diff --git a/.gitignore b/.gitignore index 9e490e608..d5eccc35c 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ !/subprojects/ /subprojects/* !/subprojects/*.wrap +!/subprojects/packagefiles /scripts/__pycache__/ !/.clang-format !/.git-blame-ignore-revs diff --git a/Minecraft.Assets/Common/Media/Controls1080.swf b/Minecraft.Assets/Common/Media/Controls1080.swf index 36051b8cd..9ec38f920 100644 Binary files a/Minecraft.Assets/Common/Media/Controls1080.swf and b/Minecraft.Assets/Common/Media/Controls1080.swf differ diff --git a/Minecraft.Assets/Common/Media/Crafting2x2Menu1080.swf b/Minecraft.Assets/Common/Media/Crafting2x2Menu1080.swf index 65cb014ab..e462de709 100644 Binary files a/Minecraft.Assets/Common/Media/Crafting2x2Menu1080.swf and b/Minecraft.Assets/Common/Media/Crafting2x2Menu1080.swf differ diff --git a/Minecraft.Assets/Common/Media/Crafting2x2MenuVita.swf b/Minecraft.Assets/Common/Media/Crafting2x2MenuVita.swf index 041e76637..27a0b580f 100644 Binary files a/Minecraft.Assets/Common/Media/Crafting2x2MenuVita.swf and b/Minecraft.Assets/Common/Media/Crafting2x2MenuVita.swf differ diff --git a/Minecraft.Assets/Common/Media/Crafting3x3MenuSplit1080.swf b/Minecraft.Assets/Common/Media/Crafting3x3MenuSplit1080.swf index cc42f3d18..155db47e8 100644 Binary files a/Minecraft.Assets/Common/Media/Crafting3x3MenuSplit1080.swf and b/Minecraft.Assets/Common/Media/Crafting3x3MenuSplit1080.swf differ diff --git a/Minecraft.Assets/Common/Media/CreateWorldMenu1080.swf b/Minecraft.Assets/Common/Media/CreateWorldMenu1080.swf index 245bbf653..282c51f8e 100644 Binary files a/Minecraft.Assets/Common/Media/CreateWorldMenu1080.swf and b/Minecraft.Assets/Common/Media/CreateWorldMenu1080.swf differ diff --git a/Minecraft.Assets/Common/Media/CreateWorldMenu480.swf b/Minecraft.Assets/Common/Media/CreateWorldMenu480.swf index 9426b616a..2773341d9 100644 Binary files a/Minecraft.Assets/Common/Media/CreateWorldMenu480.swf and b/Minecraft.Assets/Common/Media/CreateWorldMenu480.swf differ diff --git a/Minecraft.Assets/Common/Media/CreateWorldMenu720.swf b/Minecraft.Assets/Common/Media/CreateWorldMenu720.swf index b7474a63d..985ef7a1e 100644 Binary files a/Minecraft.Assets/Common/Media/CreateWorldMenu720.swf and b/Minecraft.Assets/Common/Media/CreateWorldMenu720.swf differ diff --git a/Minecraft.Assets/Common/Media/CreateWorldMenuVita.swf b/Minecraft.Assets/Common/Media/CreateWorldMenuVita.swf index 814efa9cd..f7fe1071a 100644 Binary files a/Minecraft.Assets/Common/Media/CreateWorldMenuVita.swf and b/Minecraft.Assets/Common/Media/CreateWorldMenuVita.swf differ diff --git a/Minecraft.Assets/Common/Media/CreativeMenuVita.swf b/Minecraft.Assets/Common/Media/CreativeMenuVita.swf index ecbbb3dbd..01797a065 100644 Binary files a/Minecraft.Assets/Common/Media/CreativeMenuVita.swf and b/Minecraft.Assets/Common/Media/CreativeMenuVita.swf differ diff --git a/Minecraft.Assets/Common/Media/Graphics/TutorialExitScreenshot.png b/Minecraft.Assets/Common/Media/Graphics/TutorialExitScreenshot.png index b84759627..4052436aa 100644 Binary files a/Minecraft.Assets/Common/Media/Graphics/TutorialExitScreenshot.png and b/Minecraft.Assets/Common/Media/Graphics/TutorialExitScreenshot.png differ diff --git a/Minecraft.Assets/Common/Media/HTMLColours.col b/Minecraft.Assets/Common/Media/HTMLColours.col new file mode 100644 index 000000000..21db75ae6 Binary files /dev/null and b/Minecraft.Assets/Common/Media/HTMLColours.col differ diff --git a/Minecraft.Assets/Common/Media/HTMLColours.xml b/Minecraft.Assets/Common/Media/HTMLColours.xml index ea6ef00cf..8f17132c7 100644 --- a/Minecraft.Assets/Common/Media/HTMLColours.xml +++ b/Minecraft.Assets/Common/Media/HTMLColours.xml @@ -7,14 +7,14 @@ - + - + diff --git a/Minecraft.Assets/Common/Media/HUD1080.swf b/Minecraft.Assets/Common/Media/HUD1080.swf index c9a051663..261be0e63 100644 Binary files a/Minecraft.Assets/Common/Media/HUD1080.swf and b/Minecraft.Assets/Common/Media/HUD1080.swf differ diff --git a/Minecraft.Assets/Common/Media/HUD480.swf b/Minecraft.Assets/Common/Media/HUD480.swf index d8a65a410..25cc211cc 100644 Binary files a/Minecraft.Assets/Common/Media/HUD480.swf and b/Minecraft.Assets/Common/Media/HUD480.swf differ diff --git a/Minecraft.Assets/Common/Media/HUD720.swf b/Minecraft.Assets/Common/Media/HUD720.swf index 3527bb701..b044e31fd 100644 Binary files a/Minecraft.Assets/Common/Media/HUD720.swf and b/Minecraft.Assets/Common/Media/HUD720.swf differ diff --git a/Minecraft.Assets/Common/Media/HUDSplit1080.swf b/Minecraft.Assets/Common/Media/HUDSplit1080.swf index cff338b95..c22cfc85c 100644 Binary files a/Minecraft.Assets/Common/Media/HUDSplit1080.swf and b/Minecraft.Assets/Common/Media/HUDSplit1080.swf differ diff --git a/Minecraft.Assets/Common/Media/HUDSplit720.swf b/Minecraft.Assets/Common/Media/HUDSplit720.swf index 405cb99d0..ba9937e1a 100644 Binary files a/Minecraft.Assets/Common/Media/HUDSplit720.swf and b/Minecraft.Assets/Common/Media/HUDSplit720.swf differ diff --git a/Minecraft.Assets/Common/Media/HUDVita.swf b/Minecraft.Assets/Common/Media/HUDVita.swf index 3197a7227..03b05f429 100644 Binary files a/Minecraft.Assets/Common/Media/HUDVita.swf and b/Minecraft.Assets/Common/Media/HUDVita.swf differ diff --git a/Minecraft.Assets/Common/Media/HorseInventoryMenu1080.swf b/Minecraft.Assets/Common/Media/HorseInventoryMenu1080.swf index 2f3838480..db0f4d36a 100644 Binary files a/Minecraft.Assets/Common/Media/HorseInventoryMenu1080.swf and b/Minecraft.Assets/Common/Media/HorseInventoryMenu1080.swf differ diff --git a/Minecraft.Assets/Common/Media/HorseInventoryMenu480.swf b/Minecraft.Assets/Common/Media/HorseInventoryMenu480.swf index 1c1d8177e..599c3e38b 100644 Binary files a/Minecraft.Assets/Common/Media/HorseInventoryMenu480.swf and b/Minecraft.Assets/Common/Media/HorseInventoryMenu480.swf differ diff --git a/Minecraft.Assets/Common/Media/HorseInventoryMenu720.swf b/Minecraft.Assets/Common/Media/HorseInventoryMenu720.swf index b07966bc0..eee79a2f8 100644 Binary files a/Minecraft.Assets/Common/Media/HorseInventoryMenu720.swf and b/Minecraft.Assets/Common/Media/HorseInventoryMenu720.swf differ diff --git a/Minecraft.Assets/Common/Media/HorseInventoryMenuSplit1080.swf b/Minecraft.Assets/Common/Media/HorseInventoryMenuSplit1080.swf index c90925e5c..edfa8430d 100644 Binary files a/Minecraft.Assets/Common/Media/HorseInventoryMenuSplit1080.swf and b/Minecraft.Assets/Common/Media/HorseInventoryMenuSplit1080.swf differ diff --git a/Minecraft.Assets/Common/Media/HorseInventoryMenuSplit720.swf b/Minecraft.Assets/Common/Media/HorseInventoryMenuSplit720.swf index d4814571c..5883cba44 100644 Binary files a/Minecraft.Assets/Common/Media/HorseInventoryMenuSplit720.swf and b/Minecraft.Assets/Common/Media/HorseInventoryMenuSplit720.swf differ diff --git a/Minecraft.Assets/Common/Media/HowToPlay1080.swf b/Minecraft.Assets/Common/Media/HowToPlay1080.swf index 8a74aae19..c1e911109 100644 Binary files a/Minecraft.Assets/Common/Media/HowToPlay1080.swf and b/Minecraft.Assets/Common/Media/HowToPlay1080.swf differ diff --git a/Minecraft.Assets/Common/Media/HowToPlay480.swf b/Minecraft.Assets/Common/Media/HowToPlay480.swf index 60449f751..e7cbe8088 100644 Binary files a/Minecraft.Assets/Common/Media/HowToPlay480.swf and b/Minecraft.Assets/Common/Media/HowToPlay480.swf differ diff --git a/Minecraft.Assets/Common/Media/HowToPlay720.swf b/Minecraft.Assets/Common/Media/HowToPlay720.swf index eb7652ac8..3e12dbb06 100644 Binary files a/Minecraft.Assets/Common/Media/HowToPlay720.swf and b/Minecraft.Assets/Common/Media/HowToPlay720.swf differ diff --git a/Minecraft.Assets/Common/Media/HowToPlayMenu1080.swf b/Minecraft.Assets/Common/Media/HowToPlayMenu1080.swf index 5dc90de1f..6e128ffac 100644 Binary files a/Minecraft.Assets/Common/Media/HowToPlayMenu1080.swf and b/Minecraft.Assets/Common/Media/HowToPlayMenu1080.swf differ diff --git a/Minecraft.Assets/Common/Media/HowToPlayMenu480.swf b/Minecraft.Assets/Common/Media/HowToPlayMenu480.swf index df33898a6..5e25feaf9 100644 Binary files a/Minecraft.Assets/Common/Media/HowToPlayMenu480.swf and b/Minecraft.Assets/Common/Media/HowToPlayMenu480.swf differ diff --git a/Minecraft.Assets/Common/Media/HowToPlayMenu720.swf b/Minecraft.Assets/Common/Media/HowToPlayMenu720.swf index 0f01ef702..ef85f005d 100644 Binary files a/Minecraft.Assets/Common/Media/HowToPlayMenu720.swf and b/Minecraft.Assets/Common/Media/HowToPlayMenu720.swf differ diff --git a/Minecraft.Assets/Common/Media/HowToPlayMenuSplit1080.swf b/Minecraft.Assets/Common/Media/HowToPlayMenuSplit1080.swf index 2c1515ce1..f44140b6b 100644 Binary files a/Minecraft.Assets/Common/Media/HowToPlayMenuSplit1080.swf and b/Minecraft.Assets/Common/Media/HowToPlayMenuSplit1080.swf differ diff --git a/Minecraft.Assets/Common/Media/HowToPlayMenuSplit720.swf b/Minecraft.Assets/Common/Media/HowToPlayMenuSplit720.swf index c861543a9..fe33c20e4 100644 Binary files a/Minecraft.Assets/Common/Media/HowToPlayMenuSplit720.swf and b/Minecraft.Assets/Common/Media/HowToPlayMenuSplit720.swf differ diff --git a/Minecraft.Assets/Common/Media/HowToPlayMenuVita.swf b/Minecraft.Assets/Common/Media/HowToPlayMenuVita.swf index b2db55a1e..aa1ca7a7c 100644 Binary files a/Minecraft.Assets/Common/Media/HowToPlayMenuVita.swf and b/Minecraft.Assets/Common/Media/HowToPlayMenuVita.swf differ diff --git a/Minecraft.Assets/Common/Media/HowToPlaySplit1080.swf b/Minecraft.Assets/Common/Media/HowToPlaySplit1080.swf index db8062253..3ba64d5a2 100644 Binary files a/Minecraft.Assets/Common/Media/HowToPlaySplit1080.swf and b/Minecraft.Assets/Common/Media/HowToPlaySplit1080.swf differ diff --git a/Minecraft.Assets/Common/Media/HowToPlaySplit720.swf b/Minecraft.Assets/Common/Media/HowToPlaySplit720.swf index 1735af41f..bc9542e3f 100644 Binary files a/Minecraft.Assets/Common/Media/HowToPlaySplit720.swf and b/Minecraft.Assets/Common/Media/HowToPlaySplit720.swf differ diff --git a/Minecraft.Assets/Common/Media/HowToPlayVita.swf b/Minecraft.Assets/Common/Media/HowToPlayVita.swf index 7ead38e23..51f2397d6 100644 Binary files a/Minecraft.Assets/Common/Media/HowToPlayVita.swf and b/Minecraft.Assets/Common/Media/HowToPlayVita.swf differ diff --git a/Minecraft.Assets/Common/Media/InGameHostOptions1080.swf b/Minecraft.Assets/Common/Media/InGameHostOptions1080.swf index 9caefeab7..207c86a72 100644 Binary files a/Minecraft.Assets/Common/Media/InGameHostOptions1080.swf and b/Minecraft.Assets/Common/Media/InGameHostOptions1080.swf differ diff --git a/Minecraft.Assets/Common/Media/InGameHostOptions480.swf b/Minecraft.Assets/Common/Media/InGameHostOptions480.swf index 6177ad683..f0d0e0c61 100644 Binary files a/Minecraft.Assets/Common/Media/InGameHostOptions480.swf and b/Minecraft.Assets/Common/Media/InGameHostOptions480.swf differ diff --git a/Minecraft.Assets/Common/Media/InGameHostOptions720.swf b/Minecraft.Assets/Common/Media/InGameHostOptions720.swf index 448b39a3d..f4e55bf42 100644 Binary files a/Minecraft.Assets/Common/Media/InGameHostOptions720.swf and b/Minecraft.Assets/Common/Media/InGameHostOptions720.swf differ diff --git a/Minecraft.Assets/Common/Media/InGameHostOptionsSplit1080.swf b/Minecraft.Assets/Common/Media/InGameHostOptionsSplit1080.swf index 281f75d97..a45e8a378 100644 Binary files a/Minecraft.Assets/Common/Media/InGameHostOptionsSplit1080.swf and b/Minecraft.Assets/Common/Media/InGameHostOptionsSplit1080.swf differ diff --git a/Minecraft.Assets/Common/Media/InGameHostOptionsSplit720.swf b/Minecraft.Assets/Common/Media/InGameHostOptionsSplit720.swf index 328a31151..7f76aaaf7 100644 Binary files a/Minecraft.Assets/Common/Media/InGameHostOptionsSplit720.swf and b/Minecraft.Assets/Common/Media/InGameHostOptionsSplit720.swf differ diff --git a/Minecraft.Assets/Common/Media/InGameHostOptionsVita.swf b/Minecraft.Assets/Common/Media/InGameHostOptionsVita.swf index c9f6c0d70..a7276f104 100644 Binary files a/Minecraft.Assets/Common/Media/InGameHostOptionsVita.swf and b/Minecraft.Assets/Common/Media/InGameHostOptionsVita.swf differ diff --git a/Minecraft.Assets/Common/Media/InGamePlayerOptions1080.swf b/Minecraft.Assets/Common/Media/InGamePlayerOptions1080.swf index 12a15405b..601cc467d 100644 Binary files a/Minecraft.Assets/Common/Media/InGamePlayerOptions1080.swf and b/Minecraft.Assets/Common/Media/InGamePlayerOptions1080.swf differ diff --git a/Minecraft.Assets/Common/Media/InGamePlayerOptions480.swf b/Minecraft.Assets/Common/Media/InGamePlayerOptions480.swf index 707d8fdb3..9e0b0ad98 100644 Binary files a/Minecraft.Assets/Common/Media/InGamePlayerOptions480.swf and b/Minecraft.Assets/Common/Media/InGamePlayerOptions480.swf differ diff --git a/Minecraft.Assets/Common/Media/InGamePlayerOptions720.swf b/Minecraft.Assets/Common/Media/InGamePlayerOptions720.swf index 36c7ea04b..bc9c4f6b7 100644 Binary files a/Minecraft.Assets/Common/Media/InGamePlayerOptions720.swf and b/Minecraft.Assets/Common/Media/InGamePlayerOptions720.swf differ diff --git a/Minecraft.Assets/Common/Media/InGamePlayerOptionsSplit1080.swf b/Minecraft.Assets/Common/Media/InGamePlayerOptionsSplit1080.swf index 65772a1ba..c4187a091 100644 Binary files a/Minecraft.Assets/Common/Media/InGamePlayerOptionsSplit1080.swf and b/Minecraft.Assets/Common/Media/InGamePlayerOptionsSplit1080.swf differ diff --git a/Minecraft.Assets/Common/Media/InGamePlayerOptionsSplit720.swf b/Minecraft.Assets/Common/Media/InGamePlayerOptionsSplit720.swf index 1c3b78207..ab0b3a7e6 100644 Binary files a/Minecraft.Assets/Common/Media/InGamePlayerOptionsSplit720.swf and b/Minecraft.Assets/Common/Media/InGamePlayerOptionsSplit720.swf differ diff --git a/Minecraft.Assets/Common/Media/InGamePlayerOptionsVita.swf b/Minecraft.Assets/Common/Media/InGamePlayerOptionsVita.swf index c8d8d370a..13c0b653c 100644 Binary files a/Minecraft.Assets/Common/Media/InGamePlayerOptionsVita.swf and b/Minecraft.Assets/Common/Media/InGamePlayerOptionsVita.swf differ diff --git a/Minecraft.Assets/Common/Media/Intro1080.swf b/Minecraft.Assets/Common/Media/Intro1080.swf index 92569e1a8..c9f2d3ba4 100644 Binary files a/Minecraft.Assets/Common/Media/Intro1080.swf and b/Minecraft.Assets/Common/Media/Intro1080.swf differ diff --git a/Minecraft.Assets/Common/Media/Intro480.swf b/Minecraft.Assets/Common/Media/Intro480.swf index 2b289ff8d..425c01fe6 100644 Binary files a/Minecraft.Assets/Common/Media/Intro480.swf and b/Minecraft.Assets/Common/Media/Intro480.swf differ diff --git a/Minecraft.Assets/Common/Media/Intro720.swf b/Minecraft.Assets/Common/Media/Intro720.swf index 42c086d4b..0c2bb3eb3 100644 Binary files a/Minecraft.Assets/Common/Media/Intro720.swf and b/Minecraft.Assets/Common/Media/Intro720.swf differ diff --git a/Minecraft.Assets/Common/Media/IntroVita.swf b/Minecraft.Assets/Common/Media/IntroVita.swf index 54a9b2d5e..8229640de 100644 Binary files a/Minecraft.Assets/Common/Media/IntroVita.swf and b/Minecraft.Assets/Common/Media/IntroVita.swf differ diff --git a/Minecraft.Assets/Common/Media/InventoryMenu1080.swf b/Minecraft.Assets/Common/Media/InventoryMenu1080.swf index f7e84e8a3..47434cc33 100644 Binary files a/Minecraft.Assets/Common/Media/InventoryMenu1080.swf and b/Minecraft.Assets/Common/Media/InventoryMenu1080.swf differ diff --git a/Minecraft.Assets/Common/Media/InventoryMenu480.swf b/Minecraft.Assets/Common/Media/InventoryMenu480.swf index c5facdc4d..5c129e1d1 100644 Binary files a/Minecraft.Assets/Common/Media/InventoryMenu480.swf and b/Minecraft.Assets/Common/Media/InventoryMenu480.swf differ diff --git a/Minecraft.Assets/Common/Media/InventoryMenu720.swf b/Minecraft.Assets/Common/Media/InventoryMenu720.swf index e6f3cee09..3de2da831 100644 Binary files a/Minecraft.Assets/Common/Media/InventoryMenu720.swf and b/Minecraft.Assets/Common/Media/InventoryMenu720.swf differ diff --git a/Minecraft.Assets/Common/Media/InventoryMenuSplit1080.swf b/Minecraft.Assets/Common/Media/InventoryMenuSplit1080.swf index 4f6e78c51..efe2d484a 100644 Binary files a/Minecraft.Assets/Common/Media/InventoryMenuSplit1080.swf and b/Minecraft.Assets/Common/Media/InventoryMenuSplit1080.swf differ diff --git a/Minecraft.Assets/Common/Media/InventoryMenuSplit720.swf b/Minecraft.Assets/Common/Media/InventoryMenuSplit720.swf index 1e7d00ed2..a9d13a059 100644 Binary files a/Minecraft.Assets/Common/Media/InventoryMenuSplit720.swf and b/Minecraft.Assets/Common/Media/InventoryMenuSplit720.swf differ diff --git a/Minecraft.Assets/Common/Media/InventoryMenuVita.swf b/Minecraft.Assets/Common/Media/InventoryMenuVita.swf index e38bb07dc..1eae726a8 100644 Binary files a/Minecraft.Assets/Common/Media/InventoryMenuVita.swf and b/Minecraft.Assets/Common/Media/InventoryMenuVita.swf differ diff --git a/Minecraft.Assets/Common/Media/LaunchMoreOptionsMenu1080.swf b/Minecraft.Assets/Common/Media/LaunchMoreOptionsMenu1080.swf index 3db865f86..07d812079 100644 Binary files a/Minecraft.Assets/Common/Media/LaunchMoreOptionsMenu1080.swf and b/Minecraft.Assets/Common/Media/LaunchMoreOptionsMenu1080.swf differ diff --git a/Minecraft.Assets/Common/Media/LaunchMoreOptionsMenu480.swf b/Minecraft.Assets/Common/Media/LaunchMoreOptionsMenu480.swf index ea1132c0e..666f11274 100644 Binary files a/Minecraft.Assets/Common/Media/LaunchMoreOptionsMenu480.swf and b/Minecraft.Assets/Common/Media/LaunchMoreOptionsMenu480.swf differ diff --git a/Minecraft.Assets/Common/Media/LaunchMoreOptionsMenu720.swf b/Minecraft.Assets/Common/Media/LaunchMoreOptionsMenu720.swf index 1cdf4d22c..e77beb4ec 100644 Binary files a/Minecraft.Assets/Common/Media/LaunchMoreOptionsMenu720.swf and b/Minecraft.Assets/Common/Media/LaunchMoreOptionsMenu720.swf differ diff --git a/Minecraft.Assets/Common/Media/LaunchMoreOptionsMenuVita.swf b/Minecraft.Assets/Common/Media/LaunchMoreOptionsMenuVita.swf index 21fede27f..5c1d44d9b 100644 Binary files a/Minecraft.Assets/Common/Media/LaunchMoreOptionsMenuVita.swf and b/Minecraft.Assets/Common/Media/LaunchMoreOptionsMenuVita.swf differ diff --git a/Minecraft.Assets/Common/Media/LoadMenu1080.swf b/Minecraft.Assets/Common/Media/LoadMenu1080.swf index e89f18754..d0d61ec78 100644 Binary files a/Minecraft.Assets/Common/Media/LoadMenu1080.swf and b/Minecraft.Assets/Common/Media/LoadMenu1080.swf differ diff --git a/Minecraft.Assets/Common/Media/LoadMenu480.swf b/Minecraft.Assets/Common/Media/LoadMenu480.swf index ce7ac1ad2..e105c9e78 100644 Binary files a/Minecraft.Assets/Common/Media/LoadMenu480.swf and b/Minecraft.Assets/Common/Media/LoadMenu480.swf differ diff --git a/Minecraft.Assets/Common/Media/LoadMenu720.swf b/Minecraft.Assets/Common/Media/LoadMenu720.swf index c3976f491..ef33463ea 100644 Binary files a/Minecraft.Assets/Common/Media/LoadMenu720.swf and b/Minecraft.Assets/Common/Media/LoadMenu720.swf differ diff --git a/Minecraft.Assets/Common/Media/LoadMenuVita.swf b/Minecraft.Assets/Common/Media/LoadMenuVita.swf index 8bbf94e77..a5be6f3fe 100644 Binary files a/Minecraft.Assets/Common/Media/LoadMenuVita.swf and b/Minecraft.Assets/Common/Media/LoadMenuVita.swf differ diff --git a/Minecraft.Assets/Common/Media/PressStartToPlay1080.swf b/Minecraft.Assets/Common/Media/PressStartToPlay1080.swf index d15bedfc3..87de331d7 100644 Binary files a/Minecraft.Assets/Common/Media/PressStartToPlay1080.swf and b/Minecraft.Assets/Common/Media/PressStartToPlay1080.swf differ diff --git a/Minecraft.Assets/Common/Media/PressStartToPlay720.swf b/Minecraft.Assets/Common/Media/PressStartToPlay720.swf index 302550423..2554a31df 100644 Binary files a/Minecraft.Assets/Common/Media/PressStartToPlay720.swf and b/Minecraft.Assets/Common/Media/PressStartToPlay720.swf differ diff --git a/Minecraft.Assets/Common/Media/QuadrantSignin1080.swf b/Minecraft.Assets/Common/Media/QuadrantSignin1080.swf index 760a0319c..92e2f3486 100644 Binary files a/Minecraft.Assets/Common/Media/QuadrantSignin1080.swf and b/Minecraft.Assets/Common/Media/QuadrantSignin1080.swf differ diff --git a/Minecraft.Assets/Common/Media/QuadrantSignin720.swf b/Minecraft.Assets/Common/Media/QuadrantSignin720.swf index fd3542ff8..d22c12a2d 100644 Binary files a/Minecraft.Assets/Common/Media/QuadrantSignin720.swf and b/Minecraft.Assets/Common/Media/QuadrantSignin720.swf differ diff --git a/Minecraft.Assets/Common/Media/SettingsOptionsMenu1080.swf b/Minecraft.Assets/Common/Media/SettingsOptionsMenu1080.swf index 9dc478c44..ede969352 100644 Binary files a/Minecraft.Assets/Common/Media/SettingsOptionsMenu1080.swf and b/Minecraft.Assets/Common/Media/SettingsOptionsMenu1080.swf differ diff --git a/Minecraft.Assets/Common/Media/SettingsOptionsMenu480.swf b/Minecraft.Assets/Common/Media/SettingsOptionsMenu480.swf index 717e8ac9f..d3d5b93ef 100644 Binary files a/Minecraft.Assets/Common/Media/SettingsOptionsMenu480.swf and b/Minecraft.Assets/Common/Media/SettingsOptionsMenu480.swf differ diff --git a/Minecraft.Assets/Common/Media/SettingsOptionsMenu720.swf b/Minecraft.Assets/Common/Media/SettingsOptionsMenu720.swf index 05a1bc637..ce8434bf7 100644 Binary files a/Minecraft.Assets/Common/Media/SettingsOptionsMenu720.swf and b/Minecraft.Assets/Common/Media/SettingsOptionsMenu720.swf differ diff --git a/Minecraft.Assets/Common/Media/SettingsOptionsMenuSplit1080.swf b/Minecraft.Assets/Common/Media/SettingsOptionsMenuSplit1080.swf index 5bef6ed3d..b435a238f 100644 Binary files a/Minecraft.Assets/Common/Media/SettingsOptionsMenuSplit1080.swf and b/Minecraft.Assets/Common/Media/SettingsOptionsMenuSplit1080.swf differ diff --git a/Minecraft.Assets/Common/Media/SettingsOptionsMenuSplit720.swf b/Minecraft.Assets/Common/Media/SettingsOptionsMenuSplit720.swf index e6bf0a4ed..d178d4cb5 100644 Binary files a/Minecraft.Assets/Common/Media/SettingsOptionsMenuSplit720.swf and b/Minecraft.Assets/Common/Media/SettingsOptionsMenuSplit720.swf differ diff --git a/Minecraft.Assets/Common/Media/SettingsOptionsMenuVita.swf b/Minecraft.Assets/Common/Media/SettingsOptionsMenuVita.swf index a3ca1b246..562a0c224 100644 Binary files a/Minecraft.Assets/Common/Media/SettingsOptionsMenuVita.swf and b/Minecraft.Assets/Common/Media/SettingsOptionsMenuVita.swf differ diff --git a/Minecraft.Assets/Common/Media/SkinSelectMenu1080.swf b/Minecraft.Assets/Common/Media/SkinSelectMenu1080.swf index 002d76391..5eaf67fb4 100644 Binary files a/Minecraft.Assets/Common/Media/SkinSelectMenu1080.swf and b/Minecraft.Assets/Common/Media/SkinSelectMenu1080.swf differ diff --git a/Minecraft.Assets/Common/Media/SkinSelectMenu720.swf b/Minecraft.Assets/Common/Media/SkinSelectMenu720.swf index ae8b3ed3b..059ae199f 100644 Binary files a/Minecraft.Assets/Common/Media/SkinSelectMenu720.swf and b/Minecraft.Assets/Common/Media/SkinSelectMenu720.swf differ diff --git a/Minecraft.Assets/Common/Media/SkinSelectMenuSplit1080.swf b/Minecraft.Assets/Common/Media/SkinSelectMenuSplit1080.swf index a6666acf6..03c532feb 100644 Binary files a/Minecraft.Assets/Common/Media/SkinSelectMenuSplit1080.swf and b/Minecraft.Assets/Common/Media/SkinSelectMenuSplit1080.swf differ diff --git a/Minecraft.Assets/Common/Media/SkinSelectMenuSplit720.swf b/Minecraft.Assets/Common/Media/SkinSelectMenuSplit720.swf index b090beaa9..a49f20e89 100644 Binary files a/Minecraft.Assets/Common/Media/SkinSelectMenuSplit720.swf and b/Minecraft.Assets/Common/Media/SkinSelectMenuSplit720.swf differ diff --git a/Minecraft.Assets/Common/Media/SkinSelectMenuVita.swf b/Minecraft.Assets/Common/Media/SkinSelectMenuVita.swf index 349501659..f46cda9b9 100644 Binary files a/Minecraft.Assets/Common/Media/SkinSelectMenuVita.swf and b/Minecraft.Assets/Common/Media/SkinSelectMenuVita.swf differ diff --git a/Minecraft.Assets/Common/Media/ToolTips1080.swf b/Minecraft.Assets/Common/Media/ToolTips1080.swf index 6bb2e3670..2251f80e9 100644 Binary files a/Minecraft.Assets/Common/Media/ToolTips1080.swf and b/Minecraft.Assets/Common/Media/ToolTips1080.swf differ diff --git a/Minecraft.Assets/Common/Media/ToolTips480.swf b/Minecraft.Assets/Common/Media/ToolTips480.swf index 735361e7e..3ebebb9b6 100644 Binary files a/Minecraft.Assets/Common/Media/ToolTips480.swf and b/Minecraft.Assets/Common/Media/ToolTips480.swf differ diff --git a/Minecraft.Assets/Common/Media/ToolTips720.swf b/Minecraft.Assets/Common/Media/ToolTips720.swf index f29f1649c..7c5a5ba46 100644 Binary files a/Minecraft.Assets/Common/Media/ToolTips720.swf and b/Minecraft.Assets/Common/Media/ToolTips720.swf differ diff --git a/Minecraft.Assets/Common/Media/ToolTipsSplit1080.swf b/Minecraft.Assets/Common/Media/ToolTipsSplit1080.swf index 91d6327cc..820fdda1a 100644 Binary files a/Minecraft.Assets/Common/Media/ToolTipsSplit1080.swf and b/Minecraft.Assets/Common/Media/ToolTipsSplit1080.swf differ diff --git a/Minecraft.Assets/Common/Media/ToolTipsSplit720.swf b/Minecraft.Assets/Common/Media/ToolTipsSplit720.swf index 260092c59..7c5ae7eac 100644 Binary files a/Minecraft.Assets/Common/Media/ToolTipsSplit720.swf and b/Minecraft.Assets/Common/Media/ToolTipsSplit720.swf differ diff --git a/Minecraft.Assets/Common/Media/ToolTipsVita.swf b/Minecraft.Assets/Common/Media/ToolTipsVita.swf index f8aa42fc7..c2b9dfe8d 100644 Binary files a/Minecraft.Assets/Common/Media/ToolTipsVita.swf and b/Minecraft.Assets/Common/Media/ToolTipsVita.swf differ diff --git a/Minecraft.Assets/Common/Media/TradingMenu1080.swf b/Minecraft.Assets/Common/Media/TradingMenu1080.swf index b4bd5ebdb..75b6292ef 100644 Binary files a/Minecraft.Assets/Common/Media/TradingMenu1080.swf and b/Minecraft.Assets/Common/Media/TradingMenu1080.swf differ diff --git a/Minecraft.Assets/Common/Media/TradingMenu480.swf b/Minecraft.Assets/Common/Media/TradingMenu480.swf index e6fa8b5fb..035b47470 100644 Binary files a/Minecraft.Assets/Common/Media/TradingMenu480.swf and b/Minecraft.Assets/Common/Media/TradingMenu480.swf differ diff --git a/Minecraft.Assets/Common/Media/TradingMenu720.swf b/Minecraft.Assets/Common/Media/TradingMenu720.swf index 1ce0cfb15..774e14b8e 100644 Binary files a/Minecraft.Assets/Common/Media/TradingMenu720.swf and b/Minecraft.Assets/Common/Media/TradingMenu720.swf differ diff --git a/Minecraft.Assets/Common/Media/TradingMenuSplit1080.swf b/Minecraft.Assets/Common/Media/TradingMenuSplit1080.swf index ac6c27aec..2545ebb07 100644 Binary files a/Minecraft.Assets/Common/Media/TradingMenuSplit1080.swf and b/Minecraft.Assets/Common/Media/TradingMenuSplit1080.swf differ diff --git a/Minecraft.Assets/Common/Media/TradingMenuSplit720.swf b/Minecraft.Assets/Common/Media/TradingMenuSplit720.swf index 73ece9f83..5677b19b6 100644 Binary files a/Minecraft.Assets/Common/Media/TradingMenuSplit720.swf and b/Minecraft.Assets/Common/Media/TradingMenuSplit720.swf differ diff --git a/Minecraft.Assets/Common/Media/TradingMenuVita.swf b/Minecraft.Assets/Common/Media/TradingMenuVita.swf index f36749fbb..e93787ae0 100644 Binary files a/Minecraft.Assets/Common/Media/TradingMenuVita.swf and b/Minecraft.Assets/Common/Media/TradingMenuVita.swf differ diff --git a/Minecraft.Assets/Common/Media/TutorialPopup1080.swf b/Minecraft.Assets/Common/Media/TutorialPopup1080.swf index 016195548..edd94f4f8 100644 Binary files a/Minecraft.Assets/Common/Media/TutorialPopup1080.swf and b/Minecraft.Assets/Common/Media/TutorialPopup1080.swf differ diff --git a/Minecraft.Assets/Common/Media/TutorialPopup480.swf b/Minecraft.Assets/Common/Media/TutorialPopup480.swf index fbea78ead..321dd3911 100644 Binary files a/Minecraft.Assets/Common/Media/TutorialPopup480.swf and b/Minecraft.Assets/Common/Media/TutorialPopup480.swf differ diff --git a/Minecraft.Assets/Common/Media/TutorialPopup720.swf b/Minecraft.Assets/Common/Media/TutorialPopup720.swf index 0d3dcb203..94b6958e9 100644 Binary files a/Minecraft.Assets/Common/Media/TutorialPopup720.swf and b/Minecraft.Assets/Common/Media/TutorialPopup720.swf differ diff --git a/Minecraft.Assets/Common/Media/TutorialPopupSplit1080.swf b/Minecraft.Assets/Common/Media/TutorialPopupSplit1080.swf index cdb09fc9b..bb088d8c5 100644 Binary files a/Minecraft.Assets/Common/Media/TutorialPopupSplit1080.swf and b/Minecraft.Assets/Common/Media/TutorialPopupSplit1080.swf differ diff --git a/Minecraft.Assets/Common/Media/TutorialPopupSplit720.swf b/Minecraft.Assets/Common/Media/TutorialPopupSplit720.swf index 2234e02ce..3626e9c71 100644 Binary files a/Minecraft.Assets/Common/Media/TutorialPopupSplit720.swf and b/Minecraft.Assets/Common/Media/TutorialPopupSplit720.swf differ diff --git a/Minecraft.Assets/Common/Media/TutorialPopupVita.swf b/Minecraft.Assets/Common/Media/TutorialPopupVita.swf index e671b2c5b..e48661633 100644 Binary files a/Minecraft.Assets/Common/Media/TutorialPopupVita.swf and b/Minecraft.Assets/Common/Media/TutorialPopupVita.swf differ diff --git a/Minecraft.Assets/Common/Media/font/CHS/MSYH.ttf b/Minecraft.Assets/Common/Media/font/CHS/MSYH.ttf new file mode 100644 index 000000000..96d1db199 Binary files /dev/null and b/Minecraft.Assets/Common/Media/font/CHS/MSYH.ttf differ diff --git a/Minecraft.Assets/Common/Media/font/CHT/DFHeiMedium-B5.ttf b/Minecraft.Assets/Common/Media/font/CHT/DFHeiMedium-B5.ttf new file mode 100644 index 000000000..f9fb48943 Binary files /dev/null and b/Minecraft.Assets/Common/Media/font/CHT/DFHeiMedium-B5.ttf differ diff --git a/Minecraft.Assets/Common/Media/font/CHT/DFTT_R5.TTC b/Minecraft.Assets/Common/Media/font/CHT/DFTT_R5.TTC new file mode 100644 index 000000000..34839685c Binary files /dev/null and b/Minecraft.Assets/Common/Media/font/CHT/DFTT_R5.TTC differ diff --git a/Minecraft.Assets/Common/Media/font/JPN/DF-DotDotGothic16.ttf b/Minecraft.Assets/Common/Media/font/JPN/DF-DotDotGothic16.ttf new file mode 100644 index 000000000..1be2b4b3c Binary files /dev/null and b/Minecraft.Assets/Common/Media/font/JPN/DF-DotDotGothic16.ttf differ diff --git a/Minecraft.Assets/Common/Media/font/JPN/DFGMaruGothic-Md.ttf b/Minecraft.Assets/Common/Media/font/JPN/DFGMaruGothic-Md.ttf new file mode 100644 index 000000000..4eb4eef73 Binary files /dev/null and b/Minecraft.Assets/Common/Media/font/JPN/DFGMaruGothic-Md.ttf differ diff --git a/Minecraft.Assets/Common/Media/font/KOR/BOKMSD.ttf b/Minecraft.Assets/Common/Media/font/KOR/BOKMSD.ttf new file mode 100644 index 000000000..83fe86997 Binary files /dev/null and b/Minecraft.Assets/Common/Media/font/KOR/BOKMSD.ttf differ diff --git a/Minecraft.Assets/Common/Media/font/KOR/candadite2.ttf b/Minecraft.Assets/Common/Media/font/KOR/candadite2.ttf new file mode 100644 index 000000000..f2ba094ff Binary files /dev/null and b/Minecraft.Assets/Common/Media/font/KOR/candadite2.ttf differ diff --git a/Minecraft.Assets/Common/Media/font/Mojang Font_11.ttf b/Minecraft.Assets/Common/Media/font/Mojang Font_11.ttf new file mode 100644 index 000000000..969cee585 Binary files /dev/null and b/Minecraft.Assets/Common/Media/font/Mojang Font_11.ttf differ diff --git a/Minecraft.Assets/Common/Media/font/Mojang Font_7.ttf b/Minecraft.Assets/Common/Media/font/Mojang Font_7.ttf new file mode 100644 index 000000000..727c5fb6c Binary files /dev/null and b/Minecraft.Assets/Common/Media/font/Mojang Font_7.ttf differ diff --git a/Minecraft.Assets/Common/Media/font/Mojangles.ttf b/Minecraft.Assets/Common/Media/font/Mojangles.ttf new file mode 100644 index 000000000..e7b87e9f5 Binary files /dev/null and b/Minecraft.Assets/Common/Media/font/Mojangles.ttf differ diff --git a/Minecraft.Assets/Common/Media/font/Mojangles_11.abc b/Minecraft.Assets/Common/Media/font/Mojangles_11.abc new file mode 100644 index 000000000..016fdf99c Binary files /dev/null and b/Minecraft.Assets/Common/Media/font/Mojangles_11.abc differ diff --git a/Minecraft.Assets/Common/Media/font/Mojangles_7.abc b/Minecraft.Assets/Common/Media/font/Mojangles_7.abc new file mode 100644 index 000000000..6ce066732 Binary files /dev/null and b/Minecraft.Assets/Common/Media/font/Mojangles_7.abc differ diff --git a/Minecraft.Assets/Common/Media/font/RU/SpaceMace.ttf b/Minecraft.Assets/Common/Media/font/RU/SpaceMace.ttf new file mode 100644 index 000000000..70cd3f7d9 Binary files /dev/null and b/Minecraft.Assets/Common/Media/font/RU/SpaceMace.ttf differ diff --git a/Minecraft.Assets/Common/Media/font/chars.txt b/Minecraft.Assets/Common/Media/font/chars.txt new file mode 100644 index 000000000..f7ba12aea Binary files /dev/null and b/Minecraft.Assets/Common/Media/font/chars.txt differ diff --git a/Minecraft.Assets/Common/Media/languages.loc b/Minecraft.Assets/Common/Media/languages.loc new file mode 100644 index 000000000..c267b1ac8 Binary files /dev/null and b/Minecraft.Assets/Common/Media/languages.loc differ diff --git a/Minecraft.Assets/Common/Media/movies1080.txt b/Minecraft.Assets/Common/Media/movies1080.txt index f72fa4cfb..782dd5bc3 100644 --- a/Minecraft.Assets/Common/Media/movies1080.txt +++ b/Minecraft.Assets/Common/Media/movies1080.txt @@ -7,6 +7,7 @@ skinHDHud.swf skinHDLabels.swf skinHDInGame.swf AnvilMenu1080.swf +BeaconMenu1080.swf BrewingStandMenu1080.swf ChestMenu1080.swf ChestLargeMenu1080.swf @@ -31,9 +32,12 @@ DispenserMenu1080.swf EnchantingMenu1080.swf EndPoem1080.swf EULA1080.swf +FireworksMenu1080.swf FullscreenProgress1080.swf FurnaceMenu1080.swf HelpAndOptionsMenu1080.swf +HopperMenu1080.swf +HorseInventoryMenu1080.swf HowToPlay1080.swf HowToPlayMenu1080.swf HUD1080.swf @@ -44,6 +48,8 @@ InGameTeleportMenu1080.swf Intro1080.swf InventoryMenu1080.swf JoinMenu1080.swf +LanguagesMenu1080.swf +LanguagesMenuSplit1080.swf LoadOrJoinMenu1080.swf LaunchMoreOptionsMenu1080.swf LeaderboardMenu1080.swf @@ -72,6 +78,7 @@ ToolTips1080.swf TradingMenu1080.swf TutorialPopup1080.swf AnvilMenuSplit1080.swf +BeaconMenuSplit1080.swf BrewingStandMenuSplit1080.swf ChestMenuSplit1080.swf ChestLargeMenuSplit1080.swf @@ -82,9 +89,12 @@ CreativeMenuSplit1080.swf DeathMenuSplit1080.swf DispenserMenuSplit1080.swf EnchantingMenuSplit1080.swf +FireworksMenuSplit1080.swf FurnaceMenuSplit1080.swf FullscreenProgressSplit1080.swf HelpAndOptionsMenuSplit1080.swf +HopperMenuSplit1080.swf +HorseInventoryMenuSplit1080.swf HowToPlaySplit1080.swf HowToPlayMenuSplit1080.swf HUDSplit1080.swf diff --git a/Minecraft.Assets/Common/Media/movies480.txt b/Minecraft.Assets/Common/Media/movies480.txt index a3ab2ec6f..bbc4f2a5d 100644 --- a/Minecraft.Assets/Common/Media/movies480.txt +++ b/Minecraft.Assets/Common/Media/movies480.txt @@ -1,4 +1,5 @@ AnvilMenu480.swf +BeaconMenu480.swf BrewingStandMenu480.swf ChestLargeMenu480.swf ChestMenu480.swf @@ -15,9 +16,12 @@ DLCMainMenu480.swf EnchantingMenu480.swf EndPoem480.swf EULA480.swf +FireworksMenu480.swf FullscreenProgress480.swf FurnaceMenu480.swf HelpAndOptionsMenu480.swf +HopperMenu480.swf +HorseInventoryMenu480.swf HowToPlay480.swf HowToPlayMenu480.swf HUD480.swf @@ -27,6 +31,7 @@ InGamePlayerOptions480.swf Intro480.swf InventoryMenu480.swf JoinMenu480.swf +LanguagesMenu480.swf LaunchMoreOptionsMenu480.swf LeaderboardMenu480.swf LoadMenu480.swf diff --git a/Minecraft.Assets/Common/Media/movies720.txt b/Minecraft.Assets/Common/Media/movies720.txt index ee89748b0..524fcee05 100644 --- a/Minecraft.Assets/Common/Media/movies720.txt +++ b/Minecraft.Assets/Common/Media/movies720.txt @@ -7,6 +7,7 @@ skinHud.swf skinLabels.swf skinInGame.swf AnvilMenu720.swf +BeaconMenu720.swf BrewingStandMenu720.swf ChestMenu720.swf ChestLargeMenu720.swf @@ -29,9 +30,12 @@ DispenserMenu720.swf EnchantingMenu720.swf EndPoem720.swf EULA720.swf +FireworksMenu720.swf FullscreenProgress720.swf FurnaceMenu720.swf HelpAndOptionsMenu720.swf +HopperMenu720.swf +HorseInventoryMenu720.swf HowToPlay720.swf HowToPlayMenu720.swf HUD720.swf @@ -42,6 +46,8 @@ InGameTeleportMenu720.swf Intro720.swf InventoryMenu720.swf JoinMenu720.swf +LanguagesMenu720.swf +LanguagesMenuSplit720.swf LoadOrJoinMenu720.swf LaunchMoreOptionsMenu720.swf LeaderboardMenu720.swf @@ -69,6 +75,7 @@ ToolTips720.swf TradingMenu720.swf TutorialPopup720.swf AnvilMenuSplit720.swf +BeaconMenuSplit720.swf BrewingStandMenuSplit720.swf ChestMenuSplit720.swf ChestLargeMenuSplit720.swf @@ -80,10 +87,13 @@ CreativeMenuSplit720.swf DeathMenuSplit720.swf DispenserMenuSplit720.swf EnchantingMenuSplit720.swf +FireworksMenuSplit720.swf FurnaceMenuSplit720.swf FullscreenProgressSplit720.swf GamertagSplit720.swf HelpAndOptionsMenuSplit720.swf +HopperMenuSplit720.swf +HorseInventoryMenuSplit720.swf HowToPlaySplit720.swf HowToPlayMenuSplit720.swf HUDSplit720.swf diff --git a/Minecraft.Assets/Common/Media/moviesVita.txt b/Minecraft.Assets/Common/Media/moviesVita.txt index 7a05e006e..97627ca6a 100644 --- a/Minecraft.Assets/Common/Media/moviesVita.txt +++ b/Minecraft.Assets/Common/Media/moviesVita.txt @@ -7,6 +7,7 @@ skinHud.swf skinLabels.swf skinInGame.swf AnvilMenuVita.swf +BeaconMenuVita.swf BrewingStandMenuVita.swf ChestLargeMenuVita.swf ChestMenuVita.swf @@ -24,9 +25,12 @@ DLCMainMenuVita.swf EnchantingMenuVita.swf EndPoemVita.swf EULAVita.swf +FireworksMenuVita.swf FullscreenProgressVita.swf FurnaceMenuVita.swf HelpAndOptionsMenuVita.swf +HopperMenuVita.swf +HorseInventoryMenuVita.swf HowToPlayMenuVita.swf HowToPlayVita.swf HUDVita.swf @@ -37,6 +41,7 @@ InGameTeleportMenuVita.swf IntroVita.swf InventoryMenuVita.swf JoinMenuVita.swf +LanguagesMenuVita.swf LaunchMoreOptionsMenuVita.swf LeaderboardMenuVita.swf LoadMenuVita.swf diff --git a/Minecraft.Assets/Common/Media/skin.swf b/Minecraft.Assets/Common/Media/skin.swf index c4660d594..6206ca479 100644 Binary files a/Minecraft.Assets/Common/Media/skin.swf and b/Minecraft.Assets/Common/Media/skin.swf differ diff --git a/Minecraft.Assets/Common/Media/skinGraphics.swf b/Minecraft.Assets/Common/Media/skinGraphics.swf index 8438f11d7..f0482ec7c 100644 Binary files a/Minecraft.Assets/Common/Media/skinGraphics.swf and b/Minecraft.Assets/Common/Media/skinGraphics.swf differ diff --git a/Minecraft.Assets/Common/Media/skinGraphicsHud.swf b/Minecraft.Assets/Common/Media/skinGraphicsHud.swf index 55123e69e..7f75f4234 100644 Binary files a/Minecraft.Assets/Common/Media/skinGraphicsHud.swf and b/Minecraft.Assets/Common/Media/skinGraphicsHud.swf differ diff --git a/Minecraft.Assets/Common/Media/skinGraphicsInGame.swf b/Minecraft.Assets/Common/Media/skinGraphicsInGame.swf index 6612beaf7..639f5bdae 100644 Binary files a/Minecraft.Assets/Common/Media/skinGraphicsInGame.swf and b/Minecraft.Assets/Common/Media/skinGraphicsInGame.swf differ diff --git a/Minecraft.Assets/Common/Media/skinHD.swf b/Minecraft.Assets/Common/Media/skinHD.swf index c80fa4063..12d35caf0 100644 Binary files a/Minecraft.Assets/Common/Media/skinHD.swf and b/Minecraft.Assets/Common/Media/skinHD.swf differ diff --git a/Minecraft.Assets/Common/Media/skinHDGraphics.swf b/Minecraft.Assets/Common/Media/skinHDGraphics.swf index 27e3798af..7ba08bc8c 100644 Binary files a/Minecraft.Assets/Common/Media/skinHDGraphics.swf and b/Minecraft.Assets/Common/Media/skinHDGraphics.swf differ diff --git a/Minecraft.Assets/Common/Media/skinHDGraphicsHud.swf b/Minecraft.Assets/Common/Media/skinHDGraphicsHud.swf index 2c4674746..bb51379e8 100644 Binary files a/Minecraft.Assets/Common/Media/skinHDGraphicsHud.swf and b/Minecraft.Assets/Common/Media/skinHDGraphicsHud.swf differ diff --git a/Minecraft.Assets/Common/Media/skinHDGraphicsInGame.swf b/Minecraft.Assets/Common/Media/skinHDGraphicsInGame.swf index 7a39b0999..d014d3176 100644 Binary files a/Minecraft.Assets/Common/Media/skinHDGraphicsInGame.swf and b/Minecraft.Assets/Common/Media/skinHDGraphicsInGame.swf differ diff --git a/Minecraft.Assets/Common/Media/skinHDHud.swf b/Minecraft.Assets/Common/Media/skinHDHud.swf index fcdbe396b..0e2a9ef2c 100644 Binary files a/Minecraft.Assets/Common/Media/skinHDHud.swf and b/Minecraft.Assets/Common/Media/skinHDHud.swf differ diff --git a/Minecraft.Assets/Common/Media/skinHDInGame.swf b/Minecraft.Assets/Common/Media/skinHDInGame.swf index cfc912284..b9aaa0683 100644 Binary files a/Minecraft.Assets/Common/Media/skinHDInGame.swf and b/Minecraft.Assets/Common/Media/skinHDInGame.swf differ diff --git a/Minecraft.Assets/Common/Media/skinHDLabels.swf b/Minecraft.Assets/Common/Media/skinHDLabels.swf index 5ed2b3494..dd80d1e76 100644 Binary files a/Minecraft.Assets/Common/Media/skinHDLabels.swf and b/Minecraft.Assets/Common/Media/skinHDLabels.swf differ diff --git a/Minecraft.Assets/Common/Media/skinHud.swf b/Minecraft.Assets/Common/Media/skinHud.swf index c98bf708d..31b3ff00a 100644 Binary files a/Minecraft.Assets/Common/Media/skinHud.swf and b/Minecraft.Assets/Common/Media/skinHud.swf differ diff --git a/Minecraft.Assets/Common/Media/skinInGame.swf b/Minecraft.Assets/Common/Media/skinInGame.swf index bee85d33f..fd3147b67 100644 Binary files a/Minecraft.Assets/Common/Media/skinInGame.swf and b/Minecraft.Assets/Common/Media/skinInGame.swf differ diff --git a/Minecraft.Assets/Common/Media/skinLabels.swf b/Minecraft.Assets/Common/Media/skinLabels.swf index 04a41d33e..e562acbe2 100644 Binary files a/Minecraft.Assets/Common/Media/skinLabels.swf and b/Minecraft.Assets/Common/Media/skinLabels.swf differ diff --git a/Minecraft.Assets/Common/Media/splashes.txt b/Minecraft.Assets/Common/Media/splashes.txt index c12a2f9c3..86e38941b 100644 --- a/Minecraft.Assets/Common/Media/splashes.txt +++ b/Minecraft.Assets/Common/Media/splashes.txt @@ -295,7 +295,7 @@ You can't explain that! if not ok then return end §1C§2o§3l§4o§5r§6m§7a§8t§9i§ac §kFUNKY LOL -SOPA means LOSER in Swedish +SOPA means LOSER in Swedish! Big Pointy Teeth! Bekarton guards the gate! Mmmph, mmph! @@ -309,4 +309,6 @@ Pretty scary! I have a suggestion. Now with extra hugs! Almost java 6! -Woah. \ No newline at end of file +Woah. +HURNERJSGER? +What's up, Doc? \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/1_2_2/gui/icons.png b/Minecraft.Assets/Common/res/1_2_2/gui/icons.png index e5d56d73a..89d780f08 100644 Binary files a/Minecraft.Assets/Common/res/1_2_2/gui/icons.png and b/Minecraft.Assets/Common/res/1_2_2/gui/icons.png differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Candy/Data/TexturePack.xzp b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Candy/Data/TexturePack.xzp index f2e865fc9..2eae00207 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Candy/Data/TexturePack.xzp and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Candy/Data/TexturePack.xzp differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Candy/Data/x16Data.pck b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Candy/Data/x16Data.pck index 50d5d4eee..7c5481194 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Candy/Data/x16Data.pck and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Candy/Data/x16Data.pck differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/City/Data/TexturePack.xzp b/Minecraft.Assets/Common/res/TitleUpdate/DLC/City/Data/TexturePack.xzp index b2d02efd4..d96eeeeec 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/City/Data/TexturePack.xzp and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/City/Data/TexturePack.xzp differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/City/Data/x32Data.pck b/Minecraft.Assets/Common/res/TitleUpdate/DLC/City/Data/x32Data.pck index 4968ba018..52f0f98f7 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/City/Data/x32Data.pck and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/City/Data/x32Data.pck differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Fantasy/Data/TexturePack.xzp b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Fantasy/Data/TexturePack.xzp index 87fc9d91d..00b9d61cd 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Fantasy/Data/TexturePack.xzp and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Fantasy/Data/TexturePack.xzp differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Fantasy/Data/x32Data.pck b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Fantasy/Data/x32Data.pck index 9d909b939..103a8d820 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Fantasy/Data/x32Data.pck and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Fantasy/Data/x32Data.pck differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halloween/Data/TexturePack.xzp b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halloween/Data/TexturePack.xzp index ce7ea0345..ca0a01ad5 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halloween/Data/TexturePack.xzp and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halloween/Data/TexturePack.xzp differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halloween/Data/x16Data.pck b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halloween/Data/x16Data.pck index 9da2ef1bb..f519e0062 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halloween/Data/x16Data.pck and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halloween/Data/x16Data.pck differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halo/Data/TexturePack.xzp b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halo/Data/TexturePack.xzp index 73339be42..908ce2222 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halo/Data/TexturePack.xzp and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halo/Data/TexturePack.xzp differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halo/Data/x16Data.pck b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halo/Data/x16Data.pck index 63d881945..7e2c79bf7 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halo/Data/x16Data.pck and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halo/Data/x16Data.pck differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halo/TexturePack.pck b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halo/TexturePack.pck index fddfbb38d..5820cd200 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halo/TexturePack.pck and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Halo/TexturePack.pck differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/MassEffect/Data/TexturePack.xzp b/Minecraft.Assets/Common/res/TitleUpdate/DLC/MassEffect/Data/TexturePack.xzp index 5b2df78a4..3f021e565 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/MassEffect/Data/TexturePack.xzp and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/MassEffect/Data/TexturePack.xzp differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/MassEffect/Data/masseffect.mcs b/Minecraft.Assets/Common/res/TitleUpdate/DLC/MassEffect/Data/masseffect.mcs index c3e1cb8d4..fdb2b5323 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/MassEffect/Data/masseffect.mcs and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/MassEffect/Data/masseffect.mcs differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/MassEffect/Data/x16Data.pck b/Minecraft.Assets/Common/res/TitleUpdate/DLC/MassEffect/Data/x16Data.pck index 2c01acae5..85ac50a84 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/MassEffect/Data/x16Data.pck and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/MassEffect/Data/x16Data.pck differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/MassEffect/TexturePack.pck b/Minecraft.Assets/Common/res/TitleUpdate/DLC/MassEffect/TexturePack.pck index e0576ed85..1b60faf74 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/MassEffect/TexturePack.pck and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/MassEffect/TexturePack.pck differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Natural/Data/TexturePack.xzp b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Natural/Data/TexturePack.xzp index 34f7dc99b..a5509dffa 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Natural/Data/TexturePack.xzp and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Natural/Data/TexturePack.xzp differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Natural/Data/x32Data.pck b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Natural/Data/x32Data.pck index 4224184c3..d211b05c9 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Natural/Data/x32Data.pck and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Natural/Data/x32Data.pck differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Plastic/Data/TexturePack.xzp b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Plastic/Data/TexturePack.xzp index 033840eb5..3f3cceeae 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Plastic/Data/TexturePack.xzp and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Plastic/Data/TexturePack.xzp differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Plastic/Data/x16Data.pck b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Plastic/Data/x16Data.pck index b5b5c14a6..3e9f17fd4 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Plastic/Data/x16Data.pck and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Plastic/Data/x16Data.pck differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Skyrim/Data/TexturePack.xzp b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Skyrim/Data/TexturePack.xzp index 45c24d418..a0ad59106 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Skyrim/Data/TexturePack.xzp and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Skyrim/Data/TexturePack.xzp differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Skyrim/Data/x16Data.pck b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Skyrim/Data/x16Data.pck index 82a5965dc..1560a2c10 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Skyrim/Data/x16Data.pck and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Skyrim/Data/x16Data.pck differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Skyrim/TexturePack.pck b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Skyrim/TexturePack.pck index 2dc382a1a..2f52919d5 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/DLC/Skyrim/TexturePack.pck and b/Minecraft.Assets/Common/res/TitleUpdate/DLC/Skyrim/TexturePack.pck differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildAll.cmd b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildAll.cmd deleted file mode 100644 index 061755587..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildAll.cmd +++ /dev/null @@ -1,10 +0,0 @@ -@ECHO OFF - -call .\BuildGameRule.cmd Tutorial -call .\BuildGameRule_PS3.cmd Tutorial -call .\BuildGameRule_Windows64.cmd Tutorial -call .\BuildGameRule_Durango.cmd Tutorial -call .\BuildGameRule_Orbis.cmd Tutorial -call .\BuildGameRule_PSVita.cmd Tutorial - -pause diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule.cmd b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule.cmd deleted file mode 100644 index 4594adf26..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule.cmd +++ /dev/null @@ -1,19 +0,0 @@ -ECHO OFF - -set RULENAME=%1 -cd %RULENAME% -rem set TOOLS=..\..\..\..\..\..\Tools - -ECHO "Building Localisation" -%TOOLS%\NewLocalisationPacker.exe --oldFormat Microsoft %CD%\Strings_Xbox360 %CD%\languages.loc - -ECHO "Building Game Rules" -%TOOLS%\GameRulesPacker -i %CD%\GameRules.xml -o %CD%\ -c lzxrle - -ECHO "Building DLC Pack" -%TOOLS%\DLC_DataCreator2_CL %CD%\%RULENAME%.xml - -rem Return the new tutorial. -copy %RULENAME%.pck ..\..\%RULENAME%.pck - -cd .. \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule_Durango.cmd b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule_Durango.cmd deleted file mode 100644 index bebbbd8e1..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule_Durango.cmd +++ /dev/null @@ -1,28 +0,0 @@ -@ECHO OFF - -set RULENAME=%1 -cd %RULENAME% - -rem set TOOLS=..\..\..\..\..\..\Tools - -echo Durango - -echo Building Localisation... -%TOOLS%\NewLocalisationPacker --oldFormat Microsoft %CD%\Strings_Durango %CD%\languages.loc - -echo Building Game Rules... -%TOOLS%\GameRulesPacker -i %CD%\GameRules.xml -o %CD%\ -c zlibrle - -echo Building DLC Pack... -%TOOLS%\DLC_DataCreator2_CL --LittleEndian %CD%\%RULENAME%.xml - -rem Return the new tutorial. -copy %RULENAME%.pck ..\..\%RULENAME%_Durango.pck - -echo Cleaning-up... -rem del %CD%\languages.loc -rem del %CD%\GameRules.grf -rem del %CD%\%RULENAME%.pck - -echo Finished. -cd .. \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule_Orbis.cmd b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule_Orbis.cmd deleted file mode 100644 index 3f2411a23..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule_Orbis.cmd +++ /dev/null @@ -1,28 +0,0 @@ -@ECHO OFF - -set RULENAME=%1 -cd %RULENAME% - -rem set TOOLS=..\..\..\..\..\..\Tools - -echo Orbis - -echo Building Localisation... -%TOOLS%\NewLocalisationPacker --oldFormat Sony %CD%\Strings_Orbis %CD%\languages.loc - -echo Building Game Rules... -%TOOLS%\GameRulesPacker -i %CD%\GameRules.xml -o %CD%\ -c zlibrle - -echo Building DLC Pack... -%TOOLS%\DLC_DataCreator2_CL --LittleEndian %CD%\%RULENAME%.xml - -rem Return the new tutorial. -copy %RULENAME%.pck ..\..\%RULENAME%_Orbis.pck - -echo Cleaning-up... -rem del %CD%\languages.loc -rem del %CD%\GameRules.grf -rem del %CD%\%RULENAME%.pck - -echo Finished. -cd .. \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule_PS3.cmd b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule_PS3.cmd deleted file mode 100644 index 9cdfd3878..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule_PS3.cmd +++ /dev/null @@ -1,28 +0,0 @@ -@ECHO OFF - -set RULENAME=%1 -cd %RULENAME% - -rem set TOOLS=..\..\..\..\..\..\Tools - -echo Play Station 3 - -echo Building Localisation... -%TOOLS%\NewLocalisationPacker --oldFormat Sony %CD%\Strings_PS3 %CD%\languages.loc - -echo Building Game Rules... -%TOOLS%\GameRulesPacker -i %CD%\GameRules.xml -o %CD%\ -c edgezlibrle - -echo Building DLC Pack... -%TOOLS%\DLC_DataCreator2_CL %CD%\%RULENAME%.xml - -rem Return the new tutorial. -copy %RULENAME%.pck ..\..\%RULENAME%_PS3.pck - -echo Cleaning-up... -rem del %CD%\languages.loc -rem del %CD%\GameRules.grf -rem del %CD%\%RULENAME%.pck - -echo Finished. -cd .. \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule_PSVita.cmd b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule_PSVita.cmd deleted file mode 100644 index 7891eb206..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule_PSVita.cmd +++ /dev/null @@ -1,28 +0,0 @@ -@ECHO OFF - -set RULENAME=%1 -cd %RULENAME% - -rem set TOOLS=..\..\..\..\..\..\Tools - -echo PSVita - -echo Building Localisation... -%TOOLS%\NewLocalisationPacker --oldFormat Sony %CD%\Strings_PSVita %CD%\languages.loc - -echo Building Game Rules... -%TOOLS%\GameRulesPacker -i %CD%\GameRules.xml -o %CD%\ -c zlibrle - -echo Building DLC Pack... -%TOOLS%\DLC_DataCreator2_CL --LittleEndian %CD%\%RULENAME%.xml - -rem Return the new tutorial. -copy %RULENAME%.pck ..\..\%RULENAME%_PSVita.pck - -echo Cleaning-up... -rem del %CD%\languages.loc -rem del %CD%\GameRules.grf -rem del %CD%\%RULENAME%.pck - -echo Finished. -cd .. \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule_Windows64.cmd b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule_Windows64.cmd deleted file mode 100644 index 8e9b730b8..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule_Windows64.cmd +++ /dev/null @@ -1,28 +0,0 @@ -@ECHO OFF - -set RULENAME=%1 -cd %RULENAME% - -rem set TOOLS=..\..\..\..\..\..\Tools - -echo Windows 64 - -echo Building Localisation... -%TOOLS%\NewLocalisationPacker --oldFormat Microsoft %CD%\Strings_Win64 %CD%\languages.loc - -echo Building Game Rules... -%TOOLS%\GameRulesPacker -i %CD%\GameRules.xml -o %CD%\ -c zlibrle - -echo Building DLC Pack... -%TOOLS%\DLC_DataCreator2_CL --LittleEndian %CD%\%RULENAME%.xml - -rem Return the new tutorial. -copy %RULENAME%.pck ..\..\%RULENAME%_Windows64.pck - -echo Cleaning-up... -rem del %CD%\languages.loc -rem del %CD%\GameRules.grf -rem del %CD%\%RULENAME%.pck - -echo Finished. -cd .. \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule_Xbox.cmd b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule_Xbox.cmd deleted file mode 100644 index fde982456..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/BuildGameRule_Xbox.cmd +++ /dev/null @@ -1,28 +0,0 @@ -@ECHO OFF - -set RULENAME=%1 -cd %RULENAME% - -rem set TOOLS=..\..\..\..\..\..\Tools - -echo Xbox 360 - -echo Building Localisation... -%TOOLS%\NewLocalisationPacker.exe --oldFormat Microsoft %CD%\Strings_Xbox360 %CD%\languages.loc - -echo Building Game Rules... -%TOOLS%\GameRulesPacker -i %CD%\GameRules.xml -o %CD%\ -c lzxrle - -echo Building DLC Pack... -%TOOLS%\DLC_DataCreator2_CL %CD%\%RULENAME%.xml - -rem Return the new tutorial. -copy %RULENAME%.pck ..\..\%RULENAME%_Xbox.pck - -echo Cleaning-up... -rem del %CD%\languages.loc -rem del %CD%\GameRules.grf -rem del %CD%\%RULENAME%.pck - -echo Finished. -cd .. \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/GameRules.sln b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/GameRules.sln deleted file mode 100644 index 31c1bd39b..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/GameRules.sln +++ /dev/null @@ -1,30 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GameRules", "GameRules.vcxproj", "{0DD2FD59-36AC-476F-9201-D687A4CE9E98}" -EndProject -Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 2 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = http://tfs_server:8080/tfs/storiespark - SccProjectUniqueName0 = GameRules.vcxproj - SccLocalPath0 = . - SccLocalPath1 = . - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Xbox 360 = Debug|Xbox 360 - Release|Xbox 360 = Release|Xbox 360 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0DD2FD59-36AC-476F-9201-D687A4CE9E98}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360 - {0DD2FD59-36AC-476F-9201-D687A4CE9E98}.Debug|Xbox 360.Build.0 = Debug|Xbox 360 - {0DD2FD59-36AC-476F-9201-D687A4CE9E98}.Debug|Xbox 360.Deploy.0 = Debug|Xbox 360 - {0DD2FD59-36AC-476F-9201-D687A4CE9E98}.Release|Xbox 360.ActiveCfg = Release|Xbox 360 - {0DD2FD59-36AC-476F-9201-D687A4CE9E98}.Release|Xbox 360.Build.0 = Release|Xbox 360 - {0DD2FD59-36AC-476F-9201-D687A4CE9E98}.Release|Xbox 360.Deploy.0 = Release|Xbox 360 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/GameRules.vcxproj b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/GameRules.vcxproj deleted file mode 100644 index 0bcb4e30f..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/GameRules.vcxproj +++ /dev/null @@ -1,103 +0,0 @@ - - - - - Debug - Xbox 360 - - - Release - Xbox 360 - - - - {0DD2FD59-36AC-476F-9201-D687A4CE9E98} - MakeFileProj - SAK - SAK - SAK - SAK - - - - Makefile - - - Makefile - - - - - - - - - - - - - - - _DEBUG;$(NMakePreprocessorDefinitions) - BuildGameRule.cmd Tutorial - - - GameRules.xex - NDEBUG;$(NMakePreprocessorDefinitions) - - - - - - - - CopyToHardDrive - - - - - - Designer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - true - - - - - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/GameRules.vcxproj.filters b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/GameRules.vcxproj.filters deleted file mode 100644 index 9c46ad82c..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/GameRules.vcxproj.filters +++ /dev/null @@ -1,114 +0,0 @@ - - - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {ab02d5da-7fb3-494b-a636-03764d9a8acd} - - - {e1a87048-bca2-46e6-a234-91d7d64eb983} - - - {da425f4a-cf76-48e8-87cb-d9fda0f42365} - - - {c0ba5f53-4881-495e-8158-5d87f379426d} - - - {61651432-41a1-42f0-a853-c7795d813418} - - - {e194e42b-1c9b-4e35-9a4b-dabd68eab3e0} - - - - - Tutorial - - - Tutorial\Loc - - - Tutorial\Loc\Microsoft - - - Tutorial\Loc\Microsoft - - - Tutorial\Loc\Microsoft - - - Tutorial\Loc\Microsoft - - - Tutorial\Loc\Microsoft - - - Tutorial\Loc\Microsoft - - - Tutorial\Loc\Microsoft - - - Tutorial\Loc\Microsoft - - - Tutorial\Loc\Microsoft - - - Packs - - - Tutorial\schematics - - - Tutorial\schematics - - - Tutorial\schematics - - - Tutorial\schematics - - - Tutorial\schematics - - - Tutorial\schematics - - - Tutorial\schematics - - - Tutorial\schematics - - - Tutorial\schematics - - - Tutorial\schematics - - - Tutorial\schematics - - - Tutorial\schematics - - - - - - - - - - - - - Shared - - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/GameRules.vcxproj.vspscc b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/GameRules.vcxproj.vspscc deleted file mode 100644 index b6d32892f..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/GameRules.vcxproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/GameRulesDefinition.xsd b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/GameRulesDefinition.xsd deleted file mode 100644 index a41f6865b..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/GameRulesDefinition.xsd +++ /dev/null @@ -1,2848 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Count children - - - - - Accumulate childrens goals - - - - - - - - - - Crafting Table - - - - - Chest - - - - - Furnace - - - - - Dispenser - - - - - - - - - - Mineshaft - - - - - Nether Bridge - - - - - Temples - - - - - Stronghold - - - - - Village - - - - - - - - - - SOUTH - - - - - WEST - - - - - NORTH - - - - - EAST - - - - - - - - - - NORTH - - - - - SOUTH - - - - - WEST - - - - - EAST - - - - - - - - - - Overworld - - - - - Nether - - - - - The End - - - - - - - - - - Protection - - - - - Fire Protection - - - - - Feather Falling - - - - - Blast Protection - - - - - Projectile Protection - - - - - Respiration - - - - - Aqua Affinity - - - - - Thorns - - - - - Sharpness - - - - - Smite - - - - - Bane of Arthropods - - - - - Knockback - - - - - Fire Aspect - - - - - Looting - - - - - Efficiency - - - - - Silk Touch - - - - - Unbreaking - - - - - Fortune - - - - - Power - - - - - Punch - - - - - Flame - - - - - Infinity - - - - - - - - - - Air - - - - - Stone - - - - - Grass Block - - - - - Dirt - - - - - Cobblestone - - - - - Wooden Planks - - - - - Sapling - - - - - Bedrock - - - - - Water - - - - - Water - - - - - Lava - - - - - Lava - - - - - Sand - - - - - Gravel - - - - - Gold Ore - - - - - Iron Ore - - - - - Coal Ore - - - - - Wood - - - - - Leaves - - - - - Sponge - - - - - Glass - - - - - Lapis Lazuli Ore - - - - - Lapis Lazuli Block - - - - - Dispenser - - - - - Sandstone - - - - - Note Block - - - - - Bed - - - - - Powered Rail - - - - - Detector Rail - - - - - Sticky Piston - - - - - Web - - - - - Shrub - - - - - Dead Bush - - - - - Piston - - - - - Piston - - - - - Wool - - - - - Piston - - - - - Flower - - - - - Rose - - - - - Mushroom - - - - - Mushroom - - - - - Block of Gold - - - - - Block of Iron - - - - - Stone Slab - - - - - Stone Slab - - - - - Bricks - - - - - TNT - - - - - Bookshelf - - - - - Moss Stone - - - - - Obsidian - - - - - Torch - - - - - Fire - - - - - Monster Spawner - - - - - Wooden Stairs - - - - - Chest - - - - - Redstone Dust - - - - - Diamond Ore - - - - - Block of Diamond - - - - - Crafting Table - - - - - Crops - - - - - Farmland - - - - - Furnace - - - - - Furnace - - - - - Sign - - - - - Wooden Door - - - - - Ladder - - - - - Rail - - - - - Stone Stairs - - - - - Sign - - - - - Lever - - - - - Pressure Plate - - - - - Iron Door - - - - - Pressure Plate - - - - - Redstone Ore - - - - - Redstone Ore - - - - - Redstone Torch - - - - - Redstone Torch - - - - - Button - - - - - Snow - - - - - Ice - - - - - Snow - - - - - Cactus - - - - - Clay - - - - - Sugar Cane - - - - - Jukebox - - - - - Fence - - - - - Pumpkin - - - - - Netherrack - - - - - Soul Sand - - - - - Glowstone - - - - - Portal - - - - - Jack-O-Lantern - - - - - Cake - - - - - Redstone Repeater - - - - - Redstone Repeater - - - - - Locked Chest - - - - - Trapdoor - - - - - Silverfish Stone - - - - - Stone Bricks - - - - - Mushroom - - - - - Mushroom - - - - - Iron Bars - - - - - Glass Pane - - - - - Melon - - - - - Pumpkin Stem - - - - - Melon Stem - - - - - Vines - - - - - Fence Gate - - - - - Brick Stairs - - - - - Stone Brick Stairs - - - - - Mycelium - - - - - Lily Pad - - - - - Nether Brick - - - - - Nether Brick Fence - - - - - Nether Brick Stairs - - - - - Nether Wart - - - - - Enchantment Table - - - - - Brewing Stand - - - - - Cauldron - - - - - End Portal - - - - - End Portal Frame - - - - - End Stone - - - - - Dragon Egg - - - - - Redstone Lamp - - - - - Redstone Lamp - - - - - Oak Wood Slab - - - - - Oak Wood Slab - - - - - Cocoa - - - - - Sandstone Stairs - - - - - Emerald Ore - - - - - Ender Chest - - - - - Tripwire Hook - - - - - Tripwire - - - - - Block of Emerald - - - - - Spruce Wood Stairs - - - - - Birch Wood Stairs - - - - - Jungle Wood Stairs - - - - - Cobblestone Wall - - - - - Flower Pot - - - - - Carrots - - - - - Potatoes - - - - - Button - - - - - Skull - - - - - Anvil - - - - - Nether Quartz Ore - - - - - Block of Quartz - - - - - Quartz Stairs - - - - - Carpet - - - - - - - - - - Stone - - - - - Grass Block - - - - - Dirt - - - - - Cobblestone - - - - - Wooden Planks - - - - - Sapling - - - - - Bedrock - - - - - Water - - - - - Water - - - - - Lava - - - - - Lava - - - - - Sand - - - - - Gravel - - - - - Gold Ore - - - - - Iron Ore - - - - - Coal Ore - - - - - Wood - - - - - Leaves - - - - - Sponge - - - - - Glass - - - - - Lapis Lazuli Ore - - - - - Lapis Lazuli Block - - - - - Dispenser - - - - - Sandstone - - - - - Note Block - - - - - Bed - - - - - Powered Rail - - - - - Detector Rail - - - - - Sticky Piston - - - - - Web - - - - - Tall Grass - - - - - Dead Bush - - - - - Piston - - - - - Piston - - - - - Wool - - - - - Piston - - - - - Flower - - - - - Rose - - - - - Mushroom - - - - - Mushroom - - - - - Block of Gold - - - - - Block of Iron - - - - - Stone Slab - - - - - Stone Slab - - - - - Bricks - - - - - TNT - - - - - Bookshelf - - - - - Moss Stone - - - - - Obsidian - - - - - Torch - - - - - Fire - - - - - Monster Spawner - - - - - Wooden Stairs - - - - - Chest - - - - - Redstone Dust - - - - - Diamond Ore - - - - - Block of Diamond - - - - - Crafting Table - - - - - Crops - - - - - Farmland - - - - - Furnace - - - - - Furnace - - - - - Sign - - - - - Wooden Door - - - - - Ladder - - - - - Rail - - - - - Stone Stairs - - - - - Sign - - - - - Lever - - - - - Pressure Plate - - - - - Iron Door - - - - - Pressure Plate - - - - - Redstone Ore - - - - - Redstone Ore - - - - - Redstone Torch - - - - - Redstone Torch - - - - - Button - - - - - Snow - - - - - Ice - - - - - Snow - - - - - Cactus - - - - - Clay - - - - - Sugar Cane - - - - - Jukebox - - - - - Fence - - - - - Pumpkin - - - - - Netherrack - - - - - Soul Sand - - - - - Glowstone - - - - - Portal - - - - - Jack-O-Lantern - - - - - Cake - - - - - Redstone Repeater - - - - - Redstone Repeater - - - - - Locked Chest - - - - - Trapdoor - - - - - Silverfish Stone - - - - - Stone Bricks - - - - - Mushroom - - - - - Mushroom - - - - - Iron Bars - - - - - Glass Pane - - - - - Melon - - - - - Pumpkin Stem - - - - - Melon Stem - - - - - Vines - - - - - Fence Gate - - - - - Brick Stairs - - - - - Stone Brick Stairs - - - - - Mycelium - - - - - Lily Pad - - - - - Nether Brick - - - - - Nether Brick Fence - - - - - Nether Brick Stairs - - - - - Nether Wart - - - - - Enchantment Table - - - - - Brewing Stand - - - - - Cauldron - - - - - End Portal - - - - - End Portal Frame - - - - - End Stone - - - - - Dragon Egg - - - - - Redstone Lamp - - - - - Redstone Lamp - - - - - Oak Wood Slab - - - - - Oak Wood Slab - - - - - Cocoa - - - - - Sandstone Stairs - - - - - Emerald Ore - - - - - Ender Chest - - - - - Tripwire Hook - - - - - Tripwire - - - - - Block of Emerald - - - - - Spruce Wood Stairs - - - - - Birch Wood Stairs - - - - - Jungle Wood Stairs - - - - - Cobblestone Wall - - - - - Flower Pot - - - - - Carrots - - - - - Potatoes - - - - - Button - - - - - Skull - - - - - Anvil - - - - - Nether Quartz Ore - - - - - Block of Quartz - - - - - Quartz Stairs - - - - - Carpet - - - - - Iron Shovel - - - - - Iron Pickaxe - - - - - Iron Axe - - - - - Flint and Steel - - - - - Apple - - - - - Bow - - - - - Arrow - - - - - Coal - - - - - Diamond - - - - - Iron Ingot - - - - - Gold Ingot - - - - - Iron Sword - - - - - Wooden Sword - - - - - Wooden Shovel - - - - - Wooden Pickaxe - - - - - Wooden Axe - - - - - Stone Sword - - - - - Stone Shovel - - - - - Stone Pickaxe - - - - - Stone Axe - - - - - Diamond Sword - - - - - Diamond Shovel - - - - - Diamond Pickaxe - - - - - Diamond Axe - - - - - Stick - - - - - Bowl - - - - - Mushroom Stew - - - - - Golden Sword - - - - - Golden Shovel - - - - - Golden Pickaxe - - - - - Golden Axe - - - - - String - - - - - Feather - - - - - Gunpowder - - - - - Wooden Hoe - - - - - Stone Hoe - - - - - Iron Hoe - - - - - Diamond Hoe - - - - - Golden Hoe - - - - - Seeds - - - - - Wheat - - - - - Bread - - - - - Leather Cap - - - - - Leather Tunic - - - - - Leather Pants - - - - - Leather Boots - - - - - Chain Helmet - - - - - Chain Chestplate - - - - - Chain Leggings - - - - - Chain Boots - - - - - Iron Helmet - - - - - Iron Chestplate - - - - - Iron Leggings - - - - - Iron Boots - - - - - Diamond Helmet - - - - - Diamond Chestplate - - - - - Diamond Leggings - - - - - Diamond Boots - - - - - Golden Helmet - - - - - Golden Chestplate - - - - - Golden Leggings - - - - - Golden Boots - - - - - Flint - - - - - Raw Porkchop - - - - - Cooked Porkchop - - - - - Painting - - - - - Golden Apple - - - - - Sign - - - - - Wooden Door - - - - - Bucket - - - - - Water Bucket - - - - - Lava Bucket - - - - - Minecart - - - - - Saddle - - - - - Iron Door - - - - - Redstone - - - - - Snowball - - - - - Boat - - - - - Leather - - - - - Milk Bucket - - - - - Brick - - - - - Clay - - - - - Sugar Canes - - - - - Paper - - - - - Book - - - - - Slimeball - - - - - Minecart with Chest - - - - - Minecart with Furnace - - - - - Egg - - - - - Compass - - - - - Fishing Rod - - - - - Clock - - - - - Glowstone Dust - - - - - Raw Fish - - - - - Cooked Fish - - - - - Dye Powder - - - - - Bone - - - - - Sugar - - - - - Cake - - - - - Bed - - - - - Redstone Repeater - - - - - Cookie - - - - - Map - - - - - Shears - - - - - Melon Slice - - - - - Pumpkin Seeds - - - - - Melon Seeds - - - - - Raw Beef - - - - - Steak - - - - - Raw Chicken - - - - - Cooked Chicken - - - - - Rotten Flesh - - - - - Ender Pearl - - - - - Blaze Rod - - - - - Ghast Tear - - - - - Gold Nugget - - - - - Nether Wart - - - - - {*splash*}{*prefix*}Potion {*postfix*} - - - - - Glass Bottle - - - - - Spider Eye - - - - - Fermented Spider Eye - - - - - Blaze Powder - - - - - Magma Cream - - - - - Brewing Stand - - - - - Cauldron - - - - - Eye of Ender - - - - - Glistering Melon - - - - - Spawn {*CREATURE*} - - - - - Bottle o' Enchanting - - - - - Fire Charge - - - - - Emerald - - - - - Item Frame - - - - - Flower Pot - - - - - Carrot - - - - - Potato - - - - - Baked Potato - - - - - Poisonous Potato - - - - - Golden Carrot - - - - - Skull - - - - - Carrot on a Stick - - - - - Pumpkin Pie - - - - - Enchanted Book - - - - - Nether Brick - - - - - Nether Quartz - - - - - Music Disc - "13" - - - - - Music Disc - "cat" - - - - - Music Disc - "blocks" - - - - - Music Disc - "chirp" - - - - - Music Disc - "far" - - - - - Music Disc - "mall" - - - - - Music Disc - "mellohi" - - - - - Music Disc - "stal" - - - - - Music Disc - "strad" - - - - - Music Disc - "ward" - - - - - Music Disc - "11" - - - - - Music Disc - "where are we now" - - - - - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/GameRules.grf b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/GameRules.grf deleted file mode 100644 index 3628e09a3..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/GameRules.grf and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/GameRules.grh b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/GameRules.grh deleted file mode 100644 index 602a525b8..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/GameRules.grh and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/GameRules.xml b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/GameRules.xml deleted file mode 100644 index 63094246f..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/GameRules.xml and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/de-DE.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/de-DE.lang deleted file mode 100644 index 7311b6399..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/de-DE.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Du hast {*progress*} von {*goal*} Schallplatten gefunden! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/es-ES.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/es-ES.lang deleted file mode 100644 index df6109090..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/es-ES.lang +++ /dev/null @@ -1,5 +0,0 @@ - -¡Has encontrado {*progress*} de {*goal*} discos! - - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/fr-FR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/fr-FR.lang deleted file mode 100644 index c01e36b47..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/fr-FR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Vous avez trouvé {*progress*} / {*goal*} disques ! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/it-IT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/it-IT.lang deleted file mode 100644 index ef0b627c4..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/it-IT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Hai trovato {*progress*} dischi su {*goal*}! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/ja-JP.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/ja-JP.lang deleted file mode 100644 index cae65a04d..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/ja-JP.lang +++ /dev/null @@ -1,4 +0,0 @@ - -音楽ディスクを見つけました ({*progress*}/{*goal*}) - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/ko-KR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/ko-KR.lang deleted file mode 100644 index e67d5517e..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/ko-KR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -음악 디스크 {*progress*}/{*goal*}장을 찾았습니다! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/pt-BR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/pt-BR.lang deleted file mode 100644 index 82f11c82f..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/pt-BR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Você encontrou {*progress*} de {*goal*} discos de música! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/pt-PT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/pt-PT.lang deleted file mode 100644 index 381f45670..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/pt-PT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Encontraste {*progress*} de {*goal*} Discos de Música! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/zh-CHT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/zh-CHT.lang deleted file mode 100644 index 8c04f7713..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/Microsoft/zh-CHT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -您已經找到 {*progress*}/{*goal*} 張唱片! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/en-EN.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/en-EN.lang deleted file mode 100644 index cfda2eb8c..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings/en-EN.lang +++ /dev/null @@ -1,5 +0,0 @@ - - - You have found {*progress*} of {*goal*} Music Discs! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/de-DE.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/de-DE.lang deleted file mode 100644 index 02775ada9..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/de-DE.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Du hast {*progress*} von {*goal*} Schallplatten gefunden! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/es-ES.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/es-ES.lang deleted file mode 100644 index 2d91f76e7..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/es-ES.lang +++ /dev/null @@ -1,5 +0,0 @@ - -¡Has encontrado {*progress*} de {*goal*} discos! - - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/fr-FR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/fr-FR.lang deleted file mode 100644 index eba483f88..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/fr-FR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Vous avez trouvé {*progress*} / {*goal*} disques ! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/it-IT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/it-IT.lang deleted file mode 100644 index f0883a6cb..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/it-IT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Hai trovato {*progress*} dischi su {*goal*}! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/ja-JP.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/ja-JP.lang deleted file mode 100644 index b95f86928..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/ja-JP.lang +++ /dev/null @@ -1,4 +0,0 @@ - -音楽ディスクを見つけました ({*progress*}/{*goal*}) - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/ko-KR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/ko-KR.lang deleted file mode 100644 index 87cb920dc..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/ko-KR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -음악 디스크 {*progress*}/{*goal*}장을 찾았습니다! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/pt-BR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/pt-BR.lang deleted file mode 100644 index bcfbbe79a..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/pt-BR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Você encontrou {*progress*} de {*goal*} discos de música! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/pt-PT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/pt-PT.lang deleted file mode 100644 index 917482c6c..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/pt-PT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Encontraste {*progress*} de {*goal*} Discos de Música! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/zh-CHT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/zh-CHT.lang deleted file mode 100644 index 461ae695e..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/Microsoft/zh-CHT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -您已經找到 {*progress*}/{*goal*} 張唱片! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/en-EN.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/en-EN.lang deleted file mode 100644 index 7d85ded6c..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Durango/en-EN.lang +++ /dev/null @@ -1,5 +0,0 @@ - - - You have found {*progress*} of {*goal*} Music Discs! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/da-DA.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/da-DA.lang deleted file mode 100644 index efc321d97..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/da-DA.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - Du har fundet {*progress*} af {*goal*} musikplader! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/de-DE.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/de-DE.lang deleted file mode 100644 index 02775ada9..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/de-DE.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Du hast {*progress*} von {*goal*} Schallplatten gefunden! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/es-ES.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/es-ES.lang deleted file mode 100644 index 2d91f76e7..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/es-ES.lang +++ /dev/null @@ -1,5 +0,0 @@ - -¡Has encontrado {*progress*} de {*goal*} discos! - - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/fi-FI.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/fi-FI.lang deleted file mode 100644 index 229e1e145..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/fi-FI.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - Olet löytänyt {*progress*}/{*goal*} musiikkilevyistä! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/fr-FR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/fr-FR.lang deleted file mode 100644 index eba483f88..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/fr-FR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Vous avez trouvé {*progress*} / {*goal*} disques ! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/it-IT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/it-IT.lang deleted file mode 100644 index f0883a6cb..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/it-IT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Hai trovato {*progress*} dischi su {*goal*}! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/ja-JP.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/ja-JP.lang deleted file mode 100644 index b95f86928..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/ja-JP.lang +++ /dev/null @@ -1,4 +0,0 @@ - -音楽ディスクを見つけました ({*progress*}/{*goal*}) - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/ko-KR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/ko-KR.lang deleted file mode 100644 index 87cb920dc..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/ko-KR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -음악 디스크 {*progress*}/{*goal*}장을 찾았습니다! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/la-LAS.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/la-LAS.lang deleted file mode 100644 index 61f2842b5..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/la-LAS.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - ¡Has encontrado {*progress*} de {*goal*} discos! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/nl-NL.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/nl-NL.lang deleted file mode 100644 index a1710841a..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/nl-NL.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - Je hebt {*progress*} van {*goal*} muziekplaten gevonden! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/no-NO.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/no-NO.lang deleted file mode 100644 index a3d244bed..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/no-NO.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - Du har funnet {*progress*} av {*goal*} musikkplater! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/pl-PL.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/pl-PL.lang deleted file mode 100644 index 5b5c99d2b..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/pl-PL.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - Udało ci się znaleźć {*progress*} z {*goal*} płyt muzycznych! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/pt-BR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/pt-BR.lang deleted file mode 100644 index bcfbbe79a..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/pt-BR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Você encontrou {*progress*} de {*goal*} discos de música! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/pt-PT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/pt-PT.lang deleted file mode 100644 index 917482c6c..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/pt-PT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Encontraste {*progress*} de {*goal*} Discos de Música! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/ru-RU.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/ru-RU.lang deleted file mode 100644 index 7a1c49fad..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/ru-RU.lang +++ /dev/null @@ -1,5 +0,0 @@ - - - Вы нашли {*progress*} из {*goal*} музыкальных дисков! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/sv-SV.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/sv-SV.lang deleted file mode 100644 index 3745f9daa..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/sv-SV.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - Du har hittat {*progress*} av {*goal*} musikskivor! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/tr-TR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/tr-TR.lang deleted file mode 100644 index 778361fb9..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/tr-TR.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - {*goal*} Müzik Plağından {*progress*} tanesini buldun! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/zh-CHT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/zh-CHT.lang deleted file mode 100644 index 461ae695e..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/Sony/zh-CHT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -您已經找到 {*progress*}/{*goal*} 張唱片! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/en-EN.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/en-EN.lang deleted file mode 100644 index 7d85ded6c..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Orbis/en-EN.lang +++ /dev/null @@ -1,5 +0,0 @@ - - - You have found {*progress*} of {*goal*} Music Discs! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/da-DA.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/da-DA.lang deleted file mode 100644 index efc321d97..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/da-DA.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - Du har fundet {*progress*} af {*goal*} musikplader! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/de-DE.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/de-DE.lang deleted file mode 100644 index 02775ada9..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/de-DE.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Du hast {*progress*} von {*goal*} Schallplatten gefunden! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/es-ES.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/es-ES.lang deleted file mode 100644 index 2d91f76e7..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/es-ES.lang +++ /dev/null @@ -1,5 +0,0 @@ - -¡Has encontrado {*progress*} de {*goal*} discos! - - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/fi-FI.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/fi-FI.lang deleted file mode 100644 index 229e1e145..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/fi-FI.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - Olet löytänyt {*progress*}/{*goal*} musiikkilevyistä! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/fr-FR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/fr-FR.lang deleted file mode 100644 index eba483f88..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/fr-FR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Vous avez trouvé {*progress*} / {*goal*} disques ! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/it-IT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/it-IT.lang deleted file mode 100644 index f0883a6cb..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/it-IT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Hai trovato {*progress*} dischi su {*goal*}! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/ja-JP.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/ja-JP.lang deleted file mode 100644 index b95f86928..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/ja-JP.lang +++ /dev/null @@ -1,4 +0,0 @@ - -音楽ディスクを見つけました ({*progress*}/{*goal*}) - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/ko-KR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/ko-KR.lang deleted file mode 100644 index 87cb920dc..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/ko-KR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -음악 디스크 {*progress*}/{*goal*}장을 찾았습니다! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/la-LAS.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/la-LAS.lang deleted file mode 100644 index 61f2842b5..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/la-LAS.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - ¡Has encontrado {*progress*} de {*goal*} discos! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/nl-NL.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/nl-NL.lang deleted file mode 100644 index a1710841a..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/nl-NL.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - Je hebt {*progress*} van {*goal*} muziekplaten gevonden! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/no-NO.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/no-NO.lang deleted file mode 100644 index a3d244bed..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/no-NO.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - Du har funnet {*progress*} av {*goal*} musikkplater! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/pl-PL.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/pl-PL.lang deleted file mode 100644 index 5b5c99d2b..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/pl-PL.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - Udało ci się znaleźć {*progress*} z {*goal*} płyt muzycznych! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/pt-BR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/pt-BR.lang deleted file mode 100644 index bcfbbe79a..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/pt-BR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Você encontrou {*progress*} de {*goal*} discos de música! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/pt-PT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/pt-PT.lang deleted file mode 100644 index 917482c6c..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/pt-PT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Encontraste {*progress*} de {*goal*} Discos de Música! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/ru-RU.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/ru-RU.lang deleted file mode 100644 index 7a1c49fad..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/ru-RU.lang +++ /dev/null @@ -1,5 +0,0 @@ - - - Вы нашли {*progress*} из {*goal*} музыкальных дисков! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/sv-SV.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/sv-SV.lang deleted file mode 100644 index 3745f9daa..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/sv-SV.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - Du har hittat {*progress*} av {*goal*} musikskivor! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/tr-TR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/tr-TR.lang deleted file mode 100644 index 778361fb9..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/tr-TR.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - {*goal*} Müzik Plağından {*progress*} tanesini buldun! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/zh-CHT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/zh-CHT.lang deleted file mode 100644 index 461ae695e..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/Sony/zh-CHT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -您已經找到 {*progress*}/{*goal*} 張唱片! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/en-EN.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/en-EN.lang deleted file mode 100644 index 7d85ded6c..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PS3/en-EN.lang +++ /dev/null @@ -1,5 +0,0 @@ - - - You have found {*progress*} of {*goal*} Music Discs! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/da-DA.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/da-DA.lang deleted file mode 100644 index efc321d97..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/da-DA.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - Du har fundet {*progress*} af {*goal*} musikplader! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/de-DE.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/de-DE.lang deleted file mode 100644 index 02775ada9..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/de-DE.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Du hast {*progress*} von {*goal*} Schallplatten gefunden! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/es-ES.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/es-ES.lang deleted file mode 100644 index 2d91f76e7..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/es-ES.lang +++ /dev/null @@ -1,5 +0,0 @@ - -¡Has encontrado {*progress*} de {*goal*} discos! - - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/fi-FI.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/fi-FI.lang deleted file mode 100644 index 229e1e145..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/fi-FI.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - Olet löytänyt {*progress*}/{*goal*} musiikkilevyistä! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/fr-FR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/fr-FR.lang deleted file mode 100644 index eba483f88..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/fr-FR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Vous avez trouvé {*progress*} / {*goal*} disques ! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/it-IT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/it-IT.lang deleted file mode 100644 index f0883a6cb..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/it-IT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Hai trovato {*progress*} dischi su {*goal*}! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/ja-JP.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/ja-JP.lang deleted file mode 100644 index b95f86928..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/ja-JP.lang +++ /dev/null @@ -1,4 +0,0 @@ - -音楽ディスクを見つけました ({*progress*}/{*goal*}) - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/ko-KR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/ko-KR.lang deleted file mode 100644 index 87cb920dc..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/ko-KR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -음악 디스크 {*progress*}/{*goal*}장을 찾았습니다! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/la-LAS.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/la-LAS.lang deleted file mode 100644 index 61f2842b5..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/la-LAS.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - ¡Has encontrado {*progress*} de {*goal*} discos! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/nl-NL.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/nl-NL.lang deleted file mode 100644 index a1710841a..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/nl-NL.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - Je hebt {*progress*} van {*goal*} muziekplaten gevonden! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/no-NO.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/no-NO.lang deleted file mode 100644 index a3d244bed..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/no-NO.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - Du har funnet {*progress*} av {*goal*} musikkplater! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/pl-PL.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/pl-PL.lang deleted file mode 100644 index 5b5c99d2b..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/pl-PL.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - Udało ci się znaleźć {*progress*} z {*goal*} płyt muzycznych! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/pt-BR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/pt-BR.lang deleted file mode 100644 index bcfbbe79a..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/pt-BR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Você encontrou {*progress*} de {*goal*} discos de música! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/pt-PT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/pt-PT.lang deleted file mode 100644 index 917482c6c..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/pt-PT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Encontraste {*progress*} de {*goal*} Discos de Música! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/ru-RU.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/ru-RU.lang deleted file mode 100644 index 7a1c49fad..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/ru-RU.lang +++ /dev/null @@ -1,5 +0,0 @@ - - - Вы нашли {*progress*} из {*goal*} музыкальных дисков! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/sv-SV.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/sv-SV.lang deleted file mode 100644 index 3745f9daa..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/sv-SV.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - Du har hittat {*progress*} av {*goal*} musikskivor! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/tr-TR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/tr-TR.lang deleted file mode 100644 index 778361fb9..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/tr-TR.lang +++ /dev/null @@ -1,6 +0,0 @@ - - - - {*goal*} Müzik Plağından {*progress*} tanesini buldun! - - \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/zh-CHT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/zh-CHT.lang deleted file mode 100644 index 461ae695e..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/Sony/zh-CHT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -您已經找到 {*progress*}/{*goal*} 張唱片! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/en-EN.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/en-EN.lang deleted file mode 100644 index 7d85ded6c..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_PSVita/en-EN.lang +++ /dev/null @@ -1,5 +0,0 @@ - - - You have found {*progress*} of {*goal*} Music Discs! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/de-DE.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/de-DE.lang deleted file mode 100644 index 02775ada9..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/de-DE.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Du hast {*progress*} von {*goal*} Schallplatten gefunden! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/es-ES.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/es-ES.lang deleted file mode 100644 index 2d91f76e7..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/es-ES.lang +++ /dev/null @@ -1,5 +0,0 @@ - -¡Has encontrado {*progress*} de {*goal*} discos! - - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/fr-FR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/fr-FR.lang deleted file mode 100644 index eba483f88..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/fr-FR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Vous avez trouvé {*progress*} / {*goal*} disques ! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/it-IT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/it-IT.lang deleted file mode 100644 index f0883a6cb..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/it-IT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Hai trovato {*progress*} dischi su {*goal*}! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/ja-JP.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/ja-JP.lang deleted file mode 100644 index b95f86928..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/ja-JP.lang +++ /dev/null @@ -1,4 +0,0 @@ - -音楽ディスクを見つけました ({*progress*}/{*goal*}) - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/ko-KR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/ko-KR.lang deleted file mode 100644 index 87cb920dc..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/ko-KR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -음악 디스크 {*progress*}/{*goal*}장을 찾았습니다! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/pt-BR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/pt-BR.lang deleted file mode 100644 index bcfbbe79a..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/pt-BR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Você encontrou {*progress*} de {*goal*} discos de música! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/pt-PT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/pt-PT.lang deleted file mode 100644 index 917482c6c..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/pt-PT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Encontraste {*progress*} de {*goal*} Discos de Música! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/zh-CHT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/zh-CHT.lang deleted file mode 100644 index 461ae695e..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/Microsoft/zh-CHT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -您已經找到 {*progress*}/{*goal*} 張唱片! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/en-EN.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/en-EN.lang deleted file mode 100644 index 7d85ded6c..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Win64/en-EN.lang +++ /dev/null @@ -1,5 +0,0 @@ - - - You have found {*progress*} of {*goal*} Music Discs! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/de-DE.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/de-DE.lang deleted file mode 100644 index 02775ada9..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/de-DE.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Du hast {*progress*} von {*goal*} Schallplatten gefunden! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/es-ES.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/es-ES.lang deleted file mode 100644 index 2d91f76e7..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/es-ES.lang +++ /dev/null @@ -1,5 +0,0 @@ - -¡Has encontrado {*progress*} de {*goal*} discos! - - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/fr-FR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/fr-FR.lang deleted file mode 100644 index eba483f88..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/fr-FR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Vous avez trouvé {*progress*} / {*goal*} disques ! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/it-IT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/it-IT.lang deleted file mode 100644 index f0883a6cb..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/it-IT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Hai trovato {*progress*} dischi su {*goal*}! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/ja-JP.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/ja-JP.lang deleted file mode 100644 index b95f86928..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/ja-JP.lang +++ /dev/null @@ -1,4 +0,0 @@ - -音楽ディスクを見つけました ({*progress*}/{*goal*}) - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/ko-KR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/ko-KR.lang deleted file mode 100644 index 87cb920dc..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/ko-KR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -음악 디스크 {*progress*}/{*goal*}장을 찾았습니다! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/pt-BR.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/pt-BR.lang deleted file mode 100644 index bcfbbe79a..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/pt-BR.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Você encontrou {*progress*} de {*goal*} discos de música! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/pt-PT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/pt-PT.lang deleted file mode 100644 index 917482c6c..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/pt-PT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -Encontraste {*progress*} de {*goal*} Discos de Música! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/zh-CHT.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/zh-CHT.lang deleted file mode 100644 index 461ae695e..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/Microsoft/zh-CHT.lang +++ /dev/null @@ -1,4 +0,0 @@ - -您已經找到 {*progress*}/{*goal*} 張唱片! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/en-EN.lang b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/en-EN.lang deleted file mode 100644 index 7d85ded6c..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Strings_Xbox360/en-EN.lang +++ /dev/null @@ -1,5 +0,0 @@ - - - You have found {*progress*} of {*goal*} Music Discs! - - diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Tutorial.pck b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Tutorial.pck deleted file mode 100644 index fc4b95301..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Tutorial.pck and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Tutorial.xml b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Tutorial.xml deleted file mode 100644 index 325eb3fdd..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/Tutorial.xml and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/languages.loc b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/languages.loc deleted file mode 100644 index 50ef48d4f..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/languages.loc and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Boat.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Boat.sch deleted file mode 100644 index 323e10d5b..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Boat.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/CasTes1.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/CasTes1.sch deleted file mode 100644 index de3737326..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/CasTes1.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/CasTes2.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/CasTes2.sch deleted file mode 100644 index a7140c605..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/CasTes2.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/JungleTemp.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/JungleTemp.sch deleted file mode 100644 index 9f6003b7d..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/JungleTemp.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Lava.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Lava.sch deleted file mode 100644 index 1e1624086..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Lava.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/MinecraftSign.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/MinecraftSign.sch deleted file mode 100644 index 3625264a5..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/MinecraftSign.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Mushroom.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Mushroom.sch deleted file mode 100644 index 8b012bbe1..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Mushroom.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/PillarHouse.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/PillarHouse.sch deleted file mode 100644 index ae95dcc93..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/PillarHouse.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Pyramid.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Pyramid.sch deleted file mode 100644 index 5c7ea6b29..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Pyramid.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/RuinedHouse.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/RuinedHouse.sch deleted file mode 100644 index c7844400d..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/RuinedHouse.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Ship.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Ship.sch deleted file mode 100644 index 6aa37242e..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Ship.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Smithy.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Smithy.sch deleted file mode 100644 index c18473044..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Smithy.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/SnowHouse.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/SnowHouse.sch deleted file mode 100644 index 17a3b2509..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/SnowHouse.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Spider.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Spider.sch deleted file mode 100644 index e6049259e..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Spider.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Stairs.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Stairs.sch deleted file mode 100644 index 33943c2ab..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Stairs.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/StoneCircle.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/StoneCircle.sch deleted file mode 100644 index 0c06ec537..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/StoneCircle.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/StoneTemp.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/StoneTemp.sch deleted file mode 100644 index f227b0ec4..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/StoneTemp.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Tower.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Tower.sch deleted file mode 100644 index 102fdff21..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/Tower.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/UWChamber.sch b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/UWChamber.sch deleted file mode 100644 index f1c0e2c78..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/Tutorial/schematics/UWChamber.sch and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/launchCMD.cmd b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/launchCMD.cmd deleted file mode 100644 index d21751d79..000000000 --- a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/BuildOnly/launchCMD.cmd +++ /dev/null @@ -1 +0,0 @@ -cmd & \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/Tutorial.pck b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/Tutorial.pck index 8f44945b1..e506da137 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/Tutorial.pck and b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/Tutorial.pck differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/Tutorial_Durango.pck b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/Tutorial_Durango.pck deleted file mode 100644 index d5e1d6b0a..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/Tutorial_Durango.pck and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/Tutorial_Orbis.pck b/Minecraft.Assets/Common/res/TitleUpdate/GameRules/Tutorial_Orbis.pck deleted file mode 100644 index fc4b95301..000000000 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/GameRules/Tutorial_Orbis.pck and /dev/null differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/audio/Minecraft.xgs b/Minecraft.Assets/Common/res/TitleUpdate/audio/Minecraft.xgs index 5d6c55be8..c6e34ce05 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/audio/Minecraft.xgs and b/Minecraft.Assets/Common/res/TitleUpdate/audio/Minecraft.xgs differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/audio/additional.xsb b/Minecraft.Assets/Common/res/TitleUpdate/audio/additional.xsb index e60b35246..86c6ac69a 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/audio/additional.xsb and b/Minecraft.Assets/Common/res/TitleUpdate/audio/additional.xsb differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/res/colours.col b/Minecraft.Assets/Common/res/TitleUpdate/res/colours.col index abe91ebee..ebdcf7a97 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/res/colours.col and b/Minecraft.Assets/Common/res/TitleUpdate/res/colours.col differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/res/colours.xml b/Minecraft.Assets/Common/res/TitleUpdate/res/colours.xml index f6a856457..6c45b6602 100644 --- a/Minecraft.Assets/Common/res/TitleUpdate/res/colours.xml +++ b/Minecraft.Assets/Common/res/TitleUpdate/res/colours.xml @@ -218,6 +218,10 @@ if __name__=="__main__": notecolors() + + + + @@ -263,6 +267,12 @@ if __name__=="__main__": notecolors() + + + + + + @@ -280,4 +290,10 @@ if __name__=="__main__": notecolors() + + + + + + \ No newline at end of file diff --git a/Minecraft.Assets/Common/res/TitleUpdate/res/font/Default.png b/Minecraft.Assets/Common/res/TitleUpdate/res/font/Default.png index 07ec8d9dc..9c499811b 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/res/font/Default.png and b/Minecraft.Assets/Common/res/TitleUpdate/res/font/Default.png differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/res/font/Mojangles_11.png b/Minecraft.Assets/Common/res/TitleUpdate/res/font/Mojangles_11.png index cfa864465..32cbd5152 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/res/font/Mojangles_11.png and b/Minecraft.Assets/Common/res/TitleUpdate/res/font/Mojangles_11.png differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/res/font/Mojangles_7.png b/Minecraft.Assets/Common/res/TitleUpdate/res/font/Mojangles_7.png index 9de84520c..7a1b38704 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/res/font/Mojangles_7.png and b/Minecraft.Assets/Common/res/TitleUpdate/res/font/Mojangles_7.png differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/res/items.png b/Minecraft.Assets/Common/res/TitleUpdate/res/items.png index c86026a09..5456083c0 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/res/items.png and b/Minecraft.Assets/Common/res/TitleUpdate/res/items.png differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/res/terrain.png b/Minecraft.Assets/Common/res/TitleUpdate/res/terrain.png index d5d3751d7..0246b41d9 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/res/terrain.png and b/Minecraft.Assets/Common/res/TitleUpdate/res/terrain.png differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/res/terrainMipMapLevel2.png b/Minecraft.Assets/Common/res/TitleUpdate/res/terrainMipMapLevel2.png index 771bb2d57..02686b3e9 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/res/terrainMipMapLevel2.png and b/Minecraft.Assets/Common/res/TitleUpdate/res/terrainMipMapLevel2.png differ diff --git a/Minecraft.Assets/Common/res/TitleUpdate/res/terrainMipMapLevel3.png b/Minecraft.Assets/Common/res/TitleUpdate/res/terrainMipMapLevel3.png index 900ba0f35..dddef6151 100644 Binary files a/Minecraft.Assets/Common/res/TitleUpdate/res/terrainMipMapLevel3.png and b/Minecraft.Assets/Common/res/TitleUpdate/res/terrainMipMapLevel3.png differ diff --git a/Minecraft.Assets/Common/res/gui/furnace.png b/Minecraft.Assets/Common/res/gui/furnace.png index 8527289e5..a5834e195 100644 Binary files a/Minecraft.Assets/Common/res/gui/furnace.png and b/Minecraft.Assets/Common/res/gui/furnace.png differ diff --git a/Minecraft.Assets/Windows64Media/loc/en-EN/strings.lang b/Minecraft.Assets/Windows64Media/loc/en-EN/strings.lang index c8ef73677..752552227 100644 --- a/Minecraft.Assets/Windows64Media/loc/en-EN/strings.lang +++ b/Minecraft.Assets/Windows64Media/loc/en-EN/strings.lang @@ -1,647 +1,224 @@ + - - - - - Retrieving Xbox 360 Save - - - - Getting File Details - - - - Downloading File Data (%.2fMB/%.2fMB) - - - - Converting Data for Xbox One - - - - Saving - - - - No Xbox 360 save was found - - - - - Saving incomplete - - - - Minecraft: Xbox One Edition is out of space for save data. To make room, delete other Minecraft: Xbox One Edition worlds and press retry to continue, or select disable saving to continue without saving. - - - - Select retry to reattempt saving, or select disable saving to continue without saving. - - - - Retry saving - - - - Disable saving - - - - Delete Saves - - - - - Online service is disabled on your Sony Entertainment Network account due to parental control settings. - - - - Online Service - - - - - Not Used - - - - OK - - - - Back - - - - Cancel - - - - Yes - - - - No - - - - Corrupt Save - - - - Your save data appears to be corrupt. Create a new save and overwrite the corrupt one? - - - - No Free Space - - - - Your selected storage device doesn't have enough free space to create a game save. - - - - Select again - - - - Play without saving - - - - Create a new save - - - - Overwrite save? - - - - Your selected storage device already contains this save. Is it OK to overwrite it? - - - - No - don't overwrite - - - - Overwrite and save - - - - Save failed - - - - Storage Device Problem - - - - Your storage device is unavailable or has an error - - - - Your storage device is unavailable or has an error. Please select a new storage device. - - - - Select a new storage device - - - - No storage device selected - - - - If you do not select a storage device, game saves will be disabled - - - - Select a storage device - - - - Continue without saving - - - - Your storage device has been removed. Please select a new one. - - - - Loading failed - - - - Name the save - - - - Enter a name for your savegame - - - - Return to Desktop - - - - Are you sure you want to exit the game? - - - - Signed out - - - - You have been returned to the title screen because your gamer profile was signed out - - - - The match has ended because a gamer profile was signed out - - - - Continue playing - - - - Gamer profile not online - - - - This game has some features which require an Xbox LIVE enabled gamer profile, but you are currently offline. - - - - This feature requires a gamer profile which is signed into Xbox LIVE. - - - - Connect to Xbox LIVE - - - - Continue playing offline - - - - Achievement Award Problem - - - - There was a problem accessing your gamer profile. Your achievement could not be awarded at this time. - - - - Gamer profile problem - - - - Saving of settings to gamer profile has failed. - - - - Guest Gamer Profile - - - - Guest gamer profile cannot access this feature. Please use a different gamer profile. - - - - Saving… - - - - Saving content. Please don't turn off your console. - - - - Unlock Full Game - - - - This is the Minecraft trial game. If you had the full game, you would just have earned an achievement! -Unlock the full game to experience the joy of Minecraft and to play with your friends across the globe through Xbox LIVE. -Would you like to unlock the full game? - - - - You are being returned to the main menu because of a problem reading your profile. - - - - Your selected storage device doesn't have enough free space to create a game save. - - - - Your selected storage device already contains this save. Is it OK to overwrite it? - - - - Storage Device Problem - - - - Your storage device is unavailable or has an error - - - - Your storage device is unavailable or has an error. Please select a new storage device. - - - - Select a new storage device - - - - No storage device selected - - - - If you do not select a storage device, game saves will be disabled - - - - Select a storage device - - - - Your storage device has been removed. Please select a new one. - - - - Return to Desktop - - - - You have been returned to the title screen because your gamer profile was signed out - - - - The match has ended because a gamer profile was signed out - - - - Gamer profile not online - - - - This game has some features which require an Xbox Live enabled gamer profile, but you are currently offline. - - - - This feature requires a gamer profile which is signed into Xbox Live. - - - - Connect to Xbox Live - - - - Achievement Award Problem - - - - There was a problem accessing your gamer profile. Your achievement could not be awarded at this time. - - - - Gamer profile problem - - - - Saving of settings to gamer profile has failed. - - - - Guest Gamer Profile - - - - Guest gamer profile cannot access this feature. Please use a different gamer profile. - - - - - This is the Minecraft trial game. If you had the full game, you would just have earned an achievement! - Unlock the full game to experience the joy of Minecraft and to play with your friends across the globe through Xbox Live. - Would you like to unlock the full game? - - - - - You are being returned to the main menu because of a problem reading your profile. - - New Downloadable Content is available! Access it from the Minecraft Store button on the Main Menu. - - + You can change the look of your character with a Skin Pack from the Minecraft Store. Select 'Minecraft Store' on the Main Menu to see what's available. - - + + + NOT USED + + + You can use the touchscreen on the Xbox 360 system to navigate menus! + Alter the gamma settings to make the game brighter or darker. - - + If you set the game difficulty to Peaceful, your health will automatically regenerate, and no monsters will come out at night! - - + Feed a bone to a wolf to tame it. You can then make it sit or follow you. - - + You can drop items when in the Inventory menu by moving the cursor off the menu and pressing{*CONTROLLER_VK_A*} - - + Sleeping in a bed at night will fast forward the game to dawn, but all players in a multiplayer game need to sleep in beds at the same time. - - + Harvest pork chops from pigs, and cook and eat them to regain health. - - + Harvest leather from cows, and use it to make armor. - - + If you have an empty bucket, you can fill it with milk from a cow, or water, or lava! - - + Use a hoe to prepare areas of ground for planting. - - + Spiders won't attack you during the day - unless you attack them. - - + Digging soil or sand with a spade is faster than with your hand! - - + Eating cooked pork chops gives more health than eating raw pork chops. - - + Make some torches to light up areas at night. Monsters will avoid the areas around these torches. - - + Get to destinations faster with a minecart and rail! - - + Plant some saplings and they'll grow into trees. - - + Pigmen won't attack you, unless you attack them. - - + You can change your game spawn point and skip to dawn by sleeping in a bed. - - + Hit those fireballs back at the Ghast! - - + Building a portal will allow you to travel to another dimension - The Nether. - - + Press{*CONTROLLER_VK_B*} to drop the item currently in your hand! - - + Use the right tool for the job! - - + If you can't find any coal for your torches, you can always make charcoal from trees in a furnace. - - + Digging straight down or straight up is not a great idea. - - + Bonemeal (crafted from a Skeleton bone) can be used as a fertilizer, and can make things grow instantly! - - + Creepers explode when they get close to you! - - + Obsidian is created when water hits a lava source block. - - + Lava can take minutes to disappear COMPLETELY when the source block is removed. - - + Cobblestone is resistant to Ghast fireballs, making it useful for guarding portals. - - + Blocks that can be used as a light source will melt snow and ice. This includes torches, glowstone, and Jack-O-Lanterns. - - + Take caution when building structures made of wool in open air, as lightning from thunderstorms can set wool on fire. - - + A single bucket of lava can be used in a furnace to smelt 100 blocks. - - + The instrument played by a note block depends on the material beneath it. - - + Zombies and Skeletons can survive daylight if they are in water. - - + Attacking a wolf will cause any wolves in the immediate vicinity to turn hostile and attack you. This trait is also shared by Zombie Pigmen. - - + Wolves cannot enter the Nether. - - + Wolves won't attack Creepers. - - + Chickens lay an egg every 5 to 10 minutes. - - + Obsidian can only be mined with a diamond pickaxe. - - + Creepers are the easiest obtainable source of gunpowder. - - + Placing two chests side by side will make one large chest. - - + Tame wolves show their health with the position of their tail. Feed them meat to heal them. - - + Cook cactus in a furnace to get green dye. - - + + + You'll get the latest info on this game from @4JStudios and @Kappische on twitter! + + + Don't look an Enderman in the eye! + Read the What's New section in the How To Play menus to see the latest update information about the game. - - + Stackable fences are in the game now! - - + + + minecraftforum has a section dedicated to the Xbox 360 Edition. + Some animals will follow you if you have wheat in your hand. - - + If an animal can't move more than 20 blocks in any direction, it won't despawn. - - + Music by C418! - - + Notch has over a million followers on twitter! - - + Not all Swedish people have blonde hair. Some, like Jens from Mojang, even have ginger hair! - - + + + We think 4J Studios has removed Herobrine from the Xbox 360 system game, but we're not too sure. + There will be an update to this game eventually! - - + Who is Notch? - - + Mojang has more awards than staff! - - + Some famous people play Minecraft! - - + deadmau5 likes Minecraft! - - + Do not look directly at the bugs. - - + Creepers were born from a coding bug. - - + Is it a chicken or is it a duck? - - + Were you at Minecon? - - + No-one at Mojang has ever seen junkboy's face. - - + Did you know there's a Minecraft Wiki? - - + Mojang's new office is cool! - - + + + Minecraft: Xbox 360 Edition broke lots of records! + Minecon 2013 was in Orlando, Florida, USA! - - + .party() was excellent! - - + Always assume rumors are false, rather than assuming they're true! - - + {*T3*}HOW TO PLAY : BASICS{*ETW*}{*B*}{*B*} Minecraft is a game about placing blocks to build anything you can imagine. At night monsters come out, make sure to build a shelter before that happens.{*B*}{*B*} @@ -651,15 +228,13 @@ Press{*CONTROLLER_ACTION_JUMP*} to jump.{*B*}{*B*} Push{*CONTROLLER_ACTION_MOVE*} forward twice in rapid succession to sprint. While you hold {*CONTROLLER_ACTION_MOVE*} forward, the character will continue to sprint unless they run out of sprint time or the Food Bar has less than{*ICON_SHANK_03*}.{*B*}{*B*} Hold{*CONTROLLER_ACTION_ACTION*} to mine and chop using your hand or whatever you are holding. You may need to craft a tool to mine some blocks.{*B*}{*B*} If you are holding an item in your hand, use{*CONTROLLER_ACTION_USE*} to use that item, or press{*CONTROLLER_ACTION_DROP*} to drop that item. - - + {*T3*}HOW TO PLAY : HUD{*ETW*}{*B*}{*B*} The HUD shows information about your status; your health, your remaining oxygen when you are under water, your hunger level (you need to eat to replenish this), and your armor if you are wearing any. If you lose some health, but have a food bar with 9 or more{*ICON_SHANK_01*} in it, your health will automatically replenish. Eating food will replenish your food bar.{*B*} The Experience Bar is also shown here, with a numeric value to show your Experience Level, and the bar indicating how many Experience Points are required to increase your Experience Level. Experience Points are gained by collecting the Experience Orbs dropped by mobs when they die, mining certain block types, breeding animals, fishing, and smelting ores in a furnace.{*B*}{*B*} It also shows the items that are available to use. Use{*CONTROLLER_ACTION_LEFT_SCROLL*} and{*CONTROLLER_ACTION_RIGHT_SCROLL*} to change the item in your hand. - - + {*T3*}HOW TO PLAY : INVENTORY{*ETW*}{*B*}{*B*} Use{*CONTROLLER_ACTION_INVENTORY*} to view your inventory.{*B*}{*B*} @@ -669,39 +244,34 @@ Move the item with the pointer over another space in the inventory and place it If an item you are over is armor, you will be shown a tooltip to enable a quick move of this to the right armor slot in the inventory.{*B*}{*B*} It is possible to change the color of your Leather Armor by dying it, you can do this in the inventory menu by holding the dye in your pointer, then pressing{*CONTROLLER_VK_X*} whilst the pointer is over the piece you wish to dye. - - + {*T3*}HOW TO PLAY : CHEST{*ETW*}{*B*}{*B*} Once you have crafted a Chest, you can place this in the world and then use it with{*CONTROLLER_ACTION_USE*} to store items from your inventory.{*B*}{*B*} Use the pointer to move items between your inventory and the chest.{*B*}{*B*} Items in the chest will be stored there for you to swap back into your inventory again later. - - + {*T3*}HOW TO PLAY : LARGE CHEST{*ETW*}{*B*}{*B*} Two chests placed next to each other will be combined to form a Large Chest. This can store even more items.{*B*}{*B*} It is used in the same way as a normal chest. - - + {*T3*}HOW TO PLAY : CRAFTING{*ETW*}{*B*}{*B*} In the Crafting interface, you can combine items from your inventory to create new types of items. Use{*CONTROLLER_ACTION_CRAFTING*} to open the crafting interface.{*B*}{*B*} Scroll through the tabs at the top using{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to select the type of item you wish to craft, then use{*CONTROLLER_MENU_NAVIGATE*} to select the item to craft.{*B*}{*B*} The crafting area shows the items required to craft the new item. Press{*CONTROLLER_VK_A*} to craft the item and place it in your inventory. - - + {*T3*}HOW TO PLAY : CRAFTING TABLE{*ETW*}{*B*}{*B*} You can craft larger items using a Crafting Table.{*B*}{*B*} Place the table in the world and press{*CONTROLLER_ACTION_USE*} to use it.{*B*}{*B*} Crafting on a table works in the same way as basic crafting, but you have a larger crafting area, and a more varied selection of items to craft. - - + {*T3*}HOW TO PLAY : FURNACE{*ETW*}{*B*}{*B*} A Furnace allows you to change items by firing them. For example, you can turn iron ore into iron ingots in the furnace.{*B*}{*B*} @@ -710,16 +280,14 @@ You need to put some fuel into the bottom of the furnace, and the item to be fir When your items have been fired, you can move them from the output area into your inventory.{*B*}{*B*} If an item you are over is an ingredient or fuel for the furnace, you will be shown tooltips to enable a quick move of this to the furnace. - - + {*T3*}HOW TO PLAY : DISPENSER{*ETW*}{*B*}{*B*} A Dispenser is used to shoot out items. You will need to place a switch, for example a lever, next to the dispenser to trigger it.{*B*}{*B*} To fill the dispenser with items press{*CONTROLLER_ACTION_USE*}, then move the items that you want to dispense from your inventory into the dispenser.{*B*}{*B*} Now when you use the switch, the dispenser will shoot out an item. - - + {*T3*}HOW TO PLAY : BREWING{*ETW*}{*B*}{*B*} Brewing potions requires a Brewing Stand, which can be built at a crafting table. Every potion starts off with a bottle of water, which is made by filling a Glass Bottle with water from a Cauldron, or a water source.{*B*} @@ -727,7 +295,6 @@ A Brewing Stand has three slots for bottles, so can make three potions at the sa Putting a potion ingredient in the top position at the Brewing Stand will make a base potion after a short time. This doesn't have any effect by itself, but brewing another ingredient with this base potion will give you a potion with an effect.{*B*} Once you have this potion you can add a third ingredient to make the effect last longer (using Redstone Dust), be more intense (using Glowstone Dust), or turn into a harmful potion (using a Fermented Spider Eye).{*B*} You can also add gunpowder to any potion to turn it into a Splash Potion, which can then be thrown. The thrown Splash Potion will cause the potion effect to apply over the area it lands in.{*B*} - The source ingredients for potions are :-{*B*}{*B*} * {*T2*}Nether Wart{*ETW*}{*B*} * {*T2*}Spider Eye{*ETW*}{*B*} @@ -739,11 +306,9 @@ The source ingredients for potions are :-{*B*}{*B*} * {*T2*}Redstone Dust{*ETW*}{*B*} * {*T2*}Glowstone Dust{*ETW*}{*B*} * {*T2*}Fermented Spider Eye{*ETW*}{*B*}{*B*} - You'll need to experiment with combinations of ingredients in order to find out all the different potions you can make. - - + {*T3*}HOW TO PLAY : ENCHANTING{*ETW*}{*B*}{*B*} The Experience Points collected when a mob dies, or when certain blocks are mined or smelted in a furnace, can be used to enchant some tools, weapons, armor and books.{*B*} @@ -754,14 +319,12 @@ If the Enchantment Table is surrounded by Bookshelves (up to a maximum of 15 Boo All the ingredients for an Enchantment Table can be found within the villages in a world, or by mining and cultivation of the world.{*B*}{*B*} Enchanted Books are used at the Anvil to apply enchantments to items. This gives you more control over which enchantments you would like on your items.{*B*} - - + {*T3*}HOW TO PLAY : FARMING ANIMALS{*ETW*}{*B*}{*B*} If you want to keep your animals in the one place, build a fenced area of less than 20x20 blocks and have your animals inside it. This ensures they will still be there when you come back to see them. - - + {*T3*}HOW TO PLAY : BREEDING ANIMALS{*ETW*}{*B*}{*B*} The animals in Minecraft can breed, and will produce baby versions of themselves!{*B*} @@ -770,199 +333,185 @@ Feed Wheat to a cow, mooshroom or sheep, Carrots to a pig, Wheat Seeds or Nether When two animals of the same species meet, and both are in Love Mode, they will kiss for a few seconds, and then a baby animal will appear. The baby animal will follow their parents for a while before growing into a full sized animal itself.{*B*} After being in Love Mode, an animal will not be able to enter it again for about five minutes.{*B*} There is a limit on the number of animals it is possible to have in a world, so you may find the animals don't breed when you have a lot of them. - - + {*T3*}HOW TO PLAY : NETHER PORTAL{*ETW*}{*B*}{*B*} A Nether Portal allows the player to travel between the Overworld and the Nether world. The Nether world can be used to fast-travel in the Overworld - traveling one block distance in the Nether is equivalent to traveling 3 blocks in the Overworld, so when you build a portal in the Nether world and exit through it, you will be 3 times further away from your entry point.{*B*}{*B*} A minimum of 10 Obsidian blocks are required to build the portal, and the portal needs to be 5 blocks high by 4 blocks wide by 1 block deep. Once the portal frame is built, the space inside the frame needs to be set on fire to activate it. This can be done using the Flint and Steel item, or the Fire Charge item.{*B*}{*B*} Examples of portal construction are shown in the picture to the right. - - + + + {*T3*}HOW TO PLAY : MULTIPLAYER{*ETW*}{*B*}{*B*} +Minecraft on the Xbox 360 system is a multiplayer game by default.{*B*}{*B*} +When you start or join an online game, it will be visible to people in your friends list (unless you've selected Invite Only when hosting the game), and if they join the game, it will also be visible to people in their friends list (if you have selected the Allow Friends of Friends option).{*B*} +When you are in a game, you can press the SELECT button to bring up a list of all other players in the game, and Kick players from the game. + + + {*T3*}HOW TO PLAY : SHARING SCREENSHOTS{*ETW*}{*B*}{*B*} +You can capture a screenshot from your game by bringing up the Pause Menu, and pressing{*CONTROLLER_VK_Y*} to Share to Facebook. You'll be presented with a miniature version of your screenshot, and can edit the text associated with the Facebook post.{*B*}{*B*} +There's a camera mode especially for taking these screenshots, so that you can see the front of your character in the shot - press{*CONTROLLER_ACTION_CAMERA*} until you can see the front view of your character before pressing{*CONTROLLER_VK_Y*} to Share.{*B*}{*B*} +Online ID's will not be displayed in the screenshot. + {*T3*}HOW TO PLAY : BANNING LEVELS{*ETW*}{*B*}{*B*} If you find offensive content within a level you are playing, you can choose to add the level to your Banned Levels list. If you would like to do this, bring up the Pause menu, then press{*CONTROLLER_VK_RB*} to select the Ban Level tooltip. When you attempt to join this level in future, you will be notified that the level is in your Banned Levels list, and given the option to remove it from the list and continue into the level, or back out. - - + + + {*T3*}HOW TO PLAY : CREATIVE MODE{*ETW*}{*B*}{*B*} +The creative mode interface allows any item in the game to be moved into the player’s inventory without the need for mining or crafting the item. +The items in the player's inventory will not be removed when they are placed or used in the world, and this allows the player to focus on building rather than resource gathering.{*B*} +If you create, load or save a world in Creative Mode, that world will have trophies and leaderboard updates disabled, even if it is then loaded in Survival Mode.{*B*} +To fly when in Creative Mode, press{*CONTROLLER_ACTION_JUMP*} twice quickly. To exit flying, repeat the action. To fly faster, push{*CONTROLLER_ACTION_MOVE*} forward twice in rapid succession while flying. +When in flying mode, you can hold down{*CONTROLLER_ACTION_JUMP*} to move up and{*CONTROLLER_ACTION_SNEAK*} to move down, or use{*CONTROLLER_ACTION_DPAD_UP*} to move up, {*CONTROLLER_ACTION_DPAD_DOWN*} to move down, +{*CONTROLLER_ACTION_DPAD_LEFT*} to move left, and {*CONTROLLER_ACTION_DPAD_RIGHT*} to move right. + {*T3*}HOW TO PLAY : HOST AND PLAYER OPTIONS{*ETW*}{*B*}{*B*} - {*T1*}Game Options{*ETW*}{*B*} When loading or creating a world, you can press the "More Options" button to enter a menu that allows more control over your game.{*B*}{*B*} - {*T2*}Player vs Player{*ETW*}{*B*} When enabled, players can inflict damage on other players. This option only affects Survival mode.{*B*}{*B*} - {*T2*}Trust Players{*ETW*}{*B*} When disabled, players joining the game are restricted in what they can do. They are not able to mine or use items, place blocks, use doors and switches, use containers, attack players or attack animals. You can change these options for a specific player using the in-game menu.{*B*}{*B*} - {*T2*}Fire Spreads{*ETW*}{*B*} When enabled, fire may spread to nearby flammable blocks. This option can also be changed from within the game.{*B*}{*B*} - {*T2*}TNT Explodes{*ETW*}{*B*} When enabled, TNT will explode when detonated. This option can also be changed from within the game.{*B*}{*B*} - {*T2*}Host Privileges{*ETW*}{*B*} When enabled, the host can toggle their ability to fly, disable exhaustion, and make themselves invisible from the in-game menu. {*DISABLES_ACHIEVEMENTS*}{*B*}{*B*} - + {*T2*}Daylight Cycle{*ETW*}{*B*} + When disabled, the time of day will not change.{*B*}{*B*} + {*T2*}Keep Inventory{*ETW*}{*B*} + When enabled, players will keep their inventory when they die.{*B*}{*B*} + {*T2*}Mob Spawning{*ETW*}{*B*} + When disabled, mobs will not spawn naturally.{*B*}{*B*} + {*T2*}Mob Griefing{*ETW*}{*B*} + When disabled, prevents monsters and animals from changing blocks (for example, Creeper explosions won't destroy blocks and Sheep won't remove Grass) or picking up items.{*B*}{*B*} + {*T2*}Mob Loot{*ETW*}{*B*} + When disabled, monsters and animals will not drop loot (for example, Creepers won't drop gunpowder).{*B*}{*B*} + {*T2*}Tile Drops{*ETW*}{*B*} + When disabled, blocks will not drop items when destroyed (for example, Stone blocks won't drop Cobblestone).{*B*}{*B*} + {*T2*}Natural Regeneration{*ETW*}{*B*} + When disabled, players will not regenerate health naturally.{*B*}{*B*} {*T1*}World Generation Options{*ETW*}{*B*} When creating a new world there are some additional options.{*B*}{*B*} - {*T2*}Generate Structures{*ETW*}{*B*} When enabled, structures such as Villages and Strongholds will generate in the world.{*B*}{*B*} - {*T2*}Superflat World{*ETW*}{*B*} When enabled, a completely flat world will be generated in the Overworld and in the Nether.{*B*}{*B*} - {*T2*}Bonus Chest{*ETW*}{*B*} When enabled, a chest containing some useful items will be created near the player spawn point.{*B*}{*B*} - {*T2*}Reset Nether{*ETW*}{*B*} When enabled, the Nether will be re-generated. This is useful if you have an older save where Nether Fortresses were not present.{*B*}{*B*} - {*T1*}In-Game Options{*ETW*}{*B*} While in the game a number of options can be accessed by pressing {*BACK_BUTTON*} to bring up the in-game menu.{*B*}{*B*} - {*T2*}Host Options{*ETW*}{*B*} The host player, and any players set as moderators can access the "Host Option" menu. In this menu they can enable and disable fire spreading and TNT exploding.{*B*}{*B*} - {*T1*}Player Options{*ETW*}{*B*} To modify the privileges for a player, select their name and press{*CONTROLLER_VK_A*} to bring up the player privileges menu where you can use the following options.{*B*}{*B*} - {*T2*}Can Build And Mine{*ETW*}{*B*} This option is only available when "Trust Players" is turned off. When this option is enabled, the player is able to interact with the world as normal. When disabled the player will not be able to place or destroy blocks, or interact with many items and blocks.{*B*}{*B*} - {*T2*}Can Use Doors and Switches{*ETW*}{*B*} This option is only available when "Trust Players" is turned off. When this option is disabled, the player will not be able to use doors and switches.{*B*}{*B*} - {*T2*}Can Open Containers{*ETW*}{*B*} This option is only available when "Trust Players" is turned off. When this option is disabled, the player will not be able to open containers, such as chests.{*B*}{*B*} - {*T2*}Can Attack Players{*ETW*}{*B*} This option is only available when "Trust Players" is turned off. When this option is disabled the player will not be able to cause damage to other players.{*B*}{*B*} - {*T2*}Can Attack Animals{*ETW*}{*B*} This option is only available when "Trust Players" is turned off. When this option is disabled the player will not be able to cause damage to animals.{*B*}{*B*} - {*T2*}Moderator{*ETW*}{*B*} When this option is enabled, the player is able to change privileges for other players (except the host) if "Trust Players" is turned off, kick players and they can enable and disable fire spreading and TNT exploding.{*B*}{*B*} - {*T2*}Kick Player{*ETW*}{*B*} - For players that are not on the same {*PLATFORM_NAME*} console as the host player, selecting this option will kick the player from the game and any other players on their {*PLATFORM_NAME*} console. This player will not be able to rejoin the game until it is restarted.{*B*}{*B*} - + {*KICK_PLAYER_DESCRIPTION*}{*B*}{*B*} {*T1*}Host Player Options{*ETW*}{*B*} If "Host Privileges" is enabled the host player can modify some privileges for themselves. To modify the privileges for a player, select their name and press{*CONTROLLER_VK_A*} to bring up the player privileges menu where you can use the following options.{*B*}{*B*} - {*T2*}Can Fly{*ETW*}{*B*} When this option is enabled, the player is able to fly. This option is only relevant to Survival mode, as flying is enabled for all players in Creative mode.{*B*}{*B*} - {*T2*}Disable Exhaustion{*ETW*}{*B*} This option only affects Survival mode. When enabled, physical activities (walking/sprinting/jumping etc.) do not decrease the food bar. However, if the player becomes injured, the food bar will slowly decrease while the player is healing.{*B*}{*B*} - {*T2*}Invisible{*ETW*}{*B*} When this option is enabled, the player is not visible to other players and is invulnerable.{*B*}{*B*} - {*T2*}Can Teleport{*ETW*}{*B*} This allows the player to move players or themselves to other players in the world. - - + + + For players that are not on the same Xbox 360 system as the host player, selecting this option will kick the player from the game and any other players on their Xbox 360 system. This player will not be able to rejoin the game until it is restarted. + Next Page - - + Previous Page - - + Basics - - + HUD - - + Inventory - - + Chests - - + Crafting - - + Furnace - - + Dispenser - - + Farming Animals - - + Breeding Animals - - + Brewing - - + Enchantment - - + Nether Portal - - + Multiplayer - - + Sharing Screenshots - - + Banning Levels - - + Creative Mode - - + Host and Player Options - - + Trading - - + Anvil - - + The End - - + {*T3*}HOW TO PLAY : THE END{*ETW*}{*B*}{*B*} The End is another dimension in the game, which is reached through an active End Portal. The End Portal can be found in a Stronghold, which is deep underground in the Overworld.{*B*} To activate the End Portal, you'll need to put an Eye of Ender into any End Portal Frame without one.{*B*} -Once the portal is active, jump into it to go to The End.{*B*}{*B*} +Once the portal is active, jump in to it to go to The End.{*B*}{*B*} In The End you will meet the Ender Dragon, a fierce and powerful enemy, along with many Enderman, so you will have to be well prepared for the battle before going there!{*B*}{*B*} You'll find that there are Ender Crystals on top of eight Obsidian spikes that the Ender Dragon uses to heal itself, so the first step in the battle is to destroy each of these.{*B*} @@ -973,5567 +522,4993 @@ Avoid the acid breath, and target the Ender Dragon's eyes for the best results. Once you are in The End, your friends will be able to see the location of the End Portal within the Stronghold on their maps, so they can easily join you. - - + Sprint - - + What's New - - + - -{*T3*}{*TITLE_UPDATE_NAME*}{*ETW*}{*B*}{*B*} -{*T3*}Changes and Additions{*ETW*}{*B*}{*B*} -- Added new items - Emerald, Emerald Ore, Block of Emerald, Ender Chest, Tripwire Hook, Enchanted Golden Apple, Anvil, Flower Pot, Cobblestone Walls, Mossy Cobblestone Walls, Wither Painting, Potato, Baked Potato, Poisonous Potato, Carrot, Golden Carrot, Carrot on a Stick, -Pumpkin Pie, Night Vision Potion, Invisibility Potion, Nether Quartz, Nether Quartz Ore, Block of Quartz, Quartz Slab, Quartz Stair, Chiseled Quartz Block, Pillar Quartz Block, Enchanted Book, Carpet.{*B*} -- Added new recipes for Smooth Sandstone and Chiselled Sandstone.{*B*} -- Added new Mobs - Zombie Villagers.{*B*} -- Added new terrain generation features - Desert Temples, Desert Villages, Jungle Temples.{*B*} -- Added Trading with villagers.{*B*} -- Added Anvil interface.{*B*} -- Can dye leather armor.{*B*} -- Can dye wolf collars.{*B*} -- Can control riding a pig with a Carrot on a Stick.{*B*} -- Updated Bonus Chest content with more items.{*B*} -- Changed placement of half blocks and other blocks on half blocks.{*B*} -- Changed placement of upside down stairs and slabs.{*B*} -- Added different villager professions.{*B*} -- Villagers spawned from a spawn egg will have a random profession.{*B*} -- Added sideways log placement.{*B*} -- Furnaces can use wooden tools as a fuel.{*B*} -- Ice and Glass panes can be collected with silk touch enchanted tools.{*B*} -- Wooden Buttons and Wooden Pressure Plates can be activated with Arrows.{*B*} -- Nether mobs can spawn in the Overworld from Portals.{*B*} -- Creepers and Spiders are aggressive towards the last player that hit them.{*B*} -- Mobs in Creative mode become neutral again after a short period.{*B*} -- Remove knockback when drowning.{*B*} -- Doors being broken by zombies show damage.{*B*} -- Ice melts in the nether.{*B*} -- Cauldrons fill up when out in the rain.{*B*} -- Pistons take twice as long to update.{*B*} -- Pig drops Saddle when killed (if has one).{*B*} -- Sky color in The End changed.{*B*} -- String can be placed (for Tripwires).{*B*} -- Rain drips through leaves.{*B*} -- Levers can be placed on the bottom of blocks.{*B*} -- TNT does variable damage depending on difficulty setting.{*B*} -- Book recipe changed.{*B*} -- Boats break Lilypads, instead of Lilypads breaking Boats.{*B*} -- Pigs drop more Porkchops.{*B*} -- Slimes spawn less in Superflat worlds.{*B*} -- Creeper damage variable based on difficulty setting, more knockback.{*B*} -- Fixed Endermen not opening their jaws.{*B*} -- Added teleporting of players (using the {*BACK_BUTTON*} menu in-game).{*B*} -- Added new Host Options for flying, invisibility and invulnerability for remote players.{*B*} -- Added new tutorials to the Tutorial World for new items and features.{*B*} -- Updated the positions of the Music Disc Chests in the Tutorial World.{*B*} + {*T3*}Changes and Additions{*ETW*}{*B*}{*B*} +- Added new items - Hardened Clay, Stained Clay, Block of Coal, Hay Bale, Activator Rail, Block of Redstone, Daylight Sensor, Dropper, Hopper, Minecart with Hopper, Minecart with TNT, Redstone Comparator, Weighted Pressure Plate, Beacon, Trapped Chest, Firework Rocket, Firework Star, Nether Star, Lead, Horse Armor, Name Tag, Horse Spawn Egg{*B*} +- Added new Mobs - Wither, Wither Skeletons, Witches, Bats, Horses, Donkeys and Mules{*B*} +- Added new terrain generation features - Witch Huts.{*B*} +- Added Beacon interface.{*B*} +- Added Horse interface.{*B*} +- Added Hopper interface.{*B*} +- Added Fireworks - Fireworks interface is accessible from the Crafting Table when you have the ingredients to craft a Firework Star or Firework Rocket.{*B*} +- Added 'Adventure Mode' - You can only break blocks with the correct tools.{*B*} +- Added lots of new sounds.{*B*} +- Mobs, items and projectiles can now pass through portals.{*B*} +- Repeaters can now be locked by powering their sides with another Repeater.{*B*} +- Zombies and Skeletons can now spawn with different weapons and armor.{*B*} +- New death messages.{*B*} +- Name mobs with a Name Tag, and rename containers to change the title when the menu is open.{*B*} +- Bonemeal no longer instantly grows everything to full size, and instead randomly grows in stages.{*B*} +- A Redstone signal describing the contents of Chests, Brewing Stands, Dispensers and Jukeboxes can be detected by placing a Redstone Comparator directly against them.{*B*} +- Dispensers can face in any direction.{*B*} +- Eating a Golden Apple gives the player extra "absorption" health for a short period.{*B*} +- The longer you remain in an area the harder the monsters that spawn in that area will be.{*B*} - - + {*ETB*}Welcome back! You may not have noticed but your Minecraft has just been updated.{*B*}{*B*} -There are lots of new features for you and friends to play with so here’s just a few highlights. Have a read and then go and have fun!{*B*}{*B*} -{*T1*}New Items{*ETB*} - Emerald, Emerald Ore, Block of Emerald, Ender Chest, Tripwire Hook, Enchanted Golden Apple, Anvil, Flower Pot, Cobblestone Walls, Mossy Cobblestone Walls, Wither Painting, Potato, Baked Potato, Poisonous Potato, Carrot, Golden Carrot, Carrot on a Stick, -Pumpkin Pie, Night Vision Potion, Invisibility Potion, Nether Quartz, Nether Quartz Ore, Block of Quartz, Quartz Slab, Quartz Stair, Chiseled Quartz Block, Pillar Quartz Block, Enchanted Book, Carpet.{*B*}{*B*} - {*T1*}New Mobs{*ETB*} - Zombie Villagers.{*B*}{*B*} -{*T1*}New Features{*ETB*} - Trade with villagers, repair or enchant weapons and tools with an Anvil, store items in an Ender Chest, control a pig while riding it using a Carrot on a Stick!{*B*}{*B*} -{*T1*}New Mini-Tutorials{*ETB*} – Learn how to use the new features in the Tutorial World!{*B*}{*B*} -{*T1*}New 'Easter Eggs'{*ETB*} – We've moved all the secret Music Discs in the Tutorial World. See if you can find them again!{*B*}{*B*} - - - +There are lots of new features for you and friends to play with so here’s just a few highlights. Have a read and then go and have fun!{*B*}{*B*} +{*T1*}New Items{*ETB*} - Hardened Clay, Stained Clay, Block of Coal, Hay Bale, Activator Rail, Block of Redstone, Daylight Sensor, Dropper, Hopper, Minecart with Hopper, Minecart with TNT, Redstone Comparator, Weighted Pressure Plate, Beacon, Trapped Chest, Firework Rocket, Firework Star, Nether Star, Lead, Horse Armor, Name Tag, Horse Spawn Egg{*B*}{*B*} +{*T1*}New Mobs{*ETB*} - Wither, Wither Skeletons, Witches, Bats, Horses, Donkeys and Mules{*B*}{*B*} +{*T1*}New Features{*ETB*} - Tame and ride a horse, craft fireworks and put on a show, name animals and monsters with a Name Tag, create more advanced Redstone circuits, and new Host Options to help control what guests to your world can do!{*B*}{*B*} +{*T1*}New Tutorial World{*ETB*} – Learn how to use the old and new features in the Tutorial World. See if you can find all the secret Music Discs hidden in the world!{*B*}{*B*} + + + + Horses + + + {*T3*}HOW TO PLAY : HORSES{*ETW*}{*B*}{*B*} +Horses and Donkeys are found mainly in open plains. Mules are the offspring of a Donkey and a Horse, but are infertile themselves.{*B*} +All adult Horses, Donkeys and Mules can be ridden. However only Horses can be armored, and only Mules and Donkeys may be equipped with saddlebags for transporting items.{*B*}{*B*} +Horses, Donkeys and Mules must be tamed before they can be used. A horse is tamed by attempting to ride it, and managing to stay on the horse while it attempts to throw the rider off.{*B*} +When Love Hearts appear around the horse, it is tame, and will no longer attempt to throw the player off. To steer a horse, the player must equip the horse with a Saddle.{*B*}{*B*} +Saddles can be bought from villagers or found inside Chests hidden in the world.{*B*} +Tame Donkeys and Mules can be given saddlebags by attaching a Chest. These saddlebags can then be accessed whilst riding or sneaking.{*B*}{*B*} +Horses and Donkeys (but not Mules) can be bred like other animals using Golden Apples or Golden Carrots.{*B*} +Foals will grow into adult horses over time, although feeding them Wheat or Hay will speed this up.{*B*} + + + + Beacons + + + {*T3*}HOW TO PLAY : BEACONS{*ETW*}{*B*}{*B*} +Active Beacons project a bright beam of light into the sky and grant powers to nearby players.{*B*} +They are crafted with Glass, Obsidian and Nether Stars, which can be obtained by defeating the Wither.{*B*}{*B*} +Beacons must be placed so that they are in sunlight during the day. Beacons must be placed on Pyramids of Iron, Gold, Emerald or Diamond.{*B*} +The material the Beacon is placed on has no effect on the power of the Beacon.{*B*}{*B*} +In the Beacon menu you can select one primary power for your Beacon. The more tiers your pyramid has the more powers you will have to choose from.{*B*} +A Beacon on a pyramid with at least four tiers also gives the option of either the Regeneration secondary power or a stronger primary power.{*B*}{*B*} +To set the powers of your Beacon you must sacrifice an Emerald, Diamond, Gold or Iron Ingot in the payment slot.{*B*} +Once set, the powers will emanate from the Beacon indefinitely.{*B*} + + + + Fireworks + + + {*T3*}HOW TO PLAY : FIREWORKS{*ETW*}{*B*}{*B*} +Fireworks are decorative items that can be launched by hand or from Dispensers. They are crafted using Paper, Gunpowder and optionally a number of Firework Stars.{*B*} +The colors, fade, shape, size, and effects (such as trails and twinkle) of Firework Stars can be customized by including additional ingredients when crafting.{*B*}{*B*} +To craft a Firework place Gunpowder and Paper in the 3x3 crafting grid that is shown above your inventory.{*B*} +You can optionally place multiple Firework Stars in the crafting grid to add them to the Firework.{*B*} +Filling more slots in the crafting grid with Gunpowder will increase the height at which all the Firework Stars will explode.{*B*}{*B*} +You can then take the crafted Firework out of the output slot.{*B*}{*B*} +Firework Stars can be crafted by placing Gunpowder and Dye into the crafting grid.{*B*} + - The Dye will set the color of the explosion of the Firework Star.{*B*} + - The shape of the Firework Star is set by adding either a Fire Charge, Gold Nugget, Feather or Mob Head.{*B*} + - A trail or a twinkle can be added using Diamonds or Glowstone Dust.{*B*}{*B*} +After a Firework Star has been crafted, you can set the fade color of the Firework Star by crafting it with Dye. + + + + Hoppers + + + {*T3*}HOW TO PLAY : HOPPERS{*ETW*}{*B*}{*B*} +Hoppers are used to insert or remove items from containers, and to automatically pick up items thrown into them.{*B*} +They can affect Brewing Stands, Chests, Dispensers, Droppers, Minecarts with Chests, Minecarts with Hoppers, as well as other Hoppers.{*B*}{*B*} +Hoppers will continuously attempt to suck items out of a suitable container placed above them. They will also attempt to insert stored items into an output container.{*B*} +If a Hopper is powered by Redstone it will become inactive and stop both sucking and inserting items.{*B*}{*B*} +A Hopper points in the direction it tries to output items. To make a Hopper point to a particular block, place the Hopper against that block whilst sneaking.{*B*} + + + + Droppers + + + {*T3*}HOW TO PLAY : DROPPERS{*ETW*}{*B*}{*B*} +When powered by Redstone, Droppers will drop a single random item contained within them onto the ground. Use {*CONTROLLER_ACTION_USE*} to open the Dropper and then you can load the Dropper with items from your inventory.{*B*} +If the Dropper is facing a Chest or another type of Container, the item will be placed into that instead. Long chains of Droppers can be constructed to transport items over a distance, but for this to work they will have to be alternately powered on and off. + + Deals more damage than by hand. - - + Used to dig dirt, grass, sand, gravel and snow faster than by hand. Shovels are required to dig snowballs. - - + Required to mine stone-related blocks and ore. - - + Used to chop wood-related blocks faster than by hand. - - + Used to till dirt and grass blocks to prepare for crops. - - + Wooden doors are activated by using, hitting them or with Redstone. - - + Iron doors can only be opened by Redstone, buttons or switches. - - - NOT USED - - - NOT USED - - - NOT USED - - - NOT USED - - - - Gives the user 1 Armor when worn. - - - - Gives the user 3 Armor when worn. - - - - Gives the user 2 Armor when worn. - - - - Gives the user 1 Armor when worn. - - - - Gives the user 2 Armor when worn. - - - - Gives the user 5 Armor when worn. - - - - Gives the user 4 Armor when worn. - - - - Gives the user 1 Armor when worn. - - - - Gives the user 2 Armor when worn. - - - - Gives the user 6 Armor when worn. - - - - Gives the user 5 Armor when worn. - - - - Gives the user 2 Armor when worn. - - - - Gives the user 2 Armor when worn. - - - - Gives the user 5 Armor when worn. - - - - Gives the user 3 Armor when worn. - - - - Gives the user 1 Armor when worn. - - - - Gives the user 3 Armor when worn. - - - - Gives the user 8 Armor when worn. - - - - Gives the user 6 Armor when worn. - - - - Gives the user 3 Armor when worn. - - + + NOT USED + + + NOT USED + + + NOT USED + + + NOT USED + + + Gives the user 1 Armor when worn. + + + Gives the user 3 Armor when worn. + + + Gives the user 2 Armor when worn. + + + Gives the user 1 Armor when worn. + + + Gives the user 2 Armor when worn. + + + Gives the user 5 Armor when worn. + + + Gives the user 4 Armor when worn. + + + Gives the user 1 Armor when worn. + + + Gives the user 2 Armor when worn. + + + Gives the user 6 Armor when worn. + + + Gives the user 5 Armor when worn. + + + Gives the user 2 Armor when worn. + + + Gives the user 2 Armor when worn. + + + Gives the user 5 Armor when worn. + + + Gives the user 3 Armor when worn. + + + Gives the user 1 Armor when worn. + + + Gives the user 3 Armor when worn. + + + Gives the user 8 Armor when worn. + + + Gives the user 6 Armor when worn. + + + Gives the user 3 Armor when worn. + A shiny ingot which can be used to craft tools made from this material. Created by smelting ore in a furnace. - - + Allows ingots, gems, or dyes to be crafted into placeable blocks. Can be used as an expensive building block or compact storage of the ore. - - + Used to send an electrical charge when stepped on by a player, an animal, or a monster. Wooden Pressure Plates can also be activated by dropping something on them. - - + Used for compact staircases. - - + Used for making long staircases. Two slabs placed on top of each other will create a normal-sized double slab block. - - + Used for making long staircases. Two slabs placed on top of each other will create a normal-sized double slab block. - - + Used to create light. Torches also melt snow and ice. - - + Used as a building material and can be crafted into many things. Can be crafted from any form of wood. - - + Used as a building material. Is not influenced by gravity like normal Sand. - - + Used as a building material. - - + Used to craft torches, arrows, signs, ladders, fences and as handles for tools and weapons. - - + Used to forward time from any time at night to morning if all the players in the world are in bed, and changes the spawn point of the player. The colors of the bed are always the same, regardless of the colors of wool used. - - + Allows you to craft a more varied selection of items than the normal crafting. - - + Allows you to smelt ore, create charcoal and glass, and cook fish and porkchops. - - + Stores blocks and items inside. Place two chests side by side to create a larger chest with double the capacity. - - + Used as a barrier that cannot be jumped over. Counts as 1.5 blocks high for players, animals and monsters, but 1 block high for other blocks. - - + Used to climb vertically. - - + Activated by using, hitting them or with redstone. They function as normal doors, but are a one by one block and lay flat on the ground. - - + Shows text entered by you or other players. - - + Used to create brighter light than torches. Melts snow/ice and can be used underwater. - - + Used to cause explosions. Activated after placing by igniting with Flint and Steel item, or with an electrical charge. - - + Used to hold mushroom stew. You keep the bowl when the stew has been eaten. - - + Used to hold and transport water, lava and milk. - - + Used to hold and transport water. - - + Used to hold and transport lava. - - + Used to hold and transport milk. - - + Used to create fire, ignite TNT, and open a portal once it has been built. - - + Used to catch fish. - - + Displays positions of the Sun and Moon. - - + Points to your start point. - - + Will create an image of an area explored while held. This can be used for path-finding. - - + + + When used becomes a map of the part of the world that you are in, and gets filled in as you explore. + Allows for ranged attacks by using arrows. - - + Used as ammunition for bows. - - + + + Dropped by the Wither, used in crafting Beacons. + + + When activated, create colorful explosions. The color, effect, shape and fade are determined by the Firework Star used when the Firework is created. + + + Used to determine the color, effect and shape of a Firework. + + + Used in Redstone circuits to maintain, compare, or subtract signal strength, or to measure certain block states. + + + Is a type of Minecart that acts as a moving TNT block. + + + Is a block that outputs a Redstone signal based on sunlight (or lack of sunlight). + + + Is a special type of Minecart that functions similarly to a Hopper. It will collect items lying on tracks and from containers above it. + + + A special type of Armor that can be equipped to a horse. Provides 5 Armor. + + + A special type of Armor that can be equipped to a horse. Provides 7 Armor. + + + A special type of Armor that can be equipped to a horse. Provides 11 Armor. + + + Used to leash mobs to the player or Fence posts. + + + Used to name mobs in the world. + Restores 2.5{*ICON_SHANK_01*}. - - + Restores 1{*ICON_SHANK_01*}. Can be used 6 times. - - + Restores 1{*ICON_SHANK_01*}. - - + Restores 1{*ICON_SHANK_01*}. - - + Restores 3{*ICON_SHANK_01*}. - - + Restores 1{*ICON_SHANK_01*}, or can be cooked in a furnace. Eating this can cause you to be poisoned. - - + Restores 3{*ICON_SHANK_01*}. Created by cooking raw chicken in a furnace. - - + Restores 1.5{*ICON_SHANK_01*}, or can be cooked in a furnace. - - + Restores 4{*ICON_SHANK_01*}. Created by cooking raw beef in a furnace. - - + Restores 1.5{*ICON_SHANK_01*}, or can be cooked in a furnace. - - + Restores 4{*ICON_SHANK_01*}. Created by cooking a raw porkchop in a furnace. - - + Restores 1{*ICON_SHANK_01*}, or can be cooked in a furnace. Can be fed to an Ocelot to tame it. - - + Restores 2.5{*ICON_SHANK_01*}. Created by cooking a raw fish in a furnace. - - + Restores 2{*ICON_SHANK_01*}, and can be crafted into a golden apple. - - + Restores 2{*ICON_SHANK_01*}, and regenerates health for 4 seconds. Crafted from an apple and gold nuggets. - - + Restores 2{*ICON_SHANK_01*}. Eating this can cause you to be poisoned. - - + Used in the cake recipe, and as an ingredient for brewing potions. - - + Used to send an electrical charge by being turned on or off. Stays in the on or off state until pressed again. - - + Constantly sends an electrical charge, or can be used as a receiver/transmitter when connected to the side of a block. Can also be used for low-level lighting. - - + Used in Redstone circuits as repeater, a delayer, and/or a diode. - - + Used to send an electrical charge by being pressed. Stays activated for approximately a second before shutting off again. - - + Used to hold and shoot out items in a random order when given a Redstone charge. - - + Plays a note when triggered. Hit it to change the pitch of the note. Placing this on top of different blocks will change the type of instrument. - - + Used to guide minecarts. - - + When powered, accelerates minecarts that pass over it. When unpowered, causes minecarts to stop on it. - - + - Functions like a Pressure Plate (sends a Redstone signal when powered) but can only be activated by a minecart. - - + Functions like a Pressure Plate (sends a Redstone signal when powered) but can only be activated by a Minecart. + Used to transport you, an animal, or a monster along rails. - - + Used to transport goods along rails. - - + Will move along rails and can push other minecarts when coal is put in it. - - + Used to travel in water more quickly than swimming. - - + Collected from sheep, and can be colored with dyes. - - + Used as a building material and can be colored with dyes. This recipe is not recommended because Wool can be easily obtained from Sheep. - - + Used as a dye to create black wool. - - + Used as a dye to create green wool. - - + Used as a dye to create brown wool, as an ingredient in cookies, or to grow Cocoa Pods. - - + Used as a dye to create silver wool. - - + Used as a dye to create yellow wool. - - + Used as a dye to create red wool. - - + Used to instantly grow crops, trees, tall grass, huge mushrooms and flowers, and can be used in dye recipes. - - + Used as a dye to create pink wool. - - + Used as a dye to create orange wool. - - + Used as a dye to create lime wool. - - + Used as a dye to create gray wool. - - + Used as a dye to create light gray wool. (Note: light gray dye can also be made by combining gray dye with bone meal, letting you make four light gray dyes from every ink sac instead of three.) - - + Used as a dye to create light blue wool. - - + Used as a dye to create cyan wool. - - + Used as a dye to create purple wool. - - + Used as a dye to create magenta wool. - - + Used as dye to create Blue Wool. - - + Plays Music Discs. - - + Use these to create very strong tools, weapons or armor. - - + Used to create brighter light than torches. Melts snow/ice and can be used underwater. - - + Used to create books and maps. - - + Can be used to create bookshelves or enchanted to make Enchanted Books. - - + Allows the creation of more powerful enchantments when placed around the Enchantment Table. - - + Used as decoration. - - + Can be mined with an iron pickaxe or better, then smelted in a furnace to produce gold ingots. - - + Can be mined with a stone pickaxe or better, then smelted in a furnace to produce iron ingots. - - + Can be mined with a pickaxe to collect coal. - - + Can be mined with a stone pickaxe or better to collect lapis lazuli. - - + Can be mined with an iron pickaxe or better to collect diamonds. - - + Can be mined with an iron pickaxe or better to collect redstone dust. - - + Can be mined with a pickaxe to collect cobblestone. - - + Collected using a shovel. Can be used for construction. - - + Can be planted and it will eventually grow into a tree. - - + This cannot be broken. - - + Sets fire to anything that touches it. Can be collected in a bucket. - - + Collected using a shovel. Can be smelted into glass using the furnace. Is affected by gravity if there is no other tile underneath it. - - + Collected using a shovel. Sometimes produces flint when dug up. Is affected by gravity if there is no other tile underneath it. - - + Chopped using an axe, and can be crafted into planks or used as a fuel. - - + Created in a furnace by smelting sand. Can be used for construction, but will break if you try to mine it. - - + Mined from stone using a pickaxe. Can be used to construct a furnace or stone tools. - - + Baked from clay in a furnace. - - + Can be baked into bricks in a furnace. - - + When broken drops clay balls which can be baked into bricks in a furnace. - - + A compact way to store snowballs. - - + Can be dug with a shovel to create snowballs. - - + Sometimes produces wheat seeds when broken. - - + Can be crafted into a dye. - - + Can be crafted with a bowl to make stew. - - + Can only be mined with a diamond pickaxe. Is produced by the meeting of water and still lava, and is used to build a portal. - - + Spawns monsters into the world. - - + Is placed on the ground to carry an electrical charge. When brewed with a potion it will increase the duration of the effect. - - + When fully grown, crops can be harvested to collect wheat. - - + Ground that has been prepared ready to plant seeds. - - + Can be cooked in a furnace to create a green dye. - - + Can be crafted to create sugar. - - + Can be worn as a helmet or crafted with a torch to create a Jack-O-Lantern. It is also the main ingredient in Pumpkin Pie. - - + Burns forever if set alight. - - + Slows the movement of anything walking over it. - - + Standing in the portal allows you to pass between the Overworld and the Nether. - - + Used as a fuel in a furnace, or crafted to make a torch. - - + Collected by killing a spider, and can be crafted into a Bow or Fishing Rod, or placed on the ground to create Tripwire. - - + Collected by killing a chicken, and can be crafted into an arrow. - - + Collected by killing a Creeper, and can be crafted into TNT or used as an ingredient for brewing potions. - - + Can be planted in farmland to grow crops. Make sure there's enough light for the seeds to grow! - - + Harvested from crops, and can be used to craft food items. - - + Collected by digging gravel, and can be used to craft a flint and steel. - - + When used on a pig it allows you to ride the pig. The pig can then be steered using a Carrot on a Stick. - - + Collected by digging snow, and can be thrown. - - + Collected by killing a cow, and can be crafted into armor or used to make Books. - - + Collected by killing a Slime, and used as an ingredient for brewing potions or crafted to make Sticky Pistons. - - + Dropped randomly by chickens, and can be crafted into food items. - - + Collected by mining Glowstone, and can be crafted to make Glowstone blocks again or brewed with a potion to increase the potency of the effect. - - + Collected by killing a Skeleton. Can be crafted into bone meal. Can be fed to a wolf to tame it. - - + Collected by getting a Skeleton to kill a Creeper. Can be played in a jukebox. - - + Extinguishes fire and helps crops grow. Can be collected in a bucket. - - + When broken sometimes drops a sapling which can then be replanted to grow into a tree. - - + Found in dungeons, can be used for construction and decoration. - - + Used to obtain wool from sheep and harvest leaf blocks. - - + When powered (using a button, a lever, a pressure plate, a redstone torch, or redstone with any one of these), a piston extends if it can and pushes blocks. - - + When powered (using a button, a lever, a pressure plate, a redstone torch, or redstone with any one of these), a piston extends if it can and pushes blocks. When it retracts it pulls back the block touching the extended part of the piston. - - + Made from Stone blocks, and commonly found in Strongholds. - - + Used as a barrier, similar to fences. - - + Similar to a door, but used primarily with fences. - - + Can be crafted from Melon Slices. - - + Transparent blocks that can be used as an alternative to Glass Blocks. - - + Can be planted to grow pumpkins. - - + Can be planted to grow melons. - - + Dropped by Enderman when they die. When thrown, the player will be teleported to the position the Ender Pearl lands at, and will lose some health. - - + A block of dirt with grass growing on top. Collected using a shovel. Can be used for construction. - - + Can be used for construction and decoration. - - + Slows movement when walking through it. Can be destroyed using shears to collect string. - - + Spawns a Silverfish when destroyed. May also spawn Silverfish if nearby to another Silverfish being attacked. - - + Grows over time when placed. Can be collected using shears. Can be climbed like a ladder. - - + Slippery when walked on. Turns into water if above another block when destroyed. Melts if close enough to a light source or when placed in The Nether. - - + Can be used as decoration. - - + Used in potion brewing, and for locating Strongholds. Dropped by Blazes who tend to be found near or in Nether Fortresses. - - + Used in potion brewing. Dropped by Ghasts when they die. - - + Dropped by Zombie Pigmen when they die. Zombie Pigmen can be found in the Nether. Used as an ingredient for brewing potions. - - + Used in potion brewing. This can be found naturally growing in Nether Fortresses. It can also be planted on Soul Sand. - - + When used, can have various effects, depending on what it is used on. - - + Can be filled with water, and used as the starting ingredient for a potion in the Brewing Stand. - - + This is a poisonous food and brewing item. Dropped when a Spider or Cave Spider is killed by a player. - - + Used in potion brewing, mainly to create potions with a negative effect. - - + Used in potion brewing, or crafted with other items to make Eye of Ender or Magma Cream. - - + Used in potion brewing. - - + Used for making Potions and Splash Potions. - - + Filled with water by rain or with a bucket of water, and can then be used to fill Glass Bottles with water. - - + When thrown, will show the direction to an End Portal. When twelve of these are placed in the End Portal Frames, the End Portal will be activated. - - + Used in potion brewing. - - + Similar to Grass Blocks, but very good for growing mushrooms on. - - + Floats on water, and can be walked on. - - + Used to build Nether Fortresses. Immune to Ghast's fireballs. - - + Used in Nether Fortresses. - - + Found in Nether Fortresses, and will drop Nether Wart when broken. - - + This allows players to enchant Swords, Pickaxes, Axes, Shovels, Bows and Armor, using the player's Experience Points. - - + This can be activated using twelve Eye of Ender, and will allow the player to travel to The End dimension. - - + Used to form an End Portal. - - + A block type found in The End. It has a very high blast resistance, so is useful for building with. - - + This block is created by the defeat of the Dragon in The End. - - + When thrown, it drops Experience Orbs which increase your experience points when collected. - - + Useful for setting things on fire, or for indiscriminately starting fires when fired from a Dispenser. - - + These are similar to a display case, and will display the item or block placed in it. - - + When thrown can spawn a creature of the type indicated. - - + Used for making long staircases. Two slabs placed on top of each other will create a normal-sized double slab block. - - + Used for making long staircases. Two slabs placed on top of each other will create a normal-sized double slab block. - - + Created by smelting Netherrack in a furnace. Can be crafted into Nether Brick blocks. - - + When powered they emit light. - - + Can be farmed to collect Cocoa Beans. - - + Mob Heads can be placed as a decoration, or worn as a mask in the helmet slot. - - + + + Used to execute commands. + + + Projects a beam of light into the sky and can provide Status Effects to nearby players. + + + Stores blocks and items inside. Place two chest side by side to create a larger chest with double capacity. The trapped chest also creates a Redstone charge when opened. + + + Provides a Redstone charge. The charge will be stronger if more items are on the plate. + + + Provides a Redstone charge. The charge will be stronger if more items are on the plate. Requires more weight than the light plate. + + + Used as a redstone power source. Can be crafted back into Redstone. + + + Used to catch items or to transfer items into and out of containers. + + + A type of rail that can enable or disable Minecarts with Hoppers and trigger Minecarts with TNT. + + + Used to hold and drop items, or push items into another container, when given a Redstone charge. + + + Colorful blocks crafted by dyeing Hardened clay. + + + Can be fed to Horses, Donkeys or Mules to heal up to 10 Hearts. Speeds up the growth of foals. + + + Created by smelting Clay in a furnace. + + + Crafted from glass and a dye. + + + Crafted from Stained Glass + + + A compact way of storing Coal. Can be used as fuel in a Furnace. + Squid - - + Drops ink sacs when killed. - - + Cow - - + Drops leather when killed. Can also be milked with a bucket. - - + Sheep - - + Drops wool when sheared (if it has not already been sheared). Can be dyed to make its wool a different color. - - + Chicken - - + Drops feathers when killed, and also randomly lays eggs. - - + Pig - - + Drops porkchops when killed. Can be ridden by using a saddle. - - + Wolf - - + Docile until attacked, when they will attack you back. Can be tamed using bones which causes the wolf to follow you around and attack anything that attacks you. - - + Creeper - - + Explodes if you get too close! - - + Skeleton - - + Fires arrows at you. Drops arrows when killed. - - + Spider - - + Attacks you when you are close to it. Can climb walls. Drops string when killed. - - + Zombie - - + Attacks you when you are close to it. - - + Zombie Pigman - - + Initially docile, but will attack in groups if you attack one. - - + Ghast - - + Fires flaming balls at you that explode on contact. - - + Slime - - + Split into smaller Slimes when damaged. - - + Enderman - - + Will attack you if you look at it. Can also move blocks around. - - + Silverfish - - + Attracts nearby hidden Silverfish when attacked. Hides in stone blocks. - - + Cave Spider - - + Has a venomous bite. - - + Mooshroom - - + Makes mushroom stew when used with a bowl. Drops mushrooms and becomes a normal cow when sheared. - - + Snow Golem - - + The Snow Golem can be created by players using snow blocks and a pumpkin. They will throw snowballs at their creators enemies. - - + Ender Dragon - - + This is a large black dragon found in The End. - - + Blaze - - + These are enemies found in the Nether, mostly inside Nether Fortresses. They will drop Blaze Rods when killed. - - + Magma Cube - - + These can be found in The Nether. Similar to Slimes, they will break up into smaller versions when killed. - - + Villager - - + Ocelot - - + These can be found in Jungles. They can be tamed by feeding them Raw Fish. You will need to let the Ocelot approach you though, since any sudden movements will scare it away. - - + Iron Golem - - + Appear in Villages to protect them, and can be created using Iron Blocks and Pumpkins. - - + + + Bat + + + These flying creatures are found in caverns or other large enclosed spaces. + + + Witch + + + These enemies can be found in swamps and attack you by throwing Potions. They drop Potions when killed. + + + Horse + + + These animals can be tamed and can then be ridden. + + + Donkey + + + These animals can be tamed and can then be ridden. They can have a chest attached. + + + Mule + + + Born when a Horse and a Donkey breed. These animals can be tamed and can then be ridden and carry chests. + + + Zombie Horse + + + Skeleton Horse + + + Wither + + + These are crafted from Wither Skulls and Soul Sand. They fire exploding skulls at you. + Explosives Animator - - + Concept Artist - - + Number Crunching and Statistics - - + Bully Coordinator - - + Original Design and Code by - - + Project Manager/Producer - - + Rest of Mojang Office - - + Lead Game Programmer Minecraft PC - - + Ninja Coder - - + CEO - - + White Collar Worker - - + Customer Support - - + Office DJ - - + Designer/Programmer Minecraft - Pocket Edition - - + Developer - - + Chief Architect - - + Art Developer - - + Game Crafter - - + Director of Fun - - + Music and Sounds - - + Programming - - + Art - - + QA - - + Executive Producer - - + Lead Producer - - + Producer - - + Test Lead - - + Lead Tester - - + Design Team - - + Development Team - - + Release Management - - + Director, XBLA Publishing - - + Business Development - - + Portfolio Director - - + Product Manager - - + Marketing - - + Community Manager - - + Europe Localization Team - - + Redmond Localization Team - - + Asia Localization Team - - + User Research Team - - + MGS Central Teams - - + Milestone Acceptance Tester - - + Special Thanks - - + Test Manager - - + Senior Test Lead - - + SDET - - + Project STE - - + Additional STE - - + Test Associates - - + Jon Kågström - - + Tobias Möllstam - - + Risë Lugo - - + Wooden Sword - - + Stone Sword - - + Iron Sword - - + Diamond Sword - - + Golden Sword - - + Wooden Shovel - - + Stone Shovel - - + Iron Shovel - - + Diamond Shovel - - + Golden Shovel - - + Wooden Pickaxe - - + Stone Pickaxe - - + Iron Pickaxe - - + Diamond Pickaxe - - + Golden Pickaxe - - + Wooden Axe - - + Stone Axe - - + Iron Axe - - + Diamond Axe - - + Golden Axe - - + Wooden Hoe - - + Stone Hoe - - + Iron Hoe - - + Diamond Hoe - - + Golden Hoe - - + Wooden Door - - + Iron Door - - + Chain Helmet - - + Chain Chestplate - - + Chain Leggings - - + Chain Boots - - + Leather Cap - - + Iron Helmet - - + Diamond Helmet - - + Golden Helmet - - + Leather Tunic - - + Iron Chestplate - - + Diamond Chestplate - - + Golden Chestplate - - + Leather Pants - - + Iron Leggings - - + Diamond Leggings - - + Golden Leggings - - + Leather Boots - - + Iron Boots - - + Diamond Boots - - + Golden Boots - - + Iron Ingot - - + Gold Ingot - - + Bucket - - + Water Bucket - - + Lava Bucket - - + Flint and Steel - - + Apple - - + Bow - - + Arrow - - + Coal - - + Charcoal - - + Diamond - - + Stick - - + Bowl - - + Mushroom Stew - - + String - - + Feather - - + Gunpowder - - + Wheat Seeds - - + Wheat - - + Bread - - + Flint - - + Raw Porkchop - - + Cooked Porkchop - - + Painting - - + Golden Apple - - + Sign - - + Minecart - - + Saddle - - + Redstone - - + Snowball - - + Boat - - + Leather - - + Milk Bucket - - + Brick - - + Clay - - + Sugar Canes - - + Paper - - + Book - - + Slimeball - - + Minecart with Chest - - + Minecart with Furnace - - + Egg - - + Compass - - + Fishing Rod - - + Clock - - + Glowstone Dust - - + Raw Fish - - + Cooked Fish - - + Dye Powder - - + Ink Sac - - + Rose Red - - + Cactus Green - - + Cocoa Beans - - + Lapis Lazuli - - + Purple Dye - - + Cyan Dye - - + Light Gray Dye - - + Gray Dye - - + Pink Dye - - + Lime Dye - - + Dandelion Yellow - - + Light Blue Dye - - + Magenta Dye - - + Orange Dye - - + Bone Meal - - + Bone - - + Sugar - - + Cake - - + Bed - - + Redstone Repeater - - + Cookie - - + Map - - + + + Empty Map + Music Disc - "13" - - + Music Disc - "cat" - - + Music Disc - "blocks" - - + Music Disc - "chirp" - - + Music Disc - "far" - - + Music Disc - "mall" - - + Music Disc - "mellohi" - - + Music Disc - "stal" - - + Music Disc - "strad" - - + Music Disc - "ward" - - + Music Disc - "11" - - + Music Disc - "where are we now" - - + Shears - - + Pumpkin Seeds - - + Melon Seeds - - + Raw Chicken - - + Cooked Chicken - - + Raw Beef - - + Steak - - + Rotten Flesh - - + Ender Pearl - - + Melon Slice - - + Blaze Rod - - + Ghast Tear - - + Gold Nugget - - + Nether Wart - - + {*splash*}{*prefix*}Potion {*postfix*} - - + Glass Bottle - - + Water Bottle - - + Spider Eye - - + Fermented Spider Eye - - + Blaze Powder - - + Magma Cream - - + Brewing Stand - - + Cauldron - - + Eye of Ender - - + Glistering Melon - - + Bottle o' Enchanting - - + Fire Charge - - + Fire Charge (Charcoal) - - + Fire Charge (Coal) - - + Item Frame - - + Spawn {*CREATURE*} - - + Nether Brick - - + Skull - - + Skeleton Skull - - + Wither Skeleton Skull - - + Zombie Head - - + Head - - + %s's Head - - + Creeper Head - - + + + Nether Star + + + Firework Rocket + + + Firework Star + + + Redstone Comparator + + + Minecart with TNT + + + Minecart with Hopper + + + Iron Horse Armor + + + Gold Horse Armor + + + Diamond Horse Armor + + + Lead + + + Name Tag + Stone - - + Grass Block - - + Dirt - - + Cobblestone - - + Oak Wood Planks - - + Spruce Wood Planks - - + Birch Wood Planks - - + Jungle Wood Planks - - + + + Wood Planks (any type) + Sapling - - + Oak Sapling - - + Spruce Sapling - - + Birch Sapling - - + Jungle Tree Sapling - - + Bedrock - - + Water - - + Lava - - + Sand - - + Sandstone - - + Gravel - - + Gold Ore - - + Iron Ore - - + Coal Ore - - + Wood - - + Oak Wood - - + Spruce Wood - - + Birch Wood - - + Jungle Wood - - + Oak - - + Spruce - - + Birch - - + Leaves - - + Oak Leaves - - + Spruce Leaves - - + Birch Leaves - - + Jungle Leaves - - + Sponge - - + Glass - - + Wool - - + Black Wool - - + Red Wool - - + Green Wool - - + Brown Wool - - + Blue Wool - - + Purple Wool - - + Cyan Wool - - + Light Gray Wool - - + Gray Wool - - + Pink Wool - - + Lime Wool - - + Yellow Wool - - + Light Blue Wool - - + Magenta Wool - - + Orange Wool - - + White Wool - - + Flower - - + Rose - - + Mushroom - - + Block of Gold - - - A compact way of storing Gold. - - - + + A compact way of storing Gold. + + + A compact way of storing Iron. + + Block of Iron - - - A compact way of storing Iron. - - - - + Stone Slab - - + Stone Slab - - + Sandstone Slab - - + Oak Wood Slab - - + Cobblestone Slab - - + Bricks Slab - - + Stone Bricks Slab - - + Oak Wood Slab - - + Spruce Wood Slab - - + Birch Wood Slab - - + Jungle Wood Slab - - + Nether Brick Slab - - + Bricks - - + TNT - - + Bookshelf - - + Moss Stone - - + Obsidian - - + Torch - - + Torch (Coal) - - + Torch (Charcoal) - - + Fire - - + Monster Spawner - - + Oak Wood Stairs - - + Chest - - + Redstone Dust - - + Diamond Ore - - + Block of Diamond - - - A compact way of storing Diamonds. - - - - + + A compact way of storing Diamonds. + + Crafting Table - - + Crops - - + Farmland - - + Furnace - - + Sign - - + Wooden Door - - + Ladder - - + Rail - - + Powered Rail - - + Detector Rail - - + Stone Stairs - - + Lever - - + Pressure Plate - - + Iron Door - - + Redstone Ore - - + Redstone Torch - - + Button - - + Snow - - + Ice - - + Cactus - - + Clay - - + Sugar Cane - - + Jukebox - - + Fence - - + Pumpkin - - + Jack-O-Lantern - - + Netherrack - - + Soul Sand - - + Glowstone - - + Portal - - + Lapis Lazuli Ore - - + Lapis Lazuli Block - - - A compact way of storing Lapis Lazuli. - - - - + + A compact way of storing Lapis Lazuli. + + Dispenser - - + Note Block - - + Cake - - + Bed - - + Web - - + Tall Grass - - + Dead Bush - - + Diode - - + Locked Chest - - + Trapdoor - - + Wool (any color) - - + Piston - - + Sticky Piston - - + Silverfish Block - - + Stone Bricks - - + Mossy Stone Bricks - - + Cracked Stone Bricks - - + Chiseled Stone Bricks - - + Mushroom - - + Mushroom - - + Iron Bars - - + Glass Pane - - + Melon - - + Pumpkin Stem - - + Melon Stem - - + Vines - - + Fence Gate - - + Brick Stairs - - + Stone Brick Stairs - - + Silverfish Stone - - + Silverfish Cobblestone - - + Silverfish Stone Brick - - + Mycelium - - + Lily Pad - - + Nether Brick - - + Nether Brick Fence - - + Nether Brick Stairs - - + Nether Wart - - + Enchantment Table - - + Brewing Stand - - + Cauldron - - + End Portal - - + End Portal Frame - - + End Stone - - + Dragon Egg - - + Shrub - - + Fern - - + Sandstone Stairs - - + Spruce Wood Stairs - - + Birch Wood Stairs - - + Jungle Wood Stairs - - + Redstone Lamp - - + Cocoa - - + Skull - - + + + Command Block + + + Beacon + + + Trapped Chest + + + Weighted Pressure Plate (Light) + + + Weighted Pressure Plate (Heavy) + + + Redstone Comparator + + + Daylight Sensor + + + Block of Redstone + + + Hopper + + + Activator Rail + + + Dropper + + + Stained Clay + + + Hay Bale + + + Hardened Clay + + + Block of Coal + + + Black Stained Clay + + + Red Stained Clay + + + Green Stained Clay + + + Brown Stained Clay + + + Blue Stained Clay + + + Purple Stained Clay + + + Cyan Stained Clay + + + Light Gray Stained Clay + + + Gray Stained Clay + + + Pink Stained Clay + + + Lime Stained Clay + + + Yellow Stained Clay + + + Light Blue Stained Clay + + + Magenta Stained Clay + + + Orange Stained Clay + + + White Stained Clay + + + Stained Glass + + + Black Stained Glass + + + Red Stained Glass + + + Green Stained Glass + + + Brown Stained Glass + + + Blue Stained Glass + + + Purple Stained Glass + + + Cyan Stained Glass + + + Light Gray Stained Glass + + + Gray Stained Glass + + + Pink Stained Glass + + + Lime Stained Glass + + + Yellow Stained Glass + + + Light Blue Stained Glass + + + Magenta Stained Glass + + + Orange Stained Glass + + + White Stained Glass + + + Stained Glass Pane + + + Black Stained Glass Pane + + + Red Stained Glass Pane + + + Green Stained Glass Pane + + + Brown Stained Glass Pane + + + Blue Stained Glass Pane + + + Purple Stained Glass Pane + + + Cyan Stained Glass Pane + + + Light Gray Stained Glass Pane + + + Gray Stained Glass Pane + + + Pink Stained Glass Pane + + + Lime Stained Glass Pane + + + Yellow Stained Glass Pane + + + Light Blue Stained Glass Pane + + + Magenta Stained Glass Pane + + + Orange Stained Glass Pane + + + White Stained Glass Pane + + + Small Ball + + + Large Ball + + + Star-shaped + + + Creeper-shaped + + + Burst + + + Unknown Shape + + + Black + + + Red + + + Green + + + Brown + + + Blue + + + Purple + + + Cyan + + + Light Gray + + + Gray + + + Pink + + + Lime + + + Yellow + + + Light Blue + + + Magenta + + + Orange + + + White + + + Custom + + + Fade to + + + Twinkle + + + Trail + + + Flight Duration: + Current Controls - - + Layout - - + Move/Sprint - - + Look - - + Pause - - + Jump - - + Jump/Fly Up - - + Inventory - - + Cycle Held Item - - + Action - - + Use - - + Crafting - - + Drop - - + Sneak - - + Sneak/Fly Down - - + Change Camera Mode - - + Players/Invite - - + Movement (When Flying) - - + Layout 1 - - + Layout 2 - - + Layout 3 - - + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\X360ControllerIcons\ButtonA.png" align="middle" height="30" width="30"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\X360ControllerIcons\ButtonB.png" align="middle" height="30" width="30"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\X360ControllerIcons\ButtonX.png" align="middle" height="30" width="30"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\X360ControllerIcons\ButtonY.png" align="middle" height="30" width="30"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\X360ControllerIcons\ButtonLeftStick.png" align="middle" height="30" width="30"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\X360ControllerIcons\ButtonRightStick.png" align="middle" height="30" width="30"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\X360ControllerIcons\ButtonLeftTrigger.png" align="middle" height="30" width="30"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\X360ControllerIcons\ButtonRightTrigger.png" align="middle" height="30" width="30"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\X360ControllerIcons\ButtonLeftBumper.png" align="middle" height="30" width="30"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\X360ControllerIcons\ButtonRightBumper.png" align="middle" height="30" width="30"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\X360ControllerIcons\ButtonBack.png" align="middle" height="30" width="30"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\X360ControllerIcons\ButtonStart.png" align="middle" height="30" width="30"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\X360ControllerIcons\ButtonRS.png" align="middle" height="30" width="30"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\X360ControllerIcons\ButtonLS.png" align="middle" height="30" width="30"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\X360ControllerIcons\ButtonDpadR.png" align="middle" height="30" width="30"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\X360ControllerIcons\ButtonDpadL.png" align="middle" height="30" width="30"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\X360ControllerIcons\ButtonDpadU.png" align="middle" height="30" width="30"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\X360ControllerIcons\ButtonDpadD.png" align="middle" height="30" width="30"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\Icon_Shank.png" align="middle" height="22" width="22"/> + - - - + &nbsp;<img src="{*IMAGEROOT*}Graphics\Icon_Shank.png" align="middle" height="22" width="22"/><img src="{*IMAGEROOT*}Graphics\Icon_Shank.png" align="middle" height="22" width="22"/><img src="{*IMAGEROOT*}Graphics\Icon_Shank.png" align="middle" height="22" width="22"/> + {*B*}Press{*CONTROLLER_VK_A*} to continue. - - + {*B*}Press{*CONTROLLER_VK_A*} to start the tutorial.{*B*} - Press{*CONTROLLER_VK_B*} if you think you are ready to play on your own. - - +Press{*CONTROLLER_VK_B*} if you think you are ready to play on your own. + Minecraft is a game about placing blocks to build anything you can imagine. At night monsters come out, make sure to build a shelter before that happens. - - + Use{*CONTROLLER_ACTION_LOOK*} to look up, down and around. - - + Use{*CONTROLLER_ACTION_MOVE*} to move around. - - + To sprint, push{*CONTROLLER_ACTION_MOVE*} forward twice quickly. While you hold{*CONTROLLER_ACTION_MOVE*} forward, the character will continue to sprint unless they run out of sprint time or food. - - + Press{*CONTROLLER_ACTION_JUMP*} to jump. - - + Hold{*CONTROLLER_ACTION_ACTION*} to mine and chop using your hand or whatever you are holding. You may need to craft a tool to mine some blocks... - - + Hold{*CONTROLLER_ACTION_ACTION*} to chop down 4 blocks of wood (tree trunks).{*B*}When a block breaks you can pick it up by standing near to the floating item that appears, causing it to appear in your inventory. - - + Press{*CONTROLLER_ACTION_CRAFTING*} to open the crafting interface. - - + As you collect and craft more items, your inventory will fill up.{*B*} - Press{*CONTROLLER_ACTION_INVENTORY*} to open the inventory. - - +Press{*CONTROLLER_ACTION_INVENTORY*} to open the inventory. + As you move around, mine and attack, you will deplete your food bar{*ICON_SHANK_01*}. Sprinting and sprint jumping use a lot more food than walking and jumping normally. - - + If you lose some health, but have a food bar with 9 or more{*ICON_SHANK_01*} in it, your health will automatically replenish. Eating food will replenish your food bar. - - + With a food item in your hand, hold{*CONTROLLER_ACTION_USE*} to eat it and replenish your food bar. You cannot eat if your food bar is full. - - + Your food bar is low, and you have lost some health. Eat the steak in your inventory to replenish your food bar and start healing.{*ICON*}364{*/ICON*} - - + The wood that you have collected can be crafted into planks. Open the crafting interface to craft them.{*PlanksIcon*} - - + A lot of crafting can involve multiple steps. Now that you have some planks there are more items that you can craft. Create a crafting table.{*CraftingTableIcon*} - - + To make collecting blocks faster you can build tools designed for the job. Some tools have a handle made of sticks. Craft some sticks now.{*SticksIcon*} - - + Use{*CONTROLLER_ACTION_LEFT_SCROLL*} and{*CONTROLLER_ACTION_RIGHT_SCROLL*} to change the current held item. - - + Use{*CONTROLLER_ACTION_USE*} to use items, interact with objects and place some items. Items that have been placed can be picked up again by mining them with the right tool. - - + With the crafting table selected, point the crosshair where you want it and use{*CONTROLLER_ACTION_USE*} to place a crafting table. - - + Point the crosshair at the crafting table and press{*CONTROLLER_ACTION_USE*} to open it. - - + A shovel helps dig soft blocks, like dirt and snow, faster. As you collect more materials you can craft tools that work faster and last longer. Create a wooden shovel.{*WoodenShovelIcon*} - - + An axe helps chop wood and wooden tiles, faster. As you collect more materials you can craft tools that work faster and last longer. Create a wooden axe.{*WoodenHatchetIcon*} - - + A pickaxe helps dig hard blocks, like stone and ore, faster. As you collect more materials you can craft tools that work faster and last longer, and allow you to mine harder materials. Create a wooden pickaxe.{*WoodenPickaxeIcon*} - - + Open the container - - + - - Night time can approach quickly, and it is dangerous to be outside unprepared. You can craft armor and weapons, but it is sensible to have a safe shelter. - - - + Night time can approach quickly, and it is dangerous to be outside unprepared. You can craft armor and weapons, but it is sensible to have a safe shelter. + - - Nearby there is an abandoned Miner's shelter that you can complete to be safe overnight. - - - + Nearby there is an abandoned Miner's shelter that you can complete to be safe overnight. + - - You will need to collect the resources to complete the shelter. Walls and roof can be made of any tile type, but you will want to create a door, some windows and lighting. - - - + You will need to collect the resources to complete the shelter. Walls and roof can be made of any tile type, but you will want to create a door, some windows and lighting. + Use your pickaxe to mine some stone blocks. Stone blocks will produce cobblestone when mined. If you collect 8 cobblestone blocks you can build a furnace. You may need to dig through some dirt to reach the stone, so use your shovel for this.{*StoneIcon*} - - + You have collected enough cobblestone to build a furnace. Use your crafting table to create one. - - + Use{*CONTROLLER_ACTION_USE*} to place the furnace in the world, and then open it. - - + Use the furnace to create some charcoal. If you are waiting for it to finish how about using the time to collect more materials to finish the shelter? - - + Use the furnace to create some glass. If you are waiting for it to finish how about using the time to collect more materials to finish the shelter? - - + A good shelter will have a door so that you can easily go in and out without having to mine and replace the walls. Craft a wooden door now.{*WoodenDoorIcon*} - - + Use{*CONTROLLER_ACTION_USE*} to place the door. You can use{*CONTROLLER_ACTION_USE*} to open and close a wooden door in the world. - - + It can get very dark at night, so you will want some lighting inside your shelter so that you can see. Craft a torch now from sticks and charcoal using the crafting interface.{*TorchIcon*} - - + - - You have completed the first part of the tutorial. - - - + You have completed the first part of the tutorial. + - - {*B*} - Press{*CONTROLLER_VK_A*} to continue with the tutorial.{*B*} - Press{*CONTROLLER_VK_B*} if you think you are ready to play on your own. - - - + {*B*} +Press{*CONTROLLER_VK_A*} to continue with the tutorial.{*B*} +Press{*CONTROLLER_VK_B*} if you think you are ready to play on your own. + - - This is your inventory. It shows items available for use in your hand, and all the other items that you are carrying. Your armor is also shown here. - - - + This is your inventory. It shows items available for use in your hand, and all the other items that you are carrying. Your armor is also shown here. + {*B*} - Press{*CONTROLLER_VK_A*} to continue.{*B*} - Press{*CONTROLLER_VK_B*} if you already know how to use the inventory. - - - +Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to use the inventory. + - - Use{*CONTROLLER_MENU_NAVIGATE*} to move the pointer. Use{*CONTROLLER_VK_A*} to pick an item under the pointer. - If there is more than one item here this will pick them all up, or you can use{*CONTROLLER_VK_X*} to pick up just half of them. - - - + Use{*CONTROLLER_MENU_NAVIGATE*} to move the pointer. Use{*CONTROLLER_VK_A*} to pick an item under the pointer. +If there is more than one item here this will pick them all up, or you can use{*CONTROLLER_VK_X*} to pick up just half of them. + - - Move this item with the pointer over another space in the inventory and place it down using{*CONTROLLER_VK_A*}. - With multiple items on the pointer, use{*CONTROLLER_VK_A*} to place them all, or{*CONTROLLER_VK_X*} to place just one. - - - + Move this item with the pointer over another space in the inventory and place it down using{*CONTROLLER_VK_A*}. +With multiple items on the pointer, use{*CONTROLLER_VK_A*} to place them all, or{*CONTROLLER_VK_X*} to place just one. + - - If you move the pointer outside the edge of the interface with an item on the pointer, you can drop the item. - - - + If you move the pointer outside the edge of the interface with an item on the pointer, you can drop the item. + - - If you want more information about an item, move the pointer over the item and press{*CONTROLLER_VK_RT*} . - - - + If you want more information about an item, move the pointer over the item and press{*CONTROLLER_ACTION_MENU_PAGEDOWN*} . + - - Press{*CONTROLLER_VK_B*} now to exit the inventory. - - - + Press{*CONTROLLER_VK_B*} now to exit the inventory. + - - This is the creative mode inventory. It shows items available for use in your hand, and all the other items that you can choose from. - - - + This is the creative mode inventory. It shows items available for use in your hand, and all the other items that you can choose from. + {*B*} - Press{*CONTROLLER_VK_A*} to continue.{*B*} - Press{*CONTROLLER_VK_B*} if you already know how to use the creative mode inventory. - - - +Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to use the creative mode inventory. + - - Use{*CONTROLLER_MENU_NAVIGATE*} to move the pointer. - When on the item list, use{*CONTROLLER_VK_A*} to pick an item under the pointer, and use{*CONTROLLER_VK_Y*} to pick up a full stack of that item. - - - + Use{*CONTROLLER_MENU_NAVIGATE*} to move the pointer. +When on the item list, use{*CONTROLLER_VK_A*} to pick an item under the pointer, and use{*CONTROLLER_VK_Y*} to pick up a full stack of that item. + - - The pointer will automatically move over a space in the use row. You can place it down using{*CONTROLLER_VK_A*}. Once you have placed the item, the pointer will return to the item list where you can select another item. - - - + The pointer will automatically move over a space in the use row. You can place it down using{*CONTROLLER_VK_A*}. Once you have placed the item, the pointer will return to the item list where you can select another item. + - - If you move the pointer outside the edge of the interface with an item on the pointer, you can drop the item into the world. To clear all items in the quick select bar, press{*CONTROLLER_VK_X*}. - - - + If you move the pointer outside the edge of the interface with an item on the pointer, you can drop the item into the world. To clear all items in the quick select bar, press{*CONTROLLER_VK_X*}. + - - Scroll through the Group Type tabs at the top using{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to select the group type of the item you wish to pickup. - - - + Scroll through the Group Type tabs at the top using{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to select the group type of the item you wish to pickup. + - - If you want more information about an item, move the pointer over the item and press{*CONTROLLER_VK_RT*} . - - - + If you want more information about an item, move the pointer over the item and press{*CONTROLLER_ACTION_MENU_PAGEDOWN*} . + - - Press{*CONTROLLER_VK_B*} now to exit the creative mode inventory. - - - + Press{*CONTROLLER_VK_B*} now to exit the creative mode inventory. + - - This is the crafting interface. This interface allows you to combine the items you've collected to make new items. - - - + This is the crafting interface. This interface allows you to combine the items you've collected to make new items. + - {*B*} - Press{*CONTROLLER_VK_A*} to continue.{*B*} - Press{*CONTROLLER_VK_B*} if you already know how to craft. - - - + {*B*}Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to craft. + {*B*} - Press{*CONTROLLER_VK_X*} to show the item description. - - - +Press{*CONTROLLER_VK_X*} to show the item description. + {*B*} - Press{*CONTROLLER_VK_X*} to show the ingredients required to make the current item. - - - +Press{*CONTROLLER_VK_X*} to show the ingredients required to make the current item. + {*B*} - Press{*CONTROLLER_VK_X*} to show the inventory again. - - - +Press{*CONTROLLER_VK_X*} to show the inventory again. + - - Scroll through the Group Type tabs at the top using{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to select the group type of the item you wish to craft, then use{*CONTROLLER_MENU_NAVIGATE*} to select the item to craft. - - - + Scroll through the Group Type tabs at the top using{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to select the group type of the item you wish to craft, then use{*CONTROLLER_MENU_NAVIGATE*} to select the item to craft. + - - The crafting area shows the items you require in order to craft the new item. Press{*CONTROLLER_VK_A*} to craft the item and place it in your inventory. - - - + The crafting area shows the items you require in order to craft the new item. Press{*CONTROLLER_VK_A*} to craft the item and place it in your inventory. + - - You can craft a larger selection of items using a crafting table. Crafting on a table works in the same way as basic crafting, but you have a larger crafting area allowing more combinations of ingredients. - - - + You can craft a larger selection of items using a crafting table. Crafting on a table works in the same way as basic crafting, but you have a larger crafting area allowing more combinations of ingredients. + - - The bottom right part of the crafting interface shows your inventory. This area can also show a description of the currently selected item, and the ingredients required to craft it. - - - + The bottom right part of the crafting interface shows your inventory. This area can also show a description of the currently selected item, and the ingredients required to craft it. + - - The description of the currently selected item is now displayed. The description can give you an idea of what the item can be used for. - - - + The description of the currently selected item is now displayed. The description can give you an idea of what the item can be used for. + - - The list of ingredients required to craft the selected item are now displayed. - - - + The list of ingredients required to craft the selected item are now displayed. + The wood that you have collected can be crafted into planks. Select the planks icon and press{*CONTROLLER_VK_A*} to create them.{*PlanksIcon*} - - + - - Now you have built a crafting table you should place it in the world to enable you to build a larger selection of items.{*B*} - Press{*CONTROLLER_VK_B*} now to exit the crafting interface. - - - + Now you have built a crafting table you should place it in the world to enable you to build a larger selection of items.{*B*} +Press{*CONTROLLER_VK_B*} now to exit the crafting interface. + - - Press{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to change to the group type of the items you wish to craft. Select the tools group.{*ToolsIcon*} - - - + Press{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to change to the group type of the items you wish to craft. Select the tools group.{*ToolsIcon*} + - - Press{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to change to the group type of the items you wish to craft. Select the structures group.{*StructuresIcon*} - - - + Press{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to change to the group type of the items you wish to craft. Select the structures group.{*StructuresIcon*} + - - Use{*CONTROLLER_MENU_NAVIGATE*} to change to the item you wish to craft. Some items have multiple versions depending on the materials used. Select the wooden shovel.{*WoodenShovelIcon*} - - - + Use{*CONTROLLER_MENU_NAVIGATE*} to change to the item you wish to craft. Some items have multiple versions depending on the materials used. Select the wooden shovel.{*WoodenShovelIcon*} + - - A lot of crafting can involve multiple steps. Now that you have some planks there are more items that you can craft. Use{*CONTROLLER_MENU_NAVIGATE*} to change to the item you wish to craft. Select the crafting table.{*CraftingTableIcon*} - - - + A lot of crafting can involve multiple steps. Now that you have some planks there are more items that you can craft. Use{*CONTROLLER_MENU_NAVIGATE*} to change to the item you wish to craft. Select the crafting table.{*CraftingTableIcon*} + - - With the tools you have built you are off to a great start, and are able to collect a variety of different materials more efficiently.{*B*} - Press{*CONTROLLER_VK_B*} now to exit the crafting interface. - - - + With the tools you have built you are off to a great start, and are able to collect a variety of different materials more efficiently.{*B*} +Press{*CONTROLLER_VK_B*} now to exit the crafting interface. + - - Some items can not be created using the crafting table, but require a furnace. Craft a furnace now.{*FurnaceIcon*} - - - + Some items can not be created using the crafting table, but require a furnace. Craft a furnace now.{*FurnaceIcon*} + - - Place the furnace you have crafted in the world. You will want to put this inside your shelter.{*B*} - Press{*CONTROLLER_VK_B*} now to exit the crafting interface. - - - + Place the furnace you have crafted in the world. You will want to put this inside your shelter.{*B*} +Press{*CONTROLLER_VK_B*} now to exit the crafting interface. + - - This is the furnace interface. A furnace allows you to change items by firing them. For example, you can turn iron ore into iron ingots in the furnace. - - - + This is the furnace interface. A furnace allows you to change items by firing them. For example, you can turn iron ore into iron ingots in the furnace. + {*B*} - Press{*CONTROLLER_VK_A*} to continue.{*B*} - Press{*CONTROLLER_VK_B*} if you already know how to use a furnace. - - - +Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to use a furnace. + - - You need to put some fuel into the bottom slot of the furnace, and the item to be changed in the top slot. The furnace will then fire up and start working, putting the result in the right-hand slot. - - - + You need to put some fuel into the bottom slot of the furnace, and the item to be changed in the top slot. The furnace will then fire up and start working, putting the result in the right-hand slot. + - - Many wooden items can be used as fuels, but not everything burns for the same time. You may also discover other items in the world that can be used as a fuel. - - - + Many wooden items can be used as fuels, but not everything burns for the same time. You may also discover other items in the world that can be used as a fuel. + - - When your items have been fired, you can move them from the output area into your inventory. You should experiment with different ingredients to see what you can make. - - - + When your items have been fired, you can move them from the output area into your inventory. You should experiment with different ingredients to see what you can make. + - - If you use wood as the ingredient then you can make charcoal. Put some fuel in the furnace and wood in the ingredient slot. It can take some time for the furnace to create the charcoal, so feel free to do something else and come back to check the progress. - - - + If you use wood as the ingredient then you can make charcoal. Put some fuel in the furnace and wood in the ingredient slot. It can take some time for the furnace to create the charcoal, so feel free to do something else and come back to check the progress. + - - Charcoal can be used as a fuel, as well as being crafted into a torch with a stick. - - - + Charcoal can be used as a fuel, as well as being crafted into a torch with a stick. + - - Placing sand in the ingredient slot allows you to make glass. Create some glass blocks to use as windows in your shelter. - - - + Placing sand in the ingredient slot allows you to make glass. Create some glass blocks to use as windows in your shelter. + - - This is the brewing interface. You can use this to create potions that have a variety of different effects. - - - + This is the brewing interface. You can use this to create potions that have a variety of different effects. + {*B*} - Press{*CONTROLLER_VK_A*} to continue.{*B*} - Press{*CONTROLLER_VK_B*} if you already know how to use the brewing stand. - - - +Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to use the brewing stand. + - - You brew potions by placing an ingredient in the top slot, and a potion or water bottle in the bottom slots (up to 3 can be brewed at one time). Once a valid combination is entered the brewing process will start and create the potion after a short time. - - - + You brew potions by placing an ingredient in the top slot, and a potion or water bottle in the bottom slots (up to 3 can be brewed at one time). Once a valid combination is entered the brewing process will start and create the potion after a short time. + - - All potions start with a Water Bottle. Most potions are created by first using a Nether Wart to make an Awkward Potion, and will require at least one more ingredient to make the final potion. - - - + All potions start with a Water Bottle. Most potions are created by first using a Nether Wart to make an Awkward Potion, and will require at least one more ingredient to make the final potion. + - - Once you have a potion you can modify its effects. Adding Redstone Dust increases the duration of its effect and adding Glowstone Dust can make its effect more powerful. - - - + Once you have a potion you can modify its effects. Adding Redstone Dust increases the duration of its effect and adding Glowstone Dust can make its effect more powerful. + - - Adding Fermented Spider Eye corrupts the potion and can turn it into a potion with the opposite effect, and adding Gunpowder turns the potion into a Splash Potion which can be thrown to apply its affect to a nearby area. - - - + Adding Fermented Spider Eye corrupts the potion and can turn it into a potion with the opposite effect, and adding Gunpowder turns the potion into a Splash Potion which can be thrown to apply its affect to a nearby area. + - - Create a Potion of Fire Resistance by first adding Nether Wart to a Water Bottle, and then adding Magma Cream. - - - + Create a Potion of Fire Resistance by first adding Nether Wart to a Water Bottle, and then adding Magma Cream. + - - Press{*CONTROLLER_VK_B*} now to exit the brewing interface. - - - + Press{*CONTROLLER_VK_B*} now to exit the brewing interface. + - - In this area there is a Brewing Stand, a Cauldron and a chest full of items for brewing. - - - + In this area there is a Brewing Stand, a Cauldron and a chest full of items for brewing. + {*B*} - Press{*CONTROLLER_VK_A*} to learn more about brewing and potions.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about brewing and potions. - - - +Press{*CONTROLLER_VK_A*} to learn more about brewing and potions.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about brewing and potions. + - - The first step in brewing a potion is to create a Water Bottle. Take a Glass Bottle from the chest. - - - + The first step in brewing a potion is to create a Water Bottle. Take a Glass Bottle from the chest. + - - You can fill a glass bottle from a Cauldron that has water in it, or from a block of water. Fill your glass bottle now by pointing at a water source and pressing{*CONTROLLER_ACTION_USE*}. - - - + You can fill a glass bottle from a Cauldron that has water in it, or from a block of water. Fill your glass bottle now by pointing at a water source and pressing{*CONTROLLER_ACTION_USE*}. + - - If a cauldron becomes empty, you can refill it with a Water Bucket. - - - + If a cauldron becomes empty, you can refill it with a Water Bucket. + - - Use the Brewing Stand to create a Potion of Fire Resistance. You will need a Water Bottle, Nether Wart and Magma Cream. - - - + Use the Brewing Stand to create a Potion of Fire Resistance. You will need a Water Bottle, Nether Wart and Magma Cream. + - - With a potion in your hand, hold{*CONTROLLER_ACTION_USE*} to use it. For a normal potion you will drink it and apply the effect to yourself, and for a Splash potion you will throw it and apply the effect to creatures near where it hits. - Splash potions can be created by adding gunpowder to normal potions. - - - + With a potion in your hand, hold{*CONTROLLER_ACTION_USE*} to use it. For a normal potion you will drink it and apply the effect to yourself, and for a Splash potion you will throw it and apply the effect to creatures near where it hits. +Splash potions can be created by adding gunpowder to normal potions. + - - Use your Potion of Fire Resistance on yourself. - - - + Use your Potion of Fire Resistance on yourself. + - - Now that you are resistant to fire and lava, you should see if there are places you can get to that you couldn't before. - - - + Now that you are resistant to fire and lava, you should see if there are places you can get to that you couldn't before. + - - This is the enchanting interface which you can use to add enchantments to weapons, armor and some tools. - - - + This is the enchanting interface which you can use to add enchantments to weapons, armor and some tools. + {*B*} - Press{*CONTROLLER_VK_A*} to learn more about the enchanting interface.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about the enchanting interface. - - - +Press{*CONTROLLER_VK_A*} to learn more about the enchanting interface.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about the enchanting interface. + - - To enchant an item, first place it in the enchanting slot. Weapons, armor and some tools can be enchanted to add special effects such as improved damage resistance or increasing the number of items produced when mining a block. - - - + To enchant an item, first place it in the enchanting slot. Weapons, armor and some tools can be enchanted to add special effects such as improved damage resistance or increasing the number of items produced when mining a block. + - - When an item is placed in the enchanting slot, the buttons on the right will change to show a selection of random enchantments. - - - + When an item is placed in the enchanting slot, the buttons on the right will change to show a selection of random enchantments. + - - The number on the button represents the cost in experience levels to apply that enchantment to the item. If you do not have a high enough level the button will be disabled. - - - + The number on the button represents the cost in experience levels to apply that enchantment to the item. If you do not have a high enough level the button will be disabled. + - - Select an enchantment and press{*CONTROLLER_VK_A*} to enchant the item. This will decrease your experience level by the cost of the enchantment. - - - + Select an enchantment and press{*CONTROLLER_VK_A*} to enchant the item. This will decrease your experience level by the cost of the enchantment. + - - Although the enchantments are all random, some of the better enchantments are only available when you have a high experience level and have lots of bookcases around the Enchantment Table to increase its power. - - - + Although the enchantments are all random, some of the better enchantments are only available when you have a high experience level and have lots of bookcases around the Enchantment Table to increase its power. + - - In this area there is an Enchantment Table and some other items to help you learn about enchanting. - - - + In this area there is an Enchantment Table and some other items to help you learn about enchanting. + {*B*} - Press{*CONTROLLER_VK_A*} to learn more about enchanting.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about enchanting. - - - +Press{*CONTROLLER_VK_A*} to learn more about enchanting.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about enchanting. + - - Using an Enchantment Table allows you to add special effects such as increasing the number of items produced when mining a block, or improved damage resistance for weapons, armor and some tools. - - - + Using an Enchantment Table allows you to add special effects such as increasing the number of items produced when mining a block, or improved damage resistance for weapons, armor and some tools. + - - Placing bookcases around the Enchantment Table increases its power and allows access to higher level enchantments. - - - + Placing bookcases around the Enchantment Table increases its power and allows access to higher level enchantments. + - - Enchanting items costs Experience Levels, which can be built up by collecting Experience Orbs which are produced by killing monsters and animals, mining ores, breeding animals, fishing and smelting/cooking some things in a furnace. - - - + Enchanting items costs Experience Levels, which can be built up by collecting Experience Orbs which are produced by killing monsters and animals, mining ores, breeding animals, fishing and smelting/cooking some things in a furnace. + - - You can also build experience levels using a Bottle O' Enchanting, which, when thrown, creates Experience Orbs around where it lands. These orbs can then be collected. - - - + You can also build experience levels using a Bottle O' Enchanting, which, when thrown, creates Experience Orbs around where it lands. These orbs can then be collected. + - - In the chests in this area you can find some enchanted items, Bottles O' Enchanting, and some items that have yet to be enchanted for you to experiment with at the Enchantment Table. - - - + In the chests in this area you can find some enchanted items, Bottles O' Enchanting, and some items that have yet to be enchanted for you to experiment with at the Enchantment Table. + - - You are now riding in a minecart. To exit the minecart, point the cursor at it and press{*CONTROLLER_ACTION_USE*} .{*MinecartIcon*} - - - + You are now riding in a minecart. To exit the minecart, point the cursor at it and press{*CONTROLLER_ACTION_USE*} .{*MinecartIcon*} + {*B*} - Press{*CONTROLLER_VK_A*} to learn more about minecarts.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about minecarts. - - - +Press{*CONTROLLER_VK_A*} to learn more about minecarts.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about minecarts. + - - A minecart runs on rails. You can also craft a powered minecart with a furnace and a minecart with a chest in it. - {*RailIcon*} - - - + A minecart runs on rails. You can also craft a powered minecart with a furnace and a minecart with a chest in it.{*RailIcon*} + - - You can also craft powered rails, which take power from redstone torches and circuits to accelerate the cart. These can be connected to switches, levers and pressure plates to make complex systems. - {*PoweredRailIcon*} - - - + You can also craft powered rails, which take power from redstone torches and circuits to accelerate the cart. These can be connected to switches, levers and pressure plates to make complex systems.{*PoweredRailIcon*} + - - You are now sailing a boat. To exit the boat, point the cursor at it and press{*CONTROLLER_ACTION_USE*} .{*BoatIcon*} - - - + You are now sailing a boat. To exit the boat, point the cursor at it and press{*CONTROLLER_ACTION_USE*} .{*BoatIcon*} + - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about boats.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about boats. - - - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about boats.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about boats. + - - A boat allows you to travel quicker over water. You can steer it using{*CONTROLLER_ACTION_MOVE*} and{*CONTROLLER_ACTION_LOOK*}. - {*BoatIcon*} - - - + A boat allows you to travel quicker over water. You can steer it using{*CONTROLLER_ACTION_MOVE*} and{*CONTROLLER_ACTION_LOOK*}.{*BoatIcon*} + - - You are now using a fishing rod. Press{*CONTROLLER_ACTION_USE*} to use it.{*FishingRodIcon*} - - - + You are now using a fishing rod. Press{*CONTROLLER_ACTION_USE*} to use it.{*FishingRodIcon*} + - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about fishing.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about fishing. - - - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about fishing.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about fishing. + - - Press{*CONTROLLER_ACTION_USE*} to cast your line and start fishing. Press{*CONTROLLER_ACTION_USE*} again to reel in the fishing line. - {*FishingRodIcon*} - - - + Press{*CONTROLLER_ACTION_USE*} to cast your line and start fishing. Press{*CONTROLLER_ACTION_USE*} again to reel in the fishing line.{*FishingRodIcon*} + - - If you wait until the float sinks below the surface of the water before reeling in you can catch a fish. Fish can be eaten raw, or cooked by a furnace, to restore health. - {*FishIcon*} - - - + If you wait until the float sinks below the surface of the water before reeling in you can catch a fish. Fish can be eaten raw, or cooked by a furnace, to restore health.{*FishIcon*} + - - As with many other tools a fishing rod has a fixed number of uses. Those uses are not limited to catching fish though. You should experiment with it to see what else can be caught or activated... - {*FishingRodIcon*} - - - + As with many other tools a fishing rod has a fixed number of uses. Those uses are not limited to catching fish though. You should experiment with it to see what else can be caught or activated...{*FishingRodIcon*} + - - This is a bed. Press{*CONTROLLER_ACTION_USE*} while pointing at it at night to sleep through the night and awake in the morning.{*ICON*}355{*/ICON*} - - - + This is a bed. Press{*CONTROLLER_ACTION_USE*} while pointing at it at night to sleep through the night and awake in the morning.{*ICON*}355{*/ICON*} + - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about beds.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about beds. - - - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about beds.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about beds. + - - A bed should be placed in a safe, well-lit place so that monsters do not wake you in the middle of the night. Once you have used a bed, if you die you will respawn at that bed. - {*ICON*}355{*/ICON*} - - - + A bed should be placed in a safe, well-lit place so that monsters do not wake you in the middle of the night. Once you have used a bed, if you die you will respawn at that bed. +{*ICON*}355{*/ICON*} + - - If there are other players in your game, everyone must be in a bed at the same time to be able to sleep. - {*ICON*}355{*/ICON*} - - - + If there are other players in your game, everyone must be in a bed at the same time to be able to sleep. +{*ICON*}355{*/ICON*} + - - In this area there are some simple Redstone and Piston circuits, and a chest with more items to extend these circuits. - - - + In this area there are some simple Redstone and Piston circuits, and a chest with more items to extend these circuits. + - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about Redstone circuits and Pistons.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about Redstone circuits and Pistons. - - - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Redstone circuits and Pistons.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about Redstone circuits and Pistons. + - - Levers, Buttons, Pressure Plates and Redstone Torches can all provide power to circuits, either by directly attaching them to the item you want to activate or by connecting them with Redstone dust. - - - + Levers, Buttons, Pressure Plates and Redstone Torches can all provide power to circuits, either by directly attaching them to the item you want to activate or by connecting them with Redstone dust. + - - The position and direction that you place a power source can change how it affects the surrounding blocks. For example a Redstone torch on the side of a block can be turned off if the block is powered by another source. - - - + The position and direction that you place a power source can change how it affects the surrounding blocks. For example a Redstone torch on the side of a block can be turned off if the block is powered by another source. + - - Redstone dust is collected by mining redstone ore with a pickaxe made of Iron, Diamond or Gold. You can use it to carry power up to 15 blocks, and it can travel up or down one block in height. - {*ICON*}331{*/ICON*} - - - + Redstone dust is collected by mining redstone ore with a pickaxe made of Iron, Diamond or Gold. You can use it to carry power up to 15 blocks, and it can travel up or down one block in height. +{*ICON*}331{*/ICON*} + - - Redstone repeaters can be used to extend the distance that the power is carried, or put a delay in a circuit. - {*ICON*}356{*/ICON*} - - - + Redstone repeaters can be used to extend the distance that the power is carried, or put a delay in a circuit. +{*ICON*}356{*/ICON*} + - - When powered, a Piston will extend, pushing up to 12 blocks. When they retract, Sticky Pistons can pull back one block of most types. - {*ICON*}33{*/ICON*} - - - + When powered, a Piston will extend, pushing up to 12 blocks. When they retract, Sticky Pistons can pull back one block of most types. +{*ICON*}33{*/ICON*} + - - In the chest in this area there are some components for making circuits with pistons. Try using or completing the circuits in this area, or put together your own. There are more examples outside the tutorial area. - - - + In the chest in this area there are some components for making circuits with pistons. Try using or completing the circuits in this area, or put together your own. There are more examples outside the tutorial area. + - - In this area there is a Portal to the Nether! - - - + In this area there is a Portal to the Nether! + - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about Portals and The Nether.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about Portals and The Nether. - - - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Portals and The Nether.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about Portals and The Nether. + - - Portals are created by placing Obsidian blocks into a frame four blocks wide and five blocks tall. The corner blocks are not required. - - - + Portals are created by placing Obsidian blocks into a frame four blocks wide and five blocks tall. The corner blocks are not required. + - - To activate a Nether Portal, set fire to the Obsidian blocks inside the frame with a Flint and Steel. Portals can be deactivated if their frame is broken, an explosion happens nearby or a liquid flows through them. - - - + To activate a Nether Portal, set fire to the Obsidian blocks inside the frame with a Flint and Steel. Portals can be deactivated if their frame is broken, an explosion happens nearby or a liquid flows through them. + - - To use a Nether Portal, stand inside it. Your screen will go purple and a sound will play. After a few seconds you will be transported to another dimension. - - - + To use a Nether Portal, stand inside it. Your screen will go purple and a sound will play. After a few seconds you will be transported to another dimension. + - - The Nether can be a dangerous place, full of lava, but can be useful to collect Netherrack which burns forever when lit, and Glowstone which produces light. - - - + The Nether can be a dangerous place, full of lava, but can be useful to collect Netherrack which burns forever when lit, and Glowstone which produces light. + - - The Nether world can be used to fast-travel in the Overworld - traveling one block distance in the Nether is equivalent to traveling 3 blocks in the Overworld. - - - + The Nether world can be used to fast-travel in the Overworld - traveling one block distance in the Nether is equivalent to traveling 3 blocks in the Overworld. + - - You are now in Creative mode. - - - + You are now in Creative mode. + - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about Creative mode.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about Creative mode. - - - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Creative mode.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about Creative mode. + When in Creative mode you have in infinite number of all available items and blocks, you can destroy blocks with one click without a tool, you are invulnerable and you can fly. - - + + + Pressing{*CONTROLLER_ACTION_JUMP*} twice quickly will allow you to fly. To exit flying, repeat the action. To fly faster, push{*CONTROLLER_ACTION_MOVE*} forward twice in rapid succession while flying. +When in flying mode, you can hold down{*CONTROLLER_ACTION_JUMP*} to move up and{*CONTROLLER_ACTION_SNEAK*} to move down, or use the directional buttons to move up, down, left or right. + Press{*CONTROLLER_ACTION_CRAFTING*} to open the creative inventory interface. - - + Make your way to the opposite side of this hole to continue. - - + You have now completed the Creative mode tutorial. - - + - - In this area a farm has been set up. Farming enables you to create a renewable source of food and other items. - - - + In this area a farm has been set up. Farming enables you to create a renewable source of food and other items. + - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about farming.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about farming. - - - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about farming.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about farming. + Wheat, Pumpkins and Melons are grown from seeds. Wheat seeds are collected by breaking Tall Grass or harvesting wheat, and Pumpkin and Melon seeds are crafted from Pumpkins and Melons respectively. - - + Before planting seeds the dirt blocks need to be turned into Farmland by using a Hoe. A nearby source of water will help keep the Farmland hydrated and make the crops grow faster, as will keeping the area lit. - - + Wheat goes through several stages when growing, and is ready to be harvested when it appears darker.{*ICON*}59:7{*/ICON*} - - + Pumpkins and Melons also need a block next to where you planted the seed for the fruit to grow once the stem has fully grown. - - + Sugarcane must be planted on a Grass, Dirt or Sand block that is right next to water block. Chopping a Sugarcane block will also drop all blocks that are above it.{*ICON*}83{*/ICON*} - - + Cacti must be planted on Sand, and will grow up to three blocks high. Like Sugarcane, destroying the lowest block will also allow you to collect the blocks that are above it.{*ICON*}81{*/ICON*} - - + Mushrooms should be planted in a dimly lit area, and will spread to nearby dimly lit blocks.{*ICON*}39{*/ICON*} - - + Bonemeal can be used to grow crops to their fully grown state, or grow Mushrooms into Huge Mushrooms.{*ICON*}351:15{*/ICON*} - - + You have now completed the farming tutorial. - - + - - In this area animals have been penned in. You can breed animals to produce baby versions of themselves. - - - + In this area animals have been penned in. You can breed animals to produce baby versions of themselves. + - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about animals and breeding.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about animals and breeding. - - - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about animals and breeding.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about animals and breeding. + To get the animals to breed, you will need to feed them with the right food to get them to go into 'Love Mode'. - - + Feed Wheat to a cow, mooshroom or sheep, Carrots to pigs, Wheat Seeds or Nether Wart to a chicken, or any kind of meat to a wolf, and they'll start looking for another animal of the same species near them that is also in Love Mode. - - + When two animals of the same species meet, and both are in Love Mode, they will kiss for a few seconds, and then a baby animal will appear. The baby animal will follow their parents for a while before growing into a full sized animal itself. - - + After being in Love Mode, an animal will not be able to enter it again for about five minutes. - - + Some animals will follow you if you are holding their food in your hand. This makes it easier to group animals together to breed them.{*ICON*}296{*/ICON*} - - + - - Wild wolves can be tamed by giving them bones. Once tamed Love Hearts will appear around them. Tamed wolves will follow the player and defend them if they haven't been commanded to sit. - - - + Wild wolves can be tamed by giving them bones. Once tamed Love Hearts will appear around them. Tamed wolves will follow the player and defend them if they haven't been commanded to sit. + You have now completed the animal and breeding tutorial. - - + - - In this area are some pumpkins and blocks to make a Snow Golem and an Iron Golem. - - - + In this area are some pumpkins and blocks to make a Snow Golem and an Iron Golem. + - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about Golems.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about Golems. - - - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Golems.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about Golems. + Golems are created by placing a pumpkin on top of a stack of blocks. - - + Snow Golems are created with two Snow Blocks, one of top of the other, with a pumpkin on top. Snow Golems throw snowballs at your enemies. - - + Iron Golems are created with four Iron Blocks in the pattern shown, with a pumpkin on top of the middle block. Iron Golems attack your enemies. - - + Iron Golems also appear naturally to protect villages, and will attack you if you attack any villagers. - - + You cannot leave this area until you have completed the tutorial. - - + Different tools are better for different materials. You should use a shovel to mine soft materials like earth and sand. - - + Different tools are better for different materials. You should use an axe to chop tree trunks. - - + Different tools are better for different materials. You should use a pickaxe to mine stone and ore. You may need to make your pickaxe from better materials to get resources from some blocks. - - + Certain tools are better for attacking enemies. Consider using a sword to attack. - - + Hint: Hold {*CONTROLLER_ACTION_ACTION*}to mine and chop using your hand or whatever you are holding. You may need to craft a tool to mine some blocks... - - + The tool you are using has become damaged. Every time you use a tool it becomes damaged, and will eventually break. The colored bar below the item in your inventory shows the current damage state. - - + Hold{*CONTROLLER_ACTION_JUMP*} to swim up. - - + In this area there is a minecart on a track. To enter the minecart, point the cursor at it and press{*CONTROLLER_ACTION_USE*}. Use{*CONTROLLER_ACTION_USE*} on the button to make the minecart move. - - + In the chest beside the river there is a boat. To use the boat, point the cursor at water and press{*CONTROLLER_ACTION_USE*}. Use{*CONTROLLER_ACTION_USE*} while pointing at the boat to enter it. - - + In the chest beside the pond there is a fishing rod. Take the fishing rod from the chest and select it as the current item in your hand to use it. - - + This more advanced piston mechanism creates a self-repairing bridge! Push the button to activate, then investigate how the components interact to learn more. - - + If you move the pointer outside of the interface while carrying an item, you can drop that item. - - + You do not have all the ingredients required to make this item. The box on the bottom left shows the ingredients required to craft this. - - + - - Congratulations, you have completed the tutorial. Time in the game is now passing normally, and you don't have long until night time and the monsters come out! Finish your shelter! - - - + Congratulations, you have completed the tutorial. Time in the game is now passing normally, and you don't have long until night time and the monsters come out! Finish your shelter! + {*EXIT_PICTURE*} When you are ready to explore further, there is a stairway in this area near the Miner's shelter that leads to a small castle. - - + Reminder: - - + - - - + <div align="center"><img src="Graphics\TutorialExitScreenshot.png"/></div> + New features have been added to the game in the latest version, including new areas in the tutorial world. - - + {*B*}Press{*CONTROLLER_VK_A*} to play through the tutorial as normal.{*B*} - Press{*CONTROLLER_VK_B*} to skip the main tutorial. - - +Press{*CONTROLLER_VK_B*} to skip the main tutorial. + In this area you will find areas setup to help you learn about fishing, boats, pistons and redstone. - - + Outside of this area you will find examples of buildings, farming, minecarts and tracks, enchanting, brewing, trading, smithing and more! - - + - - Your food bar has depleted to a level where you will no longer heal. - - - + Your food bar has depleted to a level where you will no longer heal. + - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about the food bar and eating food.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about the food bar and eating food. - - - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about the food bar and eating food.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about the food bar and eating food. + + + This is the horse inventory interface. + + + {*B*}Press{*CONTROLLER_VK_A*} to continue. +{*B*}Press{*CONTROLLER_VK_B*} if you already know how to use the horse inventory. + + + The horse inventory allows you to transfer, or equip items to your Horse, Donkey or Mule. + + + Saddle your Horse by placing a Saddle in the saddle slot. Horses can be given armor by placing Horse Armor in the armor slot. + + + You can also transfer items between your own inventory and the saddlebags strapped to Donkeys and Mules in this menu. + + + You have found a Horse. + + + You have found a Donkey. + + + You have found a Mule. + + + {*B*}Press{*CONTROLLER_VK_A*} to learn more about Horses, Donkeys and Mules. +{*B*}Press{*CONTROLLER_VK_B*} if you already know about Horses, Donkeys and Mules. + + + Horses and Donkeys are found mainly in open plains. Mules can be bred from a Donkey and a Horse, but are infertile themselves. + + + All adult Horses, Donkeys and Mules can be ridden. However only Horses can be armored, and only Mules and Donkeys may be equipped with saddlebags for transporting items. + + + Horses, Donkeys and Mules must be tamed before they can be used. A horse is tamed by attempting to ride it, and managing to stay on the horse while it attempts to throw the rider off. + + + When tamed Love Hearts will appear around them and they will no longer buck the player off. + + + Try to ride this horse now. Use {*CONTROLLER_ACTION_USE*} with no items or tools in your hand to mount it. + + + To steer a horse they must then be equipped with a saddle, which can be bought from villagers or found inside chests hidden in the world. + + + Tame Donkeys and Mules can be given saddlebags by attaching a chest. These bags can be accessed whilst riding or when sneaking. + + + Horses and Donkeys (but not Mules) can be bred like other animals using Golden Apples or Golden Carrots. Foals will grow into adult horses over time, although feeding them wheat or hay will speed this up. + + + You can try to tame the Horses and Donkeys here, and there are Saddles, Horse Armor and other useful items for Horses in chests around here too. + + + This is the Beacon interface, which you can use to choose powers for your Beacon to grant. + + + {*B*} +Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to use the Beacon interface. + + + In the Beacon menu you can select 1 primary power for your Beacon. The more tiers your pyramid has the more powers you will have to choose from. + + + A Beacon on a pyramid with at least 4 tiers grants an additional option of either the Regeneration secondary power or a stronger primary power. + + + To set the powers of your Beacon you must sacrifice an Emerald, Diamond, Gold or Iron Ingot in the payment slot. Once set, the powers will emanate from the Beacon indefinitely. + + + At the top of this pyramid there is an inactivate Beacon. + + + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Beacons.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about Beacons. + + + Active Beacons project a bright beam of light into the sky and grant powers to nearby players. They are crafted with Glass, Obsidian and Nether Stars, which can be obtained by defeating the Wither. + + + Beacons must be placed so that they are in sunlight during the day. Beacons must be placed on Pyramids of Iron, Gold, Emerald or Diamond. However the choice of material has no effect on the power of the beacon. + + + Try using the Beacon to set the powers it grants. You can use the Iron Ingots provided as the necessary payment. + + + This room contains Hoppers + + + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Hoppers.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about Hoppers. + + + Hoppers are used to insert or remove items from containers, and to automatically pick-up items thrown into them. + + + They can affect Brewing Stands, Chests, Dispensers, Droppers, Minecarts with Chests, Minecarts with Hoppers, as well as other Hoppers. + + + Hoppers will continuously attempt to suck items out of suitable container placed above them. It will also attempt to insert stored items into an output container. + + + However if a Hopper is powered by Redstone it will become inactive and stop both sucking and inserting items. + + + A Hopper points in the direction it tries to output items. To make a Hopper point to a particular block, place the Hopper against that block whilst sneaking. + + + There are various useful Hopper layouts for you to see and experiment with in this room. + + + This is the Firework interface, which you can use to craft Fireworks and Firework Stars. + + + {*B*} +Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to use the Firework interface. + + + To craft a Firework, place Gunpowder and Paper in the 3x3 crafting grid that is shown above your inventory. + + + You can optionally place multiple Firework Stars in the crafting grid to add them to the Firework. + + + Filling more slots in the crafting grid with Gunpowder will increase the height at which all the Firework Stars will explode. + + + You can then take the crafted Firework out of the output slot when you wish to craft it. + + + Firework Stars can be crafted by placing Gunpowder and Dye into the crafting grid. + + + The Dye will set the color of the explosion of the Firework Star. + + + The shape of the Firework Star is set by adding either a Fire Charge, Gold Nugget, Feather or Mob Head. + + + A trail or a twinkle can be added using Diamonds or Glowstone Dust. + + + After a Firework Star has been crafted, you can set the fade color of the Firework Star by crafting it with Dye. + + + Contained within the chests here there are various items used in the creation of FIREWORKS! + + + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Fireworks. {*B*} +Press{*CONTROLLER_VK_B*} if you already know about Fireworks. + + + Fireworks are decorative items that can be launched by hand or from Dispensers. They are crafted using Paper, Gunpowder and optionally a number of Firework Stars. + + + The colors, fade, shape, size, and effects (such as trails and twinkles) of Firework Stars can be customized by including additional ingredients when crafting. + + + Try crafting a Firework at the Crafting Table using an assortment of ingredients from the chests. + Select - - + Use - - + Back - - + Exit - - + Cancel - - + Cancel Join - - + + + NOT USED + + + NOT USED + Refresh Online Games List - - + Party Games - - + All Games - - + Change Group - - + Show Inventory - - + Show Description - - + Show Ingredients - - + Crafting - - + Create - - + Take/Place - - + Take - - + Take All - - + Take Half - - + Place - - + Place All - - + Place One - - + Drop - - + Drop All - - + Drop One - - + Swap - - + Quick Move - - + Clear Quick Select - - + What's This? - - + Share To Facebook - - + Change Filter - - + + + "NOT USED" + + + "NOT USED" + Send Friend Request - - + Page Down - - + Page Up - - + Next - - + Previous - - + Kick Player - - + Dye - - + Mine - - + Feed - - + Tame - - + Heal - - + Sit - - + Follow Me - - + Eject - - + Empty - - + Saddle - - + Place - - + Hit - - + Milk - - + Collect - - + Eat - - + Sleep - - + Wake Up - - + Play - - + Ride - - + Sail - - + Grow - - + Swim Up - - + Open - - + Change Pitch - - + Detonate - - + Read - - + Hang - - + Throw - - + Plant - - + Till - - + Harvest - - + Continue - - + Unlock Full Game - - + Delete Save - - + Delete - - + Options - - + + + Invite Friends + Invite Friends - - + Accept - - + Shear - - + Ban Level - - + Select Skin - - + Ignite - - + Navigate - - + Install Full Version - - + Install Trial Version - - + Install - - + Reinstall - - + Save Options - - + Execute Command - - + Creative - - + Move Ingredient - - + Move Fuel - - + Move Tool - - + Move Armor - - + Move Weapon - - + Equip - - + Draw - - + Release - - + Privileges - - + Block - - + Page Up - - + Page Down - - + Love Mode - - + Drink - - + Rotate - - + Hide - - + + + Upload Save For Xbox One + Clear All Slots - - + + + Upload Save for PS3™/PS4™ + + + Mount + + + Dismount + + + Attach Chest + + + Launch + + + Leash + + + Release + + + Attach + + + Name + OK - - + Cancel - - + Minecraft Store - - + Are you sure you want to leave your current game and join the new one? Any unsaved progress will be lost. - - + Exit Game - - + Save Game - - + Exit Without Saving - - + Are you sure you want to overwrite any previous save for this world with the current version of this world? - - + Are you sure you want to exit without saving? You will lose all progress in this world! - - + Start Game - - + + + If you create, load or save a world in Creative Mode, that world will have trophies and leaderboard updates disabled, even if it is then loaded in Survival Mode. Are you sure you want to continue? + + + This world has previously been saved in Creative Mode, and it will have trophies and leaderboard updates disabled. Are you sure you want to continue? + + + This world has previously been saved in Creative Mode, and it will have trophies and leaderboard updates disabled. + + + If you create, load or save a world with Host Privileges enabled, that world will have trophies and leaderboard updates disabled, even if it is then loaded with those options off. Are you sure you want to continue? + Damaged Save - - + This save is corrupt or damaged. Would you like to delete it? - - + Are you sure you want to exit to the main menu and disconnect all players from the game? Any unsaved progress will be lost. - - + Exit and save - - + Exit without saving - - + Are you sure you want to exit to the main menu? Any unsaved progress will be lost. - - + Are you sure you want to exit to the main menu? Your progress will be lost! - - + Create New World - - + Play Tutorial - - + Tutorial - - + Name Your World - - + Enter a name for your world - - + Input the seed for your world generation - - + Load Saved World - - + Press START to join game - - + Exiting the game - - + An error occurred. Exiting to the main menu. - - + Connection failed - - + Connection lost - - + Connection to the server was lost. Exiting to the main menu. - - + + + Connection to "PSN" was lost. Exiting to the main menu. + + + Connection to "PSN" was lost. + Disconnected by the server - - + You were kicked from the game - - + You were kicked from the game for flying - - + Connection attempt took too long - - + The server is full - - + The host has exited the game. - - + You cannot join this game as you are not friends with anybody in the game. - - + You cannot join this game as you have previously been kicked by the host. - - + You cannot join this game as the player you are trying to join is running an older version of the game. - - + You cannot join this game as the player you are trying to join is running a newer version of the game. - - + New World - - + Award Unlocked! - - + Hurray - you've been awarded a gamerpic featuring Steve from Minecraft! - - + Hurray - you've been awarded a gamerpic featuring a Creeper! - - + + + Hurray - you've been awarded an avatar item - a Minecraft: Xbox 360 Edition t-shirt! +Go to the dashboard to put the t-shirt on your avatar. + + + Hurray - you've been awarded an avatar item - a Minecraft: Xbox 360 Edition watch! +Go to the dashboard to put the watch on your avatar. + + + Hurray - you've been awarded an avatar item - a Creeper baseball cap! +Go to the dashboard to put the cap on your avatar. + + + Hurray - you've been awarded the Minecraft: Xbox 360 Edition theme! +Go to the dashboard to select this theme. + Unlock Full Game - - + You're playing the trial game, but you'll need the full game to be able to save your game. Would you like to unlock the full game now? - - + + + This is the Minecraft: Xbox 360 Edition trial game. If you had the full game, you would just have earned a trophy! +Unlock the full game to experience the joy of Minecraft: Xbox 360 Edition and to play with your friends across the globe through "PSN". +Would you like to unlock the full game? + + + This is the Minecraft: Xbox 360 Edition trial game. If you had the full game, you would just have earned an avatar award! +Would you like to unlock the full game? + + + This is the Minecraft: Xbox 360 Edition trial game. If you had the full game, you would just have earned a gamerpic! +Would you like to unlock the full game? + + + This is the Minecraft: Xbox 360 Edition trial game. If you had the full game, you would just have earned a theme! +Unlock the full game to experience the joy of Minecraft: Xbox 360 Edition and to play with your friends across the globe through "PSN". +Would you like to unlock the full game? + + + This is the Minecraft: Xbox 360 Edition trial game. You need the full game to be able to accept this invite. +Would you like to unlock the full game? + + + Guest players cannot unlock the full game. Please sign in with a Sony Entertainment Network account. + Please wait - - + No results - - + Filter: - - + Friends - - + My Score - - + Overall - - + Entries: - - + Rank - - + + + Online ID + + + Kills Easy + + + Kills Normal + + + Kills Hard + + + Mining Blocks Peaceful + + + Mining Blocks Easy + + + Mining Blocks Normal + + + Mining Blocks Hard + + + Farming Peaceful + + + Farming Easy + + + Farming Normal + + + Farming Hard + + + Traveling Peaceful + + + Traveling Easy + + + Traveling Normal + + + Traveling Hard + Preparing to Save Level - - + Preparing Chunks... - - + Finalizing... - - + Building Terrain - - + Simulating world for a bit - - + Initializing server - - + Generating spawn area - - + Loading spawn area - - + Entering The Nether - - + Leaving The Nether - - + Respawning - - + Generating level - - + Loading level - - + Saving players - - + Connecting to host - - + Downloading terrain - - + Switching to offline game - - + Please wait while the host saves the game - - + Entering The END - - + Leaving The END - - + + + Finding Seed for the World Generator + This bed is occupied - - + You can only sleep at night - - + %s is sleeping in a bed. To skip to dawn, all players need to sleep in beds at the same time. - - + Your home bed was missing or obstructed - - + You may not rest now, there are monsters nearby - - + You are sleeping in a bed. To skip to dawn, all players need to sleep in beds at the same time. - - + Tools and Weapons - - + Weapons - - + Food - - + Structures - - + Armor - - + Mechanisms - - + Transport - - + Decorations - - + Building Blocks - - + Redstone & Transportation - - + Miscellaneous - - + Brewing - - + + + Brewing + Tools, Weapons & Armor - - + Materials - - + Signed out - - + + + You have been returned to the title screen because you have been signed out of the "PSN". + + Difficulty - - + Music - - + Sound - - + Gamma - - + Game Sensitivity - - + Interface Sensitivity - - + Peaceful - - + Easy - - + Normal - - + Hard - - + In this mode, the player regains health over time, and there are no enemies in the environment. - - + In this mode, enemies spawn in the environment, but will do less damage to the player than in the Normal mode. - - + In this mode, enemies spawn in the environment and will do a standard amount of damage to the player. - - + In this mode, enemies will spawn in the environment, and will do a great deal of damage to the player. Watch out for the Creepers too, since they are unlikely to cancel their exploding attack when you move away from them! - - + Trial Timeout - - + + + You've been playing the Minecraft: Xbox 360 Edition Trial Game for the maximum time allowed! To continue the fun, would you like to unlock the full game? + Game full - - + Failed to join game as there are no spaces left - - + Enter Sign Text - - + Enter a line of text for your sign - - + Enter Title - - + Enter a title for your post - - + Enter Caption - - + Enter a caption for your post - - + Enter Description - - + Enter a description for your post - - + Inventory - - + Ingredients - - + Brewing Stand - - + Chest - - + Enchant - - + Furnace - - + Ingredient - - + Fuel - - + Dispenser - - + + + Horse + + + Dropper + + + Hopper + + + Beacon + + + Primary Power + + + Secondary Power + + + Minecart + There are no downloadable content offers of this type available for this title at the moment. - - + %s has joined the game. - - + %s has left the game. - - + %s was kicked from the game. - - + Are you sure you want to delete this save game? - - + Awaiting approval - - + Censored - - + Now playing: - - + Reset Settings - - + Are you sure you would like to reset your settings to their default values? - - + Loading Error - - + + + "Minecraft: Xbox 360 Edition" has failed to load, and cannot continue. + %s's Game - - + Unknown host game - - + Guest signed out - - + A guest player has signed out causing all guest players to be removed from the game. - - + Sign in - - + You are not signed in. In order to play this game, you will need to be signed in. Do you want to sign in now? - - + Multiplayer not allowed - - + + + Failed to join the game as one or more players are not allowed to play Online due to their Sony Entertainment Network account chat restrictions. + + + Failed to create an online game as one or more players are not allowed to play Online due to their Sony Entertainment Network account chat restrictions. Uncheck the "Online Game" box in "More Options" to start an offline game. + + + You are not allowed to join this game session because Online is disabled on your Sony Entertainment Network account due to chat restrictions. + + + You are not allowed to join this game session because one of your local players has Online disabled on their Sony Entertainment Network account due to chat restrictions. Uncheck the "Online Game" box in "More Options" to start an offline game. + + + You are not allowed to join this game session because a player in the session has a Member Content privilege setting of Friends Only, and you are not on their Friends List. + Failed to create game - - + + + You are not allowed to create this game session because one of your local players has Online disabled on their Sony Entertainment Network account due to chat restrictions. Uncheck the "Online Game" box in "More Options" to start an offline game. + Auto Selected - - + No Pack: Default Skins - - + Favorite Skins - - + Banned Level - - + The game you are joining is in your banned level list. If you choose to join this game, the level will be removed from your banned level list. - - + Ban This Level? - - + Are you sure you want to add this level to your banned level list? Selecting OK will also exit this game. - - + Remove from Banned List - - + Autosave Interval - - + Autosave Interval: OFF - - + Mins - - + Can't Place Here! - - + Placing lava close to the level spawn point is not allowed due to the possibility of instant death for spawning players. - - + + + This game has a level autosave feature. When you see the icon above displayed, the game is saving your data. +Please do not turn off your Xbox 360 system while this icon is on-screen. + Interface Opacity - - + Preparing to Autosave Level - - + HUD Size - - + HUD Size (Splitscreen) - - + Seed - - + Unlock Skin Pack - - + To use the skin you have selected, you need to unlock this skin pack. Would you like to unlock this skin pack now? - - + Unlock Texture Pack - - + To use this texture pack for your world, you need to unlock it. Would you like to unlock it now? - - + Trial Texture Pack - - + You are using a trial version of the texture pack. You will not be able to save this world unless you unlock the full version. Would you like to unlock the full version of the texture pack? - - + Texture Pack Not Present - - + Unlock Full Version - - + Download Trial Version - - + Download Full Version - - + This world uses a mash-up pack or texture pack you don't have! Would you like to install the mash-up pack or texture pack now? - - + Get Trial Version - - + Get Full Version - - + Kick player - - + Are you sure you want to kick this player from the game? They will not be able to rejoin until you restart the world. - - + Gamerpics Packs - - + Themes - - + Skins Packs - - + Allow friends of friends - - + You cannot join this game because it has been limited to players who are friends of the host. - - + Can't Join Game - - + Selected - - + Selected skin: - - + Corrupt Downloadable Content - - + This downloadable content is corrupt and cannot be used. You need to delete it, then re-install it from the Minecraft Store menu. - - + Some of your downloadable content is corrupt and cannot be used. You need to delete them, then re-install them from the Minecraft Store menu. - - + Your game mode has been changed - - + Rename Your World - - + Enter the new name for your world - - + Game Mode: Survival - - + Game Mode: Creative - - + + + Game Mode: Adventure + Survival - - + Creative - - + + + Adventure + Created in Survival Mode - - + Created in Creative Mode - - + Render Clouds - - + What would you like to do with this save game? - - + Rename Save - - + Autosaving in %d... - - + On - - + Off - - + Normal - - + Superflat - - + + + Enter a seed to generate the same terrain again. Leave blank for a random world. + When enabled, the game will be an online game. - - + When enabled, only invited players can join. - - + When enabled, friends of people on your Friends List can join the game. - - + When enabled, players can inflict damage on other players. Only affects Survival mode. - - + When disabled, players joining the game cannot build or mine until authorised. - - + When enabled, fire may spread to nearby flammable blocks. - - + When enabled, TNT will explode when activated. - - + + + When enabled, the host can toggle their ability to fly, disable exhaustion, and make themselves invisible from the in-game menu. Disables trophies and leaderboard updates. + When enabled, the Nether world will be re-generated. This is useful if you have an older save where Nether Fortresses were not present. - - + When enabled, structures such as Villages and Strongholds will generate in the world. - - + When enabled, a completely flat world will be generated in the Overworld and in the Nether. - - + When enabled, a chest containing some useful items will be created near the player spawn point. - - + + + When disabled, prevents monsters and animals from changing blocks (for example, Creeper explosions won't destroy blocks and Sheep won't remove Grass) or picking up items. + + + When enabled, players will keep their inventory when they die. + + + When disabled, mobs will not spawn naturally. + + + When disabled, monsters and animals will not drop loot (for example, Creepers won't drop gunpowder). + + + When disabled, blocks will not drop items when destroyed (for example, Stone blocks won't drop Cobblestone). + + + When disabled, players will not regenerate health naturally. + + + When disabled, the time of day will not change. + Skin Packs - - + Themes - - + Gamerpics - - + Avatar Items - - + Texture Packs - - + Mash-Up Packs - - + {*PLAYER*} went up in flames - - + {*PLAYER*} burned to death - - + {*PLAYER*} tried to swim in lava - - + {*PLAYER*} suffocated in a wall - - + {*PLAYER*} drowned - - + {*PLAYER*} starved to death - - + {*PLAYER*} was pricked to death - - + {*PLAYER*} hit the ground too hard - - + {*PLAYER*} fell out of the world - - + {*PLAYER*} died - - + {*PLAYER*} blew up - - + {*PLAYER*} was killed by magic - - + {*PLAYER*} was killed by Ender Dragon breath - - + {*PLAYER*} was slain by {*SOURCE*} - - + {*PLAYER*} was slain by {*SOURCE*} - - + {*PLAYER*} was shot by {*SOURCE*} - - + {*PLAYER*} was fireballed by {*SOURCE*} - - + {*PLAYER*} was pummeled by {*SOURCE*} - - + - {*PLAYER*} was killed by {*SOURCE*} - - + {*PLAYER*} was killed by {*SOURCE*} using magic + + + {*PLAYER*} fell off a ladder + + + {*PLAYER*} fell off some vines + + + {*PLAYER*} fell out of the water + + + {*PLAYER*} fell from a high place + + + {*PLAYER*} was doomed to fall by {*SOURCE*} + + + {*PLAYER*} was doomed to fall by {*SOURCE*} + + + {*PLAYER*} was doomed to fall by {*SOURCE*} using {*ITEM*} + + + {*PLAYER*} fell too far and was finished by {*SOURCE*} + + + {*PLAYER*} fell too far and was finished by {*SOURCE*} using {*ITEM*} + + + {*PLAYER*} walked into fire whilst fighting {*SOURCE*} + + + {*PLAYER*} was burnt to a crisp whilst fighting {*SOURCE*} + + + {*PLAYER*} tried to swim in lava to escape {*SOURCE*} + + + {*PLAYER*} drowned whilst trying to escape {*SOURCE*} + + + {*PLAYER*} walked into a cactus whilst trying to escape {*SOURCE*} + + + {*PLAYER*} was blown up by {*SOURCE*} + + + {*PLAYER*} withered away + + + {*PLAYER*} was slain by {*SOURCE*} using {*ITEM*} + + + {*PLAYER*} was shot by {*SOURCE*} using {*ITEM*} + + + {*PLAYER*} was fireballed by {*SOURCE*} using {*ITEM*} + + + {*PLAYER*} was pummeled by {*SOURCE*} using {*ITEM*} + + + {*PLAYER*} was killed by {*SOURCE*} using {*ITEM*} + Bedrock Fog - - + Display HUD - - + Display Hand - - + + + Splitscreen Online ID's + Death Messages - - + Animated Character - - + Custom Skin Animation - - + You can no longer mine or use items - - + You can now mine and use items - - + You can no longer place blocks - - + You can now place blocks - - + You can now use doors and switches - - + You can no longer use doors and switches - - + You can now use containers (e.g. chests) - - + You can no longer use containers (e.g. chests) - - + You can no longer attack mobs - - + You can now attack mobs - - + You can no longer attack players - - + You can now attack players - - + You can no longer attack animals - - + You can now attack animals - - + You are now a moderator - - + You are no longer a moderator - - + You can now fly - - + You can no longer fly - - + You will no longer get exhausted - - + You will now get exhausted - - + You are now invisible - - + You are no longer invisible - - + You are now invulnerable - - + You are no longer invulnerable - - + %d MSP - - + Ender Dragon - - + %s has entered The End - - + %s has left The End - - + {*C3*}I see the player you mean.{*EF*}{*B*}{*B*} @@ -6572,8 +5547,7 @@ Would you like to install the mash-up pack or texture pack now? {*C2*}{*PLAYER*}. Player of games.{*EF*}{*B*}{*B*} {*C3*}Good.{*EF*}{*B*}{*B*} - - + {*C2*}Take a breath, now. Take another. Feel air in your lungs. Let your limbs return. Yes, move your fingers. Have a body again, under gravity, in air. Respawn in the long dream. There you are. Your body touching the universe again at every point, as though you were separate things. As though we were separate things.{*EF*}{*B*}{*B*} @@ -6595,8 +5569,7 @@ Would you like to install the mash-up pack or texture pack now? {*C2*}The seven billion billion billion atoms of the player's body were created, long before this game, in the heart of a star. So the player, too, is information from a star. And the player moves through a story, which is a forest of information planted by a man called Julian, on a flat, infinite world created by a man called Markus, that exists inside a small, private world created by the player, who inhabits a universe created by...{*EF*}{*B*}{*B*} {*C3*}Shush. Sometimes the player created a small, private world that was soft and warm and simple. Sometimes hard, and cold, and complicated. Sometimes it built a model of the universe in its head; flecks of energy, moving through vast empty spaces. Sometimes it called those flecks "electrons" and "protons".{*EF*}{*B*}{*B*} - - + {*C2*}Sometimes it called them "planets" and "stars".{*EF*}{*B*}{*B*} @@ -6623,1539 +5596,1394 @@ Would you like to install the mash-up pack or texture pack now? {*C3*}You are the player.{*EF*}{*B*}{*B*} {*C2*}Wake up.{*EF*} - - + Reset Nether - - + Are you sure you want to reset the Nether in this savegame to its default state? You will lose anything you have built in the Nether! - - + Reset Nether - - + Don't Reset Nether - - + - Can't shear this Mooshroom at the moment. The maximum number of Pigs, Sheep, Cows and Cats has been reached. - - + Can't shear this Mooshroom at the moment. The maximum number of Pigs, Sheep, Cows, Cats and Horses has been reached. + - Can't use Spawn Egg at the moment. The maximum number of Pigs, Sheep, Cows and Cats has been reached. - - + Can't use Spawn Egg at the moment. The maximum number of Pigs, Sheep, Cows, Cats and Horses has been reached. + Can't use Spawn Egg at the moment. The maximum number of Mooshrooms has been reached. - - + Can't use Spawn Egg at the moment. The maximum number of Wolves in a world has been reached. - - + Can't use Spawn Egg at the moment. The maximum number of Chickens in a world has been reached. - - + Can't use Spawn Egg at the moment. The maximum number of Squid in a world has been reached. - - + + + Can't use Spawn Egg at the moment. The maximum number of Bats in a world has been reached. + Can't use Spawn Egg at the moment. The maximum number of enemies in a world has been reached. - - + Can't use Spawn Egg at the moment. The maximum number of villagers in a world has been reached. - - + The maximum number of Paintings/Item Frames in a world has been reached. - - + You can't spawn enemies in Peaceful mode. - - + - This animal can't enter Love Mode. The maximum number of breeding Pigs, Sheep, Cows and Cats has been reached. - - + This animal can't enter Love Mode. The maximum number of breeding Pigs, Sheep, Cows, Cats and Horses has been reached. + This animal can't enter Love Mode. The maximum number of breeding Wolves has been reached. - - + This animal can't enter Love Mode. The maximum number of breeding Chickens has been reached. - - + + + This animal can't enter Love Mode. The maximum number of breeding horses has been reached. + This animal can't enter Love Mode. The maximum number of breeding Mooshrooms has been reached. - - + The maximum number of Boats in a world has been reached. - - + The maximum number of Mob Heads in a world has been reached. - - + Invert Look - - + Southpaw - - + You Died! - - + Respawn - - + Downloadable Content Offers - - + Change Skin - - + How To Play - - + Controls - - + Settings - - + Credits - - + Reinstall Content - - + Debug Settings - - + Fire Spreads - - + TNT Explodes - - + Player vs Player - - + Trust Players - - + Host Privileges - - + Generate Structures - - + Superflat World - - + Bonus Chest - - + World Options - - + + + Small + + + Medium + + + Large + + + Classic + + + Game Options + + + Increase World Size + + + Overwrite Edges + + + Increase World Size + + + Overwrite Edges + + + World Size + + + Select a world size to vary the amount of the world that you can explore. + + + Disable autosave + + + Turn off the constant, automatic saving of the world. If you later choose to save it could take a long time. + + + Mob Griefing + + + Keep Inventory + + + Mob Spawning + + + Mob Loot + + + Tile Drops + + + Natural Regeneration + + + Daylight Cycle + Can Build and Mine - - + Can Use Doors and Switches - - + Can Open Containers - - + Can Attack Players - - + Can Attack Animals - - + Moderator - - + Kick Player - - + Can Fly - - + Disable Exhaustion - - + Invisible - - + Host Options - - + Players/Invite - - + Online Game - - + Invite Only - - + More Options - - + Load - - + New World - - + World Name - - + Seed for the World Generator - - + Leave blank for a random seed - - + Players - - + Join Game - - + Start Game - - + No Games Found - - + Play Game - - + Leaderboards - - + + + Trophies + Help & Options - - + Unlock Full Game - - + Resume Game - - + Save Game - - + + + System Language + + + English + + + German + + + Spanish + + + Spanish (Spain) + + + Spanish (Latin America) + + + French + + + Italian + + + Portuguese + + + Portuguese (Portugal) + + + Portuguese (Brazil) + + + Japanese + + + Korean + + + Chinese (Traditional) + + + Chinese (Simplified) + + + Danish + + + Finnish + + + Dutch + + + Polish + + + Russian + + + Swedish + + + Norwegian + + + Greek + + + Turkish + Difficulty: - - + Game Type: - - + + + Online ID's: + Structures: - - + Level Type: - - + PvP: - - + Trust Players: - - + TNT: - - + Fire Spreads: - - + Reinstall Theme - - + Reinstall Gamerpic 1 - - + Reinstall Gamerpic 2 - - + Reinstall Avatar Item 1 - - + Reinstall Avatar Item 2 - - + Reinstall Avatar Item 3 - - + Options - - + Audio - - + Control - - + Graphics - - + User Interface - - + Reset to Defaults - - + View Bobbing - - + Hints - - + In-Game Tooltips - - + + + In-Game Online ID's + 2 Player Split-screen Vertical - - + Done - - + Edit sign message: - - + Fill in the details to accompany your screenshot - - + Caption - - + Screenshot from in-game - - + Edit sign message: - - + + + Look what I made in Minecraft: Xbox 360 Edition! + The classic Minecraft textures, icons and user interface! - - + Show all Mash-up Worlds - - + + + Select Transfer Save Slot + + + Empty Slot + + + Uploading Save Metadata + + + Uploading Save Data + + + Uploading Save For Xbox One + + + Upload Canceled + + + You have canceled uploading this save to the save transfer area. + No Effects - - + Speed - - + Slowness - - + Haste - - + Mining Fatigue - - + Strength - - + Weakness - - + Instant Health - - + Instant Damage - - + Jump Boost - - + Nausea - - + Regeneration - - + Resistance - - + Fire Resistance - - + Water Breathing - - + Invisibility - - + Blindness - - + Night Vision - - + Hunger - - + Poison - - + + + Wither + + + Health Boost + + + Absorption + + + Saturation + of Swiftness - - + of Slowness - - + of Haste - - + of Dullness - - + of Strength - - + of Weakness - - + of Healing - - + of Harming - - + of Leaping - - + of Nausea - - + of Regeneration - - + of Resistance - - + of Fire Resistance - - + of Water Breathing - - + of Invisibility - - + of Blindness - - + of Night Vision - - + of Hunger - - + of Poison - - + + + of Decay + + + of Health Boost + + + of Absorption + + + of Saturation + - - - + II - - + III - - + IV - - + Splash - - + Mundane - - + Uninteresting - - + Bland - - + Clear - - + Milky - - + Diffuse - - + Artless - - + Thin - - + Awkward - - + Flat - - + Bulky - - + Bungling - - + Buttered - - + Smooth - - + Suave - - + Debonair - - + Thick - - + Elegant - - + Fancy - - + Charming - - + Dashing - - + Refined - - + Cordial - - + Sparkling - - + Potent - - + Foul - - + Odorless - - + Rank - - + Harsh - - + Acrid - - + Gross - - + Stinky - - + Used as the base of all potions. Use in a brewing stand to create potions. - - + Has no effects, can be used in a brewing stand to create potions by adding more ingredients. - - + Increases affected players, animals and monsters movement speed, and players sprinting speed, jumping length and field of view. - - + Reduces affected players, animals and monsters movement speed, and players sprinting speed, jumping length and field of view. - - + Increase the damage caused by affected players and monsters when attacking. - - + Reduces the damage cause by affected players and monsters when attacking. - - + Instantly increases the affected players, animals and monsters health. - - + Instantly reduces the affected players, animals and monsters health. - - + Restores health to the affected players, animals and monsters over time. - - + Makes the affected players, animals and monsters immune to damage from fire, lava, and ranged Blaze attacks. - - + Reduces health of the affected players, animals and monsters over time. - - + + + When Applied: + + + Horse Jump Strength + + + Zombie Reinforcements + + + Max Health + + + Mob Follow Range + + + Knockback Resistance + + + Speed + + + Attack Damage + Sharpness - - + Smite - - + Bane of Arthropods - - + Knockback - - + Fire Aspect - - + Protection - - + Fire Protection - - + Feather Falling - - + Blast Protection - - + Projectile Protection - - + Respiration - - + Aqua Affinity - - + Efficiency - - + Silk Touch - - + Unbreaking - - + Looting - - + Fortune - - + Power - - + Flame - - + Punch - - + Infinity - - + I - - + II - - + III - - + IV - - + V - - + VI - - + VII - - + VIII - - + IX - - + X - - + Can be mined with an Iron pickaxe or better to collect Emeralds. - - + Similar to a Chest except that items placed in an Ender Chest are available in every one of the player's Ender Chests, even in different dimensions. - - + Is activated when an entity passes through a connected Tripwire. - - + Activates a connected Tripwire Hook when an entity passes through it. - - + A compact way of storing Emeralds. - - + A wall made of Cobblestone. - - + Can be used to repair weapons, tools and armor. - - + Smelted in a furnace to produce Nether Quartz. - - + Used as a decoration. - - + Can be traded with villagers. - - + Used as a decoration. Flowers, Saplings, Cacti and Mushrooms can be planted in it. - - + Restores 2{*ICON_SHANK_01*}, and can be crafted into a golden carrot. Can be planted in farmland. - - + Restores 0.5{*ICON_SHANK_01*}, or can be cooked in a furnace. This can be planted in farmland. - - + Restores 3{*ICON_SHANK_01*}. Created by cooking a potato in a furnace. - - + - Restores 1{*ICON_SHANK_01*}, or can be cooked in a furnace. This can be planted in farmland. Eating this can cause you to be poisoned. - - + Restores 1{*ICON_SHANK_01*}. Eating this can cause you to become poisoned. + Restores 3{*ICON_SHANK_01*}. Crafted from a carrot and gold nuggets. - - + Used to control a saddled pig when riding on it. - - + Restores 4{*ICON_SHANK_01*}. - - + Used with an Anvil to enchant weapons, tools or armor. - - + Created by mining Nether Quartz Ore. Can be crafted into a Block of Quartz. - - + Crafted from Wool. Used as a decoration. - - + Emerald - - + Flower Pot - - + Carrot - - + Potato - - + Baked Potato - - + Poisonous Potato - - + Golden Carrot - - + Carrot on a Stick - - + Pumpkin Pie - - + Enchanted Book - - + Nether Quartz - - + Emerald Ore - - + Ender Chest - - + Tripwire Hook - - + Tripwire - - + Block of Emerald - - + Cobblestone Wall - - + Mossy Cobblestone Wall - - + Flower Pot - - + Carrots - - + Potatoes - - + Anvil - - + Anvil - - + Slightly Damaged Anvil - - + Very Damaged Anvil - - + Nether Quartz Ore - - + Block of Quartz - - + Chiseled Quartz Block - - + Pillar Quartz Block - - + Quartz Stairs - - + Carpet - - + Black Carpet - - + Red Carpet - - + Green Carpet - - + Brown Carpet - - + Blue Carpet - - + Purple Carpet - - + Cyan Carpet - - + Light Gray Carpet - - + Gray Carpet - - + Pink Carpet - - + Lime Carpet - - + Yellow Carpet - - + Light Blue Carpet - - + Magenta Carpet - - + Orange Carpet - - + White Carpet - - + Chiseled Sandstone - - + Smooth Sandstone - - + {*PLAYER*} was killed trying to hurt {*SOURCE*} - - + {*PLAYER*} was squashed by a falling Anvil. - - + {*PLAYER*} was squashed by a falling block. - - + Teleported {*PLAYER*} to {*DESTINATION*} - - + {*PLAYER*} teleported you to their position - - + {*PLAYER*} teleported to you - - + Thorns - - + Quartz Slab - - + Makes dark areas appear as if in daylight, even under water. - - + Makes affected players, animals and monsters invisible. - - + Repair & Name - - + Enchantment Cost: %d - - + Too Expensive! - - + Rename - - + You have: - - + Required Items For Trade - - + {*VILLAGER_TYPE*} offers %s - - + Repair - - + Trade - - + Dye collar - - + This is the Anvil interface, which you can use to rename, repair and apply enchantments to weapons, armor, or tools, at the cost of Experience Levels. - - + {*B*} Press{*CONTROLLER_VK_A*} to learn more about the Anvil interface.{*B*} Press{*CONTROLLER_VK_B*} if you already know the Anvil interface. - - + To begin working on an item, place it in the first input slot. - - + When the correct raw material is placed in the second input slot (e.g. Iron Ingots for a damaged Iron Sword), the proposed repair appears in the output slot. - - + Alternatively, a second identical item can be placed into the second slot to combine the two items. - - + To enchant items on the Anvil, place an Enchanted Book in the second input slot. - - + The number of Experience Levels that the work will cost is shown beneath the output. If you do not have enough Experience Levels, the repair cannot be completed. - - + It is possible to rename the item by editing the name shown in the textbox. - - + Picking up the repaired item will consume both items used by the Anvil and decrease your Experience Level by the given amount. - - + In this area there is an Anvil and a Chest containing tools and weapons to work on. - - + {*B*} Press{*CONTROLLER_VK_A*} to learn more about the Anvil.{*B*} Press{*CONTROLLER_VK_B*} if you already know about the Anvil. - - + Using an Anvil, weapons and tools can be repaired to restore their durability, renamed, or enchanted with Enchanted Books. - - + Enchanted Books can be found inside Chests within dungeons, or enchanted from normal Books at the Enchantment Table. - - + Using the Anvil costs Experience Levels, and each use has a chance to damage the Anvil. - - + The type of work to be done, value of the item, number of enchantments, and amount of prior work all affect the cost of repair. - - + Renaming an item changes the displayed name for all players and permanently reduces the prior work cost. - - + In the Chest in this area you will find damaged Pickaxes, raw materials, Bottles O' Enchanting, and Enchanted Books to experiment with. - - + This is the trading interface which displays trades that can be made with a villager. - - + {*B*} Press{*CONTROLLER_VK_A*} to learn more about the trading interface.{*B*} Press{*CONTROLLER_VK_B*} if you already know the trading interface. - - + All trades that the villager is willing to make at the moment are displayed along the top. - - + Trades will appear red and be unavailable if you do not have the required items. - - + The amount and type of items you are giving to the villager are shown in the two boxes on the left. - - + You can see the total number of the items required for the trade in the two boxes on the left. - - + Press{*CONTROLLER_VK_A*} to trade the items the villager requires for the item on offer. - - + In this area there is a villager and a Chest containing Paper to purchase items. - - + {*B*} Press{*CONTROLLER_VK_A*} to learn more about trading.{*B*} Press{*CONTROLLER_VK_B*} if you already know about trading. - - + Players can trade items from their inventory with villagers. - - + The trades a villager is likely to offer depends on their profession. - - + Performing a mix of trades will randomly add to or update the villager's available trades. - - + Trades that have been used frequently may be removed temporarily, but the villager will always offer at least one trade. - - + Take some Paper from the Chest and try trading with the villager here. - - + In this area there are two Ender Chests. - - + {*B*} Press{*CONTROLLER_VK_A*} to learn more about Ender Chests.{*B*} Press{*CONTROLLER_VK_B*} if you already know about Ender Chests. - - + All Ender Chests in a world are linked, even across dimensions. Items placed into an Ender Chest are accessible in any other Ender Chest. - - + However, the contents of the Ender Chests are different for each player. - - + This allows players to store items in any Ender Chest, and retrieve them from other Ender Chests in different positions in the world. You can try this now by placing items in either Ender Chest. - - + Restores 2{*ICON_SHANK_01*}, regenerates health for 30 seconds, and grants fire resistance and damage resistance for 5 minutes. Crafted from an apple and gold blocks. - - + Can Teleport - - + Teleport - - + Teleport To Player - - + Teleport To Me - - + Can Disable Exhaustion - - + Can Become Invisible - - + You can now enable invisibility - - + You can no longer enable invisibility - - + You can now enable flying - - + You can no longer enable flying - - + You can now disable exhaustion - - + You can no longer disable exhaustion - - + You can now teleport - - + You can no longer teleport - - + {*T3*}HOW TO PLAY : ANVIL{*ETW*}{*B*}{*B*} Experience Levels can be used to repair, enchant or rename items with the Anvil.{*B*} @@ -8165,8 +6993,7 @@ Combining items is more efficient when done with an Anvil, and additionally, if Enchanted Books can apply enchantments to items by combining them at an Anvil if the Book's enchantment is suitable. Enchanted Books can be found in Chests within dungeons, or enchanted from normal Books at the Enchantment Table.{*B*} There is a chance that the Anvil will be damaged with each use and after enough punishment it will be destroyed.{*B*} - - + {*T3*}HOW TO PLAY : TRADING{*ETW*}{*B*}{*B*} It is possible to trade items with villagers. Each villager has a profession; they can be Farmers, Butchers, Blacksmiths, Librarians or Priests, and this affects the type of items they might trade.{*B*} @@ -8174,434 +7001,334 @@ You can find a list of all the trades a villager is offering in the trading menu Trades usually involve buying or selling a number of items for emeralds.{*B*} If you do not have the items required for a trade, the items are shown in red.{*B*} - - + {*T3*}HOW TO PLAY : ENDER CHEST {*ETW*}{*B*}{*B*} All Ender Chests in a world are linked. Items placed into an Ender Chest are accessible in any other. However, the contents of the Ender Chests are different for each player. This allows players to store items in any Ender Chest, and retrieve them from other Ender Chests in different positions in the world. - - + Farmer - - + Librarian - - + Priest - - + Blacksmith - - + Butcher - - + Found in villages, villagers will offer to sell items to the player depending on their profession. - - + Large Chest - - + You can also create Enchanted Books at the Enchantment Table, which can be used later at the Anvil to apply their enchantment to an item. - - + Tripwire Hooks will also provide constant power to a circuit while something is triggering the string between them. - - + Once tamed, a wolf will always have its collar on. The color of their collar can be changed by dying it. - - + Carrots and Potatoes are farmed by planting Carrots or Potatoes, and are ready for harvesting when the vegetable is visible above the ground. - - + Additionally, pigs can be saddled and then ridden by players. They are controlled by tempting them with a Carrot on a Stick. - - + If necessary you can slowly move your minecart along using {*CONTROLLER_ACTION_MOVE*}. This helps to start the minecart by getting it onto a powered rail. - - + You cannot join this game as split-screen is only supported when in High Definition mode. Sign out all other players if you wish to join. - - + Cure - - - Finding Seed for the World Generator - - - - Kills Easy - - - - Kills Normal - - - - Kills Hard - - - - Mining Blocks Peaceful - - - - Mining Blocks Easy - - - - Mining Blocks Normal - - - - Mining Blocks Hard - - - - Farming Peaceful - - - - Farming Easy - - - - Farming Normal - - - - Farming Hard - - - - Traveling Peaceful - - - - Traveling Easy - - - - Traveling Normal - - - - Traveling Hard - - - - If you play this game in High Definition mode, you can have up to four players in split-screen on the same console! - - - - Connect extra controllers to your console and press START on them to join a game at any point. - - - - minecraftforum has a section dedicated to the Xbox One Edition. + + Xbox 360 - - - You'll get the latest info on this game from 4JStudios and Kappische on twitter! - - - - Don't look an Enderman in the eye! - - - - We think 4J Studios has removed Herobrine from the Xbox One console game, but we're not too sure. - - - - Minecraft: Xbox One Edition broke lots of records! - - - - {*T3*}HOW TO PLAY : MULTIPLAYER{*ETW*}{*B*}{*B*} -Minecraft on the Xbox One console is a multiplayer game by default. If you are playing in a High Definition mode, you can have local players join your game by attaching controllers and pressing START at any point during the game.{*B*}{*B*} -When you start or join an online game, it will be visible to people in your friends list (unless you've selected Invite Only when hosting the game), and if they join the game, it will also be visible to people in their friends list (if you have selected the Allow Friends of Friends option).{*B*} -When you are in a game, you can press the BACK button to bring up a list of all other players in the game, view their Gamer Cards, Kick players from the game, and invite others to the game. - - - - - {*T3*}HOW TO PLAY : SHARING SCREENSHOTS{*ETW*}{*B*}{*B*} -You can capture a screenshot from your game by bringing up the Pause Menu, and pressing{*CONTROLLER_VK_Y*} to Share to Facebook. You'll be presented with a miniature version of your screenshot, and can edit the text associated with the Facebook post.{*B*}{*B*} -There's a camera mode especially for taking these screenshots, so that you can see the front of your character in the shot - press{*CONTROLLER_ACTION_CAMERA*} until you can see the front view of your character before pressing{*CONTROLLER_VK_Y*} to Share.{*B*}{*B*} -Gamertags will not be displayed in the screenshot. - - - - - {*T3*}HOW TO PLAY : CREATIVE MODE{*ETW*}{*B*}{*B*} -The creative mode interface allows any item in the game to be moved into the player’s inventory without the need for mining or crafting the item. -The items in the player's inventory will not be removed when they are placed or used in the world, and this allows the player to focus on building rather than resource gathering.{*B*} -If you create, load or save a world in Creative Mode, that world will have achievements and leaderboard updates disabled, even if it is then loaded in Survival Mode.{*B*} -To fly when in Creative Mode, press{*CONTROLLER_ACTION_JUMP*} twice quickly. To exit flying, repeat the action. To fly faster, push{*CONTROLLER_ACTION_MOVE*} forward twice in rapid succession while flying. -When in flying mode, you can hold down{*CONTROLLER_ACTION_JUMP*} to move up and{*CONTROLLER_ACTION_SNEAK*} to move down, or use{*CONTROLLER_ACTION_DPAD_UP*} to move up, {*CONTROLLER_ACTION_DPAD_DOWN*} to move down, -{*CONTROLLER_ACTION_DPAD_LEFT*} to move left, and {*CONTROLLER_ACTION_DPAD_RIGHT*} to move right. - - - - Pressing{*CONTROLLER_ACTION_JUMP*} twice quickly will allow you to fly. To exit flying, repeat the action. To fly faster, push{*CONTROLLER_ACTION_MOVE*} forward twice in rapid succession while flying. -When in flying mode, you can hold down{*CONTROLLER_ACTION_JUMP*} to move up and{*CONTROLLER_ACTION_SNEAK*} to move down, or use the D-pad to move up, down, left or right. - - - - Select Storage Device - - - - Change Storage Device - - - - View Gamer Card - - - - View Gamer Profile - - - - Invite Xbox LIVE Party - - - - If you create, load or save a world in Creative Mode, that world will have achievements and leaderboard updates disabled, even if it is then loaded in Survival Mode. Are you sure you want to continue? - - - - This world has previously been saved in Creative Mode, and it will have achievements and leaderboard updates disabled. Are you sure you want to continue? - - - - This world has previously been saved in Creative Mode, and it will have achievements and leaderboard updates disabled. - - - - If you create, load or save a world with Host Privileges enabled, that world will have achievements and leaderboard updates disabled, even if it is then loaded with those options off. Are you sure you want to continue? - - - - Connection to Xbox LIVE was lost. Exiting to the main menu. - - - - Connection to Xbox LIVE was lost. - - - - Hurray - you've been awarded an avatar item - a Minecraft: Xbox One Edition t-shirt! -Go to the dashboard to put the t-shirt on your avatar. - - - - Hurray - you've been awarded an avatar item - a Minecraft: Xbox One Edition watch! -Go to the dashboard to put the watch on your avatar. - - - - Hurray - you've been awarded an avatar item - a Creeper baseball cap! -Go to the dashboard to put the cap on your avatar. - - - - Hurray - you've been awarded the Minecraft: Xbox One Edition theme! -Go to the dashboard to select this theme. - - - - This is the Minecraft: Xbox One Edition trial game. If you had the full game, you would just have earned an achievement! -Unlock the full game to experience the joy of Minecraft: Xbox One Edition and to play with your friends across the globe through Xbox LIVE. -Would you like to unlock the full game? - - - - This is the Minecraft: Xbox One Edition trial game. If you had the full game, you would just have earned an avatar award! -Unlock the full game to experience the joy of Minecraft: Xbox One Edition and to play with your friends across the globe through Xbox LIVE. -Would you like to unlock the full game? - - - - This is the Minecraft: Xbox One Edition trial game. If you had the full game, you would just have earned a gamerpic! -Unlock the full game to experience the joy of Minecraft: Xbox One Edition and to play with your friends across the globe through Xbox LIVE. -Would you like to unlock the full game? - - - - This is the Minecraft: Xbox One Edition trial game. If you had the full game, you would just have earned a theme! -Unlock the full game to experience the joy of Minecraft: Xbox One Edition and to play with your friends across the globe through Xbox LIVE. -Would you like to unlock the full game? - - - - This is the Minecraft: Xbox One Edition trial game. You need the full game to be able to accept this invite. -Would you like to unlock the full game? - - - - Guest players cannot unlock the full game. Please sign in with an Xbox LIVE user ID. - - - - Gamertag - - - - Brewing - - - - You have been returned to the title screen because your gamer profile was signed out - - - - You've been playing the Minecraft: Xbox One Edition Trial Game for the maximum time allowed! To continue the fun, would you like to unlock the full game? - - - - "Minecraft: Xbox One Edition" has failed to load, and cannot continue. - - - - Failed to join the game as one or more players are not allowed to play multiplayer games on Xbox LIVE. - - - - Failed to create an online game as one or more players are not allowed to play multiplayer games on Xbox LIVE. Uncheck the "Online Game" box to start an offline game. - - - - You are not allowed to join this game session because your Member Content privilege setting is too restrictive. Please change this setting in the Privacy and Online Settings portion of the Xbox dashboard if you would like to join this session. - - - - You are not allowed to join this game session because one of your local players has a Member Content privilege setting that is too restrictive. - - - - You are not allowed to join this game session because a player in the session has a Member Content privilege setting of Friends Only, and you are not on their Friends List. - - - - You are not allowed to create this game session because one of your local players has a Member Content privilege setting that is too restrictive. Uncheck the "Online Game" box to start an offline game, or change this setting in the Privacy and Online Settings portion of the Xbox dashboard. - - - - This game has a level autosave feature. When you see the icon above displayed, the game is saving your data. -Please do not turn off your Xbox One console while this icon is on-screen. - - - - When enabled, the host can toggle their ability to fly, disable exhaustion, and make themselves invisible from the in-game menu. Disables achievements and leaderboard updates. - - - - Splitscreen Gamertags - - - - Achievements - - - - Gamertags: - - - - In-Game Gamertags - - - - Look what I made in Minecraft: Xbox One Edition! + + OK - - Title Update 14 - - - Xbox One - - - Back - - - This option disables achievements and leaderboard updates for this world while playing, and if loading it again after saving with this option on. - - - For players that are not on the same Xbox One console as the host player, selecting this option will kick the player from the game and any other players on their Xbox One console. This player will not be able to rejoin the game until it is restarted. - - - You are using the trial version of a texture pack. You will have access to the full contents of the texture pack, but you will not be able to save your progress. -If you try to save while using the trial version, you will be given the option to purchase the full version. + + SELECT + + + This option disables trophies and leaderboard updates for this world while playing, and if loading it again after saving with this option on. + + + Upload Save For Xbox One + + + Upload Save + + + Are you sure you would like to upload this save, and overwrite any current save held in the save transfer area? + + + Uploading... + + + Upload Complete! + + + Upload Failed. Please try again later. + + + You are using the trial version of a texture pack. You will have access to the full contents of the texture pack, but you will not be able to save your progress. +If you try to save while using the trial version, you will be given the option to purchase the full version. + + + Patch 1.04 (Title Update 14) + + + Would you like to sign in to the "PSN"? + + + Change Network Mode + + + Select Network Mode + + + Choose Ad Hoc Network to connect with other Xbox 360 systems nearby, or "PSN" to connect with friends all over the world. + + + Ad Hoc Network + + + "PSN" + + + Download PS3™ Save + + + Upload Canceled + + + You have canceled uploading this save to the save transfer area. + + + Uploading data : %d%% + + + Downloading data : %d%% + + + Converting Data + + + Saving + + + Download Complete! + + + Download Failed. Please try again later. + + + Failed to join the game due to a restrictive NAT type. Please check your network settings. + + + +There is no save available in the save transfer area at the moment. +You can upload a world save to the save transfer area using Minecraft: PlayStation®3 Edition, and then download it with Minecraft: Xbox 360 Edition. - - - - - Small - - - Medium - - - Large - - - Classic - - - Game Options - - - World Size - - - Enter a seed to generate the same terrain again. Leave blank for a random world. - - - Select a world size to vary the amount of the world that you can explore. - - - Disable autosave - - - Turn off the constant, automatic saving of the world. If you later choose to save it could take a long time. - - - - A network error has occurred. - - - - Network Error - + + + The save file in the save transfer area has a version number that Minecraft: Xbox 360 Edition doesn't support yet. + + + Saving incomplete + + + Minecraft: Xbox 360 Edition is out of space for save data. To make room, delete other Minecraft: Xbox 360 Edition saves. + + + Your selected storage device doesn't have enough free space to create a game save. + + + Your selected storage device already contains this save. Is it OK to overwrite it? + + + Storage Device Problem + + + Your storage device is unavailable or has an error + + + Your storage device is unavailable or has an error. Please select a new storage device. + + + Select a new storage device + + + No storage device selected + + + If you do not select a storage device, game saves will be disabled + + + Select a storage device + + + Your storage device has been removed. Please select a new one. + + + Exit Game + + + You have been returned to the title screen because your Xbox profile was signed out + + + The match has ended because an Xbox profile was signed out + + + Xbox profile not online + + + This game has some features which require an Xbox Live enabled Xbox profile, but you are currently offline. + + + This feature requires an Xbox profile which is signed into Xbox Live. + + + Connect to Xbox Live + + + Achievement Award Problem + + + There was a problem accessing your Xbox profile. Your achievement could not be awarded at this time. + + + Xbox profile problem + + + Saving of settings to Xbox profile has failed. + + + Guest Xbox Profile + + + Guest Xbox profile cannot access this feature. Please use a different Xbox profile. + + + + This is the Minecraft trial game. If you had the full game, you would just have earned an achievement! + Unlock the full game to experience the joy of Minecraft and to play with your friends across the globe through Xbox Live. + Would you like to unlock the full game? + + + + You are being returned to the main menu because of a problem reading your Xbox profile. + + + A network error has occurred. + + + Network Error + + + A network error has occurred. Exiting to Main Menu. + + + Minecraft: PlayStation®3 Edition + + + Options + + + Save Cache + + + Online service is disabled on your Sony Entertainment Network account due to chat restrictions. + + + Online service is disabled on your Sony Entertainment Network account due to parental control settings. + + + Online Service + + + You have been signed out from the "PSN". Online features of the game will not be available until you sign back into the "PSN". + + + You have been signed out from the "PSN". Online features of the game will not be available until you sign back into the "PSN". Exiting to Main Menu. + + + Choose user for player %d (or cancel to play as guest) + + + Free + + + Your Options file is corrupt and needs to be deleted. + + + Delete options file. + + + Retry loading options file. + + + Your Save Cache file is corrupt and needs to be deleted. + + + Trophies Disabled + + + Trophies will be disabled because this save belongs to another user. + + + Fatal error: Trophy Initialization failed. Please exit game. + + + View Game Invites + + + Corrupt File + + + Controller Disconnected + + + Your controller has been disconnected. Please reconnect the controller. + + + Online service is disabled on your Sony Entertainment Network account due to parental control settings for one of your local players. + + + Online features are disabled due to a game update being available. + + + There are no downloadable content offers available for this title at the moment. + + + Invitation + + + Please come and play a game of Minecraft: Xbox 360 Edition! + + + Languages + diff --git a/Minecraft.Assets/Windows64Media/loc/stringsGeneric.xml b/Minecraft.Assets/Windows64Media/loc/stringsGeneric.xml index 4eccce8bb..36b521dd0 100644 --- a/Minecraft.Assets/Windows64Media/loc/stringsGeneric.xml +++ b/Minecraft.Assets/Windows64Media/loc/stringsGeneric.xml @@ -429,6 +429,27 @@ When loading or creating a world, you can press the "More Options" button to ent {*T2*}Host Privileges{*ETW*}{*B*} When enabled, the host can toggle their ability to fly, disable exhaustion, and make themselves invisible from the in-game menu. {*DISABLES_ACHIEVEMENTS*}{*B*}{*B*} + {*T2*}Daylight Cycle{*ETW*}{*B*} + When disabled, the time of day will not change.{*B*}{*B*} + + {*T2*}Keep Inventory{*ETW*}{*B*} + When enabled, players will keep their inventory when they die.{*B*}{*B*} + + {*T2*}Mob Spawning{*ETW*}{*B*} + When disabled, mobs will not spawn naturally.{*B*}{*B*} + + {*T2*}Mob Griefing{*ETW*}{*B*} + When disabled, prevents monsters and animals from changing blocks (for example, Creeper explosions won't destroy blocks and Sheep won't remove Grass) or picking up items.{*B*}{*B*} + + {*T2*}Mob Loot{*ETW*}{*B*} + When disabled, monsters and animals will not drop loot (for example, Creepers won't drop gunpowder).{*B*}{*B*} + + {*T2*}Tile Drops{*ETW*}{*B*} + When disabled, blocks will not drop items when destroyed (for example, Stone blocks won't drop Cobblestone).{*B*}{*B*} + + {*T2*}Natural Regeneration{*ETW*}{*B*} + When disabled, players will not regenerate health naturally.{*B*}{*B*} + {*T1*}World Generation Options{*ETW*}{*B*} When creating a new world there are some additional options.{*B*}{*B*} @@ -472,20 +493,20 @@ To modify the privileges for a player, select their name and press{*CONTROLLER_V When this option is enabled, the player is able to change privileges for other players (except the host) if "Trust Players" is turned off, kick players and they can enable and disable fire spreading and TNT exploding.{*B*}{*B*} {*T2*}Kick Player{*ETW*}{*B*} - For players that are not on the same {*PLATFORM_NAME*} console as the host player, selecting this option will kick the player from the game and any other players on their {*PLATFORM_NAME*} console. This player will not be able to rejoin the game until it is restarted.{*B*}{*B*} + {*KICK_PLAYER_DESCRIPTION*}{*B*}{*B*} {*T1*}Host Player Options{*ETW*}{*B*} If "Host Privileges" is enabled the host player can modify some privileges for themselves. To modify the privileges for a player, select their name and press{*CONTROLLER_VK_A*} to bring up the player privileges menu where you can use the following options.{*B*}{*B*} {*T2*}Can Fly{*ETW*}{*B*} When this option is enabled, the player is able to fly. This option is only relevant to Survival mode, as flying is enabled for all players in Creative mode.{*B*}{*B*} - + {*T2*}Disable Exhaustion{*ETW*}{*B*} This option only affects Survival mode. When enabled, physical activities (walking/sprinting/jumping etc.) do not decrease the food bar. However, if the player becomes injured, the food bar will slowly decrease while the player is healing.{*B*}{*B*} - + {*T2*}Invisible{*ETW*}{*B*} When this option is enabled, the player is not visible to other players and is invulnerable.{*B*}{*B*} - + {*T2*}Can Teleport{*ETW*}{*B*} This allows the player to move players or themselves to other players in the world. @@ -583,7 +604,7 @@ If "Host Privileges" is enabled the host player can modify some privileges for t {*T3*}HOW TO PLAY : THE END{*ETW*}{*B*}{*B*} The End is another dimension in the game, which is reached through an active End Portal. The End Portal can be found in a Stronghold, which is deep underground in the Overworld.{*B*} To activate the End Portal, you'll need to put an Eye of Ender into any End Portal Frame without one.{*B*} -Once the portal is active, jump into it to go to The End.{*B*}{*B*} +Once the portal is active, jump in to it to go to The End.{*B*}{*B*} In The End you will meet the Ender Dragon, a fierce and powerful enemy, along with many Enderman, so you will have to be well prepared for the battle before going there!{*B*}{*B*} You'll find that there are Ender Crystals on top of eight Obsidian spikes that the Ender Dragon uses to heal itself, so the first step in the battle is to destroy each of these.{*B*} @@ -605,65 +626,116 @@ so they can easily join you. - -{*T3*}{*TITLE_UPDATE_NAME*}{*ETW*}{*B*}{*B*} -{*T3*}Changes and Additions{*ETW*}{*B*}{*B*} -- Added new items - Emerald, Emerald Ore, Block of Emerald, Ender Chest, Tripwire Hook, Enchanted Golden Apple, Anvil, Flower Pot, Cobblestone Walls, Mossy Cobblestone Walls, Wither Painting, Potato, Baked Potato, Poisonous Potato, Carrot, Golden Carrot, Carrot on a Stick, -Pumpkin Pie, Night Vision Potion, Invisibility Potion, Nether Quartz, Nether Quartz Ore, Block of Quartz, Quartz Slab, Quartz Stair, Chiseled Quartz Block, Pillar Quartz Block, Enchanted Book, Carpet.{*B*} -- Added new recipes for Smooth Sandstone and Chiselled Sandstone.{*B*} -- Added new Mobs - Zombie Villagers.{*B*} -- Added new terrain generation features - Desert Temples, Desert Villages, Jungle Temples.{*B*} -- Added Trading with villagers.{*B*} -- Added Anvil interface.{*B*} -- Can dye leather armor.{*B*} -- Can dye wolf collars.{*B*} -- Can control riding a pig with a Carrot on a Stick.{*B*} -- Updated Bonus Chest content with more items.{*B*} -- Changed placement of half blocks and other blocks on half blocks.{*B*} -- Changed placement of upside down stairs and slabs.{*B*} -- Added different villager professions.{*B*} -- Villagers spawned from a spawn egg will have a random profession.{*B*} -- Added sideways log placement.{*B*} -- Furnaces can use wooden tools as a fuel.{*B*} -- Ice and Glass panes can be collected with silk touch enchanted tools.{*B*} -- Wooden Buttons and Wooden Pressure Plates can be activated with Arrows.{*B*} -- Nether mobs can spawn in the Overworld from Portals.{*B*} -- Creepers and Spiders are aggressive towards the last player that hit them.{*B*} -- Mobs in Creative mode become neutral again after a short period.{*B*} -- Remove knockback when drowning.{*B*} -- Doors being broken by zombies show damage.{*B*} -- Ice melts in the nether.{*B*} -- Cauldrons fill up when out in the rain.{*B*} -- Pistons take twice as long to update.{*B*} -- Pig drops Saddle when killed (if has one).{*B*} -- Sky color in The End changed.{*B*} -- String can be placed (for Tripwires).{*B*} -- Rain drips through leaves.{*B*} -- Levers can be placed on the bottom of blocks.{*B*} -- TNT does variable damage depending on difficulty setting.{*B*} -- Book recipe changed.{*B*} -- Boats break Lilypads, instead of Lilypads breaking Boats.{*B*} -- Pigs drop more Porkchops.{*B*} -- Slimes spawn less in Superflat worlds.{*B*} -- Creeper damage variable based on difficulty setting, more knockback.{*B*} -- Fixed Endermen not opening their jaws.{*B*} -- Added teleporting of players (using the {*BACK_BUTTON*} menu in-game).{*B*} -- Added new Host Options for flying, invisibility and invulnerability for remote players.{*B*} -- Added new tutorials to the Tutorial World for new items and features.{*B*} -- Updated the positions of the Music Disc Chests in the Tutorial World.{*B*} + {*T3*}Changes and Additions{*ETW*}{*B*}{*B*} +- Added new items - Hardened Clay, Stained Clay, Block of Coal, Hay Bale, Activator Rail, Block of Redstone, Daylight Sensor, Dropper, Hopper, Minecart with Hopper, Minecart with TNT, Redstone Comparator, Weighted Pressure Plate, Beacon, Trapped Chest, Firework Rocket, Firework Star, Nether Star, Lead, Horse Armor, Name Tag, Horse Spawn Egg{*B*} +- Added new Mobs - Wither, Wither Skeletons, Witches, Bats, Horses, Donkeys and Mules{*B*} +- Added new terrain generation features - Witch Huts.{*B*} +- Added Beacon interface.{*B*} +- Added Horse interface.{*B*} +- Added Hopper interface.{*B*} +- Added Fireworks - Fireworks interface is accessible from the Crafting Table when you have the ingredients to craft a Firework Star or Firework Rocket.{*B*} +- Added 'Adventure Mode' - You can only break blocks with the correct tools.{*B*} +- Added lots of new sounds.{*B*} +- Mobs, items and projectiles can now pass through portals.{*B*} +- Repeaters can now be locked by powering their sides with another Repeater.{*B*} +- Zombies and Skeletons can now spawn with different weapons and armor.{*B*} +- New death messages.{*B*} +- Name mobs with a Name Tag, and rename containers to change the title when the menu is open.{*B*} +- Bonemeal no longer instantly grows everything to full size, and instead randomly grows in stages.{*B*} +- A Redstone signal describing the contents of Chests, Brewing Stands, Dispensers and Jukeboxes can be detected by placing a Redstone Comparator directly against them.{*B*} +- Dispensers can face in any direction.{*B*} +- Eating a Golden Apple gives the player extra "absorption" health for a short period.{*B*} +- The longer you remain in an area the harder the monsters that spawn in that area will be.{*B*} {*ETB*}Welcome back! You may not have noticed but your Minecraft has just been updated.{*B*}{*B*} -There are lots of new features for you and friends to play with so here’s just a few highlights. Have a read and then go and have fun!{*B*}{*B*} -{*T1*}New Items{*ETB*} - Emerald, Emerald Ore, Block of Emerald, Ender Chest, Tripwire Hook, Enchanted Golden Apple, Anvil, Flower Pot, Cobblestone Walls, Mossy Cobblestone Walls, Wither Painting, Potato, Baked Potato, Poisonous Potato, Carrot, Golden Carrot, Carrot on a Stick, -Pumpkin Pie, Night Vision Potion, Invisibility Potion, Nether Quartz, Nether Quartz Ore, Block of Quartz, Quartz Slab, Quartz Stair, Chiseled Quartz Block, Pillar Quartz Block, Enchanted Book, Carpet.{*B*}{*B*} - {*T1*}New Mobs{*ETB*} - Zombie Villagers.{*B*}{*B*} -{*T1*}New Features{*ETB*} - Trade with villagers, repair or enchant weapons and tools with an Anvil, store items in an Ender Chest, control a pig while riding it using a Carrot on a Stick!{*B*}{*B*} -{*T1*}New Mini-Tutorials{*ETB*} – Learn how to use the new features in the Tutorial World!{*B*}{*B*} -{*T1*}New 'Easter Eggs'{*ETB*} – We've moved all the secret Music Discs in the Tutorial World. See if you can find them again!{*B*}{*B*} - +There are lots of new features for you and friends to play with so here’s just a few highlights. Have a read and then go and have fun!{*B*}{*B*} +{*T1*}New Items{*ETB*} - Hardened Clay, Stained Clay, Block of Coal, Hay Bale, Activator Rail, Block of Redstone, Daylight Sensor, Dropper, Hopper, Minecart with Hopper, Minecart with TNT, Redstone Comparator, Weighted Pressure Plate, Beacon, Trapped Chest, Firework Rocket, Firework Star, Nether Star, Lead, Horse Armor, Name Tag, Horse Spawn Egg{*B*}{*B*} +{*T1*}New Mobs{*ETB*} - Wither, Wither Skeletons, Witches, Bats, Horses, Donkeys and Mules{*B*}{*B*} +{*T1*}New Features{*ETB*} - Tame and ride a horse, craft fireworks and put on a show, name animals and monsters with a Name Tag, create more advanced Redstone circuits, and new Host Options to help control what guests to your world can do!{*B*}{*B*} +{*T1*}New Tutorial World{*ETB*} – Learn how to use the old and new features in the Tutorial World. See if you can find all the secret Music Discs hidden in the world!{*B*}{*B*} + + + + + Horses + + + + {*T3*}HOW TO PLAY : HORSES{*ETW*}{*B*}{*B*} +Horses and Donkeys are found mainly in open plains. Mules are the offspring of a Donkey and a Horse, but are infertile themselves.{*B*} +All adult Horses, Donkeys and Mules can be ridden. However only Horses can be armored, and only Mules and Donkeys may be equipped with saddlebags for transporting items.{*B*}{*B*} +Horses, Donkeys and Mules must be tamed before they can be used. A horse is tamed by attempting to ride it, and managing to stay on the horse while it attempts to throw the rider off.{*B*} +When Love Hearts appear around the horse, it is tame, and will no longer attempt to throw the player off. To steer a horse, the player must equip the horse with a Saddle.{*B*}{*B*} +Saddles can be bought from villagers or found inside Chests hidden in the world.{*B*} +Tame Donkeys and Mules can be given saddlebags by attaching a Chest. These saddlebags can then be accessed whilst riding or sneaking.{*B*}{*B*} +Horses and Donkeys (but not Mules) can be bred like other animals using Golden Apples or Golden Carrots.{*B*} +Foals will grow into adult horses over time, although feeding them Wheat or Hay will speed this up.{*B*} + + + + + Beacons + + + + {*T3*}HOW TO PLAY : BEACONS{*ETW*}{*B*}{*B*} +Active Beacons project a bright beam of light into the sky and grant powers to nearby players.{*B*} +They are crafted with Glass, Obsidian and Nether Stars, which can be obtained by defeating the Wither.{*B*}{*B*} +Beacons must be placed so that they are in sunlight during the day. Beacons must be placed on Pyramids of Iron, Gold, Emerald or Diamond.{*B*} +The material the Beacon is placed on has no effect on the power of the Beacon.{*B*}{*B*} +In the Beacon menu you can select one primary power for your Beacon. The more tiers your pyramid has the more powers you will have to choose from.{*B*} +A Beacon on a pyramid with at least four tiers also gives the option of either the Regeneration secondary power or a stronger primary power.{*B*}{*B*} +To set the powers of your Beacon you must sacrifice an Emerald, Diamond, Gold or Iron Ingot in the payment slot.{*B*} +Once set, the powers will emanate from the Beacon indefinitely.{*B*} + + + + + Fireworks + + + + {*T3*}HOW TO PLAY : FIREWORKS{*ETW*}{*B*}{*B*} +Fireworks are decorative items that can be launched by hand or from Dispensers. They are crafted using Paper, Gunpowder and optionally a number of Firework Stars.{*B*} +The colors, fade, shape, size, and effects (such as trails and twinkle) of Firework Stars can be customized by including additional ingredients when crafting.{*B*}{*B*} +To craft a Firework place Gunpowder and Paper in the 3x3 crafting grid that is shown above your inventory.{*B*} +You can optionally place multiple Firework Stars in the crafting grid to add them to the Firework.{*B*} +Filling more slots in the crafting grid with Gunpowder will increase the height at which all the Firework Stars will explode.{*B*}{*B*} +You can then take the crafted Firework out of the output slot.{*B*}{*B*} +Firework Stars can be crafted by placing Gunpowder and Dye into the crafting grid.{*B*} + - The Dye will set the color of the explosion of the Firework Star.{*B*} + - The shape of the Firework Star is set by adding either a Fire Charge, Gold Nugget, Feather or Mob Head.{*B*} + - A trail or a twinkle can be added using Diamonds or Glowstone Dust.{*B*}{*B*} +After a Firework Star has been crafted, you can set the fade color of the Firework Star by crafting it with Dye. + + + + + Hoppers + + + + {*T3*}HOW TO PLAY : HOPPERS{*ETW*}{*B*}{*B*} +Hoppers are used to insert or remove items from containers, and to automatically pick up items thrown into them.{*B*} +They can affect Brewing Stands, Chests, Dispensers, Droppers, Minecarts with Chests, Minecarts with Hoppers, as well as other Hoppers.{*B*}{*B*} +Hoppers will continuously attempt to suck items out of a suitable container placed above them. They will also attempt to insert stored items into an output container.{*B*} +If a Hopper is powered by Redstone it will become inactive and stop both sucking and inserting items.{*B*}{*B*} +A Hopper points in the direction it tries to output items. To make a Hopper point to a particular block, place the Hopper against that block whilst sneaking.{*B*} + + + + + Droppers + + + + {*T3*}HOW TO PLAY : DROPPERS{*ETW*}{*B*}{*B*} +When powered by Redstone, Droppers will drop a single random item contained within them onto the ground. Use {*CONTROLLER_ACTION_USE*} to open the Dropper and then you can load the Dropper with items from your inventory.{*B*} +If the Dropper is facing a Chest or another type of Container, the item will be placed into that instead. Long chains of Droppers can be constructed to transport items over a distance, but for this to work they will have to be alternately powered on and off. + @@ -692,100 +764,103 @@ Pumpkin Pie, Night Vision Potion, Invisibility Potion, Nether Quartz, Nether Qua Iron doors can only be opened by Redstone, buttons or switches. - + - - NOT USED - - - NOT USED - - - NOT USED - - - NOT USED - - - - Gives the user 1 Armor when worn. - + + NOT USED + - - Gives the user 3 Armor when worn. - + + NOT USED + - - Gives the user 2 Armor when worn. - + + NOT USED + - - Gives the user 1 Armor when worn. - + + NOT USED + - - Gives the user 2 Armor when worn. - + + Gives the user 1 Armor when worn. + - - Gives the user 5 Armor when worn. - + + Gives the user 3 Armor when worn. + - - Gives the user 4 Armor when worn. - + + Gives the user 2 Armor when worn. + - - Gives the user 1 Armor when worn. - + + Gives the user 1 Armor when worn. + - - Gives the user 2 Armor when worn. - + + Gives the user 2 Armor when worn. + - - Gives the user 6 Armor when worn. - + + Gives the user 5 Armor when worn. + - - Gives the user 5 Armor when worn. - + + Gives the user 4 Armor when worn. + - - Gives the user 2 Armor when worn. - + + Gives the user 1 Armor when worn. + - - Gives the user 2 Armor when worn. - + + Gives the user 2 Armor when worn. + - - Gives the user 5 Armor when worn. - + + Gives the user 6 Armor when worn. + - - Gives the user 3 Armor when worn. - + + Gives the user 5 Armor when worn. + - - Gives the user 1 Armor when worn. - + + Gives the user 2 Armor when worn. + - - Gives the user 3 Armor when worn. - + + Gives the user 2 Armor when worn. + - - Gives the user 8 Armor when worn. - + + Gives the user 5 Armor when worn. + - - Gives the user 6 Armor when worn. - + + Gives the user 3 Armor when worn. + - - Gives the user 3 Armor when worn. - + + Gives the user 1 Armor when worn. + + + + Gives the user 3 Armor when worn. + + + + Gives the user 8 Armor when worn. + + + + Gives the user 6 Armor when worn. + + + + Gives the user 3 Armor when worn. + A shiny ingot which can be used to craft tools made from this material. Created by smelting ore in a furnace. @@ -912,6 +987,10 @@ The colors of the bed are always the same, regardless of the colors of wool used Will create an image of an area explored while held. This can be used for path-finding. + + When used becomes a map of the part of the world that you are in, and gets filled in as you explore. + + Allows for ranged attacks by using arrows. @@ -920,6 +999,54 @@ The colors of the bed are always the same, regardless of the colors of wool used Used as ammunition for bows. + + Dropped by the Wither, used in crafting Beacons. + + + + When activated, create colorful explosions. The color, effect, shape and fade are determined by the Firework Star used when the Firework is created. + + + + Used to determine the color, effect and shape of a Firework. + + + + Used in Redstone circuits to maintain, compare, or subtract signal strength, or to measure certain block states. + + + + Is a type of Minecart that acts as a moving TNT block. + + + + Is a block that outputs a Redstone signal based on sunlight (or lack of sunlight). + + + + Is a special type of Minecart that functions similarly to a Hopper. It will collect items lying on tracks and from containers above it. + + + + A special type of Armor that can be equipped to a horse. Provides 5 Armor. + + + + A special type of Armor that can be equipped to a horse. Provides 7 Armor. + + + + A special type of Armor that can be equipped to a horse. Provides 11 Armor. + + + + Used to leash mobs to the player or Fence posts. + + + + Used to name mobs in the world. + + Restores 2.5{*ICON_SHANK_01*}. @@ -1022,7 +1149,7 @@ Can also be used for low-level lighting. - Functions like a Pressure Plate (sends a Redstone signal when powered) but can only be activated by a minecart. + Functions like a Pressure Plate (sends a Redstone signal when powered) but can only be activated by a Minecart. @@ -1566,6 +1693,66 @@ Can also be used for low-level lighting. Mob Heads can be placed as a decoration, or worn as a mask in the helmet slot. + + Used to execute commands. + + + + Projects a beam of light into the sky and can provide Status Effects to nearby players. + + + + Stores blocks and items inside. Place two chest side by side to create a larger chest with double capacity. The trapped chest also creates a Redstone charge when opened. + + + + Provides a Redstone charge. The charge will be stronger if more items are on the plate. + + + + Provides a Redstone charge. The charge will be stronger if more items are on the plate. Requires more weight than the light plate. + + + + Used as a redstone power source. Can be crafted back into Redstone. + + + + Used to catch items or to transfer items into and out of containers. + + + + A type of rail that can enable or disable Minecarts with Hoppers and trigger Minecarts with TNT. + + + + Used to hold and drop items, or push items into another container, when given a Redstone charge. + + + + Colorful blocks crafted by dyeing Hardened clay. + + + + Can be fed to Horses, Donkeys or Mules to heal up to 10 Hearts. Speeds up the growth of foals. + + + + Created by smelting Clay in a furnace. + + + + Crafted from glass and a dye. + + + + Crafted from Stained Glass + + + + A compact way of storing Coal. Can be used as fuel in a Furnace. + + Squid @@ -1754,6 +1941,62 @@ Can also be used for low-level lighting. Appear in Villages to protect them, and can be created using Iron Blocks and Pumpkins. + + Bat + + + + These flying creatures are found in caverns or other large enclosed spaces. + + + + Witch + + + + These enemies can be found in swamps and attack you by throwing Potions. They drop Potions when killed. + + + + Horse + + + + These animals can be tamed and can then be ridden. + + + + Donkey + + + + These animals can be tamed and can then be ridden. They can have a chest attached. + + + + Mule + + + + Born when a Horse and a Donkey breed. These animals can be tamed and can then be ridden and carry chests. + + + + Zombie Horse + + + + Skeleton Horse + + + + Wither + + + + These are crafted from Wither Skulls and Soul Sand. They fire exploding skulls at you. + + Explosives Animator @@ -2446,6 +2689,10 @@ Can also be used for low-level lighting. Map + + Empty Map + + Music Disc - "13" @@ -2650,6 +2897,50 @@ Can also be used for low-level lighting. Creeper Head + + Nether Star + + + + Firework Rocket + + + + Firework Star + + + + Redstone Comparator + + + + Minecart with TNT + + + + Minecart with Hopper + + + + Iron Horse Armor + + + + Gold Horse Armor + + + + Diamond Horse Armor + + + + Lead + + + + Name Tag + + Stone @@ -2682,6 +2973,10 @@ Can also be used for low-level lighting. Jungle Wood Planks + + Wood Planks (any type) + + Sapling @@ -2880,22 +3175,21 @@ Can also be used for low-level lighting. Block of Gold - + - - A compact way of storing Gold. - + + A compact way of storing Gold. + - + + A compact way of storing Iron. + + + Block of Iron - + - - A compact way of storing Iron. - - - - + Stone Slab @@ -3001,14 +3295,13 @@ Can also be used for low-level lighting. Block of Diamond - + - - A compact way of storing Diamonds. - + + A compact way of storing Diamonds. + - - + Crafting Table @@ -3134,14 +3427,13 @@ Can also be used for low-level lighting. Lapis Lazuli Block - + - - A compact way of storing Lapis Lazuli. - + + A compact way of storing Lapis Lazuli. + - - + Dispenser @@ -3357,6 +3649,374 @@ Can also be used for low-level lighting. Skull + + Command Block + + + + Beacon + + + + Trapped Chest + + + + Weighted Pressure Plate (Light) + + + + Weighted Pressure Plate (Heavy) + + + + Redstone Comparator + + + + Daylight Sensor + + + + Block of Redstone + + + + Hopper + + + + Activator Rail + + + + Dropper + + + + Stained Clay + + + + Hay Bale + + + + Hardened Clay + + + + Block of Coal + + + + Black Stained Clay + + + + Red Stained Clay + + + + Green Stained Clay + + + + Brown Stained Clay + + + + Blue Stained Clay + + + + Purple Stained Clay + + + + Cyan Stained Clay + + + + Light Gray Stained Clay + + + + Gray Stained Clay + + + + Pink Stained Clay + + + + Lime Stained Clay + + + + Yellow Stained Clay + + + + Light Blue Stained Clay + + + + Magenta Stained Clay + + + + Orange Stained Clay + + + + White Stained Clay + + + + Stained Glass + + + + Black Stained Glass + + + + Red Stained Glass + + + + Green Stained Glass + + + + Brown Stained Glass + + + + Blue Stained Glass + + + + Purple Stained Glass + + + + Cyan Stained Glass + + + + Light Gray Stained Glass + + + + Gray Stained Glass + + + + Pink Stained Glass + + + + Lime Stained Glass + + + + Yellow Stained Glass + + + + Light Blue Stained Glass + + + + Magenta Stained Glass + + + + Orange Stained Glass + + + + White Stained Glass + + + + Stained Glass Pane + + + + Black Stained Glass Pane + + + + Red Stained Glass Pane + + + + Green Stained Glass Pane + + + + Brown Stained Glass Pane + + + + Blue Stained Glass Pane + + + + Purple Stained Glass Pane + + + + Cyan Stained Glass Pane + + + + Light Gray Stained Glass Pane + + + + Gray Stained Glass Pane + + + + Pink Stained Glass Pane + + + + Lime Stained Glass Pane + + + + Yellow Stained Glass Pane + + + + Light Blue Stained Glass Pane + + + + Magenta Stained Glass Pane + + + + Orange Stained Glass Pane + + + + White Stained Glass Pane + + + + Small Ball + + + + Large Ball + + + + Star-shaped + + + + Creeper-shaped + + + + Burst + + + + Unknown Shape + + + + Black + + + + Red + + + + Green + + + + Brown + + + + Blue + + + + Purple + + + + Cyan + + + + Light Gray + + + + Gray + + + + Pink + + + + Lime + + + + Yellow + + + + Light Blue + + + + Magenta + + + + Orange + + + + White + + + + Custom + + + + Fade to + + + + Twinkle + + + + Trail + + + + Flight Duration: + + Current Controls @@ -3527,7 +4187,7 @@ Can also be used for low-level lighting. {*B*}Press{*CONTROLLER_VK_A*} to start the tutorial.{*B*} - Press{*CONTROLLER_VK_B*} if you think you are ready to play on your own. +Press{*CONTROLLER_VK_B*} if you think you are ready to play on your own. @@ -3565,7 +4225,7 @@ At night monsters come out, make sure to build a shelter before that happens. As you collect and craft more items, your inventory will fill up.{*B*} - Press{*CONTROLLER_ACTION_INVENTORY*} to open the inventory. +Press{*CONTROLLER_ACTION_INVENTORY*} to open the inventory. @@ -3629,21 +4289,15 @@ At night monsters come out, make sure to build a shelter before that happens. - - Night time can approach quickly, and it is dangerous to be outside unprepared. You can craft armor and weapons, but it is sensible to have a safe shelter. - + Night time can approach quickly, and it is dangerous to be outside unprepared. You can craft armor and weapons, but it is sensible to have a safe shelter. - - Nearby there is an abandoned Miner's shelter that you can complete to be safe overnight. - + Nearby there is an abandoned Miner's shelter that you can complete to be safe overnight. - - You will need to collect the resources to complete the shelter. Walls and roof can be made of any tile type, but you will want to create a door, some windows and lighting. - + You will need to collect the resources to complete the shelter. Walls and roof can be made of any tile type, but you will want to create a door, some windows and lighting. @@ -3679,179 +4333,128 @@ At night monsters come out, make sure to build a shelter before that happens. - - You have completed the first part of the tutorial. - + You have completed the first part of the tutorial. - - {*B*} - Press{*CONTROLLER_VK_A*} to continue with the tutorial.{*B*} - Press{*CONTROLLER_VK_B*} if you think you are ready to play on your own. - + {*B*} +Press{*CONTROLLER_VK_A*} to continue with the tutorial.{*B*} +Press{*CONTROLLER_VK_B*} if you think you are ready to play on your own. - - This is your inventory. It shows items available for use in your hand, and all the other items that you are carrying. Your armor is also shown here. - + This is your inventory. It shows items available for use in your hand, and all the other items that you are carrying. Your armor is also shown here. {*B*} - Press{*CONTROLLER_VK_A*} to continue.{*B*} - Press{*CONTROLLER_VK_B*} if you already know how to use the inventory. - +Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to use the inventory. - - Use{*CONTROLLER_MENU_NAVIGATE*} to move the pointer. Use{*CONTROLLER_VK_A*} to pick an item under the pointer. - If there is more than one item here this will pick them all up, or you can use{*CONTROLLER_VK_X*} to pick up just half of them. - + Use{*CONTROLLER_MENU_NAVIGATE*} to move the pointer. Use{*CONTROLLER_VK_A*} to pick an item under the pointer. +If there is more than one item here this will pick them all up, or you can use{*CONTROLLER_VK_X*} to pick up just half of them. - - Move this item with the pointer over another space in the inventory and place it down using{*CONTROLLER_VK_A*}. - With multiple items on the pointer, use{*CONTROLLER_VK_A*} to place them all, or{*CONTROLLER_VK_X*} to place just one. - + Move this item with the pointer over another space in the inventory and place it down using{*CONTROLLER_VK_A*}. +With multiple items on the pointer, use{*CONTROLLER_VK_A*} to place them all, or{*CONTROLLER_VK_X*} to place just one. - - If you move the pointer outside the edge of the interface with an item on the pointer, you can drop the item. - + If you move the pointer outside the edge of the interface with an item on the pointer, you can drop the item. - - If you want more information about an item, move the pointer over the item and press{*CONTROLLER_VK_RT*} . - + If you want more information about an item, move the pointer over the item and press{*CONTROLLER_ACTION_MENU_PAGEDOWN*} . - - Press{*CONTROLLER_VK_B*} now to exit the inventory. - + Press{*CONTROLLER_VK_B*} now to exit the inventory. - - This is the creative mode inventory. It shows items available for use in your hand, and all the other items that you can choose from. - + This is the creative mode inventory. It shows items available for use in your hand, and all the other items that you can choose from. {*B*} - Press{*CONTROLLER_VK_A*} to continue.{*B*} - Press{*CONTROLLER_VK_B*} if you already know how to use the creative mode inventory. - +Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to use the creative mode inventory. - - Use{*CONTROLLER_MENU_NAVIGATE*} to move the pointer. - When on the item list, use{*CONTROLLER_VK_A*} to pick an item under the pointer, and use{*CONTROLLER_VK_Y*} to pick up a full stack of that item. - + Use{*CONTROLLER_MENU_NAVIGATE*} to move the pointer. +When on the item list, use{*CONTROLLER_VK_A*} to pick an item under the pointer, and use{*CONTROLLER_VK_Y*} to pick up a full stack of that item. - - The pointer will automatically move over a space in the use row. You can place it down using{*CONTROLLER_VK_A*}. Once you have placed the item, the pointer will return to the item list where you can select another item. - + The pointer will automatically move over a space in the use row. You can place it down using{*CONTROLLER_VK_A*}. Once you have placed the item, the pointer will return to the item list where you can select another item. - - If you move the pointer outside the edge of the interface with an item on the pointer, you can drop the item into the world. To clear all items in the quick select bar, press{*CONTROLLER_VK_X*}. - + If you move the pointer outside the edge of the interface with an item on the pointer, you can drop the item into the world. To clear all items in the quick select bar, press{*CONTROLLER_VK_X*}. - - Scroll through the Group Type tabs at the top using{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to select the group type of the item you wish to pickup. - + Scroll through the Group Type tabs at the top using{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to select the group type of the item you wish to pickup. - - If you want more information about an item, move the pointer over the item and press{*CONTROLLER_VK_RT*} . - + If you want more information about an item, move the pointer over the item and press{*CONTROLLER_ACTION_MENU_PAGEDOWN*} . - - Press{*CONTROLLER_VK_B*} now to exit the creative mode inventory. - + Press{*CONTROLLER_VK_B*} now to exit the creative mode inventory. - - This is the crafting interface. This interface allows you to combine the items you've collected to make new items. - + This is the crafting interface. This interface allows you to combine the items you've collected to make new items. - {*B*} - Press{*CONTROLLER_VK_A*} to continue.{*B*} - Press{*CONTROLLER_VK_B*} if you already know how to craft. - + {*B*}Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to craft. {*B*} - Press{*CONTROLLER_VK_X*} to show the item description. - +Press{*CONTROLLER_VK_X*} to show the item description. {*B*} - Press{*CONTROLLER_VK_X*} to show the ingredients required to make the current item. - +Press{*CONTROLLER_VK_X*} to show the ingredients required to make the current item. {*B*} - Press{*CONTROLLER_VK_X*} to show the inventory again. - +Press{*CONTROLLER_VK_X*} to show the inventory again. - - Scroll through the Group Type tabs at the top using{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to select the group type of the item you wish to craft, then use{*CONTROLLER_MENU_NAVIGATE*} to select the item to craft. - + Scroll through the Group Type tabs at the top using{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to select the group type of the item you wish to craft, then use{*CONTROLLER_MENU_NAVIGATE*} to select the item to craft. - - The crafting area shows the items you require in order to craft the new item. Press{*CONTROLLER_VK_A*} to craft the item and place it in your inventory. - + The crafting area shows the items you require in order to craft the new item. Press{*CONTROLLER_VK_A*} to craft the item and place it in your inventory. - - You can craft a larger selection of items using a crafting table. Crafting on a table works in the same way as basic crafting, but you have a larger crafting area allowing more combinations of ingredients. - + You can craft a larger selection of items using a crafting table. Crafting on a table works in the same way as basic crafting, but you have a larger crafting area allowing more combinations of ingredients. - - The bottom right part of the crafting interface shows your inventory. This area can also show a description of the currently selected item, and the ingredients required to craft it. - + The bottom right part of the crafting interface shows your inventory. This area can also show a description of the currently selected item, and the ingredients required to craft it. - - The description of the currently selected item is now displayed. The description can give you an idea of what the item can be used for. - + The description of the currently selected item is now displayed. The description can give you an idea of what the item can be used for. - - The list of ingredients required to craft the selected item are now displayed. - + The list of ingredients required to craft the selected item are now displayed. @@ -3859,516 +4462,356 @@ At night monsters come out, make sure to build a shelter before that happens. - - Now you have built a crafting table you should place it in the world to enable you to build a larger selection of items.{*B*} - Press{*CONTROLLER_VK_B*} now to exit the crafting interface. - + Now you have built a crafting table you should place it in the world to enable you to build a larger selection of items.{*B*} +Press{*CONTROLLER_VK_B*} now to exit the crafting interface. - - Press{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to change to the group type of the items you wish to craft. Select the tools group.{*ToolsIcon*} - + Press{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to change to the group type of the items you wish to craft. Select the tools group.{*ToolsIcon*} - - Press{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to change to the group type of the items you wish to craft. Select the structures group.{*StructuresIcon*} - + Press{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to change to the group type of the items you wish to craft. Select the structures group.{*StructuresIcon*} - - Use{*CONTROLLER_MENU_NAVIGATE*} to change to the item you wish to craft. Some items have multiple versions depending on the materials used. Select the wooden shovel.{*WoodenShovelIcon*} - + Use{*CONTROLLER_MENU_NAVIGATE*} to change to the item you wish to craft. Some items have multiple versions depending on the materials used. Select the wooden shovel.{*WoodenShovelIcon*} - - A lot of crafting can involve multiple steps. Now that you have some planks there are more items that you can craft. Use{*CONTROLLER_MENU_NAVIGATE*} to change to the item you wish to craft. Select the crafting table.{*CraftingTableIcon*} - + A lot of crafting can involve multiple steps. Now that you have some planks there are more items that you can craft. Use{*CONTROLLER_MENU_NAVIGATE*} to change to the item you wish to craft. Select the crafting table.{*CraftingTableIcon*} - - With the tools you have built you are off to a great start, and are able to collect a variety of different materials more efficiently.{*B*} - Press{*CONTROLLER_VK_B*} now to exit the crafting interface. - + With the tools you have built you are off to a great start, and are able to collect a variety of different materials more efficiently.{*B*} +Press{*CONTROLLER_VK_B*} now to exit the crafting interface. - - Some items can not be created using the crafting table, but require a furnace. Craft a furnace now.{*FurnaceIcon*} - + Some items can not be created using the crafting table, but require a furnace. Craft a furnace now.{*FurnaceIcon*} - - Place the furnace you have crafted in the world. You will want to put this inside your shelter.{*B*} - Press{*CONTROLLER_VK_B*} now to exit the crafting interface. - + Place the furnace you have crafted in the world. You will want to put this inside your shelter.{*B*} +Press{*CONTROLLER_VK_B*} now to exit the crafting interface. - - This is the furnace interface. A furnace allows you to change items by firing them. For example, you can turn iron ore into iron ingots in the furnace. - + This is the furnace interface. A furnace allows you to change items by firing them. For example, you can turn iron ore into iron ingots in the furnace. {*B*} - Press{*CONTROLLER_VK_A*} to continue.{*B*} - Press{*CONTROLLER_VK_B*} if you already know how to use a furnace. - +Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to use a furnace. - - You need to put some fuel into the bottom slot of the furnace, and the item to be changed in the top slot. The furnace will then fire up and start working, putting the result in the right-hand slot. - + You need to put some fuel into the bottom slot of the furnace, and the item to be changed in the top slot. The furnace will then fire up and start working, putting the result in the right-hand slot. - - Many wooden items can be used as fuels, but not everything burns for the same time. You may also discover other items in the world that can be used as a fuel. - + Many wooden items can be used as fuels, but not everything burns for the same time. You may also discover other items in the world that can be used as a fuel. - - When your items have been fired, you can move them from the output area into your inventory. You should experiment with different ingredients to see what you can make. - + When your items have been fired, you can move them from the output area into your inventory. You should experiment with different ingredients to see what you can make. - - If you use wood as the ingredient then you can make charcoal. Put some fuel in the furnace and wood in the ingredient slot. It can take some time for the furnace to create the charcoal, so feel free to do something else and come back to check the progress. - + If you use wood as the ingredient then you can make charcoal. Put some fuel in the furnace and wood in the ingredient slot. It can take some time for the furnace to create the charcoal, so feel free to do something else and come back to check the progress. - - Charcoal can be used as a fuel, as well as being crafted into a torch with a stick. - + Charcoal can be used as a fuel, as well as being crafted into a torch with a stick. - - Placing sand in the ingredient slot allows you to make glass. Create some glass blocks to use as windows in your shelter. - + Placing sand in the ingredient slot allows you to make glass. Create some glass blocks to use as windows in your shelter. - - This is the brewing interface. You can use this to create potions that have a variety of different effects. - + This is the brewing interface. You can use this to create potions that have a variety of different effects. {*B*} - Press{*CONTROLLER_VK_A*} to continue.{*B*} - Press{*CONTROLLER_VK_B*} if you already know how to use the brewing stand. - +Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to use the brewing stand. - - You brew potions by placing an ingredient in the top slot, and a potion or water bottle in the bottom slots (up to 3 can be brewed at one time). Once a valid combination is entered the brewing process will start and create the potion after a short time. - + You brew potions by placing an ingredient in the top slot, and a potion or water bottle in the bottom slots (up to 3 can be brewed at one time). Once a valid combination is entered the brewing process will start and create the potion after a short time. - - All potions start with a Water Bottle. Most potions are created by first using a Nether Wart to make an Awkward Potion, and will require at least one more ingredient to make the final potion. - + All potions start with a Water Bottle. Most potions are created by first using a Nether Wart to make an Awkward Potion, and will require at least one more ingredient to make the final potion. - - Once you have a potion you can modify its effects. Adding Redstone Dust increases the duration of its effect and adding Glowstone Dust can make its effect more powerful. - + Once you have a potion you can modify its effects. Adding Redstone Dust increases the duration of its effect and adding Glowstone Dust can make its effect more powerful. - - Adding Fermented Spider Eye corrupts the potion and can turn it into a potion with the opposite effect, and adding Gunpowder turns the potion into a Splash Potion which can be thrown to apply its affect to a nearby area. - + Adding Fermented Spider Eye corrupts the potion and can turn it into a potion with the opposite effect, and adding Gunpowder turns the potion into a Splash Potion which can be thrown to apply its affect to a nearby area. - - Create a Potion of Fire Resistance by first adding Nether Wart to a Water Bottle, and then adding Magma Cream. - + Create a Potion of Fire Resistance by first adding Nether Wart to a Water Bottle, and then adding Magma Cream. - - Press{*CONTROLLER_VK_B*} now to exit the brewing interface. - + Press{*CONTROLLER_VK_B*} now to exit the brewing interface. - - In this area there is a Brewing Stand, a Cauldron and a chest full of items for brewing. - + In this area there is a Brewing Stand, a Cauldron and a chest full of items for brewing. {*B*} - Press{*CONTROLLER_VK_A*} to learn more about brewing and potions.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about brewing and potions. - +Press{*CONTROLLER_VK_A*} to learn more about brewing and potions.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about brewing and potions. - - The first step in brewing a potion is to create a Water Bottle. Take a Glass Bottle from the chest. - + The first step in brewing a potion is to create a Water Bottle. Take a Glass Bottle from the chest. - - You can fill a glass bottle from a Cauldron that has water in it, or from a block of water. Fill your glass bottle now by pointing at a water source and pressing{*CONTROLLER_ACTION_USE*}. - + You can fill a glass bottle from a Cauldron that has water in it, or from a block of water. Fill your glass bottle now by pointing at a water source and pressing{*CONTROLLER_ACTION_USE*}. - - If a cauldron becomes empty, you can refill it with a Water Bucket. - + If a cauldron becomes empty, you can refill it with a Water Bucket. - - Use the Brewing Stand to create a Potion of Fire Resistance. You will need a Water Bottle, Nether Wart and Magma Cream. - + Use the Brewing Stand to create a Potion of Fire Resistance. You will need a Water Bottle, Nether Wart and Magma Cream. - - With a potion in your hand, hold{*CONTROLLER_ACTION_USE*} to use it. For a normal potion you will drink it and apply the effect to yourself, and for a Splash potion you will throw it and apply the effect to creatures near where it hits. - Splash potions can be created by adding gunpowder to normal potions. - + With a potion in your hand, hold{*CONTROLLER_ACTION_USE*} to use it. For a normal potion you will drink it and apply the effect to yourself, and for a Splash potion you will throw it and apply the effect to creatures near where it hits. +Splash potions can be created by adding gunpowder to normal potions. - - Use your Potion of Fire Resistance on yourself. - + Use your Potion of Fire Resistance on yourself. - - Now that you are resistant to fire and lava, you should see if there are places you can get to that you couldn't before. - + Now that you are resistant to fire and lava, you should see if there are places you can get to that you couldn't before. - - This is the enchanting interface which you can use to add enchantments to weapons, armor and some tools. - + This is the enchanting interface which you can use to add enchantments to weapons, armor and some tools. {*B*} - Press{*CONTROLLER_VK_A*} to learn more about the enchanting interface.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about the enchanting interface. - +Press{*CONTROLLER_VK_A*} to learn more about the enchanting interface.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about the enchanting interface. - - To enchant an item, first place it in the enchanting slot. Weapons, armor and some tools can be enchanted to add special effects such as improved damage resistance or increasing the number of items produced when mining a block. - + To enchant an item, first place it in the enchanting slot. Weapons, armor and some tools can be enchanted to add special effects such as improved damage resistance or increasing the number of items produced when mining a block. - - When an item is placed in the enchanting slot, the buttons on the right will change to show a selection of random enchantments. - + When an item is placed in the enchanting slot, the buttons on the right will change to show a selection of random enchantments. - - The number on the button represents the cost in experience levels to apply that enchantment to the item. If you do not have a high enough level the button will be disabled. - + The number on the button represents the cost in experience levels to apply that enchantment to the item. If you do not have a high enough level the button will be disabled. - - Select an enchantment and press{*CONTROLLER_VK_A*} to enchant the item. This will decrease your experience level by the cost of the enchantment. - + Select an enchantment and press{*CONTROLLER_VK_A*} to enchant the item. This will decrease your experience level by the cost of the enchantment. - - Although the enchantments are all random, some of the better enchantments are only available when you have a high experience level and have lots of bookcases around the Enchantment Table to increase its power. - + Although the enchantments are all random, some of the better enchantments are only available when you have a high experience level and have lots of bookcases around the Enchantment Table to increase its power. - - In this area there is an Enchantment Table and some other items to help you learn about enchanting. - + In this area there is an Enchantment Table and some other items to help you learn about enchanting. {*B*} - Press{*CONTROLLER_VK_A*} to learn more about enchanting.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about enchanting. - +Press{*CONTROLLER_VK_A*} to learn more about enchanting.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about enchanting. - - Using an Enchantment Table allows you to add special effects such as increasing the number of items produced when mining a block, or improved damage resistance for weapons, armor and some tools. - + Using an Enchantment Table allows you to add special effects such as increasing the number of items produced when mining a block, or improved damage resistance for weapons, armor and some tools. - - Placing bookcases around the Enchantment Table increases its power and allows access to higher level enchantments. - + Placing bookcases around the Enchantment Table increases its power and allows access to higher level enchantments. - - Enchanting items costs Experience Levels, which can be built up by collecting Experience Orbs which are produced by killing monsters and animals, mining ores, breeding animals, fishing and smelting/cooking some things in a furnace. - + Enchanting items costs Experience Levels, which can be built up by collecting Experience Orbs which are produced by killing monsters and animals, mining ores, breeding animals, fishing and smelting/cooking some things in a furnace. - - You can also build experience levels using a Bottle O' Enchanting, which, when thrown, creates Experience Orbs around where it lands. These orbs can then be collected. - + You can also build experience levels using a Bottle O' Enchanting, which, when thrown, creates Experience Orbs around where it lands. These orbs can then be collected. - - In the chests in this area you can find some enchanted items, Bottles O' Enchanting, and some items that have yet to be enchanted for you to experiment with at the Enchantment Table. - + In the chests in this area you can find some enchanted items, Bottles O' Enchanting, and some items that have yet to be enchanted for you to experiment with at the Enchantment Table. - - You are now riding in a minecart. To exit the minecart, point the cursor at it and press{*CONTROLLER_ACTION_USE*} .{*MinecartIcon*} - + You are now riding in a minecart. To exit the minecart, point the cursor at it and press{*CONTROLLER_ACTION_USE*} .{*MinecartIcon*} {*B*} - Press{*CONTROLLER_VK_A*} to learn more about minecarts.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about minecarts. - +Press{*CONTROLLER_VK_A*} to learn more about minecarts.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about minecarts. - - A minecart runs on rails. You can also craft a powered minecart with a furnace and a minecart with a chest in it. - {*RailIcon*} - + A minecart runs on rails. You can also craft a powered minecart with a furnace and a minecart with a chest in it.{*RailIcon*} - - You can also craft powered rails, which take power from redstone torches and circuits to accelerate the cart. These can be connected to switches, levers and pressure plates to make complex systems. - {*PoweredRailIcon*} - + You can also craft powered rails, which take power from redstone torches and circuits to accelerate the cart. These can be connected to switches, levers and pressure plates to make complex systems.{*PoweredRailIcon*} - - You are now sailing a boat. To exit the boat, point the cursor at it and press{*CONTROLLER_ACTION_USE*} .{*BoatIcon*} - + You are now sailing a boat. To exit the boat, point the cursor at it and press{*CONTROLLER_ACTION_USE*} .{*BoatIcon*} - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about boats.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about boats. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about boats.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about boats. - - A boat allows you to travel quicker over water. You can steer it using{*CONTROLLER_ACTION_MOVE*} and{*CONTROLLER_ACTION_LOOK*}. - {*BoatIcon*} - + A boat allows you to travel quicker over water. You can steer it using{*CONTROLLER_ACTION_MOVE*} and{*CONTROLLER_ACTION_LOOK*}.{*BoatIcon*} - - You are now using a fishing rod. Press{*CONTROLLER_ACTION_USE*} to use it.{*FishingRodIcon*} - + You are now using a fishing rod. Press{*CONTROLLER_ACTION_USE*} to use it.{*FishingRodIcon*} - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about fishing.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about fishing. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about fishing.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about fishing. - - Press{*CONTROLLER_ACTION_USE*} to cast your line and start fishing. Press{*CONTROLLER_ACTION_USE*} again to reel in the fishing line. - {*FishingRodIcon*} - + Press{*CONTROLLER_ACTION_USE*} to cast your line and start fishing. Press{*CONTROLLER_ACTION_USE*} again to reel in the fishing line.{*FishingRodIcon*} - - If you wait until the float sinks below the surface of the water before reeling in you can catch a fish. Fish can be eaten raw, or cooked by a furnace, to restore health. - {*FishIcon*} - + If you wait until the float sinks below the surface of the water before reeling in you can catch a fish. Fish can be eaten raw, or cooked by a furnace, to restore health.{*FishIcon*} - - As with many other tools a fishing rod has a fixed number of uses. Those uses are not limited to catching fish though. You should experiment with it to see what else can be caught or activated... - {*FishingRodIcon*} - + As with many other tools a fishing rod has a fixed number of uses. Those uses are not limited to catching fish though. You should experiment with it to see what else can be caught or activated...{*FishingRodIcon*} - - This is a bed. Press{*CONTROLLER_ACTION_USE*} while pointing at it at night to sleep through the night and awake in the morning.{*ICON*}355{*/ICON*} - + This is a bed. Press{*CONTROLLER_ACTION_USE*} while pointing at it at night to sleep through the night and awake in the morning.{*ICON*}355{*/ICON*} - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about beds.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about beds. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about beds.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about beds. - - A bed should be placed in a safe, well-lit place so that monsters do not wake you in the middle of the night. Once you have used a bed, if you die you will respawn at that bed. - {*ICON*}355{*/ICON*} - + A bed should be placed in a safe, well-lit place so that monsters do not wake you in the middle of the night. Once you have used a bed, if you die you will respawn at that bed. +{*ICON*}355{*/ICON*} - - If there are other players in your game, everyone must be in a bed at the same time to be able to sleep. - {*ICON*}355{*/ICON*} - + If there are other players in your game, everyone must be in a bed at the same time to be able to sleep. +{*ICON*}355{*/ICON*} - - In this area there are some simple Redstone and Piston circuits, and a chest with more items to extend these circuits. - + In this area there are some simple Redstone and Piston circuits, and a chest with more items to extend these circuits. - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about Redstone circuits and Pistons.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about Redstone circuits and Pistons. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Redstone circuits and Pistons.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about Redstone circuits and Pistons. - - Levers, Buttons, Pressure Plates and Redstone Torches can all provide power to circuits, either by directly attaching them to the item you want to activate or by connecting them with Redstone dust. - + Levers, Buttons, Pressure Plates and Redstone Torches can all provide power to circuits, either by directly attaching them to the item you want to activate or by connecting them with Redstone dust. - - The position and direction that you place a power source can change how it affects the surrounding blocks. For example a Redstone torch on the side of a block can be turned off if the block is powered by another source. - + The position and direction that you place a power source can change how it affects the surrounding blocks. For example a Redstone torch on the side of a block can be turned off if the block is powered by another source. - - Redstone dust is collected by mining redstone ore with a pickaxe made of Iron, Diamond or Gold. You can use it to carry power up to 15 blocks, and it can travel up or down one block in height. - {*ICON*}331{*/ICON*} - + Redstone dust is collected by mining redstone ore with a pickaxe made of Iron, Diamond or Gold. You can use it to carry power up to 15 blocks, and it can travel up or down one block in height. +{*ICON*}331{*/ICON*} - - Redstone repeaters can be used to extend the distance that the power is carried, or put a delay in a circuit. - {*ICON*}356{*/ICON*} - + Redstone repeaters can be used to extend the distance that the power is carried, or put a delay in a circuit. +{*ICON*}356{*/ICON*} - - When powered, a Piston will extend, pushing up to 12 blocks. When they retract, Sticky Pistons can pull back one block of most types. - {*ICON*}33{*/ICON*} - + When powered, a Piston will extend, pushing up to 12 blocks. When they retract, Sticky Pistons can pull back one block of most types. +{*ICON*}33{*/ICON*} - - In the chest in this area there are some components for making circuits with pistons. Try using or completing the circuits in this area, or put together your own. There are more examples outside the tutorial area. - + In the chest in this area there are some components for making circuits with pistons. Try using or completing the circuits in this area, or put together your own. There are more examples outside the tutorial area. - - In this area there is a Portal to the Nether! - + In this area there is a Portal to the Nether! - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about Portals and The Nether.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about Portals and The Nether. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Portals and The Nether.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about Portals and The Nether. - - Portals are created by placing Obsidian blocks into a frame four blocks wide and five blocks tall. The corner blocks are not required. - + Portals are created by placing Obsidian blocks into a frame four blocks wide and five blocks tall. The corner blocks are not required. - - To activate a Nether Portal, set fire to the Obsidian blocks inside the frame with a Flint and Steel. Portals can be deactivated if their frame is broken, an explosion happens nearby or a liquid flows through them. - + To activate a Nether Portal, set fire to the Obsidian blocks inside the frame with a Flint and Steel. Portals can be deactivated if their frame is broken, an explosion happens nearby or a liquid flows through them. - - To use a Nether Portal, stand inside it. Your screen will go purple and a sound will play. After a few seconds you will be transported to another dimension. - + To use a Nether Portal, stand inside it. Your screen will go purple and a sound will play. After a few seconds you will be transported to another dimension. - - The Nether can be a dangerous place, full of lava, but can be useful to collect Netherrack which burns forever when lit, and Glowstone which produces light. - + The Nether can be a dangerous place, full of lava, but can be useful to collect Netherrack which burns forever when lit, and Glowstone which produces light. - - The Nether world can be used to fast-travel in the Overworld - traveling one block distance in the Nether is equivalent to traveling 3 blocks in the Overworld. - + The Nether world can be used to fast-travel in the Overworld - traveling one block distance in the Nether is equivalent to traveling 3 blocks in the Overworld. - - You are now in Creative mode. - + You are now in Creative mode. - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about Creative mode.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about Creative mode. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Creative mode.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about Creative mode. @@ -4388,17 +4831,13 @@ At night monsters come out, make sure to build a shelter before that happens. - - In this area a farm has been set up. Farming enables you to create a renewable source of food and other items. - + In this area a farm has been set up. Farming enables you to create a renewable source of food and other items. - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about farming.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about farming. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about farming.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about farming. @@ -4438,17 +4877,13 @@ At night monsters come out, make sure to build a shelter before that happens. - - In this area animals have been penned in. You can breed animals to produce baby versions of themselves. - + In this area animals have been penned in. You can breed animals to produce baby versions of themselves. - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about animals and breeding.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about animals and breeding. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about animals and breeding.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about animals and breeding. @@ -4472,9 +4907,7 @@ At night monsters come out, make sure to build a shelter before that happens. - - Wild wolves can be tamed by giving them bones. Once tamed Love Hearts will appear around them. Tamed wolves will follow the player and defend them if they haven't been commanded to sit. - + Wild wolves can be tamed by giving them bones. Once tamed Love Hearts will appear around them. Tamed wolves will follow the player and defend them if they haven't been commanded to sit. @@ -4482,17 +4915,13 @@ At night monsters come out, make sure to build a shelter before that happens. - - In this area are some pumpkins and blocks to make a Snow Golem and an Iron Golem. - + In this area are some pumpkins and blocks to make a Snow Golem and an Iron Golem. - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about Golems.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about Golems. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Golems.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about Golems. @@ -4568,9 +4997,7 @@ At night monsters come out, make sure to build a shelter before that happens. - - Congratulations, you have completed the tutorial. Time in the game is now passing normally, and you don't have long until night time and the monsters come out! Finish your shelter! - + Congratulations, you have completed the tutorial. Time in the game is now passing normally, and you don't have long until night time and the monsters come out! Finish your shelter! @@ -4591,7 +5018,7 @@ At night monsters come out, make sure to build a shelter before that happens. {*B*}Press{*CONTROLLER_VK_A*} to play through the tutorial as normal.{*B*} - Press{*CONTROLLER_VK_B*} to skip the main tutorial. +Press{*CONTROLLER_VK_B*} to skip the main tutorial. @@ -4603,17 +5030,233 @@ At night monsters come out, make sure to build a shelter before that happens. - - Your food bar has depleted to a level where you will no longer heal. - + Your food bar has depleted to a level where you will no longer heal. - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about the food bar and eating food.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about the food bar and eating food. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about the food bar and eating food.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about the food bar and eating food. + + + + This is the horse inventory interface. + + + + {*B*}Press{*CONTROLLER_VK_A*} to continue. +{*B*}Press{*CONTROLLER_VK_B*} if you already know how to use the horse inventory. + + + + The horse inventory allows you to transfer, or equip items to your Horse, Donkey or Mule. + + + + Saddle your Horse by placing a Saddle in the saddle slot. Horses can be given armor by placing Horse Armor in the armor slot. + + + + You can also transfer items between your own inventory and the saddlebags strapped to Donkeys and Mules in this menu. + + + + You have found a Horse. + + + + You have found a Donkey. + + + + You have found a Mule. + + + + {*B*}Press{*CONTROLLER_VK_A*} to learn more about Horses, Donkeys and Mules. +{*B*}Press{*CONTROLLER_VK_B*} if you already know about Horses, Donkeys and Mules. + + + + Horses and Donkeys are found mainly in open plains. Mules can be bred from a Donkey and a Horse, but are infertile themselves. + + + + All adult Horses, Donkeys and Mules can be ridden. However only Horses can be armored, and only Mules and Donkeys may be equipped with saddlebags for transporting items. + + + + Horses, Donkeys and Mules must be tamed before they can be used. A horse is tamed by attempting to ride it, and managing to stay on the horse while it attempts to throw the rider off. + + + + When tamed Love Hearts will appear around them and they will no longer buck the player off. + + + + Try to ride this horse now. Use {*CONTROLLER_ACTION_USE*} with no items or tools in your hand to mount it. + + + + To steer a horse they must then be equipped with a saddle, which can be bought from villagers or found inside chests hidden in the world. + + + + Tame Donkeys and Mules can be given saddlebags by attaching a chest. These bags can be accessed whilst riding or when sneaking. + + + + Horses and Donkeys (but not Mules) can be bred like other animals using Golden Apples or Golden Carrots. Foals will grow into adult horses over time, although feeding them wheat or hay will speed this up. + + + + You can try to tame the Horses and Donkeys here, and there are Saddles, Horse Armor and other useful items for Horses in chests around here too. + + + + This is the Beacon interface, which you can use to choose powers for your Beacon to grant. + + + + {*B*} +Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to use the Beacon interface. + + + + In the Beacon menu you can select 1 primary power for your Beacon. The more tiers your pyramid has the more powers you will have to choose from. + + + + A Beacon on a pyramid with at least 4 tiers grants an additional option of either the Regeneration secondary power or a stronger primary power. + + + + To set the powers of your Beacon you must sacrifice an Emerald, Diamond, Gold or Iron Ingot in the payment slot. Once set, the powers will emanate from the Beacon indefinitely. + + + + At the top of this pyramid there is an inactivate Beacon. + + + + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Beacons.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about Beacons. + + + + Active Beacons project a bright beam of light into the sky and grant powers to nearby players. They are crafted with Glass, Obsidian and Nether Stars, which can be obtained by defeating the Wither. + + + + Beacons must be placed so that they are in sunlight during the day. Beacons must be placed on Pyramids of Iron, Gold, Emerald or Diamond. However the choice of material has no effect on the power of the beacon. + + + + Try using the Beacon to set the powers it grants, you can use the Iron Ingots provided as the necessary payment. + + + + This room contains Hoppers + + + + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Hoppers.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about Hoppers. + + + + Hoppers are used to insert or remove items from containers, and to automatically pick-up items thrown into them. + + + + They can affect Brewing Stands, Chests, Dispensers, Droppers, Minecarts with Chests, Minecarts with Hoppers, as well as other Hoppers. + + + + Hoppers will continuously attempt to suck items out of suitable container placed above them. It will also attempt to insert stored items into an output container. + + + + However if a Hopper is powered by Redstone it will become inactive and stop both sucking and inserting items. + + + + A Hopper points in the direction it tries to output items. To make a Hopper point to a particular block, place the Hopper against that block whilst sneaking. + + + + There are various useful Hopper layouts for you to see and experiment with in this room. + + + + This is the Firework interface, which you can use to craft Fireworks and Firework Stars. + + + + {*B*} +Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to use the Firework interface. + + + + To craft a Firework, place Gunpowder and Paper in the 3x3 crafting grid that is shown above your inventory. + + + + You can optionally place multiple Firework Stars in the crafting grid to add them to the Firework. + + + + Filling more slots in the crafting grid with Gunpowder will increase the height at which all the Firework Stars will explode. + + + + You can then take the crafted Firework out of the output slot when you wish to craft it. + + + + Firework Stars can be crafted by placing Gunpowder and Dye into the crafting grid. + + + + The Dye will set the color of the explosion of the Firework Star. + + + + The shape of the Firework Star is set by adding either a Fire Charge, Gold Nugget, Feather or Mob Head. + + + + A trail or a twinkle can be added using Diamonds or Glowstone Dust. + + + + After a Firework Star has been crafted, you can set the fade color of the Firework Star by crafting it with Dye. + + + + Contained within the chests here there are various items used in the creation of FIREWORKS! + + + + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Fireworks. {*B*} +Press{*CONTROLLER_VK_B*} if you already know about Fireworks. + + + + Fireworks are decorative items that can be launched by hand or from Dispensers. They are crafted using Paper, Gunpowder and optionally a number of Firework Stars. + + + + The colors, fade, shape, size, and effects (such as trails and twinkles) of Firework Stars can be customized by including additional ingredients when crafting. + + + + Try crafting a Firework at the Crafting Table using an assortment of ingredients from the chests. @@ -5032,6 +5675,38 @@ At night monsters come out, make sure to build a shelter before that happens.Clear All Slots + + Mount + + + + Dismount + + + + Attach Chest + + + + Launch + + + + Leash + + + + Release + + + + Attach + + + + Name + + OK @@ -5329,6 +6004,10 @@ Would you like to unlock the full game now? Leaving The END + + Finding Seed for the World Generator + + This bed is occupied @@ -5549,6 +6228,34 @@ Would you like to unlock the full game now? Dispenser + + Horse + + + + Dropper + + + + Hopper + + + + Beacon + + + + Primary Power + + + + Secondary Power + + + + Minecart + + There are no downloadable content offers of this type available for this title at the moment. @@ -5827,6 +6534,10 @@ Would you like to install the mash-up pack or texture pack now? Game Mode: Creative + + Game Mode: Adventure + + Survival @@ -5835,6 +6546,10 @@ Would you like to install the mash-up pack or texture pack now? Creative + + Adventure + + Created in Survival Mode @@ -5875,6 +6590,10 @@ Would you like to install the mash-up pack or texture pack now? Superflat + + Enter a seed to generate the same terrain again. Leave blank for a random world. + + When enabled, the game will be an online game. @@ -5919,6 +6638,34 @@ Would you like to install the mash-up pack or texture pack now? When enabled, a chest containing some useful items will be created near the player spawn point. + + When disabled, prevents monsters and animals from changing blocks (for example, Creeper explosions won't destroy blocks and Sheep won't remove Grass) or picking up items. + + + + When enabled, players will keep their inventory when they die. + + + + When disabled, mobs will not spawn naturally. + + + + When disabled, monsters and animals will not drop loot (for example, Creepers won't drop gunpowder). + + + + When disabled, blocks will not drop items when destroyed (for example, Stone blocks won't drop Cobblestone). + + + + When disabled, players will not regenerate health naturally. + + + + When disabled, the time of day will not change. + + Skin Packs @@ -6016,7 +6763,91 @@ Would you like to install the mash-up pack or texture pack now? - {*PLAYER*} was killed by {*SOURCE*} + {*PLAYER*} was killed by {*SOURCE*} using magic + + + + {*PLAYER*} fell off a ladder + + + + {*PLAYER*} fell off some vines + + + + {*PLAYER*} fell out of the water + + + + {*PLAYER*} fell from a high place + + + + {*PLAYER*} was doomed to fall by {*SOURCE*} + + + + {*PLAYER*} was doomed to fall by {*SOURCE*} + + + + {*PLAYER*} was doomed to fall by {*SOURCE*} using {*ITEM*} + + + + {*PLAYER*} fell too far and was finished by {*SOURCE*} + + + + {*PLAYER*} fell too far and was finished by {*SOURCE*} using {*ITEM*} + + + + {*PLAYER*} walked into fire whilst fighting {*SOURCE*} + + + + {*PLAYER*} was burnt to a crisp whilst fighting {*SOURCE*} + + + + {*PLAYER*} tried to swim in lava to escape {*SOURCE*} + + + + {*PLAYER*} drowned whilst trying to escape {*SOURCE*} + + + + {*PLAYER*} walked into a cactus whilst trying to escape {*SOURCE*} + + + + {*PLAYER*} was blown up by {*SOURCE*} + + + + {*PLAYER*} withered away + + + + {*PLAYER*} was slain by {*SOURCE*} using {*ITEM*} + + + + {*PLAYER*} was shot by {*SOURCE*} using {*ITEM*} + + + + {*PLAYER*} was fireballed by {*SOURCE*} using {*ITEM*} + + + + {*PLAYER*} was pummeled by {*SOURCE*} using {*ITEM*} + + + + {*PLAYER*} was killed by {*SOURCE*} using {*ITEM*} @@ -6263,11 +7094,11 @@ Would you like to install the mash-up pack or texture pack now? - Can't shear this Mooshroom at the moment. The maximum number of Pigs, Sheep, Cows and Cats has been reached. + Can't shear this Mooshroom at the moment. The maximum number of Pigs, Sheep, Cows, Cats and Horses has been reached. - Can't use Spawn Egg at the moment. The maximum number of Pigs, Sheep, Cows and Cats has been reached. + Can't use Spawn Egg at the moment. The maximum number of Pigs, Sheep, Cows, Cats and Horses has been reached. @@ -6286,6 +7117,10 @@ Would you like to install the mash-up pack or texture pack now? Can't use Spawn Egg at the moment. The maximum number of Squid in a world has been reached. + + Can't use Spawn Egg at the moment. The maximum number of Bats in a world has been reached. + + Can't use Spawn Egg at the moment. The maximum number of enemies in a world has been reached. @@ -6303,7 +7138,7 @@ Would you like to install the mash-up pack or texture pack now? - This animal can't enter Love Mode. The maximum number of breeding Pigs, Sheep, Cows and Cats has been reached. + This animal can't enter Love Mode. The maximum number of breeding Pigs, Sheep, Cows, Cats and Horses has been reached. @@ -6314,6 +7149,10 @@ Would you like to install the mash-up pack or texture pack now? This animal can't enter Love Mode. The maximum number of breeding Chickens has been reached. + + This animal can't enter Love Mode. The maximum number of breeding horses has been reached. + + This animal can't enter Love Mode. The maximum number of breeding Mooshrooms has been reached. @@ -6362,6 +7201,10 @@ Would you like to install the mash-up pack or texture pack now? Settings + + Languages + + Credits @@ -6410,6 +7253,38 @@ Would you like to install the mash-up pack or texture pack now? World Options + + Game Options + + + + Mob Griefing + + + + Keep Inventory + + + + Mob Spawning + + + + Mob Loot + + + + Tile Drops + + + + Natural Regeneration + + + + Daylight Cycle + + Can Build and Mine @@ -6738,6 +7613,22 @@ Would you like to install the mash-up pack or texture pack now? Poison + + Wither + + + + Health Boost + + + + Absorption + + + + Saturation + + of Swiftness @@ -6814,6 +7705,22 @@ Would you like to install the mash-up pack or texture pack now? of Poison + + of Decay + + + + of Health Boost + + + + of Absorption + + + + of Saturation + + @@ -7007,6 +7914,38 @@ Would you like to install the mash-up pack or texture pack now? Reduces health of the affected players, animals and monsters over time. + + When Applied: + + + + Horse Jump Strength + + + + Zombie Reinforcements + + + + Max Health + + + + Mob Follow Range + + + + Knockback Resistance + + + + Speed + + + + Attack Damage + + Sharpness @@ -7188,7 +8127,7 @@ Would you like to install the mash-up pack or texture pack now? - Restores 1{*ICON_SHANK_01*}, or can be cooked in a furnace. This can be planted in farmland. Eating this can cause you to be poisoned. + Restores 1{*ICON_SHANK_01*}. Eating this can cause you to become poisoned. @@ -7871,8 +8810,5 @@ All Ender Chests in a world are linked. Items placed into an Ender Chest are acc Cure - - - Finding Seed for the World Generator - + \ No newline at end of file diff --git a/Minecraft.Assets/XboxMedia/Media/skin_Minecraft.xui b/Minecraft.Assets/XboxMedia/Media/skin_Minecraft.xui index 5d4517d2c..da03a9ab6 100644 --- a/Minecraft.Assets/XboxMedia/Media/skin_Minecraft.xui +++ b/Minecraft.Assets/XboxMedia/Media/skin_Minecraft.xui @@ -2,7 +2,7 @@ 1280.000000 720.000000 -[LayerFolders]5|+How To Play|34|+|0|+ControllerIcons|3|+|0|+Creative Inventory|8|+|0|+Crafting Scene|16|+|0|+Scenes, Panels,etc|14|+|0|+Main Menu|4|+|0|+DLC|4|+|0|+Skin Select Scene|15|+|0|+HTML|4|+|0|+HUD|18|+|0|+Inventory Containers Special|34|+|0|+Inventory Containers Shared|22|+|0|+Lists|0|+Leaderboard|4|+|0|+Players|6|+|25|+|0|+Tooltips|20|+|0|+Credits|8|+|0|-Labels and Text|53|+|0|-Other|11|+|0|+ImagePresenters|2|+|0|-Default Controls|18|+|0[/LayerFolders] +[LayerFolders]7|+How To Play|44|+|0|+ControllerIcons|3|+|0|+Creative Inventory|8|+|0|+Crafting Scene|16|+|0|+Scenes, Panels,etc|14|+|0|+Main Menu|4|+|0|+DLC|4|+|0|+Skin Select Scene|15|+|0|+HTML|4|+|0|+HUD|19|+|0|-Inventory Containers Special|41|+|0|+Inventory Containers Shared|24|+|0|+Lists|0|+Leaderboard|4|+|0|+Players|6|+|25|+|0|+Tooltips|22|+|0|+Credits|8|+|0|-Labels and Text|53|+|0|+Other|11|+|0|+ImagePresenters|2|+|0|+Default Controls|18|+|0[/LayerFolders] @@ -12951,6 +12951,406 @@ +RStick_Button +350.000000 +36.000000 + + + +text_ButtonText +300.000000 +36.000000 +61.000000,0.000000,0.000000 +1 +0xffffffff +0xff000000 +16.000000 +20497 + + + + +rs_graphic +58.000000 +48.000000 +0.000000,-5.000000,0.000000 +0.800000 +16 +Graphics\X360ControllerIcons\ButtonRS_TT.png +48 + + + + + +Normal + + + +EndNormal + +stop + + +Focus + + + +FocusLoop + + + +EndFocus + +gotoandplay +FocusLoop + + +NormalDisable + + + +EndNormalDisable + +stop + + +FocusDisable + + + +EndFocusDisable + +stop + + +Press + + + +EndPress + +stop + + +InitFocus + + + +InitFocusLoop + + + +EndInitFocus + +gotoandplay +InitFocusLoop + + +InitFocusDisable + + + +EndInitFocusDisable + +stop + + + +text_ButtonText +TextColor + + +0 +0xffffffff + + + +0 +0xff606060 + + + +0 +0xff606060 + + + +0 +0xffa0a0a0 + + + +0 +0xffffffff + + + +rs_graphic +Opacity +Scale +Position + + +1 +0.800000 +1.000000,1.000000,1.000000 +0.000000,-5.000000,0.000000 + + + +1 +1.000000 +1.000000,1.000000,1.000000 +0.000000,-5.000000,0.000000 + + + +1 +0.300000 +1.000000,1.000000,1.000000 +0.000000,-5.000000,0.000000 + + + +1 +0.500000 +1.000000,1.000000,1.000000 +0.000000,-5.000000,0.000000 + + + +0 +1.000000 +1.000000,1.000000,1.000000 +0.000000,-5.000000,0.000000 + + + +0 +1.000000 +0.900000,0.900000,1.000000 +1.500000,-0.750000,0.000000 + + + +1 +1.000000 +1.000000,1.000000,1.000000 +0.000000,-5.000000,0.000000 + + + +1 +0.500000 +1.000000,1.000000,1.000000 +0.000000,-3.000000,0.000000 + + + + + + +RStick_ButtonSmall +350.000000 +25.000000 + + + +text_ButtonText +300.000000 +25.000000 +43.000000,0.000000,0.000000 +1 +0xffffffff +0xff000000 +11.000000 +20497 + + + + +rb_graphic +40.000000 +34.000000 +0.000000,-3.000000,0.000000 +0.800000 +16 +Graphics\X360ControllerIcons\ButtonRS_TT.png +48 + + + + + +Normal + + + +EndNormal + +stop + + +Focus + + + +FocusLoop + + + +EndFocus + +gotoandplay +FocusLoop + + +NormalDisable + + + +EndNormalDisable + +stop + + +FocusDisable + + + +EndFocusDisable + +stop + + +Press + + + +EndPress + +stop + + +InitFocus + + + +InitFocusLoop + + + +EndInitFocus + +gotoandplay +InitFocusLoop + + +InitFocusDisable + + + +EndInitFocusDisable + +stop + + + +text_ButtonText +TextColor + + +0 +0xffffffff + + + +0 +0xff606060 + + + +0 +0xff606060 + + + +0 +0xffa0a0a0 + + + +0 +0xffffffff + + + +rb_graphic +Opacity +Scale +Position + + +1 +0.800000 +1.000000,1.000000,1.000000 +0.000000,-3.000000,0.000000 + + + +1 +1.000000 +1.000000,1.000000,1.000000 +0.000000,-3.000000,0.000000 + + + +1 +0.300000 +1.000000,1.000000,1.000000 +0.000000,-3.000000,0.000000 + + + +1 +0.500000 +1.000000,1.000000,1.000000 +0.000000,-3.000000,0.000000 + + + +0 +1.000000 +1.000000,1.000000,1.000000 +0.000000,-3.000000,0.000000 + + + +0 +1.000000 +0.900000,0.900000,1.000000 +1.500000,1.250000,0.000000 + + + +1 +1.000000 +1.000000,1.000000,1.000000 +0.000000,-3.000000,0.000000 + + + +1 +0.500000 +1.000000,1.000000,1.000000 +0.000000,-3.000000,0.000000 + + + + + + XuiListTexturePackButtonSmall 40.000000 40.000000 @@ -29314,6 +29714,177 @@ +ItemIconBlankSmall +22.000000 +22.000000 + + + +image +22.000000 +22.000000 +15 +CXuiCtrlMinecraftSlot +XuiVisualImagePresenter + + + + + +Normal + + + +EndNormal + +stop + + +Focus + + + +FocusLoop + + + +EndFocus + +gotoandplay +FocusLoop + + +NormalDisable + + + +EndNormalDisable + +stop + + +FocusDisable + + + +InactiveFocusLoop + + + +EndFocusDisable + +gotoandplay +InactiveFocusLoop + + +Press + + + +EndPress + +stop + + +NormalSel + + + +EndNormalSel + +stop + + + + + + +ItemIconBlank +42.000000 +42.000000 + + + +image +38.000000 +38.000000 +2.000000,2.000000,0.000000 +15 +CXuiCtrlMinecraftSlot +XuiVisualImagePresenter + + + + + +Normal + + + +EndNormal + +stop + + +Focus + + + +FocusLoop + + + +EndFocus + +gotoandplay +FocusLoop + + +NormalDisable + + + +EndNormalDisable + +stop + + +FocusDisable + + + +InactiveFocusLoop + + + +EndFocusDisable + +gotoandplay +InactiveFocusLoop + + +Press + + + +EndPress + +stop + + +NormalSel + + + +EndNormalSel + +stop + + + + + + ItemIcon 64.000000 64.000000 @@ -29411,6 +29982,2088 @@ +BeaconButton +44.000000 +44.000000 +15 + + + +Button +44.000000 +44.000000 +Graphics\Beacon_Button_Normal.png + + + + +Icon +36.000000 +36.000000 +4.000000,4.000000,0.000000 +15 +true + + + +Icon +36.000000 +36.000000 +false +16 +48 + + + + + +Normal + +stop + + +Tick + +stop + + +Cross + +stop + + +Blindness + +stop + + +Fire_Resistance + +stop + + +Haste + +stop + + +Hunger + +stop + + +Invisibility + +stop + + +Jump_Boost + +stop + + +Mining_Fatigue + +stop + + +Nausea + +stop + + +Night_Vision + +stop + + +Poison + +stop + + +Regeneration + +stop + + +Resistance + +stop + + +Slowness + +stop + + +Speed + +stop + + +Strength + +stop + + +Water_Breathing + +stop + + +Weakness + +stop + + +Wither + +stop + + +HealthBoost + +stop + + +Absorption + +stop + + + +Icon +Show +ImagePath + + +0 +false + + + + +0 +true +Graphics\Beacon_Button_Tick.png + + + +0 +true + + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Blindness.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Fire_Resistance.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Haste.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Hunger.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Invisibility.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Jump_Boost.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Mining_Fatigue.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Nausea.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Night_Vision.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Poison.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Regeneration.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Resistance.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Slowness.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Speed.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Strength.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Water_Breathing.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Weakness.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Wither.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_HealthBoost.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_HealthBoost.png + + + + + + + +Normal + +stop + + +Pressed + +stop + + +Disabled + +stop + + +Hover + +stop + + + +Button +ImagePath + + +0 +Graphics\Beacon_Button_Normal.png + + + +0 +Graphics\Beacon_Button_Pressed.png + + + +0 +Graphics\Beacon_Button_Disabled.png + + + +0 +Graphics\Beacon_Button_Hover.png + + + + + + +BeaconButtonSmall +22.000000 +22.000000 +15 + + + +Button +22.000000 +22.000000 +8 +Graphics\Beacon_Button_Normal.png + + + + +Icon +18.000000 +18.000000 +2.000000,2.000000,0.000000 +15 +true + + + +Icon +18.000000 +18.000000 +false +16 +48 + + + + + +Normal + +stop + + +Tick + +stop + + +Cross + +stop + + +Blindness + +stop + + +Fire_Resistance + +stop + + +Haste + +stop + + +Hunger + +stop + + +Invisibility + +stop + + +Jump_Boost + +stop + + +Mining_Fatigue + +stop + + +Nausea + +stop + + +Night_Vision + +stop + + +Poison + +stop + + +Regeneration + +stop + + +Resistance + +stop + + +Slowness + +stop + + +Speed + +stop + + +Strength + +stop + + +Water_Breathing + +stop + + +Weakness + +stop + + +Wither + +stop + + +HealthBoost + +stop + + +Absorption + +stop + + + +Icon +Show +ImagePath + + +0 +false + + + + +0 +true +Graphics\Beacon_Button_Tick.png + + + +0 +true + + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Blindness.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Fire_Resistance.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Haste.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Hunger.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Invisibility.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Jump_Boost.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Mining_Fatigue.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Nausea.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Night_Vision.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Poison.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Regeneration.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Resistance.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Slowness.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Speed.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Strength.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Water_Breathing.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Weakness.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Wither.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_HealthBoost.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_HealthBoost.png + + + + + + + +Normal + +stop + + +Pressed + +stop + + +Disabled + +stop + + +Hover + +stop + + + +Button +ImagePath +SizeMode + + +0 +Graphics\Beacon_Button_Normal.png +8 + + + +0 +Graphics\Beacon_Button_Pressed.png +4 + + + +0 +Graphics\Beacon_Button_Disabled.png +8 + + + +0 +Graphics\Beacon_Button_Hover.png +8 + + + + + + +ItemGridHorseArmor +42.000000 +42.000000 + + + +control_ListItem +42.000000 +42.000000 +7 +0.000000,50.000000,0.000000 +CXuiCtrlSlotItemListItem +ItemButtonHorseArmor +22594 +4 + + + + + +KillFocus + + + +Normal + + + +EndNormal + +stop + + +Focus + + + +EndFocus + +stop + + + + + + +ItemButtonHorseArmor +42.000000 +42.000000 + + + +Box +42.000000 +42.000000 +15 +4 +Graphics\IconHolder.png +48 + + + + +Icon +38.000000 +38.000000 +2.000000,2.000000,0.000000 +15 +16 +Graphics\Horse_Armor_Slot.png +48 + + + + +image +38.000000 +38.000000 +2.000000,2.000000,0.000000 +15 +CXuiCtrlMinecraftSlot +XuiVisualImagePresenter + + + + +graphic_Highlight +38.000000 +38.000000 +2.000000,2.000000,0.000000 +0.000000 +15 + + +0xff646464 + + + + +0xb4ebebeb + + +4 +0xff828282 +0xffb4b4b4 +0xffd2d2d2 +0xffebebeb +0.000000 +0.592157 +0.627451 +1.000000 + + +90.000000 + + +true +4,0.000000,0.000000,0.000000,0.000000,242.119705,0.000000,1,242.119705,0.000000,242.119705,0.000000,242.119705,31.004648,1,242.119705,31.004648,242.119705,31.004648,0.000000,31.006342,1,0.000000,31.006342,0.000000,31.006342,0.000000,0.000000,1, + + + + + +Normal + + + +EndNormal + +stop + + +Focus + + + +FocusLoop + + + +EndFocus + +gotoandplay +FocusLoop + + +NormalDisable + + + +EndNormalDisable + +stop + + +FocusDisable + + + +InactiveFocusLoop + + + +EndFocusDisable + +gotoandplay +InactiveFocusLoop + + +Press + + + +EndPress + +stop + + +NormalSel + + + +EndNormalSel + +stop + + + +graphic_Highlight +Fill.Gradient.StopPos +Fill.Gradient.StopColor +Fill.Gradient.StopColor +Fill.Gradient.StopColor +Stroke.StrokeColor +Fill.Gradient.StopColor +Opacity + + +1 +0.627451 +0xff828282 +0xffd2d2d2 +0xffebebeb +0xff646464 +0xffb4b4b4 +0.000000 + + + +0 +0.627451 +0xff828282 +0xffd2d2d2 +0xffebebeb +0xff646464 +0xffb4b4b4 +1.000000 + + + +0 +0.619608 +0xff648264 +0xffc8d2c8 +0xffc8ebc8 +0xff649664 +0xff78b478 +1.000000 + + + +0 +0.619608 +0xff829682 +0xffc8d2c8 +0xffc8ebc8 +0xff649664 +0xff96c896 +1.000000 + + + +0 +0.619608 +0xff648264 +0xffc8d2c8 +0xffc8ebc8 +0xff649664 +0xff78b478 +1.000000 + + + +1 +0.627451 +0xffb4b4b4 +0xffd2d2d2 +0xffebebeb +0xffb4b4b4 +0xffc8c8c8 +0.000000 + + + +0 +0.627451 +0xffb4b4b4 +0xffd2d2d2 +0xffebebeb +0xffb4b4b4 +0xffc8c8c8 +0.000000 + + + +0 +0.619608 +0xff8c968c +0xffbec8be +0xffebebeb +0xff647264 +0xffaaafa0 +0.000000 + + + +0 +0.619608 +0xff8cb48c +0xffc3cdc3 +0xffdaebda +0xff648464 +0xff91b18c +0.000000 + + + +0 +0.619608 +0xff8c968c +0xffbec8be +0xffebebeb +0xff647264 +0xffaaafa0 +0.000000 + + + +2 +0 +0 +50 +0.619608 +0xff648264 +0xffc8d2c8 +0xffc8ebc8 +0xff649664 +0xff78b478 +0.000000 + + + +0 +0.619608 +0xff648264 +0xffc8d2c8 +0xffc8ebc8 +0xff649664 +0xff78b478 +0.000000 + + + +0 +0.619608 +0xff648264 +0xffc8d2c8 +0xffc8ebc8 +0xff649664 +0xff78b478 +0.000000 + + + +0 +0.619608 +0xff8c968c +0xffbec8be +0xffebebeb +0xff649664 +0xffaaafa0 +0.000000 + + + + + + +ItemGridHorseSaddle +42.000000 +42.000000 + + + +control_ListItem +42.000000 +42.000000 +7 +0.000000,50.000000,0.000000 +CXuiCtrlSlotItemListItem +ItemButtonHorseSaddle +22594 +4 + + + + + +KillFocus + + + +Normal + + + +EndNormal + +stop + + +Focus + + + +EndFocus + +stop + + + + + + +ItemButtonHorseSaddle +42.000000 +42.000000 + + + +Box +42.000000 +42.000000 +15 +4 +Graphics\IconHolder.png +48 + + + + +Icon +38.000000 +38.000000 +2.000000,2.000000,0.000000 +15 +16 +Graphics\Horse_Saddle_Slot.png +48 + + + + +image +38.000000 +38.000000 +2.000000,2.000000,0.000000 +15 +CXuiCtrlMinecraftSlot +XuiVisualImagePresenter + + + + +graphic_Highlight +38.000000 +38.000000 +2.000000,2.000000,0.000000 +0.000000 +15 + + +0xff646464 + + + + +0xb4ebebeb + + +4 +0xff828282 +0xffb4b4b4 +0xffd2d2d2 +0xffebebeb +0.000000 +0.592157 +0.627451 +1.000000 + + +90.000000 + + +true +4,0.000000,0.000000,0.000000,0.000000,242.119705,0.000000,1,242.119705,0.000000,242.119705,0.000000,242.119705,31.004648,1,242.119705,31.004648,242.119705,31.004648,0.000000,31.006342,1,0.000000,31.006342,0.000000,31.006342,0.000000,0.000000,1, + + + + + +Normal + + + +EndNormal + +stop + + +Focus + + + +FocusLoop + + + +EndFocus + +gotoandplay +FocusLoop + + +NormalDisable + + + +EndNormalDisable + +stop + + +FocusDisable + + + +InactiveFocusLoop + + + +EndFocusDisable + +gotoandplay +InactiveFocusLoop + + +Press + + + +EndPress + +stop + + +NormalSel + + + +EndNormalSel + +stop + + + +graphic_Highlight +Fill.Gradient.StopPos +Fill.Gradient.StopColor +Fill.Gradient.StopColor +Fill.Gradient.StopColor +Stroke.StrokeColor +Fill.Gradient.StopColor +Opacity + + +1 +0.627451 +0xff828282 +0xffd2d2d2 +0xffebebeb +0xff646464 +0xffb4b4b4 +0.000000 + + + +0 +0.627451 +0xff828282 +0xffd2d2d2 +0xffebebeb +0xff646464 +0xffb4b4b4 +1.000000 + + + +0 +0.619608 +0xff648264 +0xffc8d2c8 +0xffc8ebc8 +0xff649664 +0xff78b478 +1.000000 + + + +0 +0.619608 +0xff829682 +0xffc8d2c8 +0xffc8ebc8 +0xff649664 +0xff96c896 +1.000000 + + + +0 +0.619608 +0xff648264 +0xffc8d2c8 +0xffc8ebc8 +0xff649664 +0xff78b478 +1.000000 + + + +1 +0.627451 +0xffb4b4b4 +0xffd2d2d2 +0xffebebeb +0xffb4b4b4 +0xffc8c8c8 +0.000000 + + + +0 +0.627451 +0xffb4b4b4 +0xffd2d2d2 +0xffebebeb +0xffb4b4b4 +0xffc8c8c8 +0.000000 + + + +0 +0.619608 +0xff8c968c +0xffbec8be +0xffebebeb +0xff647264 +0xffaaafa0 +0.000000 + + + +0 +0.619608 +0xff8cb48c +0xffc3cdc3 +0xffdaebda +0xff648464 +0xff91b18c +0.000000 + + + +0 +0.619608 +0xff8c968c +0xffbec8be +0xffebebeb +0xff647264 +0xffaaafa0 +0.000000 + + + +2 +0 +0 +50 +0.619608 +0xff648264 +0xffc8d2c8 +0xffc8ebc8 +0xff649664 +0xff78b478 +0.000000 + + + +0 +0.619608 +0xff648264 +0xffc8d2c8 +0xffc8ebc8 +0xff649664 +0xff78b478 +0.000000 + + + +0 +0.619608 +0xff648264 +0xffc8d2c8 +0xffc8ebc8 +0xff649664 +0xff78b478 +0.000000 + + + +0 +0.619608 +0xff8c968c +0xffbec8be +0xffebebeb +0xff649664 +0xffaaafa0 +0.000000 + + + + + + +HorsePanel +283.000000 +36.000000 + + + +graphic_Middle +282.000000 +35.000000 +15 + + +0xff646464 + + + + +0xff0f0f0f + + +4 +0xff828282 +0xffb4b4b4 +0xffd2d2d2 +0xffebebeb +0.000000 +0.592157 +0.627451 +1.000000 + + +90.000000 + + +true +4,0.000000,0.000000,0.000000,0.000000,242.119705,0.000000,1,242.119705,0.000000,242.119705,0.000000,242.119705,31.004648,1,242.119705,31.004648,242.119705,31.004648,0.000000,31.006342,1,0.000000,31.006342,0.000000,31.006342,0.000000,0.000000,1, + + + + +graphic_BottomEdge +283.000000 +2.000000 +0.000000,34.000000,0.000000 +13 + + +0xffebebeb + + +true +4,0.000000,0.000000,0.000000,0.000000,242.119690,0.000000,0,242.119690,0.000000,242.119690,0.000000,242.119690,2.000000,0,242.119690,2.000000,242.119690,2.000000,0.000000,2.000000,0,0.000000,2.000000,0.000000,2.000000,0.000000,0.000000,0, + + + + +graphic_CapLeft +2.000000 +36.000000 +11 + + +0xff646464 + + + + +0xff373737 + + +true +4 +0xff7d7d7d +0xffb4b4b4 +0xffd2d2d2 +0xffebebeb +0.086275 +0.466667 +0.494118 +0.682353 + + +1 + + +true +4,0.000000,0.000000,0.000000,0.000000,3.000000,0.000000,0,3.000000,0.000000,3.000000,0.000000,3.000000,35.000000,0,3.000000,35.000000,3.000000,35.000000,0.000000,35.000000,0,0.000000,35.000000,0.000000,35.000000,0.000000,0.000000,0, + + + + +graphic_CapRight +2.000000 +35.000000 +281.000000,0.000000,0.000000 +14 + + +0xff646464 + + + + +0xffebebeb + + +true +4 +0xff7d7d7d +0xffb4b4b4 +0xffd2d2d2 +0xffebebeb +0.086275 +0.466667 +0.494118 +0.682353 + + +1 + + +true +4,0.000000,0.000000,0.000000,0.000000,3.000000,0.000000,0,3.000000,0.000000,3.000000,0.000000,3.000000,35.000000,0,3.000000,35.000000,3.000000,35.000000,0.000000,35.000000,0,0.000000,35.000000,0.000000,35.000000,0.000000,0.000000,0, + + + + +graphic_TopEdge +283.000000 +2.000000 +7 + + +0xff373737 + + +true +4,0.000000,0.000000,0.000000,0.000000,242.119720,0.000000,0,242.119720,0.000000,242.119720,0.000000,242.119720,2.000000,0,242.119720,2.000000,242.119720,2.000000,0.000000,2.000000,0,0.000000,2.000000,0.000000,2.000000,0.000000,0.000000,0, + + + + +HorseControl +283.000000 +36.000000 +15 +CXuiCtrlMinecraftHorse + + + + + +Normal + + + +EndNormal + +stop + + +Focus + + + +FocusLoop + + + +EndFocus + +gotoandplay +FocusLoop + + +NormalDisable + + + +EndNormalDisable + +stop + + +FocusDisable + + + +InactiveFocusLoop + + + +EndFocusDisable + +gotoandplay +InactiveFocusLoop + + +Press + + + +EndPress + +stop + + +NormalSel + + + +EndNormalSel + +stop + + + +graphic_Middle +Fill.Gradient.StopPos +Fill.Gradient.StopColor +Fill.Gradient.StopColor +Fill.Gradient.StopColor +Stroke.StrokeColor +Fill.Gradient.StopColor +Fill.Gradient.StopPos + + +1 +0.627451 +0xff828282 +0xffd2d2d2 +0xffebebeb +0xff646464 +0xffb4b4b4 +0.592157 + + + +0 +0.627451 +0xff828282 +0xffd2d2d2 +0xffebebeb +0xff646464 +0xffb4b4b4 +0.592157 + + + +0 +0.619608 +0xff648264 +0xffc8d2c8 +0xffc8ebc8 +0xff649664 +0xff78b478 +0.592157 + + + +0 +0.619608 +0xff829682 +0xffc8d2c8 +0xffc8ebc8 +0xff649664 +0xff96c896 +0.592157 + + + +0 +0.619608 +0xff648264 +0xffc8d2c8 +0xffc8ebc8 +0xff649664 +0xff78b478 +0.592157 + + + +1 +0.627451 +0xffb4b4b4 +0xffd2d2d2 +0xffebebeb +0xffb4b4b4 +0xffc8c8c8 +0.592157 + + + +0 +0.627451 +0xffb4b4b4 +0xffd2d2d2 +0xffebebeb +0xffb4b4b4 +0xffc8c8c8 +0.592157 + + + +0 +0.619608 +0xff8c968c +0xffbec8be +0xffebebeb +0xff647264 +0xffaaafa0 +0.592157 + + + +0 +0.619608 +0xff8cb48c +0xffc3cdc3 +0xffdaebda +0xff648464 +0xff91b18c +0.592157 + + + +0 +0.619608 +0xff8c968c +0xffbec8be +0xffebebeb +0xff647264 +0xffaaafa0 +0.592157 + + + +2 +0 +0 +50 +0.619608 +0xff648264 +0xffc8d2c8 +0xffc8ebc8 +0xff649664 +0xff78b478 +0.592157 + + + +1 +0.490196 +0xff8cb48c +0xff8cb48c +0xff8ca08c +0xff649664 +0xff8cb48c +0.376471 + + + +2 +0 +0 +50 +0.490196 +0xff8cb48c +0xff8cb48c +0xff8ca08c +0xff649664 +0xff8cb48c +0.376471 + + + +0 +0.619608 +0xff648264 +0xffc8d2c8 +0xffc8ebc8 +0xff649664 +0xff78b478 +0.592157 + + + +0 +0.619608 +0xff648264 +0xffc8d2c8 +0xffc8ebc8 +0xff649664 +0xff78b478 +0.592157 + + + +0 +0.619608 +0xff8c968c +0xffbec8be +0xffebebeb +0xff649664 +0xffaaafa0 +0.592157 + + + +graphic_BottomEdge +Fill.FillColor + + +1 +0xffebebeb + + + +0 +0xff0f0f0f + + + +1 +0xff0f0f0f + + + +0 +0xff0f0f0f + + + +1 +0xffb4b4b4 + + + +0 +0xffebebeb + + + +1 +0xffebebeb + + + +0 +0xffebebeb + + + +1 +0xffebebeb + + + +0 +0xff0f0f0f + + + +0 +0xffebebeb + + + +0 +0xffebebeb + + + +graphic_TopEdge +Fill.FillColor + + +1 +0xff373737 + + + +0 +0xffebebeb + + + +1 +0xffebebeb + + + +0 +0xffebebeb + + + +1 +0xffb4b4b4 + + + +0 +0xff0f0f0f + + + +1 +0xff0f0f0f + + + +0 +0xff0f0f0f + + + +1 +0xff0f0f0f + + + +0 +0xffebebeb + + + +0 +0xff0f0f0f + + + +0 +0xff0f0f0f + + + +graphic_CapLeft +Fill.FillColor + + +1 +0xff373737 + + + +0 +0xffebebeb + + + +1 +0xffebebeb + + + +0 +0xffebebeb + + + +0 +0xff0f0f0f + + + +0 +0xff0f0f0f + + + +0 +0xff0f0f0f + + + +0 +0xff0f0f0f + + + +0 +0xff0f0f0f + + + +0 +0xff0f0f0f + + + +0 +0xff0f0f0f + + + +0 +0xff0f0f0f + + + +graphic_CapRight +Fill.FillColor + + +1 +0xffebebeb + + + +0 +0xff0f0f0f + + + +1 +0xff0f0f0f + + + +0 +0xff0f0f0f + + + +0 +0xffebebeb + + + +0 +0xffebebeb + + + +0 +0xffebebeb + + + +0 +0xffebebeb + + + +0 +0xffebebeb + + + +0 +0xffebebeb + + + +0 +0xffebebeb + + + +0 +0xffebebeb + + + + + + HtmlItemDescriptionSmall 32.000000 32.000000 @@ -29912,6 +32565,21 @@ stop + +Wither + +stop + + +HealthBoost + +stop + + +Absorption + +stop + Icon @@ -30025,6 +32693,24 @@ true Graphics\PotionEffect\Potion_Effect_Icon_Weakness.png + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Wither.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_HealthBoost.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_HealthBoost.png + @@ -30277,6 +32963,21 @@ stop + +Wither + +stop + + +HealthBoost + +stop + + +Absorption + +stop + Icon @@ -30390,6 +33091,24 @@ true Graphics\PotionEffect\Potion_Effect_Icon_Weakness.png + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_Wither.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_HealthBoost.png + + + +0 +true +Graphics\PotionEffect\Potion_Effect_Icon_HealthBoost.png + @@ -34088,6 +36807,121 @@ +HorseJumpProgress +548.000000 +15.000000 + + + +ProgressBody +548.000000 +15.000000 + + + +back +182.000000 +5.000000 +15 +4 +Graphics\HUD\HorseJump_bar_empty.png +48 + + + + +bar +182.000000 +5.000000 +15 +false +true + + + +bar +182.000000 +5.000000 +4 +Graphics\HUD\HorseJump_bar_full.png +48 + + + + + +design_time_display +458.000000 +15.000000 +15 +false +true + + +1.000000 +0xff646464 + + + + +2 +0xffffffff + + +2 +0xffebebeb +0xff7d7d7d +0.000000 +0.000000 + + + + +true +4,0.000000,0.000000,0.000000,0.000000,170.000000,0.000000,0,170.000000,0.000000,170.000000,0.000000,170.000000,19.000000,0,170.000000,19.000000,170.000000,19.000000,0.000000,19.000000,0,0.000000,19.000000,0.000000,19.000000,0.000000,0.000000,0, + + + + +bar +Show +Width + + +0 +false +182.000000 + + + +0 +true +3.330000 + + + +0 +true +182.000000 + + + + + + + +Normal + + + +EndNormal + + + + + + + BossHealthLabel 500.000000 66.000000 @@ -35336,6 +38170,56 @@ stop + +FullWither + +stop + + +FullWitherFlash + +stop + + +HalfWither + +stop + + +HalfWitherFlash + +stop + + +FullAbsorb + +stop + + +HalfAbsorb + +stop + + +Horse_Full + +stop + + +Horse_Full_Flash + +stop + + +Horse_Half + +stop + + +Horse_Half_Flash + +stop + Border @@ -35350,6 +38234,46 @@ 0 Graphics\HUD\Health_Background_Flash.png + + +0 +Graphics\HUD\Health_Background.png + + + +0 +Graphics\HUD\Health_Background_Flash.png + + + +0 +Graphics\HUD\Health_Background.png + + + +0 +Graphics\HUD\Health_Background_Flash.png + + + +0 +Graphics\HUD\Health_Background.png + + + +0 +Graphics\HUD\Health_Background_Flash.png + + + +0 +Graphics\HUD\Health_Background.png + + + +0 +Graphics\HUD\Health_Background_Flash.png + Heart @@ -35415,6 +38339,66 @@ true Graphics\HUD\Health_Full_Poison_Flash.png + + +0 +true +Graphics\HUD\Health_Full_Wither.png + + + +0 +true +Graphics\HUD\Health_Full_Wither_Flash.png + + + +0 +true +Graphics\HUD\Health_Half_Wither.png + + + +0 +true +Graphics\HUD\Health_Half_Wither_Flash.png + + + +0 +true +Graphics\HUD\Health_Full_Absorb.png + + + +0 +true +Graphics\HUD\Health_Half_Absorb.png + + + +0 +true +Graphics\HUD\HorseHealth_Full.png + + + +0 +true +Graphics\HUD\HorseHealth_Full_Flash.png + + + +0 +true +Graphics\HUD\HorseHealth_Half.png + + + +0 +true +Graphics\HUD\HorseHealth_Half_Flash.png + @@ -42205,6 +45189,23 @@ +ImHowToPlayEnderchest +339.000000 +342.000000 + + + +XuiImageBreeding +451.000000 +455.000000 +0.750000,0.750000,0.750000 +1 +Graphics\HowToPlay\HowToPlay_Enderchest.png + + + + + ImHowToPlayBrewing 339.000000 342.000000 @@ -42698,18 +45699,130 @@ -ImHowToPlayEnderchest -339.000000 -342.000000 +ImHowToPlayBeaconSmall +260.000000 +290.000000 -XuiImageBreeding -451.000000 -455.000000 -0.750000,0.750000,0.750000 +Image +336.000000 +290.000000 1 -Graphics\HowToPlay\HowToPlay_Enderchest.png +Graphics\HowToPlay\HowToPlay_Beacon_Small.png + + + + + +ImHowToPlayBeacon +430.000000 +430.000000 + + + +Image +430.000000 +430.000000 +1 +Graphics\HowToPlay\HowToPlay_Beacon.png + + + + + +ImHowToPlayHorsesSmall +248.000000 +146.000000 + + + +Image +248.000000 +146.000000 +1 +Graphics\HowToPlay\HowToPlay_Horses_Small.png +48 + + + + + +ImHowToPlayHorses +525.000000 +308.000000 + + + +Image +516.000000 +302.000000 +1 +Graphics\HowToPlay\HowToPlay_Horses.png + + + + + +ImHowToPlayFireworksSmall +260.000000 +280.000000 + + + +Image +260.000000 +280.000000 +1 +Graphics\HowToPlay\HowToPlay_Fireworks_Small.png + + + + + +ImHowToPlayFireworks +428.000000 +450.000000 + + + +Image +428.000000 +450.000000 +1 +Graphics\HowToPlay\HowToPlay_Fireworks.png + + + + + +ImHowToPlayHopperSmall +260.000000 +220.000000 + + + +Image +260.000000 +220.000000 +1 +Graphics\HowToPlay\HowToPlay_Hopper_Small.png + + + + + +ImHowToPlayHopper +430.000000 +336.000000 + + + +Image +430.000000 +336.000000 +1 +Graphics\HowToPlay\HowToPlay_Hopper.png @@ -42769,4 +45882,76 @@ + + +Beacon_1 +40.000000 +40.000000 + + + +Image +40.000000 +40.000000 +15 +8 +Graphics\Beacon_1.png +48 + + + + + +Beacon_2 +40.000000 +40.000000 + + + +Image +40.000000 +40.000000 +15 +8 +Graphics\Beacon_2.png +48 + + + + + +Beacon_3 +40.000000 +40.000000 + + + +Image +40.000000 +40.000000 +15 +8 +Graphics\Beacon_3.png +48 + + + + + +Beacon_4 +40.000000 +40.000000 + + + +Image +40.000000 +40.000000 +15 +8 +Graphics\Beacon_4.png +48 + + + diff --git a/Minecraft.Assets/XboxMedia/4J_strings.resx b/Minecraft.Assets/XboxMedia/loc/4J_strings.resx similarity index 99% rename from Minecraft.Assets/XboxMedia/4J_strings.resx rename to Minecraft.Assets/XboxMedia/loc/4J_strings.resx index 2d7e48a7a..ecafab861 100644 --- a/Minecraft.Assets/XboxMedia/4J_strings.resx +++ b/Minecraft.Assets/XboxMedia/loc/4J_strings.resx @@ -92,7 +92,7 @@ Enter a name for your savegame - Return to Desktop + Return to Xbox Dashboard Are you sure you want to exit the game? diff --git a/Minecraft.Assets/XboxMedia/loc/de-DE/strings.resx b/Minecraft.Assets/XboxMedia/loc/de-DE/strings.resx index 219cb1b98..430711f8b 100644 --- a/Minecraft.Assets/XboxMedia/loc/de-DE/strings.resx +++ b/Minecraft.Assets/XboxMedia/loc/de-DE/strings.resx @@ -150,7 +150,7 @@ Minecraft ist ein Spiel, bei dem du Blöcke platzierst, um alles zu bauen, was d Mit{*CONTROLLER_ACTION_LOOK*} kannst du dich umsehen.{*B*}{*B*} Mit{*CONTROLLER_ACTION_MOVE*} kannst du dich bewegen.{*B*}{*B*} Drück{*CONTROLLER_ACTION_JUMP*}, um zu springen.{*B*}{*B*} -Drück{*CONTROLLER_ACTION_MOVE*} zweimal schnell nacheinander nach vorn, um zu sprinten. Solange du{*CONTROLLER_ACTION_MOVE*} nach vorn gedrückt hältst, sprintest du weiter, bis dir die Sprintzeit ausgeht oder deine Hungerleiste weniger als{*ICON_SHANK_03*} anzeigt. +Drück{*CONTROLLER_ACTION_MOVE*} zweimal schnell nacheinander nach vorn, um zu sprinten. Solange du{*CONTROLLER_ACTION_MOVE*} nach vorn gedrückt hältst, sprintest du weiter, bis dir die Sprintzeit ausgeht oder deine Hungerleiste weniger als{*ICON_SHANK_03*} anzeigt..{*B*}{*B*} Halte{*CONTROLLER_ACTION_ACTION*} gedrückt, um mit deiner Hand oder dem, was du darin hältst, zu graben oder zu hacken. Möglicherweise musst du dir ein Werkzeug bauen, um manche Blöcke abbauen zu können.{*B*}{*B*} Wenn du einen Gegenstand in der Hand hältst, kannst du ihn mit{*CONTROLLER_ACTION_USE*} verwenden. Drück{*CONTROLLER_ACTION_DROP*}, um ihn abzulegen. @@ -228,13 +228,13 @@ Du wirst selbst mit Kombinationen von Zutaten experimentieren müssen, um alle v {*T3*}SO WIRD GESPIELT: VERZAUBERN{*ETW*}{*B*}{*B*} -Mithilfe der Erfahrungspunkte, die du erhältst, wenn ein NPC stirbt oder wenn du bestimmte Blöcke abbaust oder im Ofen einschmilzt, kannst du einige Werkzeuge, Waffen, Rüstungen und Bücher verzaubern. {*B*} -Wenn ein Schwert, ein Bogen, eine Axt, eine Spitzhacke, eine Schaufel, eine Rüstung oder ein Buch in das Feld unter dem Buch in den Zaubertisch gelegt werden, zeigen die drei Schaltflächen rechts des Feldes ein paar Zauber und ihre Kosten in Erfahrungsleveln an. {*B*} -Wenn du für einen der Zauber nicht genug Erfahrungslevel hast, werden seine Kosten in Rot angezeigt, sonst in Grün. {*B*}{*B*} -Die tatsächlich angewendete Verzauberung wird zufällig aus den angezeigten Verzauberungen ausgewählt. {*B*}{*B*} -Wenn der Zaubertisch von Bücherregalen umgeben ist (bis hin zu maximal 15 Bücherregalen), wobei zwischen Zaubertisch und Bücherregal ein Block Abstand sein muss, werden die Verzauberungen verstärkt und man kann sehen, wie arkane Schriftzeichen aus dem Buch auf dem Zaubertisch herausfliegen. {*B*}{*B*} +Mithilfe der Erfahrungspunkte, die du erhältst, wenn ein NPC stirbt oder wenn du bestimmte Blöcke abbaust oder im Ofen einschmilzt, kannst du einige Werkzeuge, Waffen, Rüstungen und Bücher verzaubern.{*B*} +Wenn ein Schwert, ein Bogen, eine Axt, eine Spitzhacke, eine Schaufel, eine Rüstung oder ein Buch in das Feld unter dem Buch in den Zaubertisch gelegt werden, zeigen die drei Schaltflächen rechts des Feldes ein paar Zauber und ihre Kosten in Erfahrungsleveln an.{*B*} +Wenn du für einen der Zauber nicht genug Erfahrungslevel hast, werden seine Kosten in Rot angezeigt, sonst in Grün.{*B*}{*B*} +Die tatsächlich angewendete Verzauberung wird zufällig aus den angezeigten Verzauberungen ausgewählt.{*B*}{*B*} +Wenn der Zaubertisch von Bücherregalen umgeben ist (bis hin zu maximal 15 Bücherregalen), wobei zwischen Zaubertisch und Bücherregal ein Block Abstand sein muss, werden die Verzauberungen verstärkt und man kann sehen, wie arkane Schriftzeichen aus dem Buch auf dem Zaubertisch herausfliegen.{*B*}{*B*} Alle Zutaten für einen Zaubertisch kann man in den Dörfern einer Welt finden oder indem man die Welt abbaut und bewirtschaftet.{*B*}{*B*} -Zauberbücher werden beim Amboss benutzt, um Verzauberungen auf Gegenstände anzuwenden. Das gibt dir mir Kontrolle darüber, welche Verzauberungen du auf deinen Gegenständen möchtest.{*B*} +Zauberbücher werden beim Amboss benutzt, um Verzauberungen auf Gegenstände anzuwenden. Das gibt dir mehr Kontrolle darüber, welche Verzauberungen du auf deinen Gegenständen möchtest.{*B*} {*T3*}SO WIRD GESPIELT: TIERHALTUNG{*ETW*}{*B*}{*B*} @@ -301,6 +301,27 @@ Beim Laden oder Erstellen einer Welt kannst du mit der Schaltfläche "Weitere Op {*T2*}Hostprivilegien{*ETW*}{*B*} Aktiviert, dass der Host das Fliegen nutzen, Erschöpfung deaktivieren und sich selbst im Spielmenü unsichtbar machen kann. {*DISABLES_ACHIEVEMENTS*}{*B*}{*B*} + {*T2*}Tageslichtzyklus{*ETW*}{*B*} + Bei Deaktivierung ändert sich die Tageszeit nicht.{*B*}{*B*} + + {*T2*}Inventar behalten{*ETW*}{*B*} + Bei Aktivierung behalten Spieler ihr Inventar, wenn sie sterben.{*B*}{*B*} + + {*T2*}NPC-Eintritt{*ETW*}{*B*} + Bei Deaktivierung erscheinen keine NPCs auf natürlichem Weg.{*B*}{*B*} + + {*T2*}NPC-Griefing{*ETW*}{*B*} + Bei Deaktivierung können Monster und Tiere keine Blöcke verändern (z. B. werden bei Creeper-Explosionen keine Blöcke zerstört und Schafe entfernen kein Gras) oder Gegenstände aufheben.{*B*}{*B*} + + {*T2*}NPC-Beute{*ETW*}{*B*} + Bei Deaktivierung lassen Monster und Tiere keine Beute fallen (z. B. lassen Creeper kein Schießpulver fallen).{*B*}{*B*} + + {*T2*}Felderertrag{*ETW*}{*B*} + Bei Deaktivierung lassen Blöcke keine Gegenstände zurück, wenn sie zerstört werden (z. B. hinterlassen Steinblöcke keine Pflastersteine).{*B*}{*B*} + + {*T2*}Natürliche Erholung{*ETW*}{*B*} + Bei Deaktivierung wird die Gesundheit von Spielern nicht auf natürlichem Weg wiederhergestellt.{*B*}{*B*} + {*T1*}Optionen für das Erstellen der Welt{*ETW*}{*B*} Beim Erstellen einer neuen Welt gibt es einige zusätzliche Optionen.{*B*}{*B*} @@ -317,7 +338,7 @@ Beim Erstellen einer neuen Welt gibt es einige zusätzliche Optionen.{*B*}{*B*} Bei Aktivierung wird der Nether neu erstellt. Das ist nützlich, wenn du einen älteren Spielstand ohne Netherfestungen hast.{*B*}{*B*} {*T1*}Optionen im Spiel{*ETW*}{*B*} - Während des Spielens hast du Zugriff auf eine Reihe von Optionen, indem du mit der BACK-Taste das Spielmenü aufrufst.{*B*}{*B*} + Während des Spielens hast du Zugriff auf eine Reihe von Optionen, indem du mit {*BACK_BUTTON*} das Spielmenü aufrufst.{*B*}{*B*} {*T2*}Hostoptionen{*ETW*}{*B*} Der Host-Spieler und alle anderen als Moderatoren eingesetzten Spieler haben Zugriff auf das Menü "Hostoptionen". In diesem Menü können "Feuer breitet sich aus" und "TNT explodiert" aktiviert und deaktiviert werden.{*B*}{*B*} @@ -344,24 +365,26 @@ Um die Privilegien für einen Spieler zu bearbeiten, rufst du mit {*CONTROLLER_V Ist diese Option aktiviert, kann der Spieler Privilegien für andere Spieler (den Host ausgenommen) ändern, wenn "Spielern vertrauen" ausgeschaltet ist. Der Spieler kann andere Spieler ausschließen und "Feuer breitet sich aus" sowie "TNT explodiert" an- und ausschalten.{*B*}{*B*} {*T2*}Spieler ausschließen{*ETW*}{*B*} - Ist diese Option ausgewählt, werden Spieler, die nicht auf der gleichen {*PLATFORM_NAME*} Konsole wie der Host-Spieler spielen, ebenso wie alle anderen Spieler auf seiner {*PLATFORM_NAME*} Konsole vom Spiel ausgeschlossen. Dieser Spieler kann dem Spiel erst wieder beitreten, wenn es neu gestartet wird.{*B*}{*B*} + {*KICK_PLAYER_DESCRIPTION*}{*B*}{*B*} {*T1*}Optionen für Host-Spieler{*ETW*}{*B*} Wenn "Hostprivilegien" aktiviert ist, kann der Host-Spieler einige seiner eigenen Privilegien bearbeiten. Zur Bearbeitung der Privilegien für einen Spieler rufst du mit {*CONTROLLER_VK_A*} das Privilegien-Menü für Spieler auf, wo du die folgenden Optionen nutzen kannst.{*B*}{*B*} {*T2*}Kann fliegen{*ETW*}{*B*} Ist diese Option aktiviert, kann der Spieler fliegen. Diese Option ist nur für den Überlebensmodus relevant, da das Fliegen im Kreativmodus für alle Spieler aktiviert ist.{*B*}{*B*} - + {*T2*}Erschöpfung deaktivieren{*ETW*}{*B*} Diese Option betrifft nur den Überlebensmodus. Aktiviert, dass körperliche Aktivitäten (Laufen/Sprinten/Springen etc.) sich nicht auf die Hungerleiste auswirken. Verletzt der Spieler sich allerdings, verringert sich die Hungerleiste langsam während des Heilungsvorgangs.{*B*}{*B*} - + {*T2*}Unsichtbar{*ETW*}{*B*} Ist diese Option aktiviert, kann der Spieler von anderen Spielern nicht gesehen werden und ist unverwundbar.{*B*}{*B*} - - {*T2*}Kann teleportieren{*ETW*}{*B*} + + {*T2*}Kann teleportieren{*ETW*}{*B*} Dies erlaubt dem Spieler, sich selbst oder andere Spieler zu anderen Spielern in der Welt zu bewegen. +Mit dieser Option wird ein Spieler, der nicht auf der {*PLATFORM_NAME*} Konsole des Hosts spielt, vom Spiel ausgeschlossen; andere Spieler auf der {*PLATFORM_NAME*} Konsole des ausgeschlossenen Spielers werden ebenfalls ausgeschlossen. Dieser Spieler kann dem Spiel erst wieder beitreten, wenn es neu gestartet wird. + Nächste Seite Vorige Seite @@ -374,7 +397,7 @@ Wenn "Hostprivilegien" aktiviert ist, kann der Host-Spieler einige seiner eigene Truhen -Dinge herstellen +Crafting Ofen @@ -425,63 +448,95 @@ sie können dir also leicht zu Hilfe kommen. Neuigkeiten - -{*T3*}Veränderungen und Neuerungen{*ETW*}{*B*}{*B*} -- Neue Gegenstände hinzugefügt: Smaragde, Smaragderz, Smaragdblock, Endertruhe, Stolperdrahthaken, verzauberter goldener Apfel, Amboss, Blumentopf, Pflastersteinmauer, bemooste Pflastersteinmauer, Dörrgemälde, Kartoffel, Ofenkartoffel, giftige Kartoffel, Karotte, goldene Karotte, -Karottenangel, Kürbiskuchen, Nachtsichttrank, Unsichtbarkeitstrank, Netherquarz, Netherquarzerz, Quarzblock, Quarzstufe, Quarztreppe, gemeißelter Quarzblock, Säulen-Quarzblock, Zauberbuch, Teppich.{*B*} -- Neue Rezepte für glatten und gemeißelten Sandstein hinzugefügt.{*B*} -- Neue NPCs hinzugefügt: Zombie-Dorfbewohner.{*B*} -- Neue Geländeerstellungsfunktionen hinzugefügt: Wüstentempel, Wüstendörfer, Dschungeltempel.{*B*} -- Handel mit Dorfbewohnern hinzugefügt.{*B*} -- Ambossmenü hinzugefügt.{*B*} -- Lederrüstungen können nun eingefärbt werden.{*B*} -- Wolfshalsbänder können nun eingefärbt werden.{*B*} -- Beim Reiten auf Schweinen kann mit einer Karottenangel gesteuert werden.{*B*} -- Aktualisierter Bonustruheninhalt mit mehr Gegenständen.{*B*} -- Die Platzierung halber Blöcke sowie von Blöcken auf halben Blöcken wurde geändert.{*B*} -- Die Platzierung von umgedrehten Treppen und Stufen wurde geändert.{*B*} -- Verschiedene Berufe für Dorfbewohner hinzugefügt.{*B*} -- Dorfbewohner, die aus einem Eintrittsei spawnen, haben zufällige Berufe.{*B*} -- Baumstämme können seitwärts platziert werden.{*B*} -- Öfen können mit hölzernen Werkzeugen befeuert werden.{*B*} -- Eis- und Glasscheiben können mit Werkzeugen gesammelt werden, die mit Behutsamkeit verzaubert wurden.{*B*} -- Hölzerne Knöpfe und Druckplatten können durch Pfeile betätigt werden.{*B*} -- Nether-NPCs können oberirdisch aus Portalen spawnen.{*B*} -- Creeper und Spinnen sind aggressiver gegenüber dem Spieler, der sie zuletzt geschlagen hat.{*B*} -- Im Kreativmodus werden NPCs nach kurzer Zeit wieder neutral.{*B*} -- Der Rückstoßeffekt beim Ertrinken wurde entfernt.{*B*} -- Wenn Zombies Türen zerstören, ist der Schaden jetzt sichtbar.{*B*} -- Eis schmilzt im Nether.{*B*} -- Kessel, die draußen im Regen stehen, werden aufgefüllt.{*B*} -- Die Aktualisierungszeit von Kolben wurde verdoppelt.{*B*} -- Schweine verlieren gegebenenfalls ihren Sattel, wenn sie getötet werden.{*B*} -- Die Farbe des Himmels im Ende wurde geändert.{*B*} -- Draht für Stolperdraht kann platziert werden.{*B*} -- Regen tropft durch Blätter.{*B*} -- Hebel können an der Unterseite von Blöcken platziert werden.{*B*} -- Je nach Schwierigkeit verursacht TNT mehr oder weniger Schaden.{*B*} -- Das Bücherrezept wurde geändert.{*B*} -- Boote zerstören jetzt Seerosenblätter, nicht mehr umgekehrt.{*B*} -- Schweine lassen mehr Schweinefleisch fallen.{*B*} -- In superflachen Welten spawnen weniger Slimes.{*B*} -- Creeper verursachen je nach Schwierigkeit mehr oder weniger Schaden und der Rückstoß wurde erhöht.{*B*} -- Das Problem, durch das Endermen ihre Kiefer nicht bewegen konnten, wurde behoben.{*B*} -- Spieler können nun im BACK-Taste-Menü während des Spiels teleportieren.{*B*} -- Neue Hostoptionen für Flug, Unsichtbarkeit und Unverwundbarkeit entfernter Spieler hinzugefügt.{*B*} -- Neue Tutorials über neue Gegenstände und Funktionen zur Tutorial-Welt hinzugefügt.{*B*} -- Die Schallplattentruhen in der Tutorial-Welt wurden neu verteilt.{*B*} +{*T3*}Veränderungen und Neuerungen{*ETW*}{*B*}{*B*} +- Neue Gegenstände hinzugefügt: Ausgehärteter Lehm, gefärbter Lehm, Kohleblock, Heuballen, Aktivierungsschiene, Redstone-Block, Tageslichtsensor, Auswurfblock, Trichter, Lore mit Trichter, Lore mit TNT, Redstone-Vergleicher, beschwerte Druckplatte, Signalfeuer, eingeklemmte Truhe, Feuerwerksrakete, Feuerwerksstern, Netherstern, Leine, Pferderüstung, Namensschild, Pferde-Eintrittsei.{*B*} +- Neue NPCs hinzugefügt: Dürre, Dörrskelette, Hexen, Fledermäuse, Pferde, Esel und Maultiere.{*B*} +- Neue Geländeerstellungsfunktionen hinzugefügt: Hexenhütten.{*B*} +- Signalfeuer-Oberfläche hinzugefügt.{*B*} +- Pferde-Oberfläche hinzugefügt.{*B*} +Trichter-Oberfläche hinzugefügt.{*B*} +- Feuerwerk hinzugefügt: Die Feuerwerk-Oberfläche kann von der Werkbank aufgerufen werden, wenn du die Zutaten zum Craften eines Feuerwerkssterns oder einer Feuerwerksrakete hast.{*B*} +- Abenteuermodus hinzugefügt: Du kannst Blöcke nur mit den richtigen Werkzeugen abbauen.{*B*} +- Viele neue Sounds hinzugefügt.{*B*} +NPCs, Gegenstände und Projektile können jetzt durch Portale gehen.{*B*} +- Repeater können jetzt gesperrt werden, indem ihre Seiten von einem weiteren Repeater mit Strom versorgt werden.{*B*} +- Zombies und Skelette können jetzt andere Waffen und Rüstungen haben.{*B*} +- Neue Todesmeldungen.{*B*} +- Benenne NPCs mit einem Namensschild und benenne Behälter um, um den Titel des geöffneten Menüs zu ändern.{*B*} +- Knochenmehl lässt nicht mehr alles sofort zu voller Größe wachsen, sondern in zufälligen Stufen.{*B*} +- Ein Redstone-Signal, das den Inhalt von Truhen, Brauständen, Dispensern und Jukeboxen beschreibt, kann aufgefangen werden, indem ein Redstone-Vergleicher direkt daran platziert wird.{*B*} +- Dispenser können in jede Richtung zeigen.{*B*} +- Goldene Äpfel verleihen Spielern kurzfristig zusätzliche Absorptions-Gesundheit.{*B*} +- In einem Gebiet erscheinende Monster werden mit zunehmender Dauer des Aufenthalts immer schwieriger.{*B*} {*ETB*}Willkommen zurück! Vielleicht hast du es gar nicht bemerkt, aber dein Minecraft wurde gerade aktualisiert.{*B*}{*B*} Es gibt jede Menge neue Funktionen für dich und deine Freunde. Hier stellen wir dir nur ein paar Highlights vor. Lies sie dir durch und dann ziehe los und hab Spaß!{*B*}{*B*} -{*T1*}Neue Gegenstände{*ETB*}: Smaragde, Smaragderz, Smaragdblock, Endertruhe, Stolperdrahthaken, verzauberter goldener Apfel, Amboss, Blumentopf, Pflastersteinmauer, bemooste Pflastersteinmauer, Dörrgemälde, Kartoffel, Ofenkartoffel, giftige Kartoffel, Karotte, goldene Karotte, -Karottenangel, Kürbiskuchen, Nachtsichttrank, Unsichtbarkeitstrank, Netherquarz, Netherquarzerz, Quarzblock, Quarzstufe, Quarztreppe, gemeißelter Quarzblock, Säulen-Quarzblock, Zauberbuch, Teppich.{*B*}{*B*} - {*T1*}Neue NPCs{*ETB*} – Zombie-Dorfbewohner.{*B*}{*B*} -{*T1*}Neue Funktionen{*ETB*}: Handel mit Dorfbewohnern, Waffen und Werkzeuge auf Ambossen reparieren oder verzaubern, Gegenstände in einer Endertruhe lagern, Steuerung beim Reiten auf Schweinen mit einer Karottenangel!{*B*}{*B*} -{*T1*}Neue Mini-Tutorials{*ETB*} – Lerne in der Tutorial-Welt, wie man die neuen Features benutzt!{*B*}{*B*} -{*T1*}Neue 'Easter Eggs'{*ETB*} – Wir haben alle geheimen Schallplatten in der Tutorial-Welt neu platziert. Versuch, sie alle wiederzufinden!{*B*}{*B*} +{*T1*}Neue Gegenstände{*ETB*} – Ausgehärteter Lehm, gefärbter Lehm, Kohleblock, Heuballen, Aktivierungsschiene, Redstone-Block, Tageslichtsensor, Auswurfblock, Trichter, Lore mit Trichter, Lore mit TNT, Redstone-Vergleicher, beschwerte Druckplatte, Signalfeuer, eingeklemmte Truhe, Feuerwerksrakete, Feuerwerksstern, Netherstern, Leine, Pferderüstung, Namensschild, Pferde-Eintrittsei.{*B*}{*B*} +{*T1*}Neue NPCs{*ETB*} – Dürre, Dörrskelette, Hexen, Fledermäuse, Pferde, Esel und Maultiere.{*B*}{*B*} +{*T1*}Neue Features{*ETB*} – Zähme und reite ein Pferd, crafte Feuerkwerk für eine Show, benenne Tiere und Monster mit einem Namensschild, erschaffe fortgeschrittenere Redstone-Schaltkreise und neue Hostoptionen zur Kontrolle der Gastberechtigungen!{*B*}{*B*} +{*T1*}Neue Tutorial-Welt{*ETB*} – Lerne den Umgang mit neuen und alten Features. Versuche, alle geheimen Schallplatten in der Welt zu finden!{*B*}{*B*} +Pferde + +{*T3*}SO WIRD GESPIELT: PFERDE{*ETW*}{*B*}{*B*} +Pferde und Esel findet man hauptsächlich auf freiem Feld. Maultiere sind die Nachfahren von jeweils einem Esel und einem Pferd, sie sind aber selbst unfruchtbar.{*B*} +Alle ausgewachsenen Pferde, Esel und Maultiere können geritten werden. Allerdings können nur Pferden Rüstungen angelegt werden und nur Maultiere sowie Esel können mit Satteltaschen für den Transport von Gegenständen ausgestattet werden.{*B*}{*B*} +Pferde, Esel und Maultiere müssen vor dem Gebrauch gezähmt werden. Du zähmst ein Pferd, indem du versuchst, es zu reiten, und oben bleibst, wenn es versucht, dich abzuwerfen.{*B*} +Wenn um das Pferd herum Liebesherzen erscheinen, ist es zahm und versucht nicht mehr, dich abzuwerfen. Um ein Pferd beim Reiten zu lenken, musst du ihm einen Sattel anlegen.{*B*}{*B*} +Du kannst Sättel von Dorfbewohnern kaufen oder in versteckten Truhen in der Welt finden.{*B*} +Du kannst zahmen Eseln und Maultieren Satteltaschen geben, indem du eine Truhe anbringst. Du kannst dann während des Reitens oder beim Schleichen auf die Taschen zugreifen.{*B*}{*B*} +Pferde und Esel (nicht aber Maultiere) können wie andere Tiere mithilfe von goldenen Äpfeln oder goldenen Karotten gezüchtet werden.{*B*} +Fohlen wachsen mit der Zeit zu Pferden heran und du kannst dies beschleunigen, indem du sie mit Weizen oder Heu fütterst.{*B*} + + +Signalfeuer + +{*T3*}SO WIRD GESPIELT: SIGNALFEUER{*ETW*}{*B*}{*B*} +Aktive Signalfeuer werfen einen hellen Lichtstrahl in den Himmel und gewähren Spielern in der Nähe Kräfte.{*B*} +Sie werden aus Glas, Obsidian und Nethersternen gefertigt, die du erhältst, wenn du die Dürre besiegst.{*B*}{*B*} +Signalfeuer müssen auf Pyramiden aus Eisen, Gold, Smaragd oder Diamant so platziert werden, dass sie tagsüber dem Sonnenlicht ausgesetzt sind.{*B*} +Das Material der Unterlage hat keine Auswirkungen auf die Kraft des Signalfeuers.{*B*}{*B*} +Im Signalfeuermenü kannst du eine Hauptkraft für dein Signalfeuer auswählen. Je mehr Stufen deine Pyramide hat, desto mehr Kräfte stehen dir zur Auswahl.{*B*} +Bei einem Signalfeuer auf einer Pyramide mit mindestens vier Stufen hast du außerdem die Option, entweder die Regeneration als Zweitkraft oder eine stärkere Hauptkraft auszuwählen.{*B*}{*B*} +Um die Kräfte deines Signalfeuers einzustellen, musst du einen Smaragd, Diamant, Gold- oder Eisenbarren im Bezahl-Slot opfern.{*B*} +Danach strahlt das Signalfeuer für unbegrenzte Zeit die Kräfte aus.{*B*} + + +Feuerwerk + +{*T3*}SO WIRD GESPIELT: FEUERWERK{*ETW*}{*B*}{*B*} +Feuerwerk sind dekorative Gegenstände, die manuell oder von Dispensern gestartet werden können. Sie werden aus Papier, Schießpulver und wahlweise einigen Feuerwerkssternen gecraftet.{*B*} +Farben, Verblassen, Form, Größe und Effekte (wie Spuren und Funkeln) von Feuerwerkssternen können beim Craften durch zusätzliche Zutaten angepasst werden.{*B*}{*B*} +Feuerkwerk craftest du, indem du Schießpulver und Papier in das 3x3-Crafting-Raster legst, das über deinem Inventar angezeigt wird.{*B*} +Du kannst wahlweise mehrere Feuerwerkssterne in das Raster legen, um sie dem Feuerwerk hinzuzufügen.{*B*} +Mehr Schießpulver im Raster erhöht die Höhe, in der Feuerwerkssterne explodieren.{*B*}{*B*} +Du kannst das fertige Feuerwerk dann aus dem Ausgabeplatz nehmen.{*B*}{*B*} +Feuerwerkssterne werden hergestellt, indem du Schießpulver und Farbe in das Raster legst.{*B*} + – Die Explosion des Feuerwerkssterns nimmt die jeweilige Farbe an.{*B*} + – Die Form des Feuerwerkssterns ändert sich durch das Hinzufügen von Feuerkugeln, Goldklumpen, Federn oder NPC-Köpfen.{*B*} + – Spur oder Funkeln können mit Diamanten oder Glowstone-Staub hinzugefügt werden.{*B*}{*B*} +Wenn ein Feuerwerksstern gecraftet wurde, kannst du das Verblassen mit Farbe ändern. + + +Trichter + +{*T3*}SO WIRD GESPIELT: TRICHTER{*ETW*}{*B*}{*B*} +Mit Trichtern kannst du Gegenstände in Behälter füllen oder sie daraus entnehmen sowie automatisch Gegenstände aufheben, die hineingeworfen werden.{*B*} +Sie können mit Brauständen, Truhen, Dispensern, Auswurfblöcken, Loren mit Truhen, Loren mit Trichtern sowie anderen Trichtern verwendet werden.{*B*}{*B*} +Trichter versuchen fortwährend, Gegenstände aus einem geeigneten Behälter aufzusaugen, der über ihnen platziert wird. Sie versuchen auch, gelagerte Gegenstände in einen Ausgabebehälter zu legen.{*B*} +Wenn ein Trichter mit Redstone betrieben wird, wird er inaktiv und hört auf, Gegenstände aufzusaugen und einzufügen.{*B*}{*B*} +Ein Trichter zeigt in die Ausgaberichtung für Gegenstände. Damit ein Trichter auf einen bestimmten Block zeigt, platzierst du ihn dagegen, während du schleichst.{*B*} + + +Auswurfblöcke + +{*T3*}SO WIRD GESPIELT: AUSWURFBLÖCKE{*ETW*}{*B*}{*B*} +Von Redstone mit Energie versorgte Auswurfblöcke lassen einen einzelnen, zufälligen Gegenstand fallen. Öffne den Auswurfblock mit {*CONTROLLER_ACTION_USE*} und fülle ihn dann mit Gegenständen aus deinem Inventar.{*B*} +Wenn der Auswurfblock einer Truhe oder einem anderen Behälter zugewandt ist, wird der Gegenstand stattdessen darin abgelegt. Lange Ketten aus Auswurfblöcken können hergestellt werden, um Gegenstände über längere Entfernungen zu transportieren. Dafür müssen sie abwechselnd ein- und ausgeschaltet werden. + + Fügt mehr Schaden zu als eine leere Hand. Hiermit kannst du Erde, Gras, Sand, Kies und Schnee schneller als mit der Hand abbauen. Du brauchst eine Schaufel, um Schneebälle abzubauen. @@ -613,10 +668,36 @@ haben. Erzeugt ein Abbild einer Gegend, bei deren Erforschung du sie in der Hand hattest. Nützlich, um den Weg zu finden. +Wird bei Benutzung zu einem Kartenteil der aktuellen Welt und füllt sich, wenn du die Gegend erkundest. + Erlaubt Fernangriffe mit Pfeilen. Wird als Munition für Bögen verwendet. +Von der Dürre fallen gelassen, wird zur Herstellung von Signalfeuern verwendet. + +Erzeugt bei Aktivierung bunte Explosionen. Die Farbe, der Effekt, die Form und das Verblassen hängen davon ab, welcher Feuerwerksstern zur Herstellung verwendet wird. + +Legt die Farbe, den Effekt und die Form eines Feuerwerks fest. + +Wird in Redstone-Schaltkreisen verwendet, um die Signalstärke aufrechtzuerhalten, zu vergleichen oder zu mindern, oder um bestimmte Blockzustände zu messen. + +Ein Lorentyp, der als beweglicher TNT-Block funktioniert. + +Ein Block, der auf Grundlage des Sonnenlichts (oder des Mangels an Sonnenlicht) ein Redstone-Signal ausgibt. + +Ein besonderer Lorentyp, der ähnlich funktioniert wie ein Trichter. Er sammelt Gegenstände, die auf Schienen liegen, und aus Behältern darüber. + +Ein besonderer Rüstungstyp, der einem Pferd angelegt werden kann. Gewährt 5 Rüstungspunkte. + +Ein besonderer Rüstungstyp, der einem Pferd angelegt werden kann. Gewährt 7 Rüstungspunkte. + +Ein besonderer Rüstungstyp, der einem Pferd angelegt werden kann. Gewährt 11 Rüstungspunkte. + +Hiermit kannst du NPCs am Spieler oder an Zaunpfosten festbinden. + +Hiermit kannst du NPCs in der Welt Namen geben. + Regeneriert 2,5{*ICON_SHANK_01*}. Regeneriert 1,5{*ICON_SHANK_01*}. Kann 6-mal verwendet werden. @@ -668,7 +749,7 @@ Kann auch genutzt werden, um ein wenig Licht zu erzeugen. Beschleunigt darüberfahrende Loren, wenn sie unter Strom steht. Wenn kein Strom anliegt, bewirkt sie, dass Loren auf ihr anhalten. -Funktioniert wie eine Druckplatte – sendet ein Redstone-Signal, wenn sie aktiviert wird, kann aber nur durch Loren aktiviert werden. +Funktioniert wie eine Druckplatte – sendet ein Redstone-Signal, wenn sie aktiviert wird, kann aber nur durch Loren aktiviert werden. Kann dich, ein Tier oder ein Monster auf Schienen transportieren. @@ -944,100 +1025,158 @@ statt nur 3.) NPC-Köpfe können als Dekoration platziert werden oder als Maske anstatt eines Helms getragen werden. +Hiermit werden Befehle ausgeführt. + +Wirft einen Lichtstrahl in den Himmel und kann Spielern in der Nähe Statuseffekte gewähren. + +Lässt dich in ihrem Inneren Blöcke und Gegenstände lagern. Platzier zwei Truhen nebeneinander, um eine größere Truhe mit der doppelten Kapazität zu erschaffen. Die eingeklemmte Truhe erstellt beim Öffnen außerdem eine Redstone-Ladung. + +Gewährt eine Redstone-Ladung. Die Ladung wird stärker, wenn mehr Gegenstände auf der Platte liegen. + +Gewährt eine Redstone-Ladung. Die Ladung wird stärker, wenn mehr Gegenstände auf der Platte liegen. Erfordert mehr Gewicht als die leichte Platte. + +Dient als Redstone-Energiequelle. Kann in Redstone zurückverwandelt werden. + +Kann Gegenstände fangen oder sie in Behälter legen bzw. aus ihnen entfernen. + +Ein Schienentyp, der Loren mit Trichtern aktivieren oder deaktivieren und Loren mit TNT auslösen kann. + +Kann Gegenstände lagern und ablegen oder in einen anderen Behälter schieben, wenn er einen Impuls von einem Redstone-Stromkreis erhält. + +Bunte Blöcke aus gefärbtem, ausgehärtetem Lehm. + +Kann an Pferde, Esel oder Maultiere verfüttert werden, um bis zu 10 Herzen zu heilen. Lässt Fohlen schneller wachsen. + +Wird hergestellt, indem man Lehm in einem Ofen schmilzt. + +Wird aus Glas und einer Farbe hergestellt. + +Wird aus Buntglas hergestellt. + +Eine kompakte Art, Kohle zu lagern. Kann als Brennstoff in Öfen verwendet werden. + Tintenfisch - + Wenn er getötet wird, lässt er einen Tintensack fallen. - + Kuh - + Wenn sie getötet wird, lässt sie Leder fallen. Kann außerdem mit einem Eimer gemolken werden. - + Schaf - + Wenn es geschoren wird, lässt es Wolle fallen, wenn es nicht schon geschoren war. Kann gefärbt werden, wodurch seine Wolle eine andere Farbe erhält. - + Huhn - + Wenn es getötet wird, lässt es Federn fallen. Legt in zufälligen Abständen Eier. - + Schwein - + Wenn es getötet wird, lässt es Schweinefleisch fallen. Kann mithilfe eines Sattels geritten werden. - + Wolf - + Friedlich, bis er angegriffen wird, dann wehrt er sich. Kann mithilfe von Knochen gezähmt werden. Der Wolf wird dir dann folgen und alles angreifen, was dich angreift. - + Creeper - + Explodiert, wenn du ihm zu nahe kommst! - + Skelett - + Schießt mit Pfeilen auf dich. Wenn es getötet wird, lässt es Pfeile fallen. - + Spinne - + Greift dich an, wenn du ihr zu nahe kommst. Kann Wände hochklettern. Wenn sie getötet wird, lässt sie Faden fallen. - + Zombie - + Greift dich an, wenn du ihm zu nahe kommst. - + Zombie-Schweinezüchter - + Eigentlich friedlich, greift dich aber in Gruppen an, wenn du einen angreifst. - + Ghast - + Schießt Feuerbälle auf dich, die beim Auftreffen explodieren. - + Slime - + Zerfällt in kleinere Slimes, wenn er Schaden erhält. - + Enderman - + Greift dich an, wenn du ihn ansiehst. Kann außerdem Blöcke bewegen. - + Silberfisch - + Lockt in der Nähe versteckte Silberfische an, wenn er angegriffen wird. Versteckt sich in Steinblöcken. - + Höhlenspinne - + Hat einen giftigen Biss. - + Pilzkuh - + Kann mithilfe einer Schüssel zu Pilzsuppe verarbeitet werden. Lässt Pilze fallen und wird zu einer normalen Kuh, wenn man sie schert. - + Schneegolem - + Der Schneegolem entsteht, wenn Spieler Schneeblöcke und einen Kürbis kombinieren. Bewirft die Feinde seines Erbauers mit Schneebällen. - + Enderdrache - + Ein großer schwarzer Drache, den man im Ende findet. - + Lohe - + Gegner, die man im Nether findet, vorwiegend in Netherfestungen. Lassen Lohenruten fallen, wenn sie getötet werden. - + Magmawürfel - + Findet man im Nether. Ähnlich wie Schleim zerfallen sie zu kleineren Versionen, wenn man sie tötet. - + Dorfbewohner - + Ozelot - + Findet man in Dschungeln. Füttere sie mit rohem Fisch, um sie zu zähmen. Du musst aber zulassen, dass der Ozelot sich dir nähert, denn bei schnellen Bewegungen läuft er weg. - + Eisengolem - + Erscheinen in Dörfern, um sie zu beschützen, und können mittels Eisenblöcken und Kürbissen erstellt werden. - + +Fledermaus + +Diese fliegenden Geschöpfe findet man in Höhlen oder anderen großen geschlossenen Räumen. + +Hexe + +Diese Feinde findet man in Sümpfen, und sie werfen mit Tränken nach dir, um dich anzugreifen. Wenn sie sterben, lassen sie Tränke fallen. + +Pferd + +Diese Tiere können gezähmt und dann geritten werden. + +Esel + +Diese Tiere können gezähmt und dann geritten werden. Du kannst Truhen an ihnen anbringen. + +Maultier + +Eine Kreuzung aus einem Pferd und einem Esel. Diese Tiere können gezähmt und dann geritten werden. Sie können Truhen tragen. + +Zombiepferd + +Skelettpferd + +Dürre + +Werden aus Dörrschädeln und Seelensand hergestellt. Feuern explodierende Schädel auf dich ab. + Explosives Animator Concept Artist @@ -1384,6 +1523,8 @@ statt nur 3.) Karte +Leere Karte + Schallplatte - "13" Schallplatte - "cat" @@ -1486,6 +1627,28 @@ statt nur 3.) Creeper-Kopf +Netherstern + +Feuerwerksrakete + +Feuerwerksstern + +Redstone-Vergleicher + +Lore mit TNT + +Lore mit Trichter + +Eisen-Pferderüstung + +Gold-Pferderüstung + +Diamant-Pferderüstung + +Leine + +Namensschild + Stein Grasblock @@ -1502,6 +1665,8 @@ statt nur 3.) Dschungelholzbretter +Holzbretter (jeder Typ) + Setzling Eichensetzling @@ -1838,6 +2003,190 @@ statt nur 3.) Schädel +Befehlsblock + +Signalfeuer + +Eingeklemmte Truhe + +Beschwerte Druckplatte (leicht) + +Beschwerte Druckplatte (schwer) + +Redstone-Vergleicher + +Tageslichtsensor + +Redstone-Block + +Trichter + +Aktivierungsschiene + +Auswurfblock + +Gefärbter Lehm + +Heuballen + +Ausgehärteter Lehm + +Kohleblock + +Schwarz gefärbter Lehm + +Rot gefärbter Lehm + +Grün gefärbter Lehm + +Braun gefärbter Lehm + +Blau gefärbter Lehm + +Lila gefärbter Lehm + +Cyanfarbener gefärbter Lehm + +Hellgrau gefärbter Lehm + +Grau gefärbter Lehm + +Rosa gefärbter Lehm + +Hellgrün gefärbter Lehm + +Gelb gefärbter Lehm + +Hellblau gefärbter Lehm + +Magentafarben gefärbter Lehm + +Orange gefärbter Lehm + +Weiß gefärbter Lehm + +Buntglas + +Schwarzes Buntglas + +Rotes Buntglas + +Grünes Buntglas + +Braunes Buntglas + +Blaues Buntglas + +Lila Buntglas + +Cyanfarbenes Buntglas + +Hellgraues Buntglas + +Graues Buntglas + +Rosa Buntglas + +Hellgrünes Buntglas + +Gelbes Buntglas + +Hellblaues Buntglas + +Magentafarbenes Buntglas + +Oranges Buntglas + +Weißes Buntglas + +Buntglasscheibe + +Schwarze Buntglasscheibe + +Rote Buntglasscheibe + +Grüne Buntglasscheibe + +Braune Buntglasscheibe + +Blaue Buntglasscheibe + +Lila Buntglasscheibe + +Cyanfarbene Buntglasscheibe + +Hellgraue Buntglasscheibe + +Graue Buntglasscheibe + +Rosa Buntglasscheibe + +Hellgrüne Buntglasscheibe + +Gelbe Buntglasscheibe + +Hellblaue Buntglasscheibe + +Magentafarbene Buntglasscheibe + +Orange Buntglasscheibe + +Weiße Buntglasscheibe + +Kleiner Ball + +Großer Ball + +Sternförmig + +Creeper-förmig + +Explosion + +Unbekannte Form + +Schwarz + +Rot + +Grün + +Braun + +Blau + +Lila + +Cyan + +Hellgrau + +Grau + +Rosa + +Hellgrün + +Gelb + +Hellblau + +Magenta + +Orange + +Weiß + +Andere + +Verblassen + +Funkeln + +Spur + +Flugdauer: +  Derzeitige Steuerung Layout @@ -2015,8 +2364,7 @@ Nachts treiben sich Monster herum, du solltest dir einen Unterstand bauen, bevor Dies ist dein Inventar. Hier werden die Gegenstände angezeigt, die du in deiner Hand verwenden kannst, sowie alle anderen Gegenstände, die du bei dir trägst. Außerdem wird hier deine Rüstung angezeigt. - - + {*B*} Drück zum Fortfahren{*CONTROLLER_VK_A*}.{*B*} Drück{*CONTROLLER_VK_B*}, wenn du bereits weißt, wie das Inventar verwendet wird. @@ -2037,7 +2385,7 @@ Nachts treiben sich Monster herum, du solltest dir einen Unterstand bauen, bevor - Wenn du mehr Informationen über einen Gegenstand brauchst, beweg den Cursor über den Gegenstand und drück{*CONTROLLER_VK_RT*}. + Wenn du mehr Informationen über einen Gegenstand brauchst, beweg den Cursor über den Gegenstand und drück{*CONTROLLER_ACTION_MENU_PAGEDOWN*}. @@ -2071,7 +2419,7 @@ Nachts treiben sich Monster herum, du solltest dir einen Unterstand bauen, bevor - Wenn du mehr Informationen über einen Gegenstand brauchst, beweg den Cursor über den Gegenstand und drück{*CONTROLLER_VK_RT*}. + Wenn du mehr Informationen über einen Gegenstand brauchst, beweg den Cursor über den Gegenstand und drück{*CONTROLLER_ACTION_MENU_PAGEDOWN*}. @@ -2618,6 +2966,211 @@ Im Flugmodus halte{*CONTROLLER_ACTION_JUMP*} nach unten gedrückt, um dich nach Drück{*CONTROLLER_VK_B*}, wenn du schon alles über die Hungerleiste und die Nahrungsaufnahme weißt. + + Dies ist das Pferdeinventar. + + + + {*B*}Drücke zum Fortfahren {*CONTROLLER_VK_A*}. + {*B*}Drücke {*CONTROLLER_VK_B*}, wenn du bereits weißt, wie das Pferdeinventar verwendet wird. + + + + Im Pferdeinventar kannst du Gegenstände an dein Pferd, deinen Esel oder dein Maultier übertragen oder es mit ihnen ausrüsten. + + + + Sattle dein Pferd, indem du einen Sattel im Sattel-Slot platzierst. Pferde können Rüstungen tragen, wenn du Pferderüstung im Rüstungs-Slot platzierst. + + + + Du kannst hier auch Gegenstände zwischen deinem eigenen Inventar und den Satteltaschen von Eseln und Maultieren austauschen. + + +Du hast ein Pferd gefunden. + +Du hast einen Esel gefunden. + +Du hast ein Maultier gefunden. + + + {*B*}Drücke {*CONTROLLER_VK_A*}, um mehr über Pferde, Esel und Maultiere zu erfahren. + {*B*}Drücke {*CONTROLLER_VK_B*}, wenn du bereits alles über Pferde, Esel und Maultiere weißt. + + + + Pferde und Esel findet man hauptsächlich auf freiem Feld. Maultiere sind die Nachfahren von jeweils einem Esel und einem Pferd, sie sind aber selbst unfruchtbar. + + + + Alle ausgewachsenen Pferde, Esel und Maultiere können geritten werden. Allerdings können nur Pferden Rüstungen angelegt werden und nur Maultiere sowie Esel können mit Satteltaschen für den Transport von Gegenständen ausgestattet werden. + + + + Pferde, Esel und Maultiere müssen vor dem Gebrauch gezähmt werden. Du zähmst ein Pferd, indem du versuchst, es zu reiten, und oben bleibst, wenn es versucht, dich abzuwerfen. + + + + Wenn das Tier gezähmt ist, erscheinen Liebesherzen und es versucht nicht mehr, dich abzuwerfen. + + + + Versuche jetzt, dieses Pferd zu reiten. Verwende {*CONTROLLER_ACTION_USE*} ohne Gegenstände oder Werkzeuge in der Hand, um aufzusteigen. + + + + Um ein Pferd beim Reiten zu lenken, musst du ihm einen Sattel anlegen. Du kannst Sättel von Dorfbewohnern kaufen oder in versteckten Truhen in der Welt finden. + + + + Du kannst zahmen Eseln und Maultieren Satteltaschen geben, indem du eine Truhe anbringst. Du kannst dann während des Reitens oder beim Schleichen auf die Taschen zugreifen. + + + + Pferde und Esel (nicht aber Maultiere) können wie andere Tiere mithilfe von goldenen Äpfeln oder goldenen Karotten gezüchtet werden. Fohlen wachsen mit der Zeit zu Pferden heran und du kannst dies beschleunigen, indem du sie mit Weizen oder Heu fütterst. + + + + Du kannst versuchen, die Pferde und Esel hier zu zähmen, und in den Truhen in der Nähe liegen Sättel, Pferderüstungen und andere nützliche Dinge. + + + + Dies ist das Signalfeuermenü. Hier kannst du auswählen, welche Kräfte dein Signalfeuer gewähren soll. + + + + {*B*}Drücke zum Fortfahren {*CONTROLLER_VK_A*}. + {*B*}Drücke {*CONTROLLER_VK_B*}, wenn du bereits weißt, wie das Signalfeuermenü verwendet wird. + + + + Im Signalfeuermenü kannst du 1 Hauptkraft für dein Signalfeuer auswählen. Je mehr Stufen deine Pyramide hat, desto mehr Kräfte stehen dir zur Auswahl. + + + + Bei einem Signalfeuer auf einer Pyramide mit mindestens 4 Stufen hast du außerdem die Option, entweder die Regeneration als Zweitkraft oder eine stärkere Hauptkraft auszuwählen. + + + + Um die Kräfte deines Signalfeuers einzustellen, musst du einen Smaragd, Diamant, Gold- oder Eisenbarren im Bezahl-Slot opfern. Danach strahlt das Signalfeuer für unbegrenzte Zeit die Kräfte aus. + + +Auf der Spitze dieser Pyramide steht ein inaktives Signalfeuer. + + + {*B*}Drücke {*CONTROLLER_VK_A*}, um mehr über Signalfeuer zu erfahren. + {*B*}Drücke {*CONTROLLER_VK_B*}, wenn du bereits alles über Signalfeuer weißt. + + + + Aktive Signalfeuer werfen einen hellen Lichtstrahl in den Himmel und gewähren Spielern in der Nähe Kräfte. Sie werden aus Glas, Obsidian und Nethersternen gefertigt, die du erhältst, wenn du die Dürre besiegst. + + + + Signalfeuer müssen auf Pyramiden aus Eisen, Gold, Smaragd oder Diamant so platziert werden, dass sie tagsüber dem Sonnenlicht ausgesetzt sind. Das Material der Unterlage hat aber keine Auswirkungen auf die Kraft des Signalfeuers. + + + + Verwende das Signalfeuer, um die gewährte Kraft festzulegen. Du kannst mit den bereitgestellten Eisenbarren bezahlen. + + +Dieser Raum enthält Trichter. + + + {*B*}Drücke {*CONTROLLER_VK_A*}, um mehr über Trichter zu erfahren. + {*B*}Drücke {*CONTROLLER_VK_B*}, wenn du bereits alles über Trichter weißt. + + + + Mit Trichtern kannst du Gegenstände in Behälter füllen oder sie daraus entnehmen sowie automatisch Gegenstände aufheben, die hineingeworfen werden. + + + + Sie können mit Brauständen, Truhen, Dispensern, Auswurfblöcken, Loren mit Truhen, Loren mit Trichtern sowie anderen Trichtern verwendet werden. + + + + Trichter versuchen fortwährend, Gegenstände aus einem geeigneten Behälter aufzusaugen, der über ihnen platziert wird. Sie versuchen auch, gelagerte Gegenstände in einen Ausgabebehälter zu legen. + + + + Wenn ein Trichter allerdings mit Redstone betrieben wird, wird er inaktiv und hört auf, Gegenstände aufzusaugen und einzufügen. + + + + Ein Trichter zeigt in die Ausgaberichtung für Gegenstände. Damit ein Trichter auf einen bestimmten Block zeigt, platzierst du ihn dagegen, während du schleichst. + + + + Es gibt viele nützliche Anwendungsmöglichkeiten für Trichter. In diesem Raum kannst du sie dir ansehen und ausprobieren. + + + + Dies ist das Feuerwerkmenü. Hier kannst du Feuerwerk und Feuerwerkssterne craften. + + + + {*B*}Drücke zum Fortfahren {*CONTROLLER_VK_A*}. + {*B*}Drücke {*CONTROLLER_VK_B*}, wenn du bereits weißt, wie das Signalfeuermenü verwendet wird. + + + + Leg Schießpulver und Papier in das 3x3-Crafting-Raster, das über deinem Inventar angezeigt wird, um Feuerwerk zu craften. + + + + Du kannst wahlweise mehrere Feuerwerkssterne in das Raster legen, um sie dem Feuerwerk hinzuzufügen. + + + + Mehr Schießpulver im Raster erhöht die Höhe, in der Feuerwerkssterne explodieren. + + + + Du kannst das fertige Feuerwerk dann aus dem Ausgabeplatz nehmen. + + + + Feuerwerkssterne werden hergestellt, indem du Schießpulver und Farbe in das Raster legst. + + + + Die Explosion des Feuerwerkssterns nimmt die jeweilige Farbe an. + + + + Die Form des Feuerwerkssterns ändert sich durch das Hinzufügen von Feuerkugeln, Goldklumpen, Federn oder NPC-Köpfen. + + + + Spur oder Funkeln können mit Diamanten oder Glowstone-Staub hinzugefügt werden. + + + + Wenn ein Feuerwerksstern gecraftet wurde, kannst du das Verblassen mit Farbe ändern. + + + + In diesen Truhen befinden sich verschiedene Gegenstände, die bei der Herstellung von FEUERWERK verwendet werden! + + + + {*B*}Drück{*CONTROLLER_VK_A*}, um mehr über Feuerwerk zu erfahren. + {*B*}Drück{*CONTROLLER_VK_B*}, wenn du bereits alles über Feuerwerk weißt. + + + + Feuerwerk sind dekorative Gegenstände, die manuell oder von Dispensern gestartet werden können. Sie werden aus Papier, Schießpulver und wahlweise einigen Feuerwerkssternen gecraftet. + + + + Farben, Verblassen, Form, Größe und Effekte (wie Spuren und Funkeln) von Feuerwerkssternen können beim Craften durch zusätzliche Zutaten angepasst werden. + + + + Probiere, Feuerwerk mit verschiedenen Zutaten aus den Truhen an der Werkbank herzustellen. + +  Auswählen Verwenden @@ -2678,7 +3231,7 @@ Im Flugmodus halte{*CONTROLLER_ACTION_JUMP*} nach unten gedrückt, um dich nach Schnellauswahl leeren -? +Was ist das? Auf Facebook teilen @@ -2840,6 +3393,22 @@ Im Flugmodus halte{*CONTROLLER_ACTION_JUMP*} nach unten gedrückt, um dich nach Spielstand für Xbox One hochladen +Aufsteigen + +Absteigen + +Truhe befestigen + +Starten + +Festbinden + +Losbinden + +Befestigen + +Name + OK Abbrechen @@ -3150,6 +3719,20 @@ Möchtest du das vollständige Spiel freischalten? Dispenser +Pferd + +Auswurfblock + +Trichter + +Signalfeuer + +Hauptkraft + +Zweitkraft + +Lore + Es stehen derzeit keine entsprechenden Inhalte zum Herunterladen für diesen Titel zur Verfügung. %s ist dem Spiel beigetreten. @@ -3309,10 +3892,14 @@ Möchtest du das Mash-up-Paket oder Texturpaket jetzt installieren? Spielmodus: Kreativ +Spielmodus: Abenteuer + Überleben Kreativ +Abenteuer + Im Überlebensmodus Im Kreativmodus @@ -3333,6 +3920,8 @@ Möchtest du das Mash-up-Paket oder Texturpaket jetzt installieren? Superflach +Gib einen Seed ein, um das gleiche Gelände erneut zu erstellen. Lass das Feld leer, um eine zufällige Welt zu erstellen. + Wenn dies aktiviert ist, ist das Spiel online. Wenn dies aktiviert ist, können nur eingeladene Spieler beitreten. @@ -3349,7 +3938,7 @@ Möchtest du das Mash-up-Paket oder Texturpaket jetzt installieren? Aktiviert, dass der Host das Fliegen nutzen, Erschöpfung deaktivieren und sich selbst im Spielmenü unsichtbar machen kann. Deaktiviert Erfolge und Bestenlisten-Aktualisierungen. -Sorgt bei Aktivierung dafür, dass der Nether neu erstellt wird. Dies ist nützlich, wenn du einen alten Spielstand hast, der keine Netherfestungen enthält. +Bei Aktivierung wird der Nether neu erstellt. Nützlich bei alten Spielständen, die keine Netherfestungen enthalten. Aktiviert, dass Strukturen wie Dörfer und Festungen in der Welt erstellt werden. @@ -3357,6 +3946,20 @@ Möchtest du das Mash-up-Paket oder Texturpaket jetzt installieren? Aktiviert, dass eine Truhe mit nützlichen Gegenständen in der Nähe des Startpunkts des Spielers erstellt wird. +Bei Deaktivierung können Monster und Tiere keine Blöcke verändern (z. B. werden bei Creeper-Explosionen keine Blöcke zerstört und Schafe entfernen kein Gras) oder Gegenstände aufheben. + +Bei Aktivierung behalten Spieler ihr Inventar, wenn sie sterben. + +Bei Deaktivierung erscheinen keine NPCs auf natürlichem Weg. + +Bei Deaktivierung lassen Monster und Tiere keine Beute fallen (z. B. lassen Creeper kein Schießpulver fallen). + +Bei Deaktivierung lassen Blöcke keine Gegenstände zurück, wenn sie zerstört werden (z. B. hinterlassen Steinblöcke keine Pflastersteine). + +Bei Deaktivierung wird die Gesundheit von Spielern nicht auf natürlichem Weg wiederhergestellt. + +Bei Deaktivierung ändert sich die Tageszeit nicht. + Skinpakete Themen @@ -3405,7 +4008,49 @@ Möchtest du das Mash-up-Paket oder Texturpaket jetzt installieren? {*PLAYER*} wurde von {*SOURCE*} erschlagen. -{*PLAYER*} wurde durch {*SOURCE*} getötet. +{*PLAYER*} wurde durch {*SOURCE*} mit Magie getötet. + +{*PLAYER*} ist von einer Leiter gefallen. + +{*PLAYER*} ist von Ranken heruntergefallen. + +{*PLAYER*} ist aus dem Wasser gefallen. + +{*PLAYER*} ist aus großer Höhe heruntergefallen. + +{*PLAYER*} wurde von {*SOURCE*} zum Absturz verdammt. + +{*PLAYER*} wurde von {*SOURCE*} zum Absturz verdammt. + +{*PLAYER*} wurde von {*SOURCE*} mit {*ITEM*} zum Absturz verdammt. + +{*PLAYER*} ist zu tief gefallen und wurde von {*SOURCE*} erledigt. + +{*PLAYER*} ist zu tief gefallen und wurde von {*SOURCE*} mit {*ITEM*} erledigt. + +{*PLAYER*} ist im Kampf gegen {*SOURCE*} ins Feuer gegangen. + +{*PLAYER*} wurde im Kampf gegen {*SOURCE*} eingeäschert. + +{*PLAYER*} hat versucht, in Lava zu schwimmen, um {*SOURCE*} zu entkommen. + +{*PLAYER*} ist beim Versuch ertrunken, {*SOURCE*} zu entkommen. + +{*PLAYER*} ist beim Versuch, {*SOURCE*} zu entkommen, in einen Kaktus gelaufen. + +{*PLAYER*} wurde von {*SOURCE*} in die Luft gejagt. + +{*PLAYER*} ist verdorrt. + +{*PLAYER*} wurde durch {*SOURCE*} mit {*ITEM*} getötet. + +{*PLAYER*} wurde von {*SOURCE*} mit {*ITEM*} erschossen. + +{*PLAYER*} starb durch einen Feuerball von {*SOURCE*} mit {*ITEM*}. + +{*PLAYER*} wurde von {*SOURCE*} mit {*ITEM*} erschlagen. + +{*PLAYER*} wurde durch {*SOURCE*} mit {*ITEM*} getötet. Grundgesteinnebel @@ -3570,9 +4215,9 @@ Möchtest du das Mash-up-Paket oder Texturpaket jetzt installieren? Nether nicht zurücksetzen -Pilzkuh kann momentan nicht geschoren werden. Die Höchstanzahl von Schweinen, Schafen, Kühen und Katzen wurde erreicht. +Pilzkuh kann momentan nicht geschoren werden. Die Höchstanzahl von Schweinen, Schafen, Kühen, Katzen und Pferden wurde erreicht. -Eintrittsei kann momentan nicht verwendet werden. Die Höchstanzahl von Schweinen, Schafen, Kühen und Katzen wurde erreicht. +Kann momentan kein Eintrittsei verwenden. Die Höchstanzahl von Schweinen, Schafen, Kühen, Katzen und Pferden wurde erreicht. Kann momentan kein Eintrittsei verwenden. Die Höchstanzahl von Pilzkühen wurde erreicht. @@ -3582,6 +4227,8 @@ Möchtest du das Mash-up-Paket oder Texturpaket jetzt installieren? Kann momentan kein Eintrittsei verwenden. Die Höchstanzahl von Tintenfischen in einer Welt wurde erreicht. +Kann momentan kein Eintrittsei verwenden. Die Höchstanzahl von Fledermäusen in einer Welt wurde erreicht. + Kann momentan kein Eintrittsei verwenden. Die Höchstanzahl von Feinden in einer Welt wurde erreicht. Kann momentan kein Eintrittsei verwenden. Die Höchstanzahl von Dorfbewohnern in einer Welt wurde erreicht. @@ -3590,12 +4237,14 @@ Möchtest du das Mash-up-Paket oder Texturpaket jetzt installieren? Im friedlichen Modus kannst du keine Feinde erscheinen lassen. -Tier kann nicht in den Liebesmodus versetzt werden. Die Zuchtobergrenze für Schweine, Schafe, Kühe und Katzen wurde erreicht. +Tier kann nicht in den Liebesmodus versetzt werden. Die Zuchtobergrenze für Schweine, Schafe, Kühen, Katzen und Pferden wurde erreicht. Tier kann nicht in den Liebesmodus versetzt werden. Die Zuchtobergrenze für Wölfe wurde erreicht. Tier kann nicht in den Liebesmodus versetzt werden. Die Zuchtobergrenze für Hühner wurde erreicht. +Tier kann nicht in den Liebesmodus versetzt werden. Die Zuchtobergrenze für Pferde wurde erreicht. + Tier kann nicht in den Liebesmodus versetzt werden. Die Zuchtobergrenze für Pilzkühe wurde erreicht. Die Höchstanzahl von Booten in einer Welt wurde erreicht. @@ -3623,27 +4272,43 @@ Möchtest du das Mash-up-Paket oder Texturpaket jetzt installieren? Mitwirkende Inhalte neu installieren - + Debug-Einstellungen - + Feuer breitet sich aus - + TNT explodiert - + Spieler gegen Spieler - + Spielern vertrauen - + Hostprivilegien - + Strukturen erzeugen - + Superflache Welt - + Bonustruhe - + Weltoptionen - + +Spieloptionen + +NPC-Griefing + +Inventar behalten + +NPC-Eintritt + +NPC-Beute + +Felderertrag + +Natürliche Erholung + +Tageslichtzyklus + Kann bauen und abbauen Kann Türen und Schalter verwenden @@ -3830,6 +4495,14 @@ Möchtest du das Mash-up-Paket oder Texturpaket jetzt installieren? Gift +Dürre + +Gesundheitsbonus + +Absorption + +Sättigung + der Geschwindigkeit der Langsamkeit @@ -3868,6 +4541,14 @@ Möchtest du das Mash-up-Paket oder Texturpaket jetzt installieren? des Gifts +des Verfalls + +des Gesundheitsbonus + +der Absorption + +der Sättigung + II @@ -3964,6 +4645,22 @@ Möchtest du das Mash-up-Paket oder Texturpaket jetzt installieren? Verringert mit der Zeit die Gesundheit von betroffenen Spielern, Tieren und Monstern. +Bei Anwendung: + +Pferdesprungstärke + +Zombie-Verstärkungen + +Max. Gesundheit + +NPC-Folgereichweite + +Rückstoßwiderstand + +Geschwindigkeit + +Angriffsschaden + Schärfe Bann @@ -4054,7 +4751,7 @@ Möchtest du das Mash-up-Paket oder Texturpaket jetzt installieren? Regeneriert 3{*ICON_SHANK_01*}. Entsteht, wenn man eine Kartoffel im Ofen brät. -Regeneriert 1{*ICON_SHANK_01*}, doch du kannst dich damit vergiften. Kann in einem Ofen gebraten oder auf Ackerland gepflanzt werden. +Regeneriert 1{*ICON_SHANK_01*}, doch du kannst dich damit vergiften. Regeneriert 3{*ICON_SHANK_01*}. Wird aus einer Karotte und Goldnuggets hergestellt. @@ -4452,7 +5149,7 @@ Alle Endertruhen in einer Welt sind verknüpft, sodass Gegenstände, die in eine Xbox 360 -Back +BACK Diese Option deaktiviert für diese Welt Erfolge und Bestenlisten-Aktualisierungen während des Spielens und wenn nach dem Speichern mit aktivierter Option erneut geladen wird. diff --git a/Minecraft.Assets/XboxMedia/loc/es-ES/4J_strings.resx b/Minecraft.Assets/XboxMedia/loc/es-ES/4J_strings.resx index ea428db67..4882271bb 100644 --- a/Minecraft.Assets/XboxMedia/loc/es-ES/4J_strings.resx +++ b/Minecraft.Assets/XboxMedia/loc/es-ES/4J_strings.resx @@ -73,11 +73,11 @@ Perfil de jugador no en línea -Este juego ofrece características que requieren un perfil de jugador habilitado para Xbox Live, pero en estos momentos estás desconectado. +Este juego ofrece características que requieren un perfil de jugador habilitado para Xbox LIVE, pero en estos momentos estás desconectado. -Esta característica requiere un perfil de jugador con sesión iniciada en Xbox Live. +Esta característica requiere un perfil de jugador con sesión iniciada en Xbox LIVE. -Conectarse a Xbox Live +Conectarse a Xbox LIVE Seguir jugando sin conexión @@ -100,7 +100,7 @@ Desbloquear juego completo Esta es la versión de prueba de Minecraft. Si tuvieras el juego completo, ¡habrías conseguido un logro! -Desbloquea el juego completo para vivir toda la emoción de Minecraft y jugar con amigos de todo el mundo a través de Xbox Live. +Desbloquea el juego completo para vivir toda la emoción de Minecraft y jugar con amigos de todo el mundo a través de Xbox LIVE. ¿Te gustaría desbloquear el juego completo? Volverás al menú principal porque se ha producido un error al leer tu perfil. diff --git a/Minecraft.Assets/XboxMedia/loc/es-ES/strings.resx b/Minecraft.Assets/XboxMedia/loc/es-ES/strings.resx index 6fbeff35e..1e07927c4 100644 --- a/Minecraft.Assets/XboxMedia/loc/es-ES/strings.resx +++ b/Minecraft.Assets/XboxMedia/loc/es-ES/strings.resx @@ -11,7 +11,7 @@ Si estableces la dificultad del juego en Pacífico, tu salud se regenerará automáticamente. ¡Además, no saldrán monstruos por la noche! -Dale un hueso a un lobo para domesticarlo. Puedes hacer que se siente o que te siga. +Dale un hueso a un lobo para domarlo. Puedes hacer que se siente o que te siga. Para soltar objetos desde el menú de inventario, mueve el cursor fuera del menú y pulsa{*CONTROLLER_VK_A*}. @@ -87,7 +87,7 @@ Si colocas dos cofres juntos crearás un cofre grande. -Los lobos domesticados indican su salud con la posición de su cola. Dales de comer para curarlos. +Los lobos domados indican su salud con la posición de su cola. Dales de comer para curarlos. Cocina un cactus en un horno para obtener tinte verde. @@ -216,7 +216,7 @@ Los ingredientes originales de las pociones son :{*B*}{*B*} * {*T2*}Verruga del mundo inferior{*ETW*}{*B*} * {*T2*}Ojo de araña{*ETW*}{*B*} * {*T2*}Azúcar{*ETW*}{*B*} -* {*T2*}Lágrima de espectro{*ETW*}{*B*} +* {*T2*}Lágrima de Ghast{*ETW*}{*B*} * {*T2*}Polvo de llama{*ETW*}{*B*} * {*T2*}Crema de magma{*ETW*}{*B*} * {*T2*}Melón resplandeciente{*ETW*}{*B*} @@ -229,7 +229,7 @@ Tendrás que experimentar y combinar ingredientes para averiguar cuántas pocion {*T3*}CÓMO SE JUEGA: HECHIZOS{*ETW*}{*B*}{*B*} Los puntos de experiencia que se recogen cuando muere un enemigo, o cuando se extraen o se funden determinados bloques en un horno, se pueden usar para hechizar herramientas, armas, armaduras y libros.{*B*} -Cuando la espada, el arco, el hacha, el pico, la pala, la armadura o el libro se colocan en el espacio que está debajo del libro en la mesa de hechizos, los tres botones de la parte derecha del espacio mostrarán algunos hechizos y sus niveles de experiencia correspondientes.{*B*} +Cuando la espada, el arco, el hacha, el pico, la pala, la armadura o el libro se colocan en el espacio que está debajo del libro en la mesa de hechizos, los tres botones de la parte derecha del espacio mostrarán algunos hechizos y sus niveles de experiencia correspondientes.{*B*} Si no tienes suficientes niveles de experiencia para usarlos, el coste aparecerá en rojo; si no, aparecerá en verde.{*B*}{*B*} El hechizo real que se aplica se selecciona aleatoriamente en función del coste que aparece.{*B*}{*B*} Si la mesa de hechizos está rodeada de estanterías (hasta un máximo de 15), con un espacio de un bloque entre la estantería y la mesa de hechizos, la intensidad de los hechizos aumentará y aparecerán glifos arcanos en el libro de la mesa de hechizos.{*B*}{*B*} @@ -286,19 +286,40 @@ En modo de vuelo, puedes mantener pulsado{*CONTROLLER_ACTION_JUMP*} para subir y Al cargar o crear un mundo, pulsa el botón "Más opciones" para entrar en un menú donde podrás tener más control sobre tu juego.{*B*}{*B*} {*T2*}Jugador contra jugador{*ETW*}{*B*} - Si está habilitada, los jugadores pueden causar daño a otros jugadores. Esta opción solo afecta al modo Supervivencia.{*B*}{*B*} + Si está habilitado, los jugadores pueden causar daño a otros jugadores. Esta opción solo afecta al modo Supervivencia.{*B*}{*B*} {*T2*}Confiar en jugadores{*ETW*}{*B*} - Si está deshabilitada, los jugadores que se unen al juego tienen restringidas sus acciones. No pueden extraer ni usar objetos, colocar bloques, usar puertas ni interruptores, usar contenedores, atacar a jugadores o atacar a animales. Las opciones de un jugador determinado se pueden cambiar en el menú de juego.{*B*}{*B*} + Si está deshabilitado, los jugadores que se unen al juego tienen restringidas sus acciones. No pueden extraer ni usar objetos, colocar bloques, usar puertas ni interruptores, usar contenedores, atacar a jugadores o atacar a animales. Las opciones de un jugador determinado se pueden cambiar en el menú de juego.{*B*}{*B*} {*T2*}El fuego se propaga{*ETW*}{*B*} - Si está habilitada, el fuego se puede propagar a los bloques inflamables cercanos. Esta opción también se puede cambiar dentro del juego.{*B*}{*B*} + Si está habilitado, el fuego se puede propagar a los bloques inflamables cercanos. Esta opción también se puede cambiar dentro del juego.{*B*}{*B*} {*T2*}La dinamita explota{*ETW*}{*B*} - Si está habilitada, la dinamita explota cuando se detona. Esta opción también se puede cambiar dentro del juego.{*B*}{*B*} + Si está habilitado, la dinamita explota cuando se denota. Esta opción también se puede cambiar dentro del juego.{*B*}{*B*} {*T2*}Privilegios de host{*ETW*}{*B*} - Si está habilitada, el host puede activar su habilidad para volar, deshabilitar la extenuación y hacerse invisible desde el menú de juego. Esta opción deshabilita los logros y las actualizaciones del marcador de este mundo cuando se juega y si se vuelve a cargar después de guardarlo con esta opción activada.{*B*}{*B*} + Si está habilitado, el host puede activar su habilidad para volar, deshabilitar la extenuación y hacerse invisible desde el menú de juego. {*DISABLES_ACHIEVEMENTS*}{*B*}{*B*} + + {*T2*}Ciclo de luz diurna{*ETW*}{*B*} + Al desactivarse, la hora del día no cambiará.{*B*}{*B*} + + {*T2*}Mantener inventario{*ETW*}{*B*} + Al activarse, los jugadores mantendrán el inventario al morir.{*B*}{*B*} + + {*T2*}Generación de enemigos{*ETW*}{*B*} + Al desactivarse, los enemigos no se generarán de forma natural.{*B*}{*B*} + + {*T2*}Vandalismo de enemigos{*ETW*}{*B*} + Cuando se desactiva, impide que monstruos y animales cambien bloques (por ejemplo, las explosiones de Creepers no destruirán bloques y las ovejas no quitarán el césped) o recojan objetos.{*B*}{*B*} + + {*T2*}Botín de enemigos{*ETW*}{*B*} + Al desactivarse, los monstruos y animales no soltarán botín (por ejemplo, los Creepers no soltarán pólvora).{*B*}{*B*} + + {*T2*}Soltar casillas{*ETW*}{*B*} + Al desactivarse, los bloques no soltarán objetos cuando se destruyan (por ejemplo, los bloques de piedra no soltarán guijarros).{*B*}{*B*} + + {*T2*}Regeneración natural{*ETW*}{*B*} + Al desactivarse, los jugadores no regenerarán salud de forma natural.{*B*}{*B*} {*T1*}Opciones de generación del mundo{*ETW*}{*B*} Cuando se crea un mundo existen opciones adicionales.{*B*}{*B*} @@ -313,10 +334,10 @@ Cuando se crea un mundo existen opciones adicionales.{*B*}{*B*} Si está habilitada, se creará un cofre con objetos útiles cerca del punto de generación del jugador.{*B*}{*B*} {*T2*}Restablecer mundo inferior{*ETW*}{*B*} - Si está habilitada, el mundo inferior se regenará. Esta opción te será útil si tienes una partida guardada en la que no aparecían fortalezas del mundo inferior.{*B*}{*B*} + Si está habilitado, el mundo inferior se regenerará. Esta opción te será útil si tienes una partida guardada en la que no aparecían fortalezas del mundo inferior.{*B*}{*B*} {*T1*}Opciones del juego{*ETW*}{*B*} - Dentro del juego se pueden acceder a varias opciones pulsando BACK para mostrar el menú del juego.{*B*}{*B*} + Dentro del juego se pueden acceder a varias opciones pulsando {*BACK_BUTTON*} para mostrar el menú del juego.{*B*}{*B*} {*T2*}Opciones de host{*ETW*}{*B*} El host y cualquier jugador establecido como moderador pueden acceder al menú "Opciones de host". En este menú se puede habilitar y deshabilitar la propagación del fuego y la explosión de dinamita.{*B*}{*B*} @@ -325,42 +346,44 @@ Cuando se crea un mundo existen opciones adicionales.{*B*}{*B*} Para modificar los privilegios de un jugador, selecciona su nombre y pulsa{*CONTROLLER_VK_A*} para mostrar el menú de privilegios donde podrás usar las siguientes opciones.{*B*}{*B*} {*T2*}Puede construir y extraer{*ETW*}{*B*} - Esta opción solo está disponible cuando "Confiar en jugadores" está desactivada. Cuando esta opción está habilitada, el jugador puede interaccionar con el mundo de forma normal. Cuando está deshabilitada el jugador no puede colocar ni destruir bloques ni interaccionar con muchos objetos y bloques.{*B*}{*B*} + Esta opción solo está disponible cuando "Confiar en jugadores" está desactivado. Cuando esta opción está habilitada, el jugador puede interaccionar con el mundo de forma normal. Cuando está deshabilitado el jugador no puede colocar ni destruir bloques ni interaccionar con muchos objetos y bloques.{*B*}{*B*} {*T2*}Puede usar puertas e interruptores{*ETW*}{*B*} - Esta opción solo está disponible cuando "Confiar en jugadores" está desactivada. Cuando esta opción está deshabilitada, el jugador no puede usar puertas e interruptores.{*B*}{*B*} + Esta opción solo está disponible cuando "Confiar en jugadores" está desactivado. Cuando esta opción está deshabilitada, el jugador no puede usar puertas e interruptores.{*B*}{*B*} {*T2*}Puede abrir contenedores{*ETW*}{*B*} - Esta opción solo está disponible cuando "Confiar en jugadores" está desactivada. Cuando esta opción está deshabilitada, el jugador no puede abrir contenedores, como por ejemplo cofres.{*B*}{*B*} + Esta opción solo está disponible cuando "Confiar en jugadores" está desactivado. Cuando esta opción está deshabilitada, el jugador no puede abrir contenedores, como por ejemplo cofres.{*B*}{*B*} {*T2*}Puede atacar a jugadores{*ETW*}{*B*} - Esta opción solo está disponible cuando "Confiar en jugadores" está desactivada. Cuando esta opción está deshabilitada, el jugador no puede causar daños a otros jugadores.{*B*}{*B*} + Esta opción solo está disponible cuando "Confiar en jugadores" está desactivado. Cuando esta opción está deshabilitada, el jugador no puede causar daños a otros jugadores.{*B*}{*B*} {*T2*}Puede atacar a animales{*ETW*}{*B*} - Esta opción solo está disponible cuando "Confiar en jugadores" está desactivada. Cuando esta opción está deshabilitada, el jugador no puede causar daños a los animales.{*B*}{*B*} + Esta opción solo está disponible cuando "Confiar en jugadores" está desactivado. Cuando esta opción está deshabilitada, el jugador no puede causar daños a los animales.{*B*}{*B*} {*T2*}Moderador{*ETW*}{*B*} Cuando esta opción está habilitada, el jugador puede cambiar los privilegios de otros jugadores (excepto los del host) si "Confiar en jugadores" está desactivada, expulsar jugadores, y activar y desactivar "El fuego se propaga" y "La dinamita explota".{*B*}{*B*} {*T2*}Expulsar jugador{*ETW*}{*B*} - En el caso de jugadores que no estén en la misma Consola Xbox 360 que el host, si se selecciona esta opción se expulsará al jugador de la partida y a cualquier otro jugador en la misma Consola Xbox 360. El jugador no podrá volver a unirse al juego hasta que se reinicie.{*B*}{*B*} + {*KICK_PLAYER_DESCRIPTION*}{*B*}{*B*} {*T1*}Opciones de host{*ETW*}{*B*} Si "Privilegios de host" está habilitado, el host podrá modificar algunos privilegios para sí mismo. Para modificar los privilegios de un jugador, selecciona su nombre y pulsa{*CONTROLLER_VK_A*} para mostrar el menú de privilegios donde podrás usar las siguientes opciones.{*B*}{*B*} {*T2*}Puede volar{*ETW*}{*B*} Cuando esta opción está habilitada, el jugador puede volar. Esta opción solo es relevante en el modo Supervivencia, ya que el vuelo está habilitado para todos los jugadores en el modo Creativo.{*B*}{*B*} - - {*T2*}Desactivar extenuación{*ETW*}{*B*} + + {*T2*}Desactiva la extenuación{*ETW*}{*B*} Esta opción solo afecta al modo Supervivencia. Si se habilita, las actividades físicas (caminar/correr/saltar, etc.) no disminuyen la barra de comida. Sin embargo, si el jugador resulta herido, la barra de comida disminuye lentamente mientras el jugador se cura.{*B*}{*B*} - + {*T2*}Invisible{*ETW*}{*B*} Cuando esta opción está habilitada, el jugador es invisible para otros jugadores y es invulnerable.{*B*}{*B*} - - {*T2*}Puede teletransportarse{*ETW*}{*B*} + + {*T2*}Puede teletransportarse{*ETW*}{*B*} Permite al jugador desplazarse o desplazar a otros hasta la posición de otros jugadores en el mundo. +En el caso de jugadores que no estén en la misma {*PLATFORM_NAME*} que el host, si se selecciona esta opción se expulsará al jugador de la partida y a cualquier otro jugador en la misma {*PLATFORM_NAME*}. El jugador no podrá volver a unirse al juego hasta que se reinicie. + Página siguiente Página anterior @@ -424,62 +447,94 @@ para que puedan unirse a ti con facilidad. Novedades - -{*T3*}Cambios e incorporaciones{*ETW*}{*B*}{*B*} -- Se han añadido nuevos objetos: esmeralda, mena de esmeralda, bloque de esmeralda, cofre de Ender, gancho de cable trampa, manzana dorada hechizada, yunque, maceta, paredes de adoquines, paredes de adoquines musgosas, pintura de Wither, patata, patata asada, patata venenosa, zanahoria, zanahoria dorada, palo y zanahoria, -pastel de calabaza, poción de visión nocturna, poción de invisibilidad, cuarzo del mundo inferior, mena de cuarzo del mundo inferior, bloque de cuarzo, losa de cuarzo, escaleras de cuarzo, bloque de cuarzo cincelado, pilar de cuarzo, libro hechizado, alfombra.{*B*} -- Se han añadido nuevas recetas de arenisca lisa y arenisca cincelada.{*B*} -- Se han añadido nuevos enemigos: aldeanos zombis.{*B*} -- Se han añadido nuevas funciones de generación de terrenos: templos del desierto, aldeas del desierto, templos de la jungla.{*B*} -- Se ha añadido la función de comerciar con los aldeanos.{*B*} -- Se ha añadido la interfaz del yunque.{*B*} -- Se ha añadido la posibilidad de teñir las armaduras de cuero.{*B*} -- Se ha añadido la posibilidad de teñir los collares de los lobos.{*B*} -- Se puede montar sobre un cerdo y controlarlo con un palo y una zanahoria.{*B*} -- Actualización del contenido de los cofres de bonificación con más objetos.{*B*} -- Se ha modificado la colocación de medios bloques y otros bloques en medios bloques.{*B*} -- Se ha modificado la colocación de las escaleras y las losas del revés.{*B*} -- Se han añadido diferentes profesiones de aldeanos.{*B*} -- Los aldeanos generados a partir de un huevo generador desempeñarán profesiones al azar.{*B*} -- Se ha añadido la posibilidad de colocar troncos de lado.{*B*} -- Los hornos pueden usar herramientas de madera como combustible.{*B*} -- Los paneles de hielo y cristal se pueden recoger mediante herramientas hechizadas con el toque sedoso.{*B*} -- Los botones de madera y los platos de presión de madera se pueden activar mediante flechas.{*B*} -- Los enemigos del mundo inferior pueden acceder al mundo superior mediante portales.{*B*} -- Los Creepers y las arañas son agresivos con el último jugador que los toque.{*B*} -- Los enemigos en el modo Creativo vuelven a ser neutrales tras un breve periodo de tiempo.{*B*} -- Se ha eliminado el derribo durante el ahogamiento.{*B*} -- Las puertas muestran daños cuando los zombis las rompen.{*B*} -- El hielo se derrite en el mundo inferior.{*B*} -- Los calderos se llenan cuando están bajo la lluvia.{*B*} -- Los pistones tardan el doble en actualizarse.{*B*} -- Los cerdos dejan caer la silla de montar al morir (si llevan una).{*B*} -- Se ha modificado el color del cielo en El Fin.{*B*} -- Se puede colocar una cuerda (para los cables trampa).{*B*} -- La lluvia cae entre las hojas.{*B*} -- Se pueden colocar palancas en la parte inferior de los bloques.{*B*} -- La dinamita provoca daños variables en función del nivel de dificultad.{*B*} -- Se han modificado las recetas de libros.{*B*} -- Los barcos rompen los nenúfares y no al contrario.{*B*} -- Los cerdos dejan caer más chuletas.{*B*} -- La generación de limos es menor en los mundos superplanos.{*B*} -- Los Creepers causan daños variables en función del nivel de dificultad; más derribo.{*B*} -- Se ha corregido el error que hacía que los Finalizadores no abrieran sus mandíbulas.{*B*} -- Se ha añadido el teletransporte de jugadores (usando el menú {*BACK_BUTTON*} del juego).{*B*} -- Se han añadido nuevas opciones de host que permiten a los jugadores remotos volar, volverse invisibles e invulnerables.{*B*} -- Se han añadido nuevos tutoriales al mundo tutorial sobre nuevos objetos y funciones.{*B*} -- Se han actualizado las posiciones de los cofres de discos en el mundo tutorial.{*B*} +{*T3*}Cambios e incorporaciones{*ETW*}{*B*}{*B*} +- Nuevos objetos añadidos: arcilla endurecida, arcilla tintada, bloque de hulla, fardo de heno, raíl activador, bloque de piedra rojiza, sensor de luz diurna, soltador, embudo, vagoneta con embudo, vagoneta con dinamita, comparador de piedra rojiza, plato de presión por peso, faro, cofre trampa, cohete de fuegos artificiales, estrella de fuegos artificiales, estrella del mundo inferior, rienda, armadura para caballo, etiqueta de nombre y huevo generador de caballos.{*B*} +- Nuevos enemigos añadidos: Wither, esqueletos atrofiados, brujas, murciélagos, caballos, burros y mulas.{*B*} +- Nuevas funciones de generación de terrenos: chozas de bruja.{*B*} +- Nueva interfaz de faro.{*B*} +- Nueva interfaz de caballo.{*B*} +- Nueva interfaz de embudo.{*B*} +- Nueva interfaz de fuegos artificiales: podrás acceder a ella desde la mesa de creación cuando tengas los ingredientes necesarios para fabricar una estrella de fuegos artificiales o un cohete de fuegos artificiales.{*B*} +- Nuevo modo Aventura: en él solo podrás romper bloques con las herramientas correctas.{*B*} +- Nuevos efectos de sonido.{*B*} +- Los enemigos, los objetos y los proyectiles podrán pasar ahora a través de portales.{*B*} +- Ahora los repetidores se pueden bloquear proporcionándoles energía con otros repetidores.{*B*} +- Los zombis y esqueletos pueden generarse con diferentes armas y armaduras.{*B*} +- Nuevos mensajes de muerte.{*B*} +- Ponles nombre a tus enemigos con una etiqueta y cámbiales el nombre a los contenedores para que aparezca en el título del menú.{*B*} +- Ahora la carne de hueso no hará crecer todo a su máximo tamaño, sino que lo hará por fases.{*B*} +- La señal de piedra rojiza que describe el contenido de los cofres, puestos de destilado, dispensadores y tocadiscos se puede detectar con un comparador de piedra rojiza.{*B*} +- Los dispensadores se pueden orientar en cualquier dirección.{*B*} +- Comerse una manzana dorada le da al jugador salud de "absorción" extra durante un corto periodo de tiempo.{*B*} +- Cuanto más tiempo permanezcas en una zona, más fuertes serán los monstruos que se generen en dicha zona.{*B*} {*ETB*}¡Hola otra vez! Quizá no te hayas dado cuenta, pero hemos actualizado Minecraft.{*B*}{*B*} -Hay un montón de novedades con las que lo pasarás en grande con tus amigos. A continuación te detallamos las más destacadas:{*B*}{*B*} -{*T1*}Nuevos objetos{*ETB*}: esmeralda, mena de esmeralda, bloque de esmeralda, cofre de Ender, gancho de cable trampa, manzana dorada hechizada, yunque, maceta, paredes de adoquines, paredes de adoquines musgosas, pintura de Wither, patata, patata asada, patata venenosa, zanahoria, zanahoria dorada, palo y zanahoria, -Pastel de calabaza, poción de visión nocturna, poción de invisibilidad, cuarzo del mundo inferior, mena de cuarzo del mundo inferior, bloque de cuarzo, losa de cuarzo, escaleras de cuarzo, bloque de cuarzo cincelado, pilar de cuarzo,, libro hechizado, alfombra.{*B*}{*B*} - {*T1*}Nuevos enemigos{*ETB*}: aldeanos zombis.{*B*}{*B*} -{*T1*}Nuevas funciones{*ETB*}: ¡comercia con los aldeanos, repara o hechiza armas y herramientas con el yunque, guarda objetos en un cofre de Ender o controla a un cerdo mientras montas sobre él usando un palo y una zanahoria!{*B*}{*B*} -{*T1*}Nuevos minitutoriales{*ETB*} – ¡Aprende a utilizar las nuevas funciones con el mundo tutorial!{*B*}{*B*} -{*T1*}Nuevos "huevos de Pascua"{*ETB*} – Hemos cambiado de sitio todos los discos secretos del mundo tutorial. ¡Intenta encontrarlos de nuevo!{*B*}{*B*} - +Hay un montón de novedades con las que lo pasarás en grande con tus amigos. A continuación te detallamos las más destacadas:{*B*}{*B*} +{*T1*}Nuevos objetos{*ETB*}: arcilla endurecida, arcilla tintada, bloque de hulla, fardo de heno, raíl activador, bloque de piedra rojiza, sensor de luz diurna, soltador, embudo, vagoneta con embudo, vagoneta con dinamita, comparador de piedra rojiza, plato de presión por peso, faro, cofre trampa, cohete de fuegos artificiales, estrella de fuegos artificiales, estrella del mundo inferior, rienda, armadura para caballo, etiqueta de nombre y huevo generador de caballos.{*B*}{*B*} +{*T1*}Nuevos enemigos{*ETB*}: Wither, esqueletos atrofiados, brujas, murciélagos, caballos, burros y mulas.{*B*}{*B*} +{*T1*}Nuevas funciones{*ETB*}: doma caballos y móntalos, fabrica fuegos artificiales y lánzalos, ponle nombre a los animales y a los monstruos con etiquetas, crea circuitos de piedra rojiza más avanzados y, además, descubre las nuevas opciones de host que te ayudarán a controlar lo que tus invitados pueden hacer en tu mundo.{*B*}{*B*} +{*T1*}Nuevos mundo tutorial{*ETB*} – ¡Aprende a utilizar las antiguas y las nuevas funciones con el mundo tutorial! ¡A ver si puedes encontrar todos los discos secretos ocultos en el mundo!{*B*}{*B*} + + +Caballos + +{*T3*}CÓMO SE JUEGA: CABALLOS{*ETW*}{*B*}{*B*} +Los caballos y los burros se suelen encontrar en las llanuras abiertas. Las mulas son las crías de un burro y un caballo, pero no son fértiles.{*B*} +Todos los caballos, burros y mulas adultos se pueden montar. Sin embargo, solo los caballos pueden llevar armadura, y solo las mulas y los burros pueden equiparse con alforjas para llevar objetos.{*B*}{*B*} +Los caballos, burros y mulas deben domarse antes de poder usarse. Un caballo se doma intentando montarlo y logrando mantenerse sobre él mientras trata de tirarte.{*B*} +Cuando estén domados, aparecerán corazones de amor a su alrededor y ya no intentarán tirarte. Para dirigir un caballo, debes equiparlo con una silla de montar.{*B*}{*B*} +Puedes comprar sillas de montar a los aldeanos o encontrarlas en cofres ocultos por el mundo.{*B*} +Puedes poner alforjas a los burros y mulas domados; solo tienes que colocarles un cofre. Puedes acceder a estas alforjas mientras montas o acechas.{*B*}{*B*} +Los caballos y los burros (pero no las mulas) pueden cruzarse como los demás animales utilizando manzanas doradas o zanahorias doradas.{*B*} +Los potros se convertirán en caballos adultos con el tiempo, aunque alimentarlos con trigo o heno acelerará el proceso.{*B*} + + +Faros + +{*T3*}CÓMO SE JUEGA: FAROS{*ETW*}{*B*}{*B*} +Los faros activos proyectan un rayo de luz brillante hacia el cielo y otorgan poderes a los jugadores cercanos.{*B*} +Se crean con cristal, obsidiana y estrellas del mundo inferior, que se pueden obtener derrotando al Wither.{*B*}{*B*} +Los faros deben situarse de modo que queden al sol durante el día. Los faros deben colocarse en pirámides de hierro, oro, esmeralda o diamante.{*B*} +El material sobre el que se sitúe el faro no tiene ningún efecto sobre el poder del mismo.{*B*}{*B*} +En el menú de faro puedes elegir un poder principal para este. Podrás elegir entre más poderes cuantas más plantas tenga la pirámide.{*B*} +Un faro sobre una pirámide de al menos cuatro plantas también ofrece la posibilidad de o bien tener el poder secundario Regeneración, o bien tener un poder principal más fuerte.{*B*}{*B*} +Para establecer los poderes del faro, debes sacrificar un lingote de esmeralda, diamante, oro o hierro en el espacio de pago.{*B*} +Una vez establecidos, los poderes emanarán del faro indefinidamente.{*B*} + + +Fuegos artificiales + +{*T3*}CÓMO SE JUEGA: FUEGOS ARTIFICIALES{*ETW*}{*B*}{*B*} +Los fuegos artificiales son objetos decorativos que se pueden lanzar manualmente o con dispensadores. Se pueden crear usando papel, pólvora y, opcionalmente, una cantidad específica de estrellas de fuegos artificiales.{*B*} +Se pueden personalizar el color, el desvanecimiento, la forma, el tamaño y los efectos (como estelas y brillos) de las estrellas de fuegos artificiales si se les incluye ingredientes adicionales durante la creación.{*B*}{*B*} +Para crear un fuego artificial, coloca pólvora y papel en el recuadro de creación de 3x3 que se ve en tu inventario.{*B*} +También puedes colocar varias estrellas de fuegos artificiales en el recuadro de creación para agregarlas a los fuegos artificiales.{*B*} +Cuanta más pólvora utilices durante la creación, más ascenderá la estrella de fuegos artificiales antes de explotar.{*B*}{*B*} +Luego recoge el fuego artificial que has creado del espacio de producción.{*B*}{*B*} +Las estrellas de fuegos artificiales se pueden crear con pólvora y tinte.{*B*} + - El tinte determinará el color de la estrella al explotar.{*B*} + - La forma de la estrella se puede determinar añadiéndole descargas de fuego, pepitas de oro, plumas o cabeza de enemigos.{*B*} + - Se puede añadir una estela o un brillo usando diamantes o polvo de piedra brillante.{*B*}{*B*} +Cuando hayas creado un fuego artificial, puedes determinar el color de desvanecimiento de la estrella con tinte. + + +Embudos + +{*T3*}CÓMO SE JUEGA: EMBUDOS{*ETW*}{*B*}{*B*} +Los embudos se utilizan para insertar o quitar objetos de contenedores y para recoger de forma automática los objetos que se hayan lanzado en su interior.{*B*} +Pueden afectar a puestos de destilado, cofres, dispensadores, soltadores, vagonetas con cofres, vagonetas con embudos y otros embudos.{*B*}{*B*} +Los embudos intentarán absorber sin cesar objetos de un contenedor apto que se coloque sobre ellos. También tratarán de insertar objetos almacenados en un contenedor de salida.{*B*} +Si un embudo funciona con piedra rojiza, se volverá inactivo y dejará tanto de absorber como de insertar objetos.{*B*}{*B*} +Un embudo apunta en la dirección en la que intenta soltar objetos. Para que un embudo apunte a cierto bloque, colócalo contra dicho bloque mientras acechas.{*B*} + + +Soltadores + +{*T3*}CÓMO SE JUEGA: SOLTADORES{*ETW*}{*B*}{*B*} +Cuando se encuentren junto a una piedra rojiza, los soltadores dejarán caer un objeto aleatorio. Usa {*CONTROLLER_ACTION_USE*} para abrir el soltador y cargarlo con objetos de tu inventario.{*B*} +Si el soltador se encuentra frente a un cofre o a otro tipo de contenedor, el objeto caerá en dicho cofre o contenedor. Se pueden construir largas cadenas de soltadores para transportar objetos a grandes distancias. Para que esto funcione, se los tiene que activar y desactivar alternativamente. + Causa más daño que a mano. @@ -606,10 +661,36 @@ Los colores de la cama siempre son los mismos, independientemente del color de l Cuando se porta, crea una imagen del área explorada. Se puede usar para buscar rutas. +Al usarse, se convierte en un mapa de la parte del mundo en la que te encuentras y se llena conforme lo exploras. + Permite ataques a distancia con flechas. Se usa como munición para arcos. +La suelta el Wither y se utiliza para crear faros. + +Cuando se activan, crean coloridas explosiones. El color, efecto, forma y desaparición vienen determinados por la estrella de fuegos artificiales que se utilice al crear unos fuegos artificiales. + +Se utiliza para determinar el color, efecto y forma de unos fuegos artificiales. + +Se utiliza en los circuitos de piedra rojiza para mantener, comparar o sustraer fuerza de señal, o para medir el estado de ciertos bloques. + +Es un tipo de vagoneta que funciona como un bloque de dinamita móvil. + +Es un bloque que emite una señal de piedra rojiza en función de la luz solar (o la falta de la misma). + +Es un tipo especial de vagoneta que funciona de forma similar a un embudo. Recogerá objetos que estén sueltos en las vías y de los contenedores de encima. + +Un tipo especial de armadura con la que se puede equipar un caballo. Proporciona 5 de armadura. + +Un tipo especial de armadura con la que se puede equipar un caballo. Proporciona 7 de armadura. + +Un tipo especial de armadura con la que se puede equipar un caballo. Proporciona 11 de armadura. + +Se utiliza para atar enemigos al jugador o a postes de valla. + +Se utiliza para nombrar enemigos del mundo. + Restablece 2,5{*ICON_SHANK_01*}. Restablece 1{*ICON_SHANK_01*}. Se puede usar 6 veces. @@ -626,7 +707,7 @@ Los colores de la cama siempre son los mismos, independientemente del color de l Restablece 1.5{*ICON_SHANK_01*}, o se puede cocinar en el horno. -Restablece {*ICON_SHANK_01*}. Se crea cocinando ternera cruda en el horno. +Restablece 4{*ICON_SHANK_01*}. Se crea cocinando ternera cruda en el horno. Restablece 1.5{*ICON_SHANK_01*}, o se puede cocinar en el horno. @@ -667,7 +748,7 @@ de nivel bajo. Cuando se activa, acelera las vagonetas que pasan por encima. Si no está activado, las vagonetas se detendrán. -Funciona como un plato de presión, envía una señal de piedra rojiza cuando se activa, pero solo una vagoneta puede hacerlo. +Funciona como un plato de presión, ya que envía una señal de piedra rojiza cuando se activa, pero solo una vagoneta puede hacer que se active. Se usa para transportarte a ti, a un animal o a un monstruo por raíles. @@ -731,7 +812,7 @@ de tinta en vez de 3). Se usa para crear libros y mapas. -Se usa para crear una estantería o para hechizar libros. +Se usa para crear estanterías o libros hechizados. Permite crear hechizos más potentes cuando se coloca alrededor de una mesa de hechizos. @@ -881,7 +962,7 @@ de tinta en vez de 3). Se usa para destilar pociones y para localizar fortalezas. Lo sueltan las llamas, que se suelen encontrar en las fortalezas del mundo inferior o cerca. -Se usa para destilar pociones. Lo sueltan los espectros cuando mueren. +Se usa para destilar pociones. Lo sueltan los Ghast cuando mueren. Lo sueltan los porqueros zombis cuando mueren. Los porqueros zombis se encuentran en el mundo inferior. Se usa como ingrediente para destilar pociones. @@ -911,7 +992,7 @@ de tinta en vez de 3). Flota en el agua y se puede caminar sobre él. -Se usa para construir fortalezas del mundo inferior. Inmume a las bolas de fuego del espectro. +Se usa para construir fortalezas del mundo inferior. Inmume a las bolas de fuego del Ghast. Se usa en las fortalezas del mundo inferior. @@ -947,100 +1028,158 @@ de tinta en vez de 3). Las cabezas de enemigos pueden colocarse como decoración o llevarse como una máscara en el espacio de casco. +Se utiliza para ejecutar comandos. + +Proyecta un rayo de luz hacia el cielo y puede causar efectos de estado en los jugadores cercanos. + +Almacena bloques y objetos en su interior. Coloca dos cofres uno junto a otro para crear un cofre más grande con el doble de capacidad. El cofre trampa también crea una descarga de piedra rojiza cuando se abre. + +Proporciona una descarga de piedra rojiza. La descarga será más fuerte si hay más objetos en el plato. + +Proporciona una descarga de piedra rojiza. La descarga será más fuerte si hay más objetos en el plato. Requiere más peso que el plato ligero. + +Se usa como fuente de energía de piedra rojiza. Se puede volver a transformar en piedra rojiza. + +Se utiliza para coger objetos o transferir objetos dentro o fuera de contenedores. + +Un tipo de raíl que puede activar o desactivar vagonetas con embudos y activar vagonetas con dinamita. + +Se usa para sujetar y soltar objetos, o para empujarlos dentro de otro contenedor cuando recibe una descarga de piedra rojiza. + +Bloques coloridos que se crean tiñendo arcilla endurecida. + +Se le puede dar de comer a los caballos, burros o mulas para curar hasta 10 corazones. Acelera el crecimiento de los potros. + +Se crea al fundir arcilla en un horno. + +Se crea a partir de cristal y un tinte. + +Se crea a partir de vidrio tintado. + +Una manera de almacenar hulla de forma compacta. Se puede usar como combustible en un horno. + Calamar - + Suelta bolsas de tinta cuando muere. - + Vaca - + Suelta cuero cuando muere. Se puede ordeñar con un cubo. - + Oveja - + Suelta lana cuando se esquila (si aún no ha sido esquilada). Se puede teñir para que su lana sea de diferente color. - + Gallina - + Suelta plumas cuando muere y pone huevos al azar. - + Cerdo - + Suelta chuletas de cerdo cuando muere. Se puede montar con una silla. - + Lobo - + Es dócil hasta que lo atacan, ya que devolverá el ataque. Se puede domar con huesos, lo que ocasionará que el lobo te siga a todas partes y ataque a cualquier cosa que te ataque a ti. - + Creeper - + ¡Explota si te acercas demasiado! - + Esqueleto - + Te dispara flechas. Suelta flechas cuando muere. - + Araña - + Te ataca cuando está cerca. Puede escalar muros. Suelta cuerda cuando muere. - + Zombi - + Te ataca cuando está cerca. - + Porquero zombi - + En principio es manso, pero si atacas a uno atacará en grupo. - + Ghast - + Te dispara bolas de fuego que explotan al hacer contacto. - + Limo - -Escupe limos más pequeños cuando recibe daños. - + +Se divide en Limos más pequeños cuando recibe daños. + Enderman - + Te ataca si lo miras. También puede mover bloques de sitio. - + Pez plateado - + Atrae a los peces plateados ocultos cercanos al atacarlo. Se oculta en bloques de piedra. - + Araña de las cuevas - + Tiene una picadura venenosa. - + Champiñaca - + Crea estofado de champiñón si se usa en un cuenco. Suelta champiñones y se convierte en una vaca normal cuando se esquila. - + Gólem de nieve - + Los jugadores pueden crear el gólem de nieve con bloques de nieve y una calabaza. Lanza bolas de nieve a los enemigos de su creador. - + Dragón de Ender - + Un dragón negro y grande que se encuentra en El Fin. - + Llama - + Son enemigos que se encuentran en el mundo inferior, principalmente dentro de las fortalezas del mundo inferior. Sueltan barras de llama cuando mueren. - + Cubo de magma - + Se encuentran en el mundo inferior. Son parecidos a los limos y se fragmentan en versiones más pequeñas cuando mueren. - + Aldeano - + Ocelote - -Se encuentran en junglas. Pueden domesticarse dándoles de comer pescado crudo. Tienes que dejar se te acerque el ocelote, aunque ten cuidado: cualquier movimiento repentino le espantará. - + +Se encuentran en junglas. Pueden domarse dándoles de comer pescado crudo. Tienes que dejar se te acerque el ocelote, aunque ten cuidado: cualquier movimiento repentino le espantará. + Gólem de hierro - + Aparecen en aldeas para protegerlas y pueden crearse usando bloques de hierro y calabazas. - + +Murciélago + +Estas criaturas voladoras se encuentran en cuevas y otros grandes espacios cerrados. + +Bruja + +Estos enemigos pueden encontrarse en pantanos y atacan lanzando pociones. Si las matas, sueltan pociones. + +Caballo + +Estos animales se pueden domar y montar. + +Burro + +Estos animales se pueden domar y montar. Es posible colocarles un cofre. + +Mula + +Nace del cruce de un caballo y un burro. Estos animales se pueden domar y, después, montar y usar para transportar cofres. + +Caballo zombi + +Caballo esqueleto + +Wither + +Se crea a partir de calaveras atrofiadas y arena de almas. Dispara calaveras explosivas. + Explosives Animator Concept Artist @@ -1203,7 +1342,7 @@ de tinta en vez de 3). Casco de malla -Peto de malla +Coraza de malla Mallas de malla @@ -1319,7 +1458,7 @@ de tinta en vez de 3). Libro -Repugnante +Bola de limo Vagoneta con cofre @@ -1387,6 +1526,8 @@ de tinta en vez de 3). Mapa +Mapa vacío + Disco: "13" Disco: "gato" @@ -1433,7 +1574,7 @@ de tinta en vez de 3). Barra de llama -Lágrima de espectro +Lágrima de Ghast Pepita de oro @@ -1489,6 +1630,28 @@ de tinta en vez de 3). Cabeza de Creeper +Estrella del mundo inferior + +Cohete de fuegos artificiales + +Estrella de fuegos artificiales + +Comparador de piedra rojiza + +Vagoneta con dinamita + +Vagoneta con embudo + +Armadura para caballo de hierro + +Armadura para caballo de oro + +Armadura para caballo de diamante + +Rienda + +Etiqueta de nombre + Piedra Bloque de hierba @@ -1505,6 +1668,8 @@ de tinta en vez de 3). Tablones de la jungla +Tablones (de cualquier tipo) + Arbolillo Arbolillo de roble @@ -1765,7 +1930,7 @@ de tinta en vez de 3). Ladrillos de piedra musgosa -Ladrillos de piedra requebrajada +Ladrillos de piedra resquebrajada Ladrillos de piedra cincelados @@ -1841,6 +2006,190 @@ de tinta en vez de 3). Calavera +Bloque de comando + +Faro + +Cofre trampa + +Plato de presión por peso (ligero) + +Plato de presión por peso (pesado) + +Comparador de piedra rojiza + +Sensor de luz diurna + +Bloque de piedra rojiza + +Embudo + +Raíl activador + +Soltador + +Arcilla tintada + +Fardo de heno + +Arcilla endurecida + +Bloque de hulla + +Arcilla tintada negra + +Arcilla tintada roja + +Arcilla tintada verde + +Arcilla tintada marrón + +Arcilla tintada azul + +Arcilla tintada púrpura + +Arcilla tintada cian + +Arcilla tintada gris claro + +Arcilla tintada gris + +Arcilla tintada rosa + +Arcilla tintada lima + +Arcilla tintada amarilla + +Arcilla tintada azul claro + +Arcilla tintada magenta + +Arcilla tintada naranja + +Arcilla tintada blanca + +Vidrio tintado + +Vidrio tintado negro + +Vidrio tintado rojo + +Vidrio tintado verde + +Vidrio tintado marrón + +Vidrio tintado azul + +Vidrio tintado púrpura + +Vidrio tintado cian + +Vidrio tintado gris claro + +Vidrio tintado gris + +Vidrio tintado rosa + +Vidrio tintado lima + +Vidrio tintado amarillo + +Vidrio tintado azul claro + +Vidrio tintado magenta + +Vidrio tintado naranja + +Vidrio tintado blanco + +Panel de vidrio tintado + +Panel de vidrio tintado negro + +Panel de vidrio tintado rojo + +Panel de vidrio tintado verde + +Panel de vidrio tintado marrón + +Panel de vidrio tintado azul + +Panel de vidrio tintado púrpura + +Panel de vidrio tintado cian + +Panel de vidrio tintado gris claro + +Panel de vidrio tintado gris + +Panel de vidrio tintado rosa + +Panel de vidrio tintado lima + +Panel de vidrio tintado amarillo + +Panel de vidrio tintado azul claro + +Panel de vidrio tintado magenta + +Panel de vidrio tintado naranja + +Panel de vidrio tintado blanco + +Bola pequeña + +Bola grande + +Forma de estrella + +Forma de Creeper + +Explosión + +Forma desconocida + +Negros + +Rojos + +Verdes + +Marrones + +Azules + +Púrpuras + +Cian + +Gris claro + +Grises + +Rosas + +Lima + +Amarillos + +Azul claro + +Magenta + +Naranjas + +Blancos + +Personalizados + +Desaparición en + +Destello + +Rastro + +Duración del vuelo: +  Controles actuales Diseño @@ -2018,8 +2367,7 @@ Pulsa{*CONTROLLER_VK_A*} para continuar el tutorial.{*B*} Este es tu inventario. Muestra los objetos que llevas en la mano y los demás objetos que portas. Aquí también aparece tu armadura. - - + {*B*} Pulsa{*CONTROLLER_VK_A*} para continuar.{*B*} Pulsa{*CONTROLLER_VK_B*} si ya sabes cómo usar el inventario. @@ -2040,7 +2388,7 @@ Pulsa{*CONTROLLER_VK_A*} para continuar el tutorial.{*B*} - Si quieres obtener más información sobre un objeto, mueve el foco sobre él y pulsa{*CONTROLLER_VK_RT*} . + Si quieres obtener más información sobre un objeto, mueve el foco sobre él y pulsa{*CONTROLLER_ACTION_MENU_PAGEDOWN*} . @@ -2074,7 +2422,7 @@ Pulsa{*CONTROLLER_VK_A*} para continuar el tutorial.{*B*} - Si quieres obtener más información sobre un objeto, mueve el foco sobre él y pulsa{*CONTROLLER_VK_RT*} . + Si quieres obtener más información sobre un objeto, mueve el foco sobre él y pulsa{*CONTROLLER_ACTION_MENU_PAGEDOWN*} . @@ -2540,7 +2888,7 @@ En el modo de vuelo, mantén pulsado{*CONTROLLER_ACTION_JUMP*} para moverte haci Algunos animales te seguirán si tienes su comida en la mano. Así te será más fácil agrupar animales para hacer que se reproduzcan.{*ICON*}296{*/ICON*} - Los lobos salvajes se pueden domesticar dándoles huesos. Una vez domesticados, aparecerán corazones de amor a su alrededor. Los lobos mansos seguirán al jugador y lo defenderán si no reciben la orden de quedarse sentados. + Los lobos salvajes se pueden domar dándoles huesos. Una vez domados, aparecerán corazones de amor a su alrededor. Los lobos mansos seguirán al jugador y lo defenderán si no reciben la orden de quedarse sentados. Has completado el tutorial de reproducción de animales. @@ -2620,6 +2968,211 @@ En el modo de vuelo, mantén pulsado{*CONTROLLER_ACTION_JUMP*} para moverte haci Pulsa{*CONTROLLER_VK_B*} si ya tienes información sobre la barra de comida y cómo comer. + + Esta es la interfaz del inventario equino. + + + + {*B*}Pulsa{*CONTROLLER_VK_A*} para continuar. + {*B*}Pulsa {*CONTROLLER_VK_B*} si ya sabes cómo usar el inventario equino. + + + + El inventario equino te permite transferir o equipar con objetos tu caballo, burro o mula. + + + + Ensilla tu caballo colocando una silla de montar en el espacio correspondiente. Puedes poner armaduras a los caballos; solo tienes que colocar la armadura para caballo en el espacio correspondiente. + + + + También puedes transferir objetos entre tu propio inventario y las alforjas que llevan los burros y mulas desde este menú. + + +Has encontrado un caballo. + +Has encontrado un burro. + +Has encontrado una mula. + + + {*B*}Pulsa {*CONTROLLER_VK_A*} para obtener más información sobre los caballos, los burros y las mulas. + {*B*}Pulsa {*CONTROLLER_VK_B*} si ya sabes cómo funcionan los caballos, los burros y las mulas. + + + + Los caballos y los burros se suelen encontrar en las llanuras abiertas. Las mulas se pueden criar a partir de un burro y un caballo, pero no son fértiles. + + + + Todos los caballos, burros y mulas adultos se pueden montar. Sin embargo, solo los caballos pueden llevar armadura, y solo las mulas y los burros pueden equiparse con alforjas para llevar objetos. + + + + Los caballos, burros y mulas deben domarse antes de poder usarse. Un caballo se doma intentando montarlo y logrando mantenerse sobre él mientras trata de tirarte. + + + + Cuando estén domados, aparecerán corazones de amor a su alrededor y ya no intentarán tirarte. + + + + Ahora intenta montar este caballo. Usa {*CONTROLLER_ACTION_USE*} sin objetos ni herramientas en las manos para montarlo. + + + + Para dirigir un caballo, debe estar equipado antes con una silla de montar que se puede comprar a los aldeanos o encontrar en cofres ocultos por el mundo. + + + + Puedes poner alforjas a los burros y mulas domados; solo tienes que colocarles un cofre. Puedes acceder a estas alforjas mientras montas o acechas. + + + + Los caballos y los burros (pero no las mulas) pueden cruzarse como los demás animales utilizando manzanas doradas o zanahorias doradas. Los potros se convertirán en caballos adultos con el tiempo, aunque alimentarlos con trigo o heno acelerará el proceso. + + + + Aquí puedes intentar domar los caballos y burros, y hay sillas de montar, armaduras de caballo y otros objetos útiles para caballos en los cofres de la zona. + + + + Esta es la interfaz de faro, que puedes utilizar para elegir los poderes que otorgará tu faro. + + + + {*B*}Pulsa{*CONTROLLER_VK_A*} para continuar. + {*B*}Pulsa {*CONTROLLER_VK_B*} si ya sabes cómo usar la interfaz de faro. + + + + En el menú de faro puedes elegir un poder principal para este. Podrás elegir entre más poderes cuantas más plantas tenga la pirámide. + + + + Un faro sobre una pirámide de al menos cuatro plantas también ofrece la posibilidad de o bien tener el poder secundario Regeneración, o bien tener un poder principal más fuerte. + + + + Para establecer los poderes del faro, debes sacrificar un lingote de esmeralda, diamante, oro o hierro en el espacio de pago. Una vez establecidos, los poderes emanarán del faro indefinidamente. + + +En lo alto de esta pirámide hay un faro inactivo. + + + {*B*}Pulsa {*CONTROLLER_VK_A*} para obtener más información sobre los faros. + {*B*}Pulsa {*CONTROLLER_VK_B*} si ya sabes cómo funcionan los faros. + + + + Los faros activos proyectan un rayo de luz brillante hacia el cielo y otorgan poderes a los jugadores cercanos. Se crean con cristal, obsidiana y estrellas del mundo inferior, que se pueden obtener derrotando al Wither. + + + + Los faros deben situarse de modo que queden al sol durante el día. Los faros deben colocarse en pirámides de hierro, oro, esmeralda o diamante. Sin embargo, el material sobre el que se sitúe el faro no tiene ningún efecto sobre el poder del mismo. + + + + Intenta utilizar el faro para establecer los poderes que otorga; puedes pagar con los lingotes de hierro que se te han proporcionado. + + +Esta sala contiene embudos + + + {*B*}Pulsa {*CONTROLLER_VK_A*} para obtener más información sobre los embudos. + {*B*}Pulsa {*CONTROLLER_VK_B*} si ya sabes cómo funcionan los embudos. + + + + Los embudos se utilizan para insertar o quitar objetos de contenedores y para recoger de forma automática los objetos que se hayan lanzado en su interior. + + + + Pueden afectar a puestos de destilado, cofres, dispensadores, soltadores, vagonetas con cofres, vagonetas con embudos y otros embudos. + + + + Los embudos intentarán absorber sin cesar objetos de un contenedor apto que se coloque sobre ellos. También tratarán de insertar objetos almacenados en un contenedor de salida. + + + + Sin embargo, si un embudo funciona con piedra rojiza, se volverá inactivo y dejará tanto de absorber como de insertar objetos. + + + + Un embudo apunta en la dirección en la que intenta soltar objetos. Para que un embudo apunte a cierto bloque, colócalo contra dicho bloque mientras acechas. + + + + Hay varias configuraciones útiles de embudo que ver y probar en esta sala. + + + + Esta es la interfaz de fuegos artificiales, que puedes utilizar para fabricar fuegos artificiales y estrellas de fuegos artificiales. + + + + {*B*}Pulsa{*CONTROLLER_VK_A*} para continuar. + {*B*}Pulsa{*CONTROLLER_VK_B*} si ya sabes cómo usar la interfaz de fuegos artificiales. + + + + Para crear un fuego artificial, coloca pólvora y papel en el recuadro de creación de 3x3 que se ve en tu inventario. + + + + También puedes colocar varias estrellas de fuegos artificiales en el recuadro de creación para agregarlas a los fuegos artificiales. + + + + Cuanta más pólvora utilices durante la creación, más ascenderá la estrella de fuegos artificiales antes de explotar. + + + + Luego recoge el fuego artificial que has creado del espacio de producción si quieres usarlo. + + + + Las estrellas de fuegos artificiales se pueden crear con pólvora y tinte. + + + + El tinte determinará el color de la estrella al explotar. + + + + La forma de la estrella se puede determinar añadiéndole descargas de fuego, pepitas de oro, plumas o cabeza de enemigos. + + + + Se puede añadir una estela o un brillo usando diamantes o polvo de piedra brillante. + + + + Cuando hayas creado un fuego artificial, puedes determinar el color de desvanecimiento de la estrella con tinte. + + + + ¡Dentro del cofre hay varios objetos que puedes usar para crear FUEGOS ARTIFICIALES! + + + + {*B*}Pulsa {*CONTROLLER_VK_A*} para obtener más información sobre los fuegos artificiales. + {*B*}Pulsa {*CONTROLLER_VK_B*} si ya sabes cómo funcionan los fuegos artificiales. + + + + Los fuegos artificiales son objetos decorativos que se pueden lanzar manualmente o con dispensadores. Se pueden crear usando papel, pólvora y, opcionalmente, una cantidad específica de estrellas de fuegos artificiales. + + + + Se pueden personalizar el color, el desvanecimiento, la forma, el tamaño y los efectos (como estelas y brillos) de las estrellas de fuegos artificiales si se les incluye ingredientes adicionales durante la creación. + + + + Prueba a crear fuegos artificiales en la mesa de creación usando los ingredientes que desees de los cofres. + +  Seleccionar Usar @@ -2708,7 +3261,7 @@ En el modo de vuelo, mantén pulsado{*CONTROLLER_ACTION_JUMP*} para moverte haci Alimentar -Domesticar +Domar Curar @@ -2816,7 +3369,7 @@ En el modo de vuelo, mantén pulsado{*CONTROLLER_ACTION_JUMP*} para moverte haci Equipar -Retirar +Tensar Soltar @@ -2840,8 +3393,24 @@ En el modo de vuelo, mantén pulsado{*CONTROLLER_ACTION_JUMP*} para moverte haci Eliminar todos los espacios -Subir partida guardada para Xbox One +Cargar partida guardada para Xbox One +Montar + +Desmontar + +Colocar cofre + +Lanzar + +Atar + +Soltar + +Colocar + +Nombre + Aceptar Cancelar @@ -3152,6 +3721,20 @@ Ve a la Interfaz para seleccionar este tema. Dispensador +Caballo + +Soltador + +Embudo + +Faro + +Poder principal + +Poder secundario + +Vagoneta + No existen ofertas de descarga de contenido de este tipo disponibles para este título en este momento. %s se ha unido al juego. @@ -3311,10 +3894,14 @@ No apagues la Consola Xbox 360 cuando aparezca este icono en pantalla. Modo juego: Creativo +Modo juego: Aventura + Supervivencia Creativo +Aventura + En modo Supervivencia En modo Creativo @@ -3335,6 +3922,8 @@ No apagues la Consola Xbox 360 cuando aparezca este icono en pantalla. Superplano +Introduce una semilla para volver a generar el mismo terreno. Déjalo vacío para un mundo aleatorio. + Si está habilitado, el juego será un juego en línea. Si está habilitado, solo los jugadores invitados pueden unirse. @@ -3359,6 +3948,20 @@ No apagues la Consola Xbox 360 cuando aparezca este icono en pantalla. Si está habilitado, se creará un cofre con objetos útiles cerca del punto de generación del jugador. +Cuando se desactiva, impide que monstruos y animales cambien bloques (por ejemplo, las explosiones de Creepers no destruirán bloques y las ovejas no quitarán el césped) o recojan objetos. + +Al activarse, los jugadores mantendrán el inventario al morir. + +Al desactivarse, los enemigos no se generarán de forma natural. + +Al desactivarse, los monstruos y animales no soltarán botín (por ejemplo, los Creepers no soltarán pólvora). + +Al desactivarse, los bloques no soltarán objetos cuando se destruyan (por ejemplo, los bloques de piedra no soltarán guijarros). + +Al desactivarse, los jugadores no regenerarán salud de forma natural. + +Al desactivarse, la hora del día no cambiará. + Packs de aspecto Temas @@ -3407,7 +4010,49 @@ No apagues la Consola Xbox 360 cuando aparezca este icono en pantalla. {*SOURCE*} apaleó a {*PLAYER*} -{*PLAYER*} ha muerto a manos de {*SOURCE*} +{*SOURCE*} mató a {*PLAYER*} con magia. + +{*PLAYER*} se cayó de una escalera. + +{*PLAYER*} se cayó de unas hiedras. + +{*PLAYER*} se cayó del agua. + +{*PLAYER*} se cayó de un lugar alto. + +{*SOURCE*} condenó a caer a {*PLAYER*}. + +{*SOURCE*} condenó a caer a {*PLAYER*}. + +{*SOURCE*} condenó a caer a {*PLAYER*} con {*ITEM*}. + + {*PLAYER*} cayó demasiado lejos y murió a manos de {*SOURCE*}. + + {*PLAYER*} cayó demasiado lejos y murió a manos de {*SOURCE*}, que utilizó {*ITEM*}. + +{*PLAYER*} tropezó con fuego mientras luchaba contra {*SOURCE*}. + +{*PLAYER*} acabó cual tostada chamuscada mientras luchaba contra {*SOURCE*}. + +{*PLAYER*} intentó nadar en la lava para escapar de {*SOURCE*}. + +{*PLAYER*} se ahogó mientras intentaba escapar de {*SOURCE*}. + +{*PLAYER*} tropezó con un cactus mientras intentaba escapar de {*SOURCE*}. + +{*SOURCE*} hizo volar por los aires a {*PLAYER*}. + +{*PLAYER*} sufrió los efectos del Wither. + +{*SOURCE*} asesinó a {*PLAYER*} con {*ITEM*}. + +{*SOURCE*} disparó a {*PLAYER*} con {*ITEM*}. + +{*SOURCE*} quemó con bolas de fuego a {*PLAYER*} con {*ITEM*}. + +{*SOURCE*} apaleó a {*PLAYER*} con {*ITEM*}. + +{*PLAYER*} ha muerto a manos de {*SOURCE*}, que utilizó {*ITEM*}. Niebla de lecho de roca @@ -3574,7 +4219,7 @@ No apagues la Consola Xbox 360 cuando aparezca este icono en pantalla. No se puede trasquilar esta champiñaca en este momento. Límite de cerdos, ovejas, vacas y gatos alcanzado. -El huevo generador no está disponible en estos momentos. Se ha alcanzado la cantidad máxima de cerdos, ovejas, vacas y gatos. +No se pueden usar huevos generadores en este momento. Límite de cerdos, ovejas, vacas y gatos alcanzado. No se pueden usar huevos generadores ahora. Límite de champiñacas en un mundo alcanzado. @@ -3584,6 +4229,8 @@ No apagues la Consola Xbox 360 cuando aparezca este icono en pantalla. No se pueden usar huevos generadores en este momento. Se ha alcanzado el límite de calamares en un mundo. +No se pueden usar huevos generadores en este momento. Se ha alcanzado el límite de murciélagos en un mundo. + No se pueden usar huevos generadores en este momento. Se ha alcanzado el límite de enemigos en un mundo. No se pueden usar huevos generadores en este momento. Se ha alcanzado el límite de aldeanos en un mundo. @@ -3592,12 +4239,14 @@ No apagues la Consola Xbox 360 cuando aparezca este icono en pantalla. No puedes generar enemigos en el modo pacífico. -Este animal no puede entrar en el modo Amor. Se ha alcanzado la cantidad máxima de cerdos, ovejas, vacas y gatos reproductores. +Este animal no puede estar en modo Amor. Límite de cría de cerdos, ovejas, vacas, gatos y caballos alcanzado. Este animal no puede estar en modo Amor. Se ha alcanzado el límite de cría de lobos. Este animal no puede estar en modo Amor. Se ha alcanzado el límite de cría de gallinas. +Este animal no puede estar en modo Amor. Se ha alcanzado el límite de cría de caballos. + Este animal no puede estar en modo Amor. Se ha alcanzado el límite de cría de champiñacas. Se ha alcanzado la cantidad máxima de barcos en un mundo. @@ -3610,7 +4259,7 @@ No apagues la Consola Xbox 360 cuando aparezca este icono en pantalla. ¡Has muerto! -Regenerarse +Regenerar Descarga de contenido @@ -3625,40 +4274,56 @@ No apagues la Consola Xbox 360 cuando aparezca este icono en pantalla. Créditos Volver a instalar contenido - + Configuración de depuración - + El fuego se propaga - + La dinamita explota - + Jugador contra jugador - + Confiar en jugadores - + Privilegios de host - + Genera estructuras - + Mundo superplano - + Cofre de bonificación - + Opciones del mundo - + +Opciones de juego + +Vandalismo de enemigos + +Mantener inventario + +Generación de enemigos + +Botín de enemigos + +Soltar casillas + +Regeneración natural + +Ciclo de luz diurna + Puede construir y extraer -Puedes usar puertas e interruptores. +Puede usar puertas e interruptores -Puedes abrir contenedores. +Puede abrir contenedores -Puede atacar a los jugadores +Puede atacar a jugadores -Puedes atacar a animales. +Puede atacar a animales Moderador -Expulsar +Expulsar jugador Puede volar @@ -3832,6 +4497,14 @@ No apagues la Consola Xbox 360 cuando aparezca este icono en pantalla. Veneno +Wither + +Mejora de salud + +Absorción + +Saturación + de rapidez de lentitud @@ -3870,6 +4543,14 @@ No apagues la Consola Xbox 360 cuando aparezca este icono en pantalla. de veneno +de decadencia + +de mejora de salud + +de absorción + +de saturación + II @@ -3966,6 +4647,22 @@ No apagues la Consola Xbox 360 cuando aparezca este icono en pantalla. Disminuye la salud de los jugadores, animales y monstruos afectados con el tiempo. +Cuando se aplica: + +Fuerza de salto de caballo + +Refuerzos zombis + +Salud máxima + +Alcance de seguimiento de enemigos + +Resistencia a derribo + +Velocidad + +Daño de ataque + Afilado Aporrear @@ -4056,7 +4753,7 @@ No apagues la Consola Xbox 360 cuando aparezca este icono en pantalla. Restablece 3{*ICON_SHANK_01*}. Se crea cocinando una patata en el horno. -Restablece 1{*ICON_SHANK_01*}o se puede cocinar en el horno. Se puede plantar en tierras de cultivo. Si comes esto puede que te envenene. +Restablece 1{*ICON_SHANK_01*}. Si comes esto puede que te envenene. Restablece 3{*ICON_SHANK_01*}. Se produce a partir de una zanahoria y pepitas de oro. Restablece 3. @@ -4066,7 +4763,7 @@ No apagues la Consola Xbox 360 cuando aparezca este icono en pantalla. Se usa junto con un yunque para hechizar armas, herramientas o armaduras. -Se crea fundiendo menas de cuarzo del mundo inferior. Se le puede dar forma de bloque de cuarzo. +Se crea fundiendo minerales de cuarzo del mundo inferior. Se le puede dar forma de bloque de cuarzo. Se fabrica con lana. Se usa como decoración. @@ -4092,7 +4789,7 @@ No apagues la Consola Xbox 360 cuando aparezca este icono en pantalla. Cuarzo del mundo inferior -Mena de esmeralda +Mineral de esmeralda Cofre de Ender @@ -4120,7 +4817,7 @@ No apagues la Consola Xbox 360 cuando aparezca este icono en pantalla. Yunque muy dañado -Mena de cuarzo del mundo inferior +Mineral de cuarzo del mundo inferior Bloque de cuarzo @@ -4435,7 +5132,7 @@ Todos los cofres de Ender de un mundo están vinculados, y los objetos que conti - Una vez domesticados, los lobos siempre llevarán un collar. Tíñelo para cambiarlo de color. + Una vez domados, los lobos siempre llevarán un collar. Tíñelo para cambiarlo de color. Planta zanahorias o patatas y coséchalas cuando empiecen a brotar del suelo. @@ -4458,7 +5155,7 @@ Todos los cofres de Ender de un mundo están vinculados, y los objetos que conti Esta opción deshabilita los logros y las actualizaciones del marcador de este mundo cuando se juega y si se vuelve a cargar después de guardarlo con esta opción activada. -Subir partida guardada para Xbox One +Cargar partida guardada para Xbox One Subir datos guardados diff --git a/Minecraft.Assets/XboxMedia/loc/fr-FR/strings.resx b/Minecraft.Assets/XboxMedia/loc/fr-FR/strings.resx index 788799ffb..541bbb7de 100644 --- a/Minecraft.Assets/XboxMedia/loc/fr-FR/strings.resx +++ b/Minecraft.Assets/XboxMedia/loc/fr-FR/strings.resx @@ -230,11 +230,11 @@ Vous devrez essayer diverses combinaisons d'ingrédients pour découvrir toutes {*T3*}COMMENT JOUER : ENCHANTEMENT{*ETW*}{*B*}{*B*} Les points d'expérience obtenus à la mort d'un monstre, ou lorsque certains blocs sont minés ou fondus dans un four, peuvent servir à enchanter les outils, armes, armures et livres.{*B*} -Lorsqu'une épée, une hache, une pioche, une pelle, une armure ou un livre est placé dans l'emplacement situé sous le livre de la table d'enchantement, les trois boutons à sa droite afficheront certains enchantements ainsi que leur coût en niveaux d'expérience.{*B*} +Lorsqu'une épée, une hache, une pioche, une pelle, une armure ou un livre est placé dans l'emplacement situé sous le livre de la table d'enchantement, les trois boutons à sa droite afficheront certains enchantements ainsi que leur coût en niveaux d'expérience.{*B*} Si vous n'avez pas assez de niveaux d'expérience pour utiliser certains d'entre eux, le coût apparaîtra en rouge ; sinon, en vert.{*B*}{*B*} L'enchantement appliqué par défaut est choisi aléatoirement d'après le coût affiché.{*B*}{*B*} Si la table d'enchantement est entourée de bibliothèques (jusqu'à 15) avec un intervalle d'un bloc entre la table et la bibliothèque, la puissance des enchantements sera renforcée et des glyphes arcaniques apparaîtront, projetés par le livre sur la table d'enchantement.{*B*}{*B*} -Tous les ingrédients nécessaires à une table d'enchantement peuvent se trouver dans les villages, ou bien en minant et cultivant.{*B*} +Tous les ingrédients nécessaires à une table d'enchantement peuvent se trouver dans les villages, ou bien en minant et cultivant.{*B*}{*B*} Utilisez les livres d'enchantement à l'enclume pour enchanter des objets. Ainsi, vous contrôlez mieux quels enchantements vous désirez utiliser sur vos objets.{*B*} @@ -274,14 +274,14 @@ Pour ce faire, affichez le menu Pause puis appuyez sur{*CONTROLLER_VK_RB*} pour Si vous tentez de rejoindre ce niveau à l'avenir, un message vous indiquera qu'il figure dans votre liste de niveaux exclus. Vous pourrez alors décider de le supprimer de la liste et d'y accéder, ou bien d'annuler. {*T3*}COMMENT JOUER : MODE CRÉATIF{*ETW*}{*B*}{*B*} -L'interface du mode Créatif permet de déplacer dans l'inventaire du joueur n'importe quel objet du jeu sans qu'il soit besoin de le miner ou de le fabriquer. {*B*} +L'interface du mode Créatif permet de déplacer dans l'inventaire du joueur n'importe quel objet du jeu sans qu'il soit besoin de le miner ou de le fabriquer. Les objets figurant dans l'inventaire du joueur ne sont pas supprimés lorsqu'ils sont placés ou utilisés dans l'environnement du jeu, ce qui permet au joueur de tout miser sur la construction sans se soucier de collecter des ressources.{*B*} Si vous créez, chargez ou sauvegardez un monde en mode Créatif, les mises à jour des succès et des classements seront désactivées pour ce monde, même s'il est chargé en mode Survie.{*B*} -Pour voler en mode Créatif, appuyez deux fois rapidement sur {*CONTROLLER_ACTION_JUMP*}. Pour ne plus voler, répétez l'opération. Pour voler plus vite, orientez rapidement{*CONTROLLER_ACTION_MOVE*} deux fois vers l'avant en cours de vol.{*B*} -En mode Vol, maintenez{*CONTROLLER_ACTION_JUMP*} pour monter et{*CONTROLLER_ACTION_SNEAK*} pour descendre, ou bien utilisez{*CONTROLLER_ACTION_DPAD_UP*} pour monter, {*CONTROLLER_ACTION_DPAD_DOWN*} pour descendre, {*B*} +Pour voler en mode Créatif, appuyez deux fois rapidement sur {*CONTROLLER_ACTION_JUMP*}. Pour ne plus voler, répétez l'opération. Pour voler plus vite, orientez rapidement{*CONTROLLER_ACTION_MOVE*} deux fois vers l'avant en cours de vol. +En mode Vol, maintenez{*CONTROLLER_ACTION_JUMP*} pour monter et{*CONTROLLER_ACTION_SNEAK*} pour descendre, ou bien utilisez{*CONTROLLER_ACTION_DPAD_UP*} pour monter, {*CONTROLLER_ACTION_DPAD_DOWN*} pour descendre, {*CONTROLLER_ACTION_DPAD_LEFT*} pour virer à gauche et {*CONTROLLER_ACTION_DPAD_RIGHT*} pour virer à droite. -{*T3*}COMMENT JOUER : OPTIONS DU JOUEUR ET DE L'HÔTE{*ETW*}{*B*}{*B*} +{*T3*}COMMENT JOUER : OPTIONS DU JOUEUR ET DE L'HÔTE{*ETW*}{*B*}{*B*} {*T1*}Options du joueur{*ETW*}{*B*} Lorsque vous chargez ou créez un monde, appuyez sur le bouton Plus d'options pour accéder à un menu où figurent d'autres paramètres de configuration de la partie.{*B*}{*B*} @@ -299,7 +299,28 @@ Lorsque vous chargez ou créez un monde, appuyez sur le bouton Plus d'options po Lorsque cette option est activée, le TNT peut exploser lorsqu'il est activé. Vous pouvez aussi modifier cette option depuis le menu de jeu.{*B*}{*B*} {*T2*}Privilèges d'hôte{*ETW*}{*B*} - Lorsque cette option est activée, l'hôte peut activer/désactiver sa capacité à voler, désactiver la fatigue et se rendre invisible depuis le menu de jeu. {*DISABLES ACHIEVEMENTS}{*.{*B*}{*B*} + Lorsque cette option est activée, l'hôte peut activer/désactiver sa capacité à voler, désactiver la fatigue et se rendre invisible depuis le menu de jeu. {*DISABLES_ACHIEVEMENTS*}{*B*}{*B*} + + {*T2*}Cycle jour/nuit{*ETW*}{*B*} + Si vous désactivez cette option, le moment de la journée ne change pas.{*B*}{*B*} + + {*T2*}Conservation d'inventaire{*ETW*}{*B*} + Si vous activez cette option, les joueurs conservent leur inventaire après leur mort.{*B*}{*B*} + + {*T2*}Apparition des monstres{*ETW*}{*B*} + Si vous désactivez cette option, les monstres n'apparaissent pas automatiquement.{*B*}{*B*} + + {*T2*}Ingérence des monstres{*ETW*}{*B*} + Si vous désactivez cette option, les monstres et animaux ne peuvent ni modifier des blocs (par exemple, les explosions des Creepers ne détruisent pas les blocs et les moutons ne retirent pas d'herbe), ni ramasser des objets.{*B*}{*B*} + + {*T2*}Butin des monstres{*ETW*}{*B*} + Si vous désactivez cette option, les monstres et animaux ne laissent pas d'objets (par exemple, les Creepers ne laissent pas de poudre à canon).{*B*}{*B*} + + {*T2*}Butin des blocs{*ETW*}{*B*} + Si vous désactivez cette option, les blocs ne laissent pas d'objets après être détruits (par exemple, les blocs de pierre ne laissent pas de pierre taillée).{*B*}{*B*} + + {*T2*}Régénération auto{*ETW*}{*B*} + Si vous désactivez cette option, les joueurs ne regagnent pas leur santé automatiquement.{*B*}{*B*} {*T1*}Options de création de monde{*ETW*}{*B*} Lorsque vous créez un monde, vous disposez d'options supplémentaires.{*B*}{*B*} @@ -314,10 +335,10 @@ Lorsque vous créez un monde, vous disposez d'options supplémentaires.{*B*}{*B* Lorsque cette option est activée, un coffre renfermant des objets utiles sera créé à proximité du point d'apparition du joueur.{*B*}{*B*} {*T2*}Réinitialiser le Nether{*ETW*}{*B*} - Quand activé, le Nether sera généré de nouveau. Ceci est utile si vous avez une sauvegarde plus ancienne sans forteresse du Nether.{*B*}{*B*} + Activé, le Nether se régénérera. Utile si vous avez une ancienne sauvegarde sans forteresse du Nether.{*B*}{*B*} {*T1*}Options de jeu{*ETW*}{*B*} - Appuyez sur la touche BACK pour afficher le menu de jeu et accéder à diverses options.{*B*}{*B*} + Appuyez sur {*BACK_BUTTON*} pour afficher le menu de jeu et accéder à diverses options.{*B*}{*B*} {*T2*}Options de l'hôte{*ETW*}{*B*} Le joueur hôte et les joueurs au statut de modérateur peuvent accéder au menu Options de l'hôte. Depuis ce menu, ils peuvent activer/désactiver la propagation du feu et l'explosion de TNT.{*B*}{*B*} @@ -337,38 +358,40 @@ Pour modifier les privilèges d'un joueur, sélectionnez son nom et appuyez sur{ {*T2*}Peut attaquer les joueurs{*ETW*}{*B*} Uniquement disponible si l'option Joueurs de confiance est désactivée. Cette option désactivée, le joueur ne pourra pas infliger de dégâts aux autres joueurs.{*B*}{*B*} - {*T2*}Peut attaquer des animaux{*ETW*}{*B*} + {*T2*}Peut attaquer les animaux{*ETW*}{*B*} Uniquement disponible quand l'option Joueurs de confiance est désactivée. Quand cette option est désactivée, le joueur ne pourra pas infliger des dégâts aux animaux.{*B*}{*B*} {*T2*}Modérateur{*ETW*}{*B*} Lorsque cette option est activée, le joueur peut modifier les privilèges des autres joueurs (à l'exception de l'hôte) si l'option Joueurs de confiance est désactivée, il peut exclure des joueurs et activer ou désactiver la propagation du feu et l'explosion de TNT.{*B*}{*B*} {*T2*}Exclure joueur{*ETW*}{*B*} - Pour les joueurs qui ne jouent pas sur la même console {*PLATFORM_NAME*} que le joueur hôte, sélectionner cette option exclura le joueur de la partie, ainsi que tout autre joueur sur sa console {*PLATFORM_NAME*}. Ce joueur ne pourra plus rejoindre la partie jusqu'à son redémarrage.{*B*}{*B*} + {*KICK_PLAYER_DESCRIPTION*}{*B*}{*B*} {*T1*}Options du joueur hôte{*ETW*}{*B*} Si l'option Privilèges d'hôte est activée, le joueur hôte peut modifier certains de ses propres privilèges. Pour modifier les privilèges d'un joueur, sélectionnez son nom et appuyez sur{*CONTROLLER_VK_A*} pour afficher le menu des privilèges et paramétrer les options suivantes.{*B*}{*B*} {*T2*}Peut voler{*ETW*}{*B*} Lorsque cette option est activée, le joueur peut voler. Cette option ne sert qu'en mode Survie, puisque tous les joueurs peuvent voler en mode Créatif.{*B*}{*B*} - + {*T2*}Fatigue désactivée{*ETW*}{*B*} Cette option ne s'applique qu'au mode Survie. Lorsque cette option est activée, les activités physiques (marcher, courir, sauter, etc.) n'épuisent pas la jauge de nourriture. En revanche, si le joueur est blessé, sa jauge de nourriture se videra progressivement tandis qu'il se remet de ses blessures.{*B*}{*B*} - + {*T2*}Invisible{*ETW*}{*B*} Lorsque cette option est activée, le joueur est dissimulé au regard des autres joueurs et est invulnérable.{*B*}{*B*} - - {*T2*}Peut se téléporter{*ETW*}{*B*} + + {*T2*}Peut se téléporter{*ETW*}{*B*} Cette option permet au joueur de se déplacer ou déplacer d'autres joueurs instantanément dans le monde. +Pour les joueurs qui ne sont pas sur la même console {*PLATFORM_NAME*} que le joueur hôte, la sélection de cette option éjectera le joueur de la partie, ainsi que tous les autres joueurs connectés sur sa console {*PLATFORM_NAME*}. Ce joueur ne pourra rejoindre la partie qu'après son redémarrage. + Page suivante Page précédente Principes -Interface principale +Interface Inventaire @@ -411,7 +434,7 @@ L'Ender est une autre dimension du jeu, atteinte par un portail de l'Ender actif Pour activer le portail de l'Ender, vous devrez placer un œil d'Ender dans n'importe quel cadre de portail de l'Ender qui n'en contient pas.{*B*} Quand le portail est actif, sautez dedans pour vous rendre dans l'Ender.{*B*}{*B*} Dans l'Ender, vous rencontrerez le dragon de l'Ender, un ennemi féroce et puissant, et de nombreux Enderman. Vous devrez donc être préparé au combat avant de vous y rendre !{*B*}{*B*} -Vous découvrirez qu'il existe des cristaux d'Ender à l'extrémité de huit pics d'obsidienne que le dragon utilise pour se soigner. +Vous découvrirez qu'il existe des cristaux d'Ender à l'extrémité de huit pics d'obsidienne que le dragon utilise pour se soigner. La première étape est donc de détruire chacun d'entre eux.{*B*} Les premiers peuvent être atteints par des flèches, mais les derniers sont protégés par une cage d'acier, et vous devrez les atteindre par étapes.{*B*}{*B*} Ce faisant, le dragon de l'Ender vous attaquera en volant vers vous et en crachant des boules d'acide de l'Ender !{*B*} @@ -425,63 +448,95 @@ et ils pourront facilement vous rejoindre. Nouveautés - -{*T3*}Modifications et ajouts {*ETW*}{*B*}{*B*} -- Ajout de nouveaux objets : émeraude, minerai d'émeraude, bloc d'émeraude, coffre du Néant, crochet, pomme dorée enchantée, enclume, pot de fleurs, murets, murets moussus, peinture de Wither, pomme de terre, pomme de terre cuite, pomme de terre empoisonnée, carotte, carotte dorée, carotte sur un bâton, -tarte à la citrouille, potion de vision nocturne, potion d'invisibilité, quartz du Nether, minerai de quartz du Nether, bloc de quartz du Nether, dalle de quartz, escalier en quartz, bloc de quartz taillé, pilier de blocs de quartz, livre enchanté, tapis.{*B*} -- Ajout de nouvelles recettes pour le grès lisse et le grès taillé.{*B*} -- Ajout de nouveaux monstres : villageois zombies.{*B*} -- Ajout de nouvelles fonctions de génération de terrain : pyramides, villages du désert, temples de la jungle.{*B*} -- Ajout de transactions avec les villageois.{*B*} -- Ajout d'une interface d'enclume.{*B*} -- Possibilité de teindre les armures en cuir.{*B*} -- Possibilité de teindre les colliers des loups.{*B*} -- Possibilité de contrôler un cochon comme monture à l'aide d'une carotte sur un bâton.{*B*} -- Mise à jour du contenu des coffres bonus, qui contiennent maintenant plus d'objets.{*B*} -- Modification du placement des demi-blocs et autres blocs sur demi-blocs.{*B*} -- Modification du placement des escaliers et dalles à l'envers.{*B*} -- Ajout de différentes professions pour les villageois.{*B*} -- Les villageois générés par un œuf d'apparition ont une profession aléatoire.{*B*} -- Ajout d'un placement de tronc oblique.{*B*} -- Les fours peuvent utiliser les outils en bois comme combustible.{*B*} -- Vous pouvez récupérer les vitres en glace et en verre à l'aide d'outils disposant de l'enchantement Délicatesse.{*B*} -- Vous pouvez déclencher les boutons en bois et les plaques de détection en bois à l'aide de flèches.{*B*} -- Les portails à la Surface peuvent générer des monstres du Nether.{*B*} -- Les creepers et les araignées attaquent le dernier joueur qui les a touchés.{*B*} -- En mode Créatif, les monstres redeviennent neutres après un bref laps de temps.{*B*} -- Suppression du recul en cas de noyade.{*B*} -- Les dégâts des portes abîmées par les zombies sont visibles.{*B*} -- La glace fond dans le Nether.{*B*} -- Les chaudrons se remplissent d'eau de pluie.{*B*} -- Les pistons sont deux fois plus longs à mettre à jour.{*B*} -- Le cochon laisse une selle à sa mort (s'il en possède une).{*B*} -- La couleur du ciel de La Fin a changé.{*B*} -- Il est possible de placer un fil de déclenchement relié à un crochet.{*B*} -- La pluie goutte à travers les feuilles.{*B*} -- Il est possible de placer des leviers sur le bas des blocs.{*B*} -- La TNT inflige des dégâts variables selon la difficulté choisie.{*B*} -- La recette des livres a changé.{*B*} -- Ce sont les bateaux qui cassent les nénuphars et non l'inverse.{*B*} -- Les cochons lâchent plus de viande de porc.{*B*} -- Les slimes se reproduisent moins dans les mondes superplats.{*B*} -- Les dégâts des creepers sont variables selon la difficulté choisie. Recul accru.{*B*} -- Correction du bug qui empêchait l'Enderman d'ouvrir les mâchoires.{*B*} -- Ajout d'une téléportation des joueurs (à l'aide du menu {*BACK_BUTTON*} dans le jeu).{*B*} -- Ajout de nouvelles options de l'hôte gérant la lévitation, l'invisibilité et l'invulnérabilité des joueurs distants.{*B*} -- Ajout de nouveaux didacticiels dans le monde didacticiel, correspondant aux nouveaux objets et fonctionnalités.{*B*} -- Mise à jour de l'emplacement des coffres à disques vinyles dans le monde didacticiel.{*B*} +{*T3*}Modifications et ajouts{*ETW*}{*B*}{*B*} +- Ajout de nouveaux objets : argile durcie, argile colorée, bloc de charbon, botte de foin, rail activateur, bloc de redstone, capteur de lumière, dropper, entonnoir, chariot de mine avec entonnoir, chariot de mine avec TNT, comparateur de redstone, plaque de détection lestée, balise, coffre piégé, fusée d'artifice, étoile à feux d'artifice, étoile du Nether, laisse, caparaçon, étiquette, œuf d'apparition de cheval{*B*} +- Ajout de nouveaux monstres et animaux : Wither, Withers squelettes, sorcières, chauves-souris, chevaux, ânes et mules{*B*} +- Ajout de nouvelles fonctions de génération de terrain : cabanes de sorcières.{*B*} +- Ajout d'une interface pour les balises.{*B*} +- Ajout d'une interface pour les chevaux.{*B*} +- Ajout d'une interface pour les entonnoirs.{*B*} +- Ajout de feux d'artifice : l'interface des feux d'artifice est accessible depuis l'atelier, quand vous disposez des ingrédients nécessaires à la fabrication d'une étoile à feux d'artifice ou d'une fusée d'artifice.{*B*} +- Ajout d'un "mode Aventure" : il vous faut les bons outils pour briser les blocs.{*B*} +- Ajout de nouveaux sons en pagaille.{*B*} +- Les monstres, animaux, objets et projectiles peuvent désormais traverser les portails.{*B*} +- Il est maintenant possible de verrouiller les répéteurs en alimentant leurs flancs avec un autre répéteur.{*B*} +- Les zombies et squelettes peuvent maintenant apparaître avec différentes armes et armures.{*B*} +- Nouveaux messages de mort.{*B*} +- Nommez les monstres et animaux à l'aide d'une étiquette et renommez les conteneurs pour modifier leur titre quand le menu est ouvert.{*B*} +- La poudre d'os ne fait plus tout grandir immédiatement à sa taille maximale, mais par étapes aléatoires.{*B*} +- Vous pouvez détecter un signal de redstone décrivant le contenu des coffres, alambics, distributeurs et juke-box en plaçant un comparateur directement devant l'objet en question.{*B*} +- Les distributeurs peuvent être orientés dans toutes les directions.{*B*} +- Si vous mangez une pomme dorée, vous bénéficiez temporairement d'un bonus d'absorption de santé.{*B*} +- Plus vous restez dans une zone, plus les montres qui y apparaissent sont dangereux.{*B*} {*ETB*}Bienvenue ! Comme vous l'avez peut-être déjà remarqué, votre Minecraft vient de bénéficier d'une nouvelle mise à jour.{*B*}{*B*} -Vous et vos amis pouvez découvrir de nombreuses nouvelles fonctionnalités. Jetez un œil à l'aperçu qui suit et allez jouer !{*B*}{*B*} -{*T1*}Nouveaux objets{*ETB*} - Émeraude, minerai d'émeraude, bloc d'émeraude, coffre du Néant, crochet, pomme dorée enchantée, enclume, pot de fleurs, murets, murets moussus, peinture de Wither, pomme de terre, pomme de terre cuite, pomme de terre empoisonnée, carotte, carotte dorée, carotte sur un bâton, -tarte à la citrouille, potion de vision nocturne, potion d'invisibilité, quartz du Nether, minerai de quartz du Nether, bloc de quartz, dalle de quartz, escalier en quartz, bloc de quartz taillé, pilier de blocs de quartz, livre enchanté, tapis.{*B*}{*B*} -{*T1*}Nouveaux monstres{*ETB*} - Villageois zombies.{*B*}{*B*} -{*T1*}Nouvelles fonctionnalités{*ETB*} - Commercez avec les villageois, réparez ou enchantez vos armes et outils à l'aide d'une enclume, stockez des objets dans le coffre du Néant, faites du rodéo sur un cochon avec une carotte sur un bâton !{*B*}{*B*} -{*T1*}Nouveaux mini-didacticiels{*ETB*} – Apprenez à utiliser ces nouvelles fonctionnalités dans le monde didacticiel !{*B*}{*B*} -{*T1*}Nouveaux 'Easter Eggs'{*ETB*} – Nous avons modifié l'emplacement de tous les disques vinyles secrets dans le monde didacticiel. Essayez de les retrouver !{*B*}{*B*} +Vous et vos amis pouvez découvrir de nombreuses nouvelles fonctionnalités. Jetez un œil à l'aperçu qui suit et amusez-vous bien !{*B*}{*B*} +{*T1*}Nouveaux objets{*ETB*} : argile durcie, argile colorée, bloc de charbon, botte de foin, rail activateur, bloc de redstone, capteur de lumière, dropper, entonnoir, chariot de mine avec entonnoir, chariot de mine avec TNT, comparateur de redstone, plaque de détection lestée, balise, coffre piégé, fusée d'artifice, étoile à feux d'artifice, étoile du Nether, laisse, caparaçon, étiquette, œuf d'apparition de cheval{*B*}{*B*} +{*T1*}Nouveaux monstres et animaux{*ETB*} : Wither, Withers squelettes, sorcières, chauves-souris, chevaux, ânes et mules{*B*}{*B*} +{*T1*}Nouvelles fonctions{*ETB*} : domptez et montez un cheval, fabriquez des feux d'artifice et assurez le spectacle, nommez les animaux et monstres à l'aide d'une étiquette, créez des circuits de redstone plus complexes et accédez en tant qu'hôte à de nouvelles options pour mieux contrôler les actions de vos visiteurs !{*B*}{*B*} +{*T1*}Nouveau monde didacticiel{*ETB*} : découvrez comment utiliser les fonctions existantes et nouvelles dans le monde didacticiel. Arriverez-vous à trouver tous les disques vinyles qui s'y cachent ?{*B*}{*B*} +Chevaux + +{*T3*}COMMENT JOUER : CHEVAUX{*ETW*}{*B*}{*B*} +C'est surtout dans les plaines que l'on trouve des chevaux et des ânes. En croisant ces deux espèces, on obtient une mule, mais celle-ci ne peut pas avoir de descendance.{*B*} +Vous pouvez monter tous les chevaux, ânes et mules adultes. En revanche, seuls les chevaux peuvent porter une armure (appelée caparaçon), alors que les ânes et les mules peuvent être équipés de sacoches pour transporter des objets.{*B*}{*B*} +Avant de pouvoir utiliser un cheval, un âne ou une mule, il faut le dompter. Un cheval se dompte en essayant de monter dessus et de vous y maintenir pendant qu'il tente de vous désarçonner.{*B*} +Quand des cœurs apparaissent autour du cheval, c'est que vous l'avez dompté : il n'essaiera plus de vous désarçonner. Pour diriger un cheval, vous devez l'équiper d'une selle.{*B*}{*B*} +Vous pouvez trouver des selles auprès des villageois ou dans les coffres cachés dans l'environnement.{*B*} +Un âne ou une mule dompté peut être équipé d'une sacoche en lui associant un coffre. Vous pourrez ensuite accéder à cette sacoche en vous faufilant devant l'animal ou en le chevauchant.{*B*}{*B*} +Les chevaux et les ânes (mais pas les mules) s'élèvent comme les autres animaux, à l'aide de pommes dorées ou de carottes dorées.{*B*} +Les poulains deviennent adultes au fil du temps, mais vous pouvez accélérer le processus en leur donnant du blé ou du foin à manger.{*B*} + + +Balises + +{*T3*}COMMENT JOUER : BALISES{*ETW*}{*B*}{*B*} +Les balises actives projettent un intense rayon de lumière dans le ciel et octroient des pouvoirs aux joueurs avoisinants.{*B*} +Vous pouvez les fabriquer à l'aide de verre, d'obsidienne et d'étoiles du Nether, qui s'obtiennent en terrassant le Wither.{*B*}{*B*} +Une balise doit être placée au sommet d'une pyramide de fer, d'or, d'émeraude ou de diamant, et doit pouvoir recevoir la lumière du soleil le jour.{*B*} +Le matériau sur lequel la balise est placée n'a aucun effet sur son pouvoir.{*B*}{*B*} +Ouvrez le menu de la balise pour sélectionner son pouvoir principal. Plus votre pyramide a d'étages, plus il y a de pouvoirs disponibles.{*B*} +Une balise sur une pyramide d'au moins quatre étages dispose en outre d'un pouvoir secondaire (Régénération), ou d'un pouvoir principal plus puissant.{*B*}{*B*} +Pour définir les pouvoirs de votre balise, vous devez sacrifier un lingot d'émeraude, de diamant, d'or ou de fer dans l'emplacement de paiement.{*B*} +Cela fait, la balise restera active indéfiniment.{*B*} + + +Feux d'artifice + +{*T3*}COMMENT JOUER : FEUX D'ARTIFICE{*ETW*}{*B*}{*B*} +Les feux d'artifice sont des objets décoratifs pouvant être lancés à la main ou depuis un distributeur. Ils se fabriquent à l'aide de papier, de poudre à canon et (facultatif) de plusieurs étoiles à feux d'artifice.{*B*} +En ajoutant des ingrédients supplémentaires lors de la fabrication, vous pouvez personnaliser les étoiles à feux d'artifice : couleurs, disparition, forme, taille et effets (traînée, scintillement, etc.).{*B*}{*B*} +Pour fabriquer un feu d'artifice, placez de la poudre à canon et du papier dans la grille d'artisanat 3x3 qui s'affiche au-dessus de votre inventaire.{*B*} +Vous pouvez aussi placer plusieurs étoiles à feux d'artifice dans la grille d'artisanat pour les ajouter au feu d'artifice.{*B*} +Plus il y a de cases contenant de la poudre à canon dans la grille d'artisanat, plus les étoiles à feux d'artifice explosent haut.{*B*}{*B*} +Vous pouvez ensuite récupérer le feu d'artifice terminé dans la case de résultat.{*B*}{*B*} +Vous pouvez fabriquer une étoile à feux d'artifice en plaçant de la poudre à canon et un colorant dans la grille d'artisanat.{*B*} + - Ce colorant définit la couleur que prend l'étoile à feux d'artifice en explosant.{*B*} + - Pour définir la forme de l'étoile à feux d'artifice, ajoutez une boule de feu, une pépite d'or, une plume ou un crâne de monstre.{*B*} + - Pour ajouter une traînée ou un scintillement, utilisez des diamants ou de la poudre glowstone.{*B*}{*B*} +Après avoir fabriqué une étoile à feux d'artifice, vous pouvez définir sa couleur de disparition en lui ajoutant un colorant. + + +Entonnoirs + +{*T3*}COMMENT JOUER : ENTONNOIRS{*ETW*}{*B*}{*B*} +Les entonnoirs servent à insérer ou retirer des objets d'un conteneur et à ramasser automatiquement les objets qu'on y jette.{*B*} +Ils peuvent interagir avec les alambics, les coffres, les distributeurs, les droppers, les chariots de mine avec coffre, les chariots de mine avec entonnoir, et d'autres entonnoirs.{*B*}{*B*} +Un entonnoir cherche en permanence à aspirer les objets d'un conteneur compatible placé au-dessus. Il tente également d'insérer les objets stockés dans un conteneur de destination.{*B*} +Si un entonnoir est alimenté par un bloc de redstone, il devient inactif et arrête à la fois d'aspirer et d'insérer.{*B*}{*B*} +Un entonnoir est orienté dans la direction vers laquelle il essaie d'insérer des objets. Pour l'orienter vers un bloc précis, placez-le contre ce bloc tout en vous faufilant.{*B*} + + +Droppers + +{*T3*}COMMENT JOUER : DROPPERS{*ETW*}{*B*}{*B*} +Quand un dropper est alimenté par la redstone, il dépose au sol un unique objet aléatoire qu'il contient. Utilisez {*CONTROLLER_ACTION_USE*} pour ouvrir le dropper, après quoi vous pouvez y insérer des objets de votre inventaire.{*B*} +Si le dropper fait face à un coffre ou tout autre conteneur, l'objet sera transféré dedans. Il est possible de construire de longues chaînes de droppers pour transporter des objets en les allumant et éteignant à tour de rôle. + + Inflige plus de dégâts qu'à mains nues. Sert à pelleter la terre, l'herbe, le sable, le gravier et la neige plus vite qu'à mains nues. Vous devrez posséder une pelle pour creuser les boules de neige. @@ -609,13 +664,39 @@ La couleur des lits est toujours la même. Tenue en main, la carte crée l'image d'une zone explorée. Peut servir à la détermination d'un trajet. +Si vous utilisez cet objet, il devient une carte de la zone géographique dans laquelle vous vous trouvez et se remplit au fur et à mesure de votre exploration. + Permet d'attaquer à distance à l'aide de flèches. Sert de munitions pour les arcs. +Produite par le Wither, sert à fabriquer des balises. + +Crée des explosions colorées après activation. La couleur, l'effet, la forme et la disparition dépendent de l'étoile à feux d'artifice utilisée pour créer le feu d'artifice. + +Détermine la couleur, l'effet et la forme d'un feu d'artifice. + +À utiliser dans un circuit de redstone pour entretenir, comparer ou réduire la force du signal, ou encore mesurer l'état de blocs précis. + +Type de chariot de mine qui se comporte comme un bloc de TNT mobile. + +Bloc qui émet un signal de redstone selon l'ensoleillement (ou le manque d'ensoleillement). + +Type de chariot de mine spécial qui se comporte comme un entonnoir. Il connecte les objets sur le rail et les conteneurs au-dessus. + +Type d'armure spécial pour chevaux. Confère une armure de 5. + +Type d'armure spécial pour chevaux. Confère une armure de 7. + +Type d'armure spécial pour chevaux. Confère une armure de 11. + +Sert à tenir les monstres en laisse ou à les attacher à un piquet de barrière. + +Sert à nommer les monstres dans le monde. + Restitue 2,5{*ICON_SHANK_01*}. -Restitue 1{*ICON_SHANK_01*}.. Peut s'utiliser jusqu'à 6 fois. +Restitue 1{*ICON_SHANK_01*}. Peut s'utiliser jusqu'à 6 fois. Restitue 1{*ICON_SHANK_01*}. @@ -938,100 +1019,158 @@ Remarque : vous pouvez aussi combiner colorant gris et poudre d'os pour en produ Les crânes peuvent servir de décoration ou être portés comme masques dans l'emplacement pour le casque. +Sert à exécuter un ordre. + +Projette un rayon de lumière dans le ciel et peut octroyer des altérations aux joueurs avoisinants. + +Permet d'entreposer des blocs et objets. Placez deux coffres côte à côte pour former un grand coffre à la capacité doublée. Le coffre piégé crée en outre une charge de redstone à l'ouverture. + +Fournit une charge de redstone. Plus il y a d'objets sur la plaque, plus la charge est puissante. + +Fournit une charge de redstone. Plus il y a d'objets sur la plaque, plus la charge est puissante. Nécessite plus de poids que la plaque légère. + +Source d'alimentation de redstone. Peut être retransformé en redstone. + +Sert à intercepter des objets ou à en transférer depuis un conteneur vers un autre. + +Type de rail permettant d'activer ou de désactiver les chariots de mine avec entonnoir, ou encore de déclencher les chariots de mine avec du TNT. + +Sert à entreposer et distribuer des objets, ou à les pousser vers un autre conteneur, lorsqu'on lui applique une charge de redstone. + +Des blocs colorés en argile durcie puis teinte. + +Nourriture pour chevaux, ânes et mules qui restitue jusqu'à 10 cœurs. Accélère la croissance des poulains. + +Obtenue en fondant de l'argile dans un four. + +Mélange de verre et d'un colorant. + +Panneau de verre coloré. + +Un moyen peu encombrant d'entreposer du charbon. Peut servir de combustible dans un four. + Pieuvre - + Produit une poche d'encre une fois tuée. - + Vache - + Produit du cuir une fois tuée. Utilisez un seau pour la traire. - + Mouton - + Produit de la laine dès qu'il est tondu (s'il ne l'a pas déjà été). Utilisez un colorant pour changer la couleur de sa laine. - + Poulet - + Produit des plumes une fois tué ; pond aussi des œufs, à l'occasion. - + Cochon - + Produit de la viande de porc une fois tué. Utilisez une selle pour le chevaucher. - + Loup - + Inoffensif à moins d'être attaqué : il n'hésitera pas à riposter. Utilisez des os pour le domestiquer : le loup vous suivra et s'en prendra à tous vos assaillants. - + Creeper - + Explose si vous l'approchez de trop près ! - + Squelette - + Vous décoche des flèches. Produit des flèches une fois tué. - + Araignée - + Attaque dès que vous approchez. Peut escalader les murs. Produit du fil une fois tuée. - + Zombie - + Attaque dès que vous approchez. - + Cochon zombie - + Inoffensifs de nature, ils vous attaqueront en groupe si vous vous en prenez à l'un d'entre eux. - + Ghast - + Décoche des boules de feu qui explosent à l'impact. - + Slime - + Se divise en plusieurs slimes plus petits dès qu'il est touché. - + Enderman - + Vous attaquera si vous le regardez. Peut aussi déplacer des blocs. - + Poisson d'argent - + Attire les poissons d'argent tapis à proximité si vous l'attaquez. Se cache dans les blocs de pierre. - + Araignée bleue - + Sa morsure est empoisonnée. - + Champimeuh - + Combiné à un bol, sert à la préparation de ragoûts de champignons. Produit des champignons et devient une vache normale une fois tondue. - + Golem de neige - + Le Golem de neige se crée en combinant des blocs de neige et une citrouille. Ils lancent des boules de neige sur les ennemis de leur créateur. - + Dragon de l'Ender - + Un colossal dragon noir qu'on rencontre dans l'Ender. - + Blaze - + Des ennemis qu'on croise dans le Nether, surtout dans les forteresses du Nether. Ils produisent des bâtons de feu une fois tués. - + Cube de magma - + On les rencontre dans le Nether. De même que les Slimes, ils se scindent en plusieurs cubes plus petits dès qu'ils sont tués. - + Villageois - + Ocelot - + Se trouve dans la jungle. Peut être dompté en le nourrissant de poisson cru. Vous devrez cependant laisser l'ocelot vous approcher, tout mouvement brusque le fera fuir. - + Golem de fer - + Apparaît dans les villages pour les protéger et peut être créé à partir de blocs de fer et de citrouilles. - + +Chauve-souris + +Ces créatures volantes habitent les cavernes et autres grands espaces fermés. + +Sorcière + +Ces ennemis des marécages vous attaquent en lançant des potions, et en abandonnent aussi à leur mort. + +Cheval + +Vous pouvez monter ces animaux, à condition de les dompter d'abord. + +Âne + +Vous pouvez monter ces animaux, à condition de les dompter d'abord. Il est possible de leur associer un coffre. + +Mule + +Croisement entre un cheval et un âne. Vous pouvez monter ces animaux, à condition de les dompter d'abord. Ils peuvent aussi porter des sacoches. + +Cheval zombie + +Cheval squelette + +Wither + +Il vous faut des crânes de Wither et du sable des âmes pour créer ce monstre, qui vous attaque en tirant des crânes explosifs. + Explosives Animator Concept Artist @@ -1378,6 +1517,8 @@ Remarque : vous pouvez aussi combiner colorant gris et poudre d'os pour en produ Carte +Carte vide + Disque vinyle "13" Disque vinyle "cat" @@ -1480,6 +1621,28 @@ Remarque : vous pouvez aussi combiner colorant gris et poudre d'os pour en produ Crâne de creeper +Étoile du Nether + +Fusée d'artifice + +Étoile à feux d'artifice + +Comparateur de redstone + +Chariot de mine avec TNT + +Chariot de mine avec entonnoir + +Caparaçon en fer + +Caparaçon en or + +Caparaçon en diamant + +Plomb + +Étiquette + Pierre Bloc d'herbe @@ -1496,6 +1659,8 @@ Remarque : vous pouvez aussi combiner colorant gris et poudre d'os pour en produ Planches de bois tropical +Planches de bois (tout type) + Pousse d'arbre Pousse de chêne @@ -1832,6 +1997,190 @@ Remarque : vous pouvez aussi combiner colorant gris et poudre d'os pour en produ Crâne +Bloc de commande + +Balise + +Coffre piégé + +Plaque de détection lestée (légère) + +Plaque de détection lestée (lourde) + +Comparateur de redstone + +Capteur de lumière + +Bloc de redstone + +Entonnoir + +Rail activateur + +Dropper + +Argile colorée + +Botte de foin + +Argile durcie + +Bloc de charbon + +Argile noire + +Argile rouge + +Argile verte + +Argile marron + +Argile bleue + +Argile violette + +Argile cyan + +Argile gris clair + +Argile grise + +Argile rose + +Argile vert clair + +Argile jaune + +Argile bleu ciel + +Argile magenta + +Argile orange + +Argile blanche + +Verre coloré + +Verre gris + +Verre rouge + +Verre vert + +Verre marron + +Verre bleu + +Verre violet + +Verre cyan + +Verre gris clair + +Verre gris + +Verre rose + +Verre vert clair + +Verre jaune + +Verre bleu ciel + +Verre magenta + +Verre orange + +Verre blanc + +Vitrail + +Vitrail gris + +Vitrail rouge + +Vitrail vert + +Vitrail marron + +Vitrail bleu + +Vitrail violet + +Vitrail cyan + +Vitrail gris clair + +Vitrail gris + +Vitrail rose + +Vitrail vert clair + +Vitrail jaune + +Vitrail bleu ciel + +Vitrail magenta + +Vitrail orange + +Vitrail blanc + +Petite boule + +Grande boule + +Étoile + +Creeper + +Explosion + +Forme inconnue + +Noir + +Rouge + +Vert + +Marron + +Bleu + +Violet + +Cyan + +Gris clair + +Gris + +Rose + +Vert clair + +Jaune + +Bleu ciel + +Magenta + +Orange + +Blanc + +Perso. + +Dégradé + +Scintillement + +Traînée + +Durée du vol : +  Commandes actuelles Config. @@ -2009,8 +2358,7 @@ La nuit, les monstres sont de sortie ; tâchez donc d'aménager un abri avant l Voici votre inventaire. Il affiche les objets susceptibles d'être tenus en main ainsi que tous les autres objets que vous portez, armure comprise. - - + {*B*} Appuyez sur{*CONTROLLER_VK_A*} pour continuer.{*B*} Appuyez sur{*CONTROLLER_VK_B*} si vous savez déjà utiliser l'inventaire. @@ -2031,7 +2379,7 @@ La nuit, les monstres sont de sortie ; tâchez donc d'aménager un abri avant l - Si vous voulez en savoir plus sur un objet, déplacez le pointeur sur l'objet en question et appuyez sur{*CONTROLLER_VK_RT*}. + Si vous voulez en savoir plus sur un objet, déplacez le pointeur sur l'objet en question et appuyez sur{*CONTROLLER_ACTION_MENU_PAGEDOWN*}. @@ -2065,7 +2413,7 @@ La nuit, les monstres sont de sortie ; tâchez donc d'aménager un abri avant l - Si vous voulez en savoir plus sur un objet, déplacez le pointeur sur l'objet en question et appuyez sur{*CONTROLLER_VK_RT*}. + Si vous voulez en savoir plus sur un objet, déplacez le pointeur sur l'objet en question et appuyez sur{*CONTROLLER_ACTION_MENU_PAGEDOWN*}. @@ -2612,6 +2960,211 @@ En mode Vol, maintenez{*CONTROLLER_ACTION_JUMP*} pour monter et{*CONTROLLER_ACTI Appuyez sur{*CONTROLLER_VK_B*} si vous savez déjà tout ce qu'il y a à savoir sur la barre de nourriture et les aliments. + + Voici l'interface d'inventaire du cheval. + + + + {*B*}Appuyez sur{*CONTROLLER_VK_A*} pour continuer. + {*B*}Appuyez sur{*CONTROLLER_VK_B*} si vous savez déjà utiliser l'inventaire du cheval. + + + + L'inventaire du cheval vous permet de transférer des objets ou d'en équiper votre cheval, âne ou mule. + + + + Sellez votre cheval en plaçant une selle dans l'emplacement à cet effet. Vous pouvez aussi l'équiper d'une armure en plaçant un caparaçon dans l'emplacement d'armure. + + + + Ce menu permet aussi de transférer des objets de votre inventaire vers les sacoches de votre âne ou mule, et vice versa. + + +Vous avez trouvé un cheval. + +Vous avez trouvé un âne. + +Vous avez trouvé une mule. + + + {*B*}Appuyez sur{*CONTROLLER_VK_A*} pour en savoir plus sur les chevaux, ânes et mules. + {*B*}Appuyez sur{*CONTROLLER_VK_B*} si vous n'avez plus rien à apprendre sur la question. + + + + C'est surtout dans les plaines et la savane que l'on trouve des chevaux et des ânes. En croisant ces deux espèces, on obtient une mule, mais celle-ci ne peut pas avoir de descendance. + + + + Vous pouvez monter tous les chevaux, ânes et mules adultes. En revanche, seuls les chevaux peuvent porter une armure (appelée caparaçon), alors que les ânes et les mules peuvent être équipés de sacoches pour transporter des objets. + + + + Avant de pouvoir utiliser un cheval, un âne ou une mule, il faut le dompter. Un cheval se dompte en essayant de monter dessus et de vous y maintenir pendant qu'il tente de vous désarçonner. + + + + Quand des cœurs apparaissent autour du cheval, c'est que vous l'avez dompté : il n'essaiera plus de vous désarçonner. + + + + Essayez de monter ce cheval. Utilisez {*CONTROLLER_ACTION_USE*} sans objet ni outil en main pour le chevaucher. + + + + Pour diriger un cheval, vous devez l'équiper d'une selle que vous trouverez auprès des villageois, en pêchant, ou dans les coffres cachés à travers l'environnement. + + + + Un âne ou une mule dompté peut être équipé d'une sacoche en lui associant un coffre. Vous pourrez ensuite accéder à cette sacoche en vous faufilant devant l'animal ou en le chevauchant. + + + + Les chevaux et les ânes (mais pas les mules) s'élèvent comme les autres animaux, à l'aide de pommes dorées ou de carottes dorées. Les poulains deviennent adultes au fil du temps, mais vous pouvez accélérer le processus en leur donnant du blé ou du foin à manger. + + + + Vous pouvez essayer de dompter les chevaux et les ânes ici. Les coffres des environs contiennent également des selles, caparaçons et autres objets utiles pour chevaux. + + + + Vous êtes dans l'interface de la balise, qui vous permet de choisir les pouvoirs qu'octroiera votre balise. + + + + {*B*}Appuyez sur{*CONTROLLER_VK_A*} pour continuer. + {*B*}Appuyez sur{*CONTROLLER_VK_B*} si vous savez déjà utiliser cet inventaire. + + + + Le menu de la balise vous permet de sélectionner son pouvoir principal. Plus votre pyramide a d'étages, plus il y a de pouvoirs disponibles. + + + + Une balise sur une pyramide d'au moins quatre étages dispose d'un pouvoir secondaire (Régénération), ou d'un pouvoir principal plus puissant. + + + + Pour définir les pouvoirs de votre balise, vous devez sacrifier un lingot d'émeraude, de diamant, d'or ou de fer dans l'emplacement de paiement. Cela fait, la balise restera active indéfiniment. + + +Cette pyramide est surmontée d'une balise inactive. + + + {*B*}Appuyez sur{*CONTROLLER_VK_A*} pour en savoir plus sur les balises. + {*B*}Appuyez sur{*CONTROLLER_VK_B*} si vous n'avez plus rien à apprendre sur la question. + + + + Les balises actives projettent un intense rayon de lumière dans le ciel et octroient des pouvoirs aux joueurs avoisinants. Vous pouvez les fabriquer à l'aide de verre, d'obsidienne et d'étoiles du Nether, qui s'obtiennent en terrassant le Wither. + + + + Une balise doit être placée au sommet d'une pyramide de fer, d'or, d'émeraude ou de diamant, et doit pouvoir recevoir la lumière du soleil le jour. Le matériau sur lequel la balise est placée n'a aucun effet sur son pouvoir. + + + + Essayez d'utiliser la balise pour définir ses pouvoirs. Vous pouvez utiliser en guise de paiement les lingots de fer fournis. + + +Cette pièce contient des entonnoirs. + + + {*B*}Appuyez sur{*CONTROLLER_VK_A*} pour en savoir plus sur les entonnoirs. + {*B*}Appuyez sur{*CONTROLLER_VK_B*} si vous n'avez plus rien à apprendre sur la question. + + + + Les entonnoirs servent à insérer ou retirer des objets d'un conteneur et à ramasser automatiquement les objets qu'on y jette. + + + + Ils peuvent interagir avec les alambics, les coffres, les distributeurs, les droppers, les chariots de mine avec coffre, les chariots de mine avec entonnoir, et d'autres entonnoirs. + + + + Un entonnoir cherche en permanence à aspirer un objet d'un conteneur compatible placé au-dessus. Il tente également d'insérer les objets stockés dans un conteneur de destination. + + + + Si un entonnoir est alimenté par un bloc de redstone, il devient inactif et arrête à la fois d'aspirer et d'insérer. + + + + Un entonnoir est orienté dans la direction vers laquelle il essaie d'insérer des objets. Pour l'orienter vers un bloc précis, placez-le contre ce bloc tout en vous faufilant. + + + + Cette salle contient diverses configurations d'entonnoirs qui méritent d'être étudiées et testées. + + + + Vous êtes dans l'interface des feux d'artifice, qui vous permet de fabriquer des feux d'artifice et des étoile à feux d'artifice. + + + + {*B*}Appuyez sur{*CONTROLLER_VK_A*} pour continuer. + {*B*}Appuyez sur{*CONTROLLER_VK_B*} si vous savez déjà utiliser cet inventaire. + + + + Pour fabriquer un feu d'artifice, placez de la poudre à canon et du papier dans la grille d'artisanat 3x3 qui apparaît au-dessus de votre inventaire. + + + + Facultatif : vous pouvez placer plusieurs étoiles à feux d'artifice dans la grille d'artisanat pour les ajouter au feu d'artifice. + + + + Plus il y a de cases contenant de la poudre à canon dans la grille d'artisanat, plus les étoiles à feux d'artifice explosent haut. + + + + Vous pouvez ensuite récupérer le feu d'artifice terminé dans la case de résultat. + + + + Vous pouvez fabriquer une étoile à feux d'artifice en plaçant de la poudre à canon et un colorant dans la grille d'artisanat. + + + + Ce colorant définit la couleur que prend l'étoile à feux d'artifice en explosant. + + + + Pour définir la forme de l'étoile à feux d'artifice, ajoutez une boule de feu, une pépite d'or, une plume ou un crâne. + + + + Pour ajouter une traînée ou un scintillement, utilisez des diamants ou de la poudre glowstone. + + + + Après avoir fabriqué une étoile à feux d'artifice, vous pouvez définir sa couleur de disparition en lui ajoutant un colorant. + + + + Les coffres des environs contiennent divers objets servant à créer des FEUX D'ARTIFICE ! + + + + {*B*}Appuyez sur{*CONTROLLER_VK_A*} pour en savoir plus sur les feux d'artifice. + {*B*}Appuyez sur{*CONTROLLER_VK_B*} si vous n'avez plus rien à apprendre sur la question. + + + + Les feux d'artifice sont des objets décoratifs pouvant être lancés à la main ou depuis un distributeur. Ils se fabriquent à l'aide de papier, de poudre à canon et (facultatif) de plusieurs étoiles à feux d'artifice. + + + + En ajoutant des ingrédients supplémentaires lors de la fabrication, vous pouvez personnaliser les étoiles à feux d'artifice : couleurs, disparition, forme, taille et effets (traînée, scintillement, etc.). + + + + Essayez de fabriquer un feu d'artifice à l'atelier en combinant les ingrédients que contiennent les coffres. + +  Sélectionner Utiliser @@ -2834,6 +3387,22 @@ En mode Vol, maintenez{*CONTROLLER_ACTION_JUMP*} pour monter et{*CONTROLLER_ACTI Charger la sauvegarde pour Xbox One +Monter + +Descendre + +Associer un coffre + +Lancer + +Tenir en laisse + +Lâcher + +Fixer + +Nom + O.K. Annuler @@ -3144,6 +3713,20 @@ Voulez-vous déverrouiller le jeu complet ? Distributeur +Cheval + +Dropper + +Entonnoir + +Balise + +Pouvoir principal + +Pouvoir secondaire + +Chariot de mine + Aucun contenu téléchargeable de ce type n'est actuellement disponible pour ce jeu. %s a rejoint la partie. @@ -3303,10 +3886,14 @@ Voulez-vous installer le pack mash-up ou le pack de textures maintenant ? Mode de jeu : Créatif +Mode de jeu : Aventure + Survie Créatif +Aventure + Créé en mode Survie Créé en mode Créatif @@ -3327,6 +3914,8 @@ Voulez-vous installer le pack mash-up ou le pack de textures maintenant ? Superplat +Saisissez une valeur initiale pour générer à nouveau le même terrain. Champ vide = monde aléatoire. + Une fois activé, le jeu sera un jeu en ligne. Une fois activé, seuls les joueurs invités peuvent participer. @@ -3343,7 +3932,7 @@ Voulez-vous installer le pack mash-up ou le pack de textures maintenant ? Cette option permet à l'hôte d'activer sa capacité à voler et à se rendre un invisible, et de désactiver la fatigue. Elle désactive la mise à jour des succès et classements. -Si vous l'activez, le Nether sera régénéré. Très utile si vous avez une ancienne sauvegarde où les forteresses du Nether ne sont pas présentes. +Activé, le Nether se régénérera. Utile si vous avez une ancienne sauvegarde sans forteresse du Nether. Lorsque cette option est activée, les structures comme les villages et les forts apparaîtront dans le monde. @@ -3351,6 +3940,20 @@ Voulez-vous installer le pack mash-up ou le pack de textures maintenant ? Lorsque cette option est activée, un coffre renfermant des objets utiles sera créé à proximité du point d'apparition du joueur. +Si vous désactivez cette option, les monstres et animaux ne peuvent ni modifier des blocs (par exemple, les explosions des creepers ne détruisent pas les blocs et les moutons ne retirent pas d'herbe), ni ramasser des objets. + +Si vous activez cette option, les joueurs conservent leur inventaire après leur mort. + +Si vous désactivez cette option, les monstres n'apparaissent pas automatiquement. + +Si vous désactivez cette option, les monstres et animaux ne laissent pas d'objets (par exemple, les creepers ne laissent pas de poudre à canon). + +Si vous désactivez cette option, les blocs ne laissent pas d'objets après être détruits (par exemple, les blocs de pierre ne laissent pas de pierre taillée). + +Si vous désactivez cette option, les joueurs ne regagnent pas leur santé automatiquement. + +Si vous désactivez cette option, le moment de la journée ne change pas. + Packs de skins Thèmes @@ -3399,7 +4002,49 @@ Voulez-vous installer le pack mash-up ou le pack de textures maintenant ? {*PLAYER*} s'est fait rouer de coups par {*SOURCE*} -{*PLAYER*} s'est fait tuer par {*SOURCE*} +{*SOURCE*} a tué {*PLAYER*} par magie + +{*PLAYER*} a chuté d'une échelle + +{*PLAYER*} a chuté d'une liane + +{*PLAYER*} a chuté hors de l'eau + +{*PLAYER*} a chuté d'un endroit élevé + +{*PLAYER*} s'est fait pousser par {*SOURCE*} + +{*PLAYER*} s'est fait pousser par {*SOURCE*} + +{*PLAYER*} s'est fait pousser par {*SOURCE*} avec {*ITEM*} + +Après une lourde chute, {*SOURCE*} a achevé {*PLAYER*} + +Après une lourde chute, {*SOURCE*} a achevé {*PLAYER*} avec {*ITEM*} + +{*PLAYER*} a marché dans le feu tout en combattant {*SOURCE*} + +{*PLAYER*} s'est fait carboniser tout en combattant {*SOURCE*} + +{*PLAYER*} a piqué une tête dans la lave pour échapper à {*SOURCE*} + +{*PLAYER*} a péri par noyade en tentant d'échapper à {*SOURCE*} + +{*PLAYER*} a percuté un cactus en tentant d'échapper à {*SOURCE*} + +{*PLAYER*} s'est fait exploser par {*SOURCE*} + +{*PLAYER*} s'est fait Witherifier + +{*PLAYER*} s'est fait occire par {*SOURCE*} avec {*ITEM*} + +{*PLAYER*} s'est fait tirer dessus par {*SOURCE*} avec {*ITEM*} + +{*PLAYER*} a encaissé une boule de feu décochée par {*SOURCE*} avec {*ITEM*} + +{*PLAYER*} s'est fait rouer de coups par {*SOURCE*} avec {*ITEM*} + +{*PLAYER*} s'est fait tuer par {*SOURCE*} avec {*ITEM*} Brouillard d'adminium @@ -3413,7 +4058,7 @@ Voulez-vous installer le pack mash-up ou le pack de textures maintenant ? Personnage animé -Animations personnalisée pour skin +Anim. pers. pour skin Vous ne pouvez plus miner ou utiliser d'objet @@ -3566,9 +4211,9 @@ Voulez-vous installer le pack mash-up ou le pack de textures maintenant ? Ne pas réinitialiser le Nether -Pas de tonte de champimeuh pour le moment. Le nombre max de cochons, moutons, vaches et chats a été atteint. +Pas de tonte de champimeuh pour le moment. Le nombre max de cochons, moutons, vaches chats et chevaux a été atteint. -Impossible d'utiliser l'œuf d'apparition pour le moment. Vous avez atteint le nombre maximum de cochons, moutons, vaches et chats. +Impossible d'utiliser l'œuf d'apparition pour le moment. Vous avez atteint le nombre maximum de cochons, moutons, vaches, chats et chevaux. Impossible d'utiliser l'œuf d'apparition pour le moment. Vous avez atteint le nombre maximum de champimeuh. @@ -3578,6 +4223,8 @@ Voulez-vous installer le pack mash-up ou le pack de textures maintenant ? Impossible d'utiliser l'œuf d'apparition pour le moment. Vous avez atteint le nombre maximum de pieuvres dans un monde. +Impossible d'utiliser l'œuf d'apparition pour le moment. Vous avez atteint le nombre maximum de chauves-souris dans un monde. + Impossible d'utiliser un œuf d'apparition pour le moment. Le nombre maximum d'ennemis dans un monde a été atteint. Impossible d'utiliser un œuf d'apparition pour le moment. Le nombre maximum de villageois dans un monde a été atteint. @@ -3586,12 +4233,14 @@ Voulez-vous installer le pack mash-up ou le pack de textures maintenant ? Vous ne pouvez pas faire apparaître des ennemis en mode Paisible. -Cet animal ne peut pas entrer en mode amour. Le nombre maximum de cochons, moutons, vaches et chats en cours d'élevage a été atteint. +Cet animal ne peut pas entrer en mode amour. Le nombre maximum de cochons, moutons, vaches, chats et chevaux en cours d'élevage a été atteint. Cet animal ne peut pas entrer en mode amour. Le nombre maximum de loups en cours d'élevage a été atteint. Cet animal ne peut pas entrer en mode amour. Le nombre maximum de poulets en cours d'élevage a été atteint. +Cet animal ne peut pas entrer en mode amour. Le nombre maximum de chevaux en cours d'élevage a été atteint. + Cet animal ne peut pas entrer en mode amour. Nbre max de champimeuh élevés atteint. Le nombre maximum de bateaux dans un monde a été atteint. @@ -3619,27 +4268,43 @@ Voulez-vous installer le pack mash-up ou le pack de textures maintenant ?Crédits Réinstaller le contenu - + Debug Settings - + Propagation du feu - + Explosion de TNT - + PvP - + Joueurs de confiance - + Privilèges d'hôte - + Génération de structures - + Monde superplat - + Coffre bonus - + Options mondiales - + +Options du joueur + +Ingérence des monstres + +Conservation d'inventaire + +Apparition des monstres + +Butin des monstres + +Butin des blocs + +Régénération auto + +Cycle jour/nuit + Peut construire et miner Utilisation de portes et leviers possible @@ -3648,7 +4313,7 @@ Voulez-vous installer le pack mash-up ou le pack de textures maintenant ? Peut attaquer les joueurs -Attaque d'animaux possible +Peut attaquer les animaux Modérateur @@ -3826,6 +4491,14 @@ Voulez-vous installer le pack mash-up ou le pack de textures maintenant ? Poison +Wither + +Boost de santé + +Absorption + +Saturation + de rapidité de lenteur @@ -3864,6 +4537,14 @@ Voulez-vous installer le pack mash-up ou le pack de textures maintenant ? de poison +de flétrissure + +de boost de santé + +d'absorption + +de saturation + II @@ -3960,6 +4641,22 @@ Voulez-vous installer le pack mash-up ou le pack de textures maintenant ? Réduit progressivement la santé des joueurs, animaux et monstres affectés. +À l'application : + +Force de saut du cheval + +Renforts zombies + +Santé max + +Portée d'aggro + +Résistance au recul + +Vitesse + +Dégâts d'attaque + Tranchant Châtiment @@ -4050,7 +4747,7 @@ Voulez-vous installer le pack mash-up ou le pack de textures maintenant ? Restitue 3{*ICON_SHANK_01*}. Obtenu en cuisinant une pomme de terre dans un four. -Restitue 1{*ICON_SHANK_01*} mais peut vous empoisonner. À cuire dans un four ou planter dans une terre labourée. +Restitue 1{*ICON_SHANK_01*} mais peut vous rendre malade. Restitue 3{*ICON_SHANK_01*}. Se fabrique avec une carotte et des pépites d'or. diff --git a/Minecraft.Assets/XboxMedia/loc/it-IT/strings.resx b/Minecraft.Assets/XboxMedia/loc/it-IT/strings.resx index 8082dfdc7..6eb30dc32 100644 --- a/Minecraft.Assets/XboxMedia/loc/it-IT/strings.resx +++ b/Minecraft.Assets/XboxMedia/loc/it-IT/strings.resx @@ -300,6 +300,27 @@ Quando carichi o crei un mondo, se premi il pulsante "Altre opzioni" accederai a {*T2*}Privilegi dell'host{*ETW*}{*B*} Se l'opzione è abilitata, l'host, tramite il menu di gioco, può attivare o disattivare la possibilità di volare, disabilitare la stanchezza e rendersi invisibile. {*DISABLES_ACHIEVEMENTS*}{*B*}{*B*} + {*T2*}Ciclo giorno/notte{*ETW*}{*B*} + Se disattivato, l'ora del giorno non cambia.{*B*}{*B*} + + {*T2*}Mantieni inventario{*ETW*}{*B*} + Se attivato, i giocatori mantengono l'inventario quando muoiono.{*B*}{*B*} + + {*T2*}Generazione mostri{*ETW*}{*B*} + Se disattivata, i mostri non vengono generati naturalmente.{*B*}{*B*} + + {*T2*}Immutabilità{*ETW*}{*B*} + Se disattivata, impedisce a mostri e animali di modificare i blocchi (per esempio, le esplosioni dei creeper non distruggono i blocchi e le pecore non brucano l'erba) o raccogliere oggetti.{*B*}{*B*} + + {*T2*}Bottino mostri{*ETW*}{*B*} + Se disattivato, mostri e animali non rilasciano bottino (per esempio, i creeper non rilasciano polvere da sparo).{*B*}{*B*} + + {*T2*}Rilascio blocchi{*ETW*}{*B*} + Se disattivato, i blocchi non rilasciano oggetti quando vengono distrutti (per esempio, i blocchi di pietra non rilasciano ciottoli).{*B*}{*B*} + + {*T2*}Rigenerazione naturale{*ETW*}{*B*} + Se disattivata, la salute dei giocatori non si rigenera naturalmente.{*B*}{*B*} + {*T1*}Opzioni di generazione del mondo{*ETW*}{*B*} Quando crei un nuovo mondo, sono disponibili alcune opzioni aggiuntive.{*B*}{*B*} @@ -316,7 +337,7 @@ Quando crei un nuovo mondo, sono disponibili alcune opzioni aggiuntive.{*B*}{*B* Quando è attivato, il Sottomondo sarà rigenerato. Questa funzionalità può essere molto utile se hai dei vecchi salvataggi in cui le Fortezze del Sottomondo non erano presenti.{*B*}{*B*} {*T1*}Opzioni di gioco{*ETW*}{*B*} - Durante la partita, premi BACK per aprire il menu di gioco, dove potrai accedere a diverse opzioni.{*B*}{*B*} + Durante la partita, premi{*BACK_BUTTON*}per aprire il menu di gioco, dove potrai accedere a diverse opzioni.{*B*}{*B*} {*T2*}Opzioni host{*ETW*}{*B*} L'host e tutti i giocatori identificati come moderatori possono accedere al menu "Opzioni host", nel quale avranno la possibilità di abilitare o disabilitare le opzioni "Diffusione incendio" ed "Esplosione TNT".{*B*}{*B*} @@ -325,42 +346,44 @@ Quando crei un nuovo mondo, sono disponibili alcune opzioni aggiuntive.{*B*}{*B* Per modificare i privilegi di un giocatore, seleziona il suo nome e premi{*CONTROLLER_VK_A*} per accedere al menu dei privilegi del giocatore, dove potrai agire sulle seguenti opzioni.{*B*}{*B*} {*T2*}Può costruire e scavare{*ETW*}{*B*} - Quando quest'opzione è abilitata, il giocatore può interagire con il mondo normalmente. Se, invece, l'opzione è disattivata, il giocatore non può posizionare né distruggere blocchi e non potrà interagire con oggetti e blocchi di vario tipo. Quest'opzione è disponibile solo se "Autorizza giocatori" è disattivata.{*B*}{*B*} + Questa opzione è disponibile solo se "Autorizza giocatori" è disattivata. Quando l'opzione è attiva, il giocatore può interagire normalmente con il mondo di gioco. Se, invece, l'opzione è disattivata, il giocatore non può posizionare né distruggere blocchi e non potrà interagire con oggetti e blocchi di vario tipo.{*B*}{*B*} {*T2*}Può usare porte e interruttori{*ETW*}{*B*} - Se disattivata, il giocatore non sarà in grado di usare né le porte né gli interruttori. Quest'opzione è disponibile solo se "Autorizza giocatori" è disattivata.{*B*}{*B*} + Questa opzione è disponibile solo se "Autorizza giocatori" è disattivata. Se disattivata, il giocatore non sarà in grado di usare né le porte né gli interruttori.{*B*}{*B*} {*T2*}Può aprire contenitori{*ETW*}{*B*} - Se disattivata, il giocatore non sarà in grado di aprire i contenitori, come le casse. Quest'opzione è disponibile solo se "Autorizza giocatori" è disattivata.{*B*}{*B*} + Questa opzione è disponibile solo se "Autorizza giocatori" è disattivata. Se disattivata, il giocatore non sarà in grado di aprire i contenitori, come le casse.{*B*}{*B*} {*T2*}Può attaccare i giocatori{*ETW*}{*B*} - Se disattivata, impedisce al giocatore di causare danni agli altri utenti. Quest'opzione è disponibile solo se "Autorizza giocatori" è disattivata.{*B*}{*B*} + Questa opzione è disponibile solo se "Autorizza giocatori" è disattivata. Se disattivata, impedisce al giocatore di causare danni agli altri utenti.{*B*}{*B*} {*T2*}Può attaccare animali{*ETW*}{*B*} - Se disattivata, il giocatore non sarà in grado di infliggere danni agli animali. Quest'opzione è disponibile solo se "Autorizza giocatori" è disattivata.{*B*}{*B*} + Questa opzione è disponibile solo se "Autorizza giocatori" è disattivata. Se disattivata, il giocatore non sarà in grado di infliggere danni agli animali.{*B*}{*B*} {*T2*}Moderatore{*ETW*}{*B*} Se quest'opzione è attivata, il giocatore potrà modificare i privilegi degli altri utenti, fatta eccezione per l'host, a patto che "Autorizza giocatori" sia disabilitata. Inoltre, il giocatore potrà espellere gli altri utenti e modificare le opzioni relative alla diffusione degli incendi e all'esplosione del TNT.{*B*}{*B*} {*T2*}Espelli giocatore{*ETW*}{*B*} - Selezionando quest'opzione, è possibile espellere qualsiasi giocatore che non si trova sulla console {*PLATFORM_NAME*} dell'host e tutti gli altri utenti eventualmente collegati tramite la console {*PLATFORM_NAME*} del giocatore espulso. I giocatori espulsi non potranno rientrare prima che la partita sia riavviata.{*B*}{*B*} + {*KICK_PLAYER_DESCRIPTION*}{*B*}{*B*} {*T1*}Opzioni del giocatore host{*ETW*}{*B*} -Se l'opzione "Privilegi dell'host" è attivata, l'host può modificare da solo alcuni privilegi. Per modificare i privilegi di un giocatore, seleziona il suo nome e premi {*CONTROLLER_VK_A*} per aprire il menu dei privilegi del giocatore e accedere alle seguenti opzioni.{*B*}{*B*} +Se l'opzione "Privilegi dell'host" è attivata, l'host può modificare da solo alcuni privilegi. Per modificare i privilegi di un giocatore, seleziona il suo nome e premi{*CONTROLLER_VK_A*} per aprire il menu dei privilegi del giocatore e accedere alle seguenti opzioni.{*B*}{*B*} {*T2*}Può volare{*ETW*}{*B*} Se l'opzione è attivata, il giocatore è in grado di volare. L'opzione ha effetto esclusivamente sulla modalità Sopravvivenza, perché in modalità Creativa, tutti i giocatori possono volare.{*B*}{*B*} - + {*T2*}Disabilita stanchezza{*ETW*}{*B*} L'opzione ha effetto esclusivamente sulla modalità Sopravvivenza. Se attivata, le attività fisiche (camminare, correre, saltare e altre ancora) non fanno diminuire la barra del cibo. Tuttavia, se il giocatore viene ferito, la barra del cibo diminuirà lentamente man mano che il giocatore guarisce.{*B*}{*B*} - + {*T2*}Invisibile{*ETW*}{*B*} Se l'opzione è abilitata, il giocatore è invulnerabile e gli altri utenti non possono vederlo.{*B*}{*B*} - + {*T2*}Può usare il teletrasporto{*ETW*}{*B*} - Permette al giocatore di spostare sé stesso o gli altri utenti, raggiungendo altri giocatori presenti nel mondo. + Permette al giocatore di spostare se stesso o gli altri utenti, raggiungendo altri giocatori presenti nel mondo. +Selezionando quest'opzione, è possibile espellere qualsiasi giocatore che non si trova sulla console {*PLATFORM_NAME*} dell'host e tutti gli altri utenti eventualmente collegati tramite la console {*PLATFORM_NAME*} del giocatore espulso. Il giocatore non potrà accedere nuovamente finché il gioco non sarà stato riavviato. + Pagina successiva Pagina precedente @@ -424,63 +447,95 @@ così saranno in grado di raggiungerti facilmente. Novità - -{*T3*}Modifiche e aggiunte{*ETW*}{*B*}{*B*} -- Nuovi oggetti: smeraldi, minerale di smeraldo, blocco di smeraldo, forziere di Ender, gancio a filo, mela d'oro incantata, incudine, vaso di fiori, muro di ciottoli, muro di ciottoli coperto di muschio, quadro sbiadito, patata, patata arrostita, patata velenosa, carota, carota d'oro, carota e bastone, -torta di zucca, pozione della visione notturna, pozione dell'invisibilità, quarzo del Sottomondo, minerale di quarzo del Sottomondo, blocco di quarzo, lastra di quarzo, scala di quarzo, blocco cesellato di quarzo, blocco portante di quarzo, libro incantato, tappeto.{*B*} -- Nuove ricette per arenaria liscia e arenaria cesellata.{*B*} -- Nuovi nemici: abitanti del villaggio zombie.{*B*} -- Nuove caratteristiche per la generazione del mondo: templi nel deserto, villaggi nel deserto, templi nella giungla.{*B*} -- Aggiunta la possibilità di commerciare con gli abitanti dei villaggi.{*B*} -- Aggiunta l'interfaccia incudine.{*B*} -- Il colore delle armature di pelle può essere cambiato usando le tinture.{*B*} -- Il colore dei collari dei lupi può essere cambiato usando le tinture.{*B*} -- I maiali possono essere controllati usando bastone e carota quando li si cavalca.{*B*} -- Il contenuto dei forzieri bonus è stato aggiornato con altri oggetti.{*B*} -- La posizione dei mezzi blocchi e degli altri blocchi sui mezzi blocchi è stata modificata.{*B*} -- La posizione delle scale e delle lastre al contrario è stata modificata.{*B*} -- Sono stati aggiunti mestieri diversi per gli abitanti dei villaggi.{*B*} -- Gli abitanti dei villaggi nati da un uovo generazione svolgono mestieri scelti in modo casuale.{*B*} -- È stata aggiunta la possibilità di posizionare i tronchi di legno in orizzontale.{*B*} -- Gli attrezzi di legno possono essere usati come combustibile nelle fornaci.{*B*} -- Le lastre di vetro e quelle di ghiaccio possono essere raccolte con attrezzi dotati dell'incantesimo "Tocco di seta".{*B*} -- Le piastre a pressione di legno e i pulsanti di legno possono essere attivati con le frecce.{*B*} -- I nemici del Sottomondo possono essere generati nel Sopramondo tramite i portali.{*B*} -- I creeper e i ragni sono aggressivi nei confronti del giocatore che li ha colpiti per ultimo.{*B*} -- I nemici in modalità Creativa tornano a essere neutrali dopo un breve periodo.{*B*} -- È stato rimosso l'atterramento in caso di annegamento.{*B*} -- Le porte rotte dagli zombie mostrano i segni dei danni subiti.{*B*} -- Il ghiaccio si scioglie nel Sottomondo.{*B*} -- I calderoni si riempiono d'acqua sotto la pioggia.{*B*} -- I pistoni impiegano il doppio del tempo per tornare al punto di partenza.{*B*} -- In caso siano sellati, i maiali lasciano cadere la sella quando sono uccisi.{*B*} -- Il colore del cielo nel Limite è stato cambiato.{*B*} -- È possibile posizionare corde (per i ganci a filo).{*B*} -- Le gocce di pioggia filtrano tra le foglie.{*B*} -- Le leve possono essere posizionate sulla parte inferiore dei blocchi.{*B*} -- Il TNT infligge danni che variano in base al livello di difficoltà.{*B*} -- La ricetta del libro è stata cambiata.{*B*} -- Le barche rompono le ninfee (le ninfee non rompono più le barche).{*B*} -- I maiali fanno guadagnare un maggior numero di costolette di maiale.{*B*} -- Sono generati meno slime nei mondi superpiatti.{*B*} -- I creeper infliggono una quantità di danni variabile in base al livello di difficoltà, ma l'atterramento è aumentato.{*B*} -- È stato risolto il problema degli Enderman che non aprono le mascelle.{*B*} -- È stato aggiunto il teletrasporto per i giocatori (usando il menu BACK durante il gioco).{*B*} -- Sono state aggiunte opzioni host per il volo, l'invisibilità e l'invulnerabilità per i giocatori in remoto.{*B*} -- Nel mondo tutorial sono stati aggiunti altri tutorial che spiegano nuovi oggetti e caratteristiche del gioco.{*B*} -- Le posizioni dei forzieri dei dischi nel mondo tutorial sono state aggiornate.{*B*} +{*T3*}Modifiche e aggiunte{*ETW*}{*B*}{*B*} +- Aggiunti nuovi oggetti: argilla indurita, argilla colorata, blocco di carbone, balla di fieno, binario attivatore, blocco di pietra rossa, sensore luce diurna, sgancio, vagoncino, carrello con vagoncino, carrello con TNT, comparatore pietra rossa, piastra a pressione con peso, segnale, cassa intrappolata, razzo d'artificio, stella Fuoco d'artificio, stella del Sottomondo, piombo, corazza per cavalli, targhetta nome, uovo generazione cavallo{*B*} +- Aggiunti nuovi mostri: Avvizzito, scheletri avvizziti, streghe, pipistrelli, cavalli, asini e muli{*B*} +- Aggiunte nuove funzionalità di generazione del terreno: capanna della strega.{*B*} +- Aggiunta interfaccia del segnale.{*B*} +- Aggiunta interfaccia del cavallo.{*B*} +- Aggiunta interfaccia del vagoncino.{*B*} +- Aggiunti i fuochi d'artificio, la cui interfaccia è accessibile dal tavolo da lavoro quando si dispone degli ingredienti per la produzione di una stella Fuoco d'artificio o di un razzo d'artificio.{*B*} +- Aggiunta la modalità Avventura: puoi distruggere i blocchi solo se disponi degli attrezzi adatti.{*B*} +- Aggiunti numerosi nuovi suoni.{*B*} +- Ora mostri, oggetti e proiettili possono attraversare i portali.{*B*} +- Ora i ripetitori possono essere bloccati attivandone i lati con un altro ripetitore.{*B*} +- Zombie e scheletri ora possono essere generati con diverse armi e armature.{*B*} +- Nuovi messaggi in caso di morte del giocatore.{*B*} +- Possibilità di dare un nome ai mostri con una targhetta e di rinominare i contenitori al fine di modificarne il titolo quando viene visualizzato il relativo menu.{*B*} +- La farina d'ossa non fa più crescere qualsiasi oggetto istantaneamente alla dimensione massima, invece lo fa crescere casualmente di vari livelli.{*B*} +- Collocando un comparatore di pietra rossa accanto a casse, banchi di distillazione, distributori e jukebox, è possibile rilevare un segnale pietra rossa che ne illustra il contenuto.{*B*} +- I distributori possono essere rivolti in qualsiasi direzione.{*B*} +- Mangiando una mela d'oro, il giocatore ottiene un "assorbimento" extra di salute temporaneo.{*B*} +- Maggiore è il tempo trascorso in un'area, più i mostri generati in quel luogo saranno potenti.{*B*} {*ETB*}Bentornato! Forse non lo sai, ma Minecraft è appena stato aggiornato.{*B*}{*B*} -Abbiamo aggiunto tante nuove funzionalità per te e i tuoi amici: di seguito troverai elencate quelle principali. Dai un'occhiata e corri a divertirti!{*B*}{*B*} -{*T1*}Nuovi oggetti{*ETB*} - Smeraldi, minerale di smeraldo, blocco di smeraldo, forziere di Ender, gancio a filo, mela d'oro incantata, incudine, vaso di fiori, muro di ciottoli, muro di ciottoli coperto di muschio, quadro sbiadito, patata, patata arrostita, patata velenosa, carota, carota d'oro, carota e bastone, -torta di zucca, pozione della visione notturna, pozione dell'invisibilità, quarzo del Sottomondo, minerale di quarzo del Sottomondo, blocco di quarzo, lastra di quarzo, scala di quarzo, blocco cesellato di quarzo, blocco portante di quarzo, libro incantato, tappeto.{*B*}{*B*} - {*T1*}Nuovi nemici{*ETB*} - Abitanti del villaggio zombie.{*B*}{*B*} -{*T1*}Nuove funzioni di gioco{*ETB*} - Commercia con gli abitanti dei villaggi, ripara e incanta armi e attrezzi con l'incudine, custodisci oggetti nei forzieri di Ender, controlla il maiale che cavalchi usando bastone e carota!{*B*}{*B*} -{*T1*}Nuovi mini tutorial{*ETB*} – Impara a usare le nuove funzioni di gioco nel mondo tutorial!{*B*}{*B*} -{*T1*}Nuove "sorprese nascoste"{*ETB*} – Abbiamo cambiato la posizione di tutti i dischi segreti nel mondo tutorial. Vediamo se riesci a trovarli di nuovo!{*B*}{*B*} +Abbiamo aggiunto tante nuove funzionalità per te e i tuoi amici: di seguito troverai elencate quelle principali. Dai un'occhiata e corri a divertirti!{*B*}{*B*} +{*T1*}Nuovi oggetti{*ETB*} - Argilla indurita, argilla colorata, blocco di carbone, balla di fieno, binario attivatore, blocco di pietra rossa, sensore luce diurna, sgancio, vagoncino, carrello con vagoncino, carrello con TNT, comparatore pietra rossa, piastra a pressione con peso, segnale, cassa intrappolata, razzo d'artificio, stella Fuoco d'artificio, stella del Sottomondo, piombo, corazza per cavalli, targhetta nome, uovo generazione cavallo{*B*}{*B*} +{*T1*}Nuovi mostri{*ETB*} - Avvizzito, scheletri avvizziti, streghe, pipistrelli, cavalli, asini e muli{*B*}{*B*} +{*T1*}Nuove funzionalità{*ETB*} - Doma e cavalca i cavalli, produci e usa i fuochi d'artificio, usa le targhette per dare un nome ad animali e mostri, crea circuiti a pietra rossa più avanzati e usa le nuove opzioni host per controllare le azioni disponibili per i visitatori del tuo mondo!{*B*}{*B*} +{*T1*}Nuovo mondo tutorial{*ETB*} – Scopri funzionalità nuove e familiari nel mondo tutorial. Cerca di trovare tutti i dischi nascosti!{*B*}{*B*} +Cavalli + +{*T3*}COME GIOCARE: CAVALLI{*ETW*}{*B*}{*B*} +Cavalli e asini si trovano principalmente nelle pianure. Se un asino si accoppia con una cavalla, nasce un mulo, il quale però è sterile.{*B*} +Puoi cavalcare tutti i cavalli, asini e muli adulti, ma solo i cavalli possono essere dotati di armatura, così come le borse da sella per il trasporto di oggetti sono riservate ad asini e muli.{*B*}{*B*} +Prima di poter cavalcare un cavallo, un asino o un mulo, dovrai domarlo tentando di cavalcarlo e rimanendo in groppa mentre cerca di disarcionarti.{*B*} +Quando compaiono dei cuoricini intorno all'animale, significa che è domato e potrai cavalcarlo. Per controllare un cavallo, devi dotarlo di una sella.{*B*}{*B*} +Puoi acquistare le selle dagli abitanti dei villaggi oppure trovarle nelle casse nascoste un po' ovunque.{*B*} +Puoi mettere una borsa da sella su un asino o un mulo domato assicurandovi una cassa. Potrai accedere alle borse da sella mentre cavalchi o sei in modalità furtiva.{*B*}{*B*} +Puoi allevare cavalli e asini (ma non muli) come gli altri animali, usando mele d'oro o carote d'oro.{*B*} +Col passare del tempo, i puledri diventeranno adulti, comunque puoi velocizzare l'operazione nutrendoli con fieno o grano.{*B*} + + +Segnali + +{*T3*}COME GIOCARE: SEGNALI{*ETW*}{*B*}{*B*} +I segnali attivi proiettano un raggio di luce nel cielo, conferendo poteri speciali ai giocatori nelle vicinanze.{*B*} +Per produrli servono vetro, ossidiana e stelle del Sottomondo, le quali si ottengono sconfiggendo l'Avvizzito.{*B*}{*B*} +I segnali devono essere collocati in modo tale che siano colpiti dalla luce del sole durante il giorno; inoltre vanno posti su piramidi di ferro, oro, smeraldo o diamante.{*B*} +Il materiale su cui è collocato il segnale non influisce sul suo potere.{*B*}{*B*} +Nel menu dei segnali puoi selezionare un potere principale per il tuo segnale: più livelli possiede la piramide, maggiore sarà il numero di poteri tra cui scegliere.{*B*} +Un segnale su una piramide con almeno quattro livelli offre inoltre il potere secondario Rigenerazione o un potere principale rafforzato.{*B*}{*B*} +Per impostare i poteri del tuo segnale, devi sacrificare un lingotto di smeraldo, diamante, oro o ferro nello slot di pagamento.{*B*} +Una volta impostati, i poteri saranno emanati dal segnale senza scadenze o limiti.{*B*} + + +Fuochi d'artificio + +{*T3*}COME GIOCARE: FUOCHI D'ARTIFICIO{*ETW*}{*B*}{*B*} +I fuochi d'artificio sono oggetti decorativi che possono essere lanciati manualmente o dai distributori. Si producono usando carta, povere da sparo e alcune stelle Fuoco d'artificio (facoltative).{*B*} +Colori, dissolvenza, forma, dimensione ed effetti (come scia o scintillii) delle stelle Fuoco d'artificio possono essere personalizzati includendo ingredienti aggiuntivi durante la produzione.{*B*}{*B*} +Per produrre un fuoco d'artificio, inserisci polvere da sparo e carta nella griglia di produzione 3x3 al di sopra dell'inventario.{*B*} +Se lo desideri, puoi inserire alcune stelle Fuoco d'artificio nella griglia di produzione, per aggiungerle al fuoco d'artificio.{*B*} +Più caselle occupi con la polvere da sparo, maggiore sarà l'altezza a cui esploderanno le stelle Fuoco d'artificio.{*B*}{*B*} +Quando vuoi produrre il fuoco d'artificio, prendilo dalla casella di produzione.{*B*}{*B*} +Per produrre le stelle Fuoco d'artificio, inserisci polvere da sparo e tintura nella griglia di produzione.{*B*} + - La tintura stabilisce il colore dell'esplosione della stella Fuoco d'artificio.{*B*} + - Per decidere la forma della stella Fuoco d'artificio, aggiungi una scarica di fuoco, una pepita d'oro, una piuma o una testa di mostro.{*B*} + - Puoi aggiungere una scia usando diamanti e polvere di pietra brillante.{*B*}{*B*} +Una volta creata una stella Fuoco d'artificio, puoi stabilirne il colore di dissolvenza usando la tintura. + + +Vagoncini + +{*T3*}COME GIOCARE: VAGONCINI{*ETW*}{*B*}{*B*} +I vagoncini si usano per inserire o rimuovere oggetti dai contenitori e per raccogliere automaticamente gli oggetti che vi vengono riposti.{*B*} +Possono influire su Banchi di distillazione, casse, distributori, sganci, carrelli con casse, carrelli con vagoncini e altri vagoncini.{*B*}{*B*} +I vagoncini tentano continuamente di estrarre oggetti da un contenitore adatto posizionato sopra di essi. Inoltre, cercheranno di inserire gli oggetti in essi riposti in un contenitore di scarico.{*B*} +Se un vagoncino funziona grazie a una pietra rossa, si disattiverà e smetterà di prelevare e consegnare oggetti.{*B*}{*B*} +Il vagoncino punta nella direzione in cui cerca di scaricare gli oggetti. Per rivolgere un vagoncino verso un blocco particolare, posizionalo a ridosso di tale blocco mentre ti muovi furtivamente.{*B*} + + +Sganci + +{*T3*}COME GIOCARE: SGANCI{*ETW*}{*B*}{*B*} +Se attivati da una pietra rossa, gli sganci rilasciano un oggetto casuale sul terreno. Usa {*CONTROLLER_ACTION_USE*} per aprire lo sgancio e inserisci gli oggetti del tuo inventario.{*B*} +Se lo sgancio è rivolto verso un forziere o un altro tipo di contenitore, l'oggetto verrà riposto lì. Puoi creare lunghe serie di sganci per trasportare gli oggetti, ma affinché funzionino devono essere alternativamente attivati e disattivati. + + Infligge un danno maggiore della mano. Serve per scavare terra, erba, sabbia, ghiaia e neve più in fretta che a mano. Le pale servono per scavare palle di neve. @@ -553,7 +608,7 @@ torta di zucca, pozione della visione notturna, pozione dell'invisibilità, quar Si usa per creare scale lunghe. Due lastre una sopra l'altra creano un blocco doppio di dimensioni normali. -Si usa per costruire scale lunghe. Due lastre poste l'una sull'altra creano un blocco da due lastre di dimensioni normali. +Si usa per creare scale lunghe. Due lastre una sopra l'altra creano un blocco doppio di dimensioni normali. La torcia si usa per fare luce, nonché per sciogliere neve e ghiaccio. @@ -606,10 +661,36 @@ I colori sono sempre gli stessi, qualunque sia la lana usata. Mentre la tieni in mano, crea un'immagine di un'area esplorata. Può essere utile per orientarti. +Quando viene utilizzata, diventa una mappa della parte del mondo in cui ti trovi e si compila man mano che procedi nell'esplorazione. + Consente attacchi a distanza con le frecce. Si usa come munizione per l'arco. +Rilasciato dall'Avvizzito, si usa per produrre segnali. + +Quando si attiva, crea esplosioni colorate. Colore, effetto, forma e dissolvenza sono determinati dalla stella Fuoco d'artificio utilizzata al momento della sua produzione. + +Si usa per determinare colore, effetto e forma di un fuoco d'artificio. + +Si usa nei circuiti con pietre rosse per mantenere, confrontare o sottrarre forza al segnale o per misurare le condizioni di determinati blocchi. + +È un tipo di carrello che funge da blocco di TNT mobile. + +È un blocco che emette un segnale pietra rossa in base alla luce del sole (o alla sua assenza). + +È uno speciale tipo di carrello che funziona in modo simile al vagoncino. Raccoglie gli oggetti sui binari e dai contenitori sopra di esso. + +Speciale tipo di corazza che si può far indossare a un cavallo. Garantisce 5 punti armatura. + +Speciale tipo di corazza che si può far indossare a un cavallo. Garantisce 7 punti armatura. + +Speciale tipo di corazza che si può far indossare a un cavallo. Garantisce 11 punti armatura. + +Serve per allacciare il nemico al giocatore o alle recinzioni. + +Serve per dare un nome ai nemici nel mondo. + Reintegra 2,5{*ICON_SHANK_01*}. Reintegra 1{*ICON_SHANK_01*}. Utilizzabile 6 volte. @@ -628,7 +709,7 @@ I colori sono sempre gli stessi, qualunque sia la lana usata. Reintegra 4{*ICON_SHANK_01*}. Si crea cucinando il manzo crudo nella fornace. -Reintegra 1,5{*ICON_SHANK_01*} o si può cucinare nella fornace. +Reintegra 1,5{*ICON_SHANK_01*}, o può essere cucinato in una fornace. Reintegra 4{*ICON_SHANK_01*}. Si crea cucinando una costoletta di maiale in una fornace. @@ -661,7 +742,7 @@ I colori sono sempre gli stessi, qualunque sia la lana usata. Accesi, fanno accelerare i carrelli da miniera che ci passano sopra. Spenti, fanno fermare i carrelli da miniera. -Funzionano come la piastra a pressione (inviano un segnale pietra rossa mentre sono in funzione) ma sono attivabili solo dal carrello da miniera. +Funziona come la piastra a pressione (invia un segnale pietra rossa mentre è in funzione) ma è attivabile solo dal carrello da miniera. Trasporta te, un animale o un mostro sui binari. @@ -934,100 +1015,158 @@ I colori sono sempre gli stessi, qualunque sia la lana usata. Le teste di Mob si possono collocare come decorazioni o indossare come maschere nello slot per l'elmo. +Serve per eseguire ordini. + +Proietta un raggio di luce nel cielo e conferisce effetti positivi ai giocatori vicini. + +Vi si possono conservare blocchi e oggetti. Colloca due casse una accanto all'altra per creare una cassa grande dalla capacità doppia. La cassa intrappolata crea inoltre una carica di pietra rossa quando viene aperta. + +Fornisce una carica di pietra rossa. La carica è più potente se ci sono più oggetti sulla piastra. + +Fornisce una carica di pietra rossa. La carica è più potente se ci sono più oggetti sulla piastra. Richiede un peso maggiore rispetto alla piastra leggera. + +Si usa come fonte energetica per la pietra rossa. Riconvertibile in pietra rossa. + +Si usa per prelevare oggetti o per trasferirli dentro e fuori vari contenitori. + +Un tipo di binario che attiva o disattiva i carrelli con vagoncini e attiva i carrelli con TNT. + +Serve per custodire e depositare oggetti o per spingerli in un altro contenitore quando viene fornita una carica di pietra rossa. + +Blocchi colorati prodotti tingendo l'argilla indurita. + +Si può usare per nutrire cavalli, asini o muli e reintegrare fino a 10 cuori. Accelera la crescita dei puledri. + +Si crea fondendo argilla nella fornace. + +Si produce usando vetro e tintura. + +Si produce con il vetro colorato. + +Per conservare il carbone in poco spazio. Utilizzabile per il funzionamento della fornace. + Calamaro - + Rilascia sacche di inchiostro quando viene ucciso. - + Mucca - + Rilascia pelle quando viene uccisa. Si può anche mungere usando un secchio. - + Pecora - + Rilascia lana quando viene tosata (se non è già stata tosata). Si può creare lana di vari colori usando le tinture. - + Gallina - + Rilascia piume quando viene uccisa, inoltre a volte depone le uova. - + Maiale - + Rilascia costolette quando viene ucciso. Si può cavalcare usando una sella. - + Lupo - + Docile finché non viene attaccato, nel qual caso reagisce. Si può domare usando le ossa, che lo convincono a seguirti e ad attaccare i tuoi nemici. - + Creeper - + Esplode se ti avvicini troppo! - + Scheletro - + Ti lancia delle frecce. Rilascia frecce quando viene ucciso. - + Ragno - + Ti attacca quando ti avvicini. Può arrampicarsi sui muri. Rilascia un pungiglione quando viene ucciso. - + Zombie - + Ti attacca quando ti avvicini. - + Uomo-maiale zombie - + Inizialmente docile, ma se ne colpisci uno verrai attaccato da un gruppo. - + Ghast - + Ti lancia sfere di fuoco che esplodono al contatto. - + Slime - + Se danneggiato, si divide in slime più piccoli. - + Enderman - + Ti attacca se lo guardi. Può anche spostare blocchi. - + Pesciolino d'argento - + Quando viene attaccato, attira tutti i Pesciolini d'argento nascosti nei dintorni. Si nasconde nei blocchi di pietra. - + Ragno delle grotte - + Il suo morso è velenoso. - + Muccafungo - + Si usa con una Ciotola per preparare la Zuppa di funghi. Deposita funghi e diventa una mucca normale quando viene tosata. - + Golem di neve - + Il Golem di neve può essere creato assemblando blocchi di neve e una zucca. Lancia palle di neve contro i nemici del suo creatore. - + Drago di Ender - + Grosso drago nero che si trova nel Limite. - + Vampe - + Nemici che si trovano nel Sottomondo, soprattutto all'interno delle Fortezze. Quando vengono uccisi, depositano Bacchette di Vampe. - + Cubo di magma - + Si trovano nel Sottomondo. Simili a Slime, si dividono in esemplari più piccoli quando vengono uccisi. - + Abitante del villaggio - + Ocelot - + Possono essere trovati nelle giungle. Sono addomesticabili se sfamati con pesce crudo, ma aspetta che sia lui ad avvicinarsi a te, perché un movimento brusco lo metterebbe in fuga. - + Golem di ferro - + Appare nei villaggi per proteggerli, può essere creato usando blocchi di ferro e zucche. - + +Pipistrello + +Queste creature volanti si trovano nelle caverne o in altri grandi spazi chiusi. + +Strega + +Si trovano nelle paludi e attaccano lanciando pozioni. Quando vengono uccise, rilasciano pozioni. + +Cavallo + +Questi animali possono essere domati e quindi cavalcati. + +Asino + +Questi animali possono essere domati e quindi cavalcati. Possono trasportare una cassa. + +Mulo + +Nasce dall'incrocio tra un cavallo e un asino. Questi animali possono essere domati e quindi cavalcati; inoltre possono trasportare casse. + +Cavallo zombie + +Cavallo scheletro + +Avvizzito + +Si producono usando teschi di Avvizzito e sabbie mobili. Scagliano teschi esplosivi contro di te. + Explosives Animator Concept Artist @@ -1374,6 +1513,8 @@ I colori sono sempre gli stessi, qualunque sia la lana usata. Mappa +Mappa vuota + Disco - "13" Disco - "gatto" @@ -1452,9 +1593,9 @@ I colori sono sempre gli stessi, qualunque sia la lana usata. Scarica di fuoco -Scarica di fuoco (carbone vegetale) +Scarica fuoco (carbone veg.) -Scarica di fuoco (carbone) +Scarica fuoco (carbone) Espositore @@ -1476,6 +1617,28 @@ I colori sono sempre gli stessi, qualunque sia la lana usata. Testa di Creeper +Stella del Sottomondo + +Razzo d'artificio + +Stella Fuoco d'artificio + +Comparatore pietra rossa + +Carrello con TNT + +Carrello con vagoncino + +Corazza di ferro per cavallo + +Corazza d'oro per cavallo + +Corazza di diamante per cavallo + +Piombo + +Targhetta nome + Pietra Blocco d'erba @@ -1492,6 +1655,8 @@ I colori sono sempre gli stessi, qualunque sia la lana usata. Assi di legno della giungla +Assi di legno (qualsiasi tipo) + Arbusto Arbusto di quercia @@ -1604,7 +1769,7 @@ I colori sono sempre gli stessi, qualunque sia la lana usata. Lastra di arenaria -Lastra di legno +Lastra di legno di quercia Lastra acciottolata @@ -1612,15 +1777,15 @@ I colori sono sempre gli stessi, qualunque sia la lana usata. Lastra di mattoni di pietra -Lastra di legna di quercia +Lastra di legno di quercia Lastra di arbusto Lastra di legno di betulla -Lastra di legno della giungla +Lastra di legno tropicale -Lastra di mattoni del Sottomondo +Lastra matt. Sottomondo Mattoni @@ -1750,7 +1915,7 @@ I colori sono sempre gli stessi, qualunque sia la lana usata. Mattoni di pietra -Mattoni di pietra coperti di muschio +Mattoni di pietra muschiati Mattoni di pietra lesionati @@ -1790,9 +1955,9 @@ I colori sono sempre gli stessi, qualunque sia la lana usata. Mattone del Sottomondo -Recinzione di mattoni del Sottomondo +Recinzione matt. Sottomondo -Scale di mattoni del Sottomondo +Scale matt. Sottomondo Verruca del Sottomondo @@ -1820,7 +1985,7 @@ I colori sono sempre gli stessi, qualunque sia la lana usata. Scale di legno di betulla -Scala di legno della giungla +Scala di legno tropicale Torcia di pietra rossa @@ -1828,6 +1993,190 @@ I colori sono sempre gli stessi, qualunque sia la lana usata. Teschio +Blocco di comando + +Segnale + +Cassa intrappolata + +Piastra a press. pesata (leggera) + +Piastra a press. pesata (pesante) + +Comparatore pietra rossa + +Sensore luce diurna + +Blocco di pietra rossa + +Vagoncino + +Binario attivatore + +Sgancio + +Argilla colorata + +Balla di fieno + +Argilla indurita + +Blocco di carbone + +Argilla colorata nera + +Argilla colorata rossa + +Argilla colorata verde + +Argilla colorata marrone + +Argilla colorata blu + +Argilla colorata viola + +Argilla colorata turchese + +Arg. col. grigio chiaro + +Argilla colorata grigia + +Argilla colorata rosa + +Arg. col. verde acido + +Argilla colorata gialla + +Argilla colorata azzurra + +Argilla colorata magenta + +Argilla colorata arancione + +Argilla colorata bianca + +Vetro colorato + +Vetro colorato nero + +Vetro colorato rosso + +Vetro colorato verde + +Vetro colorato marrone + +Vetro colorato blu + +Vetro colorato viola + +Vetro colorato turchese + +Vetro colorato grigio chiaro + +Vetro colorato grigio + +Vetro colorato rosa + +Vetro colorato verde lime + +Vetro colorato giallo + +Vetro colorato azzurro + +Vetro colorato magenta + +Vetro colorato arancione + +Vetro colorato bianco + +Lastra di vetro colorato + +Lastra di vetro colorato nera + +Lastra di vetro colorato rossa + +Lastra di vetro colorato verde + +Lastra di vetro colorato marrone + +Lastra di vetro colorato blu + +Lastra di vetro colorato viola + +Lastra di vetro colorato turchese + +Lastra di vetro colorato grigio chiaro + +Lastra di vetro colorato grigia + +Lastra di vetro colorato rosa + +Lastra di vetro colorato verde lime + +Lastra di vetro colorato gialla + +Lastra di vetro colorato azzurra + +Lastra di vetro colorato magenta + +Lastra di vetro colorato arancione + +Lastra di vetro colorato bianca + +Sfera piccola + +Sfera grande + +A forma di stella + +A forma di creeper + +Esplosione + +Forma sconosciuta + +Nero + +Rosso + +Verde + +Marrone + +Blu + +Viola + +Turchese + +Grigio chiaro + +Grigio + +Rosa + +Verde lime + +Giallo + +Azzurro + +Magenta + +Arancione + +Bianco + +Personalizzato + +Dissolvenza + +Luccichio + +Scia + +Durata volo: +  Comandi attuali Layout @@ -2005,8 +2354,7 @@ Di notte, i mostri vagano in libertà, quindi costruisci un riparo per tempo. Questo è il tuo inventario. Mostra gli oggetti che puoi tenere in mano e quelli che trasporti, nonché la tua eventuale armatura. - - + {*B*} Premi{*CONTROLLER_VK_A*} per continuare.{*B*} Premi{*CONTROLLER_VK_B*} se sai già come si usa l'inventario. @@ -2027,8 +2375,8 @@ Di notte, i mostri vagano in libertà, quindi costruisci un riparo per tempo. - Se vuoi maggiori informazioni su un oggetto, spostaci sopra il puntatore e premi{*CONTROLLER_VK_RT*}. - + Se vuoi maggiori informazioni su un oggetto, spostaci sopra il puntatore e premi{*CONTROLLER_ACTION_MENU_PAGEDOWN*} . + Ora premi{*CONTROLLER_VK_B*} per uscire dall'inventario. @@ -2061,8 +2409,8 @@ Di notte, i mostri vagano in libertà, quindi costruisci un riparo per tempo. - Se vuoi maggiori informazioni su un oggetto, spostaci sopra il puntatore e premi{*CONTROLLER_VK_RT*}. - + Se vuoi maggiori informazioni su un oggetto, spostaci sopra il puntatore e premi{*CONTROLLER_ACTION_MENU_PAGEDOWN*} . + Ora premi{*CONTROLLER_VK_B*} per uscire dall'inventario della modalità Creativa. @@ -2608,6 +2956,211 @@ Durante il volo, puoi tenere premuto{*CONTROLLER_ACTION_JUMP*} per salire e{*CON Premi{*CONTROLLER_VK_B*} se sai già come funzionano la barra del cibo e l'alimentazione. + + Questa è l'interfaccia dell'inventario del cavallo. + + + + {*B*}Premi{*CONTROLLER_VK_A*} per continuare. + {*B*}Premi{*CONTROLLER_VK_B*} se sai già usare l'inventario del cavallo. + + + + L'inventario del cavallo ti consente di trasferire o equipaggiare oggetti per il tuo cavallo, asino o mulo. + + + + Sella il tuo cavallo inserendo una sella nel relativo slot. Puoi far indossare una corazza a un cavallo collocandola nel relativo slot. + + + + In questo menu puoi anche trasferire oggetti tra l'inventario e le borse da sella sulla groppa di asini e muli. + + +Hai trovato un cavallo. + +Hai trovato un asino. + +Hai trovato un mulo. + + + {*B*}Premi{*CONTROLLER_VK_A*} per saperne di più su cavalli, asini e muli. + {*B*}Premi{*CONTROLLER_VK_B*} se sai già tutto su cavalli, asini e muli. + + + + Cavalli e asini si trovano principalmente nelle pianure, mentre i muli nascono dall'accoppiamento tra un asino e un cavallo, ma ricorda che sono sterili e non potranno riprodursi a loro volta. + + + + Puoi cavalcare tutti i cavalli, i muli e gli asini adulti, ma puoi far indossare una corazza soltanto ai cavalli, mentre asini e muli possono essere dotati di una borsa da sella per il trasporto di oggetti. + + + + Prima di poter cavalcare un cavallo, un asino o un mulo, è necessario domarlo tentando di cavalcarlo e resistendo mentre cerca di disarcionarti. + + + + Quando compaiono dei cuori e non tenta più di farti finire a terra, significa che è stato domato. + + + + Ora prova a cavalcare questo cavallo. Usa {*CONTROLLER_ACTION_USE*} senza impugnare oggetti o attrezzi per salirgli in groppa. + + + + Per controllare un cavallo, devi dotarlo di una sella, che puoi acquistare dagli abitanti dei villaggi o trovare nelle casse sparse per il mondo. + + + + Puoi mettere una borsa da sella su un asino o un mulo domato assicurandovi una cassa. Potrai accedere alle borse da sella mentre cavalchi o sei in modalità furtiva. + + + + Cavalli e asini (non i muli) possono essere allevati come gli altri animali, usando mele d'oro o carote d'oro. Col passare del tempo, i puledri diventeranno cavalli adulti, ma puoi velocizzare il processo nutrendoli con fieno o grano. + + + + Qui puoi provare a domare cavalli e asini; inoltre, troverai selle, corazze e altre oggetti utili nelle casse. + + + + Questa è l'interfaccia del segnale, che puoi usare per scegliere i poteri conferiti dai tuoi segnali. + + + + {*B*}Premi{*CONTROLLER_VK_A*} per continuare. + {*B*}Premi{*CONTROLLER_VK_B*} se sai già usare l'inventario del segnale. + + + + Nel menu del segnale, puoi selezionare un potere principale: più livelli possiede la piramide, maggiore sarà il numero di poteri tra cui scegliere. + + + + Un segnale su una piramide con almeno quattro livelli offre inoltre il potere secondario Rigenerazione o un potere principale rafforzato. + + + + Per impostare i poteri del tuo segnale, devi sacrificare un lingotto di smeraldo, diamante, oro o ferro nello slot di pagamento. Una volta impostati, i poteri saranno emanati dal segnale senza scadenze o limiti. + + +Sulla cima di questa piramide c'è un segnale inattivo. + + + {*B*}Premi{*CONTROLLER_VK_A*} per saperne di più sui segnali. + {*B*}Premi{*CONTROLLER_VK_B*} se sai già tutto sui segnali. + + + + I segnali attivi proiettano un raggio di luce nel cielo, conferendo poteri speciali ai giocatori nelle vicinanze. Per produrli servono vetro, ossidiana e stelle del Sottomondo, le quali si ottengono sconfiggendo l'Avvizzito. + + + + I segnali devono essere collocati in modo tale che siano colpiti dalla luce del sole durante il giorno; inoltre vanno posti su piramidi di ferro, oro, smeraldo o diamante. Il materiale su cui è collocato il segnale non influisce sul suo potere. + + + + Prova a usare il segnale per impostare il potere concesso: per il pagamento, puoi usare i lingotti di ferro che ti abbiamo fornito. + + +Questa stanza contiene dei vagoncini + + + {*B*}Premi{*CONTROLLER_VK_A*} per saperne di più sui vagoncini. + {*B*}Premi{*CONTROLLER_VK_B*} se sai già tutto sui vagoncini. + + + + I vagoncini si usano per inserire o rimuovere oggetti dai contenitori e per raccogliere automaticamente gli oggetti che vi vengono riposti. + + + + Possono influire su Banchi di distillazione, casse, distributori, sganci, carrelli con casse, carrelli con vagoncini e altri vagoncini. + + + + I vagoncini tentano continuamente di estrarre oggetti da un contenitore adatto posizionato sopra di essi. Inoltre, cercheranno di inserire gli oggetti in essi riposti in un contenitore di scarico. + + + + Se un vagoncino funziona grazie a una pietra rossa, si disattiverà e smetterà di prelevare e consegnare oggetti. + + + + Il vagoncino punta nella direzione in cui cerca di scaricare gli oggetti. Per rivolgere un vagoncino verso un blocco particolare, posizionalo a ridosso di tale blocco mentre ti muovi furtivamente. + + + + In questa stanza puoi sperimentare diverse configurazioni di vagoncini. + + + + Questa è l'interfaccia dei fuochi d'artificio, che si usa per produrre i fuochi d'artificio e le relative stelle. + + + + {*B*}Premi{*CONTROLLER_VK_A*} per continuare. + {*B*}Premi{*CONTROLLER_VK_B*} se sai già usare l'inventario dei fuochi d'artificio. + + + + Per produrre un fuoco d'artificio, inserisci polvere da sparo e carta nella griglia di produzione 3x3 al di sopra dell'inventario. + + + + Se lo desideri, puoi inserire alcune stelle Fuoco d'artificio nella griglia di produzione, per aggiungerle al fuoco d'artificio. + + + + Più caselle occupi con la polvere da sparo, maggiore sarà l'altezza a cui esploderanno le stelle Fuoco d'artificio. + + + + Quando vuoi produrre il fuoco d'artificio, prendilo dalla casella di produzione. + + + + Per produrre le stelle Fuoco d'artificio, inserisci polvere da sparo e tintura nella griglia di produzione. + + + + La tintura stabilisce il colore dell'esplosione della stella Fuoco d'artificio. + + + + Per decidere la forma della stella Fuoco d'artificio, aggiungi una scarica di fuoco, una pepita d'oro, una piuma o una testa. + + + + Puoi aggiungere uno scintillio usando diamanti e polvere di pietra brillante. + + + + Una volta creata una stella Fuoco d'artificio, puoi stabilirne il colore di dissolvenza usando la tintura. + + + + In queste casse ci sono vari oggetti usati nella produzione di FUOCHI D'ARTIFICIO! + + + + {*B*}Premi{*CONTROLLER_VK_A*} per saperne di più sui fuochi d'artificio. + {*B*}Premi{*CONTROLLER_VK_B*} se sai già tutto sui fuochi d'artificio. + + + + I fuochi d'artificio sono oggetti decorativi che possono essere lanciati manualmente o dai distributori. Si producono usando carta, povere da sparo e alcune stelle Fuoco d'artificio (facoltative). + + + + Colori, dissolvenza, forma, dimensione ed effetti (come scia o scintillii) delle stelle Fuoco d'artificio possono essere personalizzati includendo ingredienti aggiuntivi durante la produzione. + + + + Prova a realizzare un fuoco d'artificio al tavolo da lavoro usando gli ingredienti che trovi nelle casse. + +  Seleziona Usa @@ -2830,6 +3383,22 @@ Durante il volo, puoi tenere premuto{*CONTROLLER_ACTION_JUMP*} per salire e{*CON Carica salvataggio per Xbox One +Sali + +Scendi + +Posiziona cassa + +Lancia + +Guinzaglio + +Rilascia + +Attacca + +Nomina + OK Annulla @@ -3068,7 +3637,7 @@ Vuoi sbloccare il gioco completo? Disconnesso -Sei tornato alla schermata iniziale perché il tuo profilo giocatore si è disconnesso +Sei tornato alla schermata iniziale perché il tuo profilo giocatore si è disconnesso. Difficoltà @@ -3140,6 +3709,20 @@ Vuoi sbloccare il gioco completo? Dispenser +Cavallo + +Sgancio + +Vagoncino + +Segnale + +Potere principale + +Potere secondario + +Carrello da miniera + Nessuna offerta di contenuto scaricabile disponibile per questo titolo al momento. %s si unisce alla partita. @@ -3299,10 +3882,14 @@ Vuoi installare uno dei due pacchetti ora? Modalità: Creativa +Modalità: Avventura + Sopravvivenza Creativa +Avventura + In modalità Sopravvivenza In modalità Creativa @@ -3323,6 +3910,8 @@ Vuoi installare uno dei due pacchetti ora? Superpiatto +Inserisci un seme per generare di nuovo lo stesso terreno. Lascia vuoto per un mondo casuale. + Se attivato, il gioco sarà un gioco online. Se attivato, i giocatori potranno unirsi solo su invito. @@ -3347,6 +3936,20 @@ Vuoi installare uno dei due pacchetti ora? Se l'opzione è abilitata, vicino al punto di generazione del giocatore apparirà una cassa contenente alcuni oggetti utili. +Se disattivato, impedisce a mostri e animali di cambiare i blocchi (per esempio, le esplosioni dei creeper non distruggono i blocchi e le pecore non brucano erba) o di raccogliere oggetti. + +Se attivo, i giocatori mantengono il proprio inventario quando muoiono. + +Se disattivato, i nemici non vengono generati naturalmente. + +Se disattivato, mostri e animali non rilasciano bottino (per esempio, i creeper non rilasciano polvere da sparo). + +Se disattivato, i blocchi non rilasciano oggetti quando vengono distrutti (per esempio, i blocchi di pietra non rilasciano ciottoli). + +Se disattivato, la salute dei giocatori non si rigenera naturalmente. + +Se disattivato, l'ora del giorno non cambia. + Pacchetti di skin Temi @@ -3395,7 +3998,49 @@ Vuoi installare uno dei due pacchetti ora? {*PLAYER*} è stato pestato a morte da {*SOURCE*} -{*PLAYER*} è stato ucciso da {*SOURCE*} +{*PLAYER*} è stato ucciso da {*SOURCE*} con la magia + +{*PLAYER*} è caduto da una scala + +{*PLAYER*} è caduto dai rampicanti + +{*PLAYER*} è caduto fuori dall'acqua + +{*PLAYER*} è caduto da una grande altezza + +{*SOURCE*} ha condannato {*PLAYER*} alla caduta + +{*SOURCE*} ha condannato {*PLAYER*} alla caduta + +{*SOURCE*} ha condannato {*PLAYER*} alla caduta usando {*ITEM*} + +{*PLAYER*} è caduto troppo lontano ed è stato fatto fuori da {*SOURCE*} + +{*PLAYER*} è caduto troppo lontano ed è stato fatto fuori da {*SOURCE*} usando {*ITEM*} + +{*PLAYER*} è finito nel fuoco mentre affrontava {*SOURCE*} + +{*PLAYER*} è finito arrosto mentre affrontava {*SOURCE*} + +{*PLAYER*} ha cercato di nuotare nella lava per sfuggire a {*SOURCE*} + +{*PLAYER*} è annegato mentre cercava di sfuggire a {*SOURCE*} + +{*PLAYER*} è finito contro un cactus mentre cercava di sfuggire a {*SOURCE*} + +{*SOURCE*} ha fatto esplodere {*PLAYER*} + +{*PLAYER*} è avvizzito + +{*SOURCE*} ha massacrato {*PLAYER*} usando {*ITEM*} + +{*SOURCE*} ha sparato a {*PLAYER*} usando {*ITEM*} + +{*SOURCE*} ha lanciato una sfera di fuoco a {*PLAYER*} usando {*ITEM*} + +{*SOURCE*} ha preso a pugni {*PLAYER*} usando {*ITEM*} + +{*SOURCE*} ha ucciso {*PLAYER*} usando {*ITEM*} Nebbia substrato roccioso @@ -3560,9 +4205,9 @@ Vuoi installare uno dei due pacchetti ora? Non ripristinare il Sottomondo -Impossibile tosare il muccafungo al momento. Hai raggiunto il numero massimo di maiali, pecore, mucche e gatti. +Impossibile tosare il muccafungo al momento. Hai raggiunto il numero massimo di maiali, pecore, mucche, gatti e cavalli. -Impossibile usare l'uovo generazione al momento. Hai raggiunto il numero massimo di maiali, pecore, mucche e gatti. +Impossibile usare l'uovo generazione al momento. Hai raggiunto il numero massimo di maiali, pecore, mucche, gatti e cavalli. Impossibile usare l'uovo generazione al momento. Hai raggiunto il numero massimo di muccafunghi. @@ -3572,6 +4217,8 @@ Vuoi installare uno dei due pacchetti ora? Impossibile usare l'uovo generazione al momento. Hai raggiunto il numero massimo di calamari. +Impossibile usare l'uovo generazione al momento. È stato raggiunto il numero massimo di pipistrelli per mondo. + Impossibile usare Uovo rigenerazione al momento. È stato raggiunto il numero massimo di nemici nel mondo. Impossibile usare Uovo rigenerazione al momento. È stato raggiunto il numero massimo di villici nel mondo. @@ -3580,12 +4227,14 @@ Vuoi installare uno dei due pacchetti ora? Non puoi generare nemici in modalità Relax. -Questo animale non può entrare in "modalità Amore". Hai raggiunto il numero massimo di maiali, pecore, mucche e gatti. +Questo animale non può entrare in "modalità Amore". Hai raggiunto il numero massimo di maiali, pecore, mucche, gatti e cavalli. Questo animale non può entrare in "modalità Amore". Hai raggiunto il numero massimo di riproduzione di lupi. Questo animale non può entrare in "modalità Amore". Hai raggiunto il numero massimo di riproduzione di galline. +Questo animale non può entrare in "modalità Amore". Hai raggiunto il numero massimo di riproduzione di cavalli. + Questo animale non può entrare in "modalità Amore". Hai raggiunto il numero massimo di riproduzione di muccafunghi. È stato raggiunto il numero massimo di navi per mondo. @@ -3613,27 +4262,43 @@ Vuoi installare uno dei due pacchetti ora? Riconoscimenti Reinstalla contenuto - + Impostazioni debug - + Diffusione incendio - + Esplosione TNT - + Giocatore vs Giocatore - + Autorizza giocatori - + Privilegi dell'host - + Genera strutture - + Mondo superpiatto - + Cassa bonus - + Opzioni mondo - + +Opzioni di gioco + +Immutabilità + +Mantieni inventario + +Generazione mostri + +Bottino mostri + +Rilascio blocchi + +Rigenerazione naturale + +Ciclo giorno/notte + Può costruire e scavare Può usare porte e interruttori @@ -3820,6 +4485,14 @@ Vuoi installare uno dei due pacchetti ora? Veleno +Avvizzito + +Bonus salute + +Assorbimento + +Saturazione + della Velocità della Lentezza @@ -3858,6 +4531,14 @@ Vuoi installare uno dei due pacchetti ora? del Veleno +del decadimento + +del bonus salute + +dell'assorbimento + +della saturazione + II @@ -3954,6 +4635,22 @@ Vuoi installare uno dei due pacchetti ora? Riduce progressivamente la salute di giocatori, animali e mostri affetti. +Quando applicato: + +Forza salto cavallo + +Rinforzi zombie + +Salute massima + +Distanza inseguimento mostri + +Resistenza ad atterramento + +Velocità + +Danno attacco + Acutezza Percossa @@ -4044,7 +4741,7 @@ Vuoi installare uno dei due pacchetti ora? Fa recuperare 3 {*ICON_SHANK_01*}. Si crea cucinando una patata nella fornace. -Reintegra 1 {*ICON_SHANK_01*}, o si può cucinare nella fornace. Si può piantare sulle zolle. Può avvelenarti. +Fa recuperare 1 {*ICON_SHANK_01*}. Può avvelenarti. Reintegra 3 {*ICON_SHANK_01*}. Si realizza usando una carota e delle pepite d'oro. @@ -4092,7 +4789,7 @@ Vuoi installare uno dei due pacchetti ora? Muro di ciottoli -Muro di ciottoli coperto di muschio +Muro di ciottoli muschiato Vaso di fiori diff --git a/Minecraft.Assets/XboxMedia/loc/ja-JP/4J_strings.resx b/Minecraft.Assets/XboxMedia/loc/ja-JP/4J_strings.resx index 63927afe3..5ef7111d5 100644 --- a/Minecraft.Assets/XboxMedia/loc/ja-JP/4J_strings.resx +++ b/Minecraft.Assets/XboxMedia/loc/ja-JP/4J_strings.resx @@ -73,9 +73,9 @@ Xbox LIVE にサインインしていません -このゲームの一部の機能では、Xbox LIVE にサインインしているゲーマー プロフィールが必要となります。現在は Xbox LIVE にサインインしていません +このゲームの一部の機能では、Xbox LIVE にサインインしているゲーマー プロフィールが必要となります。現在は Xbox LIVE にサインインしていません。 -この機能を使うには、Xbox LIVE にサインインしているゲーマー プロフィールが必要です +この機能を使うには、Xbox LIVE にサインインしているゲーマー プロフィールが必要です。 Xbox LIVE にサインイン @@ -100,7 +100,7 @@ 完全版を購入 これは Minecraft のお試し版です。完全版であれば、今すぐ獲得できる実績があります! -完全版を購入して、Xbox LIVE を通じて世界中のフレンドと一緒に遊べるMinecraft の楽しさを体験してください。 +完全版を購入して、Xbox LIVE を通じて世界中のフレンドと一緒に遊べる Minecraft の楽しさを体験してください。 完全版を購入しますか? プロフィールの読み込みに問題が発生したため、メイン メニューに戻ります diff --git a/Minecraft.Assets/XboxMedia/loc/ja-JP/strings.resx b/Minecraft.Assets/XboxMedia/loc/ja-JP/strings.resx index 132435fbf..5326fb118 100644 --- a/Minecraft.Assets/XboxMedia/loc/ja-JP/strings.resx +++ b/Minecraft.Assets/XboxMedia/loc/ja-JP/strings.resx @@ -159,7 +159,7 @@ Minecraft は自由な発想でブロックを積み上げて、探検したり 経験値ゲージも画面に表示され、現在の経験値レベルと次のレベルまでに必要な値を確認できます。 経験値は、生き物を倒した時、特定のブロックを採掘した時、動物を繁殖させた時、釣り、かまどで鉱石を製錬した時などに獲得できる経験値オーブを集めると貯まっていきます。{*B*}{*B*} さらに使用できるアイテムも表示され、{*CONTROLLER_ACTION_LEFT_SCROLL*} と {*CONTROLLER_ACTION_RIGHT_SCROLL*} で手に持つアイテムを切り替えられます -{{*T3*}遊び方: 持ち物{*ETW*}{*B*}{*B*} +{*T3*}遊び方: 持ち物{*ETW*}{*B*}{*B*} 持ち物は {*CONTROLLER_ACTION_INVENTORY*} で見ることができます。{*B*}{*B*} この画面では、手にしている使用可能なアイテム、所有しているアイテムのリスト、現在装備している防具を確認できます。{*B*}{*B*} ポインターを {*CONTROLLER_MENU_NAVIGATE*} で動かして、アイテムに合わせてから {*CONTROLLER_VK_A*} を押すと、アイテムを選択できます。そのアイテムを複数所有している場合は、そのすべてが選択されます。半分だけ選択するには {*CONTROLLER_VK_X*} を使用します。{*B*}{*B*} @@ -231,7 +231,7 @@ Minecraft は自由な発想でブロックを積み上げて、探検したり エンチャントに必要な経験値は、不足している場合は赤、足りている場合は緑で表示されます。{*B*}{*B*} エンチャントは消費可能な経験値の範囲でランダムに選択されます。{*B*}{*B*} エンチャントテーブルの周囲に、テーブルとブロック 1 つ分のすき間を空けて本棚 (最大 15 台) を並べることで、エンチャントのレベルが上がります。また本棚からテーブル上の本に向けて文字が流れ込むエフェクトが表示されます。{*B*}{*B*} -エンチャントテーブルに必要な材料はすべて村や採掘、農耕などで手に入ります。{*B*}{*B} +エンチャントテーブルに必要な材料はすべて村や採掘、農耕などで手に入ります。{*B*}{*B*} エンチャントした本は金床を使ってアイテムをエンチャントすることができます。これによりアイテムにより多くのエンチャントを選択することができます{*B*} @@ -280,9 +280,9 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに {*CONTROLLER_ACTION_DPAD_LEFT*} で左に、{*CONTROLLER_ACTION_DPAD_RIGHT*} で右に飛べます {*T3*}遊び方: ホストとプレイヤーのオプション{*ETW*}{*B*}{*B*} - + {*T1*}ゲーム オプション{*ETW*}{*B*} -世界をロードまたは生成する際、[その他のオプション] を選択して、より詳細な設定ができるようになりました。{*B*}{*B*} +世界をロードまたは生成する際、[その他のオプション] を選択して、さらに詳細な設定ができるようになりました。{*B*}{*B*} {*T2*}PvP{*ETW*}{*B*} 有効にすると、プレイヤーが他のプレイヤーにダメージを与えられるようになります (サバイバル モードのみ)。{*B*}{*B*} @@ -299,6 +299,27 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに {*T2*}ホスト特権{*ETW*}{*B*} 有効にすると、ホストの飛行能力、疲労無効、ゲーム内メニューでの非表示を切り替えられます。{*DISABLES_ACHIEVEMENTS*}{*B*}{*B*} + {*T2*}時刻の変化{*ETW*}{*B*} + 無効にすると、時刻が変わりません。{*B*}{*B*} + + {*T2*}持ち物の保持{*ETW*}{*B*} + 有効にすると、ゲームオーバー時にプレイヤーの持ち物が失われません。{*B*}{*B*} + + {*T2*}生き物の出現{*ETW*}{*B*} + 無効にすると、生き物は自然に出現しません。{*B*}{*B*} + + {*T2*}生き物による妨害{*ETW*}{*B*} + 無効にすると、モンスターや動物がブロックを変更したり (例: Creeper が爆発してもブロックが破壊されない、羊が草を取り除かない)、アイテムを拾いません。{*B*}{*B*} + + {*T2*}生き物からの戦利品{*ETW*}{*B*} + 無効にすると、モンスターや動物は戦利品をドロップしません (例: Creeper は火薬をドロップしない)。{*B*}{*B*} + + {*T2*}タイルからのアイテム入手{*ETW*}{*B*} + 無効にすると、ブロックを壊してもアイテムを落としません (例: 石ブロックが丸石を落とさない)。{*B*}{*B*} + + {*T2*}自然再生{*ETW*}{*B*} + 無効にすると、プレイヤーの HP は自然に再生されません。{*B*}{*B*} + {*T1*}世界の生成のオプション{*ETW*}{*B*} 世界の生成にオプションが追加されました。{*B*}{*B*} @@ -315,7 +336,7 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに 有効にすると暗黒界を再生成します。暗黒砦が存在しないセーブ データがある場合に便利です{*B*}{*B*} {*T1*}ゲーム内のオプション{*ETW*}{*B*} - ゲーム中に BACK を押すと、様々なオプション メニューを開くことができます。{*B*}{*B*} + ゲーム中に {*BACK_BUTTON*} を押すと、様々なオプション メニューを開くことができます。{*B*}{*B*} {*T2*}ホスト オプション{*ETW*}{*B*} ホストプレイヤーと [ホストオプションを変更できる] に設定されたプレイヤーは [ホスト オプション] メニューを使用できます。このメニューでは火の延焼や TNT の爆発などを切り替えることができます。{*B*}{*B*} @@ -333,7 +354,7 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに [高度な操作を許可] を無効にしている場合のみ使えるオプションです。無効にすると、このゲームに参加したプレイヤーはチェストなどの入れ物を使用できません。{*B*}{*B*} {*T2*}プレイヤーを攻撃可能{*ETW*}{*B*} - [高度な操作を許可] を無効にしている場合のみ使えるオプションです。無効にすると、プレイヤーが他のプレイヤーにダメージを与えられなくなります。{*B*}{*B*} + [高度な操作を許可] を無効にしている場合のみ使えるオプションです。無効にすると、プレイヤーが他のプレイヤーにダメージを与えられなくなります。{*B*}{*B*} {*T2*}動物を攻撃可能{*ETW*}{*B*} [高度な操作を許可] を無効にしている場合のみ使えるオプションです。無効にすると、プレイヤーが動物にダメージを与えられなくなります。{*B*}{*B*} @@ -342,12 +363,12 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに この設定を有効にすると、そのプレイヤーは「高度な操作を許可」が無効の場合に、ホストを除く他のプレイヤーの特権や、プレイヤーの追放、火の延焼と TNT の爆発の設定ができるようになります。{*B*}{*B*} {*T2*}プレイヤーを追放{*ETW*}{*B*} - ホストプレイヤーと同じ {*PLATFORM_NAME*} を使用していないプレイヤーに対してこのオプションを選択すると、そのプレイヤーおよび対象プレイヤーと同じ {*PLATFORM_NAME*} を使用している他のプレイヤーがゲームから追放されます。追放されたプレイヤーは、ゲームが再起動されるまでは再び参加できません。{*B*}{*B*} + {*KICK_PLAYER_DESCRIPTION*}*}{*B*}{*B*} {*T1*}ホストプレイヤー オプション{*ETW*}{*B*} [ホスト特権] が有効の場合、ホストプレイヤーは自分に特権を設定できます。ホスト特権を変更するには、プレイヤー名を選択して {*CONTROLLER_VK_A*} で特権のメニューを開き、次のオプションを設定してください。{*B*}{*B*} - - {*T2*}飛行可能{*ETW*}{*B*} + + {*T2*}飛行可能{*ETW*}{*B*} 有効にすると、飛行できるようになります。クリエイティブ モードでは全プレイヤーが飛行できるため、サバイバル モードにのみ適用されます。{*B*}{*B*} {*T2*}疲労無効{*ETW*}{*B*} @@ -356,10 +377,13 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに {*T2*}不可視{*ETW*}{*B*} 有効にするとプレイヤーは他のプレイヤーから見えなくなり、ダメージも受けなくなります。{*B*}{*B*} - {*T2*テレポート可能{*ETW*}{*B*} - 自分や他のプレイヤーを世界にいる他のプレイヤーの場所に移動することができます + {*T2*}テレポート可能{*ETW*}{*B*} + 自分や他のプレイヤーを世界にいる他のプレイヤーの場所に移動することができます。 + +ホストプレイヤーと同じ {*PLATFORM_NAME*} を使用していないプレイヤーに対してこのオプションを選択すると、そのプレイヤーおよび対象プレイヤーと同じ {*PLATFORM_NAME*} を使用している他のプレイヤーがゲームから追放されます。追放されたプレイヤーは、ゲームが再起動されるまでは再び参加できません + 次へ 前へ @@ -423,61 +447,94 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに 最新情報 -{*T3*}修正と追加{*ETW*}{*B*}{*B*} -- 新しいアイテムを追加しました。エメラルド、エメラルド鉱石、エメラルドのブロック、エンダー チェスト、トリップワイヤー フック、エンチャントした金のリンゴ、金床、植木鉢、丸石の壁、苔の生えた丸石の壁、ウィザーの絵、ジャガイモ、ベイクド ポテト、有毒なジャガイモ、ニンジン、金のニンジン、棒付きのニンジン -パンプキン パイ、暗視のポーション、不可視のポーション、闇のクォーツ、闇のクォーツ鉱石、クォーツのブロック、クォーツの厚板、クォーツの階段、模様入りのクォーツのブロック、柱状のクォーツのブロック、エンチャントした本、カーペット。{*B*} -- なめらかな砂岩と模様入りの砂岩の新しいレシピを追加しました。{*B*} -- 新しい生物、村人ゾンビを追加しました。{*B*} -- 新しい地形生成機能を追加しました。砂漠の神殿、砂漠の村、ジャングルの神殿。{*B*} -- 村人との取引を追加しました。{*B*} -- 金床の画面を追加しました。{*B*} -- 革のアーマーを染色できます。{*B*} -- オオカミの首輪を染色できます。{*B*} -- 棒付きのニンジンで乗り物の豚を操縦できます。{*B*} -- ボーナス チェスト コンテンツのアイテムを増やしました。{*B*} -- ハーフブロックとハーフブロック上のその他のハーフブロックの配置を変更しました。{*B*} -- 上下逆の階段と厚板の配置を変更しました。{*B*} -- 異なる村人の職業を追加しました。{*B*} -- スポーン エッグから出現した村人の職業がランダムになります。{*B*} -- 横道の丸太の配置を追加しました。{*B*} -- 木の道具をかまどの燃料として使用できます。{*B*} -- 氷板とガラス板を技能でエンチャントした道具で回収できます。{*B*} -- 木のボタンと木のプレッシャー プレートを矢で起動できます。{*B*} -- 闇の生物が地上界のポータルから発生します。{*B*} -- Creeperとクモが、最後に攻撃してきたプレイヤーに対して攻撃的になります。{*B*} -- クリエイティブ モードの生物が短時間で中立に戻ります。{*B*} -- 溺れている時のノックバックを排除しました。{*B*} -- ゾンビに壊されているドアのダメージが表示されます。{*B*} -- 暗黒界では氷が溶けます。{*B*} -- 雨が降っている時に大釜を外に出すと一杯になります。{*B*} -- ピストンの更新に 2 倍の時間がかかります。{*B*} -- 豚を殺すと鞍を落とします (鞍を着けている場合)。{*B*} -- 果ての世界の空の色を変更しました。{*B*} -- ひも (トップワイヤー用) を付けることができます。{*B*} -- 雨が葉の間をしたたり落ちます。{*B*} -- ブロックの下にレバーを付けることができます。{*B*} -- 難易度設定によって TNT がさまざまなダメージを与えます。{*B*} -- 本のレシピを変更しました。{*B*} -- スイレンの葉がボートを壊す代わりに、ボートがスイレンの葉を壊します。{*B*} -- 豚の落とす豚肉を増やしました。{*B*} -- スーパーフラットで発生するスライムを減らしました。{*B*} -- Creeper のダメージ変数が難易度設定に基づき、ノックバックを増やしました。{*B*} -- Endermanがアゴを開かないという問題を修正しました。{*B*} -- プレイヤーのテレポートを追加しました (ゲーム内の BACK メニューを使用)。{*B*} -- リモート プレイヤー用の飛行、不可視、不死身の新しいホスト オプションを追加しました。{*B*} -- 新しいアイテムと機能のチュートリアルを追加しました。{*B*} -- チュートリアルの音楽ディスク チェストの位置を変更しました{*B*} - + +{*T3*}修正と追加{*ETW*}{*B*}{*B*} +- 新しいアイテムを追加しました。堅焼き粘土、色付き粘土、石炭のブロック、干し草の俵、アクティベーター レール、レッドストーンのブロック、日照センサー、ドロッパー、ホッパー、ホッパー付きトロッコ、TNT 付きトロッコ、レッドストーン コンパレーター、重量感知板、ビーコン、トラップ チェスト、ロケット花火、花火の星、ネザー スター、首ひも、馬よろい、名札、馬のスポーン エッグを追加しました。{*B*} +- 新しい生き物、ウィザー、ウィザー スケルトン、ウィッチ、コウモリ、馬、ロバ、およびラバを追加しました。{*B*} +- 新しい地形生成機能、ウィッチの小屋を追加しました。{*B*} +- ビーコンのインターフェイスを追加しました。{*B*} +- 馬のインターフェイスを追加しました。{*B*} +- ホッパーのインターフェイスを追加しました。{*B*} +- 花火を追加しました。花火のインターフェイスには、花火の星またはロケット花火を作るための材料を所持している場合、作業台からアクセスすることができます。{*B*} +- 「アドベンチャー モード」を追加しました。ブロックは正しいツールでのみ壊すことができます。{*B*} +- 新しいサウンドを多数追加しました。{*B*} +- 生き物、アイテム、発射物も、ポータルを通れるようになりました。{*B*} +- リピーターに横から別のリピーターで電源を送ることで、ロックできるようになりました。{*B*} +- ゾンビとスケルトンは異なった武器と防具を装備して出現するようになりました。{*B*} +- 新しいゲームオーバー メッセージ。{*B*} +- 名札を使って生き物に名前を付けたり、メニューを開いた状態で入れ物の名前を変えてタイトルを変更します。{*B*} +- 骨粉を使ってもすべてが瞬時に成長しなくなりました。成長はランダムに段階的になります。{*B*} +- チェスト、調合台、発射装置、ジュークボックスの中身を示すレッドストーン信号は、レッドストーン コンパレーターをそちらに向けて直接設置すれば検出できます。{*B*} +- 発射装置はどの方向にも向けることができます。{*B*} +- 金のリンゴを食べると、プレイヤーは短時間、追加の「吸収」HP を獲得できます。{*B*} +- 一定のエリアに長くいればいるほど、そのエリアで出現するモンスターの難易度が上がります。{*B*} {*ETB*}ようこそ! まだお気づきでないかもしれませんが、Minecraft がアップデートされました。{*B*}{*B*} ここでご紹介しているのは、フレンドと一緒に遊べる新機能のほんの一部です。よく読んで楽しく遊んでください!{*B*}{*B*} -{*T1*}新アイテム{*ETB*} - エメラルド、エメラルド鉱石、エメラルドのブロック、エンダー チェスト、トリップワイヤー フック、エンチャントした金のリンゴ、金床、植木鉢、丸石の壁、苔の生えた丸石の壁、ウィザーの絵、ジャガイモ、ベイクド ポテト、有毒なジャガイモ、ニンジン、金のニンジン、棒付きのニンジン、 -パンプキン パイ、暗視のポーション、不可視のポーション、闇のクォーツ、闇のクォーツ鉱石、クォーツのブロック、クォーツの厚板、クォーツの階段、模様入りのクォーツのブロック、柱状のクォーツのブロック、エンチャントした本、カーペット。{*B*}{*B*} - {*T1*}新しい生物{*ETB*} - 村人ゾンビ。{*B*}{*B*} -{*T1*}新機能{*ETB*} - 村人との取引、金床での武器と道具の修理またはエンチャント、エンダー チェストにアイテムを保管、棒付きニンジンを使って乗った豚の操縦!{*B*}{*B*} -{*T1*}新しいミニチュートリアル{*ETB*} ? チュートリアルの新機能を紹介!{*B*}{*B*} -{*T1*}新しい「イースター エッグ」{*ETB*} ? チュートリアルの秘密の音楽ディスクを移動しました。もう一度見つけ出してみましょう!{*B*}{*B*} - +{*T1*}新アイテム{*ETB*} - 堅焼き粘土、色付き粘土、石炭のブロック、干し草の俵、アクティベーター レール、レッドストーンのブロック、日照センサー、ドロッパー、ホッパー、ホッパー付きトロッコ、TNT 付きトロッコ、レッドストーン コンパレーター、重量感知板、ビーコン、トラップ チェスト、ロケット花火、花火の星、ネザー スター、首ひも、馬よろい、名札、馬のスポーン エッグ{*B*}{*B*} + {*T1*}新しい生き物{*ETB*} - ウィザー、ウィザー スケルトン、ウィッチ、コウモリ、馬、ロバ、およびラバ{*B*}{*B*} +{*T1*}新機能{*ETB*} - 馬の手なづけと騎乗、花火の作製とショーの催し、名札による動物とモンスターの名付け、さらに高度なレッドストーン回路の作成、そして新しいホスト オプションによる自世界でゲストができることの管理!{*B*}{*B*} +{*T1*}新しいチュートリアル{*ETB*} チュートリアルで新旧機能の使い方を学びましょう。世界に隠された秘密の音楽ディスクをすべて見つけられるでしょうか。{*B*}{*B*} + + + + +{*T3*}使い方: 馬{*ETW*}{*B*}{*B*} +馬とロバは、主に草原で見られます。ラバはロバと馬から生まれますが、それ自体では繁殖しません。{*B*} +馬、ロバ、ラバの成体には乗ることができます。ただし、よろいを着けられるのは馬のみで、アイテムを運ぶために鞍袋を着けられるのはロバとラバのみです。{*B*}{*B*} +馬、ロバ、ラバを利用するには、最初に手なずける必要があります。騎乗して、振り落とされそうになっても乗り続けると、手なずけることができます。{*B*} +馬の周りにハートが表示されると手なずけ完了で、以降はプレイヤーを振り落とさなくなります。 馬を操縦するには鞍を置く必要があります。{*B*}{*B*} +鞍は村人から購入する、または世界の中に隠されたチェスト内に見つけることができます。{*B*} +手なずけたロバとラバにチェストを装着すれば鞍袋を背負わせることができます。この鞍袋には、騎乗またはしのび足している間にアクセスできます。{*B*}{*B*} +馬とロバ (ラバは除く) は、他の動物と同様に金のリンゴまたは金のニンジンを使って繁殖させることが可能です。{*B*} +子馬や子ロバは時間の経過とともに成長しますが、小麦または干し草を与えれば成長が早まります。{*B*} + + +ビーコン + +{*T3*}使い方: ビーコン{*ETW*}{*B*}{*B*} +アクティブなビーコンは、明るい光線を空へ放ち、近くにいるプレイヤーにパワーを与えます。{*B*} +作るには、ガラス、黒曜石、ウィザーを倒すことで手に入るネザー スターを使います。{*B*}{*B*} +ビーコンは、日中に日光が当たる場所に配置する必要があります。また、ビーコンは鉄、金、エメラルド、またはダイヤモンドのピラミッドの上に配置する必要があります。{*B*} +どの建材上にビーコンを配置するかは、ビーコンのパワーに影響しません。{*B*}{*B*} +ビーコン メニューで、ビーコンのプライマリ パワーを 1 つ選択することができます。ピラミッドの階層が増えるほど、パワーの選択肢が増えます。{*B*} +少なくとも 4 段以上のピラミッド上に配置されたビーコンでは、「回復」のセカンダリ パワーか、さらに強力なプライマリ パワーも選択可能になります。{*B*}{*B*} +ビーコンのパワーを設定するには、支払いスロットでエメラルド、ダイヤモンド、金または鉄のインゴットのいずれかを消費しなければなりません。{*B*} +設定が済むと、ビーコンからのパワーは無限に発せられます。{*B*} + + +花火 + +{*T3*}使い方: 花火{*ETW*}{*B*}{*B*} +花火は装飾アイテムで、手動、または発射装置から打ち上げることができます。作るには、紙、火薬、オプションとして数々の花火の星を使用します。{*B*} +花火の星の色、色変化、形状、サイズ、効果 (例: 光跡、点滅) は、作成時に追加の材料を含めることでカスタマイズできます。{*B*}{*B*} +花火を作るには、火薬と紙を持ち物の上に表示される 3x3 のクラフト グリッドに置きます。{*B*} +オプションとして、クラフト グリッド上に複数の花火の星を置いて、花火に加えることもできます。{*B*} +クラフト グリッドのスロットに置く火薬が多くなれば、花火の星はより高い位置で破裂します。{*B*}{*B*} +作った花火は、取り出し口から取り出せます。{*B*}{*B*} +花火の星は、火薬と染料をクラフト グリッドに置くと作れます。{*B*} + - 染料は、花火の星が破裂する際の色を設定します。{*B*} + - 花火の星の形状は、発火剤、金塊、羽根、または生き物のヘッドを追加することで設定します。{*B*} + - 光跡や点滅は、ダイヤモンドまたはグロウストーンの粉を使うことで追加できます。{*B*}{*B*} +花火の星を作った後、さらに染料を加えることで、花火の星の色変化を決めることもできます。 + + +ホッパー + +{*T3*}使い方: ホッパー{*ETW*}{*B*}{*B*} +ホッパーは、入れ物にアイテムを出し入れするために、また、その上に投げられたアイテムを自動的に拾うのに使います。{*B*} +ホッパーは調合台、チェスト、発射装置、ドロッパー、チェスト付きトロッコ、ホッパー付きトロッコ、および他のホッパーに対して作用させることができます。{*B*}{*B*} +ホッパーは、その上に位置する適切な入れ物からアイテムを吸い出し続けます。また、保管されたアイテムを出力先の入れ物に格納しようとします。{*B*} +レッドストーンが電源の場合、ホッパーは非アクティブになり、アイテムの吸い出しも格納も停止します。{*B*}{*B*} +ホッパーは向いている方向にアイテムを出します。ホッパーが特定のブロックに向くようにするには、そのブロックに向けてしのび足でホッパーを設置します。 {*B*} + + +ドロッパー + +{*T3*}使い方: ドロッパー{*ETW*}{*B*}{*B*} +レッドストーンが電源の場合、ドロッパーは格納しているアイテムをランダムに 1 つ、地上にドロップします。{*CONTROLLER_ACTION_USE*} を使ってドロッパーを開くと、自分の持ち物からアイテムをドロッパーに投入することができます。{*B*} +ドロッパーがチェストまたは他の種類の入れ物に面している場合、アイテムはドロッパーではなく、そちらへ投入されます。ドロッパーを多数つなげて設置すれば、離れた場所との間でアイテムを運べます。そのように動作させるには、電源を交互にオンとオフにする必要があります。 + 手よりも攻撃力が高い @@ -503,7 +560,7 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに 装備するとアーマーポイント +1 -装備するとアーマーポイント +3 +装備するとアーマーポイント +3。 装備するとアーマーポイント +2 @@ -513,7 +570,7 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに 装備するとアーマーポイント +5 -装備するとアーマーポイント +4 +装備するとアーマーポイント +4。 装備するとアーマーポイント +1 @@ -529,17 +586,17 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに 装備するとアーマーポイント +5 -装備するとアーマーポイント +3 +装備するとアーマーポイント +3。 装備するとアーマーポイント +1 -装備するとアーマーポイント +3 +装備するとアーマーポイント +3。 装備するとアーマーポイント +8 装備するとアーマーポイント +6 -装備するとアーマーポイント +3 +装備するとアーマーポイント +3。 光沢を放つ延べ棒、道具を作る材料として使う。かまどで鉱石を精錬して作る @@ -604,19 +661,45 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに 手に持っていると、探索済みのエリアの地図を表示する。道を確認するのに使う +使用すると、プレイヤーの世界内での現在位置周辺の地図になる。探検するにつれて図面が埋まっていく + 矢を射る攻撃ができる 弓と組み合わせて、武器として使う -2.5{*ICON_SHANK_01*} 回復する +ウィザーが落とす。ビーコンを作るのに使う。 + +作動すると、色とりどりの火花を作り出す。その色、形状、色変化は、花火を作る際に使う花火の星によって決まる。 + +花火の色、効果、形状を決めるために使う。 + +レッドストーン回路で、信号強度を維持、比較、または減算したり、特定のブロックの状態を測定したりするために使う。 + +移動する TNT ブロックとして機能する、トロッコの一種。 + +日光 (またはその不足) に応じてレッドストーン信号を出力するブロック。 + +ホッパーと同じように機能する特別な種類のトロッコ。軌道上に落ちているアイテムや、上に位置する入れ物からのアイテムを収集する。 + +馬に装着できる特別な種類の防具。防御力 +5。 + +馬に装着できる特別な種類の防具。防御力 +7。 + +馬に装着できる特別な種類の防具。防御力 +11。 + +生き物をプレイヤーまたはフェンスの柱につなぐために使う。 + +世界内の生き物に名前をつけるのに使う。 + +2.5{*ICON_SHANK_01*} 回復する。 -1{*ICON_SHANK_01*} 回復する。6 回まで使用できる +1{*ICON_SHANK_01*} 回復する。6 回まで使用できる。 -1{*ICON_SHANK_01*} 回復する +1{*ICON_SHANK_01*} 回復する。 -1{*ICON_SHANK_01*} 回復する +1{*ICON_SHANK_01*} 回復する。 -3{*ICON_SHANK_01*} 回復する +3{*ICON_SHANK_01*} 回復する。 1{*ICON_SHANK_01*} 回復する。かまどで調理することも可能。病気になる場合もある @@ -634,7 +717,7 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに 2.5{*ICON_SHANK_01*} 回復する。生魚をかまどで調理するとできる -2{*ICON_SHANK_01*} 回復する。金のリンゴの材料となる +2{*ICON_SHANK_01*} 回復する。金のリンゴの材料となる。 2{*ICON_SHANK_01*} 回復し、さらに HP が 4 秒間、自動回復する。リンゴと金の塊から作る @@ -659,7 +742,7 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに 電源が入っている時、上を走るトロッコを加速させる。電源が入っていない時は、上でトロッコが止まる -トロッコ専用の重量感知板として機能する。電源が入っている時にレッドストーンの信号を送る +トロッコ専用の重量感知板として機能する。電源が入っている時にレッドストーンの信号を送る。 プレイヤーや動物、モンスターを乗せて、レールの上を移動できる @@ -716,7 +799,7 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに 本や地図を作るのに使う -本棚を作るのに使ったり、エンチャントしてエンチャントした本を作るために使う +本棚を作るのに使ったり、エンチャントしてエンチャントした本を作るために使う。 エンチャントテーブルの周囲に置いて、より強力なエンチャントを作る @@ -932,100 +1015,158 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに ヘッド類は飾り付けとして並べたり、ヘルメットのスロットからマスクとして着用もできる +コマンドを実行するのに使う。 + +空に向けて光線を放ち、付近のプレイヤーにステータス効果をもたらすことができる。 + +中にブロックとアイテムを保管する。2 つのチェストを隣同士に置くと、容量 2 倍の大きなチェストを作ることができる。トラップ チェストは開いた時に、レッドストーン電源も供給する。 + +レッドストーンによる電源を供給する。板上のアイテムが多いほど、チャージは強力になる。 + +レッドストーンによる電源を供給する。板上のアイテムが多いほど、チャージは強力になる。軽量板よりも重さを必要とする。 + +レッドストーン電源として使う。レッドストーンに作り戻すことができる。 + +アイテムの受け取り、または入れ物からのアイテムの出し入れに使われる。 + +レールの一種。ホッパー付きトロッコを有効または無効にしたり、TNT 付きトロッコを動作させたりできる。 + +アイテムを保管または落とすのに使われる。レッドストーン電源がある場合には、他の入れ物へアイテムを移すのにも使える。 + +カラフルなブロック。堅焼き粘土を染色して作る。 + +馬、ロバ、またはラバに餌として与えることができ、10 ハートまで回復させる。子馬や子ロバの成長を早める効果もある。 + +かまどの中で粘土を精錬して作られる。 + +ガラスと染料から作られる。 + +ステンドグラスから作られる。 + +木炭を保管するのに使える。かまどで燃料として使用することができる + イカ - + 倒すと墨袋を落とす - + - + 倒すと革を落とす。バケツがあればミルクも取れる - + - + 毛を刈るときウールを落とす (毛が残っている場合)。ウールはいろいろな色に染められる - + ニワトリ - + 倒すと羽根を落とす。タマゴを持っている場合もある - + - + 倒すと豚肉を落とす。鞍があれば乗ることもできる - + オオカミ - + 普段はおとなしいが、攻撃すると反撃してくる。骨を使うと手なずけることができ、プレイヤーについて回って、プレイヤーを攻撃してくる敵を攻撃してくれる - + Creeper - + 近づきすぎると爆発する! - + ガイコツ - + 矢を放ってくる。倒すと矢を落とす - + クモ - + 近づくと攻撃してくる。壁を登ることができる。倒すと糸を落とす - + ゾンビ - + 近づくと攻撃してくる - + ゾンビ Pigman - + 最初はおとなしいが、1 匹を攻撃すると集団で反撃してくる - + Ghast - + 当たると爆発する火の玉を放ってくる - + スライム - + ダメージを与えると、小さなスライムに分裂する - + Enderman - + 照準を向けると攻撃してくる。ブロックを移動できる - + Silverfish - + 攻撃すると、近くに隠れている Silverfish も集まってくる。石ブロックの中に隠れている - + 洞窟グモ - + 牙に毒がある - + Mooshroom - + 空のおわんを使うときのこシチューが採れる。ハサミで毛刈りをするときのこを落とすが、普通の牛になってしまう - + スノー ゴーレム - + 雪ブロックとカボチャで作れるゴーレム。作った人の敵に向かって雪玉を投げつける - + エンダー ドラゴン - + 果ての世界に存在する大きな黒竜 - + Blaze - + 暗黒界に出現する敵。主に暗黒砦内にいる。倒すと Blaze ロッドを落とす - + マグマ キューブ - + 暗黒界に出現する。Slime 同様、倒すと小さな Lava Slime に分裂する - + 村人 - + ヤマネコ - + ジャングルに生息。生魚を与えて飼い慣らせる。不意な動きに驚いてすぐに逃げるため、接近するのは簡単ではない - + アイアン ゴーレム - + 村に出現して村人を守ってくれる。鉄のブロックとカボチャで作ることもできる - + +コウモリ + +この空飛ぶ生き物は、洞窟やその他の大きな閉じた空間で見つかる。 + +ウィッチ + +この敵は沼地で見られ、ポーションを投げて攻撃してくる。倒すとポーションを落とす。 + + + +この動物は手なずけて、乗ることができる。 + +ロバ + +この動物は手なずけて、乗ることができる。チェストを装着することもできる。 + +ラバ + +馬とロバの交配によって生まれる。この動物は手なずけて、乗ったり、チェストを運ばせたりすることができる。 + +馬のゾンビ + +馬のスケルトン + +ウィザー + +ウィザー スカルとソウル サンドから作られる。爆発するスカルを撃ってくる。 + Explosives Animator Concept Artist @@ -1372,6 +1513,8 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに 地図 +空っぽの地図 + 音楽ディスク: 13 音楽ディスク: cat @@ -1474,6 +1617,28 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに Creeper ヘッド +ネザースター + +ロケット花火 + +花火の星 + +レッドストーン コンパレーター + +TNT 付きトロッコ + +ホッパー付きトロッコ + +鉄の馬よろい + +金の馬よろい + +ダイヤモンドの馬よろい + +首ひも + +名札 + 草ブロック @@ -1490,6 +1655,8 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに ジャングルの木の板 + 木の板 (全種類) + 苗木 樫の苗木 @@ -1826,6 +1993,190 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに スカル +コマンド ブロック + +ビーコン + +トラップ チェスト + +重量感知板 (軽) + +重量感知板 (重) + +レッドストーン コンパレーター + +日照センサー + +レッドストーンのブロック + +ホッパー + +アクティベーター レール + +ドロッパー + +色付き粘土 + +干し草の俵 + +堅焼き粘土 + +石炭のブロック + +黒の色付き粘土 + +赤の色付き粘土 + +緑の色付き粘土 + +茶色の色付き粘土 + +青の色付き粘土 + +紫の色付き粘土 + +青緑の色付き粘土 + +薄灰色の色付き粘土 + +灰色の色付き粘土 + +ピンクの色付き粘土 + +黄緑の色付き粘土 + +黄色の色付き粘土 + +空色の色付き粘土 + +赤紫の色付き粘土 + +オレンジの色付き粘土 + +白の色付き粘土 + +ステンドグラス + +黒のステンドグラス + +赤のステンドグラス + +緑のステンドグラス + +茶色のステンドグラス + +青のステンドグラス + +紫のステンドグラス + +赤紫のステンドグラス + +薄灰色のステンドグラス + +灰色のステンドグラス + +ピンクのステンドグラス + +黄緑のステンドグラス + +黄色のステンドグラス + +空色のステンドグラス + +赤紫のステンドグラス + +オレンジのステンドグラス + +白のステンドグラス + +ステンドグラス窓 + +黒のステンドグラス窓 + +赤のステンドグラス窓 + +緑のステンドグラス窓 + +茶色のステンドグラス窓 + +青のステンドグラス窓 + +紫のステンドグラス窓 + +赤紫のステンドグラス窓 + +薄灰色のステンドグラス窓 + +灰色のステンドグラス窓 + +ピンクのステンドグラス窓 + +黄緑のステンドグラス窓 + +黄色のステンドグラス窓 + +空色のステンドグラス窓 + +赤紫のステンドグラス窓 + +オレンジのステンドグラス窓 + +白のステンドグラス窓 + +小玉 + +大玉 + +星形 + +Creeper 形 + +破裂 + +未知の形 + + + + + + + +茶色 + + + + + +青緑 + +薄灰色 + +灰色 + +ピンク + +黄緑 + +黄色 + +空色 + +赤紫 + +オレンジ + + + +カスタム + +変化後の色 + +点滅 + +光跡 + +滞空時間: +  現在の操作方法 レイアウト @@ -2003,8 +2354,7 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに これがあなたの持ち物です。手で持って使用できるアイテムと、所有しているアイテムのリスト、現在装備している防具を確認できます - - + {*B*} 持ち物の説明を続ける: {*CONTROLLER_VK_A*}{*B*} 持ち物の説明を飛ばす: {*CONTROLLER_VK_B*} @@ -2025,7 +2375,7 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに - アイテムの説明を見たい時は、ポインターをアイテムの上に動かしてから {*CONTROLLER_VK_RT*} を押してください + アイテムの説明を見たい時は、ポインターをアイテムの上に動かしてから {*CONTROLLER_ACTION_MENU_PAGEDOWN*} を押してください @@ -2060,7 +2410,7 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに - アイテムの説明を見たい時は、ポインターをアイテムの上に動かしてから {*CONTROLLER_VK_RT*} を押します + アイテムの説明を見たい時は、ポインターをアイテムの上に動かしてから {*CONTROLLER_ACTION_MENU_PAGEDOWN*} を押してください @@ -2442,7 +2792,7 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに - ポータルを起動するには、火打石と打ち金で、フレーム内の黒曜石に火をつけましょう。枠が壊れたり、近くで爆発が起きたり、液体を流したりすると、ポータルは停止します + ポータルを起動するには、火打石と打ち金で、フレーム内の黒曜石に火をつけましょう。枠が壊れたり、近くで爆発が起きたり、液体を流したりすると、ポータルは停止します。 @@ -2607,6 +2957,211 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに すでに十分知っている場合は {*CONTROLLER_VK_B*} を押してください。 + + これは馬のインベントリ インターフェイスです。 + + + + {*B*}続行するには {*CONTROLLER_VK_A*} を押します。 + {*B*}馬のインベントリの使い方を既に知っている場合は、{*CONTROLLER_VK_B*} を押します。 + + + + 馬のインベントリを使うと、自分の馬、ロバ、またはラバにアイテムを移したり、装備させたりすることができます。 + + + + 馬に鞍をのせるには、鞍スロットに鞍を置きます。防具スロットに馬よろいを置けば、馬に防具を装備させることもできます。 + + + + このメニューでは、自分の持ち物とロバまたはラバに装着した鞍袋との間で、アイテムを移動することもできます。 + + +馬を見つけました。 + +ロバを見つけました。 + +ラバを見つけました。 + + + {*B*}馬、ロバ、ラバについてもっと知るには {*CONTROLLER_VK_A*} を押します。 + {*B*}馬、ロバ、ラバについて既に知っている場合は、{*CONTROLLER_VK_B*} を押します。 + + + + 馬とロバは主にひらけた草原で見つかります。ラバはロバと馬から繁殖できますが、それ自体では子を産みません。 + + + + 馬、ロバ、ラバの成体には乗ることができます。ただし防具を装備できるのは馬だけです。アイテムを運搬するための鞍袋を着けられるのはラバとロバだけです。 + + + + 馬、ロバ、ラバは使う前に手なずける必要があります。騎乗して、振り落とされそうになっても乗り続ければ、手なずけることができます。 + + + + 手なずけると周りにハートが表示されて、二度とプレイヤーを振り落とそうとはしません。 + + + + この馬に乗ってみましょう。騎乗するには、手にアイテムやツールは何も持たないで {*CONTROLLER_ACTION_USE*} を使います。 + + + + 馬を操縦するには鞍を置く必要があります。鞍は村人から購入するか、世界のどこかに隠されたチェストの中から見つかります。 + + + + 手なずけたロバとラバに鞍袋を着けるにはチェストを取り付けます。鞍袋にアクセスできるのは、騎乗時またはしのび足している時です。 + + + + 馬とロバ (ラバは除く) は、他の動物と同様に金のリンゴや金のニンジンを使って繁殖することができます。子馬や子ロバは時間とともに成体になりますが、小麦か干し草を与えると成長が早まります。 + + + + ここでは馬とロバを手なずけてみることができます。この周辺のチェストには鞍や馬よろいなどの便利な馬用アイテムもあります。 + + + + これはビーコンのインターフェイスです。これを使うとビーコンに割り当てるパワーを選択できます。 + + + + {*B*}続行するには {*CONTROLLER_VK_A*} を押します。 + {*B*}ビーコンのインターフェイスの使い方を既に知っている場合は、{*CONTROLLER_VK_B*} を押します。 + + + + ビーコン メニューでは、ビーコンに割り当てるプライマリ パワーを 1 つ選択できます。ピラミッドの階層が増えると、パワーの選択肢も増えます。 + + + + 少なくとも 4 層以上のピラミッドに置かれたビーコンには、追加オプションとして「回復」のセカンダリ パワーか、さらに強力なプライマリ パワーが付与されます。 + + + + ビーコンのパワーを設定するには、エメラルド、ダイヤモンド、金または鉄のインゴットを支払いスロットで消費する必要があります。一度設定すると、ビーコンはパワーを無限に発します。 + + +このピラミッドの頂上には、アクティブでないビーコンがある。 + + + {*B*}ビーコンについてもっと知るには {*CONTROLLER_VK_A*} を押します。 + {*B*}ビーコンについて既に知っている場合は、{*CONTROLLER_VK_B*} を押します。 + + + + アクティブなビーコンは空に向けて明るい光線を放ち、付近のプレイヤーにパワーを与えます。ビーコンはガラス、黒曜石、ウィザーを倒すと入手できるネザースターから作ります。 + + + + ビーコンは、昼間に日光を受ける場所に設置する必要があります。また、ビーコンは鉄、金、エメラルド、またはダイヤモンドのピラミッド上に設置しなければなりません。ただし建材の違いによるビーコンのパワーへの影響はありません。 + + + + ビーコンを使って、そこから与えるパワーを設定してみましょう。必要な支払いには鉄のインゴットを使うことができます。 + + +この部屋にはホッパーがある + + + {*B*}ホッパーについてもっと知るには {*CONTROLLER_VK_A*} を押します。 + {*B*}ホッパーについて既に知っている場合は、{*CONTROLLER_VK_B*} を押します。 + + + + ホッパーは入れ物にアイテムを出し入れするために、またはホッパー上に投げられたアイテムを自動的に拾うために使います。 + + + + ホッパーは調合台、チェスト、発射装置、ドロッパー、チェスト付きトロッコ、ホッパー付きトロッコ、および他のホッパーに対して作用できます。 + + + + ホッパーは、その上に位置する適切な入れ物からアイテムを吸い出し続けます。また、保管されたアイテムを出力先の入れ物に格納します。 + + + + しかし、レッドストーンが電源の場合、ホッパーは非アクティブになり、アイテムの吸い出しも格納も停止します。 + + + + ホッパーの向きはアイテムを排出する方向を示します。ホッパーが特定のブロックに向くようにするには、しのび足しながらそのブロックに向けて設置します。 + + + + この部屋には様々な役立つホッパーのレイアウトが用意してあり、目で見て試せます。 + + + + これは花火のインターフェイスです。これを使えば花火と、花火の星を作ることができます。 + + + + {*B*}続行するには {*CONTROLLER_VK_A*} を押します。 + {*B*}花火のインターフェイスの使い方を既に知っている場合は、{*CONTROLLER_VK_B*} を押します。 + + + + 花火を作るには、火薬と紙をインベントリの上に表示される 3x3 のクラフト グリッドに置きます。 + + + + オプションとして、クラフト グリッド上に複数の花火の星を置いて、花火に追加することもできます。 + + + + クラフト グリッドのスロットに火薬を多く置くほど、花火の星はさらに高いところで破裂します。 + + + + 作った花火は、作りたい時にいつでも取り出し口から取り出せます。 + + + + 花火の星を作るには、火薬と染料をクラフト グリッドに置きます。 + + + + 染料を使って、花火の星が破裂する際の色を決めます。 + + + + 花火の星の形状は、発火剤、金塊、羽根、またはヘッドを追加して決定します。 + + + + 光跡や点滅は、ダイヤモンドまたはグロウストーンの粉を使って追加できます。 + + + + 花火の星を作った後、さらに染料を加えれば、花火の星の色変化を決められます。 + + + + ここにあるチェストの中には、花火作りに使われる様々なアイテムが入っています! + + + + {*B*}花火についてもっと知るには {*CONTROLLER_VK_A*} を押します。 + {*B*}花火について既に知っている場合は、{*CONTROLLER_VK_B*} を押します。 + + + + 花火は装飾アイテムで、手動、または発射装置から打ち上げることができます。作るには、紙、火薬、およびオプションとして数々の花火の星を使います。 + + + + 花火の星の色、色変化、形状、サイズ、効果 (光跡、点滅など) は、作る際に材料を追加すればでカスタマイズできます。 + + + + チェストにあるいろいろな材料を使って、作業台で花火を作ってみましょう。 + +  選択 使う @@ -2829,6 +3384,22 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに Xbox One 用にセーブをアップロード +騎乗する + +降りる + +チェストを着ける + +打ち上げる + +首ひもをつける + +首ひもをはずす + +装着する + +名前をつける + OK キャンセル @@ -3143,6 +3714,20 @@ Minecraft Xbox 360 版は、初期設定でマルチプレイヤー ゲームに 発射装置 + + +ドロッパー + +ホッパー + +ビーコン + +プライマリ パワー + +セカンダリ パワー + +トロッコ + 現在、このタイプのダウンロード コンテンツはありません %s が世界にやってきました @@ -3302,10 +3887,14 @@ OK を選択すると、この世界でのプレイを終了します ゲームモード: クリエイティブ +ゲーム モード: アドベンチャー + サバイバル クリエイティブ +アドベンチャー + サバイバル モードで作成 クリエイティブ モードで作成 @@ -3326,6 +3915,8 @@ OK を選択すると、この世界でのプレイを終了します スーパーフラット +同じ地形を再度生成するには種を入れます。ランダムな世界の場合、空欄のままにします。 + 有効にすると、オンラインのゲームになります 有効にすると、招待されたプレイヤーしか参加できません @@ -3350,6 +3941,20 @@ OK を選択すると、この世界でのプレイを終了します 有効にすると、プレイヤーの復活地点の近くに便利なアイテムの入ったチェストが出現します +無効にすると、モンスターや動物がブロックを変えることがなくなり (例: Creeper が爆発してもブロックが破壊されない、羊が草を取り除かない)、アイテムも拾いません。 + +有効にすると、ゲームオーバー時にプレイヤーの持ち物が失われません。 + +無効にすると、生き物は自然に出現しません。 + +無効にすると、モンスターや動物は戦利品をドロップしません (例: Creeper は火薬をドロップしない)。 + +無効にすると、ブロックを壊してもアイテムを落としません (例: 石ブロックが丸石を落とさない)。 + +無効にすると、プレイヤーの HP を自然に再生されません。 + +無効にすると、時刻が変わりません。 + スキン パック テーマ @@ -3398,7 +4003,49 @@ OK を選択すると、この世界でのプレイを終了します {*PLAYER*} は {*SOURCE*} に叩き潰された -{*PLAYER*} は {*SOURCE*} に倒された +{*PLAYER*} は {*SOURCE*} の魔法によって倒された + +{*PLAYER*} はハシゴから落ちた + +{*PLAYER*} は、つるから落ちた + +{*PLAYER*} は水から落ちた + +{*PLAYER*} は高いところから落ちた + +{*PLAYER*} は {*SOURCE*} によって滅びる運命にあった + +{*PLAYER*} は {*SOURCE*} によって滅びる運命にあった + +{*PLAYER*} は {*SOURCE*} の {*ITEM*} によって滅びる運命にあった + +{*PLAYER*} はあまりに高いところから落ち、{*SOURCE*} にとどめを刺された + +{*PLAYER*} はあまりに高いところから落ち、{*SOURCE*} に {*ITEM*} でとどめを刺された + +{*PLAYER*} は {*SOURCE*} と戦ううちに火の中へと進んで行った + +{*PLAYER*} は {*SOURCE*} と戦ううちにカリカリに焼かれた + +{*PLAYER*} は {*SOURCE*} から逃れるために溶岩の中を泳ごうとした + +{*PLAYER*} は {*SOURCE*} から逃れようとするうちに溺れた + +{*PLAYER*} は {*SOURCE*} から逃れようとするうちにサボテンに足を踏み入れた + +{*PLAYER*} は {*SOURCE*} に吹き飛ばされた + +{*PLAYER*} は弱り果てた + +{*PLAYER*} は {*SOURCE*} に {*ITEM*} で倒された + +{*PLAYER*} は {*SOURCE*} に {*ITEM*} で撃たれた + +{*PLAYER*} は {*SOURCE*} に {*ITEM*} で火だるまにされた + +{*PLAYER*} は {*SOURCE*} に {*ITEM*} で火だるまにされた + +{*PLAYER*} は {*SOURCE*} に {*ITEM*} で倒された 岩盤の霧 @@ -3552,7 +4199,7 @@ OK を選択すると、この世界でのプレイを終了します {*C2*}「そして僕が君を愛するのは、君自身が愛であるからだ」{*EF*}{*B*}{*B*} {*C3*}ゲームは終わり、プレイヤーは夢から目覚め、また新しい夢が始まります。次にプレイヤーが見る夢はもっと素晴らしいものでしょう。プレイヤーは宇宙であり、愛でした{*EF*}{*B*}{*B*} {*C3*}さあ、プレイヤー{*EF*}{*B*}{*B*} -{*C2*}目を覚まして{*EF*}{*B*}{*B*} +{*C2*}目を覚まして{*EF*} 暗黒界をリセットする @@ -3563,9 +4210,9 @@ OK を選択すると、この世界でのプレイを終了します 暗黒界をリセットしない -現在、Mooshroom は毛刈りできません。豚、羊、牛、ネコの数が最大数に達しました。 +現在、Mooshroom は毛刈りできません。豚、羊、牛、ネコ、馬の数が最大数に達しました。 -現在、スポーン エッグを使用できません。 豚、羊、牛、ネコの数が最大数に達しました +現在、スポーン エッグを使用できません。 豚、羊、牛、ネコ、馬の数が最大数に達しました。 現在、スポーン エッグを使用できません。 Mooshroom の数が最大数に達しました @@ -3575,6 +4222,8 @@ OK を選択すると、この世界でのプレイを終了します 現在、スポーン エッグを使用できません。 世界のイカの数が最大数に達しました +現在、スポーン エッグを使用できません。 世界の村人の数が最大数に達しました + 現在、スポーン エッグを使用できません。 世界の敵の数が最大数に達しました 現在、スポーン エッグを使用できません。 世界の村人の数が最大数に達しました @@ -3583,12 +4232,14 @@ OK を選択すると、この世界でのプレイを終了します 難易度「ピース」では敵を出現させることはできません。 -この動物は求愛モードにできません。豚、羊、牛、ネコの繁殖数が最大数に達しました +この動物は求愛モードにできません。豚、羊、牛、ネコ、馬の繁殖数が最大数に達しました。 この動物は求愛モードにできません。オオカミの繁殖数が最大数に達しました この動物は求愛モードにできません。ニワトリの繁殖数が最大数に達しました +この動物は求愛モードにできません。馬の繁殖数が最大数に達しました。 + この動物は求愛モードにできません。Mooshroom の繁殖数が最大数に達しました 世界のボートの数が最大数に達しました @@ -3616,27 +4267,43 @@ OK を選択すると、この世界でのプレイを終了します クレジット コンテンツを再インストール - + デバッグ設定 - + 火の延焼 - + TNT の爆発 - + PvP - + 高度な操作を許可 - + ホスト特権 - + 建物を生成する - + スーパーフラット - + ボーナス チェスト - + 世界のオプション - + +ゲーム オプション + +生き物による妨害 + +持ち物の保持 + +生き物の出現 + +生き物からの戦利品 + +タイルからのアイテム入手 + +自然再生 + +時刻の変化 + 建設と採掘の許可 ドアとスイッチを使用可能 @@ -3647,7 +4314,7 @@ OK を選択すると、この世界でのプレイを終了します 動物を攻撃可能 -ホストオプションを変更できる +ホストオプションを変更可能 プレイヤーを追放 @@ -3675,7 +4342,7 @@ OK を選択すると、この世界でのプレイを終了します 世界の種 -ランダムに種を決める場合、空白のままにしてください +空白のままで種をランダムに決定する プレイヤー @@ -3697,17 +4364,17 @@ OK を選択すると、この世界でのプレイを終了します ゲームに戻る -セーブ +ゲームをセーブ 難易度: -ゲームタイプ: +ゲーム タイプ: ゲーマータグ: 建物: -レベルタイプ: +レベル タイプ: PvP: @@ -3823,6 +4490,14 @@ OK を選択すると、この世界でのプレイを終了します +ウィザー + +HP ブースト + +吸収 + +飽和 + スピードの 鈍化の @@ -3861,6 +4536,14 @@ OK を選択すると、この世界でのプレイを終了します 毒の + (衰弱) + + (HP ブースト) + + (吸収) + + (飽和) + II @@ -3957,6 +4640,22 @@ OK を選択すると、この世界でのプレイを終了します プレイヤー、動物、モンスターの HP を時間とともに減少させます +適用時: + +馬のジャンプ強さ + +ゾンビの援軍 + +最大 HP + +生き物による追尾範囲 + +ノックバック耐性 + +スピード + +攻撃ダメージ + 鋭さ 聖なる力 @@ -4047,13 +4746,13 @@ OK を選択すると、この世界でのプレイを終了します 3{*ICON_SHANK_01*} 回復する。ジャガイモをかまどで調理するとできる -1{*ICON_SHANK_01*} 回復する。かまどで調理することも可能。農地に植えることができる。病気になる場合がある +1{*ICON_SHANK_01*} 回復する。病気になる場合がある 3{*ICON_SHANK_01*} 回復する。ニンジンと金の塊から作る 鞍を着けた豚に乗った時、操縦するのに使う -4{*ICON_SHANK_01*} 回復する +4{*ICON_SHANK_01*} 回復する。 武器、道具、防具をエンチャントするのに金床と一緒に使用する @@ -4445,7 +5144,7 @@ OK を選択すると、この世界でのプレイを終了します Xbox 360 -Back +戻る このオプションでは、実績およびランキング更新は無効になります。 diff --git a/Minecraft.Assets/XboxMedia/loc/ko-KR/4J_strings.resx b/Minecraft.Assets/XboxMedia/loc/ko-KR/4J_strings.resx index a084ef5d9..dfa720ac9 100644 --- a/Minecraft.Assets/XboxMedia/loc/ko-KR/4J_strings.resx +++ b/Minecraft.Assets/XboxMedia/loc/ko-KR/4J_strings.resx @@ -73,11 +73,11 @@ 게이머 프로필이 오프라인 상태입니다. -이 게임 기능 중 일부는 게이머 프로필로 Xbox Live에 로그인해야 이용할 수 있습니다. 현재는 오프라인 상태입니다. +이 게임 기능 중 일부는 게이머 프로필로 Xbox LIVE에 로그인해야 이용할 수 있습니다. 현재는 오프라인 상태입니다. -이 기능을 이용하려면 게이머 프로필로 Xbox Live에 로그인해야 합니다. +이 기능을 이용하려면 게이머 프로필로 Xbox LIVE에 로그인해야 합니다. -Xbox Live 연결 +Xbox LIVE 연결 오프라인으로 계속하기 diff --git a/Minecraft.Assets/XboxMedia/loc/ko-KR/strings.resx b/Minecraft.Assets/XboxMedia/loc/ko-KR/strings.resx index 17c67711e..6516a2f4b 100644 --- a/Minecraft.Assets/XboxMedia/loc/ko-KR/strings.resx +++ b/Minecraft.Assets/XboxMedia/loc/ko-KR/strings.resx @@ -150,7 +150,7 @@ Minecraft는 블록을 배치하여 무엇이든 상상한 대로 만들 수 있 {*CONTROLLER_ACTION_LOOK*}으로 주위를 둘러봅니다.{*B*}{*B*} {*CONTROLLER_ACTION_MOVE*}으로 주변을 이동합니다.{*B*}{*B*} {*CONTROLLER_ACTION_JUMP*}를 누르면 점프합니다.{*B*}{*B*} -{*CONTROLLER_ACTION_MOVE*}을 앞으로 빠르게 두 번 누르면 질주합니다. {*CONTROLLER_ACTION_MOVE*}를 계속 누르고 있으면 질주 시간이 다 되거나 음식 막대가 {*ICON_SHANK_03*} 이하가 될 때까지 계속 질주합니다. +{*CONTROLLER_ACTION_MOVE*}을 앞으로 빠르게 두 번 누르면 질주합니다. {*CONTROLLER_ACTION_MOVE*}를 계속 누르고 있으면 질주 시간이 다 되거나 음식 막대가 {*ICON_SHANK_03*} 이하가 될 때까지 계속 질주합니다.{*B*}{*B*} {*CONTROLLER_ACTION_ACTION*}를 누르고 있으면 손이나 도구를 사용해 채굴하거나 벌목합니다. 특정 블록을 채굴하려면 도구를 만들어야 할 수 있습니다.{*B*}{*B*} 손에 아이템을 들고 있다면 {*CONTROLLER_ACTION_USE*}를 눌러 사용하거나 {*CONTROLLER_ACTION_DROP*}를 눌러 버릴 수 있습니다. @@ -229,11 +229,11 @@ HUD는 체력이나 산소(물속에 있을 때), 배고픔 레벨(배고픔을 {*T3*}플레이 방법: 효과부여{*ETW*}{*B*}{*B*} 괴물 및 동물을 처치하거나 또는 특정 블록을 채굴하거나 녹여서 얻을 수 있는 경험치로 도구, 무기 및 방어구에 효과를 부여할 수 있습니다.{*B*} -검, 활, 도끼, 곡괭이, 삽 또는 방어구를 효과부여대에 놓인 책 아래에 있는 슬롯에 넣으면 슬롯 오른쪽에 각각 경험치 비용이 쓰인 단추 세 개가 나타납니다.{*B*} +검, 활, 도끼, 곡괭이, 삽 또는 방어구를 효과부여대에 놓인 책 아래에 있는 슬롯에 넣으면 슬롯 오른쪽에 각각 경험치 비용이 쓰인 단추 세 개가 나타납니다.{*B*} 효과부여에 필요한 경험치가 모자란 항목은 빨간색으로 나타나며, 그렇지 않다면 초록색으로 나타납니다.{*B*}{*B*} 실제 효과부여는 표시된 비용에 기반을 두고 무작위로 적용됩니다.{*B*}{*B*} 효과부여대가 한 블록 간격을 두고 책장에 둘러싸여 있으면(최대 책장 15개까지) 효과부여 레벨이 상승하며, 효과부여대에 놓인 책에 신비한 문양이 나타납니다.{*B*}{*B*} -효과부여대를 만들 때 쓰이는 모든 재료는 월드 안의 마을에서 찾거나 월드 안에서 채굴 및 경작을 통해 얻을 수 있습니다.{*B*} +효과부여대를 만들 때 쓰이는 모든 재료는 월드 안의 마을에서 찾거나 월드 안에서 채굴 및 경작을 통해 얻을 수 있습니다.{*B*}{*B*} 효과부여 책은 모루에서 아이템에 효과를 부여하는 데 사용합니다. 이것으로 아이템에 더 효율적으로 효과를 부여할 수 있습니다.{*B*} @@ -281,9 +281,9 @@ Xbox 360 본체용 Minecraft는 멀티 플레이 게임이 기본값으로 되 {*CONTROLLER_ACTION_DPAD_LEFT*}를 누르면 왼쪽으로 이동하고 {*CONTROLLER_ACTION_DPAD_RIGHT*}를 누르면 오른쪽으로 이동합니다. {*T3*}플레이 방법: 호스트 및 플레이어 옵션{*ETW*}{*B*}{*B*} - + {*T1*}게임 옵션{*ETW*}{*B*} -월드를 불러오거나 새로 만들 때 "추가 옵션" 단추를 누르면 게임의 세부 사항을 조정할 수 있는 메뉴가 열립니다.{*B*}{*B*} +월드를 불러오거나 새로 만들 때 "추가 옵션"을 누르면 게임의 세부 사항을 조정할 수 있는 메뉴가 열립니다.{*B*}{*B*} {*T2*}플레이어 대 플레이어{*ETW*}{*B*} 이 옵션을 켜면 플레이어가 다른 플레이어를 공격할 수 있습니다. 생존 모드에만 적용됩니다.{*B*}{*B*} @@ -300,6 +300,27 @@ Xbox 360 본체용 Minecraft는 멀티 플레이 게임이 기본값으로 되 {*T2*}호스트 특권{*ETW*}{*B*} 이 옵션을 켜면 호스트는 게임 메뉴에서 플레이어에게 비행 능력을 주거나, 지치지 않게 하거나, 투명하게 만들 수 있습니다.{*DISABLES_ACHIEVEMENTS*}{*B*}{*B*} + {*T2*}시간대 전환{*ETW*}{*B*} + 비활성화하면 시간대가 변하지 않습니다.{*B*}{*B*} + + {*T2*}소지품 유지{*ETW*}{*B*} + 활성화하면 플레이어가 죽어도 소지품의 아이템을 잃지 않습니다.{*B*}{*B*} + + {*T2*}괴물 생성{*ETW*}{*B*} + 비활성화하면 괴물이나 동물이 자연적으로 생성되지 않습니다.{*B*}{*B*} + + {*T2*}괴물에 의한 괴롭힘{*ETW*}{*B*} + 비활성화하면 몬스터와 동물이 블록을 교체하거나 아이템을 집지 못하게 합니다. 예를 들어 Creeper가 폭발해도 블록이 파괴되지 않으며, 양은 풀을 제거하지 못합니다.{*B*}{*B*} + + {*T2*}괴물 전리품{*ETW*}{*B*} + 비활성화하면 괴물과 동물이 전리품을 떨어트리지 않습니다. 예를 들어 Creeper가 화약을 떨어트리지 않습니다.{*B*}{*B*} + + {*T2*}타일 아이템{*ETW*}{*B*} + 비활성화하면 블록이 파괴돼도 아이템을 떨어트리지 않습니다. 예를 들어 돌 블록에서 조약돌을 얻을 수 없습니다.{*B*}{*B*} + + {*T2*}자연 재생{*ETW*}{*B*} + 비활성화하면 플레이어의 체력이 자연적으로 재생되지 않습니다.{*B*}{*B*} + {*T1*}월드 생성 옵션{*ETW*}{*B*} 새 월드를 생성할 때 선택할 수 있는 추가 옵션입니다.{*B*}{*B*} @@ -316,13 +337,13 @@ Xbox 360 본체용 Minecraft는 멀티 플레이 게임이 기본값으로 되 이 옵션을 켜면 지하가 재건됩니다. 사전에 지하 요새가 없는 곳에 미리 저장하면 유용합니다.{*B*}{*B*} {*T1*}게임 메뉴 옵션{*ETW*}{*B*} - 게임 플레이 중에 {*BACK_BUTTON*} 단추를 눌러서 게임 메뉴로 이동한 다음 사용할 수 있는 옵션입니다.{*B*}{*B*} + 게임 플레이 중에 {*BACK_BUTTON*}을 눌러 게임 메뉴로 이동한 다음 사용할 수 있는 옵션입니다.{*B*}{*B*} {*T2*}호스트 옵션{*ETW*}{*B*} 호스트 플레이어나 관리자로 설정된 플레이어는 "호스트 옵션" 메뉴에 들어갈 수 있습니다. 이 메뉴에서 불 확산과 TNT 폭발을 켜거나 끌 수 있습니다.{*B*}{*B*} {*T1*}플레이어 옵션{*ETW*}{*B*} -플레이어의 행동 권한을 변경하려면 플레이어 이름을 선택하고 {*CONTROLLER_VK_A*} 단추를 눌러 플레이어 특권 메뉴에서 다음 옵션을 조정하십시오.{*B*}{*B*} +플레이어의 행동 권한을 변경하려면 플레이어 이름을 선택하고 {*CONTROLLER_VK_A*}를 눌러 플레이어 특권 메뉴에서 다음 옵션을 조정하십시오.{*B*}{*B*} {*T2*}건설 및 채광 가능{*ETW*}{*B*} 이 옵션은 "플레이어 신뢰"를 껐을 때만 사용할 수 있습니다. 이 옵션을 켜면 플레이어는 월드에서 일반적인 행동을 모두 할 수 있습니다. 이 옵션을 끄면 플레이어는 블록을 놓거나 파괴하지 못합니다.{*B*}{*B*} @@ -340,27 +361,29 @@ Xbox 360 본체용 Minecraft는 멀티 플레이 게임이 기본값으로 되 이 옵션은 "플레이어 신뢰"를 껐을 때만 사용할 수 있습니다. 이 옵션을 끄면 플레이어는 동물에게 피해를 줄 수 없습니다.{*B*}{*B*} {*T2*}관리자{*ETW*}{*B*} - 이 옵션을 켜면 플레이어는 다른 플레이어의 특권을 변경할 수 있습니다(호스트 제외). “플레이어 신뢰”를 끄면 플레이어를 추방하거나 불 확산과 TNT 폭발을 켜거나 끌 수 있습니다.{*B*}{*B*} + 이 옵션을 켜면 플레이어는 다른 플레이어의 특권을 변경할 수 있습니다(호스트 제외). “플레이어 신뢰”를 끄면 플레이어를 추방하거나 불 확산과 TNT 폭발을 켜거나 끌 수 있습니다.{*B*}{*B*} {*T2*}플레이어 추방{*ETW*}{*B*} 호스트 플레이어와 같은 {*PLATFORM_NAME*} 본체로 플레이하는 플레이어를 제외하고, 이 옵션을 선택하면 다른 {*PLATFORM_NAME*} 본체로 접속하는 플레이어를 추방할 수 있습니다. 추방당한 플레이어는 게임이 새로 시작되기 전까지 다시 참가할 수 없습니다.{*B*}{*B*} - + {*T1*}호스트 플레이어 옵션{*ETW*}{*B*} "호스트 특권" 옵션을 켠 상태에서 호스트 플레이어는 플레이어 특권을 변경할 수 있습니다. 플레이어 특권을 변경하려면 플레이어 이름을 선택하고 {*CONTROLLER_VK_A*}를 눌러 플레이어 특권 메뉴에서 다음 옵션을 조정하십시오.{*B*}{*B*} {*T2*}비행 가능{*ETW*}{*B*} 이 옵션을 켜면 플레이어는 날 수 있습니다. 이 옵션은 생존 모드에서만 적용됩니다(창작 모드에서는 모든 플레이어가 비행 가능).{*B*}{*B*} - + {*T2*}지치지 않음{*ETW*}{*B*} 이 옵션은 생존 모드에서만 적용됩니다. 이 옵션을 켜면 걷기/달리기/점프 등의 행동을 해도 음식 막대가 줄어들지 않습니다. 하지만 플레이어가 상처를 입으면 회복되는 동안 음식 막대가 서서히 줄어듭니다.{*B*}{*B*} - + {*T2*}투명화{*ETW*}{*B*} 이 옵션을 켜면 플레이어는 다른 플레이어의 눈에 보이지 않게 되며 무적 상태가 됩니다.{*B*}{*B*} - - {*T2*}순간이동 가능{*ETW*}{*B*} - 플레이어가 플레이어 자신 또는 다른 플레이어를 월드 내 다른 곳으로 이동시킬 수 있습니다. + + {*T2*}순간이동 가능{*ETW*}{*B*} + 플레이어가 플레이어 자신 또는 다른 플레이어를 월드 내 다른 곳으로 이동시킬 수 있습니다. +호스트 플레이어와 같은 {*PLATFORM_NAME*} 본체로 플레이하는 플레이어를 제외하고, 이 옵션을 선택하면 다른 {*PLATFORM_NAME*} 본체로 접속하는 플레이어를 추방할 수 있습니다. 추방당한 플레이어는 게임이 새로 시작되기 전까지 다시 참가할 수 없습니다. + 다음 페이지 이전 페이지 @@ -426,61 +449,95 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E {*T3*}수정 및 추가{*ETW*}{*B*}{*B*} -- 새 아이템 추가 - 에메랄드, 에메랄드 광석, 에메랄드 블록, Ender 상자, 트립와이어 후크, 효과부여된 황금 사과, 모루, 화분, 조약돌 벽, 이끼 낀 조약돌 벽, 말라비틀어진 그림, 감자, 구운 감자, 독성 감자, 당근, 황금 당근, 당근 막대, -호박 파이, 야간 시야 물약, 투명화 물약, 지하 석영, 지하 석영 광석, 석영 블록, 석영 발판, 석영 계단, 깎아놓은 석영 블록, 석영 블록 기둥, 효과부여 책, 카펫{*B*} -- 새 조합법 추가 - 부드러운 사암 및 깎아놓은 사암{*B*} -- 새로운 괴물 추가 - 좀비 마을 사람{*B*} -- 새 지역 생성 기능 - 사막 사원, 사막 마을, 정글 사원{*B*} -- 마을 사람과 거래 가능{*B*} -- 모루 인터페이스 추가{*B*} -- 가죽 방어구 염색 가능{*B*} -- 늑대 목줄 염색 가능{*B*} -- 당근 막대기로 돼지 방향 조종 가능{*B*} -- 더 많은 아이템으로 보너스 상자 내용물 업데이트{*B*} -- 반쪽 블록 배치 및 반쪽 블록 위의 다른 블록 배치 변경{*B*} -- 뒤집힌 계단과 발판 배치 변경{*B*} -- 마을 사람 직업 추가{*B*} -- 낳은 알에서 나온 마을 사람에게 무작위 직업 부여{*B*} -- 통나무 옆으로 놓기 가능{*B*} -- 나무 도구를 용광로에서 연료로 사용 가능{*B*} -- 채굴 정확성 효과부여 도구로 얼음 및 유리 판자 수집 가능{*B*} -- 화살로 나무 단추와 나무 압력판 작동 가능{*B*} -- 차원문을 통해 지상에 지하 괴물 생성 가능{*B*} -- Creeper와 거미는 마지막으로 자신을 공격한 플레이어를 공격함{*B*} -- 창작 모드의 괴물들은 잠시 시간이 지난 후 중립 상태가 됨{*B*} -- 물에 빠졌을 때 타격 반동 제거{*B*} -- 좀비가 부수는 문에 피해 표시{*B*} -- 지하에서 얼음이 녹음{*B*} -- 비가 오면 가마솥이 채워짐{*B*} -- 피스톤 업데이트 시간 2배로 증가{*B*} -- 안장을 가진 돼지를 죽이면 안장을 떨어트림{*B*} -- Ender의 하늘 색 변경{*B*} -- 트립와이어용으로 실 설치 가능{*B*} -- 비가 나뭇잎을 통과해 내림{*B*} -- 블록 아래쪽에 레버 설치 가능{*B*} -- 난이도 설정에 따라 TNT 위력 변화{*B*} -- 책 조합법 변경{*B*} -- 연잎이 배를 파괴하지 않고, 배가 연잎을 파괴하도록 변경{*B*} -- 돼지가 돼지고기를 더 많이 떨어트림{*B*} -- 완전평면 월드에서 슬라임이 더 적게 생성됨{*B*} -- Creeper로부터 받는 피해가 난이도에 따라 달라지고 타격 반동이 강해짐{*B*} -- 고정된 Enderman이 턱을 벌리지 않음{*B*} -- 플레이어 순간이동 추가(게임 중에 {*BACK_BUTTON*} 메뉴 사용){*B*} -- 원격 플레이어 비행, 투명화, 무적 관련 호스트 옵션 추가{*B*} -- 튜토리얼 월드에 새 아이템 및 기능을 위한 새 튜토리얼 추가{*B*} -- 튜토리얼 월드의 음악 디스크 상자 위치 업데이트{*B*} +- 새로운 아이템 추가 - 단단한 찰흙, 색상 찰흙, 석탄 블록, 건초 더미, 작동기 레일, 레드스톤 블록, 일광 센서, 드로퍼, 호퍼, 호퍼가 부착된 광물 수레, TNT가 실린 광물 수레, 레드스톤 비교 회로, 압력판, 신호기, 함정 상자, 폭죽 로켓, 폭죽 별, 지옥의 별, 끈, 말 방어구, 이름 태그, 말 생성 알{*B*} +- 새로운 괴물 추가 - 위더, 말라비틀어진 해골, 마녀, 박쥐, 말, 당나귀 및 노새{*B*} +- 새로운 지역 생성 기능 추가 - 마녀 오두막{*B*} +- 신호기 인터페이스가 추가됩니다.{*B*} +- 말 인터페이스가 추가됩니다.{*B*} +- 호퍼 인터페이스가 추가됩니다.{*B*} +- 폭죽 추가 - 폭죽 별이나 폭죽 로켓 재료를 가지고 있으면 작업대에서 폭죽 인터페이스가 활성화됩니다.{*B*} +- '모험 모드' 추가 - 올바른 도구로만 블록을 깰 수 있습니다.{*B*} +- 새로운 사운드가 다수 추가됩니다.{*B*} +- 이제 괴물 및 동물, 아이템, 발사체가 차원문을 통과할 수 있습니다.{*B*} +- 이제 탐지기 옆에 다른 탐지기로 동력을 공급해 잠글 수 있습니다.{*B*} +- 좀비와 해골이 다른 무기와 방어구를 가지고 생성될 수 있습니다.{*B*} +- 새로운 사망 메시지가 추가됩니다.{*B*} +- 이름 태그로 괴물 및 동물에 이름을 붙일 수 있으며, 보관함 이름을 변경하여 메뉴를 열었을 때 표시되는 제목을 바꿀 수 있습니다.{*B*} +- 뼛가루는 더 이상 모든 것을 최대 크기로 즉시 성장시키지 않으며, 무작위로 여러 단계에 걸쳐 성장시킵니다.{*B*} +- 레드스톤 비교 회로를 직접 부착해서 상자, 양조대, 디스펜서, 주크박스 내용물을 알려주는 레드스톤 신호를 감지할 수 있습니다.{*B*} +- 디스펜서를 아무 방향으로나 향하게 할 수 있습니다.{*B*} +- 황금 사과를 먹으면 플레이어가 잠시 동안 추가로 '흡수' 체력을 얻습니다.{*B*} +- 지역에 오래 머물수록 지역에서 생성되는 괴물이 강해집니다.{*B*} {*ETB*}돌아오신 것을 환영합니다! 아직 눈치채지 못했을지도 모르지만, Minecraft가 업데이트되었습니다.{*B*}{*B*} -새로운 기능이 많이 추가됐습니다. 추가된 주요 기능 일부를 소개해 드리니 읽어보고 신 나는 게임의 세계로 여행을 떠나십시오!{*B*}{*B*} -{*T1*}새로운 아이템{*ETB*} - 에메랄드, 에메랄드 광석, 에메랄드 블록, Ender 상자, 트립와이어 후크, 효과부여된 황금 사과, 모루, 화분, 조약돌 벽, 이끼 낀 조약돌 벽, 말라비틀어진 그림, 감자, 구운 감자, 독성 감자, 당근, 황금 당근, 당근 막대, -호박 파이, 야간 시야 물약, 투명화 물약, 지하 석영, 지하 석영 광석, 석영 블록, 석영 발판, 석영 계단, 깎아놓은 석영 블록, 석영 블록 기둥, 효과부여 책, 카펫{*B*}{*B*} -{*T1*}새로운 괴물 추가{*ETB*} - 좀비 마을 사람{*B*}{*B*} -{*T1*}새 기능{*ETB*} - 마을 사람과 거래, 모루에서 무기 및 도구를 수리하거나 효과 부여, Ender 상자에 아이템 저장, 돼지를 탔을 때 당근 스틱으로 방향 조정 가능!{*B*}{*B*} -{*T1*}새로운 미니 튜토리얼{*ETB*} – 튜토리얼 월드에서 새로운 기능을 사용하는 방법을 알아보세요!{*B*}{*B*} -{*T1*}새로운 '부활절 알'{*ETB*} – 튜토리얼 월드에서 비밀 음악 디스크의 위치를 모두 옮겼습니다. 다시 한번 찾아보세요!{*B*}{*B*} +새로운 기능이 많이 추가됐습니다. 추가된 주요 기능 일부를 소개해 드리니 읽어보고 신 나는 게임의 세계로 여행을 떠나십시오!{*B*}{*B*} +{*T1*}New Items{*ETB*} - 단단한 찰흙, 색상 찰흙, 석탄 블록, 건초 더미, 작동기 레일, 레드스톤 블록, 일광 센서, 드로퍼, 호퍼, 호퍼가 부착된 광물 수레, TNT가 실린 광물 수레, 레드스톤 비교 회로, 압력판, 신호기, 함정 상자, 폭죽 로켓, 폭죽 별, 지옥의 별, 끈, 말 방어구, 이름 태그, 말 생성 알{*B*}{*B*} +{*T1*} 새로운 괴물 및 동물 {*ETB*} - 위더, 말라비틀어진 해골, 마녀, 박쥐, 말, 당나귀 및 노새{*B*}{*B*} +{*T1*} 새로운 기능 {*ETB*} - 말 길들이기 및 타기, 폭죽 만들어 터뜨리기, 이름 태그로 동물 및 괴물에 이름 붙이기, 보다 고성능의 레드스톤 회로 만들기, 손님이 자신의 월드에서 할 수 있는 행동을 제어하는 새로운 호스트 옵션 {*B*}{*B*} +{*T1*} 새로운 튜토리얼 월드 {*ETB*} – 기존 및 새 기능의 사용법을 튜토리얼 월드에서 배우십시오. 또한 월드에 숨겨진 모든 비밀 음반 찾기에도 도전해 보십시오!{*B*}{*B*} + + +{*T3*}플레이 방법: 말{*ETW*}{*B*}{*B*} +말과 당나귀는 주로 탁 트인 평원에서 찾을 수 있습니다. 노새는 당나귀와 말의 새끼이지만 번식 능력이 없습니다.{*B*} +다 자란 말과 당나귀, 노새는 타고 다닐 수 있습니다. 하지만 방어구는 말에게만 입힐 수 있으며, 아이템 운반에 필요한 안장 가방은 당나귀와 노새에게만 착용시킬 수 있습니다.{*B*}{*B*} +말과 당나귀, 노새는 길을 들여야 사용할 수 있습니다. 말은 타려고 시도함으로써 길을 들일 수 있지만, 이 과정에서 말은 기수를 떨어트리려고 할 것이므로 말등에 잘 타고 있어야 합니다.{*B*} +길이 들면 주변에 하트 표시가 나타나며, 더 이상 기수를 떨어트리려고 하지 않습니다. 말의 방향을 조정하려면 안장을 착용시켜야 합니다.{*B*}{*B*} +안장은 마을 주민으로부터 구매하거나 곳곳에 숨겨진 상자에 들어 있습니다.{*B*} +길이 든 당나귀와 노새에 상자를 부착하면 안장 가방을 달아줄 수 있습니다. 이 가방은 당나귀 또는 노새를 타거나 수그린 상태에서 사용 가능합니다.{*B*}{*B*} +말과 당나귀(노새 제외)는 황금 사과나 황금 당근을 사용해 다른 동물들처럼 교배할 수 있습니다.{*B*} +망아지는 시간이 지나면 성장하여 말이 되며, 밀이나 건초를 먹이면 성장 시간이 단축됩니다.{*B*} + + +신호기 + +{*T3*}플레이 방법: 신호기{*ETW*}{*B*}{*B*} +작동하는 신호기는 하늘로 밝은 광선을 쏘아 올리고 주변 플레이어에게 능력을 부여합니다.{*B*} +신호기는 위더를 잡고 얻을 수 있는 유리와 흑요석, 지옥의 별로 만듭니다.{*B*}{*B*} +신호기는 낮에 햇빛을 받을 수 장소에 놓아야 하며, 반드시 철, 황금, 에메랄드 및 다이아몬드 등의 피라미드 위에 설치해야 합니다.{*B*} +하지만 어떤 재료를 선택해도 신호기의 능력에는 영향을 주지 않습니다.{*B*}{*B*} +신호기 메뉴에서 신호기의 주 능력 1개를 선택할 수 있습니다. 피라미드의 층수가 많을수록 능력 선택의 폭이 더 넓어집니다.{*B*} +4층 이상 되는 피라미드 위의 신호기는 보조 능력인 '재생'이나 주 능력 강화 중 한 가지를 추가로 선택할 수 있습니다.{*B*}{*B*} +신호기의 능력을 설정하려면 지불 슬롯에 에메랄드, 다이아몬드, 황금 또는 철 주괴를 넣어야 합니다.{*B*} +재료를 넣으면 신호기에서 능력이 무기한으로 발동됩니다.{*B*} + + +폭죽 + +{*T3*}플레이 방법: 폭죽{*ETW*}{*B*}{*B*} +폭죽은 손이나 디스펜서로 발사할 수 있는 장식 아이템이며, 기본 재료인 종이와 화약에 폭죽 별을 부가적으로 더해 만들 수 있습니다.{*B*} +폭죽 별을 만들 때 추가 재료를 넣으면 색상과 사라지는 형태, 모양, 크기, 효과(궤적이나 반짝임 등)를 원하는 대로 바꿀 수 있습니다.{*B*}{*B*} +폭죽을 만들려면 소지품 위 3x3 제작칸에 화약과 종이를 넣으십시오.{*B*} +제작칸에 폭죽 별 여러 개를 추가로 넣어 폭죽에 조합할 수 있습니다.{*B*} +제작칸 슬롯에 화약을 더 많이 채우면 폭죽 별이 폭발하는 높이가 증가합니다.{*B*}{*B*} +그런 다음 결과물 슬롯 밖으로 완성된 폭죽을 꺼낼 수 있습니다.{*B*}{*B*} +폭죽 별은 화약과 염료를 제작칸에 넣어 만들 수 있습니다.{*B*} + – 염료는 폭죽 별이 폭발할 때의 색상을 결정합니다.{*B*} + – 폭죽 별의 모양은 불쏘시개, 금덩이, 깃털, 괴물 머리를 추가해 바꿀 수 있습니다.{*B*} + – 다이아몬드나 발광석 가루를 사용하면 궤적이나 반짝임 효과가 추가됩니다.{*B*}{*B*} +폭죽 별을 만든 후에는 염료와 함께 조합해, 폭발 후 사라질 때의 색상을 조절할 수 있습니다. + + +호퍼 + +{*T3*}플레이 방법: 호퍼{*ETW*}{*B*}{*B*} +호퍼는 보관함에 아이템을 넣거나 빼고, 보관함 안에 들어간 아이템을 자동으로 집습니다.{*B*} +호퍼는 양조대, 상자, 디스펜서, 드로퍼, 상자가 든 광물 수레, 호퍼가 부착된 광물 수레, 다른 호퍼에 영향을 줄 수 있습니다.{*B*}{*B*} +호퍼는 그 위에 설치된 적절한 보관함으로부터 계속 아이템을 빨아들이려고 시도합니다. 또한 보관된 아이템을 배출구 쪽 보관함에 넣으려고 합니다.{*B*} +호퍼에 레드스톤의 동력이 공급되면 작동을 멈추고 아이템 빨아들이기와 넣기를 중지합니다.{*B*}{*B*} +호퍼는 아이템을 내보내려는 방향을 가리킵니다. 호퍼가 특정 블록을 가리키게 하려면 호퍼를 해당 블록과 대치되는 방향에 설치하십시오.{*B*} + + + +드로퍼 + +{*T3*}플레이 방법: 드로퍼{*ETW*}{*B*}{*B*} +드로퍼에 레드스톤의 동력이 주입되면 그 안에 든 아이템 하나를 무작위로 땅에 떨어트립니다. {*CONTROLLER_ACTION_USE*}을(를) 눌러 드로퍼를 열면 소지품의 아이템을 드로퍼에 넣을 수 있습니다.{*B*} +드로퍼가 상자나 다른 종류의 보관함을 향해 놓였다면 아이템은 땅이 아니라 해당 상자 안에 들어갑니다. 드로퍼 여러 개를 길게 연결하면 먼 거리로 아이템을 보낼 수 있으며, 이 기능을 작동시키려면 각 드로퍼에 별도로 동력을 공급하거나 차단해야 합니다. + + 맨손 공격보다 위력이 강합니다. 손을 사용하는 것보다 흙, 잡초, 모래, 자갈, 눈을 더 빨리 파냅니다. 눈덩이를 파내려면 삽이 필요합니다. @@ -606,10 +663,36 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E 지도를 들고 있을 동안 탐험한 지역의 이미지를 만들어냅니다. 길을 찾는 데 사용할 수 있습니다. +사용하면 현재 속한 월드의 지도 일부가 되며, 지역을 탐험하면 나머지 부분이 채워집니다. + 화살과 함께 사용하여 원거리 공격을 합니다. 활에 장전하여 사용합니다. +위더에게서 얻을 수 있으며 신호기의 재료로 사용합니다. + +작동하면 화려한 색의 폭발을 일으킵니다. 색상과 효과, 모양과 사라지는 패턴은 폭죽을 만들 때 사용한 폭죽 별에 따라 결정됩니다. + +폭죽의 색상, 효과, 모양을 결정하는 재료입니다. + +레드스톤 회로에 사용하여 신호 강도를 유지, 비교, 낮추거나 특정 블록 상태를 측정합니다. + +움직이는 TNT 블록처럼 작동하는 광물 수레의 한 종류입니다. + +햇빛이 있거나 없음에 따라 레드스톤 신호를 발산하는 블록입니다. + +호퍼와 비슷하게 작동하는 특별한 광물 수레입니다. 트랙에 있는 아이템을 주워 담거나 수레 위에 있는 보관함에서 아이템을 빼냅니다. + +말에 입힐 수 있는 특별한 방어구입니다. 방어력이 5 증가합니다. + +말에 입힐 수 있는 특별한 방어구입니다. 방어력이 7 증가합니다. + +말에 입힐 수 있는 특별한 방어구입니다. 방어력이 11 증가합니다. + +괴물 및 동물을 플레이어나 울타리에 매어둡니다. + +괴물 및 동물 이름 짓기에 사용됩니다. + {*ICON_SHANK_01*}를 2.5만큼 회복합니다. {*ICON_SHANK_01*}를 1만큼 회복합니다. 효과가 6번까지 중복됩니다. @@ -934,100 +1017,158 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E 괴물 머리는 장식용으로 놓아둘 수도 있고, 투구 슬롯에 놓아 마스크로 쓸 수도 있습니다. +명령을 실행하는 데 사용합니다. + +하늘로 광선을 발사하고 주변 플레이어에게 상태 효과를 부여합니다. + +안에 블록과 아이템을 보관합니다. 상자 2개를 나란히 붙이면 용량이 2배인 큰 상자가 만들어집니다. 함정 상자는 열었을 때 레드스톤 전기도 발생시킵니다. + +레드스톤 전기를 발생시킵니다. 아이템이 많이 올려져 있으면 전기가 강해집니다. + +레드스톤 전기를 발생시킵니다. 아이템이 많이 올려져 있으면 전기가 강해집니다. 가벼운 발판보다 무거운 무게를 필요로 합니다. + +레드스톤의 동력원으로 사용됩니다. 다시 레드스톤으로 변환할 수 있습니다. + +아이템을 잡거나 보관함 안으로 또는 밖으로 아이템을 옮기는 데 사용합니다. + +호퍼가 부착된 광물 수레를 사용 가능 또는 불가능하게 하고 TNT가 실린 광물 수레를 작동시킬 수 있는 레일입니다. + +레드스톤 전기를 흘리면 아이템을 잡고 있거나, 떨어트리거나, 다른 보관함으로 아이템을 밀어보냅니다. + +단단한 찰흙으로 만든 색이 화려한 블록입니다. + +말, 당나귀, 노새에게 먹여 체력을 10 회복시킵니다. 망아지가 더 빨리 성장하게 합니다. + +화로에서 찰흙을 제련해서 만듭니다. + +유리와 염료로 만듭니다. + +스테인드글라스로부터 만듭니다. + +석탄을 보관할 수 있는 편리한 방법입니다. 화로에서 연료로 사용할 수 있습니다. + 오징어 - + 잡으면 먹물 주머니를 얻을 수 있습니다. - + - + 잡으면 가죽을 얻을 수 있습니다. 또한 우유를 짜서 양동이에 담을 수 있습니다. - + - + 가위를 사용하면 양털을 얻을 수 있습니다. 이미 털을 깎았다면 양털이 나오지 않습니다. 털을 염색하여 색을 바꿀 수 있습니다. - + - + 잡으면 깃털이 나옵니다. 가끔 알을 낳습니다. - + 돼지 - + 잡으면 돼지고기를 얻을 수 있습니다. 안장을 사용하면 타고 다닐 수 있습니다. - + 늑대 - + 공격받기 전까지는 위협적이지 않으며, 공격하면 뒤를 습격합니다. 뼈를 이용해서 길들이면 데리고 다닐 수 있으며, 플레이어를 공격하는 대상을 공격합니다. - + Creeper - + 가까이 다가가면 폭발합니다! - + 해골 - + 플레이어에게 화살을 쏩니다. 처치하면 화살을 떨어뜨립니다. - + 거미 - + 가까이 다가가면 공격합니다. 벽을 타고 오를 수 있으며, 처치하면 실을 떨어뜨립니다. - + 좀비 - + 가까이 다가가면 공격합니다. - + Pigman 좀비 - + 먼저 공격하지 않지만, 공격을 받으면 무리를 지어 달려듭니다. - + Ghast - + 닿으면 폭발하는 불덩어리를 던집니다. - + 슬라임 - + 피해를 입으면 작은 슬라임으로 분리됩니다. - + Enderman - + 플레이어가 바라보면 공격합니다. 블록을 들어 옮길 수도 있습니다. - + Sliverfish - + 공격하면 근처의 Sliverfish를 끌어들입니다. 돌 블록에 숨어 있습니다. - + 동굴 거미 - + 독이 있습니다. - + Mooshroom - + 그릇과 함께 사용하면 버섯죽을 만들 수 있습니다. 가위를 사용하면 버섯을 떨어뜨리고 보통 소가 됩니다. - + 눈 골렘 - + 플레이어는 눈 블록과 호박을 사용해 눈 골렘을 만들 수 있습니다. 눈 골렘은 플레이어의 적에게 눈덩이를 던집니다. - + Ender 드래곤 - + Ender에서 찾아볼 수 있는 거대한 검은색 드래곤입니다. - + Blaze - + 주로 지하 요새에서 찾아볼 수 있는 적입니다. 죽으면 Blaze 막대를 떨어뜨립니다. - + 마그마 큐브 - + 지하에서 찾아볼 수 있습니다. 슬라임처럼 죽으면 분열하여 여러 개의 조그만 큐브가 됩니다. - + 마을 사람 - + 오셀롯 - + 정글에서 찾을 수 있으며 날생선을 먹여서 조련이 가능합니다. 이때 갑자기 움직이면 오셀롯이 겁을 먹고 도망치기 때문에, 오셀롯이 다가오게 만들어야 합니다. - + 철 골렘 - + 마을을 보호하기 위해 나타납니다. 철 블록과 호박으로 만들 수 있습니다. - + +박쥐 + +이 날아다니는 동물은 동굴이나 그 외의 넓고 폐쇄된 공간에서 발견됩니다. + +마녀 + +늪에서 만날 수 있는 이 적은 물약을 던지며 공격합니다. 처치하면 물약을 떨어트립니다. + + + +이 동물은 길들여서 타고 다닐 수 있습니다. + +당나귀 + +이 동물은 길들여서 타고 다닐 수 있으며, 상자를 달아줄 수 있습니다. + +노새 + +말과 당나귀를 교배시켜 낳습니다. 이 동물은 길들여서 타고 다닐 수 있으며 상자를 달아줄 수 있습니다. + +좀비 말 + +해골 말 + +위더 + +위더의 해골과 영혼 모래로 만듭니다. 플레이어를 향해 폭발하는 해골을 발사합니다. + Explosives Animator Concept Artist @@ -1042,7 +1183,7 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E Rest of Mojang Office -리드 게임 프로그래머 Minecraft PC +Lead Game Programmer Minecraft PC Code Ninja @@ -1374,6 +1515,8 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E 지도 +빈 지도 + 음악 디스크 - "13" 음악 디스크 - "cat" @@ -1476,6 +1619,28 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E Creeper 머리 +지옥의 별 + +폭죽 로켓 + +폭죽 별 + +레드스톤 비교 회로 + +TNT가 실린 광물 수레 + +호퍼가 부착된 광물 수레 + +철제 말 방어구 + +황금 말 방어구 + +다이아몬드 말 방어구 + + + +이름 태그 + 잡초 블록 @@ -1492,6 +1657,8 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E 정글 나무 판자 +나무 판자(종류 무관) + 묘목 참나무 묘목 @@ -1828,6 +1995,190 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E 두개골 +명령 블록 + +신호기 + +함정 상자 + +가벼운 압력판 + +무거운 압력판 + +레드스톤 비교 회로 + +일광 센서 + +레드스톤 블록 + +호퍼 + +작동기 레일 + +드로퍼 + +색상 찰흙 + +건초 더미 + +단단한 찰흙 + +석탄 블록 + +검은색 찰흙 + +빨간색 찰흙 + +녹색 찰흙 + +갈색 찰흙 + +파란색 찰흙 + +자주색 찰흙 + +청록색 찰흙 + +밝은 회색 찰흙 + +회색 찰흙 + +분홍색 찰흙 + +라임색 찰흙 + +노란색 찰흙 + +밝은 파란색 찰흙 + +자홍색 찰흙 + +주황색 찰흙 + +흰색 찰흙 + +스테인드글라스 + +검은색 스테인드글라스 + +빨간색 스테인드글라스 + +녹색 스테인드글라스 + +갈색 스테인드글라스 + +파란색 스테인드글라스 + +자주색 스테인드글라스 + +청록색 스테인드글라스 + +밝은 회색 스테인드글라스 + +회색 스테인드글라스 + +분홍색 스테인드글라스 + +라임색 스테인드글라스 + +노란색 스테인드글라스 + +밝은 파란색 스테인드글라스 + +자홍색 스테인드글라스 + +주황색 스테인드글라스 + +흰색 스테인드글라스 + +스테인드글라스 판유리 + +검은색 스테인드글라스 판유리 + +빨간색 스테인드글라스 판유리 + +녹색 스테인드글라스 판유리 + +갈색 스테인드글라스 판유리 + +파란색 스테인드글라스 판유리 + +자주색 스테인드글라스 판유리 + +청록색 스테인드글라스 판유리 + +밝은 회색 스테인드글라스 판유리 + +회색 스테인드글라스 판유리 + +분홍색 스테인드글라스 판유리 + +라임색 스테인드글라스 판유리 + +노란색 스테인드글라스 판유리 + +밝은 파란색 스테인드글라스 판유리 + +자홍색 스테인드글라스 판유리 + +주황색 스테인드글라스 판유리 + +흰색 스테인드글라스 판유리 + +작은 공 + +큰 공 + +별 모양 + +Creeper 모양 + +폭발 + +알 수 없는 모양 + +검은색 + +빨간색 + +녹색 + +갈색 + +파란색 + +자주색 + +청록색 + +밝은 회색 + +회색 + +분홍색 + +라임색 + +노란색 + +밝은 파란색 + +자홍색 + +주황색 + +흰색 + +사용자 지정 + +사라지는 패턴: + +반짝임 + +궤적 + +효과 시간: +  현재 컨트롤 배치 @@ -1854,9 +2205,9 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E 버리기 -살금살금 걷기 +조용히 걷기 -살금살금 걷기/아래로 비행 +조용히 걷기/아래로 비행 카메라 모드 변경 @@ -2005,8 +2356,7 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E 이곳은 소지품입니다. 이 화면에는 손에 들고 쓸 수 있는 아이템과 가지고 다닐 수 있는 아이템이 모두 표시됩니다. 방어력 또한 이 화면에서 확인할 수 있습니다. - - + {*B*} 계속하려면 {*CONTROLLER_VK_A*} 단추를 누르십시오.{*B*} 소지품 사용법을 이미 알고 있다면 {*CONTROLLER_VK_B*} 단추를 누르십시오. @@ -2027,7 +2377,7 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E - 아이템 정보를 더 보려면 포인터로 아이템을 가리킨 다음 {*CONTROLLER_VK_RT*}를 누르십시오. + 아이템 정보를 더 보려면 포인터로 아이템을 가리킨 다음 {*CONTROLLER_ACTION_MENU_PAGEDOWN*}을 누르십시오. @@ -2061,7 +2411,7 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E - 아이템 정보를 더 보려면 포인터로 아이템을 가리킨 다음 {*CONTROLLER_VK_RT*}를 누르십시오. + 아이템 정보를 더 보려면 포인터로 아이템을 가리킨 다음 {*CONTROLLER_ACTION_MENU_PAGEDOWN*}을 누르십시오. @@ -2608,6 +2958,211 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E 음식 막대와 음식 먹는 법에 대해 이미 알고 있다면{*CONTROLLER_VK_B*} 단추를 누르십시오. + + 여기는 말 소지품 인터페이스입니다. + + + + {*B*}계속하려면 {*CONTROLLER_VK_A*}를 누르십시오. + {*B*}말 소지품에 대해 알고 있다면 {*CONTROLLER_VK_B*}를 누르십시오. + + + + 말 소지품은 말, 당나귀, 노새에 아이템을 옮기거나 착용시킬 수 있게 해줍니다. + + + + 안장 슬롯에 안장을 넣어 말에 안장을 채울 수 있습니다. 방어구 슬롯에 방어구를 넣으면 말이 방어구를 착용해 방어력이 오릅니다. + + + + 이 메뉴에서 자신의 소지품과, 당나귀 또는 노새에 달린 안장 가방의 아이템을 교환할 수 있습니다. + + +말을 찾았습니다. + +당나귀를 찾았습니다. + +노새를 찾았습니다. + + + {*B*}{*CONTROLLER_VK_A*}를 누르면 말과 당나귀, 노새에 대해 더 알아볼 수 있습니다. + {*B*}말과 당나귀, 노새에 대해 이미 알고 있다면 {*CONTROLLER_VK_B*}를 누르십시오. + + + + 말과 당나귀는 주로 넓은 평지에서 발견됩니다. 노새는 말과 당나귀를 교배시켜 얻을 수 있지만, 노새 자체는 교배 능력이 없습니다. + + + + 다 자란 말과 당나귀, 노새는 타고 다닐 수 있습니다. 하지만 방어구는 말에게만 입힐 수 있으며, 아이템 운반에 필요한 안장 가방은 당나귀와 노새에게만 착용시킬 수 있습니다. + + + + 말과 당나귀, 노새는 길을 들여야 사용할 수 있습니다. 말은 타려고 시도하면서, 기수를 떨어트리려는 말에 대항해 단단히 붙잡은 채 타고 있으면 길을 들일 수 있습니다. + + + + 길이 들면 주변에 하트 표시가 나타나며, 더 이상 기수를 떨어트리려고 하지 않습니다. + + + + 지금 말타기를 시도해 보십시오. 손에 아이템이나 도구를 들지 않은 채로 {*CONTROLLER_ACTION_USE*}을 조작하면 올라탑니다. + + + + 말의 방향을 조정하려면 안장을 착용시켜야 합니다. 안장은 마을 주민으로부터 구매하거나 곳곳에 숨겨진 상자에 들어 있습니다. + + + + 길이 든 당나귀와 노새에 상자를 부착하면 안장 가방을 달아줄 수 있습니다. 이 가방은 당나귀 또는 노새를 타거나 몸을 수그린 상태에서 사용 가능합니다. + + + + 말과 당나귀(노새 제외)는 황금 사과나 황금 당근을 사용해 다른 동물들처럼 교배할 수 있습니다. 망아지는 시간이 지나면 성장하여 말이 되며, 밀이나 건초를 먹이면 성장 시간이 단축됩니다. + + + + 이곳에서 말과 당나귀 길들이기를 시도할 수 있으며, 주변의 상자에는 안장과 말 방어구를 비롯해 말에게 사용할 수 있는 유용한 아이템도 들어있습니다. + + + + 이것은 신호기 인터페이스입니다. 여기서 신호기의 능력을 선택할 수 있습니다. + + + + {*B*}계속하려면 {*CONTROLLER_VK_A*}를 누르십시오. + {*B*}신호기 인터페이스 사용 방법을 알고 있다면 {*CONTROLLER_VK_B*}를 누르십시오. + + + + 신호기 메뉴에서 신호기의 주 능력 1개를 선택할 수 있습니다. 피라미드의 층수가 많을수록 능력 선택의 폭이 더 넓어집니다. + + + + 4층 이상 되는 피라미드 위의 신호기는 보조 능력인 '재생'이나 주 능력 강화 중 한 가지를 추가로 선택할 수 있습니다. + + + + 신호기의 능력을 설정하려면 지불 슬롯에 에메랄드, 다이아몬드, 황금 또는 철 주괴를 넣어야 합니다. 재료를 넣으면 신호기에서 능력이 무기한으로 발동됩니다. + + +이 피라미드 꼭대기에는 정지한 신호기가 있습니다. + + + {*B*}신호기에 대해 더 알아보려면 {*CONTROLLER_VK_A*}를 누르십시오. + {*B*}신호기에 대해 이미 알고 있다면 {*CONTROLLER_VK_B*}를 누르십시오. + + + + 작동하는 신호기는 하늘로 밝은 광선을 쏘아올리고 주변 플레이어에게 능력을 부여합니다. 신호기는 위더를 잡고 얻을 수 있는 유리와 흑요석, 지옥의 별로 만듭니다. + + + + 신호기는 낮에 햇빛을 받을 수 장소에 놓아야 하며, 반드시 철, 황금, 에메랄드 및 다이아몬드 등의 피라미드 위에 설치해야 합니다. 하지만 어떤 재료를 선택해도 신호기의 능력에는 영향을 주지 않습니다. + + + + 신호기를 사용해 능력을 설정해 보십시오. 제공되는 철 주괴를 대가로 지불할 수 있습니다. + + +여기에는 호퍼가 있습니다. + + + {*B*}호퍼에 대해 더 알아보려면 {*CONTROLLER_VK_A*}를 누르십시오. + {*B*}호퍼에 대해 이미 알고 있다면 {*CONTROLLER_VK_B*}를 누르십시오. + + + + 호퍼는 보관함에 아이템을 넣거나 빼고, 보관함 안에 들어간 아이템을 자동으로 집습니다. + + + + 호퍼는 양조대, 상자, 디스펜서, 드로퍼, 상자가 든 광물 수레, 호퍼가 부착된 광물 수레, 다른 호퍼에 영향을 줄 수 있습니다. + + + + 호퍼는 그 위에 설치된 적절한 보관함으로부터 계속 아이템을 빨아들이려고 시도합니다. 또한 보관된 아이템을 배출구 쪽 보관함에 넣으려고 합니다. + + + + 하지만 호퍼에 레드스톤의 동력이 공급되면 작동을 멈추고 아이템 빨아들이기와 넣기를 중지합니다. + + + + 호퍼는 아이템을 내보내려는 방향을 가리킵니다. 호퍼가 특정 블록을 가리키게 하려면 호퍼에 아이템이 들어있을 때 해당 블록과 대치되는 방향에 설치하십시오. + + + + 이곳에서 호퍼 배열을 확인하고 실험해볼 수 있습니다. + + + + 이것은 폭죽 인터페이스입니다. 여기에서 폭죽과 폭죽 별을 만들 수 있습니다. + + + + {*B*}계속하려면 {*CONTROLLER_VK_A*}를 누르십시오. + {*B*} 폭죽 인터페이스 사용 방법을 알고 있다면 {*CONTROLLER_VK_B*}를 누르십시오. + + + + 폭죽을 만들려면 소지품 위 3x3 제작칸에 화약과 종이를 넣으십시오. + + + + 제작칸에 폭죽 별 여러 개를 추가로 넣어 폭죽에 섞을 수 있습니다. + + + + 제작칸 슬롯에 화약을 더 많이 채우면 폭죽 별이 폭발하는 높이가 증가합니다. + + + + 그런 다음 결과물 슬롯 밖으로 완성된 폭죽을 꺼낼 수 있습니다. + + + + 폭죽 별은 화약과 염료를 제작칸에 넣어 만들 수 있습니다. + + + + 염료는 폭죽 별이 폭발할 때의 색상을 결정합니다. + + + + 폭죽 별의 모양은 불쏘시개, 금덩이, 깃털, 괴물 머리를 추가해 바꿀 수 있습니다. + + + + 다이아몬드나 발광석 가루를 사용하면 궤적이나 반짝임 효과가 추가됩니다. + + + + 폭죽 별을 만든 후에는 염료와 함께 조합해, 폭발 후 사라질 때의 색상을 조절할 수 있습니다. + + + + 이 상자들에는 폭죽을 만드는 데 쓸 수 있는 다양한 아이템이 들어있습니다! + + + + {*B*}폭죽에 대해 더 알아보려면 {*CONTROLLER_VK_A*}를 누르십시오. + {*B*}폭죽에 대해 이미 알고 있다면 {*CONTROLLER_VK_B*}를 누르십시오. + + + + 폭죽은 손이나 디스펜서로 발사할 수 있는 장식 아이템이며, 기본 재료인 종이와 화약에 폭죽 별을 부가적으로 더해 만들 수 있습니다. + + + + 폭죽 별을 만들 때 추가 재료를 넣으면 색상과 사라지는 형태, 모양, 크기, 효과(궤적이나 반짝임 등)를 원하는 대로 바꿀 수 있습니다. + + + + 작업대에서 상자에 든 재료들을 이용해 폭죽을 만들어 보십시오. + +  선택 사용 @@ -2812,9 +3367,9 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E 블록 -페이지 위로 +페이지 올림 -페이지 아래로 +페이지 내림 사랑 모드 @@ -2830,6 +3385,22 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E Xbox One 저장 데이터 업로드 +타기 + +내리기 + +상자 달기 + +발사 + +줄 묶기 + +놓기 + +부착 + +이름 + 확인 취소 @@ -3144,6 +3715,20 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E 디스펜서 + + +드로퍼 + +호퍼 + +신호기 + +주 능력 + +보조 능력 + +광물 수레 + 현재 이 게임에서 구매할 수 있는 해당 유형의 다운로드 콘텐츠가 없습니다. %s님이 게임에 참가했습니다. @@ -3303,10 +3888,14 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E 게임 모드: 창작 +게임 모드: 모험 + 생존 창작 +모험 + 생존 모드에서 생성 창작 모드에서 생성 @@ -3327,6 +3916,8 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E 완전평면 +시드를 입력해서 같은 지역을 만드십시오. 공백으로 두면 무작위 월드가 생성됩니다. + 이 옵션을 켜면 온라인 게임으로 플레이합니다. 이 옵션을 켜면 초대받은 플레이어만 게임에 참가할 수 있습니다. @@ -3351,6 +3942,20 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E 이 옵션을 켜면 쓸모있는 아이템이 든 상자가 플레이어 생성 지점 근처에 나타납니다. +비활성화하면 몬스터와 동물이 블록을 교체하거나 아이템을 집지 못하게 합니다. 예를 들어 Creeper가 폭발해도 블록이 파괴되지 않으며, 양은 풀을 제거하지 못합니다. + +활성화하면 플레이어가 죽어도 소지품의 아이템을 잃지 않습니다. + +비활성화하면 괴물이나 동물이 자연적으로 생성되지 않습니다. + +비활성화하면 괴물과 동물이 전리품을 떨어트리지 않습니다. 예를 들어 Creeper가 화약을 떨어트리지 않습니다. + +비활성화하면 블록이 파괴돼도 아이템을 떨어트리지 않습니다. 예를 들어 돌 블록에서 조약돌을 얻을 수 없습니다. + +비활성화하면 플레이어의 체력이 자연적으로 재생되지 않습니다. + +비활성화하면 시간대가 변하지 않습니다. + 스킨 팩 테마 @@ -3399,7 +4004,49 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E {*PLAYER*} {*SOURCE*}에 타격에 의해 사망 -{*PLAYER*}님이 {*SOURCE*}에 의해 살해당했습니다. +{*PLAYER*} 님이 {*SOURCE*}의 마법에 살해당했습니다. + +{*PLAYER*} 님이 사다리에서 떨어졌습니다. + +{*PLAYER*} 님이 덩굴에서 떨어졌습니다. + +{*PLAYER*} 님이 물 밖으로 떨어졌습니다. + +{*PLAYER*} 님이 높은 곳에서 떨어졌습니다. + +{*PLAYER*} 님이 {*SOURCE*}에 의해 떨어져 사망했습니다. + +{*PLAYER*} 님이 {*SOURCE*}에 의해 떨어져 사망했습니다. + +{*PLAYER*} 님이 {*SOURCE*}의 {*ITEM*}에 의해 떨어져 사망했습니다. + +{*PLAYER*} 님이 너무 멀리 떨어져 {*SOURCE*}에 의해 사망했습니다. + +{*PLAYER*} 님이 너무 멀리 떨어져 {*SOURCE*}의 {*ITEM*}에 의해 사망했습니다. + +{*PLAYER*} 님이 {*SOURCE*}과(와) 싸우던 중 불 속으로 걸어 들어갔습니다. + +{*PLAYER*} 님이 {*SOURCE*}과(와) 싸우던 중 까맣게 타버렸습니다. + +{*PLAYER*} 님이 {*SOURCE*}을(를) 피하다 용암에서 수영을 했습니다. + +{*PLAYER*} 님이 {*SOURCE*}을(를) 피하려다 익사했습니다. + +{*PLAYER*} 님이 {*SOURCE*}을(를) 피하려다 선인장에 찔렸습니다. + +{*PLAYER*} 님이 {*SOURCE*}에 의해 날아갔습니다. + +{*PLAYER*} 님이 말라 죽었습니다. + +{*PLAYER*} 님이 {*SOURCE*}의 {*ITEM*}에 의해 사망했습니다. + +{*PLAYER*} 님이 {*SOURCE*}의 {*ITEM*}에 맞아 사망했습니다. + +{*PLAYER*} 님이 {*SOURCE*}의 {*ITEM*}에 의해 불덩어리를 맞았습니다. + +{*PLAYER*} 님이 {*SOURCE*}의 {*ITEM*}에 의해 찌부러졌습니다. + +{*PLAYER*} 님이 {*SOURCE*}의 {*ITEM*}에 살해당했습니다. 기반암 안개 @@ -3564,9 +4211,9 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E 지하 초기화를 하지 않습니다. -Mooshroom의 털을 자를 수 없습니다. 돼지, 양, 소, 고양이의 수가 최대치에 도달했습니다. +Mooshroom의 털을 자를 수 없습니다. 돼지, 양, 소, 고양이, 말의 수가 최대치에 도달했습니다. -낳은 알을 사용할 수 없습니다. 돼지, 양, 소, 고양이의 수가 최대치에 도달했습니다. +낳은 알을 사용할 수 없습니다. 돼지, 양, 소, 고양이, 말의 수가 최대치에 도달했습니다. 낳은 알을 사용할 수 없습니다. Mooshroom의 수가 최대치에 도달했습니다. @@ -3576,6 +4223,8 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E 낳은 알을 사용할 수 없습니다. 오징어의 수가 최대치에 도달했습니다. +낳은 알을 사용할 수 없습니다. 마을 사람의 수가 최대치에 도달했습니다. + 낳은 알을 사용할 수 없습니다. 적의 수가 최대치에 도달했습니다. 낳은 알을 사용할 수 없습니다. 마을 사람의 수가 최대치에 도달했습니다. @@ -3584,12 +4233,14 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E 낙원 모드에서는 적을 생성할 수 없습니다. -이 동물은 사랑 모드로 만들 수 없습니다. 교배할 수 있는 돼지, 양, 소, 고양이의 수가 최대치에 도달했습니다. +이 동물은 사랑 모드로 만들 수 없습니다. 교배할 수 있는 돼지, 양, 소, 고양이, 말의 수가 최대치에 도달했습니다. 이 동물은 사랑 모드로 만들 수 없습니다. 교배할 수 있는 늑대의 수가 최대치에 도달했습니다. 이 동물은 사랑 모드로 만들 수 없습니다. 교배할 수 있는 닭의 수가 최대치에 도달했습니다. +이 동물은 사랑 모드로 만들 수 없습니다. 교배할 수 있는 말의 수가 최대치에 도달했습니다. + 이 동물은 사랑 모드로 만들 수 없습니다. 교배할 수 있는 Mooshroom의 수가 최대치에 도달했습니다. 배의 수가 최대치에 도달했습니다. @@ -3617,27 +4268,43 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E 제작진 콘텐츠 재설치 - + 디버그 설정 - + 불 확산 - + TNT 폭발 - + 플레이어 대 플레이어 - + 플레이어 신뢰 - + 호스트 특권 - + 건물 생성 - + 완전평면 월드 - + 보너스 상자 - + 월드 옵션 - + +게임 옵션 + +괴물에 의한 괴롭힘 + +소지품 유지 + +괴물 생성 + +괴물 전리품 + +타일 아이템 + +자연 재생 + +시간대 전환 + 건설 및 채광 가능 문과 스위치 사용 가능 @@ -3824,6 +4491,14 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E +위더 + +체력 강화 + +흡수 + +포만 + - 신속 - 속도 저하 @@ -3862,6 +4537,14 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E - 독 +만큼 부패 + +만큼 체력 강화 + +만큼 흡수 + +만큼 포만 + II @@ -3958,6 +4641,22 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E 효과 대상 플레이어, 동물 및 괴물의 체력이 서서히 감소합니다. +복용 시: + +말 점프 강화 + +좀비 증원 + +최대 체력 + +괴물 따라오기 거리 + +밀치기 저항 + +속도 + +공격력 + 예리 강타 @@ -4048,7 +4747,7 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E {*ICON_SHANK_01*}를 3만큼 회복합니다. 화로에서 감자를 조리하여 만듭니다. -먹어서 {*ICON_SHANK_01*}를 1만큼 회복하거나 화로에서 조리할 수 있습니다. 농지에 심을 수 있으며 먹으면 중독될 수 있습니다. +먹어서 {*ICON_SHANK_01*}를 1만큼 회복합니다. 먹으면 중독될 수 있습니다. {*ICON_SHANK_01*}를 3만큼 회복합니다. 당근과 금덩이를 사용해 만듭니다. @@ -4278,7 +4977,7 @@ Ender에 들어서면 친구가 그들의 지도에서 요새 내부에 있는 E {*B*} - 거래 인터페이스에 대해 더 알아보려면 {*CONTROLLER_VK_A*} 단추를 누르십시오.{*B*} + 거래 인터페이스에 대해 알아보려면 {*CONTROLLER_VK_A*} 단추를 누르십시오.{*B*} 거래 인터페이스에 대해 이미 알고 있다면 {*CONTROLLER_VK_B*} 단추를 누르십시오. diff --git a/Minecraft.Assets/XboxMedia/loc/pt-BR/strings.resx b/Minecraft.Assets/XboxMedia/loc/pt-BR/strings.resx index 0fd411ece..67369181e 100644 --- a/Minecraft.Assets/XboxMedia/loc/pt-BR/strings.resx +++ b/Minecraft.Assets/XboxMedia/loc/pt-BR/strings.resx @@ -147,29 +147,29 @@ {*T3*}COMO JOGAR: NOÇÕES BÁSICAS{*ETW*}{*B*}{*B*} Minecraft é um jogo que consiste em colocar blocos para construir qualquer coisa que imaginar. À noite os monstros aparecem; então, construa um abrigo antes que isso aconteça.{*B*}{*B*} -Use {*CONTROLLER_ACTION_LOOK*}para olhar à sua volta.{*B*}{*B*} -Use {*CONTROLLER_ACTION_MOVE*}para se mover.{*B*}{*B*} -Pressione {*CONTROLLER_ACTION_JUMP*}para pular.{*B*}{*B*} -Pressione {*CONTROLLER_ACTION_MOVE*}duas vezes para frente rapidamente para correr. Enquanto mantiver {*CONTROLLER_ACTION_MOVE*}pressionado para a frente, o personagem continuará correndo, a não ser que o tempo de corrida acabe ou que a Barra de Alimentos tenha menos de {*ICON_SHANK_03*}.{*B*}{*B*} -Mantenha {*CONTROLLER_ACTION_ACTION*}pressionado para extrair e cortar usando a mão ou o que estiver segurando. Talvez seja necessário fabricar uma ferramenta para extrair alguns blocos.{*B*}{*B*} -Se estiver segurando um item na mão, use {*CONTROLLER_ACTION_USE*}para utilizá-lo ou pressione {*CONTROLLER_ACTION_DROP*}para soltá-lo. +Use {*CONTROLLER_ACTION_LOOK*} para olhar à sua volta.{*B*}{*B*} +Use {*CONTROLLER_ACTION_MOVE*} para se mover.{*B*}{*B*} +Pressione {*CONTROLLER_ACTION_JUMP*} para pular.{*B*}{*B*} +Pressione {*CONTROLLER_ACTION_MOVE*} duas vezes para frente rapidamente para correr. Enquanto mantiver {*CONTROLLER_ACTION_MOVE*} pressionado para a frente, o personagem continuará correndo, a não ser que o tempo de corrida acabe ou que a Barra de Alimentos tenha menos de {*ICON_SHANK_03*}.{*B*}{*B*} +Mantenha {*CONTROLLER_ACTION_ACTION*} pressionado para extrair e cortar usando a mão ou o que estiver segurando. Talvez seja necessário fabricar uma ferramenta para extrair alguns blocos.{*B*}{*B*} +Se estiver segurando um item na mão, use {*CONTROLLER_ACTION_USE*} para utilizá-lo ou pressione {*CONTROLLER_ACTION_DROP*} para soltá-lo. {*T3*}COMO JOGAR: HUD{*ETW*}{*B*}{*B*} O HUD mostra informações sobre seu status; sua energia, o oxigênio restante quando está debaixo da água, seu nível de fome (é preciso comer para reabastecer) e sua armadura, se estiver usando uma. Se você perder energia, mas tiver uma barrra de alimentos com 9 ou mais {*ICON_SHANK_01*}, sua energia será reabastecida automaticamente. Comer reabastece sua barra de alimentos. {*B*} A Barra de Experiência também é mostrada aqui, com um valor numérico que mostra seu Nível de Experiência e a barra que indica quantos Pontos de Experiência são necessários para aumentar seu Nível de Experiência. Você ganha Pontos de Experiência coletando as Esferas de Experiência liberadas por multidões quando elas morrem, ao minerar alguns tipos de blocos, ao criar animais, pescar e fundir minérios na fornalha.{*B*}{*B*} -Também mostra os itens disponíveis para uso. Use {*CONTROLLER_ACTION_LEFT_SCROLL*}e {*CONTROLLER_ACTION_RIGHT_SCROLL*}para trocar o item em sua mão. +Também mostra os itens disponíveis para uso. Use {*CONTROLLER_ACTION_LEFT_SCROLL*} e {*CONTROLLER_ACTION_RIGHT_SCROLL*} para trocar o item em sua mão. {*T3*}COMO JOGAR: INVENTÁRIO{*ETW*}{*B*}{*B*} -Use {*CONTROLLER_ACTION_INVENTORY*}para ver seu inventário.{*B*}{*B*} +Use {*CONTROLLER_ACTION_INVENTORY*} para ver seu inventário.{*B*}{*B*} Essa tela mostra os itens disponíveis para uso em sua mão e todos os outros itens que está carregando. Sua armadura também é mostrada aqui.{*B*}{*B*} -Use{*CONTROLLER_MENU_NAVIGATE*}para mover o ponteiro. Use {*CONTROLLER_VK_A*}para pegar um item sob o ponteiro. Se houver mais de um item aqui, ele pegará todos ou você pode usar {*CONTROLLER_VK_X*}para pegar apenas metade deles.{*B*}{*B*} -Mova o item com o ponteiro sobre outro espaço no inventário e coloque-o lá usando {*CONTROLLER_VK_A*}. Se tiver vários itens no ponteiro, use {*CONTROLLER_VK_A*}para colocar todos ou {*CONTROLLER_VK_X*}para colocar apenas um.{*B*}{*B*} -Se o item sobre o qual você estiver for uma armadura, aparecerá uma dica de ferramenta para permitir a movimentação rápida para o espaço da armadura à direita no inventário. -É possível mudar a cor da sua Armadura de Couro, tingindo-a. Faça isso no menu do estoque, segurando a tinta com o cursor, e em seguida apertando{*CONTROLLER_VK_X*} enquanto o cursor estiver sobre a peça que deseja tingir. - +Use{*CONTROLLER_MENU_NAVIGATE*} para mover o ponteiro. Use {*CONTROLLER_VK_A*} para pegar um item sob o ponteiro. Se houver mais de um item aqui, ele pegará todos ou você pode usar {*CONTROLLER_VK_X*} para pegar apenas metade deles.{*B*}{*B*} +Mova o item com o ponteiro sobre outro espaço no inventário e coloque-o lá usando {*CONTROLLER_VK_A*}. Se tiver vários itens no ponteiro, use {*CONTROLLER_VK_A*} para colocar todos ou {*CONTROLLER_VK_X*} para colocar apenas um.{*B*}{*B*} +Se o item sobre o qual você estiver for uma armadura, aparecerá uma dica de ferramenta para permitir a movimentação rápida para o espaço da armadura à direita no inventário.{*B*}{*B*} +É possível mudar a cor da sua Armadura de Couro, tingindo-a. Faça isso no menu do estoque, segurando a tinta com o cursor, e em seguida apertando {*CONTROLLER_VK_X*} enquanto o cursor estiver sobre a peça que deseja tingir. + {*T3*}COMO JOGAR: BAÚ{*ETW*}{*B*}{*B*} -Depois de criar um baú, poderá colocá-lo no mundo e usá-lo com{*CONTROLLER_ACTION_USE*} para guardar itens do seu inventário.{*B*}{*B*} +Depois de criar um baú, poderá colocá-lo no mundo e usá-lo com {*CONTROLLER_ACTION_USE*} para guardar itens do seu inventário.{*B*}{*B*} Use o ponteiro para mover itens entre o inventário e o baú.{*B*}{*B*} Os itens no baú ficarão guardados lá para você até devolvê-los ao inventário mais tarde. @@ -180,20 +180,20 @@ Dois baús colocados lado a lado serão combinados para formar um Baú Grande. E {*T3*}COMO JOGAR: FABRICAÇÃO{*ETW*}{*B*}{*B*} -Na interface de fabricação, você pode combinar itens do seu inventário para criar novos tipos de itens. Use{*CONTROLLER_ACTION_CRAFTING*}para abrir a interface de fabricação.{*B*}{*B*} -Role pelas guias na parte superior usando{*CONTROLLER_VK_LB*}e{*CONTROLLER_VK_RB*}para selecionar o tipo de item que deseja criar e, em seguida, use {*CONTROLLER_MENU_NAVIGATE*}para selecionar o item a ser criado.{*B*}{*B*} -A área de fabricação mostra os itens necessários para criar o novo item. Pressione {*CONTROLLER_VK_A*}para criar o item e colocá-lo no inventário. +Na interface de fabricação, você pode combinar itens do seu inventário para criar novos tipos de itens. Use {*CONTROLLER_ACTION_CRAFTING*} para abrir a interface de fabricação.{*B*}{*B*} +Role pelas guias na parte superior usando {*CONTROLLER_VK_LB*} e {*CONTROLLER_VK_RB*} para selecionar o tipo de item que deseja criar e, em seguida, use {*CONTROLLER_MENU_NAVIGATE*} para selecionar o item a ser criado.{*B*}{*B*} +A área de fabricação mostra os itens necessários para criar o novo item. Pressione {*CONTROLLER_VK_A*} para criar o item e colocá-lo no inventário. {*T3*}COMO JOGAR: BANCADA{*ETW*}{*B*}{*B*} Você pode criar itens maiores usando uma bancada.{*B*}{*B*} -Coloque a bancada no mundo e pressione{*CONTROLLER_ACTION_USE*} para usá-la.{*B*}{*B*} +Coloque a bancada no mundo e pressione {*CONTROLLER_ACTION_USE*} para usá-la.{*B*}{*B*} A fabricação de itens na bancada funciona da mesma maneira que a fabricação básica, mas você terá uma área maior para trabalhar e uma variedade maior de itens para criar. {*T3*}COMO JOGAR: FORNALHA{*ETW*}{*B*}{*B*} Com a fornalha você pode alterar os itens queimando-os. Por exemplo, você pode transformar minério de ferro em barras de ferro na fornalha.{*B*}{*B*} -Coloque a fornalha no mundo e pressione{*CONTROLLER_ACTION_USE*} para usá-la.{*B*}{*B*} +Coloque a fornalha no mundo e pressione {*CONTROLLER_ACTION_USE*} para usá-la.{*B*}{*B*} Você deve colocar combustível sob a fornalha e o item a ser queimado na parte superior. A fornalha acenderá e começará a funcionar.{*B*}{*B*} Quando os itens estiverem queimados, você poderá movê-los da área de saída para seu inventário.{*B*}{*B*} Se o item que você estiver examinando for um ingrediente ou combustível para a fornalha, aparecerão dicas de ferramenta para permitir a movimentação rápida para a fornalha. @@ -201,7 +201,7 @@ Se o item que você estiver examinando for um ingrediente ou combustível para a {*T3*}COMO JOGAR: DISTRIBUIDOR{*ETW*}{*B*}{*B*} O distribuidor é usado para projetar itens. Você deve colocar um acionador, como uma alavanca, ao lado do distribuidor para acioná-lo.{*B*}{*B*} -Para encher o distribuidor com itens, pressione{*CONTROLLER_ACTION_USE*} e mova os itens desejados do inventário para ele.{*B*}{*B*} +Para encher o distribuidor com itens, pressione {*CONTROLLER_ACTION_USE*} e mova os itens desejados do inventário para ele.{*B*}{*B*} Então, quando usar o acionador, o distribuidor projetará um item. @@ -229,11 +229,11 @@ Você deve experimentar todas as combinações de ingredientes para descobrir to {*T3*}INSTRUÇÕES DE JOGO: FEITIÇOS{*ETW*}{*B*}{*B*} Os Pontos de Experiência recolhidos quando um habitante morre ou quando certos blocos são extraídos ou fundidos numa fornalha podem ser usados para enfeitiçar algumas ferramentas, armaduras e livros.{*B*} -Quando é colocada uma Espada, Arco, Machado, Picareta, Pá, Armadura ou Livro no orifício por baixo do livro na Mesa de Feitiços, os três botões à direita do orifício apresentam alguns feitiços e os respectivos custos em Níveis de Experiência.{*B*} +Quando é colocada uma Espada, Arco, Machado, Picareta, Pá, Armadura ou Livro no orifício por baixo do livro na Mesa de Feitiços, os três botões à direita do orifício apresentam alguns feitiços e os respectivos custos em Níveis de Experiência.{*B*} Se você não tem Níveis de Experiência suficientes para usar, o custo aparecerá em vermelho, caso contrário, verde.{*B*}{*B*} O feitiço aplicado é selecionado aleatoriamente com base no custo apresentado.{*B*}{*B*} Se a Mesa de Feitiços estiver rodeada de Estantes (até um máximo de 15 Estantes), com um bloco de intervalo entre a Estante e a Mesa de Feitiços, o poder dos feitiços irá aumentar e serão vistos glifos misteriosos saindo do livro na Mesa de Feitiços.{*B*}{*B*} -Todos os ingredientes para uma Mesa de Feitiços podem ser encontrados nas aldeias, extraindo nas minas ou cultivando no mundo.{*B*}{*B} +Todos os ingredientes para uma Mesa de Feitiços podem ser encontrados nas aldeias, extraindo nas minas ou cultivando no mundo.{*B*}{*B*} Os Livros Encantados são usados na Bigorna para aplicar feitiços aos itens. Desta forma você tem maior controle sobre os feitiços que deseja em seus itens.{*B*} @@ -257,28 +257,28 @@ Exemplos de construção de portais são mostrados na figura à direita. {*T3*}COMO JOGAR: MULTIJOGADOR{*ETW*}{*B*}{*B*} O Minecraft no console Xbox 360 é um jogo multijogador por padrão. Se você estiver jogando em um modo de Alta Definição, poderá incluir outros jogadores conectando os controles e pressionando START em qualquer ponto durante o jogo.{*B*}{*B*} -Ao iniciar ou participar de um jogo online, ele estará visível para as pessoas de sua lista de amigos (a não ser que você tenha selecionado Só Convidados como host do jogo) e, se eles entrarem no jogo, também estará visível para as pessoas da lista de amigos deles (se você tiver selecionado a opção Permitir Amigos dos Amigos). +Ao iniciar ou participar de um jogo online, ele estará visível para as pessoas de sua lista de amigos (a não ser que você tenha selecionado Só Convidados como host do jogo) e, se eles entrarem no jogo, também estará visível para as pessoas da lista de amigos deles (se você tiver selecionado a opção Permitir Amigos dos Amigos).{*B*} Quando estiver em um jogo, você poderá pressionar o botão BACK para ver a lista de todos os outros jogadores, ver os Cartões de Jogador deles, expulsar jogadores do jogo e convidar outras pessoas. {*T3*}COMO JOGAR: COMPARTILHANDO CAPTURAS DE TELA{*ETW*}{*B*}{*B*} -Você pode capturar uma tela de seu jogo abrindo o menu Pausar e pressionando{*CONTROLLER_VK_Y*} para compartilhar no Facebook. Você verá uma versão em miniatura da captura de tela e poderá editar o texto associado à postagem no Facebook.{*B*}{*B*} -Há um modo de câmera especial para essas capturas de tela, para que você possa ver a frente do seu personagem na captura: pressione {*CONTROLLER_ACTION_CAMERA*}até ter uma visão frontal do personagem antes de pressionar {*CONTROLLER_VK_Y*}para compartilhar.{*B*}{*B*} +Você pode capturar uma tela de seu jogo abrindo o menu Pausar e pressionando {*CONTROLLER_VK_Y*} para compartilhar no Facebook. Você verá uma versão em miniatura da captura de tela e poderá editar o texto associado à postagem no Facebook.{*B*}{*B*} +Há um modo de câmera especial para essas capturas de tela, para que você possa ver a frente do seu personagem na captura: pressione {*CONTROLLER_ACTION_CAMERA*} até ter uma visão frontal do personagem antes de pressionar {*CONTROLLER_VK_Y*} para compartilhar.{*B*}{*B*} Gamertags não serão exibidas na captura de tela. {*T3*}COMO JOGAR: BANINDO NÍVEIS{*ETW*}{*B*}{*B*} Se você encontrar conteúdo ofensivo em um nível em que estiver jogando, poderá optar por adicioná-lo à sua lista de Níveis Banidos. -Para isso, abra o menu Pausar e pressione {*CONTROLLER_VK_RB*}para selecionar a dica de ferramenta de Banir Nível. +Para isso, abra o menu Pausar e pressione {*CONTROLLER_VK_RB*} para selecionar a dica de ferramenta de Banir Nível. Se você tentar entrar nesse nível no futuro, será notificado de que ele está em sua lista de Níveis Banidos e poderá removê-lo da lista e continuar no nível ou sair. {*T3*}COMO JOGAR: MODO CRIATIVO{*ETW*}{*B*}{*B*} A interface do modo criativo permite que qualquer item do jogo seja movido para o inventário do jogador sem precisar minerar ou fabricar aquele item. Os itens no inventário do jogador não serão removidos quando forem colocados ou usados no mundo, e desta forma o jogador pode se concentrar na construção, em vez de coletar recursos.{*B*} Se você criar, carregar ou salvar um mundo no Modo Criativo, as atualizações de conquistas e de placar de líderes estarão desabilitadas nesse mundo, mesmo que ele seja carregado depois no Modo Sobrevivência.{*B*} -Para voar quando estiver no Modo Criativo, pressione {*CONTROLLER_ACTION_JUMP*}duas vezes rapidamente. Para parar de voar, repita a ação. Para voar mais rápido, pressione {*CONTROLLER_ACTION_MOVE*}rapidamente duas vezes para frente enquanto estiver voando. -No modo de voo, você pode manter pressionado {*CONTROLLER_ACTION_JUMP*}para se mover para cima e {*CONTROLLER_ACTION_SNEAK*}para se mover para baixo ou usar {*CONTROLLER_ACTION_DPAD_UP*}para se mover para cima, {*CONTROLLER_ACTION_DPAD_DOWN*}para se mover para baixo, -{*CONTROLLER_ACTION_DPAD_LEFT*}para se mover para a esquerda e {*CONTROLLER_ACTION_DPAD_RIGHT*}para se mover para a direita. +Para voar quando estiver no Modo Criativo, pressione {*CONTROLLER_ACTION_JUMP*} duas vezes rapidamente. Para parar de voar, repita a ação. Para voar mais rápido, pressione {*CONTROLLER_ACTION_MOVE*} rapidamente duas vezes para frente enquanto estiver voando. +No modo de voo, você pode manter pressionado {*CONTROLLER_ACTION_JUMP*} para se mover para cima e {*CONTROLLER_ACTION_SNEAK*} para se mover para baixo ou usar {*CONTROLLER_ACTION_DPAD_UP*} para se mover para cima, {*CONTROLLER_ACTION_DPAD_DOWN*} para se mover para baixo, +{*CONTROLLER_ACTION_DPAD_LEFT*} para se mover para a esquerda e {*CONTROLLER_ACTION_DPAD_RIGHT*} para se mover para a direita. {*T3*}COMO JOGAR: OPÇÕES DE HOST E JOGADOR{*ETW*}{*B*}{*B*} @@ -300,6 +300,27 @@ Ao carregar ou criar um mundo, você pode pressionar o botão "Mais Opções" pa {*T2*}Privilégios do Host{*ETW*}{*B*} Quando habilitado, o host pode ativar ou desativar no menu do jogo sua habilidade de voar, desativar a exaustão e ficar invisível. {*DISABLES_ACHIEVEMENTS*}{*B*}{*B*} + {*T2*}Ciclo do dia{*ETW*}{*B*} + Quando desativado, a hora do dia não muda.{*B*}{*B*} + + {*T2*}Manter inventário{*ETW*}{*B*} + Quando ativada, jogadores vão manter o inventário ao morrer.{*B*}{*B*} + + {*T2*}Surgimento de criaturas{*ETW*}{*B*} + Quando desativado, criaturas não aparecerão naturalmente.{*B*}{*B*} + + {*T2*}Assédio por criaturas{*ETW*}{*B*} + Quando desativado,impede monstros e animais de mudar blocos (por exemplo, explosões de Creepers não destróem blocos e ovelhas não removem grama) ou pegar itens.{*B*}{*B*} + + {*T2*}Itens de criaturas{*ETW*}{*B*} + Quando desativado, monstros e animais não derrubam itens (por exemplo, Creepers não derrubam pólvora).{*B*}{*B*} + + {*T2*}Itens de blocos{*ETW*}{*B*} + Quando desativado, blocos não derrubam itens ao serem destruídos (por exemplo, blocos de pedra não derrubam paralelepípedos).{*B*}{*B*} + + {*T2*}Regeneração natural{*ETW*}{*B*} + Quando desativada, jogadores não regeneram vida naturalmente.{*B*}{*B*} + {*T1*}Opções de Geração de Mundo{*ETW*}{*B*} Ao criar um novo mundo, há algumas opções adicionais.{*B*}{*B*} @@ -316,7 +337,7 @@ Ao criar um novo mundo, há algumas opções adicionais.{*B*}{*B*} Quando ativado, o Submundo é recriado. É útil quando se tem um jogo salvo mais antigo em que as Fortalezas do Submundo não estavam presentes.{*B*}{*B*} {*T1*}Opções no Jogo{*ETW*}{*B*} - Durante o jogo, várias opções podem ser acessadas pressionando BACK para abrir o menu do jogo.{*B*}{*B*} + Durante o jogo, várias opções podem ser acessadas pressionando {*BACK_BUTTON*} para abrir o menu do jogo.{*B*}{*B*} {*T2*}Opções do Host{*ETW*}{*B*} O jogador host e os jogadores definidos como moderadores podem acessar o menu "Opção do Host". Neste menu, eles podem habilitar e desabilitar as opções Fogo Espalha e TNT Explode.{*B*}{*B*} @@ -325,13 +346,13 @@ Ao criar um novo mundo, há algumas opções adicionais.{*B*}{*B*} Para modificar os privilégios de um jogador, selecione o nome dele e pressione {*CONTROLLER_VK_A*} para abrir o menu privilégios do jogador, onde você poderá usar as opções a seguir.{*B*}{*B*} {*T2*}Pode Construir e Minerar{*ETW*}{*B*} - Esta opção só está disponível quando "Confiar nos Jogadores" está ativado. Quando esta opção está habilitada, o jogador pode interagir com o mundo normalmente. Quando está desativada, o jogador não pode colocar nem destruir blocos, nem interagir com muitos itens e blocos.{*B*}{*B*} + Esta opção só está disponível quando "Confiar nos Jogadores" está desativada. Quando esta opção está habilitada, o jogador pode interagir com o mundo normalmente. Quando está desativada, o jogador não pode colocar nem destruir blocos, nem interagir com muitos itens e blocos.{*B*}{*B*} {*T2*}Pode utilizar portas e interruptores{*ETW*}{*B*} Esta opção só está disponível quando “Confiar nos Jogadores” está desativada. Quando esta opção estiver desabilitada, o jogador não poderá utilizar portas e interruptores.{*B*}{*B*} - {*T2*}Pode abrir containers{*ETW*}{*B*} - Esta opção só está disponível quando “Confiar nos Jogadores” está desativada. Quando esta opção estiver desabilitada, o jogador não poderá abrir containers, tais como baús.{*B*}{*B*} + {*T2*}Pode abrir recipientes{*ETW*}{*B*} + Esta opção só está disponível quando “Confiar nos Jogadores” está desativada. Quando esta opção estiver desabilitada, o jogador não poderá abrir recipientes, tais como baús.{*B*}{*B*} {*T2*}Pode Atacar Jogadores{*ETW*}{*B*} Esta opção só está disponível quando "Confiar nos Jogadores" está desativado. Quando esta opção estiver desabilitada o jogador não poderá causar danos a outros jogadores.{*B*}{*B*} @@ -343,7 +364,7 @@ Para modificar os privilégios de um jogador, selecione o nome dele e pressione Quando esta opção está habilitada, o jogador pode usar algumas das opções do menu do jogo para mudar privilégios de outros jogadores e algumas opções de mundo.{*B*}{*B*} {*T2*}Expulsar Jogador{*ETW*}{*B*} - Para os jogadores que não estão no mesmo console {*PLATFORM_NAME*} que o jogador host, selecionar esta opção faz o jogador e todos os jogadores que estiverem no console {*PLATFORM_NAME*} dele serem expulsos do jogo. Este jogador não poderá voltar ao jogo até que ele seja reiniciado.{*B*}{*B*} + {*KICK_PLAYER_DESCRIPTION*}{*B*}{*B*} {*T1*}Opções do Jogador Host{*ETW*}{*B*} Se "Privilégios do Host" estiver habilitado, o jogador host poderá modificar alguns privilégios para si mesmo. Para modificar os privilégios de um jogador, selecione o nome dele e pressione {*CONTROLLER_VK_A*} para abrir o menu privilégios do jogador, onde você pode usar as opções a seguir.{*B*}{*B*} @@ -353,14 +374,16 @@ Se "Privilégios do Host" estiver habilitado, o jogador host poderá modificar a {*T2*}Desabilitar Exaustão{*ETW*}{*B*} Esta opção só afeta o modo de Sobrevivência. Quando habilitado, as atividades físicas (voar/correr/pular etc.) não diminuem a barra de alimentos. Entretanto, se o jogador estiver ferido, a barra de alimentos diminuirá lentamente enquanto ele estiver se curando.{*B*}{*B*} - + {*T2*}Invisível{*ETW*}{*B*} Quando esta opção está habilitada, o jogador não está visível para outros jogadores e é invulnerável.{*B*}{*B*} - - {*T2*}É possível Teleportar{*ETW*}{*B*} + + {*T2*}É possível Teleportar{*ETW*}{*B*} Isto permite que o jogador mova a si mesmo ou outros jogadores para outros jogadores no mundo. +Para jogadores que não estão no mesmo console {*PLATFORM_NAME*} que o host, selecionar esta opção vai expulsá-los junto com qualquer jogador conectado em seu console {*PLATFORM_NAME*}. Este jogador não poderá se juntar novamente ao jogo até que seja reiniciado. + Próxima Página Página Anterior @@ -424,56 +447,93 @@ portanto, poderão facilmente se juntar a você. O Que Há de Novo - -{*T3*}Alterações e adições {*ETW*}{*B*}{*B*} -- Novos itens adicionados -Esmeralda, Minério de Esmeralda, Bloco de Esmeralda, Baú Ender, Gancho Disparador, Maçã Dourada Encantada, Bigorna, Vaso de Flor, Parede de Paralelepípedos, Paredes de Parelelepípedos com Musgo, Pintura Podre, Batata, Batata Cozida, Batata Venenosa, Cenoura, Cenoura Dourada, Cenoura na Vareta, Torta de Abóbora, Poção de Visão Noturna, Poção da Invisibilidade, Quartzo, Minério de Quartzo, Bloco de Quartzo, Laje de Quartzo, Escada de Quartzo, Bloco de Quartzo Cinzelado, Coluna de Bloco de Quartzo, Livro Encantado, Tapete.{*B*} -- Novos recipientes adicionados para arenito macio e arenito cinzelado.{*B*} -- Nova multidão adicionada - Aldeões zumbis.{*B*} -- Adicionados novos recursos de geração de terreno - Templos do Deserto, Aldeias Desertas, Templos de Selva.{*B*} -- Adicionado o comércio com aldeões.{*B*} -- Adicionada interface de bigorna.{*B*} -- Armadura de couro tingido.{*B*} -- Colar de lobo tingido.{*B*} -- Montaria no porco com uma cenoura na vareta.{*B*} -- Bônus de baú melhorado contendo mais itens.{*B*} -- Alteradas as posições de meio blocos e outros blocos em meio blocos.{*B*} -- Alteradas as posições de escadas invertidas e lajes.{*B*} -- Adicionadas profissões de cidadões.{*B*} -- Cidadãos vindos de ovos terão uma profissão aleatória.{*B*} -- Adicionado log unilateral.{*B*} -- Fornos podem usar ferramentas de madeira como combustível.{*B*} -- Painéis de gelo e vidro podem ser coletados com pequenos toques de ferramentas encantadas.{*B*} -- Botões de madeira e pratos de pressão de madeira podem ser ativados com flechas.{*B*} -- Pequenas multidões podem aparecer em portais no submundo.{*B*} -- Rastejantes e aranhas são agressivos com o último jogador que acertá-los.{*B*} -- Multidões no modo criativo ficam neutras novamente depois de um curto período.{*B*} -- Contra-ataque removido quando afogar.{*B*} -- Portas sendo quebradas por zumbis mostram danos.{*B*} -- Gelo derrete no submundo.{*B*} -- Calderões enchem quando estiver sem chuva.{*B*} -- Pistões levam o dobro de tempo para melhorar.{*B*} -- O Porco derruba a cela ao ser morto (se tiver uma).{*B*} -- Cor do céu No Fim alterada.{*B*} -- Barbante pode ser substituído (por corda).{*B*} -- Chuva pinga das folhas.{*B*} -- Alavancas podem ser colocadas em baixo dos blocos.{*B*} -- TNT causa dano variável dependendo da configuração de dificuldade.{*B*} -- Livro de receitas alterado.{*B*} -- Barcos quebram lírios, ao invés de lírios quebrarem barcos.{*B*} -- Porcos oferecem mais costeletas.{*B*} -- Lodos aparecem menos em mundos retos.{*B*} -- Rastejadores têm danos variáveis baseado na configuração de dificuldade, mais contra-ataque.{*B*} -- Endermen consertados para não abrir suas mandíbulas.{*B*} -- Adicionado teleporte de jogadores (usando o menu {*BACK_BUTTON*} no jogo).{*B*} --Adicionados novas opções de vôo, invisibilidade e invulnerabilidade para jogadores remotos.{*B*} -- Adicionados novos tutoriais para o Mundo do Tutorial para novos itens e recursos.{*B*} -- Melhorada a posição para o baú de discos musicais no Mundo do Tutorial.{*B*} +{*T3*}Alterações e adições{*ETW*}{*B*}{*B*} +- Novos itens adicionados - Argila endurecida, Argila colorida, Bloco de carvão, fardo de feno, trilho ativador, bloco de redstone, sensor de luz solar, monólito, tremonha, carrinho com tremonha, carrinho com TNT, comparador Redstone, placa de pressão ponderada, farol, baú preso, foguete de artifício, estrela de artifício, estrela do submundo, chumbo, armadura para cavalo, crachá, ovo de surgimento de cavalos{*B*} +- Novas criaturas adicionadas - Wither, esqueletos murchos, bruxas, morcegos, cavalos, burros e mulas{*B*} +- Adicionados novos recursos de geração de terreno - cabanas de bruxas.{*B*} +- Adicionada interface de farol.{*B*} +- Adicionada interface de cavalo.{*B*} +- Adicionada interface de tremonha.{*B*} +- Adicionados fogos de artifício - A interface dos fogos de artifício pode ser acessada na bancada quando tem os ingredientes para fazer uma estrela ou foguete de artifício.{*B*} +- Adicionado 'modo de aventura' - Você só pode quebrar blocos com as ferramentas corretas.{*B*} +- Adicionados muitos sons novos.{*B*} +- Criaturas, itens e projéteis agora podem passar pelos portais.{*B*} +- Repetidores agora podem ser trancados alimentando suas laterais com outro repetidor.{*B*} +- Agora zumbis e esqueletos podem surgir com armas e armaduras diferentes.{*B*} +- Novas mensagens de morte.{*B*} +- Nomeie criaturas com um crachá, e renomeie recipientes para mudar o título quando o menu está aberto.{*B*} +- Farelo de osso não mais faz tudo crescer imediatamente, agora cresce aleatoriamente em estágios.{*B*} +- Um sinal de redstone descrevendo o conteúdo de baús, barracas de poções, distribuidores e jukeboxes podem ser detectados colocando um comparador redstone diretamente contra eles.{*B*} +- Distribuidores podem ser colocados em qualquer direção.{*B*} +- Comer uma maçã dourada dá ao jogador vida "de absorção" extra por um curto período.{*B*} +- Quanto mais você fica em uma área, mais difíceis são as criaturas que surgem naquela área.{*B*} + +{*ETB*}Bem-vindo(a) de volta! Talvez você não tenha notado que o seu Minecraft foi atualizado.{*B*}{*B*} +Há muitos recursos novos para você e seus amigos experimentarem, aqui estão apenas alguns destaques. Dê uma lida e divirta-se!{*B*}{*B*} +\{*T1*}Novos itens{*ETB*} - Argila endurecida, argila colorida, bloco de carvão, fardo de feno, trilho ativador, bloco de redstone, sensor de luz do dia, distribuidor, tremonha, carrinho com tremonha, carrinho com TNT, comparador redstone, placa de pressão ponderada, farol, baú preso, estrela e foguete de artifício, estrela do Submundo, chumbo, armadura de cavalos, crachá, ovo de surgimento de cavalos{*B*}{*B*} +{*T1*}Novas criaturas{*ETB*} - Wither, esqueletos murchos, bruxas, morcegos, cavalos, burros e mulas{*B*}{*B*} +{*T1*}Novos recursos{*ETB*} - Dome e cavalgue um cavalo, faça fogos de artifício e dê um show, nomeie animais e monstros com um crachá, crie circuitos redstone mais avançados, e novas opções de anfitrião para ajudar a controlar o que os convidados podem fazer no seu mundo!{*B*}{*B*} +{*T1*}Novo mundo tutorial{*ETB*} – Aprenda a usar os recursos novos e velhos no mundo tutorial. Veja se consegue encontrar todos os discos de música secretos escondidos no mundo!{*B*}{*B*} -{*ETB*}Bem-vindo de volta! Talvez você não tenha notado que o seu Minecraft foi atualizado.{*B*}{*B*} -Há muitos recursos novos para você e seus amigos experimentarem, aqui estão apenas alguns destaques. Dê uma lida e divirta-se!{*B*}{*B*} -{*T1*}Novos itens{*ETB*} - Esmeralda, Minério de Esmeralda, Bloco de Esmeralda, Baú Ender, Gancho Disparador, Maçã Dourada Encantada, Bigorna, Vaso de Flor, Parede de Paralelepípedos, Paredes de Parelelepípedos com Musgo, Pintura Podre, Batata, Batata Cozida, Batata Venenosa, Cenoura, Cenoura Dourada, Cenoura na Vareta, Torta de Abóbora, Poção de Visão Noturna, Poção da Invisibilidade, Quartzo, Minério de Quartzo, Bloco de Quartzo, Laje de Quartzo, Escada de Quartzo, Bloco de Quartzo Cinzelado, Coluna de Bloco de Quartzo, Livro Encantado, Tapete{*B*}{*B*} -{*T1*}Novas multidões{*ETB*} - Aldeões zumbis.{*B*}{*B*}\r\n{*T1*}Novos recursos{*ETB*} - Comércio com aldeões, consertar ou encantar armas e ferramentas com uma Bigorna, armazenar itens em um Baú Ender, controle de um porco enquanto o monta usando uma cenoura na vareta!{*B*}{*B*}\r\n{*T1*}Novos Mini-tutoriais{*ETB*} – Saiba como usar os novos recursos no Tutorial do Mundo!{*B*}{*B*}\r\n{*T1*}Novos "Ovos de Páscoa"{*ETB*} – Movemos todos os Discos de música secretos no Mundo do Tutorial. Veja se consegue encontrá-los novamente!{*B*}{*B*}\r\n +Cavalos + +{*T3*}COMO JOGAR: CAVALOS{*ETW*}{*B*}{*B*} +Cavalos e burros são encontrados principalmente em planícies. Mulas são o fruto de um burro e um cavalo, mas são estéreis.{*B*} +Todos os cavalos, burros e mulas adultos são animais de montaria. No entanto, apenas os cavalos podem usar armadura, ao passo que só as mulas e os burros podem portar alforjes para transportar itens.{*B*}{*B*} +Cavalos, burros e mulas devem ser domesticados antes que possam ser usados. Para domesticar um cavalo, basta tentar montá-lo e permanecer montado enquanto ele tenta arremessar o montador.{*B*} +Quando aparecem coraçõezinhos em volta do cavalo, ele terá sido domesticado e não tentará mais se livrar do(a) jogador(a). Para guiar um cavalo, o jogador deve equipar uma sela sobre o animal.{*B*}{*B*} +As selas podem ser compradas de aldeões ou encontradas dentro de Baús no mundo.{*B*} +Você pode equipar alforjes em burros e mulas domesticados ao amarrar um Baú. Esses alforjes podem, então, ser acessados enquanto você monta ou se esgueira.{*B*}{*B*} +Cavalos e burros (mas não mulas) podem ser criados como os outros animais utilizando-se Maçãs Douradas ou Cenouras Douradas.{*B*} +Potros se tornarão cavalos adultos com o tempo, embora alimentá-los com Trigo ou Feno acelere o processo.{*B*} + + +Faróis + +{*T3*}COMO JOGAR: FARÓIS{*ETW*}{*B*}{*B*} +Faróis ativos projetam um feixe de luz clara no céu e concedem poderes aos jogadores próximos.{*B*} +Eles podem ser produzidos com Vidro, Obsidiana e Estrelas do Submundo, obtidas ao derrotar-se o Wither.{*B*}{*B*} +Os faróis devem ser posicionados de forma a receberem luz solar durante o dia. Eles devem ser colocados em pirâmides de ferro, ouro, esmeralda ou diamante.{*B*} +O material sobre o qual é posicionado não afeta o poder do farol.{*B*}{*B*} +No menu do Farol, você pode selecionar o poder principal deste farol. Quanto mais níveis sua pirâmide tiver, maior será o número de opções de poderes disponível para escolha.{*B*} +Um farol em uma pirâmide com pelo menos quatro níveis também concede a opção de Regenerar o segundo poder ou aumentar o poder do primeiro.{*B*}{*B*} +Para definir os poderes do seu farol, sacrifique uma esmeralda, um diamante, um ouro ou um lingote de ferro no espaço de pagamento.{*B*} +Quando tudo estiver montado, os poderes emanarão do farol indefinidamente.{*B*} + + +Fogos de artifício + +{*T3*}COMO JOGAR : FOGOS DE ARTIFÍCIO{*ETW*}{*B*}{*B*} +Fogos de artifício são itens decorativos que podem ser lançaodos à mão ou de distribuidores. Eles são criados usando papel, pólvora e opcionalmente um número de estrelas de artifício.{*B*} +As cores, desvanecimento, forma, tamanho e efeitos (como trilhas e brilho) das estrelas de artifício podem ser customizados incluindo ingredientes adicionais na criação.{*B*}{*B*} +Para criar um fogo de artifício coloque pólvora e papel na grade de criação 3x3 que é mostrada acima do seu inventário.{*B*} +Opcionalmente, você pode colocar várias estrelas de artifício na grade de criação para adicioná-los ao fogo de artifício.{*B*} +Encher mais vagas na grade de criação com pólvora aumenta a altura na qual as estrelas de artifício explodem.{*B*}{*B*} +Depois você pode tirar o fogo de artifício do espaço de resultado.{*B*}{*B*} +Estrelas de artifício podem ser criadas colocando pólvora e corante na grade de criação.{*B*} + - O corante ajusta a cor da explosão da estrela de artifício.{*B*} + - A forma da estrela de artifício é configurada adicionando uma carga de fogo, barra de ouro, pena ou cabeça de criatura.{*B*} + - Uma trilha ou um brilho podem ser adicionados usando diamantes ou pó de glowstone.{*B*}{*B*} +Depois que uma estrela de fogos de artifício foi criada, você pode ajustar a cor de desvanecimento da estrela de artifício combinando-a com um corante. + + +Tremonhas + +{*T3*}COMO JOGAR: TREMONHAS{*ETW*}{*B*}{*B*} +Tremonhas são usadas para inserir ou remover itens de recipientes e para pegar automaticamente os itens lançados dentro delas.{*B*} +Elas afetam Barraca de Poções, Baús, Distribuidor, Monólitos, Carrinhos com Baús, Carrinhos com Tremonhas, assim como outras Tremonhas.{*B*}{*B*} +Tremonhas farão tentativas contínuas de sugar os itens de recipientes convenientes que estejam acima delas. Além disso, também tentarão inserir itens depositados em um recipiente de saída.{*B*} +Se uma Tremonha for movida a Redstone, ela se tornará inativa e deixará de sugar e inserir itens.{*B*}{*B*} +Uma Tremonha aponta na direção que tenta retirar os itens. Para fazer uma Tremonha apontar para um bloco específico, coloque-a em frente a este bloco enquanto se esgueira.{*B*} + + +Monólitos + +{*T3*}COMO JOGAR : MONÓLITOS{*ETW*}{*B*}{*B*} +Quando alimentado com um sinal de Redstone, monólitos derrubam aleatoriamente um dos itens armazenados. Use {*CONTROLLER_ACTION_USE*} para abrir o monólito e então carregá-lo com itens do seu inventário.{*B*} +Se o monólito estiver de frente para um baú ou outro tipo de recipiente, o item será colocado ali ao invés de cair no chão. Longas correntes de monólitos podem ser construídos para carregar itens. Para que isso funcione, eles devem ser ativados e desativados alternadamente. + Causa mais danos que à mão. @@ -600,10 +660,36 @@ As cores da cama são sempre as mesmas, independentemente da cor da lã usada. Cria uma imagem da área explorada enquanto você o segura. Pode ser usado para encontrar caminhos. +Quando usado, vira um mapa da parte do mundo onde você está, sendo preenchido conforme você explora. + Permite ataques à distância usando flechas. Usada como munição para arcos. +Derrubados pelo Wither, utilizado na produção de Faróis. + +Quando ativado, cria explosões coloridas. Determina-se a cor, o efeito, o formato e o desvanecimento pela Estrela de Artifício usada na criação do Fogo de Artifício. + +Usado para determinar a cor, efeito e formato do Fogo de Artifício. + +Usados em circuito de Redstone para manter, comparar e subtrair a força do sinal ou para medir os estados de determinados blocos. + +Um tipo de Carrinho de Minas que funciona como um bloco de TNT móvel. + +É um bloco que produz um sinal Redstone derivado de luz do sol (ou a falta dela). + +Tipo especial de Carrinho de Minas que funciona de forma similar a uma Tremonha. Ele coletará os itens deixados nos trilhos e nos recipientes acima dele. + +Tipo especial de armadura que pode ser equipada em um cavalo. Oferece 5 de Armadura. + +Tipo especial de armadura que pode ser equipada em um cavalo. Oferece 7 de Armadura. + +Tipo especial de armadura que pode ser equipada em um cavalo. Oferece 11 de Armadura. + +Usado para amarrar criaturas ao jogador ou postes de cercas + +Usado para nomear criaturas no mundo. + Restaura 2,5{*ICON_SHANK_01*}. Restaura 1{*ICON_SHANK_01*}. Pode ser usado 6 vezes. @@ -655,7 +741,7 @@ Também pode ser usado para pouca iluminação. Quando ativado, acelera os carrinhos de minas que passam sobre ele. Quando desativado, faz os carrinhos pararem nele. -Funciona como uma chapa de pressão (envia um sinal Redstone quando ativado), mas só pode ser ativado por um carrinho de minas. +Funciona como uma chapa de pressão (envia um sinal Redstone quando ativado), mas só pode ser ativado por um Carrinho de Minas. Usado para transportar você, um animal ou um monstro sobre trilhos. @@ -928,100 +1014,158 @@ Também pode ser usado para pouca iluminação. As Cabeças de multidão podem ser colocadas como decoração, ou usadas como máscara na abertura do capacete. +Usado para executar comandos. + +Projeta um feixe de luz no céu e pode oferecer efeitos de status para os jogadores próximos. + +Armazena blocos e itens dentro. Coloque dois baús, lado a lado, para criar um baú maior com o dobro de capacidade. Além disso, o baú preso cria uma carga Redstone quando aberto. + +Oferece uma carga Redstone. A carga será mais forte se houver mais itens na chapa. + +Oferece uma carga Redstone. A carga será mais forte se houver mais itens na chapa. Exige mais peso que uma chapa leve. + +Usado como fonte de energia redstone. Redstones podem ser criadas a partir dele. + +Usado para capturar itens, transferi-los ou retirá-los de recipientes. + +Um tipo de corrimão que habilita ou desabilita Carrinhos de Minas com Tremonhas e aciona Carrinhos de Minas com TNT. + +Usado para segurar e derrubar itens ou empurrá-los em outros recipientes quando recebem carga Redstone. + +Blocos coloridos produzidos ao tingir-se a argila endurecida. + +Pode alimentar Cavalos, Burros e Mulas para curar até 10 Corações. Acelera o crescimento de potros. + +Criado ao cozinhar a argila no forno. + +Criado a partir de vidro e um corante. + +Criado a partir de um vitral + +Uma forma compacta de armazenar carvão. Pode ser usado como combustível em fornalhas. + Lula - + Solta sacos de tinta quando morta. - + Vaca - + Solta couro quando morta. Pode ser ordenhada com um balde. - + Ovelha - + Solta lã quando tosquiada (se já não tiver sido tosquiada). Pode ser tingida para produzir lã de cores diferentes. - + Galinha - + Solta penas quando morta e põe ovos aleatoriamente. - + Porco - + Solta costeletas quando morto. Pode ser montado usando uma sela. - + Lobo - + Dócil até ser atacado, quando atacará de volta. Pode ser domado usando ossos, o que faz o lobo segui-lo e atacar qualquer coisa que ataque você. - + Creeper - + Explode se você chegar muito perto! - + Esqueleto - + Dispara flechas em você. Solta flechas quando morto. - + Aranha - + Ataca quando você chega perto. Escala paredes. Solta fio quando morta. - + Zumbi - + Ataca quando você chega perto. - + Homem-porco zumbi - + Inicialmente dócil, mas ataca em grupos se você ataca um deles. - + Ghast - + Atira bolas de fogo em você, que explodem ao contato. - + Slime - + Divide-se em slimes menores quando atingido. - + Enderman - + Atacará se você olhar para ele. Também pode mover blocos. - + Traça - + Atrai as Traças próximas quando atacada. Esconde-se em blocos de pedra. - + Aranha de Caverna - + Tem uma mordida venenosa. - + Vacogumelo - + Faz sopa de cogumelo quando usada com uma vasilha. Derruba cogumelos e torna-se uma vaca normal depois de tosquiada. - + Golem de Neve - + O Golem de Neve pode ser criado pelos jogadores usando blocos de neve e uma abóbora. Ele atira bolas de neve nos inimigos dos seus criadores. - + Dragão Ender - + Este é um grande dragão negro encontrado no Final. - + Chama - + Estes são inimigos encontrados no Submundo, geralmente dentro das Fortalezas do Submundo. Derrubam Varas de Chamas quando são mortos. - + Cubo de Magma - + Eles são encontrados no Submundo. Similares aos Slimes, dividem-se em versões menores quando são mortos. - + Aldeão - + Ocelote - + Estes podem ser encontrados nas florestas. Eles podem ser domesticados, alimentando-os com Peixe Cru. Mas você deve deixar o Ocelote se aproximar, pois quaisquer movimentos bruscos podem assustá-lo e fazê-lo fugir. - + Golem de Ferro - + Aparece em vilas para protegê-las e podem ser criados usando blocos de ferro e abóboras. - + +Morcego + +Estas criaturas voadoras são encontradas nas cavernas ou em outros espaços fechados. + +Bruxa + +Estas inimigas podem ser encontradas em pântanos e atacam atirando Poções. Derrubam Poções quando mortas. + +Cavalo + +Estes animais podem ser domesticados e então montados. + +Burro + +Estes animais podem ser domesticados e então montados. Podem portar baús amarrados. + +Mula + +Fruto do cruzamento entre um cavalo e um burro. Estes animais podem ser domesticados e então montados, e podem carregar baús. + +Cavalo Zumbi + +Cavalo Esqueleto + +Wither + +Estes são criados a partir de Caveiras Murchas ou Areia Movediça. Atiram caveiras explosivas em você. + Explosives Animator Concept Artist @@ -1368,6 +1512,8 @@ Também pode ser usado para pouca iluminação. Mapa +Mapa vazio + Disco - "13" Disco de Música - "cat" @@ -1470,6 +1616,28 @@ Também pode ser usado para pouca iluminação. Cabeça de creeper +Estrela do Submundo + +Foguete de Artifício + +Estrela de Artifício + +Comparador Redstone + +Carrinho com TNT + +Carrinho com Tremonha + +Armadura de Ferro para Cavalo + +Armadura de Ouro para Cavalo + +Armadura de Diamante para Cavalo + +Chumbo + +Crachá + Pedra Bloco de Grama @@ -1486,6 +1654,8 @@ Também pode ser usado para pouca iluminação. Tábua de madeira de floresta +Tábuas (qualquer tipo) + Muda Muda de Carvalho @@ -1822,6 +1992,190 @@ Também pode ser usado para pouca iluminação. Caveira +Bloco de Comando + +Farol + +Baú Preso + +Chapa de Pressão Ponderada (Leve) + +Chapa de Pressão Ponderada (Pesada) + +Comparador Redstone + +Sensor de Luz Solar + +Bloco de Redstone + +Tremonha + +Trilho Ativador + +Monólito + +Argila colorida + +Fardo de Feno + +Argila endurecida + +Bloco de carvão + +Argila colorida preta + +Argila colorida vermelha + +Argila colorida verde + +Argila colorida marrom + +Argila colorida azul + +Argila colorida roxa + +Argila colorida ciano + +Argila colorida cinza claro + +Argila colorida cinza + +Argila colorida rosa + +Argila colorida verde-limão + +Argila colorida amarela + +Argila colorida azul claro + +Argila colorida magenta + +Argila colorida laranja + +Argila colorida branca + +Vitral + +Vitral preto + +Vitral vermelho + +Vitral verde + +Vitral marrom + +Vitral azul + +Vitral roxo + +Vitral ciano + +Vitral cinza claro + +Vitral cinza escuro + +Vitral rosa + +Vitral verde-limão + +Vitral amarelo + +Vitral azul claro + +Vitral magenta + +Vitral laranja + +Vitral branco + +Painel de vitral + +Painel de vitral preto + +Painel de vitral vermelho + +Painel de vitral verde + +Painel de vitral marrom + +Painel de vitral azul + +Painel de vitral roxo + +Painel de vitral ciano + +Painel de vitral cinza claro + +Painel de vitral cinza + +Painel de vitral rosa + +Painel de vitral verde-limão + +Painel de vitral amarelo + +Painel de vitral azul claro + +Painel de vitral magenta + +Painel de vitral laranja + +Painel de vitral branco + +Bola pequena + +Bola grande + +Forma Estelar + +Forma de Creeper + +Explosão + +Formato desconhecido + +Preto + +Vermelho + +Verde + +Marrom + +Azul + +Roxo + +Ciano + +Cinza claro + +Cinza + +Rosa + +Verde-limão + +Amarelo + +Azul claro + +Magenta + +Laranja + +Branco + +Personalizado + +Desbotado + +Brilho + +Trilho + +Duração do voo: +  Controles Atuais Estilo @@ -1999,8 +2353,7 @@ Também pode ser usado para pouca iluminação. Este é seu inventário. Ele mostra os itens disponíveis para uso em sua mão e todos os outros itens que está carregando. Sua armadura também é mostrada aqui. - - + {*B*} Pressione{*CONTROLLER_VK_A*} para continuar.{*B*} Pressione {*CONTROLLER_VK_B*} se já souber usar o inventário. @@ -2021,7 +2374,7 @@ Também pode ser usado para pouca iluminação. - Para obter mais informações sobre um item, passe o ponteiro do mouse sobre ele e pressione {*CONTROLLER_VK_RT*}. + Para obter mais informações sobre um item, passe o ponteiro do mouse sobre ele e pressione {*CONTROLLER_ACTION_MENU_PAGEDOWN*} . @@ -2055,7 +2408,7 @@ Também pode ser usado para pouca iluminação. - Para obter mais informações sobre um item, passe o ponteiro do mouse sobre ele e pressione {*CONTROLLER_VK_RT*}. + Para obter mais informações sobre um item, passe o ponteiro do mouse sobre ele e pressione {*CONTROLLER_ACTION_MENU_PAGEDOWN*} . @@ -2602,6 +2955,211 @@ No modo de voo, mantenha pressionado {*CONTROLLER_ACTION_JUMP*}para se mover par Pressione {*CONTROLLER_VK_B*}se já souber usar a barra de alimentos e como comer. + + Esta é a interface do inventário do cavalo. + + + + {*B*}Pressione{*CONTROLLER_VK_A*} para continuar. + {*B*}Pressione{*CONTROLLER_VK_B*} se você já sabe usar o inventário do cavalo. + + + + O inventário do cavalo permite a você transferir ou equipar itens no seu Cavalo, Burro ou Mula. + + + + Sele o cavalo posicionando a sela em seu respectivo espaço. Cavalos podem receber armadura ao se posicionar a Armadura de Cavalo em seu respectivo espaço. + + + + Você também pode transferir os itens entre o seu inventário e os alforjes amarrados aos burros e mulas neste menu. + + +Você encontrou um Cavalo. + +Você encontrou um Burro. + +Você encontrou uma Mula. + + + {*B*}Pressione{*CONTROLLER_VK_A*} para saber mais sobre Cavalos, Burros e Mulas. + {*B*}Pressione{*CONTROLLER_VK_B*} se você já sabe sobre Cavalos, Burros e Mulas. + + + + Cavalos e burros são encontradas principalmente em planícies abertas. Mulas são o fruto de um burro e um cavalo, mas são estéreis. + + + + Todos os cavalos, burros e mulas adultos são animais de montaria. No entanto, apenas os cavalos podem usar armadura, ao passo que só as mulas e os burros podem portar alforjes para transportar itens. + + + + Cavalos, burros e mulas devem ser domesticados antes que possam ser usados. Para domesticar um cavalo, basta tentar montá-lo e permanecer montado enquanto ele tenta tenta arremessar quem o monta. + + + + \Quando aparecem coraçõezinhos em volta do cavalo, ele terá sido domesticado e não tentará mais se livrar do(a) jogador(a). + + + + Tente montar agora neste cavalo. Use {*CONTROLLER_ACTION_USE*} sem itens ou ferramentas na mão para montar. + + + + Para guiar um cavalo, o jogador deve equipar uma sela sobre o animal, que pode ser comprada de aldeões, pescada ou encontrada dentro de baús no mundo. + + + + Você pode equipar alforjes em burros e mulas domesticados ao amarrar um Baú. Estes alforjes podem então ser acessados enquanto você monta ou se esgueira. + + + + Cavalos e burros (mas não mulas) podem ser criados como outros animais utilizando-se Maçãs Douradas ou Cenouras Douradas. Potros se tornarão cavalos adultos com o tempo, embora alimentá-los com Trigo ou Feno acelere o processo. + + + + Você pode tentar domesticar cavalos e burros aqui; além disso, há selas, armaduras de cavalos e outros itens úteis para cavalos nos baús pelas redondezas. + + + + Esta é a interface do Farol, que você pode usar para escolher os poderes que o seu farol vai conceder. + + + + {*B*}Pressione{*CONTROLLER_VK_A*} para continuar. + {*B*}Pressione{*CONTROLLER_VK_B*} se você já sabe usar a interface do Farol. + + + + No menu do Farol, você pode selecionar o poder principal deste farol. Quanto mais níveis sua pirâmide tiver, maior será o número de opções de poderes disponível para escolha. + + + + Um farol em uma pirâmide com pelo menos 4 níveis também concede a opção de Regenerar o segundo poder ou aumentar o poder do primeiro. + + + + Para definir os poderes do seu farol, sacrifique uma Esmeralda, Diamante, Ouro ou Lingote de Ferro no espaço de pagamento. Quando tudo estiver montado, os poderes emanarão do farol indefinidamente. + + +Há um farol inativo no topo desta pirâmide. + + + {*B*}Pressione{*CONTROLLER_VK_A*} para saber mais sobre os Faróis. + {*B*}Pressione{*CONTROLLER_VK_B*} se você já sabe sobre os Faróis. + + + + Faróis ativos projetam um feixe de luz clara no céu e concedem poderes aos jogadores próximos. Eles podem ser produzidos com vidro, obsidiana e estrelas do Submundo, obtidas ao derrotar o Wither. + + + + Os faróis devem ser posicionados de forma a receberem luz solar durante o dia. Eles devem ser colocados em pirâmides de ferro, ouro, esmeralda ou diamante. No entanto, o material sobre o qual um farol é posicionado não afeta o poder do farol. + + + + Tente usar o Farol para definir os poderes que ele concede. Você pode usar lingotes de ferro concedidos como o pagamento necessário. + + +Esta sala contém Tremonhas + + + {*B*}Pressione{*CONTROLLER_VK_A*} para saber mais sobre as Tremonhas. + {*B*}Press{*CONTROLLER_VK_B*} se você já sabe sobre as Tremonhas. + + + + Tremonhas são usadas para inserir ou remover itens de recipientes e para pegar itens lançados dentro delas automaticamente. + + + + Elas afetam as Barraca de Poções, Baús, Distribuidor, Monólitos, Carrinhos com Baús, Carrinhos com Tremonhas, assim como outras Tremonhas. + + + + Tremonhas farão tentativas contínuas de sugar os itens de recipientes apropriados acima delas. Além disso, também tentarão inserir itens depositados em um recipiente de saída. + + + + Se uma Tremonha for movida a Redstone, ela se tornará inativa e deixará de sugar e inserir itens. + + + + Uma Tremonha aponta na direção que tenta retirar os itens. Para fazer uma Tremonha apontar para um bloco específico, coloque-a em frente a este bloco enquanto se esgueira. + + + + Há diversos modelos de Tremonhas para você ver e experimentar nesta sala. + + + + Essa é a interface de fogos de artifício, que você pode usar para fazer fogos de artifício e estrelas de fogos de artifício. + + + + {*B*}Pressione{*CONTROLLER_VK_A*} para continuar. + {*B*}Pressione{*CONTROLLER_VK_B*} se você já sabe usar a interface do Farol. + + + + Para fazer fogos de artifício coloque pólvora e papel na grade de fabricação 3x3 acima do seu inventário. + + + + Opcionalmente, você pode colotar múltiplas estrelas de fogos de artifício na grade de fabricação, para adicioná-las ao fogo de artifício sendo fabricado. + + + + Encher mais espaços na grade de fabricação com pólvora aumenta a altura na qual as estrelas de fogos de artifício explodem. + + + + Depois você pode remover o fogo de artifício do espaço de resultado, quando quiser criá-lo. + + + + Estrelas de fogo de artifício podem ser feitas colocando pólvora e corante na grade de fabricação. + + + + O corante define a cor da explosão na estrela de fogos de artifício. + + + + A forma da estrela de fogos de artifício é definida ao adicionar uma carga de fogo, barra de ouro, pena or cabeça. + + + + Uma trilha ou brilho pode ser adicionado usando diamantes e pó de glowstone. + + + + Depois da criação de uma estrela de fogos de artifício, você pode ajustar a cor de desvanecimento combinando-a com um corante. + + + + Contido nos baús aqui estão vários itens usados na criação de FOGOS DE ARTIFÍCIO! + + + + {*B*}Pressione{*CONTROLLER_VK_A*} para aprender mais sobre fogos de artifício. + {*B*}Pressione{*CONTROLLER_VK_B*} se você já sabe sobre fogos de artifício. + + + + Fogos de artifício são itens decorativos que podem ser lançados à mão ou de distribuidores. Eles podem ser criados com papel, pólvora e opcionalmente um punhado de estrelas de fogos de artifício. + + + + As cores, desvanecimento, forma, tamanho e efeitos (como trilhas e brilhos) das estrelas de fogos de artifício podem ser customizados usando ingredientes extras na criação. + + + + Tente criar um fogo de artifício na bancada usando um sortimento de ingredientes dos baús. + +  Selecionar Usar @@ -2824,6 +3382,22 @@ No modo de voo, mantenha pressionado {*CONTROLLER_ACTION_JUMP*}para se mover par Carregar jogo salvo para o Xbox One +Montar + +Desmontar + +Baú amarrado + +Lançar + +Rédea + +Soltar + +Amarrar + +Nomear + OK Cancelar @@ -3134,6 +3708,20 @@ Deseja desbloquear a versão integral do jogo? Distribuidor +Cavalo + +Monólito + +Tremonha + +Farol + +Poder Principal + +Poder Secundário + +Carrinho de Minas + Não há ofertas de conteúdo para baixar desse tipo disponíveis para este título no momento. %s entrou no jogo. @@ -3293,10 +3881,14 @@ Deseja instalar o pacote de combinações ou o pacote de texturas agora? Modo Jogo Criativo +Modo de Jogo: Aventura + Sobrevivência Criativo +Aventura + Criado em Sobrevivência Criado em Criativo @@ -3317,6 +3909,8 @@ Deseja instalar o pacote de combinações ou o pacote de texturas agora? Superplano +Insira uma semente para gerar novamente o mesmo terreno. Deixe vazio para um mundo aleatório. + Quando habilitado, o jogo será um jogo online. Quando habilitado, apenas jogadores convidados poderão entrar. @@ -3333,7 +3927,7 @@ Deseja instalar o pacote de combinações ou o pacote de texturas agora? Quando habilitado, o host pode alternar o vôo, desabilitar exaustão e ficar invisível pelo menu do jogo. Desabilita atualizações de conquistas e de placar de líderes. -Quando ativado, o Submundo é recriado. É útil quando se tem um jogo salvo mais antigo em que as Fortalezas do Submundo não estavam presentes. +Ao ativar, recria o Submundo. Útil para mundos criados quando Fortalezas do Submundo ainda não existiam. Quando habilitado, estruturas como Vilas e Fortalezas serão geradas no mundo. @@ -3341,6 +3935,20 @@ Deseja instalar o pacote de combinações ou o pacote de texturas agora? Quando habilitado, um baú contendo alguns itens úteis será criado perto do ponto de criação do jogador. +Quando desativada, impede que monstros e animais alterem os bloco (por exemplo, as explosões dos Creepers não destroem os blocos e as Ovelhas não removem a Grama) ou peguem itens. + +Quando ativada, os jogadores manterão o inventário ao morrer. + +Quando desativada, as criaturas não aparecerão naturalmente. + +Quando desativada, monstros e animais não deixarão itens (por exemplo, os Creepers não vão deixar cair pólvora). + +Quando desativada, os blocos vão parar de derrubar itens ao serem destruídos (por exemplo, blocos de pedra não derrubarão mais paralelepípedos). + +Quando desativada, os jogadores não regenerarão a saúde naturalmente. + +Quando desativada, a hora do dia não sofrerá alteração. + Pacotes de Capas Temas @@ -3389,7 +3997,49 @@ Deseja instalar o pacote de combinações ou o pacote de texturas agora? {*PLAYER*} foi esmurrado por {*SOURCE*} -{*PLAYER*} foi morto por {*SOURCE*} +{*PLAYER*} foi morto por {*SOURCE*} usando magia + +{*PLAYER*} caiu da escada + +{*PLAYER*} caiu de algumas videiras + +{*PLAYER*} caiu para fora da água + +{*PLAYER*} caiu de um lugar alto + +{*PLAYER*} foi condenado(a) a cair por {*SOURCE*} + +{*PLAYER*} foi condenado(a) a cair por {*SOURCE*} + +{*PLAYER*} foi condenado(a) a cair por {*SOURCE*} usando {*ITEM*} + +{*PLAYER*} caiu muito longe e foi eliminado(a) por {*SOURCE*} + +{*PLAYER*} caiu muito longe e foi eliminado(a) por {*SOURCE*} usando {*ITEM*} + +{*PLAYER*} andou sobre as chamas enquanto lutava {*SOURCE*} + +{*PLAYER*} virou cinzas enquanto lutava {*SOURCE*} + +{*PLAYER*} tentou nadar na lava para escapar{*SOURCE*} + +{*PLAYER*} afogou-se enquanto tentava escapar{*SOURCE*} + +{*PLAYER*} pisou no cacto enquanto tentava escapar {*SOURCE*} + +{*PLAYER*} foi explodido(a) por {*SOURCE*} + +{*PLAYER*} secou até morrer + +{*PLAYER*} foi assassinado por {*SOURCE*} usando {*ITEM*} + +{*PLAYER*} foi baleado(a) {*SOURCE*} usando {*ITEM*} + +{*PLAYER*} levou uma bola de fogo de {*SOURCE*} usando {*ITEM*} + +{*PLAYER*} foi socado(a) por {*SOURCE*} usando {*ITEM*} + +{*PLAYER*} foi morto(a) por {*SOURCE*} usando {*ITEM*} Neblina Base @@ -3566,6 +4216,8 @@ Deseja instalar o pacote de combinações ou o pacote de texturas agora? Não é possível usar o ovo spawn no momento. O número máximo de lulas em um mundo foi alcançado. +Não pode usar um Ovo de Criação no momento. O número máximo de Morcegos em um mundo foi alcançado. + Não é possível usar o Ovo de Criação no momento. O número máximo de inimigos no mundo já foi alcançado. Não é possível usar o Ovo de Criação no momento. O número máximo de aldeões no mundo já foi alcançado. @@ -3574,12 +4226,14 @@ Deseja instalar o pacote de combinações ou o pacote de texturas agora? Você não pode gerar inimigos no Modo Paz. -Este animal não pode entrar no Modo Amor. O número máximo de Porcos, Ovelhas, Vacas e Gatos de criação foi alcançado. +Este animal não pode entrar no Modo do Amor. O número máximo de Porcos, Ovelhas, Vacas e Gatos de criação foi alcançado. Este animal não pode entrar em Modo Amor. O número máximo de lobos foi alcançado. Este animal não pode entrar em Modo Amor. O número máximo de frangos foi alcançado. +Este animal não pode entrar no Modo do Amor. O número máximo de cavalos reprodutores foi alcançado. + Este animal não pode entrar em Modo Amor. O número máximo de vacogumelos foi alcançado. O número máximo de barcos em um mundo foi alcançado. @@ -3607,27 +4261,43 @@ Deseja instalar o pacote de combinações ou o pacote de texturas agora? Créditos Reinstalar Conteúdo - + Configurações de Depuração - + Fogo Espalha - + TNT Explode - + Jogador x Jogador - + Confiar nos Jogadores - + Privilégios do Host - + Gerar Estruturas - + Mundo Superplano - + Baú de Bônus - + Opções de Mundo - + +Opções de Jogo + +Assédio por criatura + +Manter inventário + +Surgimento de criaturas + +Itens de criaturas + +Itens de Espaços + +Regeneração Natural + +Ciclo da Luz do Dia + Pode Construir e Minerar Pode Usar Portas e Acionadores @@ -3666,7 +4336,7 @@ Deseja instalar o pacote de combinações ou o pacote de texturas agora? Semente para Criação de Mundo -Deixar em branco para semente aleatória +Deixar livre p/ uma semente aleatória Jogadores @@ -3700,7 +4370,7 @@ Deseja instalar o pacote de combinações ou o pacote de texturas agora? Tipo de Nível: -JxJ: +JvJ: Confiar Jogadores: @@ -3732,7 +4402,7 @@ Deseja instalar o pacote de combinações ou o pacote de texturas agora? Restaurar Padrões -Exibir Oscilação +Oscilação da visão Dicas @@ -3754,7 +4424,7 @@ Deseja instalar o pacote de combinações ou o pacote de texturas agora? Editar mensagem da placa: -Vejam o que fiz no Minecraft: Xbox 360 Edition! +Olha o que eu fiz no Minecraft: Xbox 360 Edition! Texturas, ícones e interface do usuário clássicos do Minecraft! @@ -3814,6 +4484,14 @@ Deseja instalar o pacote de combinações ou o pacote de texturas agora? Veneno +Wither + +Reforço de Saúde + +Absorção + +Saturação + de Rapidez de Lentidão @@ -3852,6 +4530,14 @@ Deseja instalar o pacote de combinações ou o pacote de texturas agora? de Veneno +da Decadência + +do Reforço de Saúde + +da Absorção + +da Saturação + II @@ -3948,6 +4634,22 @@ Deseja instalar o pacote de combinações ou o pacote de texturas agora? Reduz a saúde dos jogadores, animais e monstros afetados com o tempo. +Quando aplicado: + +Força de pulo para o cavalo + +Reforços Zumbis + +Saúde Máxima + +Limite de acomp. pelas criaturas + +Resistência a empurrão + +Velocidade + +Dano de ataque + Nitidez Atacar @@ -4038,7 +4740,7 @@ Deseja instalar o pacote de combinações ou o pacote de texturas agora? Restaura 3{*ICON_SHANK_01*}. Criado ao cozinhar uma batata na fornalha. -Restaura 1{*ICON_SHANK_01*}, ou pode ser cozinhado em uma fornalha. Pode ser plantado na fazenda. Comer isso pode te envenenar. +Restaura 1{*ICON_SHANK_01*} Comer isso pode te envenenar. Restaura 3{*ICON_SHANK_01*}. Criado com uma cenoura e barras de ouro. diff --git a/Minecraft.Assets/XboxMedia/loc/pt-PT/4J_strings.resx b/Minecraft.Assets/XboxMedia/loc/pt-PT/4J_strings.resx index a612c3356..ab38c1c50 100644 --- a/Minecraft.Assets/XboxMedia/loc/pt-PT/4J_strings.resx +++ b/Minecraft.Assets/XboxMedia/loc/pt-PT/4J_strings.resx @@ -73,11 +73,11 @@ Perfil de jogador offline -O jogo tem algumas funcionalidades que requerem um perfil de jogador ativo no Xbox Live, mas de momento estás offline. +O jogo tem algumas funcionalidades que requerem um perfil de jogador ativo no Xbox LIVE, mas de momento estás offline. -Esta funcionalidade requer um perfil de jogador ligado ao Xbox Live. +Esta funcionalidade requer um perfil de jogador ligado ao Xbox LIVE. -Ligar ao Xbox Live +Ligar ao Xbox LIVE Continuar a jogar offline @@ -100,7 +100,7 @@ Desbloquear Jogo Completo Esta é a versão de avaliação do Minecraft. Se tivesses o jogo completo, terias acabado de ganhar um feito! -Desbloqueia o jogo completo para experimentares a diversão do Minecraft e para jogares com os teus amigos em todo o mundo através do Xbox Live. +Desbloqueia o jogo completo para experimentares a diversão do Minecraft e para jogares com os teus amigos em todo o mundo através do Xbox LIVE. Queres desbloquear o jogo completo? Estás a ser reencaminhado para o menu principal devido a um problema de leitura do teu perfil. diff --git a/Minecraft.Assets/XboxMedia/loc/pt-PT/strings.resx b/Minecraft.Assets/XboxMedia/loc/pt-PT/strings.resx index 132c30f28..6fee7199a 100644 --- a/Minecraft.Assets/XboxMedia/loc/pt-PT/strings.resx +++ b/Minecraft.Assets/XboxMedia/loc/pt-PT/strings.resx @@ -156,7 +156,7 @@ Se estiveres a segurar um objeto, usa{*CONTROLLER_ACTION_USE*} para o utilizares {*T3*}INSTRUÇÕES DE JOGO : MOSTRADOR SUPERIOR{*ETW*}{*B*}{*B*} O MOSTRADOR SUPERIOR apresenta informação sobre o teu estado; a tua saúde, o oxigénio que te resta quando estás debaixo de água, o teu nível de fome (tens de comer para reabasteceres) e a armadura, caso estejas a usar alguma. Se perderes saúde, mas tiveres uma barra de comida com 9 ou mais{*ICON_SHANK_01*}, a tua saúde será imediatamente reabastecida. Ao comeres, reabasteces a barra de comida.{*B*} -Aqui também é mostrada a Barra de Experiência, com um valor numérico que mostra o nível de Experiência, e a barra que indica quantos Pontos de Experiência te faltam para subires de nível. Ganhas Pontos de Experiência recolhendo os Orbes de Experiência que os habitantes deixam cair quando morrem, ao escavar certos tipos de blocos, ao criar animais, ao pescar e ao fundir minério na fornalha.{*B*} +Aqui também é mostrada a Barra de Experiência, com um valor numérico que mostra o nível de Experiência, e a barra que indica quantos Pontos de Experiência te faltam para subires de nível. Ganhas Pontos de Experiência recolhendo os Orbes de Experiência que os habitantes deixam cair quando morrem, ao escavar certos tipos de blocos, ao criar animais, ao pescar e ao fundir minério na fornalha.{*B*}{*B*} Também apresenta os objetos disponíveis para usares. Usa{*CONTROLLER_ACTION_LEFT_SCROLL*} e{*CONTROLLER_ACTION_RIGHT_SCROLL*} para mudares o objeto que estás a segurar. {*T3*}INSTRUÇÕES DE JOGO : INVENTÁRIO{*ETW*}{*B*}{*B*} @@ -233,7 +233,7 @@ Quando é colocada uma Espada, Arco, Machado, Picareta, Pá, Armadura ou Livro n Se não tiveres Níveis de Experiência suficientes para usar alguns destes, o custo surgirá a vermelho, caso contrário surgirá a verde.{*B*}{*B*} O feitiço aplicado é selecionado aleatoriamente com base no custo apresentado.{*B*}{*B*} Se a Mesa de Feitiços estiver rodeada de Estantes (até um máximo de 15 Estantes), com um bloco de intervalo entre a Estante e a Mesa de Feitiços, o poder dos feitiços irá aumentar e ver-se-ão glifos misteriosos a sair do livro na Mesa de Feitiços.{*B*}{*B*} -Todos os ingredientes para uma Mesa de Feitiços podem ser encontrados nas aldeias de um mundo, ou escavando ou cultivando no mundo.{*B*} +Todos os ingredientes para uma Mesa de Feitiços podem ser encontrados nas aldeias de um mundo, ou escavando ou cultivando no mundo.{*B*}{*B*} Os Livros de Feitiços são usados na Bigorna para aplicar feitiços a itens. Isto dá-te maior controlo sobre os feitiços que gostarias de ter nos teus itens.{*B*} @@ -282,7 +282,7 @@ No modo de voo, podes manter premido{*CONTROLLER_ACTION_JUMP*} para subires e{*C {*T3*}INSTRUÇÕES DE JOGO : OPÇÕES DE ANFITRIÃO E JOGADOR{*ETW*}{*B*}{*B*} -{*T1*}Opções de jogo{*ETW*}{*B*} +{*T1*}Opções de Jogo{*ETW*}{*B*} Ao carregar ou criar um mundo, prime o botão "Mais Opções" para abrir um menu que te dá maior controlo sobre o teu jogo.{*B*}{*B*} {*T2*}Jogador vs. Jogador{*ETW*}{*B*} @@ -300,6 +300,27 @@ Ao carregar ou criar um mundo, prime o botão "Mais Opções" para abrir um menu {*T2*}Privilégios de Anfitrião{*ETW*}{*B*} Quando ativada, o anfitrião pode ativar a sua capacidade de voar, desativar a exaustão e tornar-se invisível a partir do menu do jogo. {*DISABLES_ACHIEVEMENTS*}{*B*}{*B*} + {*T2*}Ciclo da Luz do Dia{*ETW*}{*B*} + Quando desativada, a hora do dia não muda.{*B*}{*B*} + + {*T2*}Manter Inventário{*ETW*}{*B*} + Quando ativada, os jogadores mantêm o inventário quando morrem.{*B*}{*B*} + + {*T2*}Geração de Criaturas{*ETW*}{*B*} + Quando desativada, as criaturas não se geram naturalmente.{*B*}{*B*} + + {*T2*}Perturbação de Criaturas{*ETW*}{*B*} + Quando desativada, impede que monstros e animais mudem blocos (por exemplo, explosões de Creeper não destroem blocos e as Ovelhas não comem Erva) ou apanhem objetos.{*B*}{*B*} + + {*T2*}Saques de Criaturas{*ETW*}{*B*} + Quando desativada, os monstros e os animais não deixam cair saques (por exemplo, os Creepers não deixam cair pólvora).{*B*}{*B*} + + {*T2*}Queda de Peças{*ETW*}{*B*} + Quando desativada, os blocos não deixam cair objetos quando são destruídos (por exemplo, os blocos de Pedra não deixam cair Pedra Arredondada).{*B*}{*B*} + + {*T2*}Regeneração Natural{*ETW*}{*B*} + Quando desativada, os jogadores não regeneram naturalmente a sua saúde.{*B*}{*B*} + {*T1*}Opções de Criação de Mundos{*ETW*}{*B*} Ao criar um novo mundo, existem opções adicionais.{*B*}{*B*} @@ -343,24 +364,26 @@ Para modificar os privilégios de um jogador, seleciona o nome e prime{*CONTROLL Quando esta opção está ativada, o jogador pode alterar os privilégios dos outros jogadores (exceto o anfitrião) se "Confiar Jogadores" estiver desativada, expulsar jogadores e ativar ou desativar a propagação de fogo e as explosões de TNT.{*B*}{*B*} {*T2*}Expulsar Jogador{*ETW*}{*B*} - Selecionar esta opção faz com que jogadores que não estejam na mesma consola {*PLATFORM_NAME*} que o anfitrião sejam eliminados do jogo. Os jogadores expulsos não poderão voltar a participar no jogo até que este seja reiniciado.{*B*}{*B*} + {*KICK_PLAYER_DESCRIPTION*}{*B*}{*B*} {*T1*}Opções de Jogador Anfitrião{*ETW*}{*B*} Se "Privilégios de Anfitrião" estiver ativada, o jogador anfitrião pode modificar alguns dos seus privilégios. Para modificar os privilégios de um jogador, seleciona o nome e prime{*CONTROLLER_VK_A*} para abrir o menu de privilégios do jogador, onde podes usar as seguintes opções.{*B*}{*B*} {*T2*}Pode Voar{*ETW*}{*B*} Quando esta opção está ativada, o jogador pode voar. Esta opção só é relevante no modo Sobrevivência, uma vez que todos os jogadores podem voar no modo Criativo.{*B*}{*B*} - + {*T2*}Desativar Exaustão{*ETW*}{*B*} Esta opção afeta apenas o modo Sobrevivência. Quando ativada, as atividades físicas (caminhar/correr/saltar, etc.) não diminuem a barra de comida. No entanto, se o jogador for ferido, a barra de comida irá diminuir lentamente enquanto o jogador estiver a recuperar.{*B*}{*B*} - + {*T2*}Invisível{*ETW*}{*B*} Quando esta opção está ativada, o jogador não pode ser visto pelos outros jogadores e é invulnerável.{*B*}{*B*} - - {*T2*}Pode Teletransportar{*ETW*}{*B*} + + {*T2*}Pode Teletransportar{*ETW*}{*B*} Permite que o jogador se transporte ou transporte outros jogadores até si ou até outros jogadores no mundo. +Selecionar esta opção fará com que os jogadores que não estão na mesma consola {*PLATFORM_NAME*} que o anfitrião sejam expulsos do jogo, juntamente com outros jogadores na sua consola {*PLATFORM_NAME*}. Este jogador não poderá voltar ao jogo até este ser reiniciado. + Página Seguinte Página Anterior @@ -383,7 +406,7 @@ Se "Privilégios de Anfitrião" estiver ativada, o jogador anfitrião pode modif Animais de Criação -Preparação de Poções +Poções Feitiço @@ -426,60 +449,92 @@ pelo que facilmente se juntarão a ti. {*T3*}Alterações e Adições{*ETW*}{*B*}{*B*} -- Novos objetos - Esmeralda, Minério de Esmeralda, Bloco de Esmeralda, Baú Ender, Gancho de Armadilha, Maçã Dourada Enfeitiçada, Bigorna, Vaso de Flores, Muros de Pedra Arredondada, Muros de Pedra Arredondada com Musgo, Pintura de Wither, Batata, Batata Cozida, Batata Venenosa, Cenoura, Cenoura Dourada, Cenoura num Pau, -Tarte de Abóbora, Poção de Visão Nocturna, Poção de Invisibilidade, Quartzo do Submundo, Minério de Quartzo do Submundo, Bloco de Quartzo, Placa de Quartzo, Escada de Quartzo, Bloco de Quartzo Esculpido, Bloco Pilar de Quartzo, Livro de Feitiços, Alcatifa.{*B*} -- Novas receitas para Grés Suave e Grés Esculpido.{*B*} -- Novos Habitantes - Aldeões Mortos-Vivos.{*B*} -- Novas funcionalidades de geração de terreno - Templos do Deserto, Aldeias do Deserto, Templos da Selva.{*B*} -- Trocas com aldeões.{*B*} -- Interface Bigorna.{*B*} -- Pode tingir armadura de cabedal.{*B*} -- Pode tingir coleiras de lobo.{*B*} -- Pode montar um porco e controlá-lo com uma Cenoura num Pau.{*B*} -- Conteúdo de Baú Bónus atualizado com mais objetos.{*B*} -- Alterada colocação de meios blocos e outros blocos em meios blocos.{*B*} -- Alterada colocação de placas e escadas invertidas.{*B*} -- Adicionadas profissões de aldeões diferentes.{*B*} -- Aldeões gerados a partir de ovo de geração terão uma profissão aleatória.{*B*} -- Adicionada colocação lateral de tronco.{*B*} -- Fornalhas podem usar ferramentas de madeira como combustível.{*B*} -- Painéis de Gelo e Vidro podem ser recolhidos com ferramentas enfeitiçadas com toque de seda.{*B*} -- Botões de Madeira e Placas de Pressão de Madeira podem ser ativados com Flechas.{*B*} -- Habitantes do Submundo podem ser gerados no Mundo Superior a partir de Portais.{*B*} -- Creepers e Aranhas são agressivos para com o último jogador que os tenha atingido.{*B*} -- Os habitantes no modo Criativo tornam-se novamente neutros após um curto período.{*B*} -- Remover ricochete aquando de afogamento.{*B*} -- As portas partidas por mortos-vivos apresentam danos.{*B*} -- Gelo derrete no Submundo.{*B*} -- Caldeirões enchem-se quando ficam à chuva.{*B*} -- Pistões demoram o dobro do tempo a atualizar.{*B*} -- Porco larga Sela quando é morto (se tiver sela).{*B*} -- Cor do céu alterada no Fim.{*B*} -- Corda pode ser colocada (para Armadilhas).{*B*} -- Chuva escorre das folhas.{*B*} -- Alavancas podem ser colocadas no fundo dos blocos.{*B*} -- TNT causa danos variáveis consoante a definição de dificuldade.{*B*} -- Receita de livro alterada.{*B*} -- Barcos partem Nenúfares, em vez de Nenúfares partirem Barcos.{*B*} -- Porcos largam mais Costeletas.{*B*} -- Slimes reproduzem-se menos em mundos Superplanos.{*B*} -- Dano de Creeper variável consoante a definição de dificuldade, mais ricochete.{*B*} -- Corrigida a não abertura dos maxilares dos Endermen.{*B*} -- Adicionado teletransporte de jogadores (usando o menu BACK do jogo).{*B*} -- Novas Opções Anfitrião para voar, invisibilidade e invulnerabilidade para jogadores remotos.{*B*} -- Novos tutoriais do Mundo Tutorial para novos itens e funcionalidades.{*B*} -- Posições dos Baús de Discos de Música atualizadas no Mundo Tutorial.{*B*} +- Novos objetos adicionados - Barro Endurecido, Barro Manchado, Bloco de Carvão, Fardo de Palha, Carril Ativador, Bloco de Redstone, Sensor de Luz do Dia, Soltador, Funil, Vagoneta com Funil, Vagoneta com TNT, Comparador de Redstone, Placa de Pressão Ponderada, Farol, Baú Preso, Foguete de Fogo de Artifício, Estrela de Fogo de Artifício, Estrela do Submundo, Corda de Conduzir, Armadura de Cavalo, Etiqueta, Ovo de Geração de Cavalo{*B*} +- Novas Criaturas adicionadas - Cérbero, Esqueletos de Cérbero, Bruxas, Morcegos, Cavalos, Burros e Mulas{*B*} +- Novas funcionalidades de geração de terreno - Cabanas de Bruxa.{*B*} +- Adicionada interface de Farol.{*B*} +- Adicionada interface de Cavalo.{*B*} +- Adicionada interface de Funil.{*B*} +- Adicionado Fogo de Artifício - a interface de Fogo de Artifício pode ser acedida a partir da Mesa de Criação quando tens os ingredientes para criar uma Estrela de Fogo de Artifício ou um Foguete de Fogo de Artifício.{*B*} +- Adicionado 'Modo Aventura' - Só podes quebrar blocos com as ferramentas corretas.{*B*} +- Adicionados imensos sons novos.{*B*} +- Habitantes, objetos e projéteis agora passam através de portais.{*B*} +- Os Repetidores podem agora ser trancados alimentando a sua lateral com outro Repetidor.{*B*} +- Mortos-vivos e Esqueletos podem agora gerar-se com diferentes armas e armaduras.{*B*} +- Novas mensagens de morte.{*B*} +- Nomeia as criaturas com uma Etiqueta, e dá novos nomes a contentores para mudar o título quando se abre o menu.{*B*} +- O Pó de Ossos já não faz tudo crescer instantaneamente até ao tamanho máximo, e passa a fazê-lo por fases de forma aleatória.{*B*} +- Um sinal de Redstone que descreve os conteúdos dos Baús, dos Postos de Poções, dos Distribuidores e das Jukeboxes pode ser detetado colocando um Comparador de Redstone diretamente contra eles.{*B*} +- Os Distribuidores podem ficar virados em qualquer direção.{*B*} +- Comer uma Maçã Dourada dá ao jogador uma saúde de "absorção" adicional durante um curto período.{*B*} +- Quanto mais tempo permaneceres numa zona, mais difíceis serão os monstros que se geram nessa zona.{*B*} + +{*ETB*}Bem-vindo de volta! Podes não ter reparado, mas o Minecraft foi atualizado.{*B*}{*B*} +Há muitas funcionalidades novas para explorares com os teus amigos. Aqui ficam algumas. Lê e depois diverte-te!{*B*}{*B*} +{*T1*}Novos Objetos{*ETB*} - Barro Endurecido, Barro Manchado, Bloco de Carvão, Fardo de Palha, Carril Ativador, Bloco de Redstone, Sensor de Luz do Dia, Soltador, Funil, Vagoneta com Funil, Vagoneta com TNT, Comparador de Redstone, Placa de Pressão Ponderada, Farol, Baú Preso, Foguete de Fogo de Artifício, Estrela de Fogo de Artifício, Estrela do Submundo, Corda de Conduzir, Armadura de Cavalo, Etiqueta, Ovo de Geração de Cavalo{*B*}{*B*} +{*T1*}Novas Criaturas{*ETB*} - Cérbero, Esqueletos de Cérbero, Bruxas, Morcegos, Cavalos, Burros e Mulas{*B*}{*B*} +{*T1*}Novas Funcionalidades{*ETB*} - Domestica e cavalga um cavalo, cria fogo de artifício e dá espetáculo, nomeia animais e monstros com uma Etiqueta, cria circuitos de Redstone mais avançados, e novas Opções de Anfitrião para ajudar a controlar aquilo que os convidados podem fazer no teu mundo!{*B*}{*B*} +{*T1*}Novo Mundo Tutorial{*ETB*} – Aprende a usar as funcionalidades antigas e recentes no Mundo Tutorial. Vê se consegues descobrir todos os Discos de Música secretos escondidos no mundo!{*B*}{*B*} -{*ETB*}Bem-vindo de volta! Podes não ter reparado, mas o Minecraft sofreu alterações.{*B*}{*B*} -Há muitas novas funcionalidades para jogares com os teus amigos. Aqui ficam algumas. Lê e depois diverte-te!{*B*}{*B*} -{*T1*}Novos objetos{*ETB*} - Esmeralda, Minério de Esmeralda, Bloco de Esmeralda, Baú Ender, Gancho de Armadilha, Maçã Dourada Enfeitiçada, Bigorna, Vaso de Flores, Muros de Pedra Arredondada, Muros de Pedra Arredondada com Musgo, Pintura de Wither, Batata, Batata Cozida, Batata Venenosa, Cenoura, Cenoura Dourada, Cenoura num Pau, -Tarte de Abóbora, Poção de Visão Nocturna, Poção de Invisibilidade, Quartzo do Submundo, Minério de Quartzo do Submundo, Bloco de Quartzo, Placa de Quartzo, Escada de Quartzo, Bloco de Quartzo Esculpido, Bloco Pilar de Quartzo, Livro de Feitiços, Alcatifa.{*B*}{*B*} - {*T1*}Novos Habitantes{*ETB*} - Aldeões Mortos-Vivos.{*B*}{*B*} -{*T1*}Novas Funcionalidades{*ETB*} - Troca com aldeões, repara ou enfeitiça armas e ferramentas usando a Bigorna, armazena objetos num Baú Ender, controla um porco enquanto o montas usando uma Cenoura num Pau!{*B*}{*B*} -{*T1*}Novos Mini-Tutoriais{*ETB*} – Aprende a usar as novas funcionalidades no Mundo Tutorial!{*B*}{*B*} -{*T1*}Novos 'Easter Eggs'{*ETB*} – Mudámos de sítio todos os Discos de Música secretos no Mundo Tutorial. Vê se consegues voltar a encontrá-los!{*B*}{*B*} - +Cavalos + +{*T3*}INSTRUÇÕES DE JOGO: CAVALOS{*ETW*}{*B*}{*B*} +Os Cavalos e os Burros estão sobretudo nas planícies. As Mulas são descendentes de um Burro e de um Cavalo, mas são inférteis.{*B*} +Todos os Cavalos, Burros e Mulas adultos podem ser montados. Porém, só os Cavalos podem ter armadura, e só as Mulas e os Burros podem ser equipados com alforjes para transportar objetos.{*B*}{*B*} +Os Cavalos, os Burros e as Mulas têm de ser domesticados antes de poderem ser usados. Para domesticar um cavalo, é preciso montá-lo e conseguir ficar em cima dele enquanto ele tenta atirar o jogador para o chão.{*B*} +Quando surgem Corações de Amor à volta do cavalo, ele está domesticado e já não tentará atirar o jogador para o chão. Para guiar um cavalo, é preciso equipá-lo com uma Sela.{*B*}{*B*} +Podes comprar Selas aos aldeões ou encontrá-las dentro de Baús escondidos pelo mundo.{*B*} +Os Burros e Mulas domesticados podem receber alforjes se lhes prenderes um Baú. Poderás depois aceder aos alforjes enquanto montas ou quando te aproximas furtivamente do animal.{*B*}{*B*} +Os Cavalos e os Burros (as Mulas não) podem ser procriados como os outros animais, usando Maçãs Douradas ou Cenouras Douradas.{*B*} +Os potros tornam-se cavalos adultos ao fim de algum tempo, mas podes acelerar o processo alimentando-os com Trigo ou Feno.{*B*} + + +Faróis + +{*T3*}INSTRUÇÕES DE JOGO: FARÓIS{*ETW*}{*B*}{*B*} +Os Faróis Ativos projetam um feixe de luz brilhante para o céu e atribuem poderes a jogadores próximos.{*B*} +São criados a partir de Vidro, Obsidiana e Estrelas do Submundo, que podem ser obtidos derrotando o Cérbero.{*B*}{*B*} +Os Faróis têm de ser colocados de modo a apanhar sol durante o dia. Eles têm de ser colocados em Pirâmides de Ferro, Ouro, Esmeralda ou Diamante.{*B*} +O material do Farol em cima do qual este é colocado não tem qualquer efeito na sua potência.{*B*}{*B*} +No menu do Farol podes selecionar um poder principal para o teu Farol. Quantos mais camadas tiver a tua pirâmide, mais poderes terás à escolha.{*B*} +Um Farol numa pirâmide com pelo menos quatro camadas também te permite escolher entre o poder secundário de Regeneração ou um poder principal mais forte.{*B*}{*B*} +Para definir os poderes do teu Farol tens de sacrificar uma Esmeralda, um Diamante, Lingotes de Ferro ou Ouro na ranhura de pagamento.{*B*} +Uma vez definidos, os poderes irão emanar indefinidamente do Farol.{*B*} + + +Fogo de artifício + +{*T3*}INSTRUÇÕES DE JOGO: FOGO DE ARTIFÍCIO{*ETW*}{*B*}{*B*} +O Fogo de Artifício é um objeto decorativo que pode ser lançado à mão ou a partir de Distribuidores. Pode ser criado usando Papel, Pólvora e, opcionalmente, algumas Estrelas de Fogo de Artifício.{*B*} +As cores, o desaparecimento, a forma, o tamanho e os efeitos (como os rastos e a cintilância) das Estrelas de Fogo de Artifício podem ser personalizados incluindo ingredientes adicionais no momento da criação.{*B*}{*B*} +Para criar um Fogo de Artifício, coloca Pólvora e Papel na grelha de criação de 3x3 que aparece acima do teu inventário.{*B*} +Opcionalmente, podes colocar múltiplas Estrelas de Fogo de Artifício na grelha para as adicionar ao Fogo de Artifício.{*B*} +Preencher mais ranhuras na grelha de criação com Pólvora aumenta a altura a que as Estrelas de Fogo de Artifício vão explodir.{*B*}{*B*} +Podes então retirar o Fogo de Artifício criado da ranhura de saída.{*B*}{*B*} +As Estrelas de Fogo de Artifício podem ser criadas colocando Pólvora e Tinta na grelha de criação.{*B*} + - A Tinta definirá a cor da explosão da Estrela de Fogo de Artifício.{*B*} + - A forma da Estrela de Fogo de Artifício é definida adicionando uma Carga de Fogo, uma Pepita de Ouro, uma Pena ou uma Cabeça de Criatura.{*B*} + - Um rasto ou uma cintilância podem ser adicionados usando Diamantes ou Pó de Glowstone.{*B*}{*B*} +Depois de ser criada uma Estrela de Fogo de Artifício, podes definir a cor de desaparecimento da Estrela de Fogo de Artifício criando-a com Tinta. + + +Funis + +{*T3*}INSTRUÇÕES DE JOGO: FUNIS{*ETW*}{*B*}{*B*} +Os Funis são usados para inserir ou remover objetos de contentores, e para recolher automaticamente objetos atirados a eles.{*B*} +Eles podem afetar Postos de Poções, Baús, Distribuidores, Soltadores, Vagonetas com Baús, Vagonetas com Funis, bem como outros Funis.{*B*}{*B*} +Os Funis vão tentar continuamente sugar objetos de um contentor adequado colocado acima deles. Também vão tentar inserir objetos armazenados num contentor de destino.{*B*} +Se um Funil for alimentado por Redstone tornar-se-á inativo e parará de sugar e de inserir objetos.{*B*}{*B*} +Um Funil aponta na direção em que tenta colocar objetos. Para levar um Funil a apontar para um determinado bloco, coloca-o frente a esse bloco enquanto andas furtivamente.{*B*} + + +Soltadores + +{*T3*}INSTRUÇÕES DE JOGO: SOLTADORES{*ETW*}{*B*}{*B*} +Quando alimentados por Redstone, os Soltadores vão largar no chão um objeto ao acaso que contenham. Usa {*CONTROLLER_ACTION_USE*} para abrir o Soltador e depois podes carregar o Soltador com objetos do teu inventário.{*B*} +Se o Soltador estiver perante um Baú ou outro tipo de Contentor, o objeto será colocado aí e não no chão. Podes criar longas cadeias de Soltadores para transportar objetos ao longo de um caminho. Para que isto funcione, eles terão de ser, alternadamente, ligados e desligados. + Provoca mais danos do que com a mão. @@ -553,7 +608,7 @@ Tarte de Abóbora, Poção de Visão Nocturna, Poção de Invisibilidade, Quartz Utilizado para criar escadas compridas. Duas placas colocadas uma sobre a outra criam um bloco de placa dupla de tamanho normal. -Utilizado como escadas longas. Duas placas colocadas uma sobre a outra irão criar um bloco de placas duplo de tamanho normal. +Utilizado para criar escadas compridas. Duas placas colocadas uma sobre a outra criam um bloco de placa dupla de tamanho normal. Utilizadas para criar luz. As tochas também derretem a neve e o gelo. @@ -606,10 +661,36 @@ As cores da cama são sempre as mesmas, independentemente das cores da lã usada Quando seguras no mapa, poderás ver a imagem de uma área explorada. Pode ser utilizado para descobrir caminhos. +Quando se usa torna-se um mapa da parte do mundo em que estás, e vai-se preenchendo à medida que exploras. + Utilizado para ataques à distância com setas. Utilizadas como munição para os arcos. +Largado pelo Cérbero, usado no fabrico de Faróis. + +Quando ativados, criam explosões coloridas. Cor, efeito, forma e desaparecimento são determinados pela Estrela de Fogo de Artifício usada quando é criado o Fogo de Artifício. + +Usada para determinar cor, efeito e forma de um Fogo de Artifício. + +Usado em circuitos Redstone para manter, comparar ou subtrair a força do sinal, ou para medir determinados estados de blocos. + +É um tipo de Vagoneta que atua como bloco de TNT móvel. + +É um bloco que produz um sinal Redstone com base na luz solar (ou na ausência desta). + +É um tipo de Vagoneta especial que funciona de modo similar a um Funil. Recolhe objetos que estão nos carris e nos contentores acima. + +Um tipo especial de Armadura que pode ser colocada num cavalo. Fornece 5 de Armadura. + +Um tipo especial de Armadura que pode ser colocada num cavalo. Fornece 7 de Armadura. + +Um tipo especial de Armadura que pode ser colocada num cavalo. Fornece 11 de Armadura. + +Usado para atrelar criaturas ao jogador ou a postes de Vedação. + +Utilizada para nomear criaturas no mundo. + Restitui 2,5{*ICON_SHANK_01*}. Restitui 1{*ICON_SHANK_01*}. Podes usar até 6 vezes. @@ -628,7 +709,7 @@ As cores da cama são sempre as mesmas, independentemente das cores da lã usada Restitui 4{*ICON_SHANK_01*}. Cria-se cozinhando bife cru numa fornalha. -Restituem 1,5{*ICON_SHANK_01*} ou podem ser cozinhadas numa fornalha. +Restitui 1,5{*ICON_SHANK_01*} ou pode ser cozinhado numa fornalha. Restituem 4{*ICON_SHANK_01*}. Criadas ao cozinhar costeletas de porco cruas numa fornalha. @@ -646,7 +727,7 @@ As cores da cama são sempre as mesmas, independentemente das cores da lã usada Utilizada para enviar uma descarga elétrica ao ligar e desligar. Fica ligada ou desligada até ser premida novamente. -Envia constantemente uma descarga elétrica ou pode ser utilizada como receptor/transmissor quando ligada ao lado de um bloco. +Envia constantemente uma descarga elétrica ou pode ser utilizada como recetor/transmissor quando ligada ao lado de um bloco. Pode também ser utilizada para iluminação reduzida. Utilizado em circuitos de Redstone como repetidor, retardador e/ou díodo. @@ -661,7 +742,7 @@ Pode também ser utilizada para iluminação reduzida. Quando ativado, acelera as vagonetas que lhe passam por cima. Quando não está ativado, as vagonetas param. -Funciona como uma Placa de Pressão (envia um sinal de Redstone quando ativado), mas só pode ser ativado por uma vagoneta. +Funciona como uma Placa de Pressão (envia um sinal de Redstone quando ativado), mas só pode ser ativado por uma Vagoneta. Utilizada para te transportar a ti, um animal ou um monstro pelos carris. @@ -822,7 +903,7 @@ A tinta pode também ser feita combinando tinta cinza com farinha de ossos, perm Recolhido ao matar um esqueleto. Pode ser usado para criar farinha de ossos e para domesticar lobos. -Recolhido quando um esqueleto mata um Creeper. Pode ser reproduzido numa jukebox. +Recolhido quando um Esqueleto mata um Creeper. Pode ser reproduzido numa jukebox. Extingue incêndios e ajuda as plantações a crescer. Pode ser recolhida num balde. @@ -932,102 +1013,160 @@ A tinta pode também ser feita combinando tinta cinza com farinha de ossos, perm Pode ser colhido para recolher Grãos de Cacau. -As Cabeças de Mob podem ser colocadas como decoração ou usadas como máscara na ranhura de capacete. +As Cabeças de Criatura podem ser colocadas como decoração ou usadas como máscara na ranhura de capacete. +Utilizado para executar ordens. + +Projeta um feixe de luz para o céu e pode fornecer Efeitos de Estado a jogadores próximos. + +Armazena blocos e objetos lá dentro. Coloca dois baús lado a lado para criar um baú maior com o dobro da capacidade. O baú preso também cria uma carga de Redstone quando aberto. + +Fornece uma carga de Redstone. A carga será mais forte se houver mais objetos na placa. + +Fornece uma carga de Redstone. A carga será mais forte se houver mais objetos na placa. Requer mais peso do que a placa leve. + +Usado como fonte de poder de Redstone. Pode voltar a ser transformado em Redstone. + +Usado para apanhar objetos ou para transferi-los para dentro e para fora de contentores. + +Um tipo de carril que pode ativar ou desativar Vagonetas com Funis e despoletar Vagonetas com TNT. + +Usado para agarrar e soltar objetos, ou para empurrar objetos para outro contentor, quando recebe uma carga de Redstone. + +Blocos coloridos criados através da aplicação de tinta em Barro Endurecido. + +Pode ser dado como alimento a Cavalos, Burros ou Mulas para curar até 10 Corações. Acelera o crescimento dos potros. + +Criado através da fundição de Barro numa fornalha. + +Fabricado a partir de vidro e de uma tinta. + +Fabricado a partir de Vidro Manchado. + +Uma forma compacta de armazenar Carvão. Pode ser usado como combustível numa Fornalha. + Lula - + Solta sacos de tinta quando é morta. - + Vaca - + Solta cabedal quando é morta. Pode também ser ordenhada com um balde. - + Ovelha - + Solta lã quando é tosquiada (se ainda não tiver sido tosquiada). Pode ser pintada para que a sua lã ganhe uma cor diferente. - + Galinha - + Solta penas quando é morta e também põe ovos de forma aleatória. - + Porco - + Solta costeletas quando é morto. Pode ser montado utilizando uma sela. - + Lobo - + É dócil, mas, se o atacares, ele contra-ataca. Pode ser domado utilizando ossos, o que faz com que te siga e ataque tudo o que te atacar. - + Creeper - + Explode se te aproximares demasiado! - + Esqueleto - + Dispara setas contra ti. Solta setas quando é morto. - + Aranha - + Ataca-te quando te aproximas. Pode subir paredes. Solta fios quando é morta. - + Morto-vivo - + Ataca-te quando te aproximas. - + Pastor Morto-vivo - + Inicialmente dócil, ataca em grupos se for atacado. - + Medusa - + Dispara bolas flamejantes que explodem quando entram em contacto. - + Slime - + Divide-se em Slimes mais pequenos quando sofre danos. - + Enderman - + Ataca-te se olhares para ele. Consegue movimentar blocos. - + Peixe Prateado - + Atrai os Peixes Prateados escondidos quando atacado. Esconde-se nos blocos de pedra. - + Aranha da Caverna - + A sua mordidela é venenosa. - + Vacogumelos - + Usada com uma tigela para fazer guisado de cogumelos. Produz cogumelos e torna-se uma vaca normal quando tosquiada. - + Golem de Neve - + O Golem de Neve pode ser criado pelos jogadores com blocos de neve e uma abóbora. Enviam bolas de neve aos inimigos dos seus criadores. - + Ender Dragon - + Um grande dragão preto que se encontra no Fim. - + Blaze - + Inimigos que podem ser encontrados no Submundo, principalmente dentro das Fortalezas do Submundo. Produzem Varinhas de Blaze quando são mortos. - + Cubo de Magma - + Podem ser encontrados no Submundo. Semelhantes aos Slimes, dividem-se em versões mais pequenas quando são mortos. - + Aldeão - + Ocelote - + Podem ser encontrados em Selvas. Podem ser domesticados quando alimentados com Peixe Cru. Porém, tens de ser o Ocelote a aproximar-se de ti, pois qualquer movimento brusco vai assustá-lo. - + Golem de Ferro - + Aparece nas Aldeias para as proteger e pode ser criado usando Blocos de Ferro e Abóboras. - + +Morcego + +Estas criaturas voadoras estão em cavernas ou noutros grandes espaços fechados. + +Bruxa + +Estas inimigas estão nos pântanos e atacam-te atirando Poções. Largam Poções quando são mortas. + +Cavalo + +Estes animais podem ser domesticados e depois podem ser montados. + +Burro + +Estes animais podem ser domesticados e depois podem ser montados. Têm um baú preso a eles. + +Mula + +Nascem do cruzamento de um Cavalo com um Burro. Estes animais podem ser domesticados e depois podem ser montados e carregar baús. + +Cavalo Morto-vivo + +Cavalo Esqueleto + +Cérbero + +São criados a partir de Caveiras de Cérbero e Areia Movediça. Atiram caveiras explosivas contra ti. + Explosives Animator Concept Artist @@ -1374,6 +1513,8 @@ A tinta pode também ser feita combinando tinta cinza com farinha de ossos, perm Mapa +Mapa Vazio + Disco Música - "13" Disco Música - "cat" @@ -1434,7 +1575,7 @@ A tinta pode também ser feita combinando tinta cinza com farinha de ossos, perm Olho de Aranha -Olho de Aranha Fermentado +Olho Aranha Ferment. Pó de Blaze @@ -1452,7 +1593,7 @@ A tinta pode também ser feita combinando tinta cinza com farinha de ossos, perm Carga de Fogo -Carga de Fogo (Carvão veg.) +Carga Fogo (Carv. veg.) Carga de Fogo (Carvão) @@ -1476,6 +1617,28 @@ A tinta pode também ser feita combinando tinta cinza com farinha de ossos, perm Cabeça de Creeper +Estrela do Submundo + +Foguete Fogo de Art. + +Estrela Fogo de Art. + +Comparador de Redstone + +Vagoneta com TNT + +Vagoneta com Funil + +Armadura de Cavalo em Ferro + +Armadura de Cavalo em Ouro + +Armadura de Cavalo em Diamante + +Corda de Conduzir + +Etiqueta + Pedra Bloco de Erva @@ -1492,6 +1655,8 @@ A tinta pode também ser feita combinando tinta cinza com farinha de ossos, perm Tábuas Madeira Selva +Placas de Madeira (qualquer) + Rebento Carvalho Jovem @@ -1606,7 +1771,7 @@ A tinta pode também ser feita combinando tinta cinza com farinha de ossos, perm Placa Madeira Carvalho -Placa de Cobblestone +Placa Pedra Arredond. Placa de Tijolo @@ -1828,6 +1993,190 @@ A tinta pode também ser feita combinando tinta cinza com farinha de ossos, perm Caveira +Bloco de Ordens + +Farol + +Baú Preso + +Placa Pressão Pond. (Leve) + +Placa Press. Pond. (Pesada) + +Comparador de Redstone + +Sensor de Luz do Dia + +Bloco de Redstone + +Funil + +Carril Ativador + +Soltador + +Barro Manchado + +Fardo de Palha + +Barro Endurecido + +Bloco de Carvão + +Barro Manchado Preto + +Barro Manchado Vermelho + +Barro Manchado Verde + +Barro Manchado Castanho + +Barro Manchado Azul + +Barro Manchado Roxo + +Barro Manchado Azul Ciano + +Barro Manch. Cinz. Claro + +Barro Manchado Cinzento + +Barro Manchado Rosa + +Barro Manchado Lima + +Barro Manchado Amarelo + +Barro Manch. Azul Claro + +Barro Manchado Magenta + +Barro Manchado Laranja + +Barro Manchado Branco + +Vidro Manchado + +Vidro Manchado Preto + +Vidro Manchado Vermelho + +Vidro Manchado Verde + +Vidro Manchado Castanho + +Vidro Manchado Azul + +Vidro Manchado Roxo + +Vidro Manchado Azul Ciano + +Vidro Manchado Cinzento Claro + +Vidro Manchado Cinzento + +Vidro Manchado Rosa + +Vidro Manchado Lima + +Vidro Manchado Amarelo + +Vidro Manchado Azul Claro + +Vidro Manchado Magenta + +Vidro Manchado Laranja + +Vidro Manchado Branco + +Painel de Vidro Manchado + +Painel de Vidro Manchado Preto + +Painel de Vidro Manchado Vermelho + +Painel de Vidro Manchado Verde + +Painel de Vidro Manchado Castanho + +Painel de Vidro Manchado Azul + +Painel de Vidro Manchado Roxo + +Painel de Vidro Manchado Azul Ciano + +Painel de Vidro Manchado Cinzento Claro + +Painel de Vidro Manchado Cinzento + +Painel de Vidro Manchado Rosa + +Painel de Vidro Manchado Lima + +Painel de Vidro Manchado Amarelo + +Painel de Vidro Manchado Azul Claro + +Painel de Vidro Manchado Magenta + +Painel de Vidro Manchado Laranja + +Painel de Vidro Manchado Branco + +Bola Pequena + +Bola Grande + +Forma de Estrela + +Forma de Creeper + +Explosão + +Forma Desconhecida + +Preto + +Vermelho + +Verde + +Castanho + +Azul + +Roxo + +Azul Ciano + +Cinzento Claro + +Cinzento + +Rosa + +Lima + +Amarelo + +Azul Claro + +Magenta + +Laranja + +Branco + +Personalizado + +Desaparecimento + +Cintilância + +Rasto + +Duração do Voo: +  Controlos Atuais Esquema @@ -2005,8 +2354,7 @@ A tinta pode também ser feita combinando tinta cinza com farinha de ossos, perm Este é o teu inventário. Mostra os objetos disponíveis que tens na mão e todos os objetos que estás a transportar. A tua armadura também é mostrada aqui. - - + {*B*} Prime{*CONTROLLER_VK_A*} para continuar.{*B*} Prime{*CONTROLLER_VK_B*} se já sabes utilizar o inventário. @@ -2027,7 +2375,7 @@ A tinta pode também ser feita combinando tinta cinza com farinha de ossos, perm - Se quiseres saber mais sobre um determinado objeto, coloca o ponteiro sobre o objeto e prime{*CONTROLLER_VK_RT*}. + Se quiseres saber mais sobre um determinado objeto, coloca o ponteiro sobre o objeto e prime{*CONTROLLER_ACTION_MENU_PAGEDOWN*}. @@ -2061,7 +2409,7 @@ A tinta pode também ser feita combinando tinta cinza com farinha de ossos, perm - Se quiseres saber mais sobre um determinado objeto, coloca o ponteiro sobre o objeto e prime{*CONTROLLER_VK_RT*}. + Se quiseres saber mais sobre um determinado objeto, coloca o ponteiro sobre o objeto e prime{*CONTROLLER_ACTION_MENU_PAGEDOWN*}. @@ -2425,7 +2773,7 @@ A tinta pode também ser feita combinando tinta cinza com farinha de ossos, perm - No baú nesta área existem alguns componentes para criar circuitos com pistões. Experimenta usar ou completar os circuitos nesta área ou cria o teu próprio circuito. Existem mais exemplos fora da área do tutorial. + No baú nesta área existem alguns componentes para criar circuitos com pistões. Experimenta usar ou completar os circuitos nesta área ou cria o teu próprio circuito. Há mais exemplos fora da área do tutorial. @@ -2443,7 +2791,7 @@ A tinta pode também ser feita combinando tinta cinza com farinha de ossos, perm - Para ativar um Portal do Submundo, incendeia os blocos de Obsidiana dentro da estrutura com Sílex e Aço. Os Portais podem ser desativados se a sua estrutura se partir, se ocorrer uma explosão nas proximidades ou se escorrer líquido sobre os blocos. + Para ativar um Portal do Submundo, incendeia os blocos de Obsidiana dentro da estrutura com Sílex e Aço. Os Portais podem ser desativados se a sua estrutura se partir, se ocorrer uma explosão nas proximidades ou se escorrer líquido através dos blocos. @@ -2608,6 +2956,211 @@ No modo de voo, podes manter premido{*CONTROLLER_ACTION_JUMP*} para subires e{*C Prime{*CONTROLLER_VK_B*} se já souberes tudo sobre a barra de comida e a alimentação. + + Esta é a interface de inventário do cavalo. + + + + {*B*}Prime {*CONTROLLER_VK_A*} para continuar. + {*B*}Prime {*CONTROLLER_VK_B*} se já souberes como usar o inventário do cavalo. + + + + O inventário do cavalo permite-te equipar ou transferir objetos para o teu Cavalo, Burro ou Mula. + + + + Sela o teu Cavalo colocando-lhe uma Sela na ranhura para selas. Os Cavalos podem receber uma Armadura de Cavalo na ranhura para armaduras. + + + + Neste menu também podes transferir objetos entre o teu inventário e os alforjes presos aos Burros e Mulas. + + +Encontraste um Cavalo. + +Encontraste um Burro. + +Encontraste uma Mula. + + + {*B*}Prime {*CONTROLLER_VK_A*} para saber mais sobre Cavalos, Burros e Mulas. + {*B*}Prime {*CONTROLLER_VK_B*} se já souberes o que precisas sobre Cavalos, Burros e Mulas. + + + + Os Cavalos e os Burros estão sobretudo nas planícies. As Mulas podem ser criadas cruzando um Burro com um Cavalo, mas são inférteis. + + + + Todos os Cavalos, Burros e Mulas adultos podem ser montados. Porém, só os Cavalos podem receber uma armadura, e só as Mulas e os Burros podem ser equipados com alforjes para transportar objetos. + + + + Os Cavalos, os Burros e as Mulas têm de ser domesticados antes de poderem ser usados. Para domesticar um cavalo é preciso tentar montá-lo e conseguir permanecer em cima dele enquanto ele tenta sacudir o jogador para o chão. + + + + Quando ficam domesticados, surgem Corações de Amor à volta deles e deixam de tentar sacudir o jogador. + + + + Experimenta montar este cavalo agora. Usa {*CONTROLLER_ACTION_USE*} sem objetos ou ferramentas na mão para montá-lo. + + + + Para guiar um cavalo, tens de equipá-lo com uma sela, que podes comprar aos aldeões ou encontrar dentro de baús escondidos no mundo. + + + + Burros e Mulas domesticados podem receber alforjes se lhes prenderes um baú. Podes aceder aos alforjes enquanto montas ou quando te aproximas furtivamente do animal. + + + + Os Cavalos e os Burros (as Mulas não) podem ser procriados como os outros animais, usando Maçãs Douradas ou Cenouras Douradas. Os potros tornam-se cavalos adultos ao fim de algum tempo, mas podes acelerar o processo alimentando-os com trigo ou feno. + + + + Podes tentar domesticar Cavalos e Burros aqui, e nos baús que por aqui andam também encontrarás Selas, Armaduras de Cavalo e outros objetos úteis para Cavalos. + + + + Esta é a interface do Farol, que podes usar para escolher os poderes que o teu Farol concede. + + + + {*B*}Prime {*CONTROLLER_VK_A*} para continuar. + {*B*}Prime {*CONTROLLER_VK_B*} se já sabes como usar a interface do Farol. + + + + No menu do Farol podes selecionar 1 poder principal para o teu Farol. Quanto mais camadas tiver a tua pirâmide, mais poderes terás à escolha. + + + + Um Farol numa pirâmide com pelo menos 4 camadas permite-te escolher entre o poder secundário de Regeneração ou um poder principal mais forte. + + + + Para definir os poderes do teu Farol tens de sacrificar uma Esmeralda, um Diamante, Lingotes de Ferro ou Ouro na ranhura de pagamento. Uma vez definidos, os poderes irão emanar indefinidamente do Farol. + + +No topo desta pirâmide há um Farol inativo. + + + {*B*}Prime {*CONTROLLER_VK_A*} para saber mais sobre Faróis. + {*B*}Prime {*CONTROLLER_VK_B*} se já sabes o que precisas sobre Faróis. + + + + Os Faróis Ativos projetam um feixe de luz brilhante para o céu e atribuem poderes a jogadores próximos. São feitos com Vidro, Obsidiana e Estrelas do Submundo, que podem ser obtidas derrotando o Cérbero. + + + + Os Faróis têm de ser colocados de modo a captar a luz solar durante o dia. Os Faróis têm de ser colocados sobre Pirâmides de Ferro, Ouro, Esmeralda ou Diamante. Porém, o tipo de material não tem qualquer efeito na potência do farol. + + + + Experimenta usar o Farol para definir os poderes que ele concede. Podes usar os Lingotes de Ferro disponibilizados como forma de pagamento. + + +Esta divisão contém Funis. + + + {*B*}Prime {*CONTROLLER_VK_A*} para saber mais sobre Funis. + {*B*}Prime {*CONTROLLER_VK_B*} se já sabes o que precisas sobre Funis. + + + + Os Funis são usados para inserir ou remover objetos de contentores, e para recolher automaticamente os objetos que são atirados neles. + + + + Eles podem afetar Postos de Poções, Baús, Distribuidores, Soltadores, Vagonetas com Baús, Vagonetas com Funis, bem como outros Funis. + + + + Os Funis vão tentar sempre sugar objetos dos contentores adequados acima deles. Também vão tentar inserir objetos armazenados num contentor de destino. + + + + Porém, se um Funil for alimentado por Redstone tornar-se-á inativo e parará de sugar e de inserir objetos. + + + + Um Funil aponta na direção em que tenta colocar objetos. Para levar um Funil a apontar para um determinado bloco, coloca-o frente a esse bloco enquanto andas furtivamente. + + + + Há vários modelos de Funil para veres e experimentares nesta divisão. + + + + Esta é a interface do Fogo de Artifício, que podes usar para criar Fogo de Artifício e Estrelas de Fogo de Artifício. + + + + {*B*}Prime {*CONTROLLER_VK_A*} para continuar. + {*B*}Prime {*CONTROLLER_VK_B*} se já sabes como usar a interface do Farol. + + + + Para criar um Fogo de Artifício, coloca Pólvora e Papel na grelha de 3x3 que é apresentada acima do teu inventário. + + + + Opcionalmente, podes colocar várias Estrelas de Fogo de Artifício na grelha e adicioná-las ao Fogo de Artifício. + + + + Preencher mais ranhuras na grelha com Pólvora aumentará a altura a que todas as Estrelas de Fogo de Artifício vão explodir. + + + + Podes então retirar o Fogo de Artifício criado da ranhura de saída. + + + + As Estrelas de Fogo de Artifício podem ser criadas colocando Pólvora e Tinta na grelha. + + + + A tinta definirá a cor da explosão da Estrela de Fogo de Artifício. + + + + A forma da Estrela de Fogo de Artifício é definida adicionando um destes elementos: Carga de Fogo, Pepita de Ouro, Pena ou Cabeça de Criatura. + + + + Podes adicionar um rasto ou uma cintilância usando Diamantes ou Pó de Glowstone. + + + + Depois de criares uma Estrela de Fogo de Artifício, podes definir a cor de desaparecimento da Estrela de Fogo de Artifício criando-a com Tinta. + + + + Dentro dos baús há vários objetos que podem ser usados na criação de FOGO DE ARTIFÍCIO! + + + + {*B*}Prime{*CONTROLLER_VK_A*} para saber mais sobre Fogo de Artifício. + {*B*}Prime{*CONTROLLER_VK_B*} se já sabes o que queres sobre Fogo de Artifício. + + + + O Fogo de Artifício é um objeto decorativo que pode ser lançado à mão ou a partir de Distribuidores. É feito usando Papel, Pólvora e, opcionalmente, uma série de Estrelas de Fogo de Artifício. + + + + As cores, o desaparecimento, a forma, a dimensão e os efeitos (como rastos e cintilâncias) das Estrelas de Fogo de Artifício podem ser personalizados através da inclusão de ingredientes extra aquando da criação. + + + + Experimenta criar um Fogo de Artifício na Mesa de Criação usando um sortido de ingredientes dos baús. + +  Selecionar Usar @@ -2646,25 +3199,25 @@ No modo de voo, podes manter premido{*CONTROLLER_ACTION_JUMP*} para subires e{*C Retirar -Retirar tudo +Retirar Tudo -Retirar metade +Retirar Metade Colocar -Colocar tudo +Colocar Tudo -Colocar um +Colocar Um Largar -Largar tudo +Largar Tudo -Largar um +Largar Um Trocar -Mover rápido +Mover Rápido Limpar Seleção Rápida @@ -2830,6 +3383,22 @@ No modo de voo, podes manter premido{*CONTROLLER_ACTION_JUMP*} para subires e{*C Carregar Gravação para Xbox One +Montar + +Desmontar + +Prender Baú + +Lançar + +Atrelar + +Soltar + +Prender + +Nomear + OK Cancelar @@ -2842,7 +3411,7 @@ No modo de voo, podes manter premido{*CONTROLLER_ACTION_JUMP*} para subires e{*C Guardar Jogo -Sair sem guardar +Sair Sem Guardar Tens a certeza de que queres substituir os jogos guardados anteriormente pela versão atual deste mundo? @@ -3058,7 +3627,7 @@ Queres desbloquear o jogo completo? Vários -Preparação de Poções +Poções Poções @@ -3140,6 +3709,20 @@ Queres desbloquear o jogo completo? Distribuidor +Cavalo + +Soltador + +Funil + +Farol + +Poder Principal + +Poder Secundário + +Vagoneta + De momento, não existem ofertas de conteúdo transferível deste tipo disponíveis para este título. %s juntou-se ao jogo. @@ -3203,7 +3786,7 @@ Queres desbloquear o jogo completo? O jogo no qual pretendes participar encontra-se na tua lista de níveis excluídos. Se quiseres participar neste jogo, o nível será removido da lista de níveis excluídos. -Excluir este nível? +Excluir Este Nível? Tens a certeza de que queres adicionar este nível à lista de níveis excluídos? Se selecionares OK, irás sair do jogo. @@ -3225,7 +3808,7 @@ Não desligues a consola Xbox 360 enquanto este ícone estiver visível. Opacidade da Interface -A preparar gravação automática do nível +A Preparar Gravação Automática do Nível Tamanho HUD @@ -3299,10 +3882,14 @@ Queres instalar o pacote de mistura ou pacote de texturas agora? Modo Criativo +Modo de Jogo: Aventura + Sobrevivência Criativo +Aventura + Criado em Sobrevivência Criado em Criativo @@ -3323,6 +3910,8 @@ Queres instalar o pacote de mistura ou pacote de texturas agora? Superplano +Introduz uma semente para gerar novamente o mesmo terreno. Deixa em branco para um mundo aleatório. + Quando ativado, o jogo ficará online. Quando ativado, só os jogadores convidados podem aderir. @@ -3347,6 +3936,20 @@ Queres instalar o pacote de mistura ou pacote de texturas agora? Quanto ativada, é criado um baú com objetos úteis junto ao ponto de regeneração do jogador. +Quando desativada, impede que monstros e animais mudem blocos (por exemplo, explosões de Creeper não destroem blocos e as Ovelhas não comem Erva) ou apanhem objetos. + +Quando ativado, os jogadores mantêm o inventário quando morrem. + +Quando desativada, as criaturas não se reproduzem naturalmente. + +Quando desativado, os monstros e animais não deixam cair saques (por exemplo, os Creepers não largam pólvora). + +Quando desativada, os blocos não largam objetos quando são destruídos (por exemplo, os blocos de Pedra não deixam cair Pedra Arredondada). + +Quando desativada, os jogadores não regeneram naturalmente a sua saúde. + +Quando desativado, a hora do dia não muda. + Pacotes de Skins Temas @@ -3395,7 +3998,49 @@ Queres instalar o pacote de mistura ou pacote de texturas agora? {*PLAYER*} foi agredido por {*SOURCE*} -{*PLAYER*} foi morto por {*SOURCE*} +{*PLAYER*} foi morto por {*SOURCE*} usando magia + +{*PLAYER*} caiu de uma escada + +{*PLAYER*} caiu de umas videiras + +{*PLAYER*} caiu fora da água + +{*PLAYER*} caiu de um local elevado + +{*PLAYER*} foi condenado a cair por {*SOURCE*} + +{*PLAYER*} foi condenado a cair por {*SOURCE*} + +{*PLAYER*} foi condenado a cair por {*SOURCE*} usando {*ITEM*} + +{*PLAYER*} caiu demasiado longe e foi liquidado por {*SOURCE*} + +{*PLAYER*} caiu demasiado longe e foi liquidado por {*SOURCE*} usando {*ITEM*} + +{*PLAYER*} entrou no fogo enquanto combatia {*SOURCE*} + +{*PLAYER*} ficou esturricado enquanto combatia {*SOURCE*} + +{*PLAYER*} tentou nadar em lava para fugir de {*SOURCE*} + +{*PLAYER*} afogou-se enquanto tentava fugir de {*SOURCE*} + +{*PLAYER*} foi de encontro a um cato enquanto tentava fugir de {*SOURCE*} + +{*PLAYER*} foi rebentado por {*SOURCE*} + +{*PLAYER*} feneceu + +{*PLAYER*} foi assassinado por {*SOURCE*} usando {*ITEM*} + +{*PLAYER*} foi alvejado por {*SOURCE*} usando {*ITEM*} + +{*PLAYER*} foi atingido por uma bola de fogo por {*SOURCE*} usando {*ITEM*} + +{*PLAYER*} foi esmagado por {*SOURCE*} usando {*ITEM*} + +{*PLAYER*} foi morto por {*SOURCE*} usando {*ITEM*} Rochas Enevoadas @@ -3427,9 +4072,9 @@ Queres instalar o pacote de mistura ou pacote de texturas agora? Já não podes usar contentores (tais como baús) -Já não podes atacar habitantes +Já não podes atacar criaturas -Já podes atacar habitantes +Já podes atacar criaturas Já não podes atacar jogadores @@ -3560,9 +4205,9 @@ Queres instalar o pacote de mistura ou pacote de texturas agora? Não Repor Submundo -De momento, não é possível tosquiar este Vacogumelo. Foi alcançado o número máximo de Porcos, Ovelhas, Vacas e Gatos. +De momento, não é possível tosquiar este Vacogumelo. Foi alcançado o número máximo de Porcos, Ovelhas, Vacas, Gatos e Cavalos. -De momento, não é possível usar o Ovo de Geração. O número máximo de Porcos, Ovelhas, Vacas e Gatos foi alcançado. +De momento, não é possível usar o Ovo de Geração. O número máximo de Porcos, Ovelhas, Vacas, Gatos e Cavalos foi alcançado. De momento, não é possível usar o Ovo de Geração. Foi alcançado o número máximo de Vacogumelos. @@ -3572,6 +4217,8 @@ Queres instalar o pacote de mistura ou pacote de texturas agora? De momento, não é possível usar o Ovo de Geração. Foi alcançado o número máximo de Lulas num mundo. +De momento, não é possível usar Ovo de Geração. Foi alcançado o número máximo de Morcegos num mundo. + De momento, não é possível usar o Ovo de Geração. Foi alcançado o número máximo de inimigos num mundo. De momento, não é possível usar o Ovo de Geração. Foi alcançado o número máximo de aldeões num mundo. @@ -3580,17 +4227,19 @@ Queres instalar o pacote de mistura ou pacote de texturas agora? Não podes produzir inimigos no modo Calmo. -Este animal não pode entrar no Modo Amor. O número máximo de Porcos, Ovelhas, Vacas e Gatos de criação foi alcançado. +Este animal não pode entrar no Modo Amor. O número máximo de Porcos, Ovelhas, Vacas, Gatos e Cavalos de criação foi alcançado. Este animal não pode entrar no Modo Amor. Foi alcançado o número máximo de Lobos de criação. Este animal não pode entrar no Modo Amor. Foi alcançado o número máximo de Galinhas de criação. +Este animal não pode entrar no Modo Amor. Foi alcançado o número máximo de cavalos de criação. + Este animal não pode entrar no Modo Amor. Foi alcançado o número máximo de Vacogumelos de criação. Foi alcançado o número máximo de Barcos num mundo. -O número máximo de Cabeças de Mob num mundo foi alcançado. +O número máximo de Cabeças de Criatura num mundo foi alcançado. Inverter @@ -3600,7 +4249,7 @@ Queres instalar o pacote de mistura ou pacote de texturas agora? Regenerar -Conteúdo transferível +Conteúdo Transferível Alterar Skin @@ -3613,27 +4262,43 @@ Queres instalar o pacote de mistura ou pacote de texturas agora? Ficha técnica Reinstalar Conteúdo - + Definições de Depuração - + Fogos Propagados - + Explosões de TNT - + Jogador vs. Jogador - + Confiar nos Jogadores - + Privilégios de Anfitrião - + Gerar Estruturas - + Mundo Superplano - + Baú de Bónus - + Opções de Mundo - + +Opções de Jogo + +Perturbação de Criaturas + +Manter Inventário + +Geração de Criaturas + +Saques de Criaturas + +Queda de Peças + +Regeneração Natural + +Ciclo da Luz do Dia + Pode Construir e Escavar Pode Usar Portas e Interruptores @@ -3672,7 +4337,7 @@ Queres instalar o pacote de mistura ou pacote de texturas agora? Semente para o Gerador de Mundos -Deixar livre para uma semente aleatória +Deixar livre p/ semente aleatória Jogadores @@ -3820,6 +4485,14 @@ Queres instalar o pacote de mistura ou pacote de texturas agora? Veneno +Cérbero + +Aumento de Saúde + +Absorção + +Saturação + de Velocidade de Lentidão @@ -3858,6 +4531,14 @@ Queres instalar o pacote de mistura ou pacote de texturas agora? de Veneno +de Decadência + +de Aumento de Saúde + +de Absorção + +de Saturação + II @@ -3954,6 +4635,22 @@ Queres instalar o pacote de mistura ou pacote de texturas agora? Reduz a saúde dos jogadores, animais e monstros afetados ao longo do tempo. +Quando se Aplica: + +Força de Salto de Cavalo + +Reforços Mortos-vivos + +Saúde Máx. + +Alcance de Seguimento das Criaturas + +Resistência a Ataques + +Velocidade + +Danos de Ataque + Precisão Golpear @@ -4044,7 +4741,7 @@ Queres instalar o pacote de mistura ou pacote de texturas agora? Restitui 3{*ICON_SHANK_01*}. Cria-se cozendo uma batata numa fornalha. -Restitui 1{*ICON_SHANK_01*} ou pode ser cozida numa fornalha. Pode ser plantada na terra. Se comeres isto podes ficar doente. +Restitui 1{*ICON_SHANK_01*}. Se comeres isto podes ficar envenenado. Restitui 3{*ICON_SHANK_01*}. Fabricada a partir de uma cenoura e de pepitas de ouro. @@ -4112,7 +4809,7 @@ Queres instalar o pacote de mistura ou pacote de texturas agora? Bloco de Quartzo -Bloco de Quartzo Esculpido +Bloc. Quartzo Esculpido Bloco Pilar de Quartzo @@ -4442,11 +5139,11 @@ Todos os Baús Ender de um mundo estão ligados. Os objetos colocados num Baú E Xbox 360 -BACK +Anterior Esta opção desativa as atualizações dos feitos e das classificações para este mundo durante o jogo e também ao carregá-lo novamente após guardar com esta opção ativa. -Carregar Gravação para Xbox One +Carregar Grav. Xbox One Carregar Gravação diff --git a/Minecraft.Assets/XboxMedia/strings.resx b/Minecraft.Assets/XboxMedia/loc/strings.resx similarity index 64% rename from Minecraft.Assets/XboxMedia/strings.resx rename to Minecraft.Assets/XboxMedia/loc/strings.resx index 21a7078a8..9e824d0f2 100644 --- a/Minecraft.Assets/XboxMedia/strings.resx +++ b/Minecraft.Assets/XboxMedia/loc/strings.resx @@ -408,6 +408,27 @@ When loading or creating a world, you can press the "More Options" button to ent {*T2*}Host Privileges{*ETW*}{*B*} When enabled, the host can toggle their ability to fly, disable exhaustion, and make themselves invisible from the in-game menu. {*DISABLES_ACHIEVEMENTS*}{*B*}{*B*} + {*T2*}Daylight Cycle{*ETW*}{*B*} + When disabled, the time of day will not change.{*B*}{*B*} + + {*T2*}Keep Inventory{*ETW*}{*B*} + When enabled, players will keep their inventory when they die.{*B*}{*B*} + + {*T2*}Mob Spawning{*ETW*}{*B*} + When disabled, mobs will not spawn naturally.{*B*}{*B*} + + {*T2*}Mob Griefing{*ETW*}{*B*} + When disabled, prevents monsters and animals from changing blocks (for example, Creeper explosions won't destroy blocks and Sheep won't remove Grass) or picking up items.{*B*}{*B*} + + {*T2*}Mob Loot{*ETW*}{*B*} + When disabled, monsters and animals will not drop loot (for example, Creepers won't drop gunpowder).{*B*}{*B*} + + {*T2*}Tile Drops{*ETW*}{*B*} + When disabled, blocks will not drop items when destroyed (for example, Stone blocks won't drop Cobblestone).{*B*}{*B*} + + {*T2*}Natural Regeneration{*ETW*}{*B*} + When disabled, players will not regenerate health naturally.{*B*}{*B*} + {*T1*}World Generation Options{*ETW*}{*B*} When creating a new world there are some additional options.{*B*}{*B*} @@ -451,25 +472,29 @@ To modify the privileges for a player, select their name and press{*CONTROLLER_V When this option is enabled, the player is able to change privileges for other players (except the host) if "Trust Players" is turned off, kick players and they can enable and disable fire spreading and TNT exploding.{*B*}{*B*} {*T2*}Kick Player{*ETW*}{*B*} - For players that are not on the same {*PLATFORM_NAME*} console as the host player, selecting this option will kick the player from the game and any other players on their {*PLATFORM_NAME*} console. This player will not be able to rejoin the game until it is restarted.{*B*}{*B*} + {*KICK_PLAYER_DESCRIPTION*}{*B*}{*B*} {*T1*}Host Player Options{*ETW*}{*B*} If "Host Privileges" is enabled the host player can modify some privileges for themselves. To modify the privileges for a player, select their name and press{*CONTROLLER_VK_A*} to bring up the player privileges menu where you can use the following options.{*B*}{*B*} {*T2*}Can Fly{*ETW*}{*B*} When this option is enabled, the player is able to fly. This option is only relevant to Survival mode, as flying is enabled for all players in Creative mode.{*B*}{*B*} - + {*T2*}Disable Exhaustion{*ETW*}{*B*} This option only affects Survival mode. When enabled, physical activities (walking/sprinting/jumping etc.) do not decrease the food bar. However, if the player becomes injured, the food bar will slowly decrease while the player is healing.{*B*}{*B*} - + {*T2*}Invisible{*ETW*}{*B*} When this option is enabled, the player is not visible to other players and is invulnerable.{*B*}{*B*} - + {*T2*}Can Teleport{*ETW*}{*B*} This allows the player to move players or themselves to other players in the world. + + For players that are not on the same {*PLATFORM_NAME*} console as the host player, selecting this option will kick the player from the game and any other players on their {*PLATFORM_NAME*} console. This player will not be able to rejoin the game until it is restarted. + + Next Page @@ -566,100 +591,148 @@ so they can easily join you. - -{*T3*}Changes and Additions{*ETW*}{*B*}{*B*} -- Added new items - Emerald, Emerald Ore, Block of Emerald, Ender Chest, Tripwire Hook, Enchanted Golden Apple, Anvil, Flower Pot, Cobblestone Walls, Mossy Cobblestone Walls, Wither Painting, Potato, Baked Potato, Poisonous Potato, Carrot, Golden Carrot, Carrot on a Stick, -Pumpkin Pie, Night Vision Potion, Invisibility Potion, Nether Quartz, Nether Quartz Ore, Block of Quartz, Quartz Slab, Quartz Stair, Chiseled Quartz Block, Pillar Quartz Block, Enchanted Book, Carpet.{*B*} -- Added new recipes for Smooth Sandstone and Chiselled Sandstone.{*B*} -- Added new Mobs - Zombie Villagers.{*B*} -- Added new terrain generation features - Desert Temples, Desert Villages, Jungle Temples.{*B*} -- Added Trading with villagers.{*B*} -- Added Anvil interface.{*B*} -- Can dye leather armor.{*B*} -- Can dye wolf collars.{*B*} -- Can control riding a pig with a Carrot on a Stick.{*B*} -- Updated Bonus Chest content with more items.{*B*} -- Changed placement of half blocks and other blocks on half blocks.{*B*} -- Changed placement of upside down stairs and slabs.{*B*} -- Added different villager professions.{*B*} -- Villagers spawned from a spawn egg will have a random profession.{*B*} -- Added sideways log placement.{*B*} -- Furnaces can use wooden tools as a fuel.{*B*} -- Ice and Glass panes can be collected with silk touch enchanted tools.{*B*} -- Wooden Buttons and Wooden Pressure Plates can be activated with Arrows.{*B*} -- Nether mobs can spawn in the Overworld from Portals.{*B*} -- Creepers and Spiders are aggressive towards the last player that hit them.{*B*} -- Mobs in Creative mode become neutral again after a short period.{*B*} -- Remove knockback when drowning.{*B*} -- Doors being broken by zombies show damage.{*B*} -- Ice melts in the nether.{*B*} -- Cauldrons fill up when out in the rain.{*B*} -- Pistons take twice as long to update.{*B*} -- Pig drops Saddle when killed (if has one).{*B*} -- Sky color in The End changed.{*B*} -- String can be placed (for Tripwires).{*B*} -- Rain drips through leaves.{*B*} -- Levers can be placed on the bottom of blocks.{*B*} -- TNT does variable damage depending on difficulty setting.{*B*} -- Book recipe changed.{*B*} -- Boats break Lilypads, instead of Lilypads breaking Boats.{*B*} -- Pigs drop more Porkchops.{*B*} -- Slimes spawn less in Superflat worlds.{*B*} -- Creeper damage variable based on difficulty setting, more knockback.{*B*} -- Fixed Endermen not opening their jaws.{*B*} -- Added teleporting of players (using the {*BACK_BUTTON*} menu in-game).{*B*} -- Added new Host Options for flying, invisibility and invulnerability for remote players.{*B*} -- Added new tutorials to the Tutorial World for new items and features.{*B*} -- Updated the positions of the Music Disc Chests in the Tutorial World.{*B*} + {*T3*}Changes and Additions{*ETW*}{*B*}{*B*} +- Added new items - Hardened Clay, Stained Clay, Block of Coal, Hay Bale, Activator Rail, Block of Redstone, Daylight Sensor, Dropper, Hopper, Minecart with Hopper, Minecart with TNT, Redstone Comparator, Weighted Pressure Plate, Beacon, Trapped Chest, Firework Rocket, Firework Star, Nether Star, Lead, Horse Armor, Name Tag, Horse Spawn Egg{*B*} +- Added new Mobs - Wither, Wither Skeletons, Witches, Bats, Horses, Donkeys and Mules{*B*} +- Added new terrain generation features - Witch Huts.{*B*} +- Added Beacon interface.{*B*} +- Added Horse interface.{*B*} +- Added Hopper interface.{*B*} +- Added Fireworks - Fireworks interface is accessible from the Crafting Table when you have the ingredients to craft a Firework Star or Firework Rocket.{*B*} +- Added 'Adventure Mode' - You can only break blocks with the correct tools.{*B*} +- Added lots of new sounds.{*B*} +- Mobs, items and projectiles can now pass through portals.{*B*} +- Repeaters can now be locked by powering their sides with another Repeater.{*B*} +- Zombies and Skeletons can now spawn with different weapons and armor.{*B*} +- New death messages.{*B*} +- Name mobs with a Name Tag, and rename containers to change the title when the menu is open.{*B*} +- Bonemeal no longer instantly grows everything to full size, and instead randomly grows in stages.{*B*} +- A Redstone signal describing the contents of Chests, Brewing Stands, Dispensers and Jukeboxes can be detected by placing a Redstone Comparator directly against them.{*B*} +- Dispensers can face in any direction.{*B*} +- Eating a Golden Apple gives the player extra "absorption" health for a short period.{*B*} +- The longer you remain in an area the harder the monsters that spawn in that area will be.{*B*} {*ETB*}Welcome back! You may not have noticed but your Minecraft has just been updated.{*B*}{*B*} -There are lots of new features for you and friends to play with so here’s just a few highlights. Have a read and then go and have fun!{*B*}{*B*} -{*T1*}New Items{*ETB*} - Emerald, Emerald Ore, Block of Emerald, Ender Chest, Tripwire Hook, Enchanted Golden Apple, Anvil, Flower Pot, Cobblestone Walls, Mossy Cobblestone Walls, Wither Painting, Potato, Baked Potato, Poisonous Potato, Carrot, Golden Carrot, Carrot on a Stick, -Pumpkin Pie, Night Vision Potion, Invisibility Potion, Nether Quartz, Nether Quartz Ore, Block of Quartz, Quartz Slab, Quartz Stair, Chiseled Quartz Block, Pillar Quartz Block, Enchanted Book, Carpet.{*B*}{*B*} - {*T1*}New Mobs{*ETB*} - Zombie Villagers.{*B*}{*B*} -{*T1*}New Features{*ETB*} - Trade with villagers, repair or enchant weapons and tools with an Anvil, store items in an Ender Chest, control a pig while riding it using a Carrot on a Stick!{*B*}{*B*} -{*T1*}New Mini-Tutorials{*ETB*} – Learn how to use the new features in the Tutorial World!{*B*}{*B*} -{*T1*}New 'Easter Eggs'{*ETB*} – We've moved all the secret Music Discs in the Tutorial World. See if you can find them again!{*B*}{*B*} - +There are lots of new features for you and friends to play with so here’s just a few highlights. Have a read and then go and have fun!{*B*}{*B*} +{*T1*}New Items{*ETB*} - Hardened Clay, Stained Clay, Block of Coal, Hay Bale, Activator Rail, Block of Redstone, Daylight Sensor, Dropper, Hopper, Minecart with Hopper, Minecart with TNT, Redstone Comparator, Weighted Pressure Plate, Beacon, Trapped Chest, Firework Rocket, Firework Star, Nether Star, Lead, Horse Armor, Name Tag, Horse Spawn Egg{*B*}{*B*} +{*T1*}New Mobs{*ETB*} - Wither, Wither Skeletons, Witches, Bats, Horses, Donkeys and Mules{*B*}{*B*} +{*T1*}New Features{*ETB*} - Tame and ride a horse, craft fireworks and put on a show, name animals and monsters with a Name Tag, create more advanced Redstone circuits, and new Host Options to help control what guests to your world can do!{*B*}{*B*} +{*T1*}New Tutorial World{*ETB*} – Learn how to use the old and new features in the Tutorial World. See if you can find all the secret Music Discs hidden in the world!{*B*}{*B*} + + + Horses + + + {*T3*}HOW TO PLAY : HORSES{*ETW*}{*B*}{*B*} +Horses and Donkeys are found mainly in open plains. Mules are the offspring of a Donkey and a Horse, but are infertile themselves.{*B*} +All adult Horses, Donkeys and Mules can be ridden. However only Horses can be armored, and only Mules and Donkeys may be equipped with saddlebags for transporting items.{*B*}{*B*} +Horses, Donkeys and Mules must be tamed before they can be used. A horse is tamed by attempting to ride it, and managing to stay on the horse while it attempts to throw the rider off.{*B*} +When Love Hearts appear around the horse, it is tame, and will no longer attempt to throw the player off. To steer a horse, the player must equip the horse with a Saddle.{*B*}{*B*} +Saddles can be bought from villagers or found inside Chests hidden in the world.{*B*} +Tame Donkeys and Mules can be given saddlebags by attaching a Chest. These saddlebags can then be accessed whilst riding or sneaking.{*B*}{*B*} +Horses and Donkeys (but not Mules) can be bred like other animals using Golden Apples or Golden Carrots.{*B*} +Foals will grow into adult horses over time, although feeding them Wheat or Hay will speed this up.{*B*} + + + + + Beacons + + + {*T3*}HOW TO PLAY : BEACONS{*ETW*}{*B*}{*B*} +Active Beacons project a bright beam of light into the sky and grant powers to nearby players.{*B*} +They are crafted with Glass, Obsidian and Nether Stars, which can be obtained by defeating the Wither.{*B*}{*B*} +Beacons must be placed so that they are in sunlight during the day. Beacons must be placed on Pyramids of Iron, Gold, Emerald or Diamond.{*B*} +The material the Beacon is placed on has no effect on the power of the Beacon.{*B*}{*B*} +In the Beacon menu you can select one primary power for your Beacon. The more tiers your pyramid has the more powers you will have to choose from.{*B*} +A Beacon on a pyramid with at least four tiers also gives the option of either the Regeneration secondary power or a stronger primary power.{*B*}{*B*} +To set the powers of your Beacon you must sacrifice an Emerald, Diamond, Gold or Iron Ingot in the payment slot.{*B*} +Once set, the powers will emanate from the Beacon indefinitely.{*B*} + + + + + Fireworks + + + {*T3*}HOW TO PLAY : FIREWORKS{*ETW*}{*B*}{*B*} +Fireworks are decorative items that can be launched by hand or from Dispensers. They are crafted using Paper, Gunpowder and optionally a number of Firework Stars.{*B*} +The colors, fade, shape, size, and effects (such as trails and twinkle) of Firework Stars can be customized by including additional ingredients when crafting.{*B*}{*B*} +To craft a Firework place Gunpowder and Paper in the 3x3 crafting grid that is shown above your inventory.{*B*} +You can optionally place multiple Firework Stars in the crafting grid to add them to the Firework.{*B*} +Filling more slots in the crafting grid with Gunpowder will increase the height at which all the Firework Stars will explode.{*B*}{*B*} +You can then take the crafted Firework out of the output slot.{*B*}{*B*} +Firework Stars can be crafted by placing Gunpowder and Dye into the crafting grid.{*B*} + - The Dye will set the color of the explosion of the Firework Star.{*B*} + - The shape of the Firework Star is set by adding either a Fire Charge, Gold Nugget, Feather or Mob Head.{*B*} + - A trail or a twinkle can be added using Diamonds or Glowstone Dust.{*B*}{*B*} +After a Firework Star has been crafted, you can set the fade color of the Firework Star by crafting it with Dye. + + + + + Hoppers + + + {*T3*}HOW TO PLAY : HOPPERS{*ETW*}{*B*}{*B*} +Hoppers are used to insert or remove items from containers, and to automatically pick up items thrown into them.{*B*} +They can affect Brewing Stands, Chests, Dispensers, Droppers, Minecarts with Chests, Minecarts with Hoppers, as well as other Hoppers.{*B*}{*B*} +Hoppers will continuously attempt to suck items out of a suitable container placed above them. They will also attempt to insert stored items into an output container.{*B*} +If a Hopper is powered by Redstone it will become inactive and stop both sucking and inserting items.{*B*}{*B*} +A Hopper points in the direction it tries to output items. To make a Hopper point to a particular block, place the Hopper against that block whilst sneaking.{*B*} + + + + Droppers + + + {*T3*}HOW TO PLAY : DROPPERS{*ETW*}{*B*}{*B*} +When powered by Redstone, Droppers will drop a single random item contained within them onto the ground. Use {*CONTROLLER_ACTION_USE*} to open the Dropper and then you can load the Dropper with items from your inventory.{*B*} +If the Dropper is facing a Chest or another type of Container, the item will be placed into that instead. Long chains of Droppers can be constructed to transport items over a distance, but for this to work they will have to be alternately powered on and off. + + + + +  - Deals more damage than by hand. + Deals more damage than by hand. - Used to dig dirt, grass, sand, gravel and snow faster than by hand. Shovels are required to dig snowballs. + Used to dig dirt, grass, sand, gravel and snow faster than by hand. Shovels are required to dig snowballs. - Required to mine stone-related blocks and ore. + Required to mine stone-related blocks and ore. - Used to chop wood-related blocks faster than by hand. + Used to chop wood-related blocks faster than by hand. - Used to till dirt and grass blocks to prepare for crops. + Used to till dirt and grass blocks to prepare for crops. - Wooden doors are activated by using, hitting them or with Redstone. + Wooden doors are activated by using, hitting them or with Redstone. - Iron doors can only be opened by Redstone, buttons or switches. + Iron doors can only be opened by Redstone, buttons or switches. - - NOT USED + + NOT USED - NOT USED + NOT USED - NOT USED + NOT USED - NOT USED + NOT USED @@ -679,807 +752,936 @@ Pumpkin Pie, Night Vision Potion, Invisibility Potion, Nether Quartz, Nether Qua - Gives the user 2 Armor when worn. + Gives the user 2 Armor when worn. - Gives the user 5 Armor when worn. + Gives the user 5 Armor when worn. - Gives the user 4 Armor when worn. + Gives the user 4 Armor when worn. - Gives the user 1 Armor when worn. + Gives the user 1 Armor when worn. - Gives the user 2 Armor when worn. + Gives the user 2 Armor when worn. - Gives the user 6 Armor when worn. + Gives the user 6 Armor when worn. - Gives the user 5 Armor when worn. + Gives the user 5 Armor when worn. - Gives the user 2 Armor when worn. + Gives the user 2 Armor when worn. - Gives the user 2 Armor when worn. + Gives the user 2 Armor when worn. - Gives the user 5 Armor when worn. + Gives the user 5 Armor when worn. - Gives the user 3 Armor when worn. + Gives the user 3 Armor when worn. - Gives the user 1 Armor when worn. + Gives the user 1 Armor when worn. - Gives the user 3 Armor when worn. + Gives the user 3 Armor when worn. - Gives the user 8 Armor when worn. + Gives the user 8 Armor when worn. - Gives the user 6 Armor when worn. + Gives the user 6 Armor when worn. - Gives the user 3 Armor when worn. + Gives the user 3 Armor when worn. - A shiny ingot which can be used to craft tools made from this material. Created by smelting ore in a furnace. + A shiny ingot which can be used to craft tools made from this material. Created by smelting ore in a furnace. - Allows ingots, gems, or dyes to be crafted into placeable blocks. Can be used as an expensive building block or compact storage of the ore. + Allows ingots, gems, or dyes to be crafted into placeable blocks. Can be used as an expensive building block or compact storage of the ore. - Used to send an electrical charge when stepped on by a player, an animal, or a monster. Wooden Pressure Plates can also be activated by dropping something on them. + Used to send an electrical charge when stepped on by a player, an animal, or a monster. Wooden Pressure Plates can also be activated by dropping something on them. - Used for compact staircases. + Used for compact staircases. - Used for making long staircases. Two slabs placed on top of each other will create a normal-sized double slab block. + Used for making long staircases. Two slabs placed on top of each other will create a normal-sized double slab block. - Used for making long staircases. Two slabs placed on top of each other will create a normal-sized double slab block. + Used for making long staircases. Two slabs placed on top of each other will create a normal-sized double slab block. - Used to create light. Torches also melt snow and ice. + Used to create light. Torches also melt snow and ice. - Used as a building material and can be crafted into many things. Can be crafted from any form of wood. + Used as a building material and can be crafted into many things. Can be crafted from any form of wood. - Used as a building material. Is not influenced by gravity like normal Sand. + Used as a building material. Is not influenced by gravity like normal Sand. - Used as a building material. + Used as a building material. - Used to craft torches, arrows, signs, ladders, fences and as handles for tools and weapons. + Used to craft torches, arrows, signs, ladders, fences and as handles for tools and weapons. - Used to forward time from any time at night to morning if all the players in the world are in bed, and changes the spawn point of the player. + Used to forward time from any time at night to morning if all the players in the world are in bed, and changes the spawn point of the player. The colors of the bed are always the same, regardless of the colors of wool used. - Allows you to craft a more varied selection of items than the normal crafting. + Allows you to craft a more varied selection of items than the normal crafting. - Allows you to smelt ore, create charcoal and glass, and cook fish and porkchops. + Allows you to smelt ore, create charcoal and glass, and cook fish and porkchops. - Stores blocks and items inside. Place two chests side by side to create a larger chest with double the capacity. + Stores blocks and items inside. Place two chests side by side to create a larger chest with double the capacity. - Used as a barrier that cannot be jumped over. Counts as 1.5 blocks high for players, animals and monsters, but 1 block high for other blocks. + Used as a barrier that cannot be jumped over. Counts as 1.5 blocks high for players, animals and monsters, but 1 block high for other blocks. - Used to climb vertically. + Used to climb vertically. - Activated by using, hitting them or with redstone. They function as normal doors, but are a one by one block and lay flat on the ground. + Activated by using, hitting them or with redstone. They function as normal doors, but are a one by one block and lay flat on the ground. - Shows text entered by you or other players. + Shows text entered by you or other players. - Used to create brighter light than torches. Melts snow/ice and can be used underwater. + Used to create brighter light than torches. Melts snow/ice and can be used underwater. - Used to cause explosions. Activated after placing by igniting with Flint and Steel item, or with an electrical charge. + Used to cause explosions. Activated after placing by igniting with Flint and Steel item, or with an electrical charge. - Used to hold mushroom stew. You keep the bowl when the stew has been eaten. + Used to hold mushroom stew. You keep the bowl when the stew has been eaten. - Used to hold and transport water, lava and milk. + Used to hold and transport water, lava and milk. - Used to hold and transport water. + Used to hold and transport water. - Used to hold and transport lava. + Used to hold and transport lava. - Used to hold and transport milk. + Used to hold and transport milk. - Used to create fire, ignite TNT, and open a portal once it has been built. + Used to create fire, ignite TNT, and open a portal once it has been built. - Used to catch fish. + Used to catch fish. - Displays positions of the Sun and Moon. + Displays positions of the Sun and Moon. - Points to your start point. + Points to your start point. - Will create an image of an area explored while held. This can be used for path-finding. + Will create an image of an area explored while held. This can be used for path-finding. + + + When used becomes a map of the part of the world that you are in, and gets filled in as you explore. - Allows for ranged attacks by using arrows. + Allows for ranged attacks by using arrows. - Used as ammunition for bows. + Used as ammunition for bows. + + + Dropped by the Wither, used in crafting Beacons. + + + When activated, create colorful explosions. The color, effect, shape and fade are determined by the Firework Star used when the Firework is created. + + + Used to determine the color, effect and shape of a Firework. + + + Used in Redstone circuits to maintain, compare, or subtract signal strength, or to measure certain block states. + + + Is a type of Minecart that acts as a moving TNT block. + + + Is a block that outputs a Redstone signal based on sunlight (or lack of sunlight). + + + Is a special type of Minecart that functions similarly to a Hopper. It will collect items lying on tracks and from containers above it. + + + A special type of Armor that can be equipped to a horse. Provides 5 Armor. + + + A special type of Armor that can be equipped to a horse. Provides 7 Armor. + + + A special type of Armor that can be equipped to a horse. Provides 11 Armor. + + + Used to leash mobs to the player or Fence posts. + + + Used to name mobs in the world. + - Restores 2.5{*ICON_SHANK_01*}. + Restores 2.5{*ICON_SHANK_01*}. - Restores 1{*ICON_SHANK_01*}. Can be used 6 times. + Restores 1{*ICON_SHANK_01*}. Can be used 6 times. - Restores 1{*ICON_SHANK_01*}. + Restores 1{*ICON_SHANK_01*}. - Restores 1{*ICON_SHANK_01*}. + Restores 1{*ICON_SHANK_01*}. - Restores 3{*ICON_SHANK_01*}. + Restores 3{*ICON_SHANK_01*}. - Restores 1{*ICON_SHANK_01*}, or can be cooked in a furnace. Eating this can cause you to be poisoned. + Restores 1{*ICON_SHANK_01*}, or can be cooked in a furnace. Eating this can cause you to be poisoned. - Restores 3{*ICON_SHANK_01*}. Created by cooking raw chicken in a furnace. + Restores 3{*ICON_SHANK_01*}. Created by cooking raw chicken in a furnace. - Restores 1.5{*ICON_SHANK_01*}, or can be cooked in a furnace. + Restores 1.5{*ICON_SHANK_01*}, or can be cooked in a furnace. - Restores 4{*ICON_SHANK_01*}. Created by cooking raw beef in a furnace. + Restores 4{*ICON_SHANK_01*}. Created by cooking raw beef in a furnace. - Restores 1.5{*ICON_SHANK_01*}, or can be cooked in a furnace. + Restores 1.5{*ICON_SHANK_01*}, or can be cooked in a furnace. - Restores 4{*ICON_SHANK_01*}. Created by cooking a raw porkchop in a furnace. + Restores 4{*ICON_SHANK_01*}. Created by cooking a raw porkchop in a furnace. - Restores 1{*ICON_SHANK_01*}, or can be cooked in a furnace. Can be fed to an Ocelot to tame it. + Restores 1{*ICON_SHANK_01*}, or can be cooked in a furnace. Can be fed to an Ocelot to tame it. - Restores 2.5{*ICON_SHANK_01*}. Created by cooking a raw fish in a furnace. + Restores 2.5{*ICON_SHANK_01*}. Created by cooking a raw fish in a furnace. - Restores 2{*ICON_SHANK_01*}, and can be crafted into a golden apple. + Restores 2{*ICON_SHANK_01*}, and can be crafted into a golden apple. - Restores 2{*ICON_SHANK_01*}, and regenerates health for 4 seconds. Crafted from an apple and gold nuggets. + Restores 2{*ICON_SHANK_01*}, and regenerates health for 4 seconds. Crafted from an apple and gold nuggets. - Restores 2{*ICON_SHANK_01*}. Eating this can cause you to be poisoned. + Restores 2{*ICON_SHANK_01*}. Eating this can cause you to be poisoned. - Used in the cake recipe, and as an ingredient for brewing potions. + Used in the cake recipe, and as an ingredient for brewing potions. - Used to send an electrical charge by being turned on or off. Stays in the on or off state until pressed again. + Used to send an electrical charge by being turned on or off. Stays in the on or off state until pressed again. - Constantly sends an electrical charge, or can be used as a receiver/transmitter when connected to the side of a block. + Constantly sends an electrical charge, or can be used as a receiver/transmitter when connected to the side of a block. Can also be used for low-level lighting. - Used in Redstone circuits as repeater, a delayer, and/or a diode. + Used in Redstone circuits as repeater, a delayer, and/or a diode. - Used to send an electrical charge by being pressed. Stays activated for approximately a second before shutting off again. + Used to send an electrical charge by being pressed. Stays activated for approximately a second before shutting off again. - Used to hold and shoot out items in a random order when given a Redstone charge. + Used to hold and shoot out items in a random order when given a Redstone charge. - Plays a note when triggered. Hit it to change the pitch of the note. Placing this on top of different blocks will change the type of instrument. + Plays a note when triggered. Hit it to change the pitch of the note. Placing this on top of different blocks will change the type of instrument. - Used to guide minecarts. + Used to guide minecarts. - When powered, accelerates minecarts that pass over it. When unpowered, causes minecarts to stop on it. + When powered, accelerates minecarts that pass over it. When unpowered, causes minecarts to stop on it. - Functions like a Pressure Plate (sends a Redstone signal when powered) but can only be activated by a minecart. + Functions like a Pressure Plate (sends a Redstone signal when powered) but can only be activated by a Minecart. - Used to transport you, an animal, or a monster along rails. + Used to transport you, an animal, or a monster along rails. - Used to transport goods along rails. + Used to transport goods along rails. - Will move along rails and can push other minecarts when coal is put in it. + Will move along rails and can push other minecarts when coal is put in it. - Used to travel in water more quickly than swimming. + Used to travel in water more quickly than swimming. - Collected from sheep, and can be colored with dyes. + Collected from sheep, and can be colored with dyes. - Used as a building material and can be colored with dyes. This recipe is not recommended because Wool can be easily obtained from Sheep. + Used as a building material and can be colored with dyes. This recipe is not recommended because Wool can be easily obtained from Sheep. - Used as a dye to create black wool. + Used as a dye to create black wool. - Used as a dye to create green wool. + Used as a dye to create green wool. - Used as a dye to create brown wool, as an ingredient in cookies, or to grow Cocoa Pods. + Used as a dye to create brown wool, as an ingredient in cookies, or to grow Cocoa Pods. - Used as a dye to create silver wool. + Used as a dye to create silver wool. - Used as a dye to create yellow wool. + Used as a dye to create yellow wool. - Used as a dye to create red wool. + Used as a dye to create red wool. - Used to instantly grow crops, trees, tall grass, huge mushrooms and flowers, and can be used in dye recipes. + Used to instantly grow crops, trees, tall grass, huge mushrooms and flowers, and can be used in dye recipes. - Used as a dye to create pink wool. + Used as a dye to create pink wool. - Used as a dye to create orange wool. + Used as a dye to create orange wool. - Used as a dye to create lime wool. + Used as a dye to create lime wool. - Used as a dye to create gray wool. + Used as a dye to create gray wool. - Used as a dye to create light gray wool. + Used as a dye to create light gray wool. (Note: light gray dye can also be made by combining gray dye with bone meal, letting you make four light gray dyes from every ink sac instead of three.) - Used as a dye to create light blue wool. + Used as a dye to create light blue wool. - Used as a dye to create cyan wool. + Used as a dye to create cyan wool. - Used as a dye to create purple wool. + Used as a dye to create purple wool. - Used as a dye to create magenta wool. + Used as a dye to create magenta wool. - Used as dye to create Blue Wool. + Used as dye to create Blue Wool. - Plays Music Discs. + Plays Music Discs. - Use these to create very strong tools, weapons or armor. + Use these to create very strong tools, weapons or armor. - Used to create brighter light than torches. Melts snow/ice and can be used underwater. + Used to create brighter light than torches. Melts snow/ice and can be used underwater. - Used to create books and maps. + Used to create books and maps. - Can be used to create a bookshelves or enchanted to make Enchanted Books. + Can be used to create bookshelves or enchanted to make Enchanted Books. - Allows the creation of more powerful enchantments when placed around the Enchantment Table. + Allows the creation of more powerful enchantments when placed around the Enchantment Table. - Used as decoration. + Used as decoration. - Can be mined with an iron pickaxe or better, then smelted in a furnace to produce gold ingots. + Can be mined with an iron pickaxe or better, then smelted in a furnace to produce gold ingots. - Can be mined with a stone pickaxe or better, then smelted in a furnace to produce iron ingots. + Can be mined with a stone pickaxe or better, then smelted in a furnace to produce iron ingots. - Can be mined with a pickaxe to collect coal. + Can be mined with a pickaxe to collect coal. - Can be mined with a stone pickaxe or better to collect lapis lazuli. + Can be mined with a stone pickaxe or better to collect lapis lazuli. - Can be mined with an iron pickaxe or better to collect diamonds. + Can be mined with an iron pickaxe or better to collect diamonds. - Can be mined with an iron pickaxe or better to collect redstone dust. + Can be mined with an iron pickaxe or better to collect redstone dust. - Can be mined with a pickaxe to collect cobblestone. + Can be mined with a pickaxe to collect cobblestone. - Collected using a shovel. Can be used for construction. + Collected using a shovel. Can be used for construction. - Can be planted and it will eventually grow into a tree. + Can be planted and it will eventually grow into a tree. - This cannot be broken. + This cannot be broken. - Sets fire to anything that touches it. Can be collected in a bucket. + Sets fire to anything that touches it. Can be collected in a bucket. - Collected using a shovel. Can be smelted into glass using the furnace. Is affected by gravity if there is no other tile underneath it. + Collected using a shovel. Can be smelted into glass using the furnace. Is affected by gravity if there is no other tile underneath it. - Collected using a shovel. Sometimes produces flint when dug up. Is affected by gravity if there is no other tile underneath it. + Collected using a shovel. Sometimes produces flint when dug up. Is affected by gravity if there is no other tile underneath it. - Chopped using an axe, and can be crafted into planks or used as a fuel. + Chopped using an axe, and can be crafted into planks or used as a fuel. - Created in a furnace by smelting sand. Can be used for construction, but will break if you try to mine it. + Created in a furnace by smelting sand. Can be used for construction, but will break if you try to mine it. - Mined from stone using a pickaxe. Can be used to construct a furnace or stone tools. + Mined from stone using a pickaxe. Can be used to construct a furnace or stone tools. - Baked from clay in a furnace. + Baked from clay in a furnace. - Can be baked into bricks in a furnace. + Can be baked into bricks in a furnace. - When broken drops clay balls which can be baked into bricks in a furnace. + When broken drops clay balls which can be baked into bricks in a furnace. - A compact way to store snowballs. + A compact way to store snowballs. - Can be dug with a shovel to create snowballs. + Can be dug with a shovel to create snowballs. - Sometimes produces wheat seeds when broken. + Sometimes produces wheat seeds when broken. - Can be crafted into a dye. + Can be crafted into a dye. - Can be crafted with a bowl to make stew. + Can be crafted with a bowl to make stew. - Can only be mined with a diamond pickaxe. Is produced by the meeting of water and still lava, and is used to build a portal. + Can only be mined with a diamond pickaxe. Is produced by the meeting of water and still lava, and is used to build a portal. - Spawns monsters into the world. + Spawns monsters into the world. - Is placed on the ground to carry an electrical charge. When brewed with a potion it will increase the duration of the effect. + Is placed on the ground to carry an electrical charge. When brewed with a potion it will increase the duration of the effect. - When fully grown, crops can be harvested to collect wheat. + When fully grown, crops can be harvested to collect wheat. - Ground that has been prepared ready to plant seeds. + Ground that has been prepared ready to plant seeds. - Can be cooked in a furnace to create a green dye. + Can be cooked in a furnace to create a green dye. - Can be crafted to create sugar. + Can be crafted to create sugar. - Can be worn as a helmet or crafted with a torch to create a Jack-O-Lantern. It is also the main ingredient in Pumpkin Pie. + Can be worn as a helmet or crafted with a torch to create a Jack-O-Lantern. It is also the main ingredient in Pumpkin Pie. - Burns forever if set alight. + Burns forever if set alight. - Slows the movement of anything walking over it. + Slows the movement of anything walking over it. - Standing in the portal allows you to pass between the Overworld and the Nether. + Standing in the portal allows you to pass between the Overworld and the Nether. - Used as a fuel in a furnace, or crafted to make a torch. + Used as a fuel in a furnace, or crafted to make a torch. - Collected by killing a spider, and can be crafted into a Bow or Fishing Rod, or placed on the ground to create Tripwire. + Collected by killing a spider, and can be crafted into a Bow or Fishing Rod, or placed on the ground to create Tripwire. - Collected by killing a chicken, and can be crafted into an arrow. + Collected by killing a chicken, and can be crafted into an arrow. - Collected by killing a Creeper, and can be crafted into TNT or used as an ingredient for brewing potions. + Collected by killing a Creeper, and can be crafted into TNT or used as an ingredient for brewing potions. - Can be planted in farmland to grow crops. Make sure there's enough light for the seeds to grow! + Can be planted in farmland to grow crops. Make sure there's enough light for the seeds to grow! - Harvested from crops, and can be used to craft food items. + Harvested from crops, and can be used to craft food items. - Collected by digging gravel, and can be used to craft a flint and steel. + Collected by digging gravel, and can be used to craft a flint and steel. - When used on a pig it allows you to ride the pig. The pig can then be steered using a Carrot on a Stick. + When used on a pig it allows you to ride the pig. The pig can then be steered using a Carrot on a Stick. - Collected by digging snow, and can be thrown. + Collected by digging snow, and can be thrown. - Collected by killing a cow, and can be crafted into armor or used to make Books. + Collected by killing a cow, and can be crafted into armor or used to make Books. - Collected by killing a Slime, and used as an ingredient for brewing potions or crafted to make Sticky Pistons. + Collected by killing a Slime, and used as an ingredient for brewing potions or crafted to make Sticky Pistons. - Dropped randomly by chickens, and can be crafted into food items. + Dropped randomly by chickens, and can be crafted into food items. - Collected by mining Glowstone, and can be crafted to make Glowstone blocks again or brewed with a potion to increase the potency of the effect. + Collected by mining Glowstone, and can be crafted to make Glowstone blocks again or brewed with a potion to increase the potency of the effect. - Collected by killing a Skeleton. Can be crafted into bone meal. Can be fed to a wolf to tame it. + Collected by killing a Skeleton. Can be crafted into bone meal. Can be fed to a wolf to tame it. - Collected by getting a Skeleton to kill a Creeper. Can be played in a jukebox. + Collected by getting a Skeleton to kill a Creeper. Can be played in a jukebox. - Extinguishes fire and helps crops grow. Can be collected in a bucket. + Extinguishes fire and helps crops grow. Can be collected in a bucket. - When broken sometimes drops a sapling which can then be replanted to grow into a tree. + When broken sometimes drops a sapling which can then be replanted to grow into a tree. - Found in dungeons, can be used for construction and decoration. + Found in dungeons, can be used for construction and decoration. - Used to obtain wool from sheep and harvest leaf blocks. + Used to obtain wool from sheep and harvest leaf blocks. - When powered (using a button, a lever, a pressure plate, a redstone torch, or redstone with any one of these), a piston extends if it can and pushes blocks. + When powered (using a button, a lever, a pressure plate, a redstone torch, or redstone with any one of these), a piston extends if it can and pushes blocks. - When powered (using a button, a lever, a pressure plate, a redstone torch, or redstone with any one of these), a piston extends if it can and pushes blocks. When it retracts it pulls back the block touching the extended part of the piston. + When powered (using a button, a lever, a pressure plate, a redstone torch, or redstone with any one of these), a piston extends if it can and pushes blocks. When it retracts it pulls back the block touching the extended part of the piston. - Made from Stone blocks, and commonly found in Strongholds. + Made from Stone blocks, and commonly found in Strongholds. - Used as a barrier, similar to fences. + Used as a barrier, similar to fences. - Similar to a door, but used primarily with fences. + Similar to a door, but used primarily with fences. - Can be crafted from Melon Slices. + Can be crafted from Melon Slices. - Transparent blocks that can be used as an alternative to Glass Blocks. + Transparent blocks that can be used as an alternative to Glass Blocks. - Can be planted to grow pumpkins. + Can be planted to grow pumpkins. - Can be planted to grow melons. + Can be planted to grow melons. - Dropped by Enderman when they die. When thrown, the player will be teleported to the position the Ender Pearl lands at, and will lose some health. + Dropped by Enderman when they die. When thrown, the player will be teleported to the position the Ender Pearl lands at, and will lose some health. - A block of dirt with grass growing on top. Collected using a shovel. Can be used for construction. + A block of dirt with grass growing on top. Collected using a shovel. Can be used for construction. - Can be used for construction and decoration. + Can be used for construction and decoration. - Slows movement when walking through it. Can be destroyed using shears to collect string. + Slows movement when walking through it. Can be destroyed using shears to collect string. - Spawns a Silverfish when destroyed. May also spawn Silverfish if nearby to another Silverfish being attacked. + Spawns a Silverfish when destroyed. May also spawn Silverfish if nearby to another Silverfish being attacked. - Grows over time when placed. Can be collected using shears. Can be climbed like a ladder. + Grows over time when placed. Can be collected using shears. Can be climbed like a ladder. - Slippery when walked on. Turns into water if above another block when destroyed. Melts if close enough to a light source or when placed in The Nether. + Slippery when walked on. Turns into water if above another block when destroyed. Melts if close enough to a light source or when placed in The Nether. - Can be used as decoration. + Can be used as decoration. - Used in potion brewing, and for locating Strongholds. Dropped by Blazes who tend to be found near or in Nether Fortresses. + Used in potion brewing, and for locating Strongholds. Dropped by Blazes who tend to be found near or in Nether Fortresses. - Used in potion brewing. Dropped by Ghasts when they die. + Used in potion brewing. Dropped by Ghasts when they die. - Dropped by Zombie Pigmen when they die. Zombie Pigmen can be found in the Nether. Used as an ingredient for brewing potions. + Dropped by Zombie Pigmen when they die. Zombie Pigmen can be found in the Nether. Used as an ingredient for brewing potions. - Used in potion brewing. This can be found naturally growing in Nether Fortresses. It can also be planted on Soul Sand. + Used in potion brewing. This can be found naturally growing in Nether Fortresses. It can also be planted on Soul Sand. - When used, can have various effects, depending on what it is used on. + When used, can have various effects, depending on what it is used on. - Can be filled with water, and used as the starting ingredient for a potion in the Brewing Stand. + Can be filled with water, and used as the starting ingredient for a potion in the Brewing Stand. - This is a poisonous food and brewing item. Dropped when a Spider or Cave Spider is killed by a player. + This is a poisonous food and brewing item. Dropped when a Spider or Cave Spider is killed by a player. - Used in potion brewing, mainly to create potions with a negative effect. + Used in potion brewing, mainly to create potions with a negative effect. - Used in potion brewing, or crafted with other items to make Eye of Ender or Magma Cream. + Used in potion brewing, or crafted with other items to make Eye of Ender or Magma Cream. - Used in potion brewing. + Used in potion brewing. - Used for making Potions and Splash Potions. + Used for making Potions and Splash Potions. - Filled with water by rain or with a bucket of water, and can then be used to fill Glass Bottles with water. + Filled with water by rain or with a bucket of water, and can then be used to fill Glass Bottles with water. - When thrown, will show the direction to an End Portal. When twelve of these are placed in the End Portal Frames, the End Portal will be activated. + When thrown, will show the direction to an End Portal. When twelve of these are placed in the End Portal Frames, the End Portal will be activated. - Used in potion brewing. + Used in potion brewing. - Similar to Grass Blocks, but very good for growing mushrooms on. + Similar to Grass Blocks, but very good for growing mushrooms on. - Floats on water, and can be walked on. + Floats on water, and can be walked on. - Used to build Nether Fortresses. Immune to Ghast's fireballs. + Used to build Nether Fortresses. Immune to Ghast's fireballs. - Used in Nether Fortresses. + Used in Nether Fortresses. - Found in Nether Fortresses, and will drop Nether Wart when broken. + Found in Nether Fortresses, and will drop Nether Wart when broken. - This allows players to enchant Swords, Pickaxes, Axes, Shovels, Bows and Armor, using the player's Experience Points. + This allows players to enchant Swords, Pickaxes, Axes, Shovels, Bows and Armor, using the player's Experience Points. - This can be activated using twelve Eye of Ender, and will allow the player to travel to The End dimension. + This can be activated using twelve Eye of Ender, and will allow the player to travel to The End dimension. - Used to form an End Portal. + Used to form an End Portal. - A block type found in The End. It has a very high blast resistance, so is useful for building with. + A block type found in The End. It has a very high blast resistance, so is useful for building with. - This block is created by the defeat of the Dragon in The End. + This block is created by the defeat of the Dragon in The End. - When thrown, it drops Experience Orbs which increase your experience points when collected. + When thrown, it drops Experience Orbs which increase your experience points when collected. - Useful for setting things on fire, or for indiscriminately starting fires when fired from a Dispenser. + Useful for setting things on fire, or for indiscriminately starting fires when fired from a Dispenser. - These are similar to a display case, and will display the item or block placed in it. + These are similar to a display case, and will display the item or block placed in it. - When thrown can spawn a creature of the type indicated. + When thrown can spawn a creature of the type indicated. - - Used for making long staircases. Two slabs placed on top of each other will create a normal-sized double slab block. + + Used for making long staircases. Two slabs placed on top of each other will create a normal-sized double slab block. - - Used for making long staircases. Two slabs placed on top of each other will create a normal-sized double slab block. + + Used for making long staircases. Two slabs placed on top of each other will create a normal-sized double slab block. - - Created by smelting Netherrack in a furnace. Can be crafted into Nether Brick blocks. + + Created by smelting Netherrack in a furnace. Can be crafted into Nether Brick blocks. - - When powered they emit light. + + When powered they emit light. - - Can be farmed to collect Cocoa Beans. + + Can be farmed to collect Cocoa Beans. - Mob Heads can be placed as a decoration, or worn as a mask in the helmet slot. - - - Squid - - - Drops ink sacs when killed. - - - Cow - - - Drops leather when killed. Can also be milked with a bucket. - - - Sheep - - - Drops wool when sheared (if it has not already been sheared). Can be dyed to make its wool a different color. - - - Chicken - - - Drops feathers when killed, and also randomly lays eggs. - - - Pig - - - Drops porkchops when killed. Can be ridden by using a saddle. - - - Wolf - - - Docile until attacked, when they will attack you back. Can be tamed using bones which causes the wolf to follow you around and attack anything that attacks you. - - - Creeper - - - Explodes if you get too close! - - - Skeleton - - - Fires arrows at you. Drops arrows when killed. - - - Spider - - - Attacks you when you are close to it. Can climb walls. Drops string when killed. - - - Zombie - - - Attacks you when you are close to it. - - - Zombie Pigman - - - Initially docile, but will attack in groups if you attack one. - - - Ghast - - - Fires flaming balls at you that explode on contact. - - - Slime - - - Split into smaller Slimes when damaged. - - - Enderman - - - Will attack you if you look at it. Can also move blocks around. - - - Silverfish - - - Attracts nearby hidden Silverfish when attacked. Hides in stone blocks. - - - Cave Spider - - - Has a venomous bite. - - - Mooshroom - - - Makes mushroom stew when used with a bowl. Drops mushrooms and becomes a normal cow when sheared. - - - Snow Golem - - - The Snow Golem can be created by players using snow blocks and a pumpkin. They will throw snowballs at their creators enemies. - - - Ender Dragon - - - This is a large black dragon found in The End. - - - Blaze - - - These are enemies found in the Nether, mostly inside Nether Fortresses. They will drop Blaze Rods when killed. - - - Magma Cube - - - These can be found in The Nether. Similar to Slimes, they will break up into smaller versions when killed. - - - Villager + Mob Heads can be placed as a decoration, or worn as a mask in the helmet slot. + + Used to execute commands. + + + Projects a beam of light into the sky and can provide Status Effects to nearby players. + + + Stores blocks and items inside. Place two chest side by side to create a larger chest with double capacity. The trapped chest also creates a Redstone charge when opened. + + + Provides a Redstone charge. The charge will be stronger if more items are on the plate. + + + Provides a Redstone charge. The charge will be stronger if more items are on the plate. Requires more weight than the light plate. + + + Used as a redstone power source. Can be crafted back into Redstone. + + + Used to catch items or to transfer items into and out of containers. + + + A type of rail that can enable or disable Minecarts with Hoppers and trigger Minecarts with TNT. + + + Used to hold and drop items, or push items into another container, when given a Redstone charge. + + + Colorful blocks crafted by dyeing Hardened clay. + + + Can be fed to Horses, Donkeys or Mules to heal up to 10 Hearts. Speeds up the growth of foals. + + + Created by smelting Clay in a furnace. + + + Crafted from glass and a dye. + + + Crafted from Stained Glass + + + A compact way of storing Coal. Can be used as fuel in a Furnace. + + + + Squid + + + Drops ink sacs when killed. + + + Cow + + + Drops leather when killed. Can also be milked with a bucket. + + + Sheep + + + Drops wool when sheared (if it has not already been sheared). Can be dyed to make its wool a different color. + + + Chicken + + + Drops feathers when killed, and also randomly lays eggs. + + + Pig + + + Drops porkchops when killed. Can be ridden by using a saddle. + + + Wolf + + + Docile until attacked, when they will attack you back. Can be tamed using bones which causes the wolf to follow you around and attack anything that attacks you. + + + Creeper + + + Explodes if you get too close! + + + Skeleton + + + Fires arrows at you. Drops arrows when killed. + + + Spider + + + Attacks you when you are close to it. Can climb walls. Drops string when killed. + + + Zombie + + + Attacks you when you are close to it. + + + Zombie Pigman + + + Initially docile, but will attack in groups if you attack one. + + + Ghast + + + Fires flaming balls at you that explode on contact. + + + Slime + + + Split into smaller Slimes when damaged. + + + Enderman + + + Will attack you if you look at it. Can also move blocks around. + + + Silverfish + + + Attracts nearby hidden Silverfish when attacked. Hides in stone blocks. + + + Cave Spider + + + Has a venomous bite. + + + Mooshroom + + + Makes mushroom stew when used with a bowl. Drops mushrooms and becomes a normal cow when sheared. + + + Snow Golem + + + The Snow Golem can be created by players using snow blocks and a pumpkin. They will throw snowballs at their creators enemies. + + + Ender Dragon + + + This is a large black dragon found in The End. + + + Blaze + + + These are enemies found in the Nether, mostly inside Nether Fortresses. They will drop Blaze Rods when killed. + + + Magma Cube + + + These can be found in The Nether. Similar to Slimes, they will break up into smaller versions when killed. + + + Villager + - - Ocelot - - - These can be found in Jungles. They can be tamed by feeding them Raw Fish. You will need to let the Ocelot approach you though, since any sudden movements will scare it away. - - - Iron Golem - - - Appear in Villages to protect them, and can be created using Iron Blocks and Pumpkins. - + + Ocelot + + + These can be found in Jungles. They can be tamed by feeding them Raw Fish. You will need to let the Ocelot approach you though, since any sudden movements will scare it away. + + + Iron Golem + + + Appear in Villages to protect them, and can be created using Iron Blocks and Pumpkins. + + + + Bat + + + These flying creatures are found in caverns or other large enclosed spaces. + + + Witch + + + These enemies can be found in swamps and attack you by throwing Potions. They drop Potions when killed. + + + Horse + + + These animals can be tamed and can then be ridden. + + + Donkey + + + These animals can be tamed and can then be ridden. They can have a chest attached. + + + Mule + + + Born when a Horse and a Donkey breed. These animals can be tamed and can then be ridden and carry chests. + + + Zombie Horse + + + Skeleton Horse + + + Wither + + + These are crafted from Wither Skulls and Soul Sand. They fire exploding skulls at you. +  @@ -2006,6 +2208,9 @@ Can also be used for low-level lighting. Map + + Empty Map + Music Disc - "13" @@ -2159,6 +2364,42 @@ Can also be used for low-level lighting. Creeper Head + + Nether Star + + + Firework Rocket + + + Firework Star + + + Redstone Comparator + + + Minecart with TNT + + + Minecart with Hopper + + + Iron Horse Armor + + + Gold Horse Armor + + + Diamond Horse Armor + + + Lead + + + Name Tag + + + + Stone @@ -2183,6 +2424,9 @@ Can also be used for low-level lighting. Jungle Wood Planks + + Wood Planks (any type) + Sapling @@ -2333,17 +2577,13 @@ Can also be used for low-level lighting. Block of Gold - A compact way of storing Gold. - A compact way of storing Iron. - - - + Block of Iron @@ -2382,7 +2622,6 @@ Can also be used for low-level lighting. Nether Brick Slab - Bricks @@ -2401,7 +2640,6 @@ Can also be used for low-level lighting. Torch - Torch (Coal) @@ -2429,11 +2667,9 @@ Can also be used for low-level lighting. Block of Diamond - A compact way of storing Diamonds. - Crafting Table @@ -2530,11 +2766,9 @@ Can also be used for low-level lighting. Lapis Lazuli Block - A compact way of storing Lapis Lazuli. - Dispenser @@ -2697,7 +2931,291 @@ Can also be used for low-level lighting. Skull - + + + + Command Block + + + Beacon + + + Trapped Chest + + + Weighted Pressure Plate (Light) + + + Weighted Pressure Plate (Heavy) + + + Redstone Comparator + + + Daylight Sensor + + + Block of Redstone + + + Hopper + + + Activator Rail + + + Dropper + + + Stained Clay + + + Hay Bale + + + Hardened Clay + + + Block of Coal + + + + Black Stained Clay + + + Red Stained Clay + + + Green Stained Clay + + + Brown Stained Clay + + + Blue Stained Clay + + + Purple Stained Clay + + + Cyan Stained Clay + + + Light Gray Stained Clay + + + Gray Stained Clay + + + Pink Stained Clay + + + Lime Stained Clay + + + Yellow Stained Clay + + + Light Blue Stained Clay + + + Magenta Stained Clay + + + Orange Stained Clay + + + White Stained Clay + + + + Stained Glass + + + Black Stained Glass + + + Red Stained Glass + + + Green Stained Glass + + + Brown Stained Glass + + + Blue Stained Glass + + + Purple Stained Glass + + + Cyan Stained Glass + + + Light Gray Stained Glass + + + Gray Stained Glass + + + Pink Stained Glass + + + Lime Stained Glass + + + Yellow Stained Glass + + + Light Blue Stained Glass + + + Magenta Stained Glass + + + Orange Stained Glass + + + White Stained Glass + + + + Stained Glass Pane + + + Black Stained Glass Pane + + + Red Stained Glass Pane + + + Green Stained Glass Pane + + + Brown Stained Glass Pane + + + Blue Stained Glass Pane + + + Purple Stained Glass Pane + + + Cyan Stained Glass Pane + + + Light Gray Stained Glass Pane + + + Gray Stained Glass Pane + + + Pink Stained Glass Pane + + + Lime Stained Glass Pane + + + Yellow Stained Glass Pane + + + Light Blue Stained Glass Pane + + + Magenta Stained Glass Pane + + + Orange Stained Glass Pane + + + White Stained Glass Pane + + + + + Small Ball + + + Large Ball + + + Star-shaped + + + Creeper-shaped + + + Burst + + + Unknown Shape + + + + Black + + + Red + + + Green + + + Brown + + + Blue + + + Purple + + + Cyan + + + Light Gray + + + Gray + + + Pink + + + Lime + + + Yellow + + + Light Blue + + + Magenta + + + Orange + + + White + + + Custom + + + + Fade to + + + Twinkle + + + Trail + + + Flight Duration: +  Current Controls @@ -2829,7 +3347,7 @@ Can also be used for low-level lighting. {*B*}Press{*CONTROLLER_VK_A*} to start the tutorial.{*B*} - Press{*CONTROLLER_VK_B*} if you think you are ready to play on your own. +Press{*CONTROLLER_VK_B*} if you think you are ready to play on your own. @@ -2859,7 +3377,7 @@ At night monsters come out, make sure to build a shelter before that happens. As you collect and craft more items, your inventory will fill up.{*B*} - Press{*CONTROLLER_ACTION_INVENTORY*} to open the inventory. +Press{*CONTROLLER_ACTION_INVENTORY*} to open the inventory. As you move around, mine and attack, you will deplete your food bar{*ICON_SHANK_01*}. Sprinting and sprint jumping use a lot more food than walking and jumping normally. @@ -2907,19 +3425,13 @@ At night monsters come out, make sure to build a shelter before that happens.Open the container - - Night time can approach quickly, and it is dangerous to be outside unprepared. You can craft armor and weapons, but it is sensible to have a safe shelter. - + Night time can approach quickly, and it is dangerous to be outside unprepared. You can craft armor and weapons, but it is sensible to have a safe shelter. - - Nearby there is an abandoned Miner's shelter that you can complete to be safe overnight. - + Nearby there is an abandoned Miner's shelter that you can complete to be safe overnight. - - You will need to collect the resources to complete the shelter. Walls and roof can be made of any tile type, but you will want to create a door, some windows and lighting. - + You will need to collect the resources to complete the shelter. Walls and roof can be made of any tile type, but you will want to create a door, some windows and lighting. Use your pickaxe to mine some stone blocks. Stone blocks will produce cobblestone when mined. If you collect 8 cobblestone blocks you can build a furnace. You may need to dig through some dirt to reach the stone, so use your shovel for this.{*StoneIcon*} @@ -2946,607 +3458,395 @@ At night monsters come out, make sure to build a shelter before that happens.It can get very dark at night, so you will want some lighting inside your shelter so that you can see. Craft a torch now from sticks and charcoal using the crafting interface.{*TorchIcon*} - - You have completed the first part of the tutorial. - + You have completed the first part of the tutorial. - - {*B*} - Press{*CONTROLLER_VK_A*} to continue with the tutorial.{*B*} - Press{*CONTROLLER_VK_B*} if you think you are ready to play on your own. - + {*B*} +Press{*CONTROLLER_VK_A*} to continue with the tutorial.{*B*} +Press{*CONTROLLER_VK_B*} if you think you are ready to play on your own. - - This is your inventory. It shows items available for use in your hand, and all the other items that you are carrying. Your armor is also shown here. - - + This is your inventory. It shows items available for use in your hand, and all the other items that you are carrying. Your armor is also shown here. {*B*} - Press{*CONTROLLER_VK_A*} to continue.{*B*} - Press{*CONTROLLER_VK_B*} if you already know how to use the inventory. - +Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to use the inventory. - - Use{*CONTROLLER_MENU_NAVIGATE*} to move the pointer. Use{*CONTROLLER_VK_A*} to pick an item under the pointer. - If there is more than one item here this will pick them all up, or you can use{*CONTROLLER_VK_X*} to pick up just half of them. - + Use{*CONTROLLER_MENU_NAVIGATE*} to move the pointer. Use{*CONTROLLER_VK_A*} to pick an item under the pointer. +If there is more than one item here this will pick them all up, or you can use{*CONTROLLER_VK_X*} to pick up just half of them. - - Move this item with the pointer over another space in the inventory and place it down using{*CONTROLLER_VK_A*}. - With multiple items on the pointer, use{*CONTROLLER_VK_A*} to place them all, or{*CONTROLLER_VK_X*} to place just one. - + Move this item with the pointer over another space in the inventory and place it down using{*CONTROLLER_VK_A*}. +With multiple items on the pointer, use{*CONTROLLER_VK_A*} to place them all, or{*CONTROLLER_VK_X*} to place just one. - - If you move the pointer outside the edge of the interface with an item on the pointer, you can drop the item. - + If you move the pointer outside the edge of the interface with an item on the pointer, you can drop the item. - - If you want more information about an item, move the pointer over the item and press{*CONTROLLER_VK_RT*} . - + If you want more information about an item, move the pointer over the item and press{*CONTROLLER_ACTION_MENU_PAGEDOWN*} . - - Press{*CONTROLLER_VK_B*} now to exit the inventory. - + Press{*CONTROLLER_VK_B*} now to exit the inventory. - - This is the creative mode inventory. It shows items available for use in your hand, and all the other items that you can choose from. - + This is the creative mode inventory. It shows items available for use in your hand, and all the other items that you can choose from. {*B*} - Press{*CONTROLLER_VK_A*} to continue.{*B*} - Press{*CONTROLLER_VK_B*} if you already know how to use the creative mode inventory. - +Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to use the creative mode inventory. - - Use{*CONTROLLER_MENU_NAVIGATE*} to move the pointer. - When on the item list, use{*CONTROLLER_VK_A*} to pick an item under the pointer, and use{*CONTROLLER_VK_Y*} to pick up a full stack of that item. - + Use{*CONTROLLER_MENU_NAVIGATE*} to move the pointer. +When on the item list, use{*CONTROLLER_VK_A*} to pick an item under the pointer, and use{*CONTROLLER_VK_Y*} to pick up a full stack of that item. - - The pointer will automatically move over a space in the use row. You can place it down using{*CONTROLLER_VK_A*}. Once you have placed the item, the pointer will return to the item list where you can select another item. - + The pointer will automatically move over a space in the use row. You can place it down using{*CONTROLLER_VK_A*}. Once you have placed the item, the pointer will return to the item list where you can select another item. - - If you move the pointer outside the edge of the interface with an item on the pointer, you can drop the item into the world. To clear all items in the quick select bar, press{*CONTROLLER_VK_X*}. - + If you move the pointer outside the edge of the interface with an item on the pointer, you can drop the item into the world. To clear all items in the quick select bar, press{*CONTROLLER_VK_X*}. - - Scroll through the Group Type tabs at the top using{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to select the group type of the item you wish to pickup. - + Scroll through the Group Type tabs at the top using{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to select the group type of the item you wish to pickup. - - If you want more information about an item, move the pointer over the item and press{*CONTROLLER_VK_RT*} . - + If you want more information about an item, move the pointer over the item and press{*CONTROLLER_ACTION_MENU_PAGEDOWN*} . - - Press{*CONTROLLER_VK_B*} now to exit the creative mode inventory. - + Press{*CONTROLLER_VK_B*} now to exit the creative mode inventory. - - This is the crafting interface. This interface allows you to combine the items you've collected to make new items. - + This is the crafting interface. This interface allows you to combine the items you've collected to make new items. - {*B*} - Press{*CONTROLLER_VK_A*} to continue.{*B*} - Press{*CONTROLLER_VK_B*} if you already know how to craft. - + {*B*}Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to craft. {*B*} - Press{*CONTROLLER_VK_X*} to show the item description. - +Press{*CONTROLLER_VK_X*} to show the item description. {*B*} - Press{*CONTROLLER_VK_X*} to show the ingredients required to make the current item. - +Press{*CONTROLLER_VK_X*} to show the ingredients required to make the current item. {*B*} - Press{*CONTROLLER_VK_X*} to show the inventory again. - +Press{*CONTROLLER_VK_X*} to show the inventory again. - - Scroll through the Group Type tabs at the top using{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to select the group type of the item you wish to craft, then use{*CONTROLLER_MENU_NAVIGATE*} to select the item to craft. - + Scroll through the Group Type tabs at the top using{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to select the group type of the item you wish to craft, then use{*CONTROLLER_MENU_NAVIGATE*} to select the item to craft. - - The crafting area shows the items you require in order to craft the new item. Press{*CONTROLLER_VK_A*} to craft the item and place it in your inventory. - + The crafting area shows the items you require in order to craft the new item. Press{*CONTROLLER_VK_A*} to craft the item and place it in your inventory. - - You can craft a larger selection of items using a crafting table. Crafting on a table works in the same way as basic crafting, but you have a larger crafting area allowing more combinations of ingredients. - + You can craft a larger selection of items using a crafting table. Crafting on a table works in the same way as basic crafting, but you have a larger crafting area allowing more combinations of ingredients. - - The bottom right part of the crafting interface shows your inventory. This area can also show a description of the currently selected item, and the ingredients required to craft it. - + The bottom right part of the crafting interface shows your inventory. This area can also show a description of the currently selected item, and the ingredients required to craft it. - - The description of the currently selected item is now displayed. The description can give you an idea of what the item can be used for. - + The description of the currently selected item is now displayed. The description can give you an idea of what the item can be used for. - - The list of ingredients required to craft the selected item are now displayed. - + The list of ingredients required to craft the selected item are now displayed. The wood that you have collected can be crafted into planks. Select the planks icon and press{*CONTROLLER_VK_A*} to create them.{*PlanksIcon*} - - Now you have built a crafting table you should place it in the world to enable you to build a larger selection of items.{*B*} - Press{*CONTROLLER_VK_B*} now to exit the crafting interface. - + Now you have built a crafting table you should place it in the world to enable you to build a larger selection of items.{*B*} +Press{*CONTROLLER_VK_B*} now to exit the crafting interface. - - Press{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to change to the group type of the items you wish to craft. Select the tools group.{*ToolsIcon*} - + Press{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to change to the group type of the items you wish to craft. Select the tools group.{*ToolsIcon*} - - Press{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to change to the group type of the items you wish to craft. Select the structures group.{*StructuresIcon*} - + Press{*CONTROLLER_VK_LB*} and{*CONTROLLER_VK_RB*} to change to the group type of the items you wish to craft. Select the structures group.{*StructuresIcon*} - - Use{*CONTROLLER_MENU_NAVIGATE*} to change to the item you wish to craft. Some items have multiple versions depending on the materials used. Select the wooden shovel.{*WoodenShovelIcon*} - + Use{*CONTROLLER_MENU_NAVIGATE*} to change to the item you wish to craft. Some items have multiple versions depending on the materials used. Select the wooden shovel.{*WoodenShovelIcon*} - - A lot of crafting can involve multiple steps. Now that you have some planks there are more items that you can craft. Use{*CONTROLLER_MENU_NAVIGATE*} to change to the item you wish to craft. Select the crafting table.{*CraftingTableIcon*} - + A lot of crafting can involve multiple steps. Now that you have some planks there are more items that you can craft. Use{*CONTROLLER_MENU_NAVIGATE*} to change to the item you wish to craft. Select the crafting table.{*CraftingTableIcon*} - - With the tools you have built you are off to a great start, and are able to collect a variety of different materials more efficiently.{*B*} - Press{*CONTROLLER_VK_B*} now to exit the crafting interface. - + With the tools you have built you are off to a great start, and are able to collect a variety of different materials more efficiently.{*B*} +Press{*CONTROLLER_VK_B*} now to exit the crafting interface. - - Some items can not be created using the crafting table, but require a furnace. Craft a furnace now.{*FurnaceIcon*} - + Some items can not be created using the crafting table, but require a furnace. Craft a furnace now.{*FurnaceIcon*} - - Place the furnace you have crafted in the world. You will want to put this inside your shelter.{*B*} - Press{*CONTROLLER_VK_B*} now to exit the crafting interface. - + Place the furnace you have crafted in the world. You will want to put this inside your shelter.{*B*} +Press{*CONTROLLER_VK_B*} now to exit the crafting interface. - - This is the furnace interface. A furnace allows you to change items by firing them. For example, you can turn iron ore into iron ingots in the furnace. - + This is the furnace interface. A furnace allows you to change items by firing them. For example, you can turn iron ore into iron ingots in the furnace. {*B*} - Press{*CONTROLLER_VK_A*} to continue.{*B*} - Press{*CONTROLLER_VK_B*} if you already know how to use a furnace. - +Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to use a furnace. - - You need to put some fuel into the bottom slot of the furnace, and the item to be changed in the top slot. The furnace will then fire up and start working, putting the result in the right-hand slot. - + You need to put some fuel into the bottom slot of the furnace, and the item to be changed in the top slot. The furnace will then fire up and start working, putting the result in the right-hand slot. - - Many wooden items can be used as fuels, but not everything burns for the same time. You may also discover other items in the world that can be used as a fuel. - + Many wooden items can be used as fuels, but not everything burns for the same time. You may also discover other items in the world that can be used as a fuel. - - When your items have been fired, you can move them from the output area into your inventory. You should experiment with different ingredients to see what you can make. - + When your items have been fired, you can move them from the output area into your inventory. You should experiment with different ingredients to see what you can make. - - If you use wood as the ingredient then you can make charcoal. Put some fuel in the furnace and wood in the ingredient slot. It can take some time for the furnace to create the charcoal, so feel free to do something else and come back to check the progress. - + If you use wood as the ingredient then you can make charcoal. Put some fuel in the furnace and wood in the ingredient slot. It can take some time for the furnace to create the charcoal, so feel free to do something else and come back to check the progress. - - Charcoal can be used as a fuel, as well as being crafted into a torch with a stick. - + Charcoal can be used as a fuel, as well as being crafted into a torch with a stick. - - Placing sand in the ingredient slot allows you to make glass. Create some glass blocks to use as windows in your shelter. - + Placing sand in the ingredient slot allows you to make glass. Create some glass blocks to use as windows in your shelter. - - This is the brewing interface. You can use this to create potions that have a variety of different effects. - + This is the brewing interface. You can use this to create potions that have a variety of different effects. {*B*} - Press{*CONTROLLER_VK_A*} to continue.{*B*} - Press{*CONTROLLER_VK_B*} if you already know how to use the brewing stand. - +Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to use the brewing stand. - - You brew potions by placing an ingredient in the top slot, and a potion or water bottle in the bottom slots (up to 3 can be brewed at one time). Once a valid combination is entered the brewing process will start and create the potion after a short time. - + You brew potions by placing an ingredient in the top slot, and a potion or water bottle in the bottom slots (up to 3 can be brewed at one time). Once a valid combination is entered the brewing process will start and create the potion after a short time. - - All potions start with a Water Bottle. Most potions are created by first using a Nether Wart to make an Awkward Potion, and will require at least one more ingredient to make the final potion. - + All potions start with a Water Bottle. Most potions are created by first using a Nether Wart to make an Awkward Potion, and will require at least one more ingredient to make the final potion. - - Once you have a potion you can modify its effects. Adding Redstone Dust increases the duration of its effect and adding Glowstone Dust can make its effect more powerful. - + Once you have a potion you can modify its effects. Adding Redstone Dust increases the duration of its effect and adding Glowstone Dust can make its effect more powerful. - - Adding Fermented Spider Eye corrupts the potion and can turn it into a potion with the opposite effect, and adding Gunpowder turns the potion into a Splash Potion which can be thrown to apply its affect to a nearby area. - + Adding Fermented Spider Eye corrupts the potion and can turn it into a potion with the opposite effect, and adding Gunpowder turns the potion into a Splash Potion which can be thrown to apply its affect to a nearby area. - - Create a Potion of Fire Resistance by first adding Nether Wart to a Water Bottle, and then adding Magma Cream. - + Create a Potion of Fire Resistance by first adding Nether Wart to a Water Bottle, and then adding Magma Cream. - - Press{*CONTROLLER_VK_B*} now to exit the brewing interface. - + Press{*CONTROLLER_VK_B*} now to exit the brewing interface. - - In this area there is a Brewing Stand, a Cauldron and a chest full of items for brewing. - + In this area there is a Brewing Stand, a Cauldron and a chest full of items for brewing. {*B*} - Press{*CONTROLLER_VK_A*} to learn more about brewing and potions.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about brewing and potions. - +Press{*CONTROLLER_VK_A*} to learn more about brewing and potions.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about brewing and potions. - - The first step in brewing a potion is to create a Water Bottle. Take a Glass Bottle from the chest. - + The first step in brewing a potion is to create a Water Bottle. Take a Glass Bottle from the chest. - - You can fill a glass bottle from a Cauldron that has water in it, or from a block of water. Fill your glass bottle now by pointing at a water source and pressing{*CONTROLLER_ACTION_USE*}. - + You can fill a glass bottle from a Cauldron that has water in it, or from a block of water. Fill your glass bottle now by pointing at a water source and pressing{*CONTROLLER_ACTION_USE*}. - - If a cauldron becomes empty, you can refill it with a Water Bucket. - + If a cauldron becomes empty, you can refill it with a Water Bucket. - - Use the Brewing Stand to create a Potion of Fire Resistance. You will need a Water Bottle, Nether Wart and Magma Cream. - + Use the Brewing Stand to create a Potion of Fire Resistance. You will need a Water Bottle, Nether Wart and Magma Cream. - - With a potion in your hand, hold{*CONTROLLER_ACTION_USE*} to use it. For a normal potion you will drink it and apply the effect to yourself, and for a Splash potion you will throw it and apply the effect to creatures near where it hits. - Splash potions can be created by adding gunpowder to normal potions. - + With a potion in your hand, hold{*CONTROLLER_ACTION_USE*} to use it. For a normal potion you will drink it and apply the effect to yourself, and for a Splash potion you will throw it and apply the effect to creatures near where it hits. +Splash potions can be created by adding gunpowder to normal potions. - - Use your Potion of Fire Resistance on yourself. - + Use your Potion of Fire Resistance on yourself. - - Now that you are resistant to fire and lava, you should see if there are places you can get to that you couldn't before. - + Now that you are resistant to fire and lava, you should see if there are places you can get to that you couldn't before. - - This is the enchanting interface which you can use to add enchantments to weapons, armor and some tools. - + This is the enchanting interface which you can use to add enchantments to weapons, armor and some tools. {*B*} - Press{*CONTROLLER_VK_A*} to learn more about the enchanting interface.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about the enchanting interface. - +Press{*CONTROLLER_VK_A*} to learn more about the enchanting interface.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about the enchanting interface. - - To enchant an item, first place it in the enchanting slot. Weapons, armor and some tools can be enchanted to add special effects such as improved damage resistance or increasing the number of items produced when mining a block. - + To enchant an item, first place it in the enchanting slot. Weapons, armor and some tools can be enchanted to add special effects such as improved damage resistance or increasing the number of items produced when mining a block. - - When an item is placed in the enchanting slot, the buttons on the right will change to show a selection of random enchantments. - + When an item is placed in the enchanting slot, the buttons on the right will change to show a selection of random enchantments. - - The number on the button represents the cost in experience levels to apply that enchantment to the item. If you do not have a high enough level the button will be disabled. - + The number on the button represents the cost in experience levels to apply that enchantment to the item. If you do not have a high enough level the button will be disabled. - - Select an enchantment and press{*CONTROLLER_VK_A*} to enchant the item. This will decrease your experience level by the cost of the enchantment. - + Select an enchantment and press{*CONTROLLER_VK_A*} to enchant the item. This will decrease your experience level by the cost of the enchantment. - - Although the enchantments are all random, some of the better enchantments are only available when you have a high experience level and have lots of bookcases around the Enchantment Table to increase its power. - + Although the enchantments are all random, some of the better enchantments are only available when you have a high experience level and have lots of bookcases around the Enchantment Table to increase its power. - - In this area there is an Enchantment Table and some other items to help you learn about enchanting. - + In this area there is an Enchantment Table and some other items to help you learn about enchanting. {*B*} - Press{*CONTROLLER_VK_A*} to learn more about enchanting.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about enchanting. - +Press{*CONTROLLER_VK_A*} to learn more about enchanting.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about enchanting. - - Using an Enchantment Table allows you to add special effects such as increasing the number of items produced when mining a block, or improved damage resistance for weapons, armor and some tools. - + Using an Enchantment Table allows you to add special effects such as increasing the number of items produced when mining a block, or improved damage resistance for weapons, armor and some tools. - - Placing bookcases around the Enchantment Table increases its power and allows access to higher level enchantments. - + Placing bookcases around the Enchantment Table increases its power and allows access to higher level enchantments. - - Enchanting items costs Experience Levels, which can be built up by collecting Experience Orbs which are produced by killing monsters and animals, mining ores, breeding animals, fishing and smelting/cooking some things in a furnace. - + Enchanting items costs Experience Levels, which can be built up by collecting Experience Orbs which are produced by killing monsters and animals, mining ores, breeding animals, fishing and smelting/cooking some things in a furnace. - - You can also build experience levels using a Bottle O' Enchanting, which, when thrown, creates Experience Orbs around where it lands. These orbs can then be collected. - + You can also build experience levels using a Bottle O' Enchanting, which, when thrown, creates Experience Orbs around where it lands. These orbs can then be collected. - - In the chests in this area you can find some enchanted items, Bottles O' Enchanting, and some items that have yet to be enchanted for you to experiment with at the Enchantment Table. - + In the chests in this area you can find some enchanted items, Bottles O' Enchanting, and some items that have yet to be enchanted for you to experiment with at the Enchantment Table. - - You are now riding in a minecart. To exit the minecart, point the cursor at it and press{*CONTROLLER_ACTION_USE*} .{*MinecartIcon*} - + You are now riding in a minecart. To exit the minecart, point the cursor at it and press{*CONTROLLER_ACTION_USE*} .{*MinecartIcon*} {*B*} - Press{*CONTROLLER_VK_A*} to learn more about minecarts.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about minecarts. - +Press{*CONTROLLER_VK_A*} to learn more about minecarts.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about minecarts. - - A minecart runs on rails. You can also craft a powered minecart with a furnace and a minecart with a chest in it. - {*RailIcon*} - + A minecart runs on rails. You can also craft a powered minecart with a furnace and a minecart with a chest in it.{*RailIcon*} - - You can also craft powered rails, which take power from redstone torches and circuits to accelerate the cart. These can be connected to switches, levers and pressure plates to make complex systems. - {*PoweredRailIcon*} - + You can also craft powered rails, which take power from redstone torches and circuits to accelerate the cart. These can be connected to switches, levers and pressure plates to make complex systems.{*PoweredRailIcon*} - - You are now sailing a boat. To exit the boat, point the cursor at it and press{*CONTROLLER_ACTION_USE*} .{*BoatIcon*} - + You are now sailing a boat. To exit the boat, point the cursor at it and press{*CONTROLLER_ACTION_USE*} .{*BoatIcon*} - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about boats.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about boats. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about boats.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about boats. - - A boat allows you to travel quicker over water. You can steer it using{*CONTROLLER_ACTION_MOVE*} and{*CONTROLLER_ACTION_LOOK*}. - {*BoatIcon*} - + A boat allows you to travel quicker over water. You can steer it using{*CONTROLLER_ACTION_MOVE*} and{*CONTROLLER_ACTION_LOOK*}.{*BoatIcon*} - - You are now using a fishing rod. Press{*CONTROLLER_ACTION_USE*} to use it.{*FishingRodIcon*} - + You are now using a fishing rod. Press{*CONTROLLER_ACTION_USE*} to use it.{*FishingRodIcon*} - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about fishing.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about fishing. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about fishing.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about fishing. - - Press{*CONTROLLER_ACTION_USE*} to cast your line and start fishing. Press{*CONTROLLER_ACTION_USE*} again to reel in the fishing line. - {*FishingRodIcon*} - + Press{*CONTROLLER_ACTION_USE*} to cast your line and start fishing. Press{*CONTROLLER_ACTION_USE*} again to reel in the fishing line.{*FishingRodIcon*} - - If you wait until the float sinks below the surface of the water before reeling in you can catch a fish. Fish can be eaten raw, or cooked by a furnace, to restore health. - {*FishIcon*} - + If you wait until the float sinks below the surface of the water before reeling in you can catch a fish. Fish can be eaten raw, or cooked by a furnace, to restore health.{*FishIcon*} - - As with many other tools a fishing rod has a fixed number of uses. Those uses are not limited to catching fish though. You should experiment with it to see what else can be caught or activated... - {*FishingRodIcon*} - + As with many other tools a fishing rod has a fixed number of uses. Those uses are not limited to catching fish though. You should experiment with it to see what else can be caught or activated...{*FishingRodIcon*} - - This is a bed. Press{*CONTROLLER_ACTION_USE*} while pointing at it at night to sleep through the night and awake in the morning.{*ICON*}355{*/ICON*} - + This is a bed. Press{*CONTROLLER_ACTION_USE*} while pointing at it at night to sleep through the night and awake in the morning.{*ICON*}355{*/ICON*} - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about beds.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about beds. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about beds.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about beds. - - A bed should be placed in a safe, well-lit place so that monsters do not wake you in the middle of the night. Once you have used a bed, if you die you will respawn at that bed. - {*ICON*}355{*/ICON*} - + A bed should be placed in a safe, well-lit place so that monsters do not wake you in the middle of the night. Once you have used a bed, if you die you will respawn at that bed. +{*ICON*}355{*/ICON*} - - If there are other players in your game, everyone must be in a bed at the same time to be able to sleep. - {*ICON*}355{*/ICON*} - + If there are other players in your game, everyone must be in a bed at the same time to be able to sleep. +{*ICON*}355{*/ICON*} - - In this area there are some simple Redstone and Piston circuits, and a chest with more items to extend these circuits. - + In this area there are some simple Redstone and Piston circuits, and a chest with more items to extend these circuits. - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about Redstone circuits and Pistons.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about Redstone circuits and Pistons. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Redstone circuits and Pistons.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about Redstone circuits and Pistons. - - Levers, Buttons, Pressure Plates and Redstone Torches can all provide power to circuits, either by directly attaching them to the item you want to activate or by connecting them with Redstone dust. - + Levers, Buttons, Pressure Plates and Redstone Torches can all provide power to circuits, either by directly attaching them to the item you want to activate or by connecting them with Redstone dust. - - The position and direction that you place a power source can change how it affects the surrounding blocks. For example a Redstone torch on the side of a block can be turned off if the block is powered by another source. - + The position and direction that you place a power source can change how it affects the surrounding blocks. For example a Redstone torch on the side of a block can be turned off if the block is powered by another source. - - Redstone dust is collected by mining redstone ore with a pickaxe made of Iron, Diamond or Gold. You can use it to carry power up to 15 blocks, and it can travel up or down one block in height. - {*ICON*}331{*/ICON*} - + Redstone dust is collected by mining redstone ore with a pickaxe made of Iron, Diamond or Gold. You can use it to carry power up to 15 blocks, and it can travel up or down one block in height. +{*ICON*}331{*/ICON*} - - Redstone repeaters can be used to extend the distance that the power is carried, or put a delay in a circuit. - {*ICON*}356{*/ICON*} - + Redstone repeaters can be used to extend the distance that the power is carried, or put a delay in a circuit. +{*ICON*}356{*/ICON*} - - When powered, a Piston will extend, pushing up to 12 blocks. When they retract, Sticky Pistons can pull back one block of most types. - {*ICON*}33{*/ICON*} - + When powered, a Piston will extend, pushing up to 12 blocks. When they retract, Sticky Pistons can pull back one block of most types. +{*ICON*}33{*/ICON*} - - In the chest in this area there are some components for making circuits with pistons. Try using or completing the circuits in this area, or put together your own. There are more examples outside the tutorial area. - + In the chest in this area there are some components for making circuits with pistons. Try using or completing the circuits in this area, or put together your own. There are more examples outside the tutorial area. - - In this area there is a Portal to the Nether! - + In this area there is a Portal to the Nether! - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about Portals and The Nether.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about Portals and The Nether. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Portals and The Nether.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about Portals and The Nether. - - Portals are created by placing Obsidian blocks into a frame four blocks wide and five blocks tall. The corner blocks are not required. - + Portals are created by placing Obsidian blocks into a frame four blocks wide and five blocks tall. The corner blocks are not required. - - To activate a Nether Portal, set fire to the Obisidian blocks inside the frame with a Flint and Steel. Portals can be deactivated if their frame is broken, an explosion happens nearby or a liquid flows through them. - + To activate a Nether Portal, set fire to the Obsidian blocks inside the frame with a Flint and Steel. Portals can be deactivated if their frame is broken, an explosion happens nearby or a liquid flows through them. - - To use a Nether Portal, stand inside it. Your screen will go purple and a sound will play. After a few seconds you will be transported to another dimension. - + To use a Nether Portal, stand inside it. Your screen will go purple and a sound will play. After a few seconds you will be transported to another dimension. - - The Nether can be a dangerous place, full of lava, but can be useful to collect Netherrack which burns forever when lit, and Glowstone which produces light. - + The Nether can be a dangerous place, full of lava, but can be useful to collect Netherrack which burns forever when lit, and Glowstone which produces light. - - The Nether world can be used to fast-travel in the Overworld - traveling one block distance in the Nether is equivalent to traveling 3 blocks in the Overworld. - + The Nether world can be used to fast-travel in the Overworld - traveling one block distance in the Nether is equivalent to traveling 3 blocks in the Overworld. - - You are now in Creative mode. - + You are now in Creative mode. - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about Creative mode.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about Creative mode. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Creative mode.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about Creative mode. When in Creative mode you have in infinite number of all available items and blocks, you can destroy blocks with one click without a tool, you are invulnerable and you can fly. @@ -3566,16 +3866,12 @@ When in flying mode, you can hold down{*CONTROLLER_ACTION_JUMP*} to move up and{ - - In this area a farm has been set up. Farming enables you to create a renewable source of food and other items. - + In this area a farm has been set up. Farming enables you to create a renewable source of food and other items. - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about farming.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about farming. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about farming.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about farming. Wheat, Pumpkins and Melons are grown from seeds. Wheat seeds are collected by breaking Tall Grass or harvesting wheat, and Pumpkin and Melon seeds are crafted from Pumpkins and Melons respectively. @@ -3606,16 +3902,12 @@ When in flying mode, you can hold down{*CONTROLLER_ACTION_JUMP*} to move up and{ - - In this area animals have been penned in. You can breed animals to produce baby versions of themselves. - + In this area animals have been penned in. You can breed animals to produce baby versions of themselves. - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about animals and breeding.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about animals and breeding. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about animals and breeding.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about animals and breeding. To get the animals to breed, you will need to feed them with the right food to get them to go into 'Love Mode'. @@ -3634,9 +3926,7 @@ When in flying mode, you can hold down{*CONTROLLER_ACTION_JUMP*} to move up and{ - - Wild wolves can be tamed by giving them bones. Once tamed Love Hearts will appear around them. Tamed wolves will follow the player and defend them if they haven't been commanded to sit. - + Wild wolves can be tamed by giving them bones. Once tamed Love Hearts will appear around them. Tamed wolves will follow the player and defend them if they haven't been commanded to sit. @@ -3644,16 +3934,12 @@ When in flying mode, you can hold down{*CONTROLLER_ACTION_JUMP*} to move up and{ - - In this area are some pumpkins and blocks to make a Snow Golem and an Iron Golem. - + In this area are some pumpkins and blocks to make a Snow Golem and an Iron Golem. - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about Golems.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about Golems. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Golems.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about Golems. Golems are created by placing a pumpkin on top of a stack of blocks. @@ -3715,9 +4001,7 @@ When in flying mode, you can hold down{*CONTROLLER_ACTION_JUMP*} to move up and{ - - Congratulations, you have completed the tutorial. Time in the game is now passing normally, and you don't have long until night time and the monsters come out! Finish your shelter! - + Congratulations, you have completed the tutorial. Time in the game is now passing normally, and you don't have long until night time and the monsters come out! Finish your shelter! {*EXIT_PICTURE*} When you are ready to explore further, there is a stairway in this area near the Miner's shelter that leads to a small castle. @@ -3736,7 +4020,7 @@ When in flying mode, you can hold down{*CONTROLLER_ACTION_JUMP*} to move up and{ {*B*}Press{*CONTROLLER_VK_A*} to play through the tutorial as normal.{*B*} - Press{*CONTROLLER_VK_B*} to skip the main tutorial. +Press{*CONTROLLER_VK_B*} to skip the main tutorial. In this area you will find areas setup to help you learn about fishing, boats, pistons and redstone. @@ -3746,19 +4030,182 @@ When in flying mode, you can hold down{*CONTROLLER_ACTION_JUMP*} to move up and{ - - Your food bar has depleted to a level where you will no longer heal. - + Your food bar has depleted to a level where you will no longer heal. - - {*B*} - Press{*CONTROLLER_VK_A*} to learn more about the food bar and eating food.{*B*} - Press{*CONTROLLER_VK_B*} if you already know about the food bar and eating food. - + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about the food bar and eating food.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about the food bar and eating food. - + + This is the horse inventory interface. + + + {*B*}Press{*CONTROLLER_VK_A*} to continue. +{*B*}Press{*CONTROLLER_VK_B*} if you already know how to use the horse inventory. + + + The horse inventory allows you to transfer, or equip items to your Horse, Donkey or Mule. + + + Saddle your Horse by placing a Saddle in the saddle slot. Horses can be given armor by placing Horse Armor in the armor slot. + + + You can also transfer items between your own inventory and the saddlebags strapped to Donkeys and Mules in this menu. + + + You have found a Horse. + + + You have found a Donkey. + + + You have found a Mule. + + + {*B*}Press{*CONTROLLER_VK_A*} to learn more about Horses, Donkeys and Mules. +{*B*}Press{*CONTROLLER_VK_B*} if you already know about Horses, Donkeys and Mules. + + + Horses and Donkeys are found mainly in open plains. Mules can be bred from a Donkey and a Horse, but are infertile themselves. + + + All adult Horses, Donkeys and Mules can be ridden. However only Horses can be armored, and only Mules and Donkeys may be equipped with saddlebags for transporting items. + + + Horses, Donkeys and Mules must be tamed before they can be used. A horse is tamed by attempting to ride it, and managing to stay on the horse while it attempts to throw the rider off. + + + When tamed Love Hearts will appear around them and they will no longer buck the player off. + + + Try to ride this horse now. Use {*CONTROLLER_ACTION_USE*} with no items or tools in your hand to mount it. + + + To steer a horse they must then be equipped with a saddle, which can be bought from villagers or found inside chests hidden in the world. + + + Tame Donkeys and Mules can be given saddlebags by attaching a chest. These bags can be accessed whilst riding or when sneaking. + + + Horses and Donkeys (but not Mules) can be bred like other animals using Golden Apples or Golden Carrots. Foals will grow into adult horses over time, although feeding them wheat or hay will speed this up. + + + You can try to tame the Horses and Donkeys here, and there are Saddles, Horse Armor and other useful items for Horses in chests around here too. + + + This is the Beacon interface, which you can use to choose powers for your Beacon to grant. + + + {*B*} +Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to use the Beacon interface. + + + In the Beacon menu you can select 1 primary power for your Beacon. The more tiers your pyramid has the more powers you will have to choose from. + + + A Beacon on a pyramid with at least 4 tiers grants an additional option of either the Regeneration secondary power or a stronger primary power. + + + To set the powers of your Beacon you must sacrifice an Emerald, Diamond, Gold or Iron Ingot in the payment slot. Once set, the powers will emanate from the Beacon indefinitely. + + + At the top of this pyramid there is an inactivate Beacon. + + + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Beacons.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about Beacons. + + + Active Beacons project a bright beam of light into the sky and grant powers to nearby players. They are crafted with Glass, Obsidian and Nether Stars, which can be obtained by defeating the Wither. + + + Beacons must be placed so that they are in sunlight during the day. Beacons must be placed on Pyramids of Iron, Gold, Emerald or Diamond. However the choice of material has no effect on the power of the beacon. + + + Try using the Beacon to set the powers it grants. You can use the Iron Ingots provided as the necessary payment. + + + This room contains Hoppers + + + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Hoppers.{*B*} +Press{*CONTROLLER_VK_B*} if you already know about Hoppers. + + + Hoppers are used to insert or remove items from containers, and to automatically pick-up items thrown into them. + + + They can affect Brewing Stands, Chests, Dispensers, Droppers, Minecarts with Chests, Minecarts with Hoppers, as well as other Hoppers. + + + Hoppers will continuously attempt to suck items out of suitable container placed above them. It will also attempt to insert stored items into an output container. + + + However if a Hopper is powered by Redstone it will become inactive and stop both sucking and inserting items. + + + A Hopper points in the direction it tries to output items. To make a Hopper point to a particular block, place the Hopper against that block whilst sneaking. + + + There are various useful Hopper layouts for you to see and experiment with in this room. + + + This is the Firework interface, which you can use to craft Fireworks and Firework Stars. + + + {*B*} +Press{*CONTROLLER_VK_A*} to continue.{*B*} +Press{*CONTROLLER_VK_B*} if you already know how to use the Firework interface. + + + To craft a Firework, place Gunpowder and Paper in the 3x3 crafting grid that is shown above your inventory. + + + You can optionally place multiple Firework Stars in the crafting grid to add them to the Firework. + + + Filling more slots in the crafting grid with Gunpowder will increase the height at which all the Firework Stars will explode. + + + You can then take the crafted Firework out of the output slot when you wish to craft it. + + + Firework Stars can be crafted by placing Gunpowder and Dye into the crafting grid. + + + The Dye will set the color of the explosion of the Firework Star. + + + The shape of the Firework Star is set by adding either a Fire Charge, Gold Nugget, Feather or Mob Head. + + + A trail or a twinkle can be added using Diamonds or Glowstone Dust. + + + After a Firework Star has been crafted, you can set the fade color of the Firework Star by crafting it with Dye. + + + Contained within the chests here there are various items used in the creation of FIREWORKS! + + + {*B*} +Press{*CONTROLLER_VK_A*} to learn more about Fireworks. {*B*} +Press{*CONTROLLER_VK_B*} if you already know about Fireworks. + + + Fireworks are decorative items that can be launched by hand or from Dispensers. They are crafted using Paper, Gunpowder and optionally a number of Firework Stars. + + + The colors, fade, shape, size, and effects (such as trails and twinkles) of Firework Stars can be customized by including additional ingredients when crafting. + + + Try crafting a Firework at the Crafting Table using an assortment of ingredients from the chests. +  Select @@ -4094,546 +4541,593 @@ When in flying mode, you can hold down{*CONTROLLER_ACTION_JUMP*} to move up and{ Upload Save for Xbox One + + + Mount + + + Dismount + + + Attach Chest + + + Launch + + + Leash + + + Release + + + Attach + + + Name +  - OK + OK - Cancel + Cancel - Minecraft Store + Minecraft Store - Are you sure you want to leave your current game and join the new one? Any unsaved progress will be lost. + Are you sure you want to leave your current game and join the new one? Any unsaved progress will be lost. - Exit Game + Exit Game - Save Game + Save Game - - Exit Without Saving + + Exit Without Saving - - Are you sure you want to overwrite any previous save for this world with the current version of this world? + + Are you sure you want to overwrite any previous save for this world with the current version of this world? - - Are you sure you want to exit without saving? You will lose all progress in this world! + + Are you sure you want to exit without saving? You will lose all progress in this world! - Start Game + Start Game - If you create, load or save a world in Creative Mode, that world will have achievements and leaderboard updates disabled, even if it is then loaded in Survival Mode. Are you sure you want to continue? + If you create, load or save a world in Creative Mode, that world will have achievements and leaderboard updates disabled, even if it is then loaded in Survival Mode. Are you sure you want to continue? - This world has previously been saved in Creative Mode, and it will have achievements and leaderboard updates disabled. Are you sure you want to continue? + This world has previously been saved in Creative Mode, and it will have achievements and leaderboard updates disabled. Are you sure you want to continue? - This world has previously been saved in Creative Mode, and it will have achievements and leaderboard updates disabled. + This world has previously been saved in Creative Mode, and it will have achievements and leaderboard updates disabled. - If you create, load or save a world with Host Privileges enabled, that world will have achievements and leaderboard updates disabled, even if it is then loaded with those options off. Are you sure you want to continue? + If you create, load or save a world with Host Privileges enabled, that world will have achievements and leaderboard updates disabled, even if it is then loaded with those options off. Are you sure you want to continue? - Damaged Save + Damaged Save - - This save is corrupt or damaged. Would you like to delete it? + + This save is corrupt or damaged. Would you like to delete it? - - Are you sure you want to exit to the main menu and disconnect all players from the game? Any unsaved progress will be lost. + + Are you sure you want to exit to the main menu and disconnect all players from the game? Any unsaved progress will be lost. - Exit and save + Exit and save - Exit without saving + Exit without saving - Are you sure you want to exit to the main menu? Any unsaved progress will be lost. + Are you sure you want to exit to the main menu? Any unsaved progress will be lost. - Are you sure you want to exit to the main menu? Your progress will be lost! + Are you sure you want to exit to the main menu? Your progress will be lost! - Create New World + Create New World - Play Tutorial + Play Tutorial - - Tutorial + + Tutorial - Name Your World + Name Your World - Enter a name for your world + Enter a name for your world - Input the seed for your world generation + Input the seed for your world generation - Load Saved World + Load Saved World - Press START to join game + Press START to join game - Exiting the game + Exiting the game - An error occurred. Exiting to the main menu. + An error occurred. Exiting to the main menu. - Connection failed + Connection failed - Connection lost + Connection lost - Connection to the server was lost. Exiting to the main menu. + Connection to the server was lost. Exiting to the main menu. - Connection to Xbox Live was lost. Exiting to the main menu. + Connection to Xbox Live was lost. Exiting to the main menu. - Connection to Xbox Live was lost. + Connection to Xbox Live was lost. - Disconnected by the server + Disconnected by the server - You were kicked from the game + You were kicked from the game - You were kicked from the game for flying + You were kicked from the game for flying - Connection attempt took too long + Connection attempt took too long - The server is full + The server is full - The host has exited the game. + The host has exited the game. - You cannot join this game as you are not friends with anybody in the game. + You cannot join this game as you are not friends with anybody in the game. - You cannot join this game as you have previously been kicked by the host. + You cannot join this game as you have previously been kicked by the host. - You cannot join this game as the player you are trying to join is running an older version of the game. + You cannot join this game as the player you are trying to join is running an older version of the game. - You cannot join this game as the player you are trying to join is running a newer version of the game. + You cannot join this game as the player you are trying to join is running a newer version of the game. - New World + New World - Award Unlocked! + Award Unlocked! - Hurray - you've been awarded a gamerpic featuring Steve from Minecraft! + Hurray - you've been awarded a gamerpic featuring Steve from Minecraft! - Hurray - you've been awarded a gamerpic featuring a Creeper! + Hurray - you've been awarded a gamerpic featuring a Creeper! - Hurray - you've been awarded an avatar item - a Minecraft: Xbox 360 Edition t-shirt! + Hurray - you've been awarded an avatar item - a Minecraft: Xbox 360 Edition t-shirt! Go to the dashboard to put the t-shirt on your avatar. - Hurray - you've been awarded an avatar item - a Minecraft: Xbox 360 Edition watch! + Hurray - you've been awarded an avatar item - a Minecraft: Xbox 360 Edition watch! Go to the dashboard to put the watch on your avatar. - Hurray - you've been awarded an avatar item - a Creeper baseball cap! + Hurray - you've been awarded an avatar item - a Creeper baseball cap! Go to the dashboard to put the cap on your avatar. - Hurray - you've been awarded the Minecraft: Xbox 360 Edition theme! + Hurray - you've been awarded the Minecraft: Xbox 360 Edition theme! Go to the dashboard to select this theme. - Unlock Full Game + Unlock Full Game - You're playing the trial game, but you'll need the full game to be able to save your game. + You're playing the trial game, but you'll need the full game to be able to save your game. Would you like to unlock the full game now? - This is the Minecraft: Xbox 360 Edition trial game. If you had the full game, you would just have earned an achievement! + This is the Minecraft: Xbox 360 Edition trial game. If you had the full game, you would just have earned an achievement! Would you like to unlock the full game? - This is the Minecraft: Xbox 360 Edition trial game. If you had the full game, you would just have earned an avatar award! + This is the Minecraft: Xbox 360 Edition trial game. If you had the full game, you would just have earned an avatar award! Would you like to unlock the full game? - This is the Minecraft: Xbox 360 Edition trial game. If you had the full game, you would just have earned a gamerpic! + This is the Minecraft: Xbox 360 Edition trial game. If you had the full game, you would just have earned a gamerpic! Would you like to unlock the full game? - This is the Minecraft: Xbox 360 Edition trial game. If you had the full game, you would just have earned a theme! + This is the Minecraft: Xbox 360 Edition trial game. If you had the full game, you would just have earned a theme! Would you like to unlock the full game? - This is the Minecraft: Xbox 360 Edition trial game. You need the full game to be able to accept this invite. + This is the Minecraft: Xbox 360 Edition trial game. You need the full game to be able to accept this invite. Would you like to unlock the full game? - Guest players cannot unlock the full game. Please sign in with an Xbox Live user ID. + Guest players cannot unlock the full game. Please sign in with an Xbox Live user ID. - Please wait + Please wait - No results + No results - Filter: + Filter: - Friends + Friends - My Score + My Score - Overall + Overall - Entries: + Entries: - Rank + Rank - Gamertag + Gamertag - Preparing to Save Level + Preparing to Save Level - Preparing Chunks... + Preparing Chunks... - Finalizing... + Finalizing... - Building Terrain + Building Terrain - Simulating world for a bit + Simulating world for a bit - Initializing server + Initializing server - Generating spawn area + Generating spawn area - Loading spawn area + Loading spawn area - Entering The Nether + Entering The Nether - Leaving The Nether + Leaving The Nether - Respawning + Respawning - Generating level + Generating level - Loading level + Loading level - Saving players + Saving players - Connecting to host + Connecting to host - Downloading terrain + Downloading terrain - Switching to offline game + Switching to offline game - Please wait while the host saves the game + Please wait while the host saves the game - Entering The END + Entering The END - Leaving The END + Leaving The END - Finding Seed for the World Generator + Finding Seed for the World Generator - This bed is occupied + This bed is occupied - You can only sleep at night + You can only sleep at night - %s is sleeping in a bed. To skip to dawn, all players need to sleep in beds at the same time. + %s is sleeping in a bed. To skip to dawn, all players need to sleep in beds at the same time. - Your home bed was missing or obstructed + Your home bed was missing or obstructed - You may not rest now, there are monsters nearby + You may not rest now, there are monsters nearby - You are sleeping in a bed. To skip to dawn, all players need to sleep in beds at the same time. + You are sleeping in a bed. To skip to dawn, all players need to sleep in beds at the same time. - Tools and Weapons + Tools and Weapons - Weapons + Weapons - Food + Food - Structures + Structures - Armor + Armor - Mechanisms + Mechanisms - Transport + Transport - Decorations + Decorations - Building Blocks + Building Blocks - Redstone & Transportation + Redstone & Transportation - Miscellaneous + Miscellaneous - Brewing + Brewing - - Brewing + + Brewing - Tools, Weapons & Armor + Tools, Weapons & Armor - Materials + Materials - Signed out + Signed out - You have been returned to the title screen because your gamer profile was signed out + You have been returned to the title screen because your gamer profile was signed out - Difficulty + Difficulty - Music + Music - Sound + Sound - Gamma + Gamma - Game Sensitivity + Game Sensitivity - Interface Sensitivity + Interface Sensitivity - - Peaceful + + Peaceful - Easy + Easy - Normal + Normal - Hard + Hard - In this mode, the player regains health over time, and there are no enemies in the environment. + In this mode, the player regains health over time, and there are no enemies in the environment. - In this mode, enemies spawn in the environment, but will do less damage to the player than in the Normal mode. + In this mode, enemies spawn in the environment, but will do less damage to the player than in the Normal mode. - In this mode, enemies spawn in the environment and will do a standard amount of damage to the player. + In this mode, enemies spawn in the environment and will do a standard amount of damage to the player. - In this mode, enemies will spawn in the environment, and will do a great deal of damage to the player. Watch out for the Creepers too, since they are unlikely to cancel their exploding attack when you move away from them! + In this mode, enemies will spawn in the environment, and will do a great deal of damage to the player. Watch out for the Creepers too, since they are unlikely to cancel their exploding attack when you move away from them! - Trial Timeout + Trial Timeout - You've been playing the Minecraft: Xbox 360 Edition Trial Game for the maximum time allowed! To continue the fun, would you like to unlock the full game? + You've been playing the Minecraft: Xbox 360 Edition Trial Game for the maximum time allowed! To continue the fun, would you like to unlock the full game? - Game full + Game full - Failed to join game as there are no spaces left + Failed to join game as there are no spaces left - Enter Sign Text + Enter Sign Text - Enter a line of text for your sign + Enter a line of text for your sign - Enter Title + Enter Title - Enter a title for your post + Enter a title for your post - Enter Caption + Enter Caption - Enter a caption for your post + Enter a caption for your post - Enter Description + Enter Description - Enter a description for your post + Enter a description for your post - - Inventory + + Inventory - - Ingredients + + Ingredients - - Brewing Stand + + Brewing Stand - - Chest + + Chest - - Enchant + + Enchant - - Furnace + + Furnace - - Ingredient + + Ingredient - - Fuel + + Fuel - - Dispenser + + Dispenser - - There are no downloadable content offers of this type available for this title at the moment. + + Horse - - %s has joined the game. + + Dropper - - %s has left the game. + + Hopper - - %s was kicked from the game. + + Beacon - - Are you sure you want to delete this save game? + + Primary Power + + + Secondary Power + + + Minecart + + + + There are no downloadable content offers of this type available for this title at the moment. + + + %s has joined the game. + + + %s has left the game. + + + %s was kicked from the game. + + + Are you sure you want to delete this save game? - Awaiting approval + Awaiting approval - Censored + Censored - Now playing: + Now playing: - Reset Settings + Reset Settings - Are you sure you would like to reset your settings to their default values? + Are you sure you would like to reset your settings to their default values? - Loading Error + Loading Error - "Minecraft: Xbox 360 Edition" has failed to load, and cannot continue. + "Minecraft: Xbox 360 Edition" has failed to load, and cannot continue. - - %s's Game + + %s's Game - - Unknown host game + + Unknown host game @@ -4642,13 +5136,13 @@ Would you like to unlock the full game? A guest player has signed out causing all guest players to be removed from the game. - + Sign in You are not signed in. In order to play this game, you will need to be signed in. Do you want to sign in now? - + Multiplayer not allowed @@ -4679,7 +5173,7 @@ Would you like to unlock the full game? No Pack: Default Skins - + Favorite Skins @@ -4733,7 +5227,7 @@ Please do not turn off your Xbox 360 console while this icon is on-screen. - Preparing to Autosave Level + Preparing to Autosave Level @@ -4748,128 +5242,134 @@ Please do not turn off your Xbox 360 console while this icon is on-screen. - Unlock Skin Pack + Unlock Skin Pack - To use the skin you have selected, you need to unlock this skin pack. + To use the skin you have selected, you need to unlock this skin pack. Would you like to unlock this skin pack now? - Unlock Texture Pack + Unlock Texture Pack - To use this texture pack for your world, you need to unlock it. + To use this texture pack for your world, you need to unlock it. Would you like to unlock it now? - Trial Texture Pack + Trial Texture Pack - You are using a trial version of the texture pack. You will not be able to save this world unless you unlock the full version. + You are using a trial version of the texture pack. You will not be able to save this world unless you unlock the full version. Would you like to unlock the full version of the texture pack? - Texture Pack Not Present + Texture Pack Not Present - Unlock Full Version + Unlock Full Version - - Download Trial Version + + Download Trial Version - - Download Full Version + + Download Full Version - This world uses a mash-up pack or texture pack you don't have! + This world uses a mash-up pack or texture pack you don't have! Would you like to install the mash-up pack or texture pack now? - Get Trial Version + Get Trial Version - Get Full Version + Get Full Version - Kick player + Kick player - Are you sure you want to kick this player from the game? They will not be able to rejoin until you restart the world. + Are you sure you want to kick this player from the game? They will not be able to rejoin until you restart the world. - Gamerpics Packs + Gamerpics Packs - Themes + Themes - Skins Packs + Skins Packs - Allow friends of friends + Allow friends of friends - You cannot join this game because it has been limited to players who are friends of the host. + You cannot join this game because it has been limited to players who are friends of the host. - Can't Join Game + Can't Join Game - Selected + Selected - Selected skin: + Selected skin: - Corrupt Downloadable Content + Corrupt Downloadable Content - This downloadable content is corrupt and cannot be used. You need to delete it, then re-install it from the Minecraft Store menu. + This downloadable content is corrupt and cannot be used. You need to delete it, then re-install it from the Minecraft Store menu. - Some of your downloadable content is corrupt and cannot be used. You need to delete them, then re-install them from the Minecraft Store menu. + Some of your downloadable content is corrupt and cannot be used. You need to delete them, then re-install them from the Minecraft Store menu. - Your game mode has been changed + Your game mode has been changed - Rename Your World + Rename Your World - Enter the new name for your world + Enter the new name for your world - Game Mode: Survival + Game Mode: Survival - Game Mode: Creative + Game Mode: Creative + + + Game Mode: Adventure - Survival + Survival - Creative + Creative + + + Adventure - Created in Survival Mode + Created in Survival Mode - Created in Creative Mode + Created in Creative Mode - Render Clouds + Render Clouds - What would you like to do with this save game? + What would you like to do with this save game? Rename Save @@ -4890,6 +5390,9 @@ Would you like to install the mash-up pack or texture pack now? Superflat + + Enter a seed to generate the same terrain again. Leave blank for a random world. + When enabled, the game will be an online game. @@ -4926,6 +5429,29 @@ Would you like to install the mash-up pack or texture pack now? When enabled, a chest containing some useful items will be created near the player spawn point. + + + When disabled, prevents monsters and animals from changing blocks (for example, Creeper explosions won't destroy blocks and Sheep won't remove Grass) or picking up items. + + + When enabled, players will keep their inventory when they die. + + + When disabled, mobs will not spawn naturally. + + + When disabled, monsters and animals will not drop loot (for example, Creepers won't drop gunpowder). + + + When disabled, blocks will not drop items when destroyed (for example, Stone blocks won't drop Cobblestone). + + + When disabled, players will not regenerate health naturally. + + + When disabled, the time of day will not change. + + Skin Packs @@ -5001,7 +5527,72 @@ Would you like to install the mash-up pack or texture pack now? {*PLAYER*} was pummeled by {*SOURCE*} - {*PLAYER*} was killed by {*SOURCE*} + {*PLAYER*} was killed by {*SOURCE*} using magic + + + + + {*PLAYER*} fell off a ladder + + + {*PLAYER*} fell off some vines + + + {*PLAYER*} fell out of the water + + + {*PLAYER*} fell from a high place + + + {*PLAYER*} was doomed to fall by {*SOURCE*} + + + {*PLAYER*} was doomed to fall by {*SOURCE*} + + + {*PLAYER*} was doomed to fall by {*SOURCE*} using {*ITEM*} + + + {*PLAYER*} fell too far and was finished by {*SOURCE*} + + + {*PLAYER*} fell too far and was finished by {*SOURCE*} using {*ITEM*} + + + {*PLAYER*} walked into fire whilst fighting {*SOURCE*} + + + {*PLAYER*} was burnt to a crisp whilst fighting {*SOURCE*} + + + {*PLAYER*} tried to swim in lava to escape {*SOURCE*} + + + {*PLAYER*} drowned whilst trying to escape {*SOURCE*} + + + {*PLAYER*} walked into a cactus whilst trying to escape {*SOURCE*} + + + {*PLAYER*} was blown up by {*SOURCE*} + + + {*PLAYER*} withered away + + + {*PLAYER*} was slain by {*SOURCE*} using {*ITEM*} + + + {*PLAYER*} was shot by {*SOURCE*} using {*ITEM*} + + + {*PLAYER*} was fireballed by {*SOURCE*} using {*ITEM*} + + + {*PLAYER*} was pummeled by {*SOURCE*} using {*ITEM*} + + + {*PLAYER*} was killed by {*SOURCE*} using {*ITEM*} @@ -5210,348 +5801,380 @@ Would you like to install the mash-up pack or texture pack now? - Reset Nether + Reset Nether - Are you sure you want to reset the Nether in this savegame to its default state? You will lose anything you have built in the Nether! + Are you sure you want to reset the Nether in this savegame to its default state? You will lose anything you have built in the Nether! - Reset Nether + Reset Nether - Don't Reset Nether + Don't Reset Nether - Can't shear this Mooshroom at the moment. The maximum number of Pigs, Sheep, Cows and Cats has been reached. + Can't shear this Mooshroom at the moment. The maximum number of Pigs, Sheep, Cows, Cats and Horses has been reached. - Can't use Spawn Egg at the moment. The maximum number of Pigs, Sheep, Cows and Cats has been reached. + Can't use Spawn Egg at the moment. The maximum number of Pigs, Sheep, Cows, Cats and Horses has been reached. - Can't use Spawn Egg at the moment. The maximum number of Mooshrooms has been reached. + Can't use Spawn Egg at the moment. The maximum number of Mooshrooms has been reached. - Can't use Spawn Egg at the moment. The maximum number of Wolves in a world has been reached. + Can't use Spawn Egg at the moment. The maximum number of Wolves in a world has been reached. - Can't use Spawn Egg at the moment. The maximum number of Chickens in a world has been reached. + Can't use Spawn Egg at the moment. The maximum number of Chickens in a world has been reached. - Can't use Spawn Egg at the moment. The maximum number of Squid in a world has been reached. + Can't use Spawn Egg at the moment. The maximum number of Squid in a world has been reached. + + + Can't use Spawn Egg at the moment. The maximum number of Bats in a world has been reached. - Can't use Spawn Egg at the moment. The maximum number of enemies in a world has been reached. + Can't use Spawn Egg at the moment. The maximum number of enemies in a world has been reached. - Can't use Spawn Egg at the moment. The maximum number of villagers in a world has been reached. + Can't use Spawn Egg at the moment. The maximum number of villagers in a world has been reached. - The maximum number of Paintings/Item Frames in a world has been reached. + The maximum number of Paintings/Item Frames in a world has been reached. - You can't spawn enemies in Peaceful mode. + You can't spawn enemies in Peaceful mode. - This animal can't enter Love Mode. The maximum number of breeding Pigs, Sheep, Cows and Cats has been reached. + This animal can't enter Love Mode. The maximum number of breeding Pigs, Sheep, Cows, Cats and Horses has been reached. - This animal can't enter Love Mode. The maximum number of breeding Wolves has been reached. + This animal can't enter Love Mode. The maximum number of breeding Wolves has been reached. - This animal can't enter Love Mode. The maximum number of breeding Chickens has been reached. + This animal can't enter Love Mode. The maximum number of breeding Chickens has been reached. + + This animal can't enter Love Mode. The maximum number of breeding horses has been reached. + - This animal can't enter Love Mode. The maximum number of breeding Mooshrooms has been reached. + This animal can't enter Love Mode. The maximum number of breeding Mooshrooms has been reached. - The maximum number of Boats in a world has been reached. + The maximum number of Boats in a world has been reached. - The maximum number of Mob Heads in a world has been reached. + The maximum number of Mob Heads in a world has been reached. - - Invert Look + + Invert Look - - Southpaw + + Southpaw - - You Died! + + You Died! - - Respawn + + Respawn - - Downloadable Content Offers + + Downloadable Content Offers - - Change Skin + + Change Skin - - How To Play + + How To Play - - Controls + + Controls - - Settings + + Settings - - Credits - - - Reinstall Content - - - Debug Settings + + Credits + + Reinstall Content + + + Debug Settings + - - Fire Spreads + + Fire Spreads + + + TNT Explodes + + + Player vs Player + + + Trust Players + + + Host Privileges + + + Generate Structures + + + Superflat World + + + Bonus Chest + + + + World Options + + + Game Options + + + + Mob Griefing + + + Keep Inventory + + + Mob Spawning + + + Mob Loot + + + Tile Drops + + + Natural Regeneration + + + Daylight Cycle + + + + Can Build and Mine - - TNT Explodes + + Can Use Doors and Switches - - Player vs Player + + Can Open Containers - - Trust Players + + Can Attack Players - - Host Privileges + + Can Attack Animals - - Generate Structures + + Moderator - - Superflat World + + Kick Player - - Bonus Chest + + Can Fly - - World Options + + Disable Exhaustion + + + Invisible + + + Host Options + + + Players/Invite - - Can Build and Mine + + Online Game - - Can Use Doors and Switches + + Invite Only - - Can Open Containers + + More Options - - Can Attack Players + + Load - - Can Attack Animals + + New World - - Moderator + + World Name - - Kick Player + + Seed for the World Generator - - Can Fly + + Leave blank for a random seed - - Disable Exhaustion + + Players - - Invisible + + Join Game - - Host Options + + Start Game - - Players/Invite - - - - Online Game - - - Invite Only - - - More Options - - - Load - - - New World - - - World Name - - - Seed for the World Generator - - - Leave blank for a random seed - - - Players - - - Join Game - - - Start Game - - - No Games Found + + No Games Found - - Play Game + + Play Game - - Leaderboards + + Leaderboards - - Achievements + + Achievements - - Help & Options + + Help & Options - - Unlock Full Game + + Unlock Full Game - - Resume Game + + Resume Game - - Save Game + + Save Game - - Difficulty: + + Difficulty: - - Game Type: + + Game Type: - - Gamertags: + + Gamertags: - - Structures: + + Structures: - - Level Type: + + Level Type: - - PvP: + + PvP: - - Trust Players: + + Trust Players: - - TNT: + + TNT: - - Fire Spreads: + + Fire Spreads: - - Reinstall Theme + + Reinstall Theme - - Reinstall Gamerpic 1 + + Reinstall Gamerpic 1 - - Reinstall Gamerpic 2 + + Reinstall Gamerpic 2 - - Reinstall Avatar Item 1 + + Reinstall Avatar Item 1 - - Reinstall Avatar Item 2 + + Reinstall Avatar Item 2 - - Reinstall Avatar Item 3 + + Reinstall Avatar Item 3 - - Options + + Options - - Audio + + Audio - - Control + + Control - - Graphics + + Graphics - - User Interface + + User Interface - - Reset to Defaults + + Reset to Defaults - - View Bobbing + + View Bobbing - - Hints + + Hints - - In-Game Tooltips + + In-Game Tooltips - - In-Game Gamertags + + In-Game Gamertags - - 2 Player Split-screen Vertical + + 2 Player Split-screen Vertical - - Done + + Done - - Edit sign message: + + Edit sign message: - - Fill in the details to accompany your screenshot + + Fill in the details to accompany your screenshot - - Caption + + Caption - - Screenshot from in-game + + Screenshot from in-game - - Edit sign message: + + Edit sign message: - - Look what I made in Minecraft: Xbox 360 Edition! + + Look what I made in Minecraft: Xbox 360 Edition! - - The classic Minecraft textures, icons and user interface! + + The classic Minecraft textures, icons and user interface! - - Show all Mash-up Worlds + + Show all Mash-up Worlds Select Transfer Save Slot @@ -5635,6 +6258,18 @@ Would you like to install the mash-up pack or texture pack now? Poison + + Wither + + + Health Boost + + + Absorption + + + Saturation + of Swiftness @@ -5693,6 +6328,18 @@ Would you like to install the mash-up pack or texture pack now? of Poison + + of Decay + + + of Health Boost + + + of Absorption + + + of Saturation + @@ -5841,6 +6488,32 @@ Would you like to install the mash-up pack or texture pack now? Reduces health of the affected players, animals and monsters over time. + + + When Applied: + + + + Horse Jump Strength + + + Zombie Reinforcements + + + Max Health + + + Mob Follow Range + + + Knockback Resistance + + + Speed + + + Attack Damage + Sharpness @@ -5983,7 +6656,7 @@ Would you like to install the mash-up pack or texture pack now? Restores 3{*ICON_SHANK_01*}. Created by cooking a potato in a furnace. - Restores 1{*ICON_SHANK_01*}, or can be cooked in a furnace. This can be planted in farmland. Eating this can cause you to be poisoned. + Restores 1{*ICON_SHANK_01*}. Eating this can cause you to become poisoned. Restores 3{*ICON_SHANK_01*}. Crafted from a carrot and gold nuggets. diff --git a/Minecraft.Assets/XboxMedia/loc/zh-CHT/4J_strings.resx b/Minecraft.Assets/XboxMedia/loc/zh-CHT/4J_strings.resx index 90cddc7f6..341189b05 100644 --- a/Minecraft.Assets/XboxMedia/loc/zh-CHT/4J_strings.resx +++ b/Minecraft.Assets/XboxMedia/loc/zh-CHT/4J_strings.resx @@ -17,7 +17,7 @@ 沒有可用空間 -已選取儲存裝置沒有足夠的可用空間來建立遊戲存檔。 +您所選取的儲存裝置沒有足夠的可用空間來建立遊戲存檔。 再選取一次 @@ -27,7 +27,7 @@ 要覆寫存檔嗎? -已選取儲存裝置已經有這個存檔,確定要覆寫該存檔嗎? +您所選取的儲存裝置已經有這個存檔,確定要覆寫該存檔嗎? 否:不要覆寫 diff --git a/Minecraft.Assets/XboxMedia/loc/zh-CHT/strings.resx b/Minecraft.Assets/XboxMedia/loc/zh-CHT/strings.resx index 7c9861f87..4efef5a74 100644 --- a/Minecraft.Assets/XboxMedia/loc/zh-CHT/strings.resx +++ b/Minecraft.Assets/XboxMedia/loc/zh-CHT/strings.resx @@ -287,20 +287,41 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 當載入或建立世界時,您可以按下 [更多選項] 按鈕,來選擇更多遊戲的相關設定。{*B*}{*B*} {*T2*}玩家 vs 玩家{*ETW*}{*B*} - 啟用此選項時,玩家對其他玩家可以造成傷害。此選項只在生存模式下可使用。{*B*}{*B*} + 啟用此選項時,玩家可以對其他玩家造成傷害。此選項只在生存模式下可使用。{*B*}{*B*} {*T2*}信任玩家{*ETW*}{*B*} - 停用此選項時,會限制加入遊戲的玩家只能從事限定的活動。他們無法進行開採或使用項目、放置方塊、使用門與開關、使用容器、攻擊玩家,或攻擊動物。您可以使用遊戲選單為特定玩家變更上述的選項。{*B*}{*B*} + 停用此選項會限制加入遊戲的玩家可以進行的活動。他們無法進行開採或使用項目、放置方塊、使用門與開關、使用容器、攻擊玩家或動物。您可以使用遊戲選單為特定玩家變更上述的選項。{*B*}{*B*} {*T2*}火會蔓延{*ETW*}{*B*} - 啟用此選項時,火會蔓延到附近易燃的方塊。可以從遊戲中變更此選項。{*B*}{*B*} + 啟用此選項時,火會蔓延到附近易燃的方塊。您也可以從遊戲中變更此選項。{*B*}{*B*} {*T2*}炸藥會爆炸{*ETW*}{*B*} - 啟用此選項時,引爆炸藥時會爆炸。可以從遊戲中變更此選項。{*B*}{*B*} + 啟用此選項時,引爆炸藥後就會發生爆炸。您也可以從遊戲中變更此選項。{*B*}{*B*} {*T2*}主持人特權{*ETW*}{*B*} 啟用此選項時,主持人可以在遊戲中切換自己的飛翔能力、停用疲勞功能,或是讓自己隱形。{*DISABLES_ACHIEVEMENTS*}{*B*}{*B*} + {*T2*}日光循環{*ETW*}{*B*} + 停用此選項時,一日當中的時間不會改變。{*B*}{*B*} + + {*T2*}保留庫存{*ETW*}{*B*} + 啟用此選項時,玩家在死時會保留他們的庫存。{*B*}{*B*} + + {*T2*}暴徒產卵{*ETW*}{*B*} + 停用此選項會讓暴徒無法自然產卵。{*B*}{*B*} + + {*T2*}暴徒破壞{*ETW*}{*B*} + 停用此選項時,可防止怪獸與動物變更方塊 (例如,爬行動物爆炸無法摧毀方塊,羊群也不會清除牧草) ,或拾取項目。{*B*}{*B*} + + {*T2*}暴徒劫掠{*ETW*}{*B*} + 停用此選項時,怪獸與動物無法撒下劫掠物 (例如:Creeper 無法撒下火藥) 。{*B*}{*B*} + + {*T2*}磚瓦拋落{*ETW*}{*B*} + 停用此選項時,方塊無法被摧毀時拋落項目 (例如:石頭方塊無法拋落鵝卵石) 。{*B*}{*B*} + + {*T2*}自然再生{*ETW*}{*B*} + 停用此選項時,玩家無法自然回復健康。{*B*}{*B*} + {*T1*}產生新世界選項{*ETW*}{*B*} 建立新世界時,有些額外的選項可使用。{*B*}{*B*} @@ -311,56 +332,59 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 啟用此選項時,會在地上世界與地獄世界中產生完全平坦的世界。{*B*}{*B*} {*T2*}贈品箱{*ETW*}{*B*} - 啟用此選項時,會在玩家再生點附近創造內含一些有用項目的贈品箱。{*B*}{*B*} + 啟用此選項時,玩家再生點附近會出現一個放了有用物品的箱子。{*B*}{*B*} {*T2*}重設地獄{*ETW*}{*B*} 啟用此選項時,會再度產生地獄。如果您的舊存檔中沒有地獄要塞,這將會很有用。{*B*}{*B*} - {*T1*}遊戲中選項{*ETW*}{*B*} - 玩遊戲時,按下 BACK 鍵可以叫出遊戲中功能表,存取某些選項。{*B*}{*B*} + {*T1*}遊戲中選項{*ETW*}{*B*} + 玩遊戲時,按下 {*BACK_BUTTON*} 鍵可以叫出遊戲中功能表,存取某些選項。{*B*}{*B*} {*T2*}主持人選項{*ETW*}{*B*} - 玩家主持人或設定為管理員的玩家,可以存取 [主持人選項] 功能表。這些人可以啟用或取消「火會蔓延」及「炸藥會爆炸」的選項。{*B*}{*B*} + 玩家主持人及設定為管理員的玩家,可以存取 [主持人選項] 功能表。這些人可以啟用或取消「火會蔓延」及「炸藥會爆炸」的選項。{*B*}{*B*} {*T1*}玩家選項{*ETW*}{*B*} 若要修改玩家的特權,可以選取玩家的名字並按下 {*CONTROLLER_VK_A*},這會叫出玩家特權功能表,您可以使用列出的選項。{*B*}{*B*} {*T2*}可以建造和開採{*ETW*}{*B*} - 只有在關閉信任玩家時才可以使用此選項。啟用此選項時,玩家可以像是在正常狀況下一樣與世界互動。取消使用此選項時,玩家將無法放置或摧毀方塊,並無法與許多項目及方塊互動。{*B*}{*B*} + 只有在「信任玩家」選項已關閉時才可以使用此選項。啟用此選項時,玩家可以在正常狀況下與世界互動。停止使用此選項後,玩家將無法放置或摧毀方塊,並無法與項目及方塊互動。{*B*}{*B*} {*T2*}可以使用門與開關{*ETW*}{*B*} - 只有在關閉信任玩家時才可以使用此選項。停用此選項時,玩家將無法使用門與開關。{*B*}{*B*} + 只有在「信任玩家」選項已關閉時才可以使用此選項。停用此選項時,玩家將無法使用門與開關。{*B*}{*B*} {*T2*}可以打開容器{*ETW*}{*B*} - 只有在關閉信任玩家時才可以使用此選項。停用此選項時,玩家將無法打開箱子等容器。{*B*}{*B*} + 只有在「信任玩家」選項已關閉時才可以使用此選項。停用此選項時,玩家將無法打開箱子等容器。{*B*}{*B*} - {*T2*}可以攻擊玩家{*ETW*}{*B*} - 只有在關閉信任玩家時才可以使用此選項。取消使用此選項時,玩家將無法對其他玩家造成傷害。{*B*}{*B*} + {*T2*}可以攻擊玩家{*ETW*}{*B*} + 只有在「信任玩家」選項已關閉時才可以使用此選項。停用此選項時,玩家將無法傷害其他玩家。{*B*}{*B*} {*T2*}可以攻擊動物{*ETW*}{*B*} - 只有在關閉信任玩家時才可以使用此選項。停用此選項時,玩家將無法對動物造成傷害。{*B*}{*B*} + 只有在「信任玩家」選項已關閉時才可以使用此選項。停用此選項時,玩家將無法傷害動物。{*B*}{*B*} {*T2*}管理員{*ETW*}{*B*} - 啟用此選項時,玩家可以修改主持人以外其他玩家的特權 (在「信任玩家」關閉的狀態下)、踢出玩家,並啟用或停用「火會蔓延」及「炸藥會爆炸」功能。{*B*}{*B*} + 啟用此選項時,玩家可以修改主持人以外其他玩家的特權 (在「信任玩家」選項關閉的狀態下)、踢出玩家,並啟用或停用「火會蔓延」及「炸藥會爆炸」功能。{*B*}{*B*} {*T2*}踢出玩家{*ETW*}{*B*} - 對使用與主持人玩家不同 {*PLATFORM_NAME*} 主機的玩家選取此選項,會將該玩家或使用其他 {*PLATFORM_NAME*} 主機的玩家踢出遊戲。除非重新啟動,否則被踢出的玩家無法再加入遊戲。{*B*}{*B*} + {*KICK_PLAYER_DESCRIPTION*}主機的玩家選取此選項,會將該玩家或使用其他 {*PLATFORM_NAME*} 主機的玩家踢出遊戲。除非重新啟動,否則被踢出的玩家無法再加入遊戲。{*B*}{*B*} {*T1*}主持人玩家選項{*ETW*}{*B*} -如果已經啟用主持人特權,則主持人玩家可以修改自己的某些特權。若要修改玩家的特權,可以選取玩家的名字並按下 {*CONTROLLER_VK_A*},這會叫出玩家特權功能表,您可以使用列出的選項。{*B*}{*B*} +如果主持人特權已經啟用,主持人玩家可以修改自己的某些特權。若要修改玩家的特權,可以選取玩家的名字並按下 {*CONTROLLER_VK_A*},這會叫出玩家特權功能表,您可以使用下列選項。{*B*}{*B*} {*T2*}可以飛翔{*ETW*}{*B*} - 啟用此選項時,玩家可以擁有飛翔的能力。只能在生存模式中選擇是否使用此選項。在創造模式中,所有的玩家都有飛翔的能力。{*B*}{*B*} + 啟用此選項時,玩家可以擁有飛翔的能力。您只能在生存模式中選擇是否使用此選項,因為在創造模式中,所有的玩家都有飛翔的能力。{*B*}{*B*} {*T2*}停用疲勞{*ETW*}{*B*} - 只能在生存模式中選擇是否使用此選項。啟用時,消耗體力的活動 (行走/奔跑/跳躍等等) 不會讓食物列減少。然而,如果玩家受傷,在玩家回復生命值期間,食物列會緩慢減少。{*B*}{*B*} + 只能在生存模式中選擇是否使用此選項。啟用時,消耗體力的活動 (行走/奔跑/跳躍等等) 不會讓食物列減少。然而,如果玩家受傷,在玩家回復生命值期間,食物列會慢慢減少。{*B*}{*B*} {*T2*}隱形{*ETW*}{*B*} - 啟用此選項時,其他玩家將無法看見玩家,且玩家會變成刀槍不入。{*B*}{*B*} - {*T2*}可以傳送{*ETW*}{*B*} - 這可以讓玩家傳送其他玩家或者他自己到其他玩家身邊。 + 啟用此選項時,其他玩家將無法看見玩家,而且玩家會變成刀槍不入。{*B*}{*B*} + + {*T2*}可以傳送{*ETW*}{*B*} + 這可以讓玩家在世界中傳送其他玩家或者他自己到其他玩家身邊。 +不是同一個玩家{*PLATFORM_NAME*}主控台為主機播放程式中,選取此選項將踢出玩家的遊戲和其他玩家在其{*PLATFORM_NAME*}主控台。這位玩家不能再加入遊戲,直到重新啟動。 + 下一頁 上一頁 @@ -379,7 +403,7 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 發射器 -豢養動物 +飼養動物 繁殖動物 @@ -425,61 +449,93 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 最新資訊 {*T3*}變更及新增功能{*ETW*}{*B*}{*B*} -- 新增物品:翡翠、翡翠原礦、翡翠方塊、終界箱、絆線鉤、附魔金蘋果、鐵砧、鵝卵石牆、青苔卵石牆、凋零骷髏的畫像、馬鈴薯、烤馬鈴薯、有毒馬鈴薯、金色胡蘿蔔、「願者上鉤」 -南瓜派、夜視藥水、隱形藥水、獄石英、獄石英原礦、石英方塊、石英板、石英階梯、雕刻石英方塊、希臘圓柱石英方塊、附魔小冊、各種地毯。{*B*} -- 新增平滑沙岩和雕刻沙岩的配方。{*B*} -- 新增怪物:殭屍村民。{*B*} -- 新增生成地形特色建築:沙漠神廟、沙漠村落、叢林神廟。{*B*} -- 新增村民交易功能。{*B*} -- 新增鐵砧介面{*B*} -- 可以將皮甲染色。{*B*} -- 可以將狼項圈染色。{*B*} -- 在騎乘豬隻時可以使用「願者上鉤」來控制方向。{*B*} -- 在贈品箱中加入更多物品。{*B*} -- 變更一般擺設半格方塊以及兩個半格方塊的擺設機制。{*B*} -- 變更樓梯以及石、木板上下顛倒的擺設。{*B*} -- 新增不同的村民職業。{*B*} -- 若使用角色蛋產生村民,其職業將為亂數設置。{*B*} -- 新增木頭的橫擺配置。{*B*} -- 可在熔爐中使用木質工具作為燃料。{*B*} -- 可以使用聚寶特殊能力收取冰塊和玻璃片。{*B*} -- 木質按鈕和木質壓板可以透過射箭啟動。{*B*} -- 地獄中的怪物可以穿過傳送門來到地上世界。{*B*} -- Creeper 和蜘蛛會攻擊最後一個對他們出手的玩家。{*B*} -- 創造模式下的怪物短時間後會回到中立特性。{*B*} -- 移除溺水時發生的擊退效果。{*B*} -- 被殭屍打壞的門會顯示傷害。{*B*} -- 冰塊會在地獄中融化。{*B*} -- 水槽在大雨中會自動補水。{*B*} -- 活塞動作的更新時間延長一倍。{*B*} -- 殺掉豬後會得到馬鞍(如果豬身上裝了馬鞍)。{*B*} -- 變更終界天空的顏色。{*B*} -- 可以擺置絲線使成為絆線。{*B*} -- 雨滴會穿過樹葉了。{*B*} -- 拉桿可以安裝在方塊的底部。{*B*} -- 炸藥的傷害會依據遊戲難度改變。{*B*} -- 變更書本的製作配方。{*B*} -- 船撞上睡蓮葉不會損壞了,而不是船撞上睡蓮葉就解體。{*B*} -- 殺死豬後會得到更多豬肉。{*B*} -- 史萊姆現在比較不會在非常平坦類型的世界中出現。{*B*} -- Creeper 自爆造成的傷害會依遊戲難度而變動,擊退距離也會更遠。{*B*} -- 修正 Endermen 不會張開嘴巴的問題。{*B*} -- 新增玩家傳送的功能 (請見遊戲內的 BACK 鍵選單)。{*B*} -- 新增遠端設定玩家飛行、隱身、無敵的主持人選項功能。{*B*} -- 因應本次更新新增物品,在教學模式中加入新的物品與功能教學。{*B*} -- 更新唱片箱子在教學模式中的位置。{*B*} - +- 新增物品:硬化黏土、染色黏土、煤炭方塊、乾草捆、啟動鐵軌、紅石方塊、陽光感測器、投擲器、漏斗、漏斗礦車、火藥礦車、紅石比較器、測重壓力板、燈塔、陷阱儲物箱、煙火火箭、煙火星、幽冥星、繩索、馬鎧、名牌、馬重生蛋。{*B*} +- 新增生物:凋零怪、凋零骷髏、女巫、蝙蝠、馬、驢和騾。{*B*} +- 新增地形生成功能:女巫屋。{*B*} +- 新增燈塔介面。{*B*} +- 新增馬介面。{*B*} +- 新增漏斗介面。{*B*} +- 新增煙火:您擁有製作煙火星或煙火火箭的材料時,可以從工作台進入煙火介面。{*B*} +- 新增「冒險模式」:您只能用正確的工具打破方塊。{*B*} +- 新增許多聲音。{*B*} +- 生物、物品和投射物現在能通過入口。{*B*} +- 現在只要用另一個中繼器為中繼器供電,就可以把它鎖起來。{*B*} +- 殭屍和骷髏現在可以用不同的武器和護甲重生。{*B*} +- 新死亡訊息。{*B*} +- 用命名牌為生物命名,以及在功能表開啟時為容器重新命名來變更標題。{*B*} +- 骨粉不再讓每樣東西立即完全長大,而是會隨機讓每樣東西於不同的階段生長。{*B*} +- 直接朝儲物箱、釀造台、發射器和唱片機放置紅石比較器,即可偵測到說明這些東西裡面內容物的紅石訊號。{*B*} +- 發射器可以朝任何方向。{*B*} +- 玩家於吃下金蘋果之後,就能短暫獲得額外的生命值去「吸收」傷害。{*B*} +- 您在某個區域停留時間越久,在該區域重生的怪物越難被打敗。{*B*} {*ETB*}歡迎回來!或許您還沒有注意到,您的 Minecraft 已經更新了。{*B*}{*B*} -我們為您和您的好友新增了許多功能,我們在此為您重點列舉幾,趕快瞭解並開始遊戲吧!{*B*}{*B*} -{*T1*}新物品{*ETB*} - 翡翠、翡翠原礦、翡翠方塊、終界箱、絆線鉤、附魔金蘋果、鐵砧、花盆、鵝卵石牆、青苔卵石牆、凋零骷髏的畫像、馬鈴薯、烤馬鈴薯、有毒馬鈴薯、金色胡蘿蔔、「願者上鉤」、 -南瓜派、夜視藥水、隱形藥水、獄石英、獄石英原礦、石英方塊、石英板、石英階梯、雕刻石英方塊、希臘圓柱石英方塊、附魔小冊、各種地毯。{*B*}{*B*} -{*T1*}新生物{*ETB*} - 殭屍村民.{*B*}{*B*} -{*T1*}新功能{*ETB*} - 和村民交易、透過鐵砧修理武器和工具,或是增加特殊能力,在終界箱裡儲存物品、在騎乘小豬的時候使用「願者上鉤」來控制豬的移動方向!{*B*}{*B*} -{*T1*}新的迷你教學課程{*ETB*} – 在教學世界裡學習如何使用新功能!{*B*}{*B*} -{*T1*}新的彩蛋{*ETB*} – 我們已經移動了在教學世界裡的秘密唱片,看看您是否能再次找出它們!{*B*}{*B*} +我們為您和您的好友新增了許多功能,我們在此為您重點列舉幾項,趕快瞭解並開始遊戲吧!{*B*}{*B*} +{*T1*}新物品{*ETB*}:硬化黏土、染色黏土、煤炭方塊、乾草捆、啟動鐵軌、紅石方塊、陽光感測器、投擲器、漏斗、漏斗礦車、火藥礦車、紅石比較器、測重壓力板、燈塔、陷阱儲物箱、煙火火箭、煙火星、幽冥星、繩索、馬鎧、名牌、馬重生蛋。{*B*}{*B*} +{*T1*}新生物{*ETB*}:凋零怪、凋零骷髏、女巫、蝙蝠、馬、驢和騾。{*B*}{*B*} +{*T1*}新功能{*ETB*}:馴服馬後騎上馬背、製作煙火及惡搞一番、用名牌為動物和怪物命名、建立更進階的紅石電路,還有主持人選項協助控制世界訪客的能耐!{*B*}{*B*} +{*T1*}新的教學世界{*ETB*}:在教學世界中學習新舊功能的使用方式。看您是否有能耐把藏在世界中的所有神祕唱片都找出來!{*B*}{*B*} + + +{*T3*}遊戲方式:馬{*ETW*}{*B*}{*B*} +馬和驢主要居住在開闊的平原。騾是驢和馬的後代,但本身不具生殖能力。{*B*} +所有成年的馬、驢和騾都可供人騎乘,但是只有馬能夠穿上護甲,只有騾和驢可以裝上鞍囊去運輸物品。{*B*}{*B*} +馬、驢和騾必須先馴服才可以使用。馴服馬的方式是騎上去,然後騎士必須想辦法不被馬摔下馬背。{*B*} +當愛心出現在馬的周圍時,牠已經被馴服,再也不會把玩家摔下馬背。玩家必須幫馬裝上馬鞍,才能操縱一匹馬。{*B*}{*B*} +您可以向村民購買,或是從藏在世界中的儲物箱尋找馬鞍。{*B*} +若要為已馴服的驢和騾加鞍囊,玩家要把儲物箱裝在牠們身上。之後騎乘或蹲伏時玩家就能使用這些鞍囊.{*B*}{*B*} +使用金蘋果或金蘿蔔餵食馬和驢即可繁殖牠們,就像繁殖其他動物一樣,但是騾就不行。{*B*} +小馬經過一段時間就會長成成年馬,不過給牠們餵食小麥或乾草就會加速生長。{*B*} + + +燈塔 + +{*T3*}遊戲方式:燈塔{*ETW*}{*B*}{*B*} +啟動的燈塔會向天空投射明亮的光束,賦予附近的玩家力量。{*B*} +製作燈塔的材料包括玻璃、黑曜石和幽冥星,擊敗凋零怪即可獲得。{*B*}{*B*} +燈塔必須放置,白天才能沐浴在陽光之下。燈塔必須放置於鐵、黃金、翡翠或鑽石金字塔上。{*B*} +用來放置燈塔的材料不會影響燈塔的力量。{*B*}{*B*} +您可以在燈塔選單中,為燈塔選取一種主要的力量。金字塔越多層,可供選擇的力量越多。{*B*} +至少有四層的金字塔上的燈塔,還能夠讓您選擇再生次要力量或是更強大的主要力量。{*B*}{*B*} +您必須在付費空格奉上翡翠、鑽石、黃金或鐵塊,才能設定燈塔的力量。{*B*} +設定後,燈塔就會無限期發出力量。{*B*} + + +煙火 + +{*T3*}遊戲方式︰煙火{*ETW*}{*B*}{*B*} +煙火屬於裝飾品,可以手動或利用發射器發射,製作的材料包括紙、火藥,也有人會選擇加入幾顆煙火星。{*B*} +煙火星的顏色、淡化、形狀、大小與效果 (例如尾巴和閃爍) 可自訂,方法是在製作時加入額外材料。{*B*}{*B*} +若要製作煙火,請將火藥和紙放在庫存上方的 3x3 工作台。{*B*} +您可以選擇在工作台放置多顆煙火星,加入煙火。{*B*} +用火藥在工作台填滿的空格越多,所有煙火星會爆炸的高度越高。{*B*}{*B*} +然後您便可從輸出空格取出製作的煙火。{*B*}{*B*} +將火藥和染料放進工作台,即可製作煙火星。{*B*} + - 染料會決定煙火星爆炸的顏色。{*B*} + - 煙火星的形狀則是取決於加入火焰彈、金塊、羽毛或生物的頭。{*B*} + - 使用鑽石或螢光粉即可新增尾巴或閃爍。{*B*}{*B*} +煙火星製作完成後,以染料製作即可決定煙火星的淡出顏色。 + + +漏斗 + +{*T3*}遊戲方式:漏斗{*ETW*}{*B*}{*B*} +您可以使用漏斗將物品插入容器或是從容器移除物品,以及自動拾取丟入容器的物品。{*B*} +漏斗能夠影響釀造台、儲物箱、發射器、投擲器、運輸礦車、漏斗礦車及其他漏斗。{*B*}{*B*} +漏斗會一直嘗試從放在上方的合適容器吸取物品,還會嘗試將儲存的物品插入輸出容器。{*B*} +如果漏斗是用紅石發電就會停用,並且停止吸取和插入物品。{*B*}{*B*} +漏斗會指向嘗試輸出物品的方向。若要讓漏斗指向特定方塊,淺行時將漏斗放在背對該方塊的位置即可。{*B*} + + +投擲器 + +{*T3*}遊戲方式︰投擲器{*ETW*}{*B*}{*B*} +投擲器由紅石供電時,會隨機掉落一件物品至地面。使用 {*CONTROLLER_ACTION_USE*} 即可開啟投擲器,然後即可將庫存中的物品裝進投擲器。{*B*} +如果投擲器朝向儲物箱或另一種容器,物品則會放進那裡面。您可以打造投擲器的長鏈子運輸物品,但是必須交替開啟關閉電源才能發揮功能。 + + 能造成比用手劈砍更大的傷害。 用來挖泥土、青草、沙子、礫石及白雪時的速度,會比用手挖還要快。您需要用鏟子才能挖雪球。 @@ -605,10 +661,36 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 用手握住時,會顯示某個地區中已探索區域的影像。可讓您用來尋找能前往某個地點的路。 +使用後會成為您身處世界的地圖,而且會隨著您的探索腳步填滿。 + 可射出箭來遠距攻擊。 可與弓組成武器。 +凋零怪所扔下,用於製作燈塔。 + +啟動時,建立彩色爆炸。顏色、效果、形狀和淡出取決於建立煙火時使用的煙火星。 + +用來決定煙火的顏色、效果和形狀。 + +用於紅石電路,以維持、比較或除去信號強度,或是測量若干方塊的狀態。 + +屬於一種貨物礦車類型,功能是移動的 TNT 方塊。 + +是根據陽光 (或缺乏陽光) 發出紅石信號的方塊。 + +屬於特殊的貨物礦車類型,功能類似漏斗,會收集軌道上的物品以及上方容器內的物品。 + +特殊護甲類型,可以裝在馬上。提供 5 護甲。 + +特殊護甲類型,可以裝在馬上。提供 7 護甲。 + +特殊護甲類型,可以裝在馬上。提供 11 護甲。 + +用來將生物拴在玩家或柵欄柱 + +用來為世界上的生物命名。 + 可回復 2.5 個 {*ICON_SHANK_01*}。 使用 1 次可回復 1 個 {*ICON_SHANK_01*},總共能使用 6 次。 @@ -933,205 +1015,263 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 生物頭顱可當裝飾品或當做面具戴在頭盔空格中。 +用來執行指令。 + +朝天空發射光束,而且能夠為附近玩家提供狀態效果。 + +將方塊和物品儲存在裡面。將兩個儲物箱並排在一起,即可建立兩倍容量的大型儲物箱。陷阱儲物箱還會在開啟時建立紅石彈。 + +提供紅石彈,當板上的物品越多,彈的力量越強大。 + +提供紅石彈,板上物品越多越強大。相較於輕型板子,需要更多重量。 + +用來當成紅石能源。可製作還原回紅石。 + +用來接住物品,或是將物品送進容器或從容器取出。 + +這種類型的軌道能夠啟用或停用漏斗礦車,以及觸發 TNT 礦車。 + +用來裝物品及扔下物品,或是在獲得紅石彈時,將物品推入另一個容器。 + +為硬化黏土染色,即可製作彩色方塊。 + +能夠餵食馬、驢或騾,最多治癒 10 顆心。加快小馬和小驢生長的速度。 + +在熔爐熔黏土即可製造出來。 + +用玻璃和染料製作。 + +用彩繪玻璃製作 + +儲存煤的壓縮方法。可以當做爐的燃料。 + 烏賊 - + 被殺死時會掉落墨囊。 - + 乳牛 - + 被殺死時會掉落皮革。您也可以用桶子來擠牛奶。 - + 綿羊 - + 被剪羊毛時會掉落羊毛 (前提是牠的羊毛還沒被剪掉)。可染色來讓綿羊擁有不同色彩的羊毛。 - + - + 被殺死時會掉落羽毛,還會隨機生蛋。 - + - + 被殺死時會掉落豬肉。您還可以使用鞍座來騎在豬上。 - + - + 狼是溫馴的動物,但當您攻擊牠時,牠就會攻擊您。您可以使用骨頭來馴服狼,這會讓牠跟著您走,並攻擊任何在攻擊您的東西。 - + Creeper - + 如果您靠太近就會爆炸! - + 骷髏 - + 會對您射箭,被殺死時會掉落箭。 - + 蜘蛛 - + 如果您靠近蜘蛛,牠就會攻擊您。蜘蛛會爬牆,被殺死時會掉落絲線。 - + 殭屍 - + 如果您靠近殭屍,殭屍就會攻擊您。 - + 殭屍 Pigman - + 殭屍 Pigman 是溫馴的怪物,但如果您攻擊整群殭屍 Pigman 中的一個,整群殭屍 Pigman 就會開始攻擊您。 - + Ghast - + 會對您發射火球,而且火球碰到東西時會爆炸。 - + 史萊姆 - + 受傷害時會分裂成數個小史萊姆。 - + Enderman - + 如果您直視 Enderman,Enderman 就會攻擊您,而且還會到處移動方塊。 - + Silverfish - + 當 Silverfish 受到攻擊時,會引來躲在附近的 Silverfish。牠們會躲在石頭方塊中。 - + 穴蜘蛛 - + 擁有毒牙。 - + Mooshroom - + 與碗一起使用可用來燉蘑菇,剪毛後會掉落蘑菇,且會變成普通的乳牛。 - + 雪人 - + 玩家可用白雪方塊和南瓜製作雪人。雪人會對製作者的敵人投擲雪球。 - + 終界龍 - + 這是出現在終界的巨大黑龍。 - + Blaze - + Blaze 是地獄裡的敵人,絕大部分皆分布在地獄要塞中。當 Blaze 被殺死時會掉落 Blaze 棒。 - + 熔岩怪 - + 熔岩怪出現於地獄,被殺死時會分裂成很多小熔岩怪,這點跟史蘭姆很像。 - + 村民 - + 豹貓 - + 分布在熱帶叢林中,餵生魚就能馴服牠們。但前提是必須讓豹貓靠近您,畢竟任何一個突然的動作都會嚇跑牠們。 - + 鐵傀儡 - + 出現來保護村落,可以用鐵塊跟南瓜製作。 - -Explosives Animator + +蝙蝠 + +這些飛行生物居住在洞窟或其他大型封閉空間。 + +女巫 + +這些敵人居住在沼澤,她們會投擲藥水攻擊您。當您殺死她們,藥水就會掉下來。 + + + +這些動物能夠馴服,接著便可供騎乘。 + + + +這些動物能夠馴服,接著便可供騎乘,而且可以裝上儲物箱。 + + + +馬和驢的後代。這些動物能夠被馴服,接著便可供人騎乘、穿戴護甲並攜帶儲物箱。 + +殭屍馬 + +骷髏馬 + +凋零怪 + +製作原料包括凋零骷髏頭和靈魂沙,他們會朝您發射爆炸骷髏頭。 + +爆炸動畫繪製者 -Concept Artist +概念藝術家 -Number Crunching and Statistics +數字運算與統計數據 -Bully Coordinator +欺負協調者 -Original Design and Code by +原始設計與編碼者 -Project Manager/Producer +專案經理/製作者 -Rest of Mojang Office +其餘 Mojang 辦公室 -Lead Game Programmer Minecraft PC +領導遊戲程式設計師 Minecraft PC -Ninja Coder +Ninja 程式編碼者 -CEO +首席執行長 -White Collar Worker +白領勞工 -Customer Support +客戶支援 -Office DJ +辦公室 DJ -Designer/Programmer Minecraft - Pocket Edition +設計者/程式設計師 Minecraft - 袖珍版 -Developer +開發者 -Chief Architect +首席建築師 -Art Developer +藝術開發者 -Game Crafter +遊戲加工者 -Director of Fun +有趣董事 -Music and Sounds +音樂與聲音 -Programming +程式設計 -Art +藝術 QA -Executive Producer +執行製作者 -Lead Producer +主管製作者 -Producer +製作者 -Test Lead +測試主管 -Lead Tester +主管測試員 -Design Team +設計團隊 -Development Team +開發團隊 -Release Management +發布管理 -Director, XBLA Publishing +董事, XBLA 公佈 -Business Development +業務開發 -Portfolio Director +投資董事 -Product Manager +製作經理 -Marketing +行銷 - Community Manager +社群經理 -Europe Localization Team +歐洲在地化團隊 -Redmond Localization Team +Redmond 在地化團隊 -Asia Localization Team +亞洲在地化團隊 -User Research Team +使用者研究團隊 -MGS Central Teams +MGS 中心團隊 -Milestone Acceptance Tester +里程碑驗收測試員 -Special Thanks +特別感謝 -Test Manager +測試經理 -Senior Test Lead +資深測試主管 SDET -Project STE +專案 STE -Additional STE +其他 STE -Test Associates +測試相關 Jon Kagstrom -Tobias Mollstam +Tobias Möllstam -Rise Lugo +Risë Lugo 木劍 @@ -1373,6 +1513,8 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 地圖 +空白地圖 + 唱片:13 唱片:Cat @@ -1475,6 +1617,28 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 Creeper 頭顱 +幽冥星 + +煙火火箭 + +煙火星 + +紅石比較器 + +TNT 礦車 + +漏斗礦車 + +鐵馬鎧 + +黃金馬鎧 + +鑽石馬鎧 + +繩索 + +名牌 + 石頭 青草方塊 @@ -1491,6 +1655,8 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 熱帶叢林厚木板 +木材厚木板 (任何類型) + 樹苗 橡樹樹苗 @@ -1827,6 +1993,193 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 骷髏 +指令方塊 + +燈塔 + +陷阱儲物箱 + +測重壓力板(輕型) + +測重壓力板(重型) + +紅石比較器 + +陽光感測器 + +紅石方塊 + +漏斗 + +啟動鐵軌 + +投擲器 + +染色黏土塊 + +乾草捆 + +硬化黏土 + +煤炭塊 + +黑色染色黏土塊 + +紅色染色黏土塊 + +綠色染色黏土塊 + +棕色染色黏土塊 + +藍色染色黏土塊 + +紫色染色黏土塊 + +青綠色染色黏土塊 + +淺灰色染色黏土塊 + +灰色染色黏土塊 + +粉紅色染色黏土塊 + +淡黃綠色染色黏土塊 + +黃色染色黏土塊 + +淺藍色染色黏土塊 + +洋紅色染色黏土塊 + +橘色染色黏土塊 + +白色染色黏土塊 + +彩繪玻璃 + +黑色彩繪玻璃 + +紅色彩繪玻璃 + +綠色彩繪玻璃 + +棕色彩繪玻璃 + +藍色彩繪玻璃 + +紫色彩繪玻璃 + +青綠色彩繪玻璃 + +淺灰色彩繪玻璃 + +灰色彩繪玻璃 + +粉紅色彩繪玻璃 + +淡黃綠色彩繪玻璃 + +黃色彩繪玻璃 + +淺藍色彩繪玻璃 + +洋紅色彩繪玻璃 + +橘色彩繪玻璃 + +白色彩繪玻璃 + +彩繪玻璃窗格 + + +黑色彩繪玻璃窗格 + + +紅色彩繪玻璃窗格 + + +綠色彩繪玻璃窗格 + +棕色彩繪玻璃窗格 + +藍色彩繪玻璃窗格 + +紫色彩繪玻璃窗格 + +青綠色彩繪玻璃窗格 + +淺灰色彩繪玻璃窗格 + +灰色彩繪玻璃窗格 + +粉紅色彩繪玻璃窗格 + +淡黃綠色彩繪玻璃窗格 + +黃色彩繪玻璃窗格 + +淺藍色彩繪玻璃窗格 + +洋紅色彩繪玻璃窗格 + +橘色彩繪玻璃窗格 + +白色彩繪玻璃窗格 + +小球 + +大球 + +星型 + +Creeper 型 + +爆裂 + +不明形狀 + +黑色 + +紅色 + +綠色 + +棕色 + +藍色 + +紫色 + +青綠色 + +淺灰色 + +灰色 + +粉紅色 + +淡黃綠色 + +黃色 + +淺藍色 + +洋紅色 + +橘色 + +白色 + +自訂 + +淡化 + +閃爍 + +鐵軌 + +戰鬥持續時間: +  目前的控制方式 配置 @@ -2004,8 +2357,7 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 這是您的物品欄。這裡會顯示可在您手中使用的物品,以及您身上的所有其他物品。您穿戴的護甲也會顯示在這裡。 - - + {*B*} 請按下 {*CONTROLLER_VK_A*} 來繼續。{*B*} 如果您已經了解物品欄的使用方式,請按下 {*CONTROLLER_VK_B*}。 @@ -2026,7 +2378,7 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 - 如果您想知道某個物品的詳細資訊,只要把游標移動到該物品上面,然後按下 {*CONTROLLER_VK_RT*} 即可。 + 如果您想知道某個物品的詳細資訊,只要把游標移動到該物品上面,然後按下{*CONTROLLER_ACTION_MENU_PAGEDOWN*}即可。 @@ -2060,7 +2412,7 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 - 如果您想知道某個物品的詳細資訊,只要把游標移動到該物品上面,然後按下 {*CONTROLLER_VK_RT*} 即可。 + 如果您想知道某個物品的詳細資訊,只要把游標移動到該物品上面,然後按下{*CONTROLLER_ACTION_MENU_PAGEDOWN*}即可。 @@ -2606,6 +2958,211 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 如果您已經了解食物列的使用方式,以及吃東西的方法,請按下 {*CONTROLLER_VK_B*} 。 + + 這是馬的物品欄介面。 + + + + {*B*}按下{*CONTROLLER_VK_A*} 繼續。 + {*B*}如果您已經知道如何使用馬物品欄,請按下{*CONTROLLER_VK_B*}。 + + + + 馬物品欄能讓您傳送或安裝物品至馬、驢或騾身上。 + + + + 在馬鞍空格放置馬鞍,即可為馬裝上馬鞍。在護甲空格放置馬護甲,即可為馬裝上護甲。 + + + + 您還可以在這個選單中,於自己的物品欄與綁在驢和騾的鞍囊之間傳送物品。 + + +您發現了一匹馬。 + +您發現了一匹驢。 + +您發現了一匹騾。 + + + {*B*}按下{*CONTROLLER_VK_A*} 進一步瞭解馬、驢和騾。 + {*B*}如果您已經瞭解馬、驢和騾,請按下{*CONTROLLER_VK_B*}。 + + + + 馬和驢居住在開闊的平原。驢和馬交配即可產下騾,但是本身不具生育能力。 + + + + 所有成年的馬、驢和騾都可供騎乘,但是只有馬能夠穿上護甲,只有騾和驢可以裝上鞍囊運輸物品。 + + + + 馬、驢和騾必須先馴服才堪用。馴服馬的方式是騎上去,過程中馬會想辦法將騎士摔下馬背,騎士必須想辦法留在馬背上。 + + + + 當愛心出現在馬的周圍時,牠已經被馴服,再也不會把玩家摔下馬背。 + + + + 馬上嘗試騎這匹馬。手上不要拿物品或工具,使用 {*CONTROLLER_ACTION_USE*} 騎上馬背。 + + + + 您必須幫馬裝上馬鞍,才能操縱馬的方向。馬鞍可以向村民購買,或是從藏在世界中的儲物箱尋找。 + + + + 裝上儲物箱,就能為馴服的驢和騾加鞍囊。騎乘或潛行時就能使用這些鞍囊。 + + + + 餵食金蘋果或金蘿蔔即可繁殖馬和驢,就像繁殖其他動物一樣(但是騾不行)。小馬經過一段時間就會長成成年馬,不過如果餵食小麥或乾草就會加速長大。 + + + + 您可以嘗試在這裡馴服馬和驢,這裡附近的儲物箱裡面,還有馬鞍、馬鎧及其他實用的馬相關物品。 + + + + 這是燈塔介面,可用來選擇燈塔要授與哪種力量。 + + + + {*B*}按下{*CONTROLLER_VK_A*} 繼續。 + {*B*}如果您已經知道如何使用燈塔介面,請按下{*CONTROLLER_VK_B*}。 + + + + 您可以在燈塔選單中,為燈塔選取一種主要的力量。金字塔越多層,可供選擇的力量越多。 + + + + 至少有四層的金字塔上的燈塔,還能夠讓您選擇再生次要力量或是更強大的主要力量。 + + + + 您必須在付費空格奉上翡翠、鑽石、黃金或鐵塊,才能設定燈塔的力量。設定後,燈塔就會無限期發出力量。 + + +這座金字塔上方有停用的燈塔。 + + + {*B*}按下{*CONTROLLER_VK_A*} 進一步瞭解燈塔。 + {*B*}如果您已經瞭解燈塔,請按下{*CONTROLLER_VK_B*}。 + + + + 啟動的燈塔會向天空投射明亮的光束,賦予附近的玩家力量。製作燈塔的材料包括玻璃、黑曜石和幽冥星,擊敗凋零怪即可獲得。 + + + + 燈塔必須放置,白天才能在沐浴在陽光之下。燈塔必須放置於鐵、黃金、翡翠或鑽石金字塔上,不過選擇的材料不會影響燈塔的力量。 + + + + 嘗試用燈塔設定它所賦予的力量,您可以拿隨附鐵塊支付必要費用。 + + +這個房間內有漏斗 + + + {*B*}按下{*CONTROLLER_VK_A*} 進一步瞭解漏斗。 + {*B*}如果您已經瞭解漏斗,請按下{*CONTROLLER_VK_B*}。 + + + + 您可以使用漏斗將物品插入容器或是從容器移除物品,以及自動拾取丟入容器的物品。 + + + + 漏斗能夠影響釀造台、儲物箱、發射器、投擲器、運輸礦車、漏斗礦車及其他漏斗。 + + + + 漏斗會一直嘗試從放在上方的合適容器吸取物品,還會嘗試將儲存的物品插入輸出容器。 + + + + 然而,如果漏斗是用紅石發電就會停用,並且停止吸取和插入物品。 + + + + 漏斗會指向嘗試輸出物品的方向。若要讓漏斗指向特定方塊,潛行時將漏斗放在背對該方塊的位置即可。 + + + + 在這個房間裡面,有好幾種實用的漏斗配置供您參考與實驗。 + + + + 這是煙火介面,可以用來製作煙火和煙火星。 + + + + {*B*}按下{*CONTROLLER_VK_A*} 繼續。 + {*B*}如果您已經知道如何使用燈塔介面,請按下{*CONTROLLER_VK_B*}。 + + + + \若要製作煙火,請將火藥和紙放在庫存上方的 3x3 工作台。 + + + + \您可以選擇在工作台放置多顆煙火星,加入煙火。 + + + + 用火藥在工作台填滿的空格越多,所有煙火星會爆炸的高度越高。 + + + + 然後等您想製作時,便可從輸出空格取出製作的煙火。 + + + + 將火藥和染料放進工作台,即可製作煙火星。 + + + + 染料會決定煙火星爆炸的顏色。 + + + + 煙火星的形狀取決於加入火焰彈、金塊、羽毛或生物的頭。 + + + + 使用鑽石或螢光粉即可新增尾巴或閃爍。 + + + + 煙火星製作完成後,以染料製作即可決定煙火星的淡出顏色。 + + + + 此處儲物箱內有製作煙火用的各種物品! + + + + {*B*}按下{*CONTROLLER_VK_A*} 即可進一步瞭解煙火。 + {*B*}如果您已經瞭解煙火,請按下{*CONTROLLER_VK_B*}。 + + + + 煙火屬於裝飾品,可以手動或利用發射器發射,製作的材料包括紙、火藥,也有人會選擇加入幾顆煙火星。 + + + + 煙火星的顏色、淡化、形狀、大小與效果 (例如尾巴和閃爍) 可自訂,方法是在製作時加入額外材料。 + + + + 嘗試用儲物箱內的各式各樣材料製作煙火。 + +  選取 使用 @@ -2724,7 +3281,7 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 播放 -騎/搭乘 +搭乘 乘船 @@ -2828,6 +3385,22 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 上傳供 Xbox One 使用的存檔 +騎上 + +下馬 + +騎下 + +發射 + +栓住 + +射箭 + +裝上 + +命名 + 確定 取消 @@ -3142,6 +3715,20 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 發射器 + + +投擲器 + +漏斗 + +燈塔 + +主要力量 + +次要力量 + +礦車 + 這款遊戲目前沒有此類型的下載內容。 %s 已經加入遊戲。 @@ -3301,10 +3888,14 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 遊戲模式:創造 +遊戲模式:冒險 + 生存 創造 +冒險 + 在生存模式中建立 在創造模式中建立 @@ -3325,6 +3916,8 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 非常平坦 +輸入種子,再度產生相同的地形。留白會隨機挑選世界。 + 啟用時,本遊戲將成為線上遊戲。 啟用時,只限被邀請的玩家加入。 @@ -3349,6 +3942,20 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 啟用時,玩家的再生點附近會有個裝著有用物品的箱子。 +停用時,怪物和動物無法變更方塊(例如:Creeper 爆炸不會摧毀方塊,綿羊無法移除草)或拾起物品 + +啟用時,玩家死掉時可以保留物品欄。 + +停用時,生物不會自然重生。 + +停用時,怪物和動物不會落下戰利品(例如:Creeper 不會落下火藥)。 + +停用時,方塊摧毀時不會落下物品(例如,石頭方塊不會落下鵝卵石)。 + +停用時,玩家不會自然恢復生命值。 + +停用時,時間不會更改。 + 角色外觀套件 主題 @@ -3397,7 +4004,49 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 {*PLAYER*} 被 {*SOURCE*} 的拳頭打死了 -{*PLAYER*} 已被 {*SOURCE*} 殺死。 +{*PLAYER*} 已被 {*SOURCE*} 用魔法殺死 + +{*PLAYER*} 從梯子跌落 + +{*PLAYER*} 從藤蔓跌落 + +{*PLAYER*} 從水中掉出來 + +{*PLAYER*} 從高處跌落 + +{*PLAYER*} 受到 {*SOURCE*} 的跌落詛咒 + +{*PLAYER*} 受到 {*SOURCE*} 的跌落詛咒 + +{*PLAYER*} 受到 {*SOURCE*} 利用 {*ITEM*} 的跌落詛咒 + +{*PLAYER*} 跌落距離太遠,遭到 {*SOURCE*} 消滅 + +{*PLAYER*} 跌落距離太遠,遭到 {*SOURCE*} 用 {*ITEM*} 消滅 + +{*PLAYER*} 在與 {*SOURCE*} 作戰時走入火中 + +{*PLAYER*} 在與 {*SOURCE*} 作戰時燒成灰燼 + +{*PLAYER*} 嘗試在岩漿中游泳,以逃離 {*SOURCE*} + +{*PLAYER*} 在嘗試逃離 {*SOURCE*} 時溺水 + +{*PLAYER*} 在嘗試逃離 {*SOURCE*} 時走入仙人掌 + +{*PLAYER*} 遭 {*SOURCE*} 轟炸 + +{*PLAYER*} 已凋零 + +{*PLAYER*} 已被 {*SOURCE*} 用 {*ITEM*} 屠殺 + +{*PLAYER*} 已被 {*SOURCE*} 用 {*ITEM*} 射死 + +{*PLAYER*} 已被 {*SOURCE*} 用 {*ITEM*} 遭火球擊中 + +{*PLAYER*} 已被 {*SOURCE*} 用 {*ITEM*} 搥打 + +{*PLAYER*} 已被 {*SOURCE*} 用 {*ITEM*} 殺死 基岩迷霧 @@ -3574,6 +4223,8 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 目前已達到遊戲世界的烏賊數量上限,無法使用角色蛋。 +目前已達到遊戲世界的村民數量上限,無法使用角色蛋。 + 目前已達到遊戲世界的敵人數量上限,無法使用角色蛋。 目前已達到遊戲世界的村民數量上限,無法使用角色蛋。 @@ -3588,6 +4239,8 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 雞已達到繁殖數量上限,該動物無法進入戀愛模式。 +這種動物不能進入愛情模式,已經達到繁殖馬的數量上限。 + Mooshrooms 已達到繁殖數量上限,該動物無法進入戀愛模式。 目前這個世界的小船已達到數量上限。 @@ -3615,27 +4268,43 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 製作群 重新安裝內容 - + 偵錯設定 - + 火會蔓延 - + 炸藥會爆炸 - + 玩家對玩家 - + 信任玩家 - + 主持人特權 - + 產生建築 - + 非常平坦的世界 - + 贈品箱 - + 世界選項 - + +遊戲選項 + +生物惡意破壞 + +保留物品欄 + +生物重生 + +生物戰利品 + +磚塊掉落 + +自然再生 + +陽光循環 + 可以建造和開採 可以使用門與開關 @@ -3822,6 +4491,14 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 巨毒 +凋零怪 + +生命值加乘 + +吸收 + +飽和 + 敏捷 緩慢 @@ -3860,6 +4537,14 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 巨毒 +腐朽 + +生命值加乘 + +吸收 + +飽和 + 2 @@ -3956,6 +4641,22 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 隨著時間自動減少受影響玩家、動物和怪物的生命值。 +套用時: + +馬跳躍力量 + +殭屍援軍 + +生命值上限 + +生物跟蹤範圍 + +擊退防禦力 + +速度 + +攻擊殺傷力 + 鋒利 重擊 @@ -4046,7 +4747,7 @@ Xbox One 主機上的 Minecraft 預設為多人遊戲。如果您選擇高畫質 可回復 3 點 {*ICON_SHANK_01*}。在熔爐中烹煮馬鈴薯即可獲得。 -可回復 1 個 {*ICON_SHANK_01*},或可在熔爐中烹煮。可以栽種在農地上。食用可能會讓您中毒。 +可回復 1 個 {*ICON_SHANK_01*}。 吃這個可能會讓您中毒。 可回復 3 個 {*ICON_SHANK_01*}。用胡蘿蔔和碎金塊精製而成。 diff --git a/Minecraft.Assets/meson.build b/Minecraft.Assets/meson.build index 2bfbd5c22..f783f3d71 100644 --- a/Minecraft.Assets/meson.build +++ b/Minecraft.Assets/meson.build @@ -61,6 +61,7 @@ archive_sources_movies1080 = [ 'Common/Media/skinHDLabels.swf', 'Common/Media/skinHDInGame.swf', 'Common/Media/AnvilMenu1080.swf', + 'Common/Media/BeaconMenu1080.swf', 'Common/Media/BrewingStandMenu1080.swf', 'Common/Media/ChestMenu1080.swf', 'Common/Media/ChestLargeMenu1080.swf', @@ -85,9 +86,12 @@ archive_sources_movies1080 = [ 'Common/Media/EnchantingMenu1080.swf', 'Common/Media/EndPoem1080.swf', 'Common/Media/EULA1080.swf', + 'Common/Media/FireworksMenu1080.swf', 'Common/Media/FullscreenProgress1080.swf', 'Common/Media/FurnaceMenu1080.swf', 'Common/Media/HelpAndOptionsMenu1080.swf', + 'Common/Media/HopperMenu1080.swf', + 'Common/Media/HorseInventoryMenu1080.swf', 'Common/Media/HowToPlay1080.swf', 'Common/Media/HowToPlayMenu1080.swf', 'Common/Media/HUD1080.swf', @@ -98,6 +102,8 @@ archive_sources_movies1080 = [ 'Common/Media/Intro1080.swf', 'Common/Media/InventoryMenu1080.swf', 'Common/Media/JoinMenu1080.swf', + 'Common/Media/LanguagesMenu1080.swf', + 'Common/Media/LanguagesMenuSplit1080.swf', 'Common/Media/LoadOrJoinMenu1080.swf', 'Common/Media/LaunchMoreOptionsMenu1080.swf', 'Common/Media/LeaderboardMenu1080.swf', @@ -126,6 +132,7 @@ archive_sources_movies1080 = [ 'Common/Media/TradingMenu1080.swf', 'Common/Media/TutorialPopup1080.swf', 'Common/Media/AnvilMenuSplit1080.swf', + 'Common/Media/BeaconMenuSplit1080.swf', 'Common/Media/BrewingStandMenuSplit1080.swf', 'Common/Media/ChestMenuSplit1080.swf', 'Common/Media/ChestLargeMenuSplit1080.swf', @@ -136,9 +143,12 @@ archive_sources_movies1080 = [ 'Common/Media/DeathMenuSplit1080.swf', 'Common/Media/DispenserMenuSplit1080.swf', 'Common/Media/EnchantingMenuSplit1080.swf', + 'Common/Media/FireworksMenuSplit1080.swf', 'Common/Media/FurnaceMenuSplit1080.swf', 'Common/Media/FullscreenProgressSplit1080.swf', 'Common/Media/HelpAndOptionsMenuSplit1080.swf', + 'Common/Media/HopperMenuSplit1080.swf', + 'Common/Media/HorseInventoryMenuSplit1080.swf', 'Common/Media/HowToPlaySplit1080.swf', 'Common/Media/HowToPlayMenuSplit1080.swf', 'Common/Media/HUDSplit1080.swf', diff --git a/Minecraft.Client/GameState/CreativeMode.cpp b/Minecraft.Client/GameState/CreativeMode.cpp index 86cb9ecc5..54632e602 100644 --- a/Minecraft.Client/GameState/CreativeMode.cpp +++ b/Minecraft.Client/GameState/CreativeMode.cpp @@ -2,8 +2,6 @@ #include "CreativeMode.h" #include "../Player/User.h" #include "../Player/LocalPlayer.h" -#include "../Level/MultiPlayerLevel.h" -#include "../Player/MultiPlayerLocalPlayer.h" #include "../../Minecraft.World/Headers/net.minecraft.world.entity.player.h" #include "../../Minecraft.World/Headers/net.minecraft.world.item.h" #include "../../Minecraft.World/Headers/net.minecraft.world.inventory.h" diff --git a/Minecraft.Client/GameState/DemoMode.cpp b/Minecraft.Client/GameState/DemoMode.cpp index 7b9a01bc0..8794ea9fc 100644 --- a/Minecraft.Client/GameState/DemoMode.cpp +++ b/Minecraft.Client/GameState/DemoMode.cpp @@ -11,8 +11,8 @@ void DemoMode::tick() { SurvivalMode::tick(); /* 4J - TODO - seems unlikely we need this demo mode anyway - __int64 time = minecraft->level->getTime(); - __int64 day = (time / Level::TICKS_PER_DAY) + 1; + int64_t time = minecraft->level->getTime(); + int64_t day = (time / Level::TICKS_PER_DAY) + 1; demoHasEnded = (time > (500 + Level::TICKS_PER_DAY * DEMO_DAYS)); if (demoHasEnded) @@ -25,13 +25,13 @@ void DemoMode::tick() { if (day <= (DEMO_DAYS + 1)) { minecraft->gui->displayClientMessage(L"demo.day." + - _toString<__int64>(day)); + _toString(day)); } } else if (day == 1) { Options *options = minecraft->options; - std::wstring message; + wstring message; if (time == 100) { minecraft.gui.addMessage("Seed: " + minecraft.level.getSeed()); diff --git a/Minecraft.Client/GameState/DispenserBootstrap.cpp b/Minecraft.Client/GameState/DispenserBootstrap.cpp new file mode 100644 index 000000000..7eaa38011 --- /dev/null +++ b/Minecraft.Client/GameState/DispenserBootstrap.cpp @@ -0,0 +1 @@ +#include "../Platform/stdafx.h" \ No newline at end of file diff --git a/Minecraft.Client/GameState/DispenserBootstrap.h b/Minecraft.Client/GameState/DispenserBootstrap.h new file mode 100644 index 000000000..da22d8244 --- /dev/null +++ b/Minecraft.Client/GameState/DispenserBootstrap.h @@ -0,0 +1,38 @@ +#pragma once +#include "../../Minecraft.World/Headers/net.minecraft.world.item.h" +#include "../../Minecraft.World/Blocks/DispenserTile.h" +#include "../../Minecraft.World/Headers/net.minecraft.core.h" +#include "../../Minecraft.World/Level/Events/LevelEvent.h" + +class DispenserBootstrap { +public: + static void bootStrap() { + DispenserTile::REGISTRY.add(Item::arrow, new ArrowDispenseBehavior()); + DispenserTile::REGISTRY.add(Item::egg, new EggDispenseBehavior()); + DispenserTile::REGISTRY.add(Item::snowBall, + new SnowballDispenseBehavior()); + DispenserTile::REGISTRY.add(Item::expBottle, + new ExpBottleDispenseBehavior()); + + DispenserTile::REGISTRY.add(Item::potion, new PotionDispenseBehavior()); + DispenserTile::REGISTRY.add(Item::spawnEgg, + new SpawnEggDispenseBehavior()); + DispenserTile::REGISTRY.add(Item::fireworks, + new FireworksDispenseBehavior()); + DispenserTile::REGISTRY.add(Item::fireball, + new FireballDispenseBehavior()); + DispenserTile::REGISTRY.add(Item::boat, new BoatDispenseBehavior()); + DispenserTile::REGISTRY.add(Item::bucket_lava, + new FilledBucketDispenseBehavior()); + DispenserTile::REGISTRY.add(Item::bucket_water, + new FilledBucketDispenseBehavior()); + DispenserTile::REGISTRY.add(Item::bucket_empty, + new EmptyBucketDispenseBehavior()); + DispenserTile::REGISTRY.add(Item::flintAndSteel, + new FlintAndSteelDispenseBehavior()); + DispenserTile::REGISTRY.add(Item::dye_powder, + new DyeDispenseBehavior()); + DispenserTile::REGISTRY.add(Item::items[Tile::tnt_Id], + new TntDispenseBehavior()); + } +}; \ No newline at end of file diff --git a/Minecraft.Client/GameState/GameMode.cpp b/Minecraft.Client/GameState/GameMode.cpp index eddaa7612..2b1790ca3 100644 --- a/Minecraft.Client/GameState/GameMode.cpp +++ b/Minecraft.Client/GameState/GameMode.cpp @@ -1,7 +1,6 @@ #include "../Platform/stdafx.h" #include "GameMode.h" #include "../Player/LocalPlayer.h" -#include "../Level/MultiPlayerLevel.h" #include "../Rendering/LevelRenderer.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.tile.h" @@ -47,9 +46,7 @@ bool GameMode::destroyBlock(int x, int y, int z, int face) { void GameMode::render(float a) {} bool GameMode::useItem(std::shared_ptr player, Level* level, - std::shared_ptr item, bool bTestUseOnly) { - return false; -} + std::shared_ptr item, bool bTestUseOnly) {} void GameMode::initPlayer(std::shared_ptr player) {} @@ -57,8 +54,8 @@ void GameMode::tick() {} void GameMode::adjustPlayer(std::shared_ptr player) {} -// bool GameMode::useItemOn(std::shared_ptr player, Level *level, -// std::shared_ptr item, int x, int y, int z, int face, bool +// bool GameMode::useItemOn(shared_ptr player, Level *level, +// shared_ptr item, int x, int y, int z, int face, bool // bTestUseOnOnly) //{ // // 4J-PB - Adding a test only version to allow tooltips to be displayed @@ -72,7 +69,7 @@ void GameMode::adjustPlayer(std::shared_ptr player) {} // case Tile::recordPlayer_Id: // case Tile::bed_Id: // special case for a bed // if (Tile::tiles[t]->TestUse(level, x, y, z, -//player )) +// player )) // { // return true; // } @@ -90,7 +87,7 @@ void GameMode::adjustPlayer(std::shared_ptr player) {} // else // { // if (Tile::tiles[t]->use(level, x, y, z, player )) return -//true; +// true; // } // } // diff --git a/Minecraft.Client/GameState/Options.cpp b/Minecraft.Client/GameState/Options.cpp index eb71c4a72..e8e24827d 100644 --- a/Minecraft.Client/GameState/Options.cpp +++ b/Minecraft.Client/GameState/Options.cpp @@ -162,7 +162,7 @@ void Options::init() { fixedCamera = false; flySpeed = 1; cameraSpeed = 1; - guiScale = 0; + guiScale = 3; particles = 0; fov = 0; gamma = 0; diff --git a/Minecraft.Client/GameState/StatsCounter.cpp b/Minecraft.Client/GameState/StatsCounter.cpp index a03bd236c..b5c01e738 100644 --- a/Minecraft.Client/GameState/StatsCounter.cpp +++ b/Minecraft.Client/GameState/StatsCounter.cpp @@ -479,11 +479,11 @@ void StatsCounter::writeStats() { scores[viewCount].m_commentData.m_mining.m_dirt = getValue(Stats::blocksMined[Tile::dirt->id], eDifficulty_Peaceful); scores[viewCount].m_commentData.m_mining.m_cobblestone = getValue( - Stats::blocksMined[Tile::stoneBrick->id], eDifficulty_Peaceful); + Stats::blocksMined[Tile::cobblestone->id], eDifficulty_Peaceful); scores[viewCount].m_commentData.m_mining.m_sand = getValue(Stats::blocksMined[Tile::sand->id], eDifficulty_Peaceful); scores[viewCount].m_commentData.m_mining.m_stone = - getValue(Stats::blocksMined[Tile::rock->id], eDifficulty_Peaceful); + getValue(Stats::blocksMined[Tile::stone->id], eDifficulty_Peaceful); scores[viewCount].m_commentData.m_mining.m_gravel = getValue( Stats::blocksMined[Tile::gravel->id], eDifficulty_Peaceful); scores[viewCount].m_commentData.m_mining.m_clay = @@ -516,11 +516,11 @@ void StatsCounter::writeStats() { scores[viewCount].m_commentData.m_mining.m_dirt = getValue(Stats::blocksMined[Tile::dirt->id], eDifficulty_Easy); scores[viewCount].m_commentData.m_mining.m_cobblestone = getValue( - Stats::blocksMined[Tile::stoneBrick->id], eDifficulty_Easy); + Stats::blocksMined[Tile::cobblestone->id], eDifficulty_Easy); scores[viewCount].m_commentData.m_mining.m_sand = getValue(Stats::blocksMined[Tile::sand->id], eDifficulty_Easy); scores[viewCount].m_commentData.m_mining.m_stone = - getValue(Stats::blocksMined[Tile::rock->id], eDifficulty_Easy); + getValue(Stats::blocksMined[Tile::stone->id], eDifficulty_Easy); scores[viewCount].m_commentData.m_mining.m_gravel = getValue(Stats::blocksMined[Tile::gravel->id], eDifficulty_Easy); scores[viewCount].m_commentData.m_mining.m_clay = @@ -553,11 +553,11 @@ void StatsCounter::writeStats() { scores[viewCount].m_commentData.m_mining.m_dirt = getValue(Stats::blocksMined[Tile::dirt->id], eDifficulty_Normal); scores[viewCount].m_commentData.m_mining.m_cobblestone = getValue( - Stats::blocksMined[Tile::stoneBrick->id], eDifficulty_Normal); + Stats::blocksMined[Tile::cobblestone->id], eDifficulty_Normal); scores[viewCount].m_commentData.m_mining.m_sand = getValue(Stats::blocksMined[Tile::sand->id], eDifficulty_Normal); scores[viewCount].m_commentData.m_mining.m_stone = - getValue(Stats::blocksMined[Tile::rock->id], eDifficulty_Normal); + getValue(Stats::blocksMined[Tile::stone->id], eDifficulty_Normal); scores[viewCount].m_commentData.m_mining.m_gravel = getValue(Stats::blocksMined[Tile::gravel->id], eDifficulty_Normal); scores[viewCount].m_commentData.m_mining.m_clay = @@ -590,11 +590,11 @@ void StatsCounter::writeStats() { scores[viewCount].m_commentData.m_mining.m_dirt = getValue(Stats::blocksMined[Tile::dirt->id], eDifficulty_Hard); scores[viewCount].m_commentData.m_mining.m_cobblestone = getValue( - Stats::blocksMined[Tile::stoneBrick->id], eDifficulty_Hard); + Stats::blocksMined[Tile::cobblestone->id], eDifficulty_Hard); scores[viewCount].m_commentData.m_mining.m_sand = getValue(Stats::blocksMined[Tile::sand->id], eDifficulty_Hard); scores[viewCount].m_commentData.m_mining.m_stone = - getValue(Stats::blocksMined[Tile::rock->id], eDifficulty_Hard); + getValue(Stats::blocksMined[Tile::stone->id], eDifficulty_Hard); scores[viewCount].m_commentData.m_mining.m_gravel = getValue(Stats::blocksMined[Tile::gravel->id], eDifficulty_Hard); scores[viewCount].m_commentData.m_mining.m_clay = @@ -627,9 +627,9 @@ void StatsCounter::writeStats() { scores[viewCount].m_commentData.m_farming.m_eggs = getValue( Stats::itemsCollected[Item::egg->id], eDifficulty_Peaceful); scores[viewCount].m_commentData.m_farming.m_wheat = - getValue(Stats::blocksMined[Tile::crops_Id], eDifficulty_Peaceful); + getValue(Stats::blocksMined[Tile::wheat_Id], eDifficulty_Peaceful); scores[viewCount].m_commentData.m_farming.m_mushroom = getValue( - Stats::blocksMined[Tile::mushroom1_Id], eDifficulty_Peaceful); + Stats::blocksMined[Tile::mushroom_brown_Id], eDifficulty_Peaceful); scores[viewCount].m_commentData.m_farming.m_sugarcane = getValue(Stats::blocksMined[Tile::reeds_Id], eDifficulty_Peaceful); scores[viewCount].m_commentData.m_farming.m_milk = @@ -660,9 +660,9 @@ void StatsCounter::writeStats() { scores[viewCount].m_commentData.m_farming.m_eggs = getValue(Stats::itemsCollected[Item::egg->id], eDifficulty_Easy); scores[viewCount].m_commentData.m_farming.m_wheat = - getValue(Stats::blocksMined[Tile::crops_Id], eDifficulty_Easy); - scores[viewCount].m_commentData.m_farming.m_mushroom = - getValue(Stats::blocksMined[Tile::mushroom1_Id], eDifficulty_Easy); + getValue(Stats::blocksMined[Tile::wheat_Id], eDifficulty_Easy); + scores[viewCount].m_commentData.m_farming.m_mushroom = getValue( + Stats::blocksMined[Tile::mushroom_brown_Id], eDifficulty_Easy); scores[viewCount].m_commentData.m_farming.m_sugarcane = getValue(Stats::blocksMined[Tile::reeds_Id], eDifficulty_Easy); scores[viewCount].m_commentData.m_farming.m_milk = @@ -694,9 +694,9 @@ void StatsCounter::writeStats() { scores[viewCount].m_commentData.m_farming.m_eggs = getValue(Stats::itemsCollected[Item::egg->id], eDifficulty_Normal); scores[viewCount].m_commentData.m_farming.m_wheat = - getValue(Stats::blocksMined[Tile::crops_Id], eDifficulty_Normal); + getValue(Stats::blocksMined[Tile::wheat_Id], eDifficulty_Normal); scores[viewCount].m_commentData.m_farming.m_mushroom = getValue( - Stats::blocksMined[Tile::mushroom1_Id], eDifficulty_Normal); + Stats::blocksMined[Tile::mushroom_brown_Id], eDifficulty_Normal); scores[viewCount].m_commentData.m_farming.m_sugarcane = getValue(Stats::blocksMined[Tile::reeds_Id], eDifficulty_Normal); scores[viewCount].m_commentData.m_farming.m_milk = @@ -727,9 +727,9 @@ void StatsCounter::writeStats() { scores[viewCount].m_commentData.m_farming.m_eggs = getValue(Stats::itemsCollected[Item::egg->id], eDifficulty_Hard); scores[viewCount].m_commentData.m_farming.m_wheat = - getValue(Stats::blocksMined[Tile::crops_Id], eDifficulty_Hard); - scores[viewCount].m_commentData.m_farming.m_mushroom = - getValue(Stats::blocksMined[Tile::mushroom1_Id], eDifficulty_Hard); + getValue(Stats::blocksMined[Tile::wheat_Id], eDifficulty_Hard); + scores[viewCount].m_commentData.m_farming.m_mushroom = getValue( + Stats::blocksMined[Tile::mushroom_brown_Id], eDifficulty_Hard); scores[viewCount].m_commentData.m_farming.m_sugarcane = getValue(Stats::blocksMined[Tile::reeds_Id], eDifficulty_Hard); scores[viewCount].m_commentData.m_farming.m_milk = @@ -880,6 +880,8 @@ void StatsCounter::writeStats() { app.DebugPrintf("Successfully wrote %d leadeboard views\n", viewCount); } + } else { + delete[] scores; } #elif defined _XBOX @@ -890,32 +892,32 @@ void StatsCounter::writeStats() { XUSER_PROPERTY killsEasyProperties[LeaderboardManager::eProperty_Kills_Max]; XUSER_PROPERTY - killsNormalProperties[LeaderboardManager::eProperty_Kills_Max]; + killsNormalProperties[LeaderboardManager::eProperty_Kills_Max]; XUSER_PROPERTY killsHardProperties[LeaderboardManager::eProperty_Kills_Max]; XUSER_PROPERTY miningBlocksPeacefulProperties [LeaderboardManager::eProperty_Mining_Max]; XUSER_PROPERTY - miningBlocksEasyProperties[LeaderboardManager::eProperty_Mining_Max]; + miningBlocksEasyProperties[LeaderboardManager::eProperty_Mining_Max]; XUSER_PROPERTY - miningBlocksNormalProperties[LeaderboardManager::eProperty_Mining_Max]; + miningBlocksNormalProperties[LeaderboardManager::eProperty_Mining_Max]; XUSER_PROPERTY - miningBlocksHardProperties[LeaderboardManager::eProperty_Mining_Max]; + miningBlocksHardProperties[LeaderboardManager::eProperty_Mining_Max]; XUSER_PROPERTY - farmingPeacefulProperties[LeaderboardManager::eProperty_Farming_Max]; + farmingPeacefulProperties[LeaderboardManager::eProperty_Farming_Max]; XUSER_PROPERTY - farmingEasyProperties[LeaderboardManager::eProperty_Farming_Max]; + farmingEasyProperties[LeaderboardManager::eProperty_Farming_Max]; XUSER_PROPERTY - farmingNormalProperties[LeaderboardManager::eProperty_Farming_Max]; + farmingNormalProperties[LeaderboardManager::eProperty_Farming_Max]; XUSER_PROPERTY - farmingHardProperties[LeaderboardManager::eProperty_Farming_Max]; + farmingHardProperties[LeaderboardManager::eProperty_Farming_Max]; XUSER_PROPERTY travellingPeacefulProperties [LeaderboardManager::eProperty_Travelling_Max]; XUSER_PROPERTY - travellingEasyProperties[LeaderboardManager::eProperty_Travelling_Max]; + travellingEasyProperties[LeaderboardManager::eProperty_Travelling_Max]; XUSER_PROPERTY travellingNormalProperties [LeaderboardManager::eProperty_Travelling_Max]; XUSER_PROPERTY - travellingHardProperties[LeaderboardManager::eProperty_Travelling_Max]; + travellingHardProperties[LeaderboardManager::eProperty_Travelling_Max]; XUSER_PROPERTY travellingProperties[1]; // arcade leaderboard if (modifiedBoards & LEADERBOARD_KILLS_EASY) { @@ -1118,10 +1120,11 @@ void StatsCounter::writeStats() { rating = getValue(Stats::blocksMined[Tile::dirt->id], eDifficulty_Peaceful) + - getValue(Stats::blocksMined[Tile::stoneBrick->id], + getValue(Stats::blocksMined[Tile::cobblestone->id], eDifficulty_Peaceful) + getValue(Stats::blocksMined[Tile::sand->id], eDifficulty_Peaceful) + - getValue(Stats::blocksMined[Tile::rock->id], eDifficulty_Peaceful) + + getValue(Stats::blocksMined[Tile::stone->id], + eDifficulty_Peaceful) + getValue(Stats::blocksMined[Tile::gravel->id], eDifficulty_Peaceful) + getValue(Stats::blocksMined[Tile::clay->id], eDifficulty_Peaceful) + @@ -1137,7 +1140,7 @@ void StatsCounter::writeStats() { &miningBlocksPeacefulProperties [LeaderboardManager::eProperty_Mining_Stone], PROPERTY_MINED_STONE, - getValue(Stats::blocksMined[Tile::stoneBrick->id], + getValue(Stats::blocksMined[Tile::cobblestone->id], eDifficulty_Peaceful)); setLeaderboardProperty( &miningBlocksPeacefulProperties @@ -1148,7 +1151,8 @@ void StatsCounter::writeStats() { &miningBlocksPeacefulProperties [LeaderboardManager::eProperty_Mining_Cobblestone], PROPERTY_MINED_COBBLESTONE, - getValue(Stats::blocksMined[Tile::rock->id], eDifficulty_Peaceful)); + getValue(Stats::blocksMined[Tile::stone->id], + eDifficulty_Peaceful)); setLeaderboardProperty( &miningBlocksPeacefulProperties [LeaderboardManager::eProperty_Mining_Gravel], @@ -1183,10 +1187,10 @@ void StatsCounter::writeStats() { rating = getValue(Stats::blocksMined[Tile::dirt->id], eDifficulty_Easy) + - getValue(Stats::blocksMined[Tile::stoneBrick->id], + getValue(Stats::blocksMined[Tile::cobblestone->id], eDifficulty_Easy) + getValue(Stats::blocksMined[Tile::sand->id], eDifficulty_Easy) + - getValue(Stats::blocksMined[Tile::rock->id], eDifficulty_Easy) + + getValue(Stats::blocksMined[Tile::stone->id], eDifficulty_Easy) + getValue(Stats::blocksMined[Tile::gravel->id], eDifficulty_Easy) + getValue(Stats::blocksMined[Tile::clay->id], eDifficulty_Easy) + getValue(Stats::blocksMined[Tile::obsidian->id], eDifficulty_Easy); @@ -1200,7 +1204,7 @@ void StatsCounter::writeStats() { &miningBlocksEasyProperties [LeaderboardManager::eProperty_Mining_Stone], PROPERTY_MINED_STONE, - getValue(Stats::blocksMined[Tile::stoneBrick->id], + getValue(Stats::blocksMined[Tile::cobblestone->id], eDifficulty_Easy)); setLeaderboardProperty( &miningBlocksEasyProperties @@ -1211,7 +1215,7 @@ void StatsCounter::writeStats() { &miningBlocksEasyProperties [LeaderboardManager::eProperty_Mining_Cobblestone], PROPERTY_MINED_COBBLESTONE, - getValue(Stats::blocksMined[Tile::rock->id], eDifficulty_Easy)); + getValue(Stats::blocksMined[Tile::stone->id], eDifficulty_Easy)); setLeaderboardProperty( &miningBlocksEasyProperties [LeaderboardManager::eProperty_Mining_Gravel], @@ -1244,10 +1248,10 @@ void StatsCounter::writeStats() { rating = getValue(Stats::blocksMined[Tile::dirt->id], eDifficulty_Normal) + - getValue(Stats::blocksMined[Tile::stoneBrick->id], + getValue(Stats::blocksMined[Tile::cobblestone->id], eDifficulty_Normal) + getValue(Stats::blocksMined[Tile::sand->id], eDifficulty_Normal) + - getValue(Stats::blocksMined[Tile::rock->id], eDifficulty_Normal) + + getValue(Stats::blocksMined[Tile::stone->id], eDifficulty_Normal) + getValue(Stats::blocksMined[Tile::gravel->id], eDifficulty_Normal) + getValue(Stats::blocksMined[Tile::clay->id], eDifficulty_Normal) + getValue(Stats::blocksMined[Tile::obsidian->id], @@ -1262,7 +1266,7 @@ void StatsCounter::writeStats() { &miningBlocksNormalProperties [LeaderboardManager::eProperty_Mining_Stone], PROPERTY_MINED_STONE, - getValue(Stats::blocksMined[Tile::stoneBrick->id], + getValue(Stats::blocksMined[Tile::cobblestone->id], eDifficulty_Normal)); setLeaderboardProperty( &miningBlocksNormalProperties @@ -1273,7 +1277,7 @@ void StatsCounter::writeStats() { &miningBlocksNormalProperties [LeaderboardManager::eProperty_Mining_Cobblestone], PROPERTY_MINED_COBBLESTONE, - getValue(Stats::blocksMined[Tile::rock->id], eDifficulty_Normal)); + getValue(Stats::blocksMined[Tile::stone->id], eDifficulty_Normal)); setLeaderboardProperty( &miningBlocksNormalProperties [LeaderboardManager::eProperty_Mining_Gravel], @@ -1307,10 +1311,10 @@ void StatsCounter::writeStats() { rating = getValue(Stats::blocksMined[Tile::dirt->id], eDifficulty_Hard) + - getValue(Stats::blocksMined[Tile::stoneBrick->id], + getValue(Stats::blocksMined[Tile::cobblestone->id], eDifficulty_Hard) + getValue(Stats::blocksMined[Tile::sand->id], eDifficulty_Hard) + - getValue(Stats::blocksMined[Tile::rock->id], eDifficulty_Hard) + + getValue(Stats::blocksMined[Tile::stone->id], eDifficulty_Hard) + getValue(Stats::blocksMined[Tile::gravel->id], eDifficulty_Hard) + getValue(Stats::blocksMined[Tile::clay->id], eDifficulty_Hard) + getValue(Stats::blocksMined[Tile::obsidian->id], eDifficulty_Hard); @@ -1324,7 +1328,7 @@ void StatsCounter::writeStats() { &miningBlocksHardProperties [LeaderboardManager::eProperty_Mining_Stone], PROPERTY_MINED_STONE, - getValue(Stats::blocksMined[Tile::stoneBrick->id], + getValue(Stats::blocksMined[Tile::cobblestone->id], eDifficulty_Hard)); setLeaderboardProperty( &miningBlocksHardProperties @@ -1335,7 +1339,7 @@ void StatsCounter::writeStats() { &miningBlocksHardProperties [LeaderboardManager::eProperty_Mining_Cobblestone], PROPERTY_MINED_COBBLESTONE, - getValue(Stats::blocksMined[Tile::rock->id], eDifficulty_Hard)); + getValue(Stats::blocksMined[Tile::stone->id], eDifficulty_Hard)); setLeaderboardProperty( &miningBlocksHardProperties [LeaderboardManager::eProperty_Mining_Gravel], @@ -1369,8 +1373,8 @@ void StatsCounter::writeStats() { rating = getValue(Stats::itemsCollected[Item::egg->id], eDifficulty_Peaceful) + - getValue(Stats::blocksMined[Tile::crops_Id], eDifficulty_Peaceful) + - getValue(Stats::blocksMined[Tile::mushroom1_Id], + getValue(Stats::blocksMined[Tile::wheat_Id], eDifficulty_Peaceful) + + getValue(Stats::blocksMined[Tile::mushroom_brown_Id], eDifficulty_Peaceful) + getValue(Stats::blocksMined[Tile::reeds_Id], eDifficulty_Peaceful) + getValue(Stats::cowsMilked, eDifficulty_Peaceful) + @@ -1386,12 +1390,12 @@ void StatsCounter::writeStats() { &farmingPeacefulProperties [LeaderboardManager::eProperty_Farming_Wheat], PROPERTY_COLLECTED_WHEAT, - getValue(Stats::blocksMined[Tile::crops_Id], eDifficulty_Peaceful)); + getValue(Stats::blocksMined[Tile::wheat_Id], eDifficulty_Peaceful)); setLeaderboardProperty( &farmingPeacefulProperties [LeaderboardManager::eProperty_Farming_Mushroom], PROPERTY_COLLECTED_MUSHROOM, - getValue(Stats::blocksMined[Tile::mushroom1_Id], + getValue(Stats::blocksMined[Tile::mushroom_brown_Id], eDifficulty_Peaceful)); setLeaderboardProperty( &farmingPeacefulProperties @@ -1425,8 +1429,9 @@ void StatsCounter::writeStats() { rating = getValue(Stats::itemsCollected[Item::egg->id], eDifficulty_Easy) + - getValue(Stats::blocksMined[Tile::crops_Id], eDifficulty_Easy) + - getValue(Stats::blocksMined[Tile::mushroom1_Id], eDifficulty_Easy) + + getValue(Stats::blocksMined[Tile::wheat_Id], eDifficulty_Easy) + + getValue(Stats::blocksMined[Tile::mushroom_brown_Id], + eDifficulty_Easy) + getValue(Stats::blocksMined[Tile::reeds_Id], eDifficulty_Easy) + getValue(Stats::cowsMilked, eDifficulty_Easy) + getValue(Stats::itemsCollected[Tile::pumpkin->id], @@ -1439,12 +1444,13 @@ void StatsCounter::writeStats() { setLeaderboardProperty( &farmingEasyProperties[LeaderboardManager::eProperty_Farming_Wheat], PROPERTY_COLLECTED_WHEAT, - getValue(Stats::blocksMined[Tile::crops_Id], eDifficulty_Easy)); + getValue(Stats::blocksMined[Tile::wheat_Id], eDifficulty_Easy)); setLeaderboardProperty( &farmingEasyProperties [LeaderboardManager::eProperty_Farming_Mushroom], PROPERTY_COLLECTED_MUSHROOM, - getValue(Stats::blocksMined[Tile::mushroom1_Id], eDifficulty_Easy)); + getValue(Stats::blocksMined[Tile::mushroom_brown_Id], + eDifficulty_Easy)); setLeaderboardProperty( &farmingEasyProperties [LeaderboardManager::eProperty_Farming_Sugarcane], @@ -1477,8 +1483,8 @@ void StatsCounter::writeStats() { rating = getValue(Stats::itemsCollected[Item::egg->id], eDifficulty_Normal) + - getValue(Stats::blocksMined[Tile::crops_Id], eDifficulty_Normal) + - getValue(Stats::blocksMined[Tile::mushroom1_Id], + getValue(Stats::blocksMined[Tile::wheat_Id], eDifficulty_Normal) + + getValue(Stats::blocksMined[Tile::mushroom_brown_Id], eDifficulty_Normal) + getValue(Stats::blocksMined[Tile::reeds_Id], eDifficulty_Normal) + getValue(Stats::cowsMilked, eDifficulty_Normal) + @@ -1493,12 +1499,12 @@ void StatsCounter::writeStats() { &farmingNormalProperties [LeaderboardManager::eProperty_Farming_Wheat], PROPERTY_COLLECTED_WHEAT, - getValue(Stats::blocksMined[Tile::crops_Id], eDifficulty_Normal)); + getValue(Stats::blocksMined[Tile::wheat_Id], eDifficulty_Normal)); setLeaderboardProperty( &farmingNormalProperties [LeaderboardManager::eProperty_Farming_Mushroom], PROPERTY_COLLECTED_MUSHROOM, - getValue(Stats::blocksMined[Tile::mushroom1_Id], + getValue(Stats::blocksMined[Tile::mushroom_brown_Id], eDifficulty_Normal)); setLeaderboardProperty( &farmingNormalProperties @@ -1531,8 +1537,9 @@ void StatsCounter::writeStats() { rating = getValue(Stats::itemsCollected[Item::egg->id], eDifficulty_Hard) + - getValue(Stats::blocksMined[Tile::crops_Id], eDifficulty_Hard) + - getValue(Stats::blocksMined[Tile::mushroom1_Id], eDifficulty_Hard) + + getValue(Stats::blocksMined[Tile::wheat_Id], eDifficulty_Hard) + + getValue(Stats::blocksMined[Tile::mushroom_brown_Id], + eDifficulty_Hard) + getValue(Stats::blocksMined[Tile::reeds_Id], eDifficulty_Hard) + getValue(Stats::cowsMilked, eDifficulty_Hard) + getValue(Stats::itemsCollected[Tile::pumpkin->id], @@ -1545,12 +1552,13 @@ void StatsCounter::writeStats() { setLeaderboardProperty( &farmingHardProperties[LeaderboardManager::eProperty_Farming_Wheat], PROPERTY_COLLECTED_WHEAT, - getValue(Stats::blocksMined[Tile::crops_Id], eDifficulty_Hard)); + getValue(Stats::blocksMined[Tile::wheat_Id], eDifficulty_Hard)); setLeaderboardProperty( &farmingHardProperties [LeaderboardManager::eProperty_Farming_Mushroom], PROPERTY_COLLECTED_MUSHROOM, - getValue(Stats::blocksMined[Tile::mushroom1_Id], eDifficulty_Hard)); + getValue(Stats::blocksMined[Tile::mushroom_brown_Id], + eDifficulty_Hard)); setLeaderboardProperty( &farmingHardProperties [LeaderboardManager::eProperty_Farming_Sugarcane], @@ -1798,11 +1806,11 @@ void StatsCounter::setupStatBoards() { statBoards.insert(std::make_pair(Stats::blocksMined[Tile::dirt->id], LEADERBOARD_MININGBLOCKS_PEACEFUL)); - statBoards.insert(std::make_pair(Stats::blocksMined[Tile::stoneBrick->id], + statBoards.insert(std::make_pair(Stats::blocksMined[Tile::cobblestone->id], LEADERBOARD_MININGBLOCKS_PEACEFUL)); statBoards.insert(std::make_pair(Stats::blocksMined[Tile::sand->id], LEADERBOARD_MININGBLOCKS_PEACEFUL)); - statBoards.insert(std::make_pair(Stats::blocksMined[Tile::rock->id], + statBoards.insert(std::make_pair(Stats::blocksMined[Tile::stone->id], LEADERBOARD_MININGBLOCKS_PEACEFUL)); statBoards.insert(std::make_pair(Stats::blocksMined[Tile::gravel->id], LEADERBOARD_MININGBLOCKS_PEACEFUL)); @@ -1813,10 +1821,11 @@ void StatsCounter::setupStatBoards() { statBoards.insert(std::make_pair(Stats::itemsCollected[Item::egg->id], LEADERBOARD_FARMING_PEACEFUL)); - statBoards.insert(std::make_pair(Stats::blocksMined[Tile::crops_Id], - LEADERBOARD_FARMING_PEACEFUL)); - statBoards.insert(std::make_pair(Stats::blocksMined[Tile::mushroom1_Id], + statBoards.insert(std::make_pair(Stats::blocksMined[Tile::wheat_Id], LEADERBOARD_FARMING_PEACEFUL)); + statBoards.insert( + std::make_pair(Stats::blocksMined[Tile::mushroom_brown_Id], + LEADERBOARD_FARMING_PEACEFUL)); statBoards.insert(std::make_pair(Stats::blocksMined[Tile::reeds_Id], LEADERBOARD_FARMING_PEACEFUL)); statBoards.insert( @@ -1884,12 +1893,12 @@ void StatsCounter::WipeLeaderboards() { if (DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGBLOCKS_HARD) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_BLOCKS_HARD, NULL); // if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_PEACEFUL ) - // XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_PEACEFUL, NULL); if( - // DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_EASY ) + // XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_PEACEFUL, NULL); + // if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_EASY ) // XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_EASY, NULL); if( // DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_NORMAL ) - // XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_NORMAL, NULL); if( - // DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_HARD ) + // XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_NORMAL, NULL); + // if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_HARD ) // XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_HARD, NULL); if (DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_FARMING_PEACEFUL) XUserResetStatsViewAllUsers(STATS_VIEW_FARMING_PEACEFUL, NULL); diff --git a/Minecraft.Client/GameState/SurvivalMode.cpp b/Minecraft.Client/GameState/SurvivalMode.cpp index ddf96d737..cbbdba9c0 100644 --- a/Minecraft.Client/GameState/SurvivalMode.cpp +++ b/Minecraft.Client/GameState/SurvivalMode.cpp @@ -3,8 +3,6 @@ #include "DemoMode.h" #include "../Rendering/LevelRenderer.h" #include "../Player/LocalPlayer.h" -#include "../Level/MultiPlayerLevel.h" -#include "../Player/MultiPlayerLocalPlayer.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.tile.h" #include "../../Minecraft.World/Headers/net.minecraft.world.entity.player.h" @@ -58,7 +56,7 @@ bool SurvivalMode::destroyBlock(int x, int y, int z, int face) { std::shared_ptr item = minecraft->player->getSelectedItem(); bool couldDestroy = minecraft->player->canDestroy(Tile::tiles[t]); if (item != NULL) { - item->mineBlock(minecraft->level, t, x, y, z, minecraft->player); + item->mineBlock(t, x, y, z, minecraft->player); if (item->count == 0) { minecraft->player->removeSelectedItem(); } diff --git a/Minecraft.Client/Level/DemoLevel.cpp b/Minecraft.Client/Level/DemoLevel.cpp index 6549de08d..257e4d9c7 100644 --- a/Minecraft.Client/Level/DemoLevel.cpp +++ b/Minecraft.Client/Level/DemoLevel.cpp @@ -10,9 +10,6 @@ DemoLevel::DemoLevel(std::shared_ptr levelStorage, const std::wstring& levelName) : Level(levelStorage, levelName, &DEMO_LEVEL_SETTINGS) {} -DemoLevel::DemoLevel(Level* level, Dimension* dimension) - : Level(level, dimension) {} - void DemoLevel::setInitialSpawn() { levelData->setSpawn(DEMO_SPAWN_X, DEMO_SPAWN_Y, DEMO_SPAWN_Z); } \ No newline at end of file diff --git a/Minecraft.Client/Level/MultiPlayerLevel.cpp b/Minecraft.Client/Level/MultiPlayerLevel.cpp index 4f0055489..5f87af715 100644 --- a/Minecraft.Client/Level/MultiPlayerLevel.cpp +++ b/Minecraft.Client/Level/MultiPlayerLevel.cpp @@ -9,9 +9,11 @@ #include "../MinecraftServer.h" #include "ServerLevel.h" #include "../Minecraft.h" +#include "../Rendering/Particles/FireworksParticles.h" #include "../../Minecraft.World/Entities/Mobs/PrimedTnt.h" #include "../../Minecraft.World/Blocks/Tile.h" #include "../../Minecraft.World/Blocks/TileEntities/TileEntity.h" +#include "../../Minecraft.World/Util/JavaMath.h" MultiPlayerLevel::ResetInfo::ResetInfo(int x, int y, int z, int tile, int data) { @@ -53,10 +55,10 @@ MultiPlayerLevel::MultiPlayerLevel(ClientConnection* connection, // multiplayer, this should only be set by receiving a packet from the // server (which happens when a player logs in) // setSpawnPos(new Pos(8, 64, 8)); - // The base ctor already has made some storage, so need to delete that + // The base ctor already has made some storage, so need to delete that if (this->savedDataStorage) delete savedDataStorage; if (connection != NULL) { - this->savedDataStorage = connection->savedDataStorage; + savedDataStorage = connection->savedDataStorage; } unshareCheckX = 0; unshareCheckZ = 0; @@ -88,17 +90,30 @@ void MultiPlayerLevel::shareChunkAt(int x, int z) { void MultiPlayerLevel::tick() { PIXBeginNamedEvent(0, "Sky color changing"); - setTime(getTime() + 1); + setGameTime(getGameTime() + 1); + if (getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)) { + // 4J: Debug setting added to keep it at day time +#ifndef _FINAL_BUILD + bool freezeTime = + app.DebugSettingsOn() && + app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) & + (1L << eDebugSetting_FreezeTime); + if (!freezeTime) +#endif + { + setDayTime(getDayTime() + 1); + } + } /* 4J - change brought forward from 1.8.2 -int newDark = this->getSkyDarken(1); -if (newDark != skyDarken) + int newDark = this->getSkyDarken(1); + if (newDark != skyDarken) { skyDarken = newDark; for (unsigned int i = 0; i < listeners.size(); i++) - { - listeners[i]->skyColorChanged(); + { + listeners[i]->skyColorChanged(); } -}*/ + }*/ PIXEndNamedEvent(); PIXBeginNamedEvent(0, "Entity re-entry"); @@ -128,7 +143,8 @@ if (newDark != skyDarken) for (unsigned int i = 0; i < updatesToReset.size(); i++) { ResetInfo& r = updatesToReset[i]; if (--r.ticks == 0) { - Level::setTileAndDataNoUpdate(r.x, r.y, r.z, r.tile, r.data); + Level::setTileAndData(r.x, r.y, r.z, r.tile, r.data, + Tile::UPDATE_ALL); Level::sendTileUpdated(r.x, r.y, r.z); // updatesToReset.erase(updatesToReset.begin()+i); @@ -387,7 +403,7 @@ void MultiPlayerLevel::tickTiles() { int xo = cp.x * 16; int zo = cp.z * 16; - LevelChunk* lc = this->getChunk(cp.x, cp.z); + LevelChunk* lc = getChunk(cp.x, cp.z); tickClientSideTiles(xo, zo, lc); } @@ -402,8 +418,8 @@ void MultiPlayerLevel::setChunkVisible(int x, int z, bool visible) { chunkCache->drop(x, z); } if (!visible) { - this->setTilesDirty(x * 16, 0, z * 16, x * 16 + 15, - Level::maxBuildHeight, z * 16 + 15); + setTilesDirty(x * 16, 0, z * 16, x * 16 + 15, Level::maxBuildHeight, + z * 16 + 15); } } @@ -456,7 +472,7 @@ void MultiPlayerLevel::putEntity(int id, std::shared_ptr e) { forced.insert(e); e->entityId = id; if (!addEntity(e)) { - this->reEntries.insert(e); + reEntries.insert(e); } entitiesById[id] = e; } @@ -498,14 +514,32 @@ void MultiPlayerLevel::removeEntities( Level::removeEntities(list); } -bool MultiPlayerLevel::setDataNoUpdate(int x, int y, int z, int data) { - int t = getTile(x, y, z); +bool MultiPlayerLevel::setData( + int x, int y, int z, int data, int updateFlags, + bool forceUpdate /*=false*/) // 4J added forceUpdate) +{ + // First check if this isn't going to do anything, because if it isn't then + // the next stage (of unsharing data) is really quite expensive so far + // better to early out here int d = getData(x, y, z); + + if (d == data) { + // If we early-out, its important that we still do a checkLight here + // (which would otherwise have happened as part of + // Level::setTileAndDataNoUpdate) This is because since we are + // potentially sharing tile/data but not lighting data, it is possible + // that the server might tell a client of a lighting update that doesn't + // need actioned on the client just because the chunk's data was being + // shared with the server when it was set. However, the lighting data + // will potentially now be out of sync on the client. + checkLight(x, y, z); + return false; + } // 4J - added - if this is the host, then stop sharing block data with the // server at this point unshareChunkAt(x, z); - if (Level::setDataNoUpdate(x, y, z, data)) { + if (Level::setData(x, y, z, data, updateFlags, forceUpdate)) { // if(m_bEnableResetChanges) updatesToReset.push_back(ResetInfo(x, y, z, // t, d)); return true; @@ -515,8 +549,8 @@ bool MultiPlayerLevel::setDataNoUpdate(int x, int y, int z, int data) { return false; } -bool MultiPlayerLevel::setTileAndDataNoUpdate(int x, int y, int z, int tile, - int data) { +bool MultiPlayerLevel::setTileAndData(int x, int y, int z, int tile, int data, + int updateFlags) { // First check if this isn't going to do anything, because if it isn't then // the next stage (of unsharing data) is really quite expensive so far // better to early out here @@ -539,24 +573,7 @@ bool MultiPlayerLevel::setTileAndDataNoUpdate(int x, int y, int z, int tile, // server at this point unshareChunkAt(x, z); - if (Level::setTileAndDataNoUpdate(x, y, z, tile, data)) { - // if(m_bEnableResetChanges) updatesToReset.push_back(ResetInfo(x, y, z, - // t, d)); - return true; - } - // Didn't actually need to stop sharing - shareChunkAt(x, z); - return false; -} - -bool MultiPlayerLevel::setTileNoUpdate(int x, int y, int z, int tile) { - int t = getTile(x, y, z); - int d = getData(x, y, z); - // 4J - added - if this is the host, then stop sharing block data with the - // server at this point - unshareChunkAt(x, z); - - if (Level::setTileNoUpdate(x, y, z, tile)) { + if (Level::setTileAndData(x, y, z, tile, data, updateFlags)) { // if(m_bEnableResetChanges) updatesToReset.push_back(ResetInfo(x, y, z, // t, d)); return true; @@ -585,7 +602,7 @@ bool MultiPlayerLevel::doSetTileAndData(int x, int y, int z, int tile, // If we're the host, need to tell the renderer for updates even if they // don't change things as the host might have been sharing data and so set // it already, but the renderer won't know to update - if ((Level::setTileAndData(x, y, z, tile, data) || + if ((Level::setTileAndData(x, y, z, tile, data, Tile::UPDATE_ALL) || g_NetworkManager.IsHost())) { if (g_NetworkManager.IsHost() && visuallyImportant) { // 4J Stu - This got removed from the tileUpdated function in TU14. @@ -613,13 +630,15 @@ void MultiPlayerLevel::disconnect(bool sendDisconnect /*= true*/) { } } +Tickable* MultiPlayerLevel::makeSoundUpdater( + std::shared_ptr minecart) { + return NULL; // new MinecartSoundUpdater(minecraft->soundEngine, minecart, + // minecraft->player); +} + void MultiPlayerLevel::tickWeather() { if (dimension->hasCeiling) return; - if (lightningTime > 0) { - lightningTime--; - } - oRainLevel = rainLevel; if (levelData->isRaining()) { rainLevel += 0.01; @@ -731,6 +750,7 @@ void MultiPlayerLevel::playSound(std::shared_ptr entity, int iSound, void MultiPlayerLevel::playLocalSound(double x, double y, double z, int iSound, float volume, float pitch, + bool distanceDelay /*= false */, float fClipSoundDist) { // float dd = 16; if (volume > 1) fClipSoundDist *= volume; @@ -747,11 +767,50 @@ void MultiPlayerLevel::playLocalSound(double x, double y, double z, int iSound, } if (minDistSq < fClipSoundDist * fClipSoundDist) { - minecraft->soundEngine->play(iSound, (float)x, (float)y, (float)z, - volume, pitch); + if (distanceDelay && minDistSq > 10 * 10) { + // 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)); + } else { + minecraft->soundEngine->play(iSound, (float)x, (float)y, (float)z, + volume, pitch); + } } } +void MultiPlayerLevel::createFireworks(double x, double y, double z, double xd, + double yd, double zd, + CompoundTag* infoTag) { + minecraft->particleEngine->add( + std::shared_ptr( + new FireworksParticles::FireworksStarter(this, x, y, z, xd, yd, zd, + minecraft->particleEngine, + infoTag))); +} + +void MultiPlayerLevel::setScoreboard(Scoreboard* scoreboard) { + this->scoreboard = scoreboard; +} + +void MultiPlayerLevel::setDayTime(int64_t newTime) { + // 4J: We send daylight cycle rule with host options so don't need this + /*if (newTime < 0) + { + newTime = -newTime; + getGameRules()->set(GameRules::RULE_DAYLIGHT, L"false"); + } + else + { + getGameRules()->set(GameRules::RULE_DAYLIGHT, L"true"); + }*/ + + Level::setDayTime(newTime); +} + void MultiPlayerLevel::removeAllPendingEntityRemovals() { // entities.removeAll(entitiesToRemove); diff --git a/Minecraft.Client/Level/MultiPlayerLevel.h b/Minecraft.Client/Level/MultiPlayerLevel.h index 0a02089d6..aeb70e2bc 100644 --- a/Minecraft.Client/Level/MultiPlayerLevel.h +++ b/Minecraft.Client/Level/MultiPlayerLevel.h @@ -18,9 +18,10 @@ private: ResetInfo(int x, int y, int z, int tile, int data); }; - std::vector updatesToReset; // 4J - was linked list but vector - // seems more appropriate - bool m_bEnableResetChanges; // 4J Added + std::vector + updatesToReset; // 4J - was linked list but std::vector seems more + // appropriate + bool m_bEnableResetChanges; // 4J Added public: void unshareChunkAt(int x, int z); // 4J - added void shareChunkAt(int x, int z); // 4J - added @@ -34,10 +35,11 @@ private: int compressCheckX; // 4J - added int compressCheckZ; // 4J - added std::vector - connections; // 4J Stu - Made this a vector as we can have more than - // one local connection + connections; // 4J Stu - Made this a std::vector as we can have more + // than one local connection MultiPlayerChunkCache* chunkCache; Minecraft* minecraft; + Scoreboard* scoreboard; public: MultiPlayerLevel(ClientConnection* connection, LevelSettings* levelSettings, @@ -79,15 +81,16 @@ public: std::shared_ptr removeEntity(int id); virtual void removeEntities( std::vector >* list); // 4J Added override - virtual bool setDataNoUpdate(int x, int y, int z, int data); - virtual bool setTileAndDataNoUpdate(int x, int y, int z, int tile, - int data); - virtual bool setTileNoUpdate(int x, int y, int z, int tile); + virtual bool setData(int x, int y, int z, int data, int updateFlags, + bool forceUpdate = false); + virtual bool setTileAndData(int x, int y, int z, int tile, int data, + int updateFlags); bool doSetTileAndData(int x, int y, int z, int tile, int data); virtual void disconnect(bool sendDisconnect = true); void animateTick(int xt, int yt, int zt); protected: + virtual Tickable* makeSoundUpdater(std::shared_ptr minecart); virtual void tickWeather(); static const int ANIMATE_TICK_MAX_PARTICLES = 500; @@ -104,8 +107,14 @@ public: virtual void playLocalSound(double x, double y, double z, int iSound, float volume, float pitch, + bool distanceDelay = false, float fClipSoundDist = 16.0f); + virtual void createFireworks(double x, double y, double z, double xd, + double yd, double zd, CompoundTag* infoTag); + virtual void setScoreboard(Scoreboard* scoreboard); + virtual void setDayTime(int64_t newTime); + // 4J Stu - Added so we can have multiple local connections void addClientConnection(ClientConnection* c) { connections.push_back(c); } void removeClientConnection(ClientConnection* c, bool sendDisconnect); diff --git a/Minecraft.Client/Level/ServerLevel.cpp b/Minecraft.Client/Level/ServerLevel.cpp index 422c30a9f..025190b7f 100644 --- a/Minecraft.Client/Level/ServerLevel.cpp +++ b/Minecraft.Client/Level/ServerLevel.cpp @@ -6,33 +6,36 @@ #include "../Player/ServerPlayer.h" #include "../Network/PlayerConnection.h" #include "../Player/EntityTracker.h" +#include "../Network/ServerScoreboard.h" +#include "../../Minecraft.World/Scores/ScoreboardSaveData.h" #include "../../Minecraft.World/Headers/net.minecraft.world.h" -#include "../../Minecraft.World/Headers/net.minecraft.world.level.h" -#include "../../Minecraft.World/Headers/net.minecraft.world.level.dimension.h" -#include "../../Minecraft.World/Headers/net.minecraft.world.level.storage.h" -#include "../../Minecraft.World/Headers/net.minecraft.world.level.chunk.h" -#include "../../Minecraft.World/Headers/net.minecraft.world.level.tile.entity.h" -#include "../../Minecraft.World/Headers/net.minecraft.world.level.biome.h" +#include "../../Minecraft.World/Headers/net.minecraft.world.item.h" #include "../../Minecraft.World/Headers/net.minecraft.world.entity.h" #include "../../Minecraft.World/Headers/net.minecraft.world.entity.ai.village.h" -#include "../../Minecraft.World/Headers/net.minecraft.world.entity.player.h" -#include "../../Minecraft.World/Headers/net.minecraft.world.entity.npc.h" #include "../../Minecraft.World/Headers/net.minecraft.world.entity.global.h" +#include "../../Minecraft.World/Headers/net.minecraft.world.entity.npc.h" +#include "../../Minecraft.World/Headers/net.minecraft.world.entity.player.h" +#include "../../Minecraft.World/Headers/net.minecraft.world.level.h" +#include "../../Minecraft.World/Headers/net.minecraft.world.level.biome.h" +#include "../../Minecraft.World/Headers/net.minecraft.world.level.chunk.h" +#include "../../Minecraft.World/Headers/net.minecraft.world.level.dimension.h" +#include "../../Minecraft.World/Headers/net.minecraft.world.level.levelgen.feature.h" +#include "../../Minecraft.World/Headers/net.minecraft.world.level.storage.h" +#include "../../Minecraft.World/Headers/net.minecraft.world.level.tile.entity.h" +#include "../../Minecraft.World/Headers/net.minecraft.world.scores.h" #include "../../Minecraft.World/Entities/ItemEntity.h" #include "../../Minecraft.World/Entities/Mobs/Arrow.h" #include "../../Minecraft.World/Entities/Mobs/PrimedTnt.h" #include "../../Minecraft.World/Blocks/FallingTile.h" #include "../../Minecraft.World/Headers/net.minecraft.network.packet.h" #include "../../Minecraft.World/Util/Mth.h" -#include "../../Minecraft.World/Headers/net.minecraft.world.level.levelgen.feature.h" -#include "../../Minecraft.World/Headers/net.minecraft.world.item.h" #include "../../Minecraft.World/WorldGen/Structures/StructurePiece.h" -#include "ServerLevelListener.h" +#include "./ServerLevelListener.h" #include "../../Minecraft.World/Util/WeighedTreasure.h" #include "../Textures/Packs/TexturePackRepository.h" #include "../Textures/Packs/DLCTexturePack.h" #include "../../Minecraft.World/Util/ProgressListener.h" -#include "../Platform/PS3/PS3Extras/ShutdownManager.h" +#include "PS3/PS3Extras/ShutdownManager.h" #include "../Network/PlayerChunkMap.h" WeighedTreasureArray ServerLevel::RANDOM_BONUS_ITEMS; @@ -100,7 +103,7 @@ void ServerLevel::staticCtor() { RANDOM_BONUS_ITEMS[17] = new WeighedTreasure(Item::potato_Id, 0, 1, 2, 3); RANDOM_BONUS_ITEMS[18] = new WeighedTreasure(Item::carrots_Id, 0, 1, 2, 3); RANDOM_BONUS_ITEMS[19] = - new WeighedTreasure(Tile::mushroom1_Id, 0, 1, 2, 2); + new WeighedTreasure(Tile::mushroom_brown_Id, 0, 1, 2, 2); }; ServerLevel::ServerLevel(MinecraftServer* server, @@ -132,9 +135,25 @@ ServerLevel::ServerLevel(MinecraftServer* server, // of this ctor but setting up early here addListener(new ServerLevelListener(server, this)); - this->tracker = new EntityTracker(this); - this->chunkMap = new PlayerChunkMap( - this, dimension, server->getPlayers()->getViewDistance()); + tracker = new EntityTracker(this); + chunkMap = new PlayerChunkMap(this, dimension, + server->getPlayers()->getViewDistance()); + + mobSpawner = new MobSpawner(); + portalForcer = new PortalForcer(this); + scoreboard = new ServerScoreboard(server); + + // shared_ptr scoreboardSaveData = + // std::dynamic_pointer_cast( + // savedDataStorage->get(typeid(ScoreboardSaveData), + // ScoreboardSaveData::FILE_ID) ); if (scoreboardSaveData == NULL) + //{ + // scoreboardSaveData = shared_ptr( new + // ScoreboardSaveData() ); + // savedDataStorage->set(ScoreboardSaveData::FILE_ID, scoreboardSaveData); + // } + // scoreboardSaveData->setScoreboard(scoreboard); + //((ServerScoreboard *) scoreboard)->setSaveData(scoreboardSaveData); // This also used to be called in parent ctor, but can't be called until // chunkSource is created. Call now if required. @@ -171,6 +190,9 @@ ServerLevel::ServerLevel(MinecraftServer* server, } ServerLevel::~ServerLevel() { + delete portalForcer; + delete mobSpawner; + EnterCriticalSection(&m_csQueueSendTileUpdates); for (AUTO_VAR(it, m_queuedSendTileUpdates.begin()); it != m_queuedSendTileUpdates.end(); ++it) { @@ -207,34 +229,47 @@ void ServerLevel::tick() { dimension->biomeSource->update(); if (allPlayersAreSleeping()) { - bool somebodyWokeUp = false; - if (spawnEnemies && difficulty >= Difficulty::EASY) { - } - - if (!somebodyWokeUp) { + if (getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)) { // skip time until new day - __int64 newTime = levelData->getTime() + TICKS_PER_DAY; + int64_t newTime = levelData->getDayTime() + TICKS_PER_DAY; // 4J : WESTY : Changed so that time update goes through stats // tracking update code. // levelData->setTime(newTime - (newTime % TICKS_PER_DAY)); - setTime(newTime - (newTime % TICKS_PER_DAY)); - - awakenAllPlayers(); + setDayTime(newTime - (newTime % TICKS_PER_DAY)); } + awakenAllPlayers(); } PIXBeginNamedEvent(0, "Mob spawner tick"); // for Minecraft 1.8, spawn friendlies really rarely - 4J - altered // from once every 400 ticks to 40 ticks as we depend on this a more than // the original since we don't have chunk post-process spawning - MobSpawner::tick(this, spawnEnemies, - spawnFriendlies && (levelData->getTime() % 40) == 0); + if (getGameRules()->getBoolean(GameRules::RULE_DOMOBSPAWNING)) { + // Note - these flags are used logically in an inverted way. Mob + // spawning is not performed if: (1) finalSpawnEnemies isn't set, and + // mob category isn't friendly (2) finalSpawnFriendlies isn't set, and + // mob category is friendly (3) finalSpawnPersistent isn't set, and mob + // category is persistent + bool finalSpawnEnemies = + spawnEnemies && ((levelData->getGameTime() % 2) == + 0); // Spawn enemies every other tick + bool finalSpawnFriendlies = + spawnFriendlies && ((levelData->getGameTime() % 40) == + 0); // Spawn friendlies once per 40 ticks + bool finalSpawnPersistent = + finalSpawnFriendlies && + ((levelData->getGameTime() % 80) == + 0); // All persistents are also friendly - do them once every + // other friendly spawning, ie once per 80 ticks + mobSpawner->tick(this, finalSpawnEnemies, finalSpawnFriendlies, + finalSpawnPersistent); + } PIXEndNamedEvent(); PIXBeginNamedEvent(0, "Chunk source tick"); chunkSource->tick(); PIXEndNamedEvent(); - int newDark = this->getOldSkyDarken(1); + int newDark = getOldSkyDarken(1); if (newDark != skyDarken) { skyDarken = newDark; if (!SharedConstants::TEXTURE_LIGHTING) // 4J - change brought forward @@ -247,17 +282,12 @@ void ServerLevel::tick() { } } - PIXBeginNamedEvent(0, "runTileEvents"); - // run after entity updates - runTileEvents(); - PIXEndNamedEvent(); - // 4J - temporarily disabling saves as they are causing gameplay to // generally stutter quite a lot - __int64 time = levelData->getTime() + 1; -// 4J Stu - Putting this back in, but I have reduced the number of chunks that -// save when not forced + int64_t time = levelData->getGameTime() + 1; + // 4J Stu - Putting this back in, but I have reduced the number of chunks + // that save when not forced #ifdef _LARGE_WORLDS if (time % (saveInterval) == (dimension->id + 1)) #else @@ -274,7 +304,20 @@ void ServerLevel::tick() { // 4J : WESTY : Changed so that time update goes through stats tracking // update code. // levelData->setTime(time); - setTime(time); + setGameTime(levelData->getGameTime() + 1); + if (getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)) { + // 4J: Debug setting added to keep it at day time +#ifndef _FINAL_BUILD + bool freezeTime = + app.DebugSettingsOn() && + app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) & + (1L << eDebugSetting_FreezeTime); + if (!freezeTime) +#endif + { + setDayTime(levelData->getDayTime() + 1); + } + } PIXBeginNamedEvent(0, "Tick pending ticks"); // if (tickCount % 5 == 0) { @@ -296,8 +339,14 @@ void ServerLevel::tick() { // MemSect(0); PIXEndNamedEvent(); + PIXBeginNamedEvent(0, "Tick portal forcer"); + portalForcer->tick(getGameTime()); + PIXEndNamedEvent(); + // repeat after tile ticks + PIXBeginNamedEvent(0, "runTileEvents"); runTileEvents(); + PIXEndNamedEvent(); // 4J Added runQueuedSendTileUpdates(); @@ -318,8 +367,7 @@ void ServerLevel::updateSleepingPlayerList() { m_bAtLeastOnePlayerSleeping = false; AUTO_VAR(itEnd, players.end()); - for (std::vector >::iterator it = players.begin(); - it != itEnd; it++) { + for (AUTO_VAR(it, players.begin()); it != itEnd; it++) { if (!(*it)->isSleeping()) { allPlayersSleeping = false; // break; @@ -477,7 +525,7 @@ void ServerLevel::tickTiles() { m_updateChunkX[iLev][m_updateChunkCount[iLev]] = cp.x; m_updateChunkZ[iLev][m_updateChunkCount[iLev]++] = cp.z; - LevelChunk* lc = this->getChunk(cp.x, cp.z); + LevelChunk* lc = getChunk(cp.x, cp.z); tickClientSideTiles(xo, zo, lc); if (random->nextInt(prob) == 0 && isRaining() && isThundering()) { @@ -490,23 +538,21 @@ void ServerLevel::tickTiles() { if (isRainingAt(x, y, z)) { addGlobalEntity(std::shared_ptr( new LightningBolt(this, x, y, z))); - lightningTime = 2; } } // 4J - changes here brought forrward from 1.2.3 if (random->nextInt(16) == 0) { - // 4jcraft added cast to unsigned - randValue = (unsigned)randValue * 3 + (unsigned)addend; + randValue = randValue * 3 + addend; int val = (randValue >> 2); int x = (val & 15); int z = ((val >> 8) & 15); - int yy = this->getTopRainBlock(x + xo, z + zo); + int yy = getTopRainBlock(x + xo, z + zo); if (shouldFreeze(x + xo, yy - 1, z + zo)) { - setTile(x + xo, yy - 1, z + zo, Tile::ice_Id); + setTileAndUpdate(x + xo, yy - 1, z + zo, Tile::ice_Id); } if (isRaining() && shouldSnow(x + xo, yy, z + zo)) { - setTile(x + xo, yy, z + zo, Tile::topSnow_Id); + setTileAndUpdate(x + xo, yy, z + zo, Tile::topSnow_Id); } if (isRaining()) { Biome* b = getBiome(x + xo, z + zo); @@ -531,26 +577,42 @@ void ServerLevel::tickTiles() { m_updateTrigger->Set(iLev); } +bool ServerLevel::isTileToBeTickedAt(int x, int y, int z, int tileId) { + TickNextTickData td = TickNextTickData(x, y, z, tileId); + return find(toBeTicked.begin(), toBeTicked.end(), td) != toBeTicked.end(); +} + void ServerLevel::addToTickNextTick(int x, int y, int z, int tileId, int tickDelay) { + addToTickNextTick(x, y, z, tileId, tickDelay, 0); +} + +void ServerLevel::addToTickNextTick(int x, int y, int z, int tileId, + int tickDelay, int priorityTilt) { MemSect(27); TickNextTickData td = TickNextTickData(x, y, z, tileId); - int r = 8; - if (getInstaTick()) { - if (hasChunksAt(td.x - r, td.y - r, td.z - r, td.x + r, td.y + r, - td.z + r)) { - int id = getTile(td.x, td.y, td.z); - if (id == td.tileId && id > 0) { - Tile::tiles[id]->tick(this, td.x, td.y, td.z, random); + int r = 0; + if (getInstaTick() && tileId > 0) { + if (Tile::tiles[tileId]->canInstantlyTick()) { + r = 8; + if (hasChunksAt(td.x - r, td.y - r, td.z - r, td.x + r, td.y + r, + td.z + r)) { + int id = getTile(td.x, td.y, td.z); + if (id == td.tileId && id > 0) { + Tile::tiles[id]->tick(this, td.x, td.y, td.z, random); + } } + MemSect(0); + return; + } else { + tickDelay = 1; } - MemSect(0); - return; } if (hasChunksAt(x - r, y - r, z - r, x + r, y + r, z + r)) { if (tileId > 0) { - td.delay(tickDelay + levelData->getTime()); + td.delay(tickDelay + levelData->getGameTime()); + td.setPriorityTilt(priorityTilt); } EnterCriticalSection(&m_tickNextTickCS); if (tickNextTickSet.find(td) == tickNextTickSet.end()) { @@ -563,11 +625,12 @@ void ServerLevel::addToTickNextTick(int x, int y, int z, int tileId, } void ServerLevel::forceAddTileTick(int x, int y, int z, int tileId, - int tickDelay) { + int tickDelay, int prioTilt) { TickNextTickData td = TickNextTickData(x, y, z, tileId); + td.setPriorityTilt(prioTilt); if (tileId > 0) { - td.delay(tickDelay + levelData->getTime()); + td.delay(tickDelay + levelData->getGameTime()); } EnterCriticalSection(&m_tickNextTickCS); if (tickNextTickSet.find(td) == tickNextTickSet.end()) { @@ -583,12 +646,14 @@ void ServerLevel::tickEntities() { return; } } else { - emptyTime = 0; + resetEmptyTime(); } Level::tickEntities(); } +void ServerLevel::resetEmptyTime() { emptyTime = 0; } + bool ServerLevel::tickPendingTicks(bool force) { EnterCriticalSection(&m_tickNextTickCS); int count = (int)tickNextTickList.size(); @@ -602,22 +667,33 @@ bool ServerLevel::tickPendingTicks(bool force) { AUTO_VAR(itTickList, tickNextTickList.begin()); for (int i = 0; i < count; i++) { TickNextTickData td = *(itTickList); - if (!force && td.m_delay > levelData->getTime()) { + if (!force && td.m_delay > levelData->getGameTime()) { break; } itTickList = tickNextTickList.erase(itTickList); tickNextTickSet.erase(td); - int r = 8; + toBeTicked.push_back(td); + } + + for (AUTO_VAR(it, toBeTicked.begin()); it != toBeTicked.end();) { + TickNextTickData td = *it; + it = toBeTicked.erase(it); + + int r = 0; if (hasChunksAt(td.x - r, td.y - r, td.z - r, td.x + r, td.y + r, td.z + r)) { int id = getTile(td.x, td.y, td.z); - if (id == td.tileId && id > 0) { + if (id > 0 && Tile::isMatching(id, td.tileId)) { Tile::tiles[id]->tick(this, td.x, td.y, td.z, random); } + } else { + addToTickNextTick(td.x, td.y, td.z, td.tileId, 0); } } + toBeTicked.clear(); + int count3 = (int)tickNextTickList.size(); int count4 = (int)tickNextTickSet.size(); @@ -634,26 +710,53 @@ std::vector* ServerLevel::fetchTicksInChunk(LevelChunk* chunk, ChunkPos* pos = chunk->getPos(); // 4jcraft added cast to unsigned - int west = (unsigned)pos->x << 4; - int east = west + 16; - int north = (unsigned)pos->z << 4; - int south = north + 16; + int xMin = ((unsigned)pos->x << 4) - 2; + int xMax = (xMin + 16) + 2; + int zMin = ((unsigned)pos->z << 4) - 2; + int zMax = (zMin + 16) + 2; delete pos; - for (AUTO_VAR(it, tickNextTickSet.begin()); it != tickNextTickSet.end();) { - TickNextTickData td = *it; + for (int i = 0; i < 2; i++) { + if (i == 0) { + for (AUTO_VAR(it, tickNextTickList.begin()); + it != tickNextTickList.end();) { + TickNextTickData td = *it; - if (td.x >= west && td.x < east && td.z >= north && td.z < south) { - if (remove) { - tickNextTickList.erase(td); - it = tickNextTickSet.erase(it); - } else { - it++; + if (td.x >= xMin && td.x < xMax && td.z >= zMin && + td.z < zMax) { + if (remove) { + tickNextTickSet.erase(td); + it = tickNextTickList.erase(it); + } else { + it++; + } + + results->push_back(td); + } else { + it++; + } } - - results->push_back(td); } else { - it++; + if (!toBeTicked.empty()) { + app.DebugPrintf("To be ticked size: %d\n", toBeTicked.size()); + } + for (AUTO_VAR(it, toBeTicked.begin()); it != toBeTicked.end();) { + TickNextTickData td = *it; + + if (td.x >= xMin && td.x < xMax && td.z >= zMin && + td.z < zMax) { + if (remove) { + tickNextTickList.erase(td); + it = toBeTicked.erase(it); + } else { + it++; + } + + results->push_back(td); + } else { + it++; + } + } } } @@ -663,19 +766,14 @@ std::vector* ServerLevel::fetchTicksInChunk(LevelChunk* chunk, void ServerLevel::tick(std::shared_ptr e, bool actual) { if (!server->isAnimals() && - ((e->GetType() & eTYPE_ANIMAL) || (e->GetType() & eTYPE_WATERANIMAL))) { + (e->instanceof(eTYPE_ANIMAL) || e->instanceof(eTYPE_WATERANIMAL))) { e->remove(); } if (!server->isNpcsEnabled() && (std::dynamic_pointer_cast(e) != NULL)) { e->remove(); } - if (e->rider.lock() == NULL || - (std::dynamic_pointer_cast(e->rider.lock()) == - NULL)) // 4J - was !(e->rider instanceof Player) - { - Level::tick(e, actual); - } + Level::tick(e, actual); } void ServerLevel::forceTick(std::shared_ptr e, bool actual) { @@ -715,10 +813,7 @@ bool ServerLevel::mayInteract(std::shared_ptr player, int xt, int yt, return true; } else if (dimension->id == 0) // 4J Stu - Only limit this in the overworld { - int xd = (int)Mth::abs((float)(xt - levelData->getXSpawn())); - int zd = (int)Mth::abs((float)(zt - levelData->getZSpawn())); - if (xd > zd) zd = xd; - return (zd > 16 || server->getPlayers()->isOp(player->name)); + return !server->isUnderSpawnProtection(this, xt, yt, zt, player); } return true; } @@ -891,7 +986,7 @@ void ServerLevel::save(bool force, ProgressListener* progressListener, // if( force && !isClientSide ) //{ // if (progressListener != NULL) - //progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC); + // progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC); // levelStorage->flushSaveFile(); // } } @@ -1073,9 +1168,9 @@ void ServerLevel::runTileEvents() { bool ServerLevel::doTileEvent(TileEventData* te) { int t = getTile(te->getX(), te->getY(), te->getZ()); if (t == te->getTile()) { - Tile::tiles[t]->triggerEvent(this, te->getX(), te->getY(), te->getZ(), - te->getParamA(), te->getParamB()); - return true; + return Tile::tiles[t]->triggerEvent(this, te->getX(), te->getY(), + te->getZ(), te->getParamA(), + te->getParamB()); } return false; } @@ -1101,8 +1196,8 @@ MinecraftServer* ServerLevel::getServer() { return server; } EntityTracker* ServerLevel::getTracker() { return tracker; } -void ServerLevel::setTimeAndAdjustTileTicks(__int64 newTime) { - __int64 delta = newTime - levelData->getTime(); +void ServerLevel::setTimeAndAdjustTileTicks(int64_t newTime) { + int64_t delta = newTime - levelData->getGameTime(); // 4J - can't directly adjust m_delay in a set as it has a const interator, // since changing values in here might change the ordering of the elements // in the set. Instead move to a vector, do the adjustment, put back in the @@ -1117,11 +1212,34 @@ void ServerLevel::setTimeAndAdjustTileTicks(__int64 newTime) { for (unsigned int i = 0; i < temp.size(); i++) { tickNextTickList.insert(temp[i]); } - setTime(newTime); + setGameTime(newTime); } PlayerChunkMap* ServerLevel::getChunkMap() { return chunkMap; } +PortalForcer* ServerLevel::getPortalForcer() { return portalForcer; } + +void ServerLevel::sendParticles(const std::wstring& name, double x, double y, + double z, int count) { + sendParticles(name, x + 0.5f, y + 0.5f, z + 0.5f, count, 0.5f, 0.5f, 0.5f, + 0.02f); +} + +void ServerLevel::sendParticles(const std::wstring& name, double x, double y, + double z, int count, double xDist, double yDist, + double zDist, double speed) { + std::shared_ptr packet = + std::shared_ptr(new LevelParticlesPacket( + name, (float)x, (float)y, (float)z, (float)xDist, (float)yDist, + (float)zDist, (float)speed, count)); + + for (AUTO_VAR(it, players.begin()); it != players.end(); ++it) { + std::shared_ptr player = + std::dynamic_pointer_cast(*it); + player->connection->send(packet); + } +} + // 4J Stu - Sometimes we want to update tiles on the server from the main thread // (eg SignTileEntity when string verify returns) void ServerLevel::queueSendTileUpdate(int x, int y, int z) { @@ -1146,7 +1264,7 @@ void ServerLevel::runQueuedSendTileUpdates() { // removed and added so we can limit the number of itementities created bool ServerLevel::addEntity(std::shared_ptr e) { // If its an item entity, and we've got to our capacity, delete the oldest - if (std::dynamic_pointer_cast(e) != NULL) { + if (e->instanceof(eTYPE_ITEMENTITY)) { // printf("Adding item entity count //%d\n",m_itemEntities.size()); EnterCriticalSection(&m_limiterCS); @@ -1158,7 +1276,7 @@ bool ServerLevel::addEntity(std::shared_ptr e) { } // If its an hanging entity, and we've got to our capacity, delete the // oldest - else if (std::dynamic_pointer_cast(e) != NULL) { + else if (e->instanceof(eTYPE_HANGING_ENTITY)) { // printf("Adding item entity count //%d\n",m_itemEntities.size()); EnterCriticalSection(&m_limiterCS); @@ -1175,7 +1293,7 @@ bool ServerLevel::addEntity(std::shared_ptr e) { LeaveCriticalSection(&m_limiterCS); } // If its an arrow entity, and we've got to our capacity, delete the oldest - else if (std::dynamic_pointer_cast(e) != NULL) { + else if (e->instanceof(eTYPE_ARROW)) { // printf("Adding arrow entity count //%d\n",m_arrowEntities.size()); EnterCriticalSection(&m_limiterCS); @@ -1187,7 +1305,7 @@ bool ServerLevel::addEntity(std::shared_ptr e) { } // If its an experience orb entity, and we've got to our capacity, delete // the oldest - else if (std::dynamic_pointer_cast(e) != NULL) { + else if (e->instanceof(eTYPE_EXPERIENCEORB)) { // printf("Adding arrow entity count //%d\n",m_arrowEntities.size()); EnterCriticalSection(&m_limiterCS); @@ -1200,37 +1318,65 @@ bool ServerLevel::addEntity(std::shared_ptr e) { return Level::addEntity(e); } +// 4J: Returns true if the level is at its limit for this type of entity (only +// checks arrows, hanging, item and experience orbs) +bool ServerLevel::atEntityLimit(std::shared_ptr e) { + // TODO: This duplicates code from addEntity above, fix + + bool atLimit = false; + + if (e->instanceof(eTYPE_ITEMENTITY)) { + EnterCriticalSection(&m_limiterCS); + atLimit = m_itemEntities.size() >= MAX_ITEM_ENTITIES; + LeaveCriticalSection(&m_limiterCS); + } else if (e->instanceof(eTYPE_HANGING_ENTITY)) { + EnterCriticalSection(&m_limiterCS); + atLimit = m_hangingEntities.size() >= MAX_HANGING_ENTITIES; + LeaveCriticalSection(&m_limiterCS); + } else if (e->instanceof(eTYPE_ARROW)) { + EnterCriticalSection(&m_limiterCS); + atLimit = m_arrowEntities.size() >= MAX_ARROW_ENTITIES; + LeaveCriticalSection(&m_limiterCS); + } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { + EnterCriticalSection(&m_limiterCS); + atLimit = m_experienceOrbEntities.size() >= MAX_EXPERIENCEORB_ENTITIES; + LeaveCriticalSection(&m_limiterCS); + } + + return atLimit; +} + // Maintain a cound of primed tnt & falling tiles in this level void ServerLevel::entityAddedExtra(std::shared_ptr e) { - if (std::dynamic_pointer_cast(e) != NULL) { + if (e->instanceof(eTYPE_ITEMENTITY)) { EnterCriticalSection(&m_limiterCS); m_itemEntities.push_back(e); // printf("entity added: item entity count now //%d\n",m_itemEntities.size()); LeaveCriticalSection(&m_limiterCS); - } else if (std::dynamic_pointer_cast(e) != NULL) { + } else if (e->instanceof(eTYPE_HANGING_ENTITY)) { EnterCriticalSection(&m_limiterCS); m_hangingEntities.push_back(e); // printf("entity added: item entity count now //%d\n",m_itemEntities.size()); LeaveCriticalSection(&m_limiterCS); - } else if (std::dynamic_pointer_cast(e) != NULL) { + } else if (e->instanceof(eTYPE_ARROW)) { EnterCriticalSection(&m_limiterCS); m_arrowEntities.push_back(e); // printf("entity added: arrow entity count now //%d\n",m_arrowEntities.size()); LeaveCriticalSection(&m_limiterCS); - } else if (std::dynamic_pointer_cast(e) != NULL) { + } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { EnterCriticalSection(&m_limiterCS); m_experienceOrbEntities.push_back(e); // printf("entity added: experience orb entity count now //%d\n",m_arrowEntities.size()); LeaveCriticalSection(&m_limiterCS); - } else if (std::dynamic_pointer_cast(e) != NULL) { + } else if (e->instanceof(eTYPE_PRIMEDTNT)) { EnterCriticalSection(&m_limiterCS); m_primedTntCount++; LeaveCriticalSection(&m_limiterCS); - } else if (std::dynamic_pointer_cast(e) != NULL) { + } else if (e->instanceof(eTYPE_FALLINGTILE)) { EnterCriticalSection(&m_limiterCS); m_fallingTileCount++; LeaveCriticalSection(&m_limiterCS); @@ -1240,7 +1386,7 @@ void ServerLevel::entityAddedExtra(std::shared_ptr e) { // Maintain a cound of primed tnt & falling tiles in this level, and remove any // item entities from our list void ServerLevel::entityRemovedExtra(std::shared_ptr e) { - if (std::dynamic_pointer_cast(e) != NULL) { + if (e->instanceof(eTYPE_ITEMENTITY)) { EnterCriticalSection(&m_limiterCS); // printf("entity removed: item entity count //%d\n",m_itemEntities.size()); @@ -1252,7 +1398,7 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { // printf("entity removed: item entity count now //%d\n",m_itemEntities.size()); LeaveCriticalSection(&m_limiterCS); - } else if (std::dynamic_pointer_cast(e) != NULL) { + } else if (e->instanceof(eTYPE_HANGING_ENTITY)) { EnterCriticalSection(&m_limiterCS); // printf("entity removed: item entity count //%d\n",m_itemEntities.size()); @@ -1265,7 +1411,7 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { // printf("entity removed: item entity count now //%d\n",m_itemEntities.size()); LeaveCriticalSection(&m_limiterCS); - } else if (std::dynamic_pointer_cast(e) != NULL) { + } else if (e->instanceof(eTYPE_ARROW)) { EnterCriticalSection(&m_limiterCS); // printf("entity removed: arrow entity count //%d\n",m_arrowEntities.size()); @@ -1277,7 +1423,7 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { // printf("entity removed: arrow entity count now //%d\n",m_arrowEntities.size()); LeaveCriticalSection(&m_limiterCS); - } else if (std::dynamic_pointer_cast(e) != NULL) { + } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { EnterCriticalSection(&m_limiterCS); // printf("entity removed: experience orb entity count //%d\n",m_arrowEntities.size()); @@ -1290,11 +1436,11 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { // printf("entity removed: experience orb entity count now //%d\n",m_arrowEntities.size()); LeaveCriticalSection(&m_limiterCS); - } else if (std::dynamic_pointer_cast(e) != NULL) { + } else if (e->instanceof(eTYPE_PRIMEDTNT)) { EnterCriticalSection(&m_limiterCS); m_primedTntCount--; LeaveCriticalSection(&m_limiterCS); - } else if (std::dynamic_pointer_cast(e) != NULL) { + } else if (e->instanceof(eTYPE_FALLINGTILE)) { EnterCriticalSection(&m_limiterCS); m_fallingTileCount--; LeaveCriticalSection(&m_limiterCS); @@ -1438,4 +1584,4 @@ void ServerLevel::flagEntitiesToBeRemoved(unsigned int* flags, if (chunkMap) { chunkMap->flagEntitiesToBeRemoved(flags, removedFound); } -} +} \ No newline at end of file diff --git a/Minecraft.Client/Level/ServerLevel.h b/Minecraft.Client/Level/ServerLevel.h index 56b0a9884..a704d6ed7 100644 --- a/Minecraft.Client/Level/ServerLevel.h +++ b/Minecraft.Client/Level/ServerLevel.h @@ -9,7 +9,8 @@ class PlayerChunkMap; class ServerLevel : public Level { private: - static const int EMPTY_TIME_NO_TICK = SharedConstants::TICKS_PER_SECOND * 3; + static const int EMPTY_TIME_NO_TICK = + SharedConstants::TICKS_PER_SECOND * 60; MinecraftServer* server; EntityTracker* tracker; @@ -35,6 +36,8 @@ public: private: bool allPlayersSleeping; + PortalForcer* portalForcer; + MobSpawner* mobSpawner; int emptyTime; bool m_bAtLeastOnePlayerSleeping; // 4J Added static WeighedTreasureArray @@ -68,10 +71,18 @@ public: protected: void tickTiles(); +private: + std::vector toBeTicked; + public: + bool isTileToBeTickedAt(int x, int y, int z, int tileId); void addToTickNextTick(int x, int y, int z, int tileId, int tickDelay); - void forceAddTileTick(int x, int y, int z, int tileId, int tickDelay); + void addToTickNextTick(int x, int y, int z, int tileId, int tickDelay, + int priorityTilt); + void forceAddTileTick(int x, int y, int z, int tileId, int tickDelay, + int prioTilt); void tickEntities(); + void resetEmptyTime(); bool tickPendingTicks(bool force); std::vector* fetchTicksInChunk(LevelChunk* chunk, bool remove); @@ -89,7 +100,7 @@ public: std::vector >* getTileEntitiesInRegion( int x0, int y0, int z0, int x1, int y1, int z1); virtual bool mayInteract(std::shared_ptr player, int xt, int yt, - int zt, int id); + int zt, int content); protected: virtual void initializeLevel(LevelSettings* settings); @@ -141,8 +152,14 @@ protected: public: MinecraftServer* getServer(); EntityTracker* getTracker(); - void setTimeAndAdjustTileTicks(__int64 newTime); + void setTimeAndAdjustTileTicks(int64_t newTime); PlayerChunkMap* getChunkMap(); + PortalForcer* getPortalForcer(); + void sendParticles(const std::wstring& name, double x, double y, double z, + int count); + void sendParticles(const std::wstring& name, double x, double y, double z, + int count, double xDist, double yDist, double zDist, + double speed); void queueSendTileUpdate(int x, int y, int z); // 4J Added private: @@ -170,6 +187,8 @@ public: void entityAddedExtra(std::shared_ptr e); void entityRemovedExtra(std::shared_ptr e); + bool atEntityLimit(std::shared_ptr e); // 4J: Added + virtual bool newPrimedTntAllowed(); virtual bool newFallingTileAllowed(); diff --git a/Minecraft.Client/Level/ServerLevelListener.cpp b/Minecraft.Client/Level/ServerLevelListener.cpp index 0440f6dbc..a421a76db 100644 --- a/Minecraft.Client/Level/ServerLevelListener.cpp +++ b/Minecraft.Client/Level/ServerLevelListener.cpp @@ -19,8 +19,8 @@ ServerLevelListener::ServerLevelListener(MinecraftServer* server, // 4J removed - /* -void ServerLevelListener::addParticle(const std::wstring& name, double x, double -y, double z, double xa, double ya, double za) +void ServerLevelListener::addParticle(const wstring& name, double x, double y, +double z, double xa, double ya, double za) { } */ @@ -67,9 +67,11 @@ void ServerLevelListener::playSound(int iSound, double x, double y, double z, } } -void ServerLevelListener::playSound(std::shared_ptr entity, int iSound, - double x, double y, double z, float volume, - float pitch, float fClipSoundDist) { +void ServerLevelListener::playSoundExceptPlayer(std::shared_ptr player, + int iSound, double x, double y, + double z, float volume, + float pitch, + float fSoundClipDist) { if (iSound < 0) { app.DebugPrintf( "ServerLevelListener received request for sound less than 0, so " @@ -79,8 +81,6 @@ void ServerLevelListener::playSound(std::shared_ptr entity, int iSound, // since we're already playing these in the LevelRenderer::playSound. // The PC version does seem to do this and the result is I can stop // walking , and then I'll hear my footstep sound with a delay - std::shared_ptr player = - std::dynamic_pointer_cast(entity); server->getPlayers()->broadcast( player, x, y, z, volume > 1 ? 16 * volume : 16, level->dimension->id, @@ -108,7 +108,13 @@ void ServerLevelListener::levelEvent(std::shared_ptr source, int type, server->getPlayers()->broadcast( source, x, y, z, 64, level->dimension->id, std::shared_ptr( - new LevelEventPacket(type, x, y, z, data))); + new LevelEventPacket(type, x, y, z, data, false))); +} + +void ServerLevelListener::globalLevelEvent(int type, int sourceX, int sourceY, + int sourceZ, int data) { + server->getPlayers()->broadcastAll(std::shared_ptr( + new LevelEventPacket(type, sourceX, sourceY, sourceZ, data, true))); } void ServerLevelListener::destroyTileProgress(int id, int x, int y, int z, diff --git a/Minecraft.Client/Level/ServerLevelListener.h b/Minecraft.Client/Level/ServerLevelListener.h index 6212df1b1..dc313d558 100644 --- a/Minecraft.Client/Level/ServerLevelListener.h +++ b/Minecraft.Client/Level/ServerLevelListener.h @@ -27,9 +27,10 @@ public: // level's player array, not just the entity storage virtual void playSound(int iSound, double x, double y, double z, float volume, float pitch, float fClipSoundDist); - virtual void playSound(std::shared_ptr entity, int iSound, double x, - double y, double z, float volume, float pitch, - float fClipSoundDist); + virtual void playSoundExceptPlayer(std::shared_ptr player, + int iSound, double x, double y, double z, + float volume, float pitch, + float fSoundClipDist); virtual void setTilesDirty(int x0, int y0, int z0, int x1, int y1, int z1, Level* level); // 4J - added level param virtual void skyColorChanged(); @@ -39,5 +40,7 @@ public: int z); virtual void levelEvent(std::shared_ptr source, int type, int x, int y, int z, int data); + virtual void globalLevelEvent(int type, int sourceX, int sourceY, + int sourceZ, int data); virtual void destroyTileProgress(int id, int x, int y, int z, int progress); }; diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 263788e27..140703f53 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -65,6 +65,7 @@ #include "../Minecraft.World/Entities/Mobs/Villager.h" #include "../Minecraft.World/Level/Storage/SparseLightStorage.h" #include "../Minecraft.World/Level/Storage/SparseDataStorage.h" +#include "../Minecraft.World/Blocks/TileEntities/ChestTileEntity.h" #include "Textures/TextureManager.h" #ifdef _XBOX #include "Platform/Xbox/Network/NetworkPlayerXbox.h" @@ -77,6 +78,7 @@ #include "Platform/Orbis/Network/PsPlusUpsellWrapper_Orbis.h" #endif +// #define DISABLE_SPU_CODE // 4J Turning this on will change the graph at the bottom of the debug overlay // to show the number of packets of each type added per fram // #define DEBUG_RENDER_SHOWS_PACKETS 1 @@ -88,10 +90,10 @@ #define DISABLE_LEVELTICK_THREAD Minecraft* Minecraft::m_instance = NULL; -__int64 Minecraft::frameTimes[512]; -__int64 Minecraft::tickTimes[512]; +int64_t Minecraft::frameTimes[512]; +int64_t Minecraft::tickTimes[512]; int Minecraft::frameTimePos = 0; -__int64 Minecraft::warezTime = 0; +int64_t Minecraft::warezTime = 0; File Minecraft::workDir = File(L""); #ifdef __PSVITA__ @@ -103,8 +105,17 @@ TOUCHSCREENRECT QuickSelectRect[3] = { }; int QuickSelectBoxWidth[3] = {89, 111, 142}; + +// 4J - TomK ToDo: these really shouldn't be magic numbers, it should read the +// hud position from flash. +int iToolTipOffset = 85; + #endif +ResourceLocation Minecraft::DEFAULT_FONT_LOCATION = + ResourceLocation(TN_DEFAULT_FONT); +ResourceLocation Minecraft::ALT_FONT_LOCATION = ResourceLocation(TN_ALT_FONT); + Minecraft::Minecraft(Component* mouseComponent, Canvas* parent, MinecraftApplet* minecraftApplet, int width, int height, bool fullscreen) { @@ -321,10 +332,11 @@ void Minecraft::init() { textures = new Textures(skins, options); // renderLoadingScreen(); - font = new Font(options, L"font/Default.png", textures, false, - TN_DEFAULT_FONT, 23, 20, 8, 8, SFontData::Codepoints); + font = + new Font(options, L"font/Default.png", textures, false, + &DEFAULT_FONT_LOCATION, 23, 20, 8, 8, SFontData::Codepoints); altFont = new Font(options, L"font/alternate.png", textures, false, - TN_ALT_FONT, 16, 16, 8, 8); + &ALT_FONT_LOCATION, 16, 16, 8, 8); // if (options.languageCode != null) { // Language.getInstance().loadLanguage(options.languageCode); @@ -394,6 +406,10 @@ void Minecraft::init() { // openGLCapabilities = new OpenGLCapabilities(); // 4J - removed levelRenderer = new LevelRenderer(this, textures); + // textures->register(&TextureAtlas::LOCATION_BLOCKS, new + // TextureAtlas(Icon::TYPE_TERRAIN, TN_TERRAIN)); + // textures->register(&TextureAtlas::LOCATION_ITEMS, new + // TextureAtlas(Icon::TYPE_ITEM, TN_GUI_ITEMS)); textures->stitch(); glViewport(0, 0, width, height); @@ -529,7 +545,7 @@ File Minecraft::getWorkingDirectory(const std::wstring& applicationName) { LevelStorageSource* Minecraft::getLevelSource() { return levelSource; } -void Minecraft::setScreen(Screen* m_screen) { +void Minecraft::setScreen(Screen* screen) { if (dynamic_cast(this->screen) != NULL) return; if (this->screen != NULL) { @@ -543,12 +559,13 @@ void Minecraft::setScreen(Screen* m_screen) { } stats->forceSave();*/ - if (m_screen == NULL && level == NULL) { - m_screen = new TitleScreen(); + this->screen = screen; + if (screen == NULL && level == NULL) { + screen = new TitleScreen(); } else if (player != NULL && !ui.GetMenuDisplayed(player->GetXboxPad()) && player->getHealth() <= 0) { #ifdef ENABLE_JAVA_GUIS - m_screen = new DeathScreen(); + screen = new DeathScreen(); #else // 4J Stu - If we exit from the death screen then we are saved as being // dead. In the Java game when you load the game you are still dead, but @@ -562,13 +579,12 @@ void Minecraft::setScreen(Screen* m_screen) { #endif } - if (dynamic_cast(m_screen) != NULL) { + if (dynamic_cast(screen) != NULL) { options->renderDebug = false; gui->clearMessages(); } - this->screen = m_screen; - if (m_screen != NULL) { + if (screen != NULL) { // releaseMouse(); // 4J - removed ScreenSizeCalculator ssc(options, width, height); int screenWidth = ssc.getWidth(); @@ -581,29 +597,18 @@ void Minecraft::setScreen(Screen* m_screen) { // 4J-PB - if a screen has been set, go into menu mode // it's possible that player doesn't exist here yet - /*if(screen!=NULL) - { - if(player && player->GetXboxPad()!=-1) - { - InputManager.SetMenuDisplayed(player->GetXboxPad(),true); + // 4jcraft: reuse this for the java GUI +#ifdef ENABLE_JAVA_GUIS + if (screen != NULL && player != NULL) { + if (player && player->GetXboxPad() != -1) { + InputManager.SetMenuDisplayed(player->GetXboxPad(), true); + } + } else if (player != NULL) { + if (player && player->GetXboxPad() != -1) { + InputManager.SetMenuDisplayed(player->GetXboxPad(), false); + } } - else - { - // set all - //InputManager.SetMenuDisplayed(XUSER_INDEX_ANY,true); - } - } - else - { - if(player && player->GetXboxPad()!=-1) - { - InputManager.SetMenuDisplayed(player->GetXboxPad(),false); - } - else - { - //InputManager.SetMenuDisplayed(XUSER_INDEX_ANY,false); - } - }*/ +#endif } void Minecraft::checkGlError(const std::wstring& string) { @@ -627,13 +632,13 @@ void Minecraft::destroy() { setLevel(NULL); // } catch (Throwable e) { // } - Screen* m_screen = screen; - if (m_screen == NULL && level == NULL) { - m_screen = new TitleScreen(); + + if (screen == NULL && level == NULL) { + screen = new TitleScreen(); } else if (player != NULL && !ui.GetMenuDisplayed(player->GetXboxPad()) && player->getHealth() <= 0) { #ifdef ENABLE_JAVA_GUIS - m_screen = new DeathScreen(); + screen = new DeathScreen(); #else // 4J Stu - If we exit from the death screen then we are saved as being // dead. In the Java game when you load the game you are still dead, but @@ -647,13 +652,12 @@ void Minecraft::destroy() { #endif } - if (m_screen != NULL && dynamic_cast(m_screen) != NULL) { + if (screen != NULL && dynamic_cast(screen) != NULL) { options->renderDebug = false; gui->clearMessages(); } - this->screen = m_screen; - if (m_screen != NULL) { + if (screen != NULL) { // releaseMouse(); // 4J - removed ScreenSizeCalculator ssc(options, width, height); int screenWidth = ssc.getWidth(); @@ -667,7 +671,7 @@ void Minecraft::destroy() { // 4J-PB - if a screen has been set, go into menu mode // it's possible that player doesn't exist here yet #ifdef ENABLE_JAVA_GUIS - if (m_screen != NULL) { + if (screen != NULL) { if (player && player->GetXboxPad() != -1) { InputManager.SetMenuDisplayed(player->GetXboxPad(), true); } @@ -713,7 +717,7 @@ void Minecraft::run() return; } - __int64 lastTime = System::currentTimeMillis(); + int64_t lastTime = System::currentTimeMillis(); int frames = 0; while (running) @@ -738,7 +742,7 @@ void Minecraft::run() timer->advanceTime(); } - __int64 beforeTickTime = System::nanoTime(); + int64_t beforeTickTime = System::nanoTime(); for (int i = 0; i < timer->ticks; i++) { ticks++; @@ -750,7 +754,7 @@ void Minecraft::run() // setScreen(new LevelConflictScreen()); // } } - __int64 tickDuraction = System::nanoTime() - beforeTickTime; + int64_t tickDuraction = System::nanoTime() - beforeTickTime; checkGlError(L"Pre render"); TileRenderer::fancy = options->fancyGraphics; @@ -1105,7 +1109,7 @@ std::shared_ptr Minecraft::createExtraLocalPlayer( localplayers[idx]->setOnlineXuid(playerXUIDOnline); localplayers[idx]->setIsGuest(ProfileManager.IsGuest(idx)); - localplayers[idx]->displayName = ProfileManager.GetDisplayName(idx); + localplayers[idx]->m_displayName = ProfileManager.GetDisplayName(idx); localplayers[idx]->m_iScreenSection = tempScreenSection; @@ -1203,7 +1207,7 @@ void Minecraft::removeLocalPlayerIdx(int idx) { #endif // 4J Stu - Adding this back in for exactly the reason my comment above // suggests it was added in the first place -#ifdef _XBOX_ONE +#if defined(_XBOX_ONE) || defined(__ORBIS__) g_NetworkManager.RemoveLocalPlayerByUserIndex(idx); #endif } @@ -1247,7 +1251,7 @@ void Minecraft::createPrimaryLocalPlayer(int iPad) { } void Minecraft::run_middle() { - static __int64 lastTime = 0; + static int64_t lastTime = 0; static bool bFirstTimeIntoGame = true; static bool bAutosaveTimerSet = false; static unsigned int uiAutosaveTimer = 0; @@ -1783,41 +1787,38 @@ void Minecraft::run_middle() { // because of age restriction if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) { - unsigned int uiIDA[1]; + UINT uiIDA[1]; uiIDA[0] = IDS_OK; - ui.RequestMessageBox( + ui.RequestErrorMessage( IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, - uiIDA, 1, i, NULL, NULL, - app.GetStringTable()); + uiIDA, 1, i); } else if (ProfileManager .IsSignedIn(i) && !ProfileManager .IsSignedInLive( i)) { // You're not signed in to PSN! - unsigned int uiIDA[2]; + UINT uiIDA[2]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; uiIDA[1] = IDS_CANCEL; - ui.RequestMessageBox( + ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, i, &Minecraft:: MustSignInReturnedPSN, - this, app.GetStringTable(), - NULL, 0, false); + this); } else #endif { - unsigned int uiIDA[1]; + UINT uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; - ui.RequestMessageBox( + ui.RequestErrorMessage( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, - uiIDA, 1, i, NULL, NULL, - app.GetStringTable()); + uiIDA, 1, i); } } // else @@ -1871,10 +1872,11 @@ void Minecraft::run_middle() { for (unsigned int iPad = XUSER_MAX_COUNT; iPad < (XUSER_MAX_COUNT + InputManager.MAX_GAMEPADS); ++iPad) { - if (InputManager.IsPadLocked(iPad) || - !InputManager.IsPadConnected(iPad)) + bool isPadLocked = InputManager.IsPadLocked(iPad), + isPadConnected = InputManager.IsPadConnected(iPad), + buttonPressed = InputManager.ButtonPressed(iPad); + if (isPadLocked || !isPadConnected || !buttonPressed) continue; - if (!InputManager.ButtonPressed(iPad)) continue; if (!ui.PressStartPlaying(firstEmptyUser)) { ui.ShowPressStart(firstEmptyUser); @@ -1907,7 +1909,7 @@ void Minecraft::run_middle() { timer->advanceTime(); } - //__int64 beforeTickTime = System::nanoTime(); + // int64_t beforeTickTime = System::nanoTime(); for (int i = 0; i < timer->ticks; i++) { bool bLastTimerTick = (i == (timer->ticks - 1)); // 4J-PB - the tick here can run more than once, and this is a @@ -1996,7 +1998,7 @@ void Minecraft::run_middle() { // SparseDataStorage::tick(); // // 4J added } - //__int64 tickDuraction = System::nanoTime() - beforeTickTime; + // int64_t tickDuraction = System::nanoTime() - beforeTickTime; MemSect(31); checkGlError(L"Pre render"); MemSect(0); @@ -2011,7 +2013,7 @@ void Minecraft::run_middle() { PIXBeginNamedEvent(0, "Light update"); - if (level != NULL) level->updateLights(); + // if (level != NULL) level->updateLights(); glEnable(GL_TEXTURE_2D); PIXEndNamedEvent(); @@ -2076,10 +2078,9 @@ void Minecraft::run_middle() { // If there's an unoccupied quadrant, then clear that to black if (unoccupiedQuadrant > -1) { // render a logo - RenderManager.StateSetViewport( - static_cast( - C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT + - unoccupiedQuadrant)); + RenderManager.StateSetViewport((C4JRender::eViewportType)( + C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT + + unoccupiedQuadrant)); glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT); @@ -2114,17 +2115,13 @@ void Minecraft::run_middle() { } */ - /* 4J - removed - if (!Display::isActive()) - { - if (fullscreen) - { - this->toggleFullScreen(); - } - Sleep(10); - } - */ +#if PACKET_ENABLE_STAT_TRACKING + Packet::updatePacketStatsPIX(); +#endif + if (options->renderDebug) { + // renderFpsMeter(tickDuraction); + #if DEBUG_RENDER_SHOWS_PACKETS // To show data for only one packet type // Packet::renderPacketStats(31); @@ -2164,10 +2161,10 @@ void Minecraft::run_middle() { if (width <= 0) width = 1; if (height <= 0) height = 1; - resize(width, height); - } - } - */ + resize(width, height); + } + } + */ MemSect(31); checkGlError(L"Post render"); MemSect(0); @@ -2229,12 +2226,12 @@ void Minecraft::emergencySave() { setLevel(NULL); } -void Minecraft::renderFpsMeter(__int64 tickTime) { +void Minecraft::renderFpsMeter(int64_t tickTime) { int nsPer60Fps = 1000000000l / 60; if (lastTimer == -1) { lastTimer = System::nanoTime(); } - __int64 now = System::nanoTime(); + int64_t now = System::nanoTime(); Minecraft::tickTimes[(Minecraft::frameTimePos) & (Minecraft::frameTimes_length - 1)] = tickTime; Minecraft::frameTimes[(Minecraft::frameTimePos++) & @@ -2272,7 +2269,7 @@ void Minecraft::renderFpsMeter(__int64 tickTime) { (float)(0)); t->end(); - __int64 totalTime = 0; + int64_t totalTime = 0; for (int i = 0; i < Minecraft::frameTimes_length; i++) { totalTime += Minecraft::frameTimes[i]; } @@ -2301,8 +2298,8 @@ void Minecraft::renderFpsMeter(__int64 tickTime) { t->color(0xff000000 + cc * 256); } - __int64 time = Minecraft::frameTimes[i] / 200000; - __int64 time2 = Minecraft::tickTimes[i] / 200000; + int64_t time = Minecraft::frameTimes[i] / 200000; + int64_t time2 = Minecraft::tickTimes[i] / 200000; t->vertex((float)(i + 0.5f), (float)(height - time + 0.5f), (float)(0)); t->vertex((float)(i + 0.5f), (float)(height + 0.5f), (float)(0)); @@ -2322,7 +2319,6 @@ void Minecraft::renderFpsMeter(__int64 tickTime) { } void Minecraft::stop() { - app.DebugPrintf("Minecraft::stop() SET running = false;\n"); running = false; // keepPolling = false; } @@ -2365,17 +2361,15 @@ void Minecraft::resize(int width, int height) { this->height = height; if (screen != NULL) { -#ifdef _ENABLEIGGY // 4jcraft: use adjusted logical width instead of raw width for correct // screen size calculation. ScreenSizeCalculator ssc(options, this->width, height); -#else - ScreenSizeCalculator ssc(options, width, height); -#endif int screenWidth = ssc.getWidth(); int screenHeight = ssc.getHeight(); - // screen->init(this, screenWidth, screenHeight); // 4J - - // TODO - put back in + screen->init( + this, screenWidth, + screenHeight); // 4jcraft: uncommented to immediately scale on + // resize now that we have correct ssc usage } } @@ -2415,8 +2409,7 @@ void Minecraft::levelTickThreadInitFunc() { // textures are to be updated - this will be true for the last time this tick // runs with bFirst true void Minecraft::tick(bool bFirst, bool bUpdateTextures) { - int iPad = -1; - if (player) iPad = player->GetXboxPad(); + int iPad = player->GetXboxPad(); // OutputDebugString("Minecraft::tick\n"); // 4J-PB - only tick this player's stats @@ -2482,27 +2475,24 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { setScreen(NULL); } - // if (screen != NULL) { - // player->missTime = 10000; - // player->lastClickTick[0] = ticks + 10000; - // player->lastClickTick[1] = ticks + 10000; - // } + if (screen != NULL) { + player->missTime = 10000; + player->lastClickTick[0] = ticks + 10000; + player->lastClickTick[1] = ticks + 10000; + } if (screen != NULL) { - InputManager.SetMenuDisplayed(player->GetXboxPad(), true); screen->updateEvents(); if (screen != NULL) { screen->particles->tick(); screen->tick(); } - } else { - InputManager.SetMenuDisplayed(player->GetXboxPad(), false); } if (screen == NULL && !ui.GetMenuDisplayed(iPad)) { // 4J-PB - add some tooltips if required int iA = -1, iB = -1, iX, iY = IDS_CONTROLS_INVENTORY, iLT = -1, - iRT = -1, iLB = -1, iRB = -1; + iRT = -1, iLB = -1, iRB = -1, iLS = -1, iRS = -1; if (player->abilities.instabuild) { iX = IDS_TOOLTIPS_CREATIVE; @@ -2514,6 +2504,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { int* piAction; int* piJump; int* piUse; + int* piAlt; unsigned int uiAction = InputManager.GetGameJoypadMaps( InputManager.GetJoypadMapVal(iPad), MINECRAFT_ACTION_ACTION); @@ -2521,6 +2512,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { InputManager.GetJoypadMapVal(iPad), MINECRAFT_ACTION_JUMP); unsigned int uiUse = InputManager.GetGameJoypadMaps( InputManager.GetJoypadMapVal(iPad), MINECRAFT_ACTION_USE); + unsigned int uiAlt = InputManager.GetGameJoypadMaps( + InputManager.GetJoypadMapVal(iPad), MINECRAFT_ACTION_SNEAK_TOGGLE); // Also need to handle PS3 having swapped triggers/bumpers switch (uiAction) { @@ -2577,6 +2570,15 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { break; } + switch (uiAlt) { + default: + case _360_JOY_BUTTON_LSTICK_RIGHT: + piAlt = &iRS; + break; + + // TODO + } + if (player->isUnderLiquid(Material::water)) { *piJump = IDS_TOOLTIPS_SWIMUP; } else { @@ -2585,11 +2587,23 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { *piUse = -1; *piAction = -1; + *piAlt = -1; // 4J-PB another special case for when the player is sleeping in a bed if (player->isSleeping() && (level != NULL) && level->isClientSide) { *piUse = IDS_TOOLTIPS_WAKEUP; } else { + if (player->isRiding()) { + std::shared_ptr mount = player->riding; + + if (mount->instanceof (eTYPE_MINECART) || mount->instanceof + (eTYPE_BOAT)) { + *piAlt = IDS_TOOLTIPS_EXIT; + } else { + *piAlt = IDS_TOOLTIPS_DISMOUNT; + } + } + // no hit result, but we may have something in our hand that we can // do something with std::shared_ptr itemInstance = @@ -2637,11 +2651,12 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { } break; - case Item::milk_Id: + case Item::bucket_milk_Id: *piUse = IDS_TOOLTIPS_DRINK; break; case Item::fishingRod_Id: // use + case Item::emptyMap_Id: *piUse = IDS_TOOLTIPS_USE; break; @@ -2673,6 +2688,11 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { if (bUseItem) *piUse = IDS_TOOLTIPS_COLLECT; break; + case Item::bucket_lava_Id: + case Item::bucket_water_Id: + *piUse = IDS_TOOLTIPS_EMPTY; + break; + case Item::boat_Id: case Tile::waterLily_Id: if (bUseItem) *piUse = IDS_TOOLTIPS_PLACE; @@ -2740,8 +2760,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { */ if (bUseItemOn && itemInstance != NULL) { switch (itemInstance->getItem()->id) { - case Tile::mushroom1_Id: - case Tile::mushroom2_Id: + case Tile::mushroom_brown_Id: + case Tile::mushroom_red_Id: case Tile::tallgrass_Id: case Tile::cactus_Id: case Tile::sapling_Id: @@ -2761,38 +2781,20 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { break; case Item::seeds_wheat_Id: - case Item::netherStalkSeeds_Id: + case Item::netherwart_seeds_Id: *piUse = IDS_TOOLTIPS_PLANT; break; - case Item::bucket_empty_Id: - switch (iTileID) { - // can collect lava or water in the - // empty bucket - case Tile::water_Id: - case Tile::calmWater_Id: - case Tile::lava_Id: - case Tile::calmLava_Id: - *piUse = IDS_TOOLTIPS_COLLECT; - break; - } - break; - - case Item::bucket_lava_Id: - case Item::bucket_water_Id: - *piUse = IDS_TOOLTIPS_EMPTY; - break; - case Item::dye_powder_Id: // bonemeal grows various plants if (itemInstance->getAuxValue() == DyePowderItem::WHITE) { switch (iTileID) { case Tile::sapling_Id: - case Tile::crops_Id: + case Tile::wheat_Id: case Tile::grass_Id: - case Tile::mushroom1_Id: - case Tile::mushroom2_Id: + case Tile::mushroom_brown_Id: + case Tile::mushroom_red_Id: case Tile::melonStem_Id: case Tile::pumpkinStem_Id: case Tile::carrots_Id: @@ -2812,6 +2814,14 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { *piUse = IDS_TOOLTIPS_IGNITE; break; + case Item::fireworks_Id: + *piUse = IDS_TOOLTIPS_FIREWORK_LAUNCH; + break; + + case Item::lead_Id: + *piUse = IDS_TOOLTIPS_ATTACH; + break; + default: *piUse = IDS_TOOLTIPS_PLACE; break; @@ -2832,10 +2842,28 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { case Tile::button_wood_Id: case Tile::trapdoor_Id: case Tile::fenceGate_Id: + case Tile::beacon_Id: *piAction = IDS_TOOLTIPS_MINE; *piUse = IDS_TOOLTIPS_USE; break; + case Tile::chest_Id: + *piAction = IDS_TOOLTIPS_MINE; + *piUse = (Tile::chest->getContainer(level, x, y, + z) != NULL) + ? IDS_TOOLTIPS_OPEN + : -1; + break; + + case Tile::enderChest_Id: + case Tile::chest_trap_Id: + case Tile::dropper_Id: + case Tile::hopper_Id: + *piUse = IDS_TOOLTIPS_OPEN; + *piAction = IDS_TOOLTIPS_MINE; + break; + + case Tile::activatorRail_Id: case Tile::goldenRail_Id: case Tile::detectorRail_Id: case Tile::rail_Id: @@ -2843,18 +2871,12 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { *piAction = IDS_TOOLTIPS_MINE; break; - case Tile::chest_Id: - case Tile::enderChest_Id: - *piUse = IDS_TOOLTIPS_OPEN; - *piAction = IDS_TOOLTIPS_MINE; - break; - case Tile::bed_Id: if (bUseItemOn) *piUse = IDS_TOOLTIPS_SLEEP; *piAction = IDS_TOOLTIPS_MINE; break; - case Tile::musicBlock_Id: + case Tile::noteblock_Id: // if in creative mode, we will mine if (player->abilities.instabuild) *piAction = IDS_TOOLTIPS_MINE; @@ -2901,7 +2923,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { } break; - case Tile::recordPlayer_Id: + case Tile::jukebox_Id: if (!bUseItemOn && itemInstance != NULL) { int iID = itemInstance->getItem()->id; if ((iID >= Item::record_01_Id) && @@ -2910,7 +2932,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { } *piAction = IDS_TOOLTIPS_MINE; } else { - if (Tile::recordPlayer->TestUse( + if (Tile::jukebox->TestUse( level, x, y, z, player)) // means we can eject { @@ -2930,8 +2952,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { case Tile::flower_Id: case Tile::rose_Id: case Tile::sapling_Id: - case Tile::mushroom1_Id: - case Tile::mushroom2_Id: + case Tile::mushroom_brown_Id: + case Tile::mushroom_red_Id: case Tile::cactus_Id: case Tile::deadBush_Id: *piUse = IDS_TOOLTIPS_PLANT; @@ -2949,6 +2971,30 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { *piAction = IDS_TOOLTIPS_MINE; break; + case Tile::comparator_off_Id: + case Tile::comparator_on_Id: + *piUse = IDS_TOOLTIPS_USE; + *piAction = IDS_TOOLTIPS_MINE; + break; + + case Tile::diode_off_Id: + case Tile::diode_on_Id: + *piUse = IDS_TOOLTIPS_USE; + *piAction = IDS_TOOLTIPS_MINE; + break; + + case Tile::redStoneOre_Id: + if (bUseItemOn) *piUse = IDS_TOOLTIPS_USE; + *piAction = IDS_TOOLTIPS_MINE; + break; + + case Tile::door_iron_Id: + if (*piUse == IDS_TOOLTIPS_PLACE) { + *piUse = -1; + } + *piAction = IDS_TOOLTIPS_MINE; + break; + default: *piAction = IDS_TOOLTIPS_MINE; break; @@ -2958,305 +3004,323 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { case HitResult::ENTITY: eINSTANCEOF entityType = hitResult->entity->GetType(); - if (gameMode != NULL && - gameMode->getTutorial() != NULL) { + if ((gameMode != NULL) && + (gameMode->getTutorial() != NULL)) { // 4J Stu - For the tutorial we want to be able to // record what items we look at so that we can give // hints - gameMode->getTutorial()->onLookAtEntity(entityType); + gameMode->getTutorial()->onLookAtEntity( + hitResult->entity); } + std::shared_ptr heldItem = nullptr; + if (player->inventory->IsHeldItem()) { + heldItem = player->inventory->getSelected(); + } + int heldItemId = + heldItem != NULL ? heldItem->getItem()->id : -1; + switch (entityType) { - case eTYPE_CHICKEN: + case eTYPE_CHICKEN: { if (player->isAllowedToAttackAnimals()) *piAction = IDS_TOOLTIPS_HIT; - // is there an object in hand? - if (player->inventory->IsHeldItem()) { - std::shared_ptr heldItem = - player->inventory->getSelected(); - int iID = heldItem->getItem()->id; - switch (iID) { - default: { - std::shared_ptr animal = - std::dynamic_pointer_cast< - Animal>(hitResult->entity); + std::shared_ptr animal = + std::dynamic_pointer_cast( + hitResult->entity); - if (!animal->isBaby() && - !animal->isInLove() && - (animal->getAge() == 0) && - animal->isFood(heldItem)) { - *piUse = IDS_TOOLTIPS_LOVEMODE; - } - } break; - } + if (animal->isLeashed() && + animal->getLeashHolder() == player) { + *piUse = IDS_TOOLTIPS_UNLEASH; + break; } - break; - case eTYPE_COW: + switch (heldItemId) { + case Item::nameTag_Id: + *piUse = IDS_TOOLTIPS_NAME; + break; + + case Item::lead_Id: + if (!animal->isLeashed()) + *piUse = IDS_TOOLTIPS_LEASH; + break; + + default: { + if (!animal->isBaby() && + !animal->isInLove() && + (animal->getAge() == 0) && + animal->isFood(heldItem)) { + *piUse = IDS_TOOLTIPS_LOVEMODE; + } + } break; + + case -1: + break; // 4J-JEV: Empty hand. + } + } break; + + case eTYPE_COW: { if (player->isAllowedToAttackAnimals()) *piAction = IDS_TOOLTIPS_HIT; - // is there an object in hand? - if (player->inventory->IsHeldItem()) { - std::shared_ptr heldItem = - player->inventory->getSelected(); - int iID = heldItem->getItem()->id; - // It's an item - switch (iID) { - // Things to USE - case Item::bucket_empty_Id: - *piUse = IDS_TOOLTIPS_MILK; - break; - default: { - std::shared_ptr animal = - std::dynamic_pointer_cast< - Animal>(hitResult->entity); + std::shared_ptr animal = + std::dynamic_pointer_cast( + hitResult->entity); - if (!animal->isBaby() && - !animal->isInLove() && - (animal->getAge() == 0) && - animal->isFood(heldItem)) { - *piUse = IDS_TOOLTIPS_LOVEMODE; - } - } break; - } + if (animal->isLeashed() && + animal->getLeashHolder() == player) { + *piUse = IDS_TOOLTIPS_UNLEASH; + break; } - break; - case eTYPE_MUSHROOMCOW: - // is there an object in hand? - if (player->inventory->IsHeldItem()) { - if (player->isAllowedToAttackAnimals()) - *piAction = IDS_TOOLTIPS_HIT; - std::shared_ptr heldItem = - player->inventory->getSelected(); - int iID = heldItem->getItem()->id; + switch (heldItemId) { + // Things to USE + case Item::nameTag_Id: + *piUse = IDS_TOOLTIPS_NAME; + break; + case Item::lead_Id: + if (!animal->isLeashed()) + *piUse = IDS_TOOLTIPS_LEASH; + break; + case Item::bucket_empty_Id: + *piUse = IDS_TOOLTIPS_MILK; + break; + default: { + if (!animal->isBaby() && + !animal->isInLove() && + (animal->getAge() == 0) && + animal->isFood(heldItem)) { + *piUse = IDS_TOOLTIPS_LOVEMODE; + } + } break; - // It's an item - switch (iID) { - // Things to USE - case Item::bowl_Id: - case Item:: - bucket_empty_Id: // You can milk a - // mooshroom with - // either a bowl - // (mushroom soup) - // or a bucket - // (milk)! - *piUse = IDS_TOOLTIPS_MILK; - break; - case Item::shears_Id: { - if (player - ->isAllowedToAttackAnimals()) - *piAction = IDS_TOOLTIPS_HIT; - std::shared_ptr animal = - std::dynamic_pointer_cast< - Animal>(hitResult->entity); - if (!animal->isBaby()) - *piUse = IDS_TOOLTIPS_SHEAR; - } break; - default: { - std::shared_ptr animal = - std::dynamic_pointer_cast< - Animal>(hitResult->entity); - - if (!animal->isBaby() && - !animal->isInLove() && - (animal->getAge() == 0) && - animal->isFood(heldItem)) { - *piUse = IDS_TOOLTIPS_LOVEMODE; - } - } break; - } - } else { - // 4J-PB - Fix for #13081 - No tooltip is - // displayed for hitting a cow when you have - // nothing in your hand nothing in your hand - if (player->isAllowedToAttackAnimals()) - *piAction = IDS_TOOLTIPS_HIT; + case -1: + break; // 4J-JEV: Empty hand. } - break; + } break; + case eTYPE_MUSHROOMCOW: { + // 4J-PB - Fix for #13081 - No tooltip is + // displayed for hitting a cow when you have + // nothing in your hand + if (player->isAllowedToAttackAnimals()) + *piAction = IDS_TOOLTIPS_HIT; + + std::shared_ptr animal = + std::dynamic_pointer_cast( + hitResult->entity); + + if (animal->isLeashed() && + animal->getLeashHolder() == player) { + *piUse = IDS_TOOLTIPS_UNLEASH; + break; + } + + // It's an item + switch (heldItemId) { + // Things to USE + case Item::nameTag_Id: + *piUse = IDS_TOOLTIPS_NAME; + break; + + case Item::lead_Id: + if (!animal->isLeashed()) + *piUse = IDS_TOOLTIPS_LEASH; + break; + + case Item::bowl_Id: + case Item:: + bucket_empty_Id: // You can milk a + // mooshroom with + // either a bowl + // (mushroom soup) or + // a bucket (milk)! + *piUse = IDS_TOOLTIPS_MILK; + break; + case Item::shears_Id: { + if (player->isAllowedToAttackAnimals()) + *piAction = IDS_TOOLTIPS_HIT; + if (!animal->isBaby()) + *piUse = IDS_TOOLTIPS_SHEAR; + } break; + default: { + if (!animal->isBaby() && + !animal->isInLove() && + (animal->getAge() == 0) && + animal->isFood(heldItem)) { + *piUse = IDS_TOOLTIPS_LOVEMODE; + } + } break; + + case -1: + break; // 4J-JEV: Empty hand. + } + } break; case eTYPE_BOAT: *piAction = IDS_TOOLTIPS_MINE; - - // are we in the boat already? - if (std::dynamic_pointer_cast( - player->riding) != NULL) { - *piUse = IDS_TOOLTIPS_EXIT; - } else { - *piUse = IDS_TOOLTIPS_SAIL; - } + *piUse = IDS_TOOLTIPS_SAIL; break; - case eTYPE_MINECART: + + case eTYPE_MINECART_RIDEABLE: *piAction = IDS_TOOLTIPS_MINE; - // are we in the minecart already? - if (std::dynamic_pointer_cast( - player->riding) != NULL) { - *piUse = IDS_TOOLTIPS_EXIT; - } else { - switch (std::dynamic_pointer_cast( - hitResult->entity) - ->type) { - case Minecart::RIDEABLE: - *piUse = IDS_TOOLTIPS_RIDE; - break; - case Minecart::CHEST: - *piUse = IDS_TOOLTIPS_OPEN; - break; - case Minecart::FURNACE: - // if you have coal, it'll go - // is there an object in hand? - if (player->inventory - ->IsHeldItem()) { - std::shared_ptr - heldItem = - player->inventory - ->getSelected(); - int iID = - heldItem->getItem()->id; - - if (iID == Item::coal->id) { - *piUse = IDS_TOOLTIPS_USE; - } else { - *piUse = IDS_TOOLTIPS_HIT; - } - } - break; - } - } - + *piUse = + IDS_TOOLTIPS_RIDE; // are we in the + // minecart already? - + // 4J-JEV: Doesn't + // matter anymore. break; - case eTYPE_SHEEP: + + case eTYPE_MINECART_FURNACE: + *piAction = IDS_TOOLTIPS_MINE; + + // if you have coal, it'll go. Is there an + // object in hand? + if (heldItemId == Item::coal_Id) + *piUse = IDS_TOOLTIPS_USE; + break; + + case eTYPE_MINECART_CHEST: + case eTYPE_MINECART_HOPPER: + *piAction = IDS_TOOLTIPS_MINE; + *piUse = IDS_TOOLTIPS_OPEN; + break; + + case eTYPE_MINECART_SPAWNER: + case eTYPE_MINECART_TNT: + *piUse = IDS_TOOLTIPS_MINE; + break; + + case eTYPE_SHEEP: { // can dye a sheep if (player->isAllowedToAttackAnimals()) *piAction = IDS_TOOLTIPS_HIT; - if (player->inventory->IsHeldItem()) { - std::shared_ptr heldItem = - player->inventory->getSelected(); - int iID = heldItem->getItem()->id; - switch (iID) { - case Item::dye_powder_Id: { - std::shared_ptr sheep = - std::dynamic_pointer_cast< - Sheep>(hitResult->entity); - // convert to tile-based color value - // (0 is white instead of black) - int newColor = ClothTile:: - getTileDataForItemAuxValue( - heldItem->getAuxValue()); + std::shared_ptr sheep = + std::dynamic_pointer_cast( + hitResult->entity); - // can only use a dye on sheep that - // haven't been sheared - if (!(sheep->isSheared() && - sheep->getColor() != - newColor)) { - *piUse = IDS_TOOLTIPS_DYE; - } - } break; - case Item::shears_Id: { - std::shared_ptr sheep = - std::dynamic_pointer_cast< - Sheep>(hitResult->entity); - - // can only shear a sheep that - // hasn't been sheared - if (!sheep->isSheared()) { - *piUse = IDS_TOOLTIPS_SHEAR; - } - } - - break; - default: { - std::shared_ptr animal = - std::dynamic_pointer_cast< - Animal>(hitResult->entity); - - if (!animal->isBaby() && - !animal->isInLove() && - (animal->getAge() == 0) && - animal->isFood(heldItem)) { - *piUse = IDS_TOOLTIPS_LOVEMODE; - } - } break; - } + if (sheep->isLeashed() && + sheep->getLeashHolder() == player) { + *piUse = IDS_TOOLTIPS_UNLEASH; + break; } - break; - case eTYPE_PIG: + switch (heldItemId) { + case Item::nameTag_Id: + *piUse = IDS_TOOLTIPS_NAME; + break; + + case Item::lead_Id: + if (!sheep->isLeashed()) + *piUse = IDS_TOOLTIPS_LEASH; + break; + + case Item::dye_powder_Id: { + // convert to tile-based color value (0 + // is white instead of black) + int newColor = ColoredTile:: + getTileDataForItemAuxValue( + heldItem->getAuxValue()); + + // can only use a dye on sheep that + // haven't been sheared + if (!(sheep->isSheared() && + sheep->getColor() != newColor)) { + *piUse = IDS_TOOLTIPS_DYE; + } + } break; + case Item::shears_Id: { + // can only shear a sheep that hasn't + // been sheared + if (!sheep->isBaby() && + !sheep->isSheared()) { + *piUse = IDS_TOOLTIPS_SHEAR; + } + } + + break; + default: { + if (!sheep->isBaby() && + !sheep->isInLove() && + (sheep->getAge() == 0) && + sheep->isFood(heldItem)) { + *piUse = IDS_TOOLTIPS_LOVEMODE; + } + } break; + + case -1: + break; // 4J-JEV: Empty hand. + } + } break; + + case eTYPE_PIG: { // can ride a pig if (player->isAllowedToAttackAnimals()) *piAction = IDS_TOOLTIPS_HIT; - if (std::dynamic_pointer_cast( - player->riding) != NULL) { - *piUse = IDS_TOOLTIPS_EXIT; - } else { - // does the pig have a saddle? - if (std::dynamic_pointer_cast( - hitResult->entity) - ->hasSaddle()) { - *piUse = IDS_TOOLTIPS_RIDE; - } else if (!std::dynamic_pointer_cast( - hitResult->entity) - ->isBaby()) { - if (player->inventory->IsHeldItem()) { - std::shared_ptr - heldItem = player->inventory - ->getSelected(); - int iID = heldItem->getItem()->id; - switch (iID) { - case Item::saddle_Id: + std::shared_ptr pig = + std::dynamic_pointer_cast( + hitResult->entity); + + if (pig->isLeashed() && + pig->getLeashHolder() == player) { + *piUse = IDS_TOOLTIPS_UNLEASH; + } else if (heldItemId == Item::lead_Id) { + if (!pig->isLeashed()) + *piUse = IDS_TOOLTIPS_LEASH; + } else if (heldItemId == Item::nameTag_Id) { + *piUse = IDS_TOOLTIPS_NAME; + } else if (pig->hasSaddle()) // does the pig + // have a saddle? + { + *piUse = IDS_TOOLTIPS_MOUNT; + } else if (!pig->isBaby()) { + if (player->inventory->IsHeldItem()) { + switch (heldItemId) { + case Item::saddle_Id: + *piUse = IDS_TOOLTIPS_SADDLE; + break; + + default: { + if (!pig->isInLove() && + (pig->getAge() == 0) && + pig->isFood(heldItem)) { *piUse = - IDS_TOOLTIPS_SADDLE; - break; - default: { - std::shared_ptr - animal = std:: - dynamic_pointer_cast< - Animal>( - hitResult - ->entity); - - if (!animal->isBaby() && - !animal->isInLove() && - (animal->getAge() == - 0) && - animal->isFood( - heldItem)) { - *piUse = - IDS_TOOLTIPS_LOVEMODE; - } - } break; - } + IDS_TOOLTIPS_LOVEMODE; + } + } break; } } } + } break; - break; case eTYPE_WOLF: // can be tamed, fed, and made to sit/stand, or // enter love mode { - int iID = -1; - std::shared_ptr heldItem = - nullptr; std::shared_ptr wolf = std::dynamic_pointer_cast( hitResult->entity); - if (player->inventory->IsHeldItem()) { - heldItem = - player->inventory->getSelected(); - iID = heldItem->getItem()->id; - } - if (player->isAllowedToAttackAnimals()) *piAction = IDS_TOOLTIPS_HIT; - switch (iID) { + if (wolf->isLeashed() && + wolf->getLeashHolder() == player) { + *piUse = IDS_TOOLTIPS_UNLEASH; + break; + } + + switch (heldItemId) { + case Item::nameTag_Id: + *piUse = IDS_TOOLTIPS_NAME; + break; + + case Item::lead_Id: + if (!wolf->isLeashed()) + *piUse = IDS_TOOLTIPS_LEASH; + break; + case Item::bone_Id: if (!wolf->isAngry() && !wolf->isTame()) { @@ -3280,7 +3344,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { break; case Item::dye_powder_Id: if (wolf->isTame()) { - if (ClothTile:: + if (ColoredTile:: getTileDataForItemAuxValue( heldItem ->getAuxValue()) != @@ -3331,23 +3395,23 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { } } break; - case eTYPE_OZELOT: { - int iID = -1; - std::shared_ptr heldItem = - nullptr; - std::shared_ptr ocelot = - std::dynamic_pointer_cast( + case eTYPE_OCELOT: { + std::shared_ptr ocelot = + std::dynamic_pointer_cast( hitResult->entity); - if (player->inventory->IsHeldItem()) { - heldItem = player->inventory->getSelected(); - iID = heldItem->getItem()->id; - } - if (player->isAllowedToAttackAnimals()) *piAction = IDS_TOOLTIPS_HIT; - if (ocelot->isTame()) { + if (ocelot->isLeashed() && + ocelot->getLeashHolder() == player) { + *piUse = IDS_TOOLTIPS_UNLEASH; + } else if (heldItemId == Item::lead_Id) { + if (!ocelot->isLeashed()) + *piUse = IDS_TOOLTIPS_LEASH; + } else if (heldItemId == Item::nameTag_Id) { + *piUse = IDS_TOOLTIPS_NAME; + } else if (ocelot->isTame()) { // 4J-PB - if you have a raw fish in your // hand, you will feed the ocelot rather // than have it sit/follow @@ -3365,24 +3429,19 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { } else if (equalsIgnoreCase( player->getUUID(), - ocelot->getOwnerUUID())) { + ocelot->getOwnerUUID()) && + !ocelot->isSittingOnTile()) { if (ocelot->isSitting()) { *piUse = IDS_TOOLTIPS_FOLLOWME; } else { *piUse = IDS_TOOLTIPS_SIT; } } - } else if (iID != -1) { - switch (iID) { - default: { - if (ocelot->isFood(heldItem)) - *piUse = IDS_TOOLTIPS_TAME; - } break; - } + } else if (heldItemId >= 0) { + if (ocelot->isFood(heldItem)) + *piUse = IDS_TOOLTIPS_TAME; } - } - - break; + } break; case eTYPE_PLAYER: { // Fix for #58576 - TU6: Content: Gameplay: Hit @@ -3410,6 +3469,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { } } } break; + case eTYPE_ITEM_FRAME: { std::shared_ptr itemFrame = std::dynamic_pointer_cast( @@ -3421,14 +3481,16 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { *piUse = IDS_TOOLTIPS_ROTATE; } else { // is there an object in hand? - if (player->inventory->IsHeldItem()) { + if (heldItemId >= 0) *piUse = IDS_TOOLTIPS_PLACE; - } } *piAction = IDS_TOOLTIPS_HIT; } break; + case eTYPE_VILLAGER: { + // 4J-JEV: Cannot leash villagers. + std::shared_ptr villager = std::dynamic_pointer_cast( hitResult->entity); @@ -3437,29 +3499,144 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { } *piAction = IDS_TOOLTIPS_HIT; } break; + case eTYPE_ZOMBIE: { std::shared_ptr zomb = std::dynamic_pointer_cast( hitResult->entity); - std::shared_ptr heldItem = - nullptr; + static GoldenAppleItem* goldapple = + (GoldenAppleItem*)Item::apple_gold; - if (player->inventory->IsHeldItem()) { - heldItem = player->inventory->getSelected(); - } - - if (zomb->isVillager() && - zomb->isWeakened() // zomb->hasEffect(MobEffect::weakness) - // - not present on - // client. - && heldItem != NULL && - heldItem->getItem()->id == - Item::apple_gold_Id) { + // zomb->hasEffect(MobEffect::weakness) - not + // present on client. + if (zomb->isVillager() && zomb->isWeakened() && + (heldItemId == Item::apple_gold_Id) && + !goldapple->isFoil(heldItem)) { *piUse = IDS_TOOLTIPS_CURE; } *piAction = IDS_TOOLTIPS_HIT; } break; + + case eTYPE_HORSE: { + std::shared_ptr horse = + std::dynamic_pointer_cast( + hitResult->entity); + + bool heldItemIsFood = false, + heldItemIsLove = false, + heldItemIsArmour = false; + + switch (heldItemId) { + case Item::wheat_Id: + case Item::sugar_Id: + case Item::bread_Id: + case Tile::hayBlock_Id: + case Item::apple_Id: + heldItemIsFood = true; + break; + case Item::carrotGolden_Id: + case Item::apple_gold_Id: + heldItemIsLove = true; + heldItemIsFood = true; + break; + case Item::horseArmorDiamond_Id: + case Item::horseArmorGold_Id: + case Item::horseArmorMetal_Id: + heldItemIsArmour = true; + break; + } + + if (horse->isLeashed() && + horse->getLeashHolder() == player) { + *piUse = IDS_TOOLTIPS_UNLEASH; + } else if (heldItemId == Item::lead_Id) { + if (!horse->isLeashed()) + *piUse = IDS_TOOLTIPS_LEASH; + } else if (heldItemId == Item::nameTag_Id) { + *piUse = IDS_TOOLTIPS_NAME; + } else if (horse->isBaby()) // 4J-JEV: Can't + // ride baby horses + // due to morals. + { + if (heldItemIsFood) { + // 4j - Can feed foles to speed growth. + *piUse = IDS_TOOLTIPS_FEED; + } + } else if (!horse->isTamed()) { + if (heldItemId == -1) { + // 4j - Player not holding anything, + // ride and attempt to break untamed + // horse. + *piUse = IDS_TOOLTIPS_TAME; + } else if (heldItemIsFood) { + // 4j - Attempt to make it like you more + // by feeding it. + *piUse = IDS_TOOLTIPS_FEED; + } + } else if (player->isSneaking() || + (heldItemId == Item::saddle_Id) || + (horse->canWearArmor() && + heldItemIsArmour)) { + // 4j - Access horses inventory + if (*piUse == -1) + *piUse = IDS_TOOLTIPS_OPEN; + } else if (horse->canWearBags() && + !horse->isChestedHorse() && + (heldItemId == Tile::chest_Id)) { + // 4j - Attach saddle-bags (chest) to donkey + // or mule. + *piUse = IDS_TOOLTIPS_ATTACH; + } else if (horse->isReadyForParenting() && + heldItemIsLove) { + // 4j - Different food to mate horses. + *piUse = IDS_TOOLTIPS_LOVEMODE; + } else if (heldItemIsFood && + (horse->getHealth() < + horse->getMaxHealth())) { + // 4j - Horse is damaged and can eat held + // item to heal + *piUse = IDS_TOOLTIPS_HEAL; + } else { + // 4j - Ride tamed horse. + *piUse = IDS_TOOLTIPS_MOUNT; + } + + if (player->isAllowedToAttackAnimals()) + *piAction = IDS_TOOLTIPS_HIT; + } break; + + case eTYPE_ENDERDRAGON: + // 4J-JEV: Enderdragon cannot be named. + *piAction = IDS_TOOLTIPS_HIT; + break; + + case eTYPE_LEASHFENCEKNOT: + *piAction = IDS_TOOLTIPS_UNLEASH; + if (heldItemId == Item::lead_Id && + LeashItem::bindPlayerMobsTest( + player, level, player->x, player->y, + player->z)) { + *piUse = IDS_TOOLTIPS_ATTACH; + } else { + *piUse = IDS_TOOLTIPS_UNLEASH; + } + break; + default: + if (hitResult->entity->instanceof (eTYPE_MOB)) { + std::shared_ptr mob = + std::dynamic_pointer_cast( + hitResult->entity); + if (mob->isLeashed() && + mob->getLeashHolder() == player) { + *piUse = IDS_TOOLTIPS_UNLEASH; + } else if (heldItemId == Item::lead_Id) { + if (!mob->isLeashed()) + *piUse = IDS_TOOLTIPS_LEASH; + } else if (heldItemId == Item::nameTag_Id) { + *piUse = IDS_TOOLTIPS_NAME; + } + } *piAction = IDS_TOOLTIPS_HIT; break; } @@ -3468,7 +3645,10 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { } } - ui.SetTooltips(iPad, iA, iB, iX, iY, iLT, iRT, iLB, iRB); + // 4J-JEV: Don't set tooltips when we're reloading the skin, it'll + // crash. + if (!ui.IsReloadingSkin()) + ui.SetTooltips(iPad, iA, iB, iX, iY, iLT, iRT, iLB, iRB, iLS, iRS); int wheel = 0; unsigned int leftTicks = @@ -3502,6 +3682,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { options->flySpeed += wheel * .25f; } } + if (gameMode->isInputAllowed(MINECRAFT_ACTION_ACTION)) { if ((player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_ACTION))) // if(InputManager.ButtonPressed(iPad, MINECRAFT_ACTION_ACTION) ) @@ -3640,9 +3821,9 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { if ((player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_SPAWN_CREEPER)) && app.GetMobsDontAttackEnabled()) { - // std::shared_ptr mob = + // shared_ptr mob = // std::dynamic_pointer_cast(Creeper::_class->newInstance( - // level )); std::shared_ptr mob = + // level )); shared_ptr mob = // std::dynamic_pointer_cast(Wolf::_class->newInstance( // level )); std::shared_ptr mob = std::dynamic_pointer_cast( @@ -3678,9 +3859,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { if ((player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_INVENTORY)) && gameMode->isInputAllowed(MINECRAFT_ACTION_INVENTORY)) { - std::shared_ptr player = - std::dynamic_pointer_cast( - Minecraft::GetInstance()->player); + std::shared_ptr player = + Minecraft::GetInstance()->player; ui.PlayUISFX(eSFX_Press); #ifdef ENABLE_JAVA_GUIS setScreen(new InventoryScreen(player)); @@ -3691,9 +3871,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { if ((player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_CRAFTING)) && gameMode->isInputAllowed(MINECRAFT_ACTION_CRAFTING)) { - std::shared_ptr player = - std::dynamic_pointer_cast( - Minecraft::GetInstance()->player); + std::shared_ptr player = + Minecraft::GetInstance()->player; // 4J-PB - reordered the if statement so creative mode doesn't bring // up the crafting table Fix for #39014 - TU5: Creative Mode: @@ -3748,20 +3927,25 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { player->drop(); } - __uint64 ullButtonsPressed = player->ullButtonsPressed; + uint64_t ullButtonsPressed = player->ullButtonsPressed; bool selected = false; - #ifdef __PSVITA__ // 4J-PB - use the touchscreen for quickselect SceTouchData* pTouchData = InputManager.GetTouchPadData(iPad, false); if (pTouchData->reportNum == 1) { int iHudSize = app.GetGameSettings(iPad, eGameSetting_UISize); + int iYOffset = (app.GetGameSettings(ProfileManager.GetPrimaryPad(), + eGameSetting_Tooltips) == 0) + ? iToolTipOffset + : 0; if ((pTouchData->report[0].x > QuickSelectRect[iHudSize].left) && (pTouchData->report[0].x < QuickSelectRect[iHudSize].right) && - (pTouchData->report[0].y > QuickSelectRect[iHudSize].top) && - (pTouchData->report[0].y < QuickSelectRect[iHudSize].bottom)) { + (pTouchData->report[0].y > + QuickSelectRect[iHudSize].top + iYOffset) && + (pTouchData->report[0].y < + QuickSelectRect[iHudSize].bottom + iYOffset)) { player->inventory->selected = (pTouchData->report[0].x - QuickSelectRect[iHudSize].left) / QuickSelectBoxWidth[iHudSize]; @@ -3834,14 +4018,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { int wheel = Mouse.getEventDWheel(); if (wheel != 0) { player->inventory.swapPaint(wheel); - { - int hotbarSlot = InputManager.GetHotbarSlotPressed(iPad); - if (hotbarSlot >= 0 && gameMode->isInputAllowed(MINECRAFT_ACTION_LEFT_SCROLL)) - { - player->inventory->selected = hotbarSlot; - selected = true; - } - } + if (options.isFlying) { if (wheel > 0) wheel = 1; if (wheel < 0) wheel = -1; @@ -4045,8 +4222,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { // } if (levels[i] != NULL) { if (!pause) { - if (levels[i]->lightningBoltTime > 0) - levels[i]->lightningBoltTime--; + if (levels[i]->skyFlashTime > 0) levels[i]->skyFlashTime--; PIXBeginNamedEvent(0, "Level entity tick"); levels[i]->tickEntities(); PIXEndNamedEvent(); @@ -4065,7 +4241,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { Camera::prepare( localplayers[idx], localplayers[idx]->ThirdPersonView() == 2); - std::shared_ptr cameraEntity = + std::shared_ptr cameraEntity = cameraTargetPlayer; double xOff = cameraEntity->xOld + @@ -4194,9 +4370,9 @@ MultiPlayerLevel* Minecraft::getLevel(int dimension) { //} // Also causing ambiguous call for some reason -// as it is matching std::shared_ptr from the func below with bool from -// this one -// void Minecraft::setLevel(Level *level, const std::wstring& message, bool +// as it is matching shared_ptr from the func below with bool from this +// one +// void Minecraft::setLevel(Level *level, const wstring& message, bool // doForceStatsSave /*= true*/) //{ // setLevel(level, message, NULL, doForceStatsSave); @@ -4337,7 +4513,8 @@ void Minecraft::setLevel(MultiPlayerLevel* level, int message /*=-1*/, player->setXuid(playerXUIDOffline); player->setOnlineXuid(playerXUIDOnline); - player->displayName = ProfileManager.GetDisplayName(iPrimaryPlayer); + player->m_displayName = + ProfileManager.GetDisplayName(iPrimaryPlayer); player->resetPos(); gameMode->initPlayer(player); @@ -4446,9 +4623,9 @@ void Minecraft::prepareLevel(int title) { this->progressRenderer->progressStagePercentage((pp++) * 100 / max); level->getTile(spawnPos->x + x, 64, spawnPos->z + z); - if (!gameMode->isCutScene()) { - while (level->updateLights()); - } + // if (!gameMode->isCutScene()) { + // while (level->updateLights()); + // } } } delete spawnPos; @@ -4529,7 +4706,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) { player->setOnlineXuid(playerXUIDOnline); player->setIsGuest(ProfileManager.IsGuest(iTempPad)); - player->displayName = ProfileManager.GetDisplayName(iPad); + player->m_displayName = ProfileManager.GetDisplayName(iPad); player->SetXboxPad(iTempPad); @@ -4727,34 +4904,32 @@ void Minecraft::main() { #endif // 4J Stu - This block generates XML for the game rules schema - // for(unsigned int i = 0; i < Item::items.length; ++i) - //{ - // if(Item::items[i] != NULL) - // { - // wprintf(L"%ls\n", - // i, app.GetString( Item::items[i]->getDescriptionId() )); - // } - //} +#if 0 + for(unsigned int i = 0; i < Item::items.length; ++i) + { + if(Item::items[i] != NULL) + { + app.DebugPrintf("%ls\n", i, app.GetString( Item::items[i]->getDescriptionId() )); + } + } - // wprintf(L"\n\n\n\n\n"); - // - // for(unsigned int i = 0; i < 256; ++i) - //{ - // if(Tile::tiles[i] != NULL) - // { - // wprintf(L"%ls\n", - // i, app.GetString( Tile::tiles[i]->getDescriptionId() )); - // } - // } - //__debugbreak(); + app.DebugPrintf("\n\n\n\n\n"); + + for(unsigned int i = 0; i < 256; ++i) + { + if(Tile::tiles[i] != NULL) + { + app.DebugPrintf("%ls\n", i, app.GetString( Tile::tiles[i]->getDescriptionId() )); + } + } + __debugbreak(); +#endif // 4J-PB - Can't call this for the first 5 seconds of a game - MS rule // if (ProfileManager.IsFullVersion()) { name = - L"Player" + _toString<__int64>(System::currentTimeMillis() % 1000); + L"Player" + _toString(System::currentTimeMillis() % 1000); sessionId = L"-"; /* 4J - TODO - get a session ID from somewhere? if (args.length > 0) name = args[0]; @@ -4786,7 +4961,8 @@ bool Minecraft::useFancyGraphics() { } bool Minecraft::useAmbientOcclusion() { - return (m_instance != NULL && m_instance->options->ambientOcclusion); + return (m_instance != NULL && + m_instance->options->ambientOcclusion != Options::AO_OFF); } bool Minecraft::renderDebug() { @@ -4794,43 +4970,6 @@ bool Minecraft::renderDebug() { } bool Minecraft::handleClientSideCommand(const std::wstring& chatMessage) { - /* 4J - TODO - if (chatMessage.startsWith("/")) { - if (DEADMAU5_CAMERA_CHEATS) { - if (chatMessage.startsWith("/follow")) { - String[] tokens = chatMessage.split(" "); - if (tokens.length >= 2) { - String playerName = tokens[1]; - - boolean found = false; - for (Player player : level.players) { - if (playerName.equalsIgnoreCase(player.name)) { - cameraTargetPlayer = player; - found = true; - break; - } - } - - if (!found) { - try { - int entityId = Integer.parseInt(playerName); - for (Entity e : level.entities) { - if (e.entityId == entityId && e instanceof Mob) { - cameraTargetPlayer = (Mob) e; - found = true; - break; - } - } - } catch (NumberFormatException e) { - } - } - } - - return true; - } - } - } - */ return false; } @@ -4851,7 +4990,7 @@ int Minecraft::maxSupportedTextureSize() { void Minecraft::delayTextureReload() { reloadTextures = true; } -__int64 Minecraft::currentTimeMillis() { +int64_t Minecraft::currentTimeMillis() { return System::currentTimeMillis(); //(Sys.getTime() * 1000) / // Sys.getTimerResolution(); } @@ -4898,7 +5037,7 @@ game - we need to wake up, and we don't have the inbedchatscreen with a button if(button==1 && (player->isSleeping() && level != NULL && level->isClientSide)) { -std::shared_ptr mplp = +shared_ptr mplp = std::dynamic_pointer_cast( player ); if(mplp) mplp->StopSleeping(); @@ -4951,7 +5090,7 @@ gameMode->startDestroyBlock(x, y, z, hitResult->f); } else { -std::shared_ptr item = player->inventory->getSelected(); +shared_ptr item = player->inventory->getSelected(); int oldCount = item != NULL ? item->count : 0; if (gameMode->useItemOn(player, level, item, x, y, z, face)) { @@ -4977,7 +5116,7 @@ gameRenderer->itemInHandRenderer->itemPlaced(); if (mayUse && button == 1) { -std::shared_ptr item = player->inventory->getSelected(); +shared_ptr item = player->inventory->getSelected(); if (item != NULL) { if (gameMode->useItem(player, level, item)) @@ -5052,8 +5191,8 @@ void Minecraft::inGameSignInCheckAllPrivilegesCallback(void* lpParam, if (!g_NetworkManager.SessionHasSpace()) { unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; - ui.RequestMessageBox(IDS_MULTIPLAYER_FULL_TITLE, - IDS_MULTIPLAYER_FULL_TEXT, uiIDA, 1); + ui.RequestErrorMessage(IDS_MULTIPLAYER_FULL_TITLE, + IDS_MULTIPLAYER_FULL_TEXT, uiIDA, 1); ProfileManager.RemoveGamepadFromGame(iPad); } else if (ProfileManager.IsSignedInLive(iPad) && ProfileManager.AllowedToPlayMultiplayer(iPad)) { @@ -5080,7 +5219,13 @@ void Minecraft::inGameSignInCheckAllPrivilegesCallback(void* lpParam, } #endif -int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) { +#ifdef _XBOX_ONE +int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad, + int iController) +#else +int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) +#endif +{ Minecraft* pMinecraftClass = (Minecraft*)pParam; if (g_NetworkManager.IsInSession()) { @@ -5112,8 +5257,8 @@ int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) { if (!g_NetworkManager.SessionHasSpace()) { unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; - ui.RequestMessageBox(IDS_MULTIPLAYER_FULL_TITLE, - IDS_MULTIPLAYER_FULL_TEXT, uiIDA, 1); + ui.RequestErrorMessage(IDS_MULTIPLAYER_FULL_TITLE, + IDS_MULTIPLAYER_FULL_TEXT, uiIDA, 1); #ifdef _DURANGO ProfileManager.RemoveGamepadFromGame(iPad); #endif @@ -5165,10 +5310,9 @@ int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) { // &Minecraft::InGame_SignInReturned, pMinecraftClass,iPad); unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, - IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, - uiIDA, 1, iPad, NULL, NULL, - app.GetStringTable()); + ui.RequestErrorMessage(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, + IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, + uiIDA, 1, iPad); #ifdef _DURANGO ProfileManager.RemoveGamepadFromGame(iPad); #endif diff --git a/Minecraft.Client/Minecraft.h b/Minecraft.Client/Minecraft.h index 876801683..39440f5ea 100644 --- a/Minecraft.Client/Minecraft.h +++ b/Minecraft.Client/Minecraft.h @@ -41,12 +41,19 @@ class PsPlusUpsellWrapper; #include "../Minecraft.World/IO/Files/File.h" #include "../Minecraft.World/Network/Packets/DisconnectPacket.h" #include "../Minecraft.World/Util/C4JThread.h" +#include "Textures/ResourceLocation.h" #ifdef linux #undef linux #endif class Minecraft { +private: + enum OS { linux, solaris, windows, macos, unknown, xbox }; + + static ResourceLocation DEFAULT_FONT_LOCATION; + static ResourceLocation ALT_FONT_LOCATION; + public: static const std::wstring VERSION_STRING; Minecraft(Component* mouseComponent, Canvas* parent, @@ -128,7 +135,8 @@ public: void updatePlayerViewportAssignments(); int unoccupiedQuadrant; // 4J - added - std::shared_ptr cameraTargetPlayer; + std::shared_ptr cameraTargetPlayer; + std::shared_ptr crosshairPickMob; ParticleEngine* particleEngine; User* user; std::wstring serverDomain; @@ -183,11 +191,11 @@ private: public: static const int frameTimes_length = 512; - static __int64 frameTimes[frameTimes_length]; + static int64_t frameTimes[frameTimes_length]; static const int tickTimes_length = 512; - static __int64 tickTimes[tickTimes_length]; + static int64_t tickTimes[tickTimes_length]; static int frameTimePos; - static __int64 warezTime; + static int64_t warezTime; private: int rightClickDelay; @@ -249,9 +257,9 @@ private: // ssWidth, int ssHeight); // 4J - removed // 4J - per player thing? - __int64 lastTimer; + int64_t lastTimer; - void renderFpsMeter(__int64 tickTime); + void renderFpsMeter(int64_t tickTime); public: void stop(); @@ -275,7 +283,7 @@ public: // bool isRaining ; // 4J - Moved to per player - //__int64 lastTickTime; + //int64_t lastTickTime; private: // 4J- per player? @@ -336,14 +344,17 @@ public: static int maxSupportedTextureSize(); void delayTextureReload(); - static __int64 currentTimeMillis(); + static int64_t currentTimeMillis(); #ifdef _DURANGO static void inGameSignInCheckAllPrivilegesCallback(void* lpParam, bool hasPrivileges, int iPad); -#endif + static int InGame_SignInReturned(void* pParam, bool bContinue, int iPad, + int iController); +#else static int InGame_SignInReturned(void* pParam, bool bContinue, int iPad); +#endif // 4J-PB Screen* getScreen(); @@ -355,7 +366,7 @@ public: private: // A bit field that store whether a particular quadrant is in the full // tutorial or not - std::uint8_t m_inFullTutorialBits; + uint8_t m_inFullTutorialBits; public: bool isTutorial(); diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index e961d7b02..96fffb80f 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -3,17 +3,19 @@ #include -#include "GameState/Options.h" -#include "MinecraftServer.h" #include "Input/ConsoleInput.h" -#include "Network/PlayerList.h" -#include "Level/ServerLevel.h" #include "Level/DerivedServerLevel.h" +#include "GameState/DispenserBootstrap.h" #include "Player/EntityTracker.h" -#include "Network/ServerConnection.h" -#include "GameState/Settings.h" +#include "MinecraftServer.h" +#include "GameState/Options.h" +#include "Network/PlayerList.h" #include "Network/ServerChunkCache.h" +#include "Network/ServerConnection.h" +#include "Level/ServerLevel.h" #include "Level/ServerLevelListener.h" +#include "GameState/Settings.h" +#include "../Minecraft.World/Commands/Command.h" #include "../Minecraft.World/Util/AABB.h" #include "../Minecraft.World/Util/Vec3.h" #include "../Minecraft.World/Headers/net.minecraft.network.h" @@ -54,15 +56,21 @@ // 4J Added MinecraftServer* MinecraftServer::server = NULL; bool MinecraftServer::setTimeAtEndOfTick = false; -__int64 MinecraftServer::setTime = 0; +int64_t MinecraftServer::setTime = 0; bool MinecraftServer::setTimeOfDayAtEndOfTick = false; -__int64 MinecraftServer::setTimeOfDay = 0; +int64_t MinecraftServer::setTimeOfDay = 0; bool MinecraftServer::m_bPrimaryPlayerSignedOut = false; bool MinecraftServer::s_bServerHalted = false; bool MinecraftServer::s_bSaveOnExitAnswered = false; +#ifdef _ACK_CHUNK_SEND_THROTTLING +bool MinecraftServer::s_hasSentEnoughPackets = false; +int64_t MinecraftServer::s_tickStartTime = 0; +std::vector MinecraftServer::s_sentTo; +#else int MinecraftServer::s_slowQueuePlayerIndex = 0; int MinecraftServer::s_slowQueueLastTime = 0; bool MinecraftServer::s_slowQueuePacketSent = false; +#endif std::unordered_map MinecraftServer::ironTimers; @@ -89,9 +97,13 @@ MinecraftServer::MinecraftServer() { m_ugcPlayersVersion = 0; m_texturePackId = 0; maxBuildHeight = Level::maxBuildHeight; + playerIdleTimeout = 0; m_postUpdateThread = NULL; + forceGameType = false; commandDispatcher = new ServerCommandDispatcher(); + + DispenserBootstrap::bootStrap(); } MinecraftServer::~MinecraftServer() {} @@ -100,34 +112,34 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData* initData, std::uint32_t initSettings, bool findSeed) { // 4J - removed #if 0 - commands = new ConsoleCommands(this); + commands = new ConsoleCommands(this); - Thread t = new Thread() { - public void run() { - BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); - String line = null; - try { - while (!stopped && running && (line = br.readLine()) != null) { - handleConsoleInput(line, MinecraftServer.this); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - }; - t.setDaemon(true); - t.start(); + Thread t = new Thread() { + public void run() { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + String line = null; + try { + while (!stopped && running && (line = br.readLine()) != null) { + handleConsoleInput(line, MinecraftServer.this); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + }; + t.setDaemon(true); + t.start(); - LogConfigurator.initLogger(); - logger.info("Starting minecraft server version " + VERSION); + LogConfigurator.initLogger(); + logger.info("Starting minecraft server version " + VERSION); - if (Runtime.getRuntime().maxMemory() / 1024 / 1024 < 512) { - logger.warning("**** NOT ENOUGH RAM!"); - logger.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); - } + if (Runtime.getRuntime().maxMemory() / 1024 / 1024 < 512) { + logger.warning("**** NOT ENOUGH RAM!"); + logger.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); + } - logger.info("Loading properties"); + logger.info("Loading properties"); #endif settings = new Settings(new File(L"server.properties")); @@ -183,7 +195,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData* initData, connection = new ServerConnection(this); Socket::Initialise(connection); // 4J - added #else - // 4J - removed + // 4J - removed InetAddress localAddress = null; if (localIp.length() > 0) localAddress = InetAddress.getByName(localIp); port = settings.getInt("server-port", DEFAULT_MINECRAFT_PORT); @@ -225,7 +237,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData* initData, // TODO: Stop loading, add error message. } - __int64 levelNanoTime = System::nanoTime(); + int64_t levelNanoTime = System::nanoTime(); std::wstring levelName = settings->getString(L"level-name", L"world"); std::wstring levelTypeString; @@ -266,22 +278,21 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData* initData, // settings->setProperty(L"max-build-height", maxBuildHeight); #if 0 - std::wstring levelSeedString = settings->getString(L"level-seed", L""); - __int64 levelSeed = (new Random())->nextLong(); - if (levelSeedString.length() > 0) - { - long newSeed = _fromString<__int64>(levelSeedString); - if (newSeed != 0) { - levelSeed = newSeed; - } - } + std::wstring levelSeedString = settings->getString(L"level-seed", L""); + int64_t levelSeed = (new Random())->nextLong(); + if (levelSeedString.length() > 0) + { + long newSeed = _fromString(levelSeedString); + if (newSeed != 0) { + levelSeed = newSeed; + } + } #endif // logger.info("Preparing level \"" + levelName + "\""); m_bLoaded = loadLevel(new McRegionLevelStorageSource(File(L".")), levelName, seed, pLevelType, initData); // logger.info("Done (" + (System.nanoTime() - levelNanoTime) + "ns)! // For help, type \"help\" or \"?\""); - app.DebugPrintf("[SRV] loadLevel returned %d\n", m_bLoaded); // 4J delete passed in save data now - this is only required for the // tutorial which is loaded by passing data directly in rather than using @@ -292,10 +303,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData* initData, initData->saveData->fileSize = 0; } - app.DebugPrintf("[SRV] Signaling ServerReady\n"); g_NetworkManager.ServerReady(); // 4J added - app.DebugPrintf("[SRV] ServerReady signaled, returning m_bLoaded=%d\n", - m_bLoaded); return m_bLoaded; } @@ -540,6 +548,14 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, settings->getBoolean(L"spawn-monsters", true), animals); #endif levels[i]->getLevelData()->setGameType(gameType); + + if (app.getLevelGenerationOptions() != NULL) { + LevelGenerationOptions* mapOptions = + app.getLevelGenerationOptions(); + levels[i]->getLevelData()->setHasBeenInCreative( + mapOptions->getLevelHasBeenInCreative()); + } + players->setLevel(levels); } @@ -559,7 +575,10 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, // 4J - Make a new thread to do post processing InitializeCriticalSection(&m_postProcessCS); - app.DebugPrintf("[SRV] Starting post-processing thread\n"); + // 4J-PB - fix for 108310 - TCR #001 BAS Game Stability: TU12: Code: + // Compliance: Crash after creating world on "journey" seed. Stack gets very + // deep with some sand tower falling, so increased the stacj to 256K from + // 128k on other platforms (was already set to that on PS3 and Orbis) m_postUpdateThread = new C4JThread(runPostUpdate, this, "Post processing", 256 * 1024); @@ -568,9 +587,8 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, m_postUpdateThread->SetProcessor(CPU_CORE_POST_PROCESSING); m_postUpdateThread->SetPriority(THREAD_PRIORITY_ABOVE_NORMAL); m_postUpdateThread->Run(); - app.DebugPrintf("[SRV] Post-processing thread started\n"); - __int64 startTime = System::currentTimeMillis(); + int64_t startTime = System::currentTimeMillis(); // 4J Stu - Added this to temporarily make starting games on vita faster #ifdef __PSVITA__ @@ -600,7 +618,20 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, csf->closeHandle(fe); } - __int64 lastTime = System::currentTimeMillis(); + int64_t lastTime = System::currentTimeMillis(); +#ifdef _LARGE_WORLDS + if (app.GetGameNewWorldSize() > levels[0]->getLevelData()->getXZSizeOld()) { + if (!app.GetGameNewWorldSizeUseMoat()) // check the moat settings to + // see if we should be + // overwriting the edge tiles + { + overwriteBordersForNewWorldSize(levels[0]); + } + // we're always overwriting hell edges + int oldHellSize = levels[0]->getLevelData()->getXZHellSizeOld(); + overwriteHellBordersForNewWorldSize(levels[1], oldHellSize); + } +#endif // 4J Stu - This loop is changed in 1.0.1 to only process the first level // (ie the overworld), but I think we still want to do them all @@ -614,7 +645,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, } #if 0 - __int64 lastStorageTickTime = System::currentTimeMillis(); + int64_t lastStorageTickTime = System::currentTimeMillis(); // Test code to enable full creation of levels at start up int halfsidelen = ( i == 0 ) ? 27 : 9; @@ -637,14 +668,11 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, } } #else - __int64 lastStorageTickTime = System::currentTimeMillis(); + int64_t lastStorageTickTime = System::currentTimeMillis(); Pos* spawnPos = level->getSharedSpawnPos(); - app.DebugPrintf("[SRV] dim=%d spawn=(%d,%d) r=%d\n", i, spawnPos->x, - spawnPos->z, r); int twoRPlusOne = r * 2 + 1; int total = twoRPlusOne * twoRPlusOne; - int chunksDone = 0; for (int x = -r; x <= r && running; x += 16) { for (int z = -r; z <= r && running; z += 16) { if (s_bServerHalted || !g_NetworkManager.IsInSession()) { @@ -655,7 +683,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, } // printf(">>>%d %d //%d\n",i,x,z); - // __int64 now = + // int64_t now = // System::currentTimeMillis(); if (now < // lastTime) lastTime = now; if (now > // lastTime + 1000) @@ -674,10 +702,6 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, true); // 4J - added parameter to // disable postprocessing here PIXEndNamedEvent(); - chunksDone++; - if (chunksDone % 50 == 0) - app.DebugPrintf("[SRV] dim=%d chunk %d/%d\n", i, - chunksDone, total); // while (level->updateLights() && // running) // ; @@ -696,9 +720,9 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, // spawn area too #if 0 // 4J - added this code to propagate lighting properly in the spawn area before we go sharing it with the local client or across the network - for (int x = -r; x <= r && running; x += 16) + for (int x = -r; x <= r && running; x += 16) { - for (int z = -r; z <= r && running; z += 16) + for (int z = -r; z <= r && running; z += 16) { PIXBeginNamedEvent(0,"Lighting gaps for %d %d",x,z); level->getChunkAt(spawnPos->x + x, spawnPos->z + z)->recheckGaps(true); @@ -714,13 +738,11 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, // printf("Main thread complete at %dms\n",System::currentTimeMillis() - // startTime); - app.DebugPrintf("[SRV] All chunk loops done, waiting for postProcess\n"); // Wait for post processing, then lighting threads, to end (post-processing // may make more lighting changes) m_postUpdateTerminate = true; postProcessTerminate(mcprogress); - app.DebugPrintf("[SRV] postProcessTerminate done\n"); // stronghold position? if (levels[0]->dimension->id == 0) { @@ -774,17 +796,13 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, if (levels[0]->isNew) saveGameRules(); if (levels[0]->isNew) { - app.DebugPrintf("[SRV] Saving level 0...\n"); levels[0]->save(true, mcprogress); - app.DebugPrintf("[SRV] Level 0 saved\n"); } if (s_bServerHalted || !g_NetworkManager.IsInSession()) return false; if (levels[0]->isNew || levels[1]->isNew || levels[2]->isNew) { - app.DebugPrintf("[SRV] Saving to disc...\n"); levels[0]->saveToDisc(mcprogress, false); - app.DebugPrintf("[SRV] saveToDisc done\n"); } if (s_bServerHalted || !g_NetworkManager.IsInSession()) return false; @@ -802,7 +820,77 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, return true; } -void MinecraftServer::setProgress(const std::wstring& status, int progress) { +#ifdef _LARGE_WORLDS +void MinecraftServer::overwriteBordersForNewWorldSize(ServerLevel* level) { + // recreate the chunks round the border (2 chunks or 32 blocks deep), + // deleting any player data from them + app.DebugPrintf("Expanding level size\n"); + int oldSize = level->getLevelData()->getXZSizeOld(); + // top + int minVal = -oldSize / 2; + int maxVal = (oldSize / 2) - 1; + for (int xVal = minVal; xVal <= maxVal; xVal++) { + int zVal = minVal; + level->cache->overwriteLevelChunkFromSource(xVal, zVal); + level->cache->overwriteLevelChunkFromSource(xVal, zVal + 1); + } + // bottom + for (int xVal = minVal; xVal <= maxVal; xVal++) { + int zVal = maxVal; + level->cache->overwriteLevelChunkFromSource(xVal, zVal); + level->cache->overwriteLevelChunkFromSource(xVal, zVal - 1); + } + // left + for (int zVal = minVal; zVal <= maxVal; zVal++) { + int xVal = minVal; + level->cache->overwriteLevelChunkFromSource(xVal, zVal); + level->cache->overwriteLevelChunkFromSource(xVal + 1, zVal); + } + // right + for (int zVal = minVal; zVal <= maxVal; zVal++) { + int xVal = maxVal; + level->cache->overwriteLevelChunkFromSource(xVal, zVal); + level->cache->overwriteLevelChunkFromSource(xVal - 1, zVal); + } +} + +void MinecraftServer::overwriteHellBordersForNewWorldSize(ServerLevel* level, + int oldHellSize) { + // recreate the chunks round the border (1 chunk or 16 blocks deep), + // deleting any player data from them + app.DebugPrintf("Expanding level size\n"); + // top + int minVal = -oldHellSize / 2; + int maxVal = (oldHellSize / 2) - 1; + for (int xVal = minVal; xVal <= maxVal; xVal++) { + int zVal = minVal; + level->cache->overwriteHellLevelChunkFromSource(xVal, zVal, minVal, + maxVal); + } + // bottom + for (int xVal = minVal; xVal <= maxVal; xVal++) { + int zVal = maxVal; + level->cache->overwriteHellLevelChunkFromSource(xVal, zVal, minVal, + maxVal); + } + // left + for (int zVal = minVal; zVal <= maxVal; zVal++) { + int xVal = minVal; + level->cache->overwriteHellLevelChunkFromSource(xVal, zVal, minVal, + maxVal); + } + // right + for (int zVal = minVal; zVal <= maxVal; zVal++) { + int xVal = maxVal; + level->cache->overwriteHellLevelChunkFromSource(xVal, zVal, minVal, + maxVal); + } +} + +#endif + +void MinecraftServer::setProgress(const std::wstring& status, + int progress) { progressStatus = status; this->progress = progress; // logger.info(status + ": " + progress + "%"); @@ -920,7 +1008,7 @@ void MinecraftServer::Suspend() { bool MinecraftServer::IsSuspending() { return m_suspending; } -void MinecraftServer::stopServer() { +void MinecraftServer::stopServer(bool didInit) { // 4J-PB - need to halt the rendering of the data, since we're about to // remove it #ifdef __PS3__ @@ -953,9 +1041,11 @@ void MinecraftServer::stopServer() { // Always save on exit! Except if saves are disabled. if (!saveOnExitAnswered()) m_saveOnExit = true; #endif - // if trial version or saving is disabled, then don't save anything + // if trial version or saving is disabled, then don't save anything. + // Also don't save anything if we didn't actually get through the server + // initialisation. if (m_saveOnExit && ProfileManager.IsFullVersion() && - (!StorageManager.GetSaveDisabled())) { + (!StorageManager.GetSaveDisabled()) && didInit) { if (players != NULL) { players->saveAll(Minecraft::GetInstance()->progressRenderer, true); @@ -1059,18 +1149,66 @@ void MinecraftServer::setFlightAllowed(bool allowFlight) { this->allowFlight = allowFlight; } +bool MinecraftServer::isCommandBlockEnabled() { + return false; // settings.getBoolean("enable-command-block", false); +} + bool MinecraftServer::isNetherEnabled() { return true; // settings.getBoolean("allow-nether", true); } bool MinecraftServer::isHardcore() { return false; } +int MinecraftServer::getOperatorUserPermissionLevel() { + return Command::LEVEL_OWNERS; // settings.getInt("op-permission-level", + // Command.LEVEL_OWNERS); +} + CommandDispatcher* MinecraftServer::getCommandDispatcher() { return commandDispatcher; } +Pos* MinecraftServer::getCommandSenderWorldPosition() { + return new Pos(0, 0, 0); +} + +Level* MinecraftServer::getCommandSenderWorld() { return levels[0]; } + +int MinecraftServer::getSpawnProtectionRadius() { return 16; } + +bool MinecraftServer::isUnderSpawnProtection(Level* level, int x, int y, int z, + std::shared_ptr player) { + if (level->dimension->id != 0) return false; + // if (getPlayers()->getOps()->empty()) return false; + if (getPlayers()->isOp(player->getName())) return false; + if (getSpawnProtectionRadius() <= 0) return false; + + Pos* spawnPos = level->getSharedSpawnPos(); + int xd = Mth::abs(x - spawnPos->x); + int zd = Mth::abs(z - spawnPos->z); + int dist = std::max(xd, zd); + + return dist <= getSpawnProtectionRadius(); +} + +void MinecraftServer::setForceGameType(bool forceGameType) { + this->forceGameType = forceGameType; +} + +bool MinecraftServer::getForceGameType() { return forceGameType; } + +int64_t MinecraftServer::getCurrentTimeMillis() { + return System::currentTimeMillis(); +} + +int MinecraftServer::getPlayerIdleTimeout() { return playerIdleTimeout; } + +void MinecraftServer::setPlayerIdleTimeout(int playerIdleTimeout) { + this->playerIdleTimeout = playerIdleTimeout; +} + extern int c0a, c0b, c1a, c1b, c1c, c2a, c2b; -void MinecraftServer::run(__int64 seed, void* lpParameter) { +void MinecraftServer::run(int64_t seed, void* lpParameter) { NetworkGameInitData* initData = NULL; std::uint32_t initSettings = 0; bool findSeed = false; @@ -1081,7 +1219,9 @@ void MinecraftServer::run(__int64 seed, void* lpParameter) { m_texturePackId = initData->texturePackId; } // try { // 4J - removed try/catch/finally + bool didInit = false; if (initServer(seed, initData, initSettings, findSeed)) { + didInit = true; ServerLevel* levelNormalDimension = levels[0]; // 4J-PB - Set the Stronghold position in the leveldata if there isn't // one in there @@ -1098,10 +1238,10 @@ void MinecraftServer::run(__int64 seed, void* lpParameter) { } } - __int64 lastTime = System::currentTimeMillis(); - __int64 unprocessedTime = 0; + int64_t lastTime = getCurrentTimeMillis(); + int64_t unprocessedTime = 0; while (running && !s_bServerHalted) { - __int64 now = System::currentTimeMillis(); + int64_t now = getCurrentTimeMillis(); // 4J Stu - When we pause the server, we don't want to count that as // time passed 4J Stu - TU-1 hotifx - Remove this line. We want to @@ -1110,7 +1250,7 @@ void MinecraftServer::run(__int64 seed, void* lpParameter) { // them that the connection to the server has been lost // if(m_isServerPaused) lastTime = now; - __int64 passedTime = now - lastTime; + int64_t passedTime = now - lastTime; if (passedTime > MS_PER_TICK * 40) { // logger.warning("Can't keep up! Did the system // time change, or is the server overloaded?"); @@ -1132,43 +1272,22 @@ void MinecraftServer::run(__int64 seed, void* lpParameter) { unprocessedTime = 0; } else { // int tickcount = 0; - // __int64 beforeall = + // int64_t beforeall = // System::currentTimeMillis(); while (unprocessedTime > MS_PER_TICK) { unprocessedTime -= MS_PER_TICK; - // __int64 + chunkPacketManagement_PreTick(); + // int64_t // before = System::currentTimeMillis(); tick(); - // __int64 + // int64_t // after = System::currentTimeMillis(); // PIXReportCounter(L"Server // time",(float)(after-before)); - // 4J Ensure that the slow queue owner keeps cycling if - // it's not been used in a while - int time = GetTickCount(); - if ((s_slowQueuePacketSent) || - ((time - s_slowQueueLastTime) > - (2 * MINECRAFT_SERVER_SLOW_QUEUE_DELAY))) { - // app.DebugPrintf("Considering - // cycling: (%d) %d - %d -> %d > - //%d\n",s_slowQueuePacketSent, time, - // s_slowQueueLastTime, (time - - // s_slowQueueLastTime), - //(2*MINECRAFT_SERVER_SLOW_QUEUE_DELAY)); - MinecraftServer::cycleSlowQueueIndex(); - s_slowQueuePacketSent = false; - s_slowQueueLastTime = time; - } - // else - // { - // app.DebugPrintf("Not - // considering cycling: %d - %d -> %d > %d\n",time, - // s_slowQueueLastTime, (time - s_slowQueueLastTime), - //(2*MINECRAFT_SERVER_SLOW_QUEUE_DELAY)); - // } + chunkPacketManagement_PostTick(); } - // __int64 afterall = + // int64_t afterall = // System::currentTimeMillis(); // PIXReportCounter(L"Server time // all",(float)(afterall-beforeall)); @@ -1196,8 +1315,7 @@ void MinecraftServer::run(__int64 seed, void* lpParameter) { //// 4J removed - we always have nether { ServerLevel* level = levels[i]; - level->setTime(MinecraftServer::setTime); - level->setOverrideTimeOfDay(-1); + level->setGameTime(MinecraftServer::setTime); } } } @@ -1206,9 +1324,7 @@ void MinecraftServer::run(__int64 seed, void* lpParameter) { for (unsigned int i = 0; i < levels.length; i++) { if (i == 0 || settings->getBoolean(L"allow-nether", true)) { ServerLevel* level = levels[i]; - // level->setTime( MinecraftServer::setTime ); - level->setOverrideTimeOfDay( - MinecraftServer::setTimeOfDay); + level->setDayTime(MinecraftServer::setTimeOfDay); } } } @@ -1221,8 +1337,6 @@ void MinecraftServer::run(__int64 seed, void* lpParameter) { param = app.GetXuiServerActionParam(i); switch (eAction) { - case eXuiServerAction_Idle: - break; case eXuiServerAction_AutoSaveGame: #if defined(_XBOX_ONE) || defined(__ORBIS__) { @@ -1399,7 +1513,7 @@ void MinecraftServer::run(__int64 seed, void* lpParameter) { app.EnterSaveNotificationSection(); // players->broadcastAll( - // std::shared_ptr( new + // shared_ptr( new // UpdateProgressPacket(20) ) ); if (!s_bServerHalted) { @@ -1477,38 +1591,38 @@ void MinecraftServer::run(__int64 seed, void* lpParameter) { } // else //{ - // while (running) + // while (running) // { - // handleConsoleInputs(); + // handleConsoleInputs(); // Sleep(10); - // } - //} + // } + // } #if 0 +} catch (Throwable t) { + t.printStackTrace(); + logger.log(Level.SEVERE, "Unexpected exception", t); + while (running) { + handleConsoleInputs(); + try { + Thread.sleep(10); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + } +} finally { + try { + stopServer(); + stopped = true; } catch (Throwable t) { - t.printStackTrace(); - logger.log(Level.SEVERE, "Unexpected exception", t); - while (running) { - handleConsoleInputs(); - try { - Thread.sleep(10); - } catch (InterruptedException e1) { - e1.printStackTrace(); - } - } - } finally { - try { - stopServer(); - stopped = true; - } catch (Throwable t) { - t.printStackTrace(); - } finally { - System::exit(0); - } - } + t.printStackTrace(); + } finally { + System::exit(0); + } +} #endif // 4J Stu - Stop the server when the loops complete, as the finally would do - stopServer(); + stopServer(didInit); stopped = true; } @@ -1549,14 +1663,12 @@ void MinecraftServer::tick() { Minecraft* pMinecraft = Minecraft::GetInstance(); // 4J-PB - sending this on the host changing the difficulty in the menus /* if(m_lastSentDifficulty != pMinecraft->options->difficulty) - { - m_lastSentDifficulty = pMinecraft->options->difficulty; - players->broadcastAll( - std::shared_ptr( new - ServerSettingsChangedPacket( - ServerSettingsChangedPacket::HOST_DIFFICULTY, - pMinecraft->options->difficulty) ) ); - }*/ + { + m_lastSentDifficulty = pMinecraft->options->difficulty; + players->broadcastAll( shared_ptr( new + ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_DIFFICULTY, + pMinecraft->options->difficulty) ) ); + }*/ for (unsigned int i = 0; i < levels.length; i++) { // if (i == 0 || settings->getBoolean(L"allow-nether", true)) @@ -1578,26 +1690,23 @@ void MinecraftServer::tick() { #endif if (tickCount % 20 == 0) { - players->broadcastAll(std::shared_ptr( - new SetTimePacket(level->getTime())), - level->dimension->id); + players->broadcastAll( + std::shared_ptr(new SetTimePacket( + level->getGameTime(), level->getDayTime(), + level->getGameRules()->getBoolean( + GameRules::RULE_DAYLIGHT))), + level->dimension->id); } // #ifndef __PS3__ - static __int64 stc = 0; - __int64 st0 = System::currentTimeMillis(); + static int64_t stc = 0; + int64_t st0 = System::currentTimeMillis(); PIXBeginNamedEvent(0, "Level tick %d", i); ((Level*)level)->tick(); - __int64 st1 = System::currentTimeMillis(); + int64_t st1 = System::currentTimeMillis(); PIXEndNamedEvent(); PIXBeginNamedEvent(0, "Update lights %d", i); - // 4J - used to be in a while loop, but we don't want the server - // locking up for a big chunk of time (could end up trying to - // process 1,000,000 lights...) Instead call this once, which will - // try and process up to 2000 lights per tick - // printf("lights: - //%d\n",level->getLightsToUpdate()); - while (level->updateLights()); - __int64 st2 = System::currentTimeMillis(); + + int64_t st2 = System::currentTimeMillis(); PIXEndNamedEvent(); PIXBeginNamedEvent(0, "Entity tick %d", i); // 4J added to stop ticking entities in levels when players are not @@ -1635,7 +1744,7 @@ void MinecraftServer::tick() { level->getTracker()->tick(); PIXEndNamedEvent(); - __int64 st3 = System::currentTimeMillis(); + int64_t st3 = System::currentTimeMillis(); // printf(">>>>>>>>>>>>>>>>>>>>>> Tick %d %d %d : //%d\n", st1 - st0, st2 - st1, st3 - st2, st0 - stc ); stc = st0; @@ -1653,9 +1762,9 @@ void MinecraftServer::tick() { // 4J - removed #if 0 - for (int i = 0; i < tickables.size(); i++) { - tickables.get(i)-tick(); - } + for (int i = 0; i < tickables.size(); i++) { + tickables.get(i)-tick(); + } #endif // try { // 4J - removed try/catch @@ -1681,7 +1790,7 @@ void MinecraftServer::handleConsoleInputs() { } } -void MinecraftServer::main(__int64 seed, void* lpParameter) { +void MinecraftServer::main(int64_t seed, void* lpParameter) { #if __PS3__ ShutdownManager::HasStarted(ShutdownManager::eServerThread); #endif @@ -1708,7 +1817,9 @@ void MinecraftServer::info(const std::wstring& string) {} void MinecraftServer::warn(const std::wstring& string) {} -std::wstring MinecraftServer::getConsoleName() { return L"CONSOLE"; } +std::wstring MinecraftServer::getConsoleName() { + return L"CONSOLE"; +} ServerLevel* MinecraftServer::getLevel(int dimension) { if (dimension == -1) @@ -1729,8 +1840,81 @@ void MinecraftServer::setLevel(int dimension, ServerLevel* level) { levels[0] = level; } +#if defined _ACK_CHUNK_SEND_THROTTLING +bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer* player) { + if (s_hasSentEnoughPackets) return false; + if (player == NULL) return false; + + for (int i = 0; i < s_sentTo.size(); i++) { + if (s_sentTo[i]->IsSameSystem(player)) { + return false; + } + } + +#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) + return (player->GetOutstandingAckCount() < 3); +#else + return (player->GetOutstandingAckCount() < 2); +#endif +} + +void MinecraftServer::chunkPacketManagement_DidSendTo(INetworkPlayer* player) { + int64_t currentTime = System::currentTimeMillis(); + + if ((currentTime - s_tickStartTime) >= MAX_TICK_TIME_FOR_PACKET_SENDS) { + s_hasSentEnoughPackets = true; + // app.DebugPrintf("Sending, setting enough packet flag: + //%dms\n",currentTime - s_tickStartTime); + } else { + // app.DebugPrintf("Sending, more time: %dms\n",currentTime + //- s_tickStartTime); + } + + player->SentChunkPacket(); + + s_sentTo.push_back(player); +} + +void MinecraftServer::chunkPacketManagement_PreTick() { + // app.DebugPrintf("*************************************************************************************************************************************************************************\n"); + s_hasSentEnoughPackets = false; + s_tickStartTime = System::currentTimeMillis(); + s_sentTo.clear(); + + std::vector >* players = + connection->getPlayers(); + + if (players->size()) { + std::vector > playersOrig = *players; + players->clear(); + + do { + int longestTime = 0; + AUTO_VAR(playerConnectionBest, playersOrig.begin()); + for (AUTO_VAR(it, playersOrig.begin()); it != playersOrig.end(); + it++) { + int thisTime = 0; + INetworkPlayer* np = (*it)->getNetworkPlayer(); + if (np) { + thisTime = np->GetTimeSinceLastChunkPacket_ms(); + } + + if (thisTime > longestTime) { + playerConnectionBest = it; + longestTime = thisTime; + } + } + players->push_back(*playerConnectionBest); + playersOrig.erase(playerConnectionBest); + } while (playersOrig.size() > 0); + } +} + +void MinecraftServer::chunkPacketManagement_PostTick() {} + +#else // 4J Added -bool MinecraftServer::canSendOnSlowQueue(INetworkPlayer* player) { +bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer* player) { if (player == NULL) return false; int time = GetTickCount(); @@ -1744,6 +1928,33 @@ bool MinecraftServer::canSendOnSlowQueue(INetworkPlayer* player) { return false; } +void MinecraftServer::chunkPacketManagement_DidSendTo(INetworkPlayer* player) { + s_slowQueuePacketSent = true; +} + +void MinecraftServer::chunkPacketManagement_PreTick() {} + +void MinecraftServer::chunkPacketManagement_PostTick() { + // 4J Ensure that the slow queue owner keeps cycling if it's not been used + // in a while + int time = GetTickCount(); + if ((s_slowQueuePacketSent) || ((time - s_slowQueueLastTime) > + (2 * MINECRAFT_SERVER_SLOW_QUEUE_DELAY))) { + // app.DebugPrintf("Considering cycling: (%d) %d - %d -> %d + //> %d\n",s_slowQueuePacketSent, time, s_slowQueueLastTime, (time - + // s_slowQueueLastTime), (2*MINECRAFT_SERVER_SLOW_QUEUE_DELAY)); + MinecraftServer::cycleSlowQueueIndex(); + s_slowQueuePacketSent = false; + s_slowQueueLastTime = time; + } + // else + // { + // app.DebugPrintf("Not considering cycling: %d - %d -> %d > + //%d\n",time, s_slowQueueLastTime, (time - s_slowQueueLastTime), + //(2*MINECRAFT_SERVER_SLOW_QUEUE_DELAY)); + // } +} + void MinecraftServer::cycleSlowQueueIndex() { if (!g_NetworkManager.IsInSession()) return; @@ -1772,6 +1983,7 @@ void MinecraftServer::cycleSlowQueueIndex() { // app.DebugPrintf("Cycled slow queue index to %d\n", // s_slowQueuePlayerIndex); } +#endif // 4J added - sets up a vector of flags to indicate which entities (with small // Ids) have been removed from the level, but are still haven't constructed a diff --git a/Minecraft.Client/MinecraftServer.h b/Minecraft.Client/MinecraftServer.h index 597b3bab7..6b2b5a809 100644 --- a/Minecraft.Client/MinecraftServer.h +++ b/Minecraft.Client/MinecraftServer.h @@ -22,6 +22,11 @@ class CommandDispatcher; #define MINECRAFT_SERVER_SLOW_QUEUE_DELAY 250 +#if defined _XBOX_ONE || defined _XBOX || defined __ORBIS__ || \ + defined __PS3__ || defined __PSVITA__ +#define _ACK_CHUNK_SEND_THROTTLING +#endif + typedef struct _LoadSaveDataThreadParam { void* data; __int64 fileSize; @@ -32,7 +37,7 @@ typedef struct _LoadSaveDataThreadParam { } LoadSaveDataThreadParam; typedef struct _NetworkGameInitData { - __int64 seed; + int64_t seed; LoadSaveDataThreadParam* saveData; std::uint32_t settings; LevelGenerationOptions* levelGen; @@ -99,7 +104,7 @@ public: private: // std::vector tickables = new ArrayList(); // 4J - - //removed + // removed CommandDispatcher* commandDispatcher; std::vector consoleInput; // 4J - was synchronizedList - TODO - investigate @@ -111,6 +116,8 @@ public: bool allowFlight; std::wstring motd; int maxBuildHeight; + int playerIdleTimeout; + bool forceGameType; private: // 4J Added @@ -142,8 +149,13 @@ private: void endProgress(); void saveAllChunks(); void saveGameRules(); - void stopServer(); + void stopServer(bool didInit); +#ifdef _LARGE_WORLDS + void overwriteBordersForNewWorldSize(ServerLevel* level); + void overwriteHellBordersForNewWorldSize(ServerLevel* level, + int oldHellSize); +#endif public: void setMaxBuildHeight(int maxBuildHeight); int getMaxBuildHeight(); @@ -158,9 +170,21 @@ public: void setPvpAllowed(bool pvp); bool isFlightAllowed(); void setFlightAllowed(bool allowFlight); + bool isCommandBlockEnabled(); bool isNetherEnabled(); bool isHardcore(); + int getOperatorUserPermissionLevel(); CommandDispatcher* getCommandDispatcher(); + Pos* getCommandSenderWorldPosition(); + Level* getCommandSenderWorld(); + int getSpawnProtectionRadius(); + bool isUnderSpawnProtection(Level* level, int x, int y, int z, + std::shared_ptr player); + void setForceGameType(bool forceGameType); + bool getForceGameType(); + static int64_t getCurrentTimeMillis(); + int getPlayerIdleTimeout(); + void setPlayerIdleTimeout(int playerIdleTimeout); public: void halt(); @@ -177,7 +201,7 @@ public: ConsoleInputSource* source); void handleConsoleInputs(); // void addTickable(Tickable tickable); // 4J removed - static void main(__int64 seed, void* lpParameter); + static void main(int64_t seed, void* lpParameter); static void HaltServer(bool bPrimaryPlayerSignedOut = false); File* getFile(const std::wstring& name); @@ -200,9 +224,9 @@ private: static MinecraftServer* server; static bool setTimeOfDayAtEndOfTick; - static __int64 setTimeOfDay; + static int64_t setTimeOfDay; static bool setTimeAtEndOfTick; - static __int64 setTime; + static int64_t setTime; static bool m_bPrimaryPlayerSignedOut; // 4J-PB added to tell the stopserver not to @@ -239,11 +263,11 @@ public: else return NULL; } - static void SetTimeOfDay(__int64 time) { + static void SetTimeOfDay(int64_t time) { setTimeOfDayAtEndOfTick = true; setTimeOfDay = time; } - static void SetTime(__int64 time) { + static void SetTime(int64_t time) { setTimeAtEndOfTick = true; setTime = time; } @@ -256,11 +280,16 @@ private: // 4J Added - A static that stores the QNet index of the player that is next // allowed to send a packet in the slow queue +#ifdef _ACK_CHUNK_SEND_THROTTLING + static bool s_hasSentEnoughPackets; + static int64_t s_tickStartTime; + static std::vector s_sentTo; + static const int MAX_TICK_TIME_FOR_PACKET_SENDS = 35; +#else static int s_slowQueuePlayerIndex; static int s_slowQueueLastTime; - -public: static bool s_slowQueuePacketSent; +#endif bool IsServerPaused() { return m_isServerPaused; } @@ -270,9 +299,14 @@ private: bool m_suspending; public: - // static int getSlowQueueIndex() { return s_slowQueuePlayerIndex; } - static bool canSendOnSlowQueue(INetworkPlayer* player); + static bool chunkPacketManagement_CanSendTo(INetworkPlayer* player); + static void chunkPacketManagement_DidSendTo(INetworkPlayer* player); +#ifndef _ACK_CHUNK_SEND_THROTTLING static void cycleSlowQueueIndex(); +#endif + + void chunkPacketManagement_PreTick(); + void chunkPacketManagement_PostTick(); void setSaveOnExit(bool save) { m_saveOnExit = save; diff --git a/Minecraft.Client/Network/ClientConnection.cpp b/Minecraft.Client/Network/ClientConnection.cpp index 65eeedc0f..ab03b3403 100644 --- a/Minecraft.Client/Network/ClientConnection.cpp +++ b/Minecraft.Client/Network/ClientConnection.cpp @@ -13,7 +13,9 @@ #include "../../Minecraft.World/Headers/net.minecraft.world.level.chunk.h" #include "../../Minecraft.World/Headers/net.minecraft.stats.h" #include "../../Minecraft.World/Headers/net.minecraft.world.entity.h" +#include "../../Minecraft.World/Headers/net.minecraft.world.entity.ai.attributes.h" #include "../../Minecraft.World/Headers/net.minecraft.world.entity.player.h" +#include "../../Minecraft.World/Headers/net.minecraft.world.entity.animal.h" #include "../../Minecraft.World/Headers/net.minecraft.world.entity.npc.h" #include "../../Minecraft.World/Headers/net.minecraft.world.entity.item.h" #include "../../Minecraft.World/Headers/net.minecraft.world.entity.projectile.h" @@ -41,6 +43,7 @@ #include "../MinecraftServer.h" #include "../ClientConstants.h" #include "../../Minecraft.World/Util/SoundTypes.h" +#include "../../Minecraft.World/Util/BasicTypeContainers.h" #include "../Textures/Packs/TexturePackRepository.h" #ifdef _XBOX #include "../Platform/Common/XUI/XUI_Scene_Trading.h" @@ -123,6 +126,8 @@ ClientConnection::ClientConnection(Minecraft* minecraft, Socket* socket, // the socket // delete socket; } + + deferredEntityLinkPackets = std::vector(); } ClientConnection::~ClientConnection() { @@ -422,20 +427,9 @@ void ClientConnection::handleAddEntity( // 4J-PB - replacing this massive if nest with switch switch (packet->type) { - case AddEntityPacket::MINECART_RIDEABLE: - e = std::shared_ptr( - new Minecart(level, x, y, z, Minecart::RIDEABLE)); + case AddEntityPacket::MINECART: + e = Minecart::createMinecart(level, x, y, z, packet->data); break; - case AddEntityPacket::MINECART_CHEST: - e = std::shared_ptr( - new Minecart(level, x, y, z, Minecart::CHEST)); - break; - - case AddEntityPacket::MINECART_FURNACE: - e = std::shared_ptr( - new Minecart(level, x, y, z, Minecart::FURNACE)); - break; - case AddEntityPacket::FISH_HOOK: { // 4J Stu - Brought forward from 1.4 to be able to drop XP from // fishing @@ -453,9 +447,10 @@ void ClientConnection::handleAddEntity( } } } - std::shared_ptr player = - std::dynamic_pointer_cast(owner); - if (player != NULL) { + + if (owner->instanceof(eTYPE_PLAYER)) { + std::shared_ptr player = + std::dynamic_pointer_cast(owner); std::shared_ptr hook = std::shared_ptr( new FishingHook(level, x, y, z, player)); @@ -492,8 +487,8 @@ void ClientConnection::handleAddEntity( break; case AddEntityPacket::FIREBALL: e = std::shared_ptr( - new Fireball(level, x, y, z, packet->xa / 8000.0, - packet->ya / 8000.0, packet->za / 8000.0)); + new LargeFireball(level, x, y, z, packet->xa / 8000.0, + packet->ya / 8000.0, packet->za / 8000.0)); packet->data = 0; break; case AddEntityPacket::SMALL_FIREBALL: @@ -524,7 +519,7 @@ void ClientConnection::handleAddEntity( e = std::shared_ptr(new Boat(level, x, y, z)); break; case AddEntityPacket::PRIMED_TNT: - e = std::shared_ptr(new PrimedTnt(level, x, y, z)); + e = std::shared_ptr(new PrimedTnt(level, x, y, z, nullptr)); break; case AddEntityPacket::ENDER_CRYSTAL: e = std::shared_ptr(new EnderCrystal(level, x, y, z)); @@ -537,7 +532,28 @@ void ClientConnection::handleAddEntity( level, x, y, z, packet->data & 0xFFFF, packet->data >> 16)); packet->data = 0; break; + case AddEntityPacket::WITHER_SKULL: + e = std::shared_ptr( + new WitherSkull(level, x, y, z, packet->xa / 8000.0, + packet->ya / 8000.0, packet->za / 8000.0)); + packet->data = 0; + break; + case AddEntityPacket::FIREWORKS: + e = std::shared_ptr( + new FireworksRocketEntity(level, x, y, z, nullptr)); + break; + case AddEntityPacket::LEASH_KNOT: + e = std::shared_ptr( + new LeashFenceKnotEntity(level, (int)x, (int)y, (int)z)); + packet->data = 0; + break; +#ifndef _FINAL_BUILD + default: + // Not a known entity (?) + assert(0); +#endif } + /* if (packet->type == AddEntityPacket::MINECART_RIDEABLE) e = std::shared_ptr( new Minecart(level, x, y, z, Minecart::RIDEABLE) ); if (packet->type == AddEntityPacket::MINECART_CHEST) e = @@ -588,38 +604,38 @@ void ClientConnection::handleAddEntity( EyeOfEnderSignal(level, x, y, z) ); if (packet->type == AddEntityPacket::FIREBALL) { - e = std::shared_ptr( new Fireball(level, x, y, z, packet->xa - / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); packet->data = 0; - } - if (packet->type == AddEntityPacket::SMALL_FIREBALL) - { - e = std::shared_ptr( new SmallFireball(level, x, y, - z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); + e = shared_ptr( new Fireball(level, x, y, z, + packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); packet->data = 0; } - if (packet->type == AddEntityPacket::EGG) e = std::shared_ptr( - new ThrownEgg(level, x, y, z) ); if (packet->type == + if (packet->type == AddEntityPacket::SMALL_FIREBALL) + { + e = shared_ptr( new SmallFireball(level, x, y, z, + packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); + packet->data = 0; + } + if (packet->type == AddEntityPacket::EGG) e = shared_ptr( new + ThrownEgg(level, x, y, z) ); if (packet->type == AddEntityPacket::THROWN_POTION) { - e = std::shared_ptr( new ThrownPotion(level, x, y, z, + e = shared_ptr( new ThrownPotion(level, x, y, z, packet->data) ); packet->data = 0; } if (packet->type == AddEntityPacket::THROWN_EXPBOTTLE) { - e = std::shared_ptr( new ThrownExpBottle(level, x, y, - z) ); packet->data = 0; + e = shared_ptr( new ThrownExpBottle(level, x, y, z) + ); packet->data = 0; } - if (packet->type == AddEntityPacket::BOAT) e = std::shared_ptr( + if (packet->type == AddEntityPacket::BOAT) e = shared_ptr( new Boat(level, x, y, z) ); if (packet->type == - AddEntityPacket::PRIMED_TNT) e = std::shared_ptr( new - PrimedTnt(level, x, y, z) ); if (packet->type == - AddEntityPacket::ENDER_CRYSTAL) e = std::shared_ptr( new - EnderCrystal(level, x, y, z) ); if (packet->type == - AddEntityPacket::FALLING_SAND) e = std::shared_ptr( new + AddEntityPacket::PRIMED_TNT) e = shared_ptr( new PrimedTnt(level, + x, y, z) ); if (packet->type == AddEntityPacket::ENDER_CRYSTAL) e = + shared_ptr( new EnderCrystal(level, x, y, z) ); if (packet->type + == AddEntityPacket::FALLING_SAND) e = shared_ptr( new FallingTile(level, x, y, z, Tile::sand->id) ); if (packet->type == - AddEntityPacket::FALLING_GRAVEL) e = std::shared_ptr( new + AddEntityPacket::FALLING_GRAVEL) e = shared_ptr( new FallingTile(level, x, y, z, Tile::gravel->id) ); if (packet->type == - AddEntityPacket::FALLING_EGG) e = std::shared_ptr( new + AddEntityPacket::FALLING_EGG) e = shared_ptr( new FallingTile(level, x, y, z, Tile::dragonEgg_Id) ); */ @@ -652,11 +668,17 @@ void ClientConnection::handleAddEntity( } } - // Note - not doing this move for frame, as the ctor for these objects - // does some adjustments on the position based on direction to move the - // object out slightly from what it is attached to, and this just - // overwrites it - if (packet->type != AddEntityPacket::ITEM_FRAME) { + if (packet->type == AddEntityPacket::LEASH_KNOT) { + // 4J: "Move" leash knot to it's current position, this sets old + // position (like frame, leash has adjusted position) + e->absMoveTo(e->x, e->y, e->z, yRot, xRot); + } else if (packet->type == AddEntityPacket::ITEM_FRAME) { + // Not doing this move for frame, as the ctor for these objects does + // some adjustments on the position based on direction to move the + // object out slightly from what it is attached to, and this just + // overwrites it + } else { + // For everything else, set position e->absMoveTo(x, y, z, yRot, xRot); } e->entityId = packet->id; @@ -681,15 +703,18 @@ void ClientConnection::handleAddEntity( } } - if (std::dynamic_pointer_cast(owner) != NULL) { + if (owner != NULL && owner->instanceof(eTYPE_LIVINGENTITY)) { std::dynamic_pointer_cast(e)->owner = - std::dynamic_pointer_cast(owner); + std::dynamic_pointer_cast(owner); } } e->lerpMotion(packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0); } + + // 4J: Check our deferred entity link packets + checkDeferredEntityLinkPackets(e->entityId); } } @@ -789,11 +814,11 @@ void ClientConnection::handleAddPlayer( INetworkPlayer* networkPlayer = g_NetworkManager.GetPlayerByXuid(player->getXuid()); if (networkPlayer != NULL) - player->displayName = networkPlayer->GetDisplayName(); + player->m_displayName = networkPlayer->GetDisplayName(); #else // On all other platforms display name is just gamertag so don't check with // the network manager - player->displayName = player->name; + player->m_displayName = player->name; #endif // printf("\t\t\t\t%d: Add player\n",packet->id,packet->yRot); @@ -890,6 +915,16 @@ void ClientConnection::handleTeleportEntity( e->lerpTo(x, y, z, yRot, xRot, 3); } +void ClientConnection::handleSetCarriedItem( + std::shared_ptr packet) { + if (packet->slot >= 0 && packet->slot < Inventory::getSelectionSize()) { + Minecraft::GetInstance() + ->localplayers[m_userIndex] + .get() + ->inventory->selected = packet->slot; + } +} + void ClientConnection::handleMoveEntity( std::shared_ptr packet) { std::shared_ptr e = getEntity(packet->id); @@ -1116,23 +1151,31 @@ void ClientConnection::handleBlockRegionUpdate( int y1 = packet->y + packet->ys; if (packet->bIsFullChunk) { y1 = Level::maxBuildHeight; - if (packet->buffer.length > 0) + if (packet->buffer.length > 0) { + PIXBeginNamedEvent(0, "Reordering to XZY"); LevelChunk::reorderBlocksAndDataToXZY(packet->y, packet->xs, packet->ys, packet->zs, &packet->buffer); + PIXEndNamedEvent(); + } } + PIXBeginNamedEvent(0, "Clear rest region"); dimensionLevel->clearResetRegion(packet->x, packet->y, packet->z, packet->x + packet->xs - 1, y1 - 1, packet->z + packet->zs - 1); + PIXEndNamedEvent(); + PIXBeginNamedEvent(0, "setBlocksAndData"); // Only full chunks send lighting information now - added flag to end of // this call dimensionLevel->setBlocksAndData(packet->x, packet->y, packet->z, packet->xs, packet->ys, packet->zs, packet->buffer, packet->bIsFullChunk); + PIXEndNamedEvent(); // OutputDebugString("END BRU\n"); + PIXBeginNamedEvent(0, "removeUnusedTileEntitiesInRegion"); // 4J - remove any tite entities in this region which are associated // with a tile that is now no longer a tile entity. Without doing this // we end up with stray tile entities kicking round, which leads to a @@ -1141,14 +1184,17 @@ void ClientConnection::handleBlockRegionUpdate( dimensionLevel->removeUnusedTileEntitiesInRegion( packet->x, packet->y, packet->z, packet->x + packet->xs, y1, packet->z + packet->zs); + PIXEndNamedEvent(); // If this is a full packet for a chunk, make sure that the cache now // considers that it has data for this chunk - this is used to determine // whether to bother rendering mobs or not, so we don't have them in // crazy positions before the data is there if (packet->bIsFullChunk) { + PIXBeginNamedEvent(0, "dateReceivedForChunk"); dimensionLevel->dataReceivedForChunk(packet->x >> 4, packet->z >> 4); + PIXEndNamedEvent(); } PIXEndNamedEvent(); } @@ -1271,10 +1317,9 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, !MinecraftServer::saveOnExitAnswered()) { unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_EXITING_GAME, IDS_GENERIC_ERROR, uiIDA, 1, - ProfileManager.GetPrimaryPad(), - &ClientConnection::HostDisconnectReturned, NULL, - app.GetStringTable()); + ui.RequestErrorMessage(IDS_EXITING_GAME, IDS_GENERIC_ERROR, uiIDA, 1, + ProfileManager.GetPrimaryPad(), + &ClientConnection::HostDisconnectReturned, NULL); } else { app.SetAction(m_userIndex, eAppAction_ExitWorld, (void*)TRUE); } @@ -1298,8 +1343,8 @@ void ClientConnection::send(std::shared_ptr packet) { void ClientConnection::handleTakeItemEntity( std::shared_ptr packet) { std::shared_ptr from = getEntity(packet->itemId); - std::shared_ptr to = - std::dynamic_pointer_cast(getEntity(packet->playerId)); + std::shared_ptr to = + std::dynamic_pointer_cast(getEntity(packet->playerId)); // 4J - the original game could assume that if getEntity didn't find the // player, it must be the local player. We need to search all local players @@ -1386,6 +1431,10 @@ void ClientConnection::handleChat(std::shared_ptr packet) { int iPos; bool displayOnGui = true; + bool replacePlayer = false; + bool replaceEntitySource = false; + bool replaceItem = false; + std::wstring playerDisplayName = L""; std::wstring sourceDisplayName = L""; @@ -1437,132 +1486,214 @@ void ClientConnection::handleChat(std::shared_ptr packet) { break; case ChatPacket::e_ChatDeathInFire: message = app.GetString(IDS_DEATH_INFIRE); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + replacePlayer = true; break; case ChatPacket::e_ChatDeathOnFire: message = app.GetString(IDS_DEATH_ONFIRE); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + replacePlayer = true; break; case ChatPacket::e_ChatDeathLava: message = app.GetString(IDS_DEATH_LAVA); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + replacePlayer = true; break; case ChatPacket::e_ChatDeathInWall: message = app.GetString(IDS_DEATH_INWALL); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + replacePlayer = true; break; case ChatPacket::e_ChatDeathDrown: message = app.GetString(IDS_DEATH_DROWN); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + replacePlayer = true; break; case ChatPacket::e_ChatDeathStarve: message = app.GetString(IDS_DEATH_STARVE); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + replacePlayer = true; break; case ChatPacket::e_ChatDeathCactus: message = app.GetString(IDS_DEATH_CACTUS); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + replacePlayer = true; break; case ChatPacket::e_ChatDeathFall: message = app.GetString(IDS_DEATH_FALL); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + replacePlayer = true; break; case ChatPacket::e_ChatDeathOutOfWorld: message = app.GetString(IDS_DEATH_OUTOFWORLD); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + replacePlayer = true; break; case ChatPacket::e_ChatDeathGeneric: message = app.GetString(IDS_DEATH_GENERIC); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + replacePlayer = true; break; case ChatPacket::e_ChatDeathExplosion: message = app.GetString(IDS_DEATH_EXPLOSION); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + replacePlayer = true; break; case ChatPacket::e_ChatDeathMagic: message = app.GetString(IDS_DEATH_MAGIC); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + replacePlayer = true; break; case ChatPacket::e_ChatDeathAnvil: message = app.GetString(IDS_DEATH_FALLING_ANVIL); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + replacePlayer = true; break; case ChatPacket::e_ChatDeathFallingBlock: message = app.GetString(IDS_DEATH_FALLING_TILE); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + replacePlayer = true; break; case ChatPacket::e_ChatDeathDragonBreath: message = app.GetString(IDS_DEATH_DRAGON_BREATH); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + replacePlayer = true; break; case ChatPacket::e_ChatDeathMob: message = app.GetString(IDS_DEATH_MOB); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); - message = replaceAll( - message, L"{*SOURCE*}", - app.getEntityName((eINSTANCEOF)packet->m_intArgs[0])); + replacePlayer = true; + replaceEntitySource = true; break; case ChatPacket::e_ChatDeathPlayer: message = app.GetString(IDS_DEATH_PLAYER); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); - message = replaceAll(message, L"{*SOURCE*}", sourceDisplayName); + replacePlayer = true; + replaceEntitySource = true; break; case ChatPacket::e_ChatDeathArrow: message = app.GetString(IDS_DEATH_ARROW); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); - if (packet->m_intArgs[0] == eTYPE_SERVERPLAYER) { - message = replaceAll(message, L"{*SOURCE*}", sourceDisplayName); - } else { - message = replaceAll( - message, L"{*SOURCE*}", - app.getEntityName((eINSTANCEOF)packet->m_intArgs[0])); - } + replacePlayer = true; + replaceEntitySource = true; break; case ChatPacket::e_ChatDeathFireball: message = app.GetString(IDS_DEATH_FIREBALL); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); - if (packet->m_intArgs[0] == eTYPE_SERVERPLAYER) { - message = - replaceAll(message, L"{*SOURCE*}", packet->m_stringArgs[1]); - } else { - message = replaceAll( - message, L"{*SOURCE*}", - app.getEntityName((eINSTANCEOF)packet->m_intArgs[0])); - } + replacePlayer = true; + replaceEntitySource = true; break; case ChatPacket::e_ChatDeathThrown: message = app.GetString(IDS_DEATH_THROWN); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); - if (packet->m_intArgs[0] == eTYPE_SERVERPLAYER) { - message = replaceAll(message, L"{*SOURCE*}", sourceDisplayName); - } else { - message = replaceAll( - message, L"{*SOURCE*}", - app.getEntityName((eINSTANCEOF)packet->m_intArgs[0])); - } + replacePlayer = true; + replaceEntitySource = true; break; case ChatPacket::e_ChatDeathIndirectMagic: message = app.GetString(IDS_DEATH_INDIRECT_MAGIC); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); - if (packet->m_intArgs[0] == eTYPE_SERVERPLAYER) { - message = replaceAll(message, L"{*SOURCE*}", sourceDisplayName); - } else { - message = replaceAll( - message, L"{*SOURCE*}", - app.getEntityName((eINSTANCEOF)packet->m_intArgs[0])); - } + replacePlayer = true; + replaceEntitySource = true; break; case ChatPacket::e_ChatDeathThorns: message = app.GetString(IDS_DEATH_THORNS); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); - if (packet->m_intArgs[0] == eTYPE_SERVERPLAYER) { - message = replaceAll(message, L"{*SOURCE*}", sourceDisplayName); - } else { - message = replaceAll( - message, L"{*SOURCE*}", - app.getEntityName((eINSTANCEOF)packet->m_intArgs[0])); - } + replacePlayer = true; + replaceEntitySource = true; break; + + case ChatPacket::e_ChatDeathFellAccidentLadder: + message = app.GetString(IDS_DEATH_FELL_ACCIDENT_LADDER); + replacePlayer = true; + break; + case ChatPacket::e_ChatDeathFellAccidentVines: + message = app.GetString(IDS_DEATH_FELL_ACCIDENT_VINES); + replacePlayer = true; + break; + case ChatPacket::e_ChatDeathFellAccidentWater: + message = app.GetString(IDS_DEATH_FELL_ACCIDENT_WATER); + replacePlayer = true; + break; + case ChatPacket::e_ChatDeathFellAccidentGeneric: + message = app.GetString(IDS_DEATH_FELL_ACCIDENT_GENERIC); + replacePlayer = true; + break; + case ChatPacket::e_ChatDeathFellKiller: + // message=app.GetString(IDS_DEATH_FELL_KILLER); + // replacePlayer = true; + // replaceEntitySource = true; + + // 4J Stu - The correct string for here, IDS_DEATH_FELL_KILLER is + // incorrect. We can't change localisation, so use a different + // string for now + message = app.GetString(IDS_DEATH_FALL); + replacePlayer = true; + break; + case ChatPacket::e_ChatDeathFellAssist: + message = app.GetString(IDS_DEATH_FELL_ASSIST); + replacePlayer = true; + replaceEntitySource = true; + break; + case ChatPacket::e_ChatDeathFellAssistItem: + message = app.GetString(IDS_DEATH_FELL_ASSIST_ITEM); + replacePlayer = true; + replaceEntitySource = true; + replaceItem = true; + break; + case ChatPacket::e_ChatDeathFellFinish: + message = app.GetString(IDS_DEATH_FELL_FINISH); + replacePlayer = true; + replaceEntitySource = true; + break; + case ChatPacket::e_ChatDeathFellFinishItem: + message = app.GetString(IDS_DEATH_FELL_FINISH_ITEM); + replacePlayer = true; + replaceEntitySource = true; + replaceItem = true; + break; + case ChatPacket::e_ChatDeathInFirePlayer: + message = app.GetString(IDS_DEATH_INFIRE_PLAYER); + replacePlayer = true; + replaceEntitySource = true; + break; + case ChatPacket::e_ChatDeathOnFirePlayer: + message = app.GetString(IDS_DEATH_ONFIRE_PLAYER); + replacePlayer = true; + replaceEntitySource = true; + break; + case ChatPacket::e_ChatDeathLavaPlayer: + message = app.GetString(IDS_DEATH_LAVA_PLAYER); + replacePlayer = true; + replaceEntitySource = true; + break; + case ChatPacket::e_ChatDeathDrownPlayer: + message = app.GetString(IDS_DEATH_DROWN_PLAYER); + replacePlayer = true; + replaceEntitySource = true; + break; + case ChatPacket::e_ChatDeathCactusPlayer: + message = app.GetString(IDS_DEATH_CACTUS_PLAYER); + replacePlayer = true; + replaceEntitySource = true; + break; + case ChatPacket::e_ChatDeathExplosionPlayer: + message = app.GetString(IDS_DEATH_EXPLOSION_PLAYER); + replacePlayer = true; + replaceEntitySource = true; + break; + case ChatPacket::e_ChatDeathWither: + message = app.GetString(IDS_DEATH_WITHER); + replacePlayer = true; + break; + case ChatPacket::e_ChatDeathPlayerItem: + message = app.GetString(IDS_DEATH_PLAYER_ITEM); + replacePlayer = true; + replaceEntitySource = true; + replaceItem = true; + break; + case ChatPacket::e_ChatDeathArrowItem: + message = app.GetString(IDS_DEATH_ARROW_ITEM); + replacePlayer = true; + replaceEntitySource = true; + replaceItem = true; + break; + case ChatPacket::e_ChatDeathFireballItem: + message = app.GetString(IDS_DEATH_FIREBALL_ITEM); + replacePlayer = true; + replaceEntitySource = true; + replaceItem = true; + break; + case ChatPacket::e_ChatDeathThrownItem: + message = app.GetString(IDS_DEATH_THROWN_ITEM); + replacePlayer = true; + replaceEntitySource = true; + replaceItem = true; + break; + case ChatPacket::e_ChatDeathIndirectMagicItem: + message = app.GetString(IDS_DEATH_INDIRECT_MAGIC_ITEM); + replacePlayer = true; + replaceEntitySource = true; + replaceItem = true; + break; + case ChatPacket::e_ChatPlayerEnteredEnd: message = app.GetString(IDS_PLAYER_ENTERED_END); iPos = message.find(L"%s"); @@ -1596,6 +1727,9 @@ void ClientConnection::handleChat(std::shared_ptr packet) { case ChatPacket::e_ChatPlayerMaxWolves: message = app.GetString(IDS_MAX_WOLVES_SPAWNED); break; + case ChatPacket::e_ChatPlayerMaxBats: + message = app.GetString(IDS_MAX_BATS_SPAWNED); + break; // Breeding case ChatPacket::e_ChatPlayerMaxBredPigsSheepCows: @@ -1633,10 +1767,10 @@ void ClientConnection::handleChat(std::shared_ptr packet) { case ChatPacket::e_ChatCommandTeleportSuccess: message = app.GetString(IDS_COMMAND_TELEPORT_SUCCESS); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + replacePlayer = true; if (packet->m_intArgs[0] == eTYPE_SERVERPLAYER) { - message = replaceAll(message, L"{*DESTINATION*}", - packet->m_stringArgs[1]); + message = + replaceAll(message, L"{*DESTINATION*}", sourceDisplayName); } else { message = replaceAll( message, L"{*DESTINATION*}", @@ -1645,11 +1779,11 @@ void ClientConnection::handleChat(std::shared_ptr packet) { break; case ChatPacket::e_ChatCommandTeleportMe: message = app.GetString(IDS_COMMAND_TELEPORT_ME); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + replacePlayer = true; break; case ChatPacket::e_ChatCommandTeleportToMe: message = app.GetString(IDS_COMMAND_TELEPORT_TO_ME); - message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + replacePlayer = true; break; default: @@ -1657,10 +1791,37 @@ void ClientConnection::handleChat(std::shared_ptr packet) { break; } + if (replacePlayer) { + message = replaceAll(message, L"{*PLAYER*}", playerDisplayName); + } + + if (replaceEntitySource) { + if (packet->m_intArgs[0] == eTYPE_SERVERPLAYER) { + message = replaceAll(message, L"{*SOURCE*}", sourceDisplayName); + } else { + std::wstring entityName; + + // Check for a custom mob name + if (packet->m_stringArgs.size() >= 2 && + !packet->m_stringArgs[1].empty()) { + entityName = packet->m_stringArgs[1]; + } else { + entityName = + app.getEntityName((eINSTANCEOF)packet->m_intArgs[0]); + } + + message = replaceAll(message, L"{*SOURCE*}", entityName); + } + } + + if (replaceItem) { + message = replaceAll(message, L"{*ITEM*}", packet->m_stringArgs[2]); + } + // flag that a message is a death message bool bIsDeathMessage = (packet->m_messageType >= ChatPacket::e_ChatDeathInFire) && - (packet->m_messageType <= ChatPacket::e_ChatDeathDragonBreath); + (packet->m_messageType <= ChatPacket::e_ChatDeathIndirectMagicItem); if (displayOnGui) minecraft->gui->addMessage(message, m_userIndex, bIsDeathMessage); @@ -1670,13 +1831,14 @@ void ClientConnection::handleAnimate(std::shared_ptr packet) { std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; if (packet->action == AnimatePacket::SWING) { - std::shared_ptr player = std::dynamic_pointer_cast(e); - if (player != NULL) player->swing(); + if (e->instanceof(eTYPE_LIVINGENTITY)) + std::dynamic_pointer_cast(e)->swing(); } else if (packet->action == AnimatePacket::HURT) { e->animateHurt(); } else if (packet->action == AnimatePacket::WAKE_UP) { - std::shared_ptr player = std::dynamic_pointer_cast(e); - if (player != NULL) player->stopSleepInBed(false, false, false); + if (e->instanceof(eTYPE_PLAYER)) + std::dynamic_pointer_cast(e)->stopSleepInBed(false, false, + false); } else if (packet->action == AnimatePacket::RESPAWN) { } else if (packet->action == AnimatePacket::CRITICAL_HIT) { std::shared_ptr critParticle = @@ -1690,8 +1852,8 @@ void ClientConnection::handleAnimate(std::shared_ptr packet) { new CritParticle(minecraft->level, e, eParticleType_magicCrit)); critParticle->CritParticlePostConstructor(); minecraft->particleEngine->add(critParticle); - } else if (packet->action == AnimatePacket::EAT && - std::dynamic_pointer_cast(e) != NULL) { + } else if ((packet->action == AnimatePacket::EAT) && + e->instanceof(eTYPE_REMOTEPLAYER)) { } } @@ -2009,11 +2171,12 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { // Check this friend against each player, if we find them we // have at least one friend for (int j = 0; j < g_NetworkManager.GetPlayerCount(); j++) { - Platform::String ^ xboxUserId = ref new Platform::String( - g_NetworkManager.GetPlayerByIndex(j) - ->GetUID() - .toString() - .data()); + Platform::String ^ xboxUserId = + ref new Platform::String( + g_NetworkManager.GetPlayerByIndex(j) + ->GetUID() + .toString() + .data()); if (friendsXuid == xboxUserId) { isAtLeastOneFriend = true; break; @@ -2101,14 +2264,14 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; if (!isFriendsWithHost) - ui.RequestMessageBox( - IDS_CANTJOIN_TITLE, IDS_NOTALLOWED_FRIENDSOFFRIENDS, uiIDA, - 1, m_userIndex, NULL, NULL, app.GetStringTable()); + ui.RequestErrorMessage(IDS_CANTJOIN_TITLE, + IDS_NOTALLOWED_FRIENDSOFFRIENDS, uiIDA, + 1, m_userIndex); else - ui.RequestMessageBox( + ui.RequestErrorMessage( IDS_CANTJOIN_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL, uiIDA, - 1, m_userIndex, NULL, NULL, app.GetStringTable()); + 1, m_userIndex); app.SetDisconnectReason(reason); @@ -2144,7 +2307,9 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { packet->m_texturePackId); // 4J-PB - we need to upsell the texture pack to the player - // app.SetAction(m_userIndex,eAppAction_TexturePackRequired); +#if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ + app.SetAction(m_userIndex, eAppAction_TexturePackRequired); +#endif // Let the player go into the game, and we'll check that they // are using the right texture pack when in } @@ -2251,8 +2416,8 @@ void ClientConnection::handleAddMob(std::shared_ptr packet) { float yRot = packet->yRot * 360 / 256.0f; float xRot = packet->xRot * 360 / 256.0f; - std::shared_ptr mob = - std::dynamic_pointer_cast(EntityIO::newById(packet->type, level)); + std::shared_ptr mob = std::dynamic_pointer_cast( + EntityIO::newById(packet->type, level)); mob->xp = packet->x; mob->yp = packet->y; mob->zp = packet->z; @@ -2297,7 +2462,8 @@ void ClientConnection::handleAddMob(std::shared_ptr packet) { } void ClientConnection::handleSetTime(std::shared_ptr packet) { - minecraft->level->setTime(packet->time); + minecraft->level->setGameTime(packet->gameTime); + minecraft->level->setDayTime(packet->dayTime); } void ClientConnection::handleSetSpawn( @@ -2305,28 +2471,66 @@ void ClientConnection::handleSetSpawn( // minecraft->player->setRespawnPosition(new Pos(packet->x, packet->y, // packet->z)); minecraft->localplayers[m_userIndex]->setRespawnPosition( - new Pos(packet->x, packet->y, packet->z)); + new Pos(packet->x, packet->y, packet->z), true); minecraft->level->getLevelData()->setSpawn(packet->x, packet->y, packet->z); } -void ClientConnection::handleRidePacket( - std::shared_ptr packet) { - std::shared_ptr rider = getEntity(packet->riderId); - std::shared_ptr ridden = getEntity(packet->riddenId); +void ClientConnection::handleEntityLinkPacket( + std::shared_ptr packet) { + std::shared_ptr sourceEntity = getEntity(packet->sourceId); + std::shared_ptr destEntity = getEntity(packet->destId); - std::shared_ptr boat = std::dynamic_pointer_cast(ridden); - // if (packet->riderId == minecraft->player->entityId) rider = - // minecraft->player; - if (packet->riderId == minecraft->localplayers[m_userIndex]->entityId) { - rider = minecraft->localplayers[m_userIndex]; + // 4J: If the destination entity couldn't be found, defer handling of this + // packet This was added to support leashing (the entity link packet is sent + // before the add entity packet) + if (destEntity == NULL && packet->destId >= 0) { + // We don't handle missing source entities because it shouldn't happen + assert(!(sourceEntity == NULL && packet->sourceId >= 0)); - if (boat) boat->setDoLerp(false); - } else if (boat) { - boat->setDoLerp(true); + deferredEntityLinkPackets.push_back(DeferredEntityLinkPacket(packet)); + return; } - if (rider == NULL) return; - rider->ride(ridden); + if (packet->type == SetEntityLinkPacket::RIDING) { + bool displayMountMessage = false; + if (packet->sourceId == Minecraft::GetInstance() + ->localplayers[m_userIndex] + .get() + ->entityId) { + sourceEntity = Minecraft::GetInstance()->localplayers[m_userIndex]; + + if (destEntity != NULL && destEntity->instanceof(eTYPE_BOAT)) + (std::dynamic_pointer_cast(destEntity))->setDoLerp(false); + + displayMountMessage = + (sourceEntity->riding == NULL && destEntity != NULL); + } else if (destEntity != NULL && destEntity->instanceof(eTYPE_BOAT)) { + (std::dynamic_pointer_cast(destEntity))->setDoLerp(true); + } + + if (sourceEntity == NULL) return; + + sourceEntity->ride(destEntity); + + // 4J TODO: pretty sure this message is a tooltip so not needed + /* + if (displayMountMessage) { + Options options = minecraft.options; + minecraft.gui.setOverlayMessage(I18n.get("mount.onboard", + Options.getTranslatedKeyMessage(options.keySneak.key)), false); + } + */ + } else if (packet->type == SetEntityLinkPacket::LEASH) { + if ((sourceEntity != NULL) && sourceEntity->instanceof(eTYPE_MOB)) { + if (destEntity != NULL) { + (std::dynamic_pointer_cast(sourceEntity)) + ->setLeashedTo(destEntity, false); + } else { + (std::dynamic_pointer_cast(sourceEntity)) + ->dropLeash(false, false); + } + } + } } void ClientConnection::handleEntityEvent( @@ -2475,9 +2679,8 @@ void ClientConnection::handleTextureAndGeometry( void ClientConnection::handleTextureChange( std::shared_ptr packet) { std::shared_ptr e = getEntity(packet->id); - if (e == NULL) return; + if ((e == NULL) || !e->instanceof(eTYPE_PLAYER)) return; std::shared_ptr player = std::dynamic_pointer_cast(e); - if (e == NULL) return; bool isLocalPlayer = false; for (int i = 0; i < XUSER_MAX_COUNT; i++) { @@ -2740,34 +2943,91 @@ void ClientConnection::handleContainerOpen( std::shared_ptr player = minecraft->localplayers[m_userIndex]; switch (packet->type) { - case ContainerOpenPacket::CONTAINER: { + case ContainerOpenPacket::BONUS_CHEST: + case ContainerOpenPacket::LARGE_CHEST: + case ContainerOpenPacket::ENDER_CHEST: + case ContainerOpenPacket::CONTAINER: + case ContainerOpenPacket::MINECART_CHEST: { + int chestString; + switch (packet->type) { + case ContainerOpenPacket::MINECART_CHEST: + chestString = IDS_ITEM_MINECART; + break; + case ContainerOpenPacket::BONUS_CHEST: + chestString = IDS_BONUS_CHEST; + break; + case ContainerOpenPacket::LARGE_CHEST: + chestString = IDS_CHEST_LARGE; + break; + case ContainerOpenPacket::ENDER_CHEST: + chestString = IDS_TILE_ENDERCHEST; + break; + case ContainerOpenPacket::CONTAINER: + chestString = IDS_CHEST; + break; + default: + assert(false); + chestString = -1; + break; + } + if (player->openContainer(std::shared_ptr( - new SimpleContainer(packet->title, packet->size)))) { + new SimpleContainer(chestString, packet->title, + packet->customName, packet->size)))) { + player->containerMenu->containerId = packet->containerId; + } else { + failed = true; + } + } break; + case ContainerOpenPacket::HOPPER: { + std::shared_ptr hopper = + std::shared_ptr(new HopperTileEntity()); + if (packet->customName) hopper->setCustomName(packet->title); + if (player->openHopper(hopper)) { player->containerMenu->containerId = packet->containerId; } else { failed = true; } } break; case ContainerOpenPacket::FURNACE: { - if (player->openFurnace(std::shared_ptr( - new FurnaceTileEntity()))) { + std::shared_ptr furnace = + std::shared_ptr(new FurnaceTileEntity()); + if (packet->customName) furnace->setCustomName(packet->title); + if (player->openFurnace(furnace)) { player->containerMenu->containerId = packet->containerId; } else { failed = true; } } break; case ContainerOpenPacket::BREWING_STAND: { - if (player->openBrewingStand( - std::shared_ptr( - new BrewingStandTileEntity()))) { + std::shared_ptr brewingStand = + std::shared_ptr( + new BrewingStandTileEntity()); + if (packet->customName) brewingStand->setCustomName(packet->title); + + if (player->openBrewingStand(brewingStand)) { + player->containerMenu->containerId = packet->containerId; + } else { + failed = true; + } + } break; + case ContainerOpenPacket::DROPPER: { + std::shared_ptr dropper = + std::shared_ptr(new DropperTileEntity()); + if (packet->customName) dropper->setCustomName(packet->title); + + if (player->openTrap(dropper)) { player->containerMenu->containerId = packet->containerId; } else { failed = true; } } break; case ContainerOpenPacket::TRAP: { - if (player->openTrap(std::shared_ptr( - new DispenserTileEntity()))) { + std::shared_ptr dispenser = + std::shared_ptr(new DispenserTileEntity()); + if (packet->customName) dispenser->setCustomName(packet->title); + + if (player->openTrap(dispenser)) { player->containerMenu->containerId = packet->containerId; } else { failed = true; @@ -2783,9 +3043,10 @@ void ClientConnection::handleContainerOpen( } } break; case ContainerOpenPacket::ENCHANTMENT: { - if (player->startEnchanting(Mth::floor(player->x), - Mth::floor(player->y), - Mth::floor(player->z))) { + if (player->startEnchanting( + Mth::floor(player->x), Mth::floor(player->y), + Mth::floor(player->z), + packet->customName ? packet->title : L"")) { player->containerMenu->containerId = packet->containerId; } else { failed = true; @@ -2796,7 +3057,19 @@ void ClientConnection::handleContainerOpen( std::shared_ptr( new ClientSideMerchant(player, packet->title)); csm->createContainer(); - if (player->openTrading(csm)) { + if (player->openTrading(csm, + packet->customName ? packet->title : L"")) { + player->containerMenu->containerId = packet->containerId; + } else { + failed = true; + } + } break; + case ContainerOpenPacket::BEACON: { + std::shared_ptr beacon = + std::shared_ptr(new BeaconTileEntity()); + if (packet->customName) beacon->setCustomName(packet->title); + + if (player->openBeacon(beacon)) { player->containerMenu->containerId = packet->containerId; } else { failed = true; @@ -2811,7 +3084,41 @@ void ClientConnection::handleContainerOpen( failed = true; } } break; - }; + case ContainerOpenPacket::HORSE: { + std::shared_ptr entity = + std::dynamic_pointer_cast( + getEntity(packet->entityId)); + int iTitle = IDS_CONTAINER_ANIMAL; + switch (entity->getType()) { + case EntityHorse::TYPE_DONKEY: + iTitle = IDS_DONKEY; + break; + case EntityHorse::TYPE_MULE: + iTitle = IDS_MULE; + break; + default: + break; + }; + if (player->openHorseInventory( + std::dynamic_pointer_cast(entity), + std::shared_ptr( + new AnimalChest(iTitle, packet->title, + packet->customName, packet->size)))) { + player->containerMenu->containerId = packet->containerId; + } else { + failed = true; + } + } break; + case ContainerOpenPacket::FIREWORKS: { + if (player->openFireworks(Mth::floor(player->x), + Mth::floor(player->y), + Mth::floor(player->z))) { + player->containerMenu->containerId = packet->containerId; + } else { + failed = true; + } + } break; + } if (failed) { // Failed - if we've got a non-inventory container currently here, close @@ -2887,6 +3194,23 @@ void ClientConnection::handleContainerContent( } } +void ClientConnection::handleTileEditorOpen( + std::shared_ptr packet) { + std::shared_ptr tileEntity = + level->getTileEntity(packet->x, packet->y, packet->z); + if (tileEntity != NULL) { + minecraft->localplayers[m_userIndex]->openTextEdit(tileEntity); + } else if (packet->editorType == TileEditorOpenPacket::SIGN) { + std::shared_ptr localSignDummy = + std::shared_ptr(new SignTileEntity()); + localSignDummy->setLevel(level); + localSignDummy->x = packet->x; + localSignDummy->y = packet->y; + localSignDummy->z = packet->z; + minecraft->player->openTextEdit(localSignDummy); + } +} + void ClientConnection::handleSignUpdate( std::shared_ptr packet) { app.DebugPrintf("ClientConnection::handleSignUpdate - "); @@ -2928,19 +3252,18 @@ void ClientConnection::handleTileEntityData( std::dynamic_pointer_cast(te) != NULL) { std::dynamic_pointer_cast(te)->load( packet->tag); - } - // else if (packet.type == TileEntityDataPacket.TYPE_ADV_COMMAND && - // (te instanceof CommandBlockEntity)) - //{ - // ((CommandBlockEntity) te).load(packet.tag); - // } - // else if (packet.type == TileEntityDataPacket.TYPE_BEACON && (te - // instanceof BeaconTileEntity)) - //{ - // ((BeaconTileEntity) te).load(packet.tag); - // } - else if (packet->type == TileEntityDataPacket::TYPE_SKULL && - std::dynamic_pointer_cast(te) != NULL) { + } else if (packet->type == TileEntityDataPacket::TYPE_ADV_COMMAND && + std::dynamic_pointer_cast(te) != + NULL) { + std::dynamic_pointer_cast(te)->load( + packet->tag); + } else if (packet->type == TileEntityDataPacket::TYPE_BEACON && + std::dynamic_pointer_cast(te) != + NULL) { + std::dynamic_pointer_cast(te)->load( + packet->tag); + } else if (packet->type == TileEntityDataPacket::TYPE_SKULL && + std::dynamic_pointer_cast(te) != NULL) { std::dynamic_pointer_cast(te)->load( packet->tag); } @@ -2972,7 +3295,7 @@ void ClientConnection::handleSetEquippedItem( void ClientConnection::handleContainerClose( std::shared_ptr packet) { - minecraft->localplayers[m_userIndex]->closeContainer(); + minecraft->localplayers[m_userIndex]->clientSideCloseContainer(); } void ClientConnection::handleTileEvent( @@ -3062,6 +3385,12 @@ void ClientConnection::handleGameEvent( } } else if (event == GameEventPacket::STOP_SAVING) { if (!g_NetworkManager.IsHost()) app.SetGameStarted(true); + } else if (event == GameEventPacket::SUCCESSFUL_BOW_HIT) { + std::shared_ptr player = + minecraft->localplayers[m_userIndex]; + level->playLocalSound(player->x, player->y + player->getHeadHeight(), + player->z, eSoundType_RANDOM_BOW_HIT, 0.18f, + 0.45f, false); } } @@ -3078,28 +3407,28 @@ void ClientConnection::handleComplexItemData( void ClientConnection::handleLevelEvent( std::shared_ptr packet) { - switch (packet->type) { - case LevelEvent::SOUND_DRAGON_DEATH: { - Minecraft* pMinecraft = Minecraft::GetInstance(); - for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (pMinecraft->localplayers[i] != NULL && - pMinecraft->localplayers[i]->level != NULL && - pMinecraft->localplayers[i]->level->dimension->id == 1) { - pMinecraft->localplayers[i]->awardStat( - GenericStats::completeTheEnd(), - GenericStats::param_noArgs()); - } + if (packet->type == LevelEvent::SOUND_DRAGON_DEATH) { + for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { + if (minecraft->localplayers[i] != NULL && + minecraft->localplayers[i]->level != NULL && + minecraft->localplayers[i]->level->dimension->id == 1) { + minecraft->localplayers[i]->awardStat( + GenericStats::completeTheEnd(), + GenericStats::param_noArgs()); } } - minecraft->level->levelEvent(packet->type, packet->x, packet->y, - packet->z, packet->data); - - break; - default: - minecraft->level->levelEvent(packet->type, packet->x, packet->y, - packet->z, packet->data); - break; } + + if (packet->isGlobalEvent()) { + minecraft->level->globalLevelEvent(packet->type, packet->x, packet->y, + packet->z, packet->data); + } else { + minecraft->level->levelEvent(packet->type, packet->x, packet->y, + packet->z, packet->data); + } + + minecraft->level->levelEvent(packet->type, packet->x, packet->y, packet->z, + packet->data); } void ClientConnection::handleAwardStat( @@ -3111,20 +3440,25 @@ void ClientConnection::handleAwardStat( void ClientConnection::handleUpdateMobEffect( std::shared_ptr packet) { std::shared_ptr e = getEntity(packet->entityId); - if (e == NULL || std::dynamic_pointer_cast(e) == NULL) return; + if ((e == NULL) || !e->instanceof(eTYPE_LIVINGENTITY)) return; - (std::dynamic_pointer_cast(e)) - ->addEffect(new MobEffectInstance(packet->effectId, - packet->effectDurationTicks, - packet->effectAmplifier)); + //( std::dynamic_pointer_cast(e) )->addEffect(new + // MobEffectInstance(packet->effectId, packet->effectDurationTicks, + // packet->effectAmplifier)); + + MobEffectInstance* mobEffectInstance = new MobEffectInstance( + packet->effectId, packet->effectDurationTicks, packet->effectAmplifier); + mobEffectInstance->setNoCounter(packet->isSuperLongDuration()); + std::dynamic_pointer_cast(e)->addEffect(mobEffectInstance); } void ClientConnection::handleRemoveMobEffect( std::shared_ptr packet) { std::shared_ptr e = getEntity(packet->entityId); - if (e == NULL || std::dynamic_pointer_cast(e) == NULL) return; + if ((e == NULL) || !e->instanceof(eTYPE_LIVINGENTITY)) return; - (std::dynamic_pointer_cast(e))->removeEffectNoUpdate(packet->effectId); + (std::dynamic_pointer_cast(e)) + ->removeEffectNoUpdate(packet->effectId); } bool ClientConnection::isServerPacketListener() { return false; } @@ -3149,7 +3483,7 @@ void ClientConnection::handlePlayerInfo( packet->m_playerPrivileges); std::shared_ptr entity = getEntity(packet->m_entityId); - if (entity != NULL && entity->GetType() == eTYPE_PLAYER) { + if (entity != NULL && entity->instanceof(eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(entity); player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, @@ -3356,13 +3690,14 @@ void ClientConnection::handlePlayerAbilities( player->abilities.invulnerable = playerAbilitiesPacket->isInvulnerable(); player->abilities.mayfly = playerAbilitiesPacket->canFly(); player->abilities.setFlyingSpeed(playerAbilitiesPacket->getFlyingSpeed()); + player->abilities.setWalkingSpeed(playerAbilitiesPacket->getWalkingSpeed()); } void ClientConnection::handleSoundEvent( std::shared_ptr packet) { - minecraft->level->playLocalSound(packet->getX(), packet->getY(), - packet->getZ(), packet->getSound(), - packet->getVolume(), packet->getPitch()); + minecraft->level->playLocalSound( + packet->getX(), packet->getY(), packet->getZ(), packet->getSound(), + packet->getVolume(), packet->getPitch(), false); } void ClientConnection::handleCustomPayload( @@ -3498,10 +3833,10 @@ int ClientConnection::HostDisconnectReturned( unsigned int uiIDA[2]; uiIDA[0] = IDS_CONFIRM_CANCEL; uiIDA[1] = IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, - 2, ProfileManager.GetPrimaryPad(), - &ClientConnection::ExitGameAndSaveReturned, NULL, - app.GetStringTable()); + ui.RequestErrorMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, + uiIDA, 2, ProfileManager.GetPrimaryPad(), + &ClientConnection::ExitGameAndSaveReturned, + NULL); } else #else // Give the player the option to save their game @@ -3514,10 +3849,10 @@ int ClientConnection::HostDisconnectReturned( unsigned int uiIDA[2]; uiIDA[0] = IDS_CONFIRM_CANCEL; uiIDA[1] = IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, - 2, ProfileManager.GetPrimaryPad(), - &ClientConnection::ExitGameAndSaveReturned, NULL, - app.GetStringTable()); + ui.RequestErrorMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, + uiIDA, 2, ProfileManager.GetPrimaryPad(), + &ClientConnection::ExitGameAndSaveReturned, + NULL); } else #endif { @@ -3563,3 +3898,211 @@ std::wstring ClientConnection::GetDisplayNameByGamertag(std::wstring gamertag) { return gamertag; #endif } + +void ClientConnection::handleAddObjective( + std::shared_ptr packet) { +#if 0 + Scoreboard scoreboard = level->getScoreboard(); + + if (packet->method == SetObjectivePacket::METHOD_ADD) + { + Objective objective = scoreboard->addObjective(packet->objectiveName, ObjectiveCriteria::DUMMY); + objective->setDisplayName(packet->displayName); + } + else + { + Objective objective = scoreboard->getObjective(packet->objectiveName); + + if (packet->method == SetObjectivePacket::METHOD_REMOVE) + { + scoreboard->removeObjective(objective); + } + else if (packet->method == SetObjectivePacket::METHOD_CHANGE) + { + objective->setDisplayName(packet->displayName); + } + } +#endif +} + +void ClientConnection::handleSetScore(std::shared_ptr packet) { +#if 0 + Scoreboard scoreboard = level->getScoreboard(); + Objective objective = scoreboard->getObjective(packet->objectiveName); + + if (packet->method == SetScorePacket::METHOD_CHANGE) + { + Score score = scoreboard->getPlayerScore(packet->owner, objective); + score->setScore(packet->score); + } + else if (packet->method == SetScorePacket::METHOD_REMOVE) + { + scoreboard->resetPlayerScore(packet->owner); + } +#endif +} + +void ClientConnection::handleSetDisplayObjective( + std::shared_ptr packet) { +#if 0 + Scoreboard scoreboard = level->getScoreboard(); + + if (packet->objectiveName->length() == 0) + { + scoreboard->setDisplayObjective(packet->slot, null); + } + else + { + Objective objective = scoreboard->getObjective(packet->objectiveName); + scoreboard->setDisplayObjective(packet->slot, objective); + } +#endif +} + +void ClientConnection::handleSetPlayerTeamPacket( + std::shared_ptr packet) { +#if 0 + Scoreboard scoreboard = level->getScoreboard(); + PlayerTeam *team; + + if (packet->method == SetPlayerTeamPacket::METHOD_ADD) + { + team = scoreboard->addPlayerTeam(packet->name); + } + else + { + team = scoreboard->getPlayerTeam(packet->name); + } + + if (packet->method == SetPlayerTeamPacket::METHOD_ADD || packet->method == SetPlayerTeamPacket::METHOD_CHANGE) + { + team->setDisplayName(packet->displayName); + team->setPrefix(packet->prefix); + team->setSuffix(packet->suffix); + team->unpackOptions(packet->options); + } + + if (packet->method == SetPlayerTeamPacket::METHOD_ADD || packet->method == SetPlayerTeamPacket::METHOD_JOIN) + { + for (int i = 0; i < packet->players.size(); i++) + { + scoreboard->addPlayerToTeam(packet->players[i], team); + } + } + + if (packet->method == SetPlayerTeamPacket::METHOD_LEAVE) + { + for (int i = 0; i < packet->players.size(); i++) + { + scoreboard->removePlayerFromTeam(packet->players[i], team); + } + } + + if (packet->method == SetPlayerTeamPacket::METHOD_REMOVE) + { + scoreboard->removePlayerTeam(team); + } +#endif +} + +void ClientConnection::handleParticleEvent( + std::shared_ptr packet) { + for (int i = 0; i < packet->getCount(); i++) { + double xVarience = random->nextGaussian() * packet->getXDist(); + double yVarience = random->nextGaussian() * packet->getYDist(); + double zVarience = random->nextGaussian() * packet->getZDist(); + double xa = random->nextGaussian() * packet->getMaxSpeed(); + double ya = random->nextGaussian() * packet->getMaxSpeed(); + double za = random->nextGaussian() * packet->getMaxSpeed(); + + // TODO: determine particle ID from name + assert(0); + ePARTICLE_TYPE particleId = eParticleType_heart; + + level->addParticle(particleId, packet->getX() + xVarience, + packet->getY() + yVarience, + packet->getZ() + zVarience, xa, ya, za); + } +} + +void ClientConnection::handleUpdateAttributes( + std::shared_ptr packet) { + std::shared_ptr entity = getEntity(packet->getEntityId()); + if (entity == NULL) return; + + if (!entity->instanceof(eTYPE_LIVINGENTITY)) { + // Entity is not a living entity! + assert(0); + } + + BaseAttributeMap* attributes = + (std::dynamic_pointer_cast(entity))->getAttributes(); + std::unordered_set + attributeSnapshots = packet->getValues(); + for (AUTO_VAR(it, attributeSnapshots.begin()); + it != attributeSnapshots.end(); ++it) { + UpdateAttributesPacket::AttributeSnapshot* attribute = *it; + AttributeInstance* instance = + attributes->getInstance(attribute->getId()); + + if (instance == NULL) { + // 4J - TODO: revisit, not familiar with the attribute system, why + // are we passing in MIN_NORMAL (Java's smallest non-zero value + // conforming to IEEE Standard 754 (?)) and MAX_VALUE + instance = attributes->registerAttribute(new RangedAttribute( + attribute->getId(), 0, Double::MIN_NORMAL, Double::MAX_VALUE)); + } + + instance->setBaseValue(attribute->getBase()); + instance->removeModifiers(); + + std::unordered_set* modifiers = + attribute->getModifiers(); + + for (AUTO_VAR(it2, modifiers->begin()); it2 != modifiers->end(); + ++it2) { + AttributeModifier* modifier = *it2; + instance->addModifier( + new AttributeModifier(modifier->getId(), modifier->getAmount(), + modifier->getOperation())); + } + } +} + +// 4J: Check for deferred entity link packets related to this entity ID and +// handle them +void ClientConnection::checkDeferredEntityLinkPackets(int newEntityId) { + if (deferredEntityLinkPackets.empty()) return; + + for (int i = 0; i < deferredEntityLinkPackets.size(); i++) { + DeferredEntityLinkPacket* deferred = &deferredEntityLinkPackets[i]; + + bool remove = false; + + // Only consider recently deferred packets + int tickInterval = GetTickCount() - deferred->m_recievedTick; + if (tickInterval < MAX_ENTITY_LINK_DEFERRAL_INTERVAL) { + // Note: we assume it's the destination entity + if (deferred->m_packet->destId == newEntityId) { + handleEntityLinkPacket(deferred->m_packet); + remove = true; + } + } else { + // This is an old packet, remove (shouldn't really come up but seems + // prudent) + remove = true; + } + + if (remove) { + deferredEntityLinkPackets.erase(deferredEntityLinkPackets.begin() + + i); + i--; + } + } +} + +ClientConnection::DeferredEntityLinkPacket::DeferredEntityLinkPacket( + std::shared_ptr packet) { + m_recievedTick = GetTickCount(); + m_packet = packet; +} \ No newline at end of file diff --git a/Minecraft.Client/Network/ClientConnection.h b/Minecraft.Client/Network/ClientConnection.h index 58d1dfd77..f31ea0a58 100644 --- a/Minecraft.Client/Network/ClientConnection.h +++ b/Minecraft.Client/Network/ClientConnection.h @@ -65,6 +65,8 @@ public: virtual void handleAddPlayer(std::shared_ptr packet); virtual void handleTeleportEntity( std::shared_ptr packet); + virtual void handleSetCarriedItem( + std::shared_ptr packet); virtual void handleMoveEntity(std::shared_ptr packet); virtual void handleRotateMob(std::shared_ptr packet); virtual void handleMoveEntitySmall( @@ -102,7 +104,8 @@ public: virtual void handleAddMob(std::shared_ptr packet); virtual void handleSetTime(std::shared_ptr packet); virtual void handleSetSpawn(std::shared_ptr packet); - virtual void handleRidePacket(std::shared_ptr packet); + virtual void handleEntityLinkPacket( + std::shared_ptr packet); virtual void handleEntityEvent(std::shared_ptr packet); private: @@ -122,6 +125,8 @@ public: virtual void handleContainerAck(std::shared_ptr packet); virtual void handleContainerContent( std::shared_ptr packet); + virtual void handleTileEditorOpen( + std::shared_ptr packet); virtual void handleSignUpdate(std::shared_ptr packet); virtual void handleTileEntityData( std::shared_ptr packet); @@ -179,4 +184,30 @@ public: void displayPrivilegeChanges(std::shared_ptr player, unsigned int oldPrivileges); -}; + + virtual void handleAddObjective(std::shared_ptr packet); + virtual void handleSetScore(std::shared_ptr packet); + virtual void handleSetDisplayObjective( + std::shared_ptr packet); + virtual void handleSetPlayerTeamPacket( + std::shared_ptr packet); + virtual void handleParticleEvent( + std::shared_ptr packet); + virtual void handleUpdateAttributes( + std::shared_ptr packet); + +private: + // 4J: Entity link packet deferred + class DeferredEntityLinkPacket { + public: + DWORD m_recievedTick; + std::shared_ptr m_packet; + + DeferredEntityLinkPacket(std::shared_ptr packet); + }; + + std::vector deferredEntityLinkPackets; + static const int MAX_ENTITY_LINK_DEFERRAL_INTERVAL = 1000; + + void checkDeferredEntityLinkPackets(int newEntityId); +}; \ No newline at end of file diff --git a/Minecraft.Client/Network/MultiPlayerChunkCache.cpp b/Minecraft.Client/Network/MultiPlayerChunkCache.cpp index 74648c2ad..8a95be10f 100644 --- a/Minecraft.Client/Network/MultiPlayerChunkCache.cpp +++ b/Minecraft.Client/Network/MultiPlayerChunkCache.cpp @@ -44,7 +44,7 @@ MultiPlayerChunkCache::MultiPlayerChunkCache(Level* level) { for (int z = 0; z < 16; z++) { unsigned char tileId = 0; if (y <= (level->getSeaLevel() - 10)) - tileId = Tile::rock_Id; + tileId = Tile::stone_Id; else if (y < level->getSeaLevel()) tileId = Tile::calmWater_Id; @@ -195,8 +195,7 @@ LevelChunk* MultiPlayerChunkCache::create(int x, int z) { // 4J - changed to use new methods for lighting chunk->setSkyLightDataAllBright(); - // Arrays::fill(chunk->skyLight->data, (uint8_t) - //255); + // Arrays::fill(chunk->skyLight->data, (byte) 255); } chunk->loaded = true; @@ -278,6 +277,9 @@ TilePos* MultiPlayerChunkCache::findNearestMapFeature( return NULL; } +void MultiPlayerChunkCache::recreateLogicStructuresForChunk(int chunkX, + int chunkZ) {} + std::wstring MultiPlayerChunkCache::gatherStats() { EnterCriticalSection(&m_csLoadCreate); int size = (int)loadedChunkList.size(); diff --git a/Minecraft.Client/Network/MultiPlayerChunkCache.h b/Minecraft.Client/Network/MultiPlayerChunkCache.h index 09710048d..ef14a168f 100644 --- a/Minecraft.Client/Network/MultiPlayerChunkCache.h +++ b/Minecraft.Client/Network/MultiPlayerChunkCache.h @@ -44,6 +44,7 @@ public: virtual TilePos* findNearestMapFeature(Level* level, const std::wstring& featureName, int x, int y, int z); + virtual void recreateLogicStructuresForChunk(int chunkX, int chunkZ); virtual void dataReceived(int x, int z); // 4J added virtual LevelChunk** getCache() { return cache; } // 4J added diff --git a/Minecraft.Client/Network/PendingConnection.cpp b/Minecraft.Client/Network/PendingConnection.cpp index bd86e35e4..08e1bb031 100644 --- a/Minecraft.Client/Network/PendingConnection.cpp +++ b/Minecraft.Client/Network/PendingConnection.cpp @@ -258,3 +258,5 @@ std::wstring PendingConnection::getName() { } bool PendingConnection::isServerPacketListener() { return true; } + +bool PendingConnection::isDisconnected() { return done; } \ No newline at end of file diff --git a/Minecraft.Client/Network/PendingConnection.h b/Minecraft.Client/Network/PendingConnection.h index 8ee23c434..aab9e0ed3 100644 --- a/Minecraft.Client/Network/PendingConnection.h +++ b/Minecraft.Client/Network/PendingConnection.h @@ -46,6 +46,7 @@ public: void send(std::shared_ptr packet); std::wstring getName(); virtual bool isServerPacketListener(); + virtual bool isDisconnected(); private: void sendPreLoginResponse(); diff --git a/Minecraft.Client/Network/PlayerChunkMap.cpp b/Minecraft.Client/Network/PlayerChunkMap.cpp index 95812270b..be55d0174 100644 --- a/Minecraft.Client/Network/PlayerChunkMap.cpp +++ b/Minecraft.Client/Network/PlayerChunkMap.cpp @@ -7,6 +7,7 @@ #include "../MinecraftServer.h" #include "../../Minecraft.World/Headers/net.minecraft.network.packet.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.h" +#include "../../Minecraft.World/Headers/net.minecraft.world.level.chunk.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.tile.h" #include "../../Minecraft.World/Util/ArrayWithLength.h" #include "../../Minecraft.World/Platform/System.h" @@ -23,19 +24,12 @@ PlayerChunkMap::PlayerChunk::PlayerChunk(int x, int z, PlayerChunkMap* pcm) parent = pcm; // 4J added ticksToNextRegionUpdate = 0; // 4J added prioritised = false; // 4J added + firstInhabitedTime = 0; parent->getLevel()->cache->create(x, z); - // 4J - added make sure our lights are up to date as soon as we make it. - // This is of particular concern for local clients, who have their data - // shared as soon as the chunkvisibilitypacket is sent, and so could - // potentially create render data for this chunk before it has been properly - // lit. - while (parent->getLevel()->updateLights()); } -PlayerChunkMap::PlayerChunk::~PlayerChunk() { - delete[] changedTiles.data; // 4jcraft, changed to [] -} +PlayerChunkMap::PlayerChunk::~PlayerChunk() { delete changedTiles.data; } // 4J added - construct an an array of flags that indicate which entities are // still waiting to have network packets sent out to say that they have been @@ -77,6 +71,10 @@ void PlayerChunkMap::PlayerChunk::add(std::shared_ptr player, player->connection->send(std::shared_ptr( new ChunkVisibilityPacket(pos.x, pos.z, true))); + if (players.empty()) { + firstInhabitedTime = parent->level->getGameTime(); + } + players.push_back(player); player->chunksToSend.push_back(pos); @@ -103,7 +101,14 @@ void PlayerChunkMap::PlayerChunk::remove(std::shared_ptr player) { players.erase(it); if (players.size() == 0) { - __int64 id = (pos.x + 0x7fffffffLL) | ((pos.z + 0x7fffffffLL) << 32); + { + LevelChunk* chunk = parent->level->getChunk(pos.x, pos.z); + updateInhabitedTime(chunk); + AUTO_VAR(it, find(parent->knownChunks.begin(), + parent->knownChunks.end(), this)); + if (it != parent->knownChunks.end()) parent->knownChunks.erase(it); + } + int64_t id = (pos.x + 0x7fffffffLL) | ((pos.z + 0x7fffffffLL) << 32); AUTO_VAR(it, parent->chunks.find(id)); if (it != parent->chunks.end()) { toDelete = it->second; // Don't delete until the end of the @@ -157,6 +162,16 @@ void PlayerChunkMap::PlayerChunk::remove(std::shared_ptr player) { delete toDelete; } +void PlayerChunkMap::PlayerChunk::updateInhabitedTime() { + updateInhabitedTime(parent->level->getChunk(pos.x, pos.z)); +} + +void PlayerChunkMap::PlayerChunk::updateInhabitedTime(LevelChunk* chunk) { + chunk->inhabitedTime += parent->level->getGameTime() - firstInhabitedTime; + + firstInhabitedTime = parent->level->getGameTime(); +} + void PlayerChunkMap::PlayerChunk::tileChanged(int x, int y, int z) { if (changes == 0) { parent->changedChunks.push_back(this); @@ -386,6 +401,7 @@ PlayerChunkMap::PlayerChunkMap(ServerLevel* level, int dimension, int radius) { this->radius = radius; this->level = level; this->dimension = dimension; + lastInhabitedUpdate = 0; } PlayerChunkMap::~PlayerChunkMap() { @@ -397,6 +413,22 @@ PlayerChunkMap::~PlayerChunkMap() { ServerLevel* PlayerChunkMap::getLevel() { return level; } void PlayerChunkMap::tick() { + int64_t time = level->getGameTime(); + + if (time - lastInhabitedUpdate > Level::TICKS_PER_DAY / 3) { + lastInhabitedUpdate = time; + + for (int i = 0; i < knownChunks.size(); i++) { + PlayerChunk* chunk = knownChunks.at(i); + + // 4J Stu - Going to let our changeChunks handler below deal with + // this + // chunk.broadcastChanges(); + + chunk->updateInhabitedTime(); + } + } + // 4J - some changes here so that we only send one region update per tick. // The chunks themselves also limit their resend rate to once every // MIN_TICKS_BETWEEN_REGION_UPDATE ticks @@ -432,13 +464,13 @@ void PlayerChunkMap::tick() { } bool PlayerChunkMap::hasChunk(int x, int z) { - __int64 id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32); + int64_t id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32); return chunks.find(id) != chunks.end(); } PlayerChunkMap::PlayerChunk* PlayerChunkMap::getChunk(int x, int z, bool create) { - __int64 id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32); + int64_t id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32); AUTO_VAR(it, chunks.find(id)); PlayerChunk* chunk = NULL; @@ -447,6 +479,7 @@ PlayerChunkMap::PlayerChunk* PlayerChunkMap::getChunk(int x, int z, } else if (create) { chunk = new PlayerChunk(x, z, this); chunks[id] = chunk; + knownChunks.push_back(chunk); } return chunk; @@ -456,7 +489,7 @@ PlayerChunkMap::PlayerChunk* PlayerChunkMap::getChunk(int x, int z, // doesn't exist, queue a request for it to be created. void PlayerChunkMap::getChunkAndAddPlayer( int x, int z, std::shared_ptr player) { - __int64 id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32); + int64_t id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32); AUTO_VAR(it, chunks.find(id)); if (it != chunks.end()) { @@ -476,7 +509,7 @@ void PlayerChunkMap::getChunkAndRemovePlayer( return; } } - __int64 id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32); + int64_t id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32); AUTO_VAR(it, chunks.find(id)); if (it != chunks.end()) { @@ -510,7 +543,6 @@ void PlayerChunkMap::tickAddRequests(std::shared_ptr player) { if (itNearest != addRequests.end()) { getChunk(itNearest->x, itNearest->z, true)->add(itNearest->player); addRequests.erase(itNearest); - return; } } } @@ -582,6 +614,14 @@ void PlayerChunkMap::add(std::shared_ptr player) { minX = maxX = xc; minZ = maxZ = zc; + // 4J - added so that we don't fully create/send every chunk at this stage. + // Particularly since moving on to large worlds, where we can be adding 1024 + // chunks here of which a large % might need to be fully created, this can + // take a long time. Instead use the getChunkAndAddPlayer for anything but + // the central region of chunks, which adds them to a queue of chunks which + // are added one per tick per player. + const int maxLegSizeToAddNow = 14; + // All but the last leg for (int legSize = 1; legSize <= size * 2; legSize++) { for (int leg = 0; leg < 2; leg++) { @@ -594,12 +634,19 @@ void PlayerChunkMap::add(std::shared_ptr player) { int targetX, targetZ; targetX = xc + dx; targetZ = zc + dz; - if (targetX > maxX) maxX = targetX; - if (targetX < minX) minX = targetX; - if (targetZ > maxZ) maxZ = targetZ; - if (targetZ < minZ) minZ = targetZ; - getChunk(targetX, targetZ, true)->add(player, false); + if ((legSize < maxLegSizeToAddNow) || + ((legSize == maxLegSizeToAddNow) && + ((leg == 0) || (k < (legSize - 1))))) { + if (targetX > maxX) maxX = targetX; + if (targetX < minX) minX = targetX; + if (targetZ > maxZ) maxZ = targetZ; + if (targetZ < minZ) minZ = targetZ; + + getChunk(targetX, targetZ, true)->add(player, false); + } else { + getChunkAndAddPlayer(targetX, targetZ, player); + } } } } @@ -613,12 +660,16 @@ void PlayerChunkMap::add(std::shared_ptr player) { int targetX, targetZ; targetX = xc + dx; targetZ = zc + dz; - if (targetX > maxX) maxX = targetX; - if (targetX < minX) minX = targetX; - if (targetZ > maxZ) maxZ = targetZ; - if (targetZ < minZ) minZ = targetZ; + if ((size * 2) <= maxLegSizeToAddNow) { + if (targetX > maxX) maxX = targetX; + if (targetX < minX) minX = targetX; + if (targetZ > maxZ) maxZ = targetZ; + if (targetZ < minZ) minZ = targetZ; - getChunk(targetX, targetZ, true)->add(player, false); + getChunk(targetX, targetZ, true)->add(player, false); + } else { + getChunkAndAddPlayer(targetX, targetZ, player); + } } // CraftBukkit end @@ -753,4 +804,4 @@ void PlayerChunkMap::setRadius(int newRadius) { assert(radius >= MIN_VIEW_DISTANCE); this->radius = newRadius; } -} +} \ No newline at end of file diff --git a/Minecraft.Client/Network/PlayerChunkMap.h b/Minecraft.Client/Network/PlayerChunkMap.h index 61ace4de2..a0315897a 100644 --- a/Minecraft.Client/Network/PlayerChunkMap.h +++ b/Minecraft.Client/Network/PlayerChunkMap.h @@ -44,6 +44,7 @@ public: int zChangeMin, zChangeMax; int ticksToNextRegionUpdate; // 4J added bool prioritised; // 4J added + int64_t firstInhabitedTime; public: PlayerChunk(int x, int z, PlayerChunkMap* pcm); @@ -53,6 +54,12 @@ public: // one much smaller packet void add(std::shared_ptr player, bool sendPacket = true); void remove(std::shared_ptr player); + void updateInhabitedTime(); + + private: + void updateInhabitedTime(LevelChunk* chunk); + + public: void tileChanged(int x, int y, int z); void prioritiseTileChanges(); // 4J added void broadcast(std::shared_ptr packet); @@ -67,15 +74,17 @@ public: void flagEntitiesToBeRemoved(unsigned int* flags, bool* removedFound); // 4J added private: - std::unordered_map<__int64, PlayerChunk*, LongKeyHash, LongKeyEq> + std::unordered_map chunks; // 4J - was LongHashMap std::vector changedChunks; + std::vector knownChunks; std::vector addRequests; // 4J added void tickAddRequests(std::shared_ptr player); // 4J added ServerLevel* level; int radius; int dimension; + int64_t lastInhabitedUpdate; public: PlayerChunkMap(ServerLevel* level, int dimension, int radius); diff --git a/Minecraft.Client/Network/PlayerConnection.cpp b/Minecraft.Client/Network/PlayerConnection.cpp index bc6a1be76..0e5038d86 100644 --- a/Minecraft.Client/Network/PlayerConnection.cpp +++ b/Minecraft.Client/Network/PlayerConnection.cpp @@ -15,6 +15,7 @@ #include "../../Minecraft.World/Headers/net.minecraft.world.inventory.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.tile.entity.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.saveddata.h" +#include "../../Minecraft.World/Headers/net.minecraft.world.entity.animal.h" #include "../../Minecraft.World/Headers/net.minecraft.network.h" #include "../../Minecraft.World/Headers/net.minecraft.world.food.h" #include "../../Minecraft.World/Util/AABB.h" @@ -55,7 +56,7 @@ PlayerConnection::PlayerConnection(MinecraftServer* server, connection->setListener(this); this->player = player; // player->connection = this; // 4J - moved out as we can't - //assign in a ctor + // assign in a ctor InitializeCriticalSection(&done_cs); m_bCloseOnTick = false; @@ -95,9 +96,6 @@ void PlayerConnection::tick() { send(std::shared_ptr( new KeepAlivePacket(lastKeepAliveId))); } - // if (!didTick) { - // player->doTick(false); - // } if (chatSpamTickCount > 0) { chatSpamTickCount--; @@ -142,9 +140,8 @@ void PlayerConnection::disconnect(DisconnectPacket::eDisconnectReason reason) { void PlayerConnection::handlePlayerInput( std::shared_ptr packet) { - player->setPlayerInput(packet->getXa(), packet->getYa(), - packet->isJumping(), packet->isSneaking(), - packet->getXRot(), packet->getYRot()); + player->setPlayerInput(packet->getXxa(), packet->getYya(), + packet->isJumping(), packet->isSneaking()); } void PlayerConnection::handleMovePlayer( @@ -172,45 +169,27 @@ void PlayerConnection::handleMovePlayer( double xt = player->x; double yt = player->y; double zt = player->z; - double xxa = 0; - double zza = 0; + if (packet->hasRot) { yRotT = packet->yRot; xRotT = packet->xRot; } - if (packet->hasPos && packet->y == -999 && packet->yView == -999) { - // CraftBukkit start - if (abs(packet->x) > 1 || abs(packet->z) > 1) { - // System.err.println(player.name + " was caught trying to - // crash the server with an invalid position."); -#ifndef _CONTENT_PACKAGE - wprintf( - L"%ls was caught trying to crash the server with an " - L"invalid position.", - player->name.c_str()); -#endif - disconnect(DisconnectPacket:: - eDisconnect_IllegalPosition); //"Nope!"); - return; - } - // CraftBukkit end - xxa = packet->x; - zza = packet->z; - } player->onGround = packet->onGround; player->doTick(false); - player->move(xxa, 0, zza); + player->ySlideOffset = 0; player->absMoveTo(xt, yt, zt, yRotT, xRotT); - player->xd = xxa; - player->zd = zza; - if (player->riding != NULL) level->forceTick(player->riding, true); if (player->riding != NULL) player->riding->positionRider(); server->getPlayers()->move(player); - xLastOk = player->x; - yLastOk = player->y; - zLastOk = player->z; + + // player may have been kicked off the mount during the tick, so + // only copy valid coordinates if the player still is "synched" + if (synched) { + xLastOk = player->x; + yLastOk = player->y; + zLastOk = player->z; + } ((Level*)level)->tick(player); return; @@ -283,12 +262,12 @@ void PlayerConnection::handleMovePlayer( // 4J-PB - removing this one for now /*if (dist > 100.0f) { -// logger.warning(player->name + " moved too quickly!"); - disconnect(DisconnectPacket::eDisconnect_MovedTooQuickly); -// System.out.println("Moved too quickly at " + xt + ", " + yt + -", " + zt); -// teleport(player->x, player->y, player->z, player->yRot, -player->xRot); return; + // logger.warning(player->name + " moved too quickly!"); + disconnect(DisconnectPacket::eDisconnect_MovedTooQuickly); + // System.out.println("Moved too quickly at " + xt + ", " + + yt + ", " + zt); + // teleport(player->x, player->y, player->z, + player->yRot, player->xRot); return; } */ @@ -332,10 +311,10 @@ player->xRot); return; if (dist > 0.25 * 0.25 && !player->isSleeping() && !player->gameMode->isCreative() && !player->isAllowedToFly()) { fail = true; -// logger.warning(player->name + " moved wrongly!"); -// System.out.println("Got position " + xt + ", " + yt + ", " + zt); -// System.out.println("Expected " + player->x + ", " + player->y + ", -// " + player->z); + // logger.warning(player->name + " moved wrongly!"); + // System.out.println("Got position " + xt + ", " + yt + + // ", " + zt); System.out.println("Expected " + player->x + // + ", " + player->y + ", " + player->z); #ifndef _CONTENT_PACKAGE wprintf(L"%ls moved wrongly!\n", player->name.c_str()); app.DebugPrintf("Got position %f, %f, %f\n", xt, yt, zt); @@ -359,8 +338,8 @@ player->xRot); return; if (oyDist >= (-0.5f / 16.0f)) { aboveGroundTickCount++; if (aboveGroundTickCount > 80) { -// logger.warning(player->name + " was kicked for floating -// too long!"); + // logger.warning(player->name + " was + // kicked for floating too long!"); #ifndef _CONTENT_PACKAGE wprintf(L"%ls was kicked for floating too long!\n", player->name.c_str()); @@ -376,6 +355,8 @@ player->xRot); return; player->onGround = packet->onGround; server->getPlayers()->move(player); player->doCheckFallDamage(player->y - startY, packet->onGround); + } else if ((tickCount % SharedConstants::TICKS_PER_SECOND) == 0) { + teleport(xLastOk, yLastOk, zLastOk, player->yRot, player->xRot); } } @@ -399,21 +380,24 @@ void PlayerConnection::teleport(double x, double y, double z, float yRot, void PlayerConnection::handlePlayerAction( std::shared_ptr packet) { ServerLevel* level = server->getLevel(player->dimension); + player->resetLastActionTime(); if (packet->action == PlayerActionPacket::DROP_ITEM) { - player->drop(); + player->drop(false); + return; + } else if (packet->action == PlayerActionPacket::DROP_ALL_ITEMS) { + player->drop(true); return; } else if (packet->action == PlayerActionPacket::RELEASE_USE_ITEM) { player->releaseUsingItem(); return; } - // 4J Stu - We don't have ops, so just use the levels setting - bool canEditSpawn = - level->canEditSpawn; // = level->dimension->id != 0 || - // server->players->isOp(player->name); + bool shouldVerifyLocation = false; if (packet->action == PlayerActionPacket::START_DESTROY_BLOCK) shouldVerifyLocation = true; + if (packet->action == PlayerActionPacket::ABORT_DESTROY_BLOCK) + shouldVerifyLocation = true; if (packet->action == PlayerActionPacket::STOP_DESTROY_BLOCK) shouldVerifyLocation = true; @@ -434,14 +418,15 @@ void PlayerConnection::handlePlayerAction( return; } } - Pos* spawnPos = level->getSharedSpawnPos(); - int xd = (int)Mth::abs((float)(x - spawnPos->x)); - int zd = (int)Mth::abs((float)(z - spawnPos->z)); - delete spawnPos; - if (xd > zd) zd = xd; + if (packet->action == PlayerActionPacket::START_DESTROY_BLOCK) { - if (zd > 16 || canEditSpawn) - player->gameMode->startDestroyBlock(x, y, z, packet->face); + if (true) + player->gameMode->startDestroyBlock( + x, y, z, + packet->face); // 4J - condition was + // !server->isUnderSpawnProtection(level, + // x, y, z, player) (from Java 1.6.4) + // but putting back to old behaviour else player->connection->send(std::shared_ptr( new TileUpdatePacket(x, y, z, level))); @@ -461,19 +446,7 @@ void PlayerConnection::handlePlayerAction( if (level->getTile(x, y, z) != 0) player->connection->send(std::shared_ptr( new TileUpdatePacket(x, y, z, level))); - } else if (packet->action == PlayerActionPacket::GET_UPDATED_BLOCK) { - double xDist = player->x - (x + 0.5); - double yDist = player->y - (y + 0.5); - double zDist = player->z - (z + 0.5); - double dist = xDist * xDist + yDist * yDist + zDist * zDist; - if (dist < 16 * 16) { - player->connection->send(std::shared_ptr( - new TileUpdatePacket(x, y, z, level))); - } } - - // 4J Stu - Don't change the levels state - // level->canEditSpawn = false; } void PlayerConnection::handleUseItem(std::shared_ptr packet) { @@ -484,6 +457,7 @@ void PlayerConnection::handleUseItem(std::shared_ptr packet) { int y = packet->getY(); int z = packet->getZ(); int face = packet->getFace(); + player->resetLastActionTime(); // 4J Stu - We don't have ops, so just use the levels setting bool canEditSpawn = @@ -495,14 +469,13 @@ void PlayerConnection::handleUseItem(std::shared_ptr packet) { } else if ((packet->getY() < server->getMaxBuildHeight() - 1) || (packet->getFace() != Facing::UP && packet->getY() < server->getMaxBuildHeight())) { - Pos* spawnPos = level->getSharedSpawnPos(); - int xd = (int)Mth::abs((float)(x - spawnPos->x)); - int zd = (int)Mth::abs((float)(z - spawnPos->z)); - delete spawnPos; - if (xd > zd) zd = xd; if (synched && player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) < 8 * 8) { - if (zd > 16 || canEditSpawn) { + if (true) // 4J - condition was + // !server->isUnderSpawnProtection(level, x, y, z, + // player) (from java 1.6.4) but putting back to old + // behaviour + { player->gameMode->useItemOn( player, level, item, x, y, z, face, packet->getClickX(), packet->getClickY(), packet->getClickZ()); @@ -511,7 +484,7 @@ void PlayerConnection::handleUseItem(std::shared_ptr packet) { informClient = true; } else { - // player->connection->send(std::shared_ptr(new + // player->connection->send(shared_ptr(new // ChatPacket("\u00A77Height limit for building is " + // server->maxBuildHeight))); informClient = true; @@ -546,6 +519,11 @@ void PlayerConnection::handleUseItem(std::shared_ptr packet) { } item = player->inventory->getSelected(); + + bool forceClientUpdate = false; + if (item != NULL && packet->getItem() == NULL) { + forceClientUpdate = true; + } if (item != NULL && item->count == 0) { player->inventory->items[player->inventory->selected] = nullptr; item = nullptr; @@ -561,7 +539,8 @@ void PlayerConnection::handleUseItem(std::shared_ptr packet) { player->containerMenu->broadcastChanges(); player->ignoreSlotUpdateHack = false; - if (!ItemInstance::matches(player->inventory->getSelected(), + if (forceClientUpdate || + !ItemInstance::matches(player->inventory->getSelected(), packet->getItem())) { send(std::shared_ptr( new ContainerSetSlotPacket(player->containerMenu->containerId, @@ -569,9 +548,6 @@ void PlayerConnection::handleUseItem(std::shared_ptr packet) { player->inventory->getSelected()))); } } - - // 4J Stu - Don't change the levels state - // level->canEditSpawn = false; } void PlayerConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, @@ -641,6 +617,7 @@ void PlayerConnection::handleSetCarriedItem( return; } player->inventory->selected = packet->slot; + player->resetLastActionTime(); } void PlayerConnection::handleChat(std::shared_ptr packet) { @@ -686,6 +663,7 @@ void PlayerConnection::handleCommand(const std::wstring& message) { } void PlayerConnection::handleAnimate(std::shared_ptr packet) { + player->resetLastActionTime(); if (packet->action == AnimatePacket::SWING) { player->swing(); } @@ -693,6 +671,7 @@ void PlayerConnection::handleAnimate(std::shared_ptr packet) { void PlayerConnection::handlePlayerCommand( std::shared_ptr packet) { + player->resetLastActionTime(); if (packet->action == PlayerCommandPacket::START_SNEAKING) { player->setSneaking(true); } else if (packet->action == PlayerCommandPacket::STOP_SNEAKING) { @@ -704,6 +683,20 @@ void PlayerConnection::handlePlayerCommand( } else if (packet->action == PlayerCommandPacket::STOP_SLEEPING) { player->stopSleepInBed(false, true, true); synched = false; + } else if (packet->action == PlayerCommandPacket::RIDING_JUMP) { + // currently only supported by horses... + if ((player->riding != NULL) && + player->riding->GetType() == eTYPE_HORSE) { + std::dynamic_pointer_cast(player->riding) + ->onPlayerJump(packet->data); + } + } else if (packet->action == PlayerCommandPacket::OPEN_INVENTORY) { + // also only supported by horses... + if ((player->riding != NULL) && + player->riding->instanceof(eTYPE_HORSE)) { + std::dynamic_pointer_cast(player->riding) + ->openInventory(player); + } } else if (packet->action == PlayerCommandPacket::START_IDLEANIM) { player->setIsIdle(true); } else if (packet->action == PlayerCommandPacket::STOP_IDLEANIM) { @@ -737,11 +730,12 @@ void PlayerConnection::warn(const std::wstring& string) { // send( std::shared_ptr( new ChatPacket(L"§9" + string) ) ); } -std::wstring PlayerConnection::getConsoleName() { return player->name; } +std::wstring PlayerConnection::getConsoleName() { return player->getName(); } void PlayerConnection::handleInteract(std::shared_ptr packet) { ServerLevel* level = server->getLevel(player->dimension); std::shared_ptr target = level->getEntity(packet->target); + player->resetLastActionTime(); // Fix for #8218 - Gameplay: Attacking zombies from a different level often // results in no hits being registered 4J Stu - If the client says that we @@ -763,6 +757,14 @@ void PlayerConnection::handleInteract(std::shared_ptr packet) { if (packet->action == InteractPacket::INTERACT) { player->interact(target); } else if (packet->action == InteractPacket::ATTACK) { + if ((target->GetType() == eTYPE_ITEMENTITY) || + (target->GetType() == eTYPE_EXPERIENCEORB) || + (target->GetType() == eTYPE_ARROW) || target == player) { + // disconnect("Attempting to attack an invalid entity"); + // server.warn("Player " + player.getName() + " tried to attack + // an invalid entity"); + return; + } player->attack(target); } //} @@ -1033,6 +1035,33 @@ void PlayerConnection::handleServerSettingsChanged( app.SetGameHostOption( eGameHostOption_TNT, app.GetGameHostOption(packet->data, eGameHostOption_TNT)); + app.SetGameHostOption( + eGameHostOption_MobGriefing, + app.GetGameHostOption(packet->data, + eGameHostOption_MobGriefing)); + app.SetGameHostOption( + eGameHostOption_KeepInventory, + app.GetGameHostOption(packet->data, + eGameHostOption_KeepInventory)); + app.SetGameHostOption( + eGameHostOption_DoMobSpawning, + app.GetGameHostOption(packet->data, + eGameHostOption_DoMobSpawning)); + app.SetGameHostOption( + eGameHostOption_DoMobLoot, + app.GetGameHostOption(packet->data, eGameHostOption_DoMobLoot)); + app.SetGameHostOption( + eGameHostOption_DoTileDrops, + app.GetGameHostOption(packet->data, + eGameHostOption_DoTileDrops)); + app.SetGameHostOption( + eGameHostOption_DoDaylightCycle, + app.GetGameHostOption(packet->data, + eGameHostOption_DoDaylightCycle)); + app.SetGameHostOption( + eGameHostOption_NaturalRegeneration, + app.GetGameHostOption(packet->data, + eGameHostOption_NaturalRegeneration)); server->getPlayers()->broadcastAll( std::shared_ptr( @@ -1063,6 +1092,7 @@ void PlayerConnection::handleGameCommand( void PlayerConnection::handleClientCommand( std::shared_ptr packet) { + player->resetLastActionTime(); if (packet->action == ClientCommandPacket::PERFORM_RESPAWN) { if (player->wonGame) { player = server->getPlayers()->respawn( @@ -1072,10 +1102,10 @@ void PlayerConnection::handleClientCommand( // else if (player.getLevel().getLevelData().isHardcore()) //{ // if (server.isSingleplayer() && - //player.name.equals(server.getSingleplayerName())) + // player.name.equals(server.getSingleplayerName())) // { // player.connection.disconnect("You have died. Game over, - //man, it's game over!"); server.selfDestruct(); + // man, it's game over!"); server.selfDestruct(); // } // else // { @@ -1084,7 +1114,7 @@ void PlayerConnection::handleClientCommand( // server.getPlayers().getBans().add(ban); // player.connection.disconnect("You have died. Game over, - //man, it's game over!"); + // man, it's game over!"); // } //} else { @@ -1135,13 +1165,11 @@ void PlayerConnection::handleContainerSetSlot( void PlayerConnection::handleContainerClick( std::shared_ptr packet) { + player->resetLastActionTime(); if (player->containerMenu->containerId == packet->containerId && player->containerMenu->isSynched(player)) { std::shared_ptr clicked = player->containerMenu->clicked( - packet->slotNum, packet->buttonNum, - packet->quickKey ? AbstractContainerMenu::CLICK_QUICK_MOVE - : AbstractContainerMenu::CLICK_PICKUP, - player); + packet->slotNum, packet->buttonNum, packet->clickType, player); if (ItemInstance::matches(packet->item, clicked)) { // Yep, you sure did click what you claimed to click! @@ -1161,9 +1189,9 @@ void PlayerConnection::handleContainerClick( player->containerMenu->setSynched(player, false); std::vector > items; - for (unsigned int i = 0; i < player->containerMenu->slots->size(); + for (unsigned int i = 0; i < player->containerMenu->slots.size(); i++) { - items.push_back(player->containerMenu->slots->at(i)->getItem()); + items.push_back(player->containerMenu->slots.at(i)->getItem()); } player->refreshContainer(player->containerMenu, &items); @@ -1174,6 +1202,7 @@ void PlayerConnection::handleContainerClick( void PlayerConnection::handleContainerButtonClick( std::shared_ptr packet) { + player->resetLastActionTime(); if (player->containerMenu->containerId == packet->containerId && player->containerMenu->isSynched(player)) { player->containerMenu->clickMenuButton(player, packet->buttonId); @@ -1261,9 +1290,9 @@ void PlayerConnection::handleSetCreativeModeSlot( // as the client also incorrectly predicts the auxvalue of the // mapItem std::vector > items; - for (unsigned int i = 0; i < player->inventoryMenu->slots->size(); + for (unsigned int i = 0; i < player->inventoryMenu->slots.size(); i++) { - items.push_back(player->inventoryMenu->slots->at(i)->getItem()); + items.push_back(player->inventoryMenu->slots.at(i)->getItem()); } player->refreshContainer(player->inventoryMenu, &items); } @@ -1283,6 +1312,7 @@ void PlayerConnection::handleContainerAck( void PlayerConnection::handleSignUpdate( std::shared_ptr packet) { + player->resetLastActionTime(); app.DebugPrintf("PlayerConnection::handleSignUpdate\n"); ServerLevel* level = server->getLevel(player->dimension); @@ -1293,8 +1323,8 @@ void PlayerConnection::handleSignUpdate( if (std::dynamic_pointer_cast(te) != NULL) { std::shared_ptr ste = std::dynamic_pointer_cast(te); - if (!ste->isEditable()) { - server->warn(L"Player " + player->name + + if (!ste->isEditable() || ste->getPlayerWhoMayEdit() != player) { + server->warn(L"Player " + player->getName() + L" just tried to change non-editable sign"); return; } @@ -1552,7 +1582,7 @@ void PlayerConnection::handleCustomPayload( ItemInstance carried = player.inventory.getSelected(); if (sentItem != null && sentItem.id == Item.writingBook.id && sentItem.id == carried.id) { - carried.setTag(sentItem.getTag()); + carried.addTagElement(WrittenBookItem.TAG_PAGES, sentItem.getTag().getList(WrittenBookItem.TAG_PAGES)); } } else if (CustomPayloadPacket.CUSTOM_BOOK_SIGN_PACKET.equals(customPayloadPacket.identifier)) @@ -1569,7 +1599,9 @@ void PlayerConnection::handleCustomPayload( ItemInstance carried = player.inventory.getSelected(); if (sentItem != null && sentItem.id == Item.writtenBook.id && carried.id == Item.writingBook.id) { - carried.setTag(sentItem.getTag()); + carried.addTagElement(WrittenBookItem.TAG_AUTHOR, new StringTag(WrittenBookItem.TAG_AUTHOR, player.getName())); + carried.addTagElement(WrittenBookItem.TAG_TITLE, new StringTag(WrittenBookItem.TAG_TITLE, sentItem.getTag().getString(WrittenBookItem.TAG_TITLE))); + carried.addTagElement(WrittenBookItem.TAG_PAGES, sentItem.getTag().getList(WrittenBookItem.TAG_PAGES)); carried.id = Item.writtenBook.id; } } @@ -1585,9 +1617,55 @@ void PlayerConnection::handleCustomPayload( if (dynamic_cast(menu)) { ((MerchantMenu*)menu)->setSelectionHint(selection); } + } else if (CustomPayloadPacket::SET_ADVENTURE_COMMAND_PACKET.compare( + customPayloadPacket->identifier) == 0) { + if (!server->isCommandBlockEnabled()) { + app.DebugPrintf("Command blocks not enabled"); + // player->sendMessage(ChatMessageComponent.forTranslation("advMode.notEnabled")); + } else if (player->hasPermission(eGameCommand_Effect) && + player->abilities.instabuild) { + ByteArrayInputStream bais(customPayloadPacket->data); + DataInputStream input(&bais); + int x = input.readInt(); + int y = input.readInt(); + int z = input.readInt(); + std::wstring command = Packet::readUtf(&input, 256); + + std::shared_ptr tileEntity = + player->level->getTileEntity(x, y, z); + std::shared_ptr cbe = + std::dynamic_pointer_cast(tileEntity); + if (tileEntity != NULL && cbe != NULL) { + cbe->setCommand(command); + player->level->sendTileUpdated(x, y, z); + // player->sendMessage(ChatMessageComponent.forTranslation("advMode.setCommand.success", + // command)); + } + } else { + // player.sendMessage(ChatMessageComponent.forTranslation("advMode.notAllowed")); + } + } else if (CustomPayloadPacket::SET_BEACON_PACKET.compare( + customPayloadPacket->identifier) == 0) { + if (dynamic_cast(player->containerMenu) != NULL) { + ByteArrayInputStream bais(customPayloadPacket->data); + DataInputStream input(&bais); + int primary = input.readInt(); + int secondary = input.readInt(); + + BeaconMenu* beaconMenu = (BeaconMenu*)player->containerMenu; + Slot* slot = beaconMenu->getSlot(0); + if (slot->hasItem()) { + slot->remove(1); + std::shared_ptr beacon = + beaconMenu->getBeacon(); + beacon->setPrimaryPower(primary); + beacon->setSecondaryPower(secondary); + beacon->setChanged(); + } + } } else if (CustomPayloadPacket::SET_ITEM_NAME_PACKET.compare( customPayloadPacket->identifier) == 0) { - RepairMenu* menu = dynamic_cast(player->containerMenu); + AnvilMenu* menu = dynamic_cast(player->containerMenu); if (menu) { if (customPayloadPacket->data.data == NULL || customPayloadPacket->data.length < 1) { @@ -1604,6 +1682,8 @@ void PlayerConnection::handleCustomPayload( } } +bool PlayerConnection::isDisconnected() { return done; } + // 4J Added void PlayerConnection::handleDebugOptions( @@ -1634,6 +1714,10 @@ void PlayerConnection::handleCraftItem( // no room in inventory, so throw it down player->drop(pTempItemInst); } + } else if (pTempItemInst->id == Item::fireworksCharge_Id || + pTempItemInst->id == Item::fireworks_Id) { + CraftingMenu* menu = (CraftingMenu*)player->containerMenu; + player->openFireworks(menu->getX(), menu->getY(), menu->getZ()); } else { // TODO 4J Stu - Assume at the moment that the client can work this out // for us... @@ -1692,9 +1776,9 @@ void PlayerConnection::handleCraftItem( // as the client also incorrectly predicts the auxvalue of the // mapItem std::vector > items; - for (unsigned int i = 0; i < player->containerMenu->slots->size(); + for (unsigned int i = 0; i < player->containerMenu->slots.size(); i++) { - items.push_back(player->containerMenu->slots->at(i)->getItem()); + items.push_back(player->containerMenu->slots.at(i)->getItem()); } player->refreshContainer(player->containerMenu, &items); } else { diff --git a/Minecraft.Client/Network/PlayerConnection.h b/Minecraft.Client/Network/PlayerConnection.h index 16c0e90dc..cdc5f4e9f 100644 --- a/Minecraft.Client/Network/PlayerConnection.h +++ b/Minecraft.Client/Network/PlayerConnection.h @@ -28,9 +28,9 @@ private: bool didTick; int lastKeepAliveId; - __int64 lastKeepAliveTime; + int64_t lastKeepAliveTime; static Random random; - __int64 lastKeepAliveTick; + int64_t lastKeepAliveTick; int chatSpamTickCount; int dropSpamTickCount; @@ -108,6 +108,7 @@ public: std::shared_ptr playerAbilitiesPacket); virtual void handleCustomPayload( std::shared_ptr customPayloadPacket); + virtual bool isDisconnected(); // 4J Added virtual void handleCraftItem(std::shared_ptr packet); @@ -156,4 +157,4 @@ private: std::vector m_texturesRequested; bool m_bWasKicked; -}; +}; \ No newline at end of file diff --git a/Minecraft.Client/Network/PlayerList.cpp b/Minecraft.Client/Network/PlayerList.cpp index 9f32610d8..c3286234c 100644 --- a/Minecraft.Client/Network/PlayerList.cpp +++ b/Minecraft.Client/Network/PlayerList.cpp @@ -25,6 +25,7 @@ #include "../../Minecraft.World/Headers/net.minecraft.world.level.storage.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.saveddata.h" #include "../../Minecraft.World/Util/JavaMath.h" +#include "../../Minecraft.World/Level/Storage/EntityIO.h" #ifdef _XBOX #include "../Platform/Xbox/Network/NetworkPlayerXbox.h" #elif defined(__PS3__) || defined(__ORBIS__) @@ -76,7 +77,10 @@ PlayerList::~PlayerList() { void PlayerList::placeNewPlayer(Connection* connection, std::shared_ptr player, std::shared_ptr packet) { - bool newPlayer = load(player); + CompoundTag* playerTag = load(player); + + bool newPlayer = playerTag == NULL; + player->setLevel(server->getLevel(player->dimension)); player->gameMode->setLevel((ServerLevel*)player->level); @@ -240,19 +244,22 @@ void PlayerList::placeNewPlayer(Connection* connection, playerConnection->send(std::shared_ptr(new LoginPacket( L"", player->entityId, level->getLevelData()->getGenerator(), level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(), - (std::uint8_t)level->dimension->id, - (std::uint8_t)level->getMaxBuildHeight(), (std::uint8_t)getMaxPlayers(), - level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), - playerIndex, level->useNewSeaLevel(), - player->getAllPlayerGamePrivileges(), + (uint8_t)level->dimension->id, (uint8_t)level->getMaxBuildHeight(), + (uint8_t)getMaxPlayers(), level->difficulty, + TelemetryManager->GetMultiplayerInstanceID(), (BYTE)playerIndex, + level->useNewSeaLevel(), player->getAllPlayerGamePrivileges(), level->getLevelData()->getXZSize(), level->getLevelData()->getHellScale()))); playerConnection->send(std::shared_ptr( new SetSpawnPositionPacket(spawnPos->x, spawnPos->y, spawnPos->z))); playerConnection->send(std::shared_ptr( new PlayerAbilitiesPacket(&player->abilities))); + playerConnection->send(std::shared_ptr( + new SetCarriedItemPacket(player->inventory->selected))); delete spawnPos; + updateEntireScoreboard((ServerScoreboard*)level->getScoreboard(), player); + sendLevelInfo(player, level); // 4J-PB - removed, since it needs to be localised in the language the @@ -274,8 +281,9 @@ void PlayerList::placeNewPlayer(Connection* connection, player->xRot); server->getConnection()->addPlayerConnection(playerConnection); - playerConnection->send( - std::shared_ptr(new SetTimePacket(level->getTime()))); + playerConnection->send(std::shared_ptr(new SetTimePacket( + level->getGameTime(), level->getDayTime(), + level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)))); AUTO_VAR(activeEffects, player->getActiveEffects()); for (AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); @@ -287,6 +295,18 @@ void PlayerList::placeNewPlayer(Connection* connection, player->initMenu(); + if (playerTag != NULL && playerTag->contains(Entity::RIDING_TAG)) { + // this player has been saved with a mount tag + std::shared_ptr mount = EntityIO::loadStatic( + playerTag->getCompound(Entity::RIDING_TAG), level); + if (mount != NULL) { + mount->forcedLoading = true; + level->addEntity(mount); + player->ride(mount); + mount->forcedLoading = false; + } + } + // If we are joining at the same time as someone in the end on this system // is travelling through the win portal, then we should set our wonGame flag // to true so that respawning works when the EndPoem is closed @@ -305,6 +325,35 @@ void PlayerList::placeNewPlayer(Connection* connection, } } +void PlayerList::updateEntireScoreboard(ServerScoreboard* scoreboard, + std::shared_ptr player) { + // unordered_set objectives; + + // for (PlayerTeam team : scoreboard->getPlayerTeams()) + //{ + // player->connection->send( shared_ptr(new + // SetPlayerTeamPacket(team, SetPlayerTeamPacket::METHOD_ADD))); + // } + + // for (int slot = 0; slot < Scoreboard::DISPLAY_SLOTS; slot++) + //{ + // Objective objective = scoreboard->getDisplayObjective(slot); + + // if (objective != NULL && !objectives->contains(objective)) + // { + // vector > *packets = + // scoreboard->getStartTrackingPackets(objective); + + // for (Packet packet : packets) + // { + // player->connection->send(packet); + // } + + // objectives->add(objective); + // } + //} +} + void PlayerList::setLevel(ServerLevelArray levels) { playerIo = levels[0]->getLevelStorage()->getPlayerIO(); } @@ -323,8 +372,7 @@ int PlayerList::getMaxRange() { return PlayerChunkMap::convertChunkRangeToBlock(getViewDistance()); } -// 4J Changed return val to bool to check if new player or loaded player -bool PlayerList::load(std::shared_ptr player) { +CompoundTag* PlayerList::load(std::shared_ptr player) { return playerIo->load(player); } @@ -346,6 +394,8 @@ void PlayerList::validatePlayerSpawnPosition( app.DebugPrintf("Original pos is %f, %f, %f in dimension %d\n", player->x, player->y, player->z, player->dimension); + bool spawnForced = player->isRespawnForced(); + double targetX = 0; if (player->x < 0) targetX = Mth::ceil(player->x) - 0.5; @@ -397,12 +447,12 @@ void PlayerList::validatePlayerSpawnPosition( Pos* bedPosition = player->getRespawnPosition(); if (bedPosition != NULL) { Pos* respawnPosition = Player::checkBedValidRespawnPosition( - server->getLevel(player->dimension), bedPosition); + server->getLevel(player->dimension), bedPosition, spawnForced); if (respawnPosition != NULL) { player->moveTo(respawnPosition->x + 0.5f, respawnPosition->y + 0.1f, respawnPosition->z + 0.5f, 0, 0); - player->setRespawnPosition(bedPosition); + player->setRespawnPosition(bedPosition, spawnForced); } delete bedPosition; } @@ -480,6 +530,13 @@ void PlayerList::remove(std::shared_ptr player) { // sure that the player is gone delete the map if (player->isGuest()) playerIo->deleteMapFilesForPlayer(player); ServerLevel* level = player->getLevel(); + if (player->riding != NULL) { + // remove mount first because the player unmounts when being + // removed, also remove mount because it's saved in the player's + // save tag + level->removeEntityImmediately(player->riding); + app.DebugPrintf("removing player mount"); + } level->removeEntity(player); level->getChunkMap()->remove(player); AUTO_VAR(it, find(players.begin(), players.end(), player)); @@ -601,6 +658,7 @@ std::shared_ptr PlayerList::respawn( ->removeEntityImmediately(serverPlayer); Pos* bedPosition = serverPlayer->getRespawnPosition(); + bool spawnForced = serverPlayer->isRespawnForced(); removePlayerFromReceiving(serverPlayer); serverPlayer->dimension = targetDimension; @@ -613,9 +671,10 @@ std::shared_ptr PlayerList::respawn( std::shared_ptr player = std::shared_ptr( new ServerPlayer(server, server->getLevel(serverPlayer->dimension), - serverPlayer->name, + serverPlayer->getName(), new ServerPlayerGameMode( server->getLevel(serverPlayer->dimension)))); + player->connection = serverPlayer->connection; player->restoreFrom(serverPlayer, keepAllPlayerData); if (keepAllPlayerData) { // Fix for #81759 - TU9: Content: Gameplay: Entering The End Exit Portal @@ -633,7 +692,6 @@ std::shared_ptr PlayerList::respawn( // packet // player->entityId = serverPlayer->entityId; - player->connection = serverPlayer->connection; player->setPlayerDefaultSkin(skin); player->setIsGuest(serverPlayer->isGuest()); player->setPlayerIndex(playerIndex); @@ -665,7 +723,7 @@ std::shared_ptr PlayerList::respawn( player->moveTo(serverPlayer->x, serverPlayer->y, serverPlayer->z, serverPlayer->yRot, serverPlayer->xRot); if (bedPosition != NULL) { - player->setRespawnPosition(bedPosition); + player->setRespawnPosition(bedPosition, spawnForced); delete bedPosition; } // Fix for #81759 - TU9: Content: Gameplay: Entering The End Exit Portal @@ -674,11 +732,12 @@ std::shared_ptr PlayerList::respawn( player->inventory->selected = serverPlayer->inventory->selected; } else if (bedPosition != NULL) { Pos* respawnPosition = Player::checkBedValidRespawnPosition( - server->getLevel(serverPlayer->dimension), bedPosition); + server->getLevel(serverPlayer->dimension), bedPosition, + spawnForced); if (respawnPosition != NULL) { player->moveTo(respawnPosition->x + 0.5f, respawnPosition->y + 0.1f, respawnPosition->z + 0.5f, 0, 0); - player->setRespawnPosition(bedPosition); + player->setRespawnPosition(bedPosition, spawnForced); } else { player->connection->send( std::shared_ptr(new GameEventPacket( @@ -703,6 +762,10 @@ std::shared_ptr PlayerList::respawn( level->getLevelData()->getHellScale()))); player->connection->teleport(player->x, player->y, player->z, player->yRot, player->xRot); + player->connection->send( + std::shared_ptr(new SetExperiencePacket( + player->experienceProgress, player->totalExperience, + player->experienceLevel))); if (keepAllPlayerData) { std::vector* activeEffects = @@ -725,6 +788,7 @@ std::shared_ptr PlayerList::respawn( players.push_back(player); player->initMenu(); + player->setHealth(player->getHealth()); // 4J-JEV - Dying before this point in the tutorial is pretty annoying, // making sure to remove health/hunger and give you back your meat. @@ -772,9 +836,9 @@ void PlayerList::toggleDimension(std::shared_ptr player, // (1) if this isn't the primary player, then we just need to remove it from // the entity tracker (2) if this Is the primary player then: // (a) if isEmptying is true, then remove the player from the - //tracker, and send "remove entity" packets for anything seen (this is the - //original behaviour of the code) (b) if isEmptying is false, then we'll be - //transferring control of entity tracking to another player + // tracker, and send "remove entity" packets for anything seen (this is the + // original behaviour of the code) (b) if isEmptying is false, then + // we'll be transferring control of entity tracking to another player if (isPrimary) { if (isEmptying) { @@ -824,58 +888,7 @@ void PlayerList::toggleDimension(std::shared_ptr player, oldLevel->removeEntityImmediately(player); player->removed = false; - double xt = player->x; - double zt = player->z; - double scale = - newLevel->getLevelData() - ->getHellScale(); // 4J Scale was 8 but this is all we can fit in - if (player->dimension == -1) { - xt /= scale; - zt /= scale; - player->moveTo(xt, player->y, zt, player->yRot, player->xRot); - if (player->isAlive()) { - oldLevel->tick(player, false); - } - } else if (player->dimension == 0) { - xt *= scale; - zt *= scale; - player->moveTo(xt, player->y, zt, player->yRot, player->xRot); - if (player->isAlive()) { - oldLevel->tick(player, false); - } - } else { - Pos* p = newLevel->getDimensionSpecificSpawn(); - - xt = p->x; - player->y = p->y; - zt = p->z; - delete p; - player->moveTo(xt, player->y, zt, 90, 0); - if (player->isAlive()) { - oldLevel->tick(player, false); - } - } - - removePlayerFromReceiving(player, false, lastDimension); - addPlayerToReceiving(player); - - if (lastDimension == 1) { - } else { - xt = (double)Mth::clamp((int)xt, -Level::MAX_LEVEL_SIZE + 128, - Level::MAX_LEVEL_SIZE - 128); - zt = (double)Mth::clamp((int)zt, -Level::MAX_LEVEL_SIZE + 128, - Level::MAX_LEVEL_SIZE - 128); - if (player->isAlive()) { - newLevel->addEntity(player); - player->moveTo(xt, player->y, zt, player->yRot, player->xRot); - newLevel->tick(player, false); - newLevel->cache->autoCreate = true; - (new PortalForcer())->force(newLevel, player); - newLevel->cache->autoCreate = false; - } - } - - player->setLevel(newLevel); + repositionAcrossDimension(player, lastDimension, oldLevel, newLevel); changeDimension(player, oldLevel); player->gameMode->setLevel(newLevel); @@ -912,6 +925,80 @@ void PlayerList::toggleDimension(std::shared_ptr player, sendAllPlayerInfo(player); } +void PlayerList::repositionAcrossDimension(std::shared_ptr entity, + int lastDimension, + ServerLevel* oldLevel, + ServerLevel* newLevel) { + double xt = entity->x; + double zt = entity->z; + double xOriginal = entity->x; + double yOriginal = entity->y; + double zOriginal = entity->z; + float yRotOriginal = entity->yRot; + double scale = + newLevel->getLevelData() + ->getHellScale(); // 4J Scale was 8 but this is all we can fit in + if (entity->dimension == -1) { + xt /= scale; + zt /= scale; + entity->moveTo(xt, entity->y, zt, entity->yRot, entity->xRot); + if (entity->isAlive()) { + oldLevel->tick(entity, false); + } + } else if (entity->dimension == 0) { + xt *= scale; + zt *= scale; + entity->moveTo(xt, entity->y, zt, entity->yRot, entity->xRot); + if (entity->isAlive()) { + oldLevel->tick(entity, false); + } + } else { + Pos* p; + + if (lastDimension == 1) { + // Coming from the end + p = newLevel->getSharedSpawnPos(); + } else { + // Going to the end + p = newLevel->getDimensionSpecificSpawn(); + } + + xt = p->x; + entity->y = p->y; + zt = p->z; + delete p; + entity->moveTo(xt, entity->y, zt, 90, 0); + if (entity->isAlive()) { + oldLevel->tick(entity, false); + } + } + + if (entity->GetType() == eTYPE_SERVERPLAYER) { + std::shared_ptr player = + std::dynamic_pointer_cast(entity); + removePlayerFromReceiving(player, false, lastDimension); + addPlayerToReceiving(player); + } + + 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); + if (entity->isAlive()) { + newLevel->addEntity(entity); + entity->moveTo(xt, entity->y, zt, entity->yRot, entity->xRot); + newLevel->tick(entity, false); + newLevel->cache->autoCreate = true; + newLevel->getPortalForcer()->force(entity, xOriginal, yOriginal, + zOriginal, yRotOriginal); + newLevel->cache->autoCreate = false; + } + } + + entity->setLevel(newLevel); +} + void PlayerList::tick() { // 4J - brought changes to how often this is sent forward from 1.2.3 if (++sendAllPlayerInfoIn > SEND_PLAYER_INFO_INTERVAL) { @@ -1095,6 +1182,121 @@ std::shared_ptr PlayerList::getPlayer(PlayerUID uid) { return nullptr; } +std::shared_ptr PlayerList::getNearestPlayer(Pos* position, + int range) { + if (players.empty()) return nullptr; + if (position == NULL) return players.at(0); + std::shared_ptr current = nullptr; + double dist = -1; + int rangeSqr = range * range; + + for (int i = 0; i < players.size(); i++) { + std::shared_ptr next = players.at(i); + double newDist = + position->distSqr(next->getCommandSenderWorldPosition()); + + if ((dist == -1 || newDist < dist) && + (range <= 0 || newDist <= rangeSqr)) { + dist = newDist; + current = next; + } + } + + return current; +} + +std::vector* PlayerList::getPlayers( + Pos* position, int rangeMin, int rangeMax, int count, int mode, + int levelMin, int levelMax, + std::unordered_map* scoreRequirements, + const std::wstring& playerName, const std::wstring& teamName, + Level* level) { + app.DebugPrintf("getPlayers NOT IMPLEMENTED!"); + return NULL; + + /*if (players.empty()) return NULL; + vector > result = new + vector >(); bool reverse = count < 0; bool + playerNameNot = !playerName.empty() && playerName.startsWith("!"); bool + teamNameNot = !teamName.empty() && teamName.startsWith("!"); int rangeMinSqr + = rangeMin * rangeMin; int rangeMaxSqr = rangeMax * rangeMax; count = + Mth.abs(count); + + if (playerNameNot) playerName = playerName.substring(1); + if (teamNameNot) teamName = teamName.substring(1); + + for (int i = 0; i < players.size(); i++) { + ServerPlayer player = players.get(i); + + if (level != null && player.level != level) continue; + if (playerName != null) { + if (playerNameNot == playerName.equalsIgnoreCase(player.getAName())) + continue; + } + if (teamName != null) { + Team team = player.getTeam(); + String actualName = team == null ? "" : team.getName(); + if (teamNameNot == teamName.equalsIgnoreCase(actualName)) continue; + } + + if (position != null && (rangeMin > 0 || rangeMax > 0)) { + float distance = position.distSqr(player.getCommandSenderWorldPosition()); + if (rangeMin > 0 && distance < rangeMinSqr) continue; + if (rangeMax > 0 && distance > rangeMaxSqr) continue; + } + + if (!meetsScoreRequirements(player, scoreRequirements)) continue; + + if (mode != GameType.NOT_SET.getId() && mode != + player.gameMode.getGameModeForPlayer().getId()) continue; if (levelMin > 0 + && player.experienceLevel < levelMin) continue; if (player.experienceLevel > + levelMax) continue; + + result.add(player); + } + + if (position != null) Collections.sort(result, new + PlayerDistanceComparator(position)); if (reverse) + Collections.reverse(result); if (count > 0) result = result.subList(0, + Math.min(count, result.size())); + + return result;*/ +} + +bool PlayerList::meetsScoreRequirements( + std::shared_ptr player, + std::unordered_map scoreRequirements) { + app.DebugPrintf("meetsScoreRequirements NOT IMPLEMENTED!"); + return false; + + // if (scoreRequirements == null || scoreRequirements.size() == 0) return + // true; + + // for (Map.Entry requirement : + // scoreRequirements.entrySet()) { String name = requirement.getKey(); + // boolean min = false; + + // if (name.endsWith("_min") && name.length() > 4) { + // min = true; + // name = name.substring(0, name.length() - 4); + // } + + // Scoreboard scoreboard = player.getScoreboard(); + // Objective objective = scoreboard.getObjective(name); + // if (objective == null) return false; + // Score score = player.getScoreboard().getPlayerScore(player.getAName(), + // objective); int value = score.getScore(); + + // if (value < requirement.getValue() && min) { + // return false; + // } else if (value > requirement.getValue() && !min) { + // return false; + // } + //} + + // return true; +} + void PlayerList::sendMessage(const std::wstring& name, const std::wstring& message) { std::shared_ptr player = getPlayer(name); @@ -1168,27 +1370,6 @@ void PlayerList::broadcast(std::shared_ptr except, double x, double y, } } -void PlayerList::broadcastToAllOps(const std::wstring& message) { - std::shared_ptr chatPacket = - std::shared_ptr(new ChatPacket(message)); - for (unsigned int i = 0; i < players.size(); i++) { - std::shared_ptr p = players[i]; - if (isOp(p->name)) { - p->connection->send(chatPacket); - } - } -} - -bool PlayerList::sendTo(const std::wstring& name, - std::shared_ptr packet) { - std::shared_ptr player = getPlayer(name); - if (player != NULL) { - player->connection->send(packet); - return true; - } - return false; -} - void PlayerList::saveAll(ProgressListener* progressListener, bool bDeleteGuestMaps /*= false*/) { if (progressListener != NULL) @@ -1222,8 +1403,9 @@ void PlayerList::reloadWhitelist() {} void PlayerList::sendLevelInfo(std::shared_ptr player, ServerLevel* level) { - player->connection->send( - std::shared_ptr(new SetTimePacket(level->getTime()))); + player->connection->send(std::shared_ptr(new SetTimePacket( + level->getGameTime(), level->getDayTime(), + level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)))); if (level->isRaining()) { player->connection->send(std::shared_ptr( new GameEventPacket(GameEventPacket::START_RAINING, 0))); @@ -1247,6 +1429,8 @@ void PlayerList::sendLevelInfo(std::shared_ptr player, void PlayerList::sendAllPlayerInfo(std::shared_ptr player) { player->refreshContainer(player->inventoryMenu); player->resetSentInfo(); + player->connection->send(std::shared_ptr( + new SetCarriedItemPacket(player->inventory->selected))); } int PlayerList::getPlayerCount() { return (int)players.size(); } @@ -1268,7 +1452,7 @@ MinecraftServer* PlayerList::getServer() { return server; } int PlayerList::getViewDistance() { return viewDistance; } void PlayerList::setOverrideGameMode(GameType* gameMode) { - this->overrideGameMode = gameMode; + overrideGameMode = gameMode; } void PlayerList::updatePlayerGameMode(std::shared_ptr newPlayer, diff --git a/Minecraft.Client/Network/PlayerList.h b/Minecraft.Client/Network/PlayerList.h index d810bcebe..b430128a9 100644 --- a/Minecraft.Client/Network/PlayerList.h +++ b/Minecraft.Client/Network/PlayerList.h @@ -14,6 +14,7 @@ class TileEntity; class ProgressListener; class GameType; class LoginPacket; +class ServerScoreboard; class PlayerList { private: @@ -70,13 +71,18 @@ public: void placeNewPlayer(Connection* connection, std::shared_ptr player, std::shared_ptr packet); + +protected: + void updateEntireScoreboard(ServerScoreboard* scoreboard, + std::shared_ptr player); + +public: void setLevel(ServerLevelArray levels); void changeDimension(std::shared_ptr player, ServerLevel* from); int getMaxRange(); - bool load(std::shared_ptr - player); // 4J Changed return val to bool to check if new - // player or loaded player + CompoundTag* load(std::shared_ptr player); + protected: void save(std::shared_ptr player); @@ -94,6 +100,9 @@ public: bool keepAllPlayerData); void toggleDimension(std::shared_ptr player, int targetDimension); + void repositionAcrossDimension(std::shared_ptr entity, + int lastDimension, ServerLevel* oldLevel, + ServerLevel* newLevel); void tick(); bool isTrackingTile(int x, int y, int z, int dimension); // 4J added void prioritiseTileChanges(int x, int y, int z, int dimension); // 4J added @@ -108,13 +117,25 @@ public: bool isOp(std::shared_ptr player); // 4J Added std::shared_ptr getPlayer(const std::wstring& name); std::shared_ptr getPlayer(PlayerUID uid); + std::shared_ptr getNearestPlayer(Pos* position, int range); + std::vector* getPlayers( + Pos* position, int rangeMin, int rangeMax, int count, int mode, + int levelMin, int levelMax, + std::unordered_map* scoreRequirements, + const std::wstring& playerName, const std::wstring& teamName, + Level* level); + +private: + bool meetsScoreRequirements( + std::shared_ptr player, + std::unordered_map scoreRequirements); + +public: void sendMessage(const std::wstring& name, const std::wstring& message); void broadcast(double x, double y, double z, double range, int dimension, std::shared_ptr packet); void broadcast(std::shared_ptr except, double x, double y, double z, double range, int dimension, std::shared_ptr packet); - void broadcastToAllOps(const std::wstring& message); - bool sendTo(const std::wstring& name, std::shared_ptr packet); // 4J Added ProgressListener *progressListener param and bDeleteGuestMaps // param void saveAll(ProgressListener* progressListener, diff --git a/Minecraft.Client/Network/ServerChunkCache.cpp b/Minecraft.Client/Network/ServerChunkCache.cpp index 46fbe3792..a8b5b78c0 100644 --- a/Minecraft.Client/Network/ServerChunkCache.cpp +++ b/Minecraft.Client/Network/ServerChunkCache.cpp @@ -11,6 +11,7 @@ #include "../../Minecraft.World/Util/ThreadName.h" #include "../../Minecraft.World/IO/Streams/Compression.h" #include "../../Minecraft.World/Level/Storage/OldChunkStorage.h" +#include "../../Minecraft.World/Blocks/Tile.h" ServerChunkCache::ServerChunkCache(ServerLevel* level, ChunkStorage* storage, ChunkSource* source) { @@ -40,8 +41,9 @@ ServerChunkCache::ServerChunkCache(ServerLevel* level, ChunkStorage* storage, // 4J-PB added ServerChunkCache::~ServerChunkCache() { + storage->WaitForAll(); // MGH - added to fix crash bug 175183 delete emptyChunk; - delete[] cache; + delete[] cache; // 4jcraft changed to delete[] delete source; #ifdef _LARGE_WORLDS @@ -336,6 +338,76 @@ LevelChunk* ServerChunkCache::getChunkLoadedOrUnloaded(int x, int z) { } #endif +// 4J MGH added, for expanding worlds, to kill any player changes and reset the +// chunk +#ifdef _LARGE_WORLDS +void ServerChunkCache::overwriteLevelChunkFromSource(int x, int z) { + int ix = x + XZOFFSET; + int iz = z + XZOFFSET; + // Check we're in range of the stored level + if ((ix < 0) || (ix >= XZSIZE)) assert(0); + if ((iz < 0) || (iz >= XZSIZE)) assert(0); + int idx = ix * XZSIZE + iz; + + LevelChunk* chunk = NULL; + chunk = source->getChunk(x, z); + assert(chunk); + if (chunk) { + save(chunk); + } +} + +void ServerChunkCache::updateOverwriteHellChunk(LevelChunk* origChunk, + LevelChunk* playerChunk, + int xMin, int xMax, int zMin, + int zMax) { + // replace a section of the chunk with the original source data, if it + // hasn't already changed + for (int x = xMin; x < xMax; x++) { + for (int z = zMin; z < zMax; z++) { + for (int y = 0; y < 256; y++) { + int playerTile = playerChunk->getTile(x, y, z); + if (playerTile == + Tile::unbreakable_Id) // if the tile is still unbreakable, + // the player hasn't changed it, so + // we can replace with the source + playerChunk->setTileAndData(x, y, z, + origChunk->getTile(x, y, z), + origChunk->getData(x, y, z)); + } + } + } +} + +void ServerChunkCache::overwriteHellLevelChunkFromSource(int x, int z, + int minVal, + int maxVal) { + int ix = x + XZOFFSET; + int iz = z + XZOFFSET; + // Check we're in range of the stored level + if ((ix < 0) || (ix >= XZSIZE)) assert(0); + if ((iz < 0) || (iz >= XZSIZE)) assert(0); + int idx = ix * XZSIZE + iz; + autoCreate = true; + LevelChunk* playerChunk = getChunk(x, z); + autoCreate = false; + LevelChunk* origChunk = source->getChunk(x, z); + assert(origChunk); + if (playerChunk != emptyChunk) { + if (x == minVal) + updateOverwriteHellChunk(origChunk, playerChunk, 0, 4, 0, 16); + if (x == maxVal) + updateOverwriteHellChunk(origChunk, playerChunk, 12, 16, 0, 16); + if (z == minVal) + updateOverwriteHellChunk(origChunk, playerChunk, 0, 16, 0, 4); + if (z == maxVal) + updateOverwriteHellChunk(origChunk, playerChunk, 0, 16, 12, 16); + } + save(playerChunk); +} + +#endif + // 4J Added // #ifdef _LARGE_WORLDS void ServerChunkCache::dontDrop(int x, int z) { @@ -362,7 +434,7 @@ LevelChunk* ServerChunkCache::load(int x, int z) { levelChunk = storage->load(level, x, z); } if (levelChunk != NULL) { - levelChunk->lastSaveTime = level->getTime(); + levelChunk->lastSaveTime = level->getGameTime(); } return levelChunk; } @@ -376,7 +448,7 @@ void ServerChunkCache::saveEntities(LevelChunk* levelChunk) { void ServerChunkCache::save(LevelChunk* levelChunk) { if (storage == NULL) return; - levelChunk->lastSaveTime = level->getTime(); + levelChunk->lastSaveTime = level->getGameTime(); storage->save(level, levelChunk); } @@ -710,6 +782,7 @@ bool ServerChunkCache::save(bool force, ProgressListener* progressListener) { notificationEvent[3]; // These are signalled by the threads to let // us know they are complete C4JThread* saveThreads[3]; + DWORD threadId[3]; SaveThreadData threadData[3]; ZeroMemory(&threadData[0], sizeof(SaveThreadData)); ZeroMemory(&threadData[1], sizeof(SaveThreadData)); @@ -787,7 +860,7 @@ bool ServerChunkCache::save(bool force, ProgressListener* progressListener) { if (saveThreads[j] == NULL) { char threadName[256]; sprintf(threadName, "Save thread %d\n", j); - SetThreadName(0, threadName); + SetThreadName(threadId[j], threadName); // saveThreads[j] = // CreateThread(NULL,0,runSaveThreadProc,&threadData[j],CREATE_SUSPENDED,&threadId[j]); @@ -926,22 +999,37 @@ bool ServerChunkCache::tick() { if (!m_toDrop.empty()) { LevelChunk* chunk = m_toDrop.front(); if (!chunk->isUnloaded()) { - save(chunk); - saveEntities(chunk); - chunk->unload(true); + // Don't unload a chunk that contains a player, as this will + // cause their entity to be removed from the level itself + // and they will never tick again. This can happen if a + // player moves a long distance in one tick, for example + // when the server thread has locked up doing something for + // a while whilst a player kept moving. In this case, the + // player is moved in the player chunk map (driven by the + // network packets being processed for their new position) + // before the player's tick is called to remove them from + // the chunk they used to be in, and add them to their + // current chunk. This will only be a temporary state and we + // should be able to unload the chunk on the next call to + // this tick. + if (!chunk->containsPlayer()) { + save(chunk); + saveEntities(chunk); + chunk->unload(true); - // loadedChunks.remove(cp); - // loadedChunkList.remove(chunk); - AUTO_VAR(it, std::find(m_loadedChunkList.begin(), - m_loadedChunkList.end(), chunk)); - if (it != m_loadedChunkList.end()) - m_loadedChunkList.erase(it); + // loadedChunks.remove(cp); + // loadedChunkList.remove(chunk); + AUTO_VAR(it, find(m_loadedChunkList.begin(), + m_loadedChunkList.end(), chunk)); + if (it != m_loadedChunkList.end()) + m_loadedChunkList.erase(it); - int ix = chunk->x + XZOFFSET; - int iz = chunk->z + XZOFFSET; - int idx = ix * XZSIZE + iz; - m_unloadedCache[idx] = chunk; - cache[idx] = NULL; + int ix = chunk->x + XZOFFSET; + int iz = chunk->z + XZOFFSET; + int idx = ix * XZSIZE + iz; + m_unloadedCache[idx] = chunk; + cache[idx] = NULL; + } } m_toDrop.pop_front(); } @@ -970,8 +1058,11 @@ TilePos* ServerChunkCache::findNearestMapFeature( return source->findNearestMapFeature(level, featureName, x, y, z); } -int ServerChunkCache::runSaveThreadProc(void* lpParam) { - SaveThreadData* params = static_cast(lpParam); +void ServerChunkCache::recreateLogicStructuresForChunk(int chunkX, int chunkZ) { +} + +int ServerChunkCache::runSaveThreadProc(LPVOID lpParam) { + SaveThreadData* params = (SaveThreadData*)lpParam; if (params->useSharedThreadStorage) { Compression::UseDefaultThreadStorage(); diff --git a/Minecraft.Client/Network/ServerChunkCache.h b/Minecraft.Client/Network/ServerChunkCache.h index c086728a0..abd7cb4b7 100644 --- a/Minecraft.Client/Network/ServerChunkCache.h +++ b/Minecraft.Client/Network/ServerChunkCache.h @@ -10,7 +10,7 @@ class ServerLevel; class ServerChunkCache : public ChunkSource { private: - // std::unordered_set toDrop; + // unordered_set toDrop; private: LevelChunk* emptyChunk; ChunkSource* source; @@ -48,6 +48,17 @@ public: virtual LevelChunk* getChunk(int x, int z); #ifdef _LARGE_WORLDS LevelChunk* getChunkLoadedOrUnloaded(int x, int z); // 4J added + void overwriteLevelChunkFromSource( + int x, int z); // 4J MGH added, for expanding worlds, to kill any + // player changes and reset the chunk + void overwriteHellLevelChunkFromSource( + int x, int z, int minVal, + int maxVal); // 4J MGH added, for expanding worlds, to reset the outer + // tiles in the chunk + void updateOverwriteHellChunk(LevelChunk* origChunk, + LevelChunk* playerChunk, int xMin, int xMax, + int zMin, int zMax); + #endif virtual LevelChunk** getCache() { return cache; } // 4J added @@ -89,6 +100,7 @@ public: virtual TilePos* findNearestMapFeature(Level* level, const std::wstring& featureName, int x, int y, int z); + virtual void recreateLogicStructuresForChunk(int chunkX, int chunkZ); private: typedef struct _SaveThreadData { diff --git a/Minecraft.Client/Network/ServerConnection.cpp b/Minecraft.Client/Network/ServerConnection.cpp index 65801536b..18dc87556 100644 --- a/Minecraft.Client/Network/ServerConnection.cpp +++ b/Minecraft.Client/Network/ServerConnection.cpp @@ -88,14 +88,10 @@ void ServerConnection::tick() { std::shared_ptr player = players[i]; std::shared_ptr serverPlayer = player->getPlayer(); if (serverPlayer) { + serverPlayer->updateFrameTick(); serverPlayer->doChunkSendingTick(false); } - // try { // 4J - removed try/catch player->tick(); - // } catch (Exception e) { - // logger.log(Level.WARNING, "Failed to handle packet: " + e, - // e); player.disconnect("Internal server error"); - // } if (player->done) { players.erase(players.begin() + i); i--; @@ -187,9 +183,14 @@ void ServerConnection::handleServerSettingsChanged( // // for (unsigned int i = 0; i < players.size(); i++) // { - // std::shared_ptr playerconnection = + // shared_ptr playerconnection = // players[i]; // playerconnection->setShowOnMaps(pMinecraft->options->GetGamertagSetting()); // } // } +} + +std::vector >* +ServerConnection::getPlayers() { + return &players; } \ No newline at end of file diff --git a/Minecraft.Client/Network/ServerConnection.h b/Minecraft.Client/Network/ServerConnection.h index 77a341df9..68ab89448 100644 --- a/Minecraft.Client/Network/ServerConnection.h +++ b/Minecraft.Client/Network/ServerConnection.h @@ -53,4 +53,5 @@ public: void handleTextureAndGeometryReceived(const std::wstring& textureName); void handleServerSettingsChanged( std::shared_ptr packet); + std::vector >* getPlayers(); }; diff --git a/Minecraft.Client/Network/ServerScoreboard.cpp b/Minecraft.Client/Network/ServerScoreboard.cpp new file mode 100644 index 000000000..f1eb63ec6 --- /dev/null +++ b/Minecraft.Client/Network/ServerScoreboard.cpp @@ -0,0 +1,233 @@ +#include "../Platform/stdafx.h" + +#include "ServerScoreboard.h" + +ServerScoreboard::ServerScoreboard(MinecraftServer* server) { + this->server = server; +} + +MinecraftServer* ServerScoreboard::getServer() { return server; } + +void ServerScoreboard::onScoreChanged(Score* score) { + // Scoreboard::onScoreChanged(score); + + // if (trackedObjectives.contains(score.getObjective())) + //{ + // server->getPlayers()->broadcastAll( shared_ptr( new + // SetScorePacket(score, SetScorePacket::METHOD_CHANGE))); + // } + + // setDirty(); +} + +void ServerScoreboard::onPlayerRemoved(const std::wstring& player) { + // Scoreboard::onPlayerRemoved(player); + // server->getPlayers()->broadcastAll( shared_ptr( new + // SetScorePacket(player))); setDirty(); +} + +void ServerScoreboard::setDisplayObjective(int slot, Objective* objective) { + // Objective *old = getDisplayObjective(slot); + + // Scoreboard::setDisplayObjective(slot, objective); + + // if (old != objective && old != NULL) + //{ + // if (getObjectiveDisplaySlotCount(old) > 0) + // { + // server->getPlayers()->broadcastAll( + // shared_ptr( new + // SetDisplayObjectivePacket(slot, objective))); + // } + // else + // { + // stopTrackingObjective(old); + // } + // } + + // if (objective != NULL) + //{ + // if (trackedObjectives.contains(objective)) + // { + // server->getPlayers()->broadcastAll( + // shared_ptr( new + // SetDisplayObjectivePacket(slot, objective))); + // } + // else + // { + // startTrackingObjective(objective); + // } + // } + + // setDirty(); +} + +void ServerScoreboard::addPlayerToTeam(const std::wstring& player, + PlayerTeam* team) { + // Scoreboard::addPlayerToTeam(player, team); + + // server->getPlayers()->broadcastAll( shared_ptr( new + // SetPlayerTeamPacket(team, Arrays::asList(player), + // SetPlayerTeamPacket::METHOD_JOIN))); + + // setDirty(); +} + +void ServerScoreboard::removePlayerFromTeam(const std::wstring& player, + PlayerTeam* team) { + // Scoreboard::removePlayerFromTeam(player, team); + + // server->getPlayers()->broadcastAll( shared_ptr( new + // SetPlayerTeamPacket(team, Arrays::asList(player), + // SetPlayerTeamPacket::METHOD_LEAVE))); + + // setDirty(); +} + +void ServerScoreboard::onObjectiveAdded(Objective* objective) { + // Scoreboard::onObjectiveAdded(objective); + // setDirty(); +} + +void ServerScoreboard::onObjectiveChanged(Objective* objective) { + // Scoreaboard::onObjectiveChanged(objective); + + // if (trackedObjectives.contains(objective)) + //{ + // server->getPlayers()->broadcastAll( shared_ptr( new + // SetObjectivePacket(objective, SetObjectivePacket::METHOD_CHANGE))); + // } + + // setDirty(); +} + +void ServerScoreboard::onObjectiveRemoved(Objective* objective) { + // Scoreboard::onObjectiveRemoved(objective); + + // if (trackedObjectives.contains(objective)) + //{ + // stopTrackingObjective(objective); + // } + + // setDirty(); +} + +void ServerScoreboard::onTeamAdded(PlayerTeam* team) { + // Scoreboard::onTeamAdded(team); + + // server->getPlayers()->broadcastAll( shared_ptr( new + // SetPlayerTeamPacket(team, SetPlayerTeamPacket::METHOD_ADD)) ); + + // setDirty(); +} + +void ServerScoreboard::onTeamChanged(PlayerTeam* team) { + // Scoreboard::onTeamChanged(team); + + // server->getPlayers()->broadcastAll( shared_ptr( new + // SetPlayerTeamPacket(team, SetPlayerTeamPacket::METHOD_CHANGE))); + + // setDirty(); +} + +void ServerScoreboard::onTeamRemoved(PlayerTeam* team) { + // Scoreboard::onTeamRemoved(team); + + // server->getPlayers()->broadcastAll( shared_ptr( new + // SetPlayerTeamPacket(team, SetPlayerTeamPacket::METHOD_REMOVE)) ); + + // setDirty(); +} + +void ServerScoreboard::setSaveData(ScoreboardSaveData* data) { + // saveData = data; +} + +void ServerScoreboard::setDirty() { + // if (saveData != NULL) + //{ + // saveData->setDirty(); + // } +} + +std::vector >* +ServerScoreboard::getStartTrackingPackets(Objective* objective) { + return NULL; + + // vector > *packets = new vector >(); + // packets.push_back( shared_ptr( new + // SetObjectivePacket(objective, SetObjectivePacket::METHOD_ADD))); + + // for (int slot = 0; slot < DISPLAY_SLOTS; slot++) + //{ + // if (getDisplayObjective(slot) == objective) packets.push_back( + // shared_ptr( new + // SetDisplayObjectivePacket(slot, objective))); + // } + + // for (Score score : getPlayerScores(objective)) + //{ + // packets.push_back( shared_ptr( new SetScorePacket(score, + // SetScorePacket::METHOD_CHANGE))); + // } + + // return packets; +} + +void ServerScoreboard::startTrackingObjective(Objective* objective) { + // vector > *packets = + // getStartTrackingPackets(objective); + + // for (ServerPlayer player : server.getPlayers().players) + //{ + // for (Packet packet : packets) + // { + // player.connection.send(packet); + // } + // } + + // trackedObjectives.push_back(objective); +} + +std::vector >* ServerScoreboard::getStopTrackingPackets( + Objective* objective) { + return NULL; + + // vector > *packets = new ArrayList(); + // packets->push_back( shared_ptr > *packets = getStopTrackingPackets(objective); + + // for (ServerPlayer player : server.getPlayers().players) + //{ + // for (Packet packet : packets) + // { + // player->connection->send(packet); + // } + // } + + // trackedObjectives.remove(objective); +} + +int ServerScoreboard::getObjectiveDisplaySlotCount(Objective* objective) { + return 0; + // int count = 0; + + // for (int slot = 0; slot < DISPLAY_SLOTS; slot++) + //{ + // if (getDisplayObjective(slot) == objective) count++; + // } + + // return count; +} \ No newline at end of file diff --git a/Minecraft.Client/Network/ServerScoreboard.h b/Minecraft.Client/Network/ServerScoreboard.h new file mode 100644 index 000000000..e06bd569b --- /dev/null +++ b/Minecraft.Client/Network/ServerScoreboard.h @@ -0,0 +1,45 @@ +#pragma once + +#include "../../Minecraft.World/Scores/Scoreboard.h" + +class MinecraftServer; +class ScoreboardSaveData; +class Score; +class Objective; +class PlayerTeam; + +class ServerScoreboard : public Scoreboard { +private: + MinecraftServer* server; + std::unordered_set trackedObjectives; + ScoreboardSaveData* saveData; + +public: + ServerScoreboard(MinecraftServer* server); + + MinecraftServer* getServer(); + void onScoreChanged(Score* score); + void onPlayerRemoved(const std::wstring& player); + void setDisplayObjective(int slot, Objective* objective); + void addPlayerToTeam(const std::wstring& player, PlayerTeam* team); + void removePlayerFromTeam(const std::wstring& player, PlayerTeam* team); + void onObjectiveAdded(Objective* objective); + void onObjectiveChanged(Objective* objective); + void onObjectiveRemoved(Objective* objective); + void onTeamAdded(PlayerTeam* team); + void onTeamChanged(PlayerTeam* team); + void onTeamRemoved(PlayerTeam* team); + void setSaveData(ScoreboardSaveData* data); + +protected: + void setDirty(); + +public: + std::vector >* getStartTrackingPackets( + Objective* objective); + void startTrackingObjective(Objective* objective); + std::vector >* getStopTrackingPackets( + Objective* objective); + void stopTrackingObjective(Objective* objective); + int getObjectiveDisplaySlotCount(Objective* objective); +}; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/App_Defines.h b/Minecraft.Client/Platform/Common/App_Defines.h index 41c239f8d..b3453e53e 100644 --- a/Minecraft.Client/Platform/Common/App_Defines.h +++ b/Minecraft.Client/Platform/Common/App_Defines.h @@ -1,6 +1,5 @@ #pragma once - // 4J Stu - For non-splitscreen menus, default to this screen #define DEFAULT_XUI_MENU_USER 0 #define MULTITHREAD_ENABLE @@ -16,27 +15,49 @@ #define MAX_LOCAL_PLAYERS 4 #endif -// 4J Stu - Required for sentient reporting of whether the volume level has been changed or not +// 4J Stu - Required for sentient reporting of whether the volume level has been +// changed or not #define DEFAULT_VOLUME_LEVEL 100 -#define GAME_HOST_OPTION_BITMASK_DIFFICULTY 0x00000003 // 0 - 3 -#define GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS 0x00000004 -#define GAME_HOST_OPTION_BITMASK_GAMERTAGS 0x00000008 -#define GAME_HOST_OPTION_BITMASK_GAMETYPE 0x00000030 -#define GAME_HOST_OPTION_BITMASK_LEVELTYPE 0x00000040 -#define GAME_HOST_OPTION_BITMASK_STRUCTURES 0x00000080 -#define GAME_HOST_OPTION_BITMASK_BONUSCHEST 0x00000100 -#define GAME_HOST_OPTION_BITMASK_BEENINCREATIVE 0x00000200 -#define GAME_HOST_OPTION_BITMASK_PVP 0x00000400 -#define GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS 0x00000800 -#define GAME_HOST_OPTION_BITMASK_TNT 0x00001000 -#define GAME_HOST_OPTION_BITMASK_FIRESPREADS 0x00002000 -#define GAME_HOST_OPTION_BITMASK_HOSTFLY 0x00004000 -#define GAME_HOST_OPTION_BITMASK_HOSTHUNGER 0x00008000 -#define GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE 0x00010000 -#define GAME_HOST_OPTION_BITMASK_BEDROCKFOG 0x00020000 -#define GAME_HOST_OPTION_BITMASK_DISABLESAVE 0x00040000 -#define GAME_HOST_OPTION_BITMASK_ALL 0xFFFFFFFF +#define GAME_HOST_OPTION_BITMASK_DIFFICULTY 0x00000003 // 0 - 3 +#define GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS 0x00000004 +#define GAME_HOST_OPTION_BITMASK_GAMERTAGS 0x00000008 +#define GAME_HOST_OPTION_BITMASK_GAMETYPE 0x00000030 +#define GAME_HOST_OPTION_BITMASK_LEVELTYPE 0x00000040 +#define GAME_HOST_OPTION_BITMASK_STRUCTURES 0x00000080 +#define GAME_HOST_OPTION_BITMASK_BONUSCHEST 0x00000100 +#define GAME_HOST_OPTION_BITMASK_BEENINCREATIVE 0x00000200 +#define GAME_HOST_OPTION_BITMASK_PVP 0x00000400 +#define GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS 0x00000800 +#define GAME_HOST_OPTION_BITMASK_TNT 0x00001000 +#define GAME_HOST_OPTION_BITMASK_FIRESPREADS 0x00002000 +#define GAME_HOST_OPTION_BITMASK_HOSTFLY 0x00004000 +#define GAME_HOST_OPTION_BITMASK_HOSTHUNGER 0x00008000 +#define GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE 0x00010000 +#define GAME_HOST_OPTION_BITMASK_BEDROCKFOG 0x00020000 +#define GAME_HOST_OPTION_BITMASK_DISABLESAVE 0x00040000 +#define GAME_HOST_OPTION_BITMASK_NOTOWNER 0x00080000 +#define GAME_HOST_OPTION_BITMASK_WORLDSIZE \ + 0x00700000 // 3 bits, 5 values (unset(0), classic(1), small(2), medium(3), + // large(4)) +#define GAME_HOST_OPTION_BITMASK_MOBGRIEFING 0x00800000 +#define GAME_HOST_OPTION_BITMASK_KEEPINVENTORY 0x01000000 +#define GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING 0x02000000 +#define GAME_HOST_OPTION_BITMASK_DOMOBLOOT 0x04000000 +#define GAME_HOST_OPTION_BITMASK_DOTILEDROPS 0x08000000 +#define GAME_HOST_OPTION_BITMASK_NATURALREGEN 0x10000000 +#define GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE 0x20000000 +#define GAME_HOST_OPTION_BITMASK_ALL 0xFFFFFFFF + +#define GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT 20 + +enum EGameHostOptionWorldSize { + e_worldSize_Unknown = 0, + e_worldSize_Classic, + e_worldSize_Small, + e_worldSize_Medium, + e_worldSize_Large +}; #ifdef _XBOX #define PROFILE_VERSION_1 1 @@ -53,77 +74,75 @@ #define PROFILE_VERSION_10 12 // 4J-JEV: New Statistics and Achievements for 'NexGen' platforms. -#define PROFILE_VERSION_BUILD_JUNE14 13 - -#define MAX_FAVORITE_SKINS 10 // these are stored in the profile data so keep it small - +#define PROFILE_VERSION_11 13 +// Java 1.6.4 +#define PROFILE_VERSION_12 14 +#define PROFILE_VERSION_CURRENT PROFILE_VERSION_12 +#define MAX_FAVORITE_SKINS \ + 10 // these are stored in the profile data so keep it small // defines for game settings - uiBitmaskValues -#define GAMESETTING_CLOUDS 0x00000001 -#define GAMESETTING_ONLINE 0x00000002 -#define GAMESETTING_INVITEONLY 0x00000004 -#define GAMESETTING_FRIENDSOFFRIENDS 0x00000008 -#define GAMESETTING_DISPLAYUPDATEMSG 0x00000030 -#define GAMESETTING_BEDROCKFOG 0x00000040 -#define GAMESETTING_DISPLAYHUD 0x00000080 -#define GAMESETTING_DISPLAYHAND 0x00000100 -#define GAMESETTING_CUSTOMSKINANIM 0x00000200 -#define GAMESETTING_DEATHMESSAGES 0x00000400 -#define GAMESETTING_UISIZE 0x00001800 -#define GAMESETTING_UISIZE_SPLITSCREEN 0x00006000 -#define GAMESETTING_ANIMATEDCHARACTER 0x00008000 -#define GAMESETTING_PS3EULAREAD 0x00010000 -#define GAMESETTING_PSVITANETWORKMODEADHOC 0x00020000 - +#define GAMESETTING_CLOUDS 0x00000001 +#define GAMESETTING_ONLINE 0x00000002 +#define GAMESETTING_INVITEONLY 0x00000004 +#define GAMESETTING_FRIENDSOFFRIENDS 0x00000008 +#define GAMESETTING_DISPLAYUPDATEMSG 0x00000030 +#define GAMESETTING_BEDROCKFOG 0x00000040 +#define GAMESETTING_DISPLAYHUD 0x00000080 +#define GAMESETTING_DISPLAYHAND 0x00000100 +#define GAMESETTING_CUSTOMSKINANIM 0x00000200 +#define GAMESETTING_DEATHMESSAGES 0x00000400 +#define GAMESETTING_UISIZE 0x00001800 +#define GAMESETTING_UISIZE_SPLITSCREEN 0x00006000 +#define GAMESETTING_ANIMATEDCHARACTER 0x00008000 +#define GAMESETTING_PS3EULAREAD 0x00010000 +#define GAMESETTING_PSVITANETWORKMODEADHOC 0x00020000 // defines for languages -#define MINECRAFT_LANGUAGE_DEFAULT 0x00 -#define MINECRAFT_LANGUAGE_ENGLISH 0x01 -#define MINECRAFT_LANGUAGE_JAPANESE 0x02 -#define MINECRAFT_LANGUAGE_GERMAN 0x03 -#define MINECRAFT_LANGUAGE_FRENCH 0x04 -#define MINECRAFT_LANGUAGE_SPANISH 0x05 -#define MINECRAFT_LANGUAGE_ITALIAN 0x06 -#define MINECRAFT_LANGUAGE_KOREAN 0x07 -#define MINECRAFT_LANGUAGE_TCHINESE 0x08 -#define MINECRAFT_LANGUAGE_PORTUGUESE 0x09 -#define MINECRAFT_LANGUAGE_BRAZILIAN 0x0A -#define MINECRAFT_LANGUAGE_RUSSIAN 0x0B -#define MINECRAFT_LANGUAGE_DUTCH 0x0C -#define MINECRAFT_LANGUAGE_FINISH 0x0D -#define MINECRAFT_LANGUAGE_SWEDISH 0x0E -#define MINECRAFT_LANGUAGE_DANISH 0x0F -#define MINECRAFT_LANGUAGE_NORWEGIAN 0x10 -#define MINECRAFT_LANGUAGE_POLISH 0x11 -#define MINECRAFT_LANGUAGE_TURKISH 0x12 -#define MINECRAFT_LANGUAGE_LATINAMERICANSPANISH 0x13 -#define MINECRAFT_LANGUAGE_GREEK 0x14 +#define MINECRAFT_LANGUAGE_DEFAULT 0x00 +#define MINECRAFT_LANGUAGE_ENGLISH 0x01 +#define MINECRAFT_LANGUAGE_JAPANESE 0x02 +#define MINECRAFT_LANGUAGE_GERMAN 0x03 +#define MINECRAFT_LANGUAGE_FRENCH 0x04 +#define MINECRAFT_LANGUAGE_SPANISH 0x05 +#define MINECRAFT_LANGUAGE_ITALIAN 0x06 +#define MINECRAFT_LANGUAGE_KOREAN 0x07 +#define MINECRAFT_LANGUAGE_TCHINESE 0x08 +#define MINECRAFT_LANGUAGE_PORTUGUESE 0x09 +#define MINECRAFT_LANGUAGE_BRAZILIAN 0x0A +#define MINECRAFT_LANGUAGE_RUSSIAN 0x0B +#define MINECRAFT_LANGUAGE_DUTCH 0x0C +#define MINECRAFT_LANGUAGE_FINISH 0x0D +#define MINECRAFT_LANGUAGE_SWEDISH 0x0E +#define MINECRAFT_LANGUAGE_DANISH 0x0F +#define MINECRAFT_LANGUAGE_NORWEGIAN 0x10 +#define MINECRAFT_LANGUAGE_POLISH 0x11 +#define MINECRAFT_LANGUAGE_TURKISH 0x12 +#define MINECRAFT_LANGUAGE_LATINAMERICANSPANISH 0x13 +#define MINECRAFT_LANGUAGE_GREEK 0x14 - /* Match these +/* Match these - const int XC_LANGUAGE_ENGLISH =1; - const int XC_LANGUAGE_JAPANESE =2; - const int XC_LANGUAGE_GERMAN =3; - const int XC_LANGUAGE_FRENCH =4; - const int XC_LANGUAGE_SPANISH =5; - const int XC_LANGUAGE_ITALIAN =6; - const int XC_LANGUAGE_KOREAN =7; - const int XC_LANGUAGE_TCHINESE =8; - const int XC_LANGUAGE_PORTUGUESE =9; - const int XC_LANGUAGE_BRAZILIAN =10; - const int XC_LANGUAGE_RUSSIAN =11; - const int XC_LANGUAGE_DUTCH =12; - const int XC_LANGUAGE_FINISH =13; - const int XC_LANGUAGE_SWEDISH =14; - const int XC_LANGUAGE_DANISH =15; - const int XC_LANGUAGE_NORWEGIAN =16; - const int XC_LANGUAGE_POLISH =17; - const int XC_LANGUAGE_TURKISH =18; - const int XC_LANGUAGE_LATINAMERICANSPANISH =19; - const int XC_LANGUAGE_GREEK =20; - */ +const int XC_LANGUAGE_ENGLISH =1; const int XC_LANGUAGE_JAPANESE +=2; const int XC_LANGUAGE_GERMAN +=3; const int XC_LANGUAGE_FRENCH +=4; const int XC_LANGUAGE_SPANISH +=5; const int XC_LANGUAGE_ITALIAN +=6; const int XC_LANGUAGE_KOREAN +=7; const int XC_LANGUAGE_TCHINESE +=8; const int XC_LANGUAGE_PORTUGUESE =9; const int XC_LANGUAGE_BRAZILIAN +=10; const int XC_LANGUAGE_RUSSIAN +=11; const int XC_LANGUAGE_DUTCH +=12; const int XC_LANGUAGE_FINISH +=13; const int XC_LANGUAGE_SWEDISH +=14; const int XC_LANGUAGE_DANISH +=15; const int XC_LANGUAGE_NORWEGIAN =16; const int XC_LANGUAGE_POLISH +=17; const int XC_LANGUAGE_TURKISH +=18; const int XC_LANGUAGE_LATINAMERICANSPANISH =19; +const int XC_LANGUAGE_GREEK =20; +*/ diff --git a/Minecraft.Client/Platform/Common/App_enums.h b/Minecraft.Client/Platform/Common/App_enums.h index 7f6c6de19..8e33689db 100644 --- a/Minecraft.Client/Platform/Common/App_enums.h +++ b/Minecraft.Client/Platform/Common/App_enums.h @@ -1,915 +1,929 @@ #pragma once -enum eFileExtensionType -{ - eFileExtensionType_PNG=0, - eFileExtensionType_INF, - eFileExtensionType_DAT, +enum eFileExtensionType { + eFileExtensionType_PNG = 0, + eFileExtensionType_INF, + eFileExtensionType_DAT, }; -enum eTMSFileType -{ - eTMSFileType_MinecraftStore=0, - eTMSFileType_TexturePack, - eTMSFileType_All +enum eTMSFileType { + eTMSFileType_MinecraftStore = 0, + eTMSFileType_TexturePack, + eTMSFileType_All }; -enum eTPDFileType -{ - eTPDFileType_Loc=0, - eTPDFileType_Icon, -// eTPDFileType_Banner, - eTPDFileType_Comparison, +enum eTPDFileType { + eTPDFileType_Loc = 0, + eTPDFileType_Icon, + // eTPDFileType_Banner, + eTPDFileType_Comparison, }; -enum eFont -{ - eFont_European=0, - eFont_Korean, - eFont_Japanese, - eFont_Chinese, - eFont_None, // to fallback to nothing +enum eFont { + eFont_European = 0, + eFont_Korean, + eFont_Japanese, + eFont_Chinese, + eFont_None, // to fallback to nothing }; -enum eXuiAction -{ - eAppAction_Idle=0, - eAppAction_SaveGame, - eAppAction_SaveGameCapturedThumbnail, - eAppAction_ExitWorld, - eAppAction_ExitWorldCapturedThumbnail, - eAppAction_ExitWorldTrial, - //eAppAction_ExitGameFatalLoadError, - eAppAction_Respawn, - eAppAction_WaitForRespawnComplete, - eAppAction_PrimaryPlayerSignedOut, - eAppAction_PrimaryPlayerSignedOutReturned, - eAppAction_PrimaryPlayerSignedOutReturned_Menus, - eAppAction_ExitPlayer, // secondary player - eAppAction_ExitPlayerPreLogin, - eAppAction_TrialOver, - eAppAction_ExitTrial, - eAppAction_WaitForDimensionChangeComplete, - eAppAction_SocialPost, - eAppAction_SocialPostScreenshot, - eAppAction_EthernetDisconnected, - eAppAction_EthernetDisconnectedReturned, - eAppAction_EthernetDisconnectedReturned_Menus, - eAppAction_ExitAndJoinFromInvite, - eAppAction_DashboardTrialJoinFromInvite, - eAppAction_ExitAndJoinFromInviteConfirmed, - eAppAction_JoinFromInvite, - eAppAction_ChangeSessionType, - eAppAction_SetDefaultOptions, - eAppAction_LocalPlayerJoined, - eAppAction_RemoteServerSave, - eAppAction_WaitRemoteServerSaveComplete, - eAppAction_FailedToJoinNoPrivileges, - eAppAction_AutosaveSaveGame, - eAppAction_AutosaveSaveGameCapturedThumbnail, - eAppAction_ProfileReadError, - eAppAction_DisplayLavaMessage, - eAppAction_BanLevel, - eAppAction_LevelInBanLevelList, +enum eXuiAction { + eAppAction_Idle = 0, + eAppAction_SaveGame, + eAppAction_SaveGameCapturedThumbnail, + eAppAction_ExitWorld, + eAppAction_ExitWorldCapturedThumbnail, + eAppAction_ExitWorldTrial, + // eAppAction_ExitGameFatalLoadError, + eAppAction_Respawn, + eAppAction_WaitForRespawnComplete, + eAppAction_PrimaryPlayerSignedOut, + eAppAction_PrimaryPlayerSignedOutReturned, + eAppAction_PrimaryPlayerSignedOutReturned_Menus, + eAppAction_ExitPlayer, // secondary player + eAppAction_ExitPlayerPreLogin, + eAppAction_TrialOver, + eAppAction_ExitTrial, + eAppAction_WaitForDimensionChangeComplete, + eAppAction_SocialPost, + eAppAction_SocialPostScreenshot, + eAppAction_EthernetDisconnected, + eAppAction_EthernetDisconnectedReturned, + eAppAction_EthernetDisconnectedReturned_Menus, + eAppAction_ExitAndJoinFromInvite, + eAppAction_DashboardTrialJoinFromInvite, + eAppAction_ExitAndJoinFromInviteConfirmed, + eAppAction_JoinFromInvite, + eAppAction_ChangeSessionType, + eAppAction_SetDefaultOptions, + eAppAction_LocalPlayerJoined, + eAppAction_RemoteServerSave, + eAppAction_WaitRemoteServerSaveComplete, + eAppAction_FailedToJoinNoPrivileges, + eAppAction_AutosaveSaveGame, + eAppAction_AutosaveSaveGameCapturedThumbnail, + eAppAction_ProfileReadError, + eAppAction_DisplayLavaMessage, + eAppAction_BanLevel, + eAppAction_LevelInBanLevelList, - eAppAction_ReloadTexturePack, - eAppAction_TexturePackRequired, // when the user has joined from invite, but doesn't have the texture pack + eAppAction_ReloadTexturePack, + eAppAction_ReloadFont, + eAppAction_TexturePackRequired, // when the user has joined from invite, + // but doesn't have the texture pack #ifdef __ORBIS__ - eAppAction_OptionsSaveNoSpace, + eAppAction_OptionsSaveNoSpace, #endif - eAppAction_DebugText, + eAppAction_DebugText, }; - - -enum eTMSAction -{ - eTMSAction_Idle=0, - eTMSAction_TMS_RetrieveFiles_Complete, - eTMSAction_TMSPP_RetrieveFiles_CreateLoad_SignInReturned, - eTMSAction_TMSPP_RetrieveFiles_RunPlayGame, - eTMSAction_TMSPP_RetrieveFiles_HelpAndOptions, - eTMSAction_TMSPP_RetrieveFiles_DLCMain, - eTMSAction_TMSPP_GlobalFileList, - eTMSAction_TMSPP_GlobalFileList_Waiting, -// eTMSAction_TMSPP_ConfigFile, -// eTMSAction_TMSPP_ConfigFile_Waiting, - eTMSAction_TMSPP_UserFileList, - eTMSAction_TMSPP_UserFileList_Waiting, - eTMSAction_TMSPP_XUIDSFile, - eTMSAction_TMSPP_XUIDSFile_Waiting, - eTMSAction_TMSPP_DLCFile, - eTMSAction_TMSPP_DLCFile_Waiting, - eTMSAction_TMSPP_BannedListFile, - eTMSAction_TMSPP_BannedListFile_Waiting, - eTMSAction_TMSPP_RetrieveFiles_Complete, - eTMSAction_TMSPP_DLCFileOnly, - eTMSAction_TMSPP_RetrieveUserFilelist_DLCFileOnly, +enum eTMSAction { + eTMSAction_Idle = 0, + eTMSAction_TMS_RetrieveFiles_Complete, + eTMSAction_TMSPP_RetrieveFiles_CreateLoad_SignInReturned, + eTMSAction_TMSPP_RetrieveFiles_RunPlayGame, + eTMSAction_TMSPP_RetrieveFiles_HelpAndOptions, + eTMSAction_TMSPP_RetrieveFiles_DLCMain, + eTMSAction_TMSPP_GlobalFileList, + eTMSAction_TMSPP_GlobalFileList_Waiting, + // eTMSAction_TMSPP_ConfigFile, + // eTMSAction_TMSPP_ConfigFile_Waiting, + eTMSAction_TMSPP_UserFileList, + eTMSAction_TMSPP_UserFileList_Waiting, + eTMSAction_TMSPP_XUIDSFile, + eTMSAction_TMSPP_XUIDSFile_Waiting, + eTMSAction_TMSPP_DLCFile, + eTMSAction_TMSPP_DLCFile_Waiting, + eTMSAction_TMSPP_BannedListFile, + eTMSAction_TMSPP_BannedListFile_Waiting, + eTMSAction_TMSPP_RetrieveFiles_Complete, + eTMSAction_TMSPP_DLCFileOnly, + eTMSAction_TMSPP_RetrieveUserFilelist_DLCFileOnly, }; -// The server runs on its own thread, so we need to call its actions there rather than where all other Xui actions are performed -// In general these are debugging options -enum eXuiServerAction -{ - eXuiServerAction_Idle=0, - eXuiServerAction_DropItem, // Debug - eXuiServerAction_SaveGame, - eXuiServerAction_AutoSaveGame, - eXuiServerAction_SpawnMob, // Debug - eXuiServerAction_PauseServer, - eXuiServerAction_ToggleRain, // Debug - eXuiServerAction_ToggleThunder, // Debug - eXuiServerAction_ServerSettingChanged_Gamertags, - eXuiServerAction_ServerSettingChanged_Difficulty, - eXuiServerAction_ExportSchematic, //Debug - eXuiServerAction_ServerSettingChanged_BedrockFog, - eXuiServerAction_SetCameraLocation, //Debug +// The server runs on its own thread, so we need to call its actions there +// rather than where all other Xui actions are performed In general these are +// debugging options +enum eXuiServerAction { + eXuiServerAction_Idle = 0, + eXuiServerAction_DropItem, // Debug + eXuiServerAction_SaveGame, + eXuiServerAction_AutoSaveGame, + eXuiServerAction_SpawnMob, // Debug + eXuiServerAction_PauseServer, + eXuiServerAction_ToggleRain, // Debug + eXuiServerAction_ToggleThunder, // Debug + eXuiServerAction_ServerSettingChanged_Gamertags, + eXuiServerAction_ServerSettingChanged_Difficulty, + eXuiServerAction_ExportSchematic, // Debug + eXuiServerAction_ServerSettingChanged_BedrockFog, + eXuiServerAction_SetCameraLocation, // Debug }; -enum eGameSetting -{ - eGameSetting_MusicVolume=0, - eGameSetting_SoundFXVolume, - eGameSetting_Gamma, - eGameSetting_Difficulty, - eGameSetting_Sensitivity_InGame, - eGameSetting_Sensitivity_InMenu, - eGameSetting_ViewBob, - eGameSetting_ControlScheme, - eGameSetting_ControlInvertLook, - eGameSetting_ControlSouthPaw, - eGameSetting_SplitScreenVertical, - eGameSetting_GamertagsVisible, - // Interim TU 1.6.6 - eGameSetting_Autosave, - eGameSetting_DisplaySplitscreenGamertags, - eGameSetting_Hints, - eGameSetting_InterfaceOpacity, - eGameSetting_Tooltips, - // TU5 - eGameSetting_Clouds, - eGameSetting_Online, - eGameSetting_InviteOnly, - eGameSetting_FriendsOfFriends, - eGameSetting_DisplayUpdateMessage, +enum eGameSetting { + eGameSetting_MusicVolume = 0, + eGameSetting_SoundFXVolume, + eGameSetting_Gamma, + eGameSetting_Difficulty, + eGameSetting_Sensitivity_InGame, + eGameSetting_Sensitivity_InMenu, + eGameSetting_ViewBob, + eGameSetting_ControlScheme, + eGameSetting_ControlInvertLook, + eGameSetting_ControlSouthPaw, + eGameSetting_SplitScreenVertical, + eGameSetting_GamertagsVisible, + // Interim TU 1.6.6 + eGameSetting_Autosave, + eGameSetting_DisplaySplitscreenGamertags, + eGameSetting_Hints, + eGameSetting_InterfaceOpacity, + eGameSetting_Tooltips, + // TU5 + eGameSetting_Clouds, + eGameSetting_Online, + eGameSetting_InviteOnly, + eGameSetting_FriendsOfFriends, + eGameSetting_DisplayUpdateMessage, - // TU6 - eGameSetting_BedrockFog, - eGameSetting_DisplayHUD, - eGameSetting_DisplayHand, + // TU6 + eGameSetting_BedrockFog, + eGameSetting_DisplayHUD, + eGameSetting_DisplayHand, - // TU7 - eGameSetting_CustomSkinAnim, + // TU7 + eGameSetting_CustomSkinAnim, - // TU9 - eGameSetting_DeathMessages, - eGameSetting_UISize, - eGameSetting_UISizeSplitscreen, - eGameSetting_AnimatedCharacter, + // TU9 + eGameSetting_DeathMessages, + eGameSetting_UISize, + eGameSetting_UISizeSplitscreen, + eGameSetting_AnimatedCharacter, - // PS3 - eGameSetting_PS3_EULA_Read, - - // PSVita - eGameSetting_PSVita_NetworkModeAdhoc, + // PS3 + eGameSetting_PS3_EULA_Read, + // PSVita + eGameSetting_PSVita_NetworkModeAdhoc, }; +enum eGameMode { eMode_Singleplayer, eMode_Multiplayer }; +enum eMinecraftColour { + eMinecraftColour_NOT_SET, -enum eGameMode -{ - eMode_Singleplayer, - eMode_Multiplayer + eMinecraftColour_Foliage_Evergreen, + eMinecraftColour_Foliage_Birch, + eMinecraftColour_Foliage_Default, + eMinecraftColour_Foliage_Common, + eMinecraftColour_Foliage_Ocean, + eMinecraftColour_Foliage_Plains, + eMinecraftColour_Foliage_Desert, + eMinecraftColour_Foliage_ExtremeHills, + eMinecraftColour_Foliage_Forest, + eMinecraftColour_Foliage_Taiga, + eMinecraftColour_Foliage_Swampland, + eMinecraftColour_Foliage_River, + eMinecraftColour_Foliage_Hell, + eMinecraftColour_Foliage_Sky, + eMinecraftColour_Foliage_FrozenOcean, + eMinecraftColour_Foliage_FrozenRiver, + eMinecraftColour_Foliage_IcePlains, + eMinecraftColour_Foliage_IceMountains, + eMinecraftColour_Foliage_MushroomIsland, + eMinecraftColour_Foliage_MushroomIslandShore, + eMinecraftColour_Foliage_Beach, + eMinecraftColour_Foliage_DesertHills, + eMinecraftColour_Foliage_ForestHills, + eMinecraftColour_Foliage_TaigaHills, + eMinecraftColour_Foliage_ExtremeHillsEdge, + eMinecraftColour_Foliage_Jungle, + eMinecraftColour_Foliage_JungleHills, + + eMinecraftColour_Grass_Common, + eMinecraftColour_Grass_Ocean, + eMinecraftColour_Grass_Plains, + eMinecraftColour_Grass_Desert, + eMinecraftColour_Grass_ExtremeHills, + eMinecraftColour_Grass_Forest, + eMinecraftColour_Grass_Taiga, + eMinecraftColour_Grass_Swampland, + eMinecraftColour_Grass_River, + eMinecraftColour_Grass_Hell, + eMinecraftColour_Grass_Sky, + eMinecraftColour_Grass_FrozenOcean, + eMinecraftColour_Grass_FrozenRiver, + eMinecraftColour_Grass_IcePlains, + eMinecraftColour_Grass_IceMountains, + eMinecraftColour_Grass_MushroomIsland, + eMinecraftColour_Grass_MushroomIslandShore, + eMinecraftColour_Grass_Beach, + eMinecraftColour_Grass_DesertHills, + eMinecraftColour_Grass_ForestHills, + eMinecraftColour_Grass_TaigaHills, + eMinecraftColour_Grass_ExtremeHillsEdge, + eMinecraftColour_Grass_Jungle, + eMinecraftColour_Grass_JungleHills, + + eMinecraftColour_Water_Ocean, + eMinecraftColour_Water_Plains, + eMinecraftColour_Water_Desert, + eMinecraftColour_Water_ExtremeHills, + eMinecraftColour_Water_Forest, + eMinecraftColour_Water_Taiga, + eMinecraftColour_Water_Swampland, + eMinecraftColour_Water_River, + eMinecraftColour_Water_Hell, + eMinecraftColour_Water_Sky, + eMinecraftColour_Water_FrozenOcean, + eMinecraftColour_Water_FrozenRiver, + eMinecraftColour_Water_IcePlains, + eMinecraftColour_Water_IceMountains, + eMinecraftColour_Water_MushroomIsland, + eMinecraftColour_Water_MushroomIslandShore, + eMinecraftColour_Water_Beach, + eMinecraftColour_Water_DesertHills, + eMinecraftColour_Water_ForestHills, + eMinecraftColour_Water_TaigaHills, + eMinecraftColour_Water_ExtremeHillsEdge, + eMinecraftColour_Water_Jungle, + eMinecraftColour_Water_JungleHills, + + eMinecraftColour_Sky_Ocean, + eMinecraftColour_Sky_Plains, + eMinecraftColour_Sky_Desert, + eMinecraftColour_Sky_ExtremeHills, + eMinecraftColour_Sky_Forest, + eMinecraftColour_Sky_Taiga, + eMinecraftColour_Sky_Swampland, + eMinecraftColour_Sky_River, + eMinecraftColour_Sky_Hell, + eMinecraftColour_Sky_Sky, + eMinecraftColour_Sky_FrozenOcean, + eMinecraftColour_Sky_FrozenRiver, + eMinecraftColour_Sky_IcePlains, + eMinecraftColour_Sky_IceMountains, + eMinecraftColour_Sky_MushroomIsland, + eMinecraftColour_Sky_MushroomIslandShore, + eMinecraftColour_Sky_Beach, + eMinecraftColour_Sky_DesertHills, + eMinecraftColour_Sky_ForestHills, + eMinecraftColour_Sky_TaigaHills, + eMinecraftColour_Sky_ExtremeHillsEdge, + eMinecraftColour_Sky_Jungle, + eMinecraftColour_Sky_JungleHills, + + eMinecraftColour_Tile_RedstoneDust, + eMinecraftColour_Tile_RedstoneDustUnlit, + eMinecraftColour_Tile_RedstoneDustLitMin, + eMinecraftColour_Tile_RedstoneDustLitMax, + eMinecraftColour_Tile_StemMin, + eMinecraftColour_Tile_StemMax, + eMinecraftColour_Tile_WaterLily, + + eMinecraftColour_Sky_Dawn_Dark, + eMinecraftColour_Sky_Dawn_Bright, + + eMinecraftColour_Material_None, + eMinecraftColour_Material_Grass, + eMinecraftColour_Material_Sand, + eMinecraftColour_Material_Cloth, + eMinecraftColour_Material_Fire, + eMinecraftColour_Material_Ice, + eMinecraftColour_Material_Metal, + eMinecraftColour_Material_Plant, + eMinecraftColour_Material_Snow, + eMinecraftColour_Material_Clay, + eMinecraftColour_Material_Dirt, + eMinecraftColour_Material_Stone, + eMinecraftColour_Material_Water, + eMinecraftColour_Material_Wood, + eMinecraftColour_Material_Emerald, + + eMinecraftColour_Particle_Note_00, + eMinecraftColour_Particle_Note_01, + eMinecraftColour_Particle_Note_02, + eMinecraftColour_Particle_Note_03, + eMinecraftColour_Particle_Note_04, + eMinecraftColour_Particle_Note_05, + eMinecraftColour_Particle_Note_06, + eMinecraftColour_Particle_Note_07, + eMinecraftColour_Particle_Note_08, + eMinecraftColour_Particle_Note_09, + eMinecraftColour_Particle_Note_10, + eMinecraftColour_Particle_Note_11, + eMinecraftColour_Particle_Note_12, + eMinecraftColour_Particle_Note_13, + eMinecraftColour_Particle_Note_14, + eMinecraftColour_Particle_Note_15, + eMinecraftColour_Particle_Note_16, + eMinecraftColour_Particle_Note_17, + eMinecraftColour_Particle_Note_18, + eMinecraftColour_Particle_Note_19, + eMinecraftColour_Particle_Note_20, + eMinecraftColour_Particle_Note_21, + eMinecraftColour_Particle_Note_22, + eMinecraftColour_Particle_Note_23, + eMinecraftColour_Particle_Note_24, + + eMinecraftColour_Particle_NetherPortal, + eMinecraftColour_Particle_EnderPortal, + eMinecraftColour_Particle_Smoke, + eMinecraftColour_Particle_Ender, + eMinecraftColour_Particle_Explode, + eMinecraftColour_Particle_HugeExplosion, + eMinecraftColour_Particle_DripWater, + eMinecraftColour_Particle_DripLavaStart, + eMinecraftColour_Particle_DripLavaEnd, + eMinecraftColour_Particle_EnchantmentTable, + eMinecraftColour_Particle_DragonBreathMin, + eMinecraftColour_Particle_DragonBreathMax, + eMinecraftColour_Particle_Suspend, + eMinecraftColour_Particle_CritStart, + eMinecraftColour_Particle_CritEnd, + + eMinecraftColour_Effect_MovementSpeed, + eMinecraftColour_Effect_MovementSlowDown, + eMinecraftColour_Effect_DigSpeed, + eMinecraftColour_Effect_DigSlowdown, + eMinecraftColour_Effect_DamageBoost, + eMinecraftColour_Effect_Heal, + eMinecraftColour_Effect_Harm, + eMinecraftColour_Effect_Jump, + eMinecraftColour_Effect_Confusion, + eMinecraftColour_Effect_Regeneration, + eMinecraftColour_Effect_DamageResistance, + eMinecraftColour_Effect_FireResistance, + eMinecraftColour_Effect_WaterBreathing, + eMinecraftColour_Effect_Invisiblity, + eMinecraftColour_Effect_Blindness, + eMinecraftColour_Effect_NightVision, + eMinecraftColour_Effect_Hunger, + eMinecraftColour_Effect_Weakness, + eMinecraftColour_Effect_Poison, + eMinecraftColour_Effect_Wither, + eMinecraftColour_Effect_HealthBoost, + eMinecraftColour_Effect_Absoprtion, + eMinecraftColour_Effect_Saturation, + + eMinecraftColour_Potion_BaseColour, + + eMinecraftColour_Mob_Creeper_Colour1, + eMinecraftColour_Mob_Creeper_Colour2, + eMinecraftColour_Mob_Skeleton_Colour1, + eMinecraftColour_Mob_Skeleton_Colour2, + eMinecraftColour_Mob_Spider_Colour1, + eMinecraftColour_Mob_Spider_Colour2, + eMinecraftColour_Mob_Zombie_Colour1, + eMinecraftColour_Mob_Zombie_Colour2, + eMinecraftColour_Mob_Slime_Colour1, + eMinecraftColour_Mob_Slime_Colour2, + eMinecraftColour_Mob_Ghast_Colour1, + eMinecraftColour_Mob_Ghast_Colour2, + eMinecraftColour_Mob_PigZombie_Colour1, + eMinecraftColour_Mob_PigZombie_Colour2, + eMinecraftColour_Mob_Enderman_Colour1, + eMinecraftColour_Mob_Enderman_Colour2, + eMinecraftColour_Mob_CaveSpider_Colour1, + eMinecraftColour_Mob_CaveSpider_Colour2, + eMinecraftColour_Mob_Silverfish_Colour1, + eMinecraftColour_Mob_Silverfish_Colour2, + eMinecraftColour_Mob_Blaze_Colour1, + eMinecraftColour_Mob_Blaze_Colour2, + eMinecraftColour_Mob_LavaSlime_Colour1, + eMinecraftColour_Mob_LavaSlime_Colour2, + eMinecraftColour_Mob_Pig_Colour1, + eMinecraftColour_Mob_Pig_Colour2, + eMinecraftColour_Mob_Sheep_Colour1, + eMinecraftColour_Mob_Sheep_Colour2, + eMinecraftColour_Mob_Cow_Colour1, + eMinecraftColour_Mob_Cow_Colour2, + eMinecraftColour_Mob_Chicken_Colour1, + eMinecraftColour_Mob_Chicken_Colour2, + eMinecraftColour_Mob_Squid_Colour1, + eMinecraftColour_Mob_Squid_Colour2, + eMinecraftColour_Mob_Wolf_Colour1, + eMinecraftColour_Mob_Wolf_Colour2, + eMinecraftColour_Mob_MushroomCow_Colour1, + eMinecraftColour_Mob_MushroomCow_Colour2, + eMinecraftColour_Mob_Ocelot_Colour1, + eMinecraftColour_Mob_Ocelot_Colour2, + eMinecraftColour_Mob_Villager_Colour1, + eMinecraftColour_Mob_Villager_Colour2, + eMinecraftColour_Mob_Bat_Colour1, + eMinecraftColour_Mob_Bat_Colour2, + eMinecraftColour_Mob_Witch_Colour1, + eMinecraftColour_Mob_Witch_Colour2, + eMinecraftColour_Mob_Horse_Colour1, + eMinecraftColour_Mob_Horse_Colour2, + + eMinecraftColour_Armour_Default_Leather_Colour, + + eMinecraftColour_Under_Water_Clear_Colour, + eMinecraftColour_Under_Lava_Clear_Colour, + eMinecraftColour_In_Cloud_Base_Colour, + + eMinecraftColour_Under_Water_Fog_Colour, + eMinecraftColour_Under_Lava_Fog_Colour, + eMinecraftColour_In_Cloud_Fog_Colour, + + eMinecraftColour_Default_Fog_Colour, + eMinecraftColour_Nether_Fog_Colour, + eMinecraftColour_End_Fog_Colour, + + eMinecraftColour_Sign_Text, + eMinecraftColour_Map_Text, + + eMinecraftColour_Leash_Light_Colour, + eMinecraftColour_Leash_Dark_Colour, + + eMinecraftColour_Fire_Overlay, + + eHTMLColor_0, + eHTMLColor_1, + eHTMLColor_2, + eHTMLColor_3, + eHTMLColor_4, + eHTMLColor_5, + eHTMLColor_6, + eHTMLColor_7, + eHTMLColor_8, + eHTMLColor_9, + eHTMLColor_a, + eHTMLColor_b, + eHTMLColor_c, + eHTMLColor_d, + eHTMLColor_e, + eHTMLColor_f, + eHTMLColor_0_dark, + eHTMLColor_1_dark, + eHTMLColor_2_dark, + eHTMLColor_3_dark, + eHTMLColor_4_dark, + eHTMLColor_5_dark, + eHTMLColor_6_dark, + eHTMLColor_7_dark, + eHTMLColor_8_dark, + eHTMLColor_9_dark, + eHTMLColor_a_dark, + eHTMLColor_b_dark, + eHTMLColor_c_dark, + eHTMLColor_d_dark, + eHTMLColor_e_dark, + eHTMLColor_f_dark, + eHTMLColor_T1, + eHTMLColor_T2, + eHTMLColor_T3, + eHTMLColor_Black, + eHTMLColor_White, + + eTextColor_Enchant, + eTextColor_EnchantFocus, + eTextColor_EnchantDisabled, + eTextColor_RenamedItemTitle, + + // eHTMLColor_0 = 0x000000, //r:0 , g: 0, b: 0, i: 0 + // eHTMLColor_1 = 0x0000aa, //r:0 , g: 0, b: aa, i: 1 // blue, quite dark + // eHTMLColor_2 = 0x109e10, // Changed by request of Dave //0x00aa00, //r:0 + // , g: aa, b: 0, i: 2 // green eHTMLColor_3 = 0x109e9e, // Changed by + // request of Dave //0x00aaaa, //r:0 , g: aa, b: aa, i: 3 // cyan + // eHTMLColor_4 = 0xaa0000, //r:aa , g: 0, b: 0, i: 4 // red + // eHTMLColor_5 = 0xaa00aa, //r:aa , g: 0, b: aa, i: 5 // purple + // eHTMLColor_6 = 0xffaa00, //r:ff , g: aa, b: 0, i: 6 // orange + // eHTMLColor_7 = 0xaaaaaa, //r:aa , g: aa, b: aa, i: 7 // light gray + // eHTMLColor_8 = 0x555555, //r:55 , g: 55, b: 55, i: 8 // gray + // eHTMLColor_9 = 0x5555ff, //r:55 , g: 55, b: ff, i: 9 // blue + // eHTMLColor_a = 0x55ff55, //r:55 , g: ff, b: 55, i: a // green + // eHTMLColor_b = 0x55ffff, //r:55 , g: ff, b: ff, i: b // cyan + // eHTMLColor_c = 0xff5555, //r:ff , g: 55, b: 55, i: c // red pink + // eHTMLColor_d = 0xff55ff, //r:ff , g: 55, b: ff, i: d // bright pink + // eHTMLColor_e = 0xffff55, //r:ff , g: ff, b: 55, i: e // yellow + // eHTMLColor_f = 0xffffff, //r:ff , g: ff, b: ff, i: f + // eHTMLColor_0_dark = 0x000000, //r:0 , g: 0, b: 0, i: 10 + // eHTMLColor_1_dark = 0x00002a, //r:0 , g: 0, b: 2a, i: 11 + // eHTMLColor_2_dark = 0x002a00, //r:0 , g: 2a, b: 0, i: 12 + // eHTMLColor_3_dark = 0x002a2a, //r:0 , g: 2a, b: 2a, i: 13 + // eHTMLColor_4_dark = 0x2a0000, //r:2a , g: 0, b: 0, i: 14 + // eHTMLColor_5_dark = 0x2a002a, //r:2a , g: 0, b: 2a, i: 15 + // eHTMLColor_6_dark = 0x2a2a00, //r:2a , g: 2a, b: 0, i: 16 + // eHTMLColor_7_dark = 0x2a2a2a, //r:2a , g: 2a, b: 2a, i: 17 // dark gray + // eHTMLColor_8_dark = 0x151515, //r:15 , g: 15, b: 15, i: 18 + // eHTMLColor_9_dark = 0x15153f, //r:15 , g: 15, b: 3f, i: 19 + // eHTMLColor_a_dark = 0x153f15, //r:15 , g: 3f, b: 15, i: 1a + // eHTMLColor_b_dark = 0x153f3f, //r:15 , g: 3f, b: 3f, i: 1b + // eHTMLColor_c_dark = 0x3f1515, //r:3f , g: 15, b: 15, i: 1c // brown + // eHTMLColor_d_dark = 0x3f153f, //r:3f , g: 15, b: 3f, i: 1d + // eHTMLColor_e_dark = 0x3f3f15, //r:3f , g: 3f, b: 15, i: 1e + // eHTMLColor_f_dark = 0x3f3f3f, //r:3f , g: 3f, b: 3f, i: 1f + + eMinecraftColour_COUNT, }; - -enum eMinecraftColour -{ - eMinecraftColour_NOT_SET, - - eMinecraftColour_Foliage_Evergreen, - eMinecraftColour_Foliage_Birch, - eMinecraftColour_Foliage_Default, - eMinecraftColour_Foliage_Common, - eMinecraftColour_Foliage_Ocean, - eMinecraftColour_Foliage_Plains, - eMinecraftColour_Foliage_Desert, - eMinecraftColour_Foliage_ExtremeHills, - eMinecraftColour_Foliage_Forest, - eMinecraftColour_Foliage_Taiga, - eMinecraftColour_Foliage_Swampland, - eMinecraftColour_Foliage_River, - eMinecraftColour_Foliage_Hell, - eMinecraftColour_Foliage_Sky, - eMinecraftColour_Foliage_FrozenOcean, - eMinecraftColour_Foliage_FrozenRiver, - eMinecraftColour_Foliage_IcePlains, - eMinecraftColour_Foliage_IceMountains, - eMinecraftColour_Foliage_MushroomIsland, - eMinecraftColour_Foliage_MushroomIslandShore, - eMinecraftColour_Foliage_Beach, - eMinecraftColour_Foliage_DesertHills, - eMinecraftColour_Foliage_ForestHills, - eMinecraftColour_Foliage_TaigaHills, - eMinecraftColour_Foliage_ExtremeHillsEdge, - eMinecraftColour_Foliage_Jungle, - eMinecraftColour_Foliage_JungleHills, - - eMinecraftColour_Grass_Common, - eMinecraftColour_Grass_Ocean, - eMinecraftColour_Grass_Plains, - eMinecraftColour_Grass_Desert, - eMinecraftColour_Grass_ExtremeHills, - eMinecraftColour_Grass_Forest, - eMinecraftColour_Grass_Taiga, - eMinecraftColour_Grass_Swampland, - eMinecraftColour_Grass_River, - eMinecraftColour_Grass_Hell, - eMinecraftColour_Grass_Sky, - eMinecraftColour_Grass_FrozenOcean, - eMinecraftColour_Grass_FrozenRiver, - eMinecraftColour_Grass_IcePlains, - eMinecraftColour_Grass_IceMountains, - eMinecraftColour_Grass_MushroomIsland, - eMinecraftColour_Grass_MushroomIslandShore, - eMinecraftColour_Grass_Beach, - eMinecraftColour_Grass_DesertHills, - eMinecraftColour_Grass_ForestHills, - eMinecraftColour_Grass_TaigaHills, - eMinecraftColour_Grass_ExtremeHillsEdge, - eMinecraftColour_Grass_Jungle, - eMinecraftColour_Grass_JungleHills, - - eMinecraftColour_Water_Ocean, - eMinecraftColour_Water_Plains, - eMinecraftColour_Water_Desert, - eMinecraftColour_Water_ExtremeHills, - eMinecraftColour_Water_Forest, - eMinecraftColour_Water_Taiga, - eMinecraftColour_Water_Swampland, - eMinecraftColour_Water_River, - eMinecraftColour_Water_Hell, - eMinecraftColour_Water_Sky, - eMinecraftColour_Water_FrozenOcean, - eMinecraftColour_Water_FrozenRiver, - eMinecraftColour_Water_IcePlains, - eMinecraftColour_Water_IceMountains, - eMinecraftColour_Water_MushroomIsland, - eMinecraftColour_Water_MushroomIslandShore, - eMinecraftColour_Water_Beach, - eMinecraftColour_Water_DesertHills, - eMinecraftColour_Water_ForestHills, - eMinecraftColour_Water_TaigaHills, - eMinecraftColour_Water_ExtremeHillsEdge, - eMinecraftColour_Water_Jungle, - eMinecraftColour_Water_JungleHills, - - eMinecraftColour_Sky_Ocean, - eMinecraftColour_Sky_Plains, - eMinecraftColour_Sky_Desert, - eMinecraftColour_Sky_ExtremeHills, - eMinecraftColour_Sky_Forest, - eMinecraftColour_Sky_Taiga, - eMinecraftColour_Sky_Swampland, - eMinecraftColour_Sky_River, - eMinecraftColour_Sky_Hell, - eMinecraftColour_Sky_Sky, - eMinecraftColour_Sky_FrozenOcean, - eMinecraftColour_Sky_FrozenRiver, - eMinecraftColour_Sky_IcePlains, - eMinecraftColour_Sky_IceMountains, - eMinecraftColour_Sky_MushroomIsland, - eMinecraftColour_Sky_MushroomIslandShore, - eMinecraftColour_Sky_Beach, - eMinecraftColour_Sky_DesertHills, - eMinecraftColour_Sky_ForestHills, - eMinecraftColour_Sky_TaigaHills, - eMinecraftColour_Sky_ExtremeHillsEdge, - eMinecraftColour_Sky_Jungle, - eMinecraftColour_Sky_JungleHills, - - eMinecraftColour_Tile_RedstoneDust, - eMinecraftColour_Tile_RedstoneDustUnlit, - eMinecraftColour_Tile_RedstoneDustLitMin, - eMinecraftColour_Tile_RedstoneDustLitMax, - eMinecraftColour_Tile_StemMin, - eMinecraftColour_Tile_StemMax, - eMinecraftColour_Tile_WaterLily, - - eMinecraftColour_Sky_Dawn_Dark, - eMinecraftColour_Sky_Dawn_Bright, - - eMinecraftColour_Material_None, - eMinecraftColour_Material_Grass, - eMinecraftColour_Material_Sand, - eMinecraftColour_Material_Cloth, - eMinecraftColour_Material_Fire, - eMinecraftColour_Material_Ice, - eMinecraftColour_Material_Metal, - eMinecraftColour_Material_Plant, - eMinecraftColour_Material_Snow, - eMinecraftColour_Material_Clay, - eMinecraftColour_Material_Dirt, - eMinecraftColour_Material_Stone, - eMinecraftColour_Material_Water, - eMinecraftColour_Material_Wood, - eMinecraftColour_Material_Emerald, - - eMinecraftColour_Particle_Note_00, - eMinecraftColour_Particle_Note_01, - eMinecraftColour_Particle_Note_02, - eMinecraftColour_Particle_Note_03, - eMinecraftColour_Particle_Note_04, - eMinecraftColour_Particle_Note_05, - eMinecraftColour_Particle_Note_06, - eMinecraftColour_Particle_Note_07, - eMinecraftColour_Particle_Note_08, - eMinecraftColour_Particle_Note_09, - eMinecraftColour_Particle_Note_10, - eMinecraftColour_Particle_Note_11, - eMinecraftColour_Particle_Note_12, - eMinecraftColour_Particle_Note_13, - eMinecraftColour_Particle_Note_14, - eMinecraftColour_Particle_Note_15, - eMinecraftColour_Particle_Note_16, - eMinecraftColour_Particle_Note_17, - eMinecraftColour_Particle_Note_18, - eMinecraftColour_Particle_Note_19, - eMinecraftColour_Particle_Note_20, - eMinecraftColour_Particle_Note_21, - eMinecraftColour_Particle_Note_22, - eMinecraftColour_Particle_Note_23, - eMinecraftColour_Particle_Note_24, - - eMinecraftColour_Particle_NetherPortal, - eMinecraftColour_Particle_EnderPortal, - eMinecraftColour_Particle_Smoke, - eMinecraftColour_Particle_Ender, - eMinecraftColour_Particle_Explode, - eMinecraftColour_Particle_HugeExplosion, - eMinecraftColour_Particle_DripWater, - eMinecraftColour_Particle_DripLavaStart, - eMinecraftColour_Particle_DripLavaEnd, - eMinecraftColour_Particle_EnchantmentTable, - eMinecraftColour_Particle_DragonBreathMin, - eMinecraftColour_Particle_DragonBreathMax, - eMinecraftColour_Particle_Suspend, - eMinecraftColour_Particle_CritStart, - eMinecraftColour_Particle_CritEnd, - - eMinecraftColour_Effect_MovementSpeed, - eMinecraftColour_Effect_MovementSlowDown, - eMinecraftColour_Effect_DigSpeed, - eMinecraftColour_Effect_DigSlowdown, - eMinecraftColour_Effect_DamageBoost, - eMinecraftColour_Effect_Heal, - eMinecraftColour_Effect_Harm, - eMinecraftColour_Effect_Jump, - eMinecraftColour_Effect_Confusion, - eMinecraftColour_Effect_Regeneration, - eMinecraftColour_Effect_DamageResistance, - eMinecraftColour_Effect_FireResistance, - eMinecraftColour_Effect_WaterBreathing, - eMinecraftColour_Effect_Invisiblity, - eMinecraftColour_Effect_Blindness, - eMinecraftColour_Effect_NightVision, - eMinecraftColour_Effect_Hunger, - eMinecraftColour_Effect_Weakness, - eMinecraftColour_Effect_Poison, - - eMinecraftColour_Potion_BaseColour, - - eMinecraftColour_Mob_Creeper_Colour1, - eMinecraftColour_Mob_Creeper_Colour2, - eMinecraftColour_Mob_Skeleton_Colour1, - eMinecraftColour_Mob_Skeleton_Colour2, - eMinecraftColour_Mob_Spider_Colour1, - eMinecraftColour_Mob_Spider_Colour2, - eMinecraftColour_Mob_Zombie_Colour1, - eMinecraftColour_Mob_Zombie_Colour2, - eMinecraftColour_Mob_Slime_Colour1, - eMinecraftColour_Mob_Slime_Colour2, - eMinecraftColour_Mob_Ghast_Colour1, - eMinecraftColour_Mob_Ghast_Colour2, - eMinecraftColour_Mob_PigZombie_Colour1, - eMinecraftColour_Mob_PigZombie_Colour2, - eMinecraftColour_Mob_Enderman_Colour1, - eMinecraftColour_Mob_Enderman_Colour2, - eMinecraftColour_Mob_CaveSpider_Colour1, - eMinecraftColour_Mob_CaveSpider_Colour2, - eMinecraftColour_Mob_Silverfish_Colour1, - eMinecraftColour_Mob_Silverfish_Colour2, - eMinecraftColour_Mob_Blaze_Colour1, - eMinecraftColour_Mob_Blaze_Colour2, - eMinecraftColour_Mob_LavaSlime_Colour1, - eMinecraftColour_Mob_LavaSlime_Colour2, - eMinecraftColour_Mob_Pig_Colour1, - eMinecraftColour_Mob_Pig_Colour2, - eMinecraftColour_Mob_Sheep_Colour1, - eMinecraftColour_Mob_Sheep_Colour2, - eMinecraftColour_Mob_Cow_Colour1, - eMinecraftColour_Mob_Cow_Colour2, - eMinecraftColour_Mob_Chicken_Colour1, - eMinecraftColour_Mob_Chicken_Colour2, - eMinecraftColour_Mob_Squid_Colour1, - eMinecraftColour_Mob_Squid_Colour2, - eMinecraftColour_Mob_Wolf_Colour1, - eMinecraftColour_Mob_Wolf_Colour2, - eMinecraftColour_Mob_MushroomCow_Colour1, - eMinecraftColour_Mob_MushroomCow_Colour2, - eMinecraftColour_Mob_Ocelot_Colour1, - eMinecraftColour_Mob_Ocelot_Colour2, - eMinecraftColour_Mob_Villager_Colour1, - eMinecraftColour_Mob_Villager_Colour2, - - eMinecraftColour_Armour_Default_Leather_Colour, - - eMinecraftColour_Under_Water_Clear_Colour, - eMinecraftColour_Under_Lava_Clear_Colour, - eMinecraftColour_In_Cloud_Base_Colour, - - eMinecraftColour_Under_Water_Fog_Colour, - eMinecraftColour_Under_Lava_Fog_Colour, - eMinecraftColour_In_Cloud_Fog_Colour, - - eMinecraftColour_Default_Fog_Colour, - eMinecraftColour_Nether_Fog_Colour, - eMinecraftColour_End_Fog_Colour, - - eMinecraftColour_Sign_Text, - eMinecraftColour_Map_Text, - - eHTMLColor_0, - eHTMLColor_1, - eHTMLColor_2, - eHTMLColor_3, - eHTMLColor_4, - eHTMLColor_5, - eHTMLColor_6, - eHTMLColor_7, - eHTMLColor_8, - eHTMLColor_9, - eHTMLColor_a, - eHTMLColor_b, - eHTMLColor_c, - eHTMLColor_d, - eHTMLColor_e, - eHTMLColor_f, - eHTMLColor_0_dark, - eHTMLColor_1_dark, - eHTMLColor_2_dark, - eHTMLColor_3_dark, - eHTMLColor_4_dark, - eHTMLColor_5_dark, - eHTMLColor_6_dark, - eHTMLColor_7_dark, - eHTMLColor_8_dark, - eHTMLColor_9_dark, - eHTMLColor_a_dark, - eHTMLColor_b_dark, - eHTMLColor_c_dark, - eHTMLColor_d_dark, - eHTMLColor_e_dark, - eHTMLColor_f_dark, - eHTMLColor_T1, - eHTMLColor_T2, - eHTMLColor_T3, - eHTMLColor_Black, - eHTMLColor_White, - - eTextColor_Enchant, - eTextColor_EnchantFocus, - eTextColor_EnchantDisabled, - eTextColor_RenamedItemTitle, - - //eHTMLColor_0 = 0x000000, //r:0 , g: 0, b: 0, i: 0 - //eHTMLColor_1 = 0x0000aa, //r:0 , g: 0, b: aa, i: 1 - //eHTMLColor_2 = 0x109e10, // Changed by request of Dave //0x00aa00, //r:0 , g: aa, b: 0, i: 2 - //eHTMLColor_3 = 0x109e9e, // Changed by request of Dave //0x00aaaa, //r:0 , g: aa, b: aa, i: 3 - //eHTMLColor_4 = 0xaa0000, //r:aa , g: 0, b: 0, i: 4 - //eHTMLColor_5 = 0xaa00aa, //r:aa , g: 0, b: aa, i: 5 - //eHTMLColor_6 = 0xffaa00, //r:ff , g: aa, b: 0, i: 6 - //eHTMLColor_7 = 0xaaaaaa, //r:aa , g: aa, b: aa, i: 7 - //eHTMLColor_8 = 0x555555, //r:55 , g: 55, b: 55, i: 8 - //eHTMLColor_9 = 0x5555ff, //r:55 , g: 55, b: ff, i: 9 - //eHTMLColor_a = 0x55ff55, //r:55 , g: ff, b: 55, i: a - //eHTMLColor_b = 0x55ffff, //r:55 , g: ff, b: ff, i: b - //eHTMLColor_c = 0xff5555, //r:ff , g: 55, b: 55, i: c - //eHTMLColor_d = 0xff55ff, //r:ff , g: 55, b: ff, i: d - //eHTMLColor_e = 0xffff55, //r:ff , g: ff, b: 55, i: e - //eHTMLColor_f = 0xffffff, //r:ff , g: ff, b: ff, i: f - //eHTMLColor_0_dark = 0x000000, //r:0 , g: 0, b: 0, i: 10 - //eHTMLColor_1_dark = 0x00002a, //r:0 , g: 0, b: 2a, i: 11 - //eHTMLColor_2_dark = 0x002a00, //r:0 , g: 2a, b: 0, i: 12 - //eHTMLColor_3_dark = 0x002a2a, //r:0 , g: 2a, b: 2a, i: 13 - //eHTMLColor_4_dark = 0x2a0000, //r:2a , g: 0, b: 0, i: 14 - //eHTMLColor_5_dark = 0x2a002a, //r:2a , g: 0, b: 2a, i: 15 - //eHTMLColor_6_dark = 0x2a2a00, //r:2a , g: 2a, b: 0, i: 16 - //eHTMLColor_7_dark = 0x2a2a2a, //r:2a , g: 2a, b: 2a, i: 17 - //eHTMLColor_8_dark = 0x151515, //r:15 , g: 15, b: 15, i: 18 - //eHTMLColor_9_dark = 0x15153f, //r:15 , g: 15, b: 3f, i: 19 - //eHTMLColor_a_dark = 0x153f15, //r:15 , g: 3f, b: 15, i: 1a - //eHTMLColor_b_dark = 0x153f3f, //r:15 , g: 3f, b: 3f, i: 1b - //eHTMLColor_c_dark = 0x3f1515, //r:3f , g: 15, b: 15, i: 1c - //eHTMLColor_d_dark = 0x3f153f, //r:3f , g: 15, b: 3f, i: 1d - //eHTMLColor_e_dark = 0x3f3f15, //r:3f , g: 3f, b: 15, i: 1e - //eHTMLColor_f_dark = 0x3f3f3f, //r:3f , g: 3f, b: 3f, i: 1f - - eMinecraftColour_COUNT, +enum eDLCContentType { + e_DLC_SkinPack = 0, + e_DLC_TexturePacks, + e_DLC_MashupPacks, + e_DLC_Themes, + e_DLC_AvatarItems, + e_DLC_Gamerpics, + e_DLC_MAX_MinecraftStore, + e_DLC_TexturePackData, // for the icon, banner and text + e_DLC_MAX, + e_DLC_NotDefined, }; -enum eDLCContentType -{ - e_DLC_SkinPack=0, - e_DLC_TexturePacks, - e_DLC_MashupPacks, - e_DLC_Themes, - e_DLC_AvatarItems, - e_DLC_Gamerpics, - e_DLC_MAX_MinecraftStore, - e_DLC_TexturePackData, // for the icon, banner and text - e_DLC_MAX, - e_DLC_NotDefined, +enum eDLCMarketplaceType { + e_Marketplace_Content = 0, // skins, texture packs and mashup packs + e_Marketplace_Themes, + e_Marketplace_AvatarItems, + e_Marketplace_Gamerpics, + e_Marketplace_MAX, + e_Marketplace_NotDefined, }; -enum eDLCMarketplaceType -{ - e_Marketplace_Content=0, // skins, texture packs and mashup packs - e_Marketplace_Themes, - e_Marketplace_AvatarItems, - e_Marketplace_Gamerpics, - e_Marketplace_MAX, - e_Marketplace_NotDefined, +enum eDLCContentState { + e_DLC_ContentState_Idle = 0, + e_DLC_ContentState_Retrieving, + e_DLC_ContentState_Retrieved }; -enum eDLCContentState -{ - e_DLC_ContentState_Idle = 0, - e_DLC_ContentState_Retrieving, - e_DLC_ContentState_Retrieved +enum eTMSContentState { + e_TMS_ContentState_Idle = 0, + e_TMS_ContentState_Queued, + e_TMS_ContentState_Retrieving, + e_TMS_ContentState_Retrieved }; -enum eTMSContentState -{ - e_TMS_ContentState_Idle = 0, - e_TMS_ContentState_Queued, - e_TMS_ContentState_Retrieving, - e_TMS_ContentState_Retrieved +enum eXUID { + eXUID_Undefined = 0, + eXUID_NoName, // name not needed + eXUID_Notch, + eXUID_Carl, + eXUID_Daniel, + eXUID_Deadmau5, + eXUID_DannyBStyle, + eXUID_JulianClark, + eXUID_Millionth, + eXUID_4JPaddy, + eXUID_4JStuart, + eXUID_4JDavid, + eXUID_4JRichard, + eXUID_4JSteven, }; -enum eXUID -{ - eXUID_Undefined=0, - eXUID_NoName, // name not needed - eXUID_Notch, - eXUID_Carl, - eXUID_Daniel, - eXUID_Deadmau5, - eXUID_DannyBStyle, - eXUID_JulianClark, - eXUID_Millionth, - eXUID_4JPaddy, - eXUID_4JStuart, - eXUID_4JDavid, - eXUID_4JRichard, - eXUID_4JSteven, -}; - - -enum _eTerrainFeatureType -{ - eTerrainFeature_None=0, - eTerrainFeature_Stronghold, - eTerrainFeature_Mineshaft, - eTerrainFeature_Village, - eTerrainFeature_Ravine, - eTerrainFeature_NetherFortress, - eTerrainFeature_StrongholdEndPortal, - eTerrainFeature_Count +enum _eTerrainFeatureType { + eTerrainFeature_None = 0, + eTerrainFeature_Stronghold, + eTerrainFeature_Mineshaft, + eTerrainFeature_Village, + eTerrainFeature_Ravine, + eTerrainFeature_NetherFortress, + eTerrainFeature_StrongholdEndPortal, + eTerrainFeature_Count }; -// 4J Stu - Whend adding new options you should consider whether having them on should disable achievements, and if so add them to the CanRecordStatsAndAchievements function -// 4J Stu - These options are now saved in save data, so new options can ONLY be added to the end -enum eGameHostOption -{ - eGameHostOption_Difficulty=0, - eGameHostOption_OnlineGame, // Unused - eGameHostOption_InviteOnly, // Unused - eGameHostOption_FriendsOfFriends, - eGameHostOption_Gamertags, - eGameHostOption_Tutorial, // special case - eGameHostOption_GameType, - eGameHostOption_LevelType, // flat or default - eGameHostOption_Structures, - eGameHostOption_BonusChest, - eGameHostOption_HasBeenInCreative, - eGameHostOption_PvP, - eGameHostOption_TrustPlayers, - eGameHostOption_TNT, - eGameHostOption_FireSpreads, - eGameHostOption_CheatsEnabled, // special case - eGameHostOption_HostCanFly, - eGameHostOption_HostCanChangeHunger, - eGameHostOption_HostCanBeInvisible, - eGameHostOption_BedrockFog, - eGameHostOption_NoHUD, - eGameHostOption_All, +// 4J Stu - Whend adding new options you should consider whether having them on +// should disable achievements, and if so add them to the +// CanRecordStatsAndAchievements function 4J Stu - These options are now saved +// in save data, so new options can ONLY be added to the end +enum eGameHostOption { + eGameHostOption_Difficulty = 0, + eGameHostOption_OnlineGame, // Unused + eGameHostOption_InviteOnly, // Unused + eGameHostOption_FriendsOfFriends, + eGameHostOption_Gamertags, + eGameHostOption_Tutorial, // special case + eGameHostOption_GameType, + eGameHostOption_LevelType, // flat or default + eGameHostOption_Structures, + eGameHostOption_BonusChest, + eGameHostOption_HasBeenInCreative, + eGameHostOption_PvP, + eGameHostOption_TrustPlayers, + eGameHostOption_TNT, + eGameHostOption_FireSpreads, + eGameHostOption_CheatsEnabled, // special case + eGameHostOption_HostCanFly, + eGameHostOption_HostCanChangeHunger, + eGameHostOption_HostCanBeInvisible, + eGameHostOption_BedrockFog, + eGameHostOption_NoHUD, + eGameHostOption_WorldSize, + eGameHostOption_All, - eGameHostOption_DisableSaving, + eGameHostOption_DisableSaving, + eGameHostOption_WasntSaveOwner, // Added for PS3 save transfer, so we can + // add a nice message in the future instead + // of the creative mode one + + eGameHostOption_MobGriefing, + eGameHostOption_KeepInventory, + eGameHostOption_DoMobSpawning, + eGameHostOption_DoMobLoot, + eGameHostOption_DoTileDrops, + eGameHostOption_NaturalRegeneration, + eGameHostOption_DoDaylightCycle, }; -// 4J-PB - If any new DLC items are added to the TMSFiles, this array needs updated +// 4J-PB - If any new DLC items are added to the TMSFiles, this array needs +// updated #ifdef _XBOX -enum _TMSFILES -{ - TMS_SP1=0, - TMS_SP2, - TMS_SP3, - TMS_SP4, - TMS_SP5, - TMS_SP6, - TMS_SPF, - TMS_SPB, - TMS_SPC, - TMS_SPZ, - TMS_SPM, - TMS_SPI, - TMS_SPG, +enum _TMSFILES { + TMS_SP1 = 0, + TMS_SP2, + TMS_SP3, + TMS_SP4, + TMS_SP5, + TMS_SP6, + TMS_SPF, + TMS_SPB, + TMS_SPC, + TMS_SPZ, + TMS_SPM, + TMS_SPI, + TMS_SPG, + TMS_SPD1, + TMS_SPSW1, - TMS_THST, - TMS_THIR, - TMS_THGO, - TMS_THDI, - TMS_THAW, + TMS_THST, + TMS_THIR, + TMS_THGO, + TMS_THDI, + TMS_THAW, - TMS_GPAN, - TMS_GPCO, - TMS_GPEN, - TMS_GPFO, - TMS_GPTO, - TMS_GPBA, - TMS_GPFA, - TMS_GPME, - TMS_GPMF, - TMS_GPMM, - TMS_GPSE, - TMS_GPOr, - TMS_GPMi, - TMS_GPMB, - TMS_GPBr, - TMS_GPM1, - TMS_GPM2, - TMS_GPM3, + TMS_GPAN, + TMS_GPCO, + TMS_GPEN, + TMS_GPFO, + TMS_GPTO, + TMS_GPBA, + TMS_GPFA, + TMS_GPME, + TMS_GPMF, + TMS_GPMM, + TMS_GPSE, + TMS_GPOr, + TMS_GPMi, + TMS_GPMB, + TMS_GPBr, + TMS_GPM1, + TMS_GPM2, + TMS_GPM3, - TMS_AH_0001, - TMS_AH_0002, - TMS_AH_0003, - TMS_AH_0004, - TMS_AH_0005, - TMS_AH_0006, - TMS_AH_0007, - TMS_AH_0008, - TMS_AH_0009, - TMS_AH_0010, - TMS_AH_0011, - TMS_AH_0012, - TMS_AH_0013, + TMS_AH_0001, + TMS_AH_0002, + TMS_AH_0003, + TMS_AH_0004, + TMS_AH_0005, + TMS_AH_0006, + TMS_AH_0007, + TMS_AH_0008, + TMS_AH_0009, + TMS_AH_0010, + TMS_AH_0011, + TMS_AH_0012, + TMS_AH_0013, - TMS_AT_0001, - TMS_AT_0002, - TMS_AT_0003, - TMS_AT_0004, - TMS_AT_0005, - TMS_AT_0006, - TMS_AT_0007, - TMS_AT_0008, - TMS_AT_0009, - TMS_AT_0010, - TMS_AT_0011, - TMS_AT_0012, - TMS_AT_0013, - TMS_AT_0014, - TMS_AT_0015, - TMS_AT_0016, - TMS_AT_0017, - TMS_AT_0018, - TMS_AT_0019, - TMS_AT_0020, - TMS_AT_0021, - TMS_AT_0022, - TMS_AT_0023, - TMS_AT_0024, - TMS_AT_0025, - TMS_AT_0026, + TMS_AT_0001, + TMS_AT_0002, + TMS_AT_0003, + TMS_AT_0004, + TMS_AT_0005, + TMS_AT_0006, + TMS_AT_0007, + TMS_AT_0008, + TMS_AT_0009, + TMS_AT_0010, + TMS_AT_0011, + TMS_AT_0012, + TMS_AT_0013, + TMS_AT_0014, + TMS_AT_0015, + TMS_AT_0016, + TMS_AT_0017, + TMS_AT_0018, + TMS_AT_0019, + TMS_AT_0020, + TMS_AT_0021, + TMS_AT_0022, + TMS_AT_0023, + TMS_AT_0024, + TMS_AT_0025, + TMS_AT_0026, - TMS_AP_0001, - TMS_AP_0002, - TMS_AP_0003, - TMS_AP_0004, - TMS_AP_0005, - TMS_AP_0006, - TMS_AP_0007, - TMS_AP_0009, - TMS_AP_0010, - TMS_AP_0011, - TMS_AP_0012, - TMS_AP_0013, - TMS_AP_0014, - TMS_AP_0015, - TMS_AP_0016, - TMS_AP_0017, - TMS_AP_0018, + TMS_AP_0001, + TMS_AP_0002, + TMS_AP_0003, + TMS_AP_0004, + TMS_AP_0005, + TMS_AP_0006, + TMS_AP_0007, + TMS_AP_0009, + TMS_AP_0010, + TMS_AP_0011, + TMS_AP_0012, + TMS_AP_0013, + TMS_AP_0014, + TMS_AP_0015, + TMS_AP_0016, + TMS_AP_0017, + TMS_AP_0018, - TMS_AP_0019, - TMS_AP_0020, - TMS_AP_0021, - TMS_AP_0022, - TMS_AP_0023, - TMS_AP_0024, - TMS_AP_0025, - TMS_AP_0026, - TMS_AP_0027, - TMS_AP_0028, - TMS_AP_0029, - TMS_AP_0030, - TMS_AP_0031, - TMS_AP_0032, - TMS_AP_0033, + TMS_AP_0019, + TMS_AP_0020, + TMS_AP_0021, + TMS_AP_0022, + TMS_AP_0023, + TMS_AP_0024, + TMS_AP_0025, + TMS_AP_0026, + TMS_AP_0027, + TMS_AP_0028, + TMS_AP_0029, + TMS_AP_0030, + TMS_AP_0031, + TMS_AP_0032, + TMS_AP_0033, - TMS_AA_0001, + TMS_AA_0001, - TMS_MPMA, - TMS_MPMA_DAT, - TMS_MPSR, - TMS_MPSR_DAT, - TMS_MPHA, - TMS_MPHA_DAT, + TMS_MPMA, + TMS_MPMA_DAT, + TMS_MPSR, + TMS_MPSR_DAT, + TMS_MPHA, + TMS_MPHA_DAT, + TMS_MPFE, + TMS_MPFE_DAT, - TMS_TP01, - TMS_TP01_DAT, - TMS_TP02, - TMS_TP02_DAT, - TMS_TP04, - TMS_TP04_DAT, - TMS_TP05, - TMS_TP05_DAT, - TMS_TP06, - TMS_TP06_DAT, - TMS_TP07, - TMS_TP07_DAT, + TMS_TP01, + TMS_TP01_DAT, + TMS_TP02, + TMS_TP02_DAT, + TMS_TP04, + TMS_TP04_DAT, + TMS_TP05, + TMS_TP05_DAT, + TMS_TP06, + TMS_TP06_DAT, + TMS_TP07, + TMS_TP07_DAT, + TMS_TP08, + TMS_TP08_DAT, - TMS_COUNT + TMS_COUNT }; #endif -enum EHTMLFontSize -{ - eHTMLSize_Normal, - eHTMLSize_Splitscreen, - eHTMLSize_Tutorial, - eHTMLSize_EndPoem, +enum EHTMLFontSize { + eHTMLSize_Normal, + eHTMLSize_Splitscreen, + eHTMLSize_Tutorial, + eHTMLSize_EndPoem, - eHTMLSize_COUNT, + eHTMLSize_COUNT, }; -enum EControllerActions -{ - ACTION_MENU_A, - ACTION_MENU_B, - ACTION_MENU_X, - ACTION_MENU_Y, - ACTION_MENU_UP, - ACTION_MENU_DOWN, - ACTION_MENU_RIGHT, - ACTION_MENU_LEFT, - ACTION_MENU_PAGEUP, - ACTION_MENU_PAGEDOWN, - ACTION_MENU_RIGHT_SCROLL, - ACTION_MENU_LEFT_SCROLL, - ACTION_MENU_STICK_PRESS, - ACTION_MENU_OTHER_STICK_PRESS, - ACTION_MENU_OTHER_STICK_UP, - ACTION_MENU_OTHER_STICK_DOWN, - ACTION_MENU_OTHER_STICK_LEFT, - ACTION_MENU_OTHER_STICK_RIGHT, - ACTION_MENU_PAUSEMENU, +enum EControllerActions { + ACTION_MENU_A, + ACTION_MENU_B, + ACTION_MENU_X, + ACTION_MENU_Y, + ACTION_MENU_UP, + ACTION_MENU_DOWN, + ACTION_MENU_RIGHT, + ACTION_MENU_LEFT, + ACTION_MENU_PAGEUP, + ACTION_MENU_PAGEDOWN, + ACTION_MENU_RIGHT_SCROLL, + ACTION_MENU_LEFT_SCROLL, + ACTION_MENU_STICK_PRESS, + ACTION_MENU_OTHER_STICK_PRESS, + ACTION_MENU_OTHER_STICK_UP, + ACTION_MENU_OTHER_STICK_DOWN, + ACTION_MENU_OTHER_STICK_LEFT, + ACTION_MENU_OTHER_STICK_RIGHT, + ACTION_MENU_PAUSEMENU, #ifdef _DURANGO - ACTION_MENU_GTC_PAUSE, - ACTION_MENU_GTC_RESUME, + ACTION_MENU_GTC_PAUSE, + ACTION_MENU_GTC_RESUME, #endif #ifdef __ORBIS__ - ACTION_MENU_TOUCHPAD_PRESS, + ACTION_MENU_TOUCHPAD_PRESS, #endif - ACTION_MENU_OK, - ACTION_MENU_CANCEL, - // 4jcraft added, off by one - ACTION_MAX_MENU = ACTION_MENU_CANCEL + 1, + ACTION_MENU_OK, + ACTION_MENU_CANCEL, + // 4jcraft added, off by one + ACTION_MAX_MENU = ACTION_MENU_CANCEL + 1, - MINECRAFT_ACTION_JUMP, - MINECRAFT_ACTION_FORWARD, - MINECRAFT_ACTION_BACKWARD, - MINECRAFT_ACTION_LEFT, - MINECRAFT_ACTION_RIGHT, - MINECRAFT_ACTION_LOOK_LEFT, - MINECRAFT_ACTION_LOOK_RIGHT, - MINECRAFT_ACTION_LOOK_UP, - MINECRAFT_ACTION_LOOK_DOWN, - MINECRAFT_ACTION_USE, - MINECRAFT_ACTION_ACTION, - MINECRAFT_ACTION_LEFT_SCROLL, - MINECRAFT_ACTION_RIGHT_SCROLL, - MINECRAFT_ACTION_INVENTORY, - MINECRAFT_ACTION_PAUSEMENU, - MINECRAFT_ACTION_DROP, - MINECRAFT_ACTION_SNEAK_TOGGLE, - MINECRAFT_ACTION_SPRINT, - MINECRAFT_ACTION_CRAFTING, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - MINECRAFT_ACTION_GAME_INFO, - MINECRAFT_ACTION_DPAD_LEFT, - MINECRAFT_ACTION_DPAD_RIGHT, - MINECRAFT_ACTION_DPAD_UP, - MINECRAFT_ACTION_DPAD_DOWN, + MINECRAFT_ACTION_JUMP, + MINECRAFT_ACTION_FORWARD, + MINECRAFT_ACTION_BACKWARD, + MINECRAFT_ACTION_LEFT, + MINECRAFT_ACTION_RIGHT, + MINECRAFT_ACTION_LOOK_LEFT, + MINECRAFT_ACTION_LOOK_RIGHT, + MINECRAFT_ACTION_LOOK_UP, + MINECRAFT_ACTION_LOOK_DOWN, + MINECRAFT_ACTION_USE, + MINECRAFT_ACTION_ACTION, + MINECRAFT_ACTION_LEFT_SCROLL, + MINECRAFT_ACTION_RIGHT_SCROLL, + MINECRAFT_ACTION_INVENTORY, + MINECRAFT_ACTION_PAUSEMENU, + MINECRAFT_ACTION_DROP, + MINECRAFT_ACTION_SNEAK_TOGGLE, + MINECRAFT_ACTION_SPRINT, + MINECRAFT_ACTION_CRAFTING, + MINECRAFT_ACTION_RENDER_THIRD_PERSON, + MINECRAFT_ACTION_GAME_INFO, + MINECRAFT_ACTION_DPAD_LEFT, + MINECRAFT_ACTION_DPAD_RIGHT, + MINECRAFT_ACTION_DPAD_UP, + MINECRAFT_ACTION_DPAD_DOWN, - MINECRAFT_ACTION_MAX, + MINECRAFT_ACTION_MAX, - // These 4 aren't mapped to the input manager directly but are created from the dpad controls if required in Minecraft::run_middle - // Don't use them with the input manager directly, just through LocalPlayer::ullButtonsPressed - MINECRAFT_ACTION_SPAWN_CREEPER, - MINECRAFT_ACTION_CHANGE_SKIN, - MINECRAFT_ACTION_FLY_TOGGLE, - MINECRAFT_ACTION_RENDER_DEBUG + // These 4 aren't mapped to the input manager directly but are created from + // the dpad controls if required in Minecraft::run_middle Don't use them + // with the input manager directly, just through + // LocalPlayer::ullButtonsPressed + MINECRAFT_ACTION_SPAWN_CREEPER, + MINECRAFT_ACTION_CHANGE_SKIN, + MINECRAFT_ACTION_FLY_TOGGLE, + MINECRAFT_ACTION_RENDER_DEBUG }; -enum eMCLang -{ - eMCLang_null=0, - eMCLang_enUS, - eMCLang_enGB, - eMCLang_enIE, - eMCLang_enAU, - eMCLang_enNZ, - eMCLang_enCA, - eMCLang_jaJP, - eMCLang_deDE, - eMCLang_deAT, - eMCLang_frFR, - eMCLang_frCA, - eMCLang_esES, - eMCLang_esMX, - eMCLang_itIT, - eMCLang_koKR, - eMCLang_ptPT, - eMCLang_ptBR, - eMCLang_ruRU, - eMCLang_nlNL, - eMCLang_fiFI, - eMCLang_svSV, - eMCLang_daDA, - eMCLang_noNO, - eMCLang_plPL, - eMCLang_trTR, - eMCLang_elEL, - eMCLang_zhCHS, - eMCLang_zhCHT, - eMCLang_laLAS, +enum eMCLang { + eMCLang_null = 0, + eMCLang_enUS, + eMCLang_enGB, + eMCLang_enIE, + eMCLang_enAU, + eMCLang_enNZ, + eMCLang_enCA, + eMCLang_jaJP, + eMCLang_deDE, + eMCLang_deAT, + eMCLang_frFR, + eMCLang_frCA, + eMCLang_esES, + eMCLang_esMX, + eMCLang_itIT, + eMCLang_koKR, + eMCLang_ptPT, + eMCLang_ptBR, + eMCLang_ruRU, + eMCLang_nlNL, + eMCLang_fiFI, + eMCLang_svSV, + eMCLang_daDA, + eMCLang_noNO, + eMCLang_plPL, + eMCLang_trTR, + eMCLang_elEL, + eMCLang_csCS, + eMCLang_zhCHT, + eMCLang_laLAS, - eMCLang_zhSG, - eMCLang_zhCN, - eMCLang_zhHK, - eMCLang_zhTW, - eMCLang_nlBE, - eMCLang_daDK, - eMCLang_frBE, - eMCLang_frCH, - eMCLang_deCH, - eMCLang_nbNO, - eMCLang_enGR, - eMCLang_enHK, - eMCLang_enSA, - eMCLang_enHU, - eMCLang_enIN, - eMCLang_enIL, - eMCLang_enSG, - eMCLang_enSK, - eMCLang_enZA, - eMCLang_enCZ, - eMCLang_enAE, - eMCLang_esAR, - eMCLang_esCL, - eMCLang_esCO, - eMCLang_esUS, - eMCLang_svSE, + eMCLang_zhSG, + eMCLang_zhCN, + eMCLang_zhHK, + eMCLang_zhTW, + eMCLang_nlBE, + eMCLang_daDK, + eMCLang_frBE, + eMCLang_frCH, + eMCLang_deCH, + eMCLang_nbNO, + eMCLang_enGR, + eMCLang_enHK, + eMCLang_enSA, + eMCLang_enHU, + eMCLang_enIN, + eMCLang_enIL, + eMCLang_enSG, + eMCLang_enSK, + eMCLang_enZA, + eMCLang_enCZ, + eMCLang_enAE, + eMCLang_esAR, + eMCLang_esCL, + eMCLang_esCO, + eMCLang_esUS, + eMCLang_svSE, - eMCLang_csCZ, - eMCLang_elGR, - eMCLang_nnNO, - eMCLang_skSK, -}; + eMCLang_csCZ, + eMCLang_elGR, + eMCLang_nnNO, + eMCLang_skSK, + + eMCLang_hans, + eMCLang_hant, +}; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/App_structs.h b/Minecraft.Client/Platform/Common/App_structs.h index 40bca2709..dbd1c56bb 100644 --- a/Minecraft.Client/Platform/Common/App_structs.h +++ b/Minecraft.Client/Platform/Common/App_structs.h @@ -2,228 +2,209 @@ #include -typedef struct -{ - wchar_t *wchFilename; - eFileExtensionType eEXT; - eTMSFileType eTMSType; - std::uint8_t *pbData; - unsigned int uiSize; - int iConfig; // used for texture pack data files -} -TMS_FILE; +typedef struct { + wchar_t* wchFilename; + eFileExtensionType eEXT; + eTMSFileType eTMSType; + std::uint8_t* pbData; + unsigned int uiSize; + int iConfig; // used for texture pack data files +} TMS_FILE; -typedef struct -{ - std::uint8_t *pbData; - unsigned int byteCount; - std::uint8_t ucRefCount; -} -MEMDATA,*PMEMDATA; +typedef struct { + std::uint8_t* pbData; + unsigned int byteCount; + std::uint8_t ucRefCount; +} MEMDATA, *PMEMDATA; -typedef struct -{ - unsigned int dwNotification; - unsigned int uiParam; -} -NOTIFICATION,*PNOTIFICATION; +typedef struct { + unsigned int dwNotification; + unsigned int uiParam; +} NOTIFICATION, *PNOTIFICATION; -typedef struct -{ - bool bSettingsChanged; - unsigned char ucMusicVolume; - unsigned char ucSoundFXVolume; - unsigned char ucSensitivity; - unsigned char ucGamma; - unsigned char ucPad01; // 1 byte of padding inserted here - unsigned short usBitmaskValues; // bit 0,1 - difficulty - // bit 2 - view bob - // bit 3 - player visible in a map - // bit 4,5 - control scheme - // bit 6 - invert look - // bit 7 - southpaw - // bit 8 - splitscreen vertical +typedef struct { + bool bSettingsChanged; + unsigned char ucMusicVolume; + unsigned char ucSoundFXVolume; + unsigned char ucSensitivity; + unsigned char ucGamma; + unsigned char ucPad01; // 1 byte of padding inserted here + unsigned short usBitmaskValues; // bit 0,1 - difficulty + // bit 2 - view bob + // bit 3 - player visible in a map + // bit 4,5 - control scheme + // bit 6 - invert look + // bit 7 - southpaw + // bit 8 - splitscreen vertical - // 4J-PB - Adding new values for interim TU for 1.6.6 - // bit 9 - Display gamertags in splitscreen - // bit 10 - Disable/Enable hints - // bit 11,12,13,14 - Autosave frequency - 0 = Off, 8 = (8*15 minutes) = 2 hours - // bit 15 Tooltips + // 4J-PB - Adding new values for interim TU for 1.6.6 + // bit 9 - Display gamertags in splitscreen + // bit 10 - Disable/Enable hints + // bit 11,12,13,14 - Autosave frequency - 0 = Off, 8 = (8*15 minutes) + // = 2 hours bit 15 Tooltips - // debug values - unsigned int uiDebugBitmask; + // debug values + unsigned int uiDebugBitmask; - // block off space to use for whatever we want (e.g bitflags for storing things the player has done in the game, so we can flag the first time they do things, such as sleep) - union - { - struct - { - unsigned char ucTutorialCompletion[TUTORIAL_PROFILE_STORAGE_BYTES]; - // adding new flags for interim TU to 1.6.6 + // block off space to use for whatever we want (e.g bitflags for storing + // things the player has done in the game, so we can flag the first time + // they do things, such as sleep) + union { + struct { + unsigned char ucTutorialCompletion[TUTORIAL_PROFILE_STORAGE_BYTES]; + // adding new flags for interim TU to 1.6.6 - // A value that encodes the skin that the player has set as their default - std::uint32_t dwSelectedSkin; + // A value that encodes the skin that the player has set as their + // default + std::uint32_t dwSelectedSkin; - // In-Menu sensitivity - unsigned char ucMenuSensitivity; - unsigned char ucInterfaceOpacity; - unsigned char ucPad02;//2 bytes of padding added here - unsigned char usPad03; + // In-Menu sensitivity + unsigned char ucMenuSensitivity; + unsigned char ucInterfaceOpacity; + unsigned char ucPad02; // 2 bytes of padding added here + unsigned char usPad03; - // Adding another bitmask flag for more settings for 1.8.2 - unsigned int uiBitmaskValues; // 0x00000001 - eGameSetting_Clouds - on - // 0x00000002 - eGameSetting_GameSetting_Online - on - // 0x00000004 - eGameSetting_GameSetting_Invite - off - // 0x00000008 - eGameSetting_GameSetting_FriendsOfFriends - on - // 0x00000010 - eGameSetting_PSVita_NetworkModeAdhoc - on + // Adding another bitmask flag for more settings for 1.8.2 + unsigned int + uiBitmaskValues; // 0x00000001 - eGameSetting_Clouds - on + // 0x00000002 - eGameSetting_GameSetting_Online - on + // 0x00000004 - eGameSetting_GameSetting_Invite - off + // 0x00000008 - eGameSetting_GameSetting_FriendsOfFriends - on + // 0x00000010 - eGameSetting_PSVita_NetworkModeAdhoc - on - // TU 5 - // 0x00000030 - eGameSetting_DisplayUpdateMessage - 3 - counts down to zero - // TU 6 - // 0x00000040 - eGameSetting_BedrockFog - off - // 0x00000080 - eGameSetting_DisplayHUD - on - // 0x00000100 - eGameSetting_DisplayHand - on - // TU 7 - // 0x00000200 - eGameSetting_CustomSkinAnim - on + // TU 5 + // 0x00000030 - eGameSetting_DisplayUpdateMessage - 3 - counts down + // to zero TU 6 0x00000040 - eGameSetting_BedrockFog - off + // 0x00000080 - eGameSetting_DisplayHUD - on + // 0x00000100 - eGameSetting_DisplayHand - on + // TU 7 + // 0x00000200 - eGameSetting_CustomSkinAnim - on - // TU9 // 0x00000400 - eGameSetting_DeathMessages - on + // TU9 + // // 0x00000400 - eGameSetting_DeathMessages - on - // Adding another bitmask to store "special" completion tasks for the tutorial - unsigned int uiSpecialTutorialBitmask; + // Adding another bitmask to store "special" completion tasks for + // the tutorial + unsigned int uiSpecialTutorialBitmask; - // A value that encodes the cape that the player has set - std::uint32_t dwSelectedCape; + // A value that encodes the cape that the player has set + std::uint32_t dwSelectedCape; - unsigned int uiFavoriteSkinA[MAX_FAVORITE_SKINS]; - unsigned char ucCurrentFavoriteSkinPos; - - // TU13 - unsigned int uiMashUpPackWorldsDisplay; // bitmask to enable/disable the display of the individual mash-up pack worlds + unsigned int uiFavoriteSkinA[MAX_FAVORITE_SKINS]; + unsigned char ucCurrentFavoriteSkinPos; - // PS3 1.05 - Adding Greek, so need a language - unsigned char ucLanguage; - // 4J Stu - See comment for GAME_SETTINGS_PROFILE_DATA_BYTES below - // was 192 - //unsigned char ucUnused[192-TUTORIAL_PROFILE_STORAGE_BYTES-sizeof(DWORD)-sizeof(char)-sizeof(char)-sizeof(char)-sizeof(char)-sizeof(LONG)-sizeof(LONG)-sizeof(DWORD)]; - // 4J-PB - don't need to define the padded space, the union with ucReservedSpace will make the sizeof GAME_SETTINGS correct - }; + // TU13 + unsigned int + uiMashUpPackWorldsDisplay; // bitmask to enable/disable the + // display of the individual mash-up + // pack worlds - unsigned char ucReservedSpace[192]; + // PS3 1.05 - Adding Greek, so need a language + unsigned char ucLanguage; + // 29/Oct/2014 - Language selector. + unsigned char ucLocale; - }; -} -GAME_SETTINGS; + // 4J Stu - See comment for GAME_SETTINGS_PROFILE_DATA_BYTES below + // was 192 + // unsigned char + // ucUnused[192-TUTORIAL_PROFILE_STORAGE_BYTES-sizeof(DWORD)-sizeof(char)-sizeof(char)-sizeof(char)-sizeof(char)-sizeof(LONG)-sizeof(LONG)-sizeof(DWORD)]; + // 4J-PB - don't need to define the padded space, the union with + // ucReservedSpace will make the sizeof GAME_SETTINGS correct + }; + + unsigned char ucReservedSpace[192]; + }; +} GAME_SETTINGS; #ifdef _XBOX_ONE -typedef struct -{ - WCHAR wchPlayerUID[64]; - char pszLevelName[14]; -} -BANNEDLISTDATA,*PBANNEDLISTDATA; +typedef struct { + WCHAR wchPlayerUID[64]; + char pszLevelName[14]; +} BANNEDLISTDATA, *PBANNEDLISTDATA; #else -typedef struct -{ - PlayerUID xuid; - char pszLevelName[14]; -} -BANNEDLISTDATA,*PBANNEDLISTDATA; +typedef struct { + PlayerUID xuid; + char pszLevelName[14]; +} BANNEDLISTDATA, *PBANNEDLISTDATA; #endif -typedef std::vector VBANNEDLIST; +typedef std::vector VBANNEDLIST; -typedef struct -{ - int iPad; - eXuiAction action; -} -XuiActionParam; +typedef struct { + int iPad; + eXuiAction action; +} XuiActionParam; // tips -typedef struct -{ - int iSortValue; - int uiStringID; -} -TIPSTRUCT; +typedef struct { + int iSortValue; + int uiStringID; +} TIPSTRUCT; +typedef struct { + eXUID eXuid; + WCHAR wchCape[MAX_CAPENAME_SIZE]; + WCHAR wchSkin[MAX_CAPENAME_SIZE]; +} MOJANG_DATA; -typedef struct -{ - eXUID eXuid; - WCHAR wchCape[MAX_CAPENAME_SIZE]; - WCHAR wchSkin[MAX_CAPENAME_SIZE]; -} -MOJANG_DATA; - -typedef struct -{ - eDLCContentType eDLCType; -#if defined( __PS3__) || defined(__ORBIS__) || defined (__PSVITA__) - char chImageURL[256];//SCE_NP_COMMERCE2_URL_LEN +typedef struct { + eDLCContentType eDLCType; +#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) + char chImageURL[256]; // SCE_NP_COMMERCE2_URL_LEN #else #ifdef _XBOX_ONE - std::wstring wsProductId; - std::wstring wsDisplayName; + std::wstring wsProductId; + std::wstring wsDisplayName; - // add a store for the local DLC image - std::uint8_t *pbImageData; - unsigned int dwImageBytes; + // add a store for the local DLC image + std::uint8_t* pbImageData; + unsigned int dwImageBytes; #else - ULONGLONG ullOfferID_Full; - ULONGLONG ullOfferID_Trial; + ULONGLONG ullOfferID_Full; + ULONGLONG ullOfferID_Trial; #endif - WCHAR wchBanner[MAX_BANNERNAME_SIZE]; - WCHAR wchDataFile[MAX_BANNERNAME_SIZE]; - int iGender; + WCHAR wchBanner[MAX_BANNERNAME_SIZE]; + WCHAR wchDataFile[MAX_BANNERNAME_SIZE]; + int iGender; #endif - int iConfig; - unsigned int uiSortIndex; -} -DLC_INFO; + int iConfig; + unsigned int uiSortIndex; +} DLC_INFO; - -typedef struct -{ - int x,z; - _eTerrainFeatureType eTerrainFeature; -} -FEATURE_DATA; +typedef struct { + int x, z; + _eTerrainFeatureType eTerrainFeature; +} FEATURE_DATA; // banned list -typedef struct -{ - std::uint8_t *pBannedList; - unsigned int byteCount; -} -BANNEDLIST; +typedef struct { + std::uint8_t* pBannedList; + unsigned int byteCount; +} BANNEDLIST; -typedef struct _DLCRequest -{ - std::uint32_t dwType; - eDLCContentState eState; -} -DLCRequest; +typedef struct _DLCRequest { + std::uint32_t dwType; + eDLCContentState eState; +} DLCRequest; -typedef struct _TMSPPRequest -{ - eTMSContentState eState; - eDLCContentType eType; - C4JStorage::eGlobalStorage eStorageFacility; - C4JStorage::eTMS_FILETYPEVAL eFileTypeVal; - //char szFilename[MAX_TMSFILENAME_SIZE]; +typedef struct _TMSPPRequest { + eTMSContentState eState; + eDLCContentType eType; + C4JStorage::eGlobalStorage eStorageFacility; + C4JStorage::eTMS_FILETYPEVAL eFileTypeVal; + // char szFilename[MAX_TMSFILENAME_SIZE]; #ifdef _XBOX_ONE - int( *CallbackFunc)(void *,int,int,void *, WCHAR *); + int (*CallbackFunc)(void*, int, int, void*, WCHAR*); #else - int( *CallbackFunc)(void *,int,int,C4JStorage::PTMSPP_FILEDATA, LPCSTR szFilename); + int (*CallbackFunc)(void*, int, int, C4JStorage::PTMSPP_FILEDATA, + LPCSTR szFilename); #endif - WCHAR wchFilename[MAX_TMSFILENAME_SIZE]; + WCHAR wchFilename[MAX_TMSFILENAME_SIZE]; - void *lpCallbackParam; -} -TMSPPRequest; + void* lpCallbackParam; +} TMSPPRequest; typedef std::pair SceneStackPair; diff --git a/Minecraft.Client/Platform/Common/Audio/Consoles_SoundEngine.h b/Minecraft.Client/Platform/Common/Audio/Consoles_SoundEngine.h index 9b2dc5077..9a174a4ba 100644 --- a/Minecraft.Client/Platform/Common/Audio/Consoles_SoundEngine.h +++ b/Minecraft.Client/Platform/Common/Audio/Consoles_SoundEngine.h @@ -77,6 +77,26 @@ public: static const WCHAR* wchSoundNames[eSoundType_MAX]; static const WCHAR* wchUISoundNames[eSFX_MAX]; +public: + void tick(); + void schedule(int iSound, float x, float y, float z, float volume, + float pitch, int delayTicks); + +private: + class ScheduledSound { + public: + int iSound; + float x, y, z; + float volume, pitch; + int delay; + + public: + ScheduledSound(int iSound, float x, float y, float z, float volume, + float pitch, int delay); + }; + + std::vector scheduledSounds; + private: // platform specific functions diff --git a/Minecraft.Client/Platform/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Platform/Common/Audio/SoundEngine.cpp index 65b6270a8..d9b52d283 100644 --- a/Minecraft.Client/Platform/Common/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Platform/Common/Audio/SoundEngine.cpp @@ -1327,6 +1327,12 @@ void SoundEngine::updateMiles() { case eSoundType_MOB_ENDERDRAGON_HIT: distanceScaler = 100.0f; break; + case eSoundType_FIREWORKS_BLAST: + case eSoundType_FIREWORKS_BLAST_FAR: + case eSoundType_FIREWORKS_LARGE_BLAST: + case eSoundType_FIREWORKS_LARGE_BLAST_FAR: + distanceScaler = 100.0f; + break; case eSoundType_MOB_GHAST_MOAN: case eSoundType_MOB_GHAST_SCREAM: case eSoundType_MOB_GHAST_DEATH: @@ -2381,4 +2387,42 @@ bool SoundEngine::isStreamingWavebankReady() { return true; } char* SoundEngine::ConvertSoundPathToName(const std::wstring& name, bool bConvertSpaces) { return NULL; +} + +void ConsoleSoundEngine::tick() { + if (scheduledSounds.empty()) { + return; + } + + for (AUTO_VAR(it, scheduledSounds.begin()); it != scheduledSounds.end();) { + SoundEngine::ScheduledSound* next = *it; + next->delay--; + + if (next->delay <= 0) { + play(next->iSound, next->x, next->y, next->z, next->volume, + next->pitch); + it = scheduledSounds.erase(it); + delete next; + } else { + ++it; + } + } +} + +void ConsoleSoundEngine::schedule(int iSound, float x, float y, float z, + float volume, float pitch, int delayTicks) { + scheduledSounds.push_back(new SoundEngine::ScheduledSound( + iSound, x, y, z, volume, pitch, delayTicks)); +} + +ConsoleSoundEngine::ScheduledSound::ScheduledSound(int iSound, float x, float y, + float z, float volume, + float pitch, int delay) { + this->iSound = iSound; + this->x = x; + this->y = y; + this->z = z; + this->volume = volume; + this->pitch = pitch; + this->delay = delay; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Audio/SoundNames.cpp b/Minecraft.Client/Platform/Common/Audio/SoundNames.cpp index 981eb9183..1fd88fccf 100644 --- a/Minecraft.Client/Platform/Common/Audio/SoundNames.cpp +++ b/Minecraft.Client/Platform/Common/Audio/SoundNames.cpp @@ -3,66 +3,66 @@ #include "Consoles_SoundEngine.h" const WCHAR* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = { - L"mob/chicken/chicken", // eSoundType_MOB_CHICKEN_AMBIENT - L"mob/chicken/chickenhurt", // eSoundType_MOB_CHICKEN_HURT - L"mob/chicken/chickenplop", // eSoundType_MOB_CHICKENPLOP - L"mob/cow/say", // eSoundType_MOB_COW_AMBIENT - L"mob/cow/hurt", // eSoundType_MOB_COW_HURT - L"mob/pig/pig", // eSoundType_MOB_PIG_AMBIENT - L"mob/pig/pigdeath", // eSoundType_MOB_PIG_DEATH - L"mob/sheep/sheep", // eSoundType_MOB_SHEEP_AMBIENT - L"mob/wolf/growl", // eSoundType_MOB_WOLF_GROWL - L"mob/wolf/whine", // eSoundType_MOB_WOLF_WHINE - L"mob/wolf/panting", // eSoundType_MOB_WOLF_PANTING - L"mob/wolf/bark", // eSoundType_MOB_WOLF_BARK - L"mob/wolf/hurt", // eSoundType_MOB_WOLF_HURT - L"mob/wolf/death", // eSoundType_MOB_WOLF_DEATH - L"mob/wolf/shake", // eSoundType_MOB_WOLF_SHAKE - L"mob/blaze/breathe", // eSoundType_MOB_BLAZE_BREATHE - L"mob/blaze/hit", // eSoundType_MOB_BLAZE_HURT - L"mob/blaze/death", // eSoundType_MOB_BLAZE_DEATH - L"mob/ghast/moan", // eSoundType_MOB_GHAST_MOAN - L"mob/ghast/scream", // eSoundType_MOB_GHAST_SCREAM - L"mob/ghast/death", // eSoundType_MOB_GHAST_DEATH - L"mob/ghast/fireball", // eSoundType_MOB_GHAST_FIREBALL - L"mob/ghast/charge", // eSoundType_MOB_GHAST_CHARGE - L"mob/endermen/idle", // eSoundType_MOB_ENDERMEN_IDLE - L"mob/endermen/hit", // eSoundType_MOB_ENDERMEN_HIT - L"mob/endermen/death", // eSoundType_MOB_ENDERMEN_DEATH - L"mob/endermen/portal", // eSoundType_MOB_ENDERMEN_PORTAL - L"mob/zombiepig/zpig", // eSoundType_MOB_ZOMBIEPIG_AMBIENT - L"mob/zombiepig/zpighurt", // eSoundType_MOB_ZOMBIEPIG_HURT - L"mob/zombiepig/zpigdeath", // eSoundType_MOB_ZOMBIEPIG_DEATH - L"mob/zombiepig/zpigangry", // eSoundType_MOB_ZOMBIEPIG_ZPIGANGRY - L"mob/silverfish/say", // eSoundType_MOB_SILVERFISH_AMBIENT, - L"mob/silverfish/hit", // eSoundType_MOB_SILVERFISH_HURT - L"mob/silverfish/kill", // eSoundType_MOB_SILVERFISH_DEATH, - L"mob/silverfish/step", // eSoundType_MOB_SILVERFISH_STEP, - L"mob/skeleton/skeleton", // eSoundType_MOB_SKELETON_AMBIENT, - L"mob/skeleton/skeletonhurt", // eSoundType_MOB_SKELETON_HURT, - L"mob/spider/spider", // eSoundType_MOB_SPIDER_AMBIENT, - L"mob/spider/spiderdeath", // eSoundType_MOB_SPIDER_DEATH, - L"mob/slime/slime", // eSoundType_MOB_SLIME, - L"mob/slime/slimeattack", // eSoundType_MOB_SLIME_ATTACK, - L"mob/creeper/creeper", // eSoundType_MOB_CREEPER_HURT, - L"mob/creeper/creeperdeath", // eSoundType_MOB_CREEPER_DEATH, - L"mob/zombie/zombie", // eSoundType_MOB_ZOMBIE_AMBIENT, - L"mob/zombie/zombiehurt", // eSoundType_MOB_ZOMBIE_HURT, - L"mob/zombie/zombiedeath", // eSoundType_MOB_ZOMBIE_DEATH, - L"mob/zombie/wood", // eSoundType_MOB_ZOMBIE_WOOD, - L"mob/zombie/woodbreak", // eSoundType_MOB_ZOMBIE_WOOD_BREAK, - L"mob/zombie/metal", // eSoundType_MOB_ZOMBIE_METAL, - L"mob/magmacube/big", // eSoundType_MOB_MAGMACUBE_BIG, - L"mob/magmacube/small", // eSoundType_MOB_MAGMACUBE_SMALL, - L"mob/cat/purr", // eSoundType_MOB_CAT_PURR - L"mob/cat/purreow", // eSoundType_MOB_CAT_PURREOW - L"mob/cat/meow", // eSoundType_MOB_CAT_MEOW + L"mob/chicken/chicken", // eSoundType_MOB_CHICKEN_AMBIENT + L"mob/chicken/chickenhurt", // eSoundType_MOB_CHICKEN_HURT + L"mob/chicken/chickenplop", // eSoundType_MOB_CHICKENPLOP + L"mob/cow/say", // eSoundType_MOB_COW_AMBIENT + L"mob/cow/hurt", // eSoundType_MOB_COW_HURT + L"mob/pig/pig", // eSoundType_MOB_PIG_AMBIENT + L"mob/pig/pigdeath", // eSoundType_MOB_PIG_DEATH + L"mob/sheep/sheep", // eSoundType_MOB_SHEEP_AMBIENT + L"mob/wolf/growl", // eSoundType_MOB_WOLF_GROWL + L"mob/wolf/whine", // eSoundType_MOB_WOLF_WHINE + L"mob/wolf/panting", // eSoundType_MOB_WOLF_PANTING + L"mob/wolf/bark", // eSoundType_MOB_WOLF_BARK + L"mob/wolf/hurt", // eSoundType_MOB_WOLF_HURT + L"mob/wolf/death", // eSoundType_MOB_WOLF_DEATH + L"mob/wolf/shake", // eSoundType_MOB_WOLF_SHAKE + L"mob/blaze/breathe", // eSoundType_MOB_BLAZE_BREATHE + L"mob/blaze/hit", // eSoundType_MOB_BLAZE_HURT + L"mob/blaze/death", // eSoundType_MOB_BLAZE_DEATH + L"mob/ghast/moan", // eSoundType_MOB_GHAST_MOAN + L"mob/ghast/scream", // eSoundType_MOB_GHAST_SCREAM + L"mob/ghast/death", // eSoundType_MOB_GHAST_DEATH + L"mob/ghast/fireball", // eSoundType_MOB_GHAST_FIREBALL + L"mob/ghast/charge", // eSoundType_MOB_GHAST_CHARGE + L"mob/endermen/idle", // eSoundType_MOB_ENDERMEN_IDLE + L"mob/endermen/hit", // eSoundType_MOB_ENDERMEN_HIT + L"mob/endermen/death", // eSoundType_MOB_ENDERMEN_DEATH + L"mob/endermen/portal", // eSoundType_MOB_ENDERMEN_PORTAL + L"mob/zombiepig/zpig", // eSoundType_MOB_ZOMBIEPIG_AMBIENT + L"mob/zombiepig/zpighurt", // eSoundType_MOB_ZOMBIEPIG_HURT + L"mob/zombiepig/zpigdeath", // eSoundType_MOB_ZOMBIEPIG_DEATH + L"mob/zombiepig/zpigangry", // eSoundType_MOB_ZOMBIEPIG_ZPIGANGRY + L"mob/silverfish/say", // eSoundType_MOB_SILVERFISH_AMBIENT, + L"mob/silverfish/hit", // eSoundType_MOB_SILVERFISH_HURT + L"mob/silverfish/kill", // eSoundType_MOB_SILVERFISH_DEATH, + L"mob/silverfish/step", // eSoundType_MOB_SILVERFISH_STEP, + L"mob/skeleton/skeleton", // eSoundType_MOB_SKELETON_AMBIENT, + L"mob/skeleton/skeletonhurt", // eSoundType_MOB_SKELETON_HURT, + L"mob/spider/spider", // eSoundType_MOB_SPIDER_AMBIENT, + L"mob/spider/spiderdeath", // eSoundType_MOB_SPIDER_DEATH, + L"mob/slime/slime", // eSoundType_MOB_SLIME, + L"mob/slime/slimeattack", // eSoundType_MOB_SLIME_ATTACK, + L"mob/creeper/creeper", // eSoundType_MOB_CREEPER_HURT, + L"mob/creeper/creeperdeath", // eSoundType_MOB_CREEPER_DEATH, + L"mob/zombie/zombie", // eSoundType_MOB_ZOMBIE_AMBIENT, + L"mob/zombie/zombiehurt", // eSoundType_MOB_ZOMBIE_HURT, + L"mob/zombie/zombiedeath", // eSoundType_MOB_ZOMBIE_DEATH, + L"mob/zombie/wood", // eSoundType_MOB_ZOMBIE_WOOD, + L"mob/zombie/woodbreak", // eSoundType_MOB_ZOMBIE_WOOD_BREAK, + L"mob/zombie/metal", // eSoundType_MOB_ZOMBIE_METAL, + L"mob/magmacube/big", // eSoundType_MOB_MAGMACUBE_BIG, + L"mob/magmacube/small", // eSoundType_MOB_MAGMACUBE_SMALL, + L"mob/cat/purr", // eSoundType_MOB_CAT_PURR + L"mob/cat/purreow", // eSoundType_MOB_CAT_PURREOW + L"mob/cat/meow", // eSoundType_MOB_CAT_MEOW // 4J-PB - correct the name of the event for hitting ocelots - L"mob/cat/hit", // eSoundType_MOB_CAT_HITT - // L"mob/irongolem/throw", // - // eSoundType_MOB_IRONGOLEM_THROW L"mob/irongolem/hit", - //// eSoundType_MOB_IRONGOLEM_HIT L"mob/irongolem/death", - //// eSoundType_MOB_IRONGOLEM_DEATH L"mob/irongolem/walk", + L"mob/cat/hitt", // eSoundType_MOB_CAT_HITT + // L"mob.irongolem.throw", // + //eSoundType_MOB_IRONGOLEM_THROW L"mob.irongolem.hit", + //// eSoundType_MOB_IRONGOLEM_HIT L"mob.irongolem.death", + //// eSoundType_MOB_IRONGOLEM_DEATH L"mob.irongolem.walk", //// eSoundType_MOB_IRONGOLEM_WALK L"random/bow", // eSoundType_RANDOM_BOW, L"random/bowhit", // eSoundType_RANDOM_BOW_HIT, @@ -78,8 +78,8 @@ const WCHAR* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = { L"random/glass", // eSoundType_RANDOM_GLASS, L"random/orb", // eSoundType_RANDOM_ORB, L"random/break", // eSoundType_RANDOM_BREAK, - L"block/chest/open", // eSoundType_RANDOM_CHEST_OPEN, - L"block/chest/close", // eSoundType_RANDOM_CHEST_CLOSE, + L"random/chestopen", // eSoundType_RANDOM_CHEST_OPEN, + L"random/chestclosed", // eSoundType_RANDOM_CHEST_CLOSE, L"random/door_open", // eSoundType_RANDOM_DOOR_OPEN, L"random/door_close", // eSoundType_RANDOM_DOOR_CLOSE, L"ambient/weather/rain", // eSoundType_AMBIENT_WEATHER_RAIN, @@ -87,17 +87,16 @@ const WCHAR* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = { L"ambient/cave/cave", // eSoundType_CAVE_CAVE, DON'T USE FOR XBOX 360!!! #ifdef _XBOX L"ambient/cave/cave2", // eSoundType_CAVE_CAVE2 - removed the two sounds - // that were at 192k in the first ambient cave event + //that were at 192k in the first ambient cave event #endif L"portal/portal", // eSoundType_PORTAL_PORTAL, // 4J-PB - added a couple that were still using std::wstring L"portal/trigger", // eSoundType_PORTAL_TRIGGER L"portal/travel", // eSoundType_PORTAL_TRAVEL - L"fire/new_ignite", // eSoundType_FIRE_IGNITE, - L"fire/fire", // eSoundType_FIRE_FIRE, - // Renamed to damage/hit as the other file doesn't exist - L"damage/hit", // eSoundType_DAMAGE_HURT, + L"fire/ignite", // eSoundType_FIRE_IGNITE, + L"fire/fire", // eSoundType_FIRE_FIRE, + L"damage/hit", // eSoundType_DAMAGE_HURT, L"damage/fallsmall", // eSoundType_DAMAGE_FALL_SMALL, L"damage/fallbig", // eSoundType_DAMAGE_FALL_BIG, L"note/harp", // eSoundType_NOTE_HARP, @@ -105,8 +104,8 @@ const WCHAR* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = { L"note/snare", // eSoundType_NOTE_SNARE, L"note/hat", // eSoundType_NOTE_HAT, L"note/bassattack", // eSoundType_NOTE_BASSATTACK, - L"tile/piston/in", // eSoundType_TILE_PISTON_IN, - L"tile/piston/out", // eSoundType_TILE_PISTON_OUT, + L"tile/piston.in", // eSoundType_TILE_PISTON_IN, + L"tile/piston.out", // eSoundType_TILE_PISTON_OUT, L"liquid/water", // eSoundType_LIQUID_WATER, L"liquid/lavapop", // eSoundType_LIQUID_LAVA_POP, L"liquid/lava", // eSoundType_LIQUID_LAVA, @@ -129,7 +128,6 @@ const WCHAR* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = { L"mob/irongolem/walk", // eSoundType_MOB_IRONGOLEM_WALK // TU14 - // For some reason damage/thorns is missing... L"damage/thorns", // eSoundType_DAMAGE_THORNS L"random/anvil_break", // eSoundType_RANDOM_ANVIL_BREAK L"random/anvil_land", // eSoundType_RANDOM_ANVIL_LAND @@ -152,6 +150,82 @@ const WCHAR* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = { L"dig/snow", // eSoundType_DIG_SNOW L"dig/stone", // eSoundType_DIG_STONE L"dig/wood", // eSoundType_DIG_WOOD + + // 1.6.4 + L"fireworks/launch", // eSoundType_FIREWORKS_LAUNCH, + L"fireworks/blast", // eSoundType_FIREWORKS_BLAST, + L"fireworks/blast_far", // eSoundType_FIREWORKS_BLAST_FAR, + L"fireworks/large_blast", // eSoundType_FIREWORKS_LARGE_BLAST, + L"fireworks/large_blast_far", // eSoundType_FIREWORKS_LARGE_BLAST_FAR, + L"fireworks/twinkle", // eSoundType_FIREWORKS_TWINKLE, + L"fireworks/twinkle_far", // eSoundType_FIREWORKS_TWINKLE_FAR, + + L"mob/bat/idle", // eSoundType_MOB_BAT_IDLE, + L"mob/bat/hurt", // eSoundType_MOB_BAT_HURT, + L"mob/bat/death", // eSoundType_MOB_BAT_DEATH, + L"mob/bat/takeoff", // eSoundType_MOB_BAT_TAKEOFF, + + L"mob/wither/spawn", // eSoundType_MOB_WITHER_SPAWN, + L"mob/wither/idle", // eSoundType_MOB_WITHER_IDLE, + L"mob/wither/hurt", // eSoundType_MOB_WITHER_HURT, + L"mob/wither/death", // eSoundType_MOB_WITHER_DEATH, + L"mob/wither/shoot", // eSoundType_MOB_WITHER_SHOOT, + + L"mob/cow/step", // eSoundType_MOB_COW_STEP, + L"mob/chicken/step", // eSoundType_MOB_CHICKEN_STEP, + L"mob/pig/step", // eSoundType_MOB_PIG_STEP, + L"mob/enderman/stare", // eSoundType_MOB_ENDERMAN_STARE, + L"mob/enderman/scream", // eSoundType_MOB_ENDERMAN_SCREAM, + L"mob/sheep/shear", // eSoundType_MOB_SHEEP_SHEAR, + L"mob/sheep/step", // eSoundType_MOB_SHEEP_STEP, + L"mob/skeleton.death", // eSoundType_MOB_SKELETON_DEATH, + L"mob/skeleton/step", // eSoundType_MOB_SKELETON_STEP, + L"mob/spider/step", // eSoundType_MOB_SPIDER_STEP, + L"mob/wolf/step", // eSoundType_MOB_WOLF_STEP, + L"mob/zombie/step", // eSoundType_MOB_ZOMBIE_STEP, + + L"liquid/swim", // eSoundType_LIQUID_SWIM, + + L"mob/horse/land", // eSoundType_MOB_HORSE_LAND, + L"mob/horse/armor", // eSoundType_MOB_HORSE_ARMOR, + L"mob/horse/leather", // eSoundType_MOB_HORSE_LEATHER, + L"mob/horse/zombie.death", // eSoundType_MOB_HORSE_ZOMBIE_DEATH, + L"mob/horse/skeleton.death", // eSoundType_MOB_HORSE_SKELETON_DEATH, + L"mob/horse/donkey.death", // eSoundType_MOB_HORSE_DONKEY_DEATH, + L"mob/horse/death", // eSoundType_MOB_HORSE_DEATH, + L"mob/horse/zombie.hit", // eSoundType_MOB_HORSE_ZOMBIE_HIT, + L"mob/horse/skeleton.hit", // eSoundType_MOB_HORSE_SKELETON_HIT, + L"mob/horse/donkey.hit", // eSoundType_MOB_HORSE_DONKEY_HIT, + L"mob/horse/hit", // eSoundType_MOB_HORSE_HIT, + L"mob/horse/zombie.idle", // eSoundType_MOB_HORSE_ZOMBIE_IDLE, + L"mob/horse/skeleton.idle", // eSoundType_MOB_HORSE_SKELETON_IDLE, + L"mob/horse/donkey.idle", // eSoundType_MOB_HORSE_DONKEY_IDLE, + L"mob/horse/idle", // eSoundType_MOB_HORSE_IDLE, + L"mob/horse/donkey.angry", // eSoundType_MOB_HORSE_DONKEY_ANGRY, + L"mob/horse/angry", // eSoundType_MOB_HORSE_ANGRY, + L"mob/horse/gallop", // eSoundType_MOB_HORSE_GALLOP, + L"mob/horse/breathe", // eSoundType_MOB_HORSE_BREATHE, + L"mob/horse/wood", // eSoundType_MOB_HORSE_WOOD, + L"mob/horse/soft", // eSoundType_MOB_HORSE_SOFT, + L"mob/horse/jump", // eSoundType_MOB_HORSE_JUMP, + + L"mob/witch/idle", // eSoundType_MOB_WITCH_IDLE, <--- + // missing + L"mob/witch/hurt", // eSoundType_MOB_WITCH_HURT, <--- + // missing + L"mob/witch/death", // eSoundType_MOB_WITCH_DEATH, <--- + // missing + + L"mob/slime/big", // eSoundType_MOB_SLIME_BIG, + L"mob/slime/small", // eSoundType_MOB_SLIME_SMALL, + + L"eating", // eSoundType_EATING <--- missing + L"random/levelup", // eSoundType_RANDOM_LEVELUP + + // 4J-PB - Some sounds were updated, but we can't do that for the 360 or we + // have to do a new sound bank instead, we'll add the sounds as new ones and + // change the code to reference them + L"fire/new_ignite", }; const WCHAR* ConsoleSoundEngine::wchUISoundNames[eSFX_MAX] = { diff --git a/Minecraft.Client/Platform/Common/BuildVer.h b/Minecraft.Client/Platform/Common/BuildVer.h index ee558b037..9248a8eba 100644 --- a/Minecraft.Client/Platform/Common/BuildVer.h +++ b/Minecraft.Client/Platform/Common/BuildVer.h @@ -7,14 +7,14 @@ // This goes up with each build // 4J-JEV: This value is extracted with a regex so it can be placed as the version in the AppX manifest on Durango. -#define VER_PRODUCTBUILD 495 +#define VER_PRODUCTBUILD 560 // This goes up if there is any change to network traffic or code in a build -#define VER_NETWORK 495 +#define VER_NETWORK 560 #define VER_PRODUCTBUILD_QFE 0 -#define VER_FILEVERSION_STRING "1.3" +#define VER_FILEVERSION_STRING "1.6" #define VER_PRODUCTVERSION_STRING VER_FILEVERSION_STRING -#define VER_FILEVERSION_STRING_W L"1.3" +#define VER_FILEVERSION_STRING_W L"1.6" #define VER_PRODUCTVERSION_STRING_W VER_FILEVERSION_STRING_W #define VER_FILEBETA_STR "" #undef VER_FILEVERSION diff --git a/Minecraft.Client/Platform/Common/Colours/ColourTable.cpp b/Minecraft.Client/Platform/Common/Colours/ColourTable.cpp index 294c3f5fd..5915a6f6b 100644 --- a/Minecraft.Client/Platform/Common/Colours/ColourTable.cpp +++ b/Minecraft.Client/Platform/Common/Colours/ColourTable.cpp @@ -2,365 +2,377 @@ #include "ColourTable.h" #include "../../Minecraft.World/Util/StringHelpers.h" -std::unordered_map ColourTable::s_colourNamesMap; +std::unordered_map + ColourTable::s_colourNamesMap; -const wchar_t *ColourTable::ColourTableElements[eMinecraftColour_COUNT] = -{ - L"NOTSET", +const wchar_t* ColourTable::ColourTableElements[eMinecraftColour_COUNT] = { + L"NOTSET", - L"Foliage_Evergreen", - L"Foliage_Birch", - L"Foliage_Default", - L"Foliage_Common", - L"Foliage_Ocean", - L"Foliage_Plains", - L"Foliage_Desert", - L"Foliage_ExtremeHills", - L"Foliage_Forest", - L"Foliage_Taiga", - L"Foliage_Swampland", - L"Foliage_River", - L"Foliage_Hell", - L"Foliage_Sky", - L"Foliage_FrozenOcean", - L"Foliage_FrozenRiver", - L"Foliage_IcePlains", - L"Foliage_IceMountains", - L"Foliage_MushroomIsland", - L"Foliage_MushroomIslandShore", - L"Foliage_Beach", - L"Foliage_DesertHills", - L"Foliage_ForestHills", - L"Foliage_TaigaHills", - L"Foliage_ExtremeHillsEdge", - L"Foliage_Jungle", - L"Foliage_JungleHills", - - L"Grass_Common", - L"Grass_Ocean", - L"Grass_Plains", - L"Grass_Desert", - L"Grass_ExtremeHills", - L"Grass_Forest", - L"Grass_Taiga", - L"Grass_Swampland", - L"Grass_River", - L"Grass_Hell", - L"Grass_Sky", - L"Grass_FrozenOcean", - L"Grass_FrozenRiver", - L"Grass_IcePlains", - L"Grass_IceMountains", - L"Grass_MushroomIsland", - L"Grass_MushroomIslandShore", - L"Grass_Beach", - L"Grass_DesertHills", - L"Grass_ForestHills", - L"Grass_TaigaHills", - L"Grass_ExtremeHillsEdge", - L"Grass_Jungle", - L"Grass_JungleHills", + L"Foliage_Evergreen", + L"Foliage_Birch", + L"Foliage_Default", + L"Foliage_Common", + L"Foliage_Ocean", + L"Foliage_Plains", + L"Foliage_Desert", + L"Foliage_ExtremeHills", + L"Foliage_Forest", + L"Foliage_Taiga", + L"Foliage_Swampland", + L"Foliage_River", + L"Foliage_Hell", + L"Foliage_Sky", + L"Foliage_FrozenOcean", + L"Foliage_FrozenRiver", + L"Foliage_IcePlains", + L"Foliage_IceMountains", + L"Foliage_MushroomIsland", + L"Foliage_MushroomIslandShore", + L"Foliage_Beach", + L"Foliage_DesertHills", + L"Foliage_ForestHills", + L"Foliage_TaigaHills", + L"Foliage_ExtremeHillsEdge", + L"Foliage_Jungle", + L"Foliage_JungleHills", - L"Water_Ocean", - L"Water_Plains", - L"Water_Desert", - L"Water_ExtremeHills", - L"Water_Forest", - L"Water_Taiga", - L"Water_Swampland", - L"Water_River", - L"Water_Hell", - L"Water_Sky", - L"Water_FrozenOcean", - L"Water_FrozenRiver", - L"Water_IcePlains", - L"Water_IceMountains", - L"Water_MushroomIsland", - L"Water_MushroomIslandShore", - L"Water_Beach", - L"Water_DesertHills", - L"Water_ForestHills", - L"Water_TaigaHills", - L"Water_ExtremeHillsEdge", - L"Water_Jungle", - L"Water_JungleHills", + L"Grass_Common", + L"Grass_Ocean", + L"Grass_Plains", + L"Grass_Desert", + L"Grass_ExtremeHills", + L"Grass_Forest", + L"Grass_Taiga", + L"Grass_Swampland", + L"Grass_River", + L"Grass_Hell", + L"Grass_Sky", + L"Grass_FrozenOcean", + L"Grass_FrozenRiver", + L"Grass_IcePlains", + L"Grass_IceMountains", + L"Grass_MushroomIsland", + L"Grass_MushroomIslandShore", + L"Grass_Beach", + L"Grass_DesertHills", + L"Grass_ForestHills", + L"Grass_TaigaHills", + L"Grass_ExtremeHillsEdge", + L"Grass_Jungle", + L"Grass_JungleHills", - L"Sky_Ocean", - L"Sky_Plains", - L"Sky_Desert", - L"Sky_ExtremeHills", - L"Sky_Forest", - L"Sky_Taiga", - L"Sky_Swampland", - L"Sky_River", - L"Sky_Hell", - L"Sky_Sky", - L"Sky_FrozenOcean", - L"Sky_FrozenRiver", - L"Sky_IcePlains", - L"Sky_IceMountains", - L"Sky_MushroomIsland", - L"Sky_MushroomIslandShore", - L"Sky_Beach", - L"Sky_DesertHills", - L"Sky_ForestHills", - L"Sky_TaigaHills", - L"Sky_ExtremeHillsEdge", - L"Sky_Jungle", - L"Sky_JungleHills", + L"Water_Ocean", + L"Water_Plains", + L"Water_Desert", + L"Water_ExtremeHills", + L"Water_Forest", + L"Water_Taiga", + L"Water_Swampland", + L"Water_River", + L"Water_Hell", + L"Water_Sky", + L"Water_FrozenOcean", + L"Water_FrozenRiver", + L"Water_IcePlains", + L"Water_IceMountains", + L"Water_MushroomIsland", + L"Water_MushroomIslandShore", + L"Water_Beach", + L"Water_DesertHills", + L"Water_ForestHills", + L"Water_TaigaHills", + L"Water_ExtremeHillsEdge", + L"Water_Jungle", + L"Water_JungleHills", - L"Tile_RedstoneDust", - L"Tile_RedstoneDustUnlit", - L"Tile_RedstoneDustLitMin", - L"Tile_RedstoneDustLitMax", - L"Tile_StemMin", - L"Tile_StemMax", - L"Tile_WaterLily", + L"Sky_Ocean", + L"Sky_Plains", + L"Sky_Desert", + L"Sky_ExtremeHills", + L"Sky_Forest", + L"Sky_Taiga", + L"Sky_Swampland", + L"Sky_River", + L"Sky_Hell", + L"Sky_Sky", + L"Sky_FrozenOcean", + L"Sky_FrozenRiver", + L"Sky_IcePlains", + L"Sky_IceMountains", + L"Sky_MushroomIsland", + L"Sky_MushroomIslandShore", + L"Sky_Beach", + L"Sky_DesertHills", + L"Sky_ForestHills", + L"Sky_TaigaHills", + L"Sky_ExtremeHillsEdge", + L"Sky_Jungle", + L"Sky_JungleHills", - L"Sky_Dawn_Dark", - L"Sky_Dawn_Bright", + L"Tile_RedstoneDust", + L"Tile_RedstoneDustUnlit", + L"Tile_RedstoneDustLitMin", + L"Tile_RedstoneDustLitMax", + L"Tile_StemMin", + L"Tile_StemMax", + L"Tile_WaterLily", - L"Material_None", - L"Material_Grass", - L"Material_Sand", - L"Material_Cloth", - L"Material_Fire", - L"Material_Ice", - L"Material_Metal", - L"Material_Plant", - L"Material_Snow", - L"Material_Clay", - L"Material_Dirt", - L"Material_Stone", - L"Material_Water", - L"Material_Wood", - L"Material_Emerald", + L"Sky_Dawn_Dark", + L"Sky_Dawn_Bright", - L"Particle_Note_00", - L"Particle_Note_01", - L"Particle_Note_02", - L"Particle_Note_03", - L"Particle_Note_04", - L"Particle_Note_05", - L"Particle_Note_06", - L"Particle_Note_07", - L"Particle_Note_08", - L"Particle_Note_09", - L"Particle_Note_10", - L"Particle_Note_11", - L"Particle_Note_12", - L"Particle_Note_13", - L"Particle_Note_14", - L"Particle_Note_15", - L"Particle_Note_16", - L"Particle_Note_17", - L"Particle_Note_18", - L"Particle_Note_19", - L"Particle_Note_20", - L"Particle_Note_21", - L"Particle_Note_22", - L"Particle_Note_23", - L"Particle_Note_24", + L"Material_None", + L"Material_Grass", + L"Material_Sand", + L"Material_Cloth", + L"Material_Fire", + L"Material_Ice", + L"Material_Metal", + L"Material_Plant", + L"Material_Snow", + L"Material_Clay", + L"Material_Dirt", + L"Material_Stone", + L"Material_Water", + L"Material_Wood", + L"Material_Emerald", - L"Particle_NetherPortal", - L"Particle_EnderPortal", - L"Particle_Smoke", - L"Particle_Ender", + L"Particle_Note_00", + L"Particle_Note_01", + L"Particle_Note_02", + L"Particle_Note_03", + L"Particle_Note_04", + L"Particle_Note_05", + L"Particle_Note_06", + L"Particle_Note_07", + L"Particle_Note_08", + L"Particle_Note_09", + L"Particle_Note_10", + L"Particle_Note_11", + L"Particle_Note_12", + L"Particle_Note_13", + L"Particle_Note_14", + L"Particle_Note_15", + L"Particle_Note_16", + L"Particle_Note_17", + L"Particle_Note_18", + L"Particle_Note_19", + L"Particle_Note_20", + L"Particle_Note_21", + L"Particle_Note_22", + L"Particle_Note_23", + L"Particle_Note_24", - L"Particle_Explode", - L"Particle_HugeExplosion", + L"Particle_NetherPortal", + L"Particle_EnderPortal", + L"Particle_Smoke", + L"Particle_Ender", - L"Particle_DripWater", - L"Particle_DripLavaStart", - L"Particle_DripLavaEnd", + L"Particle_Explode", + L"Particle_HugeExplosion", - L"Particle_EnchantmentTable", - L"Particle_DragonBreathMin", - L"Particle_DragonBreathMax", - L"Particle_Suspend", + L"Particle_DripWater", + L"Particle_DripLavaStart", + L"Particle_DripLavaEnd", - L"Particle_CritStart", // arrow in air - L"Particle_CritEnd", // arrow in air - - L"Effect_MovementSpeed", - L"Effect_MovementSlowDown", - L"Effect_DigSpeed", - L"Effect_DigSlowdown", - L"Effect_DamageBoost", - L"Effect_Heal", - L"Effect_Harm", - L"Effect_Jump", - L"Effect_Confusion", - L"Effect_Regeneration", - L"Effect_DamageResistance", - L"Effect_FireResistance", - L"Effect_WaterBreathing", - L"Effect_Invisiblity", - L"Effect_Blindness", - L"Effect_NightVision", - L"Effect_Hunger", - L"Effect_Weakness", - L"Effect_Poison", + L"Particle_EnchantmentTable", + L"Particle_DragonBreathMin", + L"Particle_DragonBreathMax", + L"Particle_Suspend", - L"Potion_BaseColour", + L"Particle_CritStart", // arrow in air + L"Particle_CritEnd", // arrow in air - L"Mob_Creeper_Colour1", - L"Mob_Creeper_Colour2", - L"Mob_Skeleton_Colour1", - L"Mob_Skeleton_Colour2", - L"Mob_Spider_Colour1", - L"Mob_Spider_Colour2", - L"Mob_Zombie_Colour1", - L"Mob_Zombie_Colour2", - L"Mob_Slime_Colour1", - L"Mob_Slime_Colour2", - L"Mob_Ghast_Colour1", - L"Mob_Ghast_Colour2", - L"Mob_PigZombie_Colour1", - L"Mob_PigZombie_Colour2", - L"Mob_Enderman_Colour1", - L"Mob_Enderman_Colour2", - L"Mob_CaveSpider_Colour1", - L"Mob_CaveSpider_Colour2", - L"Mob_Silverfish_Colour1", - L"Mob_Silverfish_Colour2", - L"Mob_Blaze_Colour1", - L"Mob_Blaze_Colour2", - L"Mob_LavaSlime_Colour1", - L"Mob_LavaSlime_Colour2", - L"Mob_Pig_Colour1", - L"Mob_Pig_Colour2", - L"Mob_Sheep_Colour1", - L"Mob_Sheep_Colour2", - L"Mob_Cow_Colour1", - L"Mob_Cow_Colour2", - L"Mob_Chicken_Colour1", - L"Mob_Chicken_Colour2", - L"Mob_Squid_Colour1", - L"Mob_Squid_Colour2", - L"Mob_Wolf_Colour1", - L"Mob_Wolf_Colour2", - L"Mob_MushroomCow_Colour1", - L"Mob_MushroomCow_Colour2", - L"Mob_Ocelot_Colour1", - L"Mob_Ocelot_Colour2", - L"Mob_Villager_Colour1", - L"Mob_Villager_Colour2", + L"Effect_MovementSpeed", + L"Effect_MovementSlowDown", + L"Effect_DigSpeed", + L"Effect_DigSlowdown", + L"Effect_DamageBoost", + L"Effect_Heal", + L"Effect_Harm", + L"Effect_Jump", + L"Effect_Confusion", + L"Effect_Regeneration", + L"Effect_DamageResistance", + L"Effect_FireResistance", + L"Effect_WaterBreathing", + L"Effect_Invisiblity", + L"Effect_Blindness", + L"Effect_NightVision", + L"Effect_Hunger", + L"Effect_Weakness", + L"Effect_Poison", + L"Effect_Wither", + L"Effect_HealthBoost", + L"Effect_Absorption", + L"Effect_Saturation", - L"Armour_Default_Leather_Colour", - L"Under_Water_Clear_Colour", - L"Under_Lava_Clear_Colour", - L"In_Cloud_Base_Colour", + L"Potion_BaseColour", - L"Under_Water_Fog_Colour", - L"Under_Lava_Fog_Colour", - L"In_Cloud_Fog_Colour", + L"Mob_Creeper_Colour1", + L"Mob_Creeper_Colour2", + L"Mob_Skeleton_Colour1", + L"Mob_Skeleton_Colour2", + L"Mob_Spider_Colour1", + L"Mob_Spider_Colour2", + L"Mob_Zombie_Colour1", + L"Mob_Zombie_Colour2", + L"Mob_Slime_Colour1", + L"Mob_Slime_Colour2", + L"Mob_Ghast_Colour1", + L"Mob_Ghast_Colour2", + L"Mob_PigZombie_Colour1", + L"Mob_PigZombie_Colour2", + L"Mob_Enderman_Colour1", + L"Mob_Enderman_Colour2", + L"Mob_CaveSpider_Colour1", + L"Mob_CaveSpider_Colour2", + L"Mob_Silverfish_Colour1", + L"Mob_Silverfish_Colour2", + L"Mob_Blaze_Colour1", + L"Mob_Blaze_Colour2", + L"Mob_LavaSlime_Colour1", + L"Mob_LavaSlime_Colour2", + L"Mob_Pig_Colour1", + L"Mob_Pig_Colour2", + L"Mob_Sheep_Colour1", + L"Mob_Sheep_Colour2", + L"Mob_Cow_Colour1", + L"Mob_Cow_Colour2", + L"Mob_Chicken_Colour1", + L"Mob_Chicken_Colour2", + L"Mob_Squid_Colour1", + L"Mob_Squid_Colour2", + L"Mob_Wolf_Colour1", + L"Mob_Wolf_Colour2", + L"Mob_MushroomCow_Colour1", + L"Mob_MushroomCow_Colour2", + L"Mob_Ocelot_Colour1", + L"Mob_Ocelot_Colour2", + L"Mob_Villager_Colour1", + L"Mob_Villager_Colour2", + L"Mob_Bat_Colour1", + L"Mob_Bat_Colour2", + L"Mob_Witch_Colour1", + L"Mob_Witch_Colour2", + L"Mob_Horse_Colour1", + L"Mob_Horse_Colour2", - L"Default_Fog_Colour", - L"Nether_Fog_Colour", - L"End_Fog_Colour", + L"Armour_Default_Leather_Colour", + L"Under_Water_Clear_Colour", + L"Under_Lava_Clear_Colour", + L"In_Cloud_Base_Colour", - L"Sign_Text", - L"Map_Text", - - L"HTMLColor_0", - L"HTMLColor_1", - L"HTMLColor_2", - L"HTMLColor_3", - L"HTMLColor_4", - L"HTMLColor_5", - L"HTMLColor_6", - L"HTMLColor_7", - L"HTMLColor_8", - L"HTMLColor_9", - L"HTMLColor_a", - L"HTMLColor_b", - L"HTMLColor_c", - L"HTMLColor_d", - L"HTMLColor_e", - L"HTMLColor_f", - L"HTMLColor_dark_0", - L"HTMLColor_dark_1", - L"HTMLColor_dark_2", - L"HTMLColor_dark_3", - L"HTMLColor_dark_4", - L"HTMLColor_dark_5", - L"HTMLColor_dark_6", - L"HTMLColor_dark_7", - L"HTMLColor_dark_8", - L"HTMLColor_dark_9", - L"HTMLColor_dark_a", - L"HTMLColor_dark_b", - L"HTMLColor_dark_c", - L"HTMLColor_dark_d", - L"HTMLColor_dark_e", - L"HTMLColor_dark_f", - L"HTMLColor_T1", - L"HTMLColor_T2", - L"HTMLColor_T3", - L"HTMLColor_Black", - L"HTMLColor_White", - L"Color_EnchantText", - L"Color_EnchantTextFocus", - L"Color_EnchantTextDisabled", - L"Color_RenamedItemTitle", + L"Under_Water_Fog_Colour", + L"Under_Lava_Fog_Colour", + L"In_Cloud_Fog_Colour", + + L"Default_Fog_Colour", + L"Nether_Fog_Colour", + L"End_Fog_Colour", + + L"Sign_Text", + L"Map_Text", + + L"Leash_Light_Colour", + L"Leash_Dark_Colour", + + L"Fire_Overlay", + + L"HTMLColor_0", + L"HTMLColor_1", + L"HTMLColor_2", + L"HTMLColor_3", + L"HTMLColor_4", + L"HTMLColor_5", + L"HTMLColor_6", + L"HTMLColor_7", + L"HTMLColor_8", + L"HTMLColor_9", + L"HTMLColor_a", + L"HTMLColor_b", + L"HTMLColor_c", + L"HTMLColor_d", + L"HTMLColor_e", + L"HTMLColor_f", + L"HTMLColor_dark_0", + L"HTMLColor_dark_1", + L"HTMLColor_dark_2", + L"HTMLColor_dark_3", + L"HTMLColor_dark_4", + L"HTMLColor_dark_5", + L"HTMLColor_dark_6", + L"HTMLColor_dark_7", + L"HTMLColor_dark_8", + L"HTMLColor_dark_9", + L"HTMLColor_dark_a", + L"HTMLColor_dark_b", + L"HTMLColor_dark_c", + L"HTMLColor_dark_d", + L"HTMLColor_dark_e", + L"HTMLColor_dark_f", + L"HTMLColor_T1", + L"HTMLColor_T2", + L"HTMLColor_T3", + L"HTMLColor_Black", + L"HTMLColor_White", + L"Color_EnchantText", + L"Color_EnchantTextFocus", + L"Color_EnchantTextDisabled", + L"Color_RenamedItemTitle", }; -void ColourTable::staticCtor() -{ - for(unsigned int i = eMinecraftColour_NOT_SET; i < eMinecraftColour_COUNT; ++i) - { - s_colourNamesMap.insert( std::unordered_map::value_type( ColourTableElements[i], (eMinecraftColour)i) ); - } +void ColourTable::staticCtor() { + for (unsigned int i = eMinecraftColour_NOT_SET; i < eMinecraftColour_COUNT; + ++i) { + s_colourNamesMap.insert( + std::unordered_map::value_type( + ColourTableElements[i], (eMinecraftColour)i)); + } } -ColourTable::ColourTable(std::uint8_t *pbData, std::uint32_t dataLength) -{ - loadColoursFromData(pbData, dataLength); +ColourTable::ColourTable(std::uint8_t* pbData, std::uint32_t dataLength) { + loadColoursFromData(pbData, dataLength); } -ColourTable::ColourTable(ColourTable *defaultColours, std::uint8_t *pbData, std::uint32_t dataLength) -{ - // 4J Stu - Default the colours that of the table passed in - XMemCpy( (void *)m_colourValues, (void *)defaultColours->m_colourValues, sizeof(int) * eMinecraftColour_COUNT); - loadColoursFromData(pbData, dataLength); +ColourTable::ColourTable(ColourTable* defaultColours, std::uint8_t* pbData, + std::uint32_t dataLength) { + // 4J Stu - Default the colours that of the table passed in + XMemCpy((void*)m_colourValues, (void*)defaultColours->m_colourValues, + sizeof(int) * eMinecraftColour_COUNT); + loadColoursFromData(pbData, dataLength); } -void ColourTable::loadColoursFromData(std::uint8_t *pbData, std::uint32_t dataLength) -{ - byteArray src(pbData, dataLength); +void ColourTable::loadColoursFromData(std::uint8_t* pbData, + std::uint32_t dataLength) { + byteArray src(pbData, dataLength); - ByteArrayInputStream bais(src); - DataInputStream dis(&bais); + ByteArrayInputStream bais(src); + DataInputStream dis(&bais); - int versionNumber = dis.readInt(); - int coloursCount = dis.readInt(); + int versionNumber = dis.readInt(); + int coloursCount = dis.readInt(); - for(int i = 0; i < coloursCount; ++i) - { - std::wstring colourId = dis.readUTF(); - int colourValue = dis.readInt(); - setColour(colourId, colourValue); - AUTO_VAR(it,s_colourNamesMap.find(colourId)); - } + for (int i = 0; i < coloursCount; ++i) { + std::wstring colourId = dis.readUTF(); + int colourValue = dis.readInt(); + setColour(colourId, colourValue); + AUTO_VAR(it, s_colourNamesMap.find(colourId)); + } - bais.reset(); + bais.reset(); } -void ColourTable::setColour(const std::wstring &colourName, int value) -{ - AUTO_VAR(it,s_colourNamesMap.find(colourName)); - if(it != s_colourNamesMap.end()) - { - m_colourValues[(int)it->second] = value; - } +void ColourTable::setColour(const std::wstring& colourName, int value) { + AUTO_VAR(it, s_colourNamesMap.find(colourName)); + if (it != s_colourNamesMap.end()) { + m_colourValues[(int)it->second] = value; + } } -void ColourTable::setColour(const std::wstring &colourName, const std::wstring &value) -{ - setColour(colourName, _fromHEXString(value)); +void ColourTable::setColour(const std::wstring& colourName, + const std::wstring& value) { + setColour(colourName, _fromHEXString(value)); } -unsigned int ColourTable::getColour(eMinecraftColour id) -{ - return m_colourValues[(int)id]; +unsigned int ColourTable::getColour(eMinecraftColour id) { + return m_colourValues[(int)id]; } diff --git a/Minecraft.Client/Platform/Common/Console_Debug_enum.h b/Minecraft.Client/Platform/Common/Console_Debug_enum.h index 4e6c2b147..b91049421 100644 --- a/Minecraft.Client/Platform/Common/Console_Debug_enum.h +++ b/Minecraft.Client/Platform/Common/Console_Debug_enum.h @@ -1,42 +1,40 @@ #pragma once -enum eDebugSetting -{ - eDebugSetting_LoadSavesFromDisk, - eDebugSetting_WriteSavesToDisk, - eDebugSetting_FreezePlayers, //eDebugSetting_InterfaceOff, - eDebugSetting_Safearea, - eDebugSetting_MobsDontAttack, - eDebugSetting_FreezeTime, - eDebugSetting_DisableWeather, - eDebugSetting_CraftAnything, - eDebugSetting_UseDpadForDebug, - eDebugSetting_MobsDontTick, - eDebugSetting_InstantDestroy, - eDebugSetting_ShowUIConsole, - eDebugSetting_DistributableSave, - eDebugSetting_DebugLeaderboards, - eDebugSetting_EnableHeightWaterBiomeOverride, //eDebugSetting_TipsAlwaysOn, - eDebugSetting_SuperflatNether, - //eDebugSetting_LightDarkBackground, - eDebugSetting_RegularLightning, - eDebugSetting_GoToNether, - //eDebugSetting_GoToEnd, - eDebugSetting_GoToOverworld, - eDebugSetting_UnlockAllDLC, // eDebugSetting_ToggleFont, - eDebugSetting_ShowUIMarketingGuide, - eDebugSetting_Max, +enum eDebugSetting { + eDebugSetting_LoadSavesFromDisk, + eDebugSetting_WriteSavesToDisk, + eDebugSetting_FreezePlayers, // eDebugSetting_InterfaceOff, + eDebugSetting_Safearea, + eDebugSetting_MobsDontAttack, + eDebugSetting_FreezeTime, + eDebugSetting_DisableWeather, + eDebugSetting_CraftAnything, + eDebugSetting_UseDpadForDebug, + eDebugSetting_MobsDontTick, + eDebugSetting_ArtTools, // eDebugSetting_InstantDestroy, + eDebugSetting_ShowUIConsole, + eDebugSetting_DistributableSave, + eDebugSetting_DebugLeaderboards, + eDebugSetting_EnableHeightWaterOverride, // eDebugSetting_TipsAlwaysOn, + eDebugSetting_SuperflatNether, + // eDebugSetting_LightDarkBackground, + eDebugSetting_RegularLightning, + eDebugSetting_EnableBiomeOverride, // eDebugSetting_GoToNether, + // eDebugSetting_GoToEnd, + eDebugSetting_GoToOverworld, + eDebugSetting_UnlockAllDLC, // eDebugSetting_ToggleFont, + eDebugSetting_ShowUIMarketingGuide, + eDebugSetting_Max, }; -enum eDebugButton -{ - eDebugButton_Theme=0, - eDebugButton_Avatar_Item_1, - eDebugButton_Avatar_Item_2, - eDebugButton_Avatar_Item_3, - eDebugButton_Gamerpic_1, - eDebugButton_Gamerpic_2, - eDebugButton_CheckTips, - eDebugButton_WipeLeaderboards, - eDebugButton_Max, +enum eDebugButton { + eDebugButton_Theme = 0, + eDebugButton_Avatar_Item_1, + eDebugButton_Avatar_Item_2, + eDebugButton_Avatar_Item_3, + eDebugButton_Gamerpic_1, + eDebugButton_Gamerpic_2, + eDebugButton_CheckTips, + eDebugButton_WipeLeaderboards, + eDebugButton_Max, }; diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index e91f2adb2..f85d56632 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -1,4 +1,4 @@ - + #include "../Minecraft.World/Platform/stdafx.h" #include "../Minecraft.World/Recipes/Recipy.h" @@ -22,6 +22,7 @@ #include "../Minecraft.World/Containers/Container.h" #include "../Minecraft.World/Blocks/TileEntities/DispenserTileEntity.h" #include "../Minecraft.World/Blocks/TileEntities/SignTileEntity.h" +#include "../Minecraft.World/Blocks/TileEntities/HopperTileEntity.h" #include "../Minecraft.Client/GameState/StatsCounter.h" #include "../Minecraft.Client/GameState/GameMode.h" #include "../Minecraft.Client/Platform/Xbox/Social/SocialManager.h" @@ -70,2103 +71,2412 @@ #include "Leaderboards/LeaderboardManager.h" -//CMinecraftApp app; +// CMinecraftApp app; unsigned int CMinecraftApp::m_uiLastSignInData = 0; -const float CMinecraftApp::fSafeZoneX = 64.0f; // 5% of 1280 -const float CMinecraftApp::fSafeZoneY = 36.0f; // 5% of 720 +const float CMinecraftApp::fSafeZoneX = 64.0f; // 5% of 1280 +const float CMinecraftApp::fSafeZoneY = 36.0f; // 5% of 720 -int CMinecraftApp::s_iHTMLFontSizesA[eHTMLSize_COUNT] = -{ +int CMinecraftApp::s_iHTMLFontSizesA[eHTMLSize_COUNT] = { #ifdef _XBOX - 14,12,14,24 + 14, 12, 14, 24 #else - //20,15,20,24 - 20,13,20,26 + // 20,15,20,24 + 20, 13, 20, 26 #endif }; - -CMinecraftApp::CMinecraftApp() -{ - if(GAME_SETTINGS_PROFILE_DATA_BYTES != sizeof(GAME_SETTINGS)) - { - // 4J Stu - See comment for GAME_SETTINGS_PROFILE_DATA_BYTES in Xbox_App.h - DebugPrintf("WARNING: The size of the profile GAME_SETTINGS struct has changed, so all stat data is likely incorrect. Is: %d, Should be: %d\n",sizeof(GAME_SETTINGS),GAME_SETTINGS_PROFILE_DATA_BYTES); +CMinecraftApp::CMinecraftApp() { + if (GAME_SETTINGS_PROFILE_DATA_BYTES != sizeof(GAME_SETTINGS)) { + // 4J Stu - See comment for GAME_SETTINGS_PROFILE_DATA_BYTES in + // Xbox_App.h + DebugPrintf( + "WARNING: The size of the profile GAME_SETTINGS struct has " + "changed, so all stat data is likely incorrect. Is: %d, Should be: " + "%d\n", + sizeof(GAME_SETTINGS), GAME_SETTINGS_PROFILE_DATA_BYTES); #ifndef _CONTENT_PACKAGE - __debugbreak(); + __debugbreak(); #endif - } + } - for(int i=0;i; - } + for (int i = 0; i < XUSER_MAX_COUNT; i++) { + m_vBannedListA[i] = new std::vector; + } - LocaleAndLanguageInit(); + LocaleAndLanguageInit(); #ifdef _XBOX_ONE - m_hasReachedMainMenu = false; + m_hasReachedMainMenu = false; #endif } - - -void CMinecraftApp::DebugPrintf(const char *szFormat, ...) -{ - +void CMinecraftApp::DebugPrintf(const char* szFormat, ...) { #ifndef _FINAL_BUILD - char buf[1024]; - va_list ap; - va_start(ap, szFormat); - vsnprintf(buf, sizeof(buf), szFormat, ap); - va_end(ap); - OutputDebugStringA(buf); + char buf[1024]; + va_list ap; + va_start(ap, szFormat); + vsnprintf(buf, sizeof(buf), szFormat, ap); + va_end(ap); + OutputDebugStringA(buf); #endif - } -void CMinecraftApp::DebugPrintf(int user, const char *szFormat, ...) -{ - if(user == USER_NONE) - return; - char buf[1024]; - va_list ap; - va_start(ap, szFormat); - vsnprintf(buf, sizeof(buf), szFormat, ap); - va_end(ap); -} - -const wchar_t *CMinecraftApp::GetString(int iID) -{ - //return L"Değişiklikler ve Yenilikler"; - //return L"ÕÕÕÕÖÖÖÖ"; - return app.m_stringTable->getString(iID); -} - -void CMinecraftApp::SetAction(int iPad, eXuiAction action, void *param) -{ - if(m_eXuiAction[iPad] == eAppAction_ExitWorldCapturedThumbnail && action != eAppAction_Idle) - { - app.DebugPrintf("Invalid change of App action for pad %d from %d to %d, ignoring\n", iPad, m_eXuiAction[iPad], action); - } - else - { - app.DebugPrintf("Changing App action for pad %d from %d to %d\n", iPad, m_eXuiAction[iPad], action); - m_eXuiAction[iPad]=action; - m_eXuiActionParam[iPad] = param; - } -} - -bool CMinecraftApp::IsAppPaused() -{ -#if defined(_XBOX_ONE) || defined(__ORBIS__) - bool paused = m_bIsAppPaused; - EnterCriticalSection(&m_saveNotificationCriticalSection); - if( g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1 ) - { - paused |= m_saveNotificationDepth > 0; - } - LeaveCriticalSection(&m_saveNotificationCriticalSection); - return paused; +void CMinecraftApp::DebugPrintf(int user, const char* szFormat, ...) { +#ifndef _FINAL_BUILD + if (user == USER_NONE) return; + char buf[1024]; + va_list ap; + va_start(ap, szFormat); + vsnprintf(buf, sizeof(buf), szFormat, ap); + va_end(ap); +#ifdef __PS3__ + unsigned int writelen; + sys_tty_write(SYS_TTYP_USER1 + (user - 1), buf, strlen(buf), &writelen); +#elif defined __PSVITA__ + switch (user) { + case 0: { + SceUID tty2 = sceIoOpen("tty2:", SCE_O_WRONLY, 0); + if (tty2 >= 0) { + std::string string1(buf); + sceIoWrite(tty2, string1.c_str(), string1.length()); + sceIoClose(tty2); + } + } break; + case 1: { + SceUID tty3 = sceIoOpen("tty3:", SCE_O_WRONLY, 0); + if (tty3 >= 0) { + std::string string1(buf); + sceIoWrite(tty3, string1.c_str(), string1.length()); + sceIoClose(tty3); + } + } break; + default: + OutputDebugStringA(buf); + break; + } #else - return m_bIsAppPaused; + OutputDebugStringA(buf); +#endif +#ifndef _XBOX + if (user == USER_UI) { + ui.logDebugString(buf); + } +#endif #endif } -void CMinecraftApp::SetAppPaused(bool val) -{ - m_bIsAppPaused = val; +const wchar_t* CMinecraftApp::GetString(int iID) { + // return L"Değişiklikler ve Yenilikler"; + // return L"ÕÕÕÕÖÖÖÖ"; + return app.m_stringTable->getString(iID); } -void CMinecraftApp::HandleButtonPresses() -{ - for(int i=0;i<4;i++) - { - HandleButtonPresses(i); - } +void CMinecraftApp::SetAction(int iPad, eXuiAction action, void* param) { + if ((m_eXuiAction[iPad] == eAppAction_ReloadTexturePack) && + (action == eAppAction_EthernetDisconnected)) { + app.DebugPrintf( + "Invalid change of App action for pad %d from %d to %d, ignoring\n", + iPad, m_eXuiAction[iPad], action); + } else if ((m_eXuiAction[iPad] == eAppAction_ReloadTexturePack) && + (action == eAppAction_ExitWorld)) { + app.DebugPrintf( + "Invalid change of App action for pad %d from %d to %d, ignoring\n", + iPad, m_eXuiAction[iPad], action); + } else if (m_eXuiAction[iPad] == eAppAction_ExitWorldCapturedThumbnail && + action != eAppAction_Idle) { + app.DebugPrintf( + "Invalid change of App action for pad %d from %d to %d, ignoring\n", + iPad, m_eXuiAction[iPad], action); + } else { + app.DebugPrintf("Changing App action for pad %d from %d to %d\n", iPad, + m_eXuiAction[iPad], action); + m_eXuiAction[iPad] = action; + m_eXuiActionParam[iPad] = param; + } } -void CMinecraftApp::HandleButtonPresses(int iPad) -{ - -// // test an update of the profile data -// void *pData=ProfileManager.GetGameDefinedProfileData(iPad); -// -// unsigned char *pchData= (unsigned char *)pData; -// int iCount=0; -// for(int i=0;i 0; + } + LeaveCriticalSection(&m_saveNotificationCriticalSection); + return paused; +#else + return m_bIsAppPaused; +#endif } -bool CMinecraftApp::LoadInventoryMenu(int iPad,std::shared_ptr player,bool bNavigateBack) -{ - bool success = true; +void CMinecraftApp::SetAppPaused(bool val) { m_bIsAppPaused = val; } - InventoryScreenInput* initData = new InventoryScreenInput(); - initData->player = player; - initData->bNavigateBack=bNavigateBack; - initData->iPad = iPad; - - if(app.GetLocalPlayerCount()>1) - { - initData->bSplitscreen=true; - success = ui.NavigateToScene(iPad,eUIScene_InventoryMenu,initData); - } - else - { - initData->bSplitscreen=false; - success = ui.NavigateToScene(iPad,eUIScene_InventoryMenu,initData); - } - - return success; +void CMinecraftApp::HandleButtonPresses() { + for (int i = 0; i < 4; i++) { + HandleButtonPresses(i); + } } -bool CMinecraftApp::LoadCreativeMenu(int iPad,std::shared_ptr player,bool bNavigateBack) -{ - bool success = true; - - InventoryScreenInput* initData = new InventoryScreenInput(); - initData->player = player; - initData->bNavigateBack=bNavigateBack; - initData->iPad = iPad; - - if(app.GetLocalPlayerCount()>1) - { - initData->bSplitscreen=true; - success = ui.NavigateToScene(iPad,eUIScene_CreativeMenu,initData); - } - else - { - initData->bSplitscreen=false; - success = ui.NavigateToScene(iPad,eUIScene_CreativeMenu,initData); - } - - return success; +void CMinecraftApp::HandleButtonPresses(int iPad) { + // // test an update of the profile data + // void *pData=ProfileManager.GetGameDefinedProfileData(iPad); + // + // unsigned char *pchData= (unsigned char *)pData; + // int iCount=0; + // for(int i=0;i player) -{ - bool success = true; +bool CMinecraftApp::LoadInventoryMenu(int iPad, + std::shared_ptr player, + bool bNavigateBack) { + bool success = true; - CraftingPanelScreenInput* initData = new CraftingPanelScreenInput(); - initData->player = player; - initData->iContainerType=RECIPE_TYPE_2x2; - initData->iPad = iPad; - initData->x = 0; - initData->y = 0; - initData->z = 0; + InventoryScreenInput* initData = new InventoryScreenInput(); + initData->player = player; + initData->bNavigateBack = bNavigateBack; + initData->iPad = iPad; - if(app.GetLocalPlayerCount()>1) - { - initData->bSplitscreen=true; - success = ui.NavigateToScene(iPad,eUIScene_Crafting2x2Menu, initData); - } - else - { - initData->bSplitscreen=false; - success = ui.NavigateToScene(iPad,eUIScene_Crafting2x2Menu, initData); - } + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + success = ui.NavigateToScene(iPad, eUIScene_InventoryMenu, initData); + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_InventoryMenu, initData); + } - return success; + return success; } -bool CMinecraftApp::LoadCrafting3x3Menu(int iPad,std::shared_ptr player, int x, int y, int z) -{ - bool success = true; +bool CMinecraftApp::LoadCreativeMenu(int iPad, + std::shared_ptr player, + bool bNavigateBack) { + bool success = true; - CraftingPanelScreenInput* initData = new CraftingPanelScreenInput(); - initData->player = player; - initData->iContainerType=RECIPE_TYPE_3x3; - initData->iPad = iPad; - initData->x = x; - initData->y = y; - initData->z = z; + InventoryScreenInput* initData = new InventoryScreenInput(); + initData->player = player; + initData->bNavigateBack = bNavigateBack; + initData->iPad = iPad; - if(app.GetLocalPlayerCount()>1) - { - initData->bSplitscreen=true; - success = ui.NavigateToScene(iPad,eUIScene_Crafting3x3Menu, initData); - } - else - { - initData->bSplitscreen=false; - success = ui.NavigateToScene(iPad,eUIScene_Crafting3x3Menu, initData); - } + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + success = ui.NavigateToScene(iPad, eUIScene_CreativeMenu, initData); + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_CreativeMenu, initData); + } - return success; + return success; } -bool CMinecraftApp::LoadEnchantingMenu(int iPad,std::shared_ptr inventory, int x, int y, int z, Level *level) -{ - bool success = true; +bool CMinecraftApp::LoadCrafting2x2Menu(int iPad, + std::shared_ptr player) { + bool success = true; - EnchantingScreenInput* initData = new EnchantingScreenInput(); - initData->inventory = inventory; - initData->level = level; - initData->x = x; - initData->y = y; - initData->z = z; - initData->iPad = iPad; + CraftingPanelScreenInput* initData = new CraftingPanelScreenInput(); + initData->player = player; + initData->iContainerType = RECIPE_TYPE_2x2; + initData->iPad = iPad; + initData->x = 0; + initData->y = 0; + initData->z = 0; - if(app.GetLocalPlayerCount()>1) - { - initData->bSplitscreen=true; - success = ui.NavigateToScene(iPad,eUIScene_EnchantingMenu, initData); - } - else - { - initData->bSplitscreen=false; - success = ui.NavigateToScene(iPad,eUIScene_EnchantingMenu, initData); - } + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + success = ui.NavigateToScene(iPad, eUIScene_Crafting2x2Menu, initData); + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_Crafting2x2Menu, initData); + } - return success; + return success; } -bool CMinecraftApp::LoadFurnaceMenu(int iPad,std::shared_ptr inventory, std::shared_ptr furnace) -{ - bool success = true; +bool CMinecraftApp::LoadCrafting3x3Menu(int iPad, + std::shared_ptr player, + int x, int y, int z) { + bool success = true; - FurnaceScreenInput* initData = new FurnaceScreenInput(); + CraftingPanelScreenInput* initData = new CraftingPanelScreenInput(); + initData->player = player; + initData->iContainerType = RECIPE_TYPE_3x3; + initData->iPad = iPad; + initData->x = x; + initData->y = y; + initData->z = z; - initData->furnace = furnace; - initData->inventory = inventory; - initData->iPad = iPad; + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + success = ui.NavigateToScene(iPad, eUIScene_Crafting3x3Menu, initData); + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_Crafting3x3Menu, initData); + } - // Load the scene. - if(app.GetLocalPlayerCount()>1) - { - initData->bSplitscreen=true; - success = ui.NavigateToScene(iPad,eUIScene_FurnaceMenu, initData); - } - else - { - initData->bSplitscreen=false; - success = ui.NavigateToScene(iPad,eUIScene_FurnaceMenu, initData); - } - - return success; + return success; } -bool CMinecraftApp::LoadBrewingStandMenu(int iPad,std::shared_ptr inventory, std::shared_ptr brewingStand) -{ - bool success = true; +bool CMinecraftApp::LoadFireworksMenu(int iPad, + std::shared_ptr player, + int x, int y, int z) { + bool success = true; - BrewingScreenInput* initData = new BrewingScreenInput(); + FireworksScreenInput* initData = new FireworksScreenInput(); + initData->player = player; + initData->iPad = iPad; + initData->x = x; + initData->y = y; + initData->z = z; - initData->brewingStand = brewingStand; - initData->inventory = inventory; - initData->iPad = iPad; + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + success = ui.NavigateToScene(iPad, eUIScene_FireworksMenu, initData); + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_FireworksMenu, initData); + } - // Load the scene. - if(app.GetLocalPlayerCount()>1) - { - initData->bSplitscreen=true; - success = ui.NavigateToScene(iPad,eUIScene_BrewingStandMenu, initData); - } - else - { - initData->bSplitscreen=false; - success = ui.NavigateToScene(iPad,eUIScene_BrewingStandMenu, initData); - } - - return success; + return success; } +bool CMinecraftApp::LoadEnchantingMenu(int iPad, + std::shared_ptr inventory, + int x, int y, int z, Level* level, + const std::wstring& name) { + bool success = true; -bool CMinecraftApp::LoadContainerMenu(int iPad,std::shared_ptr inventory, std::shared_ptr container) -{ - bool success = true; + EnchantingScreenInput* initData = new EnchantingScreenInput(); + initData->inventory = inventory; + initData->level = level; + initData->x = x; + initData->y = y; + initData->z = z; + initData->iPad = iPad; + initData->name = name; - ContainerScreenInput* initData = new ContainerScreenInput(); + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + success = ui.NavigateToScene(iPad, eUIScene_EnchantingMenu, initData); + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_EnchantingMenu, initData); + } - initData->inventory = inventory; - initData->container = container; - initData->iPad = iPad; - - // Load the scene. - if(app.GetLocalPlayerCount()>1) - { - initData->bSplitscreen=true; - - bool bLargeChest = (initData->container->getContainerSize() > 3*9)?true:false; - if(bLargeChest) - { - success = ui.NavigateToScene(iPad,eUIScene_LargeContainerMenu,initData); - } - else - { - success = ui.NavigateToScene(iPad,eUIScene_ContainerMenu,initData); - } - } - else - { - initData->bSplitscreen=false; - success = ui.NavigateToScene(iPad,eUIScene_ContainerMenu,initData); - } - - return success; + return success; } -bool CMinecraftApp::LoadTrapMenu(int iPad,std::shared_ptr inventory, std::shared_ptr trap) -{ - bool success = true; +bool CMinecraftApp::LoadFurnaceMenu( + int iPad, std::shared_ptr inventory, + std::shared_ptr furnace) { + bool success = true; - TrapScreenInput* initData = new TrapScreenInput(); + FurnaceScreenInput* initData = new FurnaceScreenInput(); - initData->inventory = inventory; - initData->trap = trap; - initData->iPad = iPad; + initData->furnace = furnace; + initData->inventory = inventory; + initData->iPad = iPad; - // Load the scene. - if(app.GetLocalPlayerCount()>1) - { - initData->bSplitscreen=true; - success = ui.NavigateToScene(iPad,eUIScene_DispenserMenu, initData); - } - else - { - initData->bSplitscreen=false; - success = ui.NavigateToScene(iPad,eUIScene_DispenserMenu, initData); - } + // Load the scene. + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + success = ui.NavigateToScene(iPad, eUIScene_FurnaceMenu, initData); + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_FurnaceMenu, initData); + } - return success; + return success; } -bool CMinecraftApp::LoadSignEntryMenu(int iPad,std::shared_ptr sign) -{ - bool success = true; +bool CMinecraftApp::LoadBrewingStandMenu( + int iPad, std::shared_ptr inventory, + std::shared_ptr brewingStand) { + bool success = true; - SignEntryScreenInput* initData = new SignEntryScreenInput(); + BrewingScreenInput* initData = new BrewingScreenInput(); - initData->sign = sign; - initData->iPad = iPad; + initData->brewingStand = brewingStand; + initData->inventory = inventory; + initData->iPad = iPad; - success = ui.NavigateToScene(iPad,eUIScene_SignEntryMenu, initData); + // Load the scene. + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + success = ui.NavigateToScene(iPad, eUIScene_BrewingStandMenu, initData); + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_BrewingStandMenu, initData); + } - delete initData; - - return success; + return success; } -bool CMinecraftApp::LoadRepairingMenu(int iPad,std::shared_ptr inventory, Level *level, int x, int y, int z) -{ - bool success = true; +bool CMinecraftApp::LoadContainerMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr container) { + bool success = true; - AnvilScreenInput *initData = new AnvilScreenInput(); - initData->inventory = inventory; - initData->level = level; - initData->x = x; - initData->y = y; - initData->z = z; - initData->iPad = iPad; - if(app.GetLocalPlayerCount()>1) initData->bSplitscreen=true; - else initData->bSplitscreen=false; + ContainerScreenInput* initData = new ContainerScreenInput(); - success = ui.NavigateToScene(iPad,eUIScene_AnvilMenu, initData); + initData->inventory = inventory; + initData->container = container; + initData->iPad = iPad; - return success; + // Load the scene. + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + + bool bLargeChest = + (initData->container->getContainerSize() > 3 * 9) ? true : false; + if (bLargeChest) { + success = + ui.NavigateToScene(iPad, eUIScene_LargeContainerMenu, initData); + } else { + success = + ui.NavigateToScene(iPad, eUIScene_ContainerMenu, initData); + } + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_ContainerMenu, initData); + } + + return success; } -bool CMinecraftApp::LoadTradingMenu(int iPad, std::shared_ptr inventory, std::shared_ptr trader, Level *level) -{ - bool success = true; +bool CMinecraftApp::LoadTrapMenu(int iPad, std::shared_ptr inventory, + std::shared_ptr trap) { + bool success = true; - TradingScreenInput *initData = new TradingScreenInput(); - initData->inventory = inventory; - initData->trader = trader; - initData->level = level; - initData->iPad = iPad; - if(app.GetLocalPlayerCount()>1) initData->bSplitscreen=true; - else initData->bSplitscreen=false; + TrapScreenInput* initData = new TrapScreenInput(); - success = ui.NavigateToScene(iPad,eUIScene_TradingMenu, initData); + initData->inventory = inventory; + initData->trap = trap; + initData->iPad = iPad; - return success; + // Load the scene. + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + success = ui.NavigateToScene(iPad, eUIScene_DispenserMenu, initData); + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_DispenserMenu, initData); + } + + return success; } +bool CMinecraftApp::LoadSignEntryMenu(int iPad, + std::shared_ptr sign) { + bool success = true; + + SignEntryScreenInput* initData = new SignEntryScreenInput(); + + initData->sign = sign; + initData->iPad = iPad; + + success = ui.NavigateToScene(iPad, eUIScene_SignEntryMenu, initData); + + delete initData; + + return success; +} + +bool CMinecraftApp::LoadRepairingMenu(int iPad, + std::shared_ptr inventory, + Level* level, int x, int y, int z) { + bool success = true; + + AnvilScreenInput* initData = new AnvilScreenInput(); + initData->inventory = inventory; + initData->level = level; + initData->x = x; + initData->y = y; + initData->z = z; + initData->iPad = iPad; + if (app.GetLocalPlayerCount() > 1) + initData->bSplitscreen = true; + else + initData->bSplitscreen = false; + + success = ui.NavigateToScene(iPad, eUIScene_AnvilMenu, initData); + + return success; +} + +bool CMinecraftApp::LoadTradingMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr trader, + Level* level, const std::wstring& name) { + bool success = true; + + TradingScreenInput* initData = new TradingScreenInput(); + initData->inventory = inventory; + initData->trader = trader; + initData->level = level; + initData->iPad = iPad; + if (app.GetLocalPlayerCount() > 1) + initData->bSplitscreen = true; + else + initData->bSplitscreen = false; + + success = ui.NavigateToScene(iPad, eUIScene_TradingMenu, initData); + + return success; +} + +bool CMinecraftApp::LoadHopperMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr hopper) { + bool success = true; + + HopperScreenInput* initData = new HopperScreenInput(); + initData->inventory = inventory; + initData->hopper = hopper; + initData->iPad = iPad; + if (app.GetLocalPlayerCount() > 1) + initData->bSplitscreen = true; + else + initData->bSplitscreen = false; + + success = ui.NavigateToScene(iPad, eUIScene_HopperMenu, initData); + + return success; +} + +bool CMinecraftApp::LoadHopperMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr hopper) { + bool success = true; + + HopperScreenInput* initData = new HopperScreenInput(); + initData->inventory = inventory; + initData->hopper = std::dynamic_pointer_cast(hopper); + initData->iPad = iPad; + if (app.GetLocalPlayerCount() > 1) + initData->bSplitscreen = true; + else + initData->bSplitscreen = false; + + success = ui.NavigateToScene(iPad, eUIScene_HopperMenu, initData); + + return success; +} + +bool CMinecraftApp::LoadHorseMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr container, + std::shared_ptr horse) { + bool success = true; + + HorseScreenInput* initData = new HorseScreenInput(); + initData->inventory = inventory; + initData->container = container; + initData->horse = horse; + initData->iPad = iPad; + if (app.GetLocalPlayerCount() > 1) + initData->bSplitscreen = true; + else + initData->bSplitscreen = false; + + success = ui.NavigateToScene(iPad, eUIScene_HorseMenu, initData); + + return success; +} + +bool CMinecraftApp::LoadBeaconMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr beacon) { + bool success = true; + + BeaconScreenInput* initData = new BeaconScreenInput(); + initData->inventory = inventory; + initData->beacon = beacon; + initData->iPad = iPad; + if (app.GetLocalPlayerCount() > 1) + initData->bSplitscreen = true; + else + initData->bSplitscreen = false; + + success = ui.NavigateToScene(iPad, eUIScene_BeaconMenu, initData); + + return success; +} ////////////////////////////////////////////// // GAME SETTINGS ////////////////////////////////////////////// -void CMinecraftApp::InitGameSettings() -{ - for(int i=0;ibSettingsChanged=false; + // clear the flag to say the settings have changed + GameSettingsA[i]->bSettingsChanged = false; - //SetDefaultGameSettings(i); - done on a callback from the profile manager + // SetDefaultGameSettings(i); - done on a callback from the profile + // manager - // 4J-PB - adding in for Windows & PS3 to set the defaults for the joypad -#if defined _WINDOWS64// || defined __PSVITA__ - C_4JProfile::PROFILESETTINGS *pProfileSettings=ProfileManager.GetDashboardProfileSettings(i); - // clear this for now - it will come from reading the system values - memset(pProfileSettings,0,sizeof(C_4JProfile::PROFILESETTINGS)); - SetDefaultOptions(pProfileSettings,i); -#elif defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__ - C4JStorage::PROFILESETTINGS *pProfileSettings=StorageManager.GetDashboardProfileSettings(i); - // 4J-PB - don't cause an options write to happen here - SetDefaultOptions(pProfileSettings,i,false); + // 4J-PB - adding in for Windows & PS3 to set the defaults for the + // joypad +#if defined _WINDOWS64 // || defined __PSVITA__ + C_4JProfile::PROFILESETTINGS* pProfileSettings = + ProfileManager.GetDashboardProfileSettings(i); + // clear this for now - it will come from reading the system values + memset(pProfileSettings, 0, sizeof(C_4JProfile::PROFILESETTINGS)); + SetDefaultOptions(pProfileSettings, i); +#elif defined __PS3__ || defined __ORBIS__ || defined _DURANGO || \ + defined __PSVITA__ + C4JStorage::PROFILESETTINGS* pProfileSettings = + StorageManager.GetDashboardProfileSettings(i); + // 4J-PB - don't cause an options write to happen here + SetDefaultOptions(pProfileSettings, i, false); #else - // 4jcrqaft: Linux (and any other platform): profile data is zero-initialised, so explicitly apply defaults - C_4JProfile::PROFILESETTINGS *pProfileSettings=ProfileManager.GetDashboardProfileSettings(i); - memset(pProfileSettings,0,sizeof(C_4JProfile::PROFILESETTINGS)); - SetDefaultOptions(pProfileSettings,i); + // 4jcrqaft: Linux (and any other platform): profile data is + // zero-initialised, so explicitly apply defaults + C_4JProfile::PROFILESETTINGS* pProfileSettings = + ProfileManager.GetDashboardProfileSettings(i); + memset(pProfileSettings, 0, sizeof(C_4JProfile::PROFILESETTINGS)); + SetDefaultOptions(pProfileSettings, i); #endif - } + } } -#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) -int CMinecraftApp::SetDefaultOptions(C4JStorage::PROFILESETTINGS *pSettings,const int iPad,bool bWriteProfile) +#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || \ + defined __PSVITA__) +int CMinecraftApp::SetDefaultOptions(C4JStorage::PROFILESETTINGS* pSettings, + const int iPad, bool bWriteProfile) #else -int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,const int iPad) +int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS* pSettings, + const int iPad) #endif { - SetGameSettings(iPad,eGameSetting_MusicVolume,DEFAULT_VOLUME_LEVEL); - SetGameSettings(iPad,eGameSetting_SoundFXVolume,DEFAULT_VOLUME_LEVEL); - SetGameSettings(iPad,eGameSetting_Gamma,50); + SetGameSettings(iPad, eGameSetting_MusicVolume, DEFAULT_VOLUME_LEVEL); + SetGameSettings(iPad, eGameSetting_SoundFXVolume, DEFAULT_VOLUME_LEVEL); + SetGameSettings(iPad, eGameSetting_Gamma, 50); - // 4J-PB - Don't reset the difficult level if we're in-game - if(Minecraft::GetInstance()->level==NULL) - { - app.DebugPrintf("SetDefaultOptions - Difficulty = 1\n"); - SetGameSettings(iPad,eGameSetting_Difficulty,1); - } - SetGameSettings(iPad,eGameSetting_Sensitivity_InGame,100); - SetGameSettings(iPad,eGameSetting_ViewBob,1); - SetGameSettings(iPad,eGameSetting_ControlScheme,0); - SetGameSettings(iPad,eGameSetting_ControlInvertLook,(pSettings->iYAxisInversion!=0)?1:0); - SetGameSettings(iPad,eGameSetting_ControlSouthPaw,pSettings->bSwapSticks?1:0); - SetGameSettings(iPad,eGameSetting_SplitScreenVertical,0); - SetGameSettings(iPad,eGameSetting_GamertagsVisible,1); + // 4J-PB - Don't reset the difficult level if we're in-game + if (Minecraft::GetInstance()->level == NULL) { + app.DebugPrintf("SetDefaultOptions - Difficulty = 1\n"); + SetGameSettings(iPad, eGameSetting_Difficulty, 1); + } + SetGameSettings(iPad, eGameSetting_Sensitivity_InGame, 100); + SetGameSettings(iPad, eGameSetting_ViewBob, 1); + SetGameSettings(iPad, eGameSetting_ControlScheme, 0); + SetGameSettings(iPad, eGameSetting_ControlInvertLook, + (pSettings->iYAxisInversion != 0) ? 1 : 0); + SetGameSettings(iPad, eGameSetting_ControlSouthPaw, + pSettings->bSwapSticks ? 1 : 0); + SetGameSettings(iPad, eGameSetting_SplitScreenVertical, 0); + SetGameSettings(iPad, eGameSetting_GamertagsVisible, 1); - // Interim TU 1.6.6 - SetGameSettings(iPad,eGameSetting_Sensitivity_InMenu,100); - SetGameSettings(iPad,eGameSetting_DisplaySplitscreenGamertags,1); - SetGameSettings(iPad,eGameSetting_Hints,1); - SetGameSettings(iPad,eGameSetting_Autosave,2); - SetGameSettings(iPad,eGameSetting_Tooltips,1); - SetGameSettings(iPad,eGameSetting_InterfaceOpacity,80); + // Interim TU 1.6.6 + SetGameSettings(iPad, eGameSetting_Sensitivity_InMenu, 100); + SetGameSettings(iPad, eGameSetting_DisplaySplitscreenGamertags, 1); + SetGameSettings(iPad, eGameSetting_Hints, 1); + SetGameSettings(iPad, eGameSetting_Autosave, 2); + SetGameSettings(iPad, eGameSetting_Tooltips, 1); + SetGameSettings(iPad, eGameSetting_InterfaceOpacity, 80); - // TU 5 - SetGameSettings(iPad,eGameSetting_Clouds,1); - SetGameSettings(iPad,eGameSetting_Online,1); - SetGameSettings(iPad,eGameSetting_InviteOnly,0); - SetGameSettings(iPad,eGameSetting_FriendsOfFriends,1); + // TU 5 + SetGameSettings(iPad, eGameSetting_Clouds, 1); + SetGameSettings(iPad, eGameSetting_Online, 1); + SetGameSettings(iPad, eGameSetting_InviteOnly, 0); + SetGameSettings(iPad, eGameSetting_FriendsOfFriends, 1); - // default the update changes message to zero - // 4J-PB - We'll only display the message if the profile is pre-TU5 - //SetGameSettings(iPad,eGameSetting_DisplayUpdateMessage,0); + // default the update changes message to zero + // 4J-PB - We'll only display the message if the profile is pre-TU5 + // SetGameSettings(iPad,eGameSetting_DisplayUpdateMessage,0); - // TU 6 - SetGameSettings(iPad,eGameSetting_BedrockFog,0); - SetGameSettings(iPad,eGameSetting_DisplayHUD,1); - SetGameSettings(iPad,eGameSetting_DisplayHand,1); + // TU 6 + SetGameSettings(iPad, eGameSetting_BedrockFog, 0); + SetGameSettings(iPad, eGameSetting_DisplayHUD, 1); + SetGameSettings(iPad, eGameSetting_DisplayHand, 1); - // TU 7 - SetGameSettings(iPad,eGameSetting_CustomSkinAnim,1); + // TU 7 + SetGameSettings(iPad, eGameSetting_CustomSkinAnim, 1); - // TU 9 - SetGameSettings(iPad,eGameSetting_DeathMessages,1); - SetGameSettings(iPad,eGameSetting_UISize,1); - SetGameSettings(iPad,eGameSetting_UISizeSplitscreen,2); - SetGameSettings(iPad,eGameSetting_AnimatedCharacter,1); + // TU 9 + SetGameSettings(iPad, eGameSetting_DeathMessages, 1); + SetGameSettings(iPad, eGameSetting_UISize, 1); + SetGameSettings(iPad, eGameSetting_UISizeSplitscreen, 2); + SetGameSettings(iPad, eGameSetting_AnimatedCharacter, 1); - // TU 12 - GameSettingsA[iPad]->ucCurrentFavoriteSkinPos=0; - for(int i=0;iuiFavoriteSkinA[i]=0xFFFFFFFF; - } + // TU 12 + GameSettingsA[iPad]->ucCurrentFavoriteSkinPos = 0; + for (int i = 0; i < MAX_FAVORITE_SKINS; i++) { + GameSettingsA[iPad]->uiFavoriteSkinA[i] = 0xFFFFFFFF; + } - // TU 13 - GameSettingsA[iPad]->uiMashUpPackWorldsDisplay=0xFFFFFFFF; + // TU 13 + GameSettingsA[iPad]->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; - // 4J-PB - leave these in, or remove from everywhere they are referenced! - // Although probably best to leave in unless we split the profile settings into platform specific classes - having different meaning per platform for the same bitmask could get confusing -//#ifdef __PS3__ - // PS3DEC13 - SetGameSettings(iPad,eGameSetting_PS3_EULA_Read,0); // EULA not read + // 1.6.4 + app.SetGameHostOption(eGameHostOption_MobGriefing, 1); + app.SetGameHostOption(eGameHostOption_KeepInventory, 0); + app.SetGameHostOption(eGameHostOption_DoMobSpawning, 1); + app.SetGameHostOption(eGameHostOption_DoMobLoot, 1); + app.SetGameHostOption(eGameHostOption_DoTileDrops, 1); + app.SetGameHostOption(eGameHostOption_NaturalRegeneration, 1); + app.SetGameHostOption(eGameHostOption_DoDaylightCycle, 1); - // PS3 1.05 - added Greek - GameSettingsA[iPad]->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; // use the system language -//#endif + // 4J-PB - leave these in, or remove from everywhere they are referenced! + // Although probably best to leave in unless we split the profile settings + // into platform specific classes - having different meaning per platform + // for the same bitmask could get confusing + // #ifdef __PS3__ + // PS3DEC13 + SetGameSettings(iPad, eGameSetting_PS3_EULA_Read, 0); // EULA not read -#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) - GameSettingsA[iPad]->bSettingsChanged=bWriteProfile; + // PS3 1.05 - added Greek + + // 4J-JEV: We cannot change these in-game, as they could affect localised + // strings and font. XB1: Fix for #172947 - Content: Gameplay: While playing + // in language different form system default one and resetting options to + // their defaults in active gameplay causes in-game language to change and + // HUD to disappear + if (!app.GetGameStarted()) { + GameSettingsA[iPad]->ucLanguage = + MINECRAFT_LANGUAGE_DEFAULT; // use the system language + GameSettingsA[iPad]->ucLocale = + MINECRAFT_LANGUAGE_DEFAULT; // use the system locale + } + + // #endif + +#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || \ + defined __PSVITA__) + GameSettingsA[iPad]->bSettingsChanged = bWriteProfile; #endif - return 0; + return 0; } -#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) -int CMinecraftApp::DefaultOptionsCallback(void *pParam,C4JStorage::PROFILESETTINGS *pSettings, const int iPad) +#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || \ + defined __PSVITA__) +int CMinecraftApp::DefaultOptionsCallback( + void* pParam, C4JStorage::PROFILESETTINGS* pSettings, const int iPad) #else -int CMinecraftApp::DefaultOptionsCallback(void *pParam,C_4JProfile::PROFILESETTINGS *pSettings, const int iPad) +int CMinecraftApp::DefaultOptionsCallback( + void* pParam, C_4JProfile::PROFILESETTINGS* pSettings, const int iPad) #endif { - CMinecraftApp *pApp=(CMinecraftApp *)pParam; + CMinecraftApp* pApp = (CMinecraftApp*)pParam; - // flag the default options to be set + // flag the default options to be set - pApp->DebugPrintf("Setting default options for player %d", iPad); - pApp->SetAction(iPad,eAppAction_SetDefaultOptions, pSettings); - //pApp->SetDefaultOptions(pSettings,iPad); - - // if the profile data has been changed, then force a profile write - // It seems we're allowed to break the 5 minute rule if it's the result of a user action - //pApp->CheckGameSettingsChanged(); + pApp->DebugPrintf("Setting default options for player %d", iPad); + pApp->SetAction(iPad, eAppAction_SetDefaultOptions, (void*)pSettings); + // pApp->SetDefaultOptions(pSettings,iPad); - return 0; + // if the profile data has been changed, then force a profile write + // It seems we're allowed to break the 5 minute rule if it's the result of a + // user action + // pApp->CheckGameSettingsChanged(); + + return 0; } -#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) +#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || \ + defined __PSVITA__) + +std::wstring CMinecraftApp::toStringOptionsStatus( + const C4JStorage::eOptionsCallback& eStatus) { +#ifndef _CONTENT_PACKAGE + switch (eStatus) { + case C4JStorage::eOptions_Callback_Idle: + return L"Idle"; + case C4JStorage::eOptions_Callback_Write: + return L"Write"; + case C4JStorage::eOptions_Callback_Write_Fail_NoSpace: + return L"Write_Fail_NoSpace"; + case C4JStorage::eOptions_Callback_Write_Fail: + return L"Write_Fail"; + case C4JStorage::eOptions_Callback_Read: + return L"Read"; + case C4JStorage::eOptions_Callback_Read_Fail: + return L"Read_Fail"; + case C4JStorage::eOptions_Callback_Read_FileNotFound: + return L"Read_FileNotFound"; + case C4JStorage::eOptions_Callback_Read_Corrupt: + return L"Read_Corrupt"; + case C4JStorage::eOptions_Callback_Read_CorruptDeletePending: + return L"Read_CorruptDeletePending"; + case C4JStorage::eOptions_Callback_Read_CorruptDeleted: + return L"Read_CorruptDeleted"; + default: + return L"[UNRECOGNISED_OPTIONS_STATUS]"; + } +#else + return L""; +#endif +} #ifdef __ORBIS__ -int CMinecraftApp::OptionsDataCallback(void *pParam,int iPad,unsigned short usVersion,C4JStorage::eOptionsCallback eStatus,int iBlocksRequired) -{ - CMinecraftApp *pApp=(CMinecraftApp *)pParam; - pApp->m_eOptionsStatusA[iPad]=eStatus; - pApp->m_eOptionsBlocksRequiredA[iPad]=iBlocksRequired; - return 0; +int CMinecraftApp::OptionsDataCallback(void* pParam, int iPad, + unsigned short usVersion, + C4JStorage::eOptionsCallback eStatus, + int iBlocksRequired) { + CMinecraftApp* pApp = (CMinecraftApp*)pParam; + pApp->m_eOptionsStatusA[iPad] = eStatus; + pApp->m_eOptionsBlocksRequiredA[iPad] = iBlocksRequired; + return 0; } -int CMinecraftApp::GetOptionsBlocksRequired(int iPad) -{ - return m_eOptionsBlocksRequiredA[iPad]; +int CMinecraftApp::GetOptionsBlocksRequired(int iPad) { + return m_eOptionsBlocksRequiredA[iPad]; } #else -int CMinecraftApp::OptionsDataCallback(void *pParam,int iPad,unsigned short usVersion,C4JStorage::eOptionsCallback eStatus) -{ - CMinecraftApp *pApp=(CMinecraftApp *)pParam; - pApp->m_eOptionsStatusA[iPad]=eStatus; - return 0; +int CMinecraftApp::OptionsDataCallback(void* pParam, int iPad, + unsigned short usVersion, + C4JStorage::eOptionsCallback eStatus) { + CMinecraftApp* pApp = (CMinecraftApp*)pParam; + +#ifndef _CONTENT_PACKAGE + pApp->DebugPrintf("[OptionsDataCallback] Pad_%i: new status == %ls(%i).\n", + iPad, pApp->toStringOptionsStatus(eStatus).c_str(), + (int)eStatus); +#endif + + pApp->m_eOptionsStatusA[iPad] = eStatus; + + return 0; } #endif -C4JStorage::eOptionsCallback CMinecraftApp::GetOptionsCallbackStatus(int iPad) -{ - return m_eOptionsStatusA[iPad]; +C4JStorage::eOptionsCallback CMinecraftApp::GetOptionsCallbackStatus(int iPad) { + return m_eOptionsStatusA[iPad]; } -void CMinecraftApp::SetOptionsCallbackStatus(int iPad, C4JStorage::eOptionsCallback eStatus) -{ - m_eOptionsStatusA[iPad]=eStatus; +void CMinecraftApp::SetOptionsCallbackStatus( + int iPad, C4JStorage::eOptionsCallback eStatus) { + m_eOptionsStatusA[iPad] = eStatus; } #endif -int CMinecraftApp::OldProfileVersionCallback(void *pParam,unsigned char *pucData, const unsigned short usVersion, const int iPad) -{ - // check what needs to be done with this version to update to the current one +int CMinecraftApp::OldProfileVersionCallback(void* pParam, + unsigned char* pucData, + const unsigned short usVersion, + const int iPad) { + // check what needs to be done with this version to update to the current + // one - switch(usVersion) - { + switch (usVersion) { #ifdef _XBOX - case PROFILE_VERSION_1: - case PROFILE_VERSION_2: - // need to fill in values for the new profile data. No need to save the profile - that'll happen if they get changed, or if the auto save for the profile kicks in - { - GAME_SETTINGS *pGameSettings=(GAME_SETTINGS *)pucData; - pGameSettings->ucMenuSensitivity=100; //eGameSetting_Sensitivity_InMenu - pGameSettings->ucInterfaceOpacity=80; //eGameSetting_Sensitivity_InMenu - pGameSettings->usBitmaskValues|=0x0200; //eGameSetting_DisplaySplitscreenGamertags - on - pGameSettings->usBitmaskValues|=0x0400; //eGameSetting_Hints - on - pGameSettings->usBitmaskValues|=0x1000; //eGameSetting_Autosave - 2 - pGameSettings->usBitmaskValues|=0x8000; //eGameSetting_Tooltips - on + case PROFILE_VERSION_1: + case PROFILE_VERSION_2: + // need to fill in values for the new profile data. No need to save + // the profile - that'll happen if they get changed, or if the auto + // save for the profile kicks in + { + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; + pGameSettings->ucMenuSensitivity = + 100; // eGameSetting_Sensitivity_InMenu + pGameSettings->ucInterfaceOpacity = + 80; // eGameSetting_Sensitivity_InMenu + pGameSettings->usBitmaskValues |= + 0x0200; // eGameSetting_DisplaySplitscreenGamertags - on + pGameSettings->usBitmaskValues |= + 0x0400; // eGameSetting_Hints - on + pGameSettings->usBitmaskValues |= + 0x1000; // eGameSetting_Autosave - 2 + pGameSettings->usBitmaskValues |= + 0x8000; // eGameSetting_Tooltips - on - // 4J-PB - Let's also award all the achievements they have again because of the profile bug that seemed to stop the awards of some - // Changing this to check the system achievements at sign-in and award any that the game says we have and the system says we haven't - //ProfileManager.ReAwardAchievements(iPad); + // 4J-PB - Let's also award all the achievements they have again + // because of the profile bug that seemed to stop the awards of + // some Changing this to check the system achievements at + // sign-in and award any that the game says we have and the + // system says we haven't + // ProfileManager.ReAwardAchievements(iPad); - pGameSettings->uiBitmaskValues=0L; // reset - pGameSettings->uiBitmaskValues|=GAMESETTING_CLOUDS; //eGameSetting_Clouds - on - pGameSettings->uiBitmaskValues|=GAMESETTING_ONLINE; //eGameSetting_GameSetting_Online - on - //eGameSetting_GameSetting_Invite - off - pGameSettings->uiBitmaskValues|=GAMESETTING_FRIENDSOFFRIENDS; //eGameSetting_GameSetting_FriendsOfFriends - on - pGameSettings->uiBitmaskValues|=GAMESETTING_DISPLAYUPDATEMSG; //eGameSetting_DisplayUpdateMessage (counter) - // TU6 - pGameSettings->uiBitmaskValues&=~GAMESETTING_BEDROCKFOG; //eGameSetting_BedrockFog - off - pGameSettings->uiBitmaskValues|=GAMESETTING_DISPLAYHUD; //eGameSetting_DisplayHUD - on - pGameSettings->uiBitmaskValues|=GAMESETTING_DISPLAYHAND; //eGameSetting_DisplayHand - on - // TU7 - pGameSettings->uiBitmaskValues|=GAMESETTING_CUSTOMSKINANIM; //eGameSetting_CustomSkinAnim - on - // TU9 - pGameSettings->uiBitmaskValues|=GAMESETTING_DEATHMESSAGES; //eGameSetting_DeathMessages - on - pGameSettings->uiBitmaskValues|=(GAMESETTING_UISIZE&0x00000800); // uisize 2 - pGameSettings->uiBitmaskValues|=(GAMESETTING_UISIZE_SPLITSCREEN&0x00004000); // splitscreen ui size 3 - pGameSettings->uiBitmaskValues|=GAMESETTING_ANIMATEDCHARACTER; //eGameSetting_AnimatedCharacter - on - // TU12 - // favorite skins added, but only set in TU12 - set to FFs - for(int i=0;iuiFavoriteSkinA[i]=0xFFFFFFFF; - } - pGameSettings->ucCurrentFavoriteSkinPos=0; - // Added a bitmask in TU13 to enable/disable display of the Mash-up pack worlds in the saves list - pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; + pGameSettings->uiBitmaskValues = 0L; // reset + pGameSettings->uiBitmaskValues |= + GAMESETTING_CLOUDS; // eGameSetting_Clouds - on + pGameSettings->uiBitmaskValues |= + GAMESETTING_ONLINE; // eGameSetting_GameSetting_Online - on + // eGameSetting_GameSetting_Invite - off + pGameSettings->uiBitmaskValues |= + GAMESETTING_FRIENDSOFFRIENDS; // eGameSetting_GameSetting_FriendsOfFriends + // - on + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage + // (counter) + // TU6 + pGameSettings->uiBitmaskValues &= + ~GAMESETTING_BEDROCKFOG; // eGameSetting_BedrockFog - off + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYHUD; // eGameSetting_DisplayHUD - on + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYHAND; // eGameSetting_DisplayHand - on + // TU7 + pGameSettings->uiBitmaskValues |= + GAMESETTING_CUSTOMSKINANIM; // eGameSetting_CustomSkinAnim + // - on + // TU9 + pGameSettings->uiBitmaskValues |= + GAMESETTING_DEATHMESSAGES; // eGameSetting_DeathMessages - + // on + pGameSettings->uiBitmaskValues |= + (GAMESETTING_UISIZE & 0x00000800); // uisize 2 + pGameSettings->uiBitmaskValues |= + (GAMESETTING_UISIZE_SPLITSCREEN & + 0x00004000); // splitscreen ui size 3 + pGameSettings->uiBitmaskValues |= + GAMESETTING_ANIMATEDCHARACTER; // eGameSetting_AnimatedCharacter + // - on + // TU12 + // favorite skins added, but only set in TU12 - set to FFs + for (int i = 0; i < MAX_FAVORITE_SKINS; i++) { + pGameSettings->uiFavoriteSkinA[i] = 0xFFFFFFFF; + } + pGameSettings->ucCurrentFavoriteSkinPos = 0; + // Added a bitmask in TU13 to enable/disable display of the + // Mash-up pack worlds in the saves list + pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; - // PS3 1.05 - added Greek - pGameSettings->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; // use the system language - } - break; - case PROFILE_VERSION_3: + // PS3 1.05 - added Greek + pGameSettings->ucLanguage = + MINECRAFT_LANGUAGE_DEFAULT; // use the system language + } + break; + case PROFILE_VERSION_3: - { - GAME_SETTINGS *pGameSettings=(GAME_SETTINGS *)pucData; - pGameSettings->uiBitmaskValues=0L; // reset - pGameSettings->uiBitmaskValues|=GAMESETTING_CLOUDS; //eGameSetting_Clouds - on - pGameSettings->uiBitmaskValues|=GAMESETTING_ONLINE; //eGameSetting_GameSetting_Online - on - //eGameSetting_GameSetting_Invite - off - pGameSettings->uiBitmaskValues|=GAMESETTING_FRIENDSOFFRIENDS; //eGameSetting_GameSetting_FriendsOfFriends - on - pGameSettings->uiBitmaskValues|=GAMESETTING_DISPLAYUPDATEMSG; //eGameSetting_DisplayUpdateMessage (counter) - // TU6 - pGameSettings->uiBitmaskValues&=~GAMESETTING_BEDROCKFOG; //eGameSetting_BedrockFog - off - pGameSettings->uiBitmaskValues|=GAMESETTING_DISPLAYHUD; //eGameSetting_DisplayHUD - on - pGameSettings->uiBitmaskValues|=GAMESETTING_DISPLAYHAND; //eGameSetting_DisplayHand - on - // TU7 - pGameSettings->uiBitmaskValues|=GAMESETTING_CUSTOMSKINANIM; //eGameSetting_CustomSkinAnim - on - // TU9 - pGameSettings->uiBitmaskValues|=GAMESETTING_DEATHMESSAGES; //eGameSetting_DeathMessages - on - pGameSettings->uiBitmaskValues|=(GAMESETTING_UISIZE&0x00000800); // uisize 2 - pGameSettings->uiBitmaskValues|=(GAMESETTING_UISIZE_SPLITSCREEN&0x00004000); // splitscreen ui size 3 - pGameSettings->uiBitmaskValues|=GAMESETTING_ANIMATEDCHARACTER; //eGameSetting_AnimatedCharacter - on - // TU12 - // favorite skins added, but only set in TU12 - set to FFs - for(int i=0;iuiFavoriteSkinA[i]=0xFFFFFFFF; - } - pGameSettings->ucCurrentFavoriteSkinPos=0; - // Added a bitmask in TU13 to enable/disable display of the Mash-up pack worlds in the saves list - pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; + { + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; + pGameSettings->uiBitmaskValues = 0L; // reset + pGameSettings->uiBitmaskValues |= + GAMESETTING_CLOUDS; // eGameSetting_Clouds - on + pGameSettings->uiBitmaskValues |= + GAMESETTING_ONLINE; // eGameSetting_GameSetting_Online - on + // eGameSetting_GameSetting_Invite - off + pGameSettings->uiBitmaskValues |= + GAMESETTING_FRIENDSOFFRIENDS; // eGameSetting_GameSetting_FriendsOfFriends + // - on + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage + // (counter) + // TU6 + pGameSettings->uiBitmaskValues &= + ~GAMESETTING_BEDROCKFOG; // eGameSetting_BedrockFog - off + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYHUD; // eGameSetting_DisplayHUD - on + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYHAND; // eGameSetting_DisplayHand - on + // TU7 + pGameSettings->uiBitmaskValues |= + GAMESETTING_CUSTOMSKINANIM; // eGameSetting_CustomSkinAnim - on + // TU9 + pGameSettings->uiBitmaskValues |= + GAMESETTING_DEATHMESSAGES; // eGameSetting_DeathMessages - on + pGameSettings->uiBitmaskValues |= + (GAMESETTING_UISIZE & 0x00000800); // uisize 2 + pGameSettings->uiBitmaskValues |= + (GAMESETTING_UISIZE_SPLITSCREEN & + 0x00004000); // splitscreen ui size 3 + pGameSettings->uiBitmaskValues |= + GAMESETTING_ANIMATEDCHARACTER; // eGameSetting_AnimatedCharacter + // - on + // TU12 + // favorite skins added, but only set in TU12 - set to FFs + for (int i = 0; i < MAX_FAVORITE_SKINS; i++) { + pGameSettings->uiFavoriteSkinA[i] = 0xFFFFFFFF; + } + pGameSettings->ucCurrentFavoriteSkinPos = 0; + // Added a bitmask in TU13 to enable/disable display of the Mash-up + // pack worlds in the saves list + pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; - // PS3 1.05 - added Greek - pGameSettings->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; // use the system language + // PS3 1.05 - added Greek + pGameSettings->ucLanguage = + MINECRAFT_LANGUAGE_DEFAULT; // use the system language - } - break; - case PROFILE_VERSION_4: - { - GAME_SETTINGS *pGameSettings=(GAME_SETTINGS *)pucData; - - pGameSettings->uiBitmaskValues&=~GAMESETTING_BEDROCKFOG; //eGameSetting_BedrockFog - off - pGameSettings->uiBitmaskValues|=GAMESETTING_DISPLAYHUD; //eGameSetting_DisplayHUD - on - pGameSettings->uiBitmaskValues|=GAMESETTING_DISPLAYHAND; //eGameSetting_DisplayHand - on - // TU7 - pGameSettings->uiBitmaskValues|=GAMESETTING_CUSTOMSKINANIM; //eGameSetting_CustomSkinAnim - on - // TU9 - pGameSettings->uiBitmaskValues|=GAMESETTING_DEATHMESSAGES; //eGameSetting_DeathMessages - on - pGameSettings->uiBitmaskValues|=(GAMESETTING_UISIZE&0x00000800); // uisize 2 - pGameSettings->uiBitmaskValues|=(GAMESETTING_UISIZE_SPLITSCREEN&0x00004000); // splitscreen ui size 3 - pGameSettings->uiBitmaskValues|=GAMESETTING_ANIMATEDCHARACTER; //eGameSetting_AnimatedCharacter - on + } break; + case PROFILE_VERSION_4: { + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; - // Set the online flag to on, so it's not saved if a game starts offline when the user didn't change it to be offline (xbox disconnected from LIVE) - pGameSettings->uiBitmaskValues|=GAMESETTING_ONLINE; //eGameSetting_GameSetting_Online - on - // TU12 - // favorite skins added, but only set in TU12 - set to FFs - for(int i=0;iuiFavoriteSkinA[i]=0xFFFFFFFF; - } - pGameSettings->ucCurrentFavoriteSkinPos=0; - // Added a bitmask in TU13 to enable/disable display of the Mash-up pack worlds in the saves list - pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; + pGameSettings->uiBitmaskValues &= + ~GAMESETTING_BEDROCKFOG; // eGameSetting_BedrockFog - off + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYHUD; // eGameSetting_DisplayHUD - on + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYHAND; // eGameSetting_DisplayHand - on + // TU7 + pGameSettings->uiBitmaskValues |= + GAMESETTING_CUSTOMSKINANIM; // eGameSetting_CustomSkinAnim - on + // TU9 + pGameSettings->uiBitmaskValues |= + GAMESETTING_DEATHMESSAGES; // eGameSetting_DeathMessages - on + pGameSettings->uiBitmaskValues |= + (GAMESETTING_UISIZE & 0x00000800); // uisize 2 + pGameSettings->uiBitmaskValues |= + (GAMESETTING_UISIZE_SPLITSCREEN & + 0x00004000); // splitscreen ui size 3 + pGameSettings->uiBitmaskValues |= + GAMESETTING_ANIMATEDCHARACTER; // eGameSetting_AnimatedCharacter + // - on - // PS3 1.05 - added Greek - pGameSettings->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; // use the system language + // Set the online flag to on, so it's not saved if a game starts + // offline when the user didn't change it to be offline (xbox + // disconnected from LIVE) + pGameSettings->uiBitmaskValues |= + GAMESETTING_ONLINE; // eGameSetting_GameSetting_Online - on + // TU12 + // favorite skins added, but only set in TU12 - set to FFs + for (int i = 0; i < MAX_FAVORITE_SKINS; i++) { + pGameSettings->uiFavoriteSkinA[i] = 0xFFFFFFFF; + } + pGameSettings->ucCurrentFavoriteSkinPos = 0; + // Added a bitmask in TU13 to enable/disable display of the Mash-up + // pack worlds in the saves list + pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; - } + // PS3 1.05 - added Greek + pGameSettings->ucLanguage = + MINECRAFT_LANGUAGE_DEFAULT; // use the system language - break; - case PROFILE_VERSION_5: - { - GAME_SETTINGS *pGameSettings=(GAME_SETTINGS *)pucData; + } - // reset the display new message counter - pGameSettings->uiBitmaskValues|=GAMESETTING_DISPLAYUPDATEMSG; //eGameSetting_DisplayUpdateMessage (counter) - // TU7 - pGameSettings->uiBitmaskValues|=GAMESETTING_CUSTOMSKINANIM; //eGameSetting_CustomSkinAnim - on - // TU9 - pGameSettings->uiBitmaskValues|=GAMESETTING_DEATHMESSAGES; //eGameSetting_DeathMessages - on - pGameSettings->uiBitmaskValues|=(GAMESETTING_UISIZE&0x00000800); // uisize 2 - pGameSettings->uiBitmaskValues|=(GAMESETTING_UISIZE_SPLITSCREEN&0x00004000); // splitscreen ui size 3 - pGameSettings->uiBitmaskValues|=GAMESETTING_ANIMATEDCHARACTER; //eGameSetting_AnimatedCharacter - on - // Set the online flag to on, so it's not saved if a game starts offline when the user didn't change it to be offline (xbox disconnected from LIVE) - pGameSettings->uiBitmaskValues|=GAMESETTING_ONLINE; //eGameSetting_GameSetting_Online - on - // TU12 - // favorite skins added, but only set in TU12 - set to FFs - for(int i=0;iuiFavoriteSkinA[i]=0xFFFFFFFF; - } - pGameSettings->ucCurrentFavoriteSkinPos=0; - // Added a bitmask in TU13 to enable/disable display of the Mash-up pack worlds in the saves list - pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; + break; + case PROFILE_VERSION_5: { + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; - // PS3 1.05 - added Greek - pGameSettings->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; // use the system language + // reset the display new message counter + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage + // (counter) + // TU7 + pGameSettings->uiBitmaskValues |= + GAMESETTING_CUSTOMSKINANIM; // eGameSetting_CustomSkinAnim - on + // TU9 + pGameSettings->uiBitmaskValues |= + GAMESETTING_DEATHMESSAGES; // eGameSetting_DeathMessages - on + pGameSettings->uiBitmaskValues |= + (GAMESETTING_UISIZE & 0x00000800); // uisize 2 + pGameSettings->uiBitmaskValues |= + (GAMESETTING_UISIZE_SPLITSCREEN & + 0x00004000); // splitscreen ui size 3 + pGameSettings->uiBitmaskValues |= + GAMESETTING_ANIMATEDCHARACTER; // eGameSetting_AnimatedCharacter + // - on + // Set the online flag to on, so it's not saved if a game starts + // offline when the user didn't change it to be offline (xbox + // disconnected from LIVE) + pGameSettings->uiBitmaskValues |= + GAMESETTING_ONLINE; // eGameSetting_GameSetting_Online - on + // TU12 + // favorite skins added, but only set in TU12 - set to FFs + for (int i = 0; i < MAX_FAVORITE_SKINS; i++) { + pGameSettings->uiFavoriteSkinA[i] = 0xFFFFFFFF; + } + pGameSettings->ucCurrentFavoriteSkinPos = 0; + // Added a bitmask in TU13 to enable/disable display of the Mash-up + // pack worlds in the saves list + pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; + // PS3 1.05 - added Greek + pGameSettings->ucLanguage = + MINECRAFT_LANGUAGE_DEFAULT; // use the system language - } + } - break; - case PROFILE_VERSION_6: - { - GAME_SETTINGS *pGameSettings=(GAME_SETTINGS *)pucData; + break; + case PROFILE_VERSION_6: { + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; - // Added gui size for splitscreen and fullscreen - // Added death messages toggle + // Added gui size for splitscreen and fullscreen + // Added death messages toggle - // reset the display new message counter - pGameSettings->uiBitmaskValues|=GAMESETTING_DISPLAYUPDATEMSG; //eGameSetting_DisplayUpdateMessage (counter) - // TU9 - pGameSettings->uiBitmaskValues|=GAMESETTING_DEATHMESSAGES; //eGameSetting_DeathMessages - on - pGameSettings->uiBitmaskValues|=(GAMESETTING_UISIZE&0x00000800); // uisize 2 - pGameSettings->uiBitmaskValues|=(GAMESETTING_UISIZE_SPLITSCREEN&0x00004000); // splitscreen ui size 3 - pGameSettings->uiBitmaskValues|=GAMESETTING_ANIMATEDCHARACTER; //eGameSetting_AnimatedCharacter - on - // Set the online flag to on, so it's not saved if a game starts offline when the user didn't change it to be offline (xbox disconnected from LIVE) - pGameSettings->uiBitmaskValues|=GAMESETTING_ONLINE; //eGameSetting_GameSetting_Online - on - // TU12 - // favorite skins added, but only set in TU12 - set to FFs - for(int i=0;iuiFavoriteSkinA[i]=0xFFFFFFFF; - } - pGameSettings->ucCurrentFavoriteSkinPos=0; - // Added a bitmask in TU13 to enable/disable display of the Mash-up pack worlds in the saves list - pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; + // reset the display new message counter + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage + // (counter) + // TU9 + pGameSettings->uiBitmaskValues |= + GAMESETTING_DEATHMESSAGES; // eGameSetting_DeathMessages - on + pGameSettings->uiBitmaskValues |= + (GAMESETTING_UISIZE & 0x00000800); // uisize 2 + pGameSettings->uiBitmaskValues |= + (GAMESETTING_UISIZE_SPLITSCREEN & + 0x00004000); // splitscreen ui size 3 + pGameSettings->uiBitmaskValues |= + GAMESETTING_ANIMATEDCHARACTER; // eGameSetting_AnimatedCharacter + // - on + // Set the online flag to on, so it's not saved if a game starts + // offline when the user didn't change it to be offline (xbox + // disconnected from LIVE) + pGameSettings->uiBitmaskValues |= + GAMESETTING_ONLINE; // eGameSetting_GameSetting_Online - on + // TU12 + // favorite skins added, but only set in TU12 - set to FFs + for (int i = 0; i < MAX_FAVORITE_SKINS; i++) { + pGameSettings->uiFavoriteSkinA[i] = 0xFFFFFFFF; + } + pGameSettings->ucCurrentFavoriteSkinPos = 0; + // Added a bitmask in TU13 to enable/disable display of the Mash-up + // pack worlds in the saves list + pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; - // PS3 1.05 - added Greek - pGameSettings->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; // use the system language + // PS3 1.05 - added Greek + pGameSettings->ucLanguage = + MINECRAFT_LANGUAGE_DEFAULT; // use the system language + } - } + break; - break; + case PROFILE_VERSION_7: { + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; + // reset the display new message counter + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage + // (counter) - case PROFILE_VERSION_7: - { - GAME_SETTINGS *pGameSettings=(GAME_SETTINGS *)pucData; - // reset the display new message counter - pGameSettings->uiBitmaskValues|=GAMESETTING_DISPLAYUPDATEMSG; //eGameSetting_DisplayUpdateMessage (counter) + // TU12 + // favorite skins added, but only set in TU12 - set to FFs + for (int i = 0; i < MAX_FAVORITE_SKINS; i++) { + pGameSettings->uiFavoriteSkinA[i] = 0xFFFFFFFF; + } + pGameSettings->ucCurrentFavoriteSkinPos = 0; + // Added a bitmask in TU13 to enable/disable display of the Mash-up + // pack worlds in the saves list + pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; - // TU12 - // favorite skins added, but only set in TU12 - set to FFs - for(int i=0;iuiFavoriteSkinA[i]=0xFFFFFFFF; - } - pGameSettings->ucCurrentFavoriteSkinPos=0; - // Added a bitmask in TU13 to enable/disable display of the Mash-up pack worlds in the saves list - pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; + // PS3 1.05 - added Greek + pGameSettings->ucLanguage = + MINECRAFT_LANGUAGE_DEFAULT; // use the system language - // PS3 1.05 - added Greek - pGameSettings->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; // use the system language - - - } - break; + } break; #endif - case PROFILE_VERSION_8: - { - GAME_SETTINGS *pGameSettings=(GAME_SETTINGS *)pucData; - // reset the display new message counter - //pGameSettings->uiBitmaskValues|=GAMESETTING_DISPLAYUPDATEMSG; //eGameSetting_DisplayUpdateMessage (counter) + case PROFILE_VERSION_8: { + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; + // reset the display new message counter + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage + // (counter) - // Added a bitmask in TU13 to enable/disable display of the Mash-up pack worlds in the saves list - pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; + // Added a bitmask in TU13 to enable/disable display of the Mash-up + // pack worlds in the saves list + pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; - // PS3DEC13 - pGameSettings->uiBitmaskValues&=~GAMESETTING_PS3EULAREAD; //eGameSetting_PS3_EULA_Read - off + // PS3DEC13 + pGameSettings->uiBitmaskValues &= + ~GAMESETTING_PS3EULAREAD; // eGameSetting_PS3_EULA_Read - off - // PS3 1.05 - added Greek - pGameSettings->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; // use the system language + // PS3 1.05 - added Greek + pGameSettings->ucLanguage = + MINECRAFT_LANGUAGE_DEFAULT; // use the system language - } - break; - case PROFILE_VERSION_9: - // PS3DEC13 - { - GAME_SETTINGS *pGameSettings=(GAME_SETTINGS *)pucData; - pGameSettings->uiBitmaskValues&=~GAMESETTING_PS3EULAREAD; //eGameSetting_PS3_EULA_Read - off - - // PS3 1.05 - added Greek - pGameSettings->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; // use the system language + } break; + case PROFILE_VERSION_9: + // PS3DEC13 + { + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage + // (counter) + pGameSettings->uiBitmaskValues &= + ~GAMESETTING_PS3EULAREAD; // eGameSetting_PS3_EULA_Read - + // off - } - break; - case PROFILE_VERSION_10: - { - GAME_SETTINGS *pGameSettings=(GAME_SETTINGS *)pucData; + // PS3 1.05 - added Greek + pGameSettings->ucLanguage = + MINECRAFT_LANGUAGE_DEFAULT; // use the system language + } + break; + case PROFILE_VERSION_10: { + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage + // (counter) + pGameSettings->ucLanguage = + MINECRAFT_LANGUAGE_DEFAULT; // use the system language + } break; + case PROFILE_VERSION_11: { + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage + // (counter) + } break; + case PROFILE_VERSION_12: { + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage + // (counter) + } break; + default: { + // This might be from a version during testing of new profile + // updates + app.DebugPrintf( + "Don't know what to do with this profile version!\n"); +#ifndef _CONTENT_PACKAGE + // __debugbreak(); +#endif - pGameSettings->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; // use the system language - } - break; + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; + pGameSettings->ucMenuSensitivity = + 100; // eGameSetting_Sensitivity_InMenu + pGameSettings->ucInterfaceOpacity = + 80; // eGameSetting_Sensitivity_InMenu + pGameSettings->usBitmaskValues |= + 0x0200; // eGameSetting_DisplaySplitscreenGamertags - on + pGameSettings->usBitmaskValues |= 0x0400; // eGameSetting_Hints - + // on + pGameSettings->usBitmaskValues |= + 0x1000; // eGameSetting_Autosave - 2 + pGameSettings->usBitmaskValues |= + 0x8000; // eGameSetting_Tooltips - on - default: - { - // This might be from a version during testing of new profile updates - app.DebugPrintf("Don't know what to do with this profile version!\n"); - #ifndef _CONTENT_PACKAGE - // __debugbreak(); - #endif + pGameSettings->uiBitmaskValues = 0L; // reset + pGameSettings->uiBitmaskValues |= + GAMESETTING_CLOUDS; // eGameSetting_Clouds - on + pGameSettings->uiBitmaskValues |= + GAMESETTING_ONLINE; // eGameSetting_GameSetting_Online - on + // eGameSetting_GameSetting_Invite - off + pGameSettings->uiBitmaskValues |= + GAMESETTING_FRIENDSOFFRIENDS; // eGameSetting_GameSetting_FriendsOfFriends + // - on + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage + // (counter) + pGameSettings->uiBitmaskValues &= + ~GAMESETTING_BEDROCKFOG; // eGameSetting_BedrockFog - off + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYHUD; // eGameSetting_DisplayHUD - on + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYHAND; // eGameSetting_DisplayHand - on + pGameSettings->uiBitmaskValues |= + GAMESETTING_CUSTOMSKINANIM; // eGameSetting_CustomSkinAnim - on + pGameSettings->uiBitmaskValues |= + GAMESETTING_DEATHMESSAGES; // eGameSetting_DeathMessages - on + pGameSettings->uiBitmaskValues |= + (GAMESETTING_UISIZE & 0x00000800); // uisize 2 + pGameSettings->uiBitmaskValues |= + (GAMESETTING_UISIZE_SPLITSCREEN & + 0x00004000); // splitscreen ui size 3 + pGameSettings->uiBitmaskValues |= + GAMESETTING_ANIMATEDCHARACTER; // eGameSetting_AnimatedCharacter + // - on + // TU12 + // favorite skins added, but only set in TU12 - set to FFs + for (int i = 0; i < MAX_FAVORITE_SKINS; i++) { + pGameSettings->uiFavoriteSkinA[i] = 0xFFFFFFFF; + } + pGameSettings->ucCurrentFavoriteSkinPos = 0; + // Added a bitmask in TU13 to enable/disable display of the Mash-up + // pack worlds in the saves list + pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; - GAME_SETTINGS *pGameSettings=(GAME_SETTINGS *)pucData; - pGameSettings->ucMenuSensitivity=100; //eGameSetting_Sensitivity_InMenu - pGameSettings->ucInterfaceOpacity=80; //eGameSetting_Sensitivity_InMenu - pGameSettings->usBitmaskValues|=0x0200; //eGameSetting_DisplaySplitscreenGamertags - on - pGameSettings->usBitmaskValues|=0x0400; //eGameSetting_Hints - on - pGameSettings->usBitmaskValues|=0x1000; //eGameSetting_Autosave - 2 - pGameSettings->usBitmaskValues|=0x8000; //eGameSetting_Tooltips - on + // PS3DEC13 + pGameSettings->uiBitmaskValues &= + ~GAMESETTING_PS3EULAREAD; // eGameSetting_PS3_EULA_Read - off - pGameSettings->uiBitmaskValues=0L; // reset - pGameSettings->uiBitmaskValues|=GAMESETTING_CLOUDS; //eGameSetting_Clouds - on - pGameSettings->uiBitmaskValues|=GAMESETTING_ONLINE; //eGameSetting_GameSetting_Online - on - //eGameSetting_GameSetting_Invite - off - pGameSettings->uiBitmaskValues|=GAMESETTING_FRIENDSOFFRIENDS; //eGameSetting_GameSetting_FriendsOfFriends - on - pGameSettings->uiBitmaskValues|=GAMESETTING_DISPLAYUPDATEMSG; //eGameSetting_DisplayUpdateMessage (counter) - pGameSettings->uiBitmaskValues&=~GAMESETTING_BEDROCKFOG; //eGameSetting_BedrockFog - off - pGameSettings->uiBitmaskValues|=GAMESETTING_DISPLAYHUD; //eGameSetting_DisplayHUD - on - pGameSettings->uiBitmaskValues|=GAMESETTING_DISPLAYHAND; //eGameSetting_DisplayHand - on - pGameSettings->uiBitmaskValues|=GAMESETTING_CUSTOMSKINANIM; //eGameSetting_CustomSkinAnim - on - pGameSettings->uiBitmaskValues|=GAMESETTING_DEATHMESSAGES; //eGameSetting_DeathMessages - on - pGameSettings->uiBitmaskValues|=(GAMESETTING_UISIZE&0x00000800); // uisize 2 - pGameSettings->uiBitmaskValues|=(GAMESETTING_UISIZE_SPLITSCREEN&0x00004000); // splitscreen ui size 3 - pGameSettings->uiBitmaskValues|=GAMESETTING_ANIMATEDCHARACTER; //eGameSetting_AnimatedCharacter - on - // TU12 - // favorite skins added, but only set in TU12 - set to FFs - for(int i=0;iuiFavoriteSkinA[i]=0xFFFFFFFF; - } - pGameSettings->ucCurrentFavoriteSkinPos=0; - // Added a bitmask in TU13 to enable/disable display of the Mash-up pack worlds in the saves list - pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; + // PS3 1.05 - added Greek + pGameSettings->ucLanguage = + MINECRAFT_LANGUAGE_DEFAULT; // use the system language - // PS3DEC13 - pGameSettings->uiBitmaskValues&=~GAMESETTING_PS3EULAREAD; //eGameSetting_PS3_EULA_Read - off + } break; + } - // PS3 1.05 - added Greek - pGameSettings->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; // use the system language - - } - break; - } - - return 0; + return 0; } -void CMinecraftApp::ApplyGameSettingsChanged(int iPad) -{ - ActionGameSettings(iPad,eGameSetting_MusicVolume ); - ActionGameSettings(iPad,eGameSetting_SoundFXVolume ); - ActionGameSettings(iPad,eGameSetting_Gamma ); - ActionGameSettings(iPad,eGameSetting_Difficulty ); - ActionGameSettings(iPad,eGameSetting_Sensitivity_InGame ); - ActionGameSettings(iPad,eGameSetting_ViewBob ); - ActionGameSettings(iPad,eGameSetting_ControlScheme ); - ActionGameSettings(iPad,eGameSetting_ControlInvertLook); - ActionGameSettings(iPad,eGameSetting_ControlSouthPaw); - ActionGameSettings(iPad,eGameSetting_SplitScreenVertical); - ActionGameSettings(iPad,eGameSetting_GamertagsVisible); +void CMinecraftApp::ApplyGameSettingsChanged(int iPad) { + ActionGameSettings(iPad, eGameSetting_MusicVolume); + ActionGameSettings(iPad, eGameSetting_SoundFXVolume); + ActionGameSettings(iPad, eGameSetting_Gamma); + ActionGameSettings(iPad, eGameSetting_Difficulty); + ActionGameSettings(iPad, eGameSetting_Sensitivity_InGame); + ActionGameSettings(iPad, eGameSetting_ViewBob); + ActionGameSettings(iPad, eGameSetting_ControlScheme); + ActionGameSettings(iPad, eGameSetting_ControlInvertLook); + ActionGameSettings(iPad, eGameSetting_ControlSouthPaw); + ActionGameSettings(iPad, eGameSetting_SplitScreenVertical); + ActionGameSettings(iPad, eGameSetting_GamertagsVisible); - // Interim TU 1.6.6 - ActionGameSettings(iPad,eGameSetting_Sensitivity_InMenu ); - ActionGameSettings(iPad,eGameSetting_DisplaySplitscreenGamertags); - ActionGameSettings(iPad,eGameSetting_Hints); - ActionGameSettings(iPad,eGameSetting_InterfaceOpacity); - ActionGameSettings(iPad,eGameSetting_Tooltips); + // Interim TU 1.6.6 + ActionGameSettings(iPad, eGameSetting_Sensitivity_InMenu); + ActionGameSettings(iPad, eGameSetting_DisplaySplitscreenGamertags); + ActionGameSettings(iPad, eGameSetting_Hints); + ActionGameSettings(iPad, eGameSetting_InterfaceOpacity); + ActionGameSettings(iPad, eGameSetting_Tooltips); - ActionGameSettings(iPad,eGameSetting_Clouds); - ActionGameSettings(iPad,eGameSetting_BedrockFog); - ActionGameSettings(iPad,eGameSetting_DisplayHUD); - ActionGameSettings(iPad,eGameSetting_DisplayHand); - ActionGameSettings(iPad,eGameSetting_CustomSkinAnim); - ActionGameSettings(iPad,eGameSetting_DeathMessages); - ActionGameSettings(iPad,eGameSetting_UISize); - ActionGameSettings(iPad,eGameSetting_UISizeSplitscreen); - ActionGameSettings(iPad,eGameSetting_AnimatedCharacter); - - ActionGameSettings(iPad,eGameSetting_PS3_EULA_Read); + ActionGameSettings(iPad, eGameSetting_Clouds); + ActionGameSettings(iPad, eGameSetting_BedrockFog); + ActionGameSettings(iPad, eGameSetting_DisplayHUD); + ActionGameSettings(iPad, eGameSetting_DisplayHand); + ActionGameSettings(iPad, eGameSetting_CustomSkinAnim); + ActionGameSettings(iPad, eGameSetting_DeathMessages); + ActionGameSettings(iPad, eGameSetting_UISize); + ActionGameSettings(iPad, eGameSetting_UISizeSplitscreen); + ActionGameSettings(iPad, eGameSetting_AnimatedCharacter); + ActionGameSettings(iPad, eGameSetting_PS3_EULA_Read); } -void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) -{ - Minecraft *pMinecraft=Minecraft::GetInstance(); - switch(eVal) - { - case eGameSetting_MusicVolume: - if(iPad==ProfileManager.GetPrimaryPad()) - { - pMinecraft->options->set(Options::Option::MUSIC,((float)GameSettingsA[iPad]->ucMusicVolume)/100.0f); - } - break; - case eGameSetting_SoundFXVolume: - if(iPad==ProfileManager.GetPrimaryPad()) - { - pMinecraft->options->set(Options::Option::SOUND,((float)GameSettingsA[iPad]->ucSoundFXVolume)/100.0f); - } - break; - case eGameSetting_Gamma: - if(iPad==ProfileManager.GetPrimaryPad()) - { - // ucGamma range is 0-100, UpdateGamma is 0 - 32768 - float fVal=((float)GameSettingsA[iPad]->ucGamma)*327.68f; - RenderManager.UpdateGamma((unsigned short)fVal); - } +void CMinecraftApp::ActionGameSettings(int iPad, eGameSetting eVal) { + Minecraft* pMinecraft = Minecraft::GetInstance(); + switch (eVal) { + case eGameSetting_MusicVolume: + if (iPad == ProfileManager.GetPrimaryPad()) { + pMinecraft->options->set( + Options::Option::MUSIC, + ((float)GameSettingsA[iPad]->ucMusicVolume) / 100.0f); + } + break; + case eGameSetting_SoundFXVolume: + if (iPad == ProfileManager.GetPrimaryPad()) { + pMinecraft->options->set( + Options::Option::SOUND, + ((float)GameSettingsA[iPad]->ucSoundFXVolume) / 100.0f); + } + break; + case eGameSetting_Gamma: + if (iPad == ProfileManager.GetPrimaryPad()) { + // ucGamma range is 0-100, UpdateGamma is 0 - 32768 + float fVal = ((float)GameSettingsA[iPad]->ucGamma) * 327.68f; + RenderManager.UpdateGamma((unsigned short)fVal); + } - break; - case eGameSetting_Difficulty: - if(iPad==ProfileManager.GetPrimaryPad()) - { - pMinecraft->options->toggle(Options::Option::DIFFICULTY,GameSettingsA[iPad]->usBitmaskValues&0x03); - app.DebugPrintf("Difficulty toggle to %d\n",GameSettingsA[iPad]->usBitmaskValues&0x03); + break; + case eGameSetting_Difficulty: + if (iPad == ProfileManager.GetPrimaryPad()) { + pMinecraft->options->toggle( + Options::Option::DIFFICULTY, + GameSettingsA[iPad]->usBitmaskValues & 0x03); + app.DebugPrintf("Difficulty toggle to %d\n", + GameSettingsA[iPad]->usBitmaskValues & 0x03); - // Update the Game Host setting - app.SetGameHostOption(eGameHostOption_Difficulty,pMinecraft->options->difficulty); + // Update the Game Host setting + app.SetGameHostOption(eGameHostOption_Difficulty, + pMinecraft->options->difficulty); - // send this to the other players if we are in-game - bool bInGame=pMinecraft->level!=NULL; + // send this to the other players if we are in-game + bool bInGame = pMinecraft->level != NULL; - // Game Host only (and for now we can't change the diff while in game, so this shouldn't happen) - if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad())) - { - app.SetXuiServerAction(iPad,eXuiServerAction_ServerSettingChanged_Difficulty); - } - } - else - { - app.DebugPrintf("NOT ACTIONING DIFFICULTY - Primary pad is %d, This pad is %d\n",ProfileManager.GetPrimaryPad(),iPad); - } - - break; - case eGameSetting_Sensitivity_InGame: - // 4J-PB - we don't use the options value - // tell the input that we've changed the sensitivity - range of the slider is 0 to 200, default is 100 - pMinecraft->options->set(Options::Option::SENSITIVITY,((float)GameSettingsA[iPad]->ucSensitivity)/100.0f); - //InputManager.SetJoypadSensitivity(iPad,((float)GameSettingsA[iPad]->ucSensitivity)/100.0f); + // Game Host only (and for now we can't change the diff while in + // game, so this shouldn't happen) + if (bInGame && g_NetworkManager.IsHost() && + (iPad == ProfileManager.GetPrimaryPad())) { + app.SetXuiServerAction( + iPad, eXuiServerAction_ServerSettingChanged_Difficulty); + } + } else { + app.DebugPrintf( + "NOT ACTIONING DIFFICULTY - Primary pad is %d, This pad is " + "%d\n", + ProfileManager.GetPrimaryPad(), iPad); + } - break; - case eGameSetting_ViewBob: - // 4J-PB - not handled here any more - it's read from the gamesettings per player - //pMinecraft->options->toggle(Options::Option::VIEW_BOBBING,GameSettingsA[iPad]->usBitmaskValues&0x04); - break; - case eGameSetting_ControlScheme: - InputManager.SetJoypadMapVal(iPad,(GameSettingsA[iPad]->usBitmaskValues&0x30)>>4); - break; + break; + case eGameSetting_Sensitivity_InGame: + // 4J-PB - we don't use the options value + // tell the input that we've changed the sensitivity - range of the + // slider is 0 to 200, default is 100 + pMinecraft->options->set( + Options::Option::SENSITIVITY, + ((float)GameSettingsA[iPad]->ucSensitivity) / 100.0f); + // InputManager.SetJoypadSensitivity(iPad,((float)GameSettingsA[iPad]->ucSensitivity)/100.0f); - case eGameSetting_ControlInvertLook: - // Nothing specific to do for this setting. - break; + break; + case eGameSetting_ViewBob: + // 4J-PB - not handled here any more - it's read from the + // gamesettings per player + // pMinecraft->options->toggle(Options::Option::VIEW_BOBBING,GameSettingsA[iPad]->usBitmaskValues&0x04); + break; + case eGameSetting_ControlScheme: + InputManager.SetJoypadMapVal( + iPad, (GameSettingsA[iPad]->usBitmaskValues & 0x30) >> 4); + break; - case eGameSetting_ControlSouthPaw: - // What is the setting? - if ( GameSettingsA[iPad]->usBitmaskValues & 0x80 ) - { - // Southpaw. - InputManager.SetJoypadStickAxisMap( iPad, AXIS_MAP_LX, AXIS_MAP_RX ); - InputManager.SetJoypadStickAxisMap( iPad, AXIS_MAP_LY, AXIS_MAP_RY ); - InputManager.SetJoypadStickAxisMap( iPad, AXIS_MAP_RX, AXIS_MAP_LX ); - InputManager.SetJoypadStickAxisMap( iPad, AXIS_MAP_RY, AXIS_MAP_LY ); - InputManager.SetJoypadStickTriggerMap( iPad, TRIGGER_MAP_0, TRIGGER_MAP_1 ); - InputManager.SetJoypadStickTriggerMap( iPad, TRIGGER_MAP_1, TRIGGER_MAP_0 ); - } - else - { - // Right handed. - InputManager.SetJoypadStickAxisMap( iPad, AXIS_MAP_LX, AXIS_MAP_LX ); - InputManager.SetJoypadStickAxisMap( iPad, AXIS_MAP_LY, AXIS_MAP_LY ); - InputManager.SetJoypadStickAxisMap( iPad, AXIS_MAP_RX, AXIS_MAP_RX ); - InputManager.SetJoypadStickAxisMap( iPad, AXIS_MAP_RY, AXIS_MAP_RY ); - InputManager.SetJoypadStickTriggerMap( iPad, TRIGGER_MAP_0, TRIGGER_MAP_0 ); - InputManager.SetJoypadStickTriggerMap( iPad, TRIGGER_MAP_1, TRIGGER_MAP_1 ); - } - break; - case eGameSetting_SplitScreenVertical: - if(iPad==ProfileManager.GetPrimaryPad()) - { - pMinecraft->updatePlayerViewportAssignments(); - } - break; - case eGameSetting_GamertagsVisible: - { - bool bInGame=pMinecraft->level!=NULL; + case eGameSetting_ControlInvertLook: + // Nothing specific to do for this setting. + break; - // Game Host only - if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad())) - { - // Update the Game Host setting if you are the host and you are in-game - app.SetGameHostOption(eGameHostOption_Gamertags,((GameSettingsA[iPad]->usBitmaskValues&0x0008)!=0)?1:0); - app.SetXuiServerAction(iPad,eXuiServerAction_ServerSettingChanged_Gamertags); + case eGameSetting_ControlSouthPaw: + // What is the setting? + if (GameSettingsA[iPad]->usBitmaskValues & 0x80) { + // Southpaw. + InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_LX, + AXIS_MAP_RX); + InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_LY, + AXIS_MAP_RY); + InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_RX, + AXIS_MAP_LX); + InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_RY, + AXIS_MAP_LY); + InputManager.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_0, + TRIGGER_MAP_1); + InputManager.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_1, + TRIGGER_MAP_0); + } else { + // Right handed. + InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_LX, + AXIS_MAP_LX); + InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_LY, + AXIS_MAP_LY); + InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_RX, + AXIS_MAP_RX); + InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_RY, + AXIS_MAP_RY); + InputManager.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_0, + TRIGGER_MAP_0); + InputManager.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_1, + TRIGGER_MAP_1); + } + break; + case eGameSetting_SplitScreenVertical: + if (iPad == ProfileManager.GetPrimaryPad()) { + pMinecraft->updatePlayerViewportAssignments(); + } + break; + case eGameSetting_GamertagsVisible: { + bool bInGame = pMinecraft->level != NULL; - PlayerList *players = MinecraftServer::getInstance()->getPlayerList(); - for(AUTO_VAR(it3, players->players.begin()); it3 != players->players.end(); ++it3) - { - std::shared_ptr decorationPlayer = *it3; - decorationPlayer->setShowOnMaps((app.GetGameHostOption(eGameHostOption_Gamertags)!=0)?true:false); - } - } - } - break; -// Interim TU 1.6.6 - case eGameSetting_Sensitivity_InMenu: - // 4J-PB - we don't use the options value - // tell the input that we've changed the sensitivity - range of the slider is 0 to 200, default is 100 - //pMinecraft->options->set(Options::Option::SENSITIVITY,((float)GameSettingsA[iPad]->ucSensitivity)/100.0f); - //InputManager.SetJoypadSensitivity(iPad,((float)GameSettingsA[iPad]->ucSensitivity)/100.0f); + // Game Host only + if (bInGame && g_NetworkManager.IsHost() && + (iPad == ProfileManager.GetPrimaryPad())) { + // Update the Game Host setting if you are the host and you are + // in-game + app.SetGameHostOption( + eGameHostOption_Gamertags, + ((GameSettingsA[iPad]->usBitmaskValues & 0x0008) != 0) ? 1 + : 0); + app.SetXuiServerAction( + iPad, eXuiServerAction_ServerSettingChanged_Gamertags); - break; + PlayerList* players = + MinecraftServer::getInstance()->getPlayerList(); + for (AUTO_VAR(it3, players->players.begin()); + it3 != players->players.end(); ++it3) { + std::shared_ptr decorationPlayer = *it3; + decorationPlayer->setShowOnMaps( + (app.GetGameHostOption(eGameHostOption_Gamertags) != 0) + ? true + : false); + } + } + } break; + // Interim TU 1.6.6 + case eGameSetting_Sensitivity_InMenu: + // 4J-PB - we don't use the options value + // tell the input that we've changed the sensitivity - range of the + // slider is 0 to 200, default is 100 + // pMinecraft->options->set(Options::Option::SENSITIVITY,((float)GameSettingsA[iPad]->ucSensitivity)/100.0f); + // InputManager.SetJoypadSensitivity(iPad,((float)GameSettingsA[iPad]->ucSensitivity)/100.0f); - case eGameSetting_DisplaySplitscreenGamertags: - for(std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx) - { - if(pMinecraft->localplayers[idx] != NULL) - { - if(pMinecraft->localplayers[idx]->m_iScreenSection==C4JRender::VIEWPORT_TYPE_FULLSCREEN) - { - ui.DisplayGamertag(idx,false); - } - else - { - ui.DisplayGamertag(idx,true); - } - } - } + break; - break; - case eGameSetting_InterfaceOpacity: - // update the tooltips display - ui.RefreshTooltips( iPad); + case eGameSetting_DisplaySplitscreenGamertags: + for (std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx) { + if (pMinecraft->localplayers[idx] != NULL) { + if (pMinecraft->localplayers[idx]->m_iScreenSection == + C4JRender::VIEWPORT_TYPE_FULLSCREEN) { + ui.DisplayGamertag(idx, false); + } else { + ui.DisplayGamertag(idx, true); + } + } + } - break; - case eGameSetting_Hints: - //nothing to do here - break; - case eGameSetting_Tooltips: - if((GameSettingsA[iPad]->usBitmaskValues&0x8000)!=0) - { - ui.SetEnableTooltips(iPad, true); - } - else - { - ui.SetEnableTooltips(iPad, false); - } - break; - case eGameSetting_Clouds: - //nothing to do here - break; - case eGameSetting_Online: - //nothing to do here - break; - case eGameSetting_InviteOnly: - //nothing to do here - break; - case eGameSetting_FriendsOfFriends: - //nothing to do here - break; - case eGameSetting_BedrockFog: - { - bool bInGame=pMinecraft->level!=NULL; + break; + case eGameSetting_InterfaceOpacity: + // update the tooltips display + ui.RefreshTooltips(iPad); - // Game Host only - if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad())) - { - // Update the Game Host setting if you are the host and you are in-game - app.SetGameHostOption(eGameHostOption_BedrockFog,GetGameSettings(iPad,eGameSetting_BedrockFog)?1:0); - app.SetXuiServerAction(iPad,eXuiServerAction_ServerSettingChanged_BedrockFog); - } - } - break; - case eGameSetting_DisplayHUD: - //nothing to do here - break; - case eGameSetting_DisplayHand: - //nothing to do here - break; - case eGameSetting_CustomSkinAnim: - //nothing to do here - break; - case eGameSetting_DeathMessages: - //nothing to do here - break; - case eGameSetting_UISize: - //nothing to do here - break; - case eGameSetting_UISizeSplitscreen: - //nothing to do here - break; - case eGameSetting_AnimatedCharacter: - //nothing to do here - break; - case eGameSetting_PS3_EULA_Read: - //nothing to do here - break; - case eGameSetting_PSVita_NetworkModeAdhoc: - //nothing to do here - break; - default: - break; - } + break; + case eGameSetting_Hints: + // nothing to do here + break; + case eGameSetting_Tooltips: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x8000) != 0) { + ui.SetEnableTooltips(iPad, true); + } else { + ui.SetEnableTooltips(iPad, false); + } + break; + case eGameSetting_Clouds: + // nothing to do here + break; + case eGameSetting_Online: + // nothing to do here + break; + case eGameSetting_InviteOnly: + // nothing to do here + break; + case eGameSetting_FriendsOfFriends: + // nothing to do here + break; + case eGameSetting_BedrockFog: { + bool bInGame = pMinecraft->level != NULL; + + // Game Host only + if (bInGame && g_NetworkManager.IsHost() && + (iPad == ProfileManager.GetPrimaryPad())) { + // Update the Game Host setting if you are the host and you are + // in-game + app.SetGameHostOption( + eGameHostOption_BedrockFog, + GetGameSettings(iPad, eGameSetting_BedrockFog) ? 1 : 0); + app.SetXuiServerAction( + iPad, eXuiServerAction_ServerSettingChanged_BedrockFog); + } + } break; + case eGameSetting_DisplayHUD: + // nothing to do here + break; + case eGameSetting_DisplayHand: + // nothing to do here + break; + case eGameSetting_CustomSkinAnim: + // nothing to do here + break; + case eGameSetting_DeathMessages: + // nothing to do here + break; + case eGameSetting_UISize: + // nothing to do here + break; + case eGameSetting_UISizeSplitscreen: + // nothing to do here + break; + case eGameSetting_AnimatedCharacter: + // nothing to do here + break; + case eGameSetting_PS3_EULA_Read: + // nothing to do here + break; + case eGameSetting_PSVita_NetworkModeAdhoc: + // nothing to do here + break; + default: + break; + } } -void CMinecraftApp::SetPlayerSkin(int iPad,const std::wstring &name) -{ - std::uint32_t skinId = app.getSkinIdFromPath(name); +void CMinecraftApp::SetPlayerSkin(int iPad, const std::wstring& name) { + std::uint32_t skinId = app.getSkinIdFromPath(name); - SetPlayerSkin(iPad,skinId); + SetPlayerSkin(iPad, skinId); } -void CMinecraftApp::SetPlayerSkin(int iPad,std::uint32_t dwSkinId) -{ - DebugPrintf("Setting skin for %d to %08X\n", iPad, dwSkinId); +void CMinecraftApp::SetPlayerSkin(int iPad, std::uint32_t dwSkinId) { + DebugPrintf("Setting skin for %d to %08X\n", iPad, dwSkinId); - GameSettingsA[iPad]->dwSelectedSkin = dwSkinId; - GameSettingsA[iPad]->bSettingsChanged = true; + GameSettingsA[iPad]->dwSelectedSkin = dwSkinId; + GameSettingsA[iPad]->bSettingsChanged = true; - TelemetryManager->RecordSkinChanged(iPad, GameSettingsA[iPad]->dwSelectedSkin); + TelemetryManager->RecordSkinChanged(iPad, + GameSettingsA[iPad]->dwSelectedSkin); - if(Minecraft::GetInstance()->localplayers[iPad]!=NULL) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomSkin(dwSkinId); + if (Minecraft::GetInstance()->localplayers[iPad] != NULL) + Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomSkin( + dwSkinId); } - -std::wstring CMinecraftApp::GetPlayerSkinName(int iPad) -{ - return app.getSkinPathFromId(GameSettingsA[iPad]->dwSelectedSkin); +std::wstring CMinecraftApp::GetPlayerSkinName(int iPad) { + return app.getSkinPathFromId(GameSettingsA[iPad]->dwSelectedSkin); } -std::uint32_t CMinecraftApp::GetPlayerSkinId(int iPad) -{ - // 4J-PB -check the user has rights to use this skin - they may have had at some point but the entitlement has been removed. - DLCPack *Pack=NULL; - DLCSkinFile *skinFile=NULL; - std::uint32_t dwSkin=GameSettingsA[iPad]->dwSelectedSkin; - wchar_t chars[256]; +std::uint32_t CMinecraftApp::GetPlayerSkinId(int iPad) { + // 4J-PB -check the user has rights to use this skin - they may have had at + // some point but the entitlement has been removed. + DLCPack* Pack = NULL; + DLCSkinFile* skinFile = NULL; + std::uint32_t dwSkin = GameSettingsA[iPad]->dwSelectedSkin; + wchar_t chars[256]; - if( GET_IS_DLC_SKIN_FROM_BITMASK(dwSkin) ) - { - // 4J Stu - DLC skins are numbered using decimal rather than hex to make it easier to number manually - swprintf(chars, 256, L"dlcskin%08d.png", GET_DLC_SKIN_ID_FROM_BITMASK(dwSkin)); - - Pack=app.m_dlcManager.getPackContainingSkin(chars); + if (GET_IS_DLC_SKIN_FROM_BITMASK(dwSkin)) { + // 4J Stu - DLC skins are numbered using decimal rather than hex to make + // it easier to number manually + swprintf(chars, 256, L"dlcskin%08d.png", + GET_DLC_SKIN_ID_FROM_BITMASK(dwSkin)); - if(Pack) - { - skinFile = Pack->getSkinFile(chars); + Pack = app.m_dlcManager.getPackContainingSkin(chars); - bool bSkinIsFree = skinFile->getParameterAsBool( DLCManager::e_DLCParamType_Free ); - bool bLicensed = Pack->hasPurchasedFile( DLCManager::e_DLCType_Skin, skinFile->getPath() ); + if (Pack) { + skinFile = Pack->getSkinFile(chars); - if(bSkinIsFree || bLicensed) - { - return dwSkin; - } - else - { - return 0; - } - } - } + bool bSkinIsFree = + skinFile->getParameterAsBool(DLCManager::e_DLCParamType_Free); + bool bLicensed = Pack->hasPurchasedFile(DLCManager::e_DLCType_Skin, + skinFile->getPath()); + if (bSkinIsFree || bLicensed) { + return dwSkin; + } else { + return 0; + } + } + } - return dwSkin; + return dwSkin; } - std::uint32_t CMinecraftApp::GetAdditionalModelParts(int iPad) - { - return m_dwAdditionalModelParts[iPad]; - } - - -void CMinecraftApp::SetPlayerCape(int iPad,const std::wstring &name) -{ - std::uint32_t capeId = Player::getCapeIdFromPath(name); - - SetPlayerCape(iPad,capeId); +std::uint32_t CMinecraftApp::GetAdditionalModelParts(int iPad) { + return m_dwAdditionalModelParts[iPad]; } -void CMinecraftApp::SetPlayerCape(int iPad,std::uint32_t dwCapeId) -{ - DebugPrintf("Setting cape for %d to %08X\n", iPad, dwCapeId); +void CMinecraftApp::SetPlayerCape(int iPad, const std::wstring& name) { + std::uint32_t capeId = Player::getCapeIdFromPath(name); - GameSettingsA[iPad]->dwSelectedCape = dwCapeId; - GameSettingsA[iPad]->bSettingsChanged = true; - - //SentientManager.RecordSkinChanged(iPad, GameSettingsA[iPad]->dwSelectedSkin); - - if(Minecraft::GetInstance()->localplayers[iPad]!=NULL) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomCape(dwCapeId); + SetPlayerCape(iPad, capeId); } -std::wstring CMinecraftApp::GetPlayerCapeName(int iPad) -{ - return Player::getCapePathFromId(GameSettingsA[iPad]->dwSelectedCape); +void CMinecraftApp::SetPlayerCape(int iPad, std::uint32_t dwCapeId) { + DebugPrintf("Setting cape for %d to %08X\n", iPad, dwCapeId); + + GameSettingsA[iPad]->dwSelectedCape = dwCapeId; + GameSettingsA[iPad]->bSettingsChanged = true; + + // SentientManager.RecordSkinChanged(iPad, + // GameSettingsA[iPad]->dwSelectedSkin); + + if (Minecraft::GetInstance()->localplayers[iPad] != NULL) + Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomCape( + dwCapeId); } -std::uint32_t CMinecraftApp::GetPlayerCapeId(int iPad) -{ - return GameSettingsA[iPad]->dwSelectedCape; +std::wstring CMinecraftApp::GetPlayerCapeName(int iPad) { + return Player::getCapePathFromId(GameSettingsA[iPad]->dwSelectedCape); } -void CMinecraftApp::SetPlayerFavoriteSkin(int iPad, int iIndex,unsigned int uiSkinID) -{ - DebugPrintf("Setting favorite skin for %d to %08X\n", iPad, uiSkinID); - - GameSettingsA[iPad]->uiFavoriteSkinA[iIndex] = uiSkinID; - GameSettingsA[iPad]->bSettingsChanged = true; +std::uint32_t CMinecraftApp::GetPlayerCapeId(int iPad) { + return GameSettingsA[iPad]->dwSelectedCape; } -unsigned int CMinecraftApp::GetPlayerFavoriteSkin(int iPad,int iIndex) -{ - return GameSettingsA[iPad]->uiFavoriteSkinA[iIndex]; +void CMinecraftApp::SetPlayerFavoriteSkin(int iPad, int iIndex, + unsigned int uiSkinID) { + DebugPrintf("Setting favorite skin for %d to %08X\n", iPad, uiSkinID); + + GameSettingsA[iPad]->uiFavoriteSkinA[iIndex] = uiSkinID; + GameSettingsA[iPad]->bSettingsChanged = true; } -unsigned char CMinecraftApp::GetPlayerFavoriteSkinsPos(int iPad) -{ - return GameSettingsA[iPad]->ucCurrentFavoriteSkinPos; +unsigned int CMinecraftApp::GetPlayerFavoriteSkin(int iPad, int iIndex) { + return GameSettingsA[iPad]->uiFavoriteSkinA[iIndex]; } -void CMinecraftApp::SetPlayerFavoriteSkinsPos(int iPad, int iPos) -{ - GameSettingsA[iPad]->ucCurrentFavoriteSkinPos=(unsigned char)iPos; - GameSettingsA[iPad]->bSettingsChanged = true; +unsigned char CMinecraftApp::GetPlayerFavoriteSkinsPos(int iPad) { + return GameSettingsA[iPad]->ucCurrentFavoriteSkinPos; } -unsigned int CMinecraftApp::GetPlayerFavoriteSkinsCount(int iPad) -{ - unsigned int uiCount=0; - for(int i=0;iuiFavoriteSkinA[i]!=0xFFFFFFFF) - { - uiCount++; - } - else - { - break; - } - } - return uiCount; +void CMinecraftApp::SetPlayerFavoriteSkinsPos(int iPad, int iPos) { + GameSettingsA[iPad]->ucCurrentFavoriteSkinPos = (unsigned char)iPos; + GameSettingsA[iPad]->bSettingsChanged = true; } -void CMinecraftApp::ValidateFavoriteSkins(int iPad) -{ - unsigned int uiCount=GetPlayerFavoriteSkinsCount(iPad); - - // remove invalid skins - unsigned int uiValidSkin=0; - wchar_t chars[256]; +unsigned int CMinecraftApp::GetPlayerFavoriteSkinsCount(int iPad) { + unsigned int uiCount = 0; + for (int i = 0; i < MAX_FAVORITE_SKINS; i++) { + if (GameSettingsA[iPad]->uiFavoriteSkinA[i] != 0xFFFFFFFF) { + uiCount++; + } else { + break; + } + } + return uiCount; +} - for(unsigned int i=0;igetFile(DLCManager::e_DLCType_Skin,chars); - DLCSkinFile *pSkinFile = pDLCPack->getSkinFile(chars); + for (unsigned int i = 0; i < uiCount; i++) { + // get the pack number from the skin id + swprintf(chars, 256, L"dlcskin%08d.png", + app.GetPlayerFavoriteSkin(iPad, i)); - if( pDLCPack->hasPurchasedFile(DLCManager::e_DLCType_Skin, L"") || (pSkinFile && pSkinFile->isFree())) - { - GameSettingsA[iPad]->uiFavoriteSkinA[uiValidSkin++]=GameSettingsA[iPad]->uiFavoriteSkinA[i]; - } - } - } + // Also check they haven't reverted to a trial pack + DLCPack* pDLCPack = app.m_dlcManager.getPackContainingSkin(chars); - for(unsigned int i=uiValidSkin;iuiFavoriteSkinA[i]=0xFFFFFFFF; - } + if (pDLCPack != NULL) { + // 4J-PB - We should let players add the free skins to their + // favourites as well! + // DLCFile + // *pDLCFile=pDLCPack->getFile(DLCManager::e_DLCType_Skin,chars); + DLCSkinFile* pSkinFile = pDLCPack->getSkinFile(chars); + + if (pDLCPack->hasPurchasedFile(DLCManager::e_DLCType_Skin, L"") || + (pSkinFile && pSkinFile->isFree())) { + GameSettingsA[iPad]->uiFavoriteSkinA[uiValidSkin++] = + GameSettingsA[iPad]->uiFavoriteSkinA[i]; + } + } + } + + for (unsigned int i = uiValidSkin; i < MAX_FAVORITE_SKINS; i++) { + GameSettingsA[iPad]->uiFavoriteSkinA[i] = 0xFFFFFFFF; + } } // Mash-up pack worlds -void CMinecraftApp::HideMashupPackWorld(int iPad, unsigned int iMashupPackID) -{ - unsigned int uiPackID=iMashupPackID - 1024; // mash-up ids start at 1024 - GameSettingsA[iPad]->uiMashUpPackWorldsDisplay&=~(1<bSettingsChanged = true; +void CMinecraftApp::HideMashupPackWorld(int iPad, unsigned int iMashupPackID) { + unsigned int uiPackID = iMashupPackID - 1024; // mash-up ids start at 1024 + GameSettingsA[iPad]->uiMashUpPackWorldsDisplay &= ~(1 << uiPackID); + GameSettingsA[iPad]->bSettingsChanged = true; } -void CMinecraftApp::SetMinecraftLanguage(int iPad, unsigned char ucLanguage) -{ - GameSettingsA[iPad]->ucLanguage = ucLanguage; - GameSettingsA[iPad]->bSettingsChanged = true; +void CMinecraftApp::EnableMashupPackWorlds(int iPad) { + GameSettingsA[iPad]->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; + GameSettingsA[iPad]->bSettingsChanged = true; } -void CMinecraftApp::EnableMashupPackWorlds(int iPad) -{ - GameSettingsA[iPad]->uiMashUpPackWorldsDisplay=0xFFFFFFFF; - GameSettingsA[iPad]->bSettingsChanged = true; +unsigned int CMinecraftApp::GetMashupPackWorlds(int iPad) { + return GameSettingsA[iPad]->uiMashUpPackWorldsDisplay; } -unsigned int CMinecraftApp::GetMashupPackWorlds(int iPad) -{ - return GameSettingsA[iPad]->uiMashUpPackWorldsDisplay; +void CMinecraftApp::SetMinecraftLanguage(int iPad, unsigned char ucLanguage) { + GameSettingsA[iPad]->ucLanguage = ucLanguage; + GameSettingsA[iPad]->bSettingsChanged = true; } -unsigned char CMinecraftApp::GetMinecraftLanguage(int iPad) -{ - // if there are no game settings read yet, return the default language - if(GameSettingsA[iPad]==NULL) - { - return 0; - } - else - { - return GameSettingsA[iPad]->ucLanguage; - } +unsigned char CMinecraftApp::GetMinecraftLanguage(int iPad) { + // if there are no game settings read yet, return the default language + if (GameSettingsA[iPad] == NULL) { + return 0; + } else { + return GameSettingsA[iPad]->ucLanguage; + } } -void CMinecraftApp::SetGameSettings(int iPad,eGameSetting eVal,unsigned char ucVal) -{ - //Minecraft *pMinecraft=Minecraft::GetInstance(); - - switch(eVal) - { - case eGameSetting_MusicVolume: - if(GameSettingsA[iPad]->ucMusicVolume!=ucVal) - { - GameSettingsA[iPad]->ucMusicVolume=ucVal; - if(iPad==ProfileManager.GetPrimaryPad()) - { - ActionGameSettings(iPad,eVal); - } - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_SoundFXVolume: - if(GameSettingsA[iPad]->ucSoundFXVolume!=ucVal) - { - GameSettingsA[iPad]->ucSoundFXVolume=ucVal; - if(iPad==ProfileManager.GetPrimaryPad()) - { - ActionGameSettings(iPad,eVal); - } - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_Gamma: - if(GameSettingsA[iPad]->ucGamma!=ucVal) - { - GameSettingsA[iPad]->ucGamma=ucVal; - if(iPad==ProfileManager.GetPrimaryPad()) - { - ActionGameSettings(iPad,eVal); - } - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_Difficulty: - if((GameSettingsA[iPad]->usBitmaskValues&0x03)!=(ucVal&0x03)) - { - GameSettingsA[iPad]->usBitmaskValues&=~0x03; - GameSettingsA[iPad]->usBitmaskValues|=ucVal&0x03; - if(iPad==ProfileManager.GetPrimaryPad()) - { - ActionGameSettings(iPad,eVal); - } - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_Sensitivity_InGame: - if(GameSettingsA[iPad]->ucSensitivity!=ucVal) - { - GameSettingsA[iPad]->ucSensitivity=ucVal; - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_ViewBob: - if((GameSettingsA[iPad]->usBitmaskValues&0x0004)!=((ucVal&0x01)<<2)) - { - if(ucVal!=0) - { - GameSettingsA[iPad]->usBitmaskValues|=0x0004; - } - else - { - GameSettingsA[iPad]->usBitmaskValues&=~0x0004; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_ControlScheme: // bits 5 and 6 - if((GameSettingsA[iPad]->usBitmaskValues&0x30)!=((ucVal&0x03)<<4)) - { - GameSettingsA[iPad]->usBitmaskValues&=~0x0030; - if(ucVal!=0) - { - GameSettingsA[iPad]->usBitmaskValues|=(ucVal&0x03)<<4; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - - case eGameSetting_ControlInvertLook: - if((GameSettingsA[iPad]->usBitmaskValues&0x0040)!=((ucVal&0x01)<<6)) - { - if(ucVal!=0) - { - GameSettingsA[iPad]->usBitmaskValues|=0x0040; - } - else - { - GameSettingsA[iPad]->usBitmaskValues&=~0x0040; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - - case eGameSetting_ControlSouthPaw: - if((GameSettingsA[iPad]->usBitmaskValues&0x0080)!=((ucVal&0x01)<<7)) - { - if(ucVal!=0) - { - GameSettingsA[iPad]->usBitmaskValues|=0x0080; - } - else - { - GameSettingsA[iPad]->usBitmaskValues&=~0x0080; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_SplitScreenVertical: - if((GameSettingsA[iPad]->usBitmaskValues&0x0100)!=((ucVal&0x01)<<8)) - { - if(ucVal!=0) - { - GameSettingsA[iPad]->usBitmaskValues|=0x0100; - } - else - { - GameSettingsA[iPad]->usBitmaskValues&=~0x0100; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_GamertagsVisible: - if((GameSettingsA[iPad]->usBitmaskValues&0x0008)!=((ucVal&0x01)<<3)) - { - if(ucVal!=0) - { - GameSettingsA[iPad]->usBitmaskValues|=0x0008; - } - else - { - GameSettingsA[iPad]->usBitmaskValues&=~0x0008; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - - // 4J-PB - Added for Interim TU for 1.6.6 - case eGameSetting_Sensitivity_InMenu: - if(GameSettingsA[iPad]->ucMenuSensitivity!=ucVal) - { - GameSettingsA[iPad]->ucMenuSensitivity=ucVal; - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_DisplaySplitscreenGamertags: - if((GameSettingsA[iPad]->usBitmaskValues&0x0200)!=((ucVal&0x01)<<9)) - { - if(ucVal!=0) - { - GameSettingsA[iPad]->usBitmaskValues|=0x0200; - } - else - { - GameSettingsA[iPad]->usBitmaskValues&=~0x0200; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_Hints: - if((GameSettingsA[iPad]->usBitmaskValues&0x0400)!=((ucVal&0x01)<<10)) - { - if(ucVal!=0) - { - GameSettingsA[iPad]->usBitmaskValues|=0x0400; - } - else - { - GameSettingsA[iPad]->usBitmaskValues&=~0x0400; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_Autosave: - if((GameSettingsA[iPad]->usBitmaskValues&0x7800)!=((ucVal&0x0F)<<11)) - { - GameSettingsA[iPad]->usBitmaskValues&=~0x7800; - if(ucVal!=0) - { - GameSettingsA[iPad]->usBitmaskValues|=(ucVal&0x0F)<<11; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - - case eGameSetting_Tooltips: - if((GameSettingsA[iPad]->usBitmaskValues&0x8000)!=((ucVal&0x01)<<15)) - { - if(ucVal!=0) - { - GameSettingsA[iPad]->usBitmaskValues|=0x8000; - } - else - { - GameSettingsA[iPad]->usBitmaskValues&=~0x8000; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_InterfaceOpacity: - if(GameSettingsA[iPad]->ucInterfaceOpacity!=ucVal) - { - GameSettingsA[iPad]->ucInterfaceOpacity=ucVal; - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - - break; - case eGameSetting_Clouds: - if((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_CLOUDS)!=(ucVal&0x01)) - { - if(ucVal==1) - { - GameSettingsA[iPad]->uiBitmaskValues|=GAMESETTING_CLOUDS; - } - else - { - GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_CLOUDS; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - - break; - - case eGameSetting_Online: - if((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_ONLINE)!=(ucVal&0x01)<<1) - { - if(ucVal==1) - { - GameSettingsA[iPad]->uiBitmaskValues|=GAMESETTING_ONLINE; - } - else - { - GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_ONLINE; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - - break; - case eGameSetting_InviteOnly: - if((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_INVITEONLY)!=(ucVal&0x01)<<2) - { - if(ucVal==1) - { - GameSettingsA[iPad]->uiBitmaskValues|=GAMESETTING_INVITEONLY; - } - else - { - GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_INVITEONLY; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - - break; - case eGameSetting_FriendsOfFriends: - if((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_FRIENDSOFFRIENDS)!=(ucVal&0x01)<<3) - { - if(ucVal==1) - { - GameSettingsA[iPad]->uiBitmaskValues|=GAMESETTING_FRIENDSOFFRIENDS; - } - else - { - GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_FRIENDSOFFRIENDS; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - - break; - case eGameSetting_DisplayUpdateMessage: - if((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_DISPLAYUPDATEMSG)!=(ucVal&0x03)<<4) - { - GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_DISPLAYUPDATEMSG; - if(ucVal>0) - { - GameSettingsA[iPad]->uiBitmaskValues|=(ucVal&0x03)<<4; - } - - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - - break; - - case eGameSetting_BedrockFog: - if((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_BEDROCKFOG)!=(ucVal&0x01)<<6) - { - if(ucVal==1) - { - GameSettingsA[iPad]->uiBitmaskValues|=GAMESETTING_BEDROCKFOG; - } - else - { - GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_BEDROCKFOG; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - - break; - case eGameSetting_DisplayHUD: - if((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_DISPLAYHUD)!=(ucVal&0x01)<<7) - { - if(ucVal==1) - { - GameSettingsA[iPad]->uiBitmaskValues|=GAMESETTING_DISPLAYHUD; - } - else - { - GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_DISPLAYHUD; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - - break; - case eGameSetting_DisplayHand: - if((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_DISPLAYHAND)!=(ucVal&0x01)<<8) - { - if(ucVal==1) - { - GameSettingsA[iPad]->uiBitmaskValues|=GAMESETTING_DISPLAYHAND; - } - else - { - GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_DISPLAYHAND; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - - break; - - case eGameSetting_CustomSkinAnim: - if((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_CUSTOMSKINANIM)!=(ucVal&0x01)<<9) - { - if(ucVal==1) - { - GameSettingsA[iPad]->uiBitmaskValues|=GAMESETTING_CUSTOMSKINANIM; - } - else - { - GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_CUSTOMSKINANIM; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - - break; - // TU9 - case eGameSetting_DeathMessages: - if((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_DEATHMESSAGES)!=(ucVal&0x01)<<10) - { - if(ucVal==1) - { - GameSettingsA[iPad]->uiBitmaskValues|=GAMESETTING_DEATHMESSAGES; - } - else - { - GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_DEATHMESSAGES; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_UISize: - if((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_UISIZE)!=((ucVal&0x03)<<11)) - { - GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_UISIZE; - if(ucVal!=0) - { - GameSettingsA[iPad]->uiBitmaskValues|=(ucVal&0x03)<<11; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_UISizeSplitscreen: - if((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_UISIZE_SPLITSCREEN)!=((ucVal&0x03)<<13)) - { - GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_UISIZE_SPLITSCREEN; - if(ucVal!=0) - { - GameSettingsA[iPad]->uiBitmaskValues|=(ucVal&0x03)<<13; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_AnimatedCharacter: - if((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_ANIMATEDCHARACTER)!=(ucVal&0x01)<<15) - { - if(ucVal==1) - { - GameSettingsA[iPad]->uiBitmaskValues|=GAMESETTING_ANIMATEDCHARACTER; - } - else - { - GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_ANIMATEDCHARACTER; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_PS3_EULA_Read: - if((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_PS3EULAREAD)!=(ucVal&0x01)<<16) - { - if(ucVal==1) - { - GameSettingsA[iPad]->uiBitmaskValues|=GAMESETTING_PS3EULAREAD; - } - else - { - GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_PS3EULAREAD; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_PSVita_NetworkModeAdhoc: - if((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_PSVITANETWORKMODEADHOC)!=(ucVal&0x01)<<17) - { - if(ucVal==1) - { - GameSettingsA[iPad]->uiBitmaskValues|=GAMESETTING_PSVITANETWORKMODEADHOC; - } - else - { - GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_PSVITANETWORKMODEADHOC; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - - } +void CMinecraftApp::SetMinecraftLocale(int iPad, unsigned char ucLocale) { + GameSettingsA[iPad]->ucLocale = ucLocale; + GameSettingsA[iPad]->bSettingsChanged = true; } -unsigned char CMinecraftApp::GetGameSettings(eGameSetting eVal) -{ - int iPad=ProfileManager.GetPrimaryPad(); - - return GetGameSettings(iPad,eVal); +unsigned char CMinecraftApp::GetMinecraftLocale(int iPad) { + // if there are no game settings read yet, return the default language + if (GameSettingsA[iPad] == NULL) { + return 0; + } else { + return GameSettingsA[iPad]->ucLocale; + } } -unsigned char CMinecraftApp::GetGameSettings(int iPad,eGameSetting eVal) -{ - switch(eVal) - { - case eGameSetting_MusicVolume: - return GameSettingsA[iPad]->ucMusicVolume; - break; - case eGameSetting_SoundFXVolume: - return GameSettingsA[iPad]->ucSoundFXVolume; - break; - case eGameSetting_Gamma: - return GameSettingsA[iPad]->ucGamma; - break; - case eGameSetting_Difficulty: - return GameSettingsA[iPad]->usBitmaskValues&0x0003; - break; - case eGameSetting_Sensitivity_InGame: - return GameSettingsA[iPad]->ucSensitivity; - break; - case eGameSetting_ViewBob: - return ((GameSettingsA[iPad]->usBitmaskValues&0x0004)>>2); - break; - case eGameSetting_GamertagsVisible: - return ((GameSettingsA[iPad]->usBitmaskValues&0x0008)>>3); - break; - case eGameSetting_ControlScheme: - return ((GameSettingsA[iPad]->usBitmaskValues&0x0030)>>4); // 2 bits - break; - case eGameSetting_ControlInvertLook: - return ((GameSettingsA[iPad]->usBitmaskValues&0x0040)>>6); - break; - case eGameSetting_ControlSouthPaw: - return ((GameSettingsA[iPad]->usBitmaskValues&0x0080)>>7); - break; - case eGameSetting_SplitScreenVertical: - return ((GameSettingsA[iPad]->usBitmaskValues&0x0100)>>8); - break; - // 4J-PB - Added for Interim TU for 1.6.6 - case eGameSetting_Sensitivity_InMenu: - return GameSettingsA[iPad]->ucMenuSensitivity; - break; +void CMinecraftApp::SetGameSettings(int iPad, eGameSetting eVal, + unsigned char ucVal) { + // Minecraft *pMinecraft=Minecraft::GetInstance(); - case eGameSetting_DisplaySplitscreenGamertags: - return ((GameSettingsA[iPad]->usBitmaskValues&0x0200)>>9); - break; + switch (eVal) { + case eGameSetting_MusicVolume: + if (GameSettingsA[iPad]->ucMusicVolume != ucVal) { + GameSettingsA[iPad]->ucMusicVolume = ucVal; + if (iPad == ProfileManager.GetPrimaryPad()) { + ActionGameSettings(iPad, eVal); + } + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_SoundFXVolume: + if (GameSettingsA[iPad]->ucSoundFXVolume != ucVal) { + GameSettingsA[iPad]->ucSoundFXVolume = ucVal; + if (iPad == ProfileManager.GetPrimaryPad()) { + ActionGameSettings(iPad, eVal); + } + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_Gamma: + if (GameSettingsA[iPad]->ucGamma != ucVal) { + GameSettingsA[iPad]->ucGamma = ucVal; + if (iPad == ProfileManager.GetPrimaryPad()) { + ActionGameSettings(iPad, eVal); + } + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_Difficulty: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x03) != + (ucVal & 0x03)) { + GameSettingsA[iPad]->usBitmaskValues &= ~0x03; + GameSettingsA[iPad]->usBitmaskValues |= ucVal & 0x03; + if (iPad == ProfileManager.GetPrimaryPad()) { + ActionGameSettings(iPad, eVal); + } + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_Sensitivity_InGame: + if (GameSettingsA[iPad]->ucSensitivity != ucVal) { + GameSettingsA[iPad]->ucSensitivity = ucVal; + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_ViewBob: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x0004) != + ((ucVal & 0x01) << 2)) { + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= 0x0004; + } else { + GameSettingsA[iPad]->usBitmaskValues &= ~0x0004; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_ControlScheme: // bits 5 and 6 + if ((GameSettingsA[iPad]->usBitmaskValues & 0x30) != + ((ucVal & 0x03) << 4)) { + GameSettingsA[iPad]->usBitmaskValues &= ~0x0030; + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= (ucVal & 0x03) << 4; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; - case eGameSetting_Hints: - return ((GameSettingsA[iPad]->usBitmaskValues&0x0400)>>10); - break; - case eGameSetting_Autosave: - { - unsigned char ucVal=(GameSettingsA[iPad]->usBitmaskValues&0x7800)>>11; - return ucVal; - } - break; - case eGameSetting_Tooltips: - return ((GameSettingsA[iPad]->usBitmaskValues&0x8000)>>15); - break; + case eGameSetting_ControlInvertLook: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x0040) != + ((ucVal & 0x01) << 6)) { + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= 0x0040; + } else { + GameSettingsA[iPad]->usBitmaskValues &= ~0x0040; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; - case eGameSetting_InterfaceOpacity: - return GameSettingsA[iPad]->ucInterfaceOpacity; - break; - - case eGameSetting_Clouds: - return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_CLOUDS); - break; - case eGameSetting_Online: - return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_ONLINE)>>1; - break; - case eGameSetting_InviteOnly: - return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_INVITEONLY)>>2; - break; - case eGameSetting_FriendsOfFriends: - return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_FRIENDSOFFRIENDS)>>3; - break; - case eGameSetting_DisplayUpdateMessage: - return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_DISPLAYUPDATEMSG)>>4; - break; - case eGameSetting_BedrockFog: - return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_BEDROCKFOG)>>6; - break; - case eGameSetting_DisplayHUD: - return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_DISPLAYHUD)>>7; - break; - case eGameSetting_DisplayHand: - return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_DISPLAYHAND)>>8; - break; - case eGameSetting_CustomSkinAnim: - return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_CUSTOMSKINANIM)>>9; - break; - // TU9 - case eGameSetting_DeathMessages: - return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_DEATHMESSAGES)>>10; - break; - case eGameSetting_UISize: - { - unsigned char ucVal=(GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_UISIZE)>>11; - return ucVal; - } - break; - case eGameSetting_UISizeSplitscreen: - { - unsigned char ucVal=(GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_UISIZE_SPLITSCREEN)>>13; - return ucVal; - } - break; - case eGameSetting_AnimatedCharacter: - return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_ANIMATEDCHARACTER)>>15; + case eGameSetting_ControlSouthPaw: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x0080) != + ((ucVal & 0x01) << 7)) { + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= 0x0080; + } else { + GameSettingsA[iPad]->usBitmaskValues &= ~0x0080; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_SplitScreenVertical: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x0100) != + ((ucVal & 0x01) << 8)) { + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= 0x0100; + } else { + GameSettingsA[iPad]->usBitmaskValues &= ~0x0100; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_GamertagsVisible: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x0008) != + ((ucVal & 0x01) << 3)) { + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= 0x0008; + } else { + GameSettingsA[iPad]->usBitmaskValues &= ~0x0008; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; - case eGameSetting_PS3_EULA_Read: - return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_PS3EULAREAD)>>16; + // 4J-PB - Added for Interim TU for 1.6.6 + case eGameSetting_Sensitivity_InMenu: + if (GameSettingsA[iPad]->ucMenuSensitivity != ucVal) { + GameSettingsA[iPad]->ucMenuSensitivity = ucVal; + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_DisplaySplitscreenGamertags: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x0200) != + ((ucVal & 0x01) << 9)) { + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= 0x0200; + } else { + GameSettingsA[iPad]->usBitmaskValues &= ~0x0200; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_Hints: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x0400) != + ((ucVal & 0x01) << 10)) { + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= 0x0400; + } else { + GameSettingsA[iPad]->usBitmaskValues &= ~0x0400; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_Autosave: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x7800) != + ((ucVal & 0x0F) << 11)) { + GameSettingsA[iPad]->usBitmaskValues &= ~0x7800; + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= (ucVal & 0x0F) + << 11; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; - case eGameSetting_PSVita_NetworkModeAdhoc: - return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_PSVITANETWORKMODEADHOC)>>17; + case eGameSetting_Tooltips: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x8000) != + ((ucVal & 0x01) << 15)) { + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= 0x8000; + } else { + GameSettingsA[iPad]->usBitmaskValues &= ~0x8000; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_InterfaceOpacity: + if (GameSettingsA[iPad]->ucInterfaceOpacity != ucVal) { + GameSettingsA[iPad]->ucInterfaceOpacity = ucVal; + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } - } - return 0; + break; + case eGameSetting_Clouds: + if ((GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_CLOUDS) != + (ucVal & 0x01)) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= GAMESETTING_CLOUDS; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= ~GAMESETTING_CLOUDS; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + + break; + + case eGameSetting_Online: + if ((GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_ONLINE) != + (ucVal & 0x01) << 1) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= GAMESETTING_ONLINE; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= ~GAMESETTING_ONLINE; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + + break; + case eGameSetting_InviteOnly: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_INVITEONLY) != (ucVal & 0x01) << 2) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_INVITEONLY; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_INVITEONLY; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + + break; + case eGameSetting_FriendsOfFriends: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_FRIENDSOFFRIENDS) != (ucVal & 0x01) << 3) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_FRIENDSOFFRIENDS; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_FRIENDSOFFRIENDS; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + + break; + case eGameSetting_DisplayUpdateMessage: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_DISPLAYUPDATEMSG) != (ucVal & 0x03) << 4) { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_DISPLAYUPDATEMSG; + if (ucVal > 0) { + GameSettingsA[iPad]->uiBitmaskValues |= (ucVal & 0x03) << 4; + } + + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + + break; + + case eGameSetting_BedrockFog: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_BEDROCKFOG) != (ucVal & 0x01) << 6) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_BEDROCKFOG; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_BEDROCKFOG; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + + break; + case eGameSetting_DisplayHUD: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_DISPLAYHUD) != (ucVal & 0x01) << 7) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_DISPLAYHUD; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_DISPLAYHUD; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + + break; + case eGameSetting_DisplayHand: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_DISPLAYHAND) != (ucVal & 0x01) << 8) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_DISPLAYHAND; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_DISPLAYHAND; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + + break; + + case eGameSetting_CustomSkinAnim: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_CUSTOMSKINANIM) != (ucVal & 0x01) << 9) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_CUSTOMSKINANIM; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_CUSTOMSKINANIM; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + + break; + // TU9 + case eGameSetting_DeathMessages: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_DEATHMESSAGES) != (ucVal & 0x01) << 10) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_DEATHMESSAGES; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_DEATHMESSAGES; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_UISize: + if ((GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_UISIZE) != + ((ucVal & 0x03) << 11)) { + GameSettingsA[iPad]->uiBitmaskValues &= ~GAMESETTING_UISIZE; + if (ucVal != 0) { + GameSettingsA[iPad]->uiBitmaskValues |= (ucVal & 0x03) + << 11; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_UISizeSplitscreen: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_UISIZE_SPLITSCREEN) != ((ucVal & 0x03) << 13)) { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_UISIZE_SPLITSCREEN; + if (ucVal != 0) { + GameSettingsA[iPad]->uiBitmaskValues |= (ucVal & 0x03) + << 13; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_AnimatedCharacter: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_ANIMATEDCHARACTER) != (ucVal & 0x01) << 15) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_ANIMATEDCHARACTER; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_ANIMATEDCHARACTER; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_PS3_EULA_Read: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_PS3EULAREAD) != (ucVal & 0x01) << 16) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_PS3EULAREAD; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_PS3EULAREAD; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_PSVita_NetworkModeAdhoc: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_PSVITANETWORKMODEADHOC) != (ucVal & 0x01) << 17) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_PSVITANETWORKMODEADHOC; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_PSVITANETWORKMODEADHOC; + } + ActionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + } } -void CMinecraftApp::CheckGameSettingsChanged(bool bOverride5MinuteTimer, int iPad) -{ - // If the settings have changed, write them to the profile +unsigned char CMinecraftApp::GetGameSettings(eGameSetting eVal) { + int iPad = ProfileManager.GetPrimaryPad(); - if(iPad==XUSER_INDEX_ANY) - { - for(int i=0;ibSettingsChanged) - { -#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__ ) - StorageManager.WriteToProfile(i,true, bOverride5MinuteTimer); + return GetGameSettings(iPad, eVal); +} + +unsigned char CMinecraftApp::GetGameSettings(int iPad, eGameSetting eVal) { + switch (eVal) { + case eGameSetting_MusicVolume: + return GameSettingsA[iPad]->ucMusicVolume; + break; + case eGameSetting_SoundFXVolume: + return GameSettingsA[iPad]->ucSoundFXVolume; + break; + case eGameSetting_Gamma: + return GameSettingsA[iPad]->ucGamma; + break; + case eGameSetting_Difficulty: + return GameSettingsA[iPad]->usBitmaskValues & 0x0003; + break; + case eGameSetting_Sensitivity_InGame: + return GameSettingsA[iPad]->ucSensitivity; + break; + case eGameSetting_ViewBob: + return ((GameSettingsA[iPad]->usBitmaskValues & 0x0004) >> 2); + break; + case eGameSetting_GamertagsVisible: + return ((GameSettingsA[iPad]->usBitmaskValues & 0x0008) >> 3); + break; + case eGameSetting_ControlScheme: + return ((GameSettingsA[iPad]->usBitmaskValues & 0x0030) >> + 4); // 2 bits + break; + case eGameSetting_ControlInvertLook: + return ((GameSettingsA[iPad]->usBitmaskValues & 0x0040) >> 6); + break; + case eGameSetting_ControlSouthPaw: + return ((GameSettingsA[iPad]->usBitmaskValues & 0x0080) >> 7); + break; + case eGameSetting_SplitScreenVertical: + return ((GameSettingsA[iPad]->usBitmaskValues & 0x0100) >> 8); + break; + // 4J-PB - Added for Interim TU for 1.6.6 + case eGameSetting_Sensitivity_InMenu: + return GameSettingsA[iPad]->ucMenuSensitivity; + break; + + case eGameSetting_DisplaySplitscreenGamertags: + return ((GameSettingsA[iPad]->usBitmaskValues & 0x0200) >> 9); + break; + + case eGameSetting_Hints: + return ((GameSettingsA[iPad]->usBitmaskValues & 0x0400) >> 10); + break; + case eGameSetting_Autosave: { + unsigned char ucVal = + (GameSettingsA[iPad]->usBitmaskValues & 0x7800) >> 11; + return ucVal; + } break; + case eGameSetting_Tooltips: + return ((GameSettingsA[iPad]->usBitmaskValues & 0x8000) >> 15); + break; + + case eGameSetting_InterfaceOpacity: + return GameSettingsA[iPad]->ucInterfaceOpacity; + break; + + case eGameSetting_Clouds: + return (GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_CLOUDS); + break; + case eGameSetting_Online: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_ONLINE) >> + 1; + break; + case eGameSetting_InviteOnly: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_INVITEONLY) >> + 2; + break; + case eGameSetting_FriendsOfFriends: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_FRIENDSOFFRIENDS) >> + 3; + break; + case eGameSetting_DisplayUpdateMessage: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_DISPLAYUPDATEMSG) >> + 4; + break; + case eGameSetting_BedrockFog: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_BEDROCKFOG) >> + 6; + break; + case eGameSetting_DisplayHUD: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_DISPLAYHUD) >> + 7; + break; + case eGameSetting_DisplayHand: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_DISPLAYHAND) >> + 8; + break; + case eGameSetting_CustomSkinAnim: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_CUSTOMSKINANIM) >> + 9; + break; + // TU9 + case eGameSetting_DeathMessages: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_DEATHMESSAGES) >> + 10; + break; + case eGameSetting_UISize: { + unsigned char ucVal = + (GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_UISIZE) >> + 11; + return ucVal; + } break; + case eGameSetting_UISizeSplitscreen: { + unsigned char ucVal = (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_UISIZE_SPLITSCREEN) >> + 13; + return ucVal; + } break; + case eGameSetting_AnimatedCharacter: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_ANIMATEDCHARACTER) >> + 15; + + case eGameSetting_PS3_EULA_Read: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_PS3EULAREAD) >> + 16; + + case eGameSetting_PSVita_NetworkModeAdhoc: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_PSVITANETWORKMODEADHOC) >> + 17; + } + return 0; +} + +void CMinecraftApp::CheckGameSettingsChanged(bool bOverride5MinuteTimer, + int iPad) { + // If the settings have changed, write them to the profile + + if (iPad == XUSER_INDEX_ANY) { + for (int i = 0; i < XUSER_MAX_COUNT; i++) { + if (GameSettingsA[i]->bSettingsChanged) { +#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || \ + defined __PSVITA__) + StorageManager.WriteToProfile(i, true, bOverride5MinuteTimer); #else - ProfileManager.WriteToProfile(i,true, bOverride5MinuteTimer); + ProfileManager.WriteToProfile(i, true, bOverride5MinuteTimer); #endif - GameSettingsA[i]->bSettingsChanged=false; - } - } - } - else - { - if(GameSettingsA[iPad]->bSettingsChanged) - { -#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) - StorageManager.WriteToProfile(iPad,true, bOverride5MinuteTimer); + GameSettingsA[i]->bSettingsChanged = false; + } + } + } else { + if (GameSettingsA[iPad]->bSettingsChanged) { +#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || \ + defined __PSVITA__) + StorageManager.WriteToProfile(iPad, true, bOverride5MinuteTimer); #else - ProfileManager.WriteToProfile(iPad,true, bOverride5MinuteTimer); + ProfileManager.WriteToProfile(iPad, true, bOverride5MinuteTimer); #endif - GameSettingsA[iPad]->bSettingsChanged=false; - } - } + GameSettingsA[iPad]->bSettingsChanged = false; + } + } } -void CMinecraftApp::ClearGameSettingsChangedFlag(int iPad) -{ - GameSettingsA[iPad]->bSettingsChanged=false; +void CMinecraftApp::ClearGameSettingsChangedFlag(int iPad) { + GameSettingsA[iPad]->bSettingsChanged = false; } /////////////////////////// @@ -2175,1423 +2485,1571 @@ void CMinecraftApp::ClearGameSettingsChangedFlag(int iPad) // //////////////////////////// #ifndef _DEBUG_MENUS_ENABLED -unsigned int CMinecraftApp::GetGameSettingsDebugMask(int iPad,bool bOverridePlayer) //bOverridePlayer is to force the send for the server to get the read options +unsigned int CMinecraftApp::GetGameSettingsDebugMask( + int iPad, bool bOverridePlayer) // bOverridePlayer is to force the send for + // the server to get the read options { - return 0; + return 0; } -void CMinecraftApp::SetGameSettingsDebugMask(int iPad, unsigned int uiVal) -{ -} +void CMinecraftApp::SetGameSettingsDebugMask(int iPad, unsigned int uiVal) {} -void CMinecraftApp::ActionDebugMask(int iPad,bool bSetAllClear) -{ -} +void CMinecraftApp::ActionDebugMask(int iPad, bool bSetAllClear) {} #else -unsigned int CMinecraftApp::GetGameSettingsDebugMask(int iPad,bool bOverridePlayer) //bOverridePlayer is to force the send for the server to get the read options +unsigned int CMinecraftApp::GetGameSettingsDebugMask( + int iPad, bool bOverridePlayer) // bOverridePlayer is to force the send for + // the server to get the read options { - if(iPad==-1) - { - iPad=ProfileManager.GetPrimaryPad(); - } - if(iPad < 0) iPad = 0; + if (iPad == -1) { + iPad = ProfileManager.GetPrimaryPad(); + } + if (iPad < 0) iPad = 0; - std::shared_ptr player = Minecraft::GetInstance()->localplayers[iPad]; + std::shared_ptr player = + Minecraft::GetInstance()->localplayers[iPad]; - if(bOverridePlayer || player==NULL) - { - return GameSettingsA[iPad]->uiDebugBitmask; - } - else - { - return player->GetDebugOptions(); - } + if (bOverridePlayer || player == NULL) { + return GameSettingsA[iPad]->uiDebugBitmask; + } else { + return player->GetDebugOptions(); + } } - -void CMinecraftApp::SetGameSettingsDebugMask(int iPad, unsigned int uiVal) -{ +void CMinecraftApp::SetGameSettingsDebugMask(int iPad, unsigned int uiVal) { #ifndef _CONTENT_PACKAGE - GameSettingsA[iPad]->bSettingsChanged=true; - GameSettingsA[iPad]->uiDebugBitmask=uiVal; + GameSettingsA[iPad]->bSettingsChanged = true; + GameSettingsA[iPad]->uiDebugBitmask = uiVal; - // update the value so the network server can use it - std::shared_ptr player = Minecraft::GetInstance()->localplayers[iPad]; + // update the value so the network server can use it + std::shared_ptr player = + Minecraft::GetInstance()->localplayers[iPad]; - if(player) - { - Minecraft::GetInstance()->localgameModes[iPad]->handleDebugOptions(uiVal,player); - } + if (player) { + Minecraft::GetInstance()->localgameModes[iPad]->handleDebugOptions( + uiVal, player); + } #endif } -void CMinecraftApp::ActionDebugMask(int iPad,bool bSetAllClear) -{ - unsigned int ulBitmask=app.GetGameSettingsDebugMask(iPad); +void CMinecraftApp::ActionDebugMask(int iPad, bool bSetAllClear) { + unsigned int ulBitmask = app.GetGameSettingsDebugMask(iPad); - if(bSetAllClear) ulBitmask=0L; + if (bSetAllClear) ulBitmask = 0L; + // these settings should only be actioned for the primary player + if (ProfileManager.GetPrimaryPad() != iPad) return; + for (int i = 0; i < eDebugSetting_Max; i++) { + switch (i) { + case eDebugSetting_LoadSavesFromDisk: + if (ulBitmask & (1 << i)) { + app.SetLoadSavesFromFolderEnabled(true); + } else { + app.SetLoadSavesFromFolderEnabled(false); + } + break; - // these settings should only be actioned for the primary player - if(ProfileManager.GetPrimaryPad()!=iPad) return; + case eDebugSetting_WriteSavesToDisk: + if (ulBitmask & (1 << i)) { + app.SetWriteSavesToFolderEnabled(true); + } else { + app.SetWriteSavesToFolderEnabled(false); + } + break; - for(int i=0;iiPad, actionInfo->action); +void CMinecraftApp::SetActionConfirmed(void* param) { + XuiActionParam* actionInfo = (XuiActionParam*)param; + app.SetAction(actionInfo->iPad, actionInfo->action); } +void CMinecraftApp::HandleXuiActions(void) { + eXuiAction eAction; + eTMSAction eTMS; + void* param; + Minecraft* pMinecraft = Minecraft::GetInstance(); + std::shared_ptr player; -void CMinecraftApp::HandleXuiActions(void) -{ - eXuiAction eAction; - eTMSAction eTMS; - void *param; - Minecraft *pMinecraft=Minecraft::GetInstance(); - std::shared_ptr player; + // are there any global actions to deal with? + eAction = app.GetGlobalXuiAction(); + if (eAction != eAppAction_Idle) { + switch (eAction) { + case eAppAction_DisplayLavaMessage: + // Display a warning about placing lava in the spawn area + { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + C4JStorage::EMessageResult result = + ui.RequestErrorMessage(IDS_CANT_PLACE_NEAR_SPAWN_TITLE, + IDS_CANT_PLACE_NEAR_SPAWN_TEXT, + uiIDA, 1, XUSER_INDEX_ANY); + if (result != C4JStorage::EMessage_Busy) + SetGlobalXuiAction(eAppAction_Idle); + } + break; + default: + break; + } + } - // are there any global actions to deal with? - eAction = app.GetGlobalXuiAction(); - if(eAction!=eAppAction_Idle) - { - switch(eAction) - { - case eAppAction_DisplayLavaMessage: - // Display a warning about placing lava in the spawn area - { - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_CANT_PLACE_NEAR_SPAWN_TITLE, IDS_CANT_PLACE_NEAR_SPAWN_TEXT, uiIDA,1,XUSER_INDEX_ANY,NULL,NULL, app.GetStringTable()); - if(result != C4JStorage::EMessage_Busy) SetGlobalXuiAction(eAppAction_Idle); + // are there any app actions to deal with? + for (int i = 0; i < XUSER_MAX_COUNT; i++) { + eAction = app.GetXuiAction(i); + param = m_eXuiActionParam[i]; - } - break; - default: - break; - } - } + if (eAction != eAppAction_Idle) { + switch (eAction) { + // the renderer will capture a screenshot + case eAppAction_SocialPost: + if (ProfileManager.IsFullVersion()) { + // Facebook Share + if (CSocialManager::Instance() + ->IsTitleAllowedToPostImages() && + CSocialManager::Instance() + ->AreAllUsersAllowedToPostImages()) { + // disable character name tags for the shot + // m_bwasHidingGui = pMinecraft->options->hideGui; + // // 4J Stu - Removed 1.8.2 bug fix (TU6) as don't + // need this + pMinecraft->options->hideGui = true; - // are there any app actions to deal with? - for(int i=0;ioptions->hideGui = bKeepHiding; - if(eAction!=eAppAction_Idle) - { - switch(eAction) - { - // the renderer will capture a screenshot - case eAppAction_SocialPost: - if(ProfileManager.IsFullVersion()) - { - // Facebook Share - if( CSocialManager::Instance()->IsTitleAllowedToPostImages() && CSocialManager::Instance()->AreAllUsersAllowedToPostImages() ) - { - // disable character name tags for the shot - //m_bwasHidingGui = pMinecraft->options->hideGui; // 4J Stu - Removed 1.8.2 bug fix (TU6) as don't need this - pMinecraft->options->hideGui = true; + // Facebook Share - SetAction(i,eAppAction_SocialPostScreenshot); - } - else - { - SetAction(i,eAppAction_Idle); - } - } - else - { - SetAction(i,eAppAction_Idle); - } - break; - case eAppAction_SocialPostScreenshot: - { - SetAction(i,eAppAction_Idle); - bool bKeepHiding = false; - for(int j=0; j < XUSER_MAX_COUNT;++j) - { - if(app.GetXuiAction(j) == eAppAction_SocialPostScreenshot) - { - bKeepHiding = true; - break; - } - } - pMinecraft->options->hideGui=bKeepHiding; + if (app.GetLocalPlayerCount() > 1) { + ui.NavigateToScene(i, eUIScene_SocialPost); + } else { + ui.NavigateToScene(i, eUIScene_SocialPost); + } + } break; + case eAppAction_SaveGame: + SetAction(i, eAppAction_Idle); + if (!GetChangingSessionType()) { + // If this is the trial game, do an upsell + if (ProfileManager.IsFullVersion()) { + // flag the render to capture the screenshot for the + // save + SetAction(i, eAppAction_SaveGameCapturedThumbnail); + } else { + // ask the player if they would like to upgrade, or + // they'll lose the level - // Facebook Share + unsigned int uiIDA[2]; + uiIDA[0] = IDS_CONFIRM_OK; + uiIDA[1] = IDS_CONFIRM_CANCEL; + ui.RequestErrorMessage( + IDS_UNLOCK_TITLE, IDS_UNLOCK_TOSAVE_TEXT, uiIDA, + 2, i, &CMinecraftApp::UnlockFullSaveReturned, + this); + } + } - if(app.GetLocalPlayerCount()>1) - { - ui.NavigateToScene(i,eUIScene_SocialPost); - } - else - { - ui.NavigateToScene(i,eUIScene_SocialPost); - } - } - break; - case eAppAction_SaveGame: - SetAction(i,eAppAction_Idle); - if(!GetChangingSessionType()) - { - // If this is the trial game, do an upsell - if(ProfileManager.IsFullVersion()) - { + break; + case eAppAction_AutosaveSaveGame: { + // Need to run a check to see if the save exists in order to + // stop the dialog asking if we want to overwrite it coming + // up on an autosave + bool bSaveExists; + StorageManager.DoesSaveExist(&bSaveExists); - // flag the render to capture the screenshot for the save - SetAction(i,eAppAction_SaveGameCapturedThumbnail); - } - else - { - // ask the player if they would like to upgrade, or they'll lose the level - - unsigned int uiIDA[2]; - uiIDA[0]=IDS_CONFIRM_OK; - uiIDA[1]=IDS_CONFIRM_CANCEL; - ui.RequestMessageBox(IDS_UNLOCK_TITLE, IDS_UNLOCK_TOSAVE_TEXT, uiIDA, 2,i,&CMinecraftApp::UnlockFullSaveReturned,this,app.GetStringTable()); - } - } + SetAction(i, eAppAction_Idle); + if (!GetChangingSessionType()) { + // flag the render to capture the screenshot for the + // save + SetAction(i, + eAppAction_AutosaveSaveGameCapturedThumbnail); + } + } - break; - case eAppAction_AutosaveSaveGame: - { - // Need to run a check to see if the save exists in order to stop the dialog asking if we want to overwrite it coming up on an autosave - bool bSaveExists; - StorageManager.DoesSaveExist(&bSaveExists); + break; - SetAction(i,eAppAction_Idle); - if(!GetChangingSessionType()) - { + case eAppAction_SaveGameCapturedThumbnail: + // reset the autosave timer + app.SetAutosaveTimerTime(); + SetAction(i, eAppAction_Idle); + // Check that there is a name for the save - if we're saving + // from the tutorial and this is the first save from the + // tutorial, we'll not have a name + /*if(StorageManager.GetSaveName()==NULL) + { + app.NavigateToScene(i,eUIScene_SaveWorld); + } + else*/ + { + // turn off the gamertags in splitscreen for the primary + // player, since they are about to be made fullscreen + ui.HideAllGameUIElements(); - // flag the render to capture the screenshot for the save - SetAction(i,eAppAction_AutosaveSaveGameCapturedThumbnail); - } - } + // Hide the other players scenes + ui.ShowOtherPlayersBaseScene( + ProfileManager.GetPrimaryPad(), false); - break; + // int saveOrCheckpointId = 0; + // bool validSave = + // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); + // SentientManager.RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), + // saveOrCheckpointId); - case eAppAction_SaveGameCapturedThumbnail: - // reset the autosave timer - app.SetAutosaveTimerTime(); - SetAction(i,eAppAction_Idle); - // Check that there is a name for the save - if we're saving from the tutorial and this is the first save from the tutorial, we'll not have a name - /*if(StorageManager.GetSaveName()==NULL) - { - app.NavigateToScene(i,eUIScene_SaveWorld); - } - else*/ - { - // turn off the gamertags in splitscreen for the primary player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); + LoadingInputParams* loadingParams = + new LoadingInputParams(); + loadingParams->func = + &UIScene_PauseMenu::SaveWorldThreadProc; + loadingParams->lpParam = (void*)false; - // Hide the other players scenes - ui.ShowOtherPlayersBaseScene(ProfileManager.GetPrimaryPad(), 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; - //INT saveOrCheckpointId = 0; - //bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); - //SentientManager.RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), saveOrCheckpointId); - - LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &UIScene_PauseMenu::SaveWorldThreadProc; - loadingParams->lpParam = (LPVOID)false; + UIFullscreenProgressCompletionData* completionData = + new UIFullscreenProgressCompletionData(); + completionData->bShowBackground = TRUE; + completionData->bShowLogo = TRUE; + completionData->type = + e_ProgressCompletion_NavigateBackToScene; + completionData->iPad = ProfileManager.GetPrimaryPad(); - // 4J-JEV - PS4: Fix for #5708 - [ONLINE] - If the user pulls their network cable out while saving the title will hang. - loadingParams->waitForThreadToDelete = true; + if (ui.IsSceneInStack(ProfileManager.GetPrimaryPad(), + eUIScene_EndPoem)) { + completionData->scene = eUIScene_EndPoem; + } else { + completionData->scene = eUIScene_PauseMenu; + } - UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); - completionData->bShowBackground=TRUE; - completionData->bShowLogo=TRUE; - completionData->type = e_ProgressCompletion_NavigateBackToScene; - completionData->iPad = ProfileManager.GetPrimaryPad(); + loadingParams->completionData = completionData; - if( ui.IsSceneInStack( ProfileManager.GetPrimaryPad(), eUIScene_EndPoem ) ) - { - completionData->scene = eUIScene_EndPoem; - } - else - { - completionData->scene = eUIScene_PauseMenu; - } - - loadingParams->completionData = completionData; - - // 4J Stu - Xbox only + // 4J Stu - Xbox only #ifdef _XBOX - // Temporarily make this scene fullscreen - CXuiSceneBase::SetPlayerBaseScenePosition( ProfileManager.GetPrimaryPad(), CXuiSceneBase::e_BaseScene_Fullscreen ); + // Temporarily make this scene fullscreen + CXuiSceneBase::SetPlayerBaseScenePosition( + ProfileManager.GetPrimaryPad(), + CXuiSceneBase::e_BaseScene_Fullscreen); #endif - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams , eUILayer_Fullscreen, eUIGroup_Fullscreen); + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_FullscreenProgress, + loadingParams, eUILayer_Fullscreen, + eUIGroup_Fullscreen); + } + break; + case eAppAction_AutosaveSaveGameCapturedThumbnail: - } - break; - case eAppAction_AutosaveSaveGameCapturedThumbnail: - - { - app.SetAutosaveTimerTime(); - SetAction(i,eAppAction_Idle); + { + app.SetAutosaveTimerTime(); + SetAction(i, eAppAction_Idle); #if defined(_XBOX_ONE) || defined(__ORBIS__) - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_AutoSaveGame); + app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + eXuiServerAction_AutoSaveGame); - if(app.GetGameHostOption(eGameHostOption_DisableSaving)) StorageManager.SetSaveDisabled(true); + if (app.GetGameHostOption(eGameHostOption_DisableSaving)) + StorageManager.SetSaveDisabled(true); #else - // turn off the gamertags in splitscreen for the primary player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); + // turn off the gamertags in splitscreen for the primary + // player, since they are about to be made fullscreen + ui.HideAllGameUIElements(); - //app.CloseAllPlayersXuiScenes(); - // Hide the other players scenes - ui.ShowOtherPlayersBaseScene(ProfileManager.GetPrimaryPad(), false); + // app.CloseAllPlayersXuiScenes(); + // Hide the other players scenes + ui.ShowOtherPlayersBaseScene(ProfileManager.GetPrimaryPad(), + false); - // This just allows it to be shown - if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false); - - //INT saveOrCheckpointId = 0; - //bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); - //SentientManager.RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), saveOrCheckpointId); + // This just allows it to be shown + if (pMinecraft + ->localgameModes[ProfileManager.GetPrimaryPad()] != + NULL) + pMinecraft + ->localgameModes[ProfileManager.GetPrimaryPad()] + ->getTutorial() + ->showTutorialPopup(false); - - LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &UIScene_PauseMenu::SaveWorldThreadProc; + // int saveOrCheckpointId = 0; + // bool validSave = + // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); + // SentientManager.RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), + // saveOrCheckpointId); - loadingParams->lpParam = (LPVOID)true; + LoadingInputParams* loadingParams = + new LoadingInputParams(); + loadingParams->func = + &UIScene_PauseMenu::SaveWorldThreadProc; - UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); - completionData->bShowBackground=TRUE; - completionData->bShowLogo=TRUE; - completionData->type = e_ProgressCompletion_AutosaveNavigateBack; - completionData->iPad = ProfileManager.GetPrimaryPad(); - //completionData->bAutosaveWasMenuDisplayed=ui.GetMenuDisplayed(ProfileManager.GetPrimaryPad()); - loadingParams->completionData = completionData; - - // 4J Stu - Xbox only + loadingParams->lpParam = (void*)true; + + UIFullscreenProgressCompletionData* completionData = + new UIFullscreenProgressCompletionData(); + completionData->bShowBackground = TRUE; + completionData->bShowLogo = TRUE; + completionData->type = + e_ProgressCompletion_AutosaveNavigateBack; + completionData->iPad = ProfileManager.GetPrimaryPad(); + // completionData->bAutosaveWasMenuDisplayed=ui.GetMenuDisplayed(ProfileManager.GetPrimaryPad()); + loadingParams->completionData = completionData; + + // 4J Stu - Xbox only #ifdef _XBOX - // Temporarily make this scene fullscreen - CXuiSceneBase::SetPlayerBaseScenePosition( ProfileManager.GetPrimaryPad(), CXuiSceneBase::e_BaseScene_Fullscreen ); + // Temporarily make this scene fullscreen + CXuiSceneBase::SetPlayerBaseScenePosition( + ProfileManager.GetPrimaryPad(), + CXuiSceneBase::e_BaseScene_Fullscreen); #endif - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams , eUILayer_Fullscreen, eUIGroup_Fullscreen); + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_FullscreenProgress, + loadingParams, eUILayer_Fullscreen, + eUIGroup_Fullscreen); #endif - } - break; - case eAppAction_ExitPlayer: - // a secondary player has chosen to quit - { - int iPlayerC=g_NetworkManager.GetPlayerCount(); + } break; + case eAppAction_ExitPlayer: + // a secondary player has chosen to quit + { + int iPlayerC = g_NetworkManager.GetPlayerCount(); - // Since the player is exiting, let's flush any profile writes for them, and hope we're not breaking TCR 136... -#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) - StorageManager.ForceQueuedProfileWrites(i); - LeaderboardManager::Instance()->OpenSession(); - for (int j = 0; j < XUSER_MAX_COUNT; j++) - { - if( ProfileManager.IsSignedIn(j) ) - { - app.DebugPrintf("Stats save for an offline game for the player at index %d\n", 0); - Minecraft::GetInstance()->forceStatsSave(j); - } - } - LeaderboardManager::Instance()->CloseSession(); + // Since the player is exiting, let's flush any profile + // writes for them, and hope we're not breaking TCR + // 136... +#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || \ + defined __PSVITA__) + StorageManager.ForceQueuedProfileWrites(i); + LeaderboardManager::Instance()->OpenSession(); + for (int j = 0; j < XUSER_MAX_COUNT; j++) { + if (ProfileManager.IsSignedIn(j)) { + app.DebugPrintf( + "Stats save for an offline game for the " + "player at index %d\n", + 0); + Minecraft::GetInstance()->forceStatsSave(j); + } + } + LeaderboardManager::Instance()->CloseSession(); #else - ProfileManager.ForceQueuedProfileWrites(i); + ProfileManager.ForceQueuedProfileWrites(i); #endif - // not required - it's done within the removeLocalPlayerIdx - // if(pMinecraft->level->isClientSide) - // { - // // we need to remove the qnetplayer, or this player won't be able to get back into the game until qnet times out and removes them - // g_NetworkManager.NotifyPlayerLeaving(g_NetworkManager.GetLocalPlayerByUserIndex(i)); - // } + // not required - it's done within the + // removeLocalPlayerIdx + // if(pMinecraft->level->isClientSide) + // { + // // we need to + // remove the qnetplayer, or this player won't be able + // to get back into the game until qnet times out and + // removes them + // g_NetworkManager.NotifyPlayerLeaving(g_NetworkManager.GetLocalPlayerByUserIndex(i)); + // } - // if there are any tips showing, we need to close them + // if there are any tips showing, we need to close them - pMinecraft->gui->clearMessages(i); + pMinecraft->gui->clearMessages(i); - // Make sure we've not got this player selected as current - this shouldn't be the case anyway - pMinecraft->setLocalPlayerIdx(ProfileManager.GetPrimaryPad()); - pMinecraft->removeLocalPlayerIdx(i); + // Make sure we've not got this player selected as + // current - this shouldn't be the case anyway + pMinecraft->setLocalPlayerIdx( + ProfileManager.GetPrimaryPad()); + pMinecraft->removeLocalPlayerIdx(i); #ifdef _XBOX - // tell the xui scenes a splitscreen player left - has to come after removeLocalPlayerIdx which calls updatePlayerViewportAssignments - XUIMessage xuiMsg; - CustomMessage_Splitscreenplayer_Struct myMsgData; - CustomMessage_Splitscreenplayer( &xuiMsg, &myMsgData, false); + // tell the xui scenes a splitscreen player left - has + // to come after removeLocalPlayerIdx which calls + // updatePlayerViewportAssignments + XUIMessage xuiMsg; + CustomMessage_Splitscreenplayer_Struct myMsgData; + CustomMessage_Splitscreenplayer(&xuiMsg, &myMsgData, + false); - // send the message - for(int idx=0;idxlocalplayers[idx]!=NULL)) - { - XuiBroadcastMessage( CXuiSceneBase::GetPlayerBaseScene(idx), &xuiMsg ); - } - } + // send the message + for (int idx = 0; idx < XUSER_MAX_COUNT; idx++) { + if ((i != idx) && + (pMinecraft->localplayers[idx] != NULL)) { + XuiBroadcastMessage( + CXuiSceneBase::GetPlayerBaseScene(idx), + &xuiMsg); + } + } #endif #ifndef _XBOX - // Wipe out the tooltips - ui.SetTooltips(i, -1); + // Wipe out the tooltips + ui.SetTooltips(i, -1); #endif - // Change the presence info - // Are we offline or online, and how many players are there - if(iPlayerC>2) // one player is about to leave here - they'll be set to idle in the qnet manager player leave - { - for(int iPlayer=0;iPlayerlocalplayers[iPlayer]) - { - if(g_NetworkManager.IsLocalGame()) - { - ProfileManager.SetCurrentGameActivity(iPlayer,CONTEXT_PRESENCE_MULTIPLAYEROFFLINE,false); - } - else - { - ProfileManager.SetCurrentGameActivity(iPlayer,CONTEXT_PRESENCE_MULTIPLAYER,false); - } - } - } - } - else - { - for(int iPlayer=0;iPlayerlocalplayers[iPlayer]) - { - if(g_NetworkManager.IsLocalGame()) - { - ProfileManager.SetCurrentGameActivity(iPlayer,CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE,false); - } - else - { - ProfileManager.SetCurrentGameActivity(iPlayer,CONTEXT_PRESENCE_MULTIPLAYER_1P,false); - } - } - } - } - + // Change the presence info + // Are we offline or online, and how many players are + // there + if (iPlayerC > 2) // one player is about to leave here + // - they'll be set to idle in the + // qnet manager player leave + { + for (int iPlayer = 0; iPlayer < XUSER_MAX_COUNT; + iPlayer++) { + if ((iPlayer != i) && + pMinecraft->localplayers[iPlayer]) { + if (g_NetworkManager.IsLocalGame()) { + ProfileManager.SetCurrentGameActivity( + iPlayer, + CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, + false); + } else { + ProfileManager.SetCurrentGameActivity( + iPlayer, + CONTEXT_PRESENCE_MULTIPLAYER, + false); + } + } + } + } else { + for (int iPlayer = 0; iPlayer < XUSER_MAX_COUNT; + iPlayer++) { + if ((iPlayer != i) && + pMinecraft->localplayers[iPlayer]) { + if (g_NetworkManager.IsLocalGame()) { + ProfileManager.SetCurrentGameActivity( + iPlayer, + CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, + false); + } else { + ProfileManager.SetCurrentGameActivity( + iPlayer, + CONTEXT_PRESENCE_MULTIPLAYER_1P, + false); + } + } + } + } + #ifdef _DURANGO - ProfileManager.RemoveGamepadFromGame(i); -#endif - - SetAction(i,eAppAction_Idle); - } - break; - case eAppAction_ExitPlayerPreLogin: - { - int iPlayerC=g_NetworkManager.GetPlayerCount(); - // Since the player is exiting, let's flush any profile writes for them, and hope we're not breaking TCR 136... -#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) - StorageManager.ForceQueuedProfileWrites(i); + ProfileManager.RemoveGamepadFromGame(i); +#endif + + SetAction(i, eAppAction_Idle); + } + break; + case eAppAction_ExitPlayerPreLogin: { + int iPlayerC = g_NetworkManager.GetPlayerCount(); + // Since the player is exiting, let's flush any profile + // writes for them, and hope we're not breaking TCR 136... +#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || \ + defined __PSVITA__) + StorageManager.ForceQueuedProfileWrites(i); #else - ProfileManager.ForceQueuedProfileWrites(i); -#endif - // if there are any tips showing, we need to close them + ProfileManager.ForceQueuedProfileWrites(i); +#endif + // if there are any tips showing, we need to close them - pMinecraft->gui->clearMessages(i); + pMinecraft->gui->clearMessages(i); - // Make sure we've not got this player selected as current - this shouldn't be the case anyway - pMinecraft->setLocalPlayerIdx(ProfileManager.GetPrimaryPad()); - pMinecraft->removeLocalPlayerIdx(i); + // Make sure we've not got this player selected as current - + // this shouldn't be the case anyway + pMinecraft->setLocalPlayerIdx( + ProfileManager.GetPrimaryPad()); + pMinecraft->removeLocalPlayerIdx(i); #ifdef _XBOX - // tell the xui scenes a splitscreen player left - has to come after removeLocalPlayerIdx which calls updatePlayerViewportAssignments - XUIMessage xuiMsg; - CustomMessage_Splitscreenplayer_Struct myMsgData; - CustomMessage_Splitscreenplayer( &xuiMsg, &myMsgData, false); + // tell the xui scenes a splitscreen player left - has to + // come after removeLocalPlayerIdx which calls + // updatePlayerViewportAssignments + XUIMessage xuiMsg; + CustomMessage_Splitscreenplayer_Struct myMsgData; + CustomMessage_Splitscreenplayer(&xuiMsg, &myMsgData, false); - // send the message - for(int idx=0;idxlocalplayers[idx]!=NULL)) - { - XuiBroadcastMessage( CXuiSceneBase::GetPlayerBaseScene(idx), &xuiMsg ); - } - } + // send the message + for (int idx = 0; idx < XUSER_MAX_COUNT; idx++) { + if ((i != idx) && + (pMinecraft->localplayers[idx] != NULL)) { + XuiBroadcastMessage( + CXuiSceneBase::GetPlayerBaseScene(idx), + &xuiMsg); + } + } #endif #ifndef _XBOX - // Wipe out the tooltips - ui.SetTooltips(i, -1); + // Wipe out the tooltips + ui.SetTooltips(i, -1); #endif - // Change the presence info - // Are we offline or online, and how many players are there - if(iPlayerC>2) // one player is about to leave here - they'll be set to idle in the qnet manager player leave - { - for(int iPlayer=0;iPlayerlocalplayers[iPlayer]) - { - if(g_NetworkManager.IsLocalGame()) - { - ProfileManager.SetCurrentGameActivity(iPlayer,CONTEXT_PRESENCE_MULTIPLAYEROFFLINE,false); - } - else - { - ProfileManager.SetCurrentGameActivity(iPlayer,CONTEXT_PRESENCE_MULTIPLAYER,false); - } - } - } - } - else - { - for(int iPlayer=0;iPlayerlocalplayers[iPlayer]) - { - if(g_NetworkManager.IsLocalGame()) - { - ProfileManager.SetCurrentGameActivity(iPlayer,CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE,false); - } - else - { - ProfileManager.SetCurrentGameActivity(iPlayer,CONTEXT_PRESENCE_MULTIPLAYER_1P,false); - } - } - } - } - SetAction(i,eAppAction_Idle); - } - break; + // Change the presence info + // Are we offline or online, and how many players are there + if (iPlayerC > + 2) // one player is about to leave here - they'll be + // set to idle in the qnet manager player leave + { + for (int iPlayer = 0; iPlayer < XUSER_MAX_COUNT; + iPlayer++) { + if ((iPlayer != i) && + pMinecraft->localplayers[iPlayer]) { + if (g_NetworkManager.IsLocalGame()) { + ProfileManager.SetCurrentGameActivity( + iPlayer, + CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, + false); + } else { + ProfileManager.SetCurrentGameActivity( + iPlayer, CONTEXT_PRESENCE_MULTIPLAYER, + false); + } + } + } + } else { + for (int iPlayer = 0; iPlayer < XUSER_MAX_COUNT; + iPlayer++) { + if ((iPlayer != i) && + pMinecraft->localplayers[iPlayer]) { + if (g_NetworkManager.IsLocalGame()) { + ProfileManager.SetCurrentGameActivity( + iPlayer, + CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, + false); + } else { + ProfileManager.SetCurrentGameActivity( + iPlayer, + CONTEXT_PRESENCE_MULTIPLAYER_1P, false); + } + } + } + } + SetAction(i, eAppAction_Idle); + } break; #ifdef __ORBIS__ - case eAppAction_OptionsSaveNoSpace: - { - SetAction(i,eAppAction_Idle); + case eAppAction_OptionsSaveNoSpace: { + SetAction(i, eAppAction_Idle); - SceSaveDataDialogParam param; - SceSaveDataDialogSystemMessageParam sysParam; - SceSaveDataDialogItems items; - SceSaveDataDirName dirName; + SceSaveDataDialogParam param; + SceSaveDataDialogSystemMessageParam sysParam; + SceSaveDataDialogItems items; + SceSaveDataDirName dirName; - sceSaveDataDialogParamInitialize(¶m); - param.mode = SCE_SAVE_DATA_DIALOG_MODE_SYSTEM_MSG; - param.dispType = SCE_SAVE_DATA_DIALOG_TYPE_SAVE; - memset(&sysParam,0,sizeof(sysParam)); - param.sysMsgParam = &sysParam; - param.sysMsgParam->sysMsgType = SCE_SAVE_DATA_DIALOG_SYSMSG_TYPE_NOSPACE_CONTINUABLE; - param.sysMsgParam->value = app.GetOptionsBlocksRequired(i); - memset(&items, 0, sizeof(items)); - param.items = &items; - param.items->userId = ProfileManager.getUserID(i); + sceSaveDataDialogParamInitialize(¶m); + param.mode = SCE_SAVE_DATA_DIALOG_MODE_SYSTEM_MSG; + param.dispType = SCE_SAVE_DATA_DIALOG_TYPE_SAVE; + memset(&sysParam, 0, sizeof(sysParam)); + param.sysMsgParam = &sysParam; + param.sysMsgParam->sysMsgType = + SCE_SAVE_DATA_DIALOG_SYSMSG_TYPE_NOSPACE_CONTINUABLE; + param.sysMsgParam->value = app.GetOptionsBlocksRequired(i); + memset(&items, 0, sizeof(items)); + param.items = &items; + param.items->userId = ProfileManager.getUserID(i); - int ret = sceSaveDataDialogInitialize(); - ret = sceSaveDataDialogOpen(¶m); + int ret = sceSaveDataDialogInitialize(); + ret = sceSaveDataDialogOpen(¶m); - app.SetOptionsSaveDataDialogRunning(true);//m_bOptionsSaveDataDialogRunning = true; - //pClass->m_eSaveIncompleteType = saveIncompleteType; + app.SetOptionsSaveDataDialogRunning( + true); // m_bOptionsSaveDataDialogRunning = true; + // pClass->m_eSaveIncompleteType = saveIncompleteType; - //StorageManager.SetSaveDisabled(true); - //pClass->EnterSaveNotificationSection(); + // StorageManager.SetSaveDisabled(true); + // pClass->EnterSaveNotificationSection(); - } - break; + } break; #endif - case eAppAction_ExitWorld: - pMinecraft->exitingWorldRightNow = true; - SetAction(i,eAppAction_Idle); + case eAppAction_ExitWorld: + pMinecraft->exitingWorldRightNow = true; - // If we're already leaving don't exit - if (g_NetworkManager.IsLeavingGame()) - { - break; - } + SetAction(i, eAppAction_Idle); - pMinecraft->gui->clearMessages(); + // If we're already leaving don't exit + if (g_NetworkManager.IsLeavingGame()) { + break; + } - // turn off the gamertags in splitscreen for the primary player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); + pMinecraft->gui->clearMessages(); - // reset the flag stopping new dlc message being shown if you've seen the message before - DisplayNewDLCTipAgain(); + // turn off the gamertags in splitscreen for the primary + // player, since they are about to be made fullscreen + ui.HideAllGameUIElements(); - // clear the autosave timer that might be on screen - ui.ShowAutosaveCountdownTimer(false); + // reset the flag stopping new dlc message being shown if + // you've seen the message before + DisplayNewDLCTipAgain(); - // Hide the selected item text - ui.HideAllGameUIElements(); + // clear the autosave timer that might be on screen + ui.ShowAutosaveCountdownTimer(false); - // Since the player forced the exit, let's flush any profile writes, and hope we're not breaking TCR 136... -#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) - StorageManager.ForceQueuedProfileWrites(); - LeaderboardManager::Instance()->OpenSession(); - for (int j = 0; j < XUSER_MAX_COUNT; j++) - { - if( ProfileManager.IsSignedIn(j) ) - { - app.DebugPrintf("Stats save for an offline game for the player at index %d\n", 0); - Minecraft::GetInstance()->forceStatsSave(j); - } - } - LeaderboardManager::Instance()->CloseSession(); + // Hide the selected item text + ui.HideAllGameUIElements(); + + // Since the player forced the exit, let's flush any profile + // writes, and hope we're not breaking TCR 136... +#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || \ + defined __PSVITA__) + StorageManager.ForceQueuedProfileWrites(); + LeaderboardManager::Instance()->OpenSession(); + for (int j = 0; j < XUSER_MAX_COUNT; j++) { + if (ProfileManager.IsSignedIn(j)) { + app.DebugPrintf( + "Stats save for an offline game for the player " + "at index %d\n", + 0); + Minecraft::GetInstance()->forceStatsSave(j); + } + } + LeaderboardManager::Instance()->CloseSession(); #elif (defined _XBOX) - ProfileManager.ForceQueuedProfileWrites(); + ProfileManager.ForceQueuedProfileWrites(); #endif - // 4J-PB - cancel any possible string verifications queued with LIVE - //InputManager.CancelAllVerifyInProgress(); + // 4J-PB - cancel any possible std::string verifications + // queued with LIVE + // InputManager.CancelAllVerifyInProgress(); - if(ProfileManager.IsFullVersion()) - { - - // In a split screen, only the primary player actually quits the game, others just remove their players - if( i != ProfileManager.GetPrimaryPad() ) - { - // Make sure we've not got this player selected as current - this shouldn't be the case anyway - pMinecraft->setLocalPlayerIdx(ProfileManager.GetPrimaryPad()); - pMinecraft->removeLocalPlayerIdx(i); + if (ProfileManager.IsFullVersion()) { + // In a split screen, only the primary player actually + // quits the game, others just remove their players + if (i != ProfileManager.GetPrimaryPad()) { + // Make sure we've not got this player selected as + // current - this shouldn't be the case anyway + pMinecraft->setLocalPlayerIdx( + ProfileManager.GetPrimaryPad()); + pMinecraft->removeLocalPlayerIdx(i); #ifdef _DURANGO - ProfileManager.RemoveGamepadFromGame(i); -#endif - SetAction(i,eAppAction_Idle); - return; - } - // flag to capture the save thumbnail - SetAction(i,eAppAction_ExitWorldCapturedThumbnail, param); - } - else - { - // ask the player if they would like to upgrade, or they'll lose the level - unsigned int uiIDA[2]; - uiIDA[0]=IDS_CONFIRM_OK; - uiIDA[1]=IDS_CONFIRM_CANCEL; - ui.RequestMessageBox(IDS_UNLOCK_TITLE, IDS_UNLOCK_TOSAVE_TEXT, uiIDA, 2, i,&CMinecraftApp::UnlockFullExitReturned,this,app.GetStringTable()); - } - - // Change the presence info - // Are we offline or online, and how many players are there - - if(g_NetworkManager.GetPlayerCount()>1) - { - for(int j=0;jlocalplayers[j]) - { - if(g_NetworkManager.IsLocalGame()) - { - app.SetRichPresenceContext(j,CONTEXT_GAME_STATE_BLANK); - ProfileManager.SetCurrentGameActivity(j,CONTEXT_PRESENCE_MULTIPLAYEROFFLINE,false); - } - else - { - app.SetRichPresenceContext(j,CONTEXT_GAME_STATE_BLANK); - ProfileManager.SetCurrentGameActivity(j,CONTEXT_PRESENCE_MULTIPLAYER,false); - } - TelemetryManager->RecordLevelExit(j, eSen_LevelExitStatus_Exited); - } - } - } - else - { - app.SetRichPresenceContext(i,CONTEXT_GAME_STATE_BLANK); - if(g_NetworkManager.IsLocalGame()) - { - ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE,false); - } - else - { - ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MULTIPLAYER_1P,false); - } - TelemetryManager->RecordLevelExit(i, eSen_LevelExitStatus_Exited); - } - break; - case eAppAction_ExitWorldCapturedThumbnail: - { - SetAction(i,eAppAction_Idle); - // Stop app running - SetGameStarted(false); - SetChangingSessionType(true); // Added to stop handling ethernet disconnects - - ui.CloseAllPlayersScenes(); - - // turn off the gamertags in splitscreen for the primary player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); - - // 4J Stu - Fix for #12368 - Crash: Game crashes when saving then exiting and selecting to save - for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) - { -#ifdef _XBOX - app.TutorialSceneNavigateBack(idx,true); + ProfileManager.RemoveGamepadFromGame(i); #endif - - // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title crashed after exiting the tutorial - // It doesn't matter if they were in the tutorial already - pMinecraft->playerLeftTutorial( idx ); - } + SetAction(i, eAppAction_Idle); + return; + } + // flag to capture the save thumbnail + SetAction(i, eAppAction_ExitWorldCapturedThumbnail, + param); + } else { + // ask the player if they would like to upgrade, or + // they'll lose the level + unsigned int uiIDA[2]; + uiIDA[0] = IDS_CONFIRM_OK; + uiIDA[1] = IDS_CONFIRM_CANCEL; + ui.RequestErrorMessage( + IDS_UNLOCK_TITLE, IDS_UNLOCK_TOSAVE_TEXT, uiIDA, 2, + i, &CMinecraftApp::UnlockFullExitReturned, this); + } - LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &UIScene_PauseMenu::ExitWorldThreadProc; - loadingParams->lpParam = param; + // Change the presence info + // Are we offline or online, and how many players are there - UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); - // If param is non-null then this is a forced exit by the server, so make sure the player knows why - // 4J Stu - Changed - Don't use the FullScreenProgressScreen for action, use a dialog instead - completionData->bRequiresUserAction = FALSE;//(param != NULL) ? TRUE : FALSE; - completionData->bShowTips = (param != NULL) ? FALSE : TRUE; - completionData->bShowBackground=TRUE; - completionData->bShowLogo=TRUE; - completionData->type = e_ProgressCompletion_NavigateToHomeMenu; - completionData->iPad = DEFAULT_XUI_MENU_USER; - loadingParams->completionData = completionData; + if (g_NetworkManager.GetPlayerCount() > 1) { + for (int j = 0; j < XUSER_MAX_COUNT; j++) { + if (pMinecraft->localplayers[j]) { + if (g_NetworkManager.IsLocalGame()) { + app.SetRichPresenceContext( + j, CONTEXT_GAME_STATE_BLANK); + ProfileManager.SetCurrentGameActivity( + j, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, + false); + } else { + app.SetRichPresenceContext( + j, CONTEXT_GAME_STATE_BLANK); + ProfileManager.SetCurrentGameActivity( + j, CONTEXT_PRESENCE_MULTIPLAYER, false); + } + TelemetryManager->RecordLevelExit( + j, eSen_LevelExitStatus_Exited); + } + } + } else { + app.SetRichPresenceContext(i, CONTEXT_GAME_STATE_BLANK); + if (g_NetworkManager.IsLocalGame()) { + ProfileManager.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, + false); + } else { + ProfileManager.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MULTIPLAYER_1P, false); + } + TelemetryManager->RecordLevelExit( + i, eSen_LevelExitStatus_Exited); + } + break; + case eAppAction_ExitWorldCapturedThumbnail: { + SetAction(i, eAppAction_Idle); + // Stop app running + SetGameStarted(false); + SetChangingSessionType( + true); // Added to stop handling ethernet disconnects - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams); - } - break; - case eAppAction_ExitWorldTrial: - { - SetAction(i,eAppAction_Idle); + ui.CloseAllPlayersScenes(); - pMinecraft->gui->clearMessages(); + // turn off the gamertags in splitscreen for the primary + // player, since they are about to be made fullscreen + ui.HideAllGameUIElements(); - // turn off the gamertags in splitscreen for the primary player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); - - // Stop app running - SetGameStarted(false); - - ui.CloseAllPlayersScenes(); - - // 4J Stu - Fix for #12368 - Crash: Game crashes when saving then exiting and selecting to save - for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) - { + // 4J Stu - Fix for #12368 - Crash: Game crashes when saving + // then exiting and selecting to save + for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { #ifdef _XBOX - app.TutorialSceneNavigateBack(idx,true); + app.TutorialSceneNavigateBack(idx, true); #endif - - // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title crashed after exiting the tutorial - // It doesn't matter if they were in the tutorial already - pMinecraft->playerLeftTutorial( idx ); - } - LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &UIScene_PauseMenu::ExitWorldThreadProc; - loadingParams->lpParam = param; + // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title + // crashed after exiting the tutorial It doesn't matter + // if they were in the tutorial already + pMinecraft->playerLeftTutorial(idx); + } - UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); - completionData->bShowBackground=TRUE; - completionData->bShowLogo=TRUE; - completionData->type = e_ProgressCompletion_NavigateToHomeMenu; - completionData->iPad = DEFAULT_XUI_MENU_USER; - loadingParams->completionData = completionData; - - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams); - } + LoadingInputParams* loadingParams = + new LoadingInputParams(); + loadingParams->func = + &UIScene_PauseMenu::ExitWorldThreadProc; + loadingParams->lpParam = param; - break; - case eAppAction_ExitTrial: - //XLaunchNewImage(XLAUNCH_KEYWORD_DASH_ARCADE, 0); - ExitGame(); - break; + UIFullscreenProgressCompletionData* completionData = + new UIFullscreenProgressCompletionData(); + // If param is non-null then this is a forced exit by the + // server, so make sure the player knows why 4J Stu - + // Changed - Don't use the FullScreenProgressScreen for + // action, use a dialog instead + completionData->bRequiresUserAction = + FALSE; //(param != NULL) ? TRUE : FALSE; + completionData->bShowTips = (param != NULL) ? FALSE : TRUE; + completionData->bShowBackground = TRUE; + completionData->bShowLogo = TRUE; + completionData->type = + e_ProgressCompletion_NavigateToHomeMenu; + completionData->iPad = DEFAULT_XUI_MENU_USER; + loadingParams->completionData = completionData; - case eAppAction_Respawn: - { - ConnectionProgressParams *param = new ConnectionProgressParams(); - param->iPad = i; - param->stringId = IDS_PROGRESS_RESPAWNING; - param->showTooltips = false; - param->setFailTimer = false; - ui.NavigateToScene(i,eUIScene_ConnectingProgress, param); - - // Need to reset this incase the player has already died and respawned - pMinecraft->localplayers[i]->SetPlayerRespawned(false); + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_FullscreenProgress, + loadingParams); + } break; + case eAppAction_ExitWorldTrial: { + SetAction(i, eAppAction_Idle); - SetAction(i,eAppAction_WaitForRespawnComplete); - if( app.GetLocalPlayerCount()>1 ) - { - // In split screen mode, we don't want to do any async loading or flushing of the cache, just a simple respawn - pMinecraft->localplayers[i]->respawn(); + pMinecraft->gui->clearMessages(); - // If the respawn requires a dimension change then the action will have changed - //if(app.GetXuiAction(i) == eAppAction_Respawn) - //{ - // SetAction(i,eAppAction_Idle); - // CloseXuiScenes(i); - //} - } - else - { - //SetAction(i,eAppAction_WaitForRespawnComplete); + // turn off the gamertags in splitscreen for the primary + // player, since they are about to be made fullscreen + ui.HideAllGameUIElements(); - //LoadingInputParams *loadingParams = new LoadingInputParams(); - //loadingParams->func = &CScene_Death::RespawnThreadProc; - //loadingParams->lpParam = (LPVOID)i; + // Stop app running + SetGameStarted(false); - // Disable game & update thread whilst we do any of this - //app.SetGameStarted(false); - pMinecraft->gameRenderer->DisableUpdateThread(); - - // 4J Stu - We don't need this on a thread in multiplayer as respawning is asynchronous. - pMinecraft->localplayers[i]->respawn(); + ui.CloseAllPlayersScenes(); - //app.SetGameStarted(true); - pMinecraft->gameRenderer->EnableUpdateThread(); - - //UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); - //completionData->bShowBackground=TRUE; - //completionData->bShowLogo=TRUE; - //completionData->type = e_ProgressCompletion_CloseUIScenes; - //completionData->iPad = i; - //loadingParams->completionData = completionData; - - //app.NavigateToScene(i,eUIScene_FullscreenProgress, loadingParams, true); - } - } - break; - case eAppAction_WaitForRespawnComplete: - player = pMinecraft->localplayers[i]; - if(player != NULL && player->GetPlayerRespawned()) - { - SetAction(i,eAppAction_Idle); - - if(ui.IsSceneInStack(i, eUIScene_EndPoem)) - { - ui.NavigateBack(i,false,eUIScene_EndPoem); - } - else - { - ui.CloseUIScenes(i); - } - - // clear the progress messages - -// pMinecraft->progressRenderer->progressStart(-1); -// pMinecraft->progressRenderer->progressStage(-1); - } - else if(!g_NetworkManager.IsInGameplay()) - { - SetAction(i,eAppAction_Idle); - } - break; - case eAppAction_WaitForDimensionChangeComplete: - player = pMinecraft->localplayers[i]; - if(player != NULL && player->connection && player->connection->isStarted()) - { - SetAction(i,eAppAction_Idle); - ui.CloseUIScenes(i); - } - else if(!g_NetworkManager.IsInGameplay()) - { - SetAction(i,eAppAction_Idle); - } - break; - case eAppAction_PrimaryPlayerSignedOut: - { - //SetAction(i,eAppAction_Idle); - - // clear the autosavetimer that might be displayed - ui.ShowAutosaveCountdownTimer(false); - - // If the player signs out before the game started the server can be killed a bit earlier to stop - // the loading or saving of a new game continuing running while the UI/Guide is up - if(!app.GetGameStarted()) MinecraftServer::HaltServer(true); - - // inform the player they are being returned to the menus because they signed out - StorageManager.SetSaveDeviceSelected(i,false); - // need to clear the player stats - can't assume it'll be done in setlevel - we may not be in the game - StatsCounter* pStats = Minecraft::GetInstance()->stats[ i ]; - pStats->clear(); - - // 4J-PB - the libs will display the Returned to Title screen -// unsigned int uiIDA[1]; -// uiIDA[0]=IDS_CONFIRM_OK; -// -// ui.RequestMessageBox(IDS_RETURNEDTOMENU_TITLE, IDS_RETURNEDTOTITLESCREEN_TEXT, uiIDA, 1, i,&CMinecraftApp::PrimaryPlayerSignedOutReturned,this,app.GetStringTable()); - if( g_NetworkManager.IsInSession() ) - { - app.SetAction(i,eAppAction_PrimaryPlayerSignedOutReturned); - } - else - { - app.SetAction(i,eAppAction_PrimaryPlayerSignedOutReturned_Menus); - MinecraftServer::resetFlags(); - } - } - break; - case eAppAction_EthernetDisconnected: - { - app.DebugPrintf("Handling eAppAction_EthernetDisconnected\n"); - SetAction(i,eAppAction_Idle); - - // 4J Stu - Fix for #12530 -TCR 001 BAS Game Stability: Title will crash if the player disconnects while starting a new world and then opts to play the tutorial once they have been returned to the Main Menu. - if(!g_NetworkManager.IsLeavingGame()) - { - app.DebugPrintf("Handling eAppAction_EthernetDisconnected - Not leaving game\n"); - // 4J-PB - not the same as a signout. We should only leave the game if this machine is not the host. We shouldn't get rid of the save device either. - if( g_NetworkManager.IsHost() ) - { - app.DebugPrintf("Handling eAppAction_EthernetDisconnected - Is Host\n"); - // If it's already a local game, then an ethernet disconnect should have no effect - if( !g_NetworkManager.IsLocalGame() && g_NetworkManager.IsInGameplay() ) - { - // Change the session to an offline session - SetAction(i,eAppAction_ChangeSessionType); - } - else if(!g_NetworkManager.IsLocalGame() && !g_NetworkManager.IsInGameplay() ) - { - // There are two cases here, either: - // 1. We're early enough in the create/load game that we can do a really minimal shutdown or - // 2. We're far enough in (game has started but the actual game started flag hasn't been set) that we should just wait until we're in the game and switch to offline mode - - // If there's a non-null level then, for our purposes, the game has started - bool gameStarted = false; - for(int i = 0; i < pMinecraft->levels.length; i++) - { - if (pMinecraft->levels.data[i] != nullptr) - { - gameStarted = true; - break; - } - } - - if (!gameStarted) - { - // 1. Exit - MinecraftServer::HaltServer(); - - // Fix for #12530 - TCR 001 BAS Game Stability: Title will crash if the player disconnects while starting a new world and then opts to play the tutorial once they have been returned to the Main Menu. - // 4J Stu - Leave the session - g_NetworkManager.LeaveGame(FALSE); - - // need to clear the player stats - can't assume it'll be done in setlevel - we may not be in the game - StatsCounter* pStats = Minecraft::GetInstance()->stats[ i ]; - pStats->clear(); - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - - ui.RequestMessageBox(g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST), g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE), uiIDA, 1, i,&CMinecraftApp::EthernetDisconnectReturned,this, app.GetStringTable()); - } - else - { - // 2. Switch to offline - SetAction(i,eAppAction_ChangeSessionType); - } - } - } - else - { - app.DebugPrintf("Handling eAppAction_EthernetDisconnected - Not host\n"); - // need to clear the player stats - can't assume it'll be done in setlevel - we may not be in the game - StatsCounter* pStats = Minecraft::GetInstance()->stats[ i ]; - pStats->clear(); - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - - ui.RequestMessageBox(g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST), g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE), uiIDA, 1, i,&CMinecraftApp::EthernetDisconnectReturned,this, app.GetStringTable()); - } - } - } - break; - // We currently handle both these returns the same way. - case eAppAction_EthernetDisconnectedReturned: - case eAppAction_PrimaryPlayerSignedOutReturned: - { - SetAction(i,eAppAction_Idle); - - pMinecraft->gui->clearMessages(); - - // turn off the gamertags in splitscreen for the primary player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); - - // set the state back to pre-game - ProfileManager.ResetProfileProcessState(); - - - if( g_NetworkManager.IsLeavingGame() ) - { - // 4J Stu - If we are already leaving the game, then we just need to signal that the player signed out to stop saves - pMinecraft->progressRenderer->progressStartNoAbort( IDS_EXITING_GAME ); - pMinecraft->progressRenderer->progressStage(-1); - // This has no effect on client machines - MinecraftServer::HaltServer(true); - } - else - { - // Stop app running - SetGameStarted(false); - - // turn off the gamertags in splitscreen for the primary player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); - - ui.CloseAllPlayersScenes(); - - // 4J Stu - Fix for #12368 - Crash: Game crashes when saving then exiting and selecting to save - for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) - { + // 4J Stu - Fix for #12368 - Crash: Game crashes when saving + // then exiting and selecting to save + for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { #ifdef _XBOX - app.TutorialSceneNavigateBack(idx,true); + app.TutorialSceneNavigateBack(idx, true); #endif - - // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title crashed after exiting the tutorial - // It doesn't matter if they were in the tutorial already - pMinecraft->playerLeftTutorial( idx ); - } - LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &CMinecraftApp::SignoutExitWorldThreadProc; + // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title + // crashed after exiting the tutorial It doesn't matter + // if they were in the tutorial already + pMinecraft->playerLeftTutorial(idx); + } - UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); - completionData->bShowBackground=TRUE; - completionData->bShowLogo=TRUE; - completionData->iPad=DEFAULT_XUI_MENU_USER; - completionData->type = e_ProgressCompletion_NavigateToHomeMenu; - loadingParams->completionData = completionData; + LoadingInputParams* loadingParams = + new LoadingInputParams(); + loadingParams->func = + &UIScene_PauseMenu::ExitWorldThreadProc; + loadingParams->lpParam = param; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams); - } - } - break; - case eAppAction_PrimaryPlayerSignedOutReturned_Menus: - SetAction(i,eAppAction_Idle); - // set the state back to pre-game - ProfileManager.ResetProfileProcessState(); - // clear the save device - StorageManager.SetSaveDeviceSelected(i,false); + UIFullscreenProgressCompletionData* completionData = + new UIFullscreenProgressCompletionData(); + completionData->bShowBackground = TRUE; + completionData->bShowLogo = TRUE; + completionData->type = + e_ProgressCompletion_NavigateToHomeMenu; + completionData->iPad = DEFAULT_XUI_MENU_USER; + loadingParams->completionData = completionData; - ui.UpdatePlayerBasePositions(); - // there are multiple layers in the help menu, so a navigate back isn't enough - ui.NavigateToHomeMenu(); + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_FullscreenProgress, + loadingParams); + } - break; - case eAppAction_EthernetDisconnectedReturned_Menus: - SetAction(i,eAppAction_Idle); - // set the state back to pre-game - ProfileManager.ResetProfileProcessState(); + break; + case eAppAction_ExitTrial: + // XLaunchNewImage(XLAUNCH_KEYWORD_DASH_ARCADE, 0); + ExitGame(); + break; - ui.UpdatePlayerBasePositions(); + case eAppAction_Respawn: { + ConnectionProgressParams* param = + new ConnectionProgressParams(); + param->iPad = i; + param->stringId = IDS_PROGRESS_RESPAWNING; + param->showTooltips = false; + param->setFailTimer = false; + ui.NavigateToScene(i, eUIScene_ConnectingProgress, param); - // there are multiple layers in the help menu, so a navigate back isn't enough - ui.NavigateToHomeMenu(); + // Need to reset this incase the player has already died and + // respawned + pMinecraft->localplayers[i]->SetPlayerRespawned(false); - break; + SetAction(i, eAppAction_WaitForRespawnComplete); + if (app.GetLocalPlayerCount() > 1) { + // In split screen mode, we don't want to do any async + // loading or flushing of the cache, just a simple + // respawn + pMinecraft->localplayers[i]->respawn(); - case eAppAction_TrialOver: - { - SetAction(i,eAppAction_Idle); - unsigned int uiIDA[2]; - uiIDA[0]=IDS_UNLOCK_TITLE; - uiIDA[1]=IDS_EXIT_GAME; + // If the respawn requires a dimension change then the + // action will have changed + // if(app.GetXuiAction(i) == eAppAction_Respawn) + //{ + // SetAction(i,eAppAction_Idle); + // CloseXuiScenes(i); + //} + } else { + // SetAction(i,eAppAction_WaitForRespawnComplete); - ui.RequestMessageBox(IDS_TRIALOVER_TITLE, IDS_TRIALOVER_TEXT, uiIDA, 2, i,&CMinecraftApp::TrialOverReturned,this,app.GetStringTable()); - } - break; + // LoadingInputParams *loadingParams = new + // LoadingInputParams(); loadingParams->func = + // &CScene_Death::RespawnThreadProc; + // loadingParams->lpParam = (void*)i; - // INVITES - case eAppAction_DashboardTrialJoinFromInvite: - { - TelemetryManager->RecordUpsellPresented(i, eSen_UpsellID_Full_Version_Of_Game, app.m_dwOfferID); + // Disable game & update thread whilst we do any of this + // app.SetGameStarted(false); + pMinecraft->gameRenderer->DisableUpdateThread(); - SetAction(i,eAppAction_Idle); - unsigned int uiIDA[2]; - uiIDA[0]=IDS_CONFIRM_OK; - uiIDA[1]=IDS_CONFIRM_CANCEL; + // 4J Stu - We don't need this on a thread in + // multiplayer as respawning is asynchronous. + pMinecraft->localplayers[i]->respawn(); - ui.RequestMessageBox(IDS_UNLOCK_TITLE, IDS_UNLOCK_ACCEPT_INVITE, uiIDA, 2, i,&CMinecraftApp::UnlockFullInviteReturned,this,app.GetStringTable()); - } - break; - case eAppAction_ExitAndJoinFromInvite: - { - unsigned int uiIDA[3]; + // app.SetGameStarted(true); + pMinecraft->gameRenderer->EnableUpdateThread(); - SetAction(i,eAppAction_Idle); - // Check the player really wants to do this + // UIFullscreenProgressCompletionData *completionData = + // new UIFullscreenProgressCompletionData(); + // completionData->bShowBackground=TRUE; + // completionData->bShowLogo=TRUE; + // completionData->type = + // e_ProgressCompletion_CloseUIScenes; + // completionData->iPad = i; + // loadingParams->completionData = completionData; + + // app.NavigateToScene(i,eUIScene_FullscreenProgress, + // loadingParams, true); + } + } break; + case eAppAction_WaitForRespawnComplete: + player = pMinecraft->localplayers[i]; + if (player != NULL && player->GetPlayerRespawned()) { + SetAction(i, eAppAction_Idle); + + if (ui.IsSceneInStack(i, eUIScene_EndPoem)) { + ui.NavigateBack(i, false, eUIScene_EndPoem); + } else { + ui.CloseUIScenes(i); + } + + // clear the progress messages + + // pMinecraft->progressRenderer->progressStart(-1); + // pMinecraft->progressRenderer->progressStage(-1); + } else if (!g_NetworkManager.IsInGameplay()) { + SetAction(i, eAppAction_Idle); + } + break; + case eAppAction_WaitForDimensionChangeComplete: + player = pMinecraft->localplayers[i]; + if (player != NULL && player->connection && + player->connection->isStarted()) { + SetAction(i, eAppAction_Idle); + ui.CloseUIScenes(i); + } else if (!g_NetworkManager.IsInGameplay()) { + SetAction(i, eAppAction_Idle); + } + break; + case eAppAction_PrimaryPlayerSignedOut: { + // SetAction(i,eAppAction_Idle); + + // clear the autosavetimer that might be displayed + ui.ShowAutosaveCountdownTimer(false); + + // If the player signs out before the game started the + // server can be killed a bit earlier to stop the loading or + // saving of a new game continuing running while the + // UI/Guide is up + if (!app.GetGameStarted()) + MinecraftServer::HaltServer(true); + + // inform the player they are being returned to the menus + // because they signed out + StorageManager.SetSaveDeviceSelected(i, false); + // need to clear the player stats - can't assume it'll be + // done in setlevel - we may not be in the game + StatsCounter* pStats = Minecraft::GetInstance()->stats[i]; + pStats->clear(); + + // 4J-PB - the libs will display the Returned to Title + // screen unsigned int + // uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; + // + // ui.RequestMessageBox(IDS_RETURNEDTOMENU_TITLE, + // IDS_RETURNEDTOTITLESCREEN_TEXT, uiIDA, 1, + // i,&CMinecraftApp::PrimaryPlayerSignedOutReturned,this,app.GetStringTable()); + if (g_NetworkManager.IsInSession()) { + app.SetAction( + i, eAppAction_PrimaryPlayerSignedOutReturned); + } else { + app.SetAction( + i, eAppAction_PrimaryPlayerSignedOutReturned_Menus); + MinecraftServer::resetFlags(); + } + } break; + case eAppAction_EthernetDisconnected: { + app.DebugPrintf( + "Handling eAppAction_EthernetDisconnected\n"); + SetAction(i, eAppAction_Idle); + + // 4J Stu - Fix for #12530 -TCR 001 BAS Game Stability: + // Title will crash if the player disconnects while starting + // a new world and then opts to play the tutorial once they + // have been returned to the Main Menu. + if (!g_NetworkManager.IsLeavingGame()) { + app.DebugPrintf( + "Handling eAppAction_EthernetDisconnected - Not " + "leaving game\n"); + // 4J-PB - not the same as a signout. We should only + // leave the game if this machine is not the host. We + // shouldn't get rid of the save device either. + if (g_NetworkManager.IsHost()) { + app.DebugPrintf( + "Handling eAppAction_EthernetDisconnected - Is " + "Host\n"); + // If it's already a local game, then an ethernet + // disconnect should have no effect + if (!g_NetworkManager.IsLocalGame() && + g_NetworkManager.IsInGameplay()) { + // Change the session to an offline session + SetAction(i, eAppAction_ChangeSessionType); + } else if (!g_NetworkManager.IsLocalGame() && + !g_NetworkManager.IsInGameplay()) { + // There are two cases here, either: + // 1. We're early enough in the + // create/load game that we can do a really + // minimal shutdown or + // 2. We're far enough in (game has started + // but the actual game started flag hasn't + // been set) that we should just wait until + // we're in the game and switch to offline + // mode + + // If there's a non-null level then, for our + // purposes, the game has started + bool gameStarted = false; + for (int j = 0; j < pMinecraft->levels.length; + j++) { + if (pMinecraft->levels.data[j] != NULL) { + gameStarted = true; + break; + } + } + + if (!gameStarted) { + // 1. Exit + MinecraftServer::HaltServer(); + + // Fix for #12530 - TCR 001 BAS Game + // Stability: Title will crash if the player + // disconnects while starting a new world + // and then opts to play the tutorial once + // they have been returned to the Main Menu. + // 4J Stu - Leave the session + g_NetworkManager.LeaveGame(FALSE); + + // need to clear the player stats - can't + // assume it'll be done in setlevel - we may + // not be in the game + StatsCounter* pStats = + Minecraft::GetInstance()->stats[i]; + pStats->clear(); + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + + ui.RequestErrorMessage( + g_NetworkManager.CorrectErrorIDS( + IDS_CONNECTION_LOST), + g_NetworkManager.CorrectErrorIDS( + IDS_CONNECTION_LOST_LIVE), + uiIDA, 1, i, + &CMinecraftApp:: + EthernetDisconnectReturned, + this); + } else { + // 2. Switch to offline + SetAction(i, eAppAction_ChangeSessionType); + } + } + } else { +#if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ + if (UIScene_LoadOrJoinMenu:: + isSaveTransferRunning()) { + // the save transfer is still in progress, delay + // jumping back to the main menu until we've + // cleaned up + SetAction(i, eAppAction_EthernetDisconnected); + } else +#endif + { + app.DebugPrintf( + "Handling eAppAction_EthernetDisconnected " + "- Not host\n"); + // need to clear the player stats - can't assume + // it'll be done in setlevel - we may not be in + // the game + StatsCounter* pStats = + Minecraft::GetInstance()->stats[i]; + pStats->clear(); + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + + ui.RequestErrorMessage( + g_NetworkManager.CorrectErrorIDS( + IDS_CONNECTION_LOST), + g_NetworkManager.CorrectErrorIDS( + IDS_CONNECTION_LOST_LIVE), + uiIDA, 1, i, + &CMinecraftApp::EthernetDisconnectReturned, + this); + } + } + } + } break; + // We currently handle both these returns the same way. + case eAppAction_EthernetDisconnectedReturned: + case eAppAction_PrimaryPlayerSignedOutReturned: { + SetAction(i, eAppAction_Idle); + + pMinecraft->gui->clearMessages(); + + // turn off the gamertags in splitscreen for the primary + // player, since they are about to be made fullscreen + ui.HideAllGameUIElements(); + + // set the state back to pre-game + ProfileManager.ResetProfileProcessState(); + + if (g_NetworkManager.IsLeavingGame()) { + // 4J Stu - If we are already leaving the game, then we + // just need to signal that the player signed out to + // stop saves + pMinecraft->progressRenderer->progressStartNoAbort( + IDS_EXITING_GAME); + pMinecraft->progressRenderer->progressStage(-1); + // This has no effect on client machines + MinecraftServer::HaltServer(true); + } else { + // Stop app running + SetGameStarted(false); + + // turn off the gamertags in splitscreen for the primary + // player, since they are about to be made fullscreen + ui.HideAllGameUIElements(); + + ui.CloseAllPlayersScenes(); + + // 4J Stu - Fix for #12368 - Crash: Game crashes when + // saving then exiting and selecting to save + for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; + ++idx) { +#ifdef _XBOX + app.TutorialSceneNavigateBack(idx, true); +#endif + + // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title + // crashed after exiting the tutorial It doesn't + // matter if they were in the tutorial already + pMinecraft->playerLeftTutorial(idx); + } + + LoadingInputParams* loadingParams = + new LoadingInputParams(); + loadingParams->func = + &CMinecraftApp::SignoutExitWorldThreadProc; + + UIFullscreenProgressCompletionData* completionData = + new UIFullscreenProgressCompletionData(); + completionData->bShowBackground = TRUE; + completionData->bShowLogo = TRUE; + completionData->iPad = DEFAULT_XUI_MENU_USER; + completionData->type = + e_ProgressCompletion_NavigateToHomeMenu; + loadingParams->completionData = completionData; + + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_FullscreenProgress, + loadingParams); + } + } break; + case eAppAction_PrimaryPlayerSignedOutReturned_Menus: + SetAction(i, eAppAction_Idle); + // set the state back to pre-game + ProfileManager.ResetProfileProcessState(); + // clear the save device + StorageManager.SetSaveDeviceSelected(i, false); + + ui.UpdatePlayerBasePositions(); + // there are multiple layers in the help menu, so a navigate + // back isn't enough + ui.NavigateToHomeMenu(); + + break; + case eAppAction_EthernetDisconnectedReturned_Menus: + SetAction(i, eAppAction_Idle); + // set the state back to pre-game + ProfileManager.ResetProfileProcessState(); + + ui.UpdatePlayerBasePositions(); + + // there are multiple layers in the help menu, so a navigate + // back isn't enough + ui.NavigateToHomeMenu(); + + break; + + case eAppAction_TrialOver: { + SetAction(i, eAppAction_Idle); + unsigned int uiIDA[2]; + uiIDA[0] = IDS_UNLOCK_TITLE; + uiIDA[1] = IDS_EXIT_GAME; + + ui.RequestErrorMessage( + IDS_TRIALOVER_TITLE, IDS_TRIALOVER_TEXT, uiIDA, 2, i, + &CMinecraftApp::TrialOverReturned, this); + } break; + + // INVITES + case eAppAction_DashboardTrialJoinFromInvite: { + TelemetryManager->RecordUpsellPresented( + i, eSen_UpsellID_Full_Version_Of_Game, app.m_dwOfferID); + + SetAction(i, eAppAction_Idle); + unsigned int uiIDA[2]; + uiIDA[0] = IDS_CONFIRM_OK; + uiIDA[1] = IDS_CONFIRM_CANCEL; + + ui.RequestErrorMessage( + IDS_UNLOCK_TITLE, IDS_UNLOCK_ACCEPT_INVITE, uiIDA, 2, i, + &CMinecraftApp::UnlockFullInviteReturned, this); + } break; + case eAppAction_ExitAndJoinFromInvite: { + unsigned int uiIDA[3]; + + SetAction(i, eAppAction_Idle); + // Check the player really wants to do this #if defined(_XBOX_ONE) || defined(__ORBIS__) - // Show save option is saves ARE disabled - if(ProfileManager.IsFullVersion() && StorageManager.GetSaveDisabled() && i==ProfileManager.GetPrimaryPad() && g_NetworkManager.IsHost() && GetGameStarted() ) - { - uiIDA[0]=IDS_CONFIRM_CANCEL; - uiIDA[1]=IDS_EXIT_GAME_SAVE; - uiIDA[2]=IDS_EXIT_GAME_NO_SAVE; + // Show save option is saves ARE disabled + if (ProfileManager.IsFullVersion() && + StorageManager.GetSaveDisabled() && + i == ProfileManager.GetPrimaryPad() && + g_NetworkManager.IsHost() && GetGameStarted()) { + uiIDA[0] = IDS_CONFIRM_CANCEL; + uiIDA[1] = IDS_EXIT_GAME_SAVE; + uiIDA[2] = IDS_EXIT_GAME_NO_SAVE; - ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_LEAVE_VIA_INVITE, uiIDA, 3, i,&CMinecraftApp::ExitAndJoinFromInviteSaveDialogReturned,this, app.GetStringTable(), 0, 0, false); - } - else + ui.RequestAlertMessage( + IDS_EXIT_GAME, IDS_CONFIRM_LEAVE_VIA_INVITE, uiIDA, + 3, i, + &CMinecraftApp:: + ExitAndJoinFromInviteSaveDialogReturned, + this); + } else #else - if(ProfileManager.IsFullVersion() && !StorageManager.GetSaveDisabled() && i==ProfileManager.GetPrimaryPad() && g_NetworkManager.IsHost() && GetGameStarted() ) - { - uiIDA[0]=IDS_CONFIRM_CANCEL; - uiIDA[1]=IDS_EXIT_GAME_SAVE; - uiIDA[2]=IDS_EXIT_GAME_NO_SAVE; + if (ProfileManager.IsFullVersion() && + !StorageManager.GetSaveDisabled() && + i == ProfileManager.GetPrimaryPad() && + g_NetworkManager.IsHost() && GetGameStarted()) { + uiIDA[0] = IDS_CONFIRM_CANCEL; + uiIDA[1] = IDS_EXIT_GAME_SAVE; + uiIDA[2] = IDS_EXIT_GAME_NO_SAVE; - ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_LEAVE_VIA_INVITE, uiIDA, 3, i,&CMinecraftApp::ExitAndJoinFromInviteSaveDialogReturned,this, app.GetStringTable(), 0, 0, false); - } - else + ui.RequestAlertMessage( + IDS_EXIT_GAME, IDS_CONFIRM_LEAVE_VIA_INVITE, uiIDA, + 3, i, + &CMinecraftApp:: + ExitAndJoinFromInviteSaveDialogReturned, + this); + } else #endif - { - if(!ProfileManager.IsFullVersion()) - { - TelemetryManager->RecordUpsellPresented(i, eSen_UpsellID_Full_Version_Of_Game, app.m_dwOfferID); + { + if (!ProfileManager.IsFullVersion()) { + TelemetryManager->RecordUpsellPresented( + i, eSen_UpsellID_Full_Version_Of_Game, + app.m_dwOfferID); - // upsell - uiIDA[0]=IDS_CONFIRM_OK; - uiIDA[1]=IDS_CONFIRM_CANCEL; - ui.RequestMessageBox(IDS_UNLOCK_TITLE, IDS_UNLOCK_ACCEPT_INVITE, uiIDA, 2, i,&CMinecraftApp::UnlockFullInviteReturned,this,app.GetStringTable()); - } - else - { - uiIDA[0]=IDS_CONFIRM_CANCEL; - uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_LEAVE_VIA_INVITE, uiIDA, 2,i,&CMinecraftApp::ExitAndJoinFromInvite,this,app.GetStringTable(), 0, 0, false); - } - } - } - break; - case eAppAction_ExitAndJoinFromInviteConfirmed: - { - SetAction(i,eAppAction_Idle); + // upsell + uiIDA[0] = IDS_CONFIRM_OK; + uiIDA[1] = IDS_CONFIRM_CANCEL; + ui.RequestErrorMessage( + IDS_UNLOCK_TITLE, IDS_UNLOCK_ACCEPT_INVITE, + uiIDA, 2, i, + &CMinecraftApp::UnlockFullInviteReturned, this); + } else { + uiIDA[0] = IDS_CONFIRM_CANCEL; + uiIDA[1] = IDS_CONFIRM_OK; + ui.RequestAlertMessage( + IDS_EXIT_GAME, IDS_CONFIRM_LEAVE_VIA_INVITE, + uiIDA, 2, i, + &CMinecraftApp::ExitAndJoinFromInvite, this); + } + } + } break; + case eAppAction_ExitAndJoinFromInviteConfirmed: { + SetAction(i, eAppAction_Idle); - pMinecraft->gui->clearMessages(); + pMinecraft->gui->clearMessages(); - // turn off the gamertags in splitscreen for the primary player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); + // turn off the gamertags in splitscreen for the primary + // player, since they are about to be made fullscreen + ui.HideAllGameUIElements(); - // Stop app running - SetGameStarted(false); + // Stop app running + SetGameStarted(false); - ui.CloseAllPlayersScenes(); - - // 4J Stu - Fix for #12368 - Crash: Game crashes when saving then exiting and selecting to save - for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) - { + ui.CloseAllPlayersScenes(); + + // 4J Stu - Fix for #12368 - Crash: Game crashes when saving + // then exiting and selecting to save + for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { #ifdef _XBOX - app.TutorialSceneNavigateBack(idx,true); + app.TutorialSceneNavigateBack(idx, true); #endif - - // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title crashed after exiting the tutorial - // It doesn't matter if they were in the tutorial already - pMinecraft->playerLeftTutorial( idx ); - } - // 4J-PB - may have been using a texture pack with audio , so clean up anything texture pack related here + // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title + // crashed after exiting the tutorial It doesn't matter + // if they were in the tutorial already + pMinecraft->playerLeftTutorial(idx); + } - // unload any texture pack audio - // if there is audio in use, clear out the audio, and unmount the pack - TexturePack *pTexPack=Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=NULL; + // 4J-PB - may have been using a texture pack with audio , + // so clean up anything texture pack related here - if(pTexPack->hasAudio()) - { - // get the dlc texture pack, and store it - pDLCTexPack=(DLCTexturePack *)pTexPack; - } + // unload any texture pack audio + // if there is audio in use, clear out the audio, and + // unmount the pack + TexturePack* pTexPack = + Minecraft::GetInstance()->skins->getSelected(); + DLCTexturePack* pDLCTexPack = NULL; - // change to the default texture pack - pMinecraft->skins->selectTexturePackById(TexturePackRepository::DEFAULT_TEXTURE_PACK_ID); + if (pTexPack->hasAudio()) { + // get the dlc texture pack, and store it + pDLCTexPack = (DLCTexturePack*)pTexPack; + } - if(pTexPack->hasAudio()) - { - // need to stop the streaming audio - by playing streaming audio from the default texture pack now - // reset the streaming sounds back to the normal ones + // change to the default texture pack + pMinecraft->skins->selectTexturePackById( + TexturePackRepository::DEFAULT_TEXTURE_PACK_ID); + + if (pTexPack->hasAudio()) { + // need to stop the streaming audio - by playing + // streaming audio from the default texture pack now + // reset the streaming sounds back to the normal ones #ifndef _XBOX - pMinecraft->soundEngine->SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3, - eStream_Nether1,eStream_Nether4, - eStream_end_dragon,eStream_end_end, - eStream_CD_1); + pMinecraft->soundEngine->SetStreamingSounds( + eStream_Overworld_Calm1, eStream_Overworld_piano3, + eStream_Nether1, eStream_Nether4, + eStream_end_dragon, eStream_end_end, eStream_CD_1); #endif - pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1); + pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, + 1); #ifdef _XBOX - if(pDLCTexPack->m_pStreamedWaveBank!=NULL) - { - pDLCTexPack->m_pStreamedWaveBank->Destroy(); - } - if(pDLCTexPack->m_pSoundBank!=NULL) - { - pDLCTexPack->m_pSoundBank->Destroy(); - } + if (pDLCTexPack->m_pStreamedWaveBank != NULL) { + pDLCTexPack->m_pStreamedWaveBank->Destroy(); + } + if (pDLCTexPack->m_pSoundBank != NULL) { + pDLCTexPack->m_pSoundBank->Destroy(); + } #endif #ifdef _DURANGO - const unsigned int result = StorageManager.UnmountInstalledDLC(L"TPACK"); + const unsigned int result = + StorageManager.UnmountInstalledDLC(L"TPACK"); #else - const unsigned int result = StorageManager.UnmountInstalledDLC("TPACK"); + const unsigned int result = + StorageManager.UnmountInstalledDLC("TPACK"); #endif - app.DebugPrintf("Unmount result is %d\n",result); - } + app.DebugPrintf("Unmount result is %d\n", result); + } #ifdef _XBOX_ONE - // 4J Stu - It's possible that we can sign in/remove players between the mask initially being set and this point - m_InviteData.dwLocalUsersMask = 0; - for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) - { - if(ProfileManager.IsSignedIn(index) ) - { - if(index==i || pMinecraft->localplayers[index]!=NULL ) - { - m_InviteData.dwLocalUsersMask |= g_NetworkManager.GetLocalPlayerMask( index ); - } - } - } + // 4J Stu - It's possible that we can sign in/remove players + // between the mask initially being set and this point + m_InviteData.dwLocalUsersMask = 0; + for (unsigned int index = 0; index < XUSER_MAX_COUNT; + ++index) { + if (ProfileManager.IsSignedIn(index)) { + if (index == i || + pMinecraft->localplayers[index] != NULL) { + m_InviteData.dwLocalUsersMask |= + g_NetworkManager.GetLocalPlayerMask(index); + } + } + } #endif - LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &CGameNetworkManager::ExitAndJoinFromInviteThreadProc; - loadingParams->lpParam = (LPVOID)&m_InviteData; + LoadingInputParams* loadingParams = + new LoadingInputParams(); + loadingParams->func = + &CGameNetworkManager::ExitAndJoinFromInviteThreadProc; + loadingParams->lpParam = (void*)&m_InviteData; - UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); - completionData->bShowBackground=TRUE; - completionData->bShowLogo=TRUE; - completionData->iPad=DEFAULT_XUI_MENU_USER; - completionData->type = e_ProgressCompletion_NoAction; - loadingParams->completionData = completionData; + UIFullscreenProgressCompletionData* completionData = + new UIFullscreenProgressCompletionData(); + completionData->bShowBackground = TRUE; + completionData->bShowLogo = TRUE; + completionData->iPad = DEFAULT_XUI_MENU_USER; + completionData->type = e_ProgressCompletion_NoAction; + loadingParams->completionData = completionData; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams); - } + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_FullscreenProgress, + loadingParams); + } - break; - case eAppAction_JoinFromInvite: - { - SetAction(i,eAppAction_Idle); + break; + case eAppAction_JoinFromInvite: { + SetAction(i, eAppAction_Idle); - // 4J Stu - Move this state block from CPlatformNetworkManager::ExitAndJoinFromInviteThreadProc, as g_NetworkManager.JoinGameFromInviteInfo ultimately can call NavigateToScene, - /// and we should only be calling that from the main thread - app.SetTutorialMode( false ); + // 4J Stu - Move this state block from + // CPlatformNetworkManager::ExitAndJoinFromInviteThreadProc, + // as g_NetworkManager.JoinGameFromInviteInfo ultimately can + // call NavigateToScene, + /// and we should only be calling that from the main thread + app.SetTutorialMode(false); - g_NetworkManager.SetLocalGame(false); + g_NetworkManager.SetLocalGame(false); - JoinFromInviteData *inviteData = (JoinFromInviteData *)param; - // 4J-PB - clear any previous connection errors - Minecraft::GetInstance()->clearConnectionFailed(); + JoinFromInviteData* inviteData = (JoinFromInviteData*)param; + // 4J-PB - clear any previous connection errors + Minecraft::GetInstance()->clearConnectionFailed(); - app.DebugPrintf( "Changing Primary Pad on an invite accept - pad was %d, and is now %d\n", ProfileManager.GetPrimaryPad(), inviteData->dwUserIndex ); - ProfileManager.SetLockedProfile(inviteData->dwUserIndex); - ProfileManager.SetPrimaryPad(inviteData->dwUserIndex); + app.DebugPrintf( + "Changing Primary Pad on an invite accept - pad was " + "%d, and is now %d\n", + ProfileManager.GetPrimaryPad(), + inviteData->dwUserIndex); + ProfileManager.SetLockedProfile(inviteData->dwUserIndex); + ProfileManager.SetPrimaryPad(inviteData->dwUserIndex); #ifdef _XBOX_ONE - // 4J Stu - If a player is signed in (i.e. locked) but not in the mask, unlock them - for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) - { - if( index != inviteData->dwUserIndex && ProfileManager.IsSignedIn(index) ) - { - if( (m_InviteData.dwLocalUsersMask & g_NetworkManager.GetLocalPlayerMask( index ) ) == 0 ) - { - ProfileManager.RemoveGamepadFromGame(index); - } - } - } + // 4J Stu - If a player is signed in (i.e. locked) but not + // in the mask, unlock them + for (unsigned int index = 0; index < XUSER_MAX_COUNT; + ++index) { + if (index != inviteData->dwUserIndex && + ProfileManager.IsSignedIn(index)) { + if ((m_InviteData.dwLocalUsersMask & + g_NetworkManager.GetLocalPlayerMask(index)) == + 0) { + ProfileManager.RemoveGamepadFromGame(index); + } + } + } #endif - // change the minecraft player name - Minecraft::GetInstance()->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); + // change the minecraft player name + Minecraft::GetInstance()->user->name = + convStringToWstring(ProfileManager.GetGamertag( + ProfileManager.GetPrimaryPad())); - bool success = g_NetworkManager.JoinGameFromInviteInfo( - inviteData->dwUserIndex, // dwUserIndex - inviteData->dwLocalUsersMask, // dwUserMask - inviteData->pInviteInfo ); // pInviteInfo + bool success = g_NetworkManager.JoinGameFromInviteInfo( + inviteData->dwUserIndex, // dwUserIndex + inviteData->dwLocalUsersMask, // dwUserMask + inviteData->pInviteInfo); // pInviteInfo - if( !success ) - { - app.DebugPrintf( "Failed joining game from invite\n" ); - //return hr; + if (!success) { + app.DebugPrintf("Failed joining game from invite\n"); + // return hr; - // 4J Stu - Copied this from XUI_FullScreenProgress to properly handle the fail case, as the thread will no longer be failing - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox( IDS_CONNECTION_FAILED, IDS_CONNECTION_LOST_SERVER, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); - - ui.NavigateToHomeMenu(); - ui.UpdatePlayerBasePositions(); - } - } - break; - case eAppAction_ChangeSessionType: - { - // If we are not in gameplay yet, then wait until the server is setup before changing the session type - if( g_NetworkManager.IsInGameplay() ) - { - // This kicks off a thread that waits for the server to end, then closes the current session, starts a new one and joins the local players into it - - SetAction(i,eAppAction_Idle); + // 4J Stu - Copied this from XUI_FullScreenProgress to + // properly handle the fail case, as the thread will no + // longer be failing + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + ui.RequestErrorMessage( + IDS_CONNECTION_FAILED, IDS_CONNECTION_LOST_SERVER, + uiIDA, 1, ProfileManager.GetPrimaryPad()); - if( !GetChangingSessionType() && !g_NetworkManager.IsLocalGame() ) - { - SetGameStarted(false); - SetChangingSessionType(true); - SetReallyChangingSessionType(true); + ui.NavigateToHomeMenu(); + ui.UpdatePlayerBasePositions(); + } + } break; + case eAppAction_ChangeSessionType: { + // If we are not in gameplay yet, then wait until the server + // is setup before changing the session type + if (g_NetworkManager.IsInGameplay()) { + // This kicks off a thread that waits for the server to + // end, then closes the current session, starts a new + // one and joins the local players into it - // turn off the gamertags in splitscreen for the primary player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); + SetAction(i, eAppAction_Idle); - if( !ui.IsSceneInStack( ProfileManager.GetPrimaryPad(), eUIScene_EndPoem ) ) - { - ui.CloseAllPlayersScenes(); - } - ui.ShowOtherPlayersBaseScene(ProfileManager.GetPrimaryPad(), true); - - // Remove this line to fix: - // #49084 - TU5: Code: Gameplay: The title crashes every time client navigates to 'Play game' menu and loads/creates new game after a "Connection to Xbox LIVE was lost" message has appeared. - //app.NavigateToScene(0,eUIScene_Main); - - LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &CGameNetworkManager::ChangeSessionTypeThreadProc; - loadingParams->lpParam = NULL; + if (!GetChangingSessionType() && + !g_NetworkManager.IsLocalGame()) { + SetGameStarted(false); + SetChangingSessionType(true); + SetReallyChangingSessionType(true); - UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); + // turn off the gamertags in splitscreen for the + // primary player, since they are about to be made + // fullscreen + ui.HideAllGameUIElements(); + + if (!ui.IsSceneInStack( + ProfileManager.GetPrimaryPad(), + eUIScene_EndPoem)) { + ui.CloseAllPlayersScenes(); + } + ui.ShowOtherPlayersBaseScene( + ProfileManager.GetPrimaryPad(), true); + + // Remove this line to fix: + // #49084 - TU5: Code: Gameplay: The title crashes + // every time client navigates to 'Play game' menu + // and loads/creates new game after a "Connection to + // Xbox LIVE was lost" message has appeared. + // app.NavigateToScene(0,eUIScene_Main); + + LoadingInputParams* loadingParams = + new LoadingInputParams(); + loadingParams->func = + &CGameNetworkManager:: + ChangeSessionTypeThreadProc; + loadingParams->lpParam = NULL; + + UIFullscreenProgressCompletionData* completionData = + new UIFullscreenProgressCompletionData(); #ifdef __PS3__ - completionData->bRequiresUserAction=FALSE; + completionData->bRequiresUserAction = FALSE; #else - completionData->bRequiresUserAction=TRUE; + completionData->bRequiresUserAction = TRUE; #endif - completionData->bShowBackground=TRUE; - completionData->bShowLogo=TRUE; - completionData->iPad=DEFAULT_XUI_MENU_USER; - if( ui.IsSceneInStack( ProfileManager.GetPrimaryPad(), eUIScene_EndPoem ) ) - { - completionData->type = e_ProgressCompletion_NavigateBackToScene; - completionData->scene = eUIScene_EndPoem; - } - else - { - completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes; - } - loadingParams->completionData = completionData; + completionData->bShowBackground = TRUE; + completionData->bShowLogo = TRUE; + completionData->iPad = DEFAULT_XUI_MENU_USER; + if (ui.IsSceneInStack( + ProfileManager.GetPrimaryPad(), + eUIScene_EndPoem)) { + completionData->type = + e_ProgressCompletion_NavigateBackToScene; + completionData->scene = eUIScene_EndPoem; + } else { + completionData->type = + e_ProgressCompletion_CloseAllPlayersUIScenes; + } + loadingParams->completionData = completionData; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams); - } - } - else if( g_NetworkManager.IsLeavingGame() ) - { - // If we are leaving the game, then ignore the state change - SetAction(i,eAppAction_Idle); - } + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_FullscreenProgress, + loadingParams); + } + } else if (g_NetworkManager.IsLeavingGame()) { + // If we are leaving the game, then ignore the state + // change + SetAction(i, eAppAction_Idle); + } #if 0 // 4J-HG - Took this out since ChangeSessionType is only set in two places (both in EthernetDisconnected) and this case is handled there, plus this breaks // this if statements original purpose (to allow us to wait for IsInGameplay before actioning switching to offline @@ -3606,488 +4064,569 @@ void CMinecraftApp::HandleXuiActions(void) } } #endif - } - break; - case eAppAction_SetDefaultOptions: - SetAction(i,eAppAction_Idle); -#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) - SetDefaultOptions((C4JStorage::PROFILESETTINGS *)param,i); + } break; + case eAppAction_SetDefaultOptions: + SetAction(i, eAppAction_Idle); +#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || \ + defined __PSVITA__) + SetDefaultOptions((C4JStorage::PROFILESETTINGS*)param, i); #else - SetDefaultOptions((C_4JProfile::PROFILESETTINGS *)param,i); + SetDefaultOptions((C_4JProfile::PROFILESETTINGS*)param, i); #endif - // if the profile data has been changed, then force a profile write - // It seems we're allowed to break the 5 minute rule if it's the result of a user action - CheckGameSettingsChanged(true,i); + // if the profile data has been changed, then force a + // profile write It seems we're allowed to break the 5 + // minute rule if it's the result of a user action + CheckGameSettingsChanged(true, i); - break; - - case eAppAction_RemoteServerSave: - { - // If the remote server save has already finished, don't complete the action - if (GetGameStarted()) - { - SetAction(ProfileManager.GetPrimaryPad(), eAppAction_Idle); - break; - } + break; - SetAction(i,eAppAction_WaitRemoteServerSaveComplete); - - for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) - { - ui.CloseUIScenes(i, true); - } + case eAppAction_RemoteServerSave: { + // If the remote server save has already finished, don't + // complete the action + if (GetGameStarted()) { + SetAction(ProfileManager.GetPrimaryPad(), + eAppAction_Idle); + break; + } - // turn off the gamertags in splitscreen for the primary player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); + SetAction(i, eAppAction_WaitRemoteServerSaveComplete); - LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &CMinecraftApp::RemoteSaveThreadProc; - loadingParams->lpParam = NULL; + for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { + ui.CloseUIScenes(i, true); + } - UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); - completionData->bRequiresUserAction=FALSE; - completionData->bShowBackground=TRUE; - completionData->bShowLogo=TRUE; - completionData->iPad=DEFAULT_XUI_MENU_USER; - if( ui.IsSceneInStack( ProfileManager.GetPrimaryPad(), eUIScene_EndPoem ) ) - { - completionData->type = e_ProgressCompletion_NavigateBackToScene; - completionData->scene = eUIScene_EndPoem; - } - else - { - completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes; - } - loadingParams->completionData = completionData; + // turn off the gamertags in splitscreen for the primary + // player, since they are about to be made fullscreen + ui.HideAllGameUIElements(); - loadingParams->cancelFunc = &CMinecraftApp::ExitGameFromRemoteSave; - loadingParams->cancelText = IDS_TOOLTIPS_EXIT; + LoadingInputParams* loadingParams = + new LoadingInputParams(); + loadingParams->func = &CMinecraftApp::RemoteSaveThreadProc; + loadingParams->lpParam = NULL; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams); - } - break; - case eAppAction_WaitRemoteServerSaveComplete: - // Do nothing - break; - case eAppAction_FailedToJoinNoPrivileges: - { - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); - if(result != C4JStorage::EMessage_Busy) SetAction(i,eAppAction_Idle); - } - break; - case eAppAction_ProfileReadError: - // Return player to the main menu - code largely copied from that for handling - // eAppAction_PrimaryPlayerSignedOut, although I don't think we should have got as - // far as needing to halt the server, or running the game, before returning to the menu - if(!app.GetGameStarted()) MinecraftServer::HaltServer(true); + UIFullscreenProgressCompletionData* completionData = + new UIFullscreenProgressCompletionData(); + completionData->bRequiresUserAction = FALSE; + completionData->bShowBackground = TRUE; + completionData->bShowLogo = TRUE; + completionData->iPad = DEFAULT_XUI_MENU_USER; + if (ui.IsSceneInStack(ProfileManager.GetPrimaryPad(), + eUIScene_EndPoem)) { + completionData->type = + e_ProgressCompletion_NavigateBackToScene; + completionData->scene = eUIScene_EndPoem; + } else { + completionData->type = + e_ProgressCompletion_CloseAllPlayersUIScenes; + } + loadingParams->completionData = completionData; - if( g_NetworkManager.IsInSession() ) - { - app.SetAction(i,eAppAction_PrimaryPlayerSignedOutReturned); - } - else - { - app.SetAction(i,eAppAction_PrimaryPlayerSignedOutReturned_Menus); - MinecraftServer::resetFlags(); - } - break; - - case eAppAction_BanLevel: - { - // It's possible that this state can get set after the game has been exited (e.g. by network disconnection) so we can't ban the level at that point - if(g_NetworkManager.IsInGameplay() && !g_NetworkManager.IsLeavingGame()) - { - TelemetryManager->RecordBanLevel(i); + loadingParams->cancelFunc = + &CMinecraftApp::ExitGameFromRemoteSave; + loadingParams->cancelText = IDS_TOOLTIPS_EXIT; -#if defined _XBOX - INetworkPlayer *pHost=g_NetworkManager.GetHostPlayer(); - // write the level to the banned level list, and exit the world - AddLevelToBannedLevelList(i,((NetworkPlayerXbox *)pHost)->GetUID(),GetUniqueMapName(),true); -#elif defined _XBOX_ONE - INetworkPlayer *pHost=g_NetworkManager.GetHostPlayer(); - AddLevelToBannedLevelList(i,pHost->GetUID(),GetUniqueMapName(),true); -#endif - // primary player would exit the world, secondary would exit the player - if(ProfileManager.GetPrimaryPad()==i) - { - SetAction(i,eAppAction_ExitWorld); - } - else - { - SetAction(i,eAppAction_ExitPlayer); - } - } - } - break; - case eAppAction_LevelInBanLevelList: - { - unsigned int uiIDA[2]; - uiIDA[0]=IDS_BUTTON_REMOVE_FROM_BAN_LIST; - uiIDA[1]=IDS_EXIT_GAME; + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_FullscreenProgress, + loadingParams); + } break; + case eAppAction_WaitRemoteServerSaveComplete: + // Do nothing + break; + case eAppAction_FailedToJoinNoPrivileges: { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + C4JStorage::EMessageResult result = ui.RequestErrorMessage( + IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, + IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, + ProfileManager.GetPrimaryPad()); + if (result != C4JStorage::EMessage_Busy) + SetAction(i, eAppAction_Idle); + } break; + case eAppAction_ProfileReadError: + // Return player to the main menu - code largely copied from + // that for handling eAppAction_PrimaryPlayerSignedOut, + // although I don't think we should have got as far as + // needing to halt the server, or running the game, before + // returning to the menu + if (!app.GetGameStarted()) + MinecraftServer::HaltServer(true); - // pass in the gamertag format string - WCHAR wchFormat[40]; - INetworkPlayer *player = g_NetworkManager.GetLocalPlayerByUserIndex(i); + if (g_NetworkManager.IsInSession()) { + app.SetAction( + i, eAppAction_PrimaryPlayerSignedOutReturned); + } else { + app.SetAction( + i, eAppAction_PrimaryPlayerSignedOutReturned_Menus); + MinecraftServer::resetFlags(); + } + break; - // If not the primary player, but the primary player has banned this level and decided not to unban - // then we may have left the game by now - if(player) - { - swprintf(wchFormat, 40, L"%ls\n\n%%ls",player->GetOnlineName()); + case eAppAction_BanLevel: { + // It's possible that this state can get set after the game + // has been exited (e.g. by network disconnection) so we + // can't ban the level at that point + if (g_NetworkManager.IsInGameplay() && + !g_NetworkManager.IsLeavingGame()) { + TelemetryManager->RecordBanLevel(i); - C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_BANNED_LEVEL_TITLE, IDS_PLAYER_BANNED_LEVEL, uiIDA,2,i,&CMinecraftApp::BannedLevelDialogReturned,this, app.GetStringTable(),wchFormat); - if(result != C4JStorage::EMessage_Busy) SetAction(i,eAppAction_Idle); - } - else - { - SetAction(i,eAppAction_Idle); - } - } - break; - case eAppAction_DebugText: - // launch the xui for text entry - { -#ifdef _XBOX - CScene_TextEntry::XuiTextInputParams *pDebugTextParams= new CScene_TextEntry::XuiTextInputParams; - pDebugTextParams->iPad=i; - pDebugTextParams->wch=(WCHAR)param; - - app.NavigateToScene(i,eUIScene_TextEntry,pDebugTextParams); -#endif - SetAction(i,eAppAction_Idle); - } - break; - - case eAppAction_ReloadTexturePack: - { - SetAction(i,eAppAction_Idle); - Minecraft *pMinecraft = Minecraft::GetInstance(); - pMinecraft->textures->reloadAll(); - pMinecraft->skins->updateUI(); - - if(!pMinecraft->skins->isUsingDefaultSkin()) - { - TexturePack *pTexturePack = pMinecraft->skins->getSelected(); - - DLCPack *pDLCPack=pTexturePack->getDLCPack(); - - bool purchased = false; - // do we have a license? - if(pDLCPack && pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" )) - { - purchased = true; - } -#ifdef _XBOX - TelemetryManager->RecordTexturePackLoaded(i, pTexturePack->getId(), purchased?1:0); -#endif - } - - // 4J-PB - If the texture pack has audio, we need to switch to this - if(pMinecraft->skins->getSelected()->hasAudio()) - { - Minecraft::GetInstance()->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1); - } - } - - break; - - case eAppAction_TexturePackRequired: - { -#ifdef _XBOX - ULONGLONG ullOfferID_Full; - app.GetDLCFullOfferIDForPackID(app.GetRequiredTexturePackID(),&ullOfferID_Full); - - TelemetryManager->RecordUpsellPresented(ProfileManager.GetPrimaryPad(), eSet_UpsellID_Texture_DLC, ullOfferID_Full & 0xFFFFFFFF); -#endif - unsigned int uiIDA[2]; - - uiIDA[0]=IDS_TEXTUREPACK_FULLVERSION; - uiIDA[1]=IDS_TEXTURE_PACK_TRIALVERSION; - - // Give the player a warning about the texture pack missing - ui.RequestMessageBox(IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CMinecraftApp::TexturePackDialogReturned,this,app.GetStringTable()); - SetAction(i,eAppAction_Idle); - } - - break; - default: - break; - } - } - - // Any TMS actions? - - eTMS = app.GetTMSAction(i); - - if(eTMS!=eTMSAction_Idle) - { - switch(eTMS) - { - // TMS++ actions - case eTMSAction_TMSPP_RetrieveFiles_CreateLoad_SignInReturned: - case eTMSAction_TMSPP_RetrieveFiles_RunPlayGame: -#ifdef _XBOX - app.TMSPP_SetTitleGroupID(GROUP_ID); - SetTMSAction(i,eTMSAction_TMSPP_GlobalFileList); -#elif defined _XBOX_ONE - SetTMSAction(i,eTMSAction_TMSPP_GlobalFileList_Waiting); - app.TMSPP_RetrieveFileList(i,C4JStorage::eGlobalStorage_Title,eTMSAction_TMSPP_UserFileList); -#else - SetTMSAction(i,eTMSAction_TMSPP_UserFileList); - #endif - break; - -#ifdef _XBOX - case eTMSAction_TMSPP_GlobalFileList: - SetTMSAction(i,eTMSAction_TMSPP_GlobalFileList_Waiting); - app.TMSPP_RetrieveFileList(i,C4JStorage::eGlobalStorage_Title,"\\",eTMSAction_TMSPP_UserFileList); - break; -#endif - case eTMSAction_TMSPP_UserFileList: - // retrieve the file list first -#if defined _XBOX - SetTMSAction(i,eTMSAction_TMSPP_UserFileList_Waiting); - app.TMSPP_RetrieveFileList(i,C4JStorage::eGlobalStorage_TitleUser,"\\",eTMSAction_TMSPP_XUIDSFile); -#elif defined _XBOX_ONE - SetTMSAction(i,eTMSAction_TMSPP_UserFileList_Waiting); - app.TMSPP_RetrieveFileList(i,C4JStorage::eGlobalStorage_TitleUser,eTMSAction_TMSPP_DLCFile); -#else - SetTMSAction(i,eTMSAction_TMSPP_XUIDSFile); -#endif - break; - case eTMSAction_TMSPP_XUIDSFile: -#ifdef _XBOX - SetTMSAction(i,eTMSAction_TMSPP_XUIDSFile_Waiting); - // pass in the next app action on the call or callback completing - app.TMSPP_ReadXuidsFile(i,eTMSAction_TMSPP_DLCFile); -#else - SetTMSAction(i,eTMSAction_TMSPP_DLCFile); -#endif - - break; - case eTMSAction_TMSPP_DLCFile: -#if defined _XBOX || defined _XBOX_ONE - SetTMSAction(i,eTMSAction_TMSPP_DLCFile_Waiting); - // pass in the next app action on the call or callback completing - app.TMSPP_ReadDLCFile(i,eTMSAction_TMSPP_BannedListFile); -#else - SetTMSAction(i,eTMSAction_TMSPP_BannedListFile); -#endif - break; - case eTMSAction_TMSPP_BannedListFile: - // If we have one in TMSPP, then we can assume we can ignore TMS #if defined _XBOX - SetTMSAction(i,eTMSAction_TMSPP_BannedListFile_Waiting); - // pass in the next app action on the call or callback completing - if(app.TMSPP_ReadBannedList(i,eTMSAction_TMS_RetrieveFiles_Complete)==false) - { - // we don't have a banned list in TMSPP, so we should check TMS - app.ReadBannedList(i, eTMSAction_TMS_RetrieveFiles_Complete,true); - } + INetworkPlayer* pHost = + g_NetworkManager.GetHostPlayer(); + // write the level to the banned level list, and exit + // the world + AddLevelToBannedLevelList( + i, ((NetworkPlayerXbox*)pHost)->GetUID(), + GetUniqueMapName(), true); #elif defined _XBOX_ONE - SetTMSAction(i,eTMSAction_TMSPP_BannedListFile_Waiting); - // pass in the next app action on the call or callback completing - app.TMSPP_ReadBannedList(i,eTMSAction_TMS_RetrieveFiles_Complete); - -#else - SetTMSAction(i,eTMSAction_TMS_RetrieveFiles_Complete); + INetworkPlayer* pHost = + g_NetworkManager.GetHostPlayer(); + AddLevelToBannedLevelList(i, pHost->GetUID(), + GetUniqueMapName(), true); #endif - break; + // primary player would exit the world, secondary would + // exit the player + if (ProfileManager.GetPrimaryPad() == i) { + SetAction(i, eAppAction_ExitWorld); + } else { + SetAction(i, eAppAction_ExitPlayer); + } + } + } break; + case eAppAction_LevelInBanLevelList: { + unsigned int uiIDA[2]; + uiIDA[0] = IDS_BUTTON_REMOVE_FROM_BAN_LIST; + uiIDA[1] = IDS_EXIT_GAME; - // SPECIAL CASE - where the user goes directly in to Help & Options from the main menu - case eTMSAction_TMSPP_RetrieveFiles_HelpAndOptions: - case eTMSAction_TMSPP_RetrieveFiles_DLCMain: - // retrieve the file list first -#if defined _XBOX - // pass in the next app action on the call or callback completing - SetTMSAction(i,eTMSAction_TMSPP_XUIDSFile_Waiting); - app.TMSPP_RetrieveFileList(i,C4JStorage::eGlobalStorage_Title,"\\",eTMSAction_TMSPP_DLCFileOnly); -#elif defined _XBOX_ONE - SetTMSAction(i,eTMSAction_TMSPP_GlobalFileList_Waiting); - app.TMSPP_RetrieveFileList(i,C4JStorage::eGlobalStorage_Title,eTMSAction_TMSPP_RetrieveUserFilelist_DLCFileOnly); -#else - SetTMSAction(i,eTMSAction_TMSPP_DLCFileOnly); + // pass in the gamertag format std::string + WCHAR wchFormat[40]; + INetworkPlayer* player = + g_NetworkManager.GetLocalPlayerByUserIndex(i); + + // If not the primary player, but the primary player has + // banned this level and decided not to unban then we may + // have left the game by now + if (player) { + swprintf(wchFormat, 40, L"%ls\n\n%%ls", + player->GetOnlineName()); + + C4JStorage::EMessageResult result = + ui.RequestErrorMessage( + IDS_BANNED_LEVEL_TITLE, IDS_PLAYER_BANNED_LEVEL, + uiIDA, 2, i, + &CMinecraftApp::BannedLevelDialogReturned, this, + wchFormat); + if (result != C4JStorage::EMessage_Busy) + SetAction(i, eAppAction_Idle); + } else { + SetAction(i, eAppAction_Idle); + } + } break; + case eAppAction_DebugText: + // launch the xui for text entry + { +#ifdef _XBOX + CScene_TextEntry::XuiTextInputParams* pDebugTextParams = + new CScene_TextEntry::XuiTextInputParams; + pDebugTextParams->iPad = i; + pDebugTextParams->wch = (WCHAR)param; + + app.NavigateToScene(i, eUIScene_TextEntry, + pDebugTextParams); #endif - break; - case eTMSAction_TMSPP_RetrieveUserFilelist_DLCFileOnly: -#if defined _XBOX - SetTMSAction(i,eTMSAction_TMSPP_UserFileList_Waiting); - app.TMSPP_RetrieveFileList(i,C4JStorage::eGlobalStorage_TitleUser,"\\",eTMSAction_TMSPP_XUIDSFile); -#elif defined _XBOX_ONE - //StorageManager.TMSPP_DeleteFile(i,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.png",NULL,NULL, 0); - SetTMSAction(i,eTMSAction_TMSPP_UserFileList_Waiting); - app.TMSPP_RetrieveFileList(i,C4JStorage::eGlobalStorage_TitleUser,eTMSAction_TMSPP_DLCFileOnly); + SetAction(i, eAppAction_Idle); + } + break; + + case eAppAction_ReloadTexturePack: { + SetAction(i, eAppAction_Idle); + Minecraft* pMinecraft = Minecraft::GetInstance(); + pMinecraft->textures->reloadAll(); + pMinecraft->skins->updateUI(); + + if (!pMinecraft->skins->isUsingDefaultSkin()) { + TexturePack* pTexturePack = + pMinecraft->skins->getSelected(); + + DLCPack* pDLCPack = pTexturePack->getDLCPack(); + + bool purchased = false; + // do we have a license? + if (pDLCPack && + pDLCPack->hasPurchasedFile( + DLCManager::e_DLCType_Texture, L"")) { + purchased = true; + } +#ifdef _XBOX + TelemetryManager->RecordTexturePackLoaded( + i, pTexturePack->getId(), purchased ? 1 : 0); +#endif + } + + // 4J-PB - If the texture pack has audio, we need to switch + // to this + if (pMinecraft->skins->getSelected()->hasAudio()) { + Minecraft::GetInstance()->soundEngine->playStreaming( + L"", 0, 0, 0, 1, 1); + } + } break; + + case eAppAction_ReloadFont: { +#ifndef _XBOX + app.DebugPrintf( + "[Consoles_App] eAppAction_ReloadFont, ingame='%s'.\n", + app.GetGameStarted() ? "Yes" : "No"); + + SetAction(i, eAppAction_Idle); + + ui.SetTooltips(i, -1); + + ui.ReloadSkin(); + ui.StartReloadSkinThread(); + + ui.setCleanupOnReload(); +#endif + } break; + + case eAppAction_TexturePackRequired: { +#if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ + unsigned int uiIDA[2]; + uiIDA[0] = IDS_TEXTUREPACK_FULLVERSION; + uiIDA[1] = IDS_CONFIRM_CANCEL; // let them continue without + // the texture pack here (as + // this is only really for r + // Give the player a warning about the texture pack missing + ui.RequestErrorMessage( + IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, + IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2, + ProfileManager.GetPrimaryPad(), + &CMinecraftApp::TexturePackDialogReturned, this); + SetAction(i, eAppAction_Idle); #else - SetTMSAction(i,eTMSAction_TMSPP_DLCFileOnly); +#ifdef _XBOX + ULONGLONG ullOfferID_Full; + app.GetDLCFullOfferIDForPackID( + app.GetRequiredTexturePackID(), &ullOfferID_Full); + + TelemetryManager->RecordUpsellPresented( + ProfileManager.GetPrimaryPad(), + eSet_UpsellID_Texture_DLC, + ullOfferID_Full & 0xFFFFFFFF); +#endif + unsigned int uiIDA[2]; + + uiIDA[0] = IDS_TEXTUREPACK_FULLVERSION; + uiIDA[1] = IDS_TEXTURE_PACK_TRIALVERSION; + + // Give the player a warning about the texture pack missing + ui.RequestErrorMessage( + IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, + IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2, + ProfileManager.GetPrimaryPad(), + &CMinecraftApp::TexturePackDialogReturned, this); + SetAction(i, eAppAction_Idle); +#endif + } + + break; + default: + break; + } + } + + // Any TMS actions? + + eTMS = app.GetTMSAction(i); + + if (eTMS != eTMSAction_Idle) { + switch (eTMS) { + // TMS++ actions + case eTMSAction_TMSPP_RetrieveFiles_CreateLoad_SignInReturned: + case eTMSAction_TMSPP_RetrieveFiles_RunPlayGame: +#ifdef _XBOX + app.TMSPP_SetTitleGroupID(GROUP_ID); + SetTMSAction(i, eTMSAction_TMSPP_GlobalFileList); +#elif defined _XBOX_ONE + SetTMSAction(i, eTMSAction_TMSPP_GlobalFileList_Waiting); + app.TMSPP_RetrieveFileList(i, + C4JStorage::eGlobalStorage_Title, + eTMSAction_TMSPP_UserFileList); +#else + SetTMSAction(i, eTMSAction_TMSPP_UserFileList); +#endif + break; + +#ifdef _XBOX + case eTMSAction_TMSPP_GlobalFileList: + SetTMSAction(i, eTMSAction_TMSPP_GlobalFileList_Waiting); + app.TMSPP_RetrieveFileList( + i, C4JStorage::eGlobalStorage_Title, "\\", + eTMSAction_TMSPP_UserFileList); + break; +#endif + case eTMSAction_TMSPP_UserFileList: + // retrieve the file list first +#if defined _XBOX + SetTMSAction(i, eTMSAction_TMSPP_UserFileList_Waiting); + app.TMSPP_RetrieveFileList( + i, C4JStorage::eGlobalStorage_TitleUser, "\\", + eTMSAction_TMSPP_XUIDSFile); +#elif defined _XBOX_ONE + SetTMSAction(i, eTMSAction_TMSPP_UserFileList_Waiting); + app.TMSPP_RetrieveFileList( + i, C4JStorage::eGlobalStorage_TitleUser, + eTMSAction_TMSPP_DLCFile); +#else + SetTMSAction(i, eTMSAction_TMSPP_XUIDSFile); +#endif + break; + case eTMSAction_TMSPP_XUIDSFile: +#ifdef _XBOX + SetTMSAction(i, eTMSAction_TMSPP_XUIDSFile_Waiting); + // pass in the next app action on the call or callback + // completing + app.TMSPP_ReadXuidsFile(i, eTMSAction_TMSPP_DLCFile); +#else + SetTMSAction(i, eTMSAction_TMSPP_DLCFile); #endif - break; - - case eTMSAction_TMSPP_DLCFileOnly: + break; + case eTMSAction_TMSPP_DLCFile: #if defined _XBOX || defined _XBOX_ONE - SetTMSAction(i,eTMSAction_TMSPP_DLCFile_Waiting); - // pass in the next app action on the call or callback completing - app.TMSPP_ReadDLCFile(i,eTMSAction_TMSPP_RetrieveFiles_Complete); + SetTMSAction(i, eTMSAction_TMSPP_DLCFile_Waiting); + // pass in the next app action on the call or callback + // completing + app.TMSPP_ReadDLCFile(i, eTMSAction_TMSPP_BannedListFile); #else - SetTMSAction(i,eTMSAction_TMSPP_RetrieveFiles_Complete); + SetTMSAction(i, eTMSAction_TMSPP_BannedListFile); #endif - break; + break; + case eTMSAction_TMSPP_BannedListFile: + // If we have one in TMSPP, then we can assume we can ignore + // TMS +#if defined _XBOX + SetTMSAction(i, eTMSAction_TMSPP_BannedListFile_Waiting); + // pass in the next app action on the call or callback + // completing + if (app.TMSPP_ReadBannedList( + i, eTMSAction_TMS_RetrieveFiles_Complete) == + false) { + // we don't have a banned list in TMSPP, so we should + // check TMS + app.ReadBannedList( + i, eTMSAction_TMS_RetrieveFiles_Complete, true); + } +#elif defined _XBOX_ONE + SetTMSAction(i, eTMSAction_TMSPP_BannedListFile_Waiting); + // pass in the next app action on the call or callback + // completing + app.TMSPP_ReadBannedList( + i, eTMSAction_TMS_RetrieveFiles_Complete); - - case eTMSAction_TMSPP_RetrieveFiles_Complete: - SetTMSAction(i,eTMSAction_Idle); - break; - - - // TMS files -/* case eTMSAction_TMS_RetrieveFiles_CreateLoad_SignInReturned: - case eTMSAction_TMS_RetrieveFiles_RunPlayGame: -#ifdef _XBOX - SetTMSAction(i,eTMSAction_TMS_XUIDSFile_Waiting); - // pass in the next app action on the call or callback completing - app.ReadXuidsFileFromTMS(i,eTMSAction_TMS_DLCFile,true); #else - SetTMSAction(i,eTMSAction_TMS_DLCFile); + SetTMSAction(i, eTMSAction_TMS_RetrieveFiles_Complete); #endif - break; + break; - case eTMSAction_TMS_DLCFile: -#ifdef _XBOX - SetTMSAction(i,eTMSAction_TMS_DLCFile_Waiting); - // pass in the next app action on the call or callback completing - app.ReadDLCFileFromTMS(i,eTMSAction_TMS_BannedListFile,true); + // SPECIAL CASE - where the user goes directly in to Help & + // Options from the main menu + case eTMSAction_TMSPP_RetrieveFiles_HelpAndOptions: + case eTMSAction_TMSPP_RetrieveFiles_DLCMain: + // retrieve the file list first +#if defined _XBOX + // pass in the next app action on the call or callback + // completing + SetTMSAction(i, eTMSAction_TMSPP_XUIDSFile_Waiting); + app.TMSPP_RetrieveFileList( + i, C4JStorage::eGlobalStorage_Title, "\\", + eTMSAction_TMSPP_DLCFileOnly); +#elif defined _XBOX_ONE + SetTMSAction(i, eTMSAction_TMSPP_GlobalFileList_Waiting); + app.TMSPP_RetrieveFileList( + i, C4JStorage::eGlobalStorage_Title, + eTMSAction_TMSPP_RetrieveUserFilelist_DLCFileOnly); #else - SetTMSAction(i,eTMSAction_TMS_BannedListFile); + SetTMSAction(i, eTMSAction_TMSPP_DLCFileOnly); +#endif + break; + case eTMSAction_TMSPP_RetrieveUserFilelist_DLCFileOnly: +#if defined _XBOX + SetTMSAction(i, eTMSAction_TMSPP_UserFileList_Waiting); + app.TMSPP_RetrieveFileList( + i, C4JStorage::eGlobalStorage_TitleUser, "\\", + eTMSAction_TMSPP_XUIDSFile); +#elif defined _XBOX_ONE + // StorageManager.TMSPP_DeleteFile(i,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.png",NULL,NULL, + // 0); + SetTMSAction(i, eTMSAction_TMSPP_UserFileList_Waiting); + app.TMSPP_RetrieveFileList( + i, C4JStorage::eGlobalStorage_TitleUser, + eTMSAction_TMSPP_DLCFileOnly); +#else + SetTMSAction(i, eTMSAction_TMSPP_DLCFileOnly); #endif - break; + break; - case eTMSAction_TMS_RetrieveFiles_HelpAndOptions: - case eTMSAction_TMS_RetrieveFiles_DLCMain: -#ifdef _XBOX - SetTMSAction(i,eTMSAction_TMS_DLCFile_Waiting); - // pass in the next app action on the call or callback completing - app.ReadDLCFileFromTMS(i,eTMSAction_Idle,true); + case eTMSAction_TMSPP_DLCFileOnly: +#if defined _XBOX || defined _XBOX_ONE + SetTMSAction(i, eTMSAction_TMSPP_DLCFile_Waiting); + // pass in the next app action on the call or callback + // completing + app.TMSPP_ReadDLCFile( + i, eTMSAction_TMSPP_RetrieveFiles_Complete); #else - SetTMSAction(i,eTMSAction_Idle); + SetTMSAction(i, eTMSAction_TMSPP_RetrieveFiles_Complete); #endif + break; - break; - case eTMSAction_TMS_BannedListFile: -#ifdef _XBOX - SetTMSAction(i,eTMSAction_TMS_BannedListFile_Waiting); - // pass in the next app action on the call or callback completing - app.ReadBannedList(i, eTMSAction_TMS_RetrieveFiles_Complete,true); -#else - SetTMSAction(i,eTMSAction_TMS_RetrieveFiles_Complete); -#endif + case eTMSAction_TMSPP_RetrieveFiles_Complete: + SetTMSAction(i, eTMSAction_Idle); + break; - break; + // TMS files + /* case + eTMSAction_TMS_RetrieveFiles_CreateLoad_SignInReturned: case + eTMSAction_TMS_RetrieveFiles_RunPlayGame: #ifdef _XBOX + SetTMSAction(i,eTMSAction_TMS_XUIDSFile_Waiting); + // pass in the next app action on the call or callback + completing + app.ReadXuidsFileFromTMS(i,eTMSAction_TMS_DLCFile,true); + #else + SetTMSAction(i,eTMSAction_TMS_DLCFile); + #endif + break; - */ - case eTMSAction_TMS_RetrieveFiles_Complete: - SetTMSAction(i,eTMSAction_Idle); - // if(StorageManager.SetSaveDevice(&CScene_Main::DeviceSelectReturned,pClass)) - // { - // // save device already selected - // // ensure we've applied this player's settings - // app.ApplyGameSettingsChanged(ProfileManager.GetPrimaryPad()); - // app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MultiGameJoinLoad); - // } - break; - default: - break; - } - } + case eTMSAction_TMS_DLCFile: + #ifdef _XBOX + SetTMSAction(i,eTMSAction_TMS_DLCFile_Waiting); + // pass in the next app action on the call or callback + completing + app.ReadDLCFileFromTMS(i,eTMSAction_TMS_BannedListFile,true); + #else + SetTMSAction(i,eTMSAction_TMS_BannedListFile); + #endif - } + break; + + case eTMSAction_TMS_RetrieveFiles_HelpAndOptions: + case eTMSAction_TMS_RetrieveFiles_DLCMain: + #ifdef _XBOX + SetTMSAction(i,eTMSAction_TMS_DLCFile_Waiting); + // pass in the next app action on the call or callback + completing app.ReadDLCFileFromTMS(i,eTMSAction_Idle,true); + #else + SetTMSAction(i,eTMSAction_Idle); + #endif + + break; + case eTMSAction_TMS_BannedListFile: + #ifdef _XBOX + SetTMSAction(i,eTMSAction_TMS_BannedListFile_Waiting); + // pass in the next app action on the call or callback + completing app.ReadBannedList(i, + eTMSAction_TMS_RetrieveFiles_Complete,true); #else + SetTMSAction(i,eTMSAction_TMS_RetrieveFiles_Complete); + #endif + + break; + + */ + case eTMSAction_TMS_RetrieveFiles_Complete: + SetTMSAction(i, eTMSAction_Idle); + // if(StorageManager.SetSaveDevice(&CScene_Main::DeviceSelectReturned,pClass)) + // { + // // save device already + // selected + // // ensure we've applied + // this player's settings + // app.ApplyGameSettingsChanged(ProfileManager.GetPrimaryPad()); + // app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MultiGameJoinLoad); + // } + break; + default: + break; + } + } + } } -int CMinecraftApp::BannedLevelDialogReturned(void *pParam,int iPad,const C4JStorage::EMessageResult result) -{ - CMinecraftApp* pApp = (CMinecraftApp*)pParam; - //Minecraft *pMinecraft=Minecraft::GetInstance(); +int CMinecraftApp::BannedLevelDialogReturned( + void* pParam, int iPad, const C4JStorage::EMessageResult result) { + CMinecraftApp* pApp = (CMinecraftApp*)pParam; + // Minecraft *pMinecraft=Minecraft::GetInstance(); - if(result==C4JStorage::EMessage_ResultAccept) - { + if (result == C4JStorage::EMessage_ResultAccept) { #if defined _XBOX || defined _XBOX_ONE - INetworkPlayer *pHost = g_NetworkManager.GetHostPlayer(); - // unban the level - if (pHost != NULL) - { + INetworkPlayer* pHost = g_NetworkManager.GetHostPlayer(); + // unban the level + if (pHost != NULL) { #if defined _XBOX - pApp->RemoveLevelFromBannedLevelList(iPad,((NetworkPlayerXbox *)pHost)->GetUID(),pApp->GetUniqueMapName()); + pApp->RemoveLevelFromBannedLevelList( + iPad, ((NetworkPlayerXbox*)pHost)->GetUID(), + pApp->GetUniqueMapName()); #else - pApp->RemoveLevelFromBannedLevelList(iPad,pHost->GetUID(),pApp->GetUniqueMapName()); + pApp->RemoveLevelFromBannedLevelList(iPad, pHost->GetUID(), + pApp->GetUniqueMapName()); #endif - } + } #endif - } - else - { - if( iPad == ProfileManager.GetPrimaryPad() ) - { - pApp->SetAction(iPad,eAppAction_ExitWorld); - } - else - { - pApp->SetAction(iPad,eAppAction_ExitPlayer); - } - } + } else { + if (iPad == ProfileManager.GetPrimaryPad()) { + pApp->SetAction(iPad, eAppAction_ExitWorld); + } else { + pApp->SetAction(iPad, eAppAction_ExitPlayer); + } + } - return 0; + return 0; } -void CMinecraftApp::loadMediaArchive() -{ - std::wstring mediapath = L""; +void CMinecraftApp::loadMediaArchive() { + std::wstring mediapath = L""; #ifdef __PS3__ - mediapath = L"Common\\Media\\MediaPS3.arc"; + mediapath = L"Common\\Media\\MediaPS3.arc"; #elif _WINDOWS64 - mediapath = L"Common\\Media\\MediaWindows64.arc"; + mediapath = L"Common\\Media\\MediaWindows64.arc"; #elif __linux__ - mediapath = L"Common/Media/MediaLinux.arc"; + mediapath = L"Common/Media/MediaLinux.arc"; #elif __ORBIS__ - mediapath = L"Common\\Media\\MediaOrbis.arc"; + mediapath = L"Common\\Media\\MediaOrbis.arc"; #elif _DURANGO - mediapath = L"Common\\Media\\MediaDurango.arc"; + mediapath = L"Common\\Media\\MediaDurango.arc"; #elif __PSVITA__ - mediapath = L"Common\\Media\\MediaPSVita.arc"; + mediapath = L"Common\\Media\\MediaPSVita.arc"; #endif - if (!mediapath.empty()) - { - m_mediaArchive = new ArchiveFile( File(mediapath) ); - } + if (!mediapath.empty()) { + m_mediaArchive = new ArchiveFile(File(mediapath)); + } #if 0 std::string path = "Common\\media.arc"; HANDLE hFile = CreateFile( path.c_str(), - GENERIC_READ, - FILE_SHARE_READ, - NULL, - OPEN_EXISTING, - FILE_FLAG_SEQUENTIAL_SCAN, - NULL ); + GENERIC_READ, + FILE_SHARE_READ, + NULL, + OPEN_EXISTING, + FILE_FLAG_SEQUENTIAL_SCAN, + NULL ); if( hFile != INVALID_HANDLE_VALUE ) { File fileHelper(convStringToWstring(path)); - DWORD dwFileSize = fileHelper.length(); + std::uint32_t dwFileSize = fileHelper.length(); // Initialize memory. - PBYTE m_fBody = new BYTE[ dwFileSize ]; + std::uint8_t* m_fBody = new std::uint8_t[ dwFileSize ]; ZeroMemory(m_fBody, dwFileSize); - DWORD m_fSize = 0; + std::uint32_t m_fSize = 0; BOOL hr = ReadFile( hFile, - m_fBody, - dwFileSize, - &m_fSize, - NULL ); + m_fBody, + dwFileSize, + &m_fSize, + NULL ); assert( m_fSize == dwFileSize ); @@ -4104,977 +4643,1071 @@ void CMinecraftApp::loadMediaArchive() #endif } -void CMinecraftApp::loadStringTable() -{ +void CMinecraftApp::loadStringTable() { #ifndef _XBOX - if(m_stringTable!=NULL) - { - // we need to unload the current string table, this is a reload - delete m_stringTable; - } - std::wstring localisationFile = L"languages.loc"; - if (m_mediaArchive->hasFile(localisationFile)) - { - byteArray locFile = m_mediaArchive->getFile(localisationFile); - m_stringTable = new StringTable(locFile.data, locFile.length); - delete[] locFile.data; - } - else - { - m_stringTable = NULL; - assert(false); - // AHHHHHHHHH. - } + if (m_stringTable != NULL) { + // we need to unload the current std::string table, this is a reload + delete m_stringTable; + } + std::wstring localisationFile = L"languages.loc"; + if (m_mediaArchive->hasFile(localisationFile)) { + byteArray locFile = m_mediaArchive->getFile(localisationFile); + m_stringTable = new StringTable(locFile.data, locFile.length); + delete[] locFile.data; + } else { + m_stringTable = NULL; + assert(false); + // AHHHHHHHHH. + } #endif } -int CMinecraftApp::PrimaryPlayerSignedOutReturned(void *pParam,int iPad,const C4JStorage::EMessageResult) -{ - //CMinecraftApp* pApp = (CMinecraftApp*)pParam; - //Minecraft *pMinecraft=Minecraft::GetInstance(); +int CMinecraftApp::PrimaryPlayerSignedOutReturned( + void* pParam, int iPad, const C4JStorage::EMessageResult) { + // CMinecraftApp* pApp = (CMinecraftApp*)pParam; + // Minecraft *pMinecraft=Minecraft::GetInstance(); - // if the player is null, we're in the menus - //if(Minecraft::GetInstance()->player!=NULL) + // if the player is null, we're in the menus + // if(Minecraft::GetInstance()->player!=NULL) - // We always create a session before kicking of any of the game code, so even though we may still be joining/creating a game - // at this point we want to handle it differently from just being in a menu - if( g_NetworkManager.IsInSession() ) - { - app.SetAction(iPad,eAppAction_PrimaryPlayerSignedOutReturned); - } - else - { - app.SetAction(iPad,eAppAction_PrimaryPlayerSignedOutReturned_Menus); - } - return 0; + // We always create a session before kicking of any of the game code, so + // even though we may still be joining/creating a game at this point we want + // to handle it differently from just being in a menu + if (g_NetworkManager.IsInSession()) { + app.SetAction(iPad, eAppAction_PrimaryPlayerSignedOutReturned); + } else { + app.SetAction(iPad, eAppAction_PrimaryPlayerSignedOutReturned_Menus); + } + return 0; } -int CMinecraftApp::EthernetDisconnectReturned(void *pParam,int iPad,const C4JStorage::EMessageResult) -{ - //CMinecraftApp* pApp = (CMinecraftApp*)pParam; - Minecraft *pMinecraft=Minecraft::GetInstance(); +int CMinecraftApp::EthernetDisconnectReturned( + void* pParam, int iPad, const C4JStorage::EMessageResult) { + // CMinecraftApp* pApp = (CMinecraftApp*)pParam; + Minecraft* pMinecraft = Minecraft::GetInstance(); - // if the player is null, we're in the menus - if(Minecraft::GetInstance()->player!=NULL) - { - app.SetAction(pMinecraft->player->GetXboxPad(),eAppAction_EthernetDisconnectedReturned); - } - else - { - // 4J-PB - turn off the PSN store icon just in case this happened when we were in one of the DLC menus -#ifdef __ORBIS__ - sceNpCommerceHidePsStoreIcon(); -#elif defined __PSVITA__ - sceNpCommerce2HidePsStoreIcon(); + // if the player is null, we're in the menus + if (Minecraft::GetInstance()->player != NULL) { + app.SetAction(pMinecraft->player->GetXboxPad(), + eAppAction_EthernetDisconnectedReturned); + } else { + // 4J-PB - turn off the PSN store icon just in case this happened when + // we were in one of the DLC menus +#if defined __ORBIS__ || defined __PSVITA__ + app.GetCommerce()->HidePsStoreIcon(); #endif - app.SetAction(iPad,eAppAction_EthernetDisconnectedReturned_Menus); - } - return 0; + app.SetAction(iPad, eAppAction_EthernetDisconnectedReturned_Menus); + } + return 0; } -int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter ) -{ +int CMinecraftApp::SignoutExitWorldThreadProc(void* lpParameter) { + // Share AABB & Vec3 pools with default (main thread) - should be ok as long + // as we don't tick the main thread whilst this thread is running + AABB::UseDefaultThreadStorage(); + Vec3::UseDefaultThreadStorage(); + Compression::UseDefaultThreadStorage(); - // Share AABB & Vec3 pools with default (main thread) - should be ok as long as we don't tick the main thread whilst this thread is running - AABB::UseDefaultThreadStorage(); - Vec3::UseDefaultThreadStorage(); - Compression::UseDefaultThreadStorage(); + // app.SetGameStarted(false); - //app.SetGameStarted(false); + Minecraft* pMinecraft = Minecraft::GetInstance(); - Minecraft *pMinecraft=Minecraft::GetInstance(); + int exitReasonStringId = -1; - int exitReasonStringId = -1; - - bool saveStats = false; - if (pMinecraft->isClientSide() || g_NetworkManager.IsInSession() ) - { - if(lpParameter != NULL ) - { - switch( app.GetDisconnectReason() ) - { - case DisconnectPacket::eDisconnect_Kicked: - exitReasonStringId = IDS_DISCONNECTED_KICKED; - break; - case DisconnectPacket::eDisconnect_NoUGC_AllLocal: - exitReasonStringId = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL; - break; - case DisconnectPacket::eDisconnect_NoUGC_Single_Local: - exitReasonStringId = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL; - break; + bool saveStats = false; + if (pMinecraft->isClientSide() || g_NetworkManager.IsInSession()) { + if (lpParameter != NULL) { + switch (app.GetDisconnectReason()) { + case DisconnectPacket::eDisconnect_Kicked: + exitReasonStringId = IDS_DISCONNECTED_KICKED; + break; + case DisconnectPacket::eDisconnect_NoUGC_AllLocal: + exitReasonStringId = + IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL; + break; + case DisconnectPacket::eDisconnect_NoUGC_Single_Local: + exitReasonStringId = + IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL; + break; #ifdef _XBOX - case DisconnectPacket::eDisconnect_NoUGC_Remote: - exitReasonStringId = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_REMOTE; - break; + case DisconnectPacket::eDisconnect_NoUGC_Remote: + exitReasonStringId = + IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_REMOTE; + break; #endif - case DisconnectPacket::eDisconnect_NoFlying: - exitReasonStringId = IDS_DISCONNECTED_FLYING; - break; - case DisconnectPacket::eDisconnect_OutdatedServer: - exitReasonStringId = IDS_DISCONNECTED_SERVER_OLD; - break; - case DisconnectPacket::eDisconnect_OutdatedClient: - exitReasonStringId = IDS_DISCONNECTED_CLIENT_OLD; - break; - default: - exitReasonStringId = IDS_DISCONNECTED; - } - pMinecraft->progressRenderer->progressStartNoAbort( exitReasonStringId ); - // 4J - Force a disconnection, this handles the situation that the server has already disconnected - if( pMinecraft->levels[0] != NULL ) pMinecraft->levels[0]->disconnect(false); - if( pMinecraft->levels[1] != NULL ) pMinecraft->levels[1]->disconnect(false); - } - else - { - exitReasonStringId = IDS_EXITING_GAME; - pMinecraft->progressRenderer->progressStartNoAbort( IDS_EXITING_GAME ); + case DisconnectPacket::eDisconnect_NoFlying: + exitReasonStringId = IDS_DISCONNECTED_FLYING; + break; + case DisconnectPacket::eDisconnect_OutdatedServer: + exitReasonStringId = IDS_DISCONNECTED_SERVER_OLD; + break; + case DisconnectPacket::eDisconnect_OutdatedClient: + exitReasonStringId = IDS_DISCONNECTED_CLIENT_OLD; + break; + default: + exitReasonStringId = IDS_DISCONNECTED; + } + pMinecraft->progressRenderer->progressStartNoAbort( + exitReasonStringId); + // 4J - Force a disconnection, this handles the situation that the + // server has already disconnected + if (pMinecraft->levels[0] != NULL) + pMinecraft->levels[0]->disconnect(false); + if (pMinecraft->levels[1] != NULL) + pMinecraft->levels[1]->disconnect(false); + } else { + exitReasonStringId = IDS_EXITING_GAME; + pMinecraft->progressRenderer->progressStartNoAbort( + IDS_EXITING_GAME); - if( pMinecraft->levels[0] != NULL ) pMinecraft->levels[0]->disconnect(); - if( pMinecraft->levels[1] != NULL ) pMinecraft->levels[1]->disconnect(); - } + if (pMinecraft->levels[0] != NULL) + pMinecraft->levels[0]->disconnect(); + if (pMinecraft->levels[1] != NULL) + pMinecraft->levels[1]->disconnect(); + } - // 4J Stu - This only does something if we actually have a server, so don't need to do any other checks - MinecraftServer::HaltServer(true); + // 4J Stu - This only does something if we actually have a server, so + // don't need to do any other checks + MinecraftServer::HaltServer(true); - // We need to call the stats & leaderboards save before we exit the session - //pMinecraft->forceStatsSave(); - saveStats = false; + // We need to call the stats & leaderboards save before we exit the + // session + // pMinecraft->forceStatsSave(); + saveStats = false; - // 4J Stu - Leave the session once the disconnect packet has been sent - g_NetworkManager.LeaveGame(FALSE); - } - else - { - if(lpParameter != NULL ) - { - switch( app.GetDisconnectReason() ) - { - case DisconnectPacket::eDisconnect_Kicked: - exitReasonStringId = IDS_DISCONNECTED_KICKED; - break; - case DisconnectPacket::eDisconnect_NoUGC_AllLocal: - exitReasonStringId = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL; - break; - case DisconnectPacket::eDisconnect_NoUGC_Single_Local: - exitReasonStringId = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL; - break; -#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) - case DisconnectPacket::eDisconnect_ContentRestricted_AllLocal: - exitReasonStringId = IDS_CONTENT_RESTRICTION_MULTIPLAYER; - break; - case DisconnectPacket::eDisconnect_ContentRestricted_Single_Local: - exitReasonStringId = IDS_CONTENT_RESTRICTION; - break; + // 4J Stu - Leave the session once the disconnect packet has been sent + g_NetworkManager.LeaveGame(FALSE); + } else { + if (lpParameter != NULL) { + switch (app.GetDisconnectReason()) { + case DisconnectPacket::eDisconnect_Kicked: + exitReasonStringId = IDS_DISCONNECTED_KICKED; + break; + case DisconnectPacket::eDisconnect_NoUGC_AllLocal: + exitReasonStringId = + IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL; + break; + case DisconnectPacket::eDisconnect_NoUGC_Single_Local: + exitReasonStringId = + IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL; + break; +#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) + case DisconnectPacket::eDisconnect_ContentRestricted_AllLocal: + exitReasonStringId = IDS_CONTENT_RESTRICTION_MULTIPLAYER; + break; + case DisconnectPacket:: + eDisconnect_ContentRestricted_Single_Local: + exitReasonStringId = IDS_CONTENT_RESTRICTION; + break; #endif #ifdef _XBOX - case DisconnectPacket::eDisconnect_NoUGC_Remote: - exitReasonStringId = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_REMOTE; - break; + case DisconnectPacket::eDisconnect_NoUGC_Remote: + exitReasonStringId = + IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_REMOTE; + break; #endif - case DisconnectPacket::eDisconnect_OutdatedServer: - exitReasonStringId = IDS_DISCONNECTED_SERVER_OLD; - break; - case DisconnectPacket::eDisconnect_OutdatedClient: - exitReasonStringId = IDS_DISCONNECTED_CLIENT_OLD; - default: - exitReasonStringId = IDS_DISCONNECTED; - } - pMinecraft->progressRenderer->progressStartNoAbort( exitReasonStringId ); - } - } - pMinecraft->setLevel(NULL,exitReasonStringId,nullptr,saveStats,true); + case DisconnectPacket::eDisconnect_OutdatedServer: + exitReasonStringId = IDS_DISCONNECTED_SERVER_OLD; + break; + case DisconnectPacket::eDisconnect_OutdatedClient: + exitReasonStringId = IDS_DISCONNECTED_CLIENT_OLD; + default: + exitReasonStringId = IDS_DISCONNECTED; + } + pMinecraft->progressRenderer->progressStartNoAbort( + exitReasonStringId); + } + } + pMinecraft->setLevel(NULL, exitReasonStringId, nullptr, saveStats, true); - // 4J-JEV: Fix for #106402 - TCR #014 BAS Debug Output: - // TU12: Mass Effect Mash-UP: Save file "Default_DisplayName" is created on all storage devices after signing out from a re-launched pre-generated world - app.m_gameRules.unloadCurrentGameRules(); // + // 4J-JEV: Fix for #106402 - TCR #014 BAS Debug Output: + // TU12: Mass Effect Mash-UP: Save file "Default_DisplayName" is created on + // all storage devices after signing out from a re-launched pre-generated + // world + app.m_gameRules.unloadCurrentGameRules(); // - MinecraftServer::resetFlags(); - - // We can't start/join a new game until the session is destroyed, so wait for it to be idle again - while( g_NetworkManager.IsInSession() ) - { - Sleep(1); - } + MinecraftServer::resetFlags(); - return 0; + // We can't start/join a new game until the session is destroyed, so wait + // for it to be idle again + while (g_NetworkManager.IsInSession()) { + Sleep(1); + } + + return S_OK; } -int CMinecraftApp::UnlockFullInviteReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - //CMinecraftApp* pApp = (CMinecraftApp*)pParam; - Minecraft *pMinecraft=Minecraft::GetInstance(); - bool bNoPlayer; +int CMinecraftApp::UnlockFullInviteReturned(void* pParam, int iPad, + C4JStorage::EMessageResult result) { + // CMinecraftApp* pApp = (CMinecraftApp*)pParam; + Minecraft* pMinecraft = Minecraft::GetInstance(); + bool bNoPlayer; - // bug 11285 - TCR 001: BAS Game Stability: CRASH - When trying to join a full version game with a trial version, the trial crashes - // 4J-PB - we may be in the main menus here, and we don't have a pMinecraft->player + // bug 11285 - TCR 001: BAS Game Stability: CRASH - When trying to join a + // full version game with a trial version, the trial crashes 4J-PB - we may + // be in the main menus here, and we don't have a pMinecraft->player - if(pMinecraft->player==NULL) - { - bNoPlayer=true; - } + if (pMinecraft->player == NULL) { + bNoPlayer = true; + } - if(result==C4JStorage::EMessage_ResultAccept) - { - if(ProfileManager.IsSignedInLive(iPad)) - { - // 4J-PB - need to check this user can access the store + if (result == C4JStorage::EMessage_ResultAccept) { + if (ProfileManager.IsSignedInLive(iPad)) { + // 4J-PB - need to check this user can access the store #if defined(__PS3__) || defined(__PSVITA__) - bool bContentRestricted; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); - if(bContentRestricted) - { - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,&app, app.GetStringTable()); - } - else + bool bContentRestricted; + ProfileManager.GetChatAndContentRestrictions( + ProfileManager.GetPrimaryPad(), true, NULL, &bContentRestricted, + NULL); + if (bContentRestricted) { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, + IDS_CONTENT_RESTRICTION, uiIDA, 1, + ProfileManager.GetPrimaryPad()); + } else #endif - { - ProfileManager.DisplayFullVersionPurchase(false,iPad,eSen_UpsellID_Full_Version_Of_Game); - } - } + { + ProfileManager.DisplayFullVersionPurchase( + false, iPad, eSen_UpsellID_Full_Version_Of_Game); + } + } #if defined(__PS3__) - else - { - // you're not signed in to PSN! - unsigned int uiIDA[2]; - uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CMinecraftApp::MustSignInFullVersionPurchaseReturned,&app, app.GetStringTable()); - - } + else { + // you're not signed in to PSN! + unsigned int uiIDA[2]; + uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; + uiIDA[1] = IDS_PRO_NOTONLINE_DECLINE; + ui.RequestErrorMessage( + IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, + ProfileManager.GetPrimaryPad(), + &CMinecraftApp::MustSignInFullVersionPurchaseReturned, &app); + } #endif - } - else - { - TelemetryManager->RecordUpsellResponded(iPad, eSen_UpsellID_Full_Version_Of_Game, app.m_dwOfferID, eSen_UpsellOutcome_Declined); - } + } else { + TelemetryManager->RecordUpsellResponded( + iPad, eSen_UpsellID_Full_Version_Of_Game, app.m_dwOfferID, + eSen_UpsellOutcome_Declined); + } - return 0; + return 0; } -int CMinecraftApp::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - //CMinecraftApp* pApp = (CMinecraftApp*)pParam; - Minecraft *pMinecraft=Minecraft::GetInstance(); +int CMinecraftApp::UnlockFullSaveReturned(void* pParam, int iPad, + C4JStorage::EMessageResult result) { + // CMinecraftApp* pApp = (CMinecraftApp*)pParam; + Minecraft* pMinecraft = Minecraft::GetInstance(); - if(result==C4JStorage::EMessage_ResultAccept) - { - if(ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) - { - // 4J-PB - need to check this user can access the store + if (result == C4JStorage::EMessage_ResultAccept) { + if (ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) { + // 4J-PB - need to check this user can access the store #if defined(__PS3__) || defined(__PSVITA__) - bool bContentRestricted; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); - if(bContentRestricted) - { - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,&app, app.GetStringTable()); - } - else + bool bContentRestricted; + ProfileManager.GetChatAndContentRestrictions( + ProfileManager.GetPrimaryPad(), true, NULL, &bContentRestricted, + NULL); + if (bContentRestricted) { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, + IDS_CONTENT_RESTRICTION, uiIDA, 1, + ProfileManager.GetPrimaryPad()); + } else #endif - { - ProfileManager.DisplayFullVersionPurchase(false,pMinecraft->player->GetXboxPad(),eSen_UpsellID_Full_Version_Of_Game); - } - } + { + ProfileManager.DisplayFullVersionPurchase( + false, pMinecraft->player->GetXboxPad(), + eSen_UpsellID_Full_Version_Of_Game); + } + } #if defined(__PS3__) - else - { - // you're not signed in to PSN! - unsigned int uiIDA[2]; - uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CMinecraftApp::MustSignInFullVersionPurchaseReturned,&app, app.GetStringTable()); - } + else { + // you're not signed in to PSN! + unsigned int uiIDA[2]; + uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; + uiIDA[1] = IDS_PRO_NOTONLINE_DECLINE; + ui.RequestErrorMessage( + IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, + ProfileManager.GetPrimaryPad(), + &CMinecraftApp::MustSignInFullVersionPurchaseReturned, &app); + } #elif defined(__ORBIS__) - else - { - // Determine why they're not "signed in live" - if (ProfileManager.isSignedInPSN(iPad)) - { - // Signed in to PSN but not connected (no internet access) - assert(!ProfileManager.isConnectedToPSN(iPad)); + else { + // Determine why they're not "signed in live" + if (ProfileManager.isSignedInPSN(iPad)) { + // Signed in to PSN but not connected (no internet access) + assert(!ProfileManager.isConnectedToPSN(iPad)); - unsigned int uiIDA[1]; - uiIDA[0] = IDS_OK; - ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable()); - } - else - { - // Not signed in to PSN - unsigned int uiIDA[1]; - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, iPad, &CMinecraftApp::MustSignInFullVersionPurchaseReturned,&app, app.GetStringTable(), NULL, 0, false); - } - } + unsigned int uiIDA[1]; + uiIDA[0] = IDS_OK; + ui.RequestErrorMessage(IDS_ERROR_NETWORK_TITLE, + IDS_ERROR_NETWORK, uiIDA, 1, iPad); + } else { + // Not signed in to PSN + unsigned int uiIDA[1]; + uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; + ui.RequestAlertMessage( + IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, + iPad, &CMinecraftApp::MustSignInFullVersionPurchaseReturned, + &app); + } + } #endif - } - else - { - TelemetryManager->RecordUpsellResponded(iPad, eSen_UpsellID_Full_Version_Of_Game, app.m_dwOfferID, eSen_UpsellOutcome_Declined); - } + } else { + TelemetryManager->RecordUpsellResponded( + iPad, eSen_UpsellID_Full_Version_Of_Game, app.m_dwOfferID, + eSen_UpsellOutcome_Declined); + } - return 0; + return 0; } -int CMinecraftApp::UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - CMinecraftApp* pApp = (CMinecraftApp*)pParam; - Minecraft *pMinecraft=Minecraft::GetInstance(); +int CMinecraftApp::UnlockFullExitReturned(void* pParam, int iPad, + C4JStorage::EMessageResult result) { + CMinecraftApp* pApp = (CMinecraftApp*)pParam; + Minecraft* pMinecraft = Minecraft::GetInstance(); - if(result==C4JStorage::EMessage_ResultAccept) - { - if(ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) - { - // 4J-PB - need to check this user can access the store + if (result == C4JStorage::EMessage_ResultAccept) { + if (ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) { + // 4J-PB - need to check this user can access the store #if defined(__PS3__) || defined(__PSVITA__) - bool bContentRestricted; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); - if(bContentRestricted) - { - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,&app, app.GetStringTable()); - } - else + bool bContentRestricted; + ProfileManager.GetChatAndContentRestrictions( + ProfileManager.GetPrimaryPad(), true, NULL, &bContentRestricted, + NULL); + if (bContentRestricted) { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, + IDS_CONTENT_RESTRICTION, uiIDA, 1, + ProfileManager.GetPrimaryPad()); + } else #endif - { - ProfileManager.DisplayFullVersionPurchase(false,pMinecraft->player->GetXboxPad(),eSen_UpsellID_Full_Version_Of_Game); + { + ProfileManager.DisplayFullVersionPurchase( + false, pMinecraft->player->GetXboxPad(), + eSen_UpsellID_Full_Version_Of_Game); #if defined __ORBIS__ || defined __PS3__ || defined __PSVITA__ - // still need to exit the trial or we'll be in the Pause menu with input ignored - pApp->SetAction(pMinecraft->player->GetXboxPad(),eAppAction_ExitWorldTrial); + // still need to exit the trial or we'll be in the Pause menu + // with input ignored + pApp->SetAction(pMinecraft->player->GetXboxPad(), + eAppAction_ExitWorldTrial); #endif - } - } + } + } #if defined(__PS3__) || defined __PSVITA__ - else - { - // you're not signed in to PSN! - unsigned int uiIDA[2]; - uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CMinecraftApp::MustSignInFullVersionPurchaseReturnedExitTrial,&app, app.GetStringTable()); - } + else { + // you're not signed in to PSN! + unsigned int uiIDA[2]; + uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; + uiIDA[1] = IDS_PRO_NOTONLINE_DECLINE; + ui.RequestErrorMessage( + IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, + ProfileManager.GetPrimaryPad(), + &CMinecraftApp::MustSignInFullVersionPurchaseReturnedExitTrial, + &app); + } #elif defined(__ORBIS__) - else - { - // Determine why they're not "signed in live" - if (ProfileManager.isSignedInPSN(iPad)) - { - // Signed in to PSN but not connected (no internet access) - assert(!ProfileManager.isConnectedToPSN(iPad)); + else { + // Determine why they're not "signed in live" + if (ProfileManager.isSignedInPSN(iPad)) { + // Signed in to PSN but not connected (no internet access) + assert(!ProfileManager.isConnectedToPSN(iPad)); - unsigned int uiIDA[1]; - uiIDA[0] = IDS_OK; - ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable()); - // still need to exit the trial or we'll be in the Pause menu with input ignored - pApp->SetAction(pMinecraft->player->GetXboxPad(),eAppAction_ExitWorldTrial); - } - else - { - // Not signed in to PSN - unsigned int uiIDA[1]; - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, iPad, &CMinecraftApp::MustSignInFullVersionPurchaseReturnedExitTrial,&app, app.GetStringTable(), NULL, 0, false); - } - } + unsigned int uiIDA[1]; + uiIDA[0] = IDS_OK; + ui.RequestErrorMessage(IDS_ERROR_NETWORK_TITLE, + IDS_ERROR_NETWORK, uiIDA, 1, iPad); + // still need to exit the trial or we'll be in the Pause menu + // with input ignored + pApp->SetAction(pMinecraft->player->GetXboxPad(), + eAppAction_ExitWorldTrial); + } else { + // Not signed in to PSN + unsigned int uiIDA[1]; + uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; + ui.RequestAlertMessage( + IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, + iPad, + &CMinecraftApp:: + MustSignInFullVersionPurchaseReturnedExitTrial, + &app); + } + } #endif - } - else - { - TelemetryManager->RecordUpsellResponded(iPad, eSen_UpsellID_Full_Version_Of_Game, app.m_dwOfferID, eSen_UpsellOutcome_Declined); - pApp->SetAction(pMinecraft->player->GetXboxPad(),eAppAction_ExitWorldTrial); - } + } else { + TelemetryManager->RecordUpsellResponded( + iPad, eSen_UpsellID_Full_Version_Of_Game, app.m_dwOfferID, + eSen_UpsellOutcome_Declined); + pApp->SetAction(pMinecraft->player->GetXboxPad(), + eAppAction_ExitWorldTrial); + } - return 0; + return 0; } -int CMinecraftApp::TrialOverReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - CMinecraftApp* pApp = (CMinecraftApp*)pParam; - Minecraft *pMinecraft=Minecraft::GetInstance(); +int CMinecraftApp::TrialOverReturned(void* pParam, int iPad, + C4JStorage::EMessageResult result) { + CMinecraftApp* pApp = (CMinecraftApp*)pParam; + Minecraft* pMinecraft = Minecraft::GetInstance(); - if(result==C4JStorage::EMessage_ResultAccept) - { - // we need a signed in user for the unlock - if(ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) - { - // 4J-PB - need to check this user can access the store + if (result == C4JStorage::EMessage_ResultAccept) { + // we need a signed in user for the unlock + if (ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) { + // 4J-PB - need to check this user can access the store #if defined(__PS3__) || defined(__PSVITA__) - bool bContentRestricted; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); - if(bContentRestricted) - { - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,&app, app.GetStringTable()); - } - else + bool bContentRestricted; + ProfileManager.GetChatAndContentRestrictions( + ProfileManager.GetPrimaryPad(), true, NULL, &bContentRestricted, + NULL); + if (bContentRestricted) { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, + IDS_CONTENT_RESTRICTION, uiIDA, 1, + ProfileManager.GetPrimaryPad()); + } else #endif - { - ProfileManager.DisplayFullVersionPurchase(false,pMinecraft->player->GetXboxPad(),eSen_UpsellID_Full_Version_Of_Game); - } - } - else - { + { + ProfileManager.DisplayFullVersionPurchase( + false, pMinecraft->player->GetXboxPad(), + eSen_UpsellID_Full_Version_Of_Game); + } + } else { #if defined(__PS3__) - // you're not signed in to PSN! - unsigned int uiIDA[2]; - uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CMinecraftApp::MustSignInFullVersionPurchaseReturned,&app, app.GetStringTable()); + // you're not signed in to PSN! + unsigned int uiIDA[2]; + uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; + uiIDA[1] = IDS_PRO_NOTONLINE_DECLINE; + ui.RequestErrorMessage( + IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, + ProfileManager.GetPrimaryPad(), + &CMinecraftApp::MustSignInFullVersionPurchaseReturned, &app); - // 4J Stu - We can't actually exit the game, so just exit back to the main menu - //pApp->SetAction(pMinecraft->player->GetXboxPad(),eAppAction_ExitWorldTrial); + // 4J Stu - We can't actually exit the game, so just exit back to + // the main menu + // pApp->SetAction(pMinecraft->player->GetXboxPad(),eAppAction_ExitWorldTrial); #else - pApp->SetAction(pMinecraft->player->GetXboxPad(),eAppAction_ExitTrial); + pApp->SetAction(pMinecraft->player->GetXboxPad(), + eAppAction_ExitTrial); #endif - } - } - else - { - TelemetryManager->RecordUpsellResponded(iPad, eSen_UpsellID_Full_Version_Of_Game, app.m_dwOfferID, eSen_UpsellOutcome_Declined); + } + } else { + TelemetryManager->RecordUpsellResponded( + iPad, eSen_UpsellID_Full_Version_Of_Game, app.m_dwOfferID, + eSen_UpsellOutcome_Declined); #if defined(__PS3__) || defined(__ORBIS__) - // 4J Stu - We can't actually exit the game, so just exit back to the main menu - pApp->SetAction(pMinecraft->player->GetXboxPad(),eAppAction_ExitWorldTrial); + // 4J Stu - We can't actually exit the game, so just exit back to the + // main menu + pApp->SetAction(pMinecraft->player->GetXboxPad(), + eAppAction_ExitWorldTrial); #else - pApp->SetAction(pMinecraft->player->GetXboxPad(),eAppAction_ExitTrial); + pApp->SetAction(pMinecraft->player->GetXboxPad(), eAppAction_ExitTrial); #endif - } + } - return 0; + return 0; } -void CMinecraftApp::ProfileReadErrorCallback(void *pParam) -{ - CMinecraftApp *pApp=(CMinecraftApp *)pParam; - int iPrimaryPlayer=ProfileManager.GetPrimaryPad(); - pApp->SetAction(iPrimaryPlayer, eAppAction_ProfileReadError); +void CMinecraftApp::ProfileReadErrorCallback(void* pParam) { + CMinecraftApp* pApp = (CMinecraftApp*)pParam; + int iPrimaryPlayer = ProfileManager.GetPrimaryPad(); + pApp->SetAction(iPrimaryPlayer, eAppAction_ProfileReadError); } -void CMinecraftApp::ClearSignInChangeUsersMask() -{ - // 4J-PB - When in the main menu, the user is on pad 0, and any change they make to their profile will be to pad 0 data - // If they then go in as a secondary player to a splitscreen game, their profile will not be read again on pad 1 if they were previously in a splitscreen game - // This is because m_uiLastSignInData remembers they were in previously, and doesn't read the profile data for them again - // Fix this by resetting the m_uiLastSignInData on pressing play game for secondary users. The Primary user does a read profile on play game anyway - int iPrimaryPlayer=ProfileManager.GetPrimaryPad(); +void CMinecraftApp::ClearSignInChangeUsersMask() { + // 4J-PB - When in the main menu, the user is on pad 0, and any change they + // make to their profile will be to pad 0 data If they then go in as a + // secondary player to a splitscreen game, their profile will not be read + // again on pad 1 if they were previously in a splitscreen game This is + // because m_uiLastSignInData remembers they were in previously, and doesn't + // read the profile data for them again Fix this by resetting the + // m_uiLastSignInData on pressing play game for secondary users. The Primary + // user does a read profile on play game anyway + int iPrimaryPlayer = ProfileManager.GetPrimaryPad(); - if(m_uiLastSignInData!=0) - { - if(iPrimaryPlayer>=0) - { - m_uiLastSignInData=1<= 0) { + m_uiLastSignInData = 1 << iPrimaryPlayer; + } else { + m_uiLastSignInData = 0; + } + } } -void CMinecraftApp::SignInChangeCallback(void *pParam,bool bPrimaryPlayerChanged,unsigned int uiSignInData) -{ +void CMinecraftApp::SignInChangeCallback(void* pParam, + bool bPrimaryPlayerChanged, + unsigned int uiSignInData) { #ifdef __PS3__ - // this is normally set in the main menu, but we can go online in the create world screens, and the primary player name isn't updated - Minecraft::GetInstance()->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); + // this is normally set in the main menu, but we can go online in the create + // world screens, and the primary player name isn't updated + Minecraft::GetInstance()->user->name = convStringToWstring( + ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); #endif - CMinecraftApp *pApp=(CMinecraftApp *)pParam; - // check if the primary player signed out - int iPrimaryPlayer=ProfileManager.GetPrimaryPad(); + CMinecraftApp* pApp = (CMinecraftApp*)pParam; + // check if the primary player signed out + int iPrimaryPlayer = ProfileManager.GetPrimaryPad(); - if((ProfileManager.GetLockedProfile()!=-1) && iPrimaryPlayer!=-1) - { - if ( ((uiSignInData & (1<SetAction(iPrimaryPlayer,eAppAction_PrimaryPlayerSignedOut); - - // 4J-PB - invalidate their banned level list - pApp->InvalidateBannedList(iPrimaryPlayer); + if ((ProfileManager.GetLockedProfile() != -1) && iPrimaryPlayer != -1) { + if (((uiSignInData & (1 << iPrimaryPlayer)) == 0) || + bPrimaryPlayerChanged) { + // Primary Player gone or there's been a sign out and sign in of the + // primary player, so kick them out + pApp->SetAction(iPrimaryPlayer, eAppAction_PrimaryPlayerSignedOut); - // need to ditch any DLCOffers info - StorageManager.ClearDLCOffers(); - pApp->ClearAndResetDLCDownloadQueue(); - pApp->ClearDLCInstalled(); - } - else - { - unsigned int uiChangedPlayers = uiSignInData ^ m_uiLastSignInData; + // 4J-PB - invalidate their banned level list + pApp->InvalidateBannedList(iPrimaryPlayer); - if( g_NetworkManager.IsInSession() ) - { - bool hasGuestIdChanged = false; - for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) - { - unsigned int guestNumber = 0; - if(ProfileManager.IsSignedIn(i)) - { - XUSER_SIGNIN_INFO info; - XUserGetSigninInfo(i,XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY ,&info); - pApp->DebugPrintf("Player at index %d has guest number %d\n", i,info.dwGuestNumber ); - guestNumber = info.dwGuestNumber; - } - if( pApp->m_currentSigninInfo[i].dwGuestNumber != 0 && guestNumber != 0 && pApp->m_currentSigninInfo[i].dwGuestNumber != guestNumber ) - { - hasGuestIdChanged = true; - } - } + // need to ditch any DLCOffers info + StorageManager.ClearDLCOffers(); + pApp->ClearAndResetDLCDownloadQueue(); + pApp->ClearDLCInstalled(); + } else { + unsigned int uiChangedPlayers = uiSignInData ^ m_uiLastSignInData; - if( hasGuestIdChanged ) - { - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_GUEST_ORDER_CHANGED_TITLE, IDS_GUEST_ORDER_CHANGED_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,NULL,app.GetStringTable()); - } + if (g_NetworkManager.IsInSession()) { + bool hasGuestIdChanged = false; + for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { + unsigned int guestNumber = 0; + if (ProfileManager.IsSignedIn(i)) { + XUSER_SIGNIN_INFO info; + XUserGetSigninInfo( + i, XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY, &info); + pApp->DebugPrintf( + "Player at index %d has guest number %d\n", i, + info.dwGuestNumber); + guestNumber = info.dwGuestNumber; + } + if (pApp->m_currentSigninInfo[i].dwGuestNumber != 0 && + guestNumber != 0 && + pApp->m_currentSigninInfo[i].dwGuestNumber != + guestNumber) { + hasGuestIdChanged = true; + } + } - // 4J Stu - On PS4 we can also cause to exit players if they are signed out here, but we shouldn't do that if - // we are going to switch to an offline game as it will likely crash due to incompatible parallel processes - bool switchToOffline = false; - // If it's an online game, and the primary profile is no longer signed into LIVE then we act as if disconnected - if( !ProfileManager.IsSignedInLive( ProfileManager.GetLockedProfile() ) && !g_NetworkManager.IsLocalGame() ) - { - switchToOffline = true; - } + if (hasGuestIdChanged) { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + ui.RequestErrorMessage(IDS_GUEST_ORDER_CHANGED_TITLE, + IDS_GUEST_ORDER_CHANGED_TEXT, uiIDA, + 1, ProfileManager.GetPrimaryPad()); + } - //printf("Old: %x, New: %x, Changed: %x\n", m_ulLastSignInData, ulSignInData, changedPlayers); - for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) - { - // Primary player shouldn't be subjected to these checks, and shouldn't call ExitPlayer - if(i == iPrimaryPlayer) continue; + // 4J Stu - On PS4 we can also cause to exit players if they are + // signed out here, but we shouldn't do that if we are going to + // switch to an offline game as it will likely crash due to + // incompatible parallel processes + bool switchToOffline = false; + // If it's an online game, and the primary profile is no longer + // signed into LIVE then we act as if disconnected + if (!ProfileManager.IsSignedInLive( + ProfileManager.GetLockedProfile()) && + !g_NetworkManager.IsLocalGame()) { + switchToOffline = true; + } - // A guest a signed in or out, out of order which invalidates all the guest players we have in the game - if(hasGuestIdChanged && pApp->m_currentSigninInfo[i].dwGuestNumber != 0 && g_NetworkManager.GetLocalPlayerByUserIndex(i)!=NULL) - { - pApp->DebugPrintf("Recommending removal of player at index %d because their guest id changed\n",i); - pApp->SetAction(i,eAppAction_ExitPlayer); - } - else - { - XUSER_SIGNIN_INFO info; - XUserGetSigninInfo(i,XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY ,&info); - // 4J Stu - Also need to detect the case where the sign in mask is the same, but the player has swapped users (eg still signed in but xuid different) - // Fix for #48451 - TU5: Code: UI: Splitscreen: Title crashes when switching to a profile previously signed out via splitscreen profile selection + // printf("Old: %x, New: %x, Changed: %x\n", m_ulLastSignInData, + // ulSignInData, changedPlayers); + for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { + // Primary player shouldn't be subjected to these checks, + // and shouldn't call ExitPlayer + if (i == iPrimaryPlayer) continue; - // 4J-PB - compiler complained about if below ('&&' within '||') - making it easier to read - bool bPlayerChanged=(uiChangedPlayers&(1<m_currentSigninInfo[i].dwGuestNumber != 0 && + g_NetworkManager.GetLocalPlayerByUserIndex(i) != NULL) { + pApp->DebugPrintf( + "Recommending removal of player at index %d " + "because their guest id changed\n", + i); + pApp->SetAction(i, eAppAction_ExitPlayer); + } else { + XUSER_SIGNIN_INFO info; + XUserGetSigninInfo( + i, XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY, &info); + // 4J Stu - Also need to detect the case where the sign + // in mask is the same, but the player has swapped users + // (eg still signed in but xuid different) Fix for + // #48451 - TU5: Code: UI: Splitscreen: Title crashes + // when switching to a profile previously signed out via + // splitscreen profile selection - if( bPlayerChanged && (!bPlayerSignedIn || (bPlayerSignedIn && !ProfileManager.AreXUIDSEqual(pApp->m_currentSigninInfo[i].xuid, info.xuid) ) )) - { - // 4J-PB - invalidate their banned level list - pApp->DebugPrintf("Player at index %d Left - invalidating their banned list\n",i); - pApp->InvalidateBannedList(i); + // 4J-PB - compiler complained about if below ('&&' + // within '||') - making it easier to read + bool bPlayerChanged = + (uiChangedPlayers & (1 << i)) == (1 << i); + bool bPlayerSignedIn = ((uiSignInData & (1 << i)) != 0); - if(g_NetworkManager.GetLocalPlayerByUserIndex(i)!=NULL) - { - pApp->DebugPrintf("Player %d signed out\n", i); - pApp->SetAction(i,eAppAction_ExitPlayer); - } - } - } + if (bPlayerChanged && + (!bPlayerSignedIn || + (bPlayerSignedIn && + !ProfileManager.AreXUIDSEqual( + pApp->m_currentSigninInfo[i].xuid, + info.xuid)))) { + // 4J-PB - invalidate their banned level list + pApp->DebugPrintf( + "Player at index %d Left - invalidating their " + "banned list\n", + i); + pApp->InvalidateBannedList(i); + + // 4J-HG: If either the player is in the network + // manager or in the game, need to exit player + // TODO: Do we need to check the network manager? + if (g_NetworkManager.GetLocalPlayerByUserIndex(i) != + NULL || + Minecraft::GetInstance()->localplayers[i] != + NULL) { + pApp->DebugPrintf("Player %d signed out\n", i); + pApp->SetAction(i, eAppAction_ExitPlayer); + } + } + } #ifdef __ORBIS__ - // check if any of the addition players have signed out of PSN (primary player is handled below) - if(!switchToOffline && i != ProfileManager.GetLockedProfile() && !g_NetworkManager.IsLocalGame()) - { - if(g_NetworkManager.GetLocalPlayerByUserIndex(i)!=NULL) - { - if(ProfileManager.IsSignedInLive(i) == false) - { - pApp->DebugPrintf("Recommending removal of player at index %d because they're no longer signed into PSNd\n",i); - pApp->SetAction(i,eAppAction_ExitPlayer); - } - } - } + // check if any of the addition players have signed out of + // PSN (primary player is handled below) + if (!switchToOffline && + i != ProfileManager.GetLockedProfile() && + !g_NetworkManager.IsLocalGame()) { + if (g_NetworkManager.GetLocalPlayerByUserIndex(i) != + NULL) { + if (ProfileManager.IsSignedInLive(i) == false) { + pApp->DebugPrintf( + "Recommending removal of player at index " + "%d because they're no longer signed into " + "PSNd\n", + i); + pApp->SetAction(i, eAppAction_ExitPlayer); + } + } + } #endif - } + } - // If it's an online game, and the primary profile is no longer signed into LIVE then we act as if disconnected - if( switchToOffline ) - { - pApp->SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected); - } + // If it's an online game, and the primary profile is no longer + // signed into LIVE then we act as if disconnected + if (switchToOffline) { + pApp->SetAction(iPrimaryPlayer, + eAppAction_EthernetDisconnected); + } - - g_NetworkManager.HandleSignInChange(); - } - // Some menus require the player to be signed in to live, so if this callback happens and the primary player is - // no longer signed in then nav back - else if ( pApp->GetLiveLinkRequired() && !ProfileManager.IsSignedInLive( ProfileManager.GetLockedProfile() ) ) - { - pApp->SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected); - } - -#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__ ) - // 4J-JEV: Need to kick of loading of profile data for sub-sign in players. - for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) - { - if( i != iPrimaryPlayer - && ( uiChangedPlayers & (1<GetLiveLinkRequired() && + !ProfileManager.IsSignedInLive( + ProfileManager.GetLockedProfile())) { +#ifdef __PSVITA__ + if (!CGameNetworkManager::usingAdhocMode()) // if we're in + // adhoc mode, we + // can ignore this #endif - } - m_uiLastSignInData = uiSignInData; - } - else if(iPrimaryPlayer!=-1) - { - // make sure the TMS banned list data is ditched - the player may have gone in to help & options, backed out, and signed out - pApp->InvalidateBannedList(iPrimaryPlayer); + { + pApp->SetAction(iPrimaryPlayer, + eAppAction_EthernetDisconnected); + } + } - // need to ditch any DLCOffers info - StorageManager.ClearDLCOffers(); - pApp->ClearAndResetDLCDownloadQueue(); - pApp->ClearDLCInstalled(); - - } - - // Update the guest numbers to the current state - for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) - { -#if defined(_XBOX) - if(FAILED(XUserGetSigninInfo(i,XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY,&pApp->m_currentSigninInfo[i]))) - { - pApp->m_currentSigninInfo[i].xuid = INVALID_XUID; - pApp->m_currentSigninInfo[i].dwGuestNumber = 0; - } +#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || \ + defined __PSVITA__) + // 4J-JEV: Need to kick of loading of profile data for sub-sign in + // players. + for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { + if (i != iPrimaryPlayer && (uiChangedPlayers & (1 << i)) && + (uiSignInData & (1 << i))) { + StorageManager.ReadFromProfile(i); + } + } #endif - app.DebugPrintf("Player at index %d has guest number %d\n", i,pApp->m_currentSigninInfo[i].dwGuestNumber ); - } + } + m_uiLastSignInData = uiSignInData; + } else if (iPrimaryPlayer != -1) { + // make sure the TMS banned list data is ditched - the player may have + // gone in to help & options, backed out, and signed out + pApp->InvalidateBannedList(iPrimaryPlayer); + + // need to ditch any DLCOffers info + StorageManager.ClearDLCOffers(); + pApp->ClearAndResetDLCDownloadQueue(); + pApp->ClearDLCInstalled(); + } + + // Update the guest numbers to the current state + for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { + if (FAILED(XUserGetSigninInfo(i, + XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY, + &pApp->m_currentSigninInfo[i]))) { + pApp->m_currentSigninInfo[i].xuid = INVALID_XUID; + pApp->m_currentSigninInfo[i].dwGuestNumber = 0; + } + app.DebugPrintf("Player at index %d has guest number %d\n", i, + pApp->m_currentSigninInfo[i].dwGuestNumber); + } } -void CMinecraftApp::NotificationsCallback(void *pParam,std::uint32_t dwNotification, unsigned int uiParam) -{ - CMinecraftApp* pClass = (CMinecraftApp*)pParam; +void CMinecraftApp::NotificationsCallback(void* pParam, + std::uint32_t dwNotification, + unsigned int uiParam) { + CMinecraftApp* pClass = (CMinecraftApp*)pParam; - // push these on to the notifications to be handled in qnet's dowork + // push these on to the notifications to be handled in qnet's dowork - PNOTIFICATION pNotification = new NOTIFICATION; + PNOTIFICATION pNotification = new NOTIFICATION; - pNotification->dwNotification=dwNotification; - pNotification->uiParam=uiParam; + pNotification->dwNotification = dwNotification; + pNotification->uiParam = uiParam; - switch( dwNotification ) - { - case XN_SYS_SIGNINCHANGED: - { - pClass->DebugPrintf("Signing changed - %d\n", uiParam ); - } - break; - case XN_SYS_INPUTDEVICESCHANGED: - if(app.GetGameStarted() && g_NetworkManager.IsInSession()) - { - for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) - { - if(!InputManager.IsPadConnected(i) && - Minecraft::GetInstance()->localplayers[i] != NULL && - !ui.IsPauseMenuDisplayed(i) && !ui.IsSceneInStack(i, eUIScene_EndPoem) ) - { - ui.CloseUIScenes(i); - ui.NavigateToScene(i,eUIScene_PauseMenu); - } - } - } - break; - case XN_LIVE_CONTENT_INSTALLED: - // Need to inform xuis that we've possibly had DLC installed - { - //app.m_dlcManager.SetNeedsUpdated(true); - // Clear the DLC installed flag to cause a GetDLC to run if it's called - app.ClearDLCInstalled(); + switch (dwNotification) { + case XN_SYS_SIGNINCHANGED: { + pClass->DebugPrintf("Signing changed - %d\n", uiParam); + } break; + case XN_SYS_INPUTDEVICESCHANGED: + if (app.GetGameStarted() && g_NetworkManager.IsInSession()) { + for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { + if (!InputManager.IsPadConnected(i) && + Minecraft::GetInstance()->localplayers[i] != NULL && + !ui.IsPauseMenuDisplayed(i) && + !ui.IsSceneInStack(i, eUIScene_EndPoem)) { + ui.CloseUIScenes(i); + ui.NavigateToScene(i, eUIScene_PauseMenu); + } + } + } + break; + case XN_LIVE_CONTENT_INSTALLED: + // Need to inform xuis that we've possibly had DLC installed + { + // app.m_dlcManager.SetNeedsUpdated(true); + // Clear the DLC installed flag to cause a GetDLC to run if + // it's called + app.ClearDLCInstalled(); - ui.HandleDLCInstalled(ProfileManager.GetPrimaryPad()); - } - break; - case XN_SYS_STORAGEDEVICESCHANGED: - { + ui.HandleDLCInstalled(ProfileManager.GetPrimaryPad()); + } + break; + case XN_SYS_STORAGEDEVICESCHANGED: { #ifdef _XBOX - // If the devices have changed, and we've got a dlc pack with audio selected, and that pack's content device is no longer valid... then pull the plug on - // audio streaming, as if we leave this until later xact gets locked up attempting to destroy the streamed wave bank. - TexturePack *pTexPack=Minecraft::GetInstance()->skins->getSelected(); - if(pTexPack->hasAudio()) - { - DLCTexturePack *pDLCTexPack=(DLCTexturePack *)pTexPack; - XCONTENTDEVICEID deviceID = pDLCTexPack->GetDLCDeviceID(); - if( XContentGetDeviceState( deviceID, NULL ) != ERROR_SUCCESS ) - { - // Set texture pack flag so that it is now considered as not having audio - this is critical so that the next playStreaming does what it is meant to do, - // and also so that we don't try and unmount this again, or play any sounds from it in the future - pTexPack->setHasAudio(false); - // need to stop the streaming audio - by playing streaming audio from the default texture pack now - Minecraft::GetInstance()->soundEngine->playStreaming(L"", 0, 0, 0, 0, 0); + // If the devices have changed, and we've got a dlc pack with audio + // selected, and that pack's content device is no longer valid... + // then pull the plug on audio streaming, as if we leave this until + // later xact gets locked up attempting to destroy the streamed wave + // bank. + TexturePack* pTexPack = + Minecraft::GetInstance()->skins->getSelected(); + if (pTexPack->hasAudio()) { + DLCTexturePack* pDLCTexPack = (DLCTexturePack*)pTexPack; + XCONTENTDEVICEID deviceID = pDLCTexPack->GetDLCDeviceID(); + if (XContentGetDeviceState(deviceID, NULL) != ERROR_SUCCESS) { + // Set texture pack flag so that it is now considered as not + // having audio - this is critical so that the next + // playStreaming does what it is meant to do, and also so + // that we don't try and unmount this again, or play any + // sounds from it in the future + pTexPack->setHasAudio(false); + // need to stop the streaming audio - by playing streaming + // audio from the default texture pack now + Minecraft::GetInstance()->soundEngine->playStreaming( + L"", 0, 0, 0, 0, 0); - if(pDLCTexPack->m_pStreamedWaveBank!=NULL) - { - pDLCTexPack->m_pStreamedWaveBank->Destroy(); - } - if(pDLCTexPack->m_pSoundBank!=NULL) - { - pDLCTexPack->m_pSoundBank->Destroy(); - } - const unsigned int result = StorageManager.UnmountInstalledDLC("TPACK"); - app.DebugPrintf("Unmount result is %d\n",result); - } - } + if (pDLCTexPack->m_pStreamedWaveBank != NULL) { + pDLCTexPack->m_pStreamedWaveBank->Destroy(); + } + if (pDLCTexPack->m_pSoundBank != NULL) { + pDLCTexPack->m_pSoundBank->Destroy(); + } + const unsigned int result = + StorageManager.UnmountInstalledDLC("TPACK"); + app.DebugPrintf("Unmount result is %d\n", result); + } + } #endif - } - break; - } + } break; + } - pClass->m_vNotifications.push_back(pNotification); + pClass->m_vNotifications.push_back(pNotification); } #if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__ -int CMinecraftApp::MustSignInFullVersionPurchaseReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - if(result==C4JStorage::EMessage_ResultAccept) - { +int CMinecraftApp::MustSignInFullVersionPurchaseReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + if (result == C4JStorage::EMessage_ResultAccept) { #ifdef __PS3__ - SQRNetworkManager_PS3::AttemptPSNSignIn(&CMinecraftApp::NowDisplayFullVersionPurchase, &app,true); + SQRNetworkManager_PS3::AttemptPSNSignIn( + &CMinecraftApp::NowDisplayFullVersionPurchase, &app, true); #elif defined __PSVITA__ - SQRNetworkManager_Vita::AttemptPSNSignIn(&CMinecraftApp::NowDisplayFullVersionPurchase, &app,true); -#else // __PS4__ - SQRNetworkManager_Orbis::AttemptPSNSignIn(&CMinecraftApp::NowDisplayFullVersionPurchase, &app,true); + SQRNetworkManager_Vita::AttemptPSNSignIn( + &CMinecraftApp::NowDisplayFullVersionPurchase, &app, true); +#else // __PS4__ + SQRNetworkManager_Orbis::AttemptPSNSignIn( + &CMinecraftApp::NowDisplayFullVersionPurchase, &app, true); #endif - } + } - return 0; + return 0; } #if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__ -int CMinecraftApp::MustSignInFullVersionPurchaseReturnedExitTrial(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - if(result==C4JStorage::EMessage_ResultAccept) - { +int CMinecraftApp::MustSignInFullVersionPurchaseReturnedExitTrial( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + if (result == C4JStorage::EMessage_ResultAccept) { #ifdef __PS3__ - SQRNetworkManager_PS3::AttemptPSNSignIn(&CMinecraftApp::NowDisplayFullVersionPurchase, &app,true); + SQRNetworkManager_PS3::AttemptPSNSignIn( + &CMinecraftApp::NowDisplayFullVersionPurchase, &app, true); #elif defined __PSVITA__ - SQRNetworkManager_Vita::AttemptPSNSignIn(&CMinecraftApp::NowDisplayFullVersionPurchase, &app,true); -#else // __PS4__ - SQRNetworkManager_Orbis::AttemptPSNSignIn(&CMinecraftApp::NowDisplayFullVersionPurchase, &app,true); + SQRNetworkManager_Vita::AttemptPSNSignIn( + &CMinecraftApp::NowDisplayFullVersionPurchase, &app, true); +#else // __PS4__ + SQRNetworkManager_Orbis::AttemptPSNSignIn( + &CMinecraftApp::NowDisplayFullVersionPurchase, &app, true); #endif - } + } - //4J-PB - we need to exit the trial, or we'll be in the pause menu with ignore input true - app.SetAction(iPad,eAppAction_ExitWorldTrial); + // 4J-PB - we need to exit the trial, or we'll be in the pause menu with + // ignore input true + app.SetAction(iPad, eAppAction_ExitWorldTrial); - return 0; + return 0; } #endif -int CMinecraftApp::NowDisplayFullVersionPurchase(void *pParam, bool bContinue, int iPad) -{ - app.m_bDisplayFullVersionPurchase=true; - return 0; +int CMinecraftApp::NowDisplayFullVersionPurchase(void* pParam, bool bContinue, + int iPad) { + app.m_bDisplayFullVersionPurchase = true; + return 0; } #endif -void CMinecraftApp::UpsellReturnedCallback(void *pParam, eUpsellType type, eUpsellResponse result, int iUserData) -{ - ESen_UpsellID senType; - ESen_UpsellOutcome senResponse; +void CMinecraftApp::UpsellReturnedCallback(void* pParam, eUpsellType type, + eUpsellResponse result, + int iUserData) { + ESen_UpsellID senType; + ESen_UpsellOutcome senResponse; #ifdef __PS3__ - unsigned int uiIDA[2]; + unsigned int uiIDA[2]; #endif - // Map the eUpsellResponse to the enum we use for sentient - switch(result) - { - case eUpsellResponse_Accepted_NoPurchase: - senResponse = eSen_UpsellOutcome_Went_To_Guide; - break; - case eUpsellResponse_Accepted_Purchase: - senResponse = eSen_UpsellOutcome_Accepted; - break; + // Map the eUpsellResponse to the enum we use for sentient + switch (result) { + case eUpsellResponse_Accepted_NoPurchase: + senResponse = eSen_UpsellOutcome_Went_To_Guide; + break; + case eUpsellResponse_Accepted_Purchase: + senResponse = eSen_UpsellOutcome_Accepted; + break; #ifdef __PS3__ - // special case for people who are not signed in to the PSN while playing the trial game - case eUpsellResponse_UserNotSignedInPSN: - - uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CMinecraftApp::MustSignInFullVersionPurchaseReturned,&app, app.GetStringTable()); + // special case for people who are not signed in to the PSN while + // playing the trial game + case eUpsellResponse_UserNotSignedInPSN: - return; + uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; + uiIDA[1] = IDS_PRO_NOTONLINE_DECLINE; + ui.RequestErrorMessage( + IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, + ProfileManager.GetPrimaryPad(), + &CMinecraftApp::MustSignInFullVersionPurchaseReturned, &app); - case eUpsellResponse_NotAllowedOnline: // On earning a trophy in the trial version, where the user is underage and can't go online to buy the game, but they selected to buy the game on the trophy upsell - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,&app, app.GetStringTable()); - break; -#endif - case eUpsellResponse_Declined: - default: - senResponse = eSen_UpsellOutcome_Declined; - break; - }; + return; - // Map the eUpsellType to the enum we use for sentient - switch(type) - { - case eUpsellType_Custom: - senType = eSen_UpsellID_Full_Version_Of_Game; - break; - default: - senType = eSen_UpsellID_Undefined; - break; - }; + case eUpsellResponse_NotAllowedOnline: // On earning a trophy in the + // trial version, where the user + // is underage and can't go + // online to buy the game, but + // they selected to buy the game + // on the trophy upsell + uiIDA[0] = IDS_CONFIRM_OK; + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, + IDS_CONTENT_RESTRICTION, uiIDA, 1, + ProfileManager.GetPrimaryPad()); + break; +#endif + case eUpsellResponse_Declined: + default: + senResponse = eSen_UpsellOutcome_Declined; + break; + }; - // Always the primary pad that gets an upsell - TelemetryManager->RecordUpsellResponded(ProfileManager.GetPrimaryPad(), eSen_UpsellID_Full_Version_Of_Game, app.m_dwOfferID, senResponse); + // Map the eUpsellType to the enum we use for sentient + switch (type) { + case eUpsellType_Custom: + senType = eSen_UpsellID_Full_Version_Of_Game; + break; + default: + senType = eSen_UpsellID_Undefined; + break; + }; + + // Always the primary pad that gets an upsell + TelemetryManager->RecordUpsellResponded(ProfileManager.GetPrimaryPad(), + eSen_UpsellID_Full_Version_Of_Game, + app.m_dwOfferID, senResponse); } -void CMinecraftApp::SetDebugSequence(const char *pchSeq) -{ - InputManager.SetDebugSequence(pchSeq,&CMinecraftApp::DebugInputCallback,this); +#ifdef _DEBUG_MENUS_ENABLED +bool CMinecraftApp::DebugArtToolsOn() { + return DebugSettingsOn() && + (GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) & + (1L << eDebugSetting_ArtTools)) != 0; } -int CMinecraftApp::DebugInputCallback(void *pParam) -{ - CMinecraftApp* pClass = (CMinecraftApp*)pParam; - //printf("sequence matched\n"); - pClass->m_bDebugOptions=!pClass->m_bDebugOptions; +#endif - for(int i=0;im_bDebugOptions = !pClass->m_bDebugOptions; - return 0; + for (int i = 0; i < XUSER_MAX_COUNT; i++) { + if (app.DebugSettingsOn()) { + app.ActionDebugMask(i); + } else { + // force debug mask off + app.ActionDebugMask(i, true); + } + } + + return 0; } -int CMinecraftApp::GetLocalPlayerCount(void) -{ - int iPlayerC=0; - Minecraft *pMinecraft = Minecraft::GetInstance(); - for(int i=0;ilocalplayers[i] != NULL) - { - iPlayerC++; - } - } +int CMinecraftApp::GetLocalPlayerCount(void) { + int iPlayerC = 0; + Minecraft* pMinecraft = Minecraft::GetInstance(); + for (int i = 0; i < XUSER_MAX_COUNT; i++) { + if (pMinecraft != NULL && pMinecraft->localplayers[i] != NULL) { + iPlayerC++; + } + } - return iPlayerC; + return iPlayerC; } -int CMinecraftApp::MarketplaceCountsCallback(void *pParam,C4JStorage::DLC_TMS_DETAILS *pTMSDetails, int iPad) -{ - app.DebugPrintf("Marketplace Counts= New - %d Total - %d\n",pTMSDetails->dwNewOffers,pTMSDetails->dwTotalOffers); +int CMinecraftApp::MarketplaceCountsCallback( + void* pParam, C4JStorage::DLC_TMS_DETAILS* pTMSDetails, int iPad) { + app.DebugPrintf("Marketplace Counts= New - %d Total - %d\n", + pTMSDetails->dwNewOffers, pTMSDetails->dwTotalOffers); - if(pTMSDetails->dwNewOffers>0) - { - app.m_bNewDLCAvailable=true; - app.m_bSeenNewDLCTip=false; - } - else - { - app.m_bNewDLCAvailable=false; - app.m_bSeenNewDLCTip=true; - } + if (pTMSDetails->dwNewOffers > 0) { + app.m_bNewDLCAvailable = true; + app.m_bSeenNewDLCTip = false; + } else { + app.m_bNewDLCAvailable = false; + app.m_bSeenNewDLCTip = true; + } - return 0; + return 0; } -bool CMinecraftApp::StartInstallDLCProcess(int iPad) -{ - app.DebugPrintf("--- CMinecraftApp::StartInstallDLCProcess: pad=%i.\n", iPad); +bool CMinecraftApp::StartInstallDLCProcess(int iPad) { + app.DebugPrintf("--- CMinecraftApp::StartInstallDLCProcess: pad=%i.\n", + iPad); - // If there is already a call to this in progress, then do nothing - // If the app says dlc is installed, then there has been no new system message to tell us there's new DLC since the last call to StartInstallDLCProcess - if((app.DLCInstallProcessCompleted()==false) && (m_bDLCInstallPending==false)) - { - app.m_dlcManager.resetUnnamedCorruptCount(); - m_bDLCInstallPending = true; - m_iTotalDLC = 0; - m_iTotalDLCInstalled = 0; - app.DebugPrintf("--- CMinecraftApp::StartInstallDLCProcess - StorageManager.GetInstalledDLC\n"); + // If there is already a call to this in progress, then do nothing + // If the app says dlc is installed, then there has been no new system + // message to tell us there's new DLC since the last call to + // StartInstallDLCProcess + if ((app.DLCInstallProcessCompleted() == false) && + (m_bDLCInstallPending == false)) { + app.m_dlcManager.resetUnnamedCorruptCount(); + m_bDLCInstallPending = true; + m_iTotalDLC = 0; + m_iTotalDLCInstalled = 0; + app.DebugPrintf( + "--- CMinecraftApp::StartInstallDLCProcess - " + "StorageManager.GetInstalledDLC\n"); - StorageManager.GetInstalledDLC(iPad,&CMinecraftApp::DLCInstalledCallback,this); - return true; - } - else - { - app.DebugPrintf("--- CMinecraftApp::StartInstallDLCProcess - nothing to do\n"); - - return false; - } + StorageManager.GetInstalledDLC( + iPad, &CMinecraftApp::DLCInstalledCallback, this); + return true; + } else { + app.DebugPrintf( + "--- CMinecraftApp::StartInstallDLCProcess - nothing to do\n"); + return false; + } } // Installed DLC callback -int CMinecraftApp::DLCInstalledCallback(void *pParam,int iInstalledC,int iPad) -{ - app.DebugPrintf("--- CMinecraftApp::DLCInstalledCallback: totalDLC=%i, pad=%i.\n", iInstalledC, iPad); - app.m_iTotalDLC = iInstalledC; - app.MountNextDLC(iPad); - return 0; +int CMinecraftApp::DLCInstalledCallback(void* pParam, int iInstalledC, + int iPad) { + app.DebugPrintf( + "--- CMinecraftApp::DLCInstalledCallback: totalDLC=%i, pad=%i.\n", + iInstalledC, iPad); + app.m_iTotalDLC = iInstalledC; + app.MountNextDLC(iPad); + return 0; } -void CMinecraftApp::MountNextDLC(int iPad) -{ - app.DebugPrintf("--- CMinecraftApp::MountNextDLC: pad=%i.\n", iPad); - if(m_iTotalDLCInstalled < m_iTotalDLC) - { - // Mount it - // We also need to match the ones the user wants to mount with the installed DLC - // We're supposed to use a generic save game as a cache of these to do this, with XUSER_ANY +void CMinecraftApp::MountNextDLC(int iPad) { + app.DebugPrintf("--- CMinecraftApp::MountNextDLC: pad=%i.\n", iPad); + if (m_iTotalDLCInstalled < m_iTotalDLC) { + // Mount it + // We also need to match the ones the user wants to mount with the + // installed DLC We're supposed to use a generic save game as a cache of + // these to do this, with XUSER_ANY - if(StorageManager.MountInstalledDLC(iPad,m_iTotalDLCInstalled,&CMinecraftApp::DLCMountedCallback,this)!=ERROR_IO_PENDING ) - { - // corrupt DLC - app.DebugPrintf("Failed to mount DLC %d for pad %d\n",m_iTotalDLCInstalled,iPad); - ++m_iTotalDLCInstalled; - app.MountNextDLC(iPad); - } - else - { - app.DebugPrintf("StorageManager.MountInstalledDLC ok\n"); - } - } - else - { - /* Removed - now loading these on demand instead of as each pack is mounted - if(m_iTotalDLCInstalled > 0) - { - Minecraft *pMinecraft=Minecraft::GetInstance(); - pMinecraft->levelRenderer->AddDLCSkinsToMemTextures(); - } - */ + if (StorageManager.MountInstalledDLC(iPad, m_iTotalDLCInstalled, + &CMinecraftApp::DLCMountedCallback, + this) != ERROR_IO_PENDING) { + // corrupt DLC + app.DebugPrintf("Failed to mount DLC %d for pad %d\n", + m_iTotalDLCInstalled, iPad); + ++m_iTotalDLCInstalled; + app.MountNextDLC(iPad); + } else { + app.DebugPrintf("StorageManager.MountInstalledDLC ok\n"); + } + } else { + /* Removed - now loading these on demand instead of as each pack is + mounted if(m_iTotalDLCInstalled > 0) + { + Minecraft *pMinecraft=Minecraft::GetInstance(); + pMinecraft->levelRenderer->AddDLCSkinsToMemTextures(); + } + */ - m_bDLCInstallPending = false; - m_bDLCInstallProcessCompleted=true; + m_bDLCInstallPending = false; + m_bDLCInstallProcessCompleted = true; - ui.HandleDLCMountingComplete(); + ui.HandleDLCMountingComplete(); #if defined(_XBOX_ONE) || defined(__ORBIS__) - // Check if the current texture pack is now installed - if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) - { - TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; + // Check if the current texture pack is now installed + if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { + TexturePack* tPack = Minecraft::GetInstance()->skins->getSelected(); + DLCTexturePack* pDLCTexPack = (DLCTexturePack*)tPack; - DLCPack *pParentPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack(); + DLCPack* pParentPack = + pDLCTexPack->getDLCInfoParentPack(); // tPack->getDLCPack(); - if(pParentPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" )) - { - StorageManager.SetSaveDisabled(false); - } - } + if (pParentPack->hasPurchasedFile(DLCManager::e_DLCType_Texture, + L"")) { + StorageManager.SetSaveDisabled(false); + } + } #endif - } +#if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ + { + TexturePack* currentTPack = + Minecraft::GetInstance()->skins->getSelected(); + TexturePack* requiredTPack = + Minecraft::GetInstance()->skins->getTexturePackById( + app.GetRequiredTexturePackID()); + if (currentTPack != requiredTPack) { + Minecraft::GetInstance()->skins->selectTexturePackById( + app.GetRequiredTexturePackID()); + } + } +#endif + } } // 4J-JEV: For the sake of clarity in DLCMountedCallback. @@ -5084,690 +5717,793 @@ void CMinecraftApp::MountNextDLC(int iPad) #define CONTENT_DATA_DISPLAY_NAME(a) (a.wszDisplayName) #endif -int CMinecraftApp::DLCMountedCallback(void *pParam,int iPad,std::uint32_t dwErr,std::uint32_t dwLicenceMask) -{ -#if defined(_XBOX) || defined(_DURANGO) || defined(__PS3__) || defined(__ORBIS__) || defined(_WINDOWS64) || defined (__PSVITA__) //Chris TODO - app.DebugPrintf("--- CMinecraftApp::DLCMountedCallback\n"); +int CMinecraftApp::DLCMountedCallback(void* pParam, int iPad, + std::uint32_t dwErr, + std::uint32_t dwLicenceMask) { +#if defined(_XBOX) || defined(_DURANGO) || defined(__PS3__) || \ + defined(__ORBIS__) || defined(_WINDOWS64) || \ + defined(__PSVITA__) // Chris TODO + app.DebugPrintf("--- CMinecraftApp::DLCMountedCallback\n"); - if(dwErr!=ERROR_SUCCESS) - { - // corrupt DLC - app.DebugPrintf("Failed to mount DLC for pad %d: %u\n",iPad,dwErr); - app.m_dlcManager.incrementUnnamedCorruptCount(); - } - else - { - XCONTENT_DATA ContentData = StorageManager.GetDLC(app.m_iTotalDLCInstalled); + if (dwErr != ERROR_SUCCESS) { + // corrupt DLC + app.DebugPrintf("Failed to mount DLC for pad %d: %u\n", iPad, dwErr); + app.m_dlcManager.incrementUnnamedCorruptCount(); + } else { + XCONTENT_DATA ContentData = + StorageManager.GetDLC(app.m_iTotalDLCInstalled); - DLCPack *pack = app.m_dlcManager.getPack( CONTENT_DATA_DISPLAY_NAME(ContentData) ); + DLCPack* pack = + app.m_dlcManager.getPack(CONTENT_DATA_DISPLAY_NAME(ContentData)); - if( pack != NULL && pack->IsCorrupt() ) - { - app.DebugPrintf("Pack '%ls' is corrupt, removing it from the DLC Manager.\n", CONTENT_DATA_DISPLAY_NAME(ContentData)); + if (pack != NULL && pack->IsCorrupt()) { + app.DebugPrintf( + "Pack '%ls' is corrupt, removing it from the DLC Manager.\n", + CONTENT_DATA_DISPLAY_NAME(ContentData)); - app.m_dlcManager.removePack(pack); - pack = NULL; - } - - if(pack == NULL) - { - app.DebugPrintf("Pack \"%ls\" is not installed, so adding it\n", CONTENT_DATA_DISPLAY_NAME(ContentData)); + app.m_dlcManager.removePack(pack); + pack = NULL; + } + + if (pack == NULL) { + app.DebugPrintf("Pack \"%ls\" is not installed, so adding it\n", + CONTENT_DATA_DISPLAY_NAME(ContentData)); #if defined(_XBOX) || defined(__PS3__) || defined(_WINDOWS64) - pack = new DLCPack(ContentData.szDisplayName,dwLicenceMask); + pack = new DLCPack(ContentData.szDisplayName, dwLicenceMask); #elif defined _XBOX_ONE - pack = new DLCPack(ContentData.wszDisplayName,ContentData.wszProductID,dwLicenceMask); + pack = new DLCPack(ContentData.wszDisplayName, + ContentData.wszProductID, dwLicenceMask); #else - pack = new DLCPack(ContentData.wszDisplayName,dwLicenceMask); + pack = new DLCPack(ContentData.wszDisplayName, dwLicenceMask); #endif - pack->SetDLCMountIndex(app.m_iTotalDLCInstalled); - pack->SetDLCDeviceID(ContentData.DeviceID); - app.m_dlcManager.addPack(pack); + pack->SetDLCMountIndex(app.m_iTotalDLCInstalled); + pack->SetDLCDeviceID(ContentData.DeviceID); + app.m_dlcManager.addPack(pack); - app.HandleDLC(pack); + app.HandleDLC(pack); - if(pack->getDLCItemsCount(DLCManager::e_DLCType_Texture) > 0) - { - Minecraft::GetInstance()->skins->addTexturePackFromDLC(pack, pack->GetPackId() ); - } - } - else - { - app.DebugPrintf("Pack \"%ls\" is already installed. Updating license to %u\n", CONTENT_DATA_DISPLAY_NAME(ContentData), dwLicenceMask); + if (pack->getDLCItemsCount(DLCManager::e_DLCType_Texture) > 0) { + Minecraft::GetInstance()->skins->addTexturePackFromDLC( + pack, pack->GetPackId()); + } + } else { + app.DebugPrintf( + "Pack \"%ls\" is already installed. Updating license to %u\n", + CONTENT_DATA_DISPLAY_NAME(ContentData), dwLicenceMask); - pack->SetDLCMountIndex(app.m_iTotalDLCInstalled); - pack->SetDLCDeviceID(ContentData.DeviceID); - pack->updateLicenseMask(dwLicenceMask); - } + pack->SetDLCMountIndex(app.m_iTotalDLCInstalled); + pack->SetDLCDeviceID(ContentData.DeviceID); + pack->updateLicenseMask(dwLicenceMask); + } - StorageManager.UnmountInstalledDLC(); - } - ++app.m_iTotalDLCInstalled; - app.MountNextDLC(iPad); + StorageManager.UnmountInstalledDLC(); + } + ++app.m_iTotalDLCInstalled; + app.MountNextDLC(iPad); -#endif // __PSVITA__ - return 0; +#endif // __PSVITA__ + return 0; } #undef CONTENT_DATA_DISPLAY_NAME // void CMinecraftApp::InstallDefaultCape() // { // if(!m_bDefaultCapeInstallAttempted) -// { -// // we only attempt to install the cape once per launch of the game -// m_bDefaultCapeInstallAttempted=true; -// +// { +// // we only attempt to install the cape once per launch of the +// game m_bDefaultCapeInstallAttempted=true; +// // std::wstring wTemp=L"Default_Cape.png"; // bool bRes=app.IsFileInMemoryTextures(wTemp); -// // if the file is not already in the memory textures, then read it from TMS -// if(!bRes) -// { -// BYTE *pBuffer=NULL; -// DWORD dwSize=0; -// // 4J-PB - out for now for DaveK so he doesn't get the birthday cape -// #ifdef _CONTENT_PACKAGE -// C4JStorage::ETMSStatus eTMSStatus; -// eTMSStatus=StorageManager.ReadTMSFile(ProfileManager.GetPrimaryPad(),C4JStorage::eGlobalStorage_Title,C4JStorage::eTMS_FileType_Graphic, L"Default_Cape.png",&pBuffer, &dwSize); +// // if the file is not already in the memory textures, then read +// it from TMS if(!bRes) +// { +// std::uint8_t *pBuffer=NULL; +// std::uint32_t dwSize=0; +// // 4J-PB - out for now for DaveK so he doesn't get the +// birthday cape #ifdef _CONTENT_PACKAGE +// C4JStorage::ETMSStatus eTMSStatus; +// eTMSStatus=StorageManager.ReadTMSFile(ProfileManager.GetPrimaryPad(),C4JStorage::eGlobalStorage_Title,C4JStorage::eTMS_FileType_Graphic, +// L"Default_Cape.png",&pBuffer, &dwSize); // if(eTMSStatus==C4JStorage::ETMSStatus_Idle) // { // app.AddMemoryTextureFile(wTemp,pBuffer,dwSize); -// } +// } // #endif // } // } // } - void CMinecraftApp::HandleDLC(DLCPack *pack) - { - unsigned int dwFilesProcessed = 0; +void CMinecraftApp::HandleDLC(DLCPack* pack) { + unsigned int dwFilesProcessed = 0; #ifndef _XBOX -#if defined(__PS3__) || defined(__ORBIS__) || defined(_WINDOWS64) || defined (__PSVITA__) || defined(__linux__) - std::vector dlcFilenames; +#if defined(__PS3__) || defined(__ORBIS__) || defined(_WINDOWS64) || \ + defined(__PSVITA__) || defined(__linux__) + std::vector dlcFilenames; #elif defined _DURANGO - std::vector dlcFilenames; + std::vector dlcFilenames; #endif - StorageManager.GetMountedDLCFileList("DLCDrive", dlcFilenames); - for(int i=0; i 0) + m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[0], pack); #else - WIN32_FIND_DATA wfd; - HANDLE hFind; + for (int i = 0; i < dlcFilenames.size(); i++) { + m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[i], pack); + } +#endif +#else + WIN32_FIND_DATA wfd; + HANDLE hFind; - char szPath[] = "DLCDrive:\\"; - char szFullFilename[256]; - strcpy(szFullFilename,szPath); - strcat(szFullFilename,"*"); + char szPath[] = "DLCDrive:\\"; + char szFullFilename[256]; + strcpy(szFullFilename, szPath); + strcat(szFullFilename, "*"); - // Start the find and check for failure. - hFind = FindFirstFile( szFullFilename, &wfd ); + // Start the find and check for failure. + hFind = FindFirstFile(szFullFilename, &wfd); - if( INVALID_HANDLE_VALUE == hFind ) - { - app.DebugPrintf( "FindFirstFile failed." ); - } - else - { - // Display each file and ask for the next. - do - { - strcpy(szFullFilename,szPath); - strcat(szFullFilename,wfd.cFileName); - - if(( GetFileAttributes( szFullFilename ) & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) - { + if (INVALID_HANDLE_VALUE == hFind) { + app.DebugPrintf("FindFirstFile failed."); + } else { + // Display each file and ask for the next. + do { + strcpy(szFullFilename, szPath); + strcat(szFullFilename, wfd.cFileName); + + if ((GetFileAttributes(szFullFilename) & + FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) { #ifdef _XBOX - std::uint32_t dwPackID=m_dlcManager.retrievePackIDFromDLCDataFile(szFullFilename,pack); + std::uint32_t dwPackID = + m_dlcManager.retrievePackIDFromDLCDataFile(szFullFilename, + pack); - // Do we need to override the TexturePack.pck with an updated version in a TU? - std::wstring wsTemp=getFilePath(dwPackID, std::wstring(L"TexturePack.pck"),false ); - File texturePCKPath(wsTemp ); - if(texturePCKPath.exists()) - { - app.DebugPrintf("Found a replacement .pck\n"); - m_dlcManager.readDLCDataFile(dwFilesProcessed, wsTemp,pack); - } - else - { - m_dlcManager.readDLCDataFile(dwFilesProcessed, szFullFilename,pack); - } + // Do we need to override the TexturePack.pck with an updated + // version in a TU? + std::wstring wsTemp = getFilePath( + dwPackID, std::wstring(L"TexturePack.pck"), false); + File texturePCKPath(wsTemp); + if (texturePCKPath.exists()) { + app.DebugPrintf("Found a replacement .pck\n"); + m_dlcManager.readDLCDataFile(dwFilesProcessed, wsTemp, + pack); + } else { + m_dlcManager.readDLCDataFile(dwFilesProcessed, + szFullFilename, pack); + } #else - m_dlcManager.readDLCDataFile(dwFilesProcessed, szFullFilename,pack); + m_dlcManager.readDLCDataFile(dwFilesProcessed, szFullFilename, + pack); #endif - } - } - while( FindNextFile( hFind, &wfd ) ); + } + } while (FindNextFile(hFind, &wfd)); - // Close the find handle. - FindClose( hFind ); - } -#endif // __PS3__ || __ORBIS__ + // Close the find handle. + FindClose(hFind); + } +#endif // __PS3__ || __ORBIS__ - if( dwFilesProcessed == 0 ) m_dlcManager.removePack(pack); - } + if (dwFilesProcessed == 0) m_dlcManager.removePack(pack); +} -// int CMinecraftApp::DLCReadCallback(LPVOID pParam,C4JStorage::DLC_FILE_DETAILS *pDLCData) +// int CMinecraftApp::DLCReadCallback(void* +// pParam,C4JStorage::DLC_FILE_DETAILS *pDLCData) // { -// -// +// +// // return 0; // } - //------------------------------------------------------------------------------------- - // Name: InitTime() - // Desc: Initializes the timer variables - //------------------------------------------------------------------------------------- - void CMinecraftApp::InitTime() - { +//------------------------------------------------------------------------------------- +// Name: InitTime() +// Desc: Initializes the timer variables +//------------------------------------------------------------------------------------- +void CMinecraftApp::InitTime() { + // Get the frequency of the timer + LARGE_INTEGER qwTicksPerSec; + QueryPerformanceFrequency(&qwTicksPerSec); + m_Time.fSecsPerTick = 1.0f / (float)qwTicksPerSec.QuadPart; - // Get the frequency of the timer - LARGE_INTEGER qwTicksPerSec; - QueryPerformanceFrequency( &qwTicksPerSec ); - m_Time.fSecsPerTick = 1.0f / (float)qwTicksPerSec.QuadPart; + // Save the start time + QueryPerformanceCounter(&m_Time.qwTime); - // Save the start time - QueryPerformanceCounter( &m_Time.qwTime ); - - // Zero out the elapsed and total time - m_Time.qwAppTime.QuadPart = 0; - m_Time.fAppTime = 0.0f; - m_Time.fElapsedTime = 0.0f; - } - - //------------------------------------------------------------------------------------- - // Name: UpdateTime() - // Desc: Updates the elapsed time since our last frame. - //------------------------------------------------------------------------------------- - void CMinecraftApp::UpdateTime() - { - LARGE_INTEGER qwNewTime; - LARGE_INTEGER qwDeltaTime; - - QueryPerformanceCounter( &qwNewTime ); - qwDeltaTime.QuadPart = qwNewTime.QuadPart - m_Time.qwTime.QuadPart; - - m_Time.qwAppTime.QuadPart += qwDeltaTime.QuadPart; - m_Time.qwTime.QuadPart = qwNewTime.QuadPart; - - m_Time.fElapsedTime = m_Time.fSecsPerTick * static_cast(qwDeltaTime.QuadPart); - m_Time.fAppTime = m_Time.fSecsPerTick * static_cast(m_Time.qwAppTime.QuadPart); - } - - - - - - - -bool CMinecraftApp::isXuidNotch(PlayerUID xuid) -{ - if(m_xuidNotch != INVALID_XUID && xuid != INVALID_XUID) - { - return ProfileManager.AreXUIDSEqual(xuid, m_xuidNotch); - } - return false; + // Zero out the elapsed and total time + m_Time.qwAppTime.QuadPart = 0; + m_Time.fAppTime = 0.0f; + m_Time.fElapsedTime = 0.0f; } -bool CMinecraftApp::isXuidDeadmau5(PlayerUID xuid) -{ - AUTO_VAR(it, MojangData.find( xuid )); // 4J Stu - The .at and [] accessors insert elements if they don't exist - if (it != MojangData.end() ) - { - MOJANG_DATA *pMojangData=MojangData[xuid]; - if(pMojangData && pMojangData->eXuid==eXUID_Deadmau5) - { - return true; - } - } +//------------------------------------------------------------------------------------- +// Name: UpdateTime() +// Desc: Updates the elapsed time since our last frame. +//------------------------------------------------------------------------------------- +void CMinecraftApp::UpdateTime() { + LARGE_INTEGER qwNewTime; + LARGE_INTEGER qwDeltaTime; - return false; + QueryPerformanceCounter(&qwNewTime); + qwDeltaTime.QuadPart = qwNewTime.QuadPart - m_Time.qwTime.QuadPart; + + m_Time.qwAppTime.QuadPart += qwDeltaTime.QuadPart; + m_Time.qwTime.QuadPart = qwNewTime.QuadPart; + + m_Time.fElapsedTime = + m_Time.fSecsPerTick * static_cast(qwDeltaTime.QuadPart); + m_Time.fAppTime = + m_Time.fSecsPerTick * static_cast(m_Time.qwAppTime.QuadPart); } -void CMinecraftApp::AddMemoryTextureFile(const std::wstring &wName, std::uint8_t *pbData, unsigned int byteCount) -{ - EnterCriticalSection(&csMemFilesLock); - // check it's not already in - PMEMDATA pData=NULL; - AUTO_VAR(it, m_MEM_Files.find(wName)); - if(it != m_MEM_Files.end()) - { +bool CMinecraftApp::isXuidNotch(PlayerUID xuid) { + if (m_xuidNotch != INVALID_XUID && xuid != INVALID_XUID) { + return ProfileManager.AreXUIDSEqual(xuid, m_xuidNotch); + } + return false; +} + +bool CMinecraftApp::isXuidDeadmau5(PlayerUID xuid) { + AUTO_VAR(it, MojangData.find(xuid)); // 4J Stu - The .at and [] accessors + // insert elements if they don't exist + if (it != MojangData.end()) { + MOJANG_DATA* pMojangData = MojangData[xuid]; + if (pMojangData && pMojangData->eXuid == eXUID_Deadmau5) { + return true; + } + } + + return false; +} + +void CMinecraftApp::AddMemoryTextureFile(const std::wstring& wName, + std::uint8_t* pbData, + unsigned int byteCount) { + EnterCriticalSection(&csMemFilesLock); + // check it's not already in + PMEMDATA pData = NULL; + AUTO_VAR(it, m_MEM_Files.find(wName)); + if (it != m_MEM_Files.end()) { #ifndef _CONTENT_PACKAGE - wprintf(L"Incrementing the memory texture file count for %ls\n", wName.c_str()); + wprintf(L"Incrementing the memory texture file count for %ls\n", + wName.c_str()); #endif - pData = (*it).second; + pData = (*it).second; - if(pData->byteCount == 0 && byteCount != 0) - { - // This should never be NULL if byteCount is 0 - if(pData->pbData!=NULL) delete [] pData->pbData; + if (pData->byteCount == 0 && byteCount != 0) { + // This should never be NULL if dwBytes is 0 + if (pData->pbData != NULL) delete[] pData->pbData; - pData->pbData=pbData; - pData->byteCount=byteCount; - } + pData->pbData = pbData; + pData->byteCount = byteCount; + } - ++pData->ucRefCount; - LeaveCriticalSection(&csMemFilesLock); - return; - } + ++pData->ucRefCount; + LeaveCriticalSection(&csMemFilesLock); + return; + } #ifndef _CONTENT_PACKAGE - //wprintf(L"Adding the memory texture file data for %ls\n", wName.c_str()); + // wprintf(L"Adding the memory texture file data for %ls\n", wName.c_str()); #endif - // this is a texture (png) file + // this is a texture (png) file - // add this texture to the list of memory texture files - it will then be picked up by the level renderer's AddEntity + // add this texture to the list of memory texture files - it will then be + // picked up by the level renderer's AddEntity - pData = new MEMDATA(); - pData->pbData=pbData; - pData->byteCount=byteCount; - pData->ucRefCount = 1; + pData = new MEMDATA(); + pData->pbData = pbData; + pData->byteCount = byteCount; + pData->ucRefCount = 1; - // use the xuid to access the skin data - m_MEM_Files[wName]=pData; + // use the xuid to access the skin data + m_MEM_Files[wName] = pData; - LeaveCriticalSection(&csMemFilesLock); + LeaveCriticalSection(&csMemFilesLock); } -void CMinecraftApp::RemoveMemoryTextureFile(const std::wstring &wName) -{ - EnterCriticalSection(&csMemFilesLock); - - AUTO_VAR(it, m_MEM_Files.find(wName)); - if(it != m_MEM_Files.end()) - { +void CMinecraftApp::RemoveMemoryTextureFile(const std::wstring& wName) { + EnterCriticalSection(&csMemFilesLock); + + AUTO_VAR(it, m_MEM_Files.find(wName)); + if (it != m_MEM_Files.end()) { #ifndef _CONTENT_PACKAGE - wprintf(L"Decrementing the memory texture file count for %ls\n", wName.c_str()); + wprintf(L"Decrementing the memory texture file count for %ls\n", + wName.c_str()); #endif - PMEMDATA pData = (*it).second; - --pData->ucRefCount; - if(pData->ucRefCount <= 0) - { + PMEMDATA pData = (*it).second; + --pData->ucRefCount; + if (pData->ucRefCount <= 0) { #ifndef _CONTENT_PACKAGE - wprintf(L"Erasing the memory texture file data for %ls\n", wName.c_str()); + wprintf(L"Erasing the memory texture file data for %ls\n", + wName.c_str()); #endif - delete pData; - m_MEM_Files.erase(wName); - } - } - LeaveCriticalSection(&csMemFilesLock); + delete pData; + m_MEM_Files.erase(wName); + } + } + LeaveCriticalSection(&csMemFilesLock); } -bool CMinecraftApp::DefaultCapeExists() -{ - std::wstring wTex=L"Special_Cape.png"; - bool val = false; +bool CMinecraftApp::DefaultCapeExists() { + std::wstring wTex = L"Special_Cape.png"; + bool val = false; - EnterCriticalSection(&csMemFilesLock); - AUTO_VAR(it, m_MEM_Files.find(wTex)); - if(it != m_MEM_Files.end()) val = true; - LeaveCriticalSection(&csMemFilesLock); + EnterCriticalSection(&csMemFilesLock); + AUTO_VAR(it, m_MEM_Files.find(wTex)); + if (it != m_MEM_Files.end()) val = true; + LeaveCriticalSection(&csMemFilesLock); - return val; + return val; } -bool CMinecraftApp::IsFileInMemoryTextures(const std::wstring &wName) -{ - bool val = false; +bool CMinecraftApp::IsFileInMemoryTextures(const std::wstring& wName) { + bool val = false; - EnterCriticalSection(&csMemFilesLock); - AUTO_VAR(it, m_MEM_Files.find(wName)); - if(it != m_MEM_Files.end()) val = true; - LeaveCriticalSection(&csMemFilesLock); + EnterCriticalSection(&csMemFilesLock); + AUTO_VAR(it, m_MEM_Files.find(wName)); + if (it != m_MEM_Files.end()) val = true; + LeaveCriticalSection(&csMemFilesLock); - return val; + return val; } -void CMinecraftApp::GetMemFileDetails(const std::wstring &wName, std::uint8_t **ppbData, unsigned int *pByteCount) -{ - EnterCriticalSection(&csMemFilesLock); - AUTO_VAR(it, m_MEM_Files.find(wName)); - if(it != m_MEM_Files.end()) - { - PMEMDATA pData = (*it).second; - *ppbData=pData->pbData; - *pByteCount=pData->byteCount; - } - LeaveCriticalSection(&csMemFilesLock); +void CMinecraftApp::GetMemFileDetails(const std::wstring& wName, + std::uint8_t** ppbData, + unsigned int* pByteCount) { + EnterCriticalSection(&csMemFilesLock); + AUTO_VAR(it, m_MEM_Files.find(wName)); + if (it != m_MEM_Files.end()) { + PMEMDATA pData = (*it).second; + *ppbData = pData->pbData; + *pByteCount = pData->byteCount; + } + LeaveCriticalSection(&csMemFilesLock); } -void CMinecraftApp::AddMemoryTPDFile(int iConfig, std::uint8_t *pbData, unsigned int byteCount) -{ - EnterCriticalSection(&csMemTPDLock); - // check it's not already in - PMEMDATA pData=NULL; - AUTO_VAR(it, m_MEM_TPD.find(iConfig)); - if(it == m_MEM_TPD.end()) - { - pData = new MEMDATA(); - pData->pbData=pbData; - pData->byteCount=byteCount; - pData->ucRefCount = 1; +void CMinecraftApp::AddMemoryTPDFile(int iConfig, std::uint8_t* pbData, + unsigned int byteCount) { + EnterCriticalSection(&csMemTPDLock); + // check it's not already in + PMEMDATA pData = NULL; + AUTO_VAR(it, m_MEM_TPD.find(iConfig)); + if (it == m_MEM_TPD.end()) { + pData = new MEMDATA(); + pData->pbData = pbData; + pData->byteCount = byteCount; + pData->ucRefCount = 1; - m_MEM_TPD[iConfig]=pData; - } + m_MEM_TPD[iConfig] = pData; + } - LeaveCriticalSection(&csMemTPDLock); + LeaveCriticalSection(&csMemTPDLock); } -void CMinecraftApp::RemoveMemoryTPDFile(int iConfig) -{ - EnterCriticalSection(&csMemTPDLock); - // check it's not already in - PMEMDATA pData=NULL; - AUTO_VAR(it, m_MEM_TPD.find(iConfig)); - if(it != m_MEM_TPD.end()) - { - pData=m_MEM_TPD[iConfig]; - delete pData; - m_MEM_TPD.erase(iConfig); - } +void CMinecraftApp::RemoveMemoryTPDFile(int iConfig) { + EnterCriticalSection(&csMemTPDLock); + // check it's not already in + PMEMDATA pData = NULL; + AUTO_VAR(it, m_MEM_TPD.find(iConfig)); + if (it != m_MEM_TPD.end()) { + pData = m_MEM_TPD[iConfig]; + delete pData; + m_MEM_TPD.erase(iConfig); + } - LeaveCriticalSection(&csMemTPDLock); + LeaveCriticalSection(&csMemTPDLock); } #ifdef _XBOX -int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile) -{ - DLC_INFO *pDLCInfo=NULL; - // run through the DLC info to find the right texture pack/mash-up pack - for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i) - { - ULONGLONG ull=app.GetDLCInfoTexturesFullOffer(i); - pDLCInfo=app.GetDLCInfoForFullOfferID(ull); +int CMinecraftApp::GetTPConfigVal(WCHAR* pwchDataFile) { + DLC_INFO* pDLCInfo = NULL; + // run through the DLC info to find the right texture pack/mash-up pack + for (unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i) { + ULONGLONG ull = app.GetDLCInfoTexturesFullOffer(i); + pDLCInfo = app.GetDLCInfoForFullOfferID(ull); - if(wcscmp(pwchDataFile,pDLCInfo->wchDataFile)==0) - { - return pDLCInfo->iConfig; - } - } + if (wcscmp(pwchDataFile, pDLCInfo->wchDataFile) == 0) { + return pDLCInfo->iConfig; + } + } - return -1; + return -1; } #elif defined _XBOX_ONE -int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile) -{ - DLC_INFO *pDLCInfo=NULL; - // run through the DLC info to find the right texture pack/mash-up pack - for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i) - { - pDLCInfo=app.GetDLCInfoForFullOfferID((WCHAR *)app.GetDLCInfoTexturesFullOffer(i).c_str()); +int CMinecraftApp::GetTPConfigVal(WCHAR* pwchDataFile) { + DLC_INFO* pDLCInfo = NULL; + // run through the DLC info to find the right texture pack/mash-up pack + for (unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i) { + pDLCInfo = app.GetDLCInfoForFullOfferID( + (WCHAR*)app.GetDLCInfoTexturesFullOffer(i).c_str()); - if(wcscmp(pwchDataFile,pDLCInfo->wchDataFile)==0) - { - return pDLCInfo->iConfig; - } - } + if (wcscmp(pwchDataFile, pDLCInfo->wchDataFile) == 0) { + return pDLCInfo->iConfig; + } + } - return -1; + return -1; } #elif defined _WINDOWS64 -int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile) -{ - return -1; -} +int CMinecraftApp::GetTPConfigVal(WCHAR* pwchDataFile) { return -1; } #endif -bool CMinecraftApp::IsFileInTPD(int iConfig) -{ - bool val = false; +bool CMinecraftApp::IsFileInTPD(int iConfig) { + bool val = false; - EnterCriticalSection(&csMemTPDLock); - AUTO_VAR(it, m_MEM_TPD.find(iConfig)); - if(it != m_MEM_TPD.end()) val = true; - LeaveCriticalSection(&csMemTPDLock); + EnterCriticalSection(&csMemTPDLock); + AUTO_VAR(it, m_MEM_TPD.find(iConfig)); + if (it != m_MEM_TPD.end()) val = true; + LeaveCriticalSection(&csMemTPDLock); - return val; + return val; } -void CMinecraftApp::GetTPD(int iConfig, std::uint8_t **ppbData, unsigned int *pByteCount) -{ - EnterCriticalSection(&csMemTPDLock); - AUTO_VAR(it, m_MEM_TPD.find(iConfig)); - if(it != m_MEM_TPD.end()) - { - PMEMDATA pData = (*it).second; - *ppbData=pData->pbData; - *pByteCount=pData->byteCount; - } - LeaveCriticalSection(&csMemTPDLock); +void CMinecraftApp::GetTPD(int iConfig, std::uint8_t** ppbData, + unsigned int* pByteCount) { + EnterCriticalSection(&csMemTPDLock); + AUTO_VAR(it, m_MEM_TPD.find(iConfig)); + if (it != m_MEM_TPD.end()) { + PMEMDATA pData = (*it).second; + *ppbData = pData->pbData; + *pByteCount = pData->byteCount; + } + LeaveCriticalSection(&csMemTPDLock); } - -// bool CMinecraftApp::UploadFileToGlobalStorage(int iQuadrant, C4JStorage::eGlobalStorage eStorageFacility, std::wstring *wsFile ) +// bool CMinecraftApp::UploadFileToGlobalStorage(int iQuadrant, +// C4JStorage::eGlobalStorage eStorageFacility, std::wstring *wsFile ) // { // bool bRes=false; // #ifndef _CONTENT_PACKAGE // // read the local file // File gtsFile( wsFile->c_str() ); -// -// __int64 fileSize = gtsFile.length(); -// +// +// int64_t fileSize = gtsFile.length(); +// // if(fileSize!=0) // { // FileInputStream fis(gtsFile); // byteArray ba((int)fileSize); // fis.read(ba); // fis.close(); -// -// bRes=StorageManager.WriteTMSFile(iQuadrant,eStorageFacility,(WCHAR *)wsFile->c_str(),ba.data, ba.length); -// +// +// bRes=StorageManager.WriteTMSFile(iQuadrant,eStorageFacility,(WCHAR +// *)wsFile->c_str(),ba.data, ba.length); +// // } // #endif // return bRes; // } +void CMinecraftApp::StoreLaunchData() {} - - - - -void CMinecraftApp::StoreLaunchData() -{ - -} - -void CMinecraftApp::ExitGame() -{ -} +void CMinecraftApp::ExitGame() {} // Invites -void CMinecraftApp::ProcessInvite(std::uint32_t dwUserIndex, std::uint32_t dwLocalUsersMask, const INVITE_INFO * pInviteInfo) -{ - m_InviteData.dwUserIndex=dwUserIndex; - m_InviteData.dwLocalUsersMask=dwLocalUsersMask; - m_InviteData.pInviteInfo=pInviteInfo; - //memcpy(&m_InviteData,pJoinData,sizeof(JoinFromInviteData)); - SetAction(dwUserIndex,eAppAction_ExitAndJoinFromInvite); +void CMinecraftApp::ProcessInvite(std::uint32_t dwUserIndex, + std::uint32_t dwLocalUsersMask, + const INVITE_INFO* pInviteInfo) { + m_InviteData.dwUserIndex = dwUserIndex; + m_InviteData.dwLocalUsersMask = dwLocalUsersMask; + m_InviteData.pInviteInfo = pInviteInfo; + // memcpy(&m_InviteData,pJoinData,sizeof(JoinFromInviteData)); + SetAction(dwUserIndex, eAppAction_ExitAndJoinFromInvite); } -int CMinecraftApp::ExitAndJoinFromInvite(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - CMinecraftApp* pApp = (CMinecraftApp*)pParam; - //Minecraft *pMinecraft=Minecraft::GetInstance(); +int CMinecraftApp::ExitAndJoinFromInvite(void* pParam, int iPad, + C4JStorage::EMessageResult result) { + CMinecraftApp* pApp = (CMinecraftApp*)pParam; + // Minecraft *pMinecraft=Minecraft::GetInstance(); - // buttons are swapped on this menu - if(result==C4JStorage::EMessage_ResultDecline) - { - pApp->SetAction(iPad,eAppAction_ExitAndJoinFromInviteConfirmed); - } + // buttons are swapped on this menu + if (result == C4JStorage::EMessage_ResultDecline) { + pApp->SetAction(iPad, eAppAction_ExitAndJoinFromInviteConfirmed); + } - return 0; + return 0; } -int CMinecraftApp::ExitAndJoinFromInviteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - CMinecraftApp *pClass = (CMinecraftApp *)pParam; - // Exit with or without saving - // Decline means save in this dialog - if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultThirdOption) - { - if( result==C4JStorage::EMessage_ResultDecline ) // Save - { - // Check they have the full texture pack if they are using one - // 4J-PB - Is the player trying to save but they are using a trial texturepack ? - if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) - { - TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); +int CMinecraftApp::ExitAndJoinFromInviteSaveDialogReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + CMinecraftApp* pClass = (CMinecraftApp*)pParam; + // Exit with or without saving + // Decline means save in this dialog + if (result == C4JStorage::EMessage_ResultDecline || + result == C4JStorage::EMessage_ResultThirdOption) { + if (result == C4JStorage::EMessage_ResultDecline) // Save + { + // Check they have the full texture pack if they are using one + // 4J-PB - Is the player trying to save but they are using a trial + // texturepack ? + if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { + TexturePack* tPack = + Minecraft::GetInstance()->skins->getSelected(); - DLCPack * pDLCPack=tPack->getDLCPack(); - if(!pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" )) - { - // upsell - // get the dlc texture pack + DLCPack* pDLCPack = tPack->getDLCPack(); + if (!pDLCPack->hasPurchasedFile(DLCManager::e_DLCType_Texture, + L"")) { + // upsell + // get the dlc texture pack #ifdef _XBOX - DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; - ULONGLONG ullOfferID_Full; - app.GetDLCFullOfferIDForPackID(pDLCTexPack->getDLCParentPackId(),&ullOfferID_Full); + DLCTexturePack* pDLCTexPack = (DLCTexturePack*)tPack; + ULONGLONG ullOfferID_Full; + app.GetDLCFullOfferIDForPackID( + pDLCTexPack->getDLCParentPackId(), &ullOfferID_Full); - // tell sentient about the upsell of the full version of the skin pack - TelemetryManager->RecordUpsellPresented(iPad, eSet_UpsellID_Texture_DLC, ullOfferID_Full & 0xFFFFFFFF); + // tell sentient about the upsell of the full version of the + // skin pack + TelemetryManager->RecordUpsellPresented( + iPad, eSet_UpsellID_Texture_DLC, + ullOfferID_Full & 0xFFFFFFFF); #endif - unsigned int uiIDA[2]; - uiIDA[0]=IDS_CONFIRM_OK; - uiIDA[1]=IDS_CONFIRM_CANCEL; + unsigned int uiIDA[2]; + uiIDA[0] = IDS_CONFIRM_OK; + uiIDA[1] = IDS_CONFIRM_CANCEL; - // Give the player a warning about the trial version of the texture pack - ui.RequestMessageBox(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad,&CMinecraftApp::WarningTrialTexturePackReturned,pClass,app.GetStringTable()); + // Give the player a warning about the trial version of the + // texture pack + ui.RequestErrorMessage( + IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, + IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad, + &CMinecraftApp::WarningTrialTexturePackReturned, + pClass); - return 0; - } - } + return S_OK; + } + } #ifndef _XBOX_ONE - // does the save exist? - bool bSaveExists; - StorageManager.DoesSaveExist(&bSaveExists); - // 4J-PB - we check if the save exists inside the libs - // we need to ask if they are sure they want to overwrite the existing game - if(bSaveExists) - { - unsigned int uiIDA[2]; - uiIDA[0]=IDS_CONFIRM_CANCEL; - uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CMinecraftApp::ExitAndJoinFromInviteAndSaveReturned,pClass, app.GetStringTable()); - return 0; - } - else + // does the save exist? + bool bSaveExists; + StorageManager.DoesSaveExist(&bSaveExists); + // 4J-PB - we check if the save exists inside the libs + // we need to ask if they are sure they want to overwrite the + // existing game + if (bSaveExists) { + unsigned int uiIDA[2]; + uiIDA[0] = IDS_CONFIRM_CANCEL; + uiIDA[1] = IDS_CONFIRM_OK; + ui.RequestErrorMessage( + IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, + ProfileManager.GetPrimaryPad(), + &CMinecraftApp::ExitAndJoinFromInviteAndSaveReturned, + pClass); + return 0; + } else #endif - { + { #if defined(_XBOX_ONE) || defined(__ORBIS__) - StorageManager.SetSaveDisabled(false); + StorageManager.SetSaveDisabled(false); #endif - MinecraftServer::getInstance()->setSaveOnExit( true ); - } + MinecraftServer::getInstance()->setSaveOnExit(true); + } + } else { + // been a few requests for a confirm on exit without saving + unsigned int uiIDA[2]; + uiIDA[0] = IDS_CONFIRM_CANCEL; + uiIDA[1] = IDS_CONFIRM_OK; + ui.RequestErrorMessage( + IDS_TITLE_DECLINE_SAVE_GAME, IDS_CONFIRM_DECLINE_SAVE_GAME, + uiIDA, 2, ProfileManager.GetPrimaryPad(), + &CMinecraftApp::ExitAndJoinFromInviteDeclineSaveReturned, + pClass); + return 0; + } + + app.SetAction(ProfileManager.GetPrimaryPad(), + eAppAction_ExitAndJoinFromInviteConfirmed); + } + return 0; +} + +int CMinecraftApp::WarningTrialTexturePackReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + // 4J Stu - I added this in when fixing an X1 bug. We should probably add + // this as well but I don't have time to test all platforms atm +#if 0 // defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) + if(result==C4JStorage::EMessage_ResultAccept) + { + if(!ProfileManager.IsSignedInLive(iPad)) + { + // you're not signed in to PSN! + } else { - // been a few requests for a confirm on exit without saving - unsigned int uiIDA[2]; - uiIDA[0]=IDS_CONFIRM_CANCEL; - uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_TITLE_DECLINE_SAVE_GAME, IDS_CONFIRM_DECLINE_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CMinecraftApp::ExitAndJoinFromInviteDeclineSaveReturned,pClass, app.GetStringTable()); - return 0; - } - - app.SetAction(ProfileManager.GetPrimaryPad(),eAppAction_ExitAndJoinFromInviteConfirmed); - } - return 0; -} - -int CMinecraftApp::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ -#ifdef _XBOX - - CMinecraftApp* pClass = (CMinecraftApp*)pParam; - - TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); - // get the dlc texture pack - DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; - ULONGLONG ullIndexA[1]; - - // 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]); - - if(result==C4JStorage::EMessage_ResultAccept) - { - if(ProfileManager.IsSignedIn(iPad)) - { - // need to allow downloads here, or the player would need to quit the game to let the download of a texture pack happen. This might affect the network traffic, since the download could take all the bandwidth... - XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); - - StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); - } - } - else - { - TelemetryManager->RecordUpsellResponded(iPad, eSet_UpsellID_Texture_DLC, ( ullIndexA[0] & 0xFFFFFFFF ), eSen_UpsellOutcome_Declined); - } -#endif - return 0; -} - -int CMinecraftApp::ExitAndJoinFromInviteAndSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - //CMinecraftApp* pClass = (CMinecraftApp*)pParam; - - // results switched for this dialog - if(result==C4JStorage::EMessage_ResultDecline) - { - int saveOrCheckpointId = 0; - - // Check they have the full texture pack if they are using one - // 4J-PB - Is the player trying to save but they are using a trial texturepack ? - if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) - { - TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); - - DLCPack * pDLCPack=tPack->getDLCPack(); - if(!pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" )) - { - // upsell - // get the dlc texture pack - -#ifdef _XBOX - DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; - ULONGLONG ullOfferID_Full; - app.GetDLCFullOfferIDForPackID(pDLCTexPack->getDLCParentPackId(),&ullOfferID_Full); - - // tell sentient about the upsell of the full version of the skin pack - TelemetryManager->RecordUpsellPresented(iPad, eSet_UpsellID_Texture_DLC, ullOfferID_Full & 0xFFFFFFFF); -#endif - - unsigned int uiIDA[2]; + // 4J-PB - need to check this user can access the store + bool bContentRestricted; + ProfileManager.GetChatAndContentRestrictions(iPad,true,NULL,&bContentRestricted,NULL); + if(bContentRestricted) + { + unsigned int uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - uiIDA[1]=IDS_CONFIRM_CANCEL; + ui.RequestAlertMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad); + } + else + { + // need to get info on the pack to see if the user has already downloaded it + TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); + DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; - // Give the player a warning about the trial version of the texture pack - ui.RequestMessageBox(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad,&CMinecraftApp::WarningTrialTexturePackReturned,NULL,app.GetStringTable()); + // retrieve the store name for the skin pack + DLCPack *pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack(); + const char *pchPackName=wstringtofilename(pDLCPack->getName()); + app.DebugPrintf("Texture Pack - %s\n",pchPackName); + SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo((char *)pchPackName); - return 0; + if(pSONYDLCInfo!=NULL) + { + char chName[42]; + char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; + + memset(chSkuID,0,SCE_NP_COMMERCE2_SKU_ID_LEN); + // find the info on the skin pack + // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. + // So we assume the first sku for the product is the one we want +#ifdef __ORBIS__ + sprintf(chName,"%s",pSONYDLCInfo->chDLCKeyname); +#else + sprintf(chName,"%s-%s",app.GetCommerceCategory(),pSONYDLCInfo->chDLCKeyname); +#endif + app.GetDLCSkuIDFromProductList(chName,chSkuID); + // 4J-PB - need to check for an empty store +#if defined __ORBIS__ || defined __PSVITA__ || defined __PS3__ + if(app.CheckForEmptyStore(iPad)==false) +#endif + { + if(app.DLCAlreadyPurchased(chSkuID)) + { + app.DownloadAlreadyPurchased(chSkuID); + } + else + { + app.Checkout(chSkuID); + } + } + } } } - //bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); - //SentientManager.RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), saveOrCheckpointId); - MinecraftServer::getInstance()->setSaveOnExit( true ); - // flag a app action of exit and join game from invite - app.SetAction(iPad,eAppAction_ExitAndJoinFromInviteConfirmed); } - return 0; +#endif // + +#ifdef _XBOX_ONE + if (result == C4JStorage::EMessage_ResultAccept) { + if (ProfileManager.IsSignedIn(iPad)) { + if (ProfileManager.IsSignedInLive(iPad)) { + TexturePack* tPack = + Minecraft::GetInstance()->skins->getSelected(); + // get the dlc texture pack + DLCTexturePack* pDLCTexPack = (DLCTexturePack*)tPack; + + DLCPack* pDLCPack = pDLCTexPack->getDLCInfoParentPack(); + + DLC_INFO* pDLCInfo = app.GetDLCInfoForProductName( + (WCHAR*)pDLCPack->getName().c_str()); + + StorageManager.InstallOffer( + 1, (WCHAR*)pDLCInfo->wsProductId.c_str(), NULL, NULL); + + // the license change coming in when the offer has been + // installed will cause this scene to refresh + } else { + // 4J-JEV: Fix for XB1: #165863 - XR-074: Compliance: With no + // active network connection user is unable to convert from + // Trial to Full texture pack and is not messaged why. + unsigned int uiIDA[1] = {IDS_CONFIRM_OK}; + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, + IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, + iPad); + } + } + } + +#endif +#ifdef _XBOX + + CMinecraftApp* pClass = (CMinecraftApp*)pParam; + + TexturePack* tPack = Minecraft::GetInstance()->skins->getSelected(); + // get the dlc texture pack + DLCTexturePack* pDLCTexPack = (DLCTexturePack*)tPack; + ULONGLONG ullIndexA[1]; + + // 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]); + + if (result == C4JStorage::EMessage_ResultAccept) { + if (ProfileManager.IsSignedIn(iPad)) { + // need to allow downloads here, or the player would need to quit + // the game to let the download of a texture pack happen. This might + // affect the network traffic, since the download could take all the + // bandwidth... + XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); + + StorageManager.InstallOffer(1, ullIndexA, NULL, NULL); + } + } else { + TelemetryManager->RecordUpsellResponded(iPad, eSet_UpsellID_Texture_DLC, + (ullIndexA[0] & 0xFFFFFFFF), + eSen_UpsellOutcome_Declined); + } +#endif + return 0; } -int CMinecraftApp::ExitAndJoinFromInviteDeclineSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - // results switched for this dialog - if(result==C4JStorage::EMessage_ResultDecline) - { -#if defined(_XBOX_ONE) || defined(__ORBIS__) - StorageManager.SetSaveDisabled(false); +int CMinecraftApp::ExitAndJoinFromInviteAndSaveReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + // CMinecraftApp* pClass = (CMinecraftApp*)pParam; + + // results switched for this dialog + if (result == C4JStorage::EMessage_ResultDecline) { + int saveOrCheckpointId = 0; + + // Check they have the full texture pack if they are using one + // 4J-PB - Is the player trying to save but they are using a trial + // texturepack ? + if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { + TexturePack* tPack = Minecraft::GetInstance()->skins->getSelected(); + + DLCPack* pDLCPack = tPack->getDLCPack(); + if (!pDLCPack->hasPurchasedFile(DLCManager::e_DLCType_Texture, + L"")) { + // upsell + // get the dlc texture pack + +#ifdef _XBOX + DLCTexturePack* pDLCTexPack = (DLCTexturePack*)tPack; + ULONGLONG ullOfferID_Full; + app.GetDLCFullOfferIDForPackID( + pDLCTexPack->getDLCParentPackId(), &ullOfferID_Full); + + // tell sentient about the upsell of the full version of the + // skin pack + TelemetryManager->RecordUpsellPresented( + iPad, eSet_UpsellID_Texture_DLC, + ullOfferID_Full & 0xFFFFFFFF); #endif - MinecraftServer::getInstance()->setSaveOnExit( false ); - // flag a app action of exit and join game from invite - app.SetAction(iPad,eAppAction_ExitAndJoinFromInviteConfirmed); - } - return 0; + + unsigned int uiIDA[2]; + uiIDA[0] = IDS_CONFIRM_OK; + uiIDA[1] = IDS_CONFIRM_CANCEL; + + // Give the player a warning about the trial version of the + // texture pack + ui.RequestErrorMessage( + IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, + IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad, + &CMinecraftApp::WarningTrialTexturePackReturned, NULL); + + return S_OK; + } + } + // bool validSave = + // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); + // SentientManager.RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), + // saveOrCheckpointId); + MinecraftServer::getInstance()->setSaveOnExit(true); + // flag a app action of exit and join game from invite + app.SetAction(iPad, eAppAction_ExitAndJoinFromInviteConfirmed); + } + return 0; +} + +int CMinecraftApp::ExitAndJoinFromInviteDeclineSaveReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + // results switched for this dialog + if (result == C4JStorage::EMessage_ResultDecline) { +#if defined(_XBOX_ONE) || defined(__ORBIS__) + StorageManager.SetSaveDisabled(false); +#endif + MinecraftServer::getInstance()->setSaveOnExit(false); + // flag a app action of exit and join game from invite + app.SetAction(iPad, eAppAction_ExitAndJoinFromInviteConfirmed); + } + return 0; } ////////////////////////////////////////////////////////////////////////// @@ -5779,3680 +6515,3734 @@ int CMinecraftApp::ExitAndJoinFromInviteDeclineSaveReturned(void *pParam,int iPa // We have to assume that we've not been able to load the text for the game. // ////////////////////////////////////////////////////////////////////////// -void CMinecraftApp::FatalLoadError() -{ +void CMinecraftApp::FatalLoadError() {} -} - -TIPSTRUCT CMinecraftApp::m_GameTipA[MAX_TIPS_GAMETIP]= -{ - { 0, IDS_TIPS_GAMETIP_1}, - { 0, IDS_TIPS_GAMETIP_2}, - { 0, IDS_TIPS_GAMETIP_3}, - { 0, IDS_TIPS_GAMETIP_4}, - { 0, IDS_TIPS_GAMETIP_5}, - { 0, IDS_TIPS_GAMETIP_6}, - { 0, IDS_TIPS_GAMETIP_7}, - { 0, IDS_TIPS_GAMETIP_8}, - { 0, IDS_TIPS_GAMETIP_9}, - { 0, IDS_TIPS_GAMETIP_10}, - { 0, IDS_TIPS_GAMETIP_11}, - { 0, IDS_TIPS_GAMETIP_12}, - { 0, IDS_TIPS_GAMETIP_13}, - { 0, IDS_TIPS_GAMETIP_14}, - { 0, IDS_TIPS_GAMETIP_15}, - { 0, IDS_TIPS_GAMETIP_16}, - { 0, IDS_TIPS_GAMETIP_17}, - { 0, IDS_TIPS_GAMETIP_18}, - { 0, IDS_TIPS_GAMETIP_19}, - { 0, IDS_TIPS_GAMETIP_20}, - { 0, IDS_TIPS_GAMETIP_21}, - { 0, IDS_TIPS_GAMETIP_22}, - { 0, IDS_TIPS_GAMETIP_23}, - { 0, IDS_TIPS_GAMETIP_24}, - { 0, IDS_TIPS_GAMETIP_25}, - { 0, IDS_TIPS_GAMETIP_26}, - { 0, IDS_TIPS_GAMETIP_27}, - { 0, IDS_TIPS_GAMETIP_28}, - { 0, IDS_TIPS_GAMETIP_29}, - { 0, IDS_TIPS_GAMETIP_30}, - { 0, IDS_TIPS_GAMETIP_31}, - { 0, IDS_TIPS_GAMETIP_32}, - { 0, IDS_TIPS_GAMETIP_33}, - { 0, IDS_TIPS_GAMETIP_34}, - { 0, IDS_TIPS_GAMETIP_35}, - { 0, IDS_TIPS_GAMETIP_36}, - { 0, IDS_TIPS_GAMETIP_37}, - { 0, IDS_TIPS_GAMETIP_38}, - { 0, IDS_TIPS_GAMETIP_39}, - { 0, IDS_TIPS_GAMETIP_40}, - { 0, IDS_TIPS_GAMETIP_41}, - { 0, IDS_TIPS_GAMETIP_42}, - { 0, IDS_TIPS_GAMETIP_43}, - { 0, IDS_TIPS_GAMETIP_44}, - { 0, IDS_TIPS_GAMETIP_45}, - { 0, IDS_TIPS_GAMETIP_46}, - { 0, IDS_TIPS_GAMETIP_47}, - { 0, IDS_TIPS_GAMETIP_48}, - { 0, IDS_TIPS_GAMETIP_49}, - { 0, IDS_TIPS_GAMETIP_50}, +TIPSTRUCT CMinecraftApp::m_GameTipA[MAX_TIPS_GAMETIP] = { + {0, IDS_TIPS_GAMETIP_1}, {0, IDS_TIPS_GAMETIP_2}, + {0, IDS_TIPS_GAMETIP_3}, {0, IDS_TIPS_GAMETIP_4}, + {0, IDS_TIPS_GAMETIP_5}, {0, IDS_TIPS_GAMETIP_6}, + {0, IDS_TIPS_GAMETIP_7}, {0, IDS_TIPS_GAMETIP_8}, + {0, IDS_TIPS_GAMETIP_9}, {0, IDS_TIPS_GAMETIP_10}, + {0, IDS_TIPS_GAMETIP_11}, {0, IDS_TIPS_GAMETIP_12}, + {0, IDS_TIPS_GAMETIP_13}, {0, IDS_TIPS_GAMETIP_14}, + {0, IDS_TIPS_GAMETIP_15}, {0, IDS_TIPS_GAMETIP_16}, + {0, IDS_TIPS_GAMETIP_17}, {0, IDS_TIPS_GAMETIP_18}, + {0, IDS_TIPS_GAMETIP_19}, {0, IDS_TIPS_GAMETIP_20}, + {0, IDS_TIPS_GAMETIP_21}, {0, IDS_TIPS_GAMETIP_22}, + {0, IDS_TIPS_GAMETIP_23}, {0, IDS_TIPS_GAMETIP_24}, + {0, IDS_TIPS_GAMETIP_25}, {0, IDS_TIPS_GAMETIP_26}, + {0, IDS_TIPS_GAMETIP_27}, {0, IDS_TIPS_GAMETIP_28}, + {0, IDS_TIPS_GAMETIP_29}, {0, IDS_TIPS_GAMETIP_30}, + {0, IDS_TIPS_GAMETIP_31}, {0, IDS_TIPS_GAMETIP_32}, + {0, IDS_TIPS_GAMETIP_33}, {0, IDS_TIPS_GAMETIP_34}, + {0, IDS_TIPS_GAMETIP_35}, {0, IDS_TIPS_GAMETIP_36}, + {0, IDS_TIPS_GAMETIP_37}, {0, IDS_TIPS_GAMETIP_38}, + {0, IDS_TIPS_GAMETIP_39}, {0, IDS_TIPS_GAMETIP_40}, + {0, IDS_TIPS_GAMETIP_41}, {0, IDS_TIPS_GAMETIP_42}, + {0, IDS_TIPS_GAMETIP_43}, {0, IDS_TIPS_GAMETIP_44}, + {0, IDS_TIPS_GAMETIP_45}, {0, IDS_TIPS_GAMETIP_46}, + {0, IDS_TIPS_GAMETIP_47}, {0, IDS_TIPS_GAMETIP_48}, + {0, IDS_TIPS_GAMETIP_49}, {0, IDS_TIPS_GAMETIP_50}, }; -TIPSTRUCT CMinecraftApp::m_TriviaTipA[MAX_TIPS_TRIVIATIP]= -{ - { 0, IDS_TIPS_TRIVIA_1}, - { 0, IDS_TIPS_TRIVIA_2}, - { 0, IDS_TIPS_TRIVIA_3}, - { 0, IDS_TIPS_TRIVIA_4}, - { 0, IDS_TIPS_TRIVIA_5}, - { 0, IDS_TIPS_TRIVIA_6}, - { 0, IDS_TIPS_TRIVIA_7}, - { 0, IDS_TIPS_TRIVIA_8}, - { 0, IDS_TIPS_TRIVIA_9}, - { 0, IDS_TIPS_TRIVIA_10}, - { 0, IDS_TIPS_TRIVIA_11}, - { 0, IDS_TIPS_TRIVIA_12}, - { 0, IDS_TIPS_TRIVIA_13}, - { 0, IDS_TIPS_TRIVIA_14}, - { 0, IDS_TIPS_TRIVIA_15}, - { 0, IDS_TIPS_TRIVIA_16}, - { 0, IDS_TIPS_TRIVIA_17}, - { 0, IDS_TIPS_TRIVIA_18}, - { 0, IDS_TIPS_TRIVIA_19}, - { 0, IDS_TIPS_TRIVIA_20}, +TIPSTRUCT CMinecraftApp::m_TriviaTipA[MAX_TIPS_TRIVIATIP] = { + {0, IDS_TIPS_TRIVIA_1}, {0, IDS_TIPS_TRIVIA_2}, {0, IDS_TIPS_TRIVIA_3}, + {0, IDS_TIPS_TRIVIA_4}, {0, IDS_TIPS_TRIVIA_5}, {0, IDS_TIPS_TRIVIA_6}, + {0, IDS_TIPS_TRIVIA_7}, {0, IDS_TIPS_TRIVIA_8}, {0, IDS_TIPS_TRIVIA_9}, + {0, IDS_TIPS_TRIVIA_10}, {0, IDS_TIPS_TRIVIA_11}, {0, IDS_TIPS_TRIVIA_12}, + {0, IDS_TIPS_TRIVIA_13}, {0, IDS_TIPS_TRIVIA_14}, {0, IDS_TIPS_TRIVIA_15}, + {0, IDS_TIPS_TRIVIA_16}, {0, IDS_TIPS_TRIVIA_17}, {0, IDS_TIPS_TRIVIA_18}, + {0, IDS_TIPS_TRIVIA_19}, {0, IDS_TIPS_TRIVIA_20}, }; -Random *CMinecraftApp::TipRandom = new Random(); +Random* CMinecraftApp::TipRandom = new Random(); -int CMinecraftApp::TipsSortFunction(const void* a, const void* b) -{ - // 4jcraft, scince the sortvalues can be negative, i changed it - // to a three way comparison, - // scince subtracting of signed integers can cause overflow. - - int s1 = ((TIPSTRUCT*)a)->iSortValue; - int s2 = ((TIPSTRUCT*)b)->iSortValue; +int CMinecraftApp::TipsSortFunction(const void* a, const void* b) { + // 4jcraft, scince the sortvalues can be negative, i changed it + // to a three way comparison, + // scince subtracting of signed integers can cause overflow. - if(s1 > s2) { - return 1; + int s1 = ((TIPSTRUCT*)a)->iSortValue; + int s2 = ((TIPSTRUCT*)b)->iSortValue; - } else if (s1 == s2) { - return 0; - } + if (s1 > s2) { + return 1; - return -1; + } else if (s1 == s2) { + return 0; + } + + return -1; } -void CMinecraftApp::InitialiseTips() -{ - // We'll randomise the tips at start up based on their priority +void CMinecraftApp::InitialiseTips() { + // We'll randomise the tips at start up based on their priority - ZeroMemory(m_TipIDA, sizeof(m_TipIDA)); + ZeroMemory(m_TipIDA, sizeof(m_TipIDA)); - // Make the first tip tell you that you can play splitscreen in HD modes if you are in SD - if(!RenderManager.IsHiDef()) - { - m_GameTipA[0].uiStringID=IDS_TIPS_GAMETIP_0; - } - // randomise then quicksort - // going to leave the multiplayer tip so it is always first + // Make the first tip tell you that you can play splitscreen in HD modes if + // you are in SD + if (!RenderManager.IsHiDef()) { + m_GameTipA[0].uiStringID = IDS_TIPS_GAMETIP_0; + } + // randomise then quicksort + // going to leave the multiplayer tip so it is always first -// Only randomise the content package build + // Only randomise the content package build #ifdef _CONTENT_PACKAGE - - for(int i=1;inextInt(); - } - qsort( &m_GameTipA[1], MAX_TIPS_GAMETIP-1, sizeof(TIPSTRUCT), TipsSortFunction ); + + for (int i = 1; i < MAX_TIPS_GAMETIP; i++) { + m_GameTipA[i].iSortValue = TipRandom->nextInt(); + } + qsort(&m_GameTipA[1], MAX_TIPS_GAMETIP - 1, sizeof(TIPSTRUCT), + TipsSortFunction); #endif - for(int i=0;inextInt(); - } - qsort( m_TriviaTipA, MAX_TIPS_TRIVIATIP, sizeof(TIPSTRUCT), TipsSortFunction ); + for (int i = 0; i < MAX_TIPS_TRIVIATIP; i++) { + m_TriviaTipA[i].iSortValue = TipRandom->nextInt(); + } + qsort(m_TriviaTipA, MAX_TIPS_TRIVIATIP, sizeof(TIPSTRUCT), + TipsSortFunction); + int iCurrentGameTip = 0; + int iCurrentTriviaTip = 0; - int iCurrentGameTip=0; - int iCurrentTriviaTip=0; + for (int i = 0; i < MAX_TIPS_GAMETIP + MAX_TIPS_TRIVIATIP; i++) { + // Add a trivia one every third tip (if there are any left) + if ((i % 3 == 2) && (iCurrentTriviaTip < MAX_TIPS_TRIVIATIP)) { + // Add a trivia one + m_TipIDA[i] = m_TriviaTipA[iCurrentTriviaTip++].uiStringID; + } else { + if (iCurrentGameTip < MAX_TIPS_GAMETIP) { + // Add a gametip + m_TipIDA[i] = m_GameTipA[iCurrentGameTip++].uiStringID; + } else { + // Add a trivia one + m_TipIDA[i] = m_TriviaTipA[iCurrentTriviaTip++].uiStringID; + } + } - for(int i=0;iskins->getSelected()->getColourTable()->getColour(colour); +int CMinecraftApp::GetHTMLColour(eMinecraftColour colour) { + Minecraft* pMinecraft = Minecraft::GetInstance(); + return pMinecraft->skins->getSelected()->getColourTable()->getColour( + colour); } -int CMinecraftApp::GetHTMLFontSize(EHTMLFontSize size) -{ - return s_iHTMLFontSizesA[size]; +int CMinecraftApp::GetHTMLFontSize(EHTMLFontSize size) { + return s_iHTMLFontSizesA[size]; } -std::wstring CMinecraftApp::FormatHTMLString(int iPad, const std::wstring &desc, int shadowColour /*= 0xFFFFFFFF*/) -{ - std::wstring text(desc); - - wchar_t replacements[64]; - // We will also insert line breaks here as couldn't figure out how to get them to come through from strings.resx ! - text = replaceAll(text, L"{*B*}", L"
" ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_T1)); - text = replaceAll(text, L"{*T1*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_T2)); - text = replaceAll(text, L"{*T2*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_T3)); - text = replaceAll(text, L"{*T3*}", replacements ); // for How To Play - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_Black)); - text = replaceAll(text, L"{*ETB*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_White)); - text = replaceAll(text, L"{*ETW*}", replacements ); - text = replaceAll(text, L"{*EF*}", L"" ); +std::wstring CMinecraftApp::FormatHTMLString( + int iPad, const std::wstring& desc, int shadowColour /*= 0xFFFFFFFF*/) { + std::wstring text(desc); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_0), shadowColour); - text = replaceAll(text, L"{*C0*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_1), shadowColour); - text = replaceAll(text, L"{*C1*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_2), shadowColour); - text = replaceAll(text, L"{*C2*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_3), shadowColour); - text = replaceAll(text, L"{*C3*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_4), shadowColour); - text = replaceAll(text, L"{*C4*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_5), shadowColour); - text = replaceAll(text, L"{*C5*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_6), shadowColour); - text = replaceAll(text, L"{*C6*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_7), shadowColour); - text = replaceAll(text, L"{*C7*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_8), shadowColour); - text = replaceAll(text, L"{*C8*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_9), shadowColour); - text = replaceAll(text, L"{*C9*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_a), shadowColour); - text = replaceAll(text, L"{*CA*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_b), shadowColour); - text = replaceAll(text, L"{*CB*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_c), shadowColour); - text = replaceAll(text, L"{*CC*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_d), shadowColour); - text = replaceAll(text, L"{*CD*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_e), shadowColour); - text = replaceAll(text, L"{*CE*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_f), shadowColour); - text = replaceAll(text, L"{*CF*}", replacements ); + wchar_t replacements[64]; + // We will also insert line breaks here as couldn't figure out how to get + // them to come through from strings.resx ! + text = replaceAll(text, L"{*B*}", L"
"); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_T1)); + text = replaceAll(text, L"{*T1*}", replacements); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_T2)); + text = replaceAll(text, L"{*T2*}", replacements); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_T3)); + text = replaceAll(text, L"{*T3*}", replacements); // for How To Play + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_Black)); + text = replaceAll(text, L"{*ETB*}", replacements); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_White)); + text = replaceAll(text, L"{*ETW*}", replacements); + text = replaceAll(text, L"{*EF*}", L""); - // Swap for southpaw. - if ( app.GetGameSettings(iPad,eGameSetting_ControlSouthPaw) ) - { - text = replaceAll(text, L"{*CONTROLLER_ACTION_MOVE*}", GetActionReplacement(iPad,MINECRAFT_ACTION_LOOK_RIGHT ) ); - text = replaceAll(text, L"{*CONTROLLER_ACTION_LOOK*}", GetActionReplacement(iPad,MINECRAFT_ACTION_RIGHT ) ); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_0), shadowColour); + text = replaceAll(text, L"{*C0*}", replacements); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_1), shadowColour); + text = replaceAll(text, L"{*C1*}", replacements); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_2), shadowColour); + text = replaceAll(text, L"{*C2*}", replacements); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_3), shadowColour); + text = replaceAll(text, L"{*C3*}", replacements); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_4), shadowColour); + text = replaceAll(text, L"{*C4*}", replacements); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_5), shadowColour); + text = replaceAll(text, L"{*C5*}", replacements); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_6), shadowColour); + text = replaceAll(text, L"{*C6*}", replacements); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_7), shadowColour); + text = replaceAll(text, L"{*C7*}", replacements); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_8), shadowColour); + text = replaceAll(text, L"{*C8*}", replacements); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_9), shadowColour); + text = replaceAll(text, L"{*C9*}", replacements); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_a), shadowColour); + text = replaceAll(text, L"{*CA*}", replacements); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_b), shadowColour); + text = replaceAll(text, L"{*CB*}", replacements); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_c), shadowColour); + text = replaceAll(text, L"{*CC*}", replacements); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_d), shadowColour); + text = replaceAll(text, L"{*CD*}", replacements); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_e), shadowColour); + text = replaceAll(text, L"{*CE*}", replacements); + swprintf(replacements, 64, L"", + GetHTMLColour(eHTMLColor_f), shadowColour); + text = replaceAll(text, L"{*CF*}", replacements); - text = replaceAll(text, L"{*CONTROLLER_MENU_NAVIGATE*}", GetVKReplacement(VK_PAD_RTHUMB_LEFT) ); - } - else // Normal right handed. - { - text = replaceAll(text, L"{*CONTROLLER_ACTION_MOVE*}", GetActionReplacement(iPad,MINECRAFT_ACTION_RIGHT ) ); - text = replaceAll(text, L"{*CONTROLLER_ACTION_LOOK*}", GetActionReplacement(iPad,MINECRAFT_ACTION_LOOK_RIGHT ) ); + // Swap for southpaw. + if (app.GetGameSettings(iPad, eGameSetting_ControlSouthPaw)) { + text = + replaceAll(text, L"{*CONTROLLER_ACTION_MOVE*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_LOOK_RIGHT)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_LOOK*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_RIGHT)); - text = replaceAll(text, L"{*CONTROLLER_MENU_NAVIGATE*}", GetVKReplacement(VK_PAD_LTHUMB_LEFT) ); - } + text = replaceAll(text, L"{*CONTROLLER_MENU_NAVIGATE*}", + GetVKReplacement(VK_PAD_RTHUMB_LEFT)); + } else // Normal right handed. + { + text = replaceAll(text, L"{*CONTROLLER_ACTION_MOVE*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_RIGHT)); + text = + replaceAll(text, L"{*CONTROLLER_ACTION_LOOK*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_LOOK_RIGHT)); - text = replaceAll(text, L"{*CONTROLLER_ACTION_JUMP*}", GetActionReplacement(iPad,MINECRAFT_ACTION_JUMP ) ); - text = replaceAll(text, L"{*CONTROLLER_ACTION_SNEAK*}", GetActionReplacement(iPad,MINECRAFT_ACTION_SNEAK_TOGGLE ) ); - text = replaceAll(text, L"{*CONTROLLER_ACTION_USE*}", GetActionReplacement(iPad,MINECRAFT_ACTION_USE ) ); - text = replaceAll(text, L"{*CONTROLLER_ACTION_ACTION*}", GetActionReplacement(iPad,MINECRAFT_ACTION_ACTION ) ); - text = replaceAll(text, L"{*CONTROLLER_ACTION_LEFT_SCROLL*}", GetActionReplacement(iPad,MINECRAFT_ACTION_LEFT_SCROLL ) ); - text = replaceAll(text, L"{*CONTROLLER_ACTION_RIGHT_SCROLL*}", GetActionReplacement(iPad,MINECRAFT_ACTION_RIGHT_SCROLL ) ); - text = replaceAll(text, L"{*CONTROLLER_ACTION_INVENTORY*}", GetActionReplacement(iPad,MINECRAFT_ACTION_INVENTORY ) ); - text = replaceAll(text, L"{*CONTROLLER_ACTION_CRAFTING*}", GetActionReplacement(iPad,MINECRAFT_ACTION_CRAFTING ) ); - text = replaceAll(text, L"{*CONTROLLER_ACTION_DROP*}", GetActionReplacement(iPad,MINECRAFT_ACTION_DROP ) ); - text = replaceAll(text, L"{*CONTROLLER_ACTION_CAMERA*}", GetActionReplacement(iPad,MINECRAFT_ACTION_RENDER_THIRD_PERSON ) ); - text = replaceAll(text, L"{*CONTROLLER_VK_A*}", GetVKReplacement(VK_PAD_A) ); - text = replaceAll(text, L"{*CONTROLLER_VK_B*}", GetVKReplacement(VK_PAD_B) ); - text = replaceAll(text, L"{*CONTROLLER_VK_X*}", GetVKReplacement(VK_PAD_X) ); - text = replaceAll(text, L"{*CONTROLLER_VK_Y*}", GetVKReplacement(VK_PAD_Y) ); - text = replaceAll(text, L"{*CONTROLLER_VK_LB*}", GetVKReplacement(VK_PAD_LSHOULDER) ); - text = replaceAll(text, L"{*CONTROLLER_VK_RB*}", GetVKReplacement(VK_PAD_RSHOULDER) ); - text = replaceAll(text, L"{*CONTROLLER_VK_LS*}", GetVKReplacement(VK_PAD_LTHUMB_UP) ); - text = replaceAll(text, L"{*CONTROLLER_VK_RS*}", GetVKReplacement(VK_PAD_RTHUMB_UP) ); - text = replaceAll(text, L"{*CONTROLLER_VK_LT*}", GetVKReplacement(VK_PAD_LTRIGGER) ); - text = replaceAll(text, L"{*CONTROLLER_VK_RT*}", GetVKReplacement(VK_PAD_RTRIGGER) ); - text = replaceAll(text, L"{*ICON_SHANK_01*}", GetIconReplacement(XZP_ICON_SHANK_01) ); - text = replaceAll(text, L"{*ICON_SHANK_03*}", GetIconReplacement(XZP_ICON_SHANK_03) ); - text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_UP*}", GetActionReplacement(iPad,MINECRAFT_ACTION_DPAD_UP ) ); - text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_DOWN*}", GetActionReplacement(iPad,MINECRAFT_ACTION_DPAD_DOWN ) ); - text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_RIGHT*}", GetActionReplacement(iPad,MINECRAFT_ACTION_DPAD_RIGHT ) ); - text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_LEFT*}", GetActionReplacement(iPad,MINECRAFT_ACTION_DPAD_LEFT ) ); + text = replaceAll(text, L"{*CONTROLLER_MENU_NAVIGATE*}", + GetVKReplacement(VK_PAD_LTHUMB_LEFT)); + } + + text = replaceAll(text, L"{*CONTROLLER_ACTION_JUMP*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_JUMP)); + text = + replaceAll(text, L"{*CONTROLLER_ACTION_SNEAK*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_SNEAK_TOGGLE)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_USE*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_USE)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_ACTION*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_ACTION)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_LEFT_SCROLL*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_LEFT_SCROLL)); + text = + replaceAll(text, L"{*CONTROLLER_ACTION_RIGHT_SCROLL*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_RIGHT_SCROLL)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_INVENTORY*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_INVENTORY)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_CRAFTING*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_CRAFTING)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_DROP*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_DROP)); + text = replaceAll( + text, L"{*CONTROLLER_ACTION_CAMERA*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_RENDER_THIRD_PERSON)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_MENU_PAGEDOWN*}", + GetActionReplacement(iPad, ACTION_MENU_PAGEDOWN)); + text = + replaceAll(text, L"{*CONTROLLER_ACTION_DISMOUNT*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_SNEAK_TOGGLE)); + text = replaceAll(text, L"{*CONTROLLER_VK_A*}", GetVKReplacement(VK_PAD_A)); + text = replaceAll(text, L"{*CONTROLLER_VK_B*}", GetVKReplacement(VK_PAD_B)); + text = replaceAll(text, L"{*CONTROLLER_VK_X*}", GetVKReplacement(VK_PAD_X)); + text = replaceAll(text, L"{*CONTROLLER_VK_Y*}", GetVKReplacement(VK_PAD_Y)); + text = replaceAll(text, L"{*CONTROLLER_VK_LB*}", + GetVKReplacement(VK_PAD_LSHOULDER)); + text = replaceAll(text, L"{*CONTROLLER_VK_RB*}", + GetVKReplacement(VK_PAD_RSHOULDER)); + text = replaceAll(text, L"{*CONTROLLER_VK_LS*}", + GetVKReplacement(VK_PAD_LTHUMB_UP)); + text = replaceAll(text, L"{*CONTROLLER_VK_RS*}", + GetVKReplacement(VK_PAD_RTHUMB_UP)); + text = replaceAll(text, L"{*CONTROLLER_VK_LT*}", + GetVKReplacement(VK_PAD_LTRIGGER)); + text = replaceAll(text, L"{*CONTROLLER_VK_RT*}", + GetVKReplacement(VK_PAD_RTRIGGER)); + text = replaceAll(text, L"{*ICON_SHANK_01*}", + GetIconReplacement(XZP_ICON_SHANK_01)); + text = replaceAll(text, L"{*ICON_SHANK_03*}", + GetIconReplacement(XZP_ICON_SHANK_03)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_UP*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_DPAD_UP)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_DOWN*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_DPAD_DOWN)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_RIGHT*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_DPAD_RIGHT)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_LEFT*}", + GetActionReplacement(iPad, MINECRAFT_ACTION_DPAD_LEFT)); #if defined _XBOX_ONE || defined __PSVITA__ - text = replaceAll(text, L"{*CONTROLLER_VK_START*}", GetVKReplacement(VK_PAD_START ) ); - text = replaceAll(text, L"{*CONTROLLER_VK_BACK*}", GetVKReplacement(VK_PAD_BACK ) ); + text = replaceAll(text, L"{*CONTROLLER_VK_START*}", + GetVKReplacement(VK_PAD_START)); + text = replaceAll(text, L"{*CONTROLLER_VK_BACK*}", + GetVKReplacement(VK_PAD_BACK)); #endif #ifdef _XBOX - std::wstring imageRoot = L""; + std::wstring imageRoot = L""; - Minecraft *pMinecraft = Minecraft::GetInstance(); - imageRoot = pMinecraft->skins->getSelected()->getXuiRootPath(); + Minecraft* pMinecraft = Minecraft::GetInstance(); + imageRoot = pMinecraft->skins->getSelected()->getXuiRootPath(); - text = replaceAll(text, L"{*IMAGEROOT*}", imageRoot); -#endif // _XBOX + text = replaceAll(text, L"{*IMAGEROOT*}", imageRoot); +#endif // _XBOX - // Fix for #8903 - UI: Localization: KOR/JPN/CHT: Button Icons are rendered with padding space, which looks no good - std::uint32_t dwLanguage = XGetLanguage( ); - switch(dwLanguage) - { - case XC_LANGUAGE_KOREAN: - case XC_LANGUAGE_JAPANESE: - case XC_LANGUAGE_TCHINESE: - text = replaceAll(text, L" ", L"" ); - break; - } + // Fix for #8903 - UI: Localization: KOR/JPN/CHT: Button Icons are rendered + // with padding space, which looks no good + std::uint32_t dwLanguage = XGetLanguage(); + switch (dwLanguage) { + case XC_LANGUAGE_KOREAN: + case XC_LANGUAGE_JAPANESE: + case XC_LANGUAGE_TCHINESE: + text = replaceAll(text, L" ", L""); + break; + } - return text; + return text; } -std::wstring CMinecraftApp::GetActionReplacement(int iPad, unsigned char ucAction) -{ - unsigned int input = InputManager.GetGameJoypadMaps(InputManager.GetJoypadMapVal(iPad) ,ucAction); +std::wstring CMinecraftApp::GetActionReplacement(int iPad, + unsigned char ucAction) { + unsigned int input = InputManager.GetGameJoypadMaps( + InputManager.GetJoypadMapVal(iPad), ucAction); #ifdef _XBOX - switch(input) - { - case _360_JOY_BUTTON_A: - return app.GetString( IDS_CONTROLLER_A ); - case _360_JOY_BUTTON_B: - return app.GetString( IDS_CONTROLLER_B ); - case _360_JOY_BUTTON_X: - return app.GetString( IDS_CONTROLLER_X ); - case _360_JOY_BUTTON_Y: - return app.GetString( IDS_CONTROLLER_Y ); - case _360_JOY_BUTTON_LSTICK_UP: - case _360_JOY_BUTTON_LSTICK_DOWN: - case _360_JOY_BUTTON_LSTICK_LEFT: - case _360_JOY_BUTTON_LSTICK_RIGHT: - return app.GetString( IDS_CONTROLLER_LEFT_STICK ); - case _360_JOY_BUTTON_RSTICK_LEFT: - case _360_JOY_BUTTON_RSTICK_RIGHT: - case _360_JOY_BUTTON_RSTICK_UP: - case _360_JOY_BUTTON_RSTICK_DOWN: - return app.GetString( IDS_CONTROLLER_RIGHT_STICK ); - case _360_JOY_BUTTON_LT: - return app.GetString( IDS_CONTROLLER_LEFT_TRIGGER ); - case _360_JOY_BUTTON_RT: - return app.GetString( IDS_CONTROLLER_RIGHT_TRIGGER ); - case _360_JOY_BUTTON_RB: - return app.GetString( IDS_CONTROLLER_RIGHT_BUMPER ); - case _360_JOY_BUTTON_LB: - return app.GetString( IDS_CONTROLLER_LEFT_BUMPER ); - case _360_JOY_BUTTON_BACK: - return app.GetString( IDS_CONTROLLER_BACK ); - case _360_JOY_BUTTON_START: - return app.GetString( IDS_CONTROLLER_START ); - case _360_JOY_BUTTON_RTHUMB: - return app.GetString( IDS_CONTROLLER_RIGHT_THUMBSTICK ); - case _360_JOY_BUTTON_LTHUMB: - return app.GetString( IDS_CONTROLLER_LEFT_THUMBSTICK ); - case _360_JOY_BUTTON_DPAD_LEFT: - return app.GetString( IDS_CONTROLLER_DPAD_L ); - case _360_JOY_BUTTON_DPAD_RIGHT: - return app.GetString( IDS_CONTROLLER_DPAD_R ); - case _360_JOY_BUTTON_DPAD_UP: - return app.GetString( IDS_CONTROLLER_DPAD_U ); - case _360_JOY_BUTTON_DPAD_DOWN: - return app.GetString( IDS_CONTROLLER_DPAD_D ); - }; - return L""; + switch (input) { + case _360_JOY_BUTTON_A: + return app.GetString(IDS_CONTROLLER_A); + case _360_JOY_BUTTON_B: + return app.GetString(IDS_CONTROLLER_B); + case _360_JOY_BUTTON_X: + return app.GetString(IDS_CONTROLLER_X); + case _360_JOY_BUTTON_Y: + return app.GetString(IDS_CONTROLLER_Y); + case _360_JOY_BUTTON_LSTICK_UP: + case _360_JOY_BUTTON_LSTICK_DOWN: + case _360_JOY_BUTTON_LSTICK_LEFT: + case _360_JOY_BUTTON_LSTICK_RIGHT: + return app.GetString(IDS_CONTROLLER_LEFT_STICK); + case _360_JOY_BUTTON_RSTICK_LEFT: + case _360_JOY_BUTTON_RSTICK_RIGHT: + case _360_JOY_BUTTON_RSTICK_UP: + case _360_JOY_BUTTON_RSTICK_DOWN: + return app.GetString(IDS_CONTROLLER_RIGHT_STICK); + case _360_JOY_BUTTON_LT: + return app.GetString(IDS_CONTROLLER_LEFT_TRIGGER); + case _360_JOY_BUTTON_RT: + return app.GetString(IDS_CONTROLLER_RIGHT_TRIGGER); + case _360_JOY_BUTTON_RB: + return app.GetString(IDS_CONTROLLER_RIGHT_BUMPER); + case _360_JOY_BUTTON_LB: + return app.GetString(IDS_CONTROLLER_LEFT_BUMPER); + case _360_JOY_BUTTON_BACK: + return app.GetString(IDS_CONTROLLER_BACK); + case _360_JOY_BUTTON_START: + return app.GetString(IDS_CONTROLLER_START); + case _360_JOY_BUTTON_RTHUMB: + return app.GetString(IDS_CONTROLLER_RIGHT_THUMBSTICK); + case _360_JOY_BUTTON_LTHUMB: + return app.GetString(IDS_CONTROLLER_LEFT_THUMBSTICK); + case _360_JOY_BUTTON_DPAD_LEFT: + return app.GetString(IDS_CONTROLLER_DPAD_L); + case _360_JOY_BUTTON_DPAD_RIGHT: + return app.GetString(IDS_CONTROLLER_DPAD_R); + case _360_JOY_BUTTON_DPAD_UP: + return app.GetString(IDS_CONTROLLER_DPAD_U); + case _360_JOY_BUTTON_DPAD_DOWN: + return app.GetString(IDS_CONTROLLER_DPAD_D); + }; + return L""; #else - std::wstring replacement = L""; + std::wstring replacement = L""; - // 4J Stu - Some of our actions can be mapped to multiple physical buttons, so replaces the switch that was here - if (input & _360_JOY_BUTTON_A) replacement = L"ButtonA"; - else if(input &_360_JOY_BUTTON_B) replacement = L"ButtonB"; - else if(input &_360_JOY_BUTTON_X) replacement = L"ButtonX"; - else if(input &_360_JOY_BUTTON_Y) replacement = L"ButtonY"; - else if( - (input &_360_JOY_BUTTON_LSTICK_UP) || - (input &_360_JOY_BUTTON_LSTICK_DOWN) || - (input &_360_JOY_BUTTON_LSTICK_LEFT) || - (input &_360_JOY_BUTTON_LSTICK_RIGHT) - ) - { - replacement = L"ButtonLeftStick"; - } - else if( - (input &_360_JOY_BUTTON_RSTICK_LEFT) || - (input &_360_JOY_BUTTON_RSTICK_RIGHT) || - (input &_360_JOY_BUTTON_RSTICK_UP) || - (input &_360_JOY_BUTTON_RSTICK_DOWN) - ) - { - replacement = L"ButtonRightStick"; - } - else if(input &_360_JOY_BUTTON_DPAD_LEFT) replacement = L"ButtonDpadL"; - else if(input &_360_JOY_BUTTON_DPAD_RIGHT) replacement = L"ButtonDpadR"; - else if(input &_360_JOY_BUTTON_DPAD_UP) replacement = L"ButtonDpadU"; - else if(input &_360_JOY_BUTTON_DPAD_DOWN) replacement = L"ButtonDpadD"; - else if(input &_360_JOY_BUTTON_LT) replacement = L"ButtonLeftTrigger"; - else if(input &_360_JOY_BUTTON_RT) replacement = L"ButtonRightTrigger"; - else if(input &_360_JOY_BUTTON_RB) replacement = L"ButtonRightBumper"; - else if(input &_360_JOY_BUTTON_LB) replacement = L"ButtonLeftBumper"; - else if(input &_360_JOY_BUTTON_BACK) replacement = L"ButtonBack"; - else if(input &_360_JOY_BUTTON_START) replacement = L"ButtonStart"; - else if(input &_360_JOY_BUTTON_RTHUMB) replacement = L"ButtonRS"; - else if(input &_360_JOY_BUTTON_LTHUMB) replacement = L"ButtonLS"; + // 4J Stu - Some of our actions can be mapped to multiple physical buttons, + // so replaces the switch that was here + if (input & _360_JOY_BUTTON_A) + replacement = L"ButtonA"; + else if (input & _360_JOY_BUTTON_B) + replacement = L"ButtonB"; + else if (input & _360_JOY_BUTTON_X) + replacement = L"ButtonX"; + else if (input & _360_JOY_BUTTON_Y) + replacement = L"ButtonY"; + else if ((input & _360_JOY_BUTTON_LSTICK_UP) || + (input & _360_JOY_BUTTON_LSTICK_DOWN) || + (input & _360_JOY_BUTTON_LSTICK_LEFT) || + (input & _360_JOY_BUTTON_LSTICK_RIGHT)) { + replacement = L"ButtonLeftStick"; + } else if ((input & _360_JOY_BUTTON_RSTICK_LEFT) || + (input & _360_JOY_BUTTON_RSTICK_RIGHT) || + (input & _360_JOY_BUTTON_RSTICK_UP) || + (input & _360_JOY_BUTTON_RSTICK_DOWN)) { + replacement = L"ButtonRightStick"; + } else if (input & _360_JOY_BUTTON_DPAD_LEFT) + replacement = L"ButtonDpadL"; + else if (input & _360_JOY_BUTTON_DPAD_RIGHT) + replacement = L"ButtonDpadR"; + else if (input & _360_JOY_BUTTON_DPAD_UP) + replacement = L"ButtonDpadU"; + else if (input & _360_JOY_BUTTON_DPAD_DOWN) + replacement = L"ButtonDpadD"; + else if (input & _360_JOY_BUTTON_LT) + replacement = L"ButtonLeftTrigger"; + else if (input & _360_JOY_BUTTON_RT) + replacement = L"ButtonRightTrigger"; + else if (input & _360_JOY_BUTTON_RB) + replacement = L"ButtonRightBumper"; + else if (input & _360_JOY_BUTTON_LB) + replacement = L"ButtonLeftBumper"; + else if (input & _360_JOY_BUTTON_BACK) + replacement = L"ButtonBack"; + else if (input & _360_JOY_BUTTON_START) + replacement = L"ButtonStart"; + else if (input & _360_JOY_BUTTON_RTHUMB) + replacement = L"ButtonRS"; + else if (input & _360_JOY_BUTTON_LTHUMB) + replacement = L"ButtonLS"; - wchar_t string[128]; + wchar_t string[128]; #ifdef __PS3__ - int size = 30; + int size = 30; #elif defined _WIN64 - int size = 45; - if(ui.getScreenWidth() < 1920) size = 30; + int size = 45; + if (ui.getScreenWidth() < 1920) size = 30; #else - int size = 45; + int size = 45; #endif - swprintf(string,128,L"", replacement.c_str(), size, size); + swprintf(string, 128, + L"", + replacement.c_str(), size, size); - return string; + return string; #endif } -std::wstring CMinecraftApp::GetVKReplacement(unsigned int uiVKey) -{ +std::wstring CMinecraftApp::GetVKReplacement(unsigned int uiVKey) { #ifdef _XBOX - switch(uiVKey) - { - case VK_PAD_A: - return app.GetString( IDS_CONTROLLER_A ); - case VK_PAD_B: - return app.GetString( IDS_CONTROLLER_B ); - case VK_PAD_X: - return app.GetString( IDS_CONTROLLER_X ); - case VK_PAD_Y: - return app.GetString( IDS_CONTROLLER_Y ); - case VK_PAD_LSHOULDER: - return app.GetString( IDS_CONTROLLER_LEFT_BUMPER ); - case VK_PAD_RSHOULDER: - return app.GetString( IDS_CONTROLLER_RIGHT_BUMPER ); - case VK_PAD_LTRIGGER: - return app.GetString( IDS_CONTROLLER_LEFT_TRIGGER ); - case VK_PAD_RTRIGGER: - return app.GetString( IDS_CONTROLLER_RIGHT_TRIGGER ); - case VK_PAD_LTHUMB_UP : - case VK_PAD_LTHUMB_DOWN : - case VK_PAD_LTHUMB_RIGHT : - case VK_PAD_LTHUMB_LEFT : - case VK_PAD_LTHUMB_UPLEFT : - case VK_PAD_LTHUMB_UPRIGHT : - case VK_PAD_LTHUMB_DOWNRIGHT: - case VK_PAD_LTHUMB_DOWNLEFT : - return app.GetString( IDS_CONTROLLER_LEFT_STICK ); - case VK_PAD_RTHUMB_UP : - case VK_PAD_RTHUMB_DOWN : - case VK_PAD_RTHUMB_RIGHT : - case VK_PAD_RTHUMB_LEFT : - case VK_PAD_RTHUMB_UPLEFT : - case VK_PAD_RTHUMB_UPRIGHT : - case VK_PAD_RTHUMB_DOWNRIGHT: - case VK_PAD_RTHUMB_DOWNLEFT : - return app.GetString( IDS_CONTROLLER_RIGHT_STICK ); - default: - break; - } - return NULL; + switch (uiVKey) { + case VK_PAD_A: + return app.GetString(IDS_CONTROLLER_A); + case VK_PAD_B: + return app.GetString(IDS_CONTROLLER_B); + case VK_PAD_X: + return app.GetString(IDS_CONTROLLER_X); + case VK_PAD_Y: + return app.GetString(IDS_CONTROLLER_Y); + case VK_PAD_LSHOULDER: + return app.GetString(IDS_CONTROLLER_LEFT_BUMPER); + case VK_PAD_RSHOULDER: + return app.GetString(IDS_CONTROLLER_RIGHT_BUMPER); + case VK_PAD_LTRIGGER: + return app.GetString(IDS_CONTROLLER_LEFT_TRIGGER); + case VK_PAD_RTRIGGER: + return app.GetString(IDS_CONTROLLER_RIGHT_TRIGGER); + case VK_PAD_LTHUMB_UP: + case VK_PAD_LTHUMB_DOWN: + case VK_PAD_LTHUMB_RIGHT: + case VK_PAD_LTHUMB_LEFT: + case VK_PAD_LTHUMB_UPLEFT: + case VK_PAD_LTHUMB_UPRIGHT: + case VK_PAD_LTHUMB_DOWNRIGHT: + case VK_PAD_LTHUMB_DOWNLEFT: + return app.GetString(IDS_CONTROLLER_LEFT_STICK); + case VK_PAD_RTHUMB_UP: + case VK_PAD_RTHUMB_DOWN: + case VK_PAD_RTHUMB_RIGHT: + case VK_PAD_RTHUMB_LEFT: + case VK_PAD_RTHUMB_UPLEFT: + case VK_PAD_RTHUMB_UPRIGHT: + case VK_PAD_RTHUMB_DOWNRIGHT: + case VK_PAD_RTHUMB_DOWNLEFT: + return app.GetString(IDS_CONTROLLER_RIGHT_STICK); + default: + break; + } + return NULL; #else - std::wstring replacement = L""; - switch(uiVKey) - { - case VK_PAD_A: -#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) - if( InputManager.IsCircleCrossSwapped() ) replacement = L"ButtonB"; - else replacement = L"ButtonA"; + std::wstring replacement = L""; + switch (uiVKey) { + case VK_PAD_A: +#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) + if (InputManager.IsCircleCrossSwapped()) + replacement = L"ButtonB"; + else + replacement = L"ButtonA"; #else - replacement = L"ButtonA"; + replacement = L"ButtonA"; #endif - break; - case VK_PAD_B: -#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) - if( InputManager.IsCircleCrossSwapped() ) replacement = L"ButtonA"; - else replacement = L"ButtonB"; + break; + case VK_PAD_B: +#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) + if (InputManager.IsCircleCrossSwapped()) + replacement = L"ButtonA"; + else + replacement = L"ButtonB"; #else - replacement = L"ButtonB"; + replacement = L"ButtonB"; #endif - break; - case VK_PAD_X: - replacement = L"ButtonX"; - break; - case VK_PAD_Y: - replacement = L"ButtonY"; - break; - case VK_PAD_LSHOULDER: - replacement = L"ButtonLeftBumper"; - break; - case VK_PAD_RSHOULDER: - replacement = L"ButtonRightBumper"; - break; - case VK_PAD_LTRIGGER: - replacement = L"ButtonLeftTrigger"; - break; - case VK_PAD_RTRIGGER: - replacement = L"ButtonRightTrigger"; - break; - case VK_PAD_LTHUMB_UP : - case VK_PAD_LTHUMB_DOWN : - case VK_PAD_LTHUMB_RIGHT : - case VK_PAD_LTHUMB_LEFT : - case VK_PAD_LTHUMB_UPLEFT : - case VK_PAD_LTHUMB_UPRIGHT : - case VK_PAD_LTHUMB_DOWNRIGHT: - case VK_PAD_LTHUMB_DOWNLEFT : - replacement = L"ButtonLeftStick"; - break; - case VK_PAD_RTHUMB_UP : - case VK_PAD_RTHUMB_DOWN : - case VK_PAD_RTHUMB_RIGHT : - case VK_PAD_RTHUMB_LEFT : - case VK_PAD_RTHUMB_UPLEFT : - case VK_PAD_RTHUMB_UPRIGHT : - case VK_PAD_RTHUMB_DOWNRIGHT: - case VK_PAD_RTHUMB_DOWNLEFT : - replacement = L"ButtonRightStick"; - break; + break; + case VK_PAD_X: + replacement = L"ButtonX"; + break; + case VK_PAD_Y: + replacement = L"ButtonY"; + break; + case VK_PAD_LSHOULDER: + replacement = L"ButtonLeftBumper"; + break; + case VK_PAD_RSHOULDER: + replacement = L"ButtonRightBumper"; + break; + case VK_PAD_LTRIGGER: + replacement = L"ButtonLeftTrigger"; + break; + case VK_PAD_RTRIGGER: + replacement = L"ButtonRightTrigger"; + break; + case VK_PAD_LTHUMB_UP: + case VK_PAD_LTHUMB_DOWN: + case VK_PAD_LTHUMB_RIGHT: + case VK_PAD_LTHUMB_LEFT: + case VK_PAD_LTHUMB_UPLEFT: + case VK_PAD_LTHUMB_UPRIGHT: + case VK_PAD_LTHUMB_DOWNRIGHT: + case VK_PAD_LTHUMB_DOWNLEFT: + replacement = L"ButtonLeftStick"; + break; + case VK_PAD_RTHUMB_UP: + case VK_PAD_RTHUMB_DOWN: + case VK_PAD_RTHUMB_RIGHT: + case VK_PAD_RTHUMB_LEFT: + case VK_PAD_RTHUMB_UPLEFT: + case VK_PAD_RTHUMB_UPRIGHT: + case VK_PAD_RTHUMB_DOWNRIGHT: + case VK_PAD_RTHUMB_DOWNLEFT: + replacement = L"ButtonRightStick"; + break; #if defined _XBOX_ONE || defined __PSVITA__ - case VK_PAD_START: - replacement = L"ButtonStart"; - break; - case VK_PAD_BACK: - replacement = L"ButtonBack"; - break; + case VK_PAD_START: + replacement = L"ButtonStart"; + break; + case VK_PAD_BACK: + replacement = L"ButtonBack"; + break; #endif - default: - break; - } - wchar_t string[128]; + default: + break; + } + wchar_t string[128]; #ifdef __PS3__ - int size = 30; + int size = 30; #elif defined _WIN64 - int size = 45; - if(ui.getScreenWidth() < 1920) size = 30; + int size = 45; + if (ui.getScreenWidth() < 1920) size = 30; #else - int size = 45; + int size = 45; #endif - swprintf(string,128,L"", replacement.c_str(), size, size); + swprintf(string, 128, + L"", + replacement.c_str(), size, size); - return string; + return string; #endif } -std::wstring CMinecraftApp::GetIconReplacement(unsigned int uiIcon) -{ +std::wstring CMinecraftApp::GetIconReplacement(unsigned int uiIcon) { #ifdef _XBOX - switch(uiIcon) - { - case XZP_ICON_SHANK_01: - return app.GetString( IDS_ICON_SHANK_01 ); - case XZP_ICON_SHANK_03: - return app.GetString( IDS_ICON_SHANK_03 ); - default: - break; - } - return NULL; + switch (uiIcon) { + case XZP_ICON_SHANK_01: + return app.GetString(IDS_ICON_SHANK_01); + case XZP_ICON_SHANK_03: + return app.GetString(IDS_ICON_SHANK_03); + default: + break; + } + return NULL; #else - wchar_t string[128]; + wchar_t string[128]; #ifdef __PS3__ - int size = 22; + int size = 22; #elif defined _WIN64 - int size = 33; - if(ui.getScreenWidth() < 1920) size = 22; + int size = 33; + if (ui.getScreenWidth() < 1920) size = 22; #else - int size = 33; + int size = 33; #endif - swprintf(string,128,L"", size, size); - std::wstring result = L""; - switch(uiIcon) - { - case XZP_ICON_SHANK_01: - result = string; - break; - case XZP_ICON_SHANK_03: - result.append(string).append(string).append(string); - break; - default: - break; - } - return result; + swprintf(string, 128, + L"", + size, size); + std::wstring result = L""; + switch (uiIcon) { + case XZP_ICON_SHANK_01: + result = string; + break; + case XZP_ICON_SHANK_03: + result.append(string).append(string).append(string); + break; + default: + break; + } + return result; #endif } -#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) -std::unordered_map CMinecraftApp::MojangData; -std::unordered_map CMinecraftApp::DLCTextures_PackID; -std::unordered_map CMinecraftApp::DLCInfo; -std::unordered_map CMinecraftApp::DLCInfo_SkinName; +#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) +std::unordered_map + CMinecraftApp::MojangData; +std::unordered_map CMinecraftApp::DLCTextures_PackID; +std::unordered_map CMinecraftApp::DLCInfo; +std::unordered_map CMinecraftApp::DLCInfo_SkinName; #elif defined(_DURANGO) -std::unordered_map CMinecraftApp::MojangData; -std::unordered_map CMinecraftApp::DLCTextures_PackID; // for mash-up packs & texture packs -//std::unordered_map CMinecraftApp::DLCInfo_Trial; // full offerid, dlc_info -std::unordered_map CMinecraftApp::DLCInfo_Full; // full offerid, dlc_info -std::unordered_map CMinecraftApp::DLCInfo_SkinName; // skin name, full offer id +std::unordered_map + CMinecraftApp::MojangData; +std::unordered_map + CMinecraftApp::DLCTextures_PackID; // for mash-up packs & texture packs +// std::unordered_map CMinecraftApp::DLCInfo_Trial; // +// full offerid, dlc_info +std::unordered_map + CMinecraftApp::DLCInfo_Full; // full offerid, dlc_info +std::unordered_map + CMinecraftApp::DLCInfo_SkinName; // skin name, full offer id #else -std::unordered_map CMinecraftApp::MojangData; -std::unordered_map CMinecraftApp::DLCTextures_PackID; -std::unordered_map CMinecraftApp::DLCInfo_Trial; -std::unordered_map CMinecraftApp::DLCInfo_Full; -std::unordered_map CMinecraftApp::DLCInfo_SkinName; +std::unordered_map CMinecraftApp::MojangData; +std::unordered_map CMinecraftApp::DLCTextures_PackID; +std::unordered_map CMinecraftApp::DLCInfo_Trial; +std::unordered_map CMinecraftApp::DLCInfo_Full; +std::unordered_map CMinecraftApp::DLCInfo_SkinName; #endif +HRESULT CMinecraftApp::RegisterMojangData(WCHAR* pXuidName, PlayerUID xuid, + WCHAR* pSkin, WCHAR* pCape) { + HRESULT hr = S_OK; + eXUID eTempXuid = eXUID_Undefined; + MOJANG_DATA* pMojangData = NULL; + // ignore the names if we don't recognize them + if (pXuidName != NULL) { + if (wcscmp(pXuidName, L"XUID_NOTCH") == 0) { + eTempXuid = + eXUID_Notch; // might be needed for the apple at some point + } else if (wcscmp(pXuidName, L"XUID_DEADMAU5") == 0) { + eTempXuid = eXUID_Deadmau5; // Needed for the deadmau5 ears + } else { + eTempXuid = eXUID_NoName; + } + } -HRESULT CMinecraftApp::RegisterMojangData(WCHAR *pXuidName, PlayerUID xuid, WCHAR *pSkin, WCHAR *pCape) -{ - HRESULT hr=0; - eXUID eTempXuid=eXUID_Undefined; - MOJANG_DATA *pMojangData=NULL; + if (eTempXuid != eXUID_Undefined) { + pMojangData = new MOJANG_DATA; + ZeroMemory(pMojangData, sizeof(MOJANG_DATA)); + pMojangData->eXuid = eTempXuid; - // ignore the names if we don't recognize them - if(pXuidName!=NULL) - { - if( wcscmp( pXuidName, L"XUID_NOTCH" ) == 0 ) - { - eTempXuid = eXUID_Notch; // might be needed for the apple at some point - } - else if( wcscmp( pXuidName, L"XUID_DEADMAU5" ) == 0 ) - { - eTempXuid = eXUID_Deadmau5; // Needed for the deadmau5 ears - } - else - { - eTempXuid=eXUID_NoName; - } - } + wcsncpy(pMojangData->wchSkin, pSkin, MAX_CAPENAME_SIZE); + wcsncpy(pMojangData->wchCape, pCape, MAX_CAPENAME_SIZE); + MojangData[xuid] = pMojangData; + } - if(eTempXuid!=eXUID_Undefined) - { - pMojangData = new MOJANG_DATA; - ZeroMemory(pMojangData,sizeof(MOJANG_DATA)); - pMojangData->eXuid=eTempXuid; - - wcsncpy( pMojangData->wchSkin, pSkin, MAX_CAPENAME_SIZE); - wcsncpy( pMojangData->wchCape, pCape, MAX_CAPENAME_SIZE); - MojangData[xuid]=pMojangData; - } - - return hr; + return hr; } -MOJANG_DATA *CMinecraftApp::GetMojangDataForXuid(PlayerUID xuid) -{ - return MojangData[xuid]; +MOJANG_DATA* CMinecraftApp::GetMojangDataForXuid(PlayerUID xuid) { + return MojangData[xuid]; } -HRESULT CMinecraftApp::RegisterConfigValues(WCHAR *pType, int iValue) -{ - HRESULT hr=0; +HRESULT CMinecraftApp::RegisterConfigValues(WCHAR* pType, int iValue) { + HRESULT hr = S_OK; -// #ifdef _XBOX -// if(pType!=NULL) -// { -// if(wcscmp(pType,L"XboxOneTransfer")==0) -// { -// if(iValue>0) -// { -// app.m_bTransferSavesToXboxOne=true; -// } -// else -// { -// app.m_bTransferSavesToXboxOne=false; -// } -// } -// else if(wcscmp(pType,L"TransferSlotCount")==0) -// { -// app.m_uiTransferSlotC=iValue; -// } -// -// } -// #endif + // #ifdef _XBOX + // if(pType!=NULL) + // { + // if(wcscmp(pType,L"XboxOneTransfer")==0) + // { + // if(iValue>0) + // { + // app.m_bTransferSavesToXboxOne=true; + // } + // else + // { + // app.m_bTransferSavesToXboxOne=false; + // } + // } + // else if(wcscmp(pType,L"TransferSlotCount")==0) + // { + // app.m_uiTransferSlotC=iValue; + // } + // + // } + // #endif - - return hr; + return hr; } #if (defined _XBOX || defined _WINDOWS64) -HRESULT CMinecraftApp::RegisterDLCData(WCHAR *pType, WCHAR *pBannerName, int iGender, __uint64 ullOfferID_Full, __uint64 ullOfferID_Trial, WCHAR *pFirstSkin, unsigned int uiSortIndex, int iConfig, WCHAR *pDataFile) -{ - HRESULT hr=0; - DLC_INFO *pDLCData=new DLC_INFO; - ZeroMemory(pDLCData,sizeof(DLC_INFO)); - pDLCData->ullOfferID_Full=ullOfferID_Full; - pDLCData->ullOfferID_Trial=ullOfferID_Trial; - pDLCData->eDLCType=e_DLC_NotDefined; - pDLCData->iGender=iGender; - pDLCData->uiSortIndex=uiSortIndex; - pDLCData->iConfig=iConfig; +HRESULT CMinecraftApp::RegisterDLCData(WCHAR* pType, WCHAR* pBannerName, + int iGender, uint64_t ullOfferID_Full, + uint64_t ullOfferID_Trial, + WCHAR* pFirstSkin, + unsigned int uiSortIndex, int iConfig, + WCHAR* pDataFile) { + HRESULT hr = S_OK; + DLC_INFO* pDLCData = new DLC_INFO; + ZeroMemory(pDLCData, sizeof(DLC_INFO)); + pDLCData->ullOfferID_Full = ullOfferID_Full; + pDLCData->ullOfferID_Trial = ullOfferID_Trial; + pDLCData->eDLCType = e_DLC_NotDefined; + pDLCData->iGender = iGender; + pDLCData->uiSortIndex = uiSortIndex; + pDLCData->iConfig = iConfig; #ifndef __ORBIS__ - // ignore the names if we don't recognize them - if(pBannerName!=L"") - { - wcsncpy_s( pDLCData->wchBanner, pBannerName, MAX_BANNERNAME_SIZE); - } + // ignore the names if we don't recognize them + if (pBannerName != L"") { + wcsncpy_s(pDLCData->wchBanner, pBannerName, MAX_BANNERNAME_SIZE); + } - if(pDataFile[0]!=0) - { - wcsncpy_s( pDLCData->wchDataFile, pDataFile, MAX_BANNERNAME_SIZE); - } + if (pDataFile[0] != 0) { + wcsncpy_s(pDLCData->wchDataFile, pDataFile, MAX_BANNERNAME_SIZE); + } #endif - if(pType!=NULL) - { - if(wcscmp(pType,L"Skin")==0) - { - pDLCData->eDLCType=e_DLC_SkinPack; - } - else if(wcscmp(pType,L"Gamerpic")==0) - { - pDLCData->eDLCType=e_DLC_Gamerpics; - } - else if(wcscmp(pType,L"Theme")==0) - { - pDLCData->eDLCType=e_DLC_Themes; - } - else if(wcscmp(pType,L"Avatar")==0) - { - pDLCData->eDLCType=e_DLC_AvatarItems; - } - else if(wcscmp(pType,L"MashUpPack")==0) - { - pDLCData->eDLCType=e_DLC_MashupPacks; - DLCTextures_PackID[pDLCData->iConfig]=ullOfferID_Full; - } - else if(wcscmp(pType,L"TexturePack")==0) - { - pDLCData->eDLCType=e_DLC_TexturePacks; - DLCTextures_PackID[pDLCData->iConfig]=ullOfferID_Full; - } + if (pType != NULL) { + if (wcscmp(pType, L"Skin") == 0) { + pDLCData->eDLCType = e_DLC_SkinPack; + } else if (wcscmp(pType, L"Gamerpic") == 0) { + pDLCData->eDLCType = e_DLC_Gamerpics; + } else if (wcscmp(pType, L"Theme") == 0) { + pDLCData->eDLCType = e_DLC_Themes; + } else if (wcscmp(pType, L"Avatar") == 0) { + pDLCData->eDLCType = e_DLC_AvatarItems; + } else if (wcscmp(pType, L"MashUpPack") == 0) { + pDLCData->eDLCType = e_DLC_MashupPacks; + DLCTextures_PackID[pDLCData->iConfig] = ullOfferID_Full; + } else if (wcscmp(pType, L"TexturePack") == 0) { + pDLCData->eDLCType = e_DLC_TexturePacks; + DLCTextures_PackID[pDLCData->iConfig] = ullOfferID_Full; + } + } + if (ullOfferID_Trial != 0ll) DLCInfo_Trial[ullOfferID_Trial] = pDLCData; + if (ullOfferID_Full != 0ll) DLCInfo_Full[ullOfferID_Full] = pDLCData; + if (pFirstSkin[0] != 0) DLCInfo_SkinName[pFirstSkin] = ullOfferID_Full; - } - - if(ullOfferID_Trial!=0ll) DLCInfo_Trial[ullOfferID_Trial]=pDLCData; - if(ullOfferID_Full!=0ll) DLCInfo_Full[ullOfferID_Full]=pDLCData; - if(pFirstSkin[0]!=0) DLCInfo_SkinName[pFirstSkin]=ullOfferID_Full; - - return hr; + return hr; } #elif defined _XBOX_ONE -std::unordered_map *CMinecraftApp::GetDLCInfo() -{ - return &DLCInfo_Full; +std::unordered_map* CMinecraftApp::GetDLCInfo() { + return &DLCInfo_Full; } -HRESULT CMinecraftApp::RegisterDLCData(eDLCContentType eType, WCHAR *pwchBannerName,WCHAR *pwchProductId, WCHAR *pwchProductName, WCHAR *pwchFirstSkin, int iConfig, unsigned int uiSortIndex) -{ - HRESULT hr=0; - // 4J-PB - need to convert the product id to uppercase because the catalog calls come back with upper case - WCHAR wchUppercaseProductID[64]; - if(pwchProductId[0]!=0) - { - for(int i=0;i<64;i++) - { - wchUppercaseProductID[i]=towupper((wchar_t)pwchProductId[i]); - } - } +HRESULT CMinecraftApp::RegisterDLCData(eDLCContentType eType, + WCHAR* pwchBannerName, + WCHAR* pwchProductId, + WCHAR* pwchProductName, + WCHAR* pwchFirstSkin, int iConfig, + unsigned int uiSortIndex) { + HRESULT hr = S_OK; + // 4J-PB - need to convert the product id to uppercase because the catalog + // calls come back with upper case + WCHAR wchUppercaseProductID[64]; + if (pwchProductId[0] != 0) { + for (int i = 0; i < 64; i++) { + wchUppercaseProductID[i] = towupper((wchar_t)pwchProductId[i]); + } + } - // check if we already have this info from the local DLC file - std::wstring wsTemp=wchUppercaseProductID; + // check if we already have this info from the local DLC file + std::wstring wsTemp = wchUppercaseProductID; - AUTO_VAR(it, DLCInfo_Full.find(wsTemp)); - if( it == DLCInfo_Full.end() ) - { - // Not found + AUTO_VAR(it, DLCInfo_Full.find(wsTemp)); + if (it == DLCInfo_Full.end()) { + // Not found - DLC_INFO *pDLCData=new DLC_INFO; - ZeroMemory(pDLCData,sizeof(DLC_INFO)); + DLC_INFO* pDLCData = new DLC_INFO; + ZeroMemory(pDLCData, sizeof(DLC_INFO)); - pDLCData->eDLCType=e_DLC_NotDefined; - pDLCData->uiSortIndex=uiSortIndex; - pDLCData->iConfig=iConfig; + pDLCData->eDLCType = e_DLC_NotDefined; + pDLCData->uiSortIndex = uiSortIndex; + pDLCData->iConfig = iConfig; - if(pwchProductId[0]!=0) - { - pDLCData->wsProductId=wchUppercaseProductID; - } + if (pwchProductId[0] != 0) { + pDLCData->wsProductId = wchUppercaseProductID; + } - // ignore the names if we don't recognize them - if(pwchBannerName!=L"") - { - wcsncpy_s( pDLCData->wchBanner, pwchBannerName, MAX_BANNERNAME_SIZE); - } + // ignore the names if we don't recognize them + if (pwchBannerName != L"") { + wcsncpy_s(pDLCData->wchBanner, pwchBannerName, MAX_BANNERNAME_SIZE); + } - if(pwchProductName[0]!=0) - { - pDLCData->wsDisplayName=pwchProductName; - } + if (pwchProductName[0] != 0) { + pDLCData->wsDisplayName = pwchProductName; + } - pDLCData->eDLCType=eType; + pDLCData->eDLCType = eType; - switch(eType) - { - case e_DLC_MashupPacks: - case e_DLC_TexturePacks: - DLCTextures_PackID[iConfig]=pDLCData->wsProductId; - break; - } + switch (eType) { + case e_DLC_MashupPacks: + case e_DLC_TexturePacks: + DLCTextures_PackID[iConfig] = pDLCData->wsProductId; + break; + } - if(pwchFirstSkin[0]!=0) DLCInfo_SkinName[pwchFirstSkin]=pDLCData->wsProductId; + if (pwchFirstSkin[0] != 0) + DLCInfo_SkinName[pwchFirstSkin] = pDLCData->wsProductId; - #ifdef _XBOX_ONE - // ignore the names, and use the product id instead - DLCInfo_Full[pDLCData->wsProductId]=pDLCData; - #else - DLCInfo_Full[pDLCData->wsDisplayName]=pDLCData; - #endif - } - app.DebugPrintf("DLCInfo - type - %d, productID - %ls, name - %ls , banner - %ls, iconfig - %d, sort index - %d\n",eType,pwchProductId, pwchProductName,pwchBannerName, iConfig, uiSortIndex); - return hr; +#ifdef _XBOX_ONE + // ignore the names, and use the product id instead + DLCInfo_Full[pDLCData->wsProductId] = pDLCData; +#else + DLCInfo_Full[pDLCData->wsDisplayName] = pDLCData; +#endif + } + app.DebugPrintf( + "DLCInfo - type - %d, productID - %ls, name - %ls , banner - %ls, " + "iconfig - %d, sort index - %d\n", + eType, pwchProductId, pwchProductName, pwchBannerName, iConfig, + uiSortIndex); + return hr; } #elif defined(__linux__) -HRESULT CMinecraftApp::RegisterDLCData(WCHAR *pType, WCHAR *pBannerName, int iGender, __uint64 ullOfferID_Full, __uint64 ullOfferID_Trial, WCHAR *pFirstSkin, unsigned int uiSortIndex, int iConfig, WCHAR *pDataFile) -{ - fprintf(stderr, "warning: CMinecraftApp::RegisterDLCData unimplemented for platform `__linux__`\n"); - return S_OK; +HRESULT CMinecraftApp::RegisterDLCData(WCHAR* pType, WCHAR* pBannerName, + int iGender, __uint64 ullOfferID_Full, + __uint64 ullOfferID_Trial, + WCHAR* pFirstSkin, + unsigned int uiSortIndex, int iConfig, + WCHAR* pDataFile) { + fprintf(stderr, + "warning: CMinecraftApp::RegisterDLCData unimplemented for " + "platform `__linux__`\n"); + return S_OK; } #else -HRESULT CMinecraftApp::RegisterDLCData(char *pchDLCName, unsigned int uiSortIndex,char *pchImageURL) -{ - // on PS3 we get all the required info from the name - char chDLCType[3]; - HRESULT hr=0; - DLC_INFO *pDLCData=new DLC_INFO; - ZeroMemory(pDLCData,sizeof(DLC_INFO)); - chDLCType[0]=pchDLCName[0]; - chDLCType[1]=pchDLCName[1]; - chDLCType[2]=0; +HRESULT CMinecraftApp::RegisterDLCData(char* pchDLCName, + unsigned int uiSortIndex, + char* pchImageURL) { + // on PS3 we get all the required info from the name + char chDLCType[3]; + HRESULT hr = S_OK; + DLC_INFO* pDLCData = new DLC_INFO; + ZeroMemory(pDLCData, sizeof(DLC_INFO)); - pDLCData->iConfig = app.GetiConfigFromName(pchDLCName); - pDLCData->uiSortIndex=uiSortIndex; - pDLCData->eDLCType = app.GetDLCTypeFromName(pchDLCName); - strcpy(pDLCData->chImageURL,pchImageURL); - //bool bIsTrialDLC = app.GetTrialFromName(pchDLCName); + chDLCType[0] = pchDLCName[0]; + chDLCType[1] = pchDLCName[1]; + chDLCType[2] = 0; - switch(pDLCData->eDLCType) - { - case e_DLC_TexturePacks: - { - char *pchName=(char *)malloc(strlen(pchDLCName)+1); - strcpy(pchName,pchDLCName); - DLCTextures_PackID[pDLCData->iConfig]=pchName; - } - break; - case e_DLC_MashupPacks: - { - char *pchName=(char *)malloc(strlen(pchDLCName)+1); - strcpy(pchName,pchDLCName); - DLCTextures_PackID[pDLCData->iConfig]=pchName; - } - break; - default: - break; - } + pDLCData->iConfig = app.GetiConfigFromName(pchDLCName); + pDLCData->uiSortIndex = uiSortIndex; + pDLCData->eDLCType = app.GetDLCTypeFromName(pchDLCName); + strcpy(pDLCData->chImageURL, pchImageURL); + // bool bIsTrialDLC = app.GetTrialFromName(pchDLCName); - app.DebugPrintf(5,"Adding DLC - %s\n",pchDLCName); - DLCInfo[pchDLCName]=pDLCData; + switch (pDLCData->eDLCType) { + case e_DLC_TexturePacks: { + char* pchName = (char*)malloc(strlen(pchDLCName) + 1); + strcpy(pchName, pchDLCName); + DLCTextures_PackID[pDLCData->iConfig] = pchName; + } break; + case e_DLC_MashupPacks: { + char* pchName = (char*)malloc(strlen(pchDLCName) + 1); + strcpy(pchName, pchDLCName); + DLCTextures_PackID[pDLCData->iConfig] = pchName; + } break; + default: + break; + } -// if(ullOfferID_Trial!=0ll) DLCInfo_Trial[ullOfferID_Trial]=pDLCData; -// if(ullOfferID_Full!=0ll) DLCInfo_Full[ullOfferID_Full]=pDLCData; -// if(pFirstSkin[0]!=0) DLCInfo_SkinName[pFirstSkin]=ullOfferID_Full; + app.DebugPrintf(5, "Adding DLC - %s\n", pchDLCName); + DLCInfo[pchDLCName] = pDLCData; -// DLCInfo[ullOfferID_Trial]=pDLCData; + // if(ullOfferID_Trial!=0ll) DLCInfo_Trial[ullOfferID_Trial]=pDLCData; + // if(ullOfferID_Full!=0ll) DLCInfo_Full[ullOfferID_Full]=pDLCData; + // if(pFirstSkin[0]!=0) DLCInfo_SkinName[pFirstSkin]=ullOfferID_Full; - return hr; + // DLCInfo[ullOfferID_Trial]=pDLCData; + + return hr; } #endif - - -#if defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__) -bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const std::wstring &FirstSkin,ULONGLONG *pullVal) -{ - AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin)); - if( it == DLCInfo_SkinName.end() ) - { - return false; - } - else - { - *pullVal=(ULONGLONG)it->second; - return true; - } +#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) +bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const std::wstring& FirstSkin, + ULONGLONG* pullVal) { + AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin)); + if (it == DLCInfo_SkinName.end()) { + return false; + } else { + *pullVal = (ULONGLONG)it->second; + return true; + } } -bool CMinecraftApp::GetDLCNameForPackID(const int iPackID,char **ppchKeyID) -{ - AUTO_VAR(it, DLCTextures_PackID.find(iPackID)); - if( it == DLCTextures_PackID.end() ) - { - *ppchKeyID=NULL; - return false; - } - else - { - *ppchKeyID=(char *)it->second; - return true; - } +bool CMinecraftApp::GetDLCNameForPackID(const int iPackID, char** ppchKeyID) { + AUTO_VAR(it, DLCTextures_PackID.find(iPackID)); + if (it == DLCTextures_PackID.end()) { + *ppchKeyID = NULL; + return false; + } else { + *ppchKeyID = (char*)it->second; + return true; + } } -DLC_INFO *CMinecraftApp::GetDLCInfo(char *pchDLCName) -{ - std::string tempString=pchDLCName; +DLC_INFO* CMinecraftApp::GetDLCInfo(char* pchDLCName) { + std::string tempString = pchDLCName; - if(DLCInfo.size()>0) - { - AUTO_VAR(it, DLCInfo.find(tempString)); + if (DLCInfo.size() > 0) { + AUTO_VAR(it, DLCInfo.find(tempString)); - if( it == DLCInfo.end() ) - { - // nothing for this - return NULL; - } - else - { - return it->second; - } - } - else return NULL; + if (it == DLCInfo.end()) { + // nothing for this + return NULL; + } else { + return it->second; + } + } else + return NULL; } -DLC_INFO *CMinecraftApp::GetDLCInfoFromTPackID(int iTPID) -{ - std::unordered_map::iterator it= DLCInfo.begin(); +DLC_INFO* CMinecraftApp::GetDLCInfoFromTPackID(int iTPID) { + std::unordered_map::iterator it = DLCInfo.begin(); - for(int i=0;isecond)->iConfig==iTPID) - { - return it->second; - } - ++it; - } - return NULL; + for (int i = 0; i < DLCInfo.size(); i++) { + if (((DLC_INFO*)it->second)->iConfig == iTPID) { + return it->second; + } + ++it; + } + return NULL; } -DLC_INFO *CMinecraftApp::GetDLCInfo(int iIndex) -{ - std::unordered_map::iterator it= DLCInfo.begin(); +DLC_INFO* CMinecraftApp::GetDLCInfo(int iIndex) { + std::unordered_map::iterator it = DLCInfo.begin(); - for(int i=0;isecond; + return it->second; } -char *CMinecraftApp::GetDLCInfoTextures(int iIndex) -{ - std::unordered_map::iterator it= DLCTextures_PackID.begin(); +char* CMinecraftApp::GetDLCInfoTextures(int iIndex) { + std::unordered_map::iterator it = DLCTextures_PackID.begin(); - for(int i=0;isecond; + return it->second; } #elif defined _XBOX_ONE -bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const std::wstring &FirstSkin,std::wstring &ProductId) -{ - AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin)); - if( it == DLCInfo_SkinName.end() ) - { - return false; - } - else - { - ProductId=it->second; - return true; - } +bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const std::wstring& FirstSkin, + std::wstring& ProductId) { + AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin)); + if (it == DLCInfo_SkinName.end()) { + return false; + } else { + ProductId = it->second; + return true; + } } -bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,std::wstring &ProductId) -{ - AUTO_VAR(it, DLCTextures_PackID.find(iPackID)); - if( it == DLCTextures_PackID.end() ) - { - return false; - } - else - { - ProductId=it->second; - return true; - } +bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID, + std::wstring& ProductId) { + AUTO_VAR(it, DLCTextures_PackID.find(iPackID)); + if (it == DLCTextures_PackID.end()) { + return false; + } else { + ProductId = it->second; + return true; + } } // DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(std::wstring &ProductId) // { // return NULL; // } -DLC_INFO *CMinecraftApp::GetDLCInfoTrialOffer(int iIndex) -{ - return NULL; +DLC_INFO* CMinecraftApp::GetDLCInfoTrialOffer(int iIndex) { return NULL; } +DLC_INFO* CMinecraftApp::GetDLCInfoFullOffer(int iIndex) { + std::unordered_map::iterator it = + DLCInfo_Full.begin(); + + for (int i = 0; i < iIndex; i++) { + ++it; + } + + return it->second; } -DLC_INFO *CMinecraftApp::GetDLCInfoFullOffer(int iIndex) -{ - std::unordered_map::iterator it= DLCInfo_Full.begin(); +std::wstring CMinecraftApp::GetDLCInfoTexturesFullOffer(int iIndex) { + std::unordered_map::iterator it = + DLCTextures_PackID.begin(); - for(int i=0;isecond; -} -std::wstring CMinecraftApp::GetDLCInfoTexturesFullOffer(int iIndex) -{ - std::unordered_map::iterator it= DLCTextures_PackID.begin(); - - for(int i=0;isecond; + return it->second; } #else -bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const std::wstring &FirstSkin,ULONGLONG *pullVal) -{ - AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin)); - if( it == DLCInfo_SkinName.end() ) - { - return false; - } - else - { - *pullVal=(ULONGLONG)it->second; - return true; - } +bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const std::wstring& FirstSkin, + ULONGLONG* pullVal) { + AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin)); + if (it == DLCInfo_SkinName.end()) { + return false; + } else { + *pullVal = (ULONGLONG)it->second; + return true; + } } -bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,ULONGLONG *pullVal) -{ - AUTO_VAR(it, DLCTextures_PackID.find(iPackID)); - if( it == DLCTextures_PackID.end() ) - { - *pullVal=(ULONGLONG)0; - return false; - } - else - { - *pullVal=(ULONGLONG)it->second; - return true; - } +bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID, + ULONGLONG* pullVal) { + AUTO_VAR(it, DLCTextures_PackID.find(iPackID)); + if (it == DLCTextures_PackID.end()) { + *pullVal = (ULONGLONG)0; + return false; + } else { + *pullVal = (ULONGLONG)it->second; + return true; + } } -DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial) -{ - //DLC_INFO *pDLCInfo=NULL; - if(DLCInfo_Trial.size()>0) - { - AUTO_VAR(it, DLCInfo_Trial.find(ullOfferID_Trial)); +DLC_INFO* CMinecraftApp::GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial) { + // DLC_INFO *pDLCInfo=NULL; + if (DLCInfo_Trial.size() > 0) { + AUTO_VAR(it, DLCInfo_Trial.find(ullOfferID_Trial)); - if( it == DLCInfo_Trial.end() ) - { - // nothing for this - return NULL; - } - else - { - return it->second; - } - } - else return NULL; + if (it == DLCInfo_Trial.end()) { + // nothing for this + return NULL; + } else { + return it->second; + } + } else + return NULL; } -DLC_INFO *CMinecraftApp::GetDLCInfoTrialOffer(int iIndex) -{ - std::unordered_map::iterator it= DLCInfo_Trial.begin(); +DLC_INFO* CMinecraftApp::GetDLCInfoTrialOffer(int iIndex) { + std::unordered_map::iterator it = + DLCInfo_Trial.begin(); - for(int i=0;isecond; + return it->second; } -DLC_INFO *CMinecraftApp::GetDLCInfoFullOffer(int iIndex) -{ - std::unordered_map::iterator it= DLCInfo_Full.begin(); +DLC_INFO* CMinecraftApp::GetDLCInfoFullOffer(int iIndex) { + std::unordered_map::iterator it = + DLCInfo_Full.begin(); - for(int i=0;isecond; + return it->second; } -ULONGLONG CMinecraftApp::GetDLCInfoTexturesFullOffer(int iIndex) -{ - std::unordered_map::iterator it= DLCTextures_PackID.begin(); +ULONGLONG CMinecraftApp::GetDLCInfoTexturesFullOffer(int iIndex) { + std::unordered_map::iterator it = + DLCTextures_PackID.begin(); - for(int i=0;isecond; + return it->second; } #endif #ifdef _XBOX_ONE -DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(WCHAR *pwchProductID) -{ - std::wstring wsTemp = pwchProductID; - if(DLCInfo_Full.size()>0) - { - AUTO_VAR(it, DLCInfo_Full.find(wsTemp)); +DLC_INFO* CMinecraftApp::GetDLCInfoForFullOfferID(WCHAR* pwchProductID) { + std::wstring wsTemp = pwchProductID; + if (DLCInfo_Full.size() > 0) { + AUTO_VAR(it, DLCInfo_Full.find(wsTemp)); - if( it == DLCInfo_Full.end() ) - { - // nothing for this - return NULL; - } - else - { - return it->second; - } - } - else return NULL; + if (it == DLCInfo_Full.end()) { + // nothing for this + return NULL; + } else { + return it->second; + } + } else + return NULL; } -DLC_INFO *CMinecraftApp::GetDLCInfoForProductName(WCHAR *pwchProductName) -{ - std::unordered_map::iterator it= DLCInfo_Full.begin(); - std::wstring wsProductName=pwchProductName; +DLC_INFO* CMinecraftApp::GetDLCInfoForProductName(WCHAR* pwchProductName) { + std::unordered_map::iterator it = + DLCInfo_Full.begin(); + std::wstring wsProductName = pwchProductName; - for(int i=0;isecond; - if(wsProductName==pDLCInfo->wsDisplayName) - { - return pDLCInfo; - } - ++it; - } - - return NULL; + for (int i = 0; i < DLCInfo_Full.size(); i++) { + DLC_INFO* pDLCInfo = (DLC_INFO*)it->second; + if (wsProductName == pDLCInfo->wsDisplayName) { + return pDLCInfo; + } + ++it; + } + + return NULL; } -#elif defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) +#elif defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) #else -DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full) -{ +DLC_INFO* CMinecraftApp::GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full) { + if (DLCInfo_Full.size() > 0) { + AUTO_VAR(it, DLCInfo_Full.find(ullOfferID_Full)); - if(DLCInfo_Full.size()>0) - { - AUTO_VAR(it, DLCInfo_Full.find(ullOfferID_Full)); - - if( it == DLCInfo_Full.end() ) - { - // nothing for this - return NULL; - } - else - { - return it->second; - } - } - else return NULL; + if (it == DLCInfo_Full.end()) { + // nothing for this + return NULL; + } else { + return it->second; + } + } else + return NULL; } #endif -void CMinecraftApp::EnterSaveNotificationSection() -{ - EnterCriticalSection(&m_saveNotificationCriticalSection); - if( m_saveNotificationDepth++ == 0 ) - { - MinecraftServer::getInstance()->broadcastStartSavingPacket(); +void CMinecraftApp::EnterSaveNotificationSection() { + EnterCriticalSection(&m_saveNotificationCriticalSection); + if (m_saveNotificationDepth++ == 0) { + if (g_NetworkManager + .IsInSession()) // this can be triggered from the front end if + // we're downloading a save + { + MinecraftServer::getInstance()->broadcastStartSavingPacket(); - if( g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1 ) - { - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_PauseServer,(void *)TRUE); - } - } - LeaveCriticalSection(&m_saveNotificationCriticalSection); + if (g_NetworkManager.IsLocalGame() && + g_NetworkManager.GetPlayerCount() == 1) { + app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + eXuiServerAction_PauseServer, + (void*)TRUE); + } + } + } + LeaveCriticalSection(&m_saveNotificationCriticalSection); } -void CMinecraftApp::LeaveSaveNotificationSection() -{ - EnterCriticalSection(&m_saveNotificationCriticalSection); - if( --m_saveNotificationDepth == 0 ) - { - MinecraftServer::getInstance()->broadcastStopSavingPacket(); +void CMinecraftApp::LeaveSaveNotificationSection() { + EnterCriticalSection(&m_saveNotificationCriticalSection); + if (--m_saveNotificationDepth == 0) { + if (g_NetworkManager + .IsInSession()) // this can be triggered from the front end if + // we're downloading a save + { + MinecraftServer::getInstance()->broadcastStopSavingPacket(); - if( g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1 ) - { - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_PauseServer,(void *)FALSE); - } - } - LeaveCriticalSection(&m_saveNotificationCriticalSection); + if (g_NetworkManager.IsLocalGame() && + g_NetworkManager.GetPlayerCount() == 1) { + app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + eXuiServerAction_PauseServer, + (void*)FALSE); + } + } + } + LeaveCriticalSection(&m_saveNotificationCriticalSection); } +int CMinecraftApp::RemoteSaveThreadProc(void* lpParameter) { + // The game should be stopped while we are doing this, but the connections + // ticks may try to create some AABB's or Vec3's + AABB::UseDefaultThreadStorage(); + Vec3::UseDefaultThreadStorage(); + Compression::UseDefaultThreadStorage(); -int CMinecraftApp::RemoteSaveThreadProc( void* lpParameter ) -{ - // The game should be stopped while we are doing this, but the connections ticks may try to create some AABB's or Vec3's - AABB::UseDefaultThreadStorage(); - Vec3::UseDefaultThreadStorage(); - Compression::UseDefaultThreadStorage(); + // 4J-PB - Xbox 360 - 163153 - [CRASH] TU17: Code: Multiplayer: During the + // Autosave in an online Multiplayer session, the game occasionally crashes + // for one or more Clients callstack - > if(tls->tileId != this->id) + // updateDefaultShape(); callstack - > + // default.exe!WaterlilyTile::getAABB(Level * level, int x, int y, int z) + // line 38 + 8 bytes C++ + // ... + // default.exe!CMinecraftApp::RemoteSaveThreadProc(void * + // lpParameter) line 6694 C++ + // host autosave, and the clients can crash on receiving handleMoveEntity + // when it's a tile within this thread, so need to do the tls for tiles + Tile::CreateNewThreadStorage(); - // 4J-PB - Xbox 360 - 163153 - [CRASH] TU17: Code: Multiplayer: During the Autosave in an online Multiplayer session, the game occasionally crashes for one or more Clients - // callstack - > if(tls->tileId != this->id) updateDefaultShape(); - // callstack - > default.exe!WaterlilyTile::getAABB(Level * level, int x, int y, int z) line 38 + 8 bytes C++ - // ... - // default.exe!CMinecraftApp::RemoteSaveThreadProc(void * lpParameter) line 6694 C++ - // host autosave, and the clients can crash on receiving handleMoveEntity when it's a tile within this thread, so need to do the tls for tiles - Tile::CreateNewThreadStorage(); + Minecraft* pMinecraft = Minecraft::GetInstance(); - Minecraft *pMinecraft = Minecraft::GetInstance(); + pMinecraft->progressRenderer->progressStartNoAbort( + IDS_PROGRESS_HOST_SAVING); + pMinecraft->progressRenderer->progressStage(-1); + pMinecraft->progressRenderer->progressStagePercentage(0); - pMinecraft->progressRenderer->progressStartNoAbort( IDS_PROGRESS_HOST_SAVING ); - pMinecraft->progressRenderer->progressStage( -1 ); - pMinecraft->progressRenderer->progressStagePercentage(0); + while (!app.GetGameStarted() && + app.GetXuiAction(ProfileManager.GetPrimaryPad()) == + eAppAction_WaitRemoteServerSaveComplete) { + // Tick all the games connections + pMinecraft->tickAllConnections(); + Sleep(100); + } - while( !app.GetGameStarted() && app.GetXuiAction( ProfileManager.GetPrimaryPad() ) == eAppAction_WaitRemoteServerSaveComplete ) - { - // Tick all the games connections - pMinecraft->tickAllConnections(); - Sleep( 100 ); - } + if (app.GetXuiAction(ProfileManager.GetPrimaryPad()) != + eAppAction_WaitRemoteServerSaveComplete) { + // Something cancelled us? + return ERROR_CANCELLED; + } + app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_Idle); - if( app.GetXuiAction( ProfileManager.GetPrimaryPad() ) != eAppAction_WaitRemoteServerSaveComplete ) - { - // Something cancelled us? - return ERROR_CANCELLED; - } - app.SetAction(ProfileManager.GetPrimaryPad(),eAppAction_Idle); + ui.UpdatePlayerBasePositions(); - ui.UpdatePlayerBasePositions(); + Tile::ReleaseThreadStorage(); - Tile::ReleaseThreadStorage(); - - return 0; + return S_OK; } -void CMinecraftApp::ExitGameFromRemoteSave( void *lpParameter ) -{ - int primaryPad = ProfileManager.GetPrimaryPad(); - - unsigned int uiIDA[3]; - uiIDA[0]=IDS_CONFIRM_CANCEL; - uiIDA[1]=IDS_CONFIRM_OK; +void CMinecraftApp::ExitGameFromRemoteSave(void* lpParameter) { + int primaryPad = ProfileManager.GetPrimaryPad(); - ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, primaryPad,&CMinecraftApp::ExitGameFromRemoteSaveDialogReturned,NULL, app.GetStringTable(), 0, 0, false); + unsigned int uiIDA[3]; + uiIDA[0] = IDS_CONFIRM_CANCEL; + uiIDA[1] = IDS_CONFIRM_OK; + + ui.RequestAlertMessage( + IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, primaryPad, + &CMinecraftApp::ExitGameFromRemoteSaveDialogReturned, NULL); } -int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - //CScene_Pause* pClass = (CScene_Pause*)pParam; +int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + // CScene_Pause* pClass = (CScene_Pause*)pParam; - // results switched for this dialog - if(result==C4JStorage::EMessage_ResultDecline) - { - app.SetAction(iPad,eAppAction_ExitWorld); - } - else - { + // results switched for this dialog + if (result == C4JStorage::EMessage_ResultDecline) { + app.SetAction(iPad, eAppAction_ExitWorld); + } else { #ifndef _XBOX - // Inform fullscreen progress scene that it's not being cancelled after all - UIScene_FullscreenProgress *pScene = (UIScene_FullscreenProgress *)ui.FindScene(eUIScene_FullscreenProgress); + // Inform fullscreen progress scene that it's not being cancelled after + // all + UIScene_FullscreenProgress* pScene = + (UIScene_FullscreenProgress*)ui.FindScene( + eUIScene_FullscreenProgress); #ifdef __PS3__ - if(pScene!=NULL) + if (pScene != NULL) #else - if (pScene != nullptr) + if (pScene != nullptr) #endif - { - pScene->SetWasCancelled(false); - } + { + pScene->SetWasCancelled(false); + } #else - // Don't have to worry about this on Xbox + // Don't have to worry about this on Xbox #endif - } - return 0; + } + return 0; } -void CMinecraftApp::SetSpecialTutorialCompletionFlag(int iPad, int index) -{ - if(index >= 0 && index < 32 && GameSettingsA[iPad] != NULL) - { - GameSettingsA[iPad]->uiSpecialTutorialBitmask |= (1<= 0 && index < 32 && GameSettingsA[iPad] != NULL) { + GameSettingsA[iPad]->uiSpecialTutorialBitmask |= (1 << index); + } } // BANNED LIST FUNCTIONS -void CMinecraftApp::SetUniqueMapName(char *pszUniqueMapName) -{ - memcpy(m_pszUniqueMapName,pszUniqueMapName,14); +void CMinecraftApp::SetUniqueMapName(char* pszUniqueMapName) { + memcpy(m_pszUniqueMapName, pszUniqueMapName, 14); } -char *CMinecraftApp::GetUniqueMapName(void) -{ - return m_pszUniqueMapName; -} +char* CMinecraftApp::GetUniqueMapName(void) { return m_pszUniqueMapName; } -void CMinecraftApp::InvalidateBannedList(int iPad) -{ - if(m_bRead_BannedListA[iPad]==true) - { - m_bRead_BannedListA[iPad]=false; - SetBanListCheck(iPad,false); - m_vBannedListA[iPad]->clear(); +void CMinecraftApp::InvalidateBannedList(int iPad) { + if (m_bRead_BannedListA[iPad] == true) { + m_bRead_BannedListA[iPad] = false; + SetBanListCheck(iPad, false); + m_vBannedListA[iPad]->clear(); - if(BannedListA[iPad].pBannedList) - { - delete [] BannedListA[iPad].pBannedList; - BannedListA[iPad].pBannedList=NULL; - } - } + if (BannedListA[iPad].pBannedList) { + delete[] BannedListA[iPad].pBannedList; + BannedListA[iPad].pBannedList = NULL; + } + } } #ifdef _XBOX_ONE -void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PBANNEDLISTDATA pBannedListData, bool bWriteToTMS) -{ - PlayerUID xuid= pBannedListData->wchPlayerUID; +void CMinecraftApp::AddLevelToBannedLevelList(int iPad, + PBANNEDLISTDATA pBannedListData, + bool bWriteToTMS) { + PlayerUID xuid = pBannedListData->wchPlayerUID; - AddLevelToBannedLevelList(iPad,xuid,pBannedListData->pszLevelName,bWriteToTMS); + AddLevelToBannedLevelList(iPad, xuid, pBannedListData->pszLevelName, + bWriteToTMS); } #endif -void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *pszLevelName, bool bWriteToTMS) -{ - // we will have retrieved the banned level list from TMS, so add this one to it and write it back to TMS +void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, + char* pszLevelName, + bool bWriteToTMS) { + // we will have retrieved the banned level list from TMS, so add this one to + // it and write it back to TMS - BANNEDLISTDATA *pBannedListData = new BANNEDLISTDATA; - memset(pBannedListData,0,sizeof(BANNEDLISTDATA)); + BANNEDLISTDATA* pBannedListData = new BANNEDLISTDATA; + memset(pBannedListData, 0, sizeof(BANNEDLISTDATA)); #ifdef _DURANGO - memcpy(&pBannedListData->wchPlayerUID, xuid.toString().c_str(), sizeof(WCHAR)*64); + memcpy(&pBannedListData->wchPlayerUID, xuid.toString().c_str(), + sizeof(WCHAR) * 64); #else - memcpy(&pBannedListData->xuid, &xuid, sizeof(PlayerUID)); + memcpy(&pBannedListData->xuid, &xuid, sizeof(PlayerUID)); #endif - strcpy(pBannedListData->pszLevelName,pszLevelName); - m_vBannedListA[iPad]->push_back(pBannedListData); + strcpy(pBannedListData->pszLevelName, pszLevelName); + m_vBannedListA[iPad]->push_back(pBannedListData); - if(bWriteToTMS) - { - const std::size_t bannedListCount = m_vBannedListA[iPad]->size(); - const unsigned int dataBytes = static_cast(sizeof(BANNEDLISTDATA) * bannedListCount); - PBANNEDLISTDATA pBannedList = new BANNEDLISTDATA[bannedListCount]; - int iCount=0; - for(AUTO_VAR(it, m_vBannedListA[iPad]->begin()); it != m_vBannedListA[iPad]->end(); ++it) - { - PBANNEDLISTDATA pData=*it; - memcpy(&pBannedList[iCount++],pData,sizeof(BANNEDLISTDATA)); - } + if (bWriteToTMS) { + const std::size_t bannedListCount = m_vBannedListA[iPad]->size(); + const unsigned int dataBytes = + static_cast(sizeof(BANNEDLISTDATA) * bannedListCount); + PBANNEDLISTDATA pBannedList = new BANNEDLISTDATA[bannedListCount]; + int iCount = 0; + for (AUTO_VAR(it, m_vBannedListA[iPad]->begin()); + it != m_vBannedListA[iPad]->end(); ++it) { + PBANNEDLISTDATA pData = *it; + memcpy(&pBannedList[iCount++], pData, sizeof(BANNEDLISTDATA)); + } - // 4J-PB - write to TMS++ now + // 4J-PB - write to TMS++ now - //bool bRes=StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(PBYTE)pBannedList, dataBytes); + // bool + // bRes=StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(std::uint8_t*)pBannedList, + // dwDataBytes); #ifdef _XBOX - StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,C4JStorage::TMS_UGCTYPE_NONE,"BannedList",(PCHAR) pBannedList, dataBytes,NULL,NULL, 0); + StorageManager.TMSPP_WriteFile( + iPad, C4JStorage::eGlobalStorage_TitleUser, + C4JStorage::TMS_FILETYPE_BINARY, C4JStorage::TMS_UGCTYPE_NONE, + "BannedList", (PCHAR)pBannedList, dataBytes, NULL, NULL, 0); #elif defined _XBOX_ONE - StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dataBytes,NULL,NULL, 0); + StorageManager.TMSPP_WriteFile( + iPad, C4JStorage::eGlobalStorage_TitleUser, + C4JStorage::TMS_FILETYPE_BINARY, L"BannedList", + (std::uint8_t*)pBannedList, dataBytes, NULL, NULL, 0); #endif - delete[] pBannedList; - } - // update telemetry too + + delete[] pBannedList; + } + // update telemetry too } -bool CMinecraftApp::IsInBannedLevelList(int iPad, PlayerUID xuid, char *pszLevelName) -{ - for(AUTO_VAR(it, m_vBannedListA[iPad]->begin()); it != m_vBannedListA[iPad]->end(); ++it) - { - PBANNEDLISTDATA pData=*it; +bool CMinecraftApp::IsInBannedLevelList(int iPad, PlayerUID xuid, + char* pszLevelName) { + for (AUTO_VAR(it, m_vBannedListA[iPad]->begin()); + it != m_vBannedListA[iPad]->end(); ++it) { + PBANNEDLISTDATA pData = *it; #ifdef _XBOX_ONE - PlayerUID bannedPlayerUID = pData->wchPlayerUID; - if(IsEqualXUID (bannedPlayerUID,xuid) && (strcmp(pData->pszLevelName,pszLevelName)==0)) -#else - if(IsEqualXUID (pData->xuid,xuid) && (strcmp(pData->pszLevelName,pszLevelName)==0)) + PlayerUID bannedPlayerUID = pData->wchPlayerUID; + if (IsEqualXUID(bannedPlayerUID, xuid) && + (strcmp(pData->pszLevelName, pszLevelName) == 0)) +#else + if (IsEqualXUID(pData->xuid, xuid) && + (strcmp(pData->pszLevelName, pszLevelName) == 0)) #endif - { - return true; - } - } + { + return true; + } + } - return false; + return false; } -void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, char *pszLevelName) -{ - //bool bFound=false; - //bool bRes; - - // we will have retrieved the banned level list from TMS, so remove this one from it and write it back to TMS - for(AUTO_VAR(it, m_vBannedListA[iPad]->begin()); it != m_vBannedListA[iPad]->end(); ) - { - PBANNEDLISTDATA pBannedListData = *it; - - if(pBannedListData!=NULL) - { +void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, + char* pszLevelName) { + // bool bFound=false; + // bool bRes; + + // we will have retrieved the banned level list from TMS, so remove this one + // from it and write it back to TMS + for (AUTO_VAR(it, m_vBannedListA[iPad]->begin()); + it != m_vBannedListA[iPad]->end();) { + PBANNEDLISTDATA pBannedListData = *it; + + if (pBannedListData != NULL) { #ifdef _XBOX_ONE - PlayerUID bannedPlayerUID = pBannedListData->wchPlayerUID; - if(IsEqualXUID (bannedPlayerUID,xuid) && (strcmp(pBannedListData->pszLevelName,pszLevelName)==0)) + PlayerUID bannedPlayerUID = pBannedListData->wchPlayerUID; + if (IsEqualXUID(bannedPlayerUID, xuid) && + (strcmp(pBannedListData->pszLevelName, pszLevelName) == 0)) #else - if(IsEqualXUID (pBannedListData->xuid,xuid) && (strcmp(pBannedListData->pszLevelName,pszLevelName)==0)) + if (IsEqualXUID(pBannedListData->xuid, xuid) && + (strcmp(pBannedListData->pszLevelName, pszLevelName) == 0)) #endif - { - TelemetryManager->RecordUnBanLevel(iPad); + { + TelemetryManager->RecordUnBanLevel(iPad); - // match found, so remove this entry - it = m_vBannedListA[iPad]->erase(it); - } - else - { - ++it; - } - } - else - { - ++it; - } - } + // match found, so remove this entry + it = m_vBannedListA[iPad]->erase(it); + } else { + ++it; + } + } else { + ++it; + } + } - const std::size_t bannedListCount = m_vBannedListA[iPad]->size(); - const unsigned int dataBytes = static_cast(sizeof(BANNEDLISTDATA) * bannedListCount); - if(dataBytes==0) - { - // wipe the file + const std::size_t bannedListCount = m_vBannedListA[iPad]->size(); + const unsigned int dataBytes = + static_cast(sizeof(BANNEDLISTDATA) * bannedListCount); + if (dataBytes == 0) { + // wipe the file #ifdef _XBOX - StorageManager.DeleteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList"); + StorageManager.DeleteTMSFile(iPad, C4JStorage::eGlobalStorage_TitleUser, + L"BannedList"); #elif defined _XBOX_ONE - StorageManager.TMSPP_DeleteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",NULL,NULL, 0); + StorageManager.TMSPP_DeleteFile( + iPad, C4JStorage::eGlobalStorage_TitleUser, + C4JStorage::TMS_FILETYPE_BINARY, L"BannedList", NULL, NULL, 0); #endif - } - else - { - PBANNEDLISTDATA pBannedList = new BANNEDLISTDATA[bannedListCount]; + } else { + PBANNEDLISTDATA pBannedList = + (BANNEDLISTDATA*)(new std::uint8_t[dataBytes]); - for(std::size_t i = 0; i < bannedListCount; ++i) - { - PBANNEDLISTDATA pBannedListData =m_vBannedListA[iPad]->at(i); + for (std::size_t i = 0; i < bannedListCount; ++i) { + PBANNEDLISTDATA pBannedListData = m_vBannedListA[iPad]->at(i); - memcpy(&pBannedList[i],pBannedListData,sizeof(BANNEDLISTDATA)); - } + memcpy(&pBannedList[i], pBannedListData, sizeof(BANNEDLISTDATA)); + } #ifdef _XBOX - StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(PBYTE)pBannedList, dataBytes); + StorageManager.WriteTMSFile(iPad, C4JStorage::eGlobalStorage_TitleUser, + L"BannedList", (std::uint8_t*)pBannedList, + dataBytes); #elif defined _XBOX_ONE - StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dataBytes,NULL,NULL, 0); + StorageManager.TMSPP_WriteFile( + iPad, C4JStorage::eGlobalStorage_TitleUser, + C4JStorage::TMS_FILETYPE_BINARY, L"BannedList", (PBYTE)pBannedList, + dataBytes, NULL, NULL, 0); #endif - delete [] pBannedList; - } + delete[] pBannedList; + } - // update telemetry too + // update telemetry too } // function to add credits for the DLC packs -void CMinecraftApp::AddCreditText(const wchar_t *lpStr) -{ - DebugPrintf("ADDING CREDIT - %ls\n",lpStr); - // add a string from the DLC to a credits vector - SCreditTextItemDef *pCreditStruct = new SCreditTextItemDef; - pCreditStruct->m_eType=eSmallText; - pCreditStruct->m_iStringID[0]=NO_TRANSLATED_STRING; - pCreditStruct->m_iStringID[1]=NO_TRANSLATED_STRING; - pCreditStruct->m_Text=new WCHAR [wcslen(lpStr)+1]; - wcscpy((WCHAR *)pCreditStruct->m_Text,lpStr); +void CMinecraftApp::AddCreditText(const wchar_t* lpStr) { + DebugPrintf("ADDING CREDIT - %ls\n", lpStr); + // add a std::string from the DLC to a credits std::vector + SCreditTextItemDef* pCreditStruct = new SCreditTextItemDef; + pCreditStruct->m_eType = eSmallText; + pCreditStruct->m_iStringID[0] = NO_TRANSLATED_STRING; + pCreditStruct->m_iStringID[1] = NO_TRANSLATED_STRING; + pCreditStruct->m_Text = new WCHAR[wcslen(lpStr) + 1]; + wcscpy((WCHAR*)pCreditStruct->m_Text, lpStr); - vDLCCredits.push_back(pCreditStruct); + vDLCCredits.push_back(pCreditStruct); } -bool CMinecraftApp::AlreadySeenCreditText(const std::wstring &wstemp) -{ +bool CMinecraftApp::AlreadySeenCreditText(const std::wstring& wstemp) { + for (unsigned int i = 0; i < m_vCreditText.size(); i++) { + std::wstring temp = m_vCreditText.at(i); - for(unsigned int i=0;i>4; - break; - case eGameHostOption_All: - return (uiHostSettings&GAME_HOST_OPTION_BITMASK_ALL); - break; - case eGameHostOption_Tutorial: - // special case - tutorial is offline, but we want the gamertag option, and set Easy mode, structures on, fire on, tnt on, pvp on, trust players on - return ((uiHostSettings&GAME_HOST_OPTION_BITMASK_GAMERTAGS)|GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS|GAME_HOST_OPTION_BITMASK_FIRESPREADS|GAME_HOST_OPTION_BITMASK_TNT|GAME_HOST_OPTION_BITMASK_PVP|GAME_HOST_OPTION_BITMASK_STRUCTURES|1); - break; - case eGameHostOption_LevelType: - return (uiHostSettings&GAME_HOST_OPTION_BITMASK_LEVELTYPE); - break; - case eGameHostOption_Structures: - return (uiHostSettings&GAME_HOST_OPTION_BITMASK_STRUCTURES); - break; - case eGameHostOption_BonusChest: - return (uiHostSettings&GAME_HOST_OPTION_BITMASK_BONUSCHEST); - break; - case eGameHostOption_HasBeenInCreative: - return (uiHostSettings&GAME_HOST_OPTION_BITMASK_BEENINCREATIVE); - break; - case eGameHostOption_PvP: - return (uiHostSettings&GAME_HOST_OPTION_BITMASK_PVP); - break; - case eGameHostOption_TrustPlayers: - return (uiHostSettings&GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS); - break; - case eGameHostOption_TNT: - return (uiHostSettings&GAME_HOST_OPTION_BITMASK_TNT); - break; - case eGameHostOption_FireSpreads: - return (uiHostSettings&GAME_HOST_OPTION_BITMASK_FIRESPREADS); - break; - case eGameHostOption_CheatsEnabled: - return (uiHostSettings&(GAME_HOST_OPTION_BITMASK_HOSTFLY|GAME_HOST_OPTION_BITMASK_HOSTHUNGER|GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE)); - break; - case eGameHostOption_HostCanFly: - return (uiHostSettings&GAME_HOST_OPTION_BITMASK_HOSTFLY); - break; - case eGameHostOption_HostCanChangeHunger: - return (uiHostSettings&GAME_HOST_OPTION_BITMASK_HOSTHUNGER); - break; - case eGameHostOption_HostCanBeInvisible: - return (uiHostSettings&GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE); - break; - case eGameHostOption_BedrockFog: - return (uiHostSettings&GAME_HOST_OPTION_BITMASK_BEDROCKFOG); - break; - case eGameHostOption_DisableSaving: - return (uiHostSettings&GAME_HOST_OPTION_BITMASK_DISABLESAVE); - break; - default: - return 0; - } +unsigned int CMinecraftApp::GetGameHostOption(unsigned int uiHostSettings, + eGameHostOption eVal) { + // unsigned int uiVal=0; + switch (eVal) { + case eGameHostOption_FriendsOfFriends: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS); + break; + case eGameHostOption_Difficulty: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_DIFFICULTY); + break; + case eGameHostOption_Gamertags: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_GAMERTAGS); + break; + case eGameHostOption_GameType: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_GAMETYPE) >> 4; + break; + case eGameHostOption_All: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_ALL); + break; + case eGameHostOption_Tutorial: + // special case - tutorial is offline, but we want the gamertag + // option, and set Easy mode, structures on, fire on, tnt on, pvp + // on, trust players on + return ((uiHostSettings & GAME_HOST_OPTION_BITMASK_GAMERTAGS) | + GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS | + GAME_HOST_OPTION_BITMASK_FIRESPREADS | + GAME_HOST_OPTION_BITMASK_TNT | + GAME_HOST_OPTION_BITMASK_PVP | + GAME_HOST_OPTION_BITMASK_STRUCTURES | 1); + break; + case eGameHostOption_LevelType: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_LEVELTYPE); + break; + case eGameHostOption_Structures: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_STRUCTURES); + break; + case eGameHostOption_BonusChest: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_BONUSCHEST); + break; + case eGameHostOption_HasBeenInCreative: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_BEENINCREATIVE); + break; + case eGameHostOption_PvP: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_PVP); + break; + case eGameHostOption_TrustPlayers: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS); + break; + case eGameHostOption_TNT: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_TNT); + break; + case eGameHostOption_FireSpreads: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_FIRESPREADS); + break; + case eGameHostOption_CheatsEnabled: + return (uiHostSettings & (GAME_HOST_OPTION_BITMASK_HOSTFLY | + GAME_HOST_OPTION_BITMASK_HOSTHUNGER | + GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE)); + break; + case eGameHostOption_HostCanFly: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_HOSTFLY); + break; + case eGameHostOption_HostCanChangeHunger: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_HOSTHUNGER); + break; + case eGameHostOption_HostCanBeInvisible: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE); + break; + case eGameHostOption_BedrockFog: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_BEDROCKFOG); + break; + case eGameHostOption_DisableSaving: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_DISABLESAVE); + break; + case eGameHostOption_WasntSaveOwner: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_NOTOWNER); + case eGameHostOption_WorldSize: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_WORLDSIZE) >> + GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT; + case eGameHostOption_MobGriefing: + return !(uiHostSettings & GAME_HOST_OPTION_BITMASK_MOBGRIEFING); + case eGameHostOption_KeepInventory: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_KEEPINVENTORY); + case eGameHostOption_DoMobSpawning: + return !(uiHostSettings & GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING); + case eGameHostOption_DoMobLoot: + return !(uiHostSettings & GAME_HOST_OPTION_BITMASK_DOMOBLOOT); + case eGameHostOption_DoTileDrops: + return !(uiHostSettings & GAME_HOST_OPTION_BITMASK_DOTILEDROPS); + case eGameHostOption_NaturalRegeneration: + return !(uiHostSettings & GAME_HOST_OPTION_BITMASK_NATURALREGEN); + case eGameHostOption_DoDaylightCycle: + return !(uiHostSettings & GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE); + break; + default: + return 0; + } - return false; + return false; } -bool CMinecraftApp::CanRecordStatsAndAchievements() -{ - // 4J Stu - All of these options give the host player some advantage, so should not allow achievements - return !(app.GetGameHostOption(eGameHostOption_HasBeenInCreative) || - app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) || - app.GetGameHostOption(eGameHostOption_HostCanChangeHunger) || - app.GetGameHostOption(eGameHostOption_HostCanFly)); +bool CMinecraftApp::CanRecordStatsAndAchievements() { + bool isTutorial = Minecraft::GetInstance() != NULL && + Minecraft::GetInstance()->isTutorial(); + // 4J Stu - All of these options give the host player some advantage, so + // should not allow achievements + return !(app.GetGameHostOption(eGameHostOption_HasBeenInCreative) || + app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) || + app.GetGameHostOption(eGameHostOption_HostCanChangeHunger) || + app.GetGameHostOption(eGameHostOption_HostCanFly) || + app.GetGameHostOption(eGameHostOption_WasntSaveOwner) || + !app.GetGameHostOption(eGameHostOption_MobGriefing) || + app.GetGameHostOption(eGameHostOption_KeepInventory) || + !app.GetGameHostOption(eGameHostOption_DoMobSpawning) || + (!app.GetGameHostOption(eGameHostOption_DoDaylightCycle) && + !isTutorial)); } -void CMinecraftApp::processSchematics(LevelChunk *levelChunk) -{ - m_gameRules.processSchematics(levelChunk); +void CMinecraftApp::processSchematics(LevelChunk* levelChunk) { + m_gameRules.processSchematics(levelChunk); } -void CMinecraftApp::processSchematicsLighting(LevelChunk *levelChunk) -{ - m_gameRules.processSchematicsLighting(levelChunk); +void CMinecraftApp::processSchematicsLighting(LevelChunk* levelChunk) { + m_gameRules.processSchematicsLighting(levelChunk); } -void CMinecraftApp::loadDefaultGameRules() -{ - m_gameRules.loadDefaultGameRules(); +void CMinecraftApp::loadDefaultGameRules() { + m_gameRules.loadDefaultGameRules(); } -void CMinecraftApp::setLevelGenerationOptions(LevelGenerationOptions *levelGen) -{ - m_gameRules.setLevelGenerationOptions(levelGen); +void CMinecraftApp::setLevelGenerationOptions( + LevelGenerationOptions* levelGen) { + m_gameRules.setLevelGenerationOptions(levelGen); } -const wchar_t *CMinecraftApp::GetGameRulesString(const std::wstring &key) -{ - return m_gameRules.GetGameRulesString(key); +const wchar_t* CMinecraftApp::GetGameRulesString(const std::wstring& key) { + return m_gameRules.GetGameRulesString(key); } -unsigned char CMinecraftApp::m_szPNG[8]= -{ - 137,80,78,71,13,10,26,10 -}; +unsigned char CMinecraftApp::m_szPNG[8] = {137, 80, 78, 71, 13, 10, 26, 10}; #define PNG_TAG_tEXt 0x74455874 -unsigned int CMinecraftApp::FromBigEndian(unsigned int uiValue) -{ +unsigned int CMinecraftApp::FromBigEndian(unsigned int uiValue) { #if defined(__PS3__) || defined(_XBOX) - // Keep it in big endian - return uiValue; + // Keep it in big endian + return uiValue; #else - unsigned int uiReturn = ( ( uiValue >> 24 ) & 0x000000ff ) | - ( ( uiValue >> 8 ) & 0x0000ff00 ) | - ( ( uiValue << 8 ) & 0x00ff0000 ) | - ( ( uiValue << 24 ) & 0xff000000 ); - return uiReturn; + unsigned int uiReturn = + ((uiValue >> 24) & 0x000000ff) | ((uiValue >> 8) & 0x0000ff00) | + ((uiValue << 8) & 0x00ff0000) | ((uiValue << 24) & 0xff000000); + return uiReturn; #endif } -void CMinecraftApp::GetImageTextData(std::uint8_t *imageData, unsigned int imageBytes, unsigned char *seedText, unsigned int &uiHostOptions, bool &bHostOptionsRead, std::uint32_t &uiTexturePack) -{ - auto readPngUInt32 = [](const std::uint8_t *data) -> unsigned int - { - unsigned int value = 0; - std::memcpy(&value, data, sizeof(value)); - return value; - }; +void CMinecraftApp::GetImageTextData(std::uint8_t* imageData, + unsigned int imageBytes, + unsigned char* seedText, + unsigned int& uiHostOptions, + bool& bHostOptionsRead, + std::uint32_t& uiTexturePack) { + auto readPngUInt32 = [](const std::uint8_t* data) -> unsigned int { + unsigned int value = 0; + std::memcpy(&value, data, sizeof(value)); + return value; + }; - std::uint8_t *ucPtr = imageData; - unsigned int uiCount=0; - unsigned int uiChunkLen; - unsigned int uiChunkType; - unsigned int uiCRC; - char szKeyword[80]; + std::uint8_t* ucPtr = imageData; + unsigned int uiCount = 0; + unsigned int uiChunkLen; + unsigned int uiChunkType; + unsigned int uiCRC; + char szKeyword[80]; - // check it's a png - for(int i=0;i<8;i++) - { - if(m_szPNG[i]!=ucPtr[i]) return; - } + // check it's a png + for (int i = 0; i < 8; i++) { + if (m_szPNG[i] != ucPtr[i]) return; + } - uiCount+=8; + uiCount += 8; - while(uiCount < imageBytes) - { - uiChunkLen = FromBigEndian(readPngUInt32(&ucPtr[uiCount])); - uiCount+=sizeof(int); - uiChunkType = FromBigEndian(readPngUInt32(&ucPtr[uiCount])); - uiCount+=sizeof(int); + while (uiCount < imageBytes) { + uiChunkLen = FromBigEndian(readPngUInt32(&ucPtr[uiCount])); + uiCount += sizeof(int); + uiChunkType = FromBigEndian(readPngUInt32(&ucPtr[uiCount])); + uiCount += sizeof(int); - if(uiChunkType==PNG_TAG_tEXt) // tEXt - { - // check that it's the 4J text - unsigned char *pszKeyword=&ucPtr[uiCount]; - while(pszKeyword < ucPtr + uiCount + uiChunkLen) - { - ZeroMemory(szKeyword,80); - unsigned int uiKeywordC=0; - while(*pszKeyword!=0) - { - szKeyword[uiKeywordC++]=*pszKeyword; - pszKeyword++; - } - pszKeyword++; - if(strcmp(szKeyword,"4J_SEED")==0) - { - // read the seed value - unsigned int uiValueC=0; - while(*pszKeyword!=0 && (pszKeyword < ucPtr + uiCount + uiChunkLen) ) - { - seedText[uiValueC++]=*pszKeyword; - pszKeyword++; - } - //memcpy(seedText,pszKeyword,uiChunkLen-8); - } - else if(strcmp(szKeyword,"4J_HOSTOPTIONS")==0) - { - bHostOptionsRead = true; - // read the host options value - unsigned int uiValueC=0; - unsigned char pszHostOptions[8]; // Hex representation of unsigned int - ZeroMemory(&pszHostOptions,8); - while(*pszKeyword!=0 && (pszKeyword < ucPtr + uiCount + uiChunkLen) && uiValueC < 8) - { - pszHostOptions[uiValueC++]=*pszKeyword; - pszKeyword++; - } + if (uiChunkType == PNG_TAG_tEXt) // tEXt + { + // check that it's the 4J text + unsigned char* pszKeyword = &ucPtr[uiCount]; + while (pszKeyword < ucPtr + uiCount + uiChunkLen) { + ZeroMemory(szKeyword, 80); + unsigned int uiKeywordC = 0; + while (*pszKeyword != 0) { + szKeyword[uiKeywordC++] = *pszKeyword; + pszKeyword++; + } + pszKeyword++; + if (strcmp(szKeyword, "4J_SEED") == 0) { + // read the seed value + unsigned int uiValueC = 0; + while (*pszKeyword != 0 && + (pszKeyword < ucPtr + uiCount + uiChunkLen)) { + seedText[uiValueC++] = *pszKeyword; + pszKeyword++; + } + // memcpy(seedText,pszKeyword,uiChunkLen-8); + } else if (strcmp(szKeyword, "4J_HOSTOPTIONS") == 0) { + bHostOptionsRead = true; + // read the host options value + unsigned int uiValueC = 0; + unsigned char pszHostOptions[9]; // Hex representation of + // unsigned int + ZeroMemory(&pszHostOptions, 9); + while (*pszKeyword != 0 && + (pszKeyword < ucPtr + uiCount + uiChunkLen) && + uiValueC < 8) { + pszHostOptions[uiValueC++] = *pszKeyword; + pszKeyword++; + } - uiHostOptions = 0; - std::stringstream ss; - ss << pszHostOptions; - ss >> std::hex >> uiHostOptions; - } - else if(strcmp(szKeyword,"4J_TEXTUREPACK")==0) - { - // read the texture pack value - unsigned int uiValueC=0; - unsigned char pszTexturePack[8]; // Hex representation of unsigned int - ZeroMemory(&pszTexturePack,8); - while(*pszKeyword!=0 && (pszKeyword < ucPtr + uiCount + uiChunkLen) && uiValueC < 8) - { - pszTexturePack[uiValueC++]=*pszKeyword; - pszKeyword++; - } + uiHostOptions = 0; + std::stringstream ss; + ss << pszHostOptions; + ss >> std::hex >> uiHostOptions; + } else if (strcmp(szKeyword, "4J_TEXTUREPACK") == 0) { + // read the texture pack value + unsigned int uiValueC = 0; + unsigned char pszTexturePack[9]; // Hex representation of + // unsigned int + ZeroMemory(&pszTexturePack, 9); + while (*pszKeyword != 0 && + (pszKeyword < ucPtr + uiCount + uiChunkLen) && + uiValueC < 8) { + pszTexturePack[uiValueC++] = *pszKeyword; + pszKeyword++; + } - std::stringstream ss; - ss << pszTexturePack; - ss >> std::hex >> uiTexturePack; - } - } - } - uiCount+=uiChunkLen; - uiCRC = FromBigEndian(readPngUInt32(&ucPtr[uiCount])); - uiCount+=sizeof(int); - } + std::stringstream ss; + ss << pszTexturePack; + ss >> std::hex >> uiTexturePack; + } + } + } + uiCount += uiChunkLen; + uiCRC = FromBigEndian(readPngUInt32(&ucPtr[uiCount])); + uiCount += sizeof(int); + } - return; + return; } -unsigned int CMinecraftApp::CreateImageTextData(std::uint8_t *textMetadata, __int64 seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId) -{ - int iTextMetadataBytes = 0; - if(hasSeed) - { - strcpy((char *)textMetadata,"4J_SEED"); - snprintf((char *)&textMetadata[8], 42, "%lld", (long long)seed); +unsigned int CMinecraftApp::CreateImageTextData(std::uint8_t* textMetadata, + int64_t seed, bool hasSeed, + unsigned int uiHostOptions, + unsigned int uiTexturePackId) { + int iTextMetadataBytes = 0; + if (hasSeed) { + strcpy((char*)textMetadata, "4J_SEED"); + snprintf((char*)&textMetadata[8], 42, "%lld", (long long)seed); - // get the length - iTextMetadataBytes+=8; - while(textMetadata[iTextMetadataBytes]!=0) iTextMetadataBytes++; - ++iTextMetadataBytes; // Add a null terminator at the end of the seed value - } + // get the length + iTextMetadataBytes += 8; + while (textMetadata[iTextMetadataBytes] != 0) iTextMetadataBytes++; + ++iTextMetadataBytes; // Add a null terminator at the end of the seed + // value + } - // Save the host options that this world was last played with - strcpy((char *)&textMetadata[iTextMetadataBytes],"4J_HOSTOPTIONS"); - snprintf( (char *)&textMetadata[iTextMetadataBytes + 15], 9, "%X", uiHostOptions); + // Save the host options that this world was last played with + strcpy((char*)&textMetadata[iTextMetadataBytes], "4J_HOSTOPTIONS"); + snprintf((char*)&textMetadata[iTextMetadataBytes + 15], 9, "%X", + uiHostOptions); - iTextMetadataBytes += 15; - while(textMetadata[iTextMetadataBytes]!=0) iTextMetadataBytes++; - ++iTextMetadataBytes; // Add a null terminator at the end of the host options value + iTextMetadataBytes += 15; + while (textMetadata[iTextMetadataBytes] != 0) iTextMetadataBytes++; + ++iTextMetadataBytes; // Add a null terminator at the end of the host + // options value - // Save the texture pack id - strcpy((char *)&textMetadata[iTextMetadataBytes],"4J_TEXTUREPACK"); + // Save the texture pack id + strcpy((char*)&textMetadata[iTextMetadataBytes], "4J_TEXTUREPACK"); + snprintf((char*)&textMetadata[iTextMetadataBytes + 15], 9, "%X", + uiHostOptions); - iTextMetadataBytes += 15; - while(textMetadata[iTextMetadataBytes]!=0) iTextMetadataBytes++; + iTextMetadataBytes += 15; + while (textMetadata[iTextMetadataBytes] != 0) iTextMetadataBytes++; - return iTextMetadataBytes; + return iTextMetadataBytes; } -void CMinecraftApp::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType,int x,int z) -{ - // check we don't already have this in - for(AUTO_VAR(it, m_vTerrainFeatures.begin()); it < m_vTerrainFeatures.end(); ++it) - { - FEATURE_DATA *pFeatureData=*it; +void CMinecraftApp::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType, + int x, int z) { + // check we don't already have this in + for (AUTO_VAR(it, m_vTerrainFeatures.begin()); + it < m_vTerrainFeatures.end(); ++it) { + FEATURE_DATA* pFeatureData = *it; - if((pFeatureData->eTerrainFeature==eFeatureType) &&(pFeatureData->x==x) && (pFeatureData->z==z)) return; - } + if ((pFeatureData->eTerrainFeature == eFeatureType) && + (pFeatureData->x == x) && (pFeatureData->z == z)) + return; + } - FEATURE_DATA *pFeatureData= new FEATURE_DATA; - pFeatureData->eTerrainFeature=eFeatureType; - pFeatureData->x=x; - pFeatureData->z=z; + FEATURE_DATA* pFeatureData = new FEATURE_DATA; + pFeatureData->eTerrainFeature = eFeatureType; + pFeatureData->x = x; + pFeatureData->z = z; - m_vTerrainFeatures.push_back(pFeatureData); + m_vTerrainFeatures.push_back(pFeatureData); } -_eTerrainFeatureType CMinecraftApp::IsTerrainFeature(int x,int z) -{ - for(AUTO_VAR(it, m_vTerrainFeatures.begin()); it < m_vTerrainFeatures.end(); ++it) - { - FEATURE_DATA *pFeatureData=*it; +_eTerrainFeatureType CMinecraftApp::IsTerrainFeature(int x, int z) { + for (AUTO_VAR(it, m_vTerrainFeatures.begin()); + it < m_vTerrainFeatures.end(); ++it) { + FEATURE_DATA* pFeatureData = *it; - if((pFeatureData->x==x) && (pFeatureData->z==z)) return pFeatureData->eTerrainFeature; - } + if ((pFeatureData->x == x) && (pFeatureData->z == z)) + return pFeatureData->eTerrainFeature; + } - return eTerrainFeature_None; + return eTerrainFeature_None; } -bool CMinecraftApp::GetTerrainFeaturePosition(_eTerrainFeatureType eType,int *pX, int *pZ) -{ - for(AUTO_VAR(it, m_vTerrainFeatures.begin()); it < m_vTerrainFeatures.end(); ++it) - { - FEATURE_DATA *pFeatureData=*it; - - if(pFeatureData->eTerrainFeature==eType) - { - *pX=pFeatureData->x; - *pZ=pFeatureData->z; - return true; - } - } +bool CMinecraftApp::GetTerrainFeaturePosition(_eTerrainFeatureType eType, + int* pX, int* pZ) { + for (AUTO_VAR(it, m_vTerrainFeatures.begin()); + it < m_vTerrainFeatures.end(); ++it) { + FEATURE_DATA* pFeatureData = *it; - return false; + if (pFeatureData->eTerrainFeature == eType) { + *pX = pFeatureData->x; + *pZ = pFeatureData->z; + return true; + } + } + + return false; } -void CMinecraftApp::ClearTerrainFeaturePosition() -{ - FEATURE_DATA *pFeatureData; - while(m_vTerrainFeatures.size()>0) - { - pFeatureData = m_vTerrainFeatures.back(); - m_vTerrainFeatures.pop_back(); - delete pFeatureData; - } +void CMinecraftApp::ClearTerrainFeaturePosition() { + FEATURE_DATA* pFeatureData; + while (m_vTerrainFeatures.size() > 0) { + pFeatureData = m_vTerrainFeatures.back(); + m_vTerrainFeatures.pop_back(); + delete pFeatureData; + } } -void CMinecraftApp::UpdatePlayerInfo(std::uint8_t networkSmallId, SHORT playerColourIndex, unsigned int playerGamePrivileges) -{ - for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) - { - if(m_playerColours[i]==networkSmallId) - { - m_playerColours[i] = 0; - m_playerGamePrivileges[i] = 0; - } - } - if(playerColourIndex >=0 && playerColourIndex < MINECRAFT_NET_MAX_PLAYERS) - { - m_playerColours[playerColourIndex] = networkSmallId; - m_playerGamePrivileges[playerColourIndex] = playerGamePrivileges; - } +void CMinecraftApp::UpdatePlayerInfo(std::uint8_t networkSmallId, + SHORT playerColourIndex, + unsigned int playerGamePrivileges) { + for (unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) { + if (m_playerColours[i] == networkSmallId) { + m_playerColours[i] = 0; + m_playerGamePrivileges[i] = 0; + } + } + if (playerColourIndex >= 0 && + playerColourIndex < MINECRAFT_NET_MAX_PLAYERS) { + m_playerColours[playerColourIndex] = networkSmallId; + m_playerGamePrivileges[playerColourIndex] = playerGamePrivileges; + } } -short CMinecraftApp::GetPlayerColour(std::uint8_t networkSmallId) -{ - short index = -1; - for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) - { - if(m_playerColours[i]==networkSmallId) - { - index = i; - break; - } - } - return index; +short CMinecraftApp::GetPlayerColour(std::uint8_t networkSmallId) { + short index = -1; + for (unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) { + if (m_playerColours[i] == networkSmallId) { + index = i; + break; + } + } + return index; } - -unsigned int CMinecraftApp::GetPlayerPrivileges(std::uint8_t networkSmallId) -{ - unsigned int privileges = 0; - for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) - { - if(m_playerColours[i]==networkSmallId) - { - privileges = m_playerGamePrivileges[i]; - break; - } - } - return privileges; +unsigned int CMinecraftApp::GetPlayerPrivileges(std::uint8_t networkSmallId) { + unsigned int privileges = 0; + for (unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) { + if (m_playerColours[i] == networkSmallId) { + privileges = m_playerGamePrivileges[i]; + break; + } + } + return privileges; } -std::wstring CMinecraftApp::getEntityName(eINSTANCEOF type) -{ - switch(type) - { - case eTYPE_WOLF: - return app.GetString(IDS_WOLF); - case eTYPE_CREEPER: - return app.GetString(IDS_CREEPER); - case eTYPE_SKELETON: - return app.GetString(IDS_SKELETON); - case eTYPE_SPIDER: - return app.GetString(IDS_SPIDER); - case eTYPE_ZOMBIE: - return app.GetString(IDS_ZOMBIE); - case eTYPE_PIGZOMBIE: - return app.GetString(IDS_PIGZOMBIE); - case eTYPE_ENDERMAN: - return app.GetString(IDS_ENDERMAN); - case eTYPE_SILVERFISH: - return app.GetString(IDS_SILVERFISH); - case eTYPE_CAVESPIDER: - return app.GetString(IDS_CAVE_SPIDER); - case eTYPE_GHAST: - return app.GetString(IDS_GHAST); - case eTYPE_SLIME: - return app.GetString(IDS_SLIME); - case eTYPE_ARROW: - return app.GetString(IDS_ITEM_ARROW); - case eTYPE_ENDERDRAGON: - return app.GetString(IDS_ENDERDRAGON); - case eTYPE_BLAZE: - return app.GetString(IDS_BLAZE); - case eTYPE_LAVASLIME: - return app.GetString(IDS_LAVA_SLIME); - // 4J-PB - fix for #107167 - Customer Encountered: TU12: Content: UI: There is no information what killed Player after being slain by Iron Golem. - case eTYPE_VILLAGERGOLEM: - return app.GetString(IDS_IRONGOLEM); - default: - break; +std::wstring CMinecraftApp::getEntityName(eINSTANCEOF type) { + switch (type) { + case eTYPE_WOLF: + return app.GetString(IDS_WOLF); + case eTYPE_CREEPER: + return app.GetString(IDS_CREEPER); + case eTYPE_SKELETON: + return app.GetString(IDS_SKELETON); + case eTYPE_SPIDER: + return app.GetString(IDS_SPIDER); + case eTYPE_ZOMBIE: + return app.GetString(IDS_ZOMBIE); + case eTYPE_PIGZOMBIE: + return app.GetString(IDS_PIGZOMBIE); + case eTYPE_ENDERMAN: + return app.GetString(IDS_ENDERMAN); + case eTYPE_SILVERFISH: + return app.GetString(IDS_SILVERFISH); + case eTYPE_CAVESPIDER: + return app.GetString(IDS_CAVE_SPIDER); + case eTYPE_GHAST: + return app.GetString(IDS_GHAST); + case eTYPE_SLIME: + return app.GetString(IDS_SLIME); + case eTYPE_ARROW: + return app.GetString(IDS_ITEM_ARROW); + case eTYPE_ENDERDRAGON: + return app.GetString(IDS_ENDERDRAGON); + case eTYPE_BLAZE: + return app.GetString(IDS_BLAZE); + case eTYPE_LAVASLIME: + return app.GetString(IDS_LAVA_SLIME); + // 4J-PB - fix for #107167 - Customer Encountered: TU12: Content: + // UI: There is no information what killed Player after being slain + // by Iron Golem. + case eTYPE_VILLAGERGOLEM: + return app.GetString(IDS_IRONGOLEM); + case eTYPE_HORSE: + return app.GetString(IDS_HORSE); + case eTYPE_WITCH: + return app.GetString(IDS_WITCH); + case eTYPE_WITHERBOSS: + return app.GetString(IDS_WITHER); + case eTYPE_BAT: + return app.GetString(IDS_BAT); + default: + break; + }; - }; - - return L""; + return L""; } -std::uint32_t CMinecraftApp::m_dwContentTypeA[e_Marketplace_MAX] = -{ - XMARKETPLACE_OFFERING_TYPE_CONTENT, // e_DLC_SkinPack, e_DLC_TexturePacks, e_DLC_MashupPacks +std::uint32_t CMinecraftApp::m_dwContentTypeA[e_Marketplace_MAX] = { + XMARKETPLACE_OFFERING_TYPE_CONTENT, // e_DLC_SkinPack, e_DLC_TexturePacks, + // e_DLC_MashupPacks #ifndef _XBOX_ONE - XMARKETPLACE_OFFERING_TYPE_THEME, // e_DLC_Themes - XMARKETPLACE_OFFERING_TYPE_AVATARITEM, // e_DLC_AvatarItems - XMARKETPLACE_OFFERING_TYPE_TILE, // e_DLC_Gamerpics + XMARKETPLACE_OFFERING_TYPE_THEME, // e_DLC_Themes + XMARKETPLACE_OFFERING_TYPE_AVATARITEM, // e_DLC_AvatarItems + XMARKETPLACE_OFFERING_TYPE_TILE, // e_DLC_Gamerpics #endif }; -unsigned int CMinecraftApp::AddDLCRequest(eDLCMarketplaceType eType, bool bPromote) -{ - // lock access - EnterCriticalSection(&csDLCDownloadQueue); +unsigned int CMinecraftApp::AddDLCRequest(eDLCMarketplaceType eType, + bool bPromote) { + // lock access + EnterCriticalSection(&csDLCDownloadQueue); - // If it's already in there, promote it to the top of the list - int iPosition=0; - for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it) - { - DLCRequest *pCurrent = *it; + // If it's already in there, promote it to the top of the list + int iPosition = 0; + for (AUTO_VAR(it, m_DLCDownloadQueue.begin()); + it != m_DLCDownloadQueue.end(); ++it) { + DLCRequest* pCurrent = *it; - if(pCurrent->dwType==m_dwContentTypeA[eType]) - { - // already got this in the list - if(pCurrent->eState == e_DLC_ContentState_Retrieving || pCurrent->eState == e_DLC_ContentState_Retrieved) - { - // already retrieved this - LeaveCriticalSection(&csDLCDownloadQueue); - return 0; - } - else - { - // promote - if(bPromote) - { - m_DLCDownloadQueue.erase(m_DLCDownloadQueue.begin()+iPosition); - m_DLCDownloadQueue.insert(m_DLCDownloadQueue.begin(),pCurrent); - } - LeaveCriticalSection(&csDLCDownloadQueue); - return 0; - } - } - iPosition++; - } + if (pCurrent->dwType == m_dwContentTypeA[eType]) { + // already got this in the list + if (pCurrent->eState == e_DLC_ContentState_Retrieving || + pCurrent->eState == e_DLC_ContentState_Retrieved) { + // already retrieved this + LeaveCriticalSection(&csDLCDownloadQueue); + return 0; + } else { + // promote + if (bPromote) { + m_DLCDownloadQueue.erase(m_DLCDownloadQueue.begin() + + iPosition); + m_DLCDownloadQueue.insert(m_DLCDownloadQueue.begin(), + pCurrent); + } + LeaveCriticalSection(&csDLCDownloadQueue); + return 0; + } + } + iPosition++; + } - DLCRequest *pDLCreq = new DLCRequest; - pDLCreq->dwType=m_dwContentTypeA[eType]; - pDLCreq->eState=e_DLC_ContentState_Idle; + DLCRequest* pDLCreq = new DLCRequest; + pDLCreq->dwType = m_dwContentTypeA[eType]; + pDLCreq->eState = e_DLC_ContentState_Idle; - m_DLCDownloadQueue.push_back(pDLCreq); + m_DLCDownloadQueue.push_back(pDLCreq); - m_bAllDLCContentRetrieved=false; - LeaveCriticalSection(&csDLCDownloadQueue); + m_bAllDLCContentRetrieved = false; + LeaveCriticalSection(&csDLCDownloadQueue); - app.DebugPrintf("[Consoles_App] Added DLC request.\n"); - return 1; + app.DebugPrintf("[Consoles_App] Added DLC request.\n"); + return 1; } -unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool bPromote) -{ +unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, + bool bPromote) { #if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) - // lock access - EnterCriticalSection(&csTMSPPDownloadQueue); + // lock access + EnterCriticalSection(&csTMSPPDownloadQueue); - // If it's already in there, promote it to the top of the list - int iPosition=0; - //ignore promoting for now - /* - bool bPromoted=false; + // If it's already in there, promote it to the top of the list + int iPosition = 0; + // ignore promoting for now + /* + bool bPromoted=false; - for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it) - { - TMSPPRequest *pCurrent = *it; + for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != + m_TMSPPDownloadQueue.end(); ++it) + { + TMSPPRequest *pCurrent = *it; - if(pCurrent->eType==eType) - { - if(!(pCurrent->eState == e_TMS_ContentState_Retrieving || pCurrent->eState == e_TMS_ContentState_Retrieved)) - { - // promote - if(bPromote) - { - m_TMSPPDownloadQueue.erase(m_TMSPPDownloadQueue.begin()+iPosition); - m_TMSPPDownloadQueue.insert(m_TMSPPDownloadQueue.begin(),pCurrent); - bPromoted=true; - } - } - } - iPosition++; - } + if(pCurrent->eType==eType) + { + if(!(pCurrent->eState == e_TMS_ContentState_Retrieving || pCurrent->eState + == e_TMS_ContentState_Retrieved)) + { + // promote + if(bPromote) + { + m_TMSPPDownloadQueue.erase(m_TMSPPDownloadQueue.begin()+iPosition); + m_TMSPPDownloadQueue.insert(m_TMSPPDownloadQueue.begin(),pCurrent); + bPromoted=true; + } + } + } + iPosition++; + } - if(bPromoted) - { - // re-ordered the list, so leave now - LeaveCriticalSection(&csTMSPPDownloadQueue); - return 0; - } - */ + if(bPromoted) + { + // re-ordered the list, so leave now + LeaveCriticalSection(&csTMSPPDownloadQueue); + return 0; + } + */ - // special case for data files (not image files) - if(eType==e_DLC_TexturePackData) - { + // special case for data files (not image files) + if (eType == e_DLC_TexturePackData) { + int iCount = GetDLCInfoFullOffersCount(); + for (int i = 0; i < iCount; i++) { + DLC_INFO* pDLC = GetDLCInfoFullOffer(i); - int iCount=GetDLCInfoFullOffersCount(); + if ((pDLC->eDLCType == e_DLC_TexturePacks) || + (pDLC->eDLCType == e_DLC_MashupPacks)) { + // first check if the image is already in the memory textures, + // since we might be loading some from the Title Update + // partition + if (pDLC->wchDataFile[0] != 0) { + // WCHAR *cString = pDLC->wchDataFile; + // 4J-PB - shouldn't check this here - let the TMS files + // override it, so if they are on TMS, we'll take them + // first + // int iIndex = + // app.GetLocalTMSFileIndex(pDLC->wchDataFile,true); - for(int i=0;iiConfig); - DLC_INFO *pDLC=GetDLCInfoFullOffer(i); + if (!bPresent) { + // this may already be present in the vector because + // of a previous trial/full offer - if((pDLC->eDLCType==e_DLC_TexturePacks) || (pDLC->eDLCType==e_DLC_MashupPacks)) - { - // first check if the image is already in the memory textures, since we might be loading some from the Title Update partition - if(pDLC->wchDataFile[0]!=0) - { - //WCHAR *cString = pDLC->wchDataFile; - // 4J-PB - shouldn't check this here - let the TMS files override it, so if they are on TMS, we'll take them first - //int iIndex = app.GetLocalTMSFileIndex(pDLC->wchDataFile,true); + bool bAlreadyInQueue = false; + for (AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); + it != m_TMSPPDownloadQueue.end(); ++it) { + TMSPPRequest* pCurrent = *it; - //if(iIndex!=-1) - { - bool bPresent = app.IsFileInTPD(pDLC->iConfig); + if (wcscmp(pDLC->wchDataFile, + pCurrent->wchFilename) == 0) { + bAlreadyInQueue = true; + break; + } + } - if(!bPresent) - { - // this may already be present in the vector because of a previous trial/full offer + if (!bAlreadyInQueue) { + TMSPPRequest* pTMSPPreq = new TMSPPRequest; - bool bAlreadyInQueue=false; - for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it) - { - TMSPPRequest *pCurrent = *it; + pTMSPPreq->CallbackFunc = + &CMinecraftApp::TMSPPFileReturned; + pTMSPPreq->lpCallbackParam = this; + pTMSPPreq->eStorageFacility = + C4JStorage::eGlobalStorage_Title; + pTMSPPreq->eFileTypeVal = + C4JStorage::TMS_FILETYPE_BINARY; + memcpy(pTMSPPreq->wchFilename, + pDLC->wchDataFile, + sizeof(WCHAR) * MAX_BANNERNAME_SIZE); + pTMSPPreq->eType = e_DLC_TexturePackData; + pTMSPPreq->eState = e_TMS_ContentState_Queued; + m_bAllTMSContentRetrieved = false; + m_TMSPPDownloadQueue.push_back(pTMSPPreq); + } + } else { + app.DebugPrintf( + "Texture data already present in the TPD\n"); + } + } + } + } + } + } else { // for all the files of type eType, add them to the download list - if(wcscmp(pDLC->wchDataFile,pCurrent->wchFilename)==0) - { - bAlreadyInQueue=true; - break; - } - } + // run through the trial offers first, then the full offers. Any + // duplicates won't be added to the download queue + int iCount; +#ifdef _XBOX // Only trial offers on Xbox 360 + iCount = GetDLCInfoTrialOffersCount(); + for (int i = 0; i < iCount; i++) { + DLC_INFO* pDLC = GetDLCInfoTrialOffer(i); - if(!bAlreadyInQueue) - { - TMSPPRequest *pTMSPPreq = new TMSPPRequest; + // is this the right type? + if (pDLC->eDLCType == eType) { + WCHAR* cString = pDLC->wchBanner; - pTMSPPreq->CallbackFunc=&CMinecraftApp::TMSPPFileReturned; - pTMSPPreq->lpCallbackParam=this; - pTMSPPreq->eStorageFacility=C4JStorage::eGlobalStorage_Title; - pTMSPPreq->eFileTypeVal=C4JStorage::TMS_FILETYPE_BINARY; - memcpy(pTMSPPreq->wchFilename,pDLC->wchDataFile,sizeof(WCHAR)*MAX_BANNERNAME_SIZE); - pTMSPPreq->eType=e_DLC_TexturePackData; - pTMSPPreq->eState=e_TMS_ContentState_Queued; - m_bAllTMSContentRetrieved=false; - m_TMSPPDownloadQueue.push_back(pTMSPPreq); - } - } - else - { - app.DebugPrintf("Texture data already present in the TPD\n"); - } - } - } - } - } - } - else - { // for all the files of type eType, add them to the download list + // 4J-PB - shouldn't check this here - let the TMS files + // override it, so if they are on TMS, we'll take them first is + // the file in the TMS XZP? + // int iIndex = app.GetLocalTMSFileIndex(cString,true); - // run through the trial offers first, then the full offers. Any duplicates won't be added to the download queue - int iCount; -#ifdef _XBOX // Only trial offers on Xbox 360 - iCount=GetDLCInfoTrialOffersCount(); - for(int i=0;ieDLCType==eType) - { + if (!bPresent) // retrieve it from TMSPP + { + bool bAlreadyInQueue = false; + for (AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); + it != m_TMSPPDownloadQueue.end(); ++it) { + TMSPPRequest* pCurrent = *it; - WCHAR *cString = pDLC->wchBanner; + if (wcscmp(pDLC->wchBanner, + pCurrent->wchFilename) == 0) { + bAlreadyInQueue = true; + break; + } + } - // 4J-PB - shouldn't check this here - let the TMS files override it, so if they are on TMS, we'll take them first - // is the file in the TMS XZP? - //int iIndex = app.GetLocalTMSFileIndex(cString,true); + if (!bAlreadyInQueue) { + TMSPPRequest* pTMSPPreq = new TMSPPRequest; - //if(iIndex!=-1) - { - bool bPresent = app.IsFileInMemoryTextures(cString); + pTMSPPreq->CallbackFunc = + &CMinecraftApp::TMSPPFileReturned; + pTMSPPreq->lpCallbackParam = this; + pTMSPPreq->eStorageFacility = + C4JStorage::eGlobalStorage_Title; + pTMSPPreq->eFileTypeVal = + C4JStorage::TMS_FILETYPE_BINARY; + // wcstombs(pTMSPPreq->szFilename,pDLC->wchBanner,MAX_TMSFILENAME_SIZE); + memcpy(pTMSPPreq->wchFilename, pDLC->wchBanner, + sizeof(WCHAR) * MAX_BANNERNAME_SIZE); + pTMSPPreq->eType = eType; + pTMSPPreq->eState = e_TMS_ContentState_Queued; - if(!bPresent) // retrieve it from TMSPP - { - bool bAlreadyInQueue=false; - for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it) - { - TMSPPRequest *pCurrent = *it; - - if(wcscmp(pDLC->wchBanner,pCurrent->wchFilename)==0) - { - bAlreadyInQueue=true; - break; - } - } - - if(!bAlreadyInQueue) - { - TMSPPRequest *pTMSPPreq = new TMSPPRequest; - - pTMSPPreq->CallbackFunc=&CMinecraftApp::TMSPPFileReturned; - pTMSPPreq->lpCallbackParam=this; - pTMSPPreq->eStorageFacility=C4JStorage::eGlobalStorage_Title; - pTMSPPreq->eFileTypeVal=C4JStorage::TMS_FILETYPE_BINARY; - //wcstombs(pTMSPPreq->szFilename,pDLC->wchBanner,MAX_TMSFILENAME_SIZE); - memcpy(pTMSPPreq->wchFilename,pDLC->wchBanner,sizeof(WCHAR)*MAX_BANNERNAME_SIZE); - pTMSPPreq->eType=eType; - pTMSPPreq->eState=e_TMS_ContentState_Queued; - - m_bAllTMSContentRetrieved=false; - m_TMSPPDownloadQueue.push_back(pTMSPPreq); - app.DebugPrintf("===m_TMSPPDownloadQueue Adding %ls, q size is %d\n",pTMSPPreq->wchFilename,m_TMSPPDownloadQueue.size()); - } - } - } - } - } + m_bAllTMSContentRetrieved = false; + m_TMSPPDownloadQueue.push_back(pTMSPPreq); + app.DebugPrintf( + "===m_TMSPPDownloadQueue Adding %ls, q size is " + "%d\n", + pTMSPPreq->wchFilename, + m_TMSPPDownloadQueue.size()); + } + } + } + } + } #endif - // and the full offers + // and the full offers - iCount=GetDLCInfoFullOffersCount(); - for(int i=0;iwchType,wchDLCTypeNames[eType])==0) - if(pDLC->eDLCType==eType) - { - // first check if the image is already in the memory textures, since we might be loading some from the Title Update partition + iCount = GetDLCInfoFullOffersCount(); + for (int i = 0; i < iCount; i++) { + DLC_INFO* pDLC = GetDLCInfoFullOffer(i); + // if(wcscmp(pDLC->wchType,wchDLCTypeNames[eType])==0) + if (pDLC->eDLCType == eType) { + // first check if the image is already in the memory textures, + // since we might be loading some from the Title Update + // partition - WCHAR *cString = pDLC->wchBanner; - // 4J-PB - shouldn't check this here - let the TMS files override it, so if they are on TMS, we'll take them first - //int iIndex = app.GetLocalTMSFileIndex(cString,true); + WCHAR* cString = pDLC->wchBanner; + // 4J-PB - shouldn't check this here - let the TMS files + // override it, so if they are on TMS, we'll take them first + // int iIndex = app.GetLocalTMSFileIndex(cString,true); - //if(iIndex!=-1) - { - bool bPresent = app.IsFileInMemoryTextures(cString); - - if(!bPresent) - { - // this may already be present in the vector because of a previous trial/full offer + // if(iIndex!=-1) + { + bool bPresent = app.IsFileInMemoryTextures(cString); - bool bAlreadyInQueue=false; - for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it) - { - TMSPPRequest *pCurrent = *it; + if (!bPresent) { + // this may already be present in the vector because of + // a previous trial/full offer - if(wcscmp(pDLC->wchBanner,pCurrent->wchFilename)==0) - { - bAlreadyInQueue=true; - break; - } - } + bool bAlreadyInQueue = false; + for (AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); + it != m_TMSPPDownloadQueue.end(); ++it) { + TMSPPRequest* pCurrent = *it; - if(!bAlreadyInQueue) - { - //app.DebugPrintf("Adding a request to the TMSPP download queue - %ls\n",pDLC->wchBanner); - TMSPPRequest *pTMSPPreq = new TMSPPRequest; - ZeroMemory(pTMSPPreq,sizeof(TMSPPRequest)); + if (wcscmp(pDLC->wchBanner, + pCurrent->wchFilename) == 0) { + bAlreadyInQueue = true; + break; + } + } - pTMSPPreq->CallbackFunc=&CMinecraftApp::TMSPPFileReturned; - pTMSPPreq->lpCallbackParam=this; - // 4J-PB - testing for now - //pTMSPPreq->eStorageFacility=C4JStorage::eGlobalStorage_TitleUser; - pTMSPPreq->eStorageFacility=C4JStorage::eGlobalStorage_Title; - pTMSPPreq->eFileTypeVal=C4JStorage::TMS_FILETYPE_BINARY; - //wcstombs(pTMSPPreq->szFilename,pDLC->wchBanner,MAX_TMSFILENAME_SIZE); + if (!bAlreadyInQueue) { + // app.DebugPrintf("Adding a request to the TMSPP + // download queue - %ls\n",pDLC->wchBanner); + TMSPPRequest* pTMSPPreq = new TMSPPRequest; + ZeroMemory(pTMSPPreq, sizeof(TMSPPRequest)); - memcpy(pTMSPPreq->wchFilename,pDLC->wchBanner,sizeof(WCHAR)*MAX_BANNERNAME_SIZE); - pTMSPPreq->eType=eType; - pTMSPPreq->eState=e_TMS_ContentState_Queued; - m_bAllTMSContentRetrieved=false; - m_TMSPPDownloadQueue.push_back(pTMSPPreq); - app.DebugPrintf("===m_TMSPPDownloadQueue Adding %ls, q size is %d\n",pTMSPPreq->wchFilename,m_TMSPPDownloadQueue.size()); - } - } - } - } - } - } + pTMSPPreq->CallbackFunc = + &CMinecraftApp::TMSPPFileReturned; + pTMSPPreq->lpCallbackParam = this; + // 4J-PB - testing for now + // pTMSPPreq->eStorageFacility=C4JStorage::eGlobalStorage_TitleUser; + pTMSPPreq->eStorageFacility = + C4JStorage::eGlobalStorage_Title; + pTMSPPreq->eFileTypeVal = + C4JStorage::TMS_FILETYPE_BINARY; + // wcstombs(pTMSPPreq->szFilename,pDLC->wchBanner,MAX_TMSFILENAME_SIZE); - LeaveCriticalSection(&csTMSPPDownloadQueue); + memcpy(pTMSPPreq->wchFilename, pDLC->wchBanner, + sizeof(WCHAR) * MAX_BANNERNAME_SIZE); + pTMSPPreq->eType = eType; + pTMSPPreq->eState = e_TMS_ContentState_Queued; + m_bAllTMSContentRetrieved = false; + m_TMSPPDownloadQueue.push_back(pTMSPPreq); + app.DebugPrintf( + "===m_TMSPPDownloadQueue Adding %ls, q size is " + "%d\n", + pTMSPPreq->wchFilename, + m_TMSPPDownloadQueue.size()); + } + } + } + } + } + } + + LeaveCriticalSection(&csTMSPPDownloadQueue); #endif - return 1; + return 1; } -bool CMinecraftApp::CheckTMSDLCCanStop() -{ - EnterCriticalSection(&csTMSPPDownloadQueue); - for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it) - { - TMSPPRequest *pCurrent = *it; +bool CMinecraftApp::CheckTMSDLCCanStop() { + EnterCriticalSection(&csTMSPPDownloadQueue); + for (AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); + it != m_TMSPPDownloadQueue.end(); ++it) { + TMSPPRequest* pCurrent = *it; - if(pCurrent->eState==e_TMS_ContentState_Retrieving) - { - LeaveCriticalSection(&csTMSPPDownloadQueue); - return false; - } - } - LeaveCriticalSection(&csTMSPPDownloadQueue); + if (pCurrent->eState == e_TMS_ContentState_Retrieving) { + LeaveCriticalSection(&csTMSPPDownloadQueue); + return false; + } + } + LeaveCriticalSection(&csTMSPPDownloadQueue); - return true; + return true; } +bool CMinecraftApp::RetrieveNextDLCContent() { + // If there's already a retrieve in progress, quit + // we may have re-ordered the list, so need to check every item -bool CMinecraftApp::RetrieveNextDLCContent() -{ - // If there's already a retrieve in progress, quit - // we may have re-ordered the list, so need to check every item + // is there a primary player and a network connection? + int primPad = ProfileManager.GetPrimaryPad(); + if (primPad == -1 || !ProfileManager.IsSignedInLive(primPad)) { + return true; // 4J-JEV: We need to wait until the primary player is + // online. + } - // is there a primary player and a network connection? - int primPad = ProfileManager.GetPrimaryPad(); - if ( primPad == -1 || !ProfileManager.IsSignedInLive(primPad) ) - { - return true; // 4J-JEV: We need to wait until the primary player is online. - } + EnterCriticalSection(&csDLCDownloadQueue); + for (AUTO_VAR(it, m_DLCDownloadQueue.begin()); + it != m_DLCDownloadQueue.end(); ++it) { + DLCRequest* pCurrent = *it; - EnterCriticalSection(&csDLCDownloadQueue); - for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it) - { - DLCRequest *pCurrent = *it; + if (pCurrent->eState == e_DLC_ContentState_Retrieving) { + LeaveCriticalSection(&csDLCDownloadQueue); + return true; + } + } - if(pCurrent->eState==e_DLC_ContentState_Retrieving) - { - LeaveCriticalSection(&csDLCDownloadQueue); - return true; - } - } + // Now look for the next retrieval + for (AUTO_VAR(it, m_DLCDownloadQueue.begin()); + it != m_DLCDownloadQueue.end(); ++it) { + DLCRequest* pCurrent = *it; - // Now look for the next retrieval - for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it) - { - DLCRequest *pCurrent = *it; - - if(pCurrent->eState==e_DLC_ContentState_Idle) - { + if (pCurrent->eState == e_DLC_ContentState_Idle) { #ifdef _DEBUG - app.DebugPrintf("RetrieveNextDLCContent - type = %d\n",pCurrent->dwType); + app.DebugPrintf("RetrieveNextDLCContent - type = %d\n", + pCurrent->dwType); #endif - C4JStorage::EDLCStatus status = StorageManager.GetDLCOffers(ProfileManager.GetPrimaryPad(), &CMinecraftApp::DLCOffersReturned, this, pCurrent->dwType); - if(status==C4JStorage::EDLC_Pending) - { - pCurrent->eState=e_DLC_ContentState_Retrieving; - } - else - { - // no content of this type, or some other problem - app.DebugPrintf("RetrieveNextDLCContent - PROBLEM\n"); - pCurrent->eState=e_DLC_ContentState_Retrieved; - } - LeaveCriticalSection(&csDLCDownloadQueue); - return true; - } - } - LeaveCriticalSection(&csDLCDownloadQueue); + C4JStorage::EDLCStatus status = StorageManager.GetDLCOffers( + ProfileManager.GetPrimaryPad(), + &CMinecraftApp::DLCOffersReturned, this, pCurrent->dwType); + if (status == C4JStorage::EDLC_Pending) { + pCurrent->eState = e_DLC_ContentState_Retrieving; + } else { + // no content of this type, or some other problem + app.DebugPrintf("RetrieveNextDLCContent - PROBLEM\n"); + pCurrent->eState = e_DLC_ContentState_Retrieved; + } + LeaveCriticalSection(&csDLCDownloadQueue); + return true; + } + } + LeaveCriticalSection(&csDLCDownloadQueue); - app.DebugPrintf("[Consoles_App] Finished downloading dlc content.\n"); - return false; + app.DebugPrintf("[Consoles_App] Finished downloading dlc content.\n"); + return false; } #if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) #ifdef _XBOX_ONE -int CMinecraftApp::TMSPPFileReturned(void *pParam,int iPad,int iUserData,void *lpvData, WCHAR* wchFilename) -{ - C4JStorage::PTMSPP_FILEDATA pFileData=(C4JStorage::PTMSPP_FILEDATA)lpvData; +int CMinecraftApp::TMSPPFileReturned(void* pParam, int iPad, int iUserData, + void* lpvData, WCHAR* wchFilename) { + C4JStorage::PTMSPP_FILEDATA pFileData = + (C4JStorage::PTMSPP_FILEDATA)lpvData; #else -int CMinecraftApp::TMSPPFileReturned(void *pParam,int iPad,int iUserData,C4JStorage::PTMSPP_FILEDATA pFileData, LPCSTR szFilename) -{ +int CMinecraftApp::TMSPPFileReturned(void* pParam, int iPad, int iUserData, + C4JStorage::PTMSPP_FILEDATA pFileData, + LPCSTR szFilename) { #endif - CMinecraftApp* pClass = (CMinecraftApp *) pParam; + CMinecraftApp* pClass = (CMinecraftApp*)pParam; - // find the right one in the vector - EnterCriticalSection(&pClass->csTMSPPDownloadQueue); - for(AUTO_VAR(it, pClass->m_TMSPPDownloadQueue.begin()); it != pClass->m_TMSPPDownloadQueue.end(); ++it) - { - TMSPPRequest *pCurrent = *it; + // find the right one in the vector + EnterCriticalSection(&pClass->csTMSPPDownloadQueue); + for (AUTO_VAR(it, pClass->m_TMSPPDownloadQueue.begin()); + it != pClass->m_TMSPPDownloadQueue.end(); ++it) { + TMSPPRequest* pCurrent = *it; #if defined(_XBOX) || defined(_WINDOWS64) - char szFile[MAX_TMSFILENAME_SIZE]; - wcstombs(szFile,pCurrent->wchFilename,MAX_TMSFILENAME_SIZE); - + char szFile[MAX_TMSFILENAME_SIZE]; + wcstombs(szFile, pCurrent->wchFilename, MAX_TMSFILENAME_SIZE); - if(strcmp(szFilename,szFile)==0) + if (strcmp(szFilename, szFile) == 0) #elif _XBOX_ONE - if(wcscmp(wchFilename,pCurrent->wchFilename)==0) + if (wcscmp(wchFilename, pCurrent->wchFilename) == 0) #endif - { - // set this to retrieved whether it found it or not - pCurrent->eState=e_TMS_ContentState_Retrieved; - - if(pFileData!=NULL) - { + { + // set this to retrieved whether it found it or not + pCurrent->eState = e_TMS_ContentState_Retrieved; + if (pFileData != NULL) { #ifdef _XBOX_ONE - - switch(pCurrent->eType) - { - case e_DLC_TexturePackData: - { - // 4J-PB - we need to allocate memory for the file data and copy into it, since the current data is a reference into the blob download memory - std::uint8_t *pbData = new std::uint8_t[pFileData->size]; - memcpy(pbData,pFileData->pbData,pFileData->size); + switch (pCurrent->eType) { + case e_DLC_TexturePackData: { + // 4J-PB - we need to allocate memory for the file data + // and copy into it, since the current data is a + // reference into the blob download memory + std::uint8_t* pbData = + new std::uint8_t[pFileData->size]; + memcpy(pbData, pFileData->pbData, pFileData->size); - pClass->m_vTMSPPData.push_back(pbData); - app.DebugPrintf("Got texturepack data\n"); - // get the config value for the texture pack - int iConfig=app.GetTPConfigVal(pCurrent->wchFilename); - app.AddMemoryTPDFile(iConfig, pbData, pFileData->size); - } - break; - default: - // 4J-PB - check the data is an image - if(pFileData->pbData[0]==0x89) - { - // 4J-PB - we need to allocate memory for the file data and copy into it, since the current data is a reference into the blob download memory - std::uint8_t *pbData = new std::uint8_t[pFileData->size]; - memcpy(pbData,pFileData->pbData,pFileData->size); - - pClass->m_vTMSPPData.push_back(pbData); - app.DebugPrintf("Got image data - %ls\n",pCurrent->wchFilename); - app.AddMemoryTextureFile(pCurrent->wchFilename, pbData, pFileData->size); - } - else - { - app.DebugPrintf("Got image data, but it's not a png - %ls\n",pCurrent->wchFilename); - } - break; - } + pClass->m_vTMSPPData.push_back(pbData); + app.DebugPrintf("Got texturepack data\n"); + // get the config value for the texture pack + int iConfig = app.GetTPConfigVal(pCurrent->wchFilename); + app.AddMemoryTPDFile(iConfig, pbData, pFileData->size); + } break; + default: + // 4J-PB - check the data is an image + if (pFileData->pbData[0] == 0x89) { + // 4J-PB - we need to allocate memory for the file + // data and copy into it, since the current data is + // a reference into the blob download memory + std::uint8_t* pbData = + new std::uint8_t[pFileData->size]; + memcpy(pbData, pFileData->pbData, pFileData->size); + + pClass->m_vTMSPPData.push_back(pbData); + app.DebugPrintf("Got image data - %ls\n", + pCurrent->wchFilename); + app.AddMemoryTextureFile(pCurrent->wchFilename, + pbData, pFileData->size); + } else { + app.DebugPrintf( + "Got image data, but it's not a png - %ls\n", + pCurrent->wchFilename); + } + break; + } #else - switch(pCurrent->eType) - { - case e_DLC_TexturePackData: - { - app.DebugPrintf("--- Got texturepack data %ls\n",pCurrent->wchFilename); - // get the config value for the texture pack - int iConfig=app.GetTPConfigVal(pCurrent->wchFilename); - app.AddMemoryTPDFile(iConfig, pFileData->pbData, pFileData->size); - } - break; - default: - app.DebugPrintf("--- Got image data - %ls\n",pCurrent->wchFilename); - app.AddMemoryTextureFile(pCurrent->wchFilename, pFileData->pbData, pFileData->size); - break; - } + switch (pCurrent->eType) { + case e_DLC_TexturePackData: { + app.DebugPrintf("--- Got texturepack data %ls\n", + pCurrent->wchFilename); + // get the config value for the texture pack + int iConfig = app.GetTPConfigVal(pCurrent->wchFilename); + app.AddMemoryTPDFile(iConfig, pFileData->pbData, + pFileData->size); + } break; + default: + app.DebugPrintf("--- Got image data - %ls\n", + pCurrent->wchFilename); + app.AddMemoryTextureFile(pCurrent->wchFilename, + pFileData->pbData, + pFileData->size); + break; + } #endif - } - else - { + } else { #ifdef _XBOX_ONE - app.DebugPrintf("TMSImageReturned failed (%ls)...\n",wchFilename); + app.DebugPrintf("TMSImageReturned failed (%ls)...\n", + wchFilename); #else - app.DebugPrintf("TMSImageReturned failed (%s)...\n",szFilename); + app.DebugPrintf("TMSImageReturned failed (%s)...\n", + szFilename); #endif - } - break; - } - - } - LeaveCriticalSection(&pClass->csTMSPPDownloadQueue); + } + break; + } + } + LeaveCriticalSection(&pClass->csTMSPPDownloadQueue); - return 0; + return 0; } #endif -bool CMinecraftApp::RetrieveNextTMSPPContent() -{ +bool CMinecraftApp::RetrieveNextTMSPPContent() { #if defined _XBOX || defined _XBOX_ONE - // If there's already a retrieve in progress, quit - // we may have re-ordered the list, so need to check every item + // If there's already a retrieve in progress, quit + // we may have re-ordered the list, so need to check every item - // is there a primary player and a network connection? - if(ProfileManager.GetPrimaryPad()==-1) return false; + // is there a primary player and a network connection? + if (ProfileManager.GetPrimaryPad() == -1) return false; - if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())==false) return false; + if (ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) == false) + return false; - EnterCriticalSection(&csTMSPPDownloadQueue); - for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it) - { - TMSPPRequest *pCurrent = *it; + EnterCriticalSection(&csTMSPPDownloadQueue); + for (AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); + it != m_TMSPPDownloadQueue.end(); ++it) { + TMSPPRequest* pCurrent = *it; - if(pCurrent->eState==e_TMS_ContentState_Retrieving) - { - app.DebugPrintf("."); - LeaveCriticalSection(&csTMSPPDownloadQueue); - return true; - } - } + if (pCurrent->eState == e_TMS_ContentState_Retrieving) { + app.DebugPrintf("."); + LeaveCriticalSection(&csTMSPPDownloadQueue); + return true; + } + } - // Now look for the next retrieval - for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it) - { - TMSPPRequest *pCurrent = *it; + // Now look for the next retrieval + for (AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); + it != m_TMSPPDownloadQueue.end(); ++it) { + TMSPPRequest* pCurrent = *it; - if(pCurrent->eState==e_TMS_ContentState_Queued) - { - // 4J-PB - the file may be in the local TMS files, but try to retrieve it from the remote TMS in case it's been changed. If it's not in the list of TMS files, this will - // return right away with a ETMSStatus_Fail_ReadDetailsNotRetrieved + if (pCurrent->eState == e_TMS_ContentState_Queued) { + // 4J-PB - the file may be in the local TMS files, but try to + // retrieve it from the remote TMS in case it's been changed. If + // it's not in the list of TMS files, this will return right away + // with a ETMSStatus_Fail_ReadDetailsNotRetrieved #ifdef _XBOX - char szFilename[MAX_TMSFILENAME_SIZE]; - wcstombs(szFilename,pCurrent->wchFilename,MAX_TMSFILENAME_SIZE); + char szFilename[MAX_TMSFILENAME_SIZE]; + wcstombs(szFilename, pCurrent->wchFilename, MAX_TMSFILENAME_SIZE); - app.DebugPrintf("\nRetrieveNextTMSPPContent - type = %d, %s\n",pCurrent->eType,szFilename); + app.DebugPrintf("\nRetrieveNextTMSPPContent - type = %d, %s\n", + pCurrent->eType, szFilename); - C4JStorage::ETMSStatus status=StorageManager.TMSPP_ReadFile(ProfileManager.GetPrimaryPad(),pCurrent->eStorageFacility,pCurrent->eFileTypeVal,szFilename,pCurrent->CallbackFunc,this); - switch(status) - { - case C4JStorage::ETMSStatus_Pending: - pCurrent->eState=e_TMS_ContentState_Retrieving; - break; - case C4JStorage::ETMSStatus_Idle: - pCurrent->eState=e_TMS_ContentState_Retrieved; - break; - case C4JStorage::ETMSStatus_Fail_ReadInProgress: - case C4JStorage::ETMSStatus_ReadInProgress: - pCurrent->eState=e_TMS_ContentState_Retrieving; - if(pCurrent->eState==C4JStorage::ETMSStatus_Fail_ReadInProgress) - { - app.DebugPrintf("TMSPP_ReadFile failed - read in progress\n"); - Sleep(50); - LeaveCriticalSection(&csTMSPPDownloadQueue); - return false; - } - break; - default: - pCurrent->eState=e_TMS_ContentState_Retrieved; - break; - } + C4JStorage::ETMSStatus status = StorageManager.TMSPP_ReadFile( + ProfileManager.GetPrimaryPad(), pCurrent->eStorageFacility, + pCurrent->eFileTypeVal, szFilename, pCurrent->CallbackFunc, + this); + switch (status) { + case C4JStorage::ETMSStatus_Pending: + pCurrent->eState = e_TMS_ContentState_Retrieving; + break; + case C4JStorage::ETMSStatus_Idle: + pCurrent->eState = e_TMS_ContentState_Retrieved; + break; + case C4JStorage::ETMSStatus_Fail_ReadInProgress: + case C4JStorage::ETMSStatus_ReadInProgress: + pCurrent->eState = e_TMS_ContentState_Retrieving; + if (pCurrent->eState == + C4JStorage::ETMSStatus_Fail_ReadInProgress) { + app.DebugPrintf( + "TMSPP_ReadFile failed - read in progress\n"); + Sleep(50); + LeaveCriticalSection(&csTMSPPDownloadQueue); + return false; + } + break; + default: + pCurrent->eState = e_TMS_ContentState_Retrieved; + break; + } #else - eTitleStorageState status; - app.DebugPrintf("RetrieveNextTMSPPContent - type = %d, %ls\n",pCurrent->eType,pCurrent->wchFilename); - //eTitleStorageState status=StorageManager.TMSPP_ReadFile(ProfileManager.GetPrimaryPad(),pCurrent->eStorageFacility,pCurrent->eFileTypeVal,pCurrent->wchFilename,pCurrent->CallbackFunc,this,0); - if(0)//wcscmp(pCurrent->wchFilename,L"TP01.png")==0) - { - // TP01 fails because the blob size returned is bigger than the global metadata says it should be - status=eTitleStorage_readerror; - } - else - { - status=StorageManager.TMSPP_ReadFile(ProfileManager.GetPrimaryPad(),pCurrent->eStorageFacility,pCurrent->eFileTypeVal,pCurrent->wchFilename,pCurrent->CallbackFunc,this,0); - } - switch(status) - { - case eTitleStorage_pending: - pCurrent->eState=e_TMS_ContentState_Retrieving; - break; - case eTitleStorage_idle: - pCurrent->eState=e_TMS_ContentState_Retrieved; - break; - case eTitleStorage_busy: - // try again next time - { - app.DebugPrintf("@@@@@@@@@@@@@@@@@ TMSPP_ReadFile failed - busy (probably reading already)\n"); - Sleep(50); - LeaveCriticalSection(&csTMSPPDownloadQueue); - return false; - } - break; - default: - pCurrent->eState=e_TMS_ContentState_Retrieved; - break; - } + eTitleStorageState status; + app.DebugPrintf("RetrieveNextTMSPPContent - type = %d, %ls\n", + pCurrent->eType, pCurrent->wchFilename); + // eTitleStorageState + // status=StorageManager.TMSPP_ReadFile(ProfileManager.GetPrimaryPad(),pCurrent->eStorageFacility,pCurrent->eFileTypeVal,pCurrent->wchFilename,pCurrent->CallbackFunc,this,0); + if (0) // wcscmp(pCurrent->wchFilename,L"TP01.png")==0) + { + // TP01 fails because the blob size returned is bigger than the + // global metadata says it should be + status = eTitleStorage_readerror; + } else { + status = StorageManager.TMSPP_ReadFile( + ProfileManager.GetPrimaryPad(), pCurrent->eStorageFacility, + pCurrent->eFileTypeVal, pCurrent->wchFilename, + pCurrent->CallbackFunc, this, 0); + } + switch (status) { + case eTitleStorage_pending: + pCurrent->eState = e_TMS_ContentState_Retrieving; + break; + case eTitleStorage_idle: + pCurrent->eState = e_TMS_ContentState_Retrieved; + break; + case eTitleStorage_busy: + // try again next time + { + app.DebugPrintf( + "@@@@@@@@@@@@@@@@@ TMSPP_ReadFile failed - busy " + "(probably reading already)\n"); + Sleep(50); + LeaveCriticalSection(&csTMSPPDownloadQueue); + return false; + } + break; + default: + pCurrent->eState = e_TMS_ContentState_Retrieved; + break; + } #endif + LeaveCriticalSection(&csTMSPPDownloadQueue); + return true; + } + } - - LeaveCriticalSection(&csTMSPPDownloadQueue); - return true; - } - } - - LeaveCriticalSection(&csTMSPPDownloadQueue); + LeaveCriticalSection(&csTMSPPDownloadQueue); #endif - return false; + return false; } -void CMinecraftApp::TickDLCOffersRetrieved() -{ - if(!m_bAllDLCContentRetrieved) - { - if (!app.RetrieveNextDLCContent()) - { - app.DebugPrintf("[Consoles_App] All content retrieved.\n"); - m_bAllDLCContentRetrieved=true; - } - } +void CMinecraftApp::TickDLCOffersRetrieved() { + if (!m_bAllDLCContentRetrieved) { + if (!app.RetrieveNextDLCContent()) { + app.DebugPrintf("[Consoles_App] All content retrieved.\n"); + m_bAllDLCContentRetrieved = true; + } + } } -void CMinecraftApp::ClearAndResetDLCDownloadQueue() -{ - app.DebugPrintf("[Consoles_App] Clear and reset download queue.\n"); +void CMinecraftApp::ClearAndResetDLCDownloadQueue() { + app.DebugPrintf("[Consoles_App] Clear and reset download queue.\n"); - int iPosition=0; - EnterCriticalSection(&csTMSPPDownloadQueue); - for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it) - { - DLCRequest *pCurrent = *it; + int iPosition = 0; + EnterCriticalSection(&csTMSPPDownloadQueue); + for (AUTO_VAR(it, m_DLCDownloadQueue.begin()); + it != m_DLCDownloadQueue.end(); ++it) { + DLCRequest* pCurrent = *it; - delete pCurrent; - iPosition++; - } - m_DLCDownloadQueue.clear(); - m_bAllDLCContentRetrieved=true; - LeaveCriticalSection(&csTMSPPDownloadQueue); + delete pCurrent; + iPosition++; + } + m_DLCDownloadQueue.clear(); + m_bAllDLCContentRetrieved = true; + LeaveCriticalSection(&csTMSPPDownloadQueue); } -void CMinecraftApp::TickTMSPPFilesRetrieved() -{ - if(m_bTickTMSDLCFiles && !m_bAllTMSContentRetrieved) - { - if(app.RetrieveNextTMSPPContent()==false) - { - m_bAllTMSContentRetrieved=true; - } - } +void CMinecraftApp::TickTMSPPFilesRetrieved() { + if (m_bTickTMSDLCFiles && !m_bAllTMSContentRetrieved) { + if (app.RetrieveNextTMSPPContent() == false) { + m_bAllTMSContentRetrieved = true; + } + } } -void CMinecraftApp::ClearTMSPPFilesRetrieved() -{ - int iPosition=0; - EnterCriticalSection(&csTMSPPDownloadQueue); - for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it) - { - TMSPPRequest *pCurrent = *it; +void CMinecraftApp::ClearTMSPPFilesRetrieved() { + int iPosition = 0; + EnterCriticalSection(&csTMSPPDownloadQueue); + for (AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); + it != m_TMSPPDownloadQueue.end(); ++it) { + TMSPPRequest* pCurrent = *it; - delete pCurrent; - iPosition++; - } - m_TMSPPDownloadQueue.clear(); - m_bAllTMSContentRetrieved=true; - LeaveCriticalSection(&csTMSPPDownloadQueue); + delete pCurrent; + iPosition++; + } + m_TMSPPDownloadQueue.clear(); + m_bAllTMSContentRetrieved = true; + LeaveCriticalSection(&csTMSPPDownloadQueue); } -int CMinecraftApp::DLCOffersReturned(void *pParam, int iOfferC, std::uint32_t dwType, int iPad) -{ - CMinecraftApp* pClass = (CMinecraftApp *) pParam; +int CMinecraftApp::DLCOffersReturned(void* pParam, int iOfferC, + std::uint32_t dwType, int iPad) { + CMinecraftApp* pClass = (CMinecraftApp*)pParam; - // find the right one in the vector - EnterCriticalSection(&pClass->csTMSPPDownloadQueue); - for(AUTO_VAR(it, pClass->m_DLCDownloadQueue.begin()); it != pClass->m_DLCDownloadQueue.end(); ++it) - { - DLCRequest *pCurrent = *it; + // find the right one in the vector + EnterCriticalSection(&pClass->csTMSPPDownloadQueue); + for (AUTO_VAR(it, pClass->m_DLCDownloadQueue.begin()); + it != pClass->m_DLCDownloadQueue.end(); ++it) { + DLCRequest* pCurrent = *it; - // avatar items are coming back as type Content, so we can't trust the type setting - if(pCurrent->dwType == static_cast(dwType)) - { - pClass->m_iDLCOfferC = iOfferC; - app.DebugPrintf("DLCOffersReturned - type %u, count %d - setting to retrieved\n",dwType,iOfferC); - pCurrent->eState=e_DLC_ContentState_Retrieved; - break; - } - } - LeaveCriticalSection(&pClass->csTMSPPDownloadQueue); - return 0; + // avatar items are coming back as type Content, so we can't trust the + // type setting + if (pCurrent->dwType == static_cast(dwType)) { + pClass->m_iDLCOfferC = iOfferC; + app.DebugPrintf( + "DLCOffersReturned - type %u, count %d - setting to " + "retrieved\n", + dwType, iOfferC); + pCurrent->eState = e_DLC_ContentState_Retrieved; + break; + } + } + LeaveCriticalSection(&pClass->csTMSPPDownloadQueue); + return 0; } -eDLCContentType CMinecraftApp::Find_eDLCContentType(std::uint32_t dwType) -{ - for(int i=0;idwType==m_dwContentTypeA[eType]) && (pCurrent->eState==e_DLC_ContentState_Retrieved)) - { - LeaveCriticalSection(&csDLCDownloadQueue); - return true; - } - } - LeaveCriticalSection(&csDLCDownloadQueue); - return false; + if ((pCurrent->dwType == m_dwContentTypeA[eType]) && + (pCurrent->eState == e_DLC_ContentState_Retrieved)) { + LeaveCriticalSection(&csDLCDownloadQueue); + return true; + } + } + LeaveCriticalSection(&csDLCDownloadQueue); + return false; } -void CMinecraftApp::SetAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX *SkinBoxA, unsigned int dwSkinBoxC) -{ - EntityRenderer *renderer = EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER); - Model *pModel = renderer->getModel(); - std::vector *pvModelPart = new std::vector; - std::vector *pvSkinBoxes = new std::vector; +void CMinecraftApp::SetAdditionalSkinBoxes(std::uint32_t dwSkinID, + SKIN_BOX* SkinBoxA, + unsigned int dwSkinBoxC) { + EntityRenderer* renderer = + EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER); + Model* pModel = renderer->getModel(); + std::vector* pvModelPart = new std::vector; + std::vector* pvSkinBoxes = new std::vector; - EnterCriticalSection( &csAdditionalModelParts ); - EnterCriticalSection( &csAdditionalSkinBoxes ); + EnterCriticalSection(&csAdditionalModelParts); + EnterCriticalSection(&csAdditionalSkinBoxes); - app.DebugPrintf("*** SetAdditionalSkinBoxes - Inserting model parts for skin %d from array of Skin Boxes\n",dwSkinID&0x0FFFFFFF); + app.DebugPrintf( + "*** SetAdditionalSkinBoxes - Inserting model parts for skin %d from " + "array of Skin Boxes\n", + dwSkinID & 0x0FFFFFFF); - // convert the skin boxes into model parts, and add to the humanoid model - for(unsigned int i=0;iAddOrRetrievePart(&SkinBoxA[i]); - pvModelPart->push_back(pModelPart); - pvSkinBoxes->push_back(&SkinBoxA[i]); - } - } + // convert the skin boxes into model parts, and add to the humanoid model + for (unsigned int i = 0; i < dwSkinBoxC; i++) { + if (pModel) { + ModelPart* pModelPart = pModel->AddOrRetrievePart(&SkinBoxA[i]); + pvModelPart->push_back(pModelPart); + pvSkinBoxes->push_back(&SkinBoxA[i]); + } + } + m_AdditionalModelParts.insert( + std::pair*>(dwSkinID, + pvModelPart)); + m_AdditionalSkinBoxes.insert( + std::pair*>(dwSkinID, + pvSkinBoxes)); - m_AdditionalModelParts.insert( std::pair *>(dwSkinID, pvModelPart) ); - m_AdditionalSkinBoxes.insert( std::pair *>(dwSkinID, pvSkinBoxes) ); - - LeaveCriticalSection( &csAdditionalSkinBoxes ); - LeaveCriticalSection( &csAdditionalModelParts ); - + LeaveCriticalSection(&csAdditionalSkinBoxes); + LeaveCriticalSection(&csAdditionalModelParts); } -std::vector * CMinecraftApp::SetAdditionalSkinBoxes(std::uint32_t dwSkinID, std::vector *pvSkinBoxA) -{ - EntityRenderer *renderer = EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER); - Model *pModel = renderer->getModel(); - std::vector *pvModelPart = new std::vector; +std::vector* CMinecraftApp::SetAdditionalSkinBoxes( + std::uint32_t dwSkinID, std::vector* pvSkinBoxA) { + EntityRenderer* renderer = + EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER); + Model* pModel = renderer->getModel(); + std::vector* pvModelPart = new std::vector; - EnterCriticalSection( &csAdditionalModelParts ); - EnterCriticalSection( &csAdditionalSkinBoxes ); - app.DebugPrintf("*** SetAdditionalSkinBoxes - Inserting model parts for skin %d from array of Skin Boxes\n",dwSkinID&0x0FFFFFFF); + EnterCriticalSection(&csAdditionalModelParts); + EnterCriticalSection(&csAdditionalSkinBoxes); + app.DebugPrintf( + "*** SetAdditionalSkinBoxes - Inserting model parts for skin %d from " + "array of Skin Boxes\n", + dwSkinID & 0x0FFFFFFF); - // convert the skin boxes into model parts, and add to the humanoid model - for(AUTO_VAR(it, pvSkinBoxA->begin());it != pvSkinBoxA->end(); ++it) - { - if(pModel) - { - ModelPart *pModelPart=pModel->AddOrRetrievePart(*it); - pvModelPart->push_back(pModelPart); - } - } + // convert the skin boxes into model parts, and add to the humanoid model + for (AUTO_VAR(it, pvSkinBoxA->begin()); it != pvSkinBoxA->end(); ++it) { + if (pModel) { + ModelPart* pModelPart = pModel->AddOrRetrievePart(*it); + pvModelPart->push_back(pModelPart); + } + } - m_AdditionalModelParts.insert( std::pair *>(dwSkinID, pvModelPart) ); - m_AdditionalSkinBoxes.insert( std::pair *>(dwSkinID, pvSkinBoxA) ); + m_AdditionalModelParts.insert( + std::pair*>(dwSkinID, + pvModelPart)); + m_AdditionalSkinBoxes.insert( + std::pair*>(dwSkinID, + pvSkinBoxA)); - LeaveCriticalSection( &csAdditionalSkinBoxes ); - LeaveCriticalSection( &csAdditionalModelParts ); - return pvModelPart; + LeaveCriticalSection(&csAdditionalSkinBoxes); + LeaveCriticalSection(&csAdditionalModelParts); + return pvModelPart; } +std::vector* CMinecraftApp::GetAdditionalModelParts( + std::uint32_t dwSkinID) { + EnterCriticalSection(&csAdditionalModelParts); + std::vector* pvModelParts = NULL; + if (m_AdditionalModelParts.size() > 0) { + AUTO_VAR(it, m_AdditionalModelParts.find(dwSkinID)); + if (it != m_AdditionalModelParts.end()) { + pvModelParts = (*it).second; + } + } -std::vector *CMinecraftApp::GetAdditionalModelParts(std::uint32_t dwSkinID) -{ - EnterCriticalSection( &csAdditionalModelParts ); - std::vector *pvModelParts=NULL; - if(m_AdditionalModelParts.size()>0) - { - AUTO_VAR(it, m_AdditionalModelParts.find(dwSkinID)); - if(it!=m_AdditionalModelParts.end()) - { - pvModelParts = (*it).second; - } - } - - LeaveCriticalSection( &csAdditionalModelParts ); - return pvModelParts; + LeaveCriticalSection(&csAdditionalModelParts); + return pvModelParts; } -std::vector *CMinecraftApp::GetAdditionalSkinBoxes(std::uint32_t dwSkinID) -{ - EnterCriticalSection( &csAdditionalSkinBoxes ); - std::vector *pvSkinBoxes=NULL; - if(m_AdditionalSkinBoxes.size()>0) - { - AUTO_VAR(it,m_AdditionalSkinBoxes.find(dwSkinID)); - if(it!=m_AdditionalSkinBoxes.end()) - { - pvSkinBoxes = (*it).second; - } - } - - LeaveCriticalSection( &csAdditionalSkinBoxes ); - return pvSkinBoxes; +std::vector* CMinecraftApp::GetAdditionalSkinBoxes( + std::uint32_t dwSkinID) { + EnterCriticalSection(&csAdditionalSkinBoxes); + std::vector* pvSkinBoxes = NULL; + if (m_AdditionalSkinBoxes.size() > 0) { + AUTO_VAR(it, m_AdditionalSkinBoxes.find(dwSkinID)); + if (it != m_AdditionalSkinBoxes.end()) { + pvSkinBoxes = (*it).second; + } + } + + LeaveCriticalSection(&csAdditionalSkinBoxes); + return pvSkinBoxes; } -unsigned int CMinecraftApp::GetAnimOverrideBitmask(std::uint32_t dwSkinID) -{ - EnterCriticalSection( &csAnimOverrideBitmask ); - unsigned int uiAnimOverrideBitmask=0L; +unsigned int CMinecraftApp::GetAnimOverrideBitmask(std::uint32_t dwSkinID) { + EnterCriticalSection(&csAnimOverrideBitmask); + unsigned int uiAnimOverrideBitmask = 0L; - if(m_AnimOverrides.size()>0) - { - AUTO_VAR(it, m_AnimOverrides.find(dwSkinID)); - if(it!=m_AnimOverrides.end()) - { - uiAnimOverrideBitmask = (*it).second; - } - } + if (m_AnimOverrides.size() > 0) { + AUTO_VAR(it, m_AnimOverrides.find(dwSkinID)); + if (it != m_AnimOverrides.end()) { + uiAnimOverrideBitmask = (*it).second; + } + } - LeaveCriticalSection( &csAnimOverrideBitmask ); - return uiAnimOverrideBitmask; + LeaveCriticalSection(&csAnimOverrideBitmask); + return uiAnimOverrideBitmask; } -void CMinecraftApp::SetAnimOverrideBitmask(std::uint32_t dwSkinID,unsigned int uiAnimOverrideBitmask) -{ - // Make thread safe - EnterCriticalSection( &csAnimOverrideBitmask ); +void CMinecraftApp::SetAnimOverrideBitmask(std::uint32_t dwSkinID, + unsigned int uiAnimOverrideBitmask) { + // Make thread safe + EnterCriticalSection(&csAnimOverrideBitmask); - if(m_AnimOverrides.size()>0) - { - AUTO_VAR(it, m_AnimOverrides.find(dwSkinID)); - if(it!=m_AnimOverrides.end()) - { - LeaveCriticalSection( &csAnimOverrideBitmask ); - return; // already in here - } - } - m_AnimOverrides.insert( std::pair(dwSkinID, uiAnimOverrideBitmask) ); - LeaveCriticalSection( &csAnimOverrideBitmask ); + if (m_AnimOverrides.size() > 0) { + AUTO_VAR(it, m_AnimOverrides.find(dwSkinID)); + if (it != m_AnimOverrides.end()) { + LeaveCriticalSection(&csAnimOverrideBitmask); + return; // already in here + } + } + m_AnimOverrides.insert(std::pair( + dwSkinID, uiAnimOverrideBitmask)); + LeaveCriticalSection(&csAnimOverrideBitmask); } -std::uint32_t CMinecraftApp::getSkinIdFromPath(const std::wstring &skin) -{ - bool dlcSkin = false; - unsigned int skinId = 0; - - if(skin.size() >= 14) - { - dlcSkin = skin.substr(0,3).compare(L"dlc") == 0; +std::uint32_t CMinecraftApp::getSkinIdFromPath(const std::wstring& skin) { + bool dlcSkin = false; + unsigned int skinId = 0; - std::wstring skinValue = skin.substr(7,skin.size()); - skinValue = skinValue.substr(0,skinValue.find_first_of(L'.')); - - std::wstringstream ss; - // 4J Stu - dlc skins are numbered using decimal to make it easier for artists/people to number manually - // Everything else is numbered using hex - if(dlcSkin) - ss << std::dec << skinValue.c_str(); - else - ss << std::hex << skinValue.c_str(); - ss >> skinId; + if (skin.size() >= 14) { + dlcSkin = skin.substr(0, 3).compare(L"dlc") == 0; - skinId = MAKE_SKIN_BITMASK(dlcSkin, skinId); - } - return skinId; + std::wstring skinValue = skin.substr(7, skin.size()); + skinValue = skinValue.substr(0, skinValue.find_first_of(L'.')); + + std::wstringstream ss; + // 4J Stu - dlc skins are numbered using decimal to make it easier for + // artists/people to number manually Everything else is numbered using + // hex + if (dlcSkin) + ss << std::dec << skinValue.c_str(); + else + ss << std::hex << skinValue.c_str(); + ss >> skinId; + + skinId = MAKE_SKIN_BITMASK(dlcSkin, skinId); + } + return skinId; } -std::wstring CMinecraftApp::getSkinPathFromId(std::uint32_t skinId) -{ - // 4J Stu - This function maps the encoded DWORD we store in the player profile - // to a filename that is stored as a memory texture and shared between systems in game - wchar_t chars[256]; - if( GET_IS_DLC_SKIN_FROM_BITMASK(skinId) ) - { - // 4J Stu - DLC skins are numbered using decimal rather than hex to make it easier to number manually - swprintf(chars, 256, L"dlcskin%08d.png", GET_DLC_SKIN_ID_FROM_BITMASK(skinId)); - - } - else - { - std::uint32_t ugcSkinIndex = GET_UGC_SKIN_ID_FROM_BITMASK(skinId); - std::uint32_t defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(skinId); - if( ugcSkinIndex == 0 ) - { - swprintf(chars, 256, L"defskin%08X.png",defaultSkinIndex); - } - else - { - swprintf(chars, 256, L"ugcskin%08X.png",ugcSkinIndex); - } - } - return chars; +std::wstring CMinecraftApp::getSkinPathFromId(std::uint32_t skinId) { + // 4J Stu - This function maps the encoded DWORD we store in the player + // profile to a filename that is stored as a memory texture and shared + // between systems in game + wchar_t chars[256]; + if (GET_IS_DLC_SKIN_FROM_BITMASK(skinId)) { + // 4J Stu - DLC skins are numbered using decimal rather than hex to make + // it easier to number manually + swprintf(chars, 256, L"dlcskin%08d.png", + GET_DLC_SKIN_ID_FROM_BITMASK(skinId)); + + } else { + std::uint32_t ugcSkinIndex = GET_UGC_SKIN_ID_FROM_BITMASK(skinId); + std::uint32_t defaultSkinIndex = + GET_DEFAULT_SKIN_ID_FROM_BITMASK(skinId); + if (ugcSkinIndex == 0) { + swprintf(chars, 256, L"defskin%08X.png", defaultSkinIndex); + } else { + swprintf(chars, 256, L"ugcskin%08X.png", ugcSkinIndex); + } + } + return chars; } +int CMinecraftApp::TexturePackDialogReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result) { +#if defined __PSVITA__ || defined __PS3__ || defined __ORBIS__ + if (result == C4JStorage::EMessage_ResultAccept) { + Minecraft* pMinecraft = Minecraft::GetInstance(); + if (pMinecraft->skins->selectTexturePackById( + app.GetRequiredTexturePackID())) { + // it's been installed already + } else { + // we need to enable background downloading for the DLC + XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); + SONYDLC* pSONYDLCInfo = + app.GetSONYDLCInfo(app.GetRequiredTexturePackID()); + if (pSONYDLCInfo != NULL) { + char chName[42]; + char chKeyName[20]; + char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; + + memset(chSkuID, 0, SCE_NP_COMMERCE2_SKU_ID_LEN); + // we have to retrieve the skuid from the store info, it can't + // be hardcoded since Sony may change it. So we assume the first + // sku for the product is the one we want MGH - keyname in the + // DLC file is 16 chars long, but there's no space for a NULL + // terminating char + memset(chKeyName, 0, sizeof(chKeyName)); + strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); + +#ifdef __ORBIS__ + strcpy(chName, chKeyName); +#else + sprintf(chName, "%s-%s", app.GetCommerceCategory(), chKeyName); +#endif + app.GetDLCSkuIDFromProductList(chName, chSkuID); + // 4J-PB - need to check for an empty store + if (app.CheckForEmptyStore(iPad) == false) { + if (app.DLCAlreadyPurchased(chSkuID)) { + app.DownloadAlreadyPurchased(chSkuID); + } else { + app.Checkout(chSkuID); + } + } + } + } + } else { + app.DebugPrintf("Continuing without installing texture pack\n"); + } +#endif -int CMinecraftApp::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ #ifdef _XBOX - if(result!=C4JStorage::EMessage_Cancelled) - { - if(app.GetRequiredTexturePackID()!=0) - { - // we need to enable background downloading for the DLC - XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); + if (result != C4JStorage::EMessage_Cancelled) { + if (app.GetRequiredTexturePackID() != 0) { + // we need to enable background downloading for the DLC + XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); - ULONGLONG ullOfferID_Full; - ULONGLONG ullIndexA[1]; - app.GetDLCFullOfferIDForPackID(app.GetRequiredTexturePackID(),&ullOfferID_Full); + ULONGLONG ullOfferID_Full; + ULONGLONG ullIndexA[1]; + app.GetDLCFullOfferIDForPackID(app.GetRequiredTexturePackID(), + &ullOfferID_Full); - if( result==C4JStorage::EMessage_ResultAccept ) // Full version - { - ullIndexA[0]=ullOfferID_Full; - StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); - } - else // trial version - { - DLC_INFO *pDLCInfo=app.GetDLCInfoForFullOfferID(ullOfferID_Full); - ullIndexA[0]=pDLCInfo->ullOfferID_Trial; - StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); - } - } - } + if (result == C4JStorage::EMessage_ResultAccept) // Full version + { + ullIndexA[0] = ullOfferID_Full; + StorageManager.InstallOffer(1, ullIndexA, NULL, NULL); + } else // trial version + { + DLC_INFO* pDLCInfo = + app.GetDLCInfoForFullOfferID(ullOfferID_Full); + ullIndexA[0] = pDLCInfo->ullOfferID_Trial; + StorageManager.InstallOffer(1, ullIndexA, NULL, NULL); + } + } + } #endif - return 0; + return 0; } -int CMinecraftApp::getArchiveFileSize(const std::wstring &filename) -{ - TexturePack *tPack = NULL; - Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft && pMinecraft->skins) tPack = pMinecraft->skins->getSelected(); - if(tPack && tPack->hasData() && tPack->getArchiveFile() && tPack->getArchiveFile()->hasFile(filename)) - { - return tPack->getArchiveFile()->getFileSize(filename); - } - else return m_mediaArchive->getFileSize(filename); +int CMinecraftApp::getArchiveFileSize(const std::wstring& filename) { + TexturePack* tPack = NULL; + Minecraft* pMinecraft = Minecraft::GetInstance(); + if (pMinecraft && pMinecraft->skins) + tPack = pMinecraft->skins->getSelected(); + if (tPack && tPack->hasData() && tPack->getArchiveFile() && + tPack->getArchiveFile()->hasFile(filename)) { + return tPack->getArchiveFile()->getFileSize(filename); + } else + return m_mediaArchive->getFileSize(filename); } -bool CMinecraftApp::hasArchiveFile(const std::wstring &filename) -{ - TexturePack *tPack = NULL; - Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft && pMinecraft->skins) tPack = pMinecraft->skins->getSelected(); - if(tPack && tPack->hasData() && tPack->getArchiveFile() && tPack->getArchiveFile()->hasFile(filename)) return true; - else return m_mediaArchive->hasFile(filename); +bool CMinecraftApp::hasArchiveFile(const std::wstring& filename) { + TexturePack* tPack = NULL; + Minecraft* pMinecraft = Minecraft::GetInstance(); + if (pMinecraft && pMinecraft->skins) + tPack = pMinecraft->skins->getSelected(); + if (tPack && tPack->hasData() && tPack->getArchiveFile() && + tPack->getArchiveFile()->hasFile(filename)) + return true; + else + return m_mediaArchive->hasFile(filename); } -byteArray CMinecraftApp::getArchiveFile(const std::wstring &filename) -{ - TexturePack *tPack = NULL; - Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft && pMinecraft->skins) tPack = pMinecraft->skins->getSelected(); - if(tPack && tPack->hasData() && tPack->getArchiveFile() && tPack->getArchiveFile()->hasFile(filename)) - { - return tPack->getArchiveFile()->getFile(filename); - } - else return m_mediaArchive->getFile(filename); +byteArray CMinecraftApp::getArchiveFile(const std::wstring& filename) { + TexturePack* tPack = NULL; + Minecraft* pMinecraft = Minecraft::GetInstance(); + if (pMinecraft && pMinecraft->skins) + tPack = pMinecraft->skins->getSelected(); + if (tPack && tPack->hasData() && tPack->getArchiveFile() && + tPack->getArchiveFile()->hasFile(filename)) { + return tPack->getArchiveFile()->getFile(filename); + } else + return m_mediaArchive->getFile(filename); } // DLC -#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) -int CMinecraftApp::GetDLCInfoCount() -{ - return (int)DLCInfo.size(); -} +#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) +int CMinecraftApp::GetDLCInfoCount() { return (int)DLCInfo.size(); } #elif defined _XBOX_ONE -int CMinecraftApp::GetDLCInfoTrialOffersCount() -{ - return 0; -} +int CMinecraftApp::GetDLCInfoTrialOffersCount() { return 0; } -int CMinecraftApp::GetDLCInfoFullOffersCount() -{ - return (int)DLCInfo_Full.size(); +int CMinecraftApp::GetDLCInfoFullOffersCount() { + return (int)DLCInfo_Full.size(); } #else -int CMinecraftApp::GetDLCInfoTrialOffersCount() -{ - return (int)DLCInfo_Trial.size(); +int CMinecraftApp::GetDLCInfoTrialOffersCount() { + return (int)DLCInfo_Trial.size(); } -int CMinecraftApp::GetDLCInfoFullOffersCount() -{ - return (int)DLCInfo_Full.size(); +int CMinecraftApp::GetDLCInfoFullOffersCount() { + return (int)DLCInfo_Full.size(); } #endif -int CMinecraftApp::GetDLCInfoTexturesOffersCount() -{ - return (int)DLCTextures_PackID.size(); +int CMinecraftApp::GetDLCInfoTexturesOffersCount() { + return (int)DLCTextures_PackID.size(); } // AUTOSAVE -void CMinecraftApp::SetAutosaveTimerTime(void) -{ +void CMinecraftApp::SetAutosaveTimerTime(void) { #if defined(_XBOX_ONE) || defined(__ORBIS__) - m_uiAutosaveTimer= GetTickCount()+1000*60; + m_uiAutosaveTimer = GetTickCount() + 1000 * 60; #else - m_uiAutosaveTimer= GetTickCount()+GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_Autosave)*1000*60*15; + m_uiAutosaveTimer = + GetTickCount() + + GetGameSettings(ProfileManager.GetPrimaryPad(), eGameSetting_Autosave) * + 1000 * 60 * 15; #endif -}// value x 15 to get mins, x60 for secs +} // value x 15 to get mins, x60 for secs -bool CMinecraftApp::AutosaveDue(void) -{ - return (GetTickCount()>m_uiAutosaveTimer); +bool CMinecraftApp::AutosaveDue(void) { + return (GetTickCount() > m_uiAutosaveTimer); } -unsigned int CMinecraftApp::SecondsToAutosave() -{ - return (m_uiAutosaveTimer - GetTickCount() ) / 1000; +unsigned int CMinecraftApp::SecondsToAutosave() { + return (m_uiAutosaveTimer - GetTickCount()) / 1000; } -void CMinecraftApp::SetTrialTimerStart(void) -{ - m_fTrialTimerStart=m_Time.fAppTime; mfTrialPausedTime=0.0f; +void CMinecraftApp::SetTrialTimerStart(void) { + m_fTrialTimerStart = m_Time.fAppTime; + mfTrialPausedTime = 0.0f; } -float CMinecraftApp::getTrialTimer(void) -{ - return m_Time.fAppTime-m_fTrialTimerStart-mfTrialPausedTime; +float CMinecraftApp::getTrialTimer(void) { + return m_Time.fAppTime - m_fTrialTimerStart - mfTrialPausedTime; } -bool CMinecraftApp::IsLocalMultiplayerAvailable() -{ - unsigned int connectedControllers = 0; - for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) - { - if( InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i) ) ++connectedControllers; - } +bool CMinecraftApp::IsLocalMultiplayerAvailable() { + unsigned int connectedControllers = 0; + for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { + if (InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i)) + ++connectedControllers; + } - bool available = RenderManager.IsHiDef() && connectedControllers > 1; + bool available = RenderManager.IsHiDef() && connectedControllers > 1; #ifdef __ORBIS__ - // Check for remote play - available = available && InputManager.IsLocalMultiplayerAvailable(); + // Check for remote play + available = available && InputManager.IsLocalMultiplayerAvailable(); #endif - return available; + return available; - // Found this in GameNetworkManager? - //#ifdef _DURANGO - // iOtherConnectedControllers = InputManager.GetConnectedGamepadCount(); - // if((InputManager.IsPadConnected(userIndex) || ProfileManager.IsSignedIn(userIndex))) - // { - // --iOtherConnectedControllers; - // } - //#else - // for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) - // { - // if( (i!=userIndex) && (InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i)) ) - // { - // iOtherConnectedControllers++; - // } - // } - //#endif + // Found this in GameNetworkManager? + // #ifdef _DURANGO + // iOtherConnectedControllers = + // InputManager.GetConnectedGamepadCount(); + // if((InputManager.IsPadConnected(userIndex) || + // ProfileManager.IsSignedIn(userIndex))) + // { + // --iOtherConnectedControllers; + // } + // #else + // for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) + // { + // if( (i!=userIndex) && (InputManager.IsPadConnected(i) || + // ProfileManager.IsSignedIn(i)) ) + // { + // iOtherConnectedControllers++; + // } + // } + // #endif } - // 4J-PB - language and locale function -void CMinecraftApp::getLocale(std::vector &vecWstrLocales) -{ - std::vector locales; - - const unsigned int systemLanguage = XGetLanguage( ); +void CMinecraftApp::getLocale(std::vector& vecWstrLocales) { + std::vector locales; - // 4J-PB - restrict the 360 language until we're ready to have them in + const unsigned int systemLanguage = XGetLanguage(); + + // 4J-PB - restrict the 360 language until we're ready to have them in #ifdef _XBOX - switch(systemLanguage) - { - case XC_LANGUAGE_FRENCH : - locales.push_back(eMCLang_frFR); - break; - case XC_LANGUAGE_ITALIAN : - locales.push_back(eMCLang_itIT); - break; - case XC_LANGUAGE_GERMAN : - locales.push_back(eMCLang_deDE); - break; - case XC_LANGUAGE_SPANISH : - locales.push_back(eMCLang_esES); - break; - case XC_LANGUAGE_PORTUGUESE : - if(XGetLocale()==XC_LOCALE_BRAZIL) - { - locales.push_back(eMCLang_ptBR); - } - locales.push_back(eMCLang_ptPT); - break; - case XC_LANGUAGE_JAPANESE : - locales.push_back(eMCLang_jaJP); - break; - case XC_LANGUAGE_KOREAN : - locales.push_back(eMCLang_koKR); - break; - case XC_LANGUAGE_TCHINESE : - locales.push_back(eMCLang_zhCHT); - break; - } + switch (systemLanguage) { + case XC_LANGUAGE_FRENCH: + locales.push_back(eMCLang_frFR); + break; + case XC_LANGUAGE_ITALIAN: + locales.push_back(eMCLang_itIT); + break; + case XC_LANGUAGE_GERMAN: + locales.push_back(eMCLang_deDE); + break; + case XC_LANGUAGE_SPANISH: + locales.push_back(eMCLang_esES); + break; + case XC_LANGUAGE_PORTUGUESE: + if (XGetLocale() == XC_LOCALE_BRAZIL) { + locales.push_back(eMCLang_ptBR); + } + locales.push_back(eMCLang_ptPT); + break; + case XC_LANGUAGE_JAPANESE: + locales.push_back(eMCLang_jaJP); + break; + case XC_LANGUAGE_KOREAN: + locales.push_back(eMCLang_koKR); + break; + case XC_LANGUAGE_TCHINESE: + locales.push_back(eMCLang_zhCHT); + break; + } #else - switch(systemLanguage) - { + switch (systemLanguage) { + case XC_LANGUAGE_ENGLISH: + switch (XGetLocale()) { + case XC_LOCALE_AUSTRALIA: + case XC_LOCALE_CANADA: + case XC_LOCALE_CZECH_REPUBLIC: + case XC_LOCALE_GREECE: + case XC_LOCALE_HONG_KONG: + case XC_LOCALE_HUNGARY: + case XC_LOCALE_INDIA: + case XC_LOCALE_IRELAND: + case XC_LOCALE_ISRAEL: + case XC_LOCALE_NEW_ZEALAND: + case XC_LOCALE_SAUDI_ARABIA: + case XC_LOCALE_SINGAPORE: + case XC_LOCALE_SLOVAK_REPUBLIC: + case XC_LOCALE_SOUTH_AFRICA: + case XC_LOCALE_UNITED_ARAB_EMIRATES: + case XC_LOCALE_GREAT_BRITAIN: + locales.push_back(eMCLang_enGB); + break; + default: // XC_LOCALE_UNITED_STATES + break; + } + break; + case XC_LANGUAGE_JAPANESE: + locales.push_back(eMCLang_jaJP); + break; + case XC_LANGUAGE_GERMAN: + switch (XGetLocale()) { + case XC_LOCALE_AUSTRIA: + locales.push_back(eMCLang_deAT); + break; + case XC_LOCALE_SWITZERLAND: + locales.push_back(eMCLang_deCH); + break; + default: // XC_LOCALE_GERMANY: + break; + } + locales.push_back(eMCLang_deDE); + break; + case XC_LANGUAGE_FRENCH: + switch (XGetLocale()) { + case XC_LOCALE_BELGIUM: + locales.push_back(eMCLang_frBE); + break; + case XC_LOCALE_CANADA: + locales.push_back(eMCLang_frCA); + break; + case XC_LOCALE_SWITZERLAND: + locales.push_back(eMCLang_frCH); + break; + default: // XC_LOCALE_FRANCE: + break; + } + locales.push_back(eMCLang_frFR); + break; + case XC_LANGUAGE_SPANISH: + switch (XGetLocale()) { + case XC_LOCALE_MEXICO: + case XC_LOCALE_ARGENTINA: + case XC_LOCALE_CHILE: + case XC_LOCALE_COLOMBIA: + case XC_LOCALE_UNITED_STATES: + case XC_LOCALE_LATIN_AMERICA: + locales.push_back(eMCLang_laLAS); + locales.push_back(eMCLang_esMX); + break; + default: // XC_LOCALE_SPAIN + break; + } + locales.push_back(eMCLang_esES); + break; + case XC_LANGUAGE_ITALIAN: + locales.push_back(eMCLang_itIT); + break; + case XC_LANGUAGE_KOREAN: + locales.push_back(eMCLang_koKR); + break; + case XC_LANGUAGE_TCHINESE: + switch (XGetLocale()) { + case XC_LOCALE_HONG_KONG: + locales.push_back(eMCLang_zhHK); + locales.push_back(eMCLang_zhTW); + break; + case XC_LOCALE_TAIWAN: + locales.push_back(eMCLang_zhTW); + locales.push_back(eMCLang_zhHK); + default: + break; + } + locales.push_back(eMCLang_hant); + locales.push_back(eMCLang_zhCHT); + break; + case XC_LANGUAGE_PORTUGUESE: + if (XGetLocale() == XC_LOCALE_BRAZIL) { + locales.push_back(eMCLang_ptBR); + } + locales.push_back(eMCLang_ptPT); + break; + case XC_LANGUAGE_POLISH: + locales.push_back(eMCLang_plPL); + break; + case XC_LANGUAGE_RUSSIAN: + locales.push_back(eMCLang_ruRU); + break; + case XC_LANGUAGE_SWEDISH: + locales.push_back(eMCLang_svSV); + locales.push_back(eMCLang_svSE); + break; + case XC_LANGUAGE_TURKISH: + locales.push_back(eMCLang_trTR); + break; + case XC_LANGUAGE_BNORWEGIAN: + locales.push_back(eMCLang_nbNO); + locales.push_back(eMCLang_noNO); + locales.push_back(eMCLang_nnNO); + break; + case XC_LANGUAGE_DUTCH: + switch (XGetLocale()) { + case XC_LOCALE_BELGIUM: + locales.push_back(eMCLang_nlBE); + break; + default: + break; + } + locales.push_back(eMCLang_nlNL); + break; + case XC_LANGUAGE_SCHINESE: + switch (XGetLocale()) { + case XC_LOCALE_SINGAPORE: + locales.push_back(eMCLang_zhSG); + break; + default: + break; + } + locales.push_back(eMCLang_hans); + locales.push_back(eMCLang_csCS); + locales.push_back(eMCLang_zhCN); + break; - case XC_LANGUAGE_ENGLISH: - switch(XGetLocale()) - { - case XC_LOCALE_AUSTRALIA: - case XC_LOCALE_CANADA: - case XC_LOCALE_CZECH_REPUBLIC: - case XC_LOCALE_GREECE: - case XC_LOCALE_HONG_KONG: - case XC_LOCALE_HUNGARY: - case XC_LOCALE_INDIA: - case XC_LOCALE_IRELAND: - case XC_LOCALE_ISRAEL: - case XC_LOCALE_NEW_ZEALAND: - case XC_LOCALE_SAUDI_ARABIA: - case XC_LOCALE_SINGAPORE: - case XC_LOCALE_SLOVAK_REPUBLIC: - case XC_LOCALE_SOUTH_AFRICA: - case XC_LOCALE_UNITED_ARAB_EMIRATES: - case XC_LOCALE_GREAT_BRITAIN: - locales.push_back(eMCLang_enGB); - break; - default: //XC_LOCALE_UNITED_STATES - break; - } - break; - case XC_LANGUAGE_JAPANESE : - locales.push_back(eMCLang_jaJP); - break; - case XC_LANGUAGE_GERMAN : - switch(XGetLocale()) - { - case XC_LOCALE_AUSTRIA: - locales.push_back(eMCLang_deAT); - break; - case XC_LOCALE_SWITZERLAND: - locales.push_back(eMCLang_deCH); - break; - default:// XC_LOCALE_GERMANY: - break; - } - locales.push_back(eMCLang_deDE); - break; - case XC_LANGUAGE_FRENCH : - switch(XGetLocale()) - { - case XC_LOCALE_BELGIUM: - locales.push_back(eMCLang_frBE); - break; - case XC_LOCALE_CANADA: - locales.push_back(eMCLang_frCA); - break; - case XC_LOCALE_SWITZERLAND: - locales.push_back(eMCLang_frCH); - break; - default:// XC_LOCALE_FRANCE: - break; - } - locales.push_back(eMCLang_frFR); - break; - case XC_LANGUAGE_SPANISH : - switch(XGetLocale()) - { - case XC_LOCALE_MEXICO: - case XC_LOCALE_ARGENTINA: - case XC_LOCALE_CHILE: - case XC_LOCALE_COLOMBIA: - case XC_LOCALE_UNITED_STATES: - locales.push_back(eMCLang_esMX); - break; - default://XC_LOCALE_SPAIN - break; - } - locales.push_back(eMCLang_esES); - break; - case XC_LANGUAGE_ITALIAN : - locales.push_back(eMCLang_itIT); - break; - case XC_LANGUAGE_KOREAN : - locales.push_back(eMCLang_koKR); - break; - case XC_LANGUAGE_TCHINESE : - switch(XGetLocale()) - { - case XC_LOCALE_HONG_KONG: - locales.push_back(eMCLang_zhHK); - locales.push_back(eMCLang_zhTW); - break; - case XC_LOCALE_TAIWAN: - locales.push_back(eMCLang_zhTW); - locales.push_back(eMCLang_zhHK); - default: - break; - } - locales.push_back(eMCLang_zhCHT); - break; - case XC_LANGUAGE_PORTUGUESE : - if(XGetLocale()==XC_LOCALE_BRAZIL) - { - locales.push_back(eMCLang_ptBR); - } - locales.push_back(eMCLang_ptPT); - break; - case XC_LANGUAGE_POLISH : - locales.push_back(eMCLang_plPL); - break; - case XC_LANGUAGE_RUSSIAN : - locales.push_back(eMCLang_ruRU); - break; - case XC_LANGUAGE_SWEDISH : - locales.push_back(eMCLang_svSV); - locales.push_back(eMCLang_svSE); - break; - case XC_LANGUAGE_TURKISH : - locales.push_back(eMCLang_trTR); - break; - case XC_LANGUAGE_BNORWEGIAN : - locales.push_back(eMCLang_nbNO); - locales.push_back(eMCLang_noNO); - locales.push_back(eMCLang_nnNO); - break; - case XC_LANGUAGE_DUTCH : - switch(XGetLocale()) - { - case XC_LOCALE_BELGIUM: - locales.push_back(eMCLang_nlBE); - break; - default: - break; - } - locales.push_back(eMCLang_nlNL); - break; - case XC_LANGUAGE_SCHINESE : - switch(XGetLocale()) - { - case XC_LOCALE_SINGAPORE: - locales.push_back(eMCLang_zhSG); - break; - default: - break; - } - locales.push_back(eMCLang_zhCHS); - locales.push_back(eMCLang_zhCN); - break; +#if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || \ + defined _DURANGO + case XC_LANGUAGE_DANISH: + locales.push_back(eMCLang_daDA); + locales.push_back(eMCLang_daDK); + break; + case XC_LANGUAGE_FINISH: + locales.push_back(eMCLang_fiFI); + break; -#if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined _DURANGO - case XC_LANGUAGE_DANISH: - locales.push_back(eMCLang_daDA); - locales.push_back(eMCLang_daDK); - break; + case XC_LANGUAGE_CZECH: + locales.push_back(eMCLang_csCZ); + locales.push_back(eMCLang_enCZ); + break; - case XC_LANGUAGE_LATINAMERICANSPANISH: - locales.push_back(eMCLang_laLAS); - locales.push_back(eMCLang_esES); - break; + case XC_LANGUAGE_SLOVAK: + locales.push_back(eMCLang_skSK); + locales.push_back(eMCLang_enSK); + break; - case XC_LANGUAGE_FINISH : - locales.push_back(eMCLang_fiFI); - break; - - case XC_LANGUAGE_CZECH : - locales.push_back(eMCLang_csCZ); - locales.push_back(eMCLang_enCZ); - break; - - case XC_LANGUAGE_SLOVAK : - locales.push_back(eMCLang_skSK); - locales.push_back(eMCLang_enSK); - break; - - case XC_LANGUAGE_GREEK : - locales.push_back(eMCLang_elEL); - locales.push_back(eMCLang_elGR); - locales.push_back(eMCLang_enGR); - locales.push_back(eMCLang_enGB); - break; + case XC_LANGUAGE_GREEK: + locales.push_back(eMCLang_elEL); + locales.push_back(eMCLang_elGR); + locales.push_back(eMCLang_enGR); + locales.push_back(eMCLang_enGB); + break; #endif - } + } #endif - locales.push_back(eMCLang_enUS); - locales.push_back(eMCLang_null); + locales.push_back(eMCLang_enUS); + locales.push_back(eMCLang_null); - for (int i=0; i -//using namespace std; +// using namespace std; #include "Audio/Consoles_SoundEngine.h" #ifndef __linux__ @@ -19,7 +19,7 @@ #include "../Minecraft.World/Network/Packets/DisconnectPacket.h" #ifndef __linux__ #include -#endif // __linux__ +#endif // __linux__ #include "../Minecraft.Client/Utils/StringTable.h" #include "DLC/DLCManager.h" @@ -27,14 +27,14 @@ #include "GameRules/GameRuleManager.h" #include "../Minecraft.Client/Rendering/Models/SkinBox.h" #include "../Minecraft.Client/Utils/ArchiveFile.h" +#include "../Minecraft.World/Entities/MinecartHopper.h" -typedef struct _JoinFromInviteData -{ - std::uint32_t dwUserIndex; // dwUserIndex - std::uint32_t dwLocalUsersMask; // dwUserMask - const INVITE_INFO *pInviteInfo; // pInviteInfo -} -JoinFromInviteData; + +typedef struct _JoinFromInviteData { + std::uint32_t dwUserIndex; // dwUserIndex + std::uint32_t dwLocalUsersMask; // dwUserMask + const INVITE_INFO* pInviteInfo; // pInviteInfo +} JoinFromInviteData; class Player; class Inventory; @@ -44,6 +44,11 @@ class Container; class DispenserTileEntity; class SignTileEntity; class BrewingStandTileEntity; +class CommandBlockEntity; +class HopperTileEntity; +// class MinecartHopper; +class EntityHorse; +class BeaconTileEntity; class LocalPlayer; class DLCPack; class LevelRuleset; @@ -55,862 +60,1102 @@ class Merchant; class CMinecraftAudio; -class CMinecraftApp - +class CMinecraftApp #ifdef _XBOX - : public CXuiModule + : public CXuiModule #endif { private: - static int s_iHTMLFontSizesA[eHTMLSize_COUNT]; + static int s_iHTMLFontSizesA[eHTMLSize_COUNT]; public: + CMinecraftApp(); - CMinecraftApp(); + static const float fSafeZoneX; // 5% of 1280 + static const float fSafeZoneY; // 5% of 720 - static const float fSafeZoneX; // 5% of 1280 - static const float fSafeZoneY; // 5% of 720 + typedef std::vector VMEMFILES; + typedef std::vector VNOTIFICATIONS; - typedef std::vector VMEMFILES; - typedef std::vector VNOTIFICATIONS; + // storing skin files + std::vector vSkinNames; + DLCManager m_dlcManager; - // storing skin files - std::vector vSkinNames; - DLCManager m_dlcManager; + // storing credits text from the DLC + std::vector m_vCreditText; // hold the credit text lines so + // we can avoid duplicating them - // storing credits text from the DLC - std::vector m_vCreditText; // hold the credit text lines so we can avoid duplicating them - - - // In builds prior to TU5, the size of the GAME_SETTINGS struct was 204 bytes. We added a few new values to the internal struct in TU5, and even though we - // changed the size of the ucUnused array to be decreased by the size of the values we added, the packing of the struct has introduced some extra - // padding that resulted in the GAME_SETTINGS struct being 208 bytes. The knock-on effect from this was that all the stats, which come after the game settings - // in the profile data, we being read offset by 4 bytes. We need to ensure that the GAME_SETTINGS struct does not grow larger than 204 bytes or if we need it - // to then we need to rebuild the profile data completely and increase the profile version. There should be enough free space to grow larger for a few more updates - // as long as we take into account the padding issues and check that settings are still stored at the same positions when we read them - static const int GAME_SETTINGS_PROFILE_DATA_BYTES = 204; + // In builds prior to TU5, the size of the GAME_SETTINGS struct was 204 + // bytes. We added a few new values to the internal struct in TU5, and even + // though we changed the size of the ucUnused array to be decreased by the + // size of the values we added, the packing of the struct has introduced + // some extra padding that resulted in the GAME_SETTINGS struct being 208 + // bytes. The knock-on effect from this was that all the stats, which come + // after the game settings in the profile data, we being read offset by 4 + // bytes. We need to ensure that the GAME_SETTINGS struct does not grow + // larger than 204 bytes or if we need it to then we need to rebuild the + // profile data completely and increase the profile version. There should be + // enough free space to grow larger for a few more updates as long as we + // take into account the padding issues and check that settings are still + // stored at the same positions when we read them + static const int GAME_SETTINGS_PROFILE_DATA_BYTES = 204; #ifdef _EXTENDED_ACHIEVEMENTS - /* 4J-JEV: - * We need more space in the profile data because of the new achievements and statistics - * necessary for the new expanded achievement set. - */ - static const int GAME_DEFINED_PROFILE_DATA_BYTES = 2*972; // per user + /* 4J-JEV: + * We need more space in the profile data because of the new achievements + * and statistics necessary for the new expanded achievement set. + */ + static const int GAME_DEFINED_PROFILE_DATA_BYTES = 2 * 972; // per user #else - static const int GAME_DEFINED_PROFILE_DATA_BYTES = 972; // per user + static const int GAME_DEFINED_PROFILE_DATA_BYTES = 972; // per user #endif - unsigned int uiGameDefinedDataChangedBitmask; + unsigned int uiGameDefinedDataChangedBitmask; - void DebugPrintf(const char *szFormat, ...); - void DebugPrintfVerbose(bool bVerbose, const char *szFormat, ...); // Conditional printf - void DebugPrintf(int user, const char *szFormat, ...); + void DebugPrintf(const char* szFormat, ...); + void DebugPrintfVerbose(bool bVerbose, const char* szFormat, + ...); // Conditional printf + void DebugPrintf(int user, const char* szFormat, ...); - static const int USER_NONE = 0; // disables printf - static const int USER_GENERAL = 1; - static const int USER_JV = 2; - static const int USER_MH = 3; - static const int USER_PB = 4; - static const int USER_RR = 5; - static const int USER_SR = 6; - static const int USER_UI = 7; // 4J Stu - This also makes it appear on the UI console - - void HandleButtonPresses(); - bool IntroRunning() { return m_bIntroRunning;} - void SetIntroRunning(bool bSet) {m_bIntroRunning=bSet;} + static const int USER_NONE = 0; // disables printf + static const int USER_GENERAL = 1; + static const int USER_JV = 2; + static const int USER_MH = 3; + static const int USER_PB = 4; + static const int USER_RR = 5; + static const int USER_SR = 6; + static const int USER_UI = + 7; // 4J Stu - This also makes it appear on the UI console + + void HandleButtonPresses(); + bool IntroRunning() { return m_bIntroRunning; } + void SetIntroRunning(bool bSet) { m_bIntroRunning = bSet; } #ifdef _CONTENT_PACKAGE #ifndef _FINAL_BUILD - bool PartnernetPasswordRunning() { return m_bPartnernetPasswordRunning;} - void SetPartnernetPasswordRunning(bool bSet) {m_bPartnernetPasswordRunning=bSet;} + bool PartnernetPasswordRunning() { return m_bPartnernetPasswordRunning; } + void SetPartnernetPasswordRunning(bool bSet) { + m_bPartnernetPasswordRunning = bSet; + } #endif #endif - bool IsAppPaused(); - void SetAppPaused(bool val); - static int DisplaySavingMessage(void *pParam,const C4JStorage::ESavingMessage eMsg, int iPad); - bool GetGameStarted() {return m_bGameStarted;} - void SetGameStarted(bool bVal) { if(bVal) DebugPrintf("SetGameStarted - true\n"); else DebugPrintf("SetGameStarted - false\n"); m_bGameStarted = bVal; m_bIsAppPaused = !bVal;} - int GetLocalPlayerCount(void); - bool LoadInventoryMenu(int iPad,std::shared_ptr player, bool bNavigateBack=false); - bool LoadCreativeMenu(int iPad,std::shared_ptr player,bool bNavigateBack=false); - bool LoadEnchantingMenu(int iPad,std::shared_ptr inventory, int x, int y, int z, Level *level); - bool LoadFurnaceMenu(int iPad,std::shared_ptr inventory, std::shared_ptr furnace); - bool LoadBrewingStandMenu(int iPad,std::shared_ptr inventory, std::shared_ptr brewingStand); - bool LoadContainerMenu(int iPad,std::shared_ptr inventory, std::shared_ptr container); - bool LoadTrapMenu(int iPad,std::shared_ptr inventory, std::shared_ptr trap); - bool LoadCrafting2x2Menu(int iPad,std::shared_ptr player); - bool LoadCrafting3x3Menu(int iPad,std::shared_ptr player, int x, int y, int z); - bool LoadSignEntryMenu(int iPad,std::shared_ptr sign); - bool LoadRepairingMenu(int iPad,std::shared_ptr inventory, Level *level, int x, int y, int z); - bool LoadTradingMenu(int iPad, std::shared_ptr inventory, std::shared_ptr trader, Level *level); + bool IsAppPaused(); + void SetAppPaused(bool val); + static int DisplaySavingMessage(void* pParam, + const C4JStorage::ESavingMessage eMsg, + int iPad); + bool GetGameStarted() { return m_bGameStarted; } + void SetGameStarted(bool bVal) { + if (bVal) + DebugPrintf("SetGameStarted - true\n"); + else + DebugPrintf("SetGameStarted - false\n"); + m_bGameStarted = bVal; + m_bIsAppPaused = !bVal; + } + int GetLocalPlayerCount(void); + bool LoadInventoryMenu(int iPad, std::shared_ptr player, + bool bNavigateBack = false); + bool LoadCreativeMenu(int iPad, std::shared_ptr player, + bool bNavigateBack = false); + bool LoadEnchantingMenu(int iPad, std::shared_ptr inventory, + int x, int y, int z, Level* level, + const std::wstring& name); + bool LoadFurnaceMenu(int iPad, std::shared_ptr inventory, + std::shared_ptr furnace); + bool LoadBrewingStandMenu( + int iPad, std::shared_ptr inventory, + std::shared_ptr brewingStand); + bool LoadContainerMenu(int iPad, std::shared_ptr inventory, + std::shared_ptr container); + bool LoadTrapMenu(int iPad, std::shared_ptr inventory, + std::shared_ptr trap); + bool LoadCrafting2x2Menu(int iPad, std::shared_ptr player); + bool LoadCrafting3x3Menu(int iPad, std::shared_ptr player, + int x, int y, int z); + bool LoadFireworksMenu(int iPad, std::shared_ptr player, int x, + int y, int z); + bool LoadSignEntryMenu(int iPad, std::shared_ptr sign); + bool LoadRepairingMenu(int iPad, std::shared_ptr inventory, + Level* level, int x, int y, int z); + bool LoadTradingMenu(int iPad, std::shared_ptr inventory, + std::shared_ptr trader, Level* level, + const std::wstring& name); - bool GetTutorialMode() { return m_bTutorialMode;} - void SetTutorialMode(bool bSet) {m_bTutorialMode=bSet;} + bool LoadCommandBlockMenu( + int iPad, std::shared_ptr commandBlock) { + return false; + } + bool LoadHopperMenu(int iPad, std::shared_ptr inventory, + std::shared_ptr hopper); + bool LoadHopperMenu(int iPad, std::shared_ptr inventory, + std::shared_ptr hopper); + bool LoadHorseMenu(int iPad, std::shared_ptr inventory, + std::shared_ptr container, + std::shared_ptr horse); + bool LoadBeaconMenu(int iPad, std::shared_ptr inventory, + std::shared_ptr beacon); - void SetSpecialTutorialCompletionFlag(int iPad, int index); + bool GetTutorialMode() { return m_bTutorialMode; } + void SetTutorialMode(bool bSet) { m_bTutorialMode = bSet; } - static const wchar_t * GetString(int iID); + void SetSpecialTutorialCompletionFlag(int iPad, int index); - eGameMode GetGameMode() { return m_eGameMode;} - void SetGameMode(eGameMode eMode) { m_eGameMode=eMode;} + static const wchar_t* GetString(int iID); - eXuiAction GetGlobalXuiAction() {return m_eGlobalXuiAction;} - void SetGlobalXuiAction(eXuiAction action) {m_eGlobalXuiAction=action;} - eXuiAction GetXuiAction(int iPad) {return m_eXuiAction[iPad];} - void SetAction(int iPad, eXuiAction action, void *param = nullptr); - void SetTMSAction(int iPad, eTMSAction action) {m_eTMSAction[iPad]=action; } - eTMSAction GetTMSAction(int iPad) {return m_eTMSAction[iPad];} - eXuiServerAction GetXuiServerAction(int iPad) {return m_eXuiServerAction[iPad];} - void * GetXuiServerActionParam(int iPad) {return m_eXuiServerActionParam[iPad];} - void SetXuiServerAction(int iPad, eXuiServerAction action, void *param = nullptr) {m_eXuiServerAction[iPad]=action; m_eXuiServerActionParam[iPad] = param;} - eXuiServerAction GetGlobalXuiServerAction() {return m_eGlobalXuiServerAction;} - void SetGlobalXuiServerAction(eXuiServerAction action) {m_eGlobalXuiServerAction=action;} - - DisconnectPacket::eDisconnectReason GetDisconnectReason() { return m_disconnectReason; } - void SetDisconnectReason(DisconnectPacket::eDisconnectReason bVal) { m_disconnectReason = bVal; } + eGameMode GetGameMode() { return m_eGameMode; } + void SetGameMode(eGameMode eMode) { m_eGameMode = eMode; } - bool GetChangingSessionType() { return m_bChangingSessionType; } - void SetChangingSessionType(bool bVal) { m_bChangingSessionType = bVal; } + eXuiAction GetGlobalXuiAction() { return m_eGlobalXuiAction; } + void SetGlobalXuiAction(eXuiAction action) { m_eGlobalXuiAction = action; } + eXuiAction GetXuiAction(int iPad) { return m_eXuiAction[iPad]; } + void SetAction(int iPad, eXuiAction action, void* param = nullptr); + void SetTMSAction(int iPad, eTMSAction action) { + m_eTMSAction[iPad] = action; + } + eTMSAction GetTMSAction(int iPad) { return m_eTMSAction[iPad]; } + eXuiServerAction GetXuiServerAction(int iPad) { + return m_eXuiServerAction[iPad]; + } + void* GetXuiServerActionParam(int iPad) { + return m_eXuiServerActionParam[iPad]; + } + void SetXuiServerAction(int iPad, eXuiServerAction action, + void* param = nullptr) { + m_eXuiServerAction[iPad] = action; + m_eXuiServerActionParam[iPad] = param; + } + eXuiServerAction GetGlobalXuiServerAction() { + return m_eGlobalXuiServerAction; + } + void SetGlobalXuiServerAction(eXuiServerAction action) { + m_eGlobalXuiServerAction = action; + } - bool GetReallyChangingSessionType() { return m_bReallyChangingSessionType; } - void SetReallyChangingSessionType(bool bVal) { m_bReallyChangingSessionType = bVal; } + DisconnectPacket::eDisconnectReason GetDisconnectReason() { + return m_disconnectReason; + } + void SetDisconnectReason(DisconnectPacket::eDisconnectReason bVal) { + m_disconnectReason = bVal; + } + bool GetChangingSessionType() { return m_bChangingSessionType; } + void SetChangingSessionType(bool bVal) { m_bChangingSessionType = bVal; } - // 4J Stu - Added so that we can call this when a confirmation box is selected - static void SetActionConfirmed(void *param); - void HandleXuiActions(void); + bool GetReallyChangingSessionType() { return m_bReallyChangingSessionType; } + void SetReallyChangingSessionType(bool bVal) { + m_bReallyChangingSessionType = bVal; + } - // 4J Stu - Functions used for Minecon and other promo work - bool GetLoadSavesFromFolderEnabled() { return m_bLoadSavesFromFolderEnabled; } - void SetLoadSavesFromFolderEnabled(bool bVal) { m_bLoadSavesFromFolderEnabled = bVal; } + // 4J Stu - Added so that we can call this when a confirmation box is + // selected + static void SetActionConfirmed(void* param); + void HandleXuiActions(void); - // 4J Stu - Useful for debugging - bool GetWriteSavesToFolderEnabled() { return m_bWriteSavesToFolderEnabled; } - void SetWriteSavesToFolderEnabled(bool bVal) { m_bWriteSavesToFolderEnabled = bVal; } - bool GetMobsDontAttackEnabled() { return m_bMobsDontAttack; } - void SetMobsDontAttackEnabled(bool bVal) { m_bMobsDontAttack = bVal; } - bool GetUseDPadForDebug() { return m_bUseDPadForDebug; } - void SetUseDPadForDebug(bool bVal) { m_bUseDPadForDebug = bVal; } - bool GetMobsDontTickEnabled() { return m_bMobsDontTick; } - void SetMobsDontTickEnabled(bool bVal) { m_bMobsDontTick = bVal; } + // 4J Stu - Functions used for Minecon and other promo work + bool GetLoadSavesFromFolderEnabled() { + return m_bLoadSavesFromFolderEnabled; + } + void SetLoadSavesFromFolderEnabled(bool bVal) { + m_bLoadSavesFromFolderEnabled = bVal; + } - bool GetFreezePlayers() { return m_bFreezePlayers; } - void SetFreezePlayers(bool bVal) { m_bFreezePlayers = bVal; } + // 4J Stu - Useful for debugging + bool GetWriteSavesToFolderEnabled() { return m_bWriteSavesToFolderEnabled; } + void SetWriteSavesToFolderEnabled(bool bVal) { + m_bWriteSavesToFolderEnabled = bVal; + } + bool GetMobsDontAttackEnabled() { return m_bMobsDontAttack; } + void SetMobsDontAttackEnabled(bool bVal) { m_bMobsDontAttack = bVal; } + bool GetUseDPadForDebug() { return m_bUseDPadForDebug; } + void SetUseDPadForDebug(bool bVal) { m_bUseDPadForDebug = bVal; } + bool GetMobsDontTickEnabled() { return m_bMobsDontTick; } + void SetMobsDontTickEnabled(bool bVal) { m_bMobsDontTick = bVal; } - // debug -0 show safe area - void ShowSafeArea(bool show) - { + bool GetFreezePlayers() { return m_bFreezePlayers; } + void SetFreezePlayers(bool bVal) { m_bFreezePlayers = bVal; } + + // debug -0 show safe area + void ShowSafeArea(bool show) { #ifdef _XBOX - CXuiSceneBase::ShowSafeArea(show); + CXuiSceneBase::ShowSafeArea(show); #endif - } - // 4J-PB - to capture the social post screenshot - virtual void CaptureScreenshot(int iPad) {}; - //void GetPreviewImage(int iPad,XSOCIAL_PREVIEWIMAGE *preview); + } + // 4J-PB - to capture the social post screenshot + virtual void CaptureScreenshot(int iPad) {}; + // void GetPreviewImage(int iPad,XSOCIAL_PREVIEWIMAGE + // *preview); - void InitGameSettings(); - static int OldProfileVersionCallback(void *pParam,unsigned char *pucData, const unsigned short usVersion, const int iPad); + void InitGameSettings(); + static int OldProfileVersionCallback(void* pParam, unsigned char* pucData, + const unsigned short usVersion, + const int iPad); -#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__ ) - static int DefaultOptionsCallback(void *pParam,C4JStorage::PROFILESETTINGS *pSettings, const int iPad); - int SetDefaultOptions(C4JStorage::PROFILESETTINGS *pSettings,const int iPad,bool bWriteProfile=true); +#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || \ + defined __PSVITA__) + std::wstring toStringOptionsStatus( + const C4JStorage::eOptionsCallback& eStatus); + static int DefaultOptionsCallback(void* pParam, + C4JStorage::PROFILESETTINGS* pSettings, + const int iPad); + int SetDefaultOptions(C4JStorage::PROFILESETTINGS* pSettings, + const int iPad, bool bWriteProfile = true); #ifdef __ORBIS__ - static int OptionsDataCallback(void *pParam,int iPad,unsigned short usVersion,C4JStorage::eOptionsCallback eStatus,int iBlocksRequired); - int GetOptionsBlocksRequired(int iPad); + static int OptionsDataCallback(void* pParam, int iPad, + unsigned short usVersion, + C4JStorage::eOptionsCallback eStatus, + int iBlocksRequired); + int GetOptionsBlocksRequired(int iPad); #else - static int OptionsDataCallback(void *pParam,int iPad,unsigned short usVersion,C4JStorage::eOptionsCallback eStatus); + static int OptionsDataCallback(void* pParam, int iPad, + unsigned short usVersion, + C4JStorage::eOptionsCallback eStatus); #endif - C4JStorage::eOptionsCallback GetOptionsCallbackStatus(int iPad); + C4JStorage::eOptionsCallback GetOptionsCallbackStatus(int iPad); - void SetOptionsCallbackStatus(int iPad, C4JStorage::eOptionsCallback eStatus); + void SetOptionsCallbackStatus(int iPad, + C4JStorage::eOptionsCallback eStatus); #else - static int DefaultOptionsCallback(void *pParam,C_4JProfile::PROFILESETTINGS *pSettings, const int iPad); - int SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,const int iPad); + static int DefaultOptionsCallback(void* pParam, + C_4JProfile::PROFILESETTINGS* pSettings, + const int iPad); + int SetDefaultOptions(C_4JProfile::PROFILESETTINGS* pSettings, + const int iPad); #endif - virtual void SetRichPresenceContext(int iPad, int contextId) = 0; + virtual void SetRichPresenceContext(int iPad, int contextId) = 0; - - void SetGameSettings(int iPad,eGameSetting eVal,unsigned char ucVal); - unsigned char GetGameSettings(int iPad,eGameSetting eVal); - unsigned char GetGameSettings(eGameSetting eVal); // for the primary pad - void SetPlayerSkin(int iPad,const std::wstring &name); - void SetPlayerSkin(int iPad,std::uint32_t dwSkinId); - void SetPlayerCape(int iPad,const std::wstring &name); - void SetPlayerCape(int iPad,std::uint32_t dwCapeId); - void SetPlayerFavoriteSkin(int iPad, int iIndex,unsigned int uiSkinID); - unsigned int GetPlayerFavoriteSkin(int iPad,int iIndex); - unsigned char GetPlayerFavoriteSkinsPos(int iPad); - void SetPlayerFavoriteSkinsPos(int iPad,int iPos); - unsigned int GetPlayerFavoriteSkinsCount(int iPad); - void ValidateFavoriteSkins(int iPad); // check the DLC is available for the skins + void SetGameSettings(int iPad, eGameSetting eVal, unsigned char ucVal); + unsigned char GetGameSettings(int iPad, eGameSetting eVal); + unsigned char GetGameSettings(eGameSetting eVal); // for the primary pad + void SetPlayerSkin(int iPad, const std::wstring& name); + void SetPlayerSkin(int iPad, std::uint32_t dwSkinId); + void SetPlayerCape(int iPad, const std::wstring& name); + void SetPlayerCape(int iPad, std::uint32_t dwCapeId); + void SetPlayerFavoriteSkin(int iPad, int iIndex, unsigned int uiSkinID); + unsigned int GetPlayerFavoriteSkin(int iPad, int iIndex); + unsigned char GetPlayerFavoriteSkinsPos(int iPad); + void SetPlayerFavoriteSkinsPos(int iPad, int iPos); + unsigned int GetPlayerFavoriteSkinsCount(int iPad); + void ValidateFavoriteSkins( + int iPad); // check the DLC is available for the skins - // Mash-up pack worlds hide/display - void HideMashupPackWorld(int iPad, unsigned int iMashupPackID); - void EnableMashupPackWorlds(int iPad); - unsigned int GetMashupPackWorlds(int iPad); + // Mash-up pack worlds hide/display + void HideMashupPackWorld(int iPad, unsigned int iMashupPackID); + void EnableMashupPackWorlds(int iPad); + unsigned int GetMashupPackWorlds(int iPad); - // Minecraft language select - void SetMinecraftLanguage(int iPad, unsigned char ucLanguage); - unsigned char GetMinecraftLanguage(int iPad); + // Minecraft language select + void SetMinecraftLanguage(int iPad, unsigned char ucLanguage); + unsigned char GetMinecraftLanguage(int iPad); + void SetMinecraftLocale(int iPad, unsigned char ucLanguage); + unsigned char GetMinecraftLocale(int iPad); - - // 4J-PB - set a timer when the user navigates the quickselect, so we can bring the opacity back to defaults for a short time - unsigned int GetOpacityTimer(int iPad) { return m_uiOpacityCountDown[iPad]; } - void SetOpacityTimer(int iPad) { m_uiOpacityCountDown[iPad]=120; } // 6 seconds - void TickOpacityTimer(int iPad) { if(m_uiOpacityCountDown[iPad]>0) m_uiOpacityCountDown[iPad]--;} + // 4J-PB - set a timer when the user navigates the quickselect, so we can + // bring the opacity back to defaults for a short time + unsigned int GetOpacityTimer(int iPad) { + return m_uiOpacityCountDown[iPad]; + } + void SetOpacityTimer(int iPad) { + m_uiOpacityCountDown[iPad] = 120; + } // 6 seconds + void TickOpacityTimer(int iPad) { + if (m_uiOpacityCountDown[iPad] > 0) m_uiOpacityCountDown[iPad]--; + } public: - std::wstring GetPlayerSkinName(int iPad); - std::uint32_t GetPlayerSkinId(int iPad); - std::wstring GetPlayerCapeName(int iPad); - std::uint32_t GetPlayerCapeId(int iPad); - std::uint32_t GetAdditionalModelParts(int iPad); - void CheckGameSettingsChanged(bool bOverride5MinuteTimer=false, int iPad=XUSER_INDEX_ANY); - void ApplyGameSettingsChanged(int iPad); - void ClearGameSettingsChangedFlag(int iPad); - void ActionGameSettings(int iPad,eGameSetting eVal); - unsigned int GetGameSettingsDebugMask(int iPad=-1,bool bOverridePlayer=false); - void SetGameSettingsDebugMask(int iPad, unsigned int uiVal); - void ActionDebugMask(int iPad, bool bSetAllClear=false); + std::wstring GetPlayerSkinName(int iPad); + std::uint32_t GetPlayerSkinId(int iPad); + std::wstring GetPlayerCapeName(int iPad); + std::uint32_t GetPlayerCapeId(int iPad); + std::uint32_t GetAdditionalModelParts(int iPad); + void CheckGameSettingsChanged(bool bOverride5MinuteTimer = false, + int iPad = XUSER_INDEX_ANY); + void ApplyGameSettingsChanged(int iPad); + void ClearGameSettingsChangedFlag(int iPad); + void ActionGameSettings(int iPad, eGameSetting eVal); + unsigned int GetGameSettingsDebugMask(int iPad = -1, + bool bOverridePlayer = false); + void SetGameSettingsDebugMask(int iPad, unsigned int uiVal); + void ActionDebugMask(int iPad, bool bSetAllClear = false); - // - bool IsLocalMultiplayerAvailable(); + // + bool IsLocalMultiplayerAvailable(); - // for sign in change monitoring - static void SignInChangeCallback(void *pParam, bool bVal, unsigned int uiSignInData); - static void ClearSignInChangeUsersMask(); - static int SignoutExitWorldThreadProc( void* lpParameter ); - static int PrimaryPlayerSignedOutReturned(void *pParam, int iPad, const C4JStorage::EMessageResult); - static int EthernetDisconnectReturned(void *pParam, int iPad, const C4JStorage::EMessageResult); - static void ProfileReadErrorCallback(void *pParam); + // for sign in change monitoring + static void SignInChangeCallback(void* pParam, bool bVal, + unsigned int uiSignInData); + static void ClearSignInChangeUsersMask(); + static int SignoutExitWorldThreadProc(void* lpParameter); + static int PrimaryPlayerSignedOutReturned(void* pParam, int iPad, + const C4JStorage::EMessageResult); + static int EthernetDisconnectReturned(void* pParam, int iPad, + const C4JStorage::EMessageResult); + static void ProfileReadErrorCallback(void* pParam); - // FATAL LOAD ERRORS - virtual void FatalLoadError(); + // FATAL LOAD ERRORS + virtual void FatalLoadError(); - // Notifications from the game listener to be passed to the qnet listener - static void NotificationsCallback(void *pParam,std::uint32_t dwNotification, unsigned int uiParam); + // Notifications from the game listener to be passed to the qnet listener + static void NotificationsCallback(void* pParam, + std::uint32_t dwNotification, + unsigned int uiParam); - // for the ethernet being disconnected - static void LiveLinkChangeCallback(void *pParam, bool bConnected); - bool GetLiveLinkRequired() {return m_bLiveLinkRequired;} - void SetLiveLinkRequired(bool required) {m_bLiveLinkRequired=required;} + // for the ethernet being disconnected + static void LiveLinkChangeCallback(void* pParam, bool bConnected); + bool GetLiveLinkRequired() { return m_bLiveLinkRequired; } + void SetLiveLinkRequired(bool required) { m_bLiveLinkRequired = required; } - static void UpsellReturnedCallback(void *pParam, eUpsellType type, eUpsellResponse result, int iUserData); + static void UpsellReturnedCallback(void* pParam, eUpsellType type, + eUpsellResponse result, int iUserData); #if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__ - static int NowDisplayFullVersionPurchase(void *pParam, bool bContinue, int iPad); - static int MustSignInFullVersionPurchaseReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); + static int NowDisplayFullVersionPurchase(void* pParam, bool bContinue, + int iPad); + static int MustSignInFullVersionPurchaseReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result); #endif #if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__ - static int MustSignInFullVersionPurchaseReturnedExitTrial(void *pParam,int iPad,C4JStorage::EMessageResult result); + static int MustSignInFullVersionPurchaseReturnedExitTrial( + void* pParam, int iPad, C4JStorage::EMessageResult result); #endif #ifdef _DEBUG_MENUS_ENABLED - bool DebugSettingsOn() { return m_bDebugOptions;} + bool DebugSettingsOn() { return m_bDebugOptions; } + bool DebugArtToolsOn(); #else - bool DebugSettingsOn() { return false;} + bool DebugSettingsOn() { return false; } + bool DebugArtToolsOn() { return false; } #endif - void SetDebugSequence(const char *pchSeq); - static int DebugInputCallback(void *pParam); - //bool UploadFileToGlobalStorage(int iQuadrant, C4JStorage::eGlobalStorage eStorageFacility, std::wstring *wsFile ); + void SetDebugSequence(const char* pchSeq); + static int DebugInputCallback(void* pParam); + // bool UploadFileToGlobalStorage(int iQuadrant, + // C4JStorage::eGlobalStorage eStorageFacility, std::wstring *wsFile ); - // Installed DLC - bool StartInstallDLCProcess(int iPad); - static int DLCInstalledCallback(void *pParam,int iOfferC,int iPad); - void HandleDLCLicenseChange(); - static int DLCMountedCallback(void *pParam,int iPad,std::uint32_t dwErr,std::uint32_t dwLicenceMask); - void MountNextDLC(int iPad); - //static int DLCReadCallback(LPVOID pParam,C4JStorage::DLC_FILE_DETAILS *pDLCData); - void HandleDLC(DLCPack *pack); - bool DLCInstallPending() {return m_bDLCInstallPending;} - bool DLCInstallProcessCompleted() {return m_bDLCInstallProcessCompleted;} - void ClearDLCInstalled() { m_bDLCInstallProcessCompleted=false;} - static int MarketplaceCountsCallback(void *pParam,C4JStorage::DLC_TMS_DETAILS *,int iPad); + // Installed DLC + bool StartInstallDLCProcess(int iPad); + static int DLCInstalledCallback(void* pParam, int iOfferC, int iPad); + void HandleDLCLicenseChange(); + static int DLCMountedCallback(void* pParam, int iPad, std::uint32_t dwErr, + std::uint32_t dwLicenceMask); + void MountNextDLC(int iPad); + // static int DLCReadCallback(void* pParam,C4JStorage::DLC_FILE_DETAILS + // *pDLCData); + void HandleDLC(DLCPack* pack); + bool DLCInstallPending() { return m_bDLCInstallPending; } + bool DLCInstallProcessCompleted() { return m_bDLCInstallProcessCompleted; } + void ClearDLCInstalled() { m_bDLCInstallProcessCompleted = false; } + static int MarketplaceCountsCallback(void* pParam, + C4JStorage::DLC_TMS_DETAILS*, + int iPad); - bool AlreadySeenCreditText(const std::wstring &wstemp); + bool AlreadySeenCreditText(const std::wstring& wstemp); - void ClearNewDLCAvailable(void) { m_bNewDLCAvailable=false; m_bSeenNewDLCTip=true;} - bool GetNewDLCAvailable() { return m_bNewDLCAvailable;} - void DisplayNewDLCTipAgain() { m_bSeenNewDLCTip=false;} - bool DisplayNewDLCTip() { if(!m_bSeenNewDLCTip) { m_bSeenNewDLCTip=true; return true;} else return false;} + void ClearNewDLCAvailable(void) { + m_bNewDLCAvailable = false; + m_bSeenNewDLCTip = true; + } + bool GetNewDLCAvailable() { return m_bNewDLCAvailable; } + void DisplayNewDLCTipAgain() { m_bSeenNewDLCTip = false; } + bool DisplayNewDLCTip() { + if (!m_bSeenNewDLCTip) { + m_bSeenNewDLCTip = true; + return true; + } else + return false; + } - // functions to store launch data, and to exit the game - required due to possibly being on a demo disc - virtual void StoreLaunchData(); - virtual void ExitGame(); + // functions to store launch data, and to exit the game - required due to + // possibly being on a demo disc + virtual void StoreLaunchData(); + virtual void ExitGame(); - bool isXuidNotch(PlayerUID xuid); - bool isXuidDeadmau5(PlayerUID xuid); + bool isXuidNotch(PlayerUID xuid); + bool isXuidDeadmau5(PlayerUID xuid); - void AddMemoryTextureFile(const std::wstring &wName, std::uint8_t *pbData, unsigned int byteCount); - void RemoveMemoryTextureFile(const std::wstring &wName); - void GetMemFileDetails(const std::wstring &wName, std::uint8_t **ppbData, unsigned int *pByteCount); - bool IsFileInMemoryTextures(const std::wstring &wName); + void AddMemoryTextureFile(const std::wstring& wName, std::uint8_t* pbData, + unsigned int byteCount); + void RemoveMemoryTextureFile(const std::wstring& wName); + void GetMemFileDetails(const std::wstring& wName, std::uint8_t** ppbData, + unsigned int* pByteCount); + bool IsFileInMemoryTextures(const std::wstring& wName); - // Texture Pack Data files (icon, banner, comparison shot & text) - void AddMemoryTPDFile(int iConfig, std::uint8_t *pbData, unsigned int byteCount); - void RemoveMemoryTPDFile(int iConfig); - bool IsFileInTPD(int iConfig); - void GetTPD(int iConfig, std::uint8_t **ppbData, unsigned int *pByteCount); - int GetTPDSize() {return m_MEM_TPD.size();} + // Texture Pack Data files (icon, banner, comparison shot & text) + void AddMemoryTPDFile(int iConfig, std::uint8_t* pbData, + unsigned int byteCount); + void RemoveMemoryTPDFile(int iConfig); + bool IsFileInTPD(int iConfig); + void GetTPD(int iConfig, std::uint8_t** ppbData, unsigned int* pByteCount); + int GetTPDSize() { return m_MEM_TPD.size(); } #ifndef __PS3__ - int GetTPConfigVal(WCHAR *pwchDataFile); + int GetTPConfigVal(WCHAR* pwchDataFile); #endif - bool DefaultCapeExists(); - //void InstallDefaultCape(); // attempt to install the default cape once per game launch + bool DefaultCapeExists(); + // void InstallDefaultCape(); // attempt to install the default cape once + // per game launch - // invites - //void ProcessInvite(JoinFromInviteData *pJoinData); - void ProcessInvite(std::uint32_t dwUserIndex, std::uint32_t dwLocalUsersMask, const INVITE_INFO * pInviteInfo); + // invites + // void ProcessInvite(JoinFromInviteData *pJoinData); + void ProcessInvite(std::uint32_t dwUserIndex, + std::uint32_t dwLocalUsersMask, + const INVITE_INFO* pInviteInfo); - // Add credits for DLC installed - void AddCreditText(const wchar_t *lpStr); + // Add credits for DLC installed + void AddCreditText(const wchar_t* lpStr); private: - PlayerUID m_xuidNotch; + PlayerUID m_xuidNotch; #ifdef _DURANGO - std::unordered_map m_GTS_Files; + std::unordered_map m_GTS_Files; #else - std::unordered_map m_GTS_Files; + std::unordered_map m_GTS_Files; #endif - // for storing memory textures - player skin - std::unordered_map m_MEM_Files; - // for storing texture pack data files - std::unordered_map m_MEM_TPD; - CRITICAL_SECTION csMemFilesLock; // For locking access to the above map - CRITICAL_SECTION csMemTPDLock; // For locking access to the above map + // for storing memory textures - player skin + std::unordered_map m_MEM_Files; + // for storing texture pack data files + std::unordered_map m_MEM_TPD; + CRITICAL_SECTION csMemFilesLock; // For locking access to the above map + CRITICAL_SECTION csMemTPDLock; // For locking access to the above map - VNOTIFICATIONS m_vNotifications; + VNOTIFICATIONS m_vNotifications; public: - // launch data - std::uint8_t *m_pLaunchData; - unsigned int m_dwLaunchDataSize; + // launch data + std::uint8_t* m_pLaunchData; + unsigned int m_dwLaunchDataSize; public: - // BAN LIST - void AddLevelToBannedLevelList(int iPad,PlayerUID xuid, char *pszLevelName, bool bWriteToTMS); - bool IsInBannedLevelList(int iPad, PlayerUID xuid, char *pszLevelName); - void RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, char *pszLevelName); - void InvalidateBannedList(int iPad); - void SetUniqueMapName(char *pszUniqueMapName); - char *GetUniqueMapName(void); + // BAN LIST + void AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char* pszLevelName, + bool bWriteToTMS); + bool IsInBannedLevelList(int iPad, PlayerUID xuid, char* pszLevelName); + void RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, + char* pszLevelName); + void InvalidateBannedList(int iPad); + void SetUniqueMapName(char* pszUniqueMapName); + char* GetUniqueMapName(void); #ifdef _XBOX_ONE - void AddLevelToBannedLevelList(int iPad, PBANNEDLISTDATA pBannedListData, bool bWriteToTMS); + void AddLevelToBannedLevelList(int iPad, PBANNEDLISTDATA pBannedListData, + bool bWriteToTMS); #endif +public: + bool GetResourcesLoaded() { return m_bResourcesLoaded; } + void SetResourcesLoaded(bool bVal) { m_bResourcesLoaded = bVal; } public: - bool GetResourcesLoaded() {return m_bResourcesLoaded;} - void SetResourcesLoaded(bool bVal) {m_bResourcesLoaded=bVal;} + bool m_bGameStarted; + bool m_bIntroRunning; + bool m_bTutorialMode; + bool m_bIsAppPaused; -public: - bool m_bGameStarted; - bool m_bIntroRunning; - bool m_bTutorialMode; - bool m_bIsAppPaused; + bool m_bChangingSessionType; + bool m_bReallyChangingSessionType; - bool m_bChangingSessionType; - bool m_bReallyChangingSessionType; + bool m_bDisplayFullVersionPurchase; // for after signing in during the + // trial, and trying to unlock full + // version on an upsell - bool m_bDisplayFullVersionPurchase; // for after signing in during the trial, and trying to unlock full version on an upsell - - void loadMediaArchive(); - void loadStringTable(); + void loadMediaArchive(); + void loadStringTable(); protected: - ArchiveFile *m_mediaArchive; - StringTable *m_stringTable; + ArchiveFile* m_mediaArchive; + StringTable* m_stringTable; public: - int getArchiveFileSize(const std::wstring &filename); - bool hasArchiveFile(const std::wstring &filename); - byteArray getArchiveFile(const std::wstring &filename); + int getArchiveFileSize(const std::wstring& filename); + bool hasArchiveFile(const std::wstring& filename); + byteArray getArchiveFile(const std::wstring& filename); private: - - static int BannedLevelDialogReturned(void *pParam,int iPad,const C4JStorage::EMessageResult); - static int TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - - VBANNEDLIST *m_vBannedListA[XUSER_MAX_COUNT]; + static int BannedLevelDialogReturned(void* pParam, int iPad, + const C4JStorage::EMessageResult); + static int TexturePackDialogReturned(void* pParam, int iPad, + C4JStorage::EMessageResult result); - void HandleButtonPresses(int iPad); + VBANNEDLIST* m_vBannedListA[XUSER_MAX_COUNT]; - bool m_bResourcesLoaded; + void HandleButtonPresses(int iPad); - // Global string table for this application. - //CXuiStringTable StringTable; + bool m_bResourcesLoaded; + // Global string table for this application. + // CXuiStringTable StringTable; - // Container scene for some menu + // Container scene for some menu -// CXuiScene debugContainerScene; - - - //bool m_bSplitScreenEnabled; + // CXuiScene debugContainerScene; + // bool m_bSplitScreenEnabled; #ifdef _CONTENT_PACKAGE #ifndef _FINAL_BUILD - bool m_bPartnernetPasswordRunning; + bool m_bPartnernetPasswordRunning; #endif #endif - eGameMode m_eGameMode; // single or multiplayer + eGameMode m_eGameMode; // single or multiplayer - static unsigned int m_uiLastSignInData; + static unsigned int m_uiLastSignInData; - // We've got sizeof(GAME_SETTINGS) bytes reserved at the start of the gamedefined data per player for settings - GAME_SETTINGS *GameSettingsA[XUSER_MAX_COUNT]; + // We've got sizeof(GAME_SETTINGS) bytes reserved at the start of the + // gamedefined data per player for settings + GAME_SETTINGS* GameSettingsA[XUSER_MAX_COUNT]; - // For promo work - bool m_bLoadSavesFromFolderEnabled; + // For promo work + bool m_bLoadSavesFromFolderEnabled; - // For debugging - bool m_bWriteSavesToFolderEnabled; - bool m_bMobsDontAttack; - bool m_bUseDPadForDebug; - bool m_bMobsDontTick; - bool m_bFreezePlayers; + // For debugging + bool m_bWriteSavesToFolderEnabled; + bool m_bMobsDontAttack; + bool m_bUseDPadForDebug; + bool m_bMobsDontTick; + bool m_bFreezePlayers; - // 4J : WESTY : For taking screen shots. - //bool m_bInterfaceRenderingOff; - //bool m_bHandRenderingOff; + // 4J : WESTY : For taking screen shots. + // bool m_bInterfaceRenderingOff; + // bool m_bHandRenderingOff; - DisconnectPacket::eDisconnectReason m_disconnectReason; + DisconnectPacket::eDisconnectReason m_disconnectReason; public: - virtual void RunFrame() {}; + virtual void RunFrame() {}; + static constexpr unsigned int m_dwOfferID = 0x00000001; + // timer + void InitTime(); + void UpdateTime(); - static constexpr unsigned int m_dwOfferID = 0x00000001; + // trial timer + void SetTrialTimerStart(void); + float getTrialTimer(void); -// timer - void InitTime(); - void UpdateTime(); - - // trial timer - void SetTrialTimerStart(void); - float getTrialTimer(void); - - // notifications from the game for qnet - VNOTIFICATIONS *GetNotifications() {return &m_vNotifications;} + // notifications from the game for qnet + VNOTIFICATIONS* GetNotifications() { return &m_vNotifications; } private: + // To avoid problems with threads being kicked off from xuis that alter + // things that may be in progress within the run_middle, we'll action these + // at the end of the game loop + eXuiAction m_eXuiAction[XUSER_MAX_COUNT]; + eTMSAction m_eTMSAction[XUSER_MAX_COUNT]; + void* m_eXuiActionParam[XUSER_MAX_COUNT]; + eXuiAction m_eGlobalXuiAction; + eXuiServerAction m_eXuiServerAction[XUSER_MAX_COUNT]; + void* m_eXuiServerActionParam[XUSER_MAX_COUNT]; + eXuiServerAction m_eGlobalXuiServerAction; + bool m_bLiveLinkRequired; - // To avoid problems with threads being kicked off from xuis that alter things that may be in progress within the run_middle, - // we'll action these at the end of the game loop - eXuiAction m_eXuiAction[XUSER_MAX_COUNT]; - eTMSAction m_eTMSAction[XUSER_MAX_COUNT]; - void *m_eXuiActionParam[XUSER_MAX_COUNT]; - eXuiAction m_eGlobalXuiAction; - eXuiServerAction m_eXuiServerAction[XUSER_MAX_COUNT]; - void *m_eXuiServerActionParam[XUSER_MAX_COUNT]; - eXuiServerAction m_eGlobalXuiServerAction; + static int UnlockFullExitReturned(void* pParam, int iPad, + C4JStorage::EMessageResult result); + static int UnlockFullSaveReturned(void* pParam, int iPad, + C4JStorage::EMessageResult result); + static int UnlockFullInviteReturned(void* pParam, int iPad, + C4JStorage::EMessageResult result); + static int TrialOverReturned(void* pParam, int iPad, + C4JStorage::EMessageResult result); + static int ExitAndJoinFromInvite(void* pParam, int iPad, + C4JStorage::EMessageResult result); + static int ExitAndJoinFromInviteSaveDialogReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result); + static int ExitAndJoinFromInviteAndSaveReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result); + static int ExitAndJoinFromInviteDeclineSaveReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result); + static int FatalErrorDialogReturned(void* pParam, int iPad, + C4JStorage::EMessageResult result); + static int WarningTrialTexturePackReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result); - bool m_bLiveLinkRequired; + JoinFromInviteData m_InviteData; + bool m_bDebugOptions; // toggle debug things on or off - static int UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int UnlockFullInviteReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int TrialOverReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int ExitAndJoinFromInvite(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int ExitAndJoinFromInviteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int ExitAndJoinFromInviteAndSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int ExitAndJoinFromInviteDeclineSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int FatalErrorDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); + // Trial timer + float m_fTrialTimerStart, mfTrialPausedTime; + typedef struct TimeInfo { + LARGE_INTEGER qwTime; + LARGE_INTEGER qwAppTime; - JoinFromInviteData m_InviteData; - bool m_bDebugOptions; // toggle debug things on or off + float fAppTime; + float fElapsedTime; + float fSecsPerTick; + } TIMEINFO; - // Trial timer - float m_fTrialTimerStart,mfTrialPausedTime; - typedef struct TimeInfo - { - LARGE_INTEGER qwTime; - LARGE_INTEGER qwAppTime; - - float fAppTime; - float fElapsedTime; - float fSecsPerTick; - } TIMEINFO; - - TimeInfo m_Time; + TimeInfo m_Time; protected: - static const int MAX_TIPS_GAMETIP = 50; - static const int MAX_TIPS_TRIVIATIP = 20; - static TIPSTRUCT m_GameTipA[MAX_TIPS_GAMETIP]; - static TIPSTRUCT m_TriviaTipA[MAX_TIPS_TRIVIATIP]; - static Random *TipRandom; + static const int MAX_TIPS_GAMETIP = 50; + static const int MAX_TIPS_TRIVIATIP = 20; + static TIPSTRUCT m_GameTipA[MAX_TIPS_GAMETIP]; + static TIPSTRUCT m_TriviaTipA[MAX_TIPS_TRIVIATIP]; + static Random* TipRandom; + public: - void InitialiseTips(); - int GetNextTip(); - int GetHTMLColour(eMinecraftColour colour); - int GetHTMLColor(eMinecraftColour colour) { return GetHTMLColour(colour); } - int GetHTMLFontSize(EHTMLFontSize size); - std::wstring FormatHTMLString(int iPad, const std::wstring &desc, int shadowColour = 0xFFFFFFFF); - std::wstring GetActionReplacement(int iPad, unsigned char ucAction); - std::wstring GetVKReplacement(unsigned int uiVKey); - std::wstring GetIconReplacement(unsigned int uiIcon); + void InitialiseTips(); + int GetNextTip(); + int GetHTMLColour(eMinecraftColour colour); + int GetHTMLColor(eMinecraftColour colour) { return GetHTMLColour(colour); } + int GetHTMLFontSize(EHTMLFontSize size); + std::wstring FormatHTMLString(int iPad, const std::wstring& desc, + int shadowColour = 0xFFFFFFFF); + std::wstring GetActionReplacement(int iPad, unsigned char ucAction); + std::wstring GetVKReplacement(unsigned int uiVKey); + std::wstring GetIconReplacement(unsigned int uiIcon); - float getAppTime() { return m_Time.fAppTime; } - void UpdateTrialPausedTimer() { mfTrialPausedTime+= m_Time.fElapsedTime;} + float getAppTime() { return m_Time.fAppTime; } + void UpdateTrialPausedTimer() { mfTrialPausedTime += m_Time.fElapsedTime; } + + static int RemoteSaveThreadProc(void* lpParameter); + static void ExitGameFromRemoteSave(void* lpParameter); + static int ExitGameFromRemoteSaveDialogReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result); - static int RemoteSaveThreadProc( void* lpParameter ); - static void ExitGameFromRemoteSave( void *lpParameter ); - static int ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); private: - int m_TipIDA[MAX_TIPS_GAMETIP+MAX_TIPS_TRIVIATIP]; - unsigned int m_uiCurrentTip; - static int TipsSortFunction(const void* a, const void* b); + int m_TipIDA[MAX_TIPS_GAMETIP + MAX_TIPS_TRIVIATIP]; + unsigned int m_uiCurrentTip; + static int TipsSortFunction(const void* a, const void* b); - // XML + // XML public: + // Hold a vector of terrain feature positions + void AddTerrainFeaturePosition(_eTerrainFeatureType, int, int); + void ClearTerrainFeaturePosition(); + _eTerrainFeatureType IsTerrainFeature(int x, int z); + bool GetTerrainFeaturePosition(_eTerrainFeatureType eType, int* pX, + int* pZ); + std::vector m_vTerrainFeatures; - // Hold a vector of terrain feature positions - void AddTerrainFeaturePosition(_eTerrainFeatureType,int,int); - void ClearTerrainFeaturePosition(); - _eTerrainFeatureType IsTerrainFeature(int x,int z); - bool GetTerrainFeaturePosition(_eTerrainFeatureType eType, int *pX, int *pZ); - std::vector m_vTerrainFeatures; - - static HRESULT RegisterMojangData(WCHAR *, PlayerUID, WCHAR *, WCHAR *); - MOJANG_DATA *GetMojangDataForXuid(PlayerUID xuid); - static HRESULT RegisterConfigValues(WCHAR *pType, int iValue); + static HRESULT RegisterMojangData(WCHAR*, PlayerUID, WCHAR*, WCHAR*); + MOJANG_DATA* GetMojangDataForXuid(PlayerUID xuid); + static HRESULT RegisterConfigValues(WCHAR* pType, int iValue); #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) - HRESULT RegisterDLCData(char *pchDLCName, unsigned int uiSortIndex, char *pchImageURL); - bool GetDLCFullOfferIDForSkinID(const std::wstring &FirstSkin,ULONGLONG *pullVal); - DLC_INFO *GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial); - DLC_INFO *GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full); + HRESULT RegisterDLCData(char* pchDLCName, unsigned int uiSortIndex, + char* pchImageURL); + bool GetDLCFullOfferIDForSkinID(const std::wstring& FirstSkin, + ULONGLONG* pullVal); + DLC_INFO* GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial); + DLC_INFO* GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full); #elif defined(_XBOX_ONE) - static HRESULT RegisterDLCData(eDLCContentType, WCHAR *, WCHAR *, WCHAR *, WCHAR *, int, unsigned int); - //bool GetDLCFullOfferIDForSkinID(const std::wstring &FirstSkin,WCHAR *pwchProductId); - bool GetDLCFullOfferIDForSkinID(const std::wstring &FirstSkin,std::wstring &wsProductId); - DLC_INFO *GetDLCInfoForFullOfferID(WCHAR *pwchProductId); - DLC_INFO *GetDLCInfoForProductName(WCHAR *pwchProductName); + static HRESULT RegisterDLCData(eDLCContentType, WCHAR*, WCHAR*, WCHAR*, + WCHAR*, int, unsigned int); + // bool GetDLCFullOfferIDForSkinID(const std::wstring &FirstSkin,WCHAR + // *pwchProductId); + bool GetDLCFullOfferIDForSkinID(const std::wstring& FirstSkin, + std::wstring& wsProductId); + DLC_INFO* GetDLCInfoForFullOfferID(WCHAR* pwchProductId); + DLC_INFO* GetDLCInfoForProductName(WCHAR* pwchProductName); #else - static HRESULT RegisterDLCData(WCHAR *, WCHAR *, int, __uint64, __uint64, WCHAR *, unsigned int, int, WCHAR *pDataFile); - bool GetDLCFullOfferIDForSkinID(const std::wstring &FirstSkin,ULONGLONG *pullVal); - DLC_INFO *GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial); - DLC_INFO *GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full); + static HRESULT RegisterDLCData(WCHAR*, WCHAR*, int, uint64_t, uint64_t, + WCHAR*, unsigned int, int, WCHAR* pDataFile); + bool GetDLCFullOfferIDForSkinID(const std::wstring& FirstSkin, + ULONGLONG* pullVal); + DLC_INFO* GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial); + DLC_INFO* GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full); #endif - unsigned int GetDLCCreditsCount(); - SCreditTextItemDef * GetDLCCredits(int iIndex); + unsigned int GetDLCCreditsCount(); + SCreditTextItemDef* GetDLCCredits(int iIndex); -// TMS - void ReadDLCFileFromTMS(int iPad,eTMSAction action, bool bCallback=false); - void ReadXuidsFileFromTMS(int iPad,eTMSAction action,bool bCallback=false); + // TMS + void ReadDLCFileFromTMS(int iPad, eTMSAction action, + bool bCallback = false); + void ReadXuidsFileFromTMS(int iPad, eTMSAction action, + bool bCallback = false); - // images for save thumbnail/social post - virtual void CaptureSaveThumbnail() =0; - virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize)=0; - virtual void ReleaseSaveThumbnail()=0; - virtual void GetScreenshot(int iPad, std::uint8_t **screenshotData, unsigned int *screenshotSize)=0; + // images for save thumbnail/social post + virtual void CaptureSaveThumbnail() = 0; + virtual void GetSaveThumbnail(std::uint8_t** thumbnailData, + unsigned int* thumbnailSize) = 0; + virtual void ReleaseSaveThumbnail() = 0; + virtual void GetScreenshot(int iPad, std::uint8_t** screenshotData, + unsigned int* screenshotSize) = 0; - virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false)=0; + virtual void ReadBannedList(int iPad, eTMSAction action = (eTMSAction)0, + bool bCallback = false) = 0; private: + std::vector vDLCCredits; - std::vector vDLCCredits; - -#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) - static std::unordered_map MojangData; - static std::unordered_map DLCTextures_PackID; // for mash-up packs & texture packs - static std::unordered_map DLCInfo; - static std::unordered_map DLCInfo_SkinName; // skin name, full offer id +#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) + static std::unordered_map + MojangData; + static std::unordered_map + DLCTextures_PackID; // for mash-up packs & texture packs + static std::unordered_map DLCInfo; + static std::unordered_map + DLCInfo_SkinName; // skin name, full offer id #elif defined(_DURANGO) - static std::unordered_map MojangData; - static std::unordered_map DLCTextures_PackID; // for mash-up packs & texture packs - //static std::unordered_map DLCInfo_Trial; // full offerid, dlc_info - static std::unordered_map DLCInfo_Full; // full offerid, dlc_info - static std::unordered_map DLCInfo_SkinName; // skin name, full offer id + static std::unordered_map + MojangData; + static std::unordered_map + DLCTextures_PackID; // for mash-up packs & texture packs + // static std::unordered_map DLCInfo_Trial; // + // full offerid, dlc_info + static std::unordered_map + DLCInfo_Full; // full offerid, dlc_info + static std::unordered_map + DLCInfo_SkinName; // skin name, full offer id #else - static std::unordered_map MojangData; - static std::unordered_map DLCTextures_PackID; // for mash-up packs & texture packs - static std::unordered_map DLCInfo_Trial; // full offerid, dlc_info - static std::unordered_map DLCInfo_Full; // full offerid, dlc_info - static std::unordered_map DLCInfo_SkinName; // skin name, full offer id + static std::unordered_map MojangData; + static std::unordered_map + DLCTextures_PackID; // for mash-up packs & texture packs + static std::unordered_map + DLCInfo_Trial; // full offerid, dlc_info + static std::unordered_map + DLCInfo_Full; // full offerid, dlc_info + static std::unordered_map + DLCInfo_SkinName; // skin name, full offer id #endif -// bool m_bRead_TMS_XUIDS_XML; // track whether we have already read the TMS xuids.xml file -// bool m_bRead_TMS_DLCINFO_XML; // track whether we have already read the TMS DLC.xml file + // bool m_bRead_TMS_XUIDS_XML; // track whether we have already read the + // TMS xuids.xml file bool m_bRead_TMS_DLCINFO_XML; // track whether + // we have already read the TMS DLC.xml file - bool m_bDefaultCapeInstallAttempted; // have we attempted to install the default cape from tms + bool m_bDefaultCapeInstallAttempted; // have we attempted to install the + // default cape from tms - //bool m_bwasHidingGui; // 4J Stu - Removed 1.8.2 bug fix (TU6) as not needed - bool m_bDLCInstallProcessCompleted; - bool m_bDLCInstallPending; - int m_iTotalDLC; - int m_iTotalDLCInstalled; + // bool m_bwasHidingGui; // 4J Stu - Removed 1.8.2 bug fix (TU6) as not + // needed + bool m_bDLCInstallProcessCompleted; + bool m_bDLCInstallPending; + int m_iTotalDLC; + int m_iTotalDLCInstalled; public: - // 4J Stu - We need to be able to detect when a guest player signs in or out causing other guest players to change their xuid - // The simplest way to do this is to check if their guest number has changed, so store the last known one here - // 4J Stu - Now storing the whole XUSER_SIGNIN_INFO so we can detect xuid changes - XUSER_SIGNIN_INFO m_currentSigninInfo[XUSER_MAX_COUNT]; + // 4J Stu - We need to be able to detect when a guest player signs in or out + // causing other guest players to change their xuid The simplest way to do + // this is to check if their guest number has changed, so store the last + // known one here 4J Stu - Now storing the whole XUSER_SIGNIN_INFO so we can + // detect xuid changes + XUSER_SIGNIN_INFO m_currentSigninInfo[XUSER_MAX_COUNT]; - //void OverrideFontRenderer(bool set, bool immediate = true); -// void ToggleFontRenderer() { OverrideFontRenderer(!m_bFontRendererOverridden,false); } - BANNEDLIST BannedListA[XUSER_MAX_COUNT]; + // void OverrideFontRenderer(bool set, bool immediate = true); + // void ToggleFontRenderer() { + // OverrideFontRenderer(!m_bFontRendererOverridden,false); } + BANNEDLIST BannedListA[XUSER_MAX_COUNT]; private: -// XUI_FontRenderer *m_fontRenderer; -// bool m_bFontRendererOverridden; -// bool m_bOverrideFontRenderer; + // XUI_FontRenderer *m_fontRenderer; + // bool m_bFontRendererOverridden; + // bool m_bOverrideFontRenderer; - - bool m_bRead_BannedListA[XUSER_MAX_COUNT]; - char m_pszUniqueMapName[14]; - bool m_BanListCheck[XUSER_MAX_COUNT]; + bool m_bRead_BannedListA[XUSER_MAX_COUNT]; + char m_pszUniqueMapName[14]; + bool m_BanListCheck[XUSER_MAX_COUNT]; public: - void SetBanListCheck(int iPad,bool bVal) {m_BanListCheck[iPad]=bVal;} - bool GetBanListCheck(int iPad) { return m_BanListCheck[iPad];} -// AUTOSAVE + void SetBanListCheck(int iPad, bool bVal) { m_BanListCheck[iPad] = bVal; } + bool GetBanListCheck(int iPad) { return m_BanListCheck[iPad]; } + // AUTOSAVE public: - void SetAutosaveTimerTime(void); - bool AutosaveDue(void); - unsigned int SecondsToAutosave(); -private: - unsigned int m_uiAutosaveTimer; - unsigned int m_uiOpacityCountDown[XUSER_MAX_COUNT]; - - // DLC - bool m_bNewDLCAvailable; - bool m_bSeenNewDLCTip; - - // Host options -private: - unsigned int m_uiGameHostSettings; - static unsigned char m_szPNG[8]; - - unsigned int FromBigEndian(unsigned int uiValue); - -public: - - - void SetGameHostOption(eGameHostOption eVal,unsigned int uiVal); - void SetGameHostOption(unsigned int &uiHostSettings, eGameHostOption eVal,unsigned int uiVal); - unsigned int GetGameHostOption(eGameHostOption eVal); - unsigned int GetGameHostOption(unsigned int uiHostSettings, eGameHostOption eVal); - - void SetResetNether(bool bResetNether) {m_bResetNether=bResetNether;} - bool GetResetNether() {return m_bResetNether;} - bool CanRecordStatsAndAchievements(); - - // World seed from png image - void GetImageTextData(std::uint8_t *imageData, unsigned int imageBytes, unsigned char *seedText, unsigned int &uiHostOptions, bool &bHostOptionsRead, std::uint32_t &uiTexturePack); - unsigned int CreateImageTextData(std::uint8_t *textMetadata, __int64 seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId); - - // Game rules - GameRuleManager m_gameRules; - -public: - void processSchematics(LevelChunk *levelChunk); - void processSchematicsLighting(LevelChunk *levelChunk); - void loadDefaultGameRules(); - std::vector *getLevelGenerators() { return m_gameRules.getLevelGenerators(); } - void setLevelGenerationOptions(LevelGenerationOptions *levelGen); - LevelRuleset *getGameRuleDefinitions() { return m_gameRules.getGameRuleDefinitions(); } - LevelGenerationOptions *getLevelGenerationOptions() { return m_gameRules.getLevelGenerationOptions(); } - const wchar_t *GetGameRulesString(const std::wstring &key); + void SetAutosaveTimerTime(void); + bool AutosaveDue(void); + unsigned int SecondsToAutosave(); private: - std::uint8_t m_playerColours[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's - unsigned int m_playerGamePrivileges[MINECRAFT_NET_MAX_PLAYERS]; + unsigned int m_uiAutosaveTimer; + unsigned int m_uiOpacityCountDown[XUSER_MAX_COUNT]; + + // DLC + bool m_bNewDLCAvailable; + bool m_bSeenNewDLCTip; + + // Host options +private: + unsigned int m_uiGameHostSettings; + static unsigned char m_szPNG[8]; + +#ifdef _LARGE_WORLDS + unsigned int m_GameNewWorldSize; + bool m_bGameNewWorldSizeUseMoat; + unsigned int m_GameNewHellScale; +#endif + unsigned int FromBigEndian(unsigned int uiValue); public: - void UpdatePlayerInfo(std::uint8_t networkSmallId, SHORT playerColourIndex, unsigned int playerGamePrivileges); - short GetPlayerColour(std::uint8_t networkSmallId); - unsigned int GetPlayerPrivileges(std::uint8_t networkSmallId); + void SetGameHostOption(eGameHostOption eVal, unsigned int uiVal); + void SetGameHostOption(unsigned int& uiHostSettings, eGameHostOption eVal, + unsigned int uiVal); + unsigned int GetGameHostOption(eGameHostOption eVal); + unsigned int GetGameHostOption(unsigned int uiHostSettings, + eGameHostOption eVal); - std::wstring getEntityName(eINSTANCEOF type); +#ifdef _LARGE_WORLDS + void SetGameNewWorldSize(unsigned int newSize, bool useMoat) { + m_GameNewWorldSize = newSize; + m_bGameNewWorldSizeUseMoat = useMoat; + } + unsigned int GetGameNewWorldSize() { return m_GameNewWorldSize; } + unsigned int GetGameNewWorldSizeUseMoat() { + return m_bGameNewWorldSizeUseMoat; + } + void SetGameNewHellScale(unsigned int newScale) { + m_GameNewHellScale = newScale; + } + unsigned int GetGameNewHellScale() { return m_GameNewHellScale; } +#endif + void SetResetNether(bool bResetNether) { m_bResetNether = bResetNether; } + bool GetResetNether() { return m_bResetNether; } + bool CanRecordStatsAndAchievements(); + // World seed from png image + void GetImageTextData(std::uint8_t* imageData, unsigned int imageBytes, + unsigned char* seedText, unsigned int& uiHostOptions, + bool& bHostOptionsRead, std::uint32_t& uiTexturePack); + unsigned int CreateImageTextData(std::uint8_t* textMetadata, __int64 seed, + bool hasSeed, unsigned int uiHostOptions, + unsigned int uiTexturePackId); + // Game rules + GameRuleManager m_gameRules; - unsigned int AddDLCRequest(eDLCMarketplaceType eContentType, bool bPromote=false); - bool RetrieveNextDLCContent(); - bool CheckTMSDLCCanStop(); - static int DLCOffersReturned(void *pParam, int iOfferC, std::uint32_t dwType, int iPad); - std::uint32_t GetDLCContentType(eDLCContentType eType) { return m_dwContentTypeA[eType];} - eDLCContentType Find_eDLCContentType(std::uint32_t dwType); - int GetDLCOffersCount() { return m_iDLCOfferC;} - bool DLCContentRetrieved(eDLCMarketplaceType eType); - void TickDLCOffersRetrieved(); - void ClearAndResetDLCDownloadQueue(); - bool RetrieveNextTMSPPContent(); - void TickTMSPPFilesRetrieved(); - void ClearTMSPPFilesRetrieved(); - unsigned int AddTMSPPFileTypeRequest(eDLCContentType eType, bool bPromote=false); - int GetDLCInfoTexturesOffersCount(); -#if defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__) - DLC_INFO *GetDLCInfo(int iIndex); - DLC_INFO *GetDLCInfo(char *); - DLC_INFO *GetDLCInfoFromTPackID(int iTPID); - bool GetDLCNameForPackID(const int iPackID,char **ppchKeyID); - char * GetDLCInfoTextures(int iIndex); - int GetDLCInfoCount(); +public: + void processSchematics(LevelChunk* levelChunk); + void processSchematicsLighting(LevelChunk* levelChunk); + void loadDefaultGameRules(); + std::vector* getLevelGenerators() { + return m_gameRules.getLevelGenerators(); + } + void setLevelGenerationOptions(LevelGenerationOptions* levelGen); + LevelRuleset* getGameRuleDefinitions() { + return m_gameRules.getGameRuleDefinitions(); + } + LevelGenerationOptions* getLevelGenerationOptions() { + return m_gameRules.getLevelGenerationOptions(); + } + const wchar_t* GetGameRulesString(const std::wstring& key); + +private: + std::uint8_t m_playerColours[MINECRAFT_NET_MAX_PLAYERS]; // An array of + // QNet small-id's + unsigned int m_playerGamePrivileges[MINECRAFT_NET_MAX_PLAYERS]; + +public: + void UpdatePlayerInfo(std::uint8_t networkSmallId, SHORT playerColourIndex, + unsigned int playerGamePrivileges); + short GetPlayerColour(std::uint8_t networkSmallId); + unsigned int GetPlayerPrivileges(std::uint8_t networkSmallId); + + std::wstring getEntityName(eINSTANCEOF type); + + unsigned int AddDLCRequest(eDLCMarketplaceType eContentType, + bool bPromote = false); + bool RetrieveNextDLCContent(); + bool CheckTMSDLCCanStop(); + static int DLCOffersReturned(void* pParam, int iOfferC, + std::uint32_t dwType, int iPad); + std::uint32_t GetDLCContentType(eDLCContentType eType) { + return m_dwContentTypeA[eType]; + } + eDLCContentType Find_eDLCContentType(std::uint32_t dwType); + int GetDLCOffersCount() { return m_iDLCOfferC; } + bool DLCContentRetrieved(eDLCMarketplaceType eType); + void TickDLCOffersRetrieved(); + void ClearAndResetDLCDownloadQueue(); + bool RetrieveNextTMSPPContent(); + void TickTMSPPFilesRetrieved(); + void ClearTMSPPFilesRetrieved(); + unsigned int AddTMSPPFileTypeRequest(eDLCContentType eType, + bool bPromote = false); + int GetDLCInfoTexturesOffersCount(); +#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) + DLC_INFO* GetDLCInfo(int iIndex); + DLC_INFO* GetDLCInfo(char*); + DLC_INFO* GetDLCInfoFromTPackID(int iTPID); + bool GetDLCNameForPackID(const int iPackID, char** ppchKeyID); + char* GetDLCInfoTextures(int iIndex); + int GetDLCInfoCount(); #else #ifdef _XBOX_ONE - static int TMSPPFileReturned(void *pParam,int iPad,int iUserData,void *, WCHAR *wchFilename); - std::unordered_map *GetDLCInfo(); + static int TMSPPFileReturned(void* pParam, int iPad, int iUserData, void*, + WCHAR* wchFilename); + std::unordered_map* GetDLCInfo(); #else - static int TMSPPFileReturned(void *pParam,int iPad,int iUserData,C4JStorage::PTMSPP_FILEDATA pFileData, LPCSTR szFilename); + static int TMSPPFileReturned(void* pParam, int iPad, int iUserData, + C4JStorage::PTMSPP_FILEDATA pFileData, + LPCSTR szFilename); #endif - DLC_INFO *GetDLCInfoTrialOffer(int iIndex); - DLC_INFO *GetDLCInfoFullOffer(int iIndex); + DLC_INFO* GetDLCInfoTrialOffer(int iIndex); + DLC_INFO* GetDLCInfoFullOffer(int iIndex); - int GetDLCInfoTrialOffersCount(); - int GetDLCInfoFullOffersCount(); + int GetDLCInfoTrialOffersCount(); + int GetDLCInfoFullOffersCount(); #ifdef _XBOX_ONE - bool GetDLCFullOfferIDForPackID(const int iPackID,std::wstring &wsProductId); - std::wstring GetDLCInfoTexturesFullOffer(int iIndex); + bool GetDLCFullOfferIDForPackID(const int iPackID, + std::wstring& wsProductId); + std::wstring GetDLCInfoTexturesFullOffer(int iIndex); #else - bool GetDLCFullOfferIDForPackID(const int iPackID,ULONGLONG *pullVal); - ULONGLONG GetDLCInfoTexturesFullOffer(int iIndex); + bool GetDLCFullOfferIDForPackID(const int iPackID, ULONGLONG* pullVal); + ULONGLONG GetDLCInfoTexturesFullOffer(int iIndex); #endif #endif - void SetCorruptSaveDeleted(bool bVal) {m_bCorruptSaveDeleted=bVal;} - bool GetCorruptSaveDeleted(void) {return m_bCorruptSaveDeleted;} + void SetCorruptSaveDeleted(bool bVal) { m_bCorruptSaveDeleted = bVal; } + bool GetCorruptSaveDeleted(void) { return m_bCorruptSaveDeleted; } + + void EnterSaveNotificationSection(); + void LeaveSaveNotificationSection(); - void EnterSaveNotificationSection(); - void LeaveSaveNotificationSection(); private: - CRITICAL_SECTION m_saveNotificationCriticalSection; - int m_saveNotificationDepth; - // Download Status + CRITICAL_SECTION m_saveNotificationCriticalSection; + int m_saveNotificationDepth; + // Download Status - //Request current_download; - std::vector m_DLCDownloadQueue; - std::vector m_TMSPPDownloadQueue; - static std::uint32_t m_dwContentTypeA[e_Marketplace_MAX]; - int m_iDLCOfferC; - bool m_bAllDLCContentRetrieved; - bool m_bAllTMSContentRetrieved; - bool m_bTickTMSDLCFiles; - CRITICAL_SECTION csDLCDownloadQueue; - CRITICAL_SECTION csTMSPPDownloadQueue; - CRITICAL_SECTION csAdditionalModelParts; - CRITICAL_SECTION csAdditionalSkinBoxes; - CRITICAL_SECTION csAnimOverrideBitmask; - bool m_bCorruptSaveDeleted; + // Request current_download; + std::vector m_DLCDownloadQueue; + std::vector m_TMSPPDownloadQueue; + static std::uint32_t m_dwContentTypeA[e_Marketplace_MAX]; + int m_iDLCOfferC; + bool m_bAllDLCContentRetrieved; + bool m_bAllTMSContentRetrieved; + bool m_bTickTMSDLCFiles; + CRITICAL_SECTION csDLCDownloadQueue; + CRITICAL_SECTION csTMSPPDownloadQueue; + CRITICAL_SECTION csAdditionalModelParts; + CRITICAL_SECTION csAdditionalSkinBoxes; + CRITICAL_SECTION csAnimOverrideBitmask; + bool m_bCorruptSaveDeleted; - std::uint32_t m_dwAdditionalModelParts[XUSER_MAX_COUNT]; + std::uint32_t m_dwAdditionalModelParts[XUSER_MAX_COUNT]; - std::uint8_t *m_pBannedListFileBuffer; - unsigned int m_dwBannedListFileSize; + std::uint8_t* m_pBannedListFileBuffer; + unsigned int m_dwBannedListFileSize; public: - unsigned int m_dwDLCFileSize; - std::uint8_t *m_pDLCFileBuffer; + unsigned int m_dwDLCFileSize; + std::uint8_t* m_pDLCFileBuffer; -// static int CallbackReadXuidsFileFromTMS(LPVOID lpParam, WCHAR *wchFilename, int iPad, bool bResult, int iAction); -// static int CallbackDLCFileFromTMS(LPVOID lpParam, WCHAR *wchFilename, int iPad, bool bResult, int iAction); -// static int CallbackBannedListFileFromTMS(LPVOID lpParam, WCHAR *wchFilename, int iPad, bool bResult, int iAction); + // static int CallbackReadXuidsFileFromTMS(void* lpParam, WCHAR + // *wchFilename, int iPad, bool bResult, int iAction); static int + // CallbackDLCFileFromTMS(void* lpParam, WCHAR *wchFilename, int iPad, bool + // bResult, int iAction); static int CallbackBannedListFileFromTMS(void* + // lpParam, WCHAR *wchFilename, int iPad, bool bResult, int iAction); - // Storing additional model parts per skin texture - void SetAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX *SkinBoxA, unsigned int dwSkinBoxC); - std::vector * SetAdditionalSkinBoxes(std::uint32_t dwSkinID, std::vector *pvSkinBoxA); - std::vector *GetAdditionalModelParts(std::uint32_t dwSkinID); - std::vector *GetAdditionalSkinBoxes(std::uint32_t dwSkinID); - void SetAnimOverrideBitmask(std::uint32_t dwSkinID,unsigned int uiAnimOverrideBitmask); - unsigned int GetAnimOverrideBitmask(std::uint32_t dwSkinID); + // Storing additional model parts per skin texture + void SetAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX* SkinBoxA, + unsigned int dwSkinBoxC); + std::vector* SetAdditionalSkinBoxes( + std::uint32_t dwSkinID, std::vector* pvSkinBoxA); + std::vector* GetAdditionalModelParts(std::uint32_t dwSkinID); + std::vector* GetAdditionalSkinBoxes(std::uint32_t dwSkinID); + void SetAnimOverrideBitmask(std::uint32_t dwSkinID, + unsigned int uiAnimOverrideBitmask); + unsigned int GetAnimOverrideBitmask(std::uint32_t dwSkinID); - static std::uint32_t getSkinIdFromPath(const std::wstring &skin); - static std::wstring getSkinPathFromId(std::uint32_t skinId); + static std::uint32_t getSkinIdFromPath(const std::wstring& skin); + static std::wstring getSkinPathFromId(std::uint32_t skinId); - virtual int LoadLocalTMSFile(WCHAR *wchTMSFile)=0; - virtual int LoadLocalTMSFile(WCHAR *wchTMSFile, eFileExtensionType eExt)=0; - virtual void FreeLocalTMSFiles(eTMSFileType eType)=0; - virtual int GetLocalTMSFileIndex(WCHAR *wchTMSFile,bool bFilenameIncludesExtension,eFileExtensionType eEXT)=0; + virtual int LoadLocalTMSFile(WCHAR* wchTMSFile) = 0; + virtual int LoadLocalTMSFile(WCHAR* wchTMSFile, + eFileExtensionType eExt) = 0; + virtual void FreeLocalTMSFiles(eTMSFileType eType) = 0; + virtual int GetLocalTMSFileIndex(WCHAR* wchTMSFile, + bool bFilenameIncludesExtension, + eFileExtensionType eEXT) = 0; - virtual bool GetTMSGlobalFileListRead() { return true;} - virtual bool GetTMSDLCInfoRead() { return true;} - virtual bool GetTMSXUIDsFileRead() { return true;} + virtual bool GetTMSGlobalFileListRead() { return true; } + virtual bool GetTMSDLCInfoRead() { return true; } + virtual bool GetTMSXUIDsFileRead() { return true; } - bool GetBanListRead(int iPad) { return m_bRead_BannedListA[iPad];} - void SetBanListRead(int iPad,bool bVal) { m_bRead_BannedListA[iPad]=bVal;} - void ClearBanList(int iPad) { BannedListA[iPad].pBannedList=NULL;BannedListA[iPad].byteCount=0;} + bool GetBanListRead(int iPad) { return m_bRead_BannedListA[iPad]; } + void SetBanListRead(int iPad, bool bVal) { + m_bRead_BannedListA[iPad] = bVal; + } + void ClearBanList(int iPad) { + BannedListA[iPad].pBannedList = NULL; + BannedListA[iPad].byteCount = 0; + } - std::uint32_t GetRequiredTexturePackID() { return m_dwRequiredTexturePackID; } - void SetRequiredTexturePackID(std::uint32_t texturePackId) { m_dwRequiredTexturePackID = texturePackId; } + std::uint32_t GetRequiredTexturePackID() { + return m_dwRequiredTexturePackID; + } + void SetRequiredTexturePackID(std::uint32_t texturePackId) { + m_dwRequiredTexturePackID = texturePackId; + } - virtual void GetFileFromTPD(eTPDFileType eType, std::uint8_t *pbData, unsigned int byteCount, std::uint8_t **ppbData, unsigned int *pByteCount ) {*ppbData = NULL; *pByteCount = 0;} + virtual void GetFileFromTPD(eTPDFileType eType, std::uint8_t* pbData, + unsigned int byteCount, std::uint8_t** ppbData, + unsigned int* pByteCount) { + *ppbData = NULL; + *pByteCount = 0; + } - //XTITLE_DEPLOYMENT_TYPE getDeploymentType() { return m_titleDeploymentType; } + // XTITLE_DEPLOYMENT_TYPE getDeploymentType() { return + // m_titleDeploymentType; } private: - // vector of additional skin model parts, indexed by the skin texture id - std::unordered_map *> m_AdditionalModelParts; - std::unordered_map *> m_AdditionalSkinBoxes; - std::unordered_map m_AnimOverrides; + // vector of additional skin model parts, indexed by the skin texture id + std::unordered_map*> + m_AdditionalModelParts; + std::unordered_map*> + m_AdditionalSkinBoxes; + std::unordered_map m_AnimOverrides; - - bool m_bResetNether; - std::uint32_t m_dwRequiredTexturePackID; + bool m_bResetNether; + std::uint32_t m_dwRequiredTexturePackID; #ifdef _XBOX_ONE - std::vector m_vTMSPPData; + std::vector m_vTMSPPData; #endif -#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) - C4JStorage::eOptionsCallback m_eOptionsStatusA[XUSER_MAX_COUNT]; +#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || \ + defined __PSVITA__) + C4JStorage::eOptionsCallback m_eOptionsStatusA[XUSER_MAX_COUNT]; #ifdef __ORBIS__ - int m_eOptionsBlocksRequiredA[XUSER_MAX_COUNT]; + int m_eOptionsBlocksRequiredA[XUSER_MAX_COUNT]; #endif #endif - - // 4J-PB - language and locale functions + // 4J-PB - language and locale functions public: + void LocaleAndLanguageInit(); + void getLocale(std::vector& vecWstrLocales); + int get_eMCLang(WCHAR* pwchLocale); + int get_xcLang(WCHAR* pwchLocale); - void LocaleAndLanguageInit(); - void getLocale(std::vector &vecWstrLocales); - int get_eMCLang(WCHAR *pwchLocale); - int get_xcLang(WCHAR *pwchLocale); + void SetTickTMSDLCFiles(bool bVal); - void SetTickTMSDLCFiles(bool bVal); - - std::wstring getFilePath(std::uint32_t packId, std::wstring filename, bool bAddDataFolder); + std::wstring getFilePath(std::uint32_t packId, std::wstring filename, + bool bAddDataFolder, + std::wstring mountPoint = L"TPACK:"); private: - std::unordered_mapm_localeA; - std::unordered_mapm_eMCLangA; - std::unordered_mapm_xcLangA; - std::wstring getRootPath(std::uint32_t packId, bool allowOverride, bool bAddDataFolder); -public: + std::unordered_map m_localeA; + std::unordered_map m_eMCLangA; + std::unordered_map m_xcLangA; + std::wstring getRootPath(std::uint32_t packId, bool allowOverride, + bool bAddDataFolder, std::wstring mountPoint); +public: #ifdef _XBOX -// bool m_bTransferSavesToXboxOne; -// unsigned int m_uiTransferSlotC; - -#elif defined (__PS3__) - + // bool m_bTransferSavesToXboxOne; + // unsigned int m_uiTransferSlotC; + +#elif defined(__PS3__) + #elif defined _DURANGO - + #elif defined _WINDOWS64 - //CMinecraftAudio audio; -#else // PS4 - + // CMinecraftAudio audio; +#else // PS4 + #endif #ifdef _XBOX_ONE public: - void SetReachedMainMenu(); - bool HasReachedMainMenu(); + void SetReachedMainMenu(); + bool HasReachedMainMenu(); + private: - bool m_hasReachedMainMenu; + bool m_hasReachedMainMenu; #endif }; -//singleton -//extern CMinecraftApp app; +// singleton +// extern CMinecraftApp app; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp index 571b3a947..0c9e424a9 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp @@ -9,273 +9,252 @@ #include "../../Minecraft.Client/Platform/Xbox/XML/xmlFilesCallback.h" #endif -namespace -{ - constexpr std::size_t AUDIO_DLC_WCHAR_BIN_SIZE = 2; +namespace { +constexpr std::size_t AUDIO_DLC_WCHAR_BIN_SIZE = 2; #if WCHAR_MAX > 0xFFFF - static std::wstring ReadAudioDlcWString(const void *data) - { - const std::uint16_t *chars = static_cast(data); - const std::uint16_t *end = chars; - while(*end != 0) - { - ++end; - } +static std::wstring ReadAudioDlcWString(const void* data) { + const std::uint16_t* chars = static_cast(data); + const std::uint16_t* end = chars; + while (*end != 0) { + ++end; + } - std::wstring out(static_cast(end - chars), 0); - for(std::size_t i = 0; i < out.size(); ++i) - { - out[i] = static_cast(chars[i]); - } - return out; - } + std::wstring out(static_cast(end - chars), 0); + for (std::size_t i = 0; i < out.size(); ++i) { + out[i] = static_cast(chars[i]); + } + return out; +} #else - static std::wstring ReadAudioDlcWString(const void *data) - { - return std::wstring(static_cast(data)); - } +static std::wstring ReadAudioDlcWString(const void* data) { + return std::wstring(static_cast(data)); +} #endif - template - T ReadAudioDlcValue(const std::uint8_t *data, unsigned int offset = 0) - { - T value; - std::memcpy(&value, data + offset, sizeof(value)); - return value; - } - - template - void ReadAudioDlcStruct(T *out, const std::uint8_t *data, unsigned int offset = 0) - { - std::memcpy(out, data + offset, sizeof(*out)); - } - - inline unsigned int AudioParamAdvance(unsigned int wcharCount) - { - return static_cast(sizeof(C4JStorage::DLC_FILE_PARAM) + wcharCount * AUDIO_DLC_WCHAR_BIN_SIZE); - } - - inline unsigned int AudioDetailAdvance(unsigned int wcharCount) - { - return static_cast(sizeof(C4JStorage::DLC_FILE_DETAILS) + wcharCount * AUDIO_DLC_WCHAR_BIN_SIZE); - } - - inline std::wstring ReadAudioParamString(const std::uint8_t *data, unsigned int offset) - { - return ReadAudioDlcWString(data + offset + offsetof(C4JStorage::DLC_FILE_PARAM, wchData)); - } +template +T ReadAudioDlcValue(const std::uint8_t* data, unsigned int offset = 0) { + T value; + std::memcpy(&value, data + offset, sizeof(value)); + return value; } -DLCAudioFile::DLCAudioFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_Audio,path) -{ - m_pbData = NULL; - m_dataBytes = 0; +template +void ReadAudioDlcStruct(T* out, const std::uint8_t* data, + unsigned int offset = 0) { + std::memcpy(out, data + offset, sizeof(*out)); } -void DLCAudioFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes) -{ - m_pbData = pbData; - m_dataBytes = dataBytes; - - processDLCDataFile(pbData,dataBytes); +inline unsigned int AudioParamAdvance(unsigned int wcharCount) { + return static_cast(sizeof(C4JStorage::DLC_FILE_PARAM) + + wcharCount * AUDIO_DLC_WCHAR_BIN_SIZE); } -std::uint8_t *DLCAudioFile::getData(std::uint32_t &dataBytes) -{ - dataBytes = m_dataBytes; - return m_pbData; +inline unsigned int AudioDetailAdvance(unsigned int wcharCount) { + return static_cast(sizeof(C4JStorage::DLC_FILE_DETAILS) + + wcharCount * AUDIO_DLC_WCHAR_BIN_SIZE); } -const WCHAR *DLCAudioFile::wchTypeNamesA[]= -{ - L"CUENAME", - L"CREDIT", +inline std::wstring ReadAudioParamString(const std::uint8_t* data, + unsigned int offset) { + return ReadAudioDlcWString(data + offset + + offsetof(C4JStorage::DLC_FILE_PARAM, wchData)); +} +} // namespace + +DLCAudioFile::DLCAudioFile(const std::wstring& path) + : DLCFile(DLCManager::e_DLCType_Audio, path) { + m_pbData = NULL; + m_dataBytes = 0; +} + +void DLCAudioFile::addData(std::uint8_t* pbData, std::uint32_t dataBytes) { + m_pbData = pbData; + m_dataBytes = dataBytes; + + processDLCDataFile(pbData, dataBytes); +} + +std::uint8_t* DLCAudioFile::getData(std::uint32_t& dataBytes) { + dataBytes = m_dataBytes; + return m_pbData; +} + +const WCHAR* DLCAudioFile::wchTypeNamesA[] = { + L"CUENAME", + L"CREDIT", }; -DLCAudioFile::EAudioParameterType DLCAudioFile::getParameterType(const std::wstring ¶mName) -{ - EAudioParameterType type = e_AudioParamType_Invalid; +DLCAudioFile::EAudioParameterType DLCAudioFile::getParameterType( + const std::wstring& paramName) { + EAudioParameterType type = e_AudioParamType_Invalid; - for(int i = 0; i < e_AudioParamType_Max; ++i) - { - if(paramName.compare(wchTypeNamesA[i]) == 0) - { - type = (EAudioParameterType)i; - break; - } - } + for (int i = 0; i < e_AudioParamType_Max; ++i) { + if (paramName.compare(wchTypeNamesA[i]) == 0) { + type = (EAudioParameterType)i; + break; + } + } - return type; + return type; } -void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, const std::wstring &value) -{ - switch(ptype) - { +void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, + const std::wstring& value) { + switch (ptype) { + case e_AudioParamType_Credit: // If this parameter exists, then mark + // this as free + // add it to the DLC credits list - case e_AudioParamType_Credit: // If this parameter exists, then mark this as free - //add it to the DLC credits list + // we'll need to justify this text since we don't have a lot of room + // for lines of credits + { + // don't look for duplicate in the music credits - // we'll need to justify this text since we don't have a lot of room for lines of credits - { - // don't look for duplicate in the music credits + // if(app.AlreadySeenCreditText(value)) break; - //if(app.AlreadySeenCreditText(value)) break; + int maximumChars = 55; - int maximumChars = 55; + bool bIsSDMode = + !RenderManager.IsHiDef() && !RenderManager.IsWidescreen(); - bool bIsSDMode=!RenderManager.IsHiDef() && !RenderManager.IsWidescreen(); + if (bIsSDMode) { + maximumChars = 45; + } - if(bIsSDMode) - { - maximumChars = 45; - } + switch (XGetLanguage()) { + case XC_LANGUAGE_JAPANESE: + case XC_LANGUAGE_TCHINESE: + case XC_LANGUAGE_KOREAN: + maximumChars = 35; + break; + } + std::wstring creditValue = value; + while (creditValue.length() > maximumChars) { + unsigned int i = 1; + while (i < creditValue.length() && + (i + 1) <= maximumChars) { + i++; + } + int iLast = (int)creditValue.find_last_of(L" ", i); + switch (XGetLanguage()) { + case XC_LANGUAGE_JAPANESE: + case XC_LANGUAGE_TCHINESE: + case XC_LANGUAGE_KOREAN: + iLast = maximumChars; + break; + default: + iLast = (int)creditValue.find_last_of(L" ", i); + break; + } - switch(XGetLanguage()) - { - case XC_LANGUAGE_JAPANESE: - case XC_LANGUAGE_TCHINESE: - case XC_LANGUAGE_KOREAN: - maximumChars = 35; - break; - } - std::wstring creditValue = value; - while (creditValue.length() > maximumChars) - { - unsigned int i = 1; - while (i < creditValue.length() && (i + 1) <= maximumChars) - { - i++; - } - int iLast=(int)creditValue.find_last_of(L" ",i); - switch(XGetLanguage()) - { - case XC_LANGUAGE_JAPANESE: - case XC_LANGUAGE_TCHINESE: - case XC_LANGUAGE_KOREAN: - iLast = maximumChars; - break; - default: - iLast=(int)creditValue.find_last_of(L" ",i); - break; - } + // if a space was found, include the space on this line + if (iLast != i) { + iLast++; + } - // if a space was found, include the space on this line - if(iLast!=i) - { - iLast++; - } - - app.AddCreditText((creditValue.substr(0, iLast)).c_str()); - creditValue = creditValue.substr(iLast); - } - app.AddCreditText(creditValue.c_str()); - - } - break; - case e_AudioParamType_Cuename: - m_parameters[type].push_back(value); - //m_parameters[(int)type] = value; - break; - default: - break; - } + app.AddCreditText((creditValue.substr(0, iLast)).c_str()); + creditValue = creditValue.substr(iLast); + } + app.AddCreditText(creditValue.c_str()); + } + break; + case e_AudioParamType_Cuename: + m_parameters[type].push_back(value); + // m_parameters[(int)type] = value; + break; + default: + break; + } } -bool DLCAudioFile::processDLCDataFile(std::uint8_t *pbData, std::uint32_t dataLength) -{ - std::unordered_map parameterMapping; - unsigned int uiCurrentByte=0; +bool DLCAudioFile::processDLCDataFile(std::uint8_t* pbData, + std::uint32_t dataLength) { + std::unordered_map parameterMapping; + unsigned int uiCurrentByte = 0; - // File format defined in the AudioPacker - // File format: Version 1 + // File format defined in the AudioPacker + // File format: Version 1 - unsigned int uiVersion = ReadAudioDlcValue(pbData, uiCurrentByte); - uiCurrentByte+=sizeof(int); + unsigned int uiVersion = + ReadAudioDlcValue(pbData, uiCurrentByte); + uiCurrentByte += sizeof(int); - if(uiVersion < CURRENT_AUDIO_VERSION_NUM) - { - if(pbData!=NULL) delete [] pbData; - app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion); - return false; - } - - unsigned int uiParameterTypeCount = ReadAudioDlcValue(pbData, uiCurrentByte); - uiCurrentByte+=sizeof(int); - C4JStorage::DLC_FILE_PARAM paramBuf; - ReadAudioDlcStruct(¶mBuf, pbData, uiCurrentByte); - - for(unsigned int i=0;i(pbData, uiCurrentByte); - uiCurrentByte+=sizeof(int); - C4JStorage::DLC_FILE_DETAILS fileBuf; - ReadAudioDlcStruct(&fileBuf, pbData, uiCurrentByte); + if (uiVersion < CURRENT_AUDIO_VERSION_NUM) { + if (pbData != NULL) delete[] pbData; + app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion); + return false; + } - unsigned int tempByteOffset = uiCurrentByte; - for(unsigned int i=0;i(pbData, uiCurrentByte); + uiCurrentByte += sizeof(int); + C4JStorage::DLC_FILE_PARAM paramBuf; + ReadAudioDlcStruct(¶mBuf, pbData, uiCurrentByte); - for(unsigned int i=0;i(pbTemp); - pbTemp+=sizeof(int); - ReadAudioDlcStruct(¶mBuf, pbTemp); - for(unsigned int j=0;j(pbData, uiCurrentByte); + uiCurrentByte += sizeof(int); + C4JStorage::DLC_FILE_DETAILS fileBuf; + ReadAudioDlcStruct(&fileBuf, pbData, uiCurrentByte); - AUTO_VAR(it, parameterMapping.find(paramBuf.dwType)); + unsigned int tempByteOffset = uiCurrentByte; + for (unsigned int i = 0; i < uiFileCount; i++) { + tempByteOffset += AudioDetailAdvance(fileBuf.dwWchCount); + ReadAudioDlcStruct(&fileBuf, pbData, tempByteOffset); + } + std::uint8_t* pbTemp = &pbData[tempByteOffset]; + ReadAudioDlcStruct(&fileBuf, pbData, uiCurrentByte); - if(it != parameterMapping.end() ) - { - addParameter(type, (EAudioParameterType)paramBuf.dwType, ReadAudioParamString(pbTemp, 0)); - } - pbTemp += AudioParamAdvance(paramBuf.dwWchCount); - ReadAudioDlcStruct(¶mBuf, pbTemp); - } - // Move the pointer to the start of the next files data; - pbTemp += fileBuf.uiFileSize; - uiCurrentByte += AudioDetailAdvance(fileBuf.dwWchCount); + for (unsigned int i = 0; i < uiFileCount; i++) { + EAudioType type = (EAudioType)fileBuf.dwType; + // Params + unsigned int uiParameterCount = ReadAudioDlcValue(pbTemp); + pbTemp += sizeof(int); + ReadAudioDlcStruct(¶mBuf, pbTemp); + for (unsigned int j = 0; j < uiParameterCount; j++) { + // EAudioParameterType paramType = e_AudioParamType_Invalid; - ReadAudioDlcStruct(&fileBuf, pbData, uiCurrentByte); + AUTO_VAR(it, parameterMapping.find(paramBuf.dwType)); - } + if (it != parameterMapping.end()) { + addParameter(type, (EAudioParameterType)paramBuf.dwType, + ReadAudioParamString(pbTemp, 0)); + } + pbTemp += AudioParamAdvance(paramBuf.dwWchCount); + ReadAudioDlcStruct(¶mBuf, pbTemp); + } + // Move the pointer to the start of the next files data; + pbTemp += fileBuf.uiFileSize; + uiCurrentByte += AudioDetailAdvance(fileBuf.dwWchCount); - return true; + ReadAudioDlcStruct(&fileBuf, pbData, uiCurrentByte); + } + + return true; } -int DLCAudioFile::GetCountofType(DLCAudioFile::EAudioType eType) -{ - return m_parameters[eType].size(); +int DLCAudioFile::GetCountofType(DLCAudioFile::EAudioType eType) { + return m_parameters[eType].size(); } - -std::wstring &DLCAudioFile::GetSoundName(int iIndex) -{ - int iWorldType=e_AudioType_Overworld; - while(iIndex>=m_parameters[iWorldType].size()) - { - iIndex-=m_parameters[iWorldType].size(); - iWorldType++; - } - return m_parameters[iWorldType].at(iIndex); +std::wstring& DLCAudioFile::GetSoundName(int iIndex) { + int iWorldType = e_AudioType_Overworld; + while (iIndex >= m_parameters[iWorldType].size()) { + iIndex -= m_parameters[iWorldType].size(); + iWorldType++; + } + return m_parameters[iWorldType].at(iIndex); } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.h b/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.h index dc6804e30..6fdc8d591 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.h @@ -1,54 +1,52 @@ #pragma once #include "DLCFile.h" -class DLCAudioFile : public DLCFile -{ - +class DLCAudioFile : public DLCFile { public: + // If you add to the Enum,then you need to add the array of type names + // These are the names used in the XML for the parameters + enum EAudioType { + e_AudioType_Invalid = -1, - // If you add to the Enum,then you need to add the array of type names - // These are the names used in the XML for the parameters - enum EAudioType - { - e_AudioType_Invalid = -1, + e_AudioType_Overworld = 0, + e_AudioType_Nether, + e_AudioType_End, - e_AudioType_Overworld = 0, - e_AudioType_Nether, - e_AudioType_End, + e_AudioType_Max, + }; + enum EAudioParameterType { + e_AudioParamType_Invalid = -1, - e_AudioType_Max, - }; - enum EAudioParameterType - { - e_AudioParamType_Invalid = -1, + e_AudioParamType_Cuename = 0, + e_AudioParamType_Credit, - e_AudioParamType_Cuename = 0, - e_AudioParamType_Credit, + e_AudioParamType_Max, - e_AudioParamType_Max, + }; + static const WCHAR* wchTypeNamesA[e_AudioParamType_Max]; - }; - static const WCHAR *wchTypeNamesA[e_AudioParamType_Max]; + DLCAudioFile(const std::wstring& path); - DLCAudioFile(const std::wstring &path); + virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes); + virtual std::uint8_t* getData(std::uint32_t& dataBytes); - virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes); - virtual std::uint8_t *getData(std::uint32_t &dataBytes); - - bool processDLCDataFile(std::uint8_t *pbData, std::uint32_t dataLength); - int GetCountofType(DLCAudioFile::EAudioType ptype); - std::wstring &GetSoundName(int iIndex); + bool processDLCDataFile(std::uint8_t* pbData, std::uint32_t dataLength); + int GetCountofType(DLCAudioFile::EAudioType ptype); + std::wstring& GetSoundName(int iIndex); private: - using DLCFile::addParameter; + using DLCFile::addParameter; - std::uint8_t *m_pbData; - std::uint32_t m_dataBytes; - static const int CURRENT_AUDIO_VERSION_NUM=1; - //std::unordered_map m_parameters; - std::vector m_parameters[e_AudioType_Max]; + std::uint8_t* m_pbData; + std::uint32_t m_dataBytes; + static const int CURRENT_AUDIO_VERSION_NUM = 1; + // std::unordered_map m_parameters; + std::vector m_parameters[e_AudioType_Max]; - // use the EAudioType to order these - void addParameter(DLCAudioFile::EAudioType type, DLCAudioFile::EAudioParameterType ptype, const std::wstring &value); - DLCAudioFile::EAudioParameterType getParameterType(const std::wstring ¶mName); + // use the EAudioType to order these + void addParameter(DLCAudioFile::EAudioType type, + DLCAudioFile::EAudioParameterType ptype, + const std::wstring& value); + DLCAudioFile::EAudioParameterType getParameterType( + const std::wstring& paramName); }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.cpp index a9edb92e8..151d1176b 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.cpp @@ -2,11 +2,9 @@ #include "DLCManager.h" #include "DLCCapeFile.h" -DLCCapeFile::DLCCapeFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_Cape,path) -{ -} +DLCCapeFile::DLCCapeFile(const std::wstring& path) + : DLCFile(DLCManager::e_DLCType_Cape, path) {} -void DLCCapeFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes) -{ - app.AddMemoryTextureFile(m_path,pbData,dataBytes); +void DLCCapeFile::addData(std::uint8_t* pbData, std::uint32_t dataBytes) { + app.AddMemoryTextureFile(m_path, pbData, dataBytes); } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.h b/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.h index 406ac3dc4..5d72b8a61 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCCapeFile.h @@ -1,10 +1,9 @@ #pragma once #include "DLCFile.h" -class DLCCapeFile : public DLCFile -{ +class DLCCapeFile : public DLCFile { public: - DLCCapeFile(const std::wstring &path); + DLCCapeFile(const std::wstring& path); - virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes); + virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes); }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.cpp index fed962a75..b315c25ff 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.cpp @@ -5,22 +5,21 @@ #include "../../Minecraft.Client/Textures/Packs/TexturePackRepository.h" #include "../../Minecraft.Client/Textures/Packs/TexturePack.h" -DLCColourTableFile::DLCColourTableFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_ColourTable,path) -{ - m_colourTable = NULL; +DLCColourTableFile::DLCColourTableFile(const std::wstring& path) + : DLCFile(DLCManager::e_DLCType_ColourTable, path) { + m_colourTable = NULL; } -DLCColourTableFile::~DLCColourTableFile() -{ - if(m_colourTable != NULL) - { - app.DebugPrintf("Deleting DLCColourTableFile data\n"); - delete m_colourTable; - } +DLCColourTableFile::~DLCColourTableFile() { + if (m_colourTable != NULL) { + app.DebugPrintf("Deleting DLCColourTableFile data\n"); + delete m_colourTable; + } } -void DLCColourTableFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes) -{ - ColourTable *defaultColourTable = Minecraft::GetInstance()->skins->getDefault()->getColourTable(); - m_colourTable = new ColourTable(defaultColourTable, pbData, dataBytes); +void DLCColourTableFile::addData(std::uint8_t* pbData, + std::uint32_t dataBytes) { + ColourTable* defaultColourTable = + Minecraft::GetInstance()->skins->getDefault()->getColourTable(); + m_colourTable = new ColourTable(defaultColourTable, pbData, dataBytes); } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.h b/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.h index d75fec458..119ddf0e8 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCColourTableFile.h @@ -3,16 +3,15 @@ class ColourTable; -class DLCColourTableFile : public DLCFile -{ +class DLCColourTableFile : public DLCFile { private: - ColourTable *m_colourTable; + ColourTable* m_colourTable; public: - DLCColourTableFile(const std::wstring &path); - ~DLCColourTableFile(); + DLCColourTableFile(const std::wstring& path); + ~DLCColourTableFile(); - virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes); + virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes); - ColourTable *getColourTable() { return m_colourTable; } + ColourTable* getColourTable() { return m_colourTable; } }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCFile.cpp index 5ae3551bc..0732416ad 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCFile.cpp @@ -1,26 +1,22 @@ #include "../../Minecraft.World/Platform/stdafx.h" #include "DLCFile.h" -DLCFile::DLCFile(DLCManager::EDLCType type, const std::wstring &path) -{ - m_type = type; - m_path = path; +DLCFile::DLCFile(DLCManager::EDLCType type, const std::wstring& path) { + m_type = type; + m_path = path; - // store the id - bool dlcSkin = path.substr(0,3).compare(L"dlc") == 0; + // store the id + bool dlcSkin = path.substr(0, 3).compare(L"dlc") == 0; - if(dlcSkin) - { - std::wstring skinValue = path.substr(7,path.size()); - skinValue = skinValue.substr(0,skinValue.find_first_of(L'.')); - std::wstringstream ss; - ss << std::dec << skinValue.c_str(); - ss >> m_dwSkinId; - m_dwSkinId = MAKE_SKIN_BITMASK(true, m_dwSkinId); + if (dlcSkin) { + std::wstring skinValue = path.substr(7, path.size()); + skinValue = skinValue.substr(0, skinValue.find_first_of(L'.')); + std::wstringstream ss; + ss << std::dec << skinValue.c_str(); + ss >> m_dwSkinId; + m_dwSkinId = MAKE_SKIN_BITMASK(true, m_dwSkinId); - } - else - { - m_dwSkinId=0; - } + } else { + m_dwSkinId = 0; + } } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCFile.h b/Minecraft.Client/Platform/Common/DLC/DLCFile.h index cb472a77c..73466a5b1 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCFile.h @@ -2,25 +2,33 @@ #include #include "DLCManager.h" -class DLCFile -{ +class DLCFile { protected: - DLCManager::EDLCType m_type; - std::wstring m_path; - std::uint32_t m_dwSkinId; + DLCManager::EDLCType m_type; + std::wstring m_path; + std::uint32_t m_dwSkinId; public: - DLCFile(DLCManager::EDLCType type, const std::wstring &path); - virtual ~DLCFile() {} + DLCFile(DLCManager::EDLCType type, const std::wstring& path); + virtual ~DLCFile() {} - DLCManager::EDLCType getType() { return m_type; } - std::wstring getPath() { return m_path; } - std::uint32_t getSkinID() { return m_dwSkinId; } + DLCManager::EDLCType getType() { return m_type; } + std::wstring getPath() { return m_path; } + std::uint32_t getSkinID() { return m_dwSkinId; } - virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes) {} - virtual std::uint8_t *getData(std::uint32_t &dataBytes) { dataBytes = 0; return NULL; } - virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value) {} + virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes) {} + virtual std::uint8_t* getData(std::uint32_t& dataBytes) { + dataBytes = 0; + return NULL; + } + virtual void addParameter(DLCManager::EDLCParameterType type, + const std::wstring& value) {} - virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type) { return L""; } - virtual bool getParameterAsBool(DLCManager::EDLCParameterType type) { return false;} + virtual std::wstring getParameterAsString( + DLCManager::EDLCParameterType type) { + return L""; + } + virtual bool getParameterAsBool(DLCManager::EDLCParameterType type) { + return false; + } }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRules.h b/Minecraft.Client/Platform/Common/DLC/DLCGameRules.h index 4b1fe01f8..05ad1d783 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRules.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRules.h @@ -3,8 +3,8 @@ #include "DLCFile.h" #include "../GameRules/LevelGenerationOptions.h" -class DLCGameRules : public DLCFile -{ +class DLCGameRules : public DLCFile { public: - DLCGameRules(DLCManager::EDLCType type, const std::wstring &path) : DLCFile(type,path) {} + DLCGameRules(DLCManager::EDLCType type, const std::wstring& path) + : DLCFile(type, path) {} }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.cpp index 1c91a39e3..9af3bee97 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.cpp @@ -2,20 +2,18 @@ #include "DLCManager.h" #include "DLCGameRulesFile.h" -DLCGameRulesFile::DLCGameRulesFile(const std::wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRules,path) -{ - m_pbData = NULL; - m_dataBytes = 0; +DLCGameRulesFile::DLCGameRulesFile(const std::wstring& path) + : DLCGameRules(DLCManager::e_DLCType_GameRules, path) { + m_pbData = NULL; + m_dataBytes = 0; } -void DLCGameRulesFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes) -{ - m_pbData = pbData; - m_dataBytes = dataBytes; +void DLCGameRulesFile::addData(std::uint8_t* pbData, std::uint32_t dataBytes) { + m_pbData = pbData; + m_dataBytes = dataBytes; } -std::uint8_t *DLCGameRulesFile::getData(std::uint32_t &dataBytes) -{ - dataBytes = m_dataBytes; - return m_pbData; +std::uint8_t* DLCGameRulesFile::getData(std::uint32_t& dataBytes) { + dataBytes = m_dataBytes; + return m_pbData; } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.h b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.h index 56af6cd8c..2bcb24a65 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesFile.h @@ -1,15 +1,14 @@ #pragma once #include "DLCGameRules.h" -class DLCGameRulesFile : public DLCGameRules -{ +class DLCGameRulesFile : public DLCGameRules { private: - std::uint8_t *m_pbData; - std::uint32_t m_dataBytes; + std::uint8_t* m_pbData; + std::uint32_t m_dataBytes; public: - DLCGameRulesFile(const std::wstring &path); + DLCGameRulesFile(const std::wstring& path); - virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes); - virtual std::uint8_t *getData(std::uint32_t &dataBytes); + virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes); + virtual std::uint8_t* getData(std::uint32_t& dataBytes); }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp index 09afd4783..e52b46368 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp @@ -9,23 +9,22 @@ #include "DLCManager.h" #include "DLCGameRulesHeader.h" -DLCGameRulesHeader::DLCGameRulesHeader(const std::wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRulesHeader,path) -{ - m_pbData = NULL; - m_dataBytes = 0; +DLCGameRulesHeader::DLCGameRulesHeader(const std::wstring& path) + : DLCGameRules(DLCManager::e_DLCType_GameRulesHeader, path) { + m_pbData = NULL; + m_dataBytes = 0; - m_hasData = false; + m_hasData = false; - m_grfPath = path.substr(0, path.length() - 4) + L".grf"; + m_grfPath = path.substr(0, path.length() - 4) + L".grf"; - lgo = NULL; + lgo = NULL; } -void DLCGameRulesHeader::addData(std::uint8_t *pbData, std::uint32_t dataBytes) -{ - m_pbData = pbData; - m_dataBytes = dataBytes; - +void DLCGameRulesHeader::addData(std::uint8_t* pbData, + std::uint32_t dataBytes) { + m_pbData = pbData; + m_dataBytes = dataBytes; #if 0 byteArray data(m_pbData, m_dataBytes); @@ -73,20 +72,18 @@ void DLCGameRulesHeader::addData(std::uint8_t *pbData, std::uint32_t dataBytes) #endif } -std::uint8_t *DLCGameRulesHeader::getData(std::uint32_t &dataBytes) -{ - dataBytes = m_dataBytes; - return m_pbData; +std::uint8_t* DLCGameRulesHeader::getData(std::uint32_t& dataBytes) { + dataBytes = m_dataBytes; + return m_pbData; } -void DLCGameRulesHeader::setGrfData(std::uint8_t *fData, std::uint32_t dataSize, StringTable *st) -{ - if (!m_hasData) - { - m_hasData = true; - - //app.m_gameRules.loadGameRules(lgo, fData, fSize); +void DLCGameRulesHeader::setGrfData(std::uint8_t* fData, std::uint32_t dataSize, + StringTable* st) { + if (!m_hasData) { + m_hasData = true; - app.m_gameRules.readRuleFile(lgo, fData, dataSize, st); - } + // app.m_gameRules.loadGameRules(lgo, fData, fSize); + + app.m_gameRules.readRuleFile(lgo, fData, dataSize, st); + } } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h index a947ece81..ddf766d00 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.h @@ -3,40 +3,44 @@ #include "DLCGameRules.h" #include "../GameRules/LevelGenerationOptions.h" -class DLCGameRulesHeader : public DLCGameRules, public JustGrSource -{ +class DLCGameRulesHeader : public DLCGameRules, public JustGrSource { private: + // GR-Header + std::uint8_t* m_pbData; + std::uint32_t m_dataBytes; - // GR-Header - std::uint8_t *m_pbData; - std::uint32_t m_dataBytes; - - bool m_hasData; + bool m_hasData; public: - virtual bool requiresTexturePack() {return m_bRequiresTexturePack;} - virtual std::uint32_t getRequiredTexturePackId() {return m_requiredTexturePackId;} - virtual std::wstring getDefaultSaveName() {return m_defaultSaveName;} - virtual const wchar_t *getWorldName() {return m_worldName.c_str();} - virtual const wchar_t *getDisplayName() {return m_displayName.c_str();} - virtual std::wstring getGrfPath() {return L"GameRules.grf";} + virtual bool requiresTexturePack() { return m_bRequiresTexturePack; } + virtual std::uint32_t getRequiredTexturePackId() { + return m_requiredTexturePackId; + } + virtual std::wstring getDefaultSaveName() { return m_defaultSaveName; } + virtual const wchar_t* getWorldName() { return m_worldName.c_str(); } + virtual const wchar_t* getDisplayName() { return m_displayName.c_str(); } + virtual std::wstring getGrfPath() { return L"GameRules.grf"; } - virtual void setRequiresTexturePack(bool x) {m_bRequiresTexturePack = x;} - virtual void setRequiredTexturePackId(std::uint32_t x) {m_requiredTexturePackId = x;} - virtual void setDefaultSaveName(const std::wstring &x) {m_defaultSaveName = x;} - virtual void setWorldName(const std::wstring & x) {m_worldName = x;} - virtual void setDisplayName(const std::wstring & x) {m_displayName = x;} - virtual void setGrfPath(const std::wstring & x) {m_grfPath = x;} + virtual void setRequiresTexturePack(bool x) { m_bRequiresTexturePack = x; } + virtual void setRequiredTexturePackId(std::uint32_t x) { + m_requiredTexturePackId = x; + } + virtual void setDefaultSaveName(const std::wstring& x) { + m_defaultSaveName = x; + } + virtual void setWorldName(const std::wstring& x) { m_worldName = x; } + virtual void setDisplayName(const std::wstring& x) { m_displayName = x; } + virtual void setGrfPath(const std::wstring& x) { m_grfPath = x; } - LevelGenerationOptions *lgo; + LevelGenerationOptions* lgo; public: - DLCGameRulesHeader(const std::wstring &path); + DLCGameRulesHeader(const std::wstring& path); - virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes); - virtual std::uint8_t *getData(std::uint32_t &dataBytes); + virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes); + virtual std::uint8_t* getData(std::uint32_t& dataBytes); - void setGrfData(std::uint8_t *fData, std::uint32_t dataSize, StringTable *); + void setGrfData(std::uint8_t* fData, std::uint32_t dataSize, StringTable*); - virtual bool ready() { return m_hasData; } + virtual bool ready() { return m_hasData; } }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.cpp index c1f9c9e30..2c36c7455 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.cpp @@ -3,12 +3,12 @@ #include "DLCLocalisationFile.h" #include "../../Minecraft.Client/Utils/StringTable.h" -DLCLocalisationFile::DLCLocalisationFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_LocalisationData,path) -{ - m_strings = NULL; +DLCLocalisationFile::DLCLocalisationFile(const std::wstring& path) + : DLCFile(DLCManager::e_DLCType_LocalisationData, path) { + m_strings = NULL; } -void DLCLocalisationFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes) -{ - m_strings = new StringTable(pbData, dataBytes); +void DLCLocalisationFile::addData(std::uint8_t* pbData, + std::uint32_t dataBytes) { + m_strings = new StringTable(pbData, dataBytes); } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.h b/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.h index 46f5782d4..7b8fca417 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCLocalisationFile.h @@ -3,16 +3,18 @@ class StringTable; -class DLCLocalisationFile : public DLCFile -{ +class DLCLocalisationFile : public DLCFile { private: - StringTable *m_strings; + StringTable* m_strings; public: - DLCLocalisationFile(const std::wstring &path); - DLCLocalisationFile(std::uint8_t *pbData, std::uint32_t dataBytes); // when we load in a texture pack details file from TMS++ + DLCLocalisationFile(const std::wstring& path); + DLCLocalisationFile( + std::uint8_t* pbData, + std::uint32_t dataBytes); // when we load in a texture pack details + // file from TMS++ - virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes); + virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes); - StringTable *getStringTable() { return m_strings; } + StringTable* getStringTable() { return m_strings; } }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp b/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp index d633e7223..f21c0f9c5 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp @@ -19,762 +19,724 @@ static const std::size_t DLC_WCHAR_BIN_SIZE = 2; #if WCHAR_MAX > 0xFFFF // than sizeof(WCHAR) != DLC_WCHAR_BIN_SIZE // e.g. Linux and all Posix/Unix systems with wchar_t beeing 4B/32bit -static_assert( sizeof(wchar_t) == 4, "wchar_t is not 4bytes but larger than 2bytes ???"); +static_assert(sizeof(wchar_t) == 4, + "wchar_t is not 4bytes but larger than 2bytes ???"); -static inline std::wstring dlc_read_wstring(const void *data) -{ - const std::uint16_t* p = static_cast(data); - // find the end (nullterminated) - const std::uint16_t* end = p; - while(*end) { - ++end; - } +static inline std::wstring dlc_read_wstring(const void* data) { + const std::uint16_t* p = static_cast(data); + // find the end (nullterminated) + const std::uint16_t* end = p; + while (*end) { + ++end; + } - std::size_t len = static_cast(end - p); + std::size_t len = static_cast(end - p); - // allocate wstring with length len - // it will be nullterminated internally, do not worry. - std::wstring out(len, 0); + // allocate wstring with length len + // it will be nullterminated internally, do not worry. + std::wstring out(len, 0); - // and copy them into thje string - for(std::size_t i = 0; i < len; ++i) { - out[i] = static_cast(p[i]); - } + // and copy them into thje string + for (std::size_t i = 0; i < len; ++i) { + out[i] = static_cast(p[i]); + } - return out; + return out; } #define DLC_WSTRING(ptr) dlc_read_wstring(ptr) #else // just in case. -static_assert( sizeof(wchar_t) == 2, "How did we get here? wide char smaller than 2 bytes"); +static_assert(sizeof(wchar_t) == 2, + "How did we get here? wide char smaller than 2 bytes"); // perfectly fine scince wchar_t will be 2 bytes (UCS-2/UTF-16) #define DLC_WSTRING(ptr) std::wstring((wchar_t*)(ptr)) #endif -#define DLC_PARAM_ADV(n) (sizeof(C4JStorage::DLC_FILE_PARAM) + (n) * DLC_WCHAR_BIN_SIZE) -#define DLC_DETAIL_ADV(n) (sizeof(C4JStorage::DLC_FILE_DETAILS) + (n) * DLC_WCHAR_BIN_SIZE) +#define DLC_PARAM_ADV(n) \ + (sizeof(C4JStorage::DLC_FILE_PARAM) + (n) * DLC_WCHAR_BIN_SIZE) +#define DLC_DETAIL_ADV(n) \ + (sizeof(C4JStorage::DLC_FILE_DETAILS) + (n) * DLC_WCHAR_BIN_SIZE) -namespace -{ - template - T ReadDlcValue(const std::uint8_t *data, unsigned int offset = 0) - { - T value; - std::memcpy(&value, data + offset, sizeof(value)); - return value; - } +namespace { +template +T ReadDlcValue(const std::uint8_t* data, unsigned int offset = 0) { + T value; + std::memcpy(&value, data + offset, sizeof(value)); + return value; +} - template - void ReadDlcStruct(T *out, const std::uint8_t *data, unsigned int offset = 0) - { - std::memcpy(out, data + offset, sizeof(*out)); - } +template +void ReadDlcStruct(T* out, const std::uint8_t* data, unsigned int offset = 0) { + std::memcpy(out, data + offset, sizeof(*out)); +} - std::wstring getMountedDlcReadPath(const std::string &path) - { - std::wstring readPath = convStringToWstring(path); +std::wstring getMountedDlcReadPath(const std::string& path) { + std::wstring readPath = convStringToWstring(path); #ifdef _WINDOWS64 - const std::string mountedPath = StorageManager.GetMountedPath(path.c_str()); - if(!mountedPath.empty()) - { - readPath = convStringToWstring(mountedPath); - } + const std::string mountedPath = StorageManager.GetMountedPath(path.c_str()); + if (!mountedPath.empty()) { + readPath = convStringToWstring(mountedPath); + } #elif defined(_DURANGO) - const std::wstring mountedPath = StorageManager.GetMountedPath(readPath.c_str()); - if(!mountedPath.empty()) - { - readPath = mountedPath; - } + const std::wstring mountedPath = + StorageManager.GetMountedPath(readPath.c_str()); + if (!mountedPath.empty()) { + readPath = mountedPath; + } #endif - return readPath; - } - - bool readOwnedDlcFile(const std::string &path, std::uint8_t **ppData, unsigned int *pBytesRead) - { - *ppData = NULL; - *pBytesRead = 0; - - const std::wstring readPath = getMountedDlcReadPath(path); - std::FILE *file = PortableFileIO::OpenBinaryFileForRead(readPath); - if(file == NULL) - { - return false; - } - - if(!PortableFileIO::Seek(file, 0, SEEK_END)) - { - std::fclose(file); - return false; - } - - const __int64 endPosition = PortableFileIO::Tell(file); - if(endPosition <= 0 || endPosition > std::numeric_limits::max()) - { - std::fclose(file); - return false; - } - - const unsigned int fileSize = static_cast(endPosition); - if(!PortableFileIO::Seek(file, 0, SEEK_SET)) - { - std::fclose(file); - return false; - } - - std::uint8_t *data = new std::uint8_t[fileSize]; - const std::size_t bytesRead = std::fread(data, 1, fileSize, file); - const bool failed = std::ferror(file) != 0 || bytesRead != fileSize; - std::fclose(file); - if(failed) - { - delete[] data; - return false; - } - - *ppData = data; - *pBytesRead = static_cast(bytesRead); - return true; - } + return readPath; } -const WCHAR *DLCManager::wchTypeNamesA[]= -{ - L"DISPLAYNAME", - L"THEMENAME", - L"FREE", - L"CREDIT", - L"CAPEPATH", - L"BOX", - L"ANIM", - L"PACKID", - L"NETHERPARTICLECOLOUR", - L"ENCHANTTEXTCOLOUR", - L"ENCHANTTEXTFOCUSCOLOUR", - L"DATAPATH", - L"PACKVERSION", +bool readOwnedDlcFile(const std::string& path, std::uint8_t** ppData, + unsigned int* pBytesRead) { + *ppData = NULL; + *pBytesRead = 0; + + const std::wstring readPath = getMountedDlcReadPath(path); + std::FILE* file = PortableFileIO::OpenBinaryFileForRead(readPath); + if (file == NULL) { + return false; + } + + if (!PortableFileIO::Seek(file, 0, SEEK_END)) { + std::fclose(file); + return false; + } + + const __int64 endPosition = PortableFileIO::Tell(file); + if (endPosition <= 0 || + endPosition > std::numeric_limits::max()) { + std::fclose(file); + return false; + } + + const unsigned int fileSize = static_cast(endPosition); + if (!PortableFileIO::Seek(file, 0, SEEK_SET)) { + std::fclose(file); + return false; + } + + std::uint8_t* data = new std::uint8_t[fileSize]; + const std::size_t bytesRead = std::fread(data, 1, fileSize, file); + const bool failed = std::ferror(file) != 0 || bytesRead != fileSize; + std::fclose(file); + if (failed) { + delete[] data; + return false; + } + + *ppData = data; + *pBytesRead = static_cast(bytesRead); + return true; +} +} // namespace + +const WCHAR* DLCManager::wchTypeNamesA[] = { + L"DISPLAYNAME", + L"THEMENAME", + L"FREE", + L"CREDIT", + L"CAPEPATH", + L"BOX", + L"ANIM", + L"PACKID", + L"NETHERPARTICLECOLOUR", + L"ENCHANTTEXTCOLOUR", + L"ENCHANTTEXTFOCUSCOLOUR", + L"DATAPATH", + L"PACKVERSION", }; -DLCManager::DLCManager() -{ - //m_bNeedsUpdated = true; - m_bNeedsCorruptCheck = true; +DLCManager::DLCManager() { + // m_bNeedsUpdated = true; + m_bNeedsCorruptCheck = true; } -DLCManager::~DLCManager() -{ - for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) - { - DLCPack *pack = *it; - delete pack; - } +DLCManager::~DLCManager() { + for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + DLCPack* pack = *it; + delete pack; + } } -DLCManager::EDLCParameterType DLCManager::getParameterType(const std::wstring ¶mName) -{ - EDLCParameterType type = e_DLCParamType_Invalid; +DLCManager::EDLCParameterType DLCManager::getParameterType( + const std::wstring& paramName) { + EDLCParameterType type = e_DLCParamType_Invalid; - for(unsigned int i = 0; i < e_DLCParamType_Max; ++i) - { - if(paramName.compare(wchTypeNamesA[i]) == 0) - { - type = (EDLCParameterType)i; - break; - } - } + for (unsigned int i = 0; i < e_DLCParamType_Max; ++i) { + if (paramName.compare(wchTypeNamesA[i]) == 0) { + type = (EDLCParameterType)i; + break; + } + } - return type; + return type; } -unsigned int DLCManager::getPackCount(EDLCType type /*= e_DLCType_All*/) -{ - unsigned int packCount = 0; - if( type != e_DLCType_All ) - { - for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) - { - DLCPack *pack = *it; - if( pack->getDLCItemsCount(type) > 0 ) - { - ++packCount; - } - } - } - else - { - packCount = static_cast(m_packs.size()); - } - return packCount; +unsigned int DLCManager::getPackCount(EDLCType type /*= e_DLCType_All*/) { + unsigned int packCount = 0; + if (type != e_DLCType_All) { + for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + DLCPack* pack = *it; + if (pack->getDLCItemsCount(type) > 0) { + ++packCount; + } + } + } else { + packCount = static_cast(m_packs.size()); + } + return packCount; } -void DLCManager::addPack(DLCPack *pack) -{ - m_packs.push_back(pack); +void DLCManager::addPack(DLCPack* pack) { m_packs.push_back(pack); } + +void DLCManager::removePack(DLCPack* pack) { + if (pack != NULL) { + AUTO_VAR(it, find(m_packs.begin(), m_packs.end(), pack)); + if (it != m_packs.end()) m_packs.erase(it); + delete pack; + } } -void DLCManager::removePack(DLCPack *pack) -{ - if(pack != NULL) - { - AUTO_VAR(it, find(m_packs.begin(),m_packs.end(),pack)); - if(it != m_packs.end() ) m_packs.erase(it); - delete pack; - } +void DLCManager::removeAllPacks(void) { + for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + DLCPack* pack = (DLCPack*)*it; + delete pack; + } + + m_packs.clear(); } -DLCPack *DLCManager::getPack(const std::wstring &name) -{ - DLCPack *pack = NULL; - //DWORD currentIndex = 0; - DLCPack *currentPack = NULL; - for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) - { - currentPack = *it; - std::wstring wsName=currentPack->getName(); +void DLCManager::LanguageChanged(void) { + for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + DLCPack* pack = (DLCPack*)*it; + // update the language + pack->UpdateLanguage(); + } +} - if(wsName.compare(name) == 0) - { - pack = currentPack; - break; - } - } - return pack; +DLCPack* DLCManager::getPack(const std::wstring& name) { + DLCPack* pack = NULL; + // DWORD currentIndex = 0; + DLCPack* currentPack = NULL; + for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + currentPack = *it; + std::wstring wsName = currentPack->getName(); + + if (wsName.compare(name) == 0) { + pack = currentPack; + break; + } + } + return pack; } #ifdef _XBOX_ONE -DLCPack *DLCManager::getPackFromProductID(const std::wstring &productID) -{ - DLCPack *pack = NULL; - //DWORD currentIndex = 0; - DLCPack *currentPack = NULL; - for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) - { - currentPack = *it; - std::wstring wsName=currentPack->getPurchaseOfferId(); +DLCPack* DLCManager::getPackFromProductID(const std::wstring& productID) { + DLCPack* pack = NULL; + // DWORD currentIndex = 0; + DLCPack* currentPack = NULL; + for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + currentPack = *it; + std::wstring wsName = currentPack->getPurchaseOfferId(); - if(wsName.compare(productID) == 0) - { - pack = currentPack; - break; - } - } - return pack; + if (wsName.compare(productID) == 0) { + pack = currentPack; + break; + } + } + return pack; } #endif -DLCPack *DLCManager::getPack(unsigned int index, EDLCType type /*= e_DLCType_All*/) -{ - DLCPack *pack = NULL; - if( type != e_DLCType_All ) - { - unsigned int currentIndex = 0; - DLCPack *currentPack = NULL; - for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) - { - currentPack = *it; - if(currentPack->getDLCItemsCount(type)>0) - { - if(currentIndex == index) - { - pack = currentPack; - break; - } - ++currentIndex; - } - } - } - else - { - if(index >= m_packs.size()) - { - app.DebugPrintf("DLCManager: Trying to access a DLC pack beyond the range of valid packs\n"); - __debugbreak(); - } - pack = m_packs[index]; - } +DLCPack* DLCManager::getPack(unsigned int index, + EDLCType type /*= e_DLCType_All*/) { + DLCPack* pack = NULL; + if (type != e_DLCType_All) { + unsigned int currentIndex = 0; + DLCPack* currentPack = NULL; + for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + currentPack = *it; + if (currentPack->getDLCItemsCount(type) > 0) { + if (currentIndex == index) { + pack = currentPack; + break; + } + ++currentIndex; + } + } + } else { + if (index >= m_packs.size()) { + app.DebugPrintf( + "DLCManager: Trying to access a DLC pack beyond the range of " + "valid packs\n"); + __debugbreak(); + } + pack = m_packs[index]; + } - return pack; + return pack; } -unsigned int DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_DLCType_All*/) -{ - unsigned int foundIndex = 0; - found = false; - if(pack == NULL) - { - app.DebugPrintf("DLCManager: Attempting to find the index for a NULL pack\n"); - //__debugbreak(); - return foundIndex; - } - if( type != e_DLCType_All ) - { - unsigned int index = 0; - for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) - { - DLCPack *thisPack = *it; - if(thisPack->getDLCItemsCount(type)>0) - { - if(thisPack == pack) - { - found = true; - foundIndex = index; - break; - } - ++index; - } - } - } - else - { - unsigned int index = 0; - for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) - { - DLCPack *thisPack = *it; - if(thisPack == pack) - { - found = true; - foundIndex = index; - break; - } - ++index; - } - } - return foundIndex; +unsigned int DLCManager::getPackIndex(DLCPack* pack, bool& found, + EDLCType type /*= e_DLCType_All*/) { + unsigned int foundIndex = 0; + found = false; + if (pack == NULL) { + app.DebugPrintf( + "DLCManager: Attempting to find the index for a NULL pack\n"); + //__debugbreak(); + return foundIndex; + } + if (type != e_DLCType_All) { + unsigned int index = 0; + for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + DLCPack* thisPack = *it; + if (thisPack->getDLCItemsCount(type) > 0) { + if (thisPack == pack) { + found = true; + foundIndex = index; + break; + } + ++index; + } + } + } else { + unsigned int index = 0; + for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + DLCPack* thisPack = *it; + if (thisPack == pack) { + found = true; + foundIndex = index; + break; + } + ++index; + } + } + return foundIndex; } -unsigned int DLCManager::getPackIndexContainingSkin(const std::wstring &path, bool &found) -{ - unsigned int foundIndex = 0; - found = false; - unsigned int index = 0; - for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) - { - DLCPack *pack = *it; - if(pack->getDLCItemsCount(e_DLCType_Skin)>0) - { - if(pack->doesPackContainSkin(path)) - { - foundIndex = index; - found = true; - break; - } - ++index; - } - } - return foundIndex; +unsigned int DLCManager::getPackIndexContainingSkin(const std::wstring& path, + bool& found) { + unsigned int foundIndex = 0; + found = false; + unsigned int index = 0; + for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + DLCPack* pack = *it; + if (pack->getDLCItemsCount(e_DLCType_Skin) > 0) { + if (pack->doesPackContainSkin(path)) { + foundIndex = index; + found = true; + break; + } + ++index; + } + } + return foundIndex; } -DLCPack *DLCManager::getPackContainingSkin(const std::wstring &path) -{ - DLCPack *foundPack = NULL; - for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) - { - DLCPack *pack = *it; - if(pack->getDLCItemsCount(e_DLCType_Skin)>0) - { - if(pack->doesPackContainSkin(path)) - { - foundPack = pack; - break; - } - } - } - return foundPack; +DLCPack* DLCManager::getPackContainingSkin(const std::wstring& path) { + DLCPack* foundPack = NULL; + for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + DLCPack* pack = *it; + if (pack->getDLCItemsCount(e_DLCType_Skin) > 0) { + if (pack->doesPackContainSkin(path)) { + foundPack = pack; + break; + } + } + } + return foundPack; } -DLCSkinFile *DLCManager::getSkinFile(const std::wstring &path) -{ - DLCSkinFile *foundSkinfile = NULL; - for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) - { - DLCPack *pack = *it; - foundSkinfile=pack->getSkinFile(path); - if(foundSkinfile!=NULL) - { - break; - } - } - return foundSkinfile; +DLCSkinFile* DLCManager::getSkinFile(const std::wstring& path) { + DLCSkinFile* foundSkinfile = NULL; + for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + DLCPack* pack = *it; + foundSkinfile = pack->getSkinFile(path); + if (foundSkinfile != NULL) { + break; + } + } + return foundSkinfile; } -unsigned int DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/) -{ - unsigned int corruptDLCCount = m_dwUnnamedCorruptDLCCount; - DLCPack *pack = NULL; - DLCPack *firstCorruptPack = NULL; +unsigned int DLCManager::checkForCorruptDLCAndAlert( + bool showMessage /*= true*/) { + unsigned int corruptDLCCount = m_dwUnnamedCorruptDLCCount; + DLCPack* pack = NULL; + DLCPack* firstCorruptPack = NULL; - for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) - { - pack = *it; - if( pack->IsCorrupt() ) - { - ++corruptDLCCount; - if(firstCorruptPack == NULL) firstCorruptPack = pack; - } - } + for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + pack = *it; + if (pack->IsCorrupt()) { + ++corruptDLCCount; + if (firstCorruptPack == NULL) firstCorruptPack = pack; + } + } - // gotta fix this someday - if(corruptDLCCount > 0 && showMessage) - { - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - if(corruptDLCCount == 1 && firstCorruptPack != NULL) - { - // pass in the pack format string - WCHAR wchFormat[132]; - swprintf(wchFormat, 132, L"%ls\n\n%%ls", firstCorruptPack->getName().c_str()); + // gotta fix this someday + if (corruptDLCCount > 0 && showMessage) { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + if (corruptDLCCount == 1 && firstCorruptPack != NULL) { + // pass in the pack format string + WCHAR wchFormat[132]; + swprintf(wchFormat, 132, L"%ls\n\n%%ls", + firstCorruptPack->getName().c_str()); - C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable(),wchFormat); + C4JStorage::EMessageResult result = ui.RequestErrorMessage( + IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA, 1, + ProfileManager.GetPrimaryPad(), NULL, NULL, wchFormat); - } - else - { - C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC_MULTIPLE, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); - } - } + } else { + C4JStorage::EMessageResult result = ui.RequestErrorMessage( + IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC_MULTIPLE, uiIDA, 1, + ProfileManager.GetPrimaryPad()); + } + } - SetNeedsCorruptCheck(false); + SetNeedsCorruptCheck(false); - return corruptDLCCount; + return corruptDLCCount; } -bool DLCManager::readDLCDataFile(unsigned int &dwFilesProcessed, const std::wstring &path, DLCPack *pack, bool fromArchive) -{ - return readDLCDataFile( dwFilesProcessed, wstringtofilename(path), pack, fromArchive); +bool DLCManager::readDLCDataFile(unsigned int& dwFilesProcessed, + const std::wstring& path, DLCPack* pack, + bool fromArchive) { + return readDLCDataFile(dwFilesProcessed, wstringtofilename(path), pack, + fromArchive); } +bool DLCManager::readDLCDataFile(unsigned int& dwFilesProcessed, + const std::string& path, DLCPack* pack, + bool fromArchive) { + std::wstring wPath = convStringToWstring(path); + if (fromArchive && app.getArchiveFileSize(wPath) >= 0) { + byteArray bytes = app.getArchiveFile(wPath); + return processDLCDataFile(dwFilesProcessed, bytes.data, bytes.length, + pack); + } else if (fromArchive) + return false; -bool DLCManager::readDLCDataFile(unsigned int &dwFilesProcessed, const std::string &path, DLCPack *pack, bool fromArchive) -{ - std::wstring wPath = convStringToWstring(path); - if (fromArchive && app.getArchiveFileSize(wPath) >= 0) - { - byteArray bytes = app.getArchiveFile(wPath); - return processDLCDataFile(dwFilesProcessed, bytes.data, bytes.length, pack); - } - else if (fromArchive) return false; - - unsigned int bytesRead = 0; - std::uint8_t *pbData = NULL; - if(!readOwnedDlcFile(path, &pbData, &bytesRead)) - { - app.DebugPrintf("Failed to open DLC data file %s\n", path.c_str()); - pack->SetIsCorrupt(true); - SetNeedsCorruptCheck(true); - return false; - } - return processDLCDataFile(dwFilesProcessed, pbData, bytesRead, pack); + unsigned int bytesRead = 0; + std::uint8_t* pbData = NULL; + if (!readOwnedDlcFile(path, &pbData, &bytesRead)) { + app.DebugPrintf("Failed to open DLC data file %s\n", path.c_str()); + pack->SetIsCorrupt(true); + SetNeedsCorruptCheck(true); + return false; + } + return processDLCDataFile(dwFilesProcessed, pbData, bytesRead, pack); } -bool DLCManager::processDLCDataFile(unsigned int &dwFilesProcessed, std::uint8_t *pbData, unsigned int dwLength, DLCPack *pack) +bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, + std::uint8_t* pbData, unsigned int dwLength, + DLCPack* pack) // a bunch of makros to reduce memcpy and offset boilerplate -#define DLC_READ_UINT(out, buf, off) memcpy((out), (buf) + (off), sizeof(unsigned int)) +#define DLC_READ_UINT(out, buf, off) \ + memcpy((out), (buf) + (off), sizeof(unsigned int)) -#define DLC_READ_PARAM(out, buf, off) memcpy((out), (buf) + (off), sizeof(C4JStorage::DLC_FILE_PARAM)) +#define DLC_READ_PARAM(out, buf, off) \ + memcpy((out), (buf) + (off), sizeof(C4JStorage::DLC_FILE_PARAM)) -#define DLC_READ_DETAIL(out, buf, off) memcpy((out), (buf) + (off), sizeof(C4JStorage::DLC_FILE_DETAILS)) +#define DLC_READ_DETAIL(out, buf, off) \ + memcpy((out), (buf) + (off), sizeof(C4JStorage::DLC_FILE_DETAILS)) // for details, read in the function below -#define DLC_PARAM_WSTR(buf, off) DLC_WSTRING((buf) + (off) + offsetof(C4JStorage::DLC_FILE_PARAM, wchData)) +#define DLC_PARAM_WSTR(buf, off) \ + DLC_WSTRING((buf) + (off) + offsetof(C4JStorage::DLC_FILE_PARAM, wchData)) -#define DLC_DETAIL_WSTR(buf, off) DLC_WSTRING((buf) + (off) + offsetof(C4JStorage::DLC_FILE_DETAILS, wchFile)) +#define DLC_DETAIL_WSTR(buf, off) \ + DLC_WSTRING((buf) + (off) + offsetof(C4JStorage::DLC_FILE_DETAILS, wchFile)) { - std::unordered_map parameterMapping; - unsigned int uiCurrentByte=0; + std::unordered_map parameterMapping; + unsigned int uiCurrentByte = 0; - // File format defined in the DLC_Creator - // File format: Version 2 - // unsigned long, version number - // unsigned long, t = number of parameter types - // t * DLC_FILE_PARAM structs mapping strings to id's - // unsigned long, n = number of files - // n * DLC_FILE_DETAILS describing each file in the pack - // n * files of the form - // // unsigned long, p = number of parameters - // // p * DLC_FILE_PARAM describing each parameter for this file - // // ulFileSize bytes of data blob of the file added + // File format defined in the DLC_Creator + // File format: Version 2 + // unsigned long, version number + // unsigned long, t = number of parameter types + // t * DLC_FILE_PARAM structs mapping strings to id's + // unsigned long, n = number of files + // n * DLC_FILE_DETAILS describing each file in the pack + // n * files of the form + // // unsigned long, p = number of parameters + // // p * DLC_FILE_PARAM describing each parameter for this file + // // ulFileSize bytes of data blob of the file added - // 4jcraft, some parts of this code changed, specifically: - // instead of casting a goddamn raw byte pointer and dereferencing it - // use memcpy, and access WSTRING with propper offset - // (scince bufferoffset after advancing by variable string length is not - // guaranteed to be properly aligned, so casting to a scalar/struct is UB) + // 4jcraft, some parts of this code changed, specifically: + // instead of casting a goddamn raw byte pointer and dereferencing it + // use memcpy, and access WSTRING with propper offset + // (scince bufferoffset after advancing by variable string length is not + // guaranteed to be properly aligned, so casting to a scalar/struct is UB) - // those casts coult be dangerous on e.g. ARM, because it doesnt handle - // missaligned loads, like x86/x64, so it would crash + // those casts coult be dangerous on e.g. ARM, because it doesnt handle + // missaligned loads, like x86/x64, so it would crash - // WHO TF USES HUNGARIAN NOTATION + // WHO TF USES HUNGARIAN NOTATION - unsigned int uiVersion; - DLC_READ_UINT(&uiVersion, pbData, uiCurrentByte); - uiCurrentByte+=sizeof(int); + unsigned int uiVersion; + DLC_READ_UINT(&uiVersion, pbData, uiCurrentByte); + uiCurrentByte += sizeof(int); - if(uiVersion < CURRENT_DLC_VERSION_NUM) - { - if(pbData!=NULL) delete [] pbData; - app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion); - return false; - } - pack->SetDataPointer(pbData); - // safe, offset 4, aligned - unsigned int uiParameterCount; - DLC_READ_UINT(&uiParameterCount, pbData, uiCurrentByte); - uiCurrentByte+=sizeof(int); + if (uiVersion < CURRENT_DLC_VERSION_NUM) { + if (pbData != NULL) delete[] pbData; + app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion); + return false; + } + pack->SetDataPointer(pbData); + // safe, offset 4, aligned + unsigned int uiParameterCount; + DLC_READ_UINT(&uiParameterCount, pbData, uiCurrentByte); + uiCurrentByte += sizeof(int); - C4JStorage::DLC_FILE_PARAM parBuf; - DLC_READ_PARAM(&parBuf, pbData, uiCurrentByte); - //DWORD dwwchCount=0; - for(unsigned int i=0;igetName(), pack->getLicenseMask()); - } - else if(type != e_DLCType_PackConfig) - { - dlcFile = pack->addFile(type, DLC_DETAIL_WSTR(pbData, uiCurrentByte)); - } + if (type == e_DLCType_TexturePack) { + dlcTexturePack = + new DLCPack(pack->getName(), pack->getLicenseMask()); + } else if (type != e_DLCType_PackConfig) { + dlcFile = + pack->addFile(type, DLC_DETAIL_WSTR(pbData, uiCurrentByte)); + } - // Params - unsigned int uiParamCount; - DLC_READ_UINT(&uiParamCount, pbTemp, 0); - pbTemp+=sizeof(int); + // Params + unsigned int uiParamCount; + DLC_READ_UINT(&uiParamCount, pbTemp, 0); + pbTemp += sizeof(int); - DLC_READ_PARAM(&parBuf, pbTemp, 0); - for(unsigned int j=0;jaddParameter(it->second, DLC_PARAM_WSTR(pbTemp, 0)); - } - else - { - if(dlcFile != NULL) dlcFile->addParameter(it->second, DLC_PARAM_WSTR(pbTemp, 0)); - else if(dlcTexturePack != NULL) dlcTexturePack->addParameter(it->second, DLC_PARAM_WSTR(pbTemp, 0)); - } - } - pbTemp+=DLC_PARAM_ADV(parBuf.dwWchCount); - DLC_READ_PARAM(&parBuf, pbTemp, 0); - } - //pbTemp+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM); + if (it != parameterMapping.end()) { + if (type == e_DLCType_PackConfig) { + pack->addParameter(it->second, DLC_PARAM_WSTR(pbTemp, 0)); + } else { + if (dlcFile != NULL) + dlcFile->addParameter(it->second, + DLC_PARAM_WSTR(pbTemp, 0)); + else if (dlcTexturePack != NULL) + dlcTexturePack->addParameter(it->second, + DLC_PARAM_WSTR(pbTemp, 0)); + } + } + pbTemp += DLC_PARAM_ADV(parBuf.dwWchCount); + DLC_READ_PARAM(&parBuf, pbTemp, 0); + } + // pbTemp+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM); - if(dlcTexturePack != NULL) - { - unsigned int texturePackFilesProcessed = 0; - bool validPack = processDLCDataFile(texturePackFilesProcessed, pbTemp, fileBuf.uiFileSize, dlcTexturePack); - pack->SetDataPointer(NULL); // If it's a child pack, it doesn't own the data - if(!validPack || texturePackFilesProcessed == 0) - { - delete dlcTexturePack; - dlcTexturePack = NULL; - } - else - { - pack->addChildPack(dlcTexturePack); + if (dlcTexturePack != NULL) { + unsigned int texturePackFilesProcessed = 0; + bool validPack = + processDLCDataFile(texturePackFilesProcessed, pbTemp, + fileBuf.uiFileSize, dlcTexturePack); + pack->SetDataPointer( + NULL); // If it's a child pack, it doesn't own the data + if (!validPack || texturePackFilesProcessed == 0) { + delete dlcTexturePack; + dlcTexturePack = NULL; + } else { + pack->addChildPack(dlcTexturePack); - if(dlcTexturePack->getDLCItemsCount(DLCManager::e_DLCType_Texture) > 0) - { - Minecraft::GetInstance()->skins->addTexturePackFromDLC(dlcTexturePack, dlcTexturePack->GetPackId() ); - } - } - ++dwFilesProcessed; - } - else if(dlcFile != NULL) - { - // Data - dlcFile->addData(pbTemp,fileBuf.uiFileSize); + if (dlcTexturePack->getDLCItemsCount( + DLCManager::e_DLCType_Texture) > 0) { + Minecraft::GetInstance()->skins->addTexturePackFromDLC( + dlcTexturePack, dlcTexturePack->GetPackId()); + } + } + ++dwFilesProcessed; + } else if (dlcFile != NULL) { + // Data + dlcFile->addData(pbTemp, fileBuf.uiFileSize); - // TODO - 4J Stu Remove the need for this vSkinNames vector, or manage it differently - switch(fileBuf.dwType) - { - case DLCManager::e_DLCType_Skin: - app.vSkinNames.push_back(DLC_DETAIL_WSTR(pbData, uiCurrentByte)); - break; - } + // TODO - 4J Stu Remove the need for this vSkinNames vector, or + // manage it differently + switch (fileBuf.dwType) { + case DLCManager::e_DLCType_Skin: + app.vSkinNames.push_back( + DLC_DETAIL_WSTR(pbData, uiCurrentByte)); + break; + } - ++dwFilesProcessed; - } + ++dwFilesProcessed; + } - // Move the pointer to the start of the next files data; - pbTemp+=fileBuf.uiFileSize; - uiCurrentByte+=DLC_DETAIL_ADV(fileBuf.dwWchCount); + // Move the pointer to the start of the next files data; + pbTemp += fileBuf.uiFileSize; + uiCurrentByte += DLC_DETAIL_ADV(fileBuf.dwWchCount); - DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte); - } + DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte); + } - if( pack->getDLCItemsCount(DLCManager::e_DLCType_GameRules) > 0 - || pack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader) > 0) - { - app.m_gameRules.loadGameRules(pack); - } + if (pack->getDLCItemsCount(DLCManager::e_DLCType_GameRules) > 0 || + pack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader) > 0) { + app.m_gameRules.loadGameRules(pack); + } - if(pack->getDLCItemsCount(DLCManager::e_DLCType_Audio) > 0) - { - //app.m_Audio.loadAudioDetails(pack); - } - // TODO Should be able to delete this data, but we can't yet due to how it is added to the Memory textures (MEM_file) + if (pack->getDLCItemsCount(DLCManager::e_DLCType_Audio) > 0) { + // app.m_Audio.loadAudioDetails(pack); + } + // TODO Should be able to delete this data, but we can't yet due to how it + // is added to the Memory textures (MEM_file) - return true; + return true; } -std::uint32_t DLCManager::retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack) -{ - std::uint32_t packId = 0; +std::uint32_t DLCManager::retrievePackIDFromDLCDataFile(const std::string& path, + DLCPack* pack) { + std::uint32_t packId = 0; - unsigned int bytesRead = 0; - std::uint8_t *pbData = NULL; - if(!readOwnedDlcFile(path, &pbData, &bytesRead)) - { - return 0; - } - packId=retrievePackID(pbData, bytesRead, pack); - delete [] pbData; + unsigned int bytesRead = 0; + std::uint8_t* pbData = NULL; + if (!readOwnedDlcFile(path, &pbData, &bytesRead)) { + return 0; + } + packId = retrievePackID(pbData, bytesRead, pack); + delete[] pbData; - return packId; + return packId; } -std::uint32_t DLCManager::retrievePackID(std::uint8_t *pbData, unsigned int dwLength, DLCPack *pack) -{ - std::uint32_t packId=0; - bool bPackIDSet=false; - std::unordered_map parameterMapping; - unsigned int uiCurrentByte=0; +std::uint32_t DLCManager::retrievePackID(std::uint8_t* pbData, + unsigned int dwLength, DLCPack* pack) { + std::uint32_t packId = 0; + bool bPackIDSet = false; + std::unordered_map parameterMapping; + unsigned int uiCurrentByte = 0; - // File format defined in the DLC_Creator - // File format: Version 2 - // unsigned long, version number - // unsigned long, t = number of parameter types - // t * DLC_FILE_PARAM structs mapping strings to id's - // unsigned long, n = number of files - // n * DLC_FILE_DETAILS describing each file in the pack - // n * files of the form - // // unsigned long, p = number of parameters - // // p * DLC_FILE_PARAM describing each parameter for this file - // // ulFileSize bytes of data blob of the file added - unsigned int uiVersion = ReadDlcValue(pbData, uiCurrentByte); - uiCurrentByte+=sizeof(int); + // File format defined in the DLC_Creator + // File format: Version 2 + // unsigned long, version number + // unsigned long, t = number of parameter types + // t * DLC_FILE_PARAM structs mapping strings to id's + // unsigned long, n = number of files + // n * DLC_FILE_DETAILS describing each file in the pack + // n * files of the form + // // unsigned long, p = number of parameters + // // p * DLC_FILE_PARAM describing each parameter for this file + // // ulFileSize bytes of data blob of the file added + unsigned int uiVersion = ReadDlcValue(pbData, uiCurrentByte); + uiCurrentByte += sizeof(int); - if(uiVersion < CURRENT_DLC_VERSION_NUM) - { - app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion); - return 0; - } - pack->SetDataPointer(pbData); - unsigned int uiParameterCount = ReadDlcValue(pbData, uiCurrentByte); - uiCurrentByte+=sizeof(int); - C4JStorage::DLC_FILE_PARAM paramBuf; - ReadDlcStruct(¶mBuf, pbData, uiCurrentByte); - for(unsigned int i=0;iSetDataPointer(pbData); + unsigned int uiParameterCount = + ReadDlcValue(pbData, uiCurrentByte); + uiCurrentByte += sizeof(int); + C4JStorage::DLC_FILE_PARAM paramBuf; + ReadDlcStruct(¶mBuf, pbData, uiCurrentByte); + for (unsigned int i = 0; i < uiParameterCount; i++) { + // Map DLC strings to application strings, then store the DLC index + // mapping to application index + std::wstring parameterName = DLC_PARAM_WSTR(pbData, uiCurrentByte); + DLCManager::EDLCParameterType type = + DLCManager::getParameterType(parameterName); + if (type != DLCManager::e_DLCParamType_Invalid) { + parameterMapping[paramBuf.dwType] = type; + } + uiCurrentByte += DLC_PARAM_ADV(paramBuf.dwWchCount); + ReadDlcStruct(¶mBuf, pbData, uiCurrentByte); + } - unsigned int uiFileCount = ReadDlcValue(pbData, uiCurrentByte); - uiCurrentByte+=sizeof(int); - C4JStorage::DLC_FILE_DETAILS fileBuf; - ReadDlcStruct(&fileBuf, pbData, uiCurrentByte); + unsigned int uiFileCount = + ReadDlcValue(pbData, uiCurrentByte); + uiCurrentByte += sizeof(int); + C4JStorage::DLC_FILE_DETAILS fileBuf; + ReadDlcStruct(&fileBuf, pbData, uiCurrentByte); - unsigned int dwTemp=uiCurrentByte; - for(unsigned int i=0;i(pbTemp); - pbTemp+=sizeof(int); - ReadDlcStruct(¶mBuf, pbTemp); - for(unsigned int j=0;j(pbTemp); + pbTemp += sizeof(int); + ReadDlcStruct(¶mBuf, pbTemp); + for (unsigned int j = 0; j < uiParameterCount; j++) { + AUTO_VAR(it, parameterMapping.find(paramBuf.dwType)); - if(it != parameterMapping.end() ) - { - if(type==e_DLCType_PackConfig) - { - if(it->second==e_DLCParamType_PackId) - { - std::wstring wsTemp = DLC_PARAM_WSTR(pbTemp, 0); - std::wstringstream ss; - // 4J Stu - numbered using decimal to make it easier for artists/people to number manually - ss << std::dec << wsTemp.c_str(); - ss >> packId; - bPackIDSet=true; - break; - } - } - } - pbTemp += DLC_PARAM_ADV(paramBuf.dwWchCount); - ReadDlcStruct(¶mBuf, pbTemp); - } + if (it != parameterMapping.end()) { + if (type == e_DLCType_PackConfig) { + if (it->second == e_DLCParamType_PackId) { + std::wstring wsTemp = DLC_PARAM_WSTR(pbTemp, 0); + std::wstringstream ss; + // 4J Stu - numbered using decimal to make it easier for + // artists/people to number manually + ss << std::dec << wsTemp.c_str(); + ss >> packId; + bPackIDSet = true; + break; + } + } + } + pbTemp += DLC_PARAM_ADV(paramBuf.dwWchCount); + ReadDlcStruct(¶mBuf, pbTemp); + } - if(bPackIDSet) break; - // Move the pointer to the start of the next files data; - pbTemp += fileBuf.uiFileSize; - uiCurrentByte += DLC_DETAIL_ADV(fileBuf.dwWchCount); + if (bPackIDSet) break; + // Move the pointer to the start of the next files data; + pbTemp += fileBuf.uiFileSize; + uiCurrentByte += DLC_DETAIL_ADV(fileBuf.dwWchCount); - ReadDlcStruct(&fileBuf, pbData, uiCurrentByte); - } + ReadDlcStruct(&fileBuf, pbData, uiCurrentByte); + } - parameterMapping.clear(); - return packId; + parameterMapping.clear(); + return packId; } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCManager.h b/Minecraft.Client/Platform/Common/DLC/DLCManager.h index 8f4e46e39..4552c7b8a 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCManager.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCManager.h @@ -1,100 +1,112 @@ #pragma once -//using namespace std; +// using namespace std; #include #include class DLCPack; class DLCSkinFile; -class DLCManager -{ +class DLCManager { public: - enum EDLCType - { - e_DLCType_Skin = 0, - e_DLCType_Cape, - e_DLCType_Texture, - e_DLCType_UIData, - e_DLCType_PackConfig, - e_DLCType_TexturePack, - e_DLCType_LocalisationData, - e_DLCType_GameRules, - e_DLCType_Audio, - e_DLCType_ColourTable, - e_DLCType_GameRulesHeader, + enum EDLCType { + e_DLCType_Skin = 0, + e_DLCType_Cape, + e_DLCType_Texture, + e_DLCType_UIData, + e_DLCType_PackConfig, + e_DLCType_TexturePack, + e_DLCType_LocalisationData, + e_DLCType_GameRules, + e_DLCType_Audio, + e_DLCType_ColourTable, + e_DLCType_GameRulesHeader, - e_DLCType_Max, - e_DLCType_All, - }; + e_DLCType_Max, + e_DLCType_All, + }; - // If you add to the Enum,then you need to add the array of type names - // These are the names used in the XML for the parameters - enum EDLCParameterType - { - e_DLCParamType_Invalid = -1, + // If you add to the Enum,then you need to add the array of type names + // These are the names used in the XML for the parameters + enum EDLCParameterType { + e_DLCParamType_Invalid = -1, - e_DLCParamType_DisplayName = 0, - e_DLCParamType_ThemeName, - e_DLCParamType_Free, // identify free skins - e_DLCParamType_Credit, // legal credits for DLC - e_DLCParamType_Cape, - e_DLCParamType_Box, - e_DLCParamType_Anim, - e_DLCParamType_PackId, - e_DLCParamType_NetherParticleColour, - e_DLCParamType_EnchantmentTextColour, - e_DLCParamType_EnchantmentTextFocusColour, - e_DLCParamType_DataPath, - e_DLCParamType_PackVersion, + e_DLCParamType_DisplayName = 0, + e_DLCParamType_ThemeName, + e_DLCParamType_Free, // identify free skins + e_DLCParamType_Credit, // legal credits for DLC + e_DLCParamType_Cape, + e_DLCParamType_Box, + e_DLCParamType_Anim, + e_DLCParamType_PackId, + e_DLCParamType_NetherParticleColour, + e_DLCParamType_EnchantmentTextColour, + e_DLCParamType_EnchantmentTextFocusColour, + e_DLCParamType_DataPath, + e_DLCParamType_PackVersion, - e_DLCParamType_Max, + e_DLCParamType_Max, - }; - const static WCHAR *wchTypeNamesA[e_DLCParamType_Max]; + }; + const static WCHAR* wchTypeNamesA[e_DLCParamType_Max]; private: - std::vector m_packs; - //bool m_bNeedsUpdated; - bool m_bNeedsCorruptCheck; - unsigned int m_dwUnnamedCorruptDLCCount; + std::vector m_packs; + // bool m_bNeedsUpdated; + bool m_bNeedsCorruptCheck; + unsigned int m_dwUnnamedCorruptDLCCount; + public: - DLCManager(); - ~DLCManager(); + DLCManager(); + ~DLCManager(); - static EDLCParameterType getParameterType(const std::wstring ¶mName); + static EDLCParameterType getParameterType(const std::wstring& paramName); - unsigned int getPackCount(EDLCType type = e_DLCType_All); + unsigned int getPackCount(EDLCType type = e_DLCType_All); - //bool NeedsUpdated() { return m_bNeedsUpdated; } - //void SetNeedsUpdated(bool val) { m_bNeedsUpdated = val; } + // bool NeedsUpdated() { return m_bNeedsUpdated; } + // void SetNeedsUpdated(bool val) { m_bNeedsUpdated = val; } - bool NeedsCorruptCheck() { return m_bNeedsCorruptCheck; } - void SetNeedsCorruptCheck(bool val) { m_bNeedsCorruptCheck = val; } + bool NeedsCorruptCheck() { return m_bNeedsCorruptCheck; } + void SetNeedsCorruptCheck(bool val) { m_bNeedsCorruptCheck = val; } - void resetUnnamedCorruptCount() { m_dwUnnamedCorruptDLCCount = 0; } - void incrementUnnamedCorruptCount() { ++m_dwUnnamedCorruptDLCCount; } + void resetUnnamedCorruptCount() { m_dwUnnamedCorruptDLCCount = 0; } + void incrementUnnamedCorruptCount() { ++m_dwUnnamedCorruptDLCCount; } - void addPack(DLCPack *pack); - void removePack(DLCPack *pack); + void addPack(DLCPack* pack); + void removePack(DLCPack* pack); + void removeAllPacks(void); + void LanguageChanged(void); - DLCPack *getPack(const std::wstring &name); + DLCPack* getPack(const std::wstring& name); #ifdef _XBOX_ONE - DLCPack *DLCManager::getPackFromProductID(const std::wstring &productID); + DLCPack* DLCManager::getPackFromProductID(const std::wstring& productID); #endif - DLCPack *getPack(unsigned int index, EDLCType type = e_DLCType_All); - unsigned int getPackIndex(DLCPack *pack, bool &found, EDLCType type = e_DLCType_All); - DLCSkinFile *getSkinFile(const std::wstring &path); // Will hunt all packs of type skin to find the right skinfile + DLCPack* getPack(unsigned int index, EDLCType type = e_DLCType_All); + unsigned int getPackIndex(DLCPack* pack, bool& found, + EDLCType type = e_DLCType_All); + DLCSkinFile* getSkinFile( + const std::wstring& path); // Will hunt all packs of type skin to find + // the right skinfile - DLCPack *getPackContainingSkin(const std::wstring &path); - unsigned int getPackIndexContainingSkin(const std::wstring &path, bool &found); + DLCPack* getPackContainingSkin(const std::wstring& path); + unsigned int getPackIndexContainingSkin(const std::wstring& path, + bool& found); - unsigned int checkForCorruptDLCAndAlert(bool showMessage = true); + unsigned int checkForCorruptDLCAndAlert(bool showMessage = true); - bool readDLCDataFile(unsigned int &dwFilesProcessed, const std::wstring &path, DLCPack *pack, bool fromArchive = false); - bool readDLCDataFile(unsigned int &dwFilesProcessed, const std::string &path, DLCPack *pack, bool fromArchive = false); - std::uint32_t retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack); + bool readDLCDataFile(unsigned int& dwFilesProcessed, + const std::wstring& path, DLCPack* pack, + bool fromArchive = false); + bool readDLCDataFile(unsigned int& dwFilesProcessed, + const std::string& path, DLCPack* pack, + bool fromArchive = false); + std::uint32_t retrievePackIDFromDLCDataFile(const std::string& path, + DLCPack* pack); private: - bool processDLCDataFile(unsigned int &dwFilesProcessed, std::uint8_t *pbData, unsigned int dwLength, DLCPack *pack); + bool processDLCDataFile(unsigned int& dwFilesProcessed, + std::uint8_t* pbData, unsigned int dwLength, + DLCPack* pack); - std::uint32_t retrievePackID(std::uint8_t *pbData, unsigned int dwLength, DLCPack *pack); + std::uint32_t retrievePackID(std::uint8_t* pbData, unsigned int dwLength, + DLCPack* pack); }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp b/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp index ec3531c56..81d3ab80d 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp @@ -11,402 +11,364 @@ #include "DLCColourTableFile.h" #include "../../Minecraft.World/Util/StringHelpers.h" -DLCPack::DLCPack(const std::wstring &name,std::uint32_t dwLicenseMask) -{ - m_dataPath = L""; - m_packName = name; - m_dwLicenseMask=dwLicenseMask; +DLCPack::DLCPack(const std::wstring& name, std::uint32_t dwLicenseMask) { + m_dataPath = L""; + m_packName = name; + m_dwLicenseMask = dwLicenseMask; #ifdef _XBOX_ONE - m_wsProductId = L""; + m_wsProductId = L""; #else - m_ullFullOfferId = 0LL; + m_ullFullOfferId = 0LL; #endif - m_isCorrupt = false; - m_packId = 0; - m_packVersion = 0; - m_parentPack = NULL; - m_dlcMountIndex = -1; + m_isCorrupt = false; + m_packId = 0; + m_packVersion = 0; + m_parentPack = NULL; + m_dlcMountIndex = -1; #ifdef _XBOX - m_dlcDeviceID = XCONTENTDEVICE_ANY; + m_dlcDeviceID = XCONTENTDEVICE_ANY; #endif - - // This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children. - m_data = NULL; + + // This pointer is for all the data used for this pack, so deleting it + // invalidates ALL of it's children. + m_data = NULL; } #ifdef _XBOX_ONE -DLCPack::DLCPack(const std::wstring &name,const std::wstring &productID,std::uint32_t dwLicenseMask) -{ - m_dataPath = L""; - m_packName = name; - m_dwLicenseMask=dwLicenseMask; - m_wsProductId = productID; - m_isCorrupt = false; - m_packId = 0; - m_packVersion = 0; - m_parentPack = NULL; - m_dlcMountIndex = -1; +DLCPack::DLCPack(const std::wstring& name, const std::wstring& productID, + std::uint32_t dwLicenseMask) { + m_dataPath = L""; + m_packName = name; + m_dwLicenseMask = dwLicenseMask; + m_wsProductId = productID; + m_isCorrupt = false; + m_packId = 0; + m_packVersion = 0; + m_parentPack = NULL; + m_dlcMountIndex = -1; - // This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children. - m_data = NULL; + // This pointer is for all the data used for this pack, so deleting it + // invalidates ALL of it's children. + m_data = NULL; } #endif -DLCPack::~DLCPack() -{ - for(AUTO_VAR(it, m_childPacks.begin()); it != m_childPacks.end(); ++it) - { - delete *it; - } +DLCPack::~DLCPack() { + for (AUTO_VAR(it, m_childPacks.begin()); it != m_childPacks.end(); ++it) { + delete *it; + } - for(unsigned int i = 0; i < DLCManager::e_DLCType_Max; ++i) - { - for(AUTO_VAR(it,m_files[i].begin()); it != m_files[i].end(); ++it) - { - delete *it; - } - } + for (unsigned int i = 0; i < DLCManager::e_DLCType_Max; ++i) { + for (AUTO_VAR(it, m_files[i].begin()); it != m_files[i].end(); ++it) { + delete *it; + } + } - // This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children. - if(m_data) - { + // This pointer is for all the data used for this pack, so deleting it + // invalidates ALL of it's children. + if (m_data) { #ifndef _CONTENT_PACKAGE - wprintf(L"Deleting data for DLC pack %ls\n", m_packName.c_str()); + wprintf(L"Deleting data for DLC pack %ls\n", m_packName.c_str()); #endif - // For the same reason, don't delete data pointer for any child pack as it just points to a region within the parent pack that has already been freed - if( m_parentPack == NULL ) - { - delete [] m_data; - } - } + // For the same reason, don't delete data pointer for any child pack as + // it just points to a region within the parent pack that has already + // been freed + if (m_parentPack == NULL) { + delete[] m_data; + } + } } -int DLCPack::GetDLCMountIndex() -{ - if(m_parentPack != NULL) - { - return m_parentPack->GetDLCMountIndex(); - } - return m_dlcMountIndex; +int DLCPack::GetDLCMountIndex() { + if (m_parentPack != NULL) { + return m_parentPack->GetDLCMountIndex(); + } + return m_dlcMountIndex; } -XCONTENTDEVICEID DLCPack::GetDLCDeviceID() -{ - if(m_parentPack != NULL ) - { - return m_parentPack->GetDLCDeviceID(); - } - return m_dlcDeviceID; +XCONTENTDEVICEID DLCPack::GetDLCDeviceID() { + if (m_parentPack != NULL) { + return m_parentPack->GetDLCDeviceID(); + } + return m_dlcDeviceID; } -void DLCPack::addChildPack(DLCPack *childPack) -{ - const std::uint32_t packId = childPack->GetPackId(); +void DLCPack::addChildPack(DLCPack* childPack) { + const std::uint32_t packId = childPack->GetPackId(); #ifndef _CONTENT_PACKAGE - if(packId > 15) - { - __debugbreak(); - } + if (packId < 0 || packId > 15) { + __debugbreak(); + } #endif - childPack->SetPackId( (packId<<24) | m_packId ); - m_childPacks.push_back(childPack); - childPack->setParentPack(this); - childPack->m_packName = m_packName + childPack->getName(); + childPack->SetPackId((packId << 24) | m_packId); + m_childPacks.push_back(childPack); + childPack->setParentPack(this); + childPack->m_packName = m_packName + childPack->getName(); } -void DLCPack::setParentPack(DLCPack *parentPack) -{ - m_parentPack = parentPack; +void DLCPack::setParentPack(DLCPack* parentPack) { m_parentPack = parentPack; } + +void DLCPack::addParameter(DLCManager::EDLCParameterType type, + const std::wstring& value) { + switch (type) { + case DLCManager::e_DLCParamType_PackId: { + std::uint32_t packId = 0; + + std::wstringstream ss; + // 4J Stu - numbered using decimal to make it easier for + // artists/people to number manually + ss << std::dec << value.c_str(); + ss >> packId; + + SetPackId(packId); + } break; + case DLCManager::e_DLCParamType_PackVersion: { + std::uint32_t version = 0; + + std::wstringstream ss; + // 4J Stu - numbered using decimal to make it easier for + // artists/people to number manually + ss << std::dec << value.c_str(); + ss >> version; + + SetPackVersion(version); + } break; + case DLCManager::e_DLCParamType_DisplayName: + m_packName = value; + break; + case DLCManager::e_DLCParamType_DataPath: + m_dataPath = value; + break; + default: + m_parameters[(int)type] = value; + break; + } } -void DLCPack::addParameter(DLCManager::EDLCParameterType type, const std::wstring &value) -{ - switch(type) - { - case DLCManager::e_DLCParamType_PackId: - { - std::uint32_t packId = 0; - - std::wstringstream ss; - // 4J Stu - numbered using decimal to make it easier for artists/people to number manually - ss << std::dec << value.c_str(); - ss >> packId; - - SetPackId(packId); - } - break; - case DLCManager::e_DLCParamType_PackVersion: - { - std::uint32_t version = 0; - - std::wstringstream ss; - // 4J Stu - numbered using decimal to make it easier for artists/people to number manually - ss << std::dec << value.c_str(); - ss >> version; - - SetPackVersion(version); - } - break; - case DLCManager::e_DLCParamType_DisplayName: - m_packName = value; - break; - case DLCManager::e_DLCParamType_DataPath: - m_dataPath = value; - break; - default: - m_parameters[(int)type] = value; - break; - } +bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type, + unsigned int& param) { + AUTO_VAR(it, m_parameters.find((int)type)); + if (it != m_parameters.end()) { + switch (type) { + case DLCManager::e_DLCParamType_NetherParticleColour: + case DLCManager::e_DLCParamType_EnchantmentTextColour: + case DLCManager::e_DLCParamType_EnchantmentTextFocusColour: { + std::wstringstream ss; + ss << std::hex << it->second.c_str(); + ss >> param; + } break; + default: + param = _fromString(it->second); + } + return true; + } + return false; } -bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type, unsigned int ¶m) -{ - AUTO_VAR(it,m_parameters.find((int)type)); - if(it != m_parameters.end()) - { - switch(type) - { - case DLCManager::e_DLCParamType_NetherParticleColour: - case DLCManager::e_DLCParamType_EnchantmentTextColour: - case DLCManager::e_DLCParamType_EnchantmentTextFocusColour: - { - std::wstringstream ss; - ss << std::hex << it->second.c_str(); - ss >> param; - } - break; - default: - param = _fromString(it->second); - } - return true; - } - return false; -} +DLCFile* DLCPack::addFile(DLCManager::EDLCType type, const std::wstring& path) { + DLCFile* newFile = NULL; -DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const std::wstring &path) -{ - DLCFile *newFile = NULL; + switch (type) { + case DLCManager::e_DLCType_Skin: { + std::vector splitPath = stringSplit(path, L'/'); + std::wstring strippedPath = splitPath.back(); - switch(type) - { - case DLCManager::e_DLCType_Skin: - { - std::vector splitPath = stringSplit(path,L'/'); - std::wstring strippedPath = splitPath.back(); + newFile = new DLCSkinFile(strippedPath); - newFile = new DLCSkinFile(strippedPath); - - // check to see if we can get the full offer id using this skin name + // check to see if we can get the full offer id using this skin name #ifdef _XBOX_ONE - app.GetDLCFullOfferIDForSkinID(strippedPath,m_wsProductId); + app.GetDLCFullOfferIDForSkinID(strippedPath, m_wsProductId); #else - ULONGLONG ullVal=0LL; + ULONGLONG ullVal = 0LL; - if(app.GetDLCFullOfferIDForSkinID(strippedPath,&ullVal)) - { - m_ullFullOfferId=ullVal; - } + if (app.GetDLCFullOfferIDForSkinID(strippedPath, &ullVal)) { + m_ullFullOfferId = ullVal; + } #endif - } - break; - case DLCManager::e_DLCType_Cape: - { - std::vector splitPath = stringSplit(path,L'/'); - std::wstring strippedPath = splitPath.back(); - newFile = new DLCCapeFile(strippedPath); - } - break; - case DLCManager::e_DLCType_Texture: - newFile = new DLCTextureFile(path); - break; - case DLCManager::e_DLCType_UIData: - newFile = new DLCUIDataFile(path); - break; - case DLCManager::e_DLCType_LocalisationData: - newFile = new DLCLocalisationFile(path); - break; - case DLCManager::e_DLCType_GameRules: - newFile = new DLCGameRulesFile(path); - break; - case DLCManager::e_DLCType_Audio: - newFile = new DLCAudioFile(path); - break; - case DLCManager::e_DLCType_ColourTable: - newFile = new DLCColourTableFile(path); - break; - case DLCManager::e_DLCType_GameRulesHeader: - newFile = new DLCGameRulesHeader(path); - break; - default: - break; - }; + } break; + case DLCManager::e_DLCType_Cape: { + std::vector splitPath = stringSplit(path, L'/'); + std::wstring strippedPath = splitPath.back(); + newFile = new DLCCapeFile(strippedPath); + } break; + case DLCManager::e_DLCType_Texture: + newFile = new DLCTextureFile(path); + break; + case DLCManager::e_DLCType_UIData: + newFile = new DLCUIDataFile(path); + break; + case DLCManager::e_DLCType_LocalisationData: + newFile = new DLCLocalisationFile(path); + break; + case DLCManager::e_DLCType_GameRules: + newFile = new DLCGameRulesFile(path); + break; + case DLCManager::e_DLCType_Audio: + newFile = new DLCAudioFile(path); + break; + case DLCManager::e_DLCType_ColourTable: + newFile = new DLCColourTableFile(path); + break; + case DLCManager::e_DLCType_GameRulesHeader: + newFile = new DLCGameRulesHeader(path); + break; + default: + break; + }; - if( newFile != NULL ) - { - m_files[newFile->getType()].push_back(newFile); - } + if (newFile != NULL) { + m_files[newFile->getType()].push_back(newFile); + } - return newFile; + return newFile; } -// MGH - added this comp func, as the embedded func in find_if was confusing the PS3 compiler -static const std::wstring *g_pathCmpString = NULL; -static bool pathCmp(DLCFile *val) -{ - return (g_pathCmpString->compare(val->getPath()) == 0); +// MGH - added this comp func, as the embedded func in find_if was confusing the +// PS3 compiler +static const std::wstring* g_pathCmpString = NULL; +static bool pathCmp(DLCFile* val) { + return (g_pathCmpString->compare(val->getPath()) == 0); } -bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, const std::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)) - { - hasFile = doesPackContainFile(currentType,path); - if(hasFile) break; - } - } - else - { - g_pathCmpString = &path; - AUTO_VAR(it, std::find_if( m_files[type].begin(), m_files[type].end(), pathCmp )); - hasFile = it != m_files[type].end(); - if(!hasFile && m_parentPack ) - { - hasFile = m_parentPack->doesPackContainFile(type,path); - } - } - return hasFile; +bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, + const std::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)) { + hasFile = doesPackContainFile(currentType, path); + if (hasFile) break; + } + } else { + g_pathCmpString = &path; + AUTO_VAR(it, std::find_if(m_files[type].begin(), m_files[type].end(), + pathCmp)); + hasFile = it != m_files[type].end(); + if (!hasFile && m_parentPack) { + hasFile = m_parentPack->doesPackContainFile(type, path); + } + } + return hasFile; } -DLCFile *DLCPack::getFile(DLCManager::EDLCType type, unsigned int 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)) - { - file = getFile(currentType,index); - if(file != NULL) break; - } - } - else - { - if(m_files[type].size() > index) file = m_files[type][index]; - if(!file && m_parentPack) - { - file = m_parentPack->getFile(type,index); - } - } - return file; +DLCFile* DLCPack::getFile(DLCManager::EDLCType type, unsigned int 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)) { + file = getFile(currentType, index); + if (file != NULL) break; + } + } else { + if (m_files[type].size() > index) file = m_files[type][index]; + if (!file && m_parentPack) { + file = m_parentPack->getFile(type, index); + } + } + return file; } -DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const std::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)) - { - file = getFile(currentType,path); - if(file != NULL) break; - } - } - else - { - g_pathCmpString = &path; - AUTO_VAR(it, std::find_if( m_files[type].begin(), m_files[type].end(), pathCmp )); +DLCFile* DLCPack::getFile(DLCManager::EDLCType type, const std::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)) { + file = getFile(currentType, path); + if (file != NULL) break; + } + } else { + g_pathCmpString = &path; + AUTO_VAR(it, std::find_if(m_files[type].begin(), m_files[type].end(), + pathCmp)); - if(it == m_files[type].end()) - { - // Not found - file = NULL; - } - else - { - file = *it; - } - if(!file && m_parentPack) - { - file = m_parentPack->getFile(type,path); - } - } - return file; + if (it == m_files[type].end()) { + // Not found + file = NULL; + } else { + file = *it; + } + if (!file && m_parentPack) { + file = m_parentPack->getFile(type, path); + } + } + return file; } -unsigned int DLCPack::getDLCItemsCount(DLCManager::EDLCType type /*= DLCManager::e_DLCType_All*/) -{ - unsigned int count = 0; +unsigned int DLCPack::getDLCItemsCount( + DLCManager::EDLCType type /*= DLCManager::e_DLCType_All*/) { + unsigned int count = 0; - switch(type) - { - case DLCManager::e_DLCType_All: - for(int i = 0; i < DLCManager::e_DLCType_Max; ++i) - { - count += getDLCItemsCount((DLCManager::EDLCType)i); - } - break; - default: - count = static_cast(m_files[(int)type].size()); - break; - }; - return count; + switch (type) { + case DLCManager::e_DLCType_All: + for (int i = 0; i < DLCManager::e_DLCType_Max; ++i) { + count += getDLCItemsCount((DLCManager::EDLCType)i); + } + break; + default: + count = static_cast(m_files[(int)type].size()); + break; + }; + return count; }; -unsigned int DLCPack::getFileIndexAt(DLCManager::EDLCType type, const std::wstring &path, bool &found) -{ - if(type == DLCManager::e_DLCType_All) - { - app.DebugPrintf("Unimplemented\n"); +unsigned int DLCPack::getFileIndexAt(DLCManager::EDLCType type, + const std::wstring& path, bool& found) { + if (type == DLCManager::e_DLCType_All) { + app.DebugPrintf("Unimplemented\n"); #ifndef __CONTENT_PACKAGE - __debugbreak(); + __debugbreak(); #endif - return 0; - } + return 0; + } - unsigned int foundIndex = 0; - found = false; - unsigned int index = 0; - for(AUTO_VAR(it, m_files[type].begin()); it != m_files[type].end(); ++it) - { - if(path.compare((*it)->getPath()) == 0) - { - foundIndex = index; - found = true; - break; - } - ++index; - } + unsigned int foundIndex = 0; + found = false; + unsigned int index = 0; + for (AUTO_VAR(it, m_files[type].begin()); it != m_files[type].end(); ++it) { + if (path.compare((*it)->getPath()) == 0) { + foundIndex = index; + found = true; + break; + } + ++index; + } - return foundIndex; + return foundIndex; } -bool DLCPack::hasPurchasedFile(DLCManager::EDLCType type, const std::wstring &path) -{ - if(type == DLCManager::e_DLCType_All) - { - app.DebugPrintf("Unimplemented\n"); +bool DLCPack::hasPurchasedFile(DLCManager::EDLCType type, + const std::wstring& path) { + if (type == DLCManager::e_DLCType_All) { + app.DebugPrintf("Unimplemented\n"); #ifndef _CONTENT_PACKAGE - __debugbreak(); + __debugbreak(); #endif - return false; - } + return false; + } #ifndef _CONTENT_PACKAGE - if( app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L< 0) { + DLCLocalisationFile* localisationFile = (DLCLocalisationFile*)getFile( + DLCManager::e_DLCType_LocalisationData, L"languages.loc"); + StringTable* strTable = localisationFile->getStringTable(); + strTable->ReloadStringTable(); + } } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCPack.h b/Minecraft.Client/Platform/Common/DLC/DLCPack.h index 3fdd16973..1408c440b 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCPack.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCPack.h @@ -1,94 +1,114 @@ #pragma once -//using namespace std; +// using namespace std; #include #include "DLCManager.h" class DLCFile; class DLCSkinFile; -class DLCPack -{ +class DLCPack { private: - std::vector m_files[DLCManager::e_DLCType_Max]; - std::vector m_childPacks; - DLCPack *m_parentPack; + std::vector m_files[DLCManager::e_DLCType_Max]; + std::vector m_childPacks; + DLCPack* m_parentPack; - std::unordered_map m_parameters; + std::unordered_map m_parameters; - std::wstring m_packName; - std::wstring m_dataPath; - std::uint32_t m_dwLicenseMask; - int m_dlcMountIndex; - XCONTENTDEVICEID m_dlcDeviceID; + std::wstring m_packName; + std::wstring m_dataPath; + std::uint32_t m_dwLicenseMask; + int m_dlcMountIndex; + XCONTENTDEVICEID m_dlcDeviceID; #ifdef _XBOX_ONE - std::wstring m_wsProductId; + std::wstring m_wsProductId; #else - ULONGLONG m_ullFullOfferId; + ULONGLONG m_ullFullOfferId; #endif - bool m_isCorrupt; - std::uint32_t m_packId; - std::uint32_t m_packVersion; + bool m_isCorrupt; + std::uint32_t m_packId; + std::uint32_t m_packVersion; - std::uint8_t *m_data; // This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children. + std::uint8_t* + m_data; // This pointer is for all the data used for this pack, so + // deleting it invalidates ALL of it's children. public: - - DLCPack(const std::wstring &name,std::uint32_t dwLicenseMask); + DLCPack(const std::wstring& name, std::uint32_t dwLicenseMask); #ifdef _XBOX_ONE - DLCPack(const std::wstring &name,const std::wstring &productID,std::uint32_t dwLicenseMask); + DLCPack(const std::wstring& name, const std::wstring& productID, + std::uint32_t dwLicenseMask); #endif - ~DLCPack(); + ~DLCPack(); - std::wstring getFullDataPath() { return m_dataPath; } + std::wstring getFullDataPath() { return m_dataPath; } - void SetDataPointer(std::uint8_t *pbData) { m_data = pbData; } + void SetDataPointer(std::uint8_t* pbData) { m_data = pbData; } - bool IsCorrupt() { return m_isCorrupt; } - void SetIsCorrupt(bool val) { m_isCorrupt = val; } + bool IsCorrupt() { return m_isCorrupt; } + void SetIsCorrupt(bool val) { m_isCorrupt = val; } - void SetPackId(std::uint32_t id) { m_packId = id; } - std::uint32_t GetPackId() { return m_packId; } + void SetPackId(std::uint32_t id) { m_packId = id; } + std::uint32_t GetPackId() { return m_packId; } - void SetPackVersion(std::uint32_t version) { m_packVersion = version; } - std::uint32_t GetPackVersion() { return m_packVersion; } + void SetPackVersion(std::uint32_t version) { m_packVersion = version; } + std::uint32_t GetPackVersion() { return m_packVersion; } - DLCPack * GetParentPack() { return m_parentPack; } - std::uint32_t GetParentPackId() { return m_parentPack->m_packId; } + DLCPack* GetParentPack() { return m_parentPack; } + std::uint32_t GetParentPackId() { return m_parentPack->m_packId; } - void SetDLCMountIndex(int id) { m_dlcMountIndex = id; } - int GetDLCMountIndex(); - void SetDLCDeviceID(XCONTENTDEVICEID deviceId) { m_dlcDeviceID = deviceId; } - XCONTENTDEVICEID GetDLCDeviceID(); + void SetDLCMountIndex(int id) { m_dlcMountIndex = id; } + int GetDLCMountIndex(); + void SetDLCDeviceID(XCONTENTDEVICEID deviceId) { m_dlcDeviceID = deviceId; } + XCONTENTDEVICEID GetDLCDeviceID(); - void addChildPack(DLCPack *childPack); - void setParentPack(DLCPack *parentPack); + void addChildPack(DLCPack* childPack); + void setParentPack(DLCPack* parentPack); - void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value); - bool getParameterAsUInt(DLCManager::EDLCParameterType type, unsigned int ¶m); + void addParameter(DLCManager::EDLCParameterType type, + const std::wstring& value); + bool getParameterAsUInt(DLCManager::EDLCParameterType type, + unsigned int& param); - void updateLicenseMask(std::uint32_t dwLicenseMask) { m_dwLicenseMask = dwLicenseMask; } - std::uint32_t getLicenseMask() { return m_dwLicenseMask; } - - std::wstring getName() { return m_packName; } + void updateLicenseMask(std::uint32_t dwLicenseMask) { + m_dwLicenseMask = dwLicenseMask; + } + std::uint32_t getLicenseMask() { return m_dwLicenseMask; } + + std::wstring getName() { return m_packName; } + + void UpdateLanguage(); #ifdef _XBOX_ONE - std::wstring getPurchaseOfferId() { return m_wsProductId; } + std::wstring getPurchaseOfferId() { return m_wsProductId; } #else - ULONGLONG getPurchaseOfferId() { return m_ullFullOfferId; } + ULONGLONG getPurchaseOfferId() { return m_ullFullOfferId; } #endif - DLCFile *addFile(DLCManager::EDLCType type, const std::wstring &path); - DLCFile *getFile(DLCManager::EDLCType type, unsigned int index); - DLCFile *getFile(DLCManager::EDLCType type, const std::wstring &path); + DLCFile* addFile(DLCManager::EDLCType type, const std::wstring& path); + DLCFile* getFile(DLCManager::EDLCType type, unsigned int index); + DLCFile* getFile(DLCManager::EDLCType type, const std::wstring& path); - unsigned int getDLCItemsCount(DLCManager::EDLCType type = DLCManager::e_DLCType_All); - unsigned int getFileIndexAt(DLCManager::EDLCType type, const std::wstring &path, bool &found); - bool doesPackContainFile(DLCManager::EDLCType type, const std::wstring &path); - std::uint32_t GetPackID() {return m_packId;} - - unsigned int getSkinCount() { return getDLCItemsCount(DLCManager::e_DLCType_Skin); } - unsigned int getSkinIndexAt(const std::wstring &path, bool &found) { return getFileIndexAt(DLCManager::e_DLCType_Skin, path, found); } - DLCSkinFile *getSkinFile(const std::wstring &path) { return (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, path); } - DLCSkinFile *getSkinFile(unsigned int index) { return (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, index); } - bool doesPackContainSkin(const std::wstring &path) { return doesPackContainFile(DLCManager::e_DLCType_Skin, path); } + unsigned int getDLCItemsCount( + DLCManager::EDLCType type = DLCManager::e_DLCType_All); + unsigned int getFileIndexAt(DLCManager::EDLCType type, + const std::wstring& path, bool& found); + bool doesPackContainFile(DLCManager::EDLCType type, + const std::wstring& path); + std::uint32_t GetPackID() { return m_packId; } - bool hasPurchasedFile(DLCManager::EDLCType type, const std::wstring &path); + unsigned int getSkinCount() { + return getDLCItemsCount(DLCManager::e_DLCType_Skin); + } + unsigned int getSkinIndexAt(const std::wstring& path, bool& found) { + return getFileIndexAt(DLCManager::e_DLCType_Skin, path, found); + } + DLCSkinFile* getSkinFile(const std::wstring& path) { + return (DLCSkinFile*)getFile(DLCManager::e_DLCType_Skin, path); + } + DLCSkinFile* getSkinFile(unsigned int index) { + return (DLCSkinFile*)getFile(DLCManager::e_DLCType_Skin, index); + } + bool doesPackContainSkin(const std::wstring& path) { + return doesPackContainFile(DLCManager::e_DLCType_Skin, path); + } + + bool hasPurchasedFile(DLCManager::EDLCType type, const std::wstring& path); }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp index 6d82d0d57..da9e7df83 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp @@ -7,166 +7,150 @@ #include "../../Minecraft.World/Player/Player.h" #include "../../Minecraft.World/Util/StringHelpers.h" -DLCSkinFile::DLCSkinFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_Skin,path) -{ - m_displayName = L""; - m_themeName = L""; - m_cape = L""; - m_bIsFree = false; - m_uiAnimOverrideBitmask=0L; +DLCSkinFile::DLCSkinFile(const std::wstring& path) + : DLCFile(DLCManager::e_DLCType_Skin, path) { + m_displayName = L""; + m_themeName = L""; + m_cape = L""; + m_bIsFree = false; + m_uiAnimOverrideBitmask = 0L; } -void DLCSkinFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes) -{ - app.AddMemoryTextureFile(m_path,pbData,dataBytes); +void DLCSkinFile::addData(std::uint8_t* pbData, std::uint32_t dataBytes) { + app.AddMemoryTextureFile(m_path, pbData, dataBytes); } -void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const std::wstring &value) -{ - switch(type) - { - case DLCManager::e_DLCParamType_DisplayName: - { - // 4J Stu - In skin pack 2, the name for Zap is mis-spelt with two p's as Zapp - // dlcskin00000109.png - if( m_path.compare(L"dlcskin00000109.png") == 0) - { - m_displayName = L"Zap"; - } - else - { - m_displayName = value; - } - } - break; - case DLCManager::e_DLCParamType_ThemeName: - m_themeName = value; - break; - case DLCManager::e_DLCParamType_Free: // If this parameter exists, then mark this as free - m_bIsFree = true; - break; - case DLCManager::e_DLCParamType_Credit: // If this parameter exists, then mark this as free - //add it to the DLC credits list +void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, + const std::wstring& value) { + switch (type) { + case DLCManager::e_DLCParamType_DisplayName: { + // 4J Stu - In skin pack 2, the name for Zap is mis-spelt with two + // p's as Zapp dlcskin00000109.png + if (m_path.compare(L"dlcskin00000109.png") == 0) { + m_displayName = L"Zap"; + } else { + m_displayName = value; + } + } break; + case DLCManager::e_DLCParamType_ThemeName: + m_themeName = value; + break; + case DLCManager::e_DLCParamType_Free: // If this parameter exists, then + // mark this as free + m_bIsFree = true; + break; + case DLCManager::e_DLCParamType_Credit: // If this parameter exists, + // then mark this as free + // add it to the DLC credits + // list - // we'll need to justify this text since we don't have a lot of room for lines of credits - { - if(app.AlreadySeenCreditText(value)) break; - // first add a blank string for spacing - app.AddCreditText(L""); + // we'll need to justify this text since we don't have a lot of room + // for lines of credits + { + if (app.AlreadySeenCreditText(value)) break; + // first add a blank string for spacing + app.AddCreditText(L""); - int maximumChars = 55; + int maximumChars = 55; - bool bIsSDMode=!RenderManager.IsHiDef() && !RenderManager.IsWidescreen(); + bool bIsSDMode = + !RenderManager.IsHiDef() && !RenderManager.IsWidescreen(); - if(bIsSDMode) - { - maximumChars = 45; - } + if (bIsSDMode) { + maximumChars = 45; + } - switch(XGetLanguage()) - { - case XC_LANGUAGE_JAPANESE: - case XC_LANGUAGE_TCHINESE: - case XC_LANGUAGE_KOREAN: - maximumChars = 35; - break; - default: - break; - } - std::wstring creditValue = value; - while (creditValue.length() > maximumChars) - { - unsigned int i = 1; - while (i < creditValue.length() && (i + 1) <= maximumChars) - { - i++; - } - int iLast=(int)creditValue.find_last_of(L" ",i); - switch(XGetLanguage()) - { - case XC_LANGUAGE_JAPANESE: - case XC_LANGUAGE_TCHINESE: - case XC_LANGUAGE_KOREAN: - iLast = maximumChars; - break; - default: - iLast=(int)creditValue.find_last_of(L" ",i); - break; - } + switch (XGetLanguage()) { + case XC_LANGUAGE_JAPANESE: + case XC_LANGUAGE_TCHINESE: + case XC_LANGUAGE_KOREAN: + maximumChars = 35; + break; + default: + break; + } + std::wstring creditValue = value; + while (creditValue.length() > maximumChars) { + unsigned int i = 1; + while (i < creditValue.length() && + (i + 1) <= maximumChars) { + i++; + } + int iLast = (int)creditValue.find_last_of(L" ", i); + switch (XGetLanguage()) { + case XC_LANGUAGE_JAPANESE: + case XC_LANGUAGE_TCHINESE: + case XC_LANGUAGE_KOREAN: + iLast = maximumChars; + break; + default: + iLast = (int)creditValue.find_last_of(L" ", i); + break; + } - // if a space was found, include the space on this line - if(iLast!=i) - { - iLast++; - } - - app.AddCreditText((creditValue.substr(0, iLast)).c_str()); - creditValue = creditValue.substr(iLast); - } - app.AddCreditText(creditValue.c_str()); + // if a space was found, include the space on this line + if (iLast != i) { + iLast++; + } - } - break; - case DLCManager::e_DLCParamType_Cape: - m_cape = value; - break; - case DLCManager::e_DLCParamType_Box: - { - WCHAR wchBodyPart[10]; - SKIN_BOX *pSkinBox = new SKIN_BOX; - ZeroMemory(pSkinBox,sizeof(SKIN_BOX)); + app.AddCreditText((creditValue.substr(0, iLast)).c_str()); + creditValue = creditValue.substr(iLast); + } + app.AddCreditText(creditValue.c_str()); + } + break; + case DLCManager::e_DLCParamType_Cape: + m_cape = value; + break; + case DLCManager::e_DLCParamType_Box: { + WCHAR wchBodyPart[10]; + SKIN_BOX* pSkinBox = new SKIN_BOX; + ZeroMemory(pSkinBox, sizeof(SKIN_BOX)); - // 4J Stu - The Xbox version used swscanf_s which isn't available in GCC. - swscanf(value.c_str(), L"%10ls%f%f%f%f%f%f%f%f", wchBodyPart, - &pSkinBox->fX, - &pSkinBox->fY, - &pSkinBox->fZ, - &pSkinBox->fW, - &pSkinBox->fH, - &pSkinBox->fD, - &pSkinBox->fU, - &pSkinBox->fV); - - if(wcscmp(wchBodyPart,L"HEAD")==0) - { - pSkinBox->ePart=eBodyPart_Head; - } - else if(wcscmp(wchBodyPart,L"BODY")==0) - { - pSkinBox->ePart=eBodyPart_Body; - } - else if(wcscmp(wchBodyPart,L"ARM0")==0) - { - pSkinBox->ePart=eBodyPart_Arm0; - } - else if(wcscmp(wchBodyPart,L"ARM1")==0) - { - pSkinBox->ePart=eBodyPart_Arm1; - } - else if(wcscmp(wchBodyPart,L"LEG0")==0) - { - pSkinBox->ePart=eBodyPart_Leg0; - } - else if(wcscmp(wchBodyPart,L"LEG1")==0) - { - pSkinBox->ePart=eBodyPart_Leg1; - } +#ifdef __PS3__ + // 4J Stu - The Xbox version used swscanf_s which isn't available in + // GCC. + swscanf(value.c_str(), L"%10ls%f%f%f%f%f%f%f%f", wchBodyPart, +#else + swscanf_s( + value.c_str(), L"%9ls%f%f%f%f%f%f%f%f", wchBodyPart, 10, +#endif + &pSkinBox->fX, &pSkinBox->fY, &pSkinBox->fZ, &pSkinBox->fW, + &pSkinBox->fH, &pSkinBox->fD, &pSkinBox->fU, &pSkinBox->fV); - // add this to the skin's vector of parts - m_AdditionalBoxes.push_back(pSkinBox); - } - break; - case DLCManager::e_DLCParamType_Anim: - { - // 4J Stu - The Xbox version used swscanf_s which isn't available in GCC. - swscanf(value.c_str(), L"%X", &m_uiAnimOverrideBitmask); - std::uint32_t skinId = app.getSkinIdFromPath(m_path); - app.SetAnimOverrideBitmask(skinId, m_uiAnimOverrideBitmask); - } - break; - default: - break; - } + if (wcscmp(wchBodyPart, L"HEAD") == 0) { + pSkinBox->ePart = eBodyPart_Head; + } else if (wcscmp(wchBodyPart, L"BODY") == 0) { + pSkinBox->ePart = eBodyPart_Body; + } else if (wcscmp(wchBodyPart, L"ARM0") == 0) { + pSkinBox->ePart = eBodyPart_Arm0; + } else if (wcscmp(wchBodyPart, L"ARM1") == 0) { + pSkinBox->ePart = eBodyPart_Arm1; + } else if (wcscmp(wchBodyPart, L"LEG0") == 0) { + pSkinBox->ePart = eBodyPart_Leg0; + } else if (wcscmp(wchBodyPart, L"LEG1") == 0) { + pSkinBox->ePart = eBodyPart_Leg1; + } + + // add this to the skin's vector of parts + m_AdditionalBoxes.push_back(pSkinBox); + } break; + case DLCManager::e_DLCParamType_Anim: { +#ifdef __PS3__ + // 4J Stu - The Xbox version used swscanf_s which isn't available in + // GCC. + swscanf(value.c_str(), L"%X", &m_uiAnimOverrideBitmask); +#else + swscanf_s(value.c_str(), L"%X", &m_uiAnimOverrideBitmask, + sizeof(unsigned int)); +#endif + DWORD skinId = app.getSkinIdFromPath(m_path); + app.SetAnimOverrideBitmask(skinId, m_uiAnimOverrideBitmask); + break; + } + default: + break; + } } // std::vector *DLCSkinFile::getAdditionalModelParts() @@ -174,37 +158,32 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const std::ws // return &m_AdditionalModelParts; // } -int DLCSkinFile::getAdditionalBoxesCount() -{ - return (int)m_AdditionalBoxes.size(); +int DLCSkinFile::getAdditionalBoxesCount() { + return (int)m_AdditionalBoxes.size(); } -std::vector *DLCSkinFile::getAdditionalBoxes() -{ - return &m_AdditionalBoxes; +std::vector* DLCSkinFile::getAdditionalBoxes() { + return &m_AdditionalBoxes; } -std::wstring DLCSkinFile::getParameterAsString(DLCManager::EDLCParameterType type) -{ - switch(type) - { - case DLCManager::e_DLCParamType_DisplayName: - return m_displayName; - case DLCManager::e_DLCParamType_ThemeName: - return m_themeName; - case DLCManager::e_DLCParamType_Cape: - return m_cape; - default: - return L""; - } +std::wstring DLCSkinFile::getParameterAsString( + DLCManager::EDLCParameterType type) { + switch (type) { + case DLCManager::e_DLCParamType_DisplayName: + return m_displayName; + case DLCManager::e_DLCParamType_ThemeName: + return m_themeName; + case DLCManager::e_DLCParamType_Cape: + return m_cape; + default: + return L""; + } } -bool DLCSkinFile::getParameterAsBool(DLCManager::EDLCParameterType type) -{ - switch(type) - { - case DLCManager::e_DLCParamType_Free: - return m_bIsFree; - default: - return false; - } +bool DLCSkinFile::getParameterAsBool(DLCManager::EDLCParameterType type) { + switch (type) { + case DLCManager::e_DLCParamType_Free: + return m_bIsFree; + default: + return false; + } } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.h b/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.h index 9a41b7d44..c0facea6c 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.h @@ -2,28 +2,27 @@ #include "DLCFile.h" #include "../../Minecraft.Client/Rendering/Models/HumanoidModel.h" -class DLCSkinFile : public DLCFile -{ - +class DLCSkinFile : public DLCFile { private: - std::wstring m_displayName; - std::wstring m_themeName; - std::wstring m_cape; - unsigned int m_uiAnimOverrideBitmask; - bool m_bIsFree; - std::vector m_AdditionalBoxes; + std::wstring m_displayName; + std::wstring m_themeName; + std::wstring m_cape; + unsigned int m_uiAnimOverrideBitmask; + bool m_bIsFree; + std::vector m_AdditionalBoxes; public: + DLCSkinFile(const std::wstring& path); - DLCSkinFile(const std::wstring &path); + virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes); + virtual void addParameter(DLCManager::EDLCParameterType type, + const std::wstring& value); - virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes); - virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value); - - virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type); - virtual bool getParameterAsBool(DLCManager::EDLCParameterType type); - std::vector *getAdditionalBoxes(); - int getAdditionalBoxesCount(); - unsigned int getAnimOverrideBitmask() { return m_uiAnimOverrideBitmask;} - bool isFree() {return m_bIsFree;} + virtual std::wstring getParameterAsString( + DLCManager::EDLCParameterType type); + virtual bool getParameterAsBool(DLCManager::EDLCParameterType type); + std::vector* getAdditionalBoxes(); + int getAdditionalBoxesCount(); + unsigned int getAnimOverrideBitmask() { return m_uiAnimOverrideBitmask; } + bool isFree() { return m_bIsFree; } }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.cpp index 7f8a500fe..2b01d492d 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.cpp @@ -2,60 +2,54 @@ #include "DLCManager.h" #include "DLCTextureFile.h" -DLCTextureFile::DLCTextureFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_Texture,path) -{ - m_bIsAnim = false; - m_animString = L""; - - m_pbData = NULL; - m_dataBytes = 0; +DLCTextureFile::DLCTextureFile(const std::wstring& path) + : DLCFile(DLCManager::e_DLCType_Texture, path) { + m_bIsAnim = false; + m_animString = L""; + + m_pbData = NULL; + m_dataBytes = 0; } -void DLCTextureFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes) -{ - //app.AddMemoryTextureFile(m_path,pbData,dwBytes); - m_pbData = pbData; - m_dataBytes = dataBytes; +void DLCTextureFile::addData(std::uint8_t* pbData, std::uint32_t dataBytes) { + // app.AddMemoryTextureFile(m_path,pbData,dwBytes); + m_pbData = pbData; + m_dataBytes = dataBytes; } -std::uint8_t *DLCTextureFile::getData(std::uint32_t &dataBytes) -{ - dataBytes = m_dataBytes; - return m_pbData; +std::uint8_t* DLCTextureFile::getData(std::uint32_t& dataBytes) { + dataBytes = m_dataBytes; + return m_pbData; } -void DLCTextureFile::addParameter(DLCManager::EDLCParameterType type, const std::wstring &value) -{ - switch(type) - { - case DLCManager::e_DLCParamType_Anim: - m_animString = value; - m_bIsAnim = true; +void DLCTextureFile::addParameter(DLCManager::EDLCParameterType type, + const std::wstring& value) { + switch (type) { + case DLCManager::e_DLCParamType_Anim: + m_animString = value; + m_bIsAnim = true; - break; - default: - break; - } + break; + default: + break; + } } -std::wstring DLCTextureFile::getParameterAsString(DLCManager::EDLCParameterType type) -{ - switch(type) - { - case DLCManager::e_DLCParamType_Anim: - return m_animString; - default: - return L""; - } +std::wstring DLCTextureFile::getParameterAsString( + DLCManager::EDLCParameterType type) { + switch (type) { + case DLCManager::e_DLCParamType_Anim: + return m_animString; + default: + return L""; + } } -bool DLCTextureFile::getParameterAsBool(DLCManager::EDLCParameterType type) -{ - switch(type) - { - case DLCManager::e_DLCParamType_Anim: - return m_bIsAnim; - default: - return false; - } +bool DLCTextureFile::getParameterAsBool(DLCManager::EDLCParameterType type) { + switch (type) { + case DLCManager::e_DLCParamType_Anim: + return m_bIsAnim; + default: + return false; + } } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.h b/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.h index baec5e951..bb25336ab 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCTextureFile.h @@ -1,24 +1,24 @@ #pragma once #include "DLCFile.h" -class DLCTextureFile : public DLCFile -{ - +class DLCTextureFile : public DLCFile { private: - bool m_bIsAnim; - std::wstring m_animString; + bool m_bIsAnim; + std::wstring m_animString; - std::uint8_t *m_pbData; - std::uint32_t m_dataBytes; + std::uint8_t* m_pbData; + std::uint32_t m_dataBytes; public: - DLCTextureFile(const std::wstring &path); + DLCTextureFile(const std::wstring& path); - virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes); - virtual std::uint8_t *getData(std::uint32_t &dataBytes); + virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes); + virtual std::uint8_t* getData(std::uint32_t& dataBytes); - virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value); + virtual void addParameter(DLCManager::EDLCParameterType type, + const std::wstring& value); - virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type); - virtual bool getParameterAsBool(DLCManager::EDLCParameterType type); + virtual std::wstring getParameterAsString( + DLCManager::EDLCParameterType type); + virtual bool getParameterAsBool(DLCManager::EDLCParameterType type); }; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.cpp index eb6d28220..4ea2138c0 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.cpp @@ -2,31 +2,28 @@ #include "DLCManager.h" #include "DLCUIDataFile.h" -DLCUIDataFile::DLCUIDataFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_UIData,path) -{ - m_pbData = NULL; - m_dataBytes = 0; - m_canDeleteData = false; +DLCUIDataFile::DLCUIDataFile(const std::wstring& path) + : DLCFile(DLCManager::e_DLCType_UIData, path) { + m_pbData = NULL; + m_dataBytes = 0; + m_canDeleteData = false; } -DLCUIDataFile::~DLCUIDataFile() -{ - if(m_canDeleteData && m_pbData != NULL) - { - app.DebugPrintf("Deleting DLCUIDataFile data\n"); - delete [] m_pbData; - } +DLCUIDataFile::~DLCUIDataFile() { + if (m_canDeleteData && m_pbData != NULL) { + app.DebugPrintf("Deleting DLCUIDataFile data\n"); + delete[] m_pbData; + } } -void DLCUIDataFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes,bool canDeleteData) -{ - m_pbData = pbData; - m_dataBytes = dataBytes; - m_canDeleteData = canDeleteData; +void DLCUIDataFile::addData(std::uint8_t* pbData, std::uint32_t dataBytes, + bool canDeleteData) { + m_pbData = pbData; + m_dataBytes = dataBytes; + m_canDeleteData = canDeleteData; } -std::uint8_t *DLCUIDataFile::getData(std::uint32_t &dataBytes) -{ - dataBytes = m_dataBytes; - return m_pbData; +std::uint8_t* DLCUIDataFile::getData(std::uint32_t& dataBytes) { + dataBytes = m_dataBytes; + return m_pbData; } diff --git a/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.h b/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.h index a1ee86308..9676ac0dd 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.h +++ b/Minecraft.Client/Platform/Common/DLC/DLCUIDataFile.h @@ -1,20 +1,20 @@ #pragma once #include "DLCFile.h" -class DLCUIDataFile : public DLCFile -{ +class DLCUIDataFile : public DLCFile { private: - std::uint8_t *m_pbData; - std::uint32_t m_dataBytes; - bool m_canDeleteData; + std::uint8_t* m_pbData; + std::uint32_t m_dataBytes; + bool m_canDeleteData; public: - DLCUIDataFile(const std::wstring &path); - ~DLCUIDataFile(); + DLCUIDataFile(const std::wstring& path); + ~DLCUIDataFile(); - using DLCFile::addData; - using DLCFile::addParameter; + using DLCFile::addData; + using DLCFile::addParameter; - virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes,bool canDeleteData = false); - virtual std::uint8_t *getData(std::uint32_t &dataBytes); + virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes, + bool canDeleteData = false); + virtual std::uint8_t* getData(std::uint32_t& dataBytes); }; diff --git a/Minecraft.Client/Platform/Common/GameRules/AddEnchantmentRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/AddEnchantmentRuleDefinition.cpp index 4bd79aa8e..7183d4e29 100644 --- a/Minecraft.Client/Platform/Common/GameRules/AddEnchantmentRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/AddEnchantmentRuleDefinition.cpp @@ -4,67 +4,64 @@ #include "../../Minecraft.World/Headers/net.minecraft.world.item.enchantment.h" #include "AddEnchantmentRuleDefinition.h" -AddEnchantmentRuleDefinition::AddEnchantmentRuleDefinition() -{ - m_enchantmentId = m_enchantmentLevel = 0; +AddEnchantmentRuleDefinition::AddEnchantmentRuleDefinition() { + m_enchantmentId = m_enchantmentLevel = 0; } -void AddEnchantmentRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes) -{ - GameRuleDefinition::writeAttributes(dos, numAttributes + 2); +void AddEnchantmentRuleDefinition::writeAttributes(DataOutputStream* dos, + unsigned int numAttributes) { + GameRuleDefinition::writeAttributes(dos, numAttributes + 2); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentId); - dos->writeUTF( _toString( m_enchantmentId ) ); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentId); + dos->writeUTF(_toString(m_enchantmentId)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentLevel); - dos->writeUTF( _toString( m_enchantmentLevel ) ); + ConsoleGameRules::write(dos, + ConsoleGameRules::eGameRuleAttr_enchantmentLevel); + dos->writeUTF(_toString(m_enchantmentLevel)); } -void AddEnchantmentRuleDefinition::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) -{ - if(attributeName.compare(L"enchantmentId") == 0) - { - int value = _fromString(attributeValue); - if(value < 0) value = 0; - if(value >= 256) value = 255; - m_enchantmentId = value; - app.DebugPrintf("AddEnchantmentRuleDefinition: Adding parameter enchantmentId=%d\n",m_enchantmentId); - } - else if(attributeName.compare(L"enchantmentLevel") == 0) - { - int value = _fromString(attributeValue); - if(value < 0) value = 0; - m_enchantmentLevel = value; - app.DebugPrintf("AddEnchantmentRuleDefinition: Adding parameter enchantmentLevel=%d\n",m_enchantmentLevel); - } - else - { - GameRuleDefinition::addAttribute(attributeName, attributeValue); - } +void AddEnchantmentRuleDefinition::addAttribute( + const std::wstring& attributeName, const std::wstring& attributeValue) { + if (attributeName.compare(L"enchantmentId") == 0) { + int value = _fromString(attributeValue); + if (value < 0) value = 0; + if (value >= 256) value = 255; + m_enchantmentId = value; + app.DebugPrintf( + "AddEnchantmentRuleDefinition: Adding parameter enchantmentId=%d\n", + m_enchantmentId); + } else if (attributeName.compare(L"enchantmentLevel") == 0) { + int value = _fromString(attributeValue); + if (value < 0) value = 0; + m_enchantmentLevel = value; + app.DebugPrintf( + "AddEnchantmentRuleDefinition: Adding parameter " + "enchantmentLevel=%d\n", + m_enchantmentLevel); + } else { + GameRuleDefinition::addAttribute(attributeName, attributeValue); + } } -bool AddEnchantmentRuleDefinition::enchantItem(std::shared_ptr item) -{ - bool enchanted = false; - if (item != NULL) - { - // 4J-JEV: Ripped code from enchantmenthelpers - // Maybe we want to add an addEnchantment method to EnchantmentHelpers - if (item->id == Item::enchantedBook_Id) - { - Item::enchantedBook->addEnchantment( item, new EnchantmentInstance(m_enchantmentId, m_enchantmentLevel) ); - } - else if (item->isEnchantable()) - { - Enchantment *e = Enchantment::enchantments[m_enchantmentId]; +bool AddEnchantmentRuleDefinition::enchantItem( + std::shared_ptr item) { + bool enchanted = false; + if (item != NULL) { + // 4J-JEV: Ripped code from enchantmenthelpers + // Maybe we want to add an addEnchantment method to EnchantmentHelpers + if (item->id == Item::enchantedBook_Id) { + Item::enchantedBook->addEnchantment( + item, + new EnchantmentInstance(m_enchantmentId, m_enchantmentLevel)); + } else if (item->isEnchantable()) { + Enchantment* e = Enchantment::enchantments[m_enchantmentId]; - if(e != NULL && e->category->canEnchant(item->getItem())) - { - int level = std::min(e->getMaxLevel(), m_enchantmentLevel); - item->enchant(e, m_enchantmentLevel); - enchanted = true; - } - } - } - return enchanted; + if (e != NULL && e->category->canEnchant(item->getItem())) { + int level = std::min(e->getMaxLevel(), m_enchantmentLevel); + item->enchant(e, m_enchantmentLevel); + enchanted = true; + } + } + } + return enchanted; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/AddEnchantmentRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/AddEnchantmentRuleDefinition.h index d939c0f96..64bdb86c0 100644 --- a/Minecraft.Client/Platform/Common/GameRules/AddEnchantmentRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/AddEnchantmentRuleDefinition.h @@ -4,20 +4,22 @@ class ItemInstance; -class AddEnchantmentRuleDefinition : public GameRuleDefinition -{ +class AddEnchantmentRuleDefinition : public GameRuleDefinition { private: - int m_enchantmentId; - int m_enchantmentLevel; + int m_enchantmentId; + int m_enchantmentLevel; public: - AddEnchantmentRuleDefinition(); + AddEnchantmentRuleDefinition(); - virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_AddEnchantment; } + virtual ConsoleGameRules::EGameRuleType getActionType() { + return ConsoleGameRules::eGameRuleType_AddEnchantment; + } - virtual void writeAttributes(DataOutputStream *, unsigned int numAttrs); + virtual void writeAttributes(DataOutputStream*, unsigned int numAttrs); - virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); + virtual void addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue); - bool enchantItem(std::shared_ptr item); + bool enchantItem(std::shared_ptr item); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.cpp index 7ae0aecf9..94e5ee596 100644 --- a/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.cpp @@ -6,122 +6,110 @@ #include "AddItemRuleDefinition.h" #include "AddEnchantmentRuleDefinition.h" -AddItemRuleDefinition::AddItemRuleDefinition() -{ - m_itemId = m_quantity = m_auxValue = m_dataTag = 0; - m_slot = -1; +AddItemRuleDefinition::AddItemRuleDefinition() { + m_itemId = m_quantity = m_auxValue = m_dataTag = 0; + m_slot = -1; } -void AddItemRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) -{ - GameRuleDefinition::writeAttributes(dos, numAttrs + 5); +void AddItemRuleDefinition::writeAttributes(DataOutputStream* dos, + unsigned int numAttrs) { + GameRuleDefinition::writeAttributes(dos, numAttrs + 5); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId); - dos->writeUTF( _toString( m_itemId ) ); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId); + dos->writeUTF(_toString(m_itemId)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity); - dos->writeUTF( _toString( m_quantity ) ); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity); + dos->writeUTF(_toString(m_quantity)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue); - dos->writeUTF( _toString( m_auxValue ) ); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue); + dos->writeUTF(_toString(m_auxValue)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag); - dos->writeUTF( _toString( m_dataTag ) ); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag); + dos->writeUTF(_toString(m_dataTag)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_slot); - dos->writeUTF( _toString( m_slot ) ); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_slot); + dos->writeUTF(_toString(m_slot)); } -void AddItemRuleDefinition::getChildren(std::vector *children) -{ - GameRuleDefinition::getChildren( children ); - for (AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); it++) - children->push_back( *it ); +void AddItemRuleDefinition::getChildren( + std::vector* children) { + GameRuleDefinition::getChildren(children); + for (AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); it++) + children->push_back(*it); } -GameRuleDefinition *AddItemRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType) -{ - GameRuleDefinition *rule = NULL; - if(ruleType == ConsoleGameRules::eGameRuleType_AddEnchantment) - { - rule = new AddEnchantmentRuleDefinition(); - m_enchantments.push_back((AddEnchantmentRuleDefinition *)rule); - } - else - { +GameRuleDefinition* AddItemRuleDefinition::addChild( + ConsoleGameRules::EGameRuleType ruleType) { + GameRuleDefinition* rule = NULL; + if (ruleType == ConsoleGameRules::eGameRuleType_AddEnchantment) { + rule = new AddEnchantmentRuleDefinition(); + m_enchantments.push_back((AddEnchantmentRuleDefinition*)rule); + } else { #ifndef _CONTENT_PACKAGE - //wprintf(L"AddItemRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType ); + // wprintf(L"AddItemRuleDefinition: Attempted to add invalid child rule + // - %d\n", ruleType ); #endif - } - return rule; + } + return rule; } -void AddItemRuleDefinition::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) -{ - if(attributeName.compare(L"itemId") == 0) - { - int value = _fromString(attributeValue); - m_itemId = value; - //app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter itemId=%d\n",m_itemId); - } - else if(attributeName.compare(L"quantity") == 0) - { - int value = _fromString(attributeValue); - m_quantity = value; - //app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter quantity=%d\n",m_quantity); - } - else if(attributeName.compare(L"auxValue") == 0) - { - int value = _fromString(attributeValue); - m_auxValue = value; - //app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter auxValue=%d\n",m_auxValue); - } - else if(attributeName.compare(L"dataTag") == 0) - { - int value = _fromString(attributeValue); - m_dataTag = value; - //app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter dataTag=%d\n",m_dataTag); - } - else if(attributeName.compare(L"slot") == 0) - { - int value = _fromString(attributeValue); - m_slot = value; - //app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter slot=%d\n",m_slot); - } - else - { - GameRuleDefinition::addAttribute(attributeName, attributeValue); - } +void AddItemRuleDefinition::addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue) { + if (attributeName.compare(L"itemId") == 0) { + int value = _fromString(attributeValue); + m_itemId = value; + // app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter + // itemId=%d\n",m_itemId); + } else if (attributeName.compare(L"quantity") == 0) { + int value = _fromString(attributeValue); + m_quantity = value; + // app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter + // quantity=%d\n",m_quantity); + } else if (attributeName.compare(L"auxValue") == 0) { + int value = _fromString(attributeValue); + m_auxValue = value; + // app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter + // auxValue=%d\n",m_auxValue); + } else if (attributeName.compare(L"dataTag") == 0) { + int value = _fromString(attributeValue); + m_dataTag = value; + // app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter + // dataTag=%d\n",m_dataTag); + } else if (attributeName.compare(L"slot") == 0) { + int value = _fromString(attributeValue); + m_slot = value; + // app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter + // slot=%d\n",m_slot); + } else { + GameRuleDefinition::addAttribute(attributeName, attributeValue); + } } -bool AddItemRuleDefinition::addItemToContainer(std::shared_ptr container, int slotId) -{ - bool added = false; - if(Item::items[m_itemId] != NULL) - { - int quantity = std::min(m_quantity, Item::items[m_itemId]->getMaxStackSize()); - std::shared_ptr newItem = std::shared_ptr(new ItemInstance(m_itemId,quantity,m_auxValue) ); - newItem->set4JData(m_dataTag); +bool AddItemRuleDefinition::addItemToContainer( + std::shared_ptr container, int slotId) { + bool added = false; + if (Item::items[m_itemId] != NULL) { + int quantity = + std::min(m_quantity, Item::items[m_itemId]->getMaxStackSize()); + std::shared_ptr newItem = std::shared_ptr( + new ItemInstance(m_itemId, quantity, m_auxValue)); + newItem->set4JData(m_dataTag); - for(AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); ++it) - { - (*it)->enchantItem(newItem); - } + for (AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); + ++it) { + (*it)->enchantItem(newItem); + } - if(m_slot >= 0 && m_slot < container->getContainerSize() ) - { - container->setItem( m_slot, newItem ); - added = true; - } - else if(slotId >= 0 && slotId < container->getContainerSize() ) - { - container->setItem( slotId, newItem ); - added = true; - } - else if(std::dynamic_pointer_cast(container) != NULL) - { - added = std::dynamic_pointer_cast(container)->add(newItem); - } - } - return added; + if (m_slot >= 0 && m_slot < container->getContainerSize()) { + container->setItem(m_slot, newItem); + added = true; + } else if (slotId >= 0 && slotId < container->getContainerSize()) { + container->setItem(slotId, newItem); + added = true; + } else if (std::dynamic_pointer_cast(container) != NULL) { + added = + std::dynamic_pointer_cast(container)->add(newItem); + } + } + return added; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.h index d4863ec9b..adbaabf62 100644 --- a/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.h @@ -5,26 +5,29 @@ class Container; class AddEnchantmentRuleDefinition; -class AddItemRuleDefinition : public GameRuleDefinition -{ +class AddItemRuleDefinition : public GameRuleDefinition { private: - int m_itemId; - int m_quantity; - int m_auxValue; - int m_dataTag; - int m_slot; - std::vector m_enchantments; + int m_itemId; + int m_quantity; + int m_auxValue; + int m_dataTag; + int m_slot; + std::vector m_enchantments; public: - AddItemRuleDefinition(); + AddItemRuleDefinition(); - virtual void writeAttributes(DataOutputStream *, unsigned int numAttributes); - virtual void getChildren(std::vector *children); + virtual void writeAttributes(DataOutputStream*, unsigned int numAttributes); + virtual void getChildren(std::vector* children); - virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_AddItem; } + virtual ConsoleGameRules::EGameRuleType getActionType() { + return ConsoleGameRules::eGameRuleType_AddItem; + } - virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); - virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); + virtual GameRuleDefinition* addChild( + ConsoleGameRules::EGameRuleType ruleType); + virtual void addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue); - bool addItemToContainer(std::shared_ptr container, int slotId); + bool addItemToContainer(std::shared_ptr container, int slotId); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.cpp index 02e8ecc63..e7f25cf69 100644 --- a/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.cpp @@ -9,241 +9,246 @@ #include "LevelGenerationOptions.h" #include "ConsoleSchematicFile.h" -ApplySchematicRuleDefinition::ApplySchematicRuleDefinition(LevelGenerationOptions *levelGenOptions) -{ - m_levelGenOptions = levelGenOptions; - m_location = Vec3::newPermanent(0,0,0); - m_locationBox = NULL; - m_totalBlocksChanged = 0; - m_totalBlocksChangedLighting = 0; - m_rotation = ConsoleSchematicFile::eSchematicRot_0; - m_completed = false; - m_dimension = 0; - m_schematic = NULL; +ApplySchematicRuleDefinition::ApplySchematicRuleDefinition( + LevelGenerationOptions* levelGenOptions) { + m_levelGenOptions = levelGenOptions; + m_location = Vec3::newPermanent(0, 0, 0); + m_locationBox = NULL; + m_totalBlocksChanged = 0; + m_totalBlocksChangedLighting = 0; + m_rotation = ConsoleSchematicFile::eSchematicRot_0; + m_completed = false; + m_dimension = 0; + m_schematic = NULL; } -ApplySchematicRuleDefinition::~ApplySchematicRuleDefinition() -{ - app.DebugPrintf("Deleting ApplySchematicRuleDefinition.\n"); - if(!m_completed) m_levelGenOptions->releaseSchematicFile(m_schematicName); - m_schematic = NULL; - delete m_location; +ApplySchematicRuleDefinition::~ApplySchematicRuleDefinition() { + app.DebugPrintf("Deleting ApplySchematicRuleDefinition.\n"); + if (!m_completed) m_levelGenOptions->releaseSchematicFile(m_schematicName); + m_schematic = NULL; + delete m_location; } -void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) -{ - GameRuleDefinition::writeAttributes(dos, numAttrs + 5); +void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream* dos, + unsigned int numAttrs) { + GameRuleDefinition::writeAttributes(dos, numAttrs + 5); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_filename); - dos->writeUTF(m_schematicName); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x); - dos->writeUTF(_toString(m_location->x)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y); - dos->writeUTF(_toString(m_location->y)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z); - dos->writeUTF(_toString(m_location->z)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_rot); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_filename); + dos->writeUTF(m_schematicName); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x); + dos->writeUTF(_toString(m_location->x)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y); + dos->writeUTF(_toString(m_location->y)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z); + dos->writeUTF(_toString(m_location->z)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_rot); - switch (m_rotation) - { - case ConsoleSchematicFile::eSchematicRot_0: dos->writeUTF(_toString( 0 )); break; - case ConsoleSchematicFile::eSchematicRot_90: dos->writeUTF(_toString( 90 )); break; - case ConsoleSchematicFile::eSchematicRot_180: dos->writeUTF(_toString( 180 )); break; - case ConsoleSchematicFile::eSchematicRot_270: dos->writeUTF(_toString( 270 )); break; - } + switch (m_rotation) { + case ConsoleSchematicFile::eSchematicRot_0: + dos->writeUTF(_toString(0)); + break; + case ConsoleSchematicFile::eSchematicRot_90: + dos->writeUTF(_toString(90)); + break; + case ConsoleSchematicFile::eSchematicRot_180: + dos->writeUTF(_toString(180)); + break; + case ConsoleSchematicFile::eSchematicRot_270: + dos->writeUTF(_toString(270)); + break; + } } -void ApplySchematicRuleDefinition::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) -{ - if(attributeName.compare(L"filename") == 0) - { - m_schematicName = attributeValue; - //app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter filename=%s\n",m_schematicName.c_str()); +void ApplySchematicRuleDefinition::addAttribute( + const std::wstring& attributeName, const std::wstring& attributeValue) { + if (attributeName.compare(L"filename") == 0) { + m_schematicName = attributeValue; + // app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter + // filename=%s\n",m_schematicName.c_str()); - if(!m_schematicName.empty()) - { - if(m_schematicName.substr( m_schematicName.length() - 4, m_schematicName.length()).compare(L".sch") != 0) - { - m_schematicName.append(L".sch"); - } - m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); - } - } - else if(attributeName.compare(L"x") == 0) - { - m_location->x = _fromString(attributeValue); - if( ((int)abs(m_location->x))%2 != 0) m_location->x -=1; - //app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter x=%f\n",m_location->x); - } - else if(attributeName.compare(L"y") == 0) - { - m_location->y = _fromString(attributeValue); - if( ((int)abs(m_location->y))%2 != 0) m_location->y -= 1; - if(m_location->y < 0) m_location->y = 0; - //app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter y=%f\n",m_location->y); - } - else if(attributeName.compare(L"z") == 0) - { - m_location->z = _fromString(attributeValue); - if(((int)abs(m_location->z))%2 != 0) m_location->z -= 1; - //app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter z=%f\n",m_location->z); - } - else if(attributeName.compare(L"rot") == 0) - { - int degrees = _fromString(attributeValue); + if (!m_schematicName.empty()) { + if (m_schematicName + .substr(m_schematicName.length() - 4, + m_schematicName.length()) + .compare(L".sch") != 0) { + m_schematicName.append(L".sch"); + } + m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); + } + } else if (attributeName.compare(L"x") == 0) { + m_location->x = _fromString(attributeValue); + if (((int)abs(m_location->x)) % 2 != 0) m_location->x -= 1; + // app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter + // x=%f\n",m_location->x); + } else if (attributeName.compare(L"y") == 0) { + m_location->y = _fromString(attributeValue); + if (((int)abs(m_location->y)) % 2 != 0) m_location->y -= 1; + if (m_location->y < 0) m_location->y = 0; + // app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter + // y=%f\n",m_location->y); + } else if (attributeName.compare(L"z") == 0) { + m_location->z = _fromString(attributeValue); + if (((int)abs(m_location->z)) % 2 != 0) m_location->z -= 1; + // app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter + // z=%f\n",m_location->z); + } else if (attributeName.compare(L"rot") == 0) { + int degrees = _fromString(attributeValue); - while(degrees < 0) degrees += 360; - while(degrees >= 360) degrees -= 360; - float quad = degrees/90; - degrees = (int)(quad + 0.5f); - switch(degrees) - { - case 1: - m_rotation = ConsoleSchematicFile::eSchematicRot_90; - break; - case 2: - m_rotation = ConsoleSchematicFile::eSchematicRot_180; - break; - case 3: - case 4: - m_rotation = ConsoleSchematicFile::eSchematicRot_270; - break; - case 0: - default: - m_rotation = ConsoleSchematicFile::eSchematicRot_0; - break; - }; - - //app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter rot=%d\n",m_rotation); - } - else if(attributeName.compare(L"dim") == 0) - { - m_dimension = _fromString(attributeValue); - if(m_dimension > 1 || m_dimension < -1) m_dimension = 0; - //app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter dimension=%d\n",m_dimension); - } - else - { - GameRuleDefinition::addAttribute(attributeName, attributeValue); - } + while (degrees < 0) degrees += 360; + while (degrees >= 360) degrees -= 360; + float quad = degrees / 90; + degrees = (int)(quad + 0.5f); + switch (degrees) { + case 1: + m_rotation = ConsoleSchematicFile::eSchematicRot_90; + break; + case 2: + m_rotation = ConsoleSchematicFile::eSchematicRot_180; + break; + case 3: + case 4: + m_rotation = ConsoleSchematicFile::eSchematicRot_270; + break; + case 0: + default: + m_rotation = ConsoleSchematicFile::eSchematicRot_0; + break; + }; + + // app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter + // rot=%d\n",m_rotation); + } else if (attributeName.compare(L"dim") == 0) { + m_dimension = _fromString(attributeValue); + if (m_dimension > 1 || m_dimension < -1) m_dimension = 0; + // app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter + // dimension=%d\n",m_dimension); + } else { + GameRuleDefinition::addAttribute(attributeName, attributeValue); + } } -void ApplySchematicRuleDefinition::updateLocationBox() -{ - if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); +void ApplySchematicRuleDefinition::updateLocationBox() { + if (m_schematic == NULL) + m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); - m_locationBox = AABB::newPermanent(0,0,0,0,0,0); + m_locationBox = AABB::newPermanent(0, 0, 0, 0, 0, 0); - m_locationBox->x0 = m_location->x; - m_locationBox->y0 = m_location->y; - m_locationBox->z0 = m_location->z; + m_locationBox->x0 = m_location->x; + m_locationBox->y0 = m_location->y; + m_locationBox->z0 = m_location->z; - m_locationBox->y1 = m_location->y + m_schematic->getYSize(); + m_locationBox->y1 = m_location->y + m_schematic->getYSize(); - switch(m_rotation) - { - case ConsoleSchematicFile::eSchematicRot_90: - case ConsoleSchematicFile::eSchematicRot_270: - m_locationBox->x1 = m_location->x + m_schematic->getZSize(); - m_locationBox->z1 = m_location->z + m_schematic->getXSize(); - break; - case ConsoleSchematicFile::eSchematicRot_0: - case ConsoleSchematicFile::eSchematicRot_180: - default: - m_locationBox->x1 = m_location->x + m_schematic->getXSize(); - m_locationBox->z1 = m_location->z + m_schematic->getZSize(); - break; - }; + switch (m_rotation) { + case ConsoleSchematicFile::eSchematicRot_90: + case ConsoleSchematicFile::eSchematicRot_270: + m_locationBox->x1 = m_location->x + m_schematic->getZSize(); + m_locationBox->z1 = m_location->z + m_schematic->getXSize(); + break; + case ConsoleSchematicFile::eSchematicRot_0: + case ConsoleSchematicFile::eSchematicRot_180: + default: + m_locationBox->x1 = m_location->x + m_schematic->getXSize(); + m_locationBox->z1 = m_location->z + m_schematic->getZSize(); + break; + }; } -void ApplySchematicRuleDefinition::processSchematic(AABB *chunkBox, LevelChunk *chunk) -{ - if( m_completed ) return; - if(chunk->level->dimension->id != m_dimension) return; - - PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition"); - if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); +void ApplySchematicRuleDefinition::processSchematic(AABB* chunkBox, + LevelChunk* chunk) { + if (m_completed) return; + if (chunk->level->dimension->id != m_dimension) return; - if(m_locationBox == NULL) updateLocationBox(); - if(chunkBox->intersects( m_locationBox )) - { - m_locationBox->y1 = std::min((double)Level::maxBuildHeight, m_locationBox->y1 ); + PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition"); + if (m_schematic == NULL) + m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); + + if (m_locationBox == NULL) updateLocationBox(); + if (chunkBox->intersects(m_locationBox)) { + m_locationBox->y1 = + std::min((double)Level::maxBuildHeight, m_locationBox->y1); #ifdef _DEBUG - app.DebugPrintf("Applying schematic %ls to chunk (%d,%d)\n",m_schematicName.c_str(),chunk->x, chunk->z); + app.DebugPrintf("Applying schematic %ls to chunk (%d,%d)\n", + m_schematicName.c_str(), chunk->x, chunk->z); #endif - PIXBeginNamedEvent(0,"Applying blocks and data"); - m_totalBlocksChanged += m_schematic->applyBlocksAndData(chunk, chunkBox, m_locationBox, m_rotation); - PIXEndNamedEvent(); + PIXBeginNamedEvent(0, "Applying blocks and data"); + m_totalBlocksChanged += m_schematic->applyBlocksAndData( + chunk, chunkBox, m_locationBox, m_rotation); + PIXEndNamedEvent(); - // Add the tileEntities - PIXBeginNamedEvent(0,"Applying tile entities"); - m_schematic->applyTileEntities(chunk, chunkBox, m_locationBox, m_rotation); - PIXEndNamedEvent(); + // Add the tileEntities + PIXBeginNamedEvent(0, "Applying tile entities"); + m_schematic->applyTileEntities(chunk, chunkBox, m_locationBox, + m_rotation); + PIXEndNamedEvent(); - // TODO This does not take into account things that go outside the bounds of the world - int targetBlocks = (m_locationBox->x1 - m_locationBox->x0) - * (m_locationBox->y1 - m_locationBox->y0) - * (m_locationBox->z1 - m_locationBox->z0); - if( (m_totalBlocksChanged == targetBlocks) && (m_totalBlocksChangedLighting == targetBlocks) ) - { - m_completed = true; - //m_levelGenOptions->releaseSchematicFile(m_schematicName); - //m_schematic = NULL; - } - } - PIXEndNamedEvent(); + // TODO This does not take into account things that go outside the + // bounds of the world + int targetBlocks = (m_locationBox->x1 - m_locationBox->x0) * + (m_locationBox->y1 - m_locationBox->y0) * + (m_locationBox->z1 - m_locationBox->z0); + if ((m_totalBlocksChanged == targetBlocks) && + (m_totalBlocksChangedLighting == targetBlocks)) { + m_completed = true; + // m_levelGenOptions->releaseSchematicFile(m_schematicName); + // m_schematic = NULL; + } + } + PIXEndNamedEvent(); } -void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, LevelChunk *chunk) -{ - if( m_completed ) return; - if(chunk->level->dimension->id != m_dimension) return; - - PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition (lighting)"); - if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); +void ApplySchematicRuleDefinition::processSchematicLighting(AABB* chunkBox, + LevelChunk* chunk) { + if (m_completed) return; + if (chunk->level->dimension->id != m_dimension) return; - if(m_locationBox == NULL) updateLocationBox(); - if(chunkBox->intersects( m_locationBox )) - { - m_locationBox->y1 = std::min((double)Level::maxBuildHeight, m_locationBox->y1 ); + PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition (lighting)"); + if (m_schematic == NULL) + m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); + + if (m_locationBox == NULL) updateLocationBox(); + if (chunkBox->intersects(m_locationBox)) { + m_locationBox->y1 = + std::min((double)Level::maxBuildHeight, m_locationBox->y1); #ifdef _DEBUG - app.DebugPrintf("Applying schematic %ls to chunk (%d,%d)\n",m_schematicName.c_str(),chunk->x, chunk->z); + app.DebugPrintf("Applying schematic %ls to chunk (%d,%d)\n", + m_schematicName.c_str(), chunk->x, chunk->z); #endif - PIXBeginNamedEvent(0,"Patching lighting"); - m_totalBlocksChangedLighting += m_schematic->applyLighting(chunk, chunkBox, m_locationBox, m_rotation); - PIXEndNamedEvent(); + PIXBeginNamedEvent(0, "Patching lighting"); + m_totalBlocksChangedLighting += m_schematic->applyLighting( + chunk, chunkBox, m_locationBox, m_rotation); + PIXEndNamedEvent(); - // TODO This does not take into account things that go outside the bounds of the world - int targetBlocks = (m_locationBox->x1 - m_locationBox->x0) - * (m_locationBox->y1 - m_locationBox->y0) - * (m_locationBox->z1 - m_locationBox->z0); - if( (m_totalBlocksChanged == targetBlocks) && (m_totalBlocksChangedLighting == targetBlocks) ) - { - m_completed = true; - //m_levelGenOptions->releaseSchematicFile(m_schematicName); - //m_schematic = NULL; - } - } - PIXEndNamedEvent(); + // TODO This does not take into account things that go outside the + // bounds of the world + int targetBlocks = (m_locationBox->x1 - m_locationBox->x0) * + (m_locationBox->y1 - m_locationBox->y0) * + (m_locationBox->z1 - m_locationBox->z0); + if ((m_totalBlocksChanged == targetBlocks) && + (m_totalBlocksChangedLighting == targetBlocks)) { + m_completed = true; + // m_levelGenOptions->releaseSchematicFile(m_schematicName); + // m_schematic = NULL; + } + } + PIXEndNamedEvent(); } -bool ApplySchematicRuleDefinition::checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1) -{ - if( m_locationBox == NULL ) updateLocationBox(); - return m_locationBox->intersects(x0,y0,z0,x1,y1,z1); +bool ApplySchematicRuleDefinition::checkIntersects(int x0, int y0, int z0, + int x1, int y1, int z1) { + if (m_locationBox == NULL) updateLocationBox(); + return m_locationBox->intersects(x0, y0, z0, x1, y1, z1); } -int ApplySchematicRuleDefinition::getMinY() -{ - if( m_locationBox == NULL ) updateLocationBox(); - return m_locationBox->y0; +int ApplySchematicRuleDefinition::getMinY() { + if (m_locationBox == NULL) updateLocationBox(); + return m_locationBox->y0; } -void ApplySchematicRuleDefinition::reset() -{ - m_totalBlocksChanged = 0; - m_totalBlocksChangedLighting = 0; - m_completed = false; +void ApplySchematicRuleDefinition::reset() { + m_totalBlocksChanged = 0; + m_totalBlocksChangedLighting = 0; + m_completed = false; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.h index a7495c841..e3c5b425f 100644 --- a/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.h @@ -8,44 +8,47 @@ class LevelChunk; class LevelGenerationOptions; class GRFObject; -class ApplySchematicRuleDefinition : public GameRuleDefinition -{ +class ApplySchematicRuleDefinition : public GameRuleDefinition { private: - LevelGenerationOptions *m_levelGenOptions; - std::wstring m_schematicName; - ConsoleSchematicFile *m_schematic; - Vec3 *m_location; - AABB *m_locationBox; - ConsoleSchematicFile::ESchematicRotation m_rotation; - int m_dimension; + LevelGenerationOptions* m_levelGenOptions; + std::wstring m_schematicName; + ConsoleSchematicFile* m_schematic; + Vec3* m_location; + AABB* m_locationBox; + ConsoleSchematicFile::ESchematicRotation m_rotation; + int m_dimension; - __int64 m_totalBlocksChanged; - __int64 m_totalBlocksChangedLighting; - bool m_completed; + __int64 m_totalBlocksChanged; + __int64 m_totalBlocksChangedLighting; + bool m_completed; - void updateLocationBox(); -public: - ApplySchematicRuleDefinition(LevelGenerationOptions *levelGenOptions); - ~ApplySchematicRuleDefinition(); + void updateLocationBox(); - virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_ApplySchematic; } - - virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs); - virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); +public: + ApplySchematicRuleDefinition(LevelGenerationOptions* levelGenOptions); + ~ApplySchematicRuleDefinition(); - void processSchematic(AABB *chunkBox, LevelChunk *chunk); - void processSchematicLighting(AABB *chunkBox, LevelChunk *chunk); + virtual ConsoleGameRules::EGameRuleType getActionType() { + return ConsoleGameRules::eGameRuleType_ApplySchematic; + } - bool checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1); - int getMinY(); + virtual void writeAttributes(DataOutputStream* dos, unsigned int numAttrs); + virtual void addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue); - bool isComplete() { return m_completed; } + void processSchematic(AABB* chunkBox, LevelChunk* chunk); + void processSchematicLighting(AABB* chunkBox, LevelChunk* chunk); - std::wstring getSchematicName() { return m_schematicName; } + bool checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1); + int getMinY(); - /** 4J-JEV: - * This GameRuleDefinition contains limited game state. - * Reset any state to how it should be before a new game. - */ - void reset(); + bool isComplete() { return m_completed; } + + std::wstring getSchematicName() { return m_schematicName; } + + /** 4J-JEV: + * This GameRuleDefinition contains limited game state. + * Reset any state to how it should be before a new game. + */ + void reset(); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.cpp b/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.cpp index eb8809555..9ee41e272 100644 --- a/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.cpp @@ -2,58 +2,48 @@ #include "../../Minecraft.World/Util/StringHelpers.h" #include "BiomeOverride.h" -BiomeOverride::BiomeOverride() -{ - m_tile = 0; - m_topTile = 0; - m_biomeId = 0; +BiomeOverride::BiomeOverride() { + m_tile = 0; + m_topTile = 0; + m_biomeId = 0; } -void BiomeOverride::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) -{ - GameRuleDefinition::writeAttributes(dos, numAttrs + 3); +void BiomeOverride::writeAttributes(DataOutputStream* dos, + unsigned int numAttrs) { + GameRuleDefinition::writeAttributes(dos, numAttrs + 3); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_biomeId); - dos->writeUTF(_toString(m_biomeId)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId); - dos->writeUTF(_toString(m_tile)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_topTileId); - dos->writeUTF(_toString(m_topTile)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_biomeId); + dos->writeUTF(_toString(m_biomeId)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId); + dos->writeUTF(_toString(m_tile)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_topTileId); + dos->writeUTF(_toString(m_topTile)); } -void BiomeOverride::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) -{ - if(attributeName.compare(L"tileId") == 0) - { - int value = _fromString(attributeValue); - m_tile = value; - app.DebugPrintf("BiomeOverride: Adding parameter tileId=%d\n",m_tile); - } - else if(attributeName.compare(L"topTileId") == 0) - { - int value = _fromString(attributeValue); - m_topTile = value; - app.DebugPrintf("BiomeOverride: Adding parameter topTileId=%d\n",m_topTile); - } - else if(attributeName.compare(L"biomeId") == 0) - { - int value = _fromString(attributeValue); - m_biomeId = value; - app.DebugPrintf("BiomeOverride: Adding parameter biomeId=%d\n",m_biomeId); - } - else - { - GameRuleDefinition::addAttribute(attributeName, attributeValue); - } +void BiomeOverride::addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue) { + if (attributeName.compare(L"tileId") == 0) { + int value = _fromString(attributeValue); + m_tile = value; + app.DebugPrintf("BiomeOverride: Adding parameter tileId=%d\n", m_tile); + } else if (attributeName.compare(L"topTileId") == 0) { + int value = _fromString(attributeValue); + m_topTile = value; + app.DebugPrintf("BiomeOverride: Adding parameter topTileId=%d\n", + m_topTile); + } else if (attributeName.compare(L"biomeId") == 0) { + int value = _fromString(attributeValue); + m_biomeId = value; + app.DebugPrintf("BiomeOverride: Adding parameter biomeId=%d\n", + m_biomeId); + } else { + GameRuleDefinition::addAttribute(attributeName, attributeValue); + } } -bool BiomeOverride::isBiome(int id) -{ - return m_biomeId == id; -} +bool BiomeOverride::isBiome(int id) { return m_biomeId == id; } -void BiomeOverride::getTileValues(std::uint8_t &tile, std::uint8_t &topTile) -{ - if(m_tile != 0) tile = m_tile; - if(m_topTile != 0) topTile = m_topTile; +void BiomeOverride::getTileValues(std::uint8_t& tile, std::uint8_t& topTile) { + if (m_tile != 0) tile = m_tile; + if (m_topTile != 0) topTile = m_topTile; } diff --git a/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.h b/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.h index 29cd64f5b..191cbff33 100644 --- a/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.h +++ b/Minecraft.Client/Platform/Common/GameRules/BiomeOverride.h @@ -1,23 +1,25 @@ #pragma once -//using namespace std; +// using namespace std; #include "GameRuleDefinition.h" -class BiomeOverride : public GameRuleDefinition -{ +class BiomeOverride : public GameRuleDefinition { private: - std::uint8_t m_topTile; - std::uint8_t m_tile; - int m_biomeId; + std::uint8_t m_topTile; + std::uint8_t m_tile; + int m_biomeId; public: - BiomeOverride(); + BiomeOverride(); - virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_BiomeOverride; } - - virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs); - virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); + virtual ConsoleGameRules::EGameRuleType getActionType() { + return ConsoleGameRules::eGameRuleType_BiomeOverride; + } - bool isBiome(int id); - void getTileValues(std::uint8_t &tile, std::uint8_t &topTile); + virtual void writeAttributes(DataOutputStream* dos, unsigned int numAttrs); + virtual void addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue); + + bool isBiome(int id); + void getTileValues(std::uint8_t& tile, std::uint8_t& topTile); }; diff --git a/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.cpp index a97b585e0..f3f601ab6 100644 --- a/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.cpp @@ -6,112 +6,111 @@ #include "../../Minecraft.World/Network/Connection.h" #include "../../Minecraft.World/Headers/net.minecraft.network.packet.h" -CollectItemRuleDefinition::CollectItemRuleDefinition() -{ - m_itemId = 0; - m_auxValue = 0; - m_quantity = 0; +CollectItemRuleDefinition::CollectItemRuleDefinition() { + m_itemId = 0; + m_auxValue = 0; + m_quantity = 0; } -CollectItemRuleDefinition::~CollectItemRuleDefinition() -{ +CollectItemRuleDefinition::~CollectItemRuleDefinition() {} + +void CollectItemRuleDefinition::writeAttributes(DataOutputStream* dos, + unsigned int numAttributes) { + GameRuleDefinition::writeAttributes(dos, numAttributes + 3); + + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId); + dos->writeUTF(_toString(m_itemId)); + + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue); + dos->writeUTF(_toString(m_auxValue)); + + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity); + dos->writeUTF(_toString(m_quantity)); } -void CollectItemRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes) -{ - GameRuleDefinition::writeAttributes(dos, numAttributes + 3); - - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId); - dos->writeUTF( _toString( m_itemId ) ); - - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue); - dos->writeUTF( _toString( m_auxValue ) ); - - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity); - dos->writeUTF( _toString( m_quantity ) ); +void CollectItemRuleDefinition::addAttribute( + const std::wstring& attributeName, const std::wstring& attributeValue) { + if (attributeName.compare(L"itemId") == 0) { + m_itemId = _fromString(attributeValue); + app.DebugPrintf("CollectItemRule: Adding parameter itemId=%d\n", + m_itemId); + } else if (attributeName.compare(L"auxValue") == 0) { + m_auxValue = _fromString(attributeValue); + app.DebugPrintf("CollectItemRule: Adding parameter m_auxValue=%d\n", + m_auxValue); + } else if (attributeName.compare(L"quantity") == 0) { + m_quantity = _fromString(attributeValue); + app.DebugPrintf("CollectItemRule: Adding parameter m_quantity=%d\n", + m_quantity); + } else { + GameRuleDefinition::addAttribute(attributeName, attributeValue); + } } -void CollectItemRuleDefinition::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) -{ - if(attributeName.compare(L"itemId") == 0) - { - m_itemId = _fromString(attributeValue); - app.DebugPrintf("CollectItemRule: Adding parameter itemId=%d\n",m_itemId); - } - else if(attributeName.compare(L"auxValue") == 0) - { - m_auxValue = _fromString(attributeValue); - app.DebugPrintf("CollectItemRule: Adding parameter m_auxValue=%d\n",m_auxValue); - } - else if(attributeName.compare(L"quantity") == 0) - { - m_quantity = _fromString(attributeValue); - app.DebugPrintf("CollectItemRule: Adding parameter m_quantity=%d\n",m_quantity); - } - else - { - GameRuleDefinition::addAttribute(attributeName, attributeValue); - } +int CollectItemRuleDefinition::getGoal() { return m_quantity; } + +int CollectItemRuleDefinition::getProgress(GameRule* rule) { + GameRule::ValueType value = rule->getParameter(L"iQuantity"); + return value.i; } -int CollectItemRuleDefinition::getGoal() -{ - return m_quantity; +void CollectItemRuleDefinition::populateGameRule( + GameRulesInstance::EGameRulesInstanceType type, GameRule* rule) { + GameRule::ValueType value; + value.i = 0; + rule->setParameter(L"iQuantity", value); + + GameRuleDefinition::populateGameRule(type, rule); } -int CollectItemRuleDefinition::getProgress(GameRule *rule) -{ - GameRule::ValueType value = rule->getParameter(L"iQuantity"); - return value.i; +bool CollectItemRuleDefinition::onCollectItem( + GameRule* rule, std::shared_ptr item) { + bool statusChanged = false; + if (item != NULL && item->id == m_itemId && + item->getAuxValue() == m_auxValue && + item->get4JData() == m_4JDataValue) { + if (!getComplete(rule)) { + GameRule::ValueType value = rule->getParameter(L"iQuantity"); + int quantityCollected = (value.i += item->count); + rule->setParameter(L"iQuantity", value); + + statusChanged = true; + + if (quantityCollected >= m_quantity) { + setComplete(rule, true); + app.DebugPrintf( + "Completed CollectItemRule with info - itemId:%d, " + "auxValue:%d, quantity:%d, dataTag:%d\n", + m_itemId, m_auxValue, m_quantity, m_4JDataValue); + + if (rule->getConnection() != NULL) { + rule->getConnection()->send( + std::shared_ptr( + new UpdateGameRuleProgressPacket( + getActionType(), this->m_descriptionId, + m_itemId, m_auxValue, this->m_4JDataValue, NULL, + 0))); + } + } + } + } + return statusChanged; } -void CollectItemRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule) -{ - GameRule::ValueType value; - value.i = 0; - rule->setParameter(L"iQuantity",value); - - GameRuleDefinition::populateGameRule(type, rule); -} - -bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, std::shared_ptr item) -{ - bool statusChanged = false; - if(item != NULL && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue) - { - if(!getComplete(rule)) - { - GameRule::ValueType value = rule->getParameter(L"iQuantity"); - int quantityCollected = (value.i += item->count); - rule->setParameter(L"iQuantity",value); - - statusChanged = true; - - if(quantityCollected >= m_quantity) - { - setComplete(rule, true); - app.DebugPrintf("Completed CollectItemRule with info - itemId:%d, auxValue:%d, quantity:%d, dataTag:%d\n", m_itemId,m_auxValue,m_quantity,m_4JDataValue); - - if(rule->getConnection() != NULL) - { - rule->getConnection()->send( std::shared_ptr( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId, m_itemId, m_auxValue, this->m_4JDataValue,NULL,0))); - } - } - } - } - return statusChanged; -} - -std::wstring CollectItemRuleDefinition::generateXml(std::shared_ptr item) -{ - // 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd - std::wstring xml = L""; - if(item != NULL) - { - xml = L"(item->id) + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" promptName=\"OPTIONAL\""; - if(item->getAuxValue() != 0) xml += L" auxValue=\"" + _toString(item->getAuxValue()) + L"\""; - if(item->get4JData() != 0) xml += L" dataTag=\"" + _toString(item->get4JData()) + L"\""; - xml += L"/>\n"; - } - return xml; +std::wstring CollectItemRuleDefinition::generateXml( + std::shared_ptr item) { + // 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd + std::wstring xml = L""; + if (item != NULL) { + xml = L"(item->id) + + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" " + L"promptName=\"OPTIONAL\""; + if (item->getAuxValue() != 0) + xml += + L" auxValue=\"" + _toString(item->getAuxValue()) + L"\""; + if (item->get4JData() != 0) + xml += L" dataTag=\"" + _toString(item->get4JData()) + L"\""; + xml += L"/>\n"; + } + return xml; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.h index d9bc6b7e3..5b0e4283b 100644 --- a/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.h @@ -6,35 +6,38 @@ class Pos; class UseTileRuleDefinition; class ItemInstance; -class CollectItemRuleDefinition : public GameRuleDefinition -{ +class CollectItemRuleDefinition : public GameRuleDefinition { private: - // These values should map directly to the xsd definition for this Rule - int m_itemId; - unsigned char m_auxValue; - int m_quantity; + // These values should map directly to the xsd definition for this Rule + int m_itemId; + unsigned char m_auxValue; + int m_quantity; public: - CollectItemRuleDefinition(); - ~CollectItemRuleDefinition(); + CollectItemRuleDefinition(); + ~CollectItemRuleDefinition(); - ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_CollectItemRule; } + ConsoleGameRules::EGameRuleType getActionType() { + return ConsoleGameRules::eGameRuleType_CollectItemRule; + } - virtual void writeAttributes(DataOutputStream *, unsigned int numAttributes); - virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); + virtual void writeAttributes(DataOutputStream*, unsigned int numAttributes); + virtual void addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue); - virtual int getGoal(); - virtual int getProgress(GameRule *rule); - - virtual int getIcon() { return m_itemId; } - virtual int getAuxValue() { return m_auxValue; } + virtual int getGoal(); + virtual int getProgress(GameRule* rule); - void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule); + virtual int getIcon() { return m_itemId; } + virtual int getAuxValue() { return m_auxValue; } - bool onCollectItem(GameRule *rule, std::shared_ptr item); + void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, + GameRule* rule); - static std::wstring generateXml(std::shared_ptr item); + bool onCollectItem(GameRule* rule, std::shared_ptr item); -private: - //static std::wstring generateXml(CollectItemRuleDefinition *ruleDef); + static std::wstring generateXml(std::shared_ptr item); + +private: + // static std::wstring generateXml(CollectItemRuleDefinition *ruleDef); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/CompleteAllRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/CompleteAllRuleDefinition.cpp index 31b0ec051..82d8fb5dd 100644 --- a/Minecraft.Client/Platform/Common/GameRules/CompleteAllRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/CompleteAllRuleDefinition.cpp @@ -5,62 +5,66 @@ #include "../../Minecraft.World/Network/Connection.h" #include "../../Minecraft.World/Headers/net.minecraft.network.packet.h" -void CompleteAllRuleDefinition::getChildren(std::vector *children) -{ - CompoundGameRuleDefinition::getChildren(children); +void CompleteAllRuleDefinition::getChildren( + std::vector* children) { + CompoundGameRuleDefinition::getChildren(children); } -bool CompleteAllRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, int y, int z) -{ - bool statusChanged = CompoundGameRuleDefinition::onUseTile(rule,tileId,x,y,z); - if(statusChanged) updateStatus(rule); - return statusChanged; +bool CompleteAllRuleDefinition::onUseTile(GameRule* rule, int tileId, int x, + int y, int z) { + bool statusChanged = + CompoundGameRuleDefinition::onUseTile(rule, tileId, x, y, z); + if (statusChanged) updateStatus(rule); + return statusChanged; } -bool CompleteAllRuleDefinition::onCollectItem(GameRule *rule, std::shared_ptr item) -{ - bool statusChanged = CompoundGameRuleDefinition::onCollectItem(rule,item); - if(statusChanged) updateStatus(rule); - return statusChanged; +bool CompleteAllRuleDefinition::onCollectItem( + GameRule* rule, std::shared_ptr item) { + bool statusChanged = CompoundGameRuleDefinition::onCollectItem(rule, item); + if (statusChanged) updateStatus(rule); + return statusChanged; } -void CompleteAllRuleDefinition::updateStatus(GameRule *rule) -{ - int goal = 0; - int progress = 0; - for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it) - { - if(it->second.isPointer) - { - goal += it->second.gr->getGameRuleDefinition()->getGoal(); - progress += it->second.gr->getGameRuleDefinition()->getProgress(it->second.gr); - } - } - if(rule->getConnection() != NULL) - { - PacketData data; - data.goal = goal; - data.progress = progress; +void CompleteAllRuleDefinition::updateStatus(GameRule* rule) { + int goal = 0; + int progress = 0; + for (AUTO_VAR(it, rule->m_parameters.begin()); + it != rule->m_parameters.end(); ++it) { + if (it->second.isPointer) { + goal += it->second.gr->getGameRuleDefinition()->getGoal(); + progress += it->second.gr->getGameRuleDefinition()->getProgress( + it->second.gr); + } + } + if (rule->getConnection() != NULL) { + PacketData data; + data.goal = goal; + data.progress = progress; - int icon = -1; - int auxValue = 0; - - if(m_lastRuleStatusChanged != NULL) - { - icon = m_lastRuleStatusChanged->getIcon(); - auxValue = m_lastRuleStatusChanged->getAuxValue(); - m_lastRuleStatusChanged = NULL; - } - rule->getConnection()->send( std::shared_ptr( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId,icon, auxValue, 0,&data,sizeof(PacketData)))); - } - app.DebugPrintf("Updated CompleteAllRule - Completed %d of %d\n", progress, goal); + int icon = -1; + int auxValue = 0; + + if (m_lastRuleStatusChanged != NULL) { + icon = m_lastRuleStatusChanged->getIcon(); + auxValue = m_lastRuleStatusChanged->getAuxValue(); + m_lastRuleStatusChanged = NULL; + } + rule->getConnection()->send( + std::shared_ptr( + new UpdateGameRuleProgressPacket( + getActionType(), this->m_descriptionId, icon, auxValue, 0, + &data, sizeof(PacketData)))); + } + app.DebugPrintf("Updated CompleteAllRule - Completed %d of %d\n", progress, + goal); } -std::wstring CompleteAllRuleDefinition::generateDescriptionString(const std::wstring &description, void *data, int dataLength) -{ - PacketData *values = (PacketData *)data; - std::wstring newDesc = description; - newDesc = replaceAll(newDesc,L"{*progress*}",_toString(values->progress)); - newDesc = replaceAll(newDesc,L"{*goal*}",_toString(values->goal)); - return newDesc; +std::wstring CompleteAllRuleDefinition::generateDescriptionString( + const std::wstring& description, void* data, int dataLength) { + PacketData* values = (PacketData*)data; + std::wstring newDesc = description; + newDesc = + replaceAll(newDesc, L"{*progress*}", _toString(values->progress)); + newDesc = replaceAll(newDesc, L"{*goal*}", _toString(values->goal)); + return newDesc; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/CompleteAllRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/CompleteAllRuleDefinition.h index dbf9365b8..5f90abc34 100644 --- a/Minecraft.Client/Platform/Common/GameRules/CompleteAllRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/CompleteAllRuleDefinition.h @@ -2,25 +2,27 @@ #include "CompoundGameRuleDefinition.h" -class CompleteAllRuleDefinition : public CompoundGameRuleDefinition -{ +class CompleteAllRuleDefinition : public CompoundGameRuleDefinition { private: - typedef struct _packetData - { - int goal; - int progress; - } PacketData; + typedef struct _packetData { + int goal; + int progress; + } PacketData; public: - ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_CompleteAllRule; } + ConsoleGameRules::EGameRuleType getActionType() { + return ConsoleGameRules::eGameRuleType_CompleteAllRule; + } - virtual void getChildren(std::vector *children); + virtual void getChildren(std::vector* children); - virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z); - virtual bool onCollectItem(GameRule *rule, std::shared_ptr item); + virtual bool onUseTile(GameRule* rule, int tileId, int x, int y, int z); + virtual bool onCollectItem(GameRule* rule, + std::shared_ptr item); - static std::wstring generateDescriptionString(const std::wstring &description, void *data, int dataLength); + static std::wstring generateDescriptionString( + const std::wstring& description, void* data, int dataLength); private: - void updateStatus(GameRule *rule); + void updateStatus(GameRule* rule); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/CompoundGameRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/CompoundGameRuleDefinition.cpp index 4fca395a8..cd21388e4 100644 --- a/Minecraft.Client/Platform/Common/GameRules/CompoundGameRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/CompoundGameRuleDefinition.cpp @@ -4,115 +4,105 @@ #include "CompoundGameRuleDefinition.h" #include "ConsoleGameRules.h" -CompoundGameRuleDefinition::CompoundGameRuleDefinition() -{ - m_lastRuleStatusChanged = NULL; +CompoundGameRuleDefinition::CompoundGameRuleDefinition() { + m_lastRuleStatusChanged = NULL; } -CompoundGameRuleDefinition::~CompoundGameRuleDefinition() -{ - for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it) - { - delete (*it); - } +CompoundGameRuleDefinition::~CompoundGameRuleDefinition() { + for (AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it) { + delete (*it); + } } -void CompoundGameRuleDefinition::getChildren(std::vector *children) -{ - GameRuleDefinition::getChildren(children); - for (AUTO_VAR(it, m_children.begin()); it != m_children.end(); it++) - children->push_back(*it); +void CompoundGameRuleDefinition::getChildren( + std::vector* children) { + GameRuleDefinition::getChildren(children); + for (AUTO_VAR(it, m_children.begin()); it != m_children.end(); it++) + children->push_back(*it); } -GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType) -{ - GameRuleDefinition *rule = NULL; - if(ruleType == ConsoleGameRules::eGameRuleType_CompleteAllRule) - { - rule = new CompleteAllRuleDefinition(); - } - else if(ruleType == ConsoleGameRules::eGameRuleType_CollectItemRule) - { - rule = new CollectItemRuleDefinition(); - } - else if(ruleType == ConsoleGameRules::eGameRuleType_UseTileRule) - { - rule = new UseTileRuleDefinition(); - } - else if(ruleType == ConsoleGameRules::eGameRuleType_UpdatePlayerRule) - { - rule = new UpdatePlayerRuleDefinition(); - } - else - { +GameRuleDefinition* CompoundGameRuleDefinition::addChild( + ConsoleGameRules::EGameRuleType ruleType) { + GameRuleDefinition* rule = NULL; + if (ruleType == ConsoleGameRules::eGameRuleType_CompleteAllRule) { + rule = new CompleteAllRuleDefinition(); + } else if (ruleType == ConsoleGameRules::eGameRuleType_CollectItemRule) { + rule = new CollectItemRuleDefinition(); + } else if (ruleType == ConsoleGameRules::eGameRuleType_UseTileRule) { + rule = new UseTileRuleDefinition(); + } else if (ruleType == ConsoleGameRules::eGameRuleType_UpdatePlayerRule) { + rule = new UpdatePlayerRuleDefinition(); + } else { #ifndef _CONTENT_PACKAGE - wprintf(L"CompoundGameRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType ); + wprintf( + L"CompoundGameRuleDefinition: Attempted to add invalid child rule " + L"- %d\n", + ruleType); #endif - } - if(rule != NULL) m_children.push_back(rule); - return rule; + } + if (rule != NULL) m_children.push_back(rule); + return rule; } -void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule) -{ - GameRule *newRule = NULL; - int i = 0; - for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it) - { - newRule = new GameRule(*it, rule->getConnection() ); - (*it)->populateGameRule(type,newRule); +void CompoundGameRuleDefinition::populateGameRule( + GameRulesInstance::EGameRulesInstanceType type, GameRule* rule) { + GameRule* newRule = NULL; + int i = 0; + for (AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it) { + newRule = new GameRule(*it, rule->getConnection()); + (*it)->populateGameRule(type, newRule); - GameRule::ValueType value; - value.gr = newRule; - value.isPointer = true; + GameRule::ValueType value; + value.gr = newRule; + value.isPointer = true; - // Somehow add the newRule to the current rule - rule->setParameter(L"rule" + _toString(i),value); - ++i; - } - GameRuleDefinition::populateGameRule(type, rule); + // Somehow add the newRule to the current rule + rule->setParameter(L"rule" + _toString(i), value); + ++i; + } + GameRuleDefinition::populateGameRule(type, rule); } -bool CompoundGameRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, int y, int z) -{ - bool statusChanged = false; - for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it) - { - if(it->second.isPointer) - { - bool changed = it->second.gr->getGameRuleDefinition()->onUseTile(it->second.gr,tileId,x,y,z); - if(!statusChanged && changed) - { - m_lastRuleStatusChanged = it->second.gr->getGameRuleDefinition(); - statusChanged = true; - } - } - } - return statusChanged; +bool CompoundGameRuleDefinition::onUseTile(GameRule* rule, int tileId, int x, + int y, int z) { + bool statusChanged = false; + for (AUTO_VAR(it, rule->m_parameters.begin()); + it != rule->m_parameters.end(); ++it) { + if (it->second.isPointer) { + bool changed = it->second.gr->getGameRuleDefinition()->onUseTile( + it->second.gr, tileId, x, y, z); + if (!statusChanged && changed) { + m_lastRuleStatusChanged = + it->second.gr->getGameRuleDefinition(); + statusChanged = true; + } + } + } + return statusChanged; } -bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, std::shared_ptr item) -{ - bool statusChanged = false; - for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it) - { - if(it->second.isPointer) - { - bool changed = it->second.gr->getGameRuleDefinition()->onCollectItem(it->second.gr,item); - if(!statusChanged && changed) - { - m_lastRuleStatusChanged = it->second.gr->getGameRuleDefinition(); - statusChanged = true; - } - } - } - return statusChanged; +bool CompoundGameRuleDefinition::onCollectItem( + GameRule* rule, std::shared_ptr item) { + bool statusChanged = false; + for (AUTO_VAR(it, rule->m_parameters.begin()); + it != rule->m_parameters.end(); ++it) { + if (it->second.isPointer) { + bool changed = + it->second.gr->getGameRuleDefinition()->onCollectItem( + it->second.gr, item); + if (!statusChanged && changed) { + m_lastRuleStatusChanged = + it->second.gr->getGameRuleDefinition(); + statusChanged = true; + } + } + } + return statusChanged; } -void CompoundGameRuleDefinition::postProcessPlayer(std::shared_ptr player) -{ - for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it) - { - (*it)->postProcessPlayer(player); - } +void CompoundGameRuleDefinition::postProcessPlayer( + std::shared_ptr player) { + for (AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it) { + (*it)->postProcessPlayer(player); + } } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/CompoundGameRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/CompoundGameRuleDefinition.h index ad13f67b9..fa1b04ce0 100644 --- a/Minecraft.Client/Platform/Common/GameRules/CompoundGameRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/CompoundGameRuleDefinition.h @@ -2,22 +2,26 @@ #include "GameRuleDefinition.h" -class CompoundGameRuleDefinition : public GameRuleDefinition -{ +class CompoundGameRuleDefinition : public GameRuleDefinition { protected: - std::vector m_children; + std::vector m_children; + protected: - GameRuleDefinition *m_lastRuleStatusChanged; + GameRuleDefinition* m_lastRuleStatusChanged; + public: - CompoundGameRuleDefinition(); - virtual ~CompoundGameRuleDefinition(); + CompoundGameRuleDefinition(); + virtual ~CompoundGameRuleDefinition(); - virtual void getChildren(std::vector *children); - virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); + virtual void getChildren(std::vector* children); + virtual GameRuleDefinition* addChild( + ConsoleGameRules::EGameRuleType ruleType); - virtual void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule); + virtual void populateGameRule( + GameRulesInstance::EGameRulesInstanceType type, GameRule* rule); - virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z); - virtual bool onCollectItem(GameRule *rule, std::shared_ptr item); - virtual void postProcessPlayer(std::shared_ptr player); + virtual bool onUseTile(GameRule* rule, int tileId, int x, int y, int z); + virtual bool onCollectItem(GameRule* rule, + std::shared_ptr item); + virtual void postProcessPlayer(std::shared_ptr player); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/ConsoleGameRulesConstants.h b/Minecraft.Client/Platform/Common/GameRules/ConsoleGameRulesConstants.h index 93c012ac2..fb5766eb6 100644 --- a/Minecraft.Client/Platform/Common/GameRules/ConsoleGameRulesConstants.h +++ b/Minecraft.Client/Platform/Common/GameRules/ConsoleGameRulesConstants.h @@ -1,120 +1,118 @@ #pragma once -//#include " +// #include " -class ConsoleGameRules -{ +class ConsoleGameRules { public: - enum EGameRuleType - { - eGameRuleType_Invalid = -1, - eGameRuleType_Root = 0, // This is the top level rule that defines a game mode, this is used to generate data for new players + enum EGameRuleType { + eGameRuleType_Invalid = -1, + eGameRuleType_Root = + 0, // This is the top level rule that defines a game mode, this is + // used to generate data for new players - eGameRuleType_LevelGenerationOptions, - eGameRuleType_ApplySchematic, - eGameRuleType_GenerateStructure, - eGameRuleType_GenerateBox, - eGameRuleType_PlaceBlock, - eGameRuleType_PlaceContainer, - eGameRuleType_PlaceSpawner, - eGameRuleType_BiomeOverride, - eGameRuleType_StartFeature, + eGameRuleType_LevelGenerationOptions, + eGameRuleType_ApplySchematic, + eGameRuleType_GenerateStructure, + eGameRuleType_GenerateBox, + eGameRuleType_PlaceBlock, + eGameRuleType_PlaceContainer, + eGameRuleType_PlaceSpawner, + eGameRuleType_BiomeOverride, + eGameRuleType_StartFeature, - eGameRuleType_AddItem, - eGameRuleType_AddEnchantment, + eGameRuleType_AddItem, + eGameRuleType_AddEnchantment, - eGameRuleType_LevelRules, - eGameRuleType_NamedArea, + eGameRuleType_LevelRules, + eGameRuleType_NamedArea, - eGameRuleType_UseTileRule, - eGameRuleType_CollectItemRule, - eGameRuleType_CompleteAllRule, - eGameRuleType_UpdatePlayerRule, + eGameRuleType_UseTileRule, + eGameRuleType_CollectItemRule, + eGameRuleType_CompleteAllRule, + eGameRuleType_UpdatePlayerRule, - eGameRuleType_Count - }; + eGameRuleType_Count + }; - enum EGameRuleAttr - { - eGameRuleAttr_Invalid = -1, + enum EGameRuleAttr { + eGameRuleAttr_Invalid = -1, - eGameRuleAttr_descriptionName = 0, - eGameRuleAttr_promptName, - eGameRuleAttr_dataTag, + eGameRuleAttr_descriptionName = 0, + eGameRuleAttr_promptName, + eGameRuleAttr_dataTag, - eGameRuleAttr_enchantmentId, - eGameRuleAttr_enchantmentLevel, + eGameRuleAttr_enchantmentId, + eGameRuleAttr_enchantmentLevel, - eGameRuleAttr_itemId, - eGameRuleAttr_quantity, - eGameRuleAttr_auxValue, - eGameRuleAttr_slot, + eGameRuleAttr_itemId, + eGameRuleAttr_quantity, + eGameRuleAttr_auxValue, + eGameRuleAttr_slot, - eGameRuleAttr_name, + eGameRuleAttr_name, - eGameRuleAttr_food, - eGameRuleAttr_health, + eGameRuleAttr_food, + eGameRuleAttr_health, - eGameRuleAttr_tileId, - eGameRuleAttr_useCoords, + eGameRuleAttr_tileId, + eGameRuleAttr_useCoords, - eGameRuleAttr_seed, - eGameRuleAttr_flatworld, + eGameRuleAttr_seed, + eGameRuleAttr_flatworld, - eGameRuleAttr_filename, - eGameRuleAttr_rot, + eGameRuleAttr_filename, + eGameRuleAttr_rot, - eGameRuleAttr_data, - eGameRuleAttr_block, - eGameRuleAttr_entity, + eGameRuleAttr_data, + eGameRuleAttr_block, + eGameRuleAttr_entity, - eGameRuleAttr_facing, + eGameRuleAttr_facing, - eGameRuleAttr_edgeTile, - eGameRuleAttr_fillTile, - eGameRuleAttr_skipAir, + eGameRuleAttr_edgeTile, + eGameRuleAttr_fillTile, + eGameRuleAttr_skipAir, - eGameRuleAttr_x, - eGameRuleAttr_x0, - eGameRuleAttr_x1, - - eGameRuleAttr_y, - eGameRuleAttr_y0, - eGameRuleAttr_y1, + eGameRuleAttr_x, + eGameRuleAttr_x0, + eGameRuleAttr_x1, - eGameRuleAttr_z, - eGameRuleAttr_z0, - eGameRuleAttr_z1, + eGameRuleAttr_y, + eGameRuleAttr_y0, + eGameRuleAttr_y1, - eGameRuleAttr_chunkX, - eGameRuleAttr_chunkZ, + eGameRuleAttr_z, + eGameRuleAttr_z0, + eGameRuleAttr_z1, - eGameRuleAttr_yRot, + eGameRuleAttr_chunkX, + eGameRuleAttr_chunkZ, - eGameRuleAttr_spawnX, - eGameRuleAttr_spawnY, - eGameRuleAttr_spawnZ, + eGameRuleAttr_yRot, - eGameRuleAttr_orientation, - eGameRuleAttr_dimension, + eGameRuleAttr_spawnX, + eGameRuleAttr_spawnY, + eGameRuleAttr_spawnZ, - eGameRuleAttr_topTileId, - eGameRuleAttr_biomeId, + eGameRuleAttr_orientation, + eGameRuleAttr_dimension, - eGameRuleAttr_feature, + eGameRuleAttr_topTileId, + eGameRuleAttr_biomeId, - eGameRuleAttr_Count - }; + eGameRuleAttr_feature, - static void write(DataOutputStream *dos, ConsoleGameRules::EGameRuleType eType) - { - dos->writeInt(eType); - } + eGameRuleAttr_Count + }; - static void write(DataOutputStream *dos, ConsoleGameRules::EGameRuleAttr eAttr) - { - dos->writeInt(static_cast(eGameRuleType_Count) + - static_cast(eAttr)); - } + static void write(DataOutputStream* dos, + ConsoleGameRules::EGameRuleType eType) { + dos->writeInt(eType); + } + static void write(DataOutputStream* dos, + ConsoleGameRules::EGameRuleAttr eAttr) { + dos->writeInt(static_cast(eGameRuleType_Count) + + static_cast(eAttr)); + } }; diff --git a/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.cpp b/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.cpp index 858d6cbce..cec5b1214 100644 --- a/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.cpp @@ -7,177 +7,155 @@ #include "../../Minecraft.World/Util/StringHelpers.h" #include "../../Minecraft.World/Headers/net.minecraft.h" -ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0) -{ - m_x = m_y = m_z = 0; - boundingBox = NULL; - orientation = Direction::NORTH; - m_dimension = 0; +ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0) { + m_x = m_y = m_z = 0; + boundingBox = NULL; + orientation = Direction::NORTH; + m_dimension = 0; } -void ConsoleGenerateStructure::getChildren(std::vector *children) -{ - GameRuleDefinition::getChildren(children); - - for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); it++) - children->push_back( *it ); +void ConsoleGenerateStructure::getChildren( + std::vector* children) { + GameRuleDefinition::getChildren(children); + + for (AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); it++) + children->push_back(*it); } -GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRuleType ruleType) -{ - GameRuleDefinition *rule = NULL; - if(ruleType == ConsoleGameRules::eGameRuleType_GenerateBox) - { - rule = new XboxStructureActionGenerateBox(); - m_actions.push_back((XboxStructureActionGenerateBox *)rule); - } - else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceBlock) - { - rule = new XboxStructureActionPlaceBlock(); - m_actions.push_back((XboxStructureActionPlaceBlock *)rule); - } - else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceContainer) - { - rule = new XboxStructureActionPlaceContainer(); - m_actions.push_back((XboxStructureActionPlaceContainer *)rule); - } - else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceSpawner) - { - rule = new XboxStructureActionPlaceSpawner(); - m_actions.push_back((XboxStructureActionPlaceSpawner *)rule); - } - else - { +GameRuleDefinition* ConsoleGenerateStructure::addChild( + ConsoleGameRules::EGameRuleType ruleType) { + GameRuleDefinition* rule = NULL; + if (ruleType == ConsoleGameRules::eGameRuleType_GenerateBox) { + rule = new XboxStructureActionGenerateBox(); + m_actions.push_back((XboxStructureActionGenerateBox*)rule); + } else if (ruleType == ConsoleGameRules::eGameRuleType_PlaceBlock) { + rule = new XboxStructureActionPlaceBlock(); + m_actions.push_back((XboxStructureActionPlaceBlock*)rule); + } else if (ruleType == ConsoleGameRules::eGameRuleType_PlaceContainer) { + rule = new XboxStructureActionPlaceContainer(); + m_actions.push_back((XboxStructureActionPlaceContainer*)rule); + } else if (ruleType == ConsoleGameRules::eGameRuleType_PlaceSpawner) { + rule = new XboxStructureActionPlaceSpawner(); + m_actions.push_back((XboxStructureActionPlaceSpawner*)rule); + } else { #ifndef _CONTENT_PACKAGE - wprintf(L"ConsoleGenerateStructure: Attempted to add invalid child rule - %d\n", ruleType ); + wprintf( + L"ConsoleGenerateStructure: Attempted to add invalid child rule - " + L"%d\n", + ruleType); #endif - } - return rule; + } + return rule; } -void ConsoleGenerateStructure::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) -{ - GameRuleDefinition::writeAttributes(dos, numAttrs + 5); +void ConsoleGenerateStructure::writeAttributes(DataOutputStream* dos, + unsigned int numAttrs) { + GameRuleDefinition::writeAttributes(dos, numAttrs + 5); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x); - dos->writeUTF(_toString(m_x)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y); - dos->writeUTF(_toString(m_y)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z); - dos->writeUTF(_toString(m_z)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x); + dos->writeUTF(_toString(m_x)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y); + dos->writeUTF(_toString(m_y)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z); + dos->writeUTF(_toString(m_z)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation); - dos->writeUTF(_toString(orientation)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dimension); - dos->writeUTF(_toString(m_dimension)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation); + dos->writeUTF(_toString(orientation)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dimension); + dos->writeUTF(_toString(m_dimension)); } -void ConsoleGenerateStructure::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) -{ - if(attributeName.compare(L"x") == 0) - { - int value = _fromString(attributeValue); - m_x = value; - app.DebugPrintf("ConsoleGenerateStructure: Adding parameter x=%d\n",m_x); - } - else if(attributeName.compare(L"y") == 0) - { - int value = _fromString(attributeValue); - m_y = value; - app.DebugPrintf("ConsoleGenerateStructure: Adding parameter y=%d\n",m_y); - } - else if(attributeName.compare(L"z") == 0) - { - int value = _fromString(attributeValue); - m_z = value; - app.DebugPrintf("ConsoleGenerateStructure: Adding parameter z=%d\n",m_z); - } - else if(attributeName.compare(L"orientation") == 0) - { - int value = _fromString(attributeValue); - orientation = value; - app.DebugPrintf("ConsoleGenerateStructure: Adding parameter orientation=%d\n",orientation); - } - else if(attributeName.compare(L"dim") == 0) - { - m_dimension = _fromString(attributeValue); - if(m_dimension > 1 || m_dimension < -1) m_dimension = 0; - app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter dimension=%d\n",m_dimension); - } - else - { - GameRuleDefinition::addAttribute(attributeName, attributeValue); - } +void ConsoleGenerateStructure::addAttribute( + const std::wstring& attributeName, const std::wstring& attributeValue) { + if (attributeName.compare(L"x") == 0) { + int value = _fromString(attributeValue); + m_x = value; + app.DebugPrintf("ConsoleGenerateStructure: Adding parameter x=%d\n", + m_x); + } else if (attributeName.compare(L"y") == 0) { + int value = _fromString(attributeValue); + m_y = value; + app.DebugPrintf("ConsoleGenerateStructure: Adding parameter y=%d\n", + m_y); + } else if (attributeName.compare(L"z") == 0) { + int value = _fromString(attributeValue); + m_z = value; + app.DebugPrintf("ConsoleGenerateStructure: Adding parameter z=%d\n", + m_z); + } else if (attributeName.compare(L"orientation") == 0) { + int value = _fromString(attributeValue); + orientation = value; + app.DebugPrintf( + "ConsoleGenerateStructure: Adding parameter orientation=%d\n", + orientation); + } else if (attributeName.compare(L"dim") == 0) { + m_dimension = _fromString(attributeValue); + if (m_dimension > 1 || m_dimension < -1) m_dimension = 0; + app.DebugPrintf( + "ApplySchematicRuleDefinition: Adding parameter dimension=%d\n", + m_dimension); + } else { + GameRuleDefinition::addAttribute(attributeName, attributeValue); + } } -BoundingBox* ConsoleGenerateStructure::getBoundingBox() -{ - if(boundingBox == NULL) - { - // Find the max bounds - int maxX, maxY, maxZ; - maxX = maxY = maxZ = 1; - for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); ++it) - { - ConsoleGenerateStructureAction *action = *it; - maxX = std::max(maxX,action->getEndX()); - maxY = std::max(maxY,action->getEndY()); - maxZ = std::max(maxZ,action->getEndZ()); - } - - boundingBox = new BoundingBox(m_x, m_y, m_z, m_x + maxX, m_y + maxY, m_z + maxZ); - } - return boundingBox; +BoundingBox* ConsoleGenerateStructure::getBoundingBox() { + if (boundingBox == NULL) { + // Find the max bounds + int maxX, maxY, maxZ; + maxX = maxY = maxZ = 1; + for (AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); ++it) { + ConsoleGenerateStructureAction* action = *it; + maxX = std::max(maxX, action->getEndX()); + maxY = std::max(maxY, action->getEndY()); + maxZ = std::max(maxZ, action->getEndZ()); + } + + boundingBox = + new BoundingBox(m_x, m_y, m_z, m_x + maxX, m_y + maxY, m_z + maxZ); + } + return boundingBox; } -bool ConsoleGenerateStructure::postProcess(Level *level, Random *random, BoundingBox *chunkBB) -{ - if(level->dimension->id != m_dimension) return false; +bool ConsoleGenerateStructure::postProcess(Level* level, Random* random, + BoundingBox* chunkBB) { + if (level->dimension->id != m_dimension) return false; - for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); ++it) - { - ConsoleGenerateStructureAction *action = *it; - - switch(action->getActionType()) - { - case ConsoleGameRules::eGameRuleType_GenerateBox: - { - XboxStructureActionGenerateBox *genBox = (XboxStructureActionGenerateBox *)action; - genBox->generateBoxInLevel(this,level,chunkBB); - } - break; - case ConsoleGameRules::eGameRuleType_PlaceBlock: - { - XboxStructureActionPlaceBlock *pPlaceBlock = (XboxStructureActionPlaceBlock *)action; - pPlaceBlock->placeBlockInLevel(this,level,chunkBB); - } - break; - case ConsoleGameRules::eGameRuleType_PlaceContainer: - { - XboxStructureActionPlaceContainer *pPlaceContainer = (XboxStructureActionPlaceContainer *)action; - pPlaceContainer->placeContainerInLevel(this,level,chunkBB); - } - break; - case ConsoleGameRules::eGameRuleType_PlaceSpawner: - { - XboxStructureActionPlaceSpawner *pPlaceSpawner = (XboxStructureActionPlaceSpawner *)action; - pPlaceSpawner->placeSpawnerInLevel(this,level,chunkBB); - } - break; - default: - break; - }; - } + for (AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); ++it) { + ConsoleGenerateStructureAction* action = *it; - return false; + switch (action->getActionType()) { + case ConsoleGameRules::eGameRuleType_GenerateBox: { + XboxStructureActionGenerateBox* genBox = + (XboxStructureActionGenerateBox*)action; + genBox->generateBoxInLevel(this, level, chunkBB); + } break; + case ConsoleGameRules::eGameRuleType_PlaceBlock: { + XboxStructureActionPlaceBlock* pPlaceBlock = + (XboxStructureActionPlaceBlock*)action; + pPlaceBlock->placeBlockInLevel(this, level, chunkBB); + } break; + case ConsoleGameRules::eGameRuleType_PlaceContainer: { + XboxStructureActionPlaceContainer* pPlaceContainer = + (XboxStructureActionPlaceContainer*)action; + pPlaceContainer->placeContainerInLevel(this, level, chunkBB); + } break; + case ConsoleGameRules::eGameRuleType_PlaceSpawner: { + XboxStructureActionPlaceSpawner* pPlaceSpawner = + (XboxStructureActionPlaceSpawner*)action; + pPlaceSpawner->placeSpawnerInLevel(this, level, chunkBB); + } break; + default: + break; + }; + } + + return false; } -bool ConsoleGenerateStructure::checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1) -{ - return getBoundingBox()->intersects(x0,y0,z0,x1,y1,z1); +bool ConsoleGenerateStructure::checkIntersects(int x0, int y0, int z0, int x1, + int y1, int z1) { + return getBoundingBox()->intersects(x0, y0, z0, x1, y1, z1); } -int ConsoleGenerateStructure::getMinY() -{ - return getBoundingBox()->y0; -} +int ConsoleGenerateStructure::getMinY() { return getBoundingBox()->y0; } diff --git a/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.h b/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.h index e9aaaface..c65280d56 100644 --- a/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.h +++ b/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.h @@ -9,30 +9,41 @@ class ConsoleGenerateStructureAction; class XboxStructureActionPlaceContainer; class GRFObject; -class ConsoleGenerateStructure : public GameRuleDefinition, public StructurePiece -{ +class ConsoleGenerateStructure : public GameRuleDefinition, + public StructurePiece { private: - int m_x, m_y, m_z; - std::vector m_actions; - int m_dimension; -public: - ConsoleGenerateStructure(); + int m_x, m_y, m_z; + std::vector m_actions; + int m_dimension; - virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_GenerateStructure; } +public: + ConsoleGenerateStructure(); - virtual void getChildren(std::vector *children); - virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); - - virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs); - virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); + virtual ConsoleGameRules::EGameRuleType getActionType() { + return ConsoleGameRules::eGameRuleType_GenerateStructure; + } - // StructurePiece - virtual BoundingBox *getBoundingBox(); - virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); + virtual void getChildren(std::vector* children); + virtual GameRuleDefinition* addChild( + ConsoleGameRules::EGameRuleType ruleType); - void createContainer(XboxStructureActionPlaceContainer *action, Level *level, BoundingBox *chunkBB); + virtual void writeAttributes(DataOutputStream* dos, unsigned int numAttrs); + virtual void addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue); - bool checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1); + // StructurePiece + virtual BoundingBox* getBoundingBox(); + virtual bool postProcess(Level* level, Random* random, + BoundingBox* chunkBB); - virtual int getMinY(); -}; + void createContainer(XboxStructureActionPlaceContainer* action, + Level* level, BoundingBox* chunkBB); + + bool checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1); + + virtual int getMinY(); + + EStructurePiece GetType() { return (EStructurePiece)0; } + void addAdditonalSaveData(CompoundTag* tag) {} + void readAdditonalSaveData(CompoundTag* tag) {} +}; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructureAction.h b/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructureAction.h index 14eb2fd86..937b70c34 100644 --- a/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructureAction.h +++ b/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructureAction.h @@ -2,10 +2,9 @@ #include "GameRuleDefinition.h" -class ConsoleGenerateStructureAction : public GameRuleDefinition -{ +class ConsoleGenerateStructureAction : public GameRuleDefinition { public: - virtual int getEndX() = 0; - virtual int getEndY() = 0; - virtual int getEndZ() = 0; + virtual int getEndX() = 0; + virtual int getEndY() = 0; + virtual int getEndZ() = 0; }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.cpp b/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.cpp index 1253db9e8..04d7015c9 100644 --- a/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.cpp @@ -12,1018 +12,1072 @@ #include "../../Minecraft.World/Headers/net.minecraft.world.phys.h" #include "../../Minecraft.World/IO/Streams/Compression.h" -ConsoleSchematicFile::ConsoleSchematicFile() -{ - m_xSize = m_ySize = m_zSize = 0; - m_refCount = 1; - m_data.data = NULL; +ConsoleSchematicFile::ConsoleSchematicFile() { + m_xSize = m_ySize = m_zSize = 0; + m_refCount = 1; + m_data.data = NULL; } -ConsoleSchematicFile::~ConsoleSchematicFile() -{ - app.DebugPrintf("Deleting schematic file\n"); - if(m_data.data != NULL) delete [] m_data.data; +ConsoleSchematicFile::~ConsoleSchematicFile() { + app.DebugPrintf("Deleting schematic file\n"); + if (m_data.data != NULL) delete[] m_data.data; } -void ConsoleSchematicFile::save(DataOutputStream *dos) -{ - if(dos != NULL) - { - dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION); +void ConsoleSchematicFile::save(DataOutputStream* dos) { + if (dos != NULL) { + dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION); - dos->writeByte(APPROPRIATE_COMPRESSION_TYPE); + dos->writeByte(APPROPRIATE_COMPRESSION_TYPE); - dos->writeInt(m_xSize); - dos->writeInt(m_ySize); - dos->writeInt(m_zSize); + dos->writeInt(m_xSize); + dos->writeInt(m_ySize); + dos->writeInt(m_zSize); - byteArray ba(new std::uint8_t[ m_data.length ], m_data.length); - Compression::getCompression()->CompressLZXRLE( ba.data, &ba.length, - m_data.data, m_data.length); + byteArray ba(new std::uint8_t[m_data.length], m_data.length); + Compression::getCompression()->CompressLZXRLE( + ba.data, &ba.length, m_data.data, m_data.length); - dos->writeInt(ba.length); - dos->write(ba); + dos->writeInt(ba.length); + dos->write(ba); - save_tags(dos); + save_tags(dos); - delete [] ba.data; - } + delete[] ba.data; + } } -void ConsoleSchematicFile::load(DataInputStream *dis) -{ - if(dis != NULL) - { - // VERSION CHECK // - int version = dis->readInt(); +void ConsoleSchematicFile::load(DataInputStream* dis) { + if (dis != NULL) { + // VERSION CHECK // + int version = dis->readInt(); - Compression::ECompressionTypes compressionType = Compression::eCompressionType_LZXRLE; + Compression::ECompressionTypes compressionType = + Compression::eCompressionType_LZXRLE; - if (version > XBOX_SCHEMATIC_ORIGINAL_VERSION) // Or later versions - { - compressionType = (Compression::ECompressionTypes)dis->readByte(); - } + if (version > XBOX_SCHEMATIC_ORIGINAL_VERSION) // Or later versions + { + compressionType = (Compression::ECompressionTypes)dis->readByte(); + } - if (version > XBOX_SCHEMATIC_CURRENT_VERSION) - assert(false && "Unrecognised schematic version!!"); + if (version > XBOX_SCHEMATIC_CURRENT_VERSION) + assert(false && "Unrecognised schematic version!!"); - m_xSize = dis->readInt(); - m_ySize = dis->readInt(); - m_zSize = dis->readInt(); + m_xSize = dis->readInt(); + m_ySize = dis->readInt(); + m_zSize = dis->readInt(); - int compressedSize = dis->readInt(); - byteArray compressedBuffer(compressedSize); - dis->readFully(compressedBuffer); + int compressedSize = dis->readInt(); + byteArray compressedBuffer(compressedSize); + dis->readFully(compressedBuffer); - if(m_data.data != NULL) - { - delete [] m_data.data; - m_data.data = NULL; - } + if (m_data.data != NULL) { + delete[] m_data.data; + m_data.data = NULL; + } - if(compressionType == Compression::eCompressionType_None) - { - m_data = compressedBuffer; - } - else - { - unsigned int outputSize = m_xSize * m_ySize * m_zSize * 3/2; - m_data = byteArray(outputSize); + if (compressionType == Compression::eCompressionType_None) { + m_data = compressedBuffer; + } else { + unsigned int outputSize = m_xSize * m_ySize * m_zSize * 3 / 2; + m_data = byteArray(outputSize); - switch(compressionType) - { - case Compression::eCompressionType_RLE: - Compression::getCompression()->DecompressRLE( m_data.data, &m_data.length, compressedBuffer.data, compressedSize); - break; - case APPROPRIATE_COMPRESSION_TYPE: - Compression::getCompression()->DecompressLZXRLE( m_data.data, &m_data.length, compressedBuffer.data, compressedSize); - break; - default: - app.DebugPrintf("Unrecognized compression type for Schematic file (%d)\n", (int)compressionType); - Compression::getCompression()->SetDecompressionType( (Compression::ECompressionTypes)compressionType ); - Compression::getCompression()->DecompressLZXRLE( m_data.data, &m_data.length, compressedBuffer.data, compressedSize); - Compression::getCompression()->SetDecompressionType( APPROPRIATE_COMPRESSION_TYPE ); - }; + switch (compressionType) { + case Compression::eCompressionType_RLE: + Compression::getCompression()->DecompressRLE( + m_data.data, &m_data.length, compressedBuffer.data, + compressedSize); + break; + case APPROPRIATE_COMPRESSION_TYPE: + Compression::getCompression()->DecompressLZXRLE( + m_data.data, &m_data.length, compressedBuffer.data, + compressedSize); + break; + default: + app.DebugPrintf( + "Unrecognized compression type for Schematic file " + "(%d)\n", + (int)compressionType); + Compression::getCompression()->SetDecompressionType( + (Compression::ECompressionTypes)compressionType); + Compression::getCompression()->DecompressLZXRLE( + m_data.data, &m_data.length, compressedBuffer.data, + compressedSize); + Compression::getCompression()->SetDecompressionType( + APPROPRIATE_COMPRESSION_TYPE); + }; - delete [] compressedBuffer.data; - } + delete[] compressedBuffer.data; + } - // READ TAGS // - // 4jcraft, fixed cast of templated List to get the tag list - // and cast it to CompoundTag inside the loop - CompoundTag *tag = NbtIo::read(dis); - ListTag *tileEntityTags = tag->getList(L"TileEntities"); - if (tileEntityTags != NULL) - { - for (int i = 0; i < tileEntityTags->size(); i++) - { - CompoundTag *teTag = (CompoundTag*) tileEntityTags->get(i); - std::shared_ptr te = TileEntity::loadStatic(teTag); + // READ TAGS // + // 4jcraft, fixed cast of templated List to get the tag list + // and cast it to CompoundTag inside the loop + CompoundTag* tag = NbtIo::read(dis); + ListTag* tileEntityTags = tag->getList(L"TileEntities"); + if (tileEntityTags != NULL) { + for (int i = 0; i < tileEntityTags->size(); i++) { + CompoundTag* teTag = (CompoundTag*)tileEntityTags->get(i); + std::shared_ptr te = TileEntity::loadStatic(teTag); - if(te == NULL) - { + if (te == NULL) { #ifndef _CONTENT_PACKAGE - app.DebugPrintf("ConsoleSchematicFile has read a NULL tile entity\n"); - __debugbreak(); + app.DebugPrintf( + "ConsoleSchematicFile has read a NULL tile entity\n"); + __debugbreak(); #endif - } - else - { - m_tileEntities.push_back(te); - } - } - } + } else { + m_tileEntities.push_back(te); + } + } + } - // 4jcraft, fixed cast of templated List to get the tag list - // and cast it to CompoundTag inside the loop - ListTag *entityTags = tag->getList(L"Entities"); - if (entityTags != NULL) - { - for (int i = 0; i < entityTags->size(); i++) - { - CompoundTag *eTag = (CompoundTag*) entityTags->get(i); - eINSTANCEOF type = EntityIO::getType(eTag->getString(L"id")); + // 4jcraft, fixed cast of templated List to get the tag list + // and cast it to CompoundTag inside the loop + ListTag* entityTags = tag->getList(L"Entities"); + if (entityTags != NULL) { + for (int i = 0; i < entityTags->size(); i++) { + CompoundTag* eTag = (CompoundTag*)entityTags->get(i); + eINSTANCEOF type = EntityIO::getType(eTag->getString(L"id")); - // 4jcraft, same here - ListTag *pos = eTag->getList(L"Pos"); + // 4jcraft, same here + ListTag* pos = eTag->getList(L"Pos"); - double x = ((DoubleTag*) pos->get(0))->data; - double y = ((DoubleTag*) pos->get(1))->data; - double z = ((DoubleTag*) pos->get(2))->data; + double x = ((DoubleTag*)pos->get(0))->data; + double y = ((DoubleTag*)pos->get(1))->data; + double z = ((DoubleTag*)pos->get(2))->data; - 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; - } + 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; + } #ifdef _DEBUG - //app.DebugPrintf(1,"Loaded entity type %d at (%f,%f,%f)\n",(int)type,x,y,z); + // app.DebugPrintf(1,"Loaded entity type %d at + // (%f,%f,%f)\n",(int)type,x,y,z); #endif - m_entities.push_back( std::pair(Vec3::newPermanent(x,y,z),(CompoundTag *)eTag->copy())); - } - } - delete tag; - } + m_entities.push_back(std::pair( + Vec3::newPermanent(x, y, z), (CompoundTag*)eTag->copy())); + } + } + delete tag; + } } -void ConsoleSchematicFile::save_tags(DataOutputStream *dos) -{ - CompoundTag *tag = new CompoundTag(); +void ConsoleSchematicFile::save_tags(DataOutputStream* dos) { + CompoundTag* tag = new CompoundTag(); - ListTag *tileEntityTags = new ListTag(); - tag->put(L"TileEntities", tileEntityTags); + ListTag* tileEntityTags = new ListTag(); + tag->put(L"TileEntities", tileEntityTags); - for (AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end(); it++) - { - CompoundTag *cTag = new CompoundTag(); - (*it)->save(cTag); - tileEntityTags->add(cTag); - } + for (AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end(); + it++) { + CompoundTag* cTag = new CompoundTag(); + (*it)->save(cTag); + tileEntityTags->add(cTag); + } - ListTag *entityTags = new ListTag(); - tag->put(L"Entities", entityTags); + ListTag* entityTags = new ListTag(); + tag->put(L"Entities", entityTags); - for (AUTO_VAR(it, m_entities.begin()); it != m_entities.end(); it++) - entityTags->add( (CompoundTag *)(*it).second->copy() ); + for (AUTO_VAR(it, m_entities.begin()); it != m_entities.end(); it++) + entityTags->add((CompoundTag*)(*it).second->copy()); - NbtIo::write(tag,dos); - delete tag; + NbtIo::write(tag, dos); + delete tag; } -__int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot) -{ - int xStart = std::max(destinationBox->x0, (double)chunk->x*16); - // 4jcraft changed from (xStart>>4)<<4 to (xStart & ~15) - int xEnd = std::min(destinationBox->x1, (double)((xStart & ~15) + 16)); +__int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk* chunk, + AABB* chunkBox, + AABB* destinationBox, + ESchematicRotation rot) { + int xStart = std::max(destinationBox->x0, (double)chunk->x * 16); + // 4jcraft changed from (xStart>>4)<<4 to (xStart & ~15) + int xEnd = std::min(destinationBox->x1, (double)((xStart & ~15) + 16)); - int yStart = destinationBox->y0; - int yEnd = destinationBox->y1; - if(yEnd > Level::maxBuildHeight) yEnd = Level::maxBuildHeight; + int yStart = destinationBox->y0; + int yEnd = destinationBox->y1; + if (yEnd > Level::maxBuildHeight) yEnd = Level::maxBuildHeight; - int zStart = std::max(destinationBox->z0, (double)chunk->z*16); - int zEnd = std::min(destinationBox->z1, (double)(zStart & ~15) + 16); + int zStart = std::max(destinationBox->z0, (double)chunk->z * 16); + int zEnd = std::min(destinationBox->z1, (double)(zStart & ~15) + 16); #ifdef _DEBUG - app.DebugPrintf("Range is (%d,%d,%d) to (%d,%d,%d)\n",xStart,yStart,zStart,xEnd-1,yEnd-1,zEnd-1); + app.DebugPrintf("Range is (%d,%d,%d) to (%d,%d,%d)\n", xStart, yStart, + zStart, xEnd - 1, yEnd - 1, zEnd - 1); #endif - int rowBlocksIncluded = (yEnd-yStart)*(zEnd-zStart); - int blocksIncluded = (xEnd-xStart)*rowBlocksIncluded; + int rowBlocksIncluded = (yEnd - yStart) * (zEnd - zStart); + int blocksIncluded = (xEnd - xStart) * rowBlocksIncluded; - int rowBlockCount = getYSize() * getZSize(); - int totalBlockCount = getXSize() * rowBlockCount; + int rowBlockCount = getYSize() * getZSize(); + int totalBlockCount = getXSize() * rowBlockCount; - byteArray blockData = byteArray(Level::CHUNK_TILE_COUNT); - PIXBeginNamedEvent(0,"Getting block data"); - chunk->getBlockData(blockData); - PIXEndNamedEvent(); - byteArray dataData = byteArray(Level::HALF_CHUNK_TILE_COUNT); - PIXBeginNamedEvent(0,"Getting Data data"); - chunk->getDataData(dataData); - PIXEndNamedEvent(); + byteArray blockData = byteArray(Level::CHUNK_TILE_COUNT); + PIXBeginNamedEvent(0, "Getting block data"); + chunk->getBlockData(blockData); + PIXEndNamedEvent(); + byteArray dataData = byteArray(Level::HALF_CHUNK_TILE_COUNT); + PIXBeginNamedEvent(0, "Getting Data data"); + chunk->getDataData(dataData); + PIXEndNamedEvent(); - // Ignore light data - int blockLightP = -1; - int skyLightP = -1; - if( rot == eSchematicRot_90 || rot == eSchematicRot_180 || rot == eSchematicRot_270 ) - { - int schematicXRow = 0; - int schematicZRow = 0; - int blocksP = 0; - int dataP = 0; + // Ignore light data + int blockLightP = -1; + int skyLightP = -1; + if (rot == eSchematicRot_90 || rot == eSchematicRot_180 || + rot == eSchematicRot_270) { + int schematicXRow = 0; + int schematicZRow = 0; + int blocksP = 0; + int dataP = 0; - for(int x = xStart; x < xEnd; ++x) - { - int x0 = x - chunk->x*16; - int x1 = x0 + 1; + for (int x = xStart; x < xEnd; ++x) { + int x0 = x - chunk->x * 16; + int x1 = x0 + 1; - for(int z = zStart; z < zEnd; ++z) - { - int z0 = z - chunk->z*16; - int z1 = z0 + 1; + for (int z = zStart; z < zEnd; ++z) { + int z0 = z - chunk->z * 16; + int z1 = z0 + 1; - chunkCoordToSchematicCoord(destinationBox, x, z, rot, schematicXRow, schematicZRow); - blocksP = (schematicXRow*rowBlockCount) + (schematicZRow*getYSize()); - dataP = totalBlockCount + (blocksP)/2; + chunkCoordToSchematicCoord(destinationBox, x, z, rot, + schematicXRow, schematicZRow); + blocksP = (schematicXRow * rowBlockCount) + + (schematicZRow * getYSize()); + dataP = totalBlockCount + (blocksP) / 2; - ConsoleSchematicFile::setBlocksAndData(chunk,blockData,dataData,m_data, x0, yStart, z0, x1, yEnd, z1, blocksP, dataP, blockLightP, skyLightP); - } - } - } - else if( rot == eSchematicRot_0 ) - { - // The initial pointer offsets for the different data types - int schematicXRow = xStart - destinationBox->x0; - int schematicZRow = zStart - destinationBox->z0; - int blocksP = (schematicXRow*rowBlockCount) + (schematicZRow*getYSize()); - int dataP = totalBlockCount + (schematicXRow*rowBlockCount + (schematicZRow*getYSize()))/2; + ConsoleSchematicFile::setBlocksAndData( + chunk, blockData, dataData, m_data, x0, yStart, z0, x1, + yEnd, z1, blocksP, dataP, blockLightP, skyLightP); + } + } + } else if (rot == eSchematicRot_0) { + // The initial pointer offsets for the different data types + int schematicXRow = xStart - destinationBox->x0; + int schematicZRow = zStart - destinationBox->z0; + int blocksP = + (schematicXRow * rowBlockCount) + (schematicZRow * getYSize()); + int dataP = + totalBlockCount + + (schematicXRow * rowBlockCount + (schematicZRow * getYSize())) / 2; - for(int x = xStart; x < xEnd; ++x) - { - int x0 = x - chunk->x*16; - int x1 = x0 + 1; + for (int x = xStart; x < xEnd; ++x) { + int x0 = x - chunk->x * 16; + int x1 = x0 + 1; - int z0 = zStart - chunk->z*16; - int z1 = zEnd - chunk->z*16; + int z0 = zStart - chunk->z * 16; + int z1 = zEnd - chunk->z * 16; - ConsoleSchematicFile::setBlocksAndData(chunk,blockData,dataData,m_data, x0, yStart, z0, x1, yEnd, z1, blocksP, dataP, blockLightP, skyLightP); - // update all pointer positions - // For z start to z end - // Set blocks and data - // increment z by the right amount - blocksP += (rowBlockCount-rowBlocksIncluded); - dataP += (rowBlockCount-rowBlocksIncluded)/2; - } - } - else - { - app.DebugPrintf("ERROR: Rotation of block and data not implemented!!\n"); - } + ConsoleSchematicFile::setBlocksAndData( + chunk, blockData, dataData, m_data, x0, yStart, z0, x1, yEnd, + z1, blocksP, dataP, blockLightP, skyLightP); + // update all pointer positions + // For z start to z end + // Set blocks and data + // increment z by the right amount + blocksP += (rowBlockCount - rowBlocksIncluded); + dataP += (rowBlockCount - rowBlocksIncluded) / 2; + } + } else { + app.DebugPrintf( + "ERROR: Rotation of block and data not implemented!!\n"); + } - // 4J Stu - Hack for ME pack to replace sand with end stone in schematics - //for(int i = 0; i < blockData.length; ++i) - //{ - // if(blockData[i] == Tile::sand_Id || blockData[i] == Tile::sandStone_Id) - // { - // blockData[i] = Tile::whiteStone_Id; - // } - //} - - PIXBeginNamedEvent(0,"Setting Block data"); - chunk->setBlockData(blockData); - PIXEndNamedEvent(); - delete[] blockData.data; //4jcraft changed to array delete - chunk->recalcHeightmapOnly(); - PIXBeginNamedEvent(0,"Setting Data data"); - chunk->setDataData(dataData); - PIXEndNamedEvent(); - delete[] dataData.data; //4jcraft, same here + // 4J Stu - Hack for ME pack to replace sand with end stone in schematics + // for(int i = 0; i < blockData.length; ++i) + //{ + // if(blockData[i] == Tile::sand_Id || blockData[i] == Tile::sandStone_Id) + // { + // blockData[i] = Tile::whiteStone_Id; + // } + //} - // A basic pass through to roughly do the lighting. At this point of post-processing, we don't have all the neighbouring chunks loaded in, - // so any lighting here should be things that won't propagate out of this chunk. - for( int xx = xStart ; xx < xEnd; xx++ ) - for( int y = yStart ; y < yEnd; y++ ) - for( int zz = zStart ; zz < zEnd; zz++ ) - { - int x = xx - chunk->x * 16; - int z = zz - chunk->z * 16; - chunk->setBrightness(LightLayer::Block,x,y,z,0); - if( chunk->getTile(x,y,z) ) - { - chunk->setBrightness(LightLayer::Sky,x,y,z,0); - } - else - { - if( chunk->isSkyLit(x,y,z) ) - { - chunk->setBrightness(LightLayer::Sky,x,y,z,15); - } - else - { - chunk->setBrightness(LightLayer::Sky,x,y,z,0); - } - } - } + PIXBeginNamedEvent(0, "Setting Block data"); + chunk->setBlockData(blockData); + PIXEndNamedEvent(); + delete[] blockData.data; // 4jcraft changed to array delete + chunk->recalcHeightmapOnly(); + PIXBeginNamedEvent(0, "Setting Data data"); + chunk->setDataData(dataData); + PIXEndNamedEvent(); + delete[] dataData.data; // 4jcraft, same here - return blocksIncluded; + // A basic pass through to roughly do the lighting. At this point of + // post-processing, we don't have all the neighbouring chunks loaded in, so + // any lighting here should be things that won't propagate out of this + // chunk. + for (int xx = xStart; xx < xEnd; xx++) + for (int y = yStart; y < yEnd; y++) + for (int zz = zStart; zz < zEnd; zz++) { + int x = xx - chunk->x * 16; + int z = zz - chunk->z * 16; + chunk->setBrightness(LightLayer::Block, x, y, z, 0); + if (chunk->getTile(x, y, z)) { + chunk->setBrightness(LightLayer::Sky, x, y, z, 0); + } else { + if (chunk->isSkyLit(x, y, z)) { + chunk->setBrightness(LightLayer::Sky, x, y, z, 15); + } else { + chunk->setBrightness(LightLayer::Sky, x, y, z, 0); + } + } + } + + return blocksIncluded; } -// At the point that this is called, we have all the neighbouring chunks loaded in (and generally post-processed, apart from this lighting pass), so -// we can do the sort of lighting that might propagate out of the chunk. -__int64 ConsoleSchematicFile::applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot) -{ - int xStart = std::max(destinationBox->x0, (double)chunk->x*16); - // 4jcraft changed >>4<<4 to & ~15 - int xEnd = std::min(destinationBox->x1, (double)(xStart & ~15) + 16); +// At the point that this is called, we have all the neighbouring chunks loaded +// in (and generally post-processed, apart from this lighting pass), so we can +// do the sort of lighting that might propagate out of the chunk. +__int64 ConsoleSchematicFile::applyLighting(LevelChunk* chunk, AABB* chunkBox, + AABB* destinationBox, + ESchematicRotation rot) { + int xStart = std::max(destinationBox->x0, (double)chunk->x * 16); + // 4jcraft changed >>4<<4 to & ~15 + int xEnd = std::min(destinationBox->x1, (double)(xStart & ~15) + 16); - int yStart = destinationBox->y0; - int yEnd = destinationBox->y1; - if(yEnd > Level::maxBuildHeight) yEnd = Level::maxBuildHeight; + int yStart = destinationBox->y0; + int yEnd = destinationBox->y1; + if (yEnd > Level::maxBuildHeight) yEnd = Level::maxBuildHeight; - int zStart = std::max(destinationBox->z0, (double)chunk->z*16); - int zEnd = std::min(destinationBox->z1, (double)(zStart & ~15) + 16); + int zStart = std::max(destinationBox->z0, (double)chunk->z * 16); + int zEnd = std::min(destinationBox->z1, (double)(zStart & ~15) + 16); - int rowBlocksIncluded = (yEnd-yStart)*(zEnd-zStart); - int blocksIncluded = (xEnd-xStart)*rowBlocksIncluded; + int rowBlocksIncluded = (yEnd - yStart) * (zEnd - zStart); + int blocksIncluded = (xEnd - xStart) * rowBlocksIncluded; - // Now actually do a checkLight on blocks that might need it, which should more accurately put everything in place - for( int xx = xStart ; xx < xEnd; xx++ ) - for( int y = yStart ; y < yEnd; y++ ) - for( int zz = zStart ; zz < zEnd; zz++ ) - { - int x = xx - chunk->x * 16; - int z = zz - chunk->z * 16; + // Now actually do a checkLight on blocks that might need it, which should + // more accurately put everything in place + for (int xx = xStart; xx < xEnd; xx++) + for (int y = yStart; y < yEnd; y++) + for (int zz = zStart; zz < zEnd; zz++) { + int x = xx - chunk->x * 16; + int z = zz - chunk->z * 16; - if( y <= chunk->getHeightmap( x, z ) ) - { - chunk->level->checkLight(LightLayer::Sky, xx, y, zz, true); - } - if( Tile::lightEmission[chunk->getTile(x,y,z)] ) - { - // Note that this lighting passes a rootOnlyEmissive flag of true, which means that only the location xx/y/zz is considered - // as possibly being a source of emissive light, not other tiles that we might encounter whilst propagating the light from - // the start location. If we don't do this, and Do encounter another emissive source in the radius of influence that the first - // light source had, then we'll start also lighting from that tile but won't actually be able to progatate that second light - // fully since checkLight only has a finite radius of 17 from the start position that it can light. Then when we do a checkLight - // on the second light later, it won't bother doing anything because the light level at the location of the tile itself will be correct. - chunk->level->checkLight(LightLayer::Block, xx, y, zz, true, true); - } - } + if (y <= chunk->getHeightmap(x, z)) { + chunk->level->checkLight(LightLayer::Sky, xx, y, zz, true); + } + if (Tile::lightEmission[chunk->getTile(x, y, z)]) { + // Note that this lighting passes a rootOnlyEmissive flag of + // true, which means that only the location xx/y/zz is + // considered as possibly being a source of emissive light, + // not other tiles that we might encounter whilst + // propagating the light from the start location. If we + // don't do this, and Do encounter another emissive source + // in the radius of influence that the first light source + // had, then we'll start also lighting from that tile but + // won't actually be able to progatate that second light + // fully since checkLight only has a finite radius of 17 + // from the start position that it can light. Then when we + // do a checkLight on the second light later, it won't + // bother doing anything because the light level at the + // location of the tile itself will be correct. + chunk->level->checkLight(LightLayer::Block, xx, y, zz, true, + true); + } + } - return blocksIncluded; + return blocksIncluded; } -void ConsoleSchematicFile::chunkCoordToSchematicCoord(AABB *destinationBox, int chunkX, int chunkZ, ESchematicRotation rot, int &schematicX, int &schematicZ) -{ - switch(rot) - { - case eSchematicRot_90: - // schematicX decreases as chunkZ increases - // schematicZ increases as chunkX increases - schematicX = chunkZ - destinationBox->z0; - schematicZ = (destinationBox->x1 - 1 - destinationBox->x0) - (chunkX - destinationBox->x0); - break; - case eSchematicRot_180: - // schematicX decreases as chunkX increases - // schematicZ decreases as chunkZ increases - schematicX = (destinationBox->x1 - 1 - destinationBox->x0) - (chunkX - destinationBox->x0); - schematicZ = (destinationBox->z1 - 1 - destinationBox->z0) - (chunkZ - destinationBox->z0); - break; - case eSchematicRot_270: - // schematicX increases as chunkZ increases - // shcematicZ decreases as chunkX increases - schematicX = (destinationBox->z1 - 1 - destinationBox->z0) - (chunkZ - destinationBox->z0); - schematicZ = chunkX - destinationBox->x0; - break; - case eSchematicRot_0: - default: - // schematicX increases as chunkX increases - // schematicZ increases as chunkZ increases - schematicX = chunkX - destinationBox->x0; - schematicZ = chunkZ - destinationBox->z0; - break; - }; +void ConsoleSchematicFile::chunkCoordToSchematicCoord(AABB* destinationBox, + int chunkX, int chunkZ, + ESchematicRotation rot, + int& schematicX, + int& schematicZ) { + switch (rot) { + case eSchematicRot_90: + // schematicX decreases as chunkZ increases + // schematicZ increases as chunkX increases + schematicX = chunkZ - destinationBox->z0; + schematicZ = (destinationBox->x1 - 1 - destinationBox->x0) - + (chunkX - destinationBox->x0); + break; + case eSchematicRot_180: + // schematicX decreases as chunkX increases + // schematicZ decreases as chunkZ increases + schematicX = (destinationBox->x1 - 1 - destinationBox->x0) - + (chunkX - destinationBox->x0); + schematicZ = (destinationBox->z1 - 1 - destinationBox->z0) - + (chunkZ - destinationBox->z0); + break; + case eSchematicRot_270: + // schematicX increases as chunkZ increases + // shcematicZ decreases as chunkX increases + schematicX = (destinationBox->z1 - 1 - destinationBox->z0) - + (chunkZ - destinationBox->z0); + schematicZ = chunkX - destinationBox->x0; + break; + case eSchematicRot_0: + default: + // schematicX increases as chunkX increases + // schematicZ increases as chunkZ increases + schematicX = chunkX - destinationBox->x0; + schematicZ = chunkZ - destinationBox->z0; + break; + }; } -void ConsoleSchematicFile::schematicCoordToChunkCoord(AABB *destinationBox, double schematicX, double schematicZ, ESchematicRotation rot, double &chunkX, double &chunkZ) -{ - switch(rot) - { - case eSchematicRot_90: - // schematicX decreases as chunkZ increases - // schematicZ increases as chunkX increases - chunkX = (destinationBox->x1 - 1 - schematicZ); - chunkZ = schematicX + destinationBox->z0; - break; - case eSchematicRot_180: - // schematicX decreases as chunkX increases - // schematicZ decreases as chunkZ increases - chunkX = (destinationBox->x1 - 1 - schematicX); - chunkZ = (destinationBox->z1 - 1 - schematicZ); - break; - case eSchematicRot_270: - // schematicX increases as chunkZ increases - // shcematicZ decreases as chunkX increases - chunkX = schematicZ + destinationBox->x0; - chunkZ = (destinationBox->z1 - 1 - schematicX); - break; - case eSchematicRot_0: - default: - // schematicX increases as chunkX increases - // schematicZ increases as chunkZ increases - chunkX = schematicX + destinationBox->x0; - chunkZ = schematicZ + destinationBox->z0; - break; - }; +void ConsoleSchematicFile::schematicCoordToChunkCoord( + AABB* destinationBox, double schematicX, double schematicZ, + ESchematicRotation rot, double& chunkX, double& chunkZ) { + switch (rot) { + case eSchematicRot_90: + // schematicX decreases as chunkZ increases + // schematicZ increases as chunkX increases + chunkX = (destinationBox->x1 - 1 - schematicZ); + chunkZ = schematicX + destinationBox->z0; + break; + case eSchematicRot_180: + // schematicX decreases as chunkX increases + // schematicZ decreases as chunkZ increases + chunkX = (destinationBox->x1 - 1 - schematicX); + chunkZ = (destinationBox->z1 - 1 - schematicZ); + break; + case eSchematicRot_270: + // schematicX increases as chunkZ increases + // shcematicZ decreases as chunkX increases + chunkX = schematicZ + destinationBox->x0; + chunkZ = (destinationBox->z1 - 1 - schematicX); + break; + case eSchematicRot_0: + default: + // schematicX increases as chunkX increases + // schematicZ increases as chunkZ increases + chunkX = schematicX + destinationBox->x0; + chunkZ = schematicZ + destinationBox->z0; + break; + }; } -void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot) -{ - for(AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end();++it) - { - std::shared_ptr te = *it; +void ConsoleSchematicFile::applyTileEntities(LevelChunk* chunk, AABB* chunkBox, + AABB* destinationBox, + ESchematicRotation rot) { + for (AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end(); + ++it) { + std::shared_ptr te = *it; - double targetX = te->x; - double targetY = te->y + destinationBox->y0; - double targetZ = te->z; + double targetX = te->x; + double targetY = te->y + destinationBox->y0; + double targetZ = te->z; - schematicCoordToChunkCoord(destinationBox, te->x, te->z, rot, targetX, targetZ); + schematicCoordToChunkCoord(destinationBox, te->x, te->z, rot, targetX, + targetZ); - Vec3 *pos = Vec3::newTemp(targetX,targetY,targetZ); - if( chunkBox->containsIncludingLowerBound(pos) ) - { - std::shared_ptr teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 ); + Vec3* pos = Vec3::newTemp(targetX, targetY, targetZ); + if (chunkBox->containsIncludingLowerBound(pos)) { + std::shared_ptr teCopy = chunk->getTileEntity( + (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15); - if ( teCopy != NULL ) - { - CompoundTag *teData = new CompoundTag(); - te->save(teData); + if (teCopy != NULL) { + CompoundTag* teData = new CompoundTag(); + te->save(teData); - teCopy->load(teData); + teCopy->load(teData); - delete teData; + delete teData; - // Adjust the tileEntity position to world coords from schematic co-ords - teCopy->x = targetX; - teCopy->y = targetY; - teCopy->z = targetZ; + // Adjust the tileEntity position to world coords from schematic + // co-ords + teCopy->x = targetX; + teCopy->y = targetY; + teCopy->z = targetZ; - // Remove the current tile entity - //chunk->removeTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 ); - } - else - { - teCopy = te->clone(); + // Remove the current tile entity + // chunk->removeTileEntity( (int)targetX & 15, (int)targetY & + // 15, (int)targetZ & 15 ); + } else { + teCopy = te->clone(); - // Adjust the tileEntity position to world coords from schematic co-ords - teCopy->x = targetX; - teCopy->y = targetY; - teCopy->z = targetZ; - chunk->addTileEntity(teCopy); - } + // Adjust the tileEntity position to world coords from schematic + // co-ords + teCopy->x = targetX; + teCopy->y = targetY; + teCopy->z = targetZ; + chunk->addTileEntity(teCopy); + } - teCopy->setChanged(); - } - } - for(AUTO_VAR(it, m_entities.begin()); it != m_entities.end();) - { - Vec3 *source = it->first; - - double targetX = source->x; - double targetY = source->y + destinationBox->y0; - double targetZ = source->z; - schematicCoordToChunkCoord(destinationBox, source->x, source->z, rot, targetX, targetZ); + teCopy->setChanged(); + } + } + for (AUTO_VAR(it, m_entities.begin()); it != m_entities.end();) { + Vec3* source = it->first; - // Add 0.01 as the AABB::contains function returns false if a value is <= the lower bound - Vec3 *pos = Vec3::newTemp(targetX+0.01,targetY+0.01,targetZ+0.01); - if( !chunkBox->containsIncludingLowerBound(pos) ) - { - ++it; - continue; - } + double targetX = source->x; + double targetY = source->y + destinationBox->y0; + double targetZ = source->z; + schematicCoordToChunkCoord(destinationBox, source->x, source->z, rot, + targetX, targetZ); - CompoundTag *eTag = it->second; - std::shared_ptr e = EntityIO::loadStatic(eTag, NULL); + // Add 0.01 as the AABB::contains function returns false if a value is + // <= the lower bound + Vec3* pos = + Vec3::newTemp(targetX + 0.01, targetY + 0.01, targetZ + 0.01); + if (!chunkBox->containsIncludingLowerBound(pos)) { + ++it; + continue; + } - if( e->GetType() == eTYPE_PAINTING ) - { - std::shared_ptr painting = std::dynamic_pointer_cast(e); - - double tileX = painting->xTile; - double tileZ = painting->zTile; - schematicCoordToChunkCoord(destinationBox, painting->xTile, painting->zTile, rot, tileX, tileZ); + CompoundTag* eTag = it->second; + std::shared_ptr e = EntityIO::loadStatic(eTag, NULL); - painting->yTile += destinationBox->y0; - painting->xTile = tileX; - painting->zTile = tileZ; - painting->setDir(painting->dir); - } - else if( e->GetType() == eTYPE_ITEM_FRAME ) - { - std::shared_ptr frame = std::dynamic_pointer_cast(e); - - double tileX = frame->xTile; - double tileZ = frame->zTile; - schematicCoordToChunkCoord(destinationBox, frame->xTile, frame->zTile, rot, tileX, tileZ); + if (e->GetType() == eTYPE_PAINTING) { + std::shared_ptr painting = + std::dynamic_pointer_cast(e); - frame->yTile += destinationBox->y0; - frame->xTile = tileX; - frame->zTile = tileZ; - frame->setDir(frame->dir); - } - else - { - e->absMoveTo(targetX, targetY, targetZ,e->yRot,e->xRot); - } + double tileX = painting->xTile; + double tileZ = painting->zTile; + schematicCoordToChunkCoord(destinationBox, painting->xTile, + painting->zTile, rot, tileX, tileZ); + + painting->yTile += destinationBox->y0; + painting->xTile = tileX; + painting->zTile = tileZ; + painting->setDir(painting->dir); + } else if (e->GetType() == eTYPE_ITEM_FRAME) { + std::shared_ptr frame = + std::dynamic_pointer_cast(e); + + double tileX = frame->xTile; + double tileZ = frame->zTile; + schematicCoordToChunkCoord(destinationBox, frame->xTile, + frame->zTile, rot, tileX, tileZ); + + frame->yTile += destinationBox->y0; + frame->xTile = tileX; + frame->zTile = tileZ; + frame->setDir(frame->dir); + } else { + e->absMoveTo(targetX, targetY, targetZ, e->yRot, e->xRot); + } #ifdef _DEBUG - app.DebugPrintf("Adding entity type %d at (%f,%f,%f)\n",e->GetType(),e->x,e->y,e->z); + app.DebugPrintf("Adding entity type %d at (%f,%f,%f)\n", e->GetType(), + e->x, e->y, e->z); #endif - e->setLevel(chunk->level); - e->resetSmallId(); - e->setDespawnProtected(); // default to being protected against despawning - chunk->level->addEntity(e); + e->setLevel(chunk->level); + e->resetSmallId(); + e->setDespawnProtected(); // default to being protected against + // despawning + chunk->level->addEntity(e); - // 4J Stu - Until we can copy every type of entity, remove them from this vector - // This means that the entities will only exist in the first use of the schematic that is processed - //it = m_entities.erase(it); - ++it; - } + // 4J Stu - Until we can copy every type of entity, remove them from + // this vector This means that the entities will only exist in the first + // use of the schematic that is processed + // it = m_entities.erase(it); + ++it; + } } -void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *level, int xStart, int yStart, int zStart, int xEnd, int yEnd, int zEnd, bool bSaveMobs, Compression::ECompressionTypes compressionType) -{ - assert(xEnd > xStart); - assert(yEnd > yStart); - assert(zEnd > zStart); - // 4J Stu - Enforce even numbered positions to start with to avoid problems with half-bytes in data +void ConsoleSchematicFile::generateSchematicFile( + DataOutputStream* dos, Level* level, int xStart, int yStart, int zStart, + int xEnd, int yEnd, int zEnd, bool bSaveMobs, + Compression::ECompressionTypes compressionType) { + assert(xEnd > xStart); + assert(yEnd > yStart); + assert(zEnd > zStart); + // 4J Stu - Enforce even numbered positions to start with to avoid problems + // with half-bytes in data - // We want the start to be even - if(xStart > 0 && xStart%2 != 0) - xStart-=1; - else if(xStart < 0 && xStart%2 !=0) - xStart-=1; - if(yStart < 0) yStart = 0; - else if(yStart > 0 && yStart%2 != 0) - yStart-=1; - if(zStart > 0 && zStart%2 != 0) - zStart-=1; - else if(zStart < 0 && zStart%2 !=0) - zStart-=1; - - // We want the end to be odd to have a total size that is even - if(xEnd > 0 && xEnd%2 == 0) - xEnd+=1; - else if(xEnd < 0 && xEnd%2 ==0) - xEnd+=1; - if(yEnd > Level::maxBuildHeight) - yEnd = Level::maxBuildHeight; - else if(yEnd > 0 && yEnd%2 == 0) - yEnd+=1; - else if(yEnd < 0 && yEnd%2 ==0) - yEnd+=1; - if(zEnd > 0 && zEnd%2 == 0) - zEnd+=1; - else if(zEnd < 0 && zEnd%2 ==0) - zEnd+=1; + // We want the start to be even + if (xStart > 0 && xStart % 2 != 0) + xStart -= 1; + else if (xStart < 0 && xStart % 2 != 0) + xStart -= 1; + if (yStart < 0) + yStart = 0; + else if (yStart > 0 && yStart % 2 != 0) + yStart -= 1; + if (zStart > 0 && zStart % 2 != 0) + zStart -= 1; + else if (zStart < 0 && zStart % 2 != 0) + zStart -= 1; - int xSize = xEnd - xStart + 1; - int ySize = yEnd - yStart + 1; - int zSize = zEnd - zStart + 1; + // We want the end to be odd to have a total size that is even + if (xEnd > 0 && xEnd % 2 == 0) + xEnd += 1; + else if (xEnd < 0 && xEnd % 2 == 0) + xEnd += 1; + if (yEnd > Level::maxBuildHeight) + yEnd = Level::maxBuildHeight; + else if (yEnd > 0 && yEnd % 2 == 0) + yEnd += 1; + else if (yEnd < 0 && yEnd % 2 == 0) + yEnd += 1; + if (zEnd > 0 && zEnd % 2 == 0) + zEnd += 1; + else if (zEnd < 0 && zEnd % 2 == 0) + zEnd += 1; - app.DebugPrintf("Generating schematic file for area (%d,%d,%d) to (%d,%d,%d), %dx%dx%d\n",xStart,yStart,zStart,xEnd,yEnd,zEnd,xSize,ySize,zSize); + int xSize = xEnd - xStart + 1; + int ySize = yEnd - yStart + 1; + int zSize = zEnd - zStart + 1; - if(dos != NULL) dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION); + app.DebugPrintf( + "Generating schematic file for area (%d,%d,%d) to (%d,%d,%d), " + "%dx%dx%d\n", + xStart, yStart, zStart, xEnd, yEnd, zEnd, xSize, ySize, zSize); - if(dos != NULL) dos->writeByte(compressionType); + if (dos != NULL) dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION); - //Write xSize - if(dos != NULL) dos->writeInt(xSize); + if (dos != NULL) dos->writeByte(compressionType); - //Write ySize - if(dos != NULL) dos->writeInt(ySize); + // Write xSize + if (dos != NULL) dos->writeInt(xSize); - //Write zSize - if(dos != NULL) dos->writeInt(zSize); + // Write ySize + if (dos != NULL) dos->writeInt(ySize); - //byteArray rawBuffer = level->getBlocksAndData(xStart, yStart, zStart, xSize, ySize, zSize, false); - int xRowSize = ySize * zSize; - int blockCount = xSize * xRowSize; - byteArray result( blockCount * 3 / 2 ); + // Write zSize + if (dos != NULL) dos->writeInt(zSize); - // Position pointers into the data when not ordered by chunk - int p = 0; - int dataP = blockCount; - int blockLightP = -1; - int skyLightP = -1; + // byteArray rawBuffer = level->getBlocksAndData(xStart, yStart, zStart, + // xSize, ySize, zSize, false); + int xRowSize = ySize * zSize; + int blockCount = xSize * xRowSize; + byteArray result(blockCount * 3 / 2); - int y0 = yStart; - int y1 = yStart + ySize; - if (y0 < 0) y0 = 0; - if (y1 > Level::maxBuildHeight) y1 = Level::maxBuildHeight; + // Position pointers into the data when not ordered by chunk + int p = 0; + int dataP = blockCount; + int blockLightP = -1; + int skyLightP = -1; - // Every x is a whole row - for(int xPos = xStart; xPos < xStart + xSize; ++xPos) - { - int xc = xPos >> 4; + int y0 = yStart; + int y1 = yStart + ySize; + if (y0 < 0) y0 = 0; + if (y1 > Level::maxBuildHeight) y1 = Level::maxBuildHeight; - int x0 = xPos - xc * 16; - if (x0 < 0) x0 = 0; - int x1 = x0 + 1; - if (x1 > 16) x1 = 16; + // Every x is a whole row + for (int xPos = xStart; xPos < xStart + xSize; ++xPos) { + int xc = xPos >> 4; - for(int zPos = zStart; zPos < zStart + zSize;) - { - int zc = zPos >> 4; + int x0 = xPos - xc * 16; + if (x0 < 0) x0 = 0; + int x1 = x0 + 1; + if (x1 > 16) x1 = 16; - int z0 = zStart - zc * 16; - int z1 = zStart + zSize - zc * 16; - if (z0 < 0) z0 = 0; - if (z1 > 16) z1 = 16; - getBlocksAndData(level->getChunk(xc, zc), &result, x0, y0, z0, x1, y1, z1, p, dataP, blockLightP, skyLightP); - zPos += (z1-z0); - } - } + for (int zPos = zStart; zPos < zStart + zSize;) { + int zc = zPos >> 4; + + int z0 = zStart - zc * 16; + int z1 = zStart + zSize - zc * 16; + if (z0 < 0) z0 = 0; + if (z1 > 16) z1 = 16; + getBlocksAndData(level->getChunk(xc, zc), &result, x0, y0, z0, x1, + y1, z1, p, dataP, blockLightP, skyLightP); + zPos += (z1 - z0); + } + } #ifndef _CONTENT_PACKAGE - if(p!=blockCount) __debugbreak(); + if (p != blockCount) __debugbreak(); #endif - // We don't know how this will compress - just make a fixed length buffer to initially decompress into - // Some small sets of blocks can end up compressing into something bigger than their source - unsigned int inputSize = blockCount * 3 / 2; - unsigned char *ucTemp = new unsigned char[inputSize]; + // We don't know how this will compress - just make a fixed length buffer to + // initially decompress into Some small sets of blocks can end up + // compressing into something bigger than their source + unsigned int inputSize = blockCount * 3 / 2; + unsigned char* ucTemp = new unsigned char[inputSize]; - switch(compressionType) - { - case Compression::eCompressionType_LZXRLE: - Compression::getCompression()->CompressLZXRLE( ucTemp, &inputSize, result.data, (unsigned int) result.length ); - break; - case Compression::eCompressionType_RLE: - Compression::getCompression()->CompressRLE( ucTemp, &inputSize, result.data, (unsigned int) result.length ); - break; - case Compression::eCompressionType_None: - default: - memcpy( ucTemp, result.data, inputSize ); - break; - }; + switch (compressionType) { + case Compression::eCompressionType_LZXRLE: + Compression::getCompression()->CompressLZXRLE( + ucTemp, &inputSize, result.data, (unsigned int)result.length); + break; + case Compression::eCompressionType_RLE: + Compression::getCompression()->CompressRLE( + ucTemp, &inputSize, result.data, (unsigned int)result.length); + break; + case Compression::eCompressionType_None: + default: + memcpy(ucTemp, result.data, inputSize); + break; + }; - delete [] result.data; - byteArray buffer = byteArray(ucTemp,inputSize); + delete[] result.data; + byteArray buffer = byteArray(ucTemp, inputSize); - if(dos != NULL) dos->writeInt(inputSize); - if(dos != NULL) dos->write(buffer); - delete [] buffer.data; + if (dos != NULL) dos->writeInt(inputSize); + if (dos != NULL) dos->write(buffer); + delete[] buffer.data; - CompoundTag tag; - ListTag *tileEntitiesTag = new ListTag(L"tileEntities"); + CompoundTag tag; + ListTag* tileEntitiesTag = + new ListTag(L"tileEntities"); - int xc0 = xStart >> 4; - int zc0 = zStart >> 4; - int xc1 = (xStart + xSize - 1) >> 4; - int zc1 = (zStart + zSize - 1) >> 4; + int xc0 = xStart >> 4; + int zc0 = zStart >> 4; + int xc1 = (xStart + xSize - 1) >> 4; + int zc1 = (zStart + zSize - 1) >> 4; - for (int xc = xc0; xc <= xc1; xc++) - { - for (int zc = zc0; zc <= zc1; zc++) - { - std::vector > *tileEntities = getTileEntitiesInRegion(level->getChunk(xc, zc), xStart, yStart, zStart, xStart + xSize, yStart + ySize, zStart + zSize); - for(AUTO_VAR(it, tileEntities->begin()); it != tileEntities->end(); ++it) - { - std::shared_ptr te = *it; - CompoundTag *teTag = new CompoundTag(); - std::shared_ptr teCopy = te->clone(); + for (int xc = xc0; xc <= xc1; xc++) { + for (int zc = zc0; zc <= zc1; zc++) { + std::vector >* tileEntities = + getTileEntitiesInRegion(level->getChunk(xc, zc), xStart, yStart, + zStart, xStart + xSize, yStart + ySize, + zStart + zSize); + for (AUTO_VAR(it, tileEntities->begin()); it != tileEntities->end(); + ++it) { + std::shared_ptr te = *it; + CompoundTag* teTag = new CompoundTag(); + std::shared_ptr teCopy = te->clone(); - // Adjust the tileEntity position to schematic coords from world co-ords - teCopy->x -= xStart; - teCopy->y -= yStart; - teCopy->z -= zStart; - teCopy->save(teTag); - tileEntitiesTag->add(teTag); - } - delete tileEntities; - } - } - tag.put(L"TileEntities", tileEntitiesTag); + // Adjust the tileEntity position to schematic coords from world + // co-ords + teCopy->x -= xStart; + teCopy->y -= yStart; + teCopy->z -= zStart; + teCopy->save(teTag); + tileEntitiesTag->add(teTag); + } + delete tileEntities; + } + } + tag.put(L"TileEntities", tileEntitiesTag); - AABB *bb = AABB::newTemp(xStart,yStart,zStart,xEnd,yEnd,zEnd); - std::vector > *entities = level->getEntities(nullptr, bb); - ListTag *entitiesTag = new ListTag(L"entities"); + AABB* bb = AABB::newTemp(xStart, yStart, zStart, xEnd, yEnd, zEnd); + std::vector >* entities = + level->getEntities(nullptr, bb); + ListTag* entitiesTag = new ListTag(L"entities"); - for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) - { - std::shared_ptr e = *it; + for (AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) { + std::shared_ptr e = *it; - bool mobCanBeSaved = false; - if(bSaveMobs) - { - if( ( e->GetType() & eTYPE_MONSTER ) || ( e->GetType() & eTYPE_WATERANIMAL ) || ( e->GetType() & eTYPE_ANIMAL ) || - ( e->GetType() == eTYPE_CHICKEN ) || ( e->GetType() == eTYPE_WOLF ) || ( e->GetType() == eTYPE_VILLAGER) || ( e->GetType() == eTYPE_MUSHROOMCOW ) ) - { - mobCanBeSaved = true; - } - } - if(mobCanBeSaved || e->GetType() == eTYPE_MINECART || e->GetType() == eTYPE_BOAT || e->GetType() == eTYPE_PAINTING || e->GetType() == eTYPE_ITEM_FRAME) - { - CompoundTag *eTag = new CompoundTag(); - if( e->save(eTag) ) - { - ListTag *pos = (ListTag *) eTag->getList(L"Pos"); + bool mobCanBeSaved = false; + if (bSaveMobs) { + if (e->instanceof(eTYPE_MONSTER) || + e->instanceof(eTYPE_WATERANIMAL) || + e->instanceof(eTYPE_ANIMAL) || (e->GetType() == eTYPE_VILLAGER)) - pos->get(0)->data -= xStart; - pos->get(1)->data -= yStart; - pos->get(2)->data -= zStart; + // 4J-JEV: All these are derived from eTYPE_ANIMAL and true + // implicitly. + //|| ( e->GetType() == eTYPE_CHICKEN ) || ( e->GetType() == + // eTYPE_WOLF ) || ( e->GetType() == eTYPE_MUSHROOMCOW ) ) + { + mobCanBeSaved = true; + } + } - if( e->GetType() == eTYPE_PAINTING || e->GetType() == eTYPE_ITEM_FRAME ) - { - ((IntTag *) eTag->get(L"TileX") )->data -= xStart; - ((IntTag *) eTag->get(L"TileY") )->data -= yStart; - ((IntTag *) eTag->get(L"TileZ") )->data -= zStart; - } + // 4J-JEV: Changed to check for instances of minecarts and + // hangingEntities instead of just eTYPE_PAINTING, eTYPE_ITEM_FRAME and + // eTYPE_MINECART + if (mobCanBeSaved || e->instanceof(eTYPE_MINECART) || + e->GetType() == eTYPE_BOAT || e->instanceof(eTYPE_HANGING_ENTITY)) { + CompoundTag* eTag = new CompoundTag(); + if (e->save(eTag)) { + ListTag* pos = + (ListTag*)eTag->getList(L"Pos"); - entitiesTag->add(eTag); - } - } - } + pos->get(0)->data -= xStart; + pos->get(1)->data -= yStart; + pos->get(2)->data -= zStart; - tag.put(L"Entities", entitiesTag); + 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; + } - if(dos != NULL) NbtIo::write(&tag,dos); + entitiesTag->add(eTag); + } + } + } + + tag.put(L"Entities", entitiesTag); + + if (dos != NULL) NbtIo::write(&tag, dos); } -void ConsoleSchematicFile::getBlocksAndData(LevelChunk *chunk, byteArray *data, int x0, int y0, int z0, int x1, int y1, int z1, int &blocksP, int &dataP, int &blockLightP, int &skyLightP) -{ - // 4J Stu - Needs updated to work with higher worlds, should still work with non-optimised version below - //int xs = x1 - x0; - //int ys = y1 - y0; - //int zs = z1 - z0; - //if (xs * ys * zs == LevelChunk::BLOCKS_LENGTH) - //{ - // byteArray blockData = byteArray(data->data + blocksP, Level::CHUNK_TILE_COUNT); - // chunk->getBlockData(blockData); - // blocksP += blockData.length; +void ConsoleSchematicFile::getBlocksAndData(LevelChunk* chunk, byteArray* data, + int x0, int y0, int z0, int x1, + int y1, int z1, int& blocksP, + int& dataP, int& blockLightP, + int& skyLightP) { + // 4J Stu - Needs updated to work with higher worlds, should still work with + // non-optimised version below + // int xs = x1 - x0; + // int ys = y1 - y0; + // int zs = z1 - z0; + // if (xs * ys * zs == LevelChunk::BLOCKS_LENGTH) + //{ + // byteArray blockData = byteArray(data->data + blocksP, + //Level::CHUNK_TILE_COUNT); chunk->getBlockData(blockData); blocksP += + //blockData.length; - // byteArray dataData = byteArray(data->data + dataP, 16384); - // chunk->getBlockLightData(dataData); - // dataP += dataData.length; + // byteArray dataData = byteArray(data->data + dataP, 16384); + // chunk->getBlockLightData(dataData); + // dataP += dataData.length; - // byteArray blockLightData = byteArray(data->data + blockLightP, 16384); - // chunk->getBlockLightData(blockLightData); - // blockLightP += blockLightData.length; + // byteArray blockLightData = byteArray(data->data + blockLightP, 16384); + // chunk->getBlockLightData(blockLightData); + // blockLightP += blockLightData.length; - // byteArray skyLightData = byteArray(data->data + skyLightP, 16384); - // chunk->getSkyLightData(skyLightData); - // skyLightP += skyLightData.length; - // return; - //} - - bool bHasLower, bHasUpper; - bHasLower = bHasUpper = false; - int lowerY0, lowerY1, upperY0, upperY1; - lowerY0 = upperY0 = y0; - lowerY1 = upperY1 = y1; + // byteArray skyLightData = byteArray(data->data + skyLightP, 16384); + // chunk->getSkyLightData(skyLightData); + // skyLightP += skyLightData.length; + // return; + //} - int compressedHeight = Level::COMPRESSED_CHUNK_SECTION_HEIGHT; - if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) - { - lowerY0 = y0; - lowerY1 = std::min(y1, compressedHeight); - bHasLower = true; - } - if(y1 >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT) - { - upperY0 = std::max(y0, compressedHeight) - Level::COMPRESSED_CHUNK_SECTION_HEIGHT; - upperY1 = y1 - Level::COMPRESSED_CHUNK_SECTION_HEIGHT; - bHasUpper = true; - } + bool bHasLower, bHasUpper; + bHasLower = bHasUpper = false; + int lowerY0, lowerY1, upperY0, upperY1; + lowerY0 = upperY0 = y0; + lowerY1 = upperY1 = y1; - byteArray blockData = byteArray(Level::CHUNK_TILE_COUNT); - chunk->getBlockData(blockData); - for (int x = x0; x < x1; x++) - for (int z = z0; z < z1; z++) - { - if(bHasLower) - { - int slot = x << Level::genDepthBitsPlusFour | z << Level::genDepthBits | lowerY0; - int len = lowerY1 - lowerY0; - System::arraycopy(blockData, slot, data, blocksP, len); - blocksP += len; - } - if(bHasUpper) - { - int slot = (x << Level::genDepthBitsPlusFour | z << Level::genDepthBits | upperY0) + Level::COMPRESSED_CHUNK_SECTION_TILES; - int len = upperY1 - upperY0; - System::arraycopy(blockData, slot, data, blocksP, len); - blocksP += len; - } - } - delete blockData.data; + int compressedHeight = Level::COMPRESSED_CHUNK_SECTION_HEIGHT; + if (y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) { + lowerY0 = y0; + lowerY1 = std::min(y1, compressedHeight); + bHasLower = true; + } + if (y1 >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT) { + upperY0 = std::max(y0, compressedHeight) - + Level::COMPRESSED_CHUNK_SECTION_HEIGHT; + upperY1 = y1 - Level::COMPRESSED_CHUNK_SECTION_HEIGHT; + bHasUpper = true; + } - byteArray dataData = byteArray(Level::CHUNK_TILE_COUNT); - chunk->getDataData(dataData); - for (int x = x0; x < x1; x++) - for (int z = z0; z < z1; z++) - { - if(bHasLower) - { - int slot = (x << Level::genDepthBitsPlusFour | z << Level::genDepthBits | lowerY0) >> 1; - int len = (lowerY1 - lowerY0) / 2; - System::arraycopy(dataData, slot, data, dataP, len); - dataP += len; - } - if(bHasUpper) - { - int slot = ((x << Level::genDepthBitsPlusFour | z << Level::genDepthBits | upperY0) + Level::COMPRESSED_CHUNK_SECTION_TILES) >> 1; - int len = (upperY1 - upperY0) / 2; - System::arraycopy(dataData, slot, data, dataP, len); - dataP += len; - } - } - delete dataData.data; + byteArray blockData = byteArray(Level::CHUNK_TILE_COUNT); + chunk->getBlockData(blockData); + for (int x = x0; x < x1; x++) + for (int z = z0; z < z1; z++) { + if (bHasLower) { + int slot = x << Level::genDepthBitsPlusFour | + z << Level::genDepthBits | lowerY0; + int len = lowerY1 - lowerY0; + System::arraycopy(blockData, slot, data, blocksP, len); + blocksP += len; + } + if (bHasUpper) { + int slot = (x << Level::genDepthBitsPlusFour | + z << Level::genDepthBits | upperY0) + + Level::COMPRESSED_CHUNK_SECTION_TILES; + int len = upperY1 - upperY0; + System::arraycopy(blockData, slot, data, blocksP, len); + blocksP += len; + } + } + delete blockData.data; - // 4J Stu - Allow ignoring light data - if(blockLightP > -1) - { - byteArray blockLightData = byteArray(Level::HALF_CHUNK_TILE_COUNT); - chunk->getBlockLightData(blockLightData); - for (int x = x0; x < x1; x++) - for (int z = z0; z < z1; z++) - { - if(bHasLower) - { - int slot = (x << Level::genDepthBitsPlusFour | z << Level::genDepthBits | lowerY0) >> 1; - int len = (lowerY1 - lowerY0) / 2; - System::arraycopy(blockLightData, slot, data, blockLightP, len); - blockLightP += len; - } - if(bHasUpper) - { - int slot = ((x << Level::genDepthBitsPlusFour | z << Level::genDepthBits | upperY0) >> 1) + (Level::COMPRESSED_CHUNK_SECTION_TILES/2); - int len = (upperY1 - upperY0) / 2; - System::arraycopy(blockLightData, slot, data, blockLightP, len); - blockLightP += len; - } - } - delete blockLightData.data; - } + byteArray dataData = byteArray(Level::CHUNK_TILE_COUNT); + chunk->getDataData(dataData); + for (int x = x0; x < x1; x++) + for (int z = z0; z < z1; z++) { + if (bHasLower) { + int slot = (x << Level::genDepthBitsPlusFour | + z << Level::genDepthBits | lowerY0) >> + 1; + int len = (lowerY1 - lowerY0) / 2; + System::arraycopy(dataData, slot, data, dataP, len); + dataP += len; + } + if (bHasUpper) { + int slot = ((x << Level::genDepthBitsPlusFour | + z << Level::genDepthBits | upperY0) + + Level::COMPRESSED_CHUNK_SECTION_TILES) >> + 1; + int len = (upperY1 - upperY0) / 2; + System::arraycopy(dataData, slot, data, dataP, len); + dataP += len; + } + } + delete dataData.data; + // 4J Stu - Allow ignoring light data + if (blockLightP > -1) { + byteArray blockLightData = byteArray(Level::HALF_CHUNK_TILE_COUNT); + chunk->getBlockLightData(blockLightData); + for (int x = x0; x < x1; x++) + for (int z = z0; z < z1; z++) { + if (bHasLower) { + int slot = (x << Level::genDepthBitsPlusFour | + z << Level::genDepthBits | lowerY0) >> + 1; + int len = (lowerY1 - lowerY0) / 2; + System::arraycopy(blockLightData, slot, data, blockLightP, + len); + blockLightP += len; + } + if (bHasUpper) { + int slot = ((x << Level::genDepthBitsPlusFour | + z << Level::genDepthBits | upperY0) >> + 1) + + (Level::COMPRESSED_CHUNK_SECTION_TILES / 2); + int len = (upperY1 - upperY0) / 2; + System::arraycopy(blockLightData, slot, data, blockLightP, + len); + blockLightP += len; + } + } + delete blockLightData.data; + } - // 4J Stu - Allow ignoring light data - if(skyLightP > -1) - { - byteArray skyLightData = byteArray(Level::HALF_CHUNK_TILE_COUNT); - chunk->getSkyLightData(skyLightData); - for (int x = x0; x < x1; x++) - for (int z = z0; z < z1; z++) - { - if(bHasLower) - { - int slot = (x << Level::genDepthBitsPlusFour | z << Level::genDepthBits | lowerY0) >> 1; - int len = (lowerY1 - lowerY0) / 2; - System::arraycopy(skyLightData, slot, data, skyLightP, len); - skyLightP += len; - } - if(bHasUpper) - { - int slot = ((x << Level::genDepthBitsPlusFour | z << Level::genDepthBits | upperY0) >> 1) + (Level::COMPRESSED_CHUNK_SECTION_TILES/2); - int len = (upperY1 - upperY0) / 2; - System::arraycopy(skyLightData, slot, data, skyLightP, len); - skyLightP += len; - } - } - delete skyLightData.data; - } + // 4J Stu - Allow ignoring light data + if (skyLightP > -1) { + byteArray skyLightData = byteArray(Level::HALF_CHUNK_TILE_COUNT); + chunk->getSkyLightData(skyLightData); + for (int x = x0; x < x1; x++) + for (int z = z0; z < z1; z++) { + if (bHasLower) { + int slot = (x << Level::genDepthBitsPlusFour | + z << Level::genDepthBits | lowerY0) >> + 1; + int len = (lowerY1 - lowerY0) / 2; + System::arraycopy(skyLightData, slot, data, skyLightP, len); + skyLightP += len; + } + if (bHasUpper) { + int slot = ((x << Level::genDepthBitsPlusFour | + z << Level::genDepthBits | upperY0) >> + 1) + + (Level::COMPRESSED_CHUNK_SECTION_TILES / 2); + int len = (upperY1 - upperY0) / 2; + System::arraycopy(skyLightData, slot, data, skyLightP, len); + skyLightP += len; + } + } + delete skyLightData.data; + } - return; + return; } -void ConsoleSchematicFile::setBlocksAndData(LevelChunk *chunk, byteArray blockData, byteArray dataData, byteArray inputData, int x0, int y0, int z0, int x1, int y1, int z1, int &blocksP, int &dataP, int &blockLightP, int &skyLightP) -{ - bool bHasLower, bHasUpper; - bHasLower = bHasUpper = false; - int lowerY0, lowerY1, upperY0, upperY1; - lowerY0 = upperY0 = y0; - lowerY1 = upperY1 = y1; +void ConsoleSchematicFile::setBlocksAndData( + LevelChunk* chunk, byteArray blockData, byteArray dataData, + byteArray inputData, int x0, int y0, int z0, int x1, int y1, int z1, + int& blocksP, int& dataP, int& blockLightP, int& skyLightP) { + bool bHasLower, bHasUpper; + bHasLower = bHasUpper = false; + int lowerY0, lowerY1, upperY0, upperY1; + lowerY0 = upperY0 = y0; + lowerY1 = upperY1 = y1; - int compressedHeight = Level::COMPRESSED_CHUNK_SECTION_HEIGHT; - if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) - { - lowerY0 = y0; - lowerY1 = std::min(y1, compressedHeight); - bHasLower = true; - } - if(y1 >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT) - { - upperY0 = std::max(y0, compressedHeight) - Level::COMPRESSED_CHUNK_SECTION_HEIGHT; - upperY1 = y1 - Level::COMPRESSED_CHUNK_SECTION_HEIGHT; - bHasUpper = true; - } - PIXBeginNamedEvent(0,"Applying block data"); - for (int x = x0; x < x1; x++) - for (int z = z0; z < z1; z++) - { - if(bHasLower) - { - int slot = x << Level::genDepthBitsPlusFour | z << Level::genDepthBits | lowerY0; - int len = lowerY1 - lowerY0; - System::arraycopy(inputData, blocksP, &blockData, slot, len); - blocksP += len; - } - if(bHasUpper) - { - int slot = (x << Level::genDepthBitsPlusFour | z << Level::genDepthBits | upperY0) + Level::COMPRESSED_CHUNK_SECTION_TILES; - int len = upperY1 - upperY0; - System::arraycopy(inputData, blocksP, &blockData, slot, len); - blocksP += len; - } - } - PIXEndNamedEvent(); + int compressedHeight = Level::COMPRESSED_CHUNK_SECTION_HEIGHT; + if (y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) { + lowerY0 = y0; + lowerY1 = std::min(y1, compressedHeight); + bHasLower = true; + } + if (y1 >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT) { + upperY0 = std::max(y0, compressedHeight) - + Level::COMPRESSED_CHUNK_SECTION_HEIGHT; + upperY1 = y1 - Level::COMPRESSED_CHUNK_SECTION_HEIGHT; + bHasUpper = true; + } + PIXBeginNamedEvent(0, "Applying block data"); + for (int x = x0; x < x1; x++) + for (int z = z0; z < z1; z++) { + if (bHasLower) { + int slot = x << Level::genDepthBitsPlusFour | + z << Level::genDepthBits | lowerY0; + int len = lowerY1 - lowerY0; + System::arraycopy(inputData, blocksP, &blockData, slot, len); + blocksP += len; + } + if (bHasUpper) { + int slot = (x << Level::genDepthBitsPlusFour | + z << Level::genDepthBits | upperY0) + + Level::COMPRESSED_CHUNK_SECTION_TILES; + int len = upperY1 - upperY0; + System::arraycopy(inputData, blocksP, &blockData, slot, len); + blocksP += len; + } + } + PIXEndNamedEvent(); - PIXBeginNamedEvent(0,"Applying Data data"); - for (int x = x0; x < x1; x++) - for (int z = z0; z < z1; z++) - { - if(bHasLower) - { - int slot = (x << Level::genDepthBitsPlusFour | z << Level::genDepthBits | lowerY0) >> 1; - int len = (lowerY1 - lowerY0) / 2; - System::arraycopy(inputData, dataP, &dataData, slot, len); - dataP += len; - } - if(bHasUpper) - { - int slot = ((x << Level::genDepthBitsPlusFour | z << Level::genDepthBits | upperY0) + Level::COMPRESSED_CHUNK_SECTION_TILES) >> 1; - int len = (upperY1 - upperY0) / 2; - System::arraycopy(inputData, dataP, &dataData, slot, len); - dataP += len; - } - } - PIXEndNamedEvent(); - // 4J Stu - Allow ignoring light data - if(blockLightP > -1) - { - byteArray blockLightData = byteArray(Level::HALF_CHUNK_TILE_COUNT); - chunk->getBlockLightData(blockLightData); - for (int x = x0; x < x1; x++) - for (int z = z0; z < z1; z++) - { - if(bHasLower) - { - int slot = (x << Level::genDepthBitsPlusFour | z << Level::genDepthBits | lowerY0) >> 1; - int len = (lowerY1 - lowerY0) / 2; - System::arraycopy(inputData, blockLightP, &blockLightData, slot, len); - blockLightP += len; - } - if(bHasUpper) - { - int slot = ( (x << Level::genDepthBitsPlusFour | z << Level::genDepthBits | upperY0) >> 1) + (Level::COMPRESSED_CHUNK_SECTION_TILES/2); - int len = (upperY1 - upperY0) / 2; - System::arraycopy(inputData, blockLightP, &blockLightData, slot, len); - blockLightP += len; - } - } - chunk->setBlockLightData(blockLightData); - delete blockLightData.data; - } + PIXBeginNamedEvent(0, "Applying Data data"); + for (int x = x0; x < x1; x++) + for (int z = z0; z < z1; z++) { + if (bHasLower) { + int slot = (x << Level::genDepthBitsPlusFour | + z << Level::genDepthBits | lowerY0) >> + 1; + int len = (lowerY1 - lowerY0) / 2; + System::arraycopy(inputData, dataP, &dataData, slot, len); + dataP += len; + } + if (bHasUpper) { + int slot = ((x << Level::genDepthBitsPlusFour | + z << Level::genDepthBits | upperY0) + + Level::COMPRESSED_CHUNK_SECTION_TILES) >> + 1; + int len = (upperY1 - upperY0) / 2; + System::arraycopy(inputData, dataP, &dataData, slot, len); + dataP += len; + } + } + PIXEndNamedEvent(); + // 4J Stu - Allow ignoring light data + if (blockLightP > -1) { + byteArray blockLightData = byteArray(Level::HALF_CHUNK_TILE_COUNT); + chunk->getBlockLightData(blockLightData); + for (int x = x0; x < x1; x++) + for (int z = z0; z < z1; z++) { + if (bHasLower) { + int slot = (x << Level::genDepthBitsPlusFour | + z << Level::genDepthBits | lowerY0) >> + 1; + int len = (lowerY1 - lowerY0) / 2; + System::arraycopy(inputData, blockLightP, &blockLightData, + slot, len); + blockLightP += len; + } + if (bHasUpper) { + int slot = ((x << Level::genDepthBitsPlusFour | + z << Level::genDepthBits | upperY0) >> + 1) + + (Level::COMPRESSED_CHUNK_SECTION_TILES / 2); + int len = (upperY1 - upperY0) / 2; + System::arraycopy(inputData, blockLightP, &blockLightData, + slot, len); + blockLightP += len; + } + } + chunk->setBlockLightData(blockLightData); + delete blockLightData.data; + } - // 4J Stu - Allow ignoring light data - if(skyLightP > -1) - { - byteArray skyLightData = byteArray(Level::HALF_CHUNK_TILE_COUNT); - chunk->getSkyLightData(skyLightData); - for (int x = x0; x < x1; x++) - for (int z = z0; z < z1; z++) - { - if(bHasLower) - { - int slot = (x << Level::genDepthBitsPlusFour | z << Level::genDepthBits | lowerY0) >> 1; - int len = (lowerY1 - lowerY0) / 2; - System::arraycopy(inputData, skyLightP, &skyLightData, slot, len); - skyLightP += len; - } - if(bHasUpper) - { - int slot = (x << Level::genDepthBitsPlusFour | z << Level::genDepthBits | upperY0) + (Level::COMPRESSED_CHUNK_SECTION_TILES/2); - int len = (upperY1 - upperY0) / 2; - System::arraycopy(inputData, skyLightP, &skyLightData, slot, len); - skyLightP += len; - } - } - chunk->setSkyLightData(skyLightData); - delete skyLightData.data; - } + // 4J Stu - Allow ignoring light data + if (skyLightP > -1) { + byteArray skyLightData = byteArray(Level::HALF_CHUNK_TILE_COUNT); + chunk->getSkyLightData(skyLightData); + for (int x = x0; x < x1; x++) + for (int z = z0; z < z1; z++) { + if (bHasLower) { + int slot = (x << Level::genDepthBitsPlusFour | + z << Level::genDepthBits | lowerY0) >> + 1; + int len = (lowerY1 - lowerY0) / 2; + System::arraycopy(inputData, skyLightP, &skyLightData, slot, + len); + skyLightP += len; + } + if (bHasUpper) { + int slot = (x << Level::genDepthBitsPlusFour | + z << Level::genDepthBits | upperY0) + + (Level::COMPRESSED_CHUNK_SECTION_TILES / 2); + int len = (upperY1 - upperY0) / 2; + System::arraycopy(inputData, skyLightP, &skyLightData, slot, + len); + skyLightP += len; + } + } + chunk->setSkyLightData(skyLightData); + delete skyLightData.data; + } } -std::vector > *ConsoleSchematicFile::getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1) -{ - std::vector > *result = new std::vector >; - for (AUTO_VAR(it, chunk->tileEntities.begin()); it != chunk->tileEntities.end(); ++it) - { - std::shared_ptr te = it->second; - if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1) - { - result->push_back(te); - } - } - return result; +std::vector >* +ConsoleSchematicFile::getTileEntitiesInRegion(LevelChunk* chunk, int x0, int y0, + int z0, int x1, int y1, int z1) { + std::vector >* result = + new std::vector >; + for (AUTO_VAR(it, chunk->tileEntities.begin()); + it != chunk->tileEntities.end(); ++it) { + std::shared_ptr te = it->second; + if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && + te->y < y1 && te->z < z1) { + result->push_back(te); + } + } + return result; } diff --git a/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.h b/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.h index 371064960..1990328a8 100644 --- a/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.h +++ b/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.h @@ -1,5 +1,5 @@ #pragma once -//using namespace std; +// using namespace std; #define XBOX_SCHEMATIC_ORIGINAL_VERSION 1 #define XBOX_SCHEMATIC_CURRENT_VERSION 2 @@ -14,77 +14,95 @@ class LevelChunk; class AABB; class Vec3; -class ConsoleSchematicFile -{ +class ConsoleSchematicFile { public: - enum ESchematicRotation - { - eSchematicRot_0, - eSchematicRot_90, - eSchematicRot_180, - eSchematicRot_270 - }; + enum ESchematicRotation { + eSchematicRot_0, + eSchematicRot_90, + eSchematicRot_180, + eSchematicRot_270 + }; + private: - int m_refCount; + int m_refCount; public: - void incrementRefCount() { ++m_refCount; } - void decrementRefCount() { --m_refCount; } - bool shouldDelete() { return m_refCount <= 0; } + void incrementRefCount() { ++m_refCount; } + void decrementRefCount() { --m_refCount; } + bool shouldDelete() { return m_refCount <= 0; } - typedef struct _XboxSchematicInitParam - { - wchar_t name[64]; - int startX; - int startY; - int startZ; - int endX; - int endY; - int endZ; - bool bSaveMobs; + typedef struct _XboxSchematicInitParam { + wchar_t name[64]; + int startX; + int startY; + int startZ; + int endX; + int endY; + int endZ; + bool bSaveMobs; - Compression::ECompressionTypes compressionType; + Compression::ECompressionTypes compressionType; + + _XboxSchematicInitParam() { + ZeroMemory(name, 64 * (sizeof(wchar_t))); + startX = startY = startZ = endX = endY = endZ = 0; + bSaveMobs = false; + compressionType = Compression::eCompressionType_None; + } + } XboxSchematicInitParam; - _XboxSchematicInitParam() - { - ZeroMemory(name,64*(sizeof(wchar_t))); - startX = startY = startZ = endX = endY = endZ = 0; - bSaveMobs = false; - compressionType = Compression::eCompressionType_None; - } - } XboxSchematicInitParam; private: - int m_xSize, m_ySize, m_zSize; - std::vector > m_tileEntities; - std::vector< std::pair > m_entities; - -public: - byteArray m_data; + int m_xSize, m_ySize, m_zSize; + std::vector > m_tileEntities; + std::vector > m_entities; public: - ConsoleSchematicFile(); - ~ConsoleSchematicFile(); + byteArray m_data; - int getXSize() { return m_xSize; } - int getYSize() { return m_ySize; } - int getZSize() { return m_zSize; } +public: + ConsoleSchematicFile(); + ~ConsoleSchematicFile(); - void save(DataOutputStream *dos); - void load(DataInputStream *dis); + int getXSize() { return m_xSize; } + int getYSize() { return m_ySize; } + int getZSize() { return m_zSize; } - __int64 applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot); - __int64 applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot); - void applyTileEntities(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot); + void save(DataOutputStream* dos); + void load(DataInputStream* dis); + + __int64 applyBlocksAndData(LevelChunk* chunk, AABB* chunkBox, + AABB* destinationBox, ESchematicRotation rot); + __int64 applyLighting(LevelChunk* chunk, AABB* chunkBox, + AABB* destinationBox, ESchematicRotation rot); + void applyTileEntities(LevelChunk* chunk, AABB* chunkBox, + AABB* destinationBox, ESchematicRotation rot); + + static void generateSchematicFile(DataOutputStream* dos, Level* level, + int xStart, int yStart, int zStart, + int xEnd, int yEnd, int zEnd, + bool bSaveMobs, + Compression::ECompressionTypes); + static void setBlocksAndData(LevelChunk* chunk, byteArray blockData, + byteArray dataData, byteArray data, int x0, + int y0, int z0, int x1, int y1, int z1, + int& blocksP, int& dataP, int& blockLightP, + int& skyLightP); - static void generateSchematicFile(DataOutputStream *dos, Level *level, int xStart, int yStart, int zStart, int xEnd, int yEnd, int zEnd, bool bSaveMobs, Compression::ECompressionTypes); - static void setBlocksAndData(LevelChunk *chunk, byteArray blockData, byteArray dataData, byteArray data, int x0, int y0, int z0, int x1, int y1, int z1, int &blocksP, int &dataP, int &blockLightP, int &skyLightP); private: - void save_tags(DataOutputStream *dos); - void load_tags(DataInputStream *dis); + void save_tags(DataOutputStream* dos); + void load_tags(DataInputStream* dis); - static void getBlocksAndData(LevelChunk *chunk, byteArray *data, int x0, int y0, int z0, int x1, int y1, int z1, int &blocksP, int &dataP, int &blockLightP, int &skyLightP); - static std::vector > *getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1); + static void getBlocksAndData(LevelChunk* chunk, byteArray* data, int x0, + int y0, int z0, int x1, int y1, int z1, + int& blocksP, int& dataP, int& blockLightP, + int& skyLightP); + static std::vector >* getTileEntitiesInRegion( + LevelChunk* chunk, int x0, int y0, int z0, int x1, int y1, int z1); - void chunkCoordToSchematicCoord(AABB *destinationBox, int chunkX, int chunkZ, ESchematicRotation rot, int &schematicX, int &schematicZ); - void schematicCoordToChunkCoord(AABB *destinationBox, double schematicX, double schematicZ, ESchematicRotation rot, double &chunkX, double &chunkZ); + void chunkCoordToSchematicCoord(AABB* destinationBox, int chunkX, + int chunkZ, ESchematicRotation rot, + int& schematicX, int& schematicZ); + void schematicCoordToChunkCoord(AABB* destinationBox, double schematicX, + double schematicZ, ESchematicRotation rot, + double& chunkX, double& chunkZ); }; diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRule.cpp b/Minecraft.Client/Platform/Common/GameRules/GameRule.cpp index 2bfcbb197..95e1a9037 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRule.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/GameRule.cpp @@ -1,97 +1,83 @@ #include "../../Minecraft.World/Platform/stdafx.h" #include "ConsoleGameRules.h" -GameRule::GameRule(GameRuleDefinition *definition, Connection *connection) -{ - m_definition = definition; - m_connection = connection; +GameRule::GameRule(GameRuleDefinition* definition, Connection* connection) { + m_definition = definition; + m_connection = connection; } -GameRule::~GameRule() -{ - for(AUTO_VAR(it, m_parameters.begin()); it != m_parameters.end(); ++it) - { - if(it->second.isPointer) - { - delete it->second.gr; - } - } +GameRule::~GameRule() { + for (AUTO_VAR(it, m_parameters.begin()); it != m_parameters.end(); ++it) { + if (it->second.isPointer) { + delete it->second.gr; + } + } } -GameRule::ValueType GameRule::getParameter(const std::wstring ¶meterName) -{ - if(m_parameters.find(parameterName) == m_parameters.end()) - { +GameRule::ValueType GameRule::getParameter(const std::wstring& parameterName) { + if (m_parameters.find(parameterName) == m_parameters.end()) { #ifndef _CONTENT_PACKAGE - wprintf(L"WARNING: Parameter %ls was not set before being fetched\n", parameterName.c_str()); - __debugbreak(); + wprintf(L"WARNING: Parameter %ls was not set before being fetched\n", + parameterName.c_str()); + __debugbreak(); #endif - } - return m_parameters[parameterName]; + } + return m_parameters[parameterName]; } -void GameRule::setParameter(const std::wstring ¶meterName,ValueType value) -{ - if(m_parameters.find(parameterName) == m_parameters.end()) - { +void GameRule::setParameter(const std::wstring& parameterName, + ValueType value) { + if (m_parameters.find(parameterName) == m_parameters.end()) { #ifndef _CONTENT_PACKAGE - wprintf(L"Adding parameter %ls to GameRule\n", parameterName.c_str()); + wprintf(L"Adding parameter %ls to GameRule\n", parameterName.c_str()); #endif - } - else - { + } else { #ifndef _CONTENT_PACKAGE - wprintf(L"Setting parameter %ls for GameRule\n", parameterName.c_str()); + wprintf(L"Setting parameter %ls for GameRule\n", parameterName.c_str()); #endif - } - m_parameters[parameterName] = value; + } + m_parameters[parameterName] = value; } -GameRuleDefinition *GameRule::getGameRuleDefinition() -{ - return m_definition; +GameRuleDefinition* GameRule::getGameRuleDefinition() { return m_definition; } + +void GameRule::onUseTile(int tileId, int x, int y, int z) { + m_definition->onUseTile(this, tileId, x, y, z); +} +void GameRule::onCollectItem(std::shared_ptr item) { + m_definition->onCollectItem(this, item); } -void GameRule::onUseTile(int tileId, int x, int y, int z) { m_definition->onUseTile(this,tileId,x,y,z); } -void GameRule::onCollectItem(std::shared_ptr item) { m_definition->onCollectItem(this,item); } +void GameRule::write(DataOutputStream* dos) { + // Find required parameters. + dos->writeInt(m_parameters.size()); + for (AUTO_VAR(it, m_parameters.begin()); it != m_parameters.end(); it++) { + std::wstring pName = (*it).first; + ValueType vType = (*it).second; -void GameRule::write(DataOutputStream *dos) -{ - // Find required parameters. - dos->writeInt(m_parameters.size()); - for (AUTO_VAR(it, m_parameters.begin()); it != m_parameters.end(); it++) - { - std::wstring pName = (*it).first; - ValueType vType = (*it).second; - - dos->writeUTF( (*it).first ); - dos->writeBoolean( vType.isPointer ); + dos->writeUTF((*it).first); + dos->writeBoolean(vType.isPointer); - if (vType.isPointer) - vType.gr->write(dos); - else - dos->writeLong( vType.i64 ); - } + if (vType.isPointer) + vType.gr->write(dos); + else + dos->writeLong(vType.i64); + } } -void GameRule::read(DataInputStream *dis) -{ - int savedParams = dis->readInt(); - for (int i = 0; i < savedParams; i++) - { - std::wstring pNames = dis->readUTF(); - - ValueType vType = getParameter(pNames); +void GameRule::read(DataInputStream* dis) { + int savedParams = dis->readInt(); + for (int i = 0; i < savedParams; i++) { + std::wstring pNames = dis->readUTF(); - if (dis->readBoolean()) - { - vType.gr->read(dis); - } - else - { - vType.isPointer = false; - vType.i64 = dis->readLong(); - setParameter(pNames, vType); - } - } + ValueType vType = getParameter(pNames); + + if (dis->readBoolean()) { + vType.gr->read(dis); + } else { + vType.isPointer = false; + vType.i64 = dis->readLong(); + setParameter(pNames, vType); + } + } } diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRule.h b/Minecraft.Client/Platform/Common/GameRules/GameRule.h index 33eb1348d..51265967d 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRule.h +++ b/Minecraft.Client/Platform/Common/GameRules/GameRule.h @@ -1,5 +1,5 @@ #pragma once -//using namespace std; +// using namespace std; #include @@ -8,55 +8,54 @@ class GameRuleDefinition; class Connection; // A game rule maintains the state for one particular definition -class GameRule -{ +class GameRule { public: - typedef struct _ValueType - { - union{ - __int64 i64; - int i; - char c; - bool b; - float f; - double d; - GameRule *gr; - }; - bool isPointer; + typedef struct _ValueType { + union { + __int64 i64; + int i; + char c; + bool b; + float f; + double d; + GameRule* gr; + }; + bool isPointer; - _ValueType() - { - i64 = 0; - isPointer = false; - } - } ValueType; + _ValueType() { + i64 = 0; + isPointer = false; + } + } ValueType; private: - GameRuleDefinition *m_definition; - Connection *m_connection; + GameRuleDefinition* m_definition; + Connection* m_connection; public: - typedef std::unordered_map stringValueMapType; - stringValueMapType m_parameters; // These are the members of this rule that maintain it's state + typedef std::unordered_map stringValueMapType; + stringValueMapType m_parameters; // These are the members of this rule that + // maintain it's state public: - GameRule(GameRuleDefinition *definition, Connection *connection = NULL); - virtual ~GameRule(); + GameRule(GameRuleDefinition* definition, Connection* connection = NULL); + virtual ~GameRule(); - Connection *getConnection() { return m_connection; } - - ValueType getParameter(const std::wstring ¶meterName); - void setParameter(const std::wstring ¶meterName,ValueType value); - GameRuleDefinition *getGameRuleDefinition(); + Connection* getConnection() { return m_connection; } - // All the hooks go here - void onUseTile(int tileId, int x, int y, int z); - void onCollectItem(std::shared_ptr item); + ValueType getParameter(const std::wstring& parameterName); + void setParameter(const std::wstring& parameterName, ValueType value); + GameRuleDefinition* getGameRuleDefinition(); - // 4J-JEV: For saving. - //CompoundTag *toTags(std::unordered_map *map); - //static GameRule *fromTags(Connection *c, CompoundTag *cTag, std::vector *grds); + // All the hooks go here + void onUseTile(int tileId, int x, int y, int z); + void onCollectItem(std::shared_ptr item); - void write(DataOutputStream *dos); - void read(DataInputStream *dos); + // 4J-JEV: For saving. + // CompoundTag *toTags(std::unordered_map *map); + // static GameRule *fromTags(Connection *c, CompoundTag *cTag, + // std::vector *grds); + + void write(DataOutputStream* dos); + void read(DataInputStream* dos); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.cpp index 0aaabb754..0cf38789b 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.cpp @@ -3,149 +3,149 @@ #include "../../Minecraft.World/Util/StringHelpers.h" #include "ConsoleGameRules.h" -GameRuleDefinition::GameRuleDefinition() -{ - m_descriptionId = L""; - m_promptId = L""; - m_4JDataValue = 0; +GameRuleDefinition::GameRuleDefinition() { + m_descriptionId = L""; + m_promptId = L""; + m_4JDataValue = 0; } -void GameRuleDefinition::write(DataOutputStream *dos) -{ - // Write EGameRuleType. - ConsoleGameRules::EGameRuleType eType = getActionType(); - assert( eType != ConsoleGameRules::eGameRuleType_Invalid ); - ConsoleGameRules::write(dos, eType); // stringID +void GameRuleDefinition::write(DataOutputStream* dos) { + // Write EGameRuleType. + ConsoleGameRules::EGameRuleType eType = getActionType(); + assert(eType != ConsoleGameRules::eGameRuleType_Invalid); + ConsoleGameRules::write(dos, eType); // stringID - writeAttributes(dos, 0); - - // 4J-JEV: Get children. - std::vector *children = new std::vector(); - getChildren( children ); + writeAttributes(dos, 0); - // Write children. - dos->writeInt( children->size() ); - for (AUTO_VAR(it, children->begin()); it != children->end(); it++) - (*it)->write(dos); + // 4J-JEV: Get children. + std::vector* children = + new std::vector(); + getChildren(children); + + // Write children. + dos->writeInt(children->size()); + for (AUTO_VAR(it, children->begin()); it != children->end(); it++) + (*it)->write(dos); } -void GameRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes) -{ - dos->writeInt(numAttributes + 3); +void GameRuleDefinition::writeAttributes(DataOutputStream* dos, + unsigned int numAttributes) { + dos->writeInt(numAttributes + 3); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_descriptionName); - dos->writeUTF(m_descriptionId); + ConsoleGameRules::write(dos, + ConsoleGameRules::eGameRuleAttr_descriptionName); + dos->writeUTF(m_descriptionId); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_promptName); - dos->writeUTF(m_promptId); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_promptName); + dos->writeUTF(m_promptId); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag); - dos->writeUTF(_toString(m_4JDataValue)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag); + dos->writeUTF(_toString(m_4JDataValue)); } -void GameRuleDefinition::getChildren(std::vector *children) {} +void GameRuleDefinition::getChildren( + std::vector* children) {} -GameRuleDefinition *GameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType) -{ +GameRuleDefinition* GameRuleDefinition::addChild( + ConsoleGameRules::EGameRuleType ruleType) { #ifndef _CONTENT_PACKAGE - wprintf(L"GameRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType ); + wprintf(L"GameRuleDefinition: Attempted to add invalid child rule - %d\n", + ruleType); #endif - return NULL; + return NULL; } -void GameRuleDefinition::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) -{ - if(attributeName.compare(L"descriptionName") == 0) - { - m_descriptionId = attributeValue; +void GameRuleDefinition::addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue) { + if (attributeName.compare(L"descriptionName") == 0) { + m_descriptionId = attributeValue; #ifndef _CONTENT_PACKAGE - wprintf(L"GameRuleDefinition: Adding parameter descriptionId=%ls\n",m_descriptionId.c_str()); + wprintf(L"GameRuleDefinition: Adding parameter descriptionId=%ls\n", + m_descriptionId.c_str()); #endif - } - else if(attributeName.compare(L"promptName") == 0) - { - m_promptId = attributeValue; + } else if (attributeName.compare(L"promptName") == 0) { + m_promptId = attributeValue; #ifndef _CONTENT_PACKAGE - wprintf(L"GameRuleDefinition: Adding parameter m_promptId=%ls\n",m_promptId.c_str()); + wprintf(L"GameRuleDefinition: Adding parameter m_promptId=%ls\n", + m_promptId.c_str()); #endif - } - else if(attributeName.compare(L"dataTag") == 0) - { - m_4JDataValue = _fromString(attributeValue); - app.DebugPrintf("GameRuleDefinition: Adding parameter m_4JDataValue=%d\n",m_4JDataValue); - } - else - { + } else if (attributeName.compare(L"dataTag") == 0) { + m_4JDataValue = _fromString(attributeValue); + app.DebugPrintf( + "GameRuleDefinition: Adding parameter m_4JDataValue=%d\n", + m_4JDataValue); + } else { #ifndef _CONTENT_PACKAGE - wprintf(L"GameRuleDefinition: Attempted to add invalid attribute: %ls\n", attributeName.c_str()); + wprintf( + L"GameRuleDefinition: Attempted to add invalid attribute: %ls\n", + attributeName.c_str()); #endif - } + } } -void GameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule) -{ - GameRule::ValueType value; - value.b = false; - rule->setParameter(L"bComplete",value); +void GameRuleDefinition::populateGameRule( + GameRulesInstance::EGameRulesInstanceType type, GameRule* rule) { + GameRule::ValueType value; + value.b = false; + rule->setParameter(L"bComplete", value); } -bool GameRuleDefinition::getComplete(GameRule *rule) -{ - GameRule::ValueType value; - value = rule->getParameter(L"bComplete"); - return value.b; +bool GameRuleDefinition::getComplete(GameRule* rule) { + GameRule::ValueType value; + value = rule->getParameter(L"bComplete"); + return value.b; } -void GameRuleDefinition::setComplete(GameRule *rule, bool val) -{ - GameRule::ValueType value; - value = rule->getParameter(L"bComplete"); - value.b = val; - rule->setParameter(L"bComplete",value); +void GameRuleDefinition::setComplete(GameRule* rule, bool val) { + GameRule::ValueType value; + value = rule->getParameter(L"bComplete"); + value.b = val; + rule->setParameter(L"bComplete", value); } -std::vector *GameRuleDefinition::enumerate() -{ - // Get Vector. - std::vector *gRules; - gRules = new std::vector(); - gRules->push_back(this); - getChildren(gRules); - return gRules; +std::vector* GameRuleDefinition::enumerate() { + // Get Vector. + std::vector* gRules; + gRules = new std::vector(); + gRules->push_back(this); + getChildren(gRules); + return gRules; } -std::unordered_map *GameRuleDefinition::enumerateMap() -{ - std::unordered_map *out - = new std::unordered_map(); +std::unordered_map* +GameRuleDefinition::enumerateMap() { + std::unordered_map* out = + new std::unordered_map(); - int i = 0; - std::vector *gRules = enumerate(); - for (AUTO_VAR(it, gRules->begin()); it != gRules->end(); it++) - out->insert( std::pair( *it, i++ ) ); + int i = 0; + std::vector* gRules = enumerate(); + for (AUTO_VAR(it, gRules->begin()); it != gRules->end(); it++) + out->insert(std::pair(*it, i++)); - return out; + return out; } -GameRulesInstance *GameRuleDefinition::generateNewGameRulesInstance(GameRulesInstance::EGameRulesInstanceType type, LevelRuleset *rules, Connection *connection) -{ - GameRulesInstance *manager = new GameRulesInstance(rules, connection); +GameRulesInstance* GameRuleDefinition::generateNewGameRulesInstance( + GameRulesInstance::EGameRulesInstanceType type, LevelRuleset* rules, + Connection* connection) { + GameRulesInstance* manager = new GameRulesInstance(rules, connection); - rules->populateGameRule(type, manager); + rules->populateGameRule(type, manager); - return manager; + return manager; } -std::wstring GameRuleDefinition::generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const std::wstring &description, void *data, int dataLength) -{ - std::wstring formatted = description; - switch(defType) - { - case ConsoleGameRules::eGameRuleType_CompleteAllRule: - formatted = CompleteAllRuleDefinition::generateDescriptionString(description,data,dataLength); - break; - default: - break; - }; - return formatted; +std::wstring GameRuleDefinition::generateDescriptionString( + ConsoleGameRules::EGameRuleType defType, const std::wstring& description, + void* data, int dataLength) { + std::wstring formatted = description; + switch (defType) { + case ConsoleGameRules::eGameRuleType_CompleteAllRule: + formatted = CompleteAllRuleDefinition::generateDescriptionString( + description, data, dataLength); + break; + default: + break; + }; + return formatted; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.h index ae917556f..6480d6936 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.h @@ -1,5 +1,5 @@ #pragma once -//using namespace std; +// using namespace std; #include #include @@ -13,55 +13,69 @@ class LevelRuleset; class Player; class WstringLookup; -class GameRuleDefinition -{ +class GameRuleDefinition { private: - // Owner type defines who this rule applies to - GameRulesInstance::EGameRulesInstanceType m_ownerType; + // Owner type defines who this rule applies to + GameRulesInstance::EGameRulesInstanceType m_ownerType; protected: - // These attributes should map to those in the XSD GameRuleType - std::wstring m_descriptionId; - std::wstring m_promptId; - int m_4JDataValue; + // These attributes should map to those in the XSD GameRuleType + std::wstring m_descriptionId; + std::wstring m_promptId; + int m_4JDataValue; public: - GameRuleDefinition(); - virtual ~GameRuleDefinition(){} + GameRuleDefinition(); + virtual ~GameRuleDefinition() {} - virtual ConsoleGameRules::EGameRuleType getActionType() = 0; + virtual ConsoleGameRules::EGameRuleType getActionType() = 0; - void setOwnerType(GameRulesInstance::EGameRulesInstanceType ownerType) { m_ownerType = ownerType;} + void setOwnerType(GameRulesInstance::EGameRulesInstanceType ownerType) { + m_ownerType = ownerType; + } - virtual void write(DataOutputStream *); + virtual void write(DataOutputStream*); - virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttributes); - virtual void getChildren(std::vector *); + virtual void writeAttributes(DataOutputStream* dos, + unsigned int numAttributes); + virtual void getChildren(std::vector*); - virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); - virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); - - virtual void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule); + virtual GameRuleDefinition* addChild( + ConsoleGameRules::EGameRuleType ruleType); + virtual void addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue); - bool getComplete(GameRule *rule); - void setComplete(GameRule *rule, bool val); + virtual void populateGameRule( + GameRulesInstance::EGameRulesInstanceType type, GameRule* rule); - virtual int getGoal() { return 0; } - virtual int getProgress(GameRule *rule) { return 0; } + bool getComplete(GameRule* rule); + void setComplete(GameRule* rule, bool val); - virtual int getIcon() { return -1; } - virtual int getAuxValue() { return 0; } + virtual int getGoal() { return 0; } + virtual int getProgress(GameRule* rule) { return 0; } - // Here we should have functions for all the hooks, with a GameRule* as the first parameter - virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z) { return false; } - virtual bool onCollectItem(GameRule *rule, std::shared_ptr item) { return false; } - virtual void postProcessPlayer(std::shared_ptr player) { } + virtual int getIcon() { return -1; } + virtual int getAuxValue() { return 0; } - std::vector *enumerate(); - std::unordered_map *enumerateMap(); + // Here we should have functions for all the hooks, with a GameRule* as the + // first parameter + virtual bool onUseTile(GameRule* rule, int tileId, int x, int y, int z) { + return false; + } + virtual bool onCollectItem(GameRule* rule, + std::shared_ptr item) { + return false; + } + virtual void postProcessPlayer(std::shared_ptr player) {} - // Static functions - static GameRulesInstance *generateNewGameRulesInstance(GameRulesInstance::EGameRulesInstanceType type, LevelRuleset *rules, Connection *connection); - static std::wstring generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const std::wstring &description, void *data = NULL, int dataLength = 0); + std::vector* enumerate(); + std::unordered_map* enumerateMap(); + // Static functions + static GameRulesInstance* generateNewGameRulesInstance( + GameRulesInstance::EGameRulesInstanceType type, LevelRuleset* rules, + Connection* connection); + static std::wstring generateDescriptionString( + ConsoleGameRules::EGameRuleType defType, + const std::wstring& description, void* data = NULL, int dataLength = 0); }; diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp index 4f9134908..928fb1672 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp @@ -12,788 +12,758 @@ #include "ConsoleGameRules.h" #include "GameRuleManager.h" -const WCHAR *GameRuleManager::wchTagNameA[] = -{ - L"", // eGameRuleType_Root - L"MapOptions", // eGameRuleType_LevelGenerationOptions - L"ApplySchematic", // eGameRuleType_ApplySchematic - L"GenerateStructure", // eGameRuleType_GenerateStructure - L"GenerateBox", // eGameRuleType_GenerateBox - L"PlaceBlock", // eGameRuleType_PlaceBlock - L"PlaceContainer", // eGameRuleType_PlaceContainer - L"PlaceSpawner", // eGameRuleType_PlaceSpawner - L"BiomeOverride", // eGameRuleType_BiomeOverride - L"StartFeature", // eGameRuleType_StartFeature - L"AddItem", // eGameRuleType_AddItem - L"AddEnchantment", // eGameRuleType_AddEnchantment - L"LevelRules", // eGameRuleType_LevelRules - L"NamedArea", // eGameRuleType_NamedArea - L"UseTile", // eGameRuleType_UseTileRule - L"CollectItem", // eGameRuleType_CollectItemRule - L"CompleteAll", // eGameRuleType_CompleteAllRule - L"UpdatePlayer", // eGameRuleType_UpdatePlayerRule +const WCHAR* GameRuleManager::wchTagNameA[] = { + L"", // eGameRuleType_Root + L"MapOptions", // eGameRuleType_LevelGenerationOptions + L"ApplySchematic", // eGameRuleType_ApplySchematic + L"GenerateStructure", // eGameRuleType_GenerateStructure + L"GenerateBox", // eGameRuleType_GenerateBox + L"PlaceBlock", // eGameRuleType_PlaceBlock + L"PlaceContainer", // eGameRuleType_PlaceContainer + L"PlaceSpawner", // eGameRuleType_PlaceSpawner + L"BiomeOverride", // eGameRuleType_BiomeOverride + L"StartFeature", // eGameRuleType_StartFeature + L"AddItem", // eGameRuleType_AddItem + L"AddEnchantment", // eGameRuleType_AddEnchantment + L"LevelRules", // eGameRuleType_LevelRules + L"NamedArea", // eGameRuleType_NamedArea + L"UseTile", // eGameRuleType_UseTileRule + L"CollectItem", // eGameRuleType_CollectItemRule + L"CompleteAll", // eGameRuleType_CompleteAllRule + L"UpdatePlayer", // eGameRuleType_UpdatePlayerRule }; -const WCHAR *GameRuleManager::wchAttrNameA[] = -{ - L"descriptionName", // eGameRuleAttr_descriptionName - L"promptName", // eGameRuleAttr_promptName - L"dataTag", // eGameRuleAttr_dataTag - L"enchantmentId", // eGameRuleAttr_enchantmentId - L"enchantmentLevel", // eGameRuleAttr_enchantmentLevel - L"itemId", // eGameRuleAttr_itemId - L"quantity", // eGameRuleAttr_quantity - L"auxValue", // eGameRuleAttr_auxValue - L"slot", // eGameRuleAttr_slot - L"name", // eGameRuleAttr_name - L"food", // eGameRuleAttr_food - L"health", // eGameRuleAttr_health - L"tileId", // eGameRuleAttr_tileId - L"useCoords", // eGameRuleAttr_useCoords - L"seed", // eGameRuleAttr_seed - L"flatworld", // eGameRuleAttr_flatworld - L"filename", // eGameRuleAttr_filename - L"rot", // eGameRuleAttr_rot - L"data", // eGameRuleAttr_data - L"block", // eGameRuleAttr_block - L"entity", // eGameRuleAttr_entity - L"facing", // eGameRuleAttr_facing - L"edgeTile", // eGameRuleAttr_edgeTile - L"fillTile", // eGameRuleAttr_fillTile - L"skipAir", // eGameRuleAttr_skipAir - L"x", // eGameRuleAttr_x - L"x0", // eGameRuleAttr_x0 - L"x1", // eGameRuleAttr_x1 - L"y", // eGameRuleAttr_y - L"y0", // eGameRuleAttr_y0 - L"y1", // eGameRuleAttr_y1 - L"z", // eGameRuleAttr_z - L"z0", // eGameRuleAttr_z0 - L"z1", // eGameRuleAttr_z1 - L"chunkX", // eGameRuleAttr_chunkX - L"chunkZ", // eGameRuleAttr_chunkZ - L"yRot", // eGameRuleAttr_yRot - L"spawnX", // eGameRuleAttr_spawnX - L"spawnY", // eGameRuleAttr_spawnY - L"spawnZ", // eGameRuleAttr_spawnZ - L"orientation", - L"dimension", - L"topTileId", // eGameRuleAttr_topTileId - L"biomeId", // eGameRuleAttr_biomeId - L"feature", // eGameRuleAttr_feature +const WCHAR* GameRuleManager::wchAttrNameA[] = { + L"descriptionName", // eGameRuleAttr_descriptionName + L"promptName", // eGameRuleAttr_promptName + L"dataTag", // eGameRuleAttr_dataTag + L"enchantmentId", // eGameRuleAttr_enchantmentId + L"enchantmentLevel", // eGameRuleAttr_enchantmentLevel + L"itemId", // eGameRuleAttr_itemId + L"quantity", // eGameRuleAttr_quantity + L"auxValue", // eGameRuleAttr_auxValue + L"slot", // eGameRuleAttr_slot + L"name", // eGameRuleAttr_name + L"food", // eGameRuleAttr_food + L"health", // eGameRuleAttr_health + L"tileId", // eGameRuleAttr_tileId + L"useCoords", // eGameRuleAttr_useCoords + L"seed", // eGameRuleAttr_seed + L"flatworld", // eGameRuleAttr_flatworld + L"filename", // eGameRuleAttr_filename + L"rot", // eGameRuleAttr_rot + L"data", // eGameRuleAttr_data + L"block", // eGameRuleAttr_block + L"entity", // eGameRuleAttr_entity + L"facing", // eGameRuleAttr_facing + L"edgeTile", // eGameRuleAttr_edgeTile + L"fillTile", // eGameRuleAttr_fillTile + L"skipAir", // eGameRuleAttr_skipAir + L"x", // eGameRuleAttr_x + L"x0", // eGameRuleAttr_x0 + L"x1", // eGameRuleAttr_x1 + L"y", // eGameRuleAttr_y + L"y0", // eGameRuleAttr_y0 + L"y1", // eGameRuleAttr_y1 + L"z", // eGameRuleAttr_z + L"z0", // eGameRuleAttr_z0 + L"z1", // eGameRuleAttr_z1 + L"chunkX", // eGameRuleAttr_chunkX + L"chunkZ", // eGameRuleAttr_chunkZ + L"yRot", // eGameRuleAttr_yRot + L"spawnX", // eGameRuleAttr_spawnX + L"spawnY", // eGameRuleAttr_spawnY + L"spawnZ", // eGameRuleAttr_spawnZ + L"orientation", + L"dimension", + L"topTileId", // eGameRuleAttr_topTileId + L"biomeId", // eGameRuleAttr_biomeId + L"feature", // eGameRuleAttr_feature }; -GameRuleManager::GameRuleManager() -{ - m_currentGameRuleDefinitions = NULL; - m_currentLevelGenerationOptions = NULL; +GameRuleManager::GameRuleManager() { + m_currentGameRuleDefinitions = NULL; + m_currentLevelGenerationOptions = NULL; } -void GameRuleManager::loadGameRules(DLCPack *pack) -{ - StringTable *strings = NULL; +void GameRuleManager::loadGameRules(DLCPack* pack) { + StringTable* strings = NULL; - if(pack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData,L"languages.loc")) - { - DLCLocalisationFile *localisationFile = (DLCLocalisationFile *)pack->getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc"); - strings = localisationFile->getStringTable(); - } + if (pack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData, + L"languages.loc")) { + DLCLocalisationFile* localisationFile = + (DLCLocalisationFile*)pack->getFile( + DLCManager::e_DLCType_LocalisationData, L"languages.loc"); + strings = localisationFile->getStringTable(); + } - int gameRulesCount = pack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader); - for(int i = 0; i < gameRulesCount; ++i) - { - DLCGameRulesHeader *dlcHeader = (DLCGameRulesHeader *)pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i); - std::uint32_t dSize; - uint8_t *dData = dlcHeader->getData(dSize); + 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); + std::uint32_t dSize; + uint8_t* dData = dlcHeader->getData(dSize); - LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions(); - // = loadGameRules(dData, dSize); //, strings); + LevelGenerationOptions* createdLevelGenerationOptions = + new LevelGenerationOptions(pack); + // = loadGameRules(dData, dSize); //, strings); - createdLevelGenerationOptions->setGrSource( dlcHeader ); + createdLevelGenerationOptions->setGrSource(dlcHeader); + createdLevelGenerationOptions->setSrc( + LevelGenerationOptions::eSrc_fromDLC); - readRuleFile(createdLevelGenerationOptions, dData, dSize, strings); + readRuleFile(createdLevelGenerationOptions, dData, dSize, strings); - createdLevelGenerationOptions->setSrc( LevelGenerationOptions::eSrc_fromDLC ); - + dlcHeader->lgo = createdLevelGenerationOptions; + } - //createdLevelGenerationOptions->setSrc( LevelGenerationOptions::eSrc_fromDLC ); - dlcHeader->lgo = createdLevelGenerationOptions; - } + gameRulesCount = pack->getDLCItemsCount(DLCManager::e_DLCType_GameRules); + for (int i = 0; i < gameRulesCount; ++i) { + DLCGameRulesFile* dlcFile = (DLCGameRulesFile*)pack->getFile( + DLCManager::e_DLCType_GameRules, i); - gameRulesCount = pack->getDLCItemsCount(DLCManager::e_DLCType_GameRules); - for (int i = 0; i < gameRulesCount; ++i) - { - DLCGameRulesFile *dlcFile = (DLCGameRulesFile *)pack->getFile(DLCManager::e_DLCType_GameRules, i); + std::uint32_t dSize; + uint8_t* dData = dlcFile->getData(dSize); - std::uint32_t dSize; - uint8_t *dData = dlcFile->getData(dSize); + LevelGenerationOptions* createdLevelGenerationOptions = + new LevelGenerationOptions(pack); + // = loadGameRules(dData, dSize); //, strings); - LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions(); - // = loadGameRules(dData, dSize); //, strings); - - createdLevelGenerationOptions->setGrSource( new JustGrSource() ); - readRuleFile(createdLevelGenerationOptions, dData, dSize, strings); + createdLevelGenerationOptions->setGrSource(new JustGrSource()); + createdLevelGenerationOptions->setSrc( + LevelGenerationOptions::eSrc_tutorial); - createdLevelGenerationOptions->setSrc( LevelGenerationOptions::eSrc_tutorial ); - - //createdLevelGenerationOptions->set_DLCGameRulesFile( dlcFile ); + readRuleFile(createdLevelGenerationOptions, dData, dSize, strings); - createdLevelGenerationOptions->setLoadedData(); - } + createdLevelGenerationOptions->setLoadedData(); + } } -LevelGenerationOptions *GameRuleManager::loadGameRules(uint8_t *dIn, unsigned int dSize) -{ - LevelGenerationOptions *lgo = new LevelGenerationOptions(); - lgo->setGrSource( new JustGrSource() ); - lgo->setSrc( LevelGenerationOptions::eSrc_fromSave ); - loadGameRules(lgo, dIn, dSize); - lgo->setLoadedData(); - return lgo; +LevelGenerationOptions* GameRuleManager::loadGameRules(uint8_t* dIn, + unsigned int dSize) { + LevelGenerationOptions* lgo = new LevelGenerationOptions(); + lgo->setGrSource(new JustGrSource()); + lgo->setSrc(LevelGenerationOptions::eSrc_fromSave); + loadGameRules(lgo, dIn, dSize); + lgo->setLoadedData(); + return lgo; } // 4J-JEV: Reverse of saveGameRules. -void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, unsigned int dSize) -{ - app.DebugPrintf("GameRuleManager::LoadingGameRules:\n"); +void GameRuleManager::loadGameRules(LevelGenerationOptions* lgo, uint8_t* dIn, + unsigned int dSize) { + app.DebugPrintf("GameRuleManager::LoadingGameRules:\n"); - ByteArrayInputStream bais( byteArray(dIn,dSize) ); - DataInputStream dis(&bais); + ByteArrayInputStream bais(byteArray(dIn, dSize)); + DataInputStream dis(&bais); - // Read file header. + // Read file header. - //dis.readInt(); // File Size + // dis.readInt(); // File Size - short version = dis.readShort(); - assert( 0x1 == version ); - app.DebugPrintf("\tversion=%d.\n", version); + short version = dis.readShort(); + assert(0x1 == version); + app.DebugPrintf("\tversion=%d.\n", version); - for (int i = 0; i < 8; i++) dis.readByte(); - - std::uint8_t compression_type = dis.readByte(); + for (int i = 0; i < 8; i++) dis.readByte(); - app.DebugPrintf("\tcompressionType=%d.\n", compression_type); + std::uint8_t compression_type = dis.readByte(); - unsigned int compr_len, decomp_len; - compr_len = dis.readInt(); - decomp_len = dis.readInt(); + app.DebugPrintf("\tcompressionType=%d.\n", compression_type); - app.DebugPrintf("\tcompr_len=%d.\n\tdecomp_len=%d.\n", compr_len, decomp_len); - + unsigned int compr_len, decomp_len; + compr_len = dis.readInt(); + decomp_len = dis.readInt(); - // Decompress File Body + app.DebugPrintf("\tcompr_len=%d.\n\tdecomp_len=%d.\n", compr_len, + decomp_len); - byteArray content(new std::uint8_t[decomp_len], decomp_len), - compr_content(new std::uint8_t[compr_len], compr_len); - dis.read(compr_content); + // Decompress File Body - Compression::getCompression()->SetDecompressionType( (Compression::ECompressionTypes)compression_type ); - Compression::getCompression()->DecompressLZXRLE( content.data, &content.length, - compr_content.data, compr_content.length); - Compression::getCompression()->SetDecompressionType( SAVE_FILE_PLATFORM_LOCAL ); + byteArray content(new std::uint8_t[decomp_len], decomp_len), + compr_content(new std::uint8_t[compr_len], compr_len); + dis.read(compr_content); - dis.close(); - bais.close(); + Compression::getCompression()->SetDecompressionType( + (Compression::ECompressionTypes)compression_type); + Compression::getCompression()->DecompressLZXRLE( + content.data, &content.length, compr_content.data, + compr_content.length); + Compression::getCompression()->SetDecompressionType( + SAVE_FILE_PLATFORM_LOCAL); - delete [] compr_content.data; + dis.close(); + bais.close(); - ByteArrayInputStream bais2( content ); - DataInputStream dis2( &bais2 ); + delete[] compr_content.data; - // Read StringTable. - byteArray bStringTable; - bStringTable.length = dis2.readInt(); - bStringTable.data = new std::uint8_t[ bStringTable.length ]; - dis2.read(bStringTable); - StringTable *strings = new StringTable(bStringTable.data, bStringTable.length); + ByteArrayInputStream bais2(content); + DataInputStream dis2(&bais2); - // Read RuleFile. - byteArray bRuleFile; - bRuleFile.length = content.length - bStringTable.length; - bRuleFile.data = new std::uint8_t[ bRuleFile.length ]; - dis2.read(bRuleFile); + // Read StringTable. + byteArray bStringTable; + bStringTable.length = dis2.readInt(); + bStringTable.data = new std::uint8_t[bStringTable.length]; + dis2.read(bStringTable); + StringTable* strings = + new StringTable(bStringTable.data, bStringTable.length); - // 4J-JEV: I don't believe that the path-name is ever used. - //DLCGameRulesFile *dlcgr = new DLCGameRulesFile(L"__PLACEHOLDER__"); - //dlcgr->addData(bRuleFile.data,bRuleFile.length); + // Read RuleFile. + byteArray bRuleFile; + bRuleFile.length = content.length - bStringTable.length; + bRuleFile.data = new std::uint8_t[bRuleFile.length]; + dis2.read(bRuleFile); - if (readRuleFile(lgo, bRuleFile.data, bRuleFile.length, strings)) - { - // Set current gen options and ruleset. - //createdLevelGenerationOptions->setFromSaveGame(true); - lgo->setSrc(LevelGenerationOptions::eSrc_fromSave); - setLevelGenerationOptions( lgo ); - //m_currentGameRuleDefinitions = lgo->getRequiredGameRules(); - } - else - { - delete lgo; - } + // 4J-JEV: I don't believe that the path-name is ever used. + // DLCGameRulesFile *dlcgr = new DLCGameRulesFile(L"__PLACEHOLDER__"); + // dlcgr->addData(bRuleFile.data,bRuleFile.length); - //delete [] content.data; + if (readRuleFile(lgo, bRuleFile.data, bRuleFile.length, strings)) { + // Set current gen options and ruleset. + // createdLevelGenerationOptions->setFromSaveGame(true); + lgo->setSrc(LevelGenerationOptions::eSrc_fromSave); + setLevelGenerationOptions(lgo); + // m_currentGameRuleDefinitions = lgo->getRequiredGameRules(); + } else { + delete lgo; + } - // Close and return. - dis2.close(); - bais2.close(); + // delete [] content.data; - return ; + // Close and return. + dis2.close(); + bais2.close(); + + return; } // 4J-JEV: Reverse of loadGameRules. -void GameRuleManager::saveGameRules(uint8_t **dOut, unsigned int *dSize) -{ - if (m_currentGameRuleDefinitions == NULL && - m_currentLevelGenerationOptions == NULL) - { - app.DebugPrintf("GameRuleManager:: Nothing here to save."); - *dOut = NULL; - *dSize = 0; - return; - } +void GameRuleManager::saveGameRules(uint8_t** dOut, unsigned int* dSize) { + if (m_currentGameRuleDefinitions == NULL && + m_currentLevelGenerationOptions == NULL) { + app.DebugPrintf("GameRuleManager:: Nothing here to save."); + *dOut = NULL; + *dSize = 0; + return; + } - app.DebugPrintf("GameRuleManager::saveGameRules:\n"); + app.DebugPrintf("GameRuleManager::saveGameRules:\n"); - // Initialise output stream. - ByteArrayOutputStream baos; - DataOutputStream dos(&baos); - - // Write header. + // Initialise output stream. + ByteArrayOutputStream baos; + DataOutputStream dos(&baos); - // VERSION NUMBER - dos.writeShort( 0x1 ); // version_number + // Write header. - // Write 8 bytes of empty space in case we need them later. - // Mainly useful for the ones we save embedded in game saves. - for (unsigned int i = 0; i < 8; i++) - dos.writeByte(0x0); + // VERSION NUMBER + dos.writeShort(0x1); // version_number - dos.writeByte(APPROPRIATE_COMPRESSION_TYPE); // m_compressionType + // Write 8 bytes of empty space in case we need them later. + // Mainly useful for the ones we save embedded in game saves. + for (unsigned int i = 0; i < 8; i++) dos.writeByte(0x0); - // -- START COMPRESSED -- // - ByteArrayOutputStream compr_baos; - DataOutputStream compr_dos(&compr_baos); + dos.writeByte(APPROPRIATE_COMPRESSION_TYPE); // m_compressionType - if (m_currentGameRuleDefinitions == NULL) - { - compr_dos.writeInt( 0 ); // numStrings for StringTable - compr_dos.writeInt( version_number ); - compr_dos.writeByte(Compression::eCompressionType_None); // compression type - for (int i=0; i<2; i++) compr_dos.writeByte(0x0); // Padding. - compr_dos.writeInt( 0 ); // StringLookup.length - compr_dos.writeInt( 0 ); // SchematicFiles.length - compr_dos.writeInt( 0 ); // XmlObjects.length - } - else - { - StringTable *st = m_currentGameRuleDefinitions->getStringTable(); + // -- START COMPRESSED -- // + ByteArrayOutputStream compr_baos; + DataOutputStream compr_dos(&compr_baos); - if (st == NULL) - { - app.DebugPrintf("GameRuleManager::saveGameRules: StringTable == NULL!"); - } - else - { - // Write string table. - byteArray stba; - m_currentGameRuleDefinitions->getStringTable()->getData(&stba.data, &stba.length); - compr_dos.writeInt( stba.length ); - compr_dos.write( stba ); + if (m_currentGameRuleDefinitions == NULL) { + compr_dos.writeInt(0); // numStrings for StringTable + compr_dos.writeInt(version_number); + compr_dos.writeByte( + Compression::eCompressionType_None); // compression type + for (int i = 0; i < 2; i++) compr_dos.writeByte(0x0); // Padding. + compr_dos.writeInt(0); // StringLookup.length + compr_dos.writeInt(0); // SchematicFiles.length + compr_dos.writeInt(0); // XmlObjects.length + } else { + StringTable* st = m_currentGameRuleDefinitions->getStringTable(); - // Write game rule file to second - // buffer and generate string lookup. - writeRuleFile(&compr_dos); - } - } + if (st == NULL) { + app.DebugPrintf( + "GameRuleManager::saveGameRules: StringTable == NULL!"); + } else { + // Write string table. + byteArray stba; + m_currentGameRuleDefinitions->getStringTable()->getData( + &stba.data, &stba.length); + compr_dos.writeInt(stba.length); + compr_dos.write(stba); - // Compress compr_dos and write to dos. - byteArray compr_ba(new std::uint8_t[ compr_baos.buf.length ], compr_baos.buf.length); - Compression::getCompression()->CompressLZXRLE( compr_ba.data, &compr_ba.length, - compr_baos.buf.data, compr_baos.buf.length ); + // Write game rule file to second + // buffer and generate string lookup. + writeRuleFile(&compr_dos); + } + } - app.DebugPrintf("\tcompr_ba.length=%d.\n\tcompr_baos.buf.length=%d.\n", - compr_ba.length, compr_baos.buf.length ); + // Compress compr_dos and write to dos. + byteArray compr_ba(new std::uint8_t[compr_baos.buf.length], + compr_baos.buf.length); + Compression::getCompression()->CompressLZXRLE( + compr_ba.data, &compr_ba.length, compr_baos.buf.data, + compr_baos.buf.length); - dos.writeInt( compr_ba.length ); // Write length - dos.writeInt( compr_baos.buf.length ); - dos.write(compr_ba); - - delete [] compr_ba.data; - - compr_dos.close(); - compr_baos.close(); - // -- END COMPRESSED -- // + app.DebugPrintf("\tcompr_ba.length=%d.\n\tcompr_baos.buf.length=%d.\n", + compr_ba.length, compr_baos.buf.length); - // return - *dSize = baos.buf.length; - *dOut = baos.buf.data; + dos.writeInt(compr_ba.length); // Write length + dos.writeInt(compr_baos.buf.length); + dos.write(compr_ba); - baos.buf.data = NULL; - - dos.close(); baos.close(); + delete[] compr_ba.data; + + compr_dos.close(); + compr_baos.close(); + // -- END COMPRESSED -- // + + // return + *dSize = baos.buf.length; + *dOut = baos.buf.data; + + baos.buf.data = NULL; + + dos.close(); + baos.close(); } // 4J-JEV: Reverse of readRuleFile. -void GameRuleManager::writeRuleFile(DataOutputStream *dos) -{ - // Write Header - dos->writeShort(version_number); // Version number. - dos->writeByte(Compression::eCompressionType_None); // compression type - for (int i=0; i<8; i++) dos->writeBoolean(false); // Padding. +void GameRuleManager::writeRuleFile(DataOutputStream* dos) { + // Write Header + dos->writeShort(version_number); // Version number. + dos->writeByte(Compression::eCompressionType_None); // compression type + for (int i = 0; i < 8; i++) dos->writeBoolean(false); // Padding. - // Write string lookup. - int numStrings = static_cast(ConsoleGameRules::eGameRuleType_Count) + - static_cast(ConsoleGameRules::eGameRuleAttr_Count); - dos->writeInt(numStrings); - for (int i = 0; i < ConsoleGameRules::eGameRuleType_Count; i++) dos->writeUTF( wchTagNameA[i] ); - for (int i = 0; i < ConsoleGameRules::eGameRuleAttr_Count; i++) dos->writeUTF( wchAttrNameA[i] ); + // Write string lookup. + int numStrings = static_cast(ConsoleGameRules::eGameRuleType_Count) + + static_cast(ConsoleGameRules::eGameRuleAttr_Count); + dos->writeInt(numStrings); + for (int i = 0; i < ConsoleGameRules::eGameRuleType_Count; i++) + dos->writeUTF(wchTagNameA[i]); + for (int i = 0; i < ConsoleGameRules::eGameRuleAttr_Count; i++) + dos->writeUTF(wchAttrNameA[i]); - // Write schematic files. - std::unordered_map *files; - files = getLevelGenerationOptions()->getUnfinishedSchematicFiles(); - dos->writeInt( files->size() ); - for (AUTO_VAR(it, files->begin()); it != files->end(); it++) - { - std::wstring filename = it->first; - ConsoleSchematicFile *file = it->second; + // Write schematic files. + std::unordered_map* files; + files = getLevelGenerationOptions()->getUnfinishedSchematicFiles(); + dos->writeInt(files->size()); + for (AUTO_VAR(it, files->begin()); it != files->end(); it++) { + std::wstring filename = it->first; + ConsoleSchematicFile* file = it->second; - ByteArrayOutputStream fileBaos; - DataOutputStream fileDos(&fileBaos); - file->save(&fileDos); + ByteArrayOutputStream fileBaos; + DataOutputStream fileDos(&fileBaos); + file->save(&fileDos); - dos->writeUTF(filename); - //dos->writeInt(file->m_data.length); - dos->writeInt(fileBaos.buf.length); - dos->write((byteArray)fileBaos.buf); + dos->writeUTF(filename); + // dos->writeInt(file->m_data.length); + dos->writeInt(fileBaos.buf.length); + dos->write((byteArray)fileBaos.buf); - fileDos.close(); fileBaos.close(); - } + fileDos.close(); + fileBaos.close(); + } - // Write xml objects. - dos->writeInt( 2 ); // numChildren - m_currentLevelGenerationOptions->write(dos); - m_currentGameRuleDefinitions->write(dos); + // Write xml objects. + dos->writeInt(2); // numChildren + m_currentLevelGenerationOptions->write(dos); + m_currentGameRuleDefinitions->write(dos); } -bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, unsigned int dSize, StringTable *strings) //(DLCGameRulesFile *dlcFile, StringTable *strings) +bool GameRuleManager::readRuleFile( + LevelGenerationOptions* lgo, uint8_t* dIn, unsigned int dSize, + StringTable* strings) //(DLCGameRulesFile *dlcFile, StringTable *strings) { - bool levelGenAdded = false; - bool gameRulesAdded = false; - LevelGenerationOptions *levelGenerator = lgo;//new LevelGenerationOptions(); - LevelRuleset *gameRules = new LevelRuleset(); + bool levelGenAdded = false; + bool gameRulesAdded = false; + LevelGenerationOptions* levelGenerator = + lgo; // new LevelGenerationOptions(); + LevelRuleset* gameRules = new LevelRuleset(); - //std::uint32_t dataLength = 0; - //std::uint8_t *data = dlcFile->getData(dataLength); - //byteArray data(pbData,dwLen); - - byteArray data(dIn, dSize); - ByteArrayInputStream bais(data); - DataInputStream dis(&bais); + // std::uint32_t dataLength = 0; + // std::uint8_t *data = dlcFile->getData(dataLength); + // byteArray data(pbData,dwLen); - // Read File. + byteArray data(dIn, dSize); + ByteArrayInputStream bais(data); + DataInputStream dis(&bais); - // version_number - __int64 version = dis.readShort(); - unsigned char compressionType = 0; - if(version == 0) - { - for (int i = 0; i < 14; i++) dis.readByte(); // Read padding. - } - else - { - compressionType = dis.readByte(); + // Read File. - // Read the spare bytes we inserted for future use - for(int i = 0; i < 8; ++i) dis.readBoolean(); - } + // version_number + __int64 version = dis.readShort(); + unsigned char compressionType = 0; + if (version == 0) { + for (int i = 0; i < 14; i++) dis.readByte(); // Read padding. + } else { + compressionType = dis.readByte(); - ByteArrayInputStream *contentBais = NULL; - DataInputStream *contentDis = NULL; + // Read the spare bytes we inserted for future use + for (int i = 0; i < 8; ++i) dis.readBoolean(); + } - if(compressionType == Compression::eCompressionType_None) - { - // No compression - // No need to read buffer size, as we can read the stream as it is; - app.DebugPrintf("De-compressing game rules with: None\n"); - contentDis = &dis; - } - else - { - unsigned int uncompressedSize = dis.readInt(); - unsigned int compressedSize = dis.readInt(); - byteArray compressedBuffer(compressedSize); - dis.read(compressedBuffer); + ByteArrayInputStream* contentBais = NULL; + DataInputStream* contentDis = NULL; - byteArray decompressedBuffer = byteArray(uncompressedSize); + if (compressionType == Compression::eCompressionType_None) { + // No compression + // No need to read buffer size, as we can read the stream as it is; + app.DebugPrintf("De-compressing game rules with: None\n"); + contentDis = &dis; + } else { + unsigned int uncompressedSize = dis.readInt(); + unsigned int compressedSize = dis.readInt(); + byteArray compressedBuffer(compressedSize); + dis.read(compressedBuffer); - switch(compressionType) - { - case Compression::eCompressionType_None: - memcpy(decompressedBuffer.data, compressedBuffer.data, uncompressedSize); - break; + byteArray decompressedBuffer = byteArray(uncompressedSize); - case Compression::eCompressionType_RLE: - app.DebugPrintf("De-compressing game rules with: RLE\n"); - Compression::getCompression()->Decompress( decompressedBuffer.data, &decompressedBuffer.length, compressedBuffer.data, compressedSize); - break; + switch (compressionType) { + case Compression::eCompressionType_None: + memcpy(decompressedBuffer.data, compressedBuffer.data, + uncompressedSize); + break; - default: - app.DebugPrintf("De-compressing game rules."); + case Compression::eCompressionType_RLE: + app.DebugPrintf("De-compressing game rules with: RLE\n"); + Compression::getCompression()->Decompress( + decompressedBuffer.data, &decompressedBuffer.length, + compressedBuffer.data, compressedSize); + break; + + default: + app.DebugPrintf("De-compressing game rules."); #ifndef _CONTENT_PACKAGE - assert( compressionType == APPROPRIATE_COMPRESSION_TYPE ); + assert(compressionType == APPROPRIATE_COMPRESSION_TYPE); #endif - // 4J-JEV: DecompressLZXRLE uses the correct platform specific compression type. (need to assert that the data is compressed with it though). - Compression::getCompression()->DecompressLZXRLE(decompressedBuffer.data, &decompressedBuffer.length, compressedBuffer.data, compressedSize); - break; -/* 4J-JEV: - Each platform has only 1 method of compression, 'compression.h' file deals with it. + // 4J-JEV: DecompressLZXRLE uses the correct platform specific + // compression type. (need to assert that the data is compressed + // with it though). + Compression::getCompression()->DecompressLZXRLE( + decompressedBuffer.data, &decompressedBuffer.length, + compressedBuffer.data, compressedSize); + break; + /* 4J-JEV: + Each platform has only 1 method of compression, + 'compression.h' file deals with it. - case Compression::eCompressionType_LZXRLE: - app.DebugPrintf("De-compressing game rules with: LZX+RLE\n"); - Compression::getCompression()->DecompressLZXRLE( decompressedBuffer.data, &uncompressedSize, compressedBuffer.data, compressedSize); - break; - default: - app.DebugPrintf("Invalid compression type %d found\n", compressionType); - __debugbreak(); + case Compression::eCompressionType_LZXRLE: + app.DebugPrintf("De-compressing game + rules with: LZX+RLE\n"); + Compression::getCompression()->DecompressLZXRLE( + decompressedBuffer.data, &uncompressedSize, + compressedBuffer.data, compressedSize); break; default: + app.DebugPrintf("Invalid compression + type %d found\n", compressionType); + __debugbreak(); - delete [] compressedBuffer.data; delete [] decompressedBuffer.data; - dis.close(); bais.reset(); + delete [] compressedBuffer.data; delete + [] decompressedBuffer.data; dis.close(); bais.reset(); - if(!gameRulesAdded) delete gameRules; - return false; - */ - }; + if(!gameRulesAdded) delete gameRules; + return false; + */ + }; - delete [] compressedBuffer.data; + delete[] compressedBuffer.data; - contentBais = new ByteArrayInputStream(decompressedBuffer); - contentDis = new DataInputStream(contentBais); - } + contentBais = new ByteArrayInputStream(decompressedBuffer); + contentDis = new DataInputStream(contentBais); + } - // string lookup. - unsigned int numStrings = contentDis->readInt(); - std::vector tagsAndAtts; - for (unsigned int i = 0; i < numStrings; i++) - tagsAndAtts.push_back( contentDis->readUTF() ); + // string lookup. + unsigned int numStrings = contentDis->readInt(); + std::vector tagsAndAtts; + for (unsigned int i = 0; i < numStrings; i++) + tagsAndAtts.push_back(contentDis->readUTF()); - std::unordered_map tagIdMap; - for(int type = (int)ConsoleGameRules::eGameRuleType_Root; type < (int)ConsoleGameRules::eGameRuleType_Count; ++type) - { - for(unsigned int i = 0; i < numStrings; ++i) - { - if(tagsAndAtts[i].compare(wchTagNameA[type]) == 0) - { - tagIdMap.insert( std::unordered_map::value_type(i, (ConsoleGameRules::EGameRuleType)type) ); - break; - } - } - } + std::unordered_map tagIdMap; + for (int type = (int)ConsoleGameRules::eGameRuleType_Root; + type < (int)ConsoleGameRules::eGameRuleType_Count; ++type) { + for (unsigned int i = 0; i < numStrings; ++i) { + if (tagsAndAtts[i].compare(wchTagNameA[type]) == 0) { + tagIdMap.insert( + std::unordered_map:: + value_type(i, (ConsoleGameRules::EGameRuleType)type)); + break; + } + } + } - // 4J-JEV: TODO: As yet unused. - /* - std::unordered_map attrIdMap; - for(int attr = (int)ConsoleGameRules::eGameRuleAttr_descriptionName; attr < (int)ConsoleGameRules::eGameRuleAttr_Count; ++attr) - { - for (unsigned int i = 0; i < numStrings; i++) - { - if (tagsAndAtts[i].compare(wchAttrNameA[attr]) == 0) - { - tagIdMap.insert( std::unordered_map::value_type(i , (ConsoleGameRules::EGameRuleAttr)attr) ); - break; - } - } - }*/ + // 4J-JEV: TODO: As yet unused. + /* + std::unordered_map attrIdMap; + for(int attr = (int)ConsoleGameRules::eGameRuleAttr_descriptionName; attr < + (int)ConsoleGameRules::eGameRuleAttr_Count; ++attr) + { + for (unsigned int i = 0; i < numStrings; i++) + { + if (tagsAndAtts[i].compare(wchAttrNameA[attr]) == 0) + { + tagIdMap.insert( std::unordered_map::value_type(i , + (ConsoleGameRules::EGameRuleAttr)attr) ); break; + } + } + }*/ - // subfile - unsigned int numFiles = contentDis->readInt(); - for (unsigned int i = 0; i < numFiles; i++) - { - std::wstring sFilename = contentDis->readUTF(); - int length = contentDis->readInt(); - byteArray ba( length ); + // subfile + unsigned int numFiles = contentDis->readInt(); + for (unsigned int i = 0; i < numFiles; i++) { + std::wstring sFilename = contentDis->readUTF(); + int length = contentDis->readInt(); + byteArray ba(length); - contentDis->read(ba); + contentDis->read(ba); - levelGenerator->loadSchematicFile(sFilename, ba.data, ba.length); + levelGenerator->loadSchematicFile(sFilename, ba.data, ba.length); + } - } + LEVEL_GEN_ID lgoID = LEVEL_GEN_ID_NULL; - LEVEL_GEN_ID lgoID = LEVEL_GEN_ID_NULL; + // xml objects + unsigned int numObjects = contentDis->readInt(); + for (unsigned int i = 0; i < numObjects; ++i) { + int tagId = contentDis->readInt(); + ConsoleGameRules::EGameRuleType tagVal = + ConsoleGameRules::eGameRuleType_Invalid; + AUTO_VAR(it, tagIdMap.find(tagId)); + if (it != tagIdMap.end()) tagVal = it->second; - // xml objects - unsigned int numObjects = contentDis->readInt(); - for(unsigned int i = 0; i < numObjects; ++i) - { - int tagId = contentDis->readInt(); - ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid; - AUTO_VAR(it,tagIdMap.find(tagId)); - if(it != tagIdMap.end()) tagVal = it->second; + GameRuleDefinition* rule = NULL; - GameRuleDefinition *rule = NULL; + if (tagVal == ConsoleGameRules::eGameRuleType_LevelGenerationOptions) { + rule = levelGenerator; + levelGenAdded = true; + // m_levelGenerators.addLevelGenerator(L"",levelGenerator); + lgoID = addLevelGenerationOptions(levelGenerator); + levelGenerator->loadStringTable(strings); + } else if (tagVal == ConsoleGameRules::eGameRuleType_LevelRules) { + rule = gameRules; + gameRulesAdded = true; + m_levelRules.addLevelRule(L"", gameRules); + levelGenerator->setRequiredGameRules(gameRules); + gameRules->loadStringTable(strings); + } - if(tagVal == ConsoleGameRules::eGameRuleType_LevelGenerationOptions) - { - rule = levelGenerator; - levelGenAdded = true; - //m_levelGenerators.addLevelGenerator(L"",levelGenerator); - lgoID = addLevelGenerationOptions(levelGenerator); - levelGenerator->loadStringTable(strings); - } - else if(tagVal == ConsoleGameRules::eGameRuleType_LevelRules) - { - rule = gameRules; - gameRulesAdded = true; - m_levelRules.addLevelRule(L"",gameRules); - levelGenerator->setRequiredGameRules(gameRules); - gameRules->loadStringTable(strings); - } + readAttributes(contentDis, &tagsAndAtts, rule); + readChildren(contentDis, &tagsAndAtts, &tagIdMap, rule); + } - readAttributes(contentDis, &tagsAndAtts, rule); - readChildren(contentDis, &tagsAndAtts, &tagIdMap, rule); - } + if (compressionType != 0) { + // Not default + contentDis->close(); + if (contentBais != NULL) delete contentBais; + delete contentDis; + } - if(compressionType != 0) - { - // Not default - contentDis->close(); - if(contentBais != NULL) delete contentBais; - delete contentDis; - } + dis.close(); + bais.reset(); - dis.close(); - bais.reset(); + // if(!levelGenAdded) { delete levelGenerator; levelGenerator = NULL; } + if (!gameRulesAdded) delete gameRules; - //if(!levelGenAdded) { delete levelGenerator; levelGenerator = NULL; } - if(!gameRulesAdded) delete gameRules; - - return true; - //return levelGenerator; + return true; + // return levelGenerator; } -LevelGenerationOptions *GameRuleManager::readHeader(DLCGameRulesHeader *grh) -{ - LevelGenerationOptions *out = - new LevelGenerationOptions(); +LevelGenerationOptions* GameRuleManager::readHeader(DLCGameRulesHeader* grh) { + LevelGenerationOptions* out = new LevelGenerationOptions(); - - out->setSrc(LevelGenerationOptions::eSrc_fromDLC); - out->setGrSource(grh); - addLevelGenerationOptions(out); + out->setSrc(LevelGenerationOptions::eSrc_fromDLC); + out->setGrSource(grh); + addLevelGenerationOptions(out); - return out; + return out; } -void GameRuleManager::readAttributes(DataInputStream *dis, std::vector *tagsAndAtts, GameRuleDefinition *rule) -{ - int numAttrs = dis->readInt(); - for (unsigned int att = 0; att < static_cast(numAttrs); ++att) - { - int attID = dis->readInt(); - std::wstring value = dis->readUTF(); +void GameRuleManager::readAttributes(DataInputStream* dis, + std::vector* tagsAndAtts, + GameRuleDefinition* rule) { + int numAttrs = dis->readInt(); + for (unsigned int att = 0; att < static_cast(numAttrs); + ++att) { + int attID = dis->readInt(); + std::wstring value = dis->readUTF(); - if(rule != NULL) rule->addAttribute(tagsAndAtts->at(attID),value); - } + if (rule != NULL) rule->addAttribute(tagsAndAtts->at(attID), value); + } } -void GameRuleManager::readChildren(DataInputStream *dis, std::vector *tagsAndAtts, std::unordered_map *tagIdMap, GameRuleDefinition *rule) -{ - int numChildren = dis->readInt(); - for(unsigned int child = 0; child < static_cast(numChildren); ++child) - { - int tagId = dis->readInt(); - ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid; - AUTO_VAR(it,tagIdMap->find(tagId)); - if(it != tagIdMap->end()) tagVal = it->second; +void GameRuleManager::readChildren( + DataInputStream* dis, std::vector* tagsAndAtts, + std::unordered_map* tagIdMap, + GameRuleDefinition* rule) { + int numChildren = dis->readInt(); + for (unsigned int child = 0; child < static_cast(numChildren); + ++child) { + int tagId = dis->readInt(); + ConsoleGameRules::EGameRuleType tagVal = + ConsoleGameRules::eGameRuleType_Invalid; + AUTO_VAR(it, tagIdMap->find(tagId)); + if (it != tagIdMap->end()) tagVal = it->second; - GameRuleDefinition *childRule = NULL; - if(rule != NULL) childRule = rule->addChild(tagVal); + GameRuleDefinition* childRule = NULL; + if (rule != NULL) childRule = rule->addChild(tagVal); - readAttributes(dis,tagsAndAtts,childRule); - readChildren(dis,tagsAndAtts,tagIdMap,childRule); - } + readAttributes(dis, tagsAndAtts, childRule); + readChildren(dis, tagsAndAtts, tagIdMap, childRule); + } } -void GameRuleManager::processSchematics(LevelChunk *levelChunk) -{ - if(getLevelGenerationOptions() != NULL) - { - LevelGenerationOptions *levelGenOptions = getLevelGenerationOptions(); - levelGenOptions->processSchematics(levelChunk); - } +void GameRuleManager::processSchematics(LevelChunk* levelChunk) { + if (getLevelGenerationOptions() != NULL) { + LevelGenerationOptions* levelGenOptions = getLevelGenerationOptions(); + levelGenOptions->processSchematics(levelChunk); + } } -void GameRuleManager::processSchematicsLighting(LevelChunk *levelChunk) -{ - if(getLevelGenerationOptions() != NULL) - { - LevelGenerationOptions *levelGenOptions = getLevelGenerationOptions(); - levelGenOptions->processSchematicsLighting(levelChunk); - } +void GameRuleManager::processSchematicsLighting(LevelChunk* levelChunk) { + if (getLevelGenerationOptions() != NULL) { + LevelGenerationOptions* levelGenOptions = getLevelGenerationOptions(); + levelGenOptions->processSchematicsLighting(levelChunk); + } } -void GameRuleManager::loadDefaultGameRules() -{ +void GameRuleManager::loadDefaultGameRules() { #ifdef _XBOX #ifdef _TU_BUILD - std::wstring fileRoot = L"UPDATE:\\res\\GameRules\\Tutorial.pck"; + std::wstring fileRoot = L"UPDATE:\\res\\GameRules\\Tutorial.pck"; #else - std::wstring fileRoot = L"GAME:\\res\\TitleUpdate\\GameRules\\Tutorial.pck"; + std::wstring fileRoot = L"GAME:\\res\\TitleUpdate\\GameRules\\Tutorial.pck"; #endif - File packedTutorialFile(fileRoot); - if(loadGameRulesPack(&packedTutorialFile)) - { - m_levelGenerators.getLevelGenerators()->at(0)->setWorldName(app.GetString(IDS_PLAY_TUTORIAL)); - //m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(L"Tutorial"); - m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME)); - } + File packedTutorialFile(fileRoot); + if (loadGameRulesPack(&packedTutorialFile)) { + m_levelGenerators.getLevelGenerators()->at(0)->setWorldName( + app.GetString(IDS_PLAY_TUTORIAL)); + // m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(L"Tutorial"); + m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName( + app.GetString(IDS_TUTORIALSAVENAME)); + } #ifndef _CONTENT_PACKAGE - // 4J Stu - Remove these just now - //File testRulesPath(L"GAME:\\GameRules"); - //std::vector *packFiles = testRulesPath.listFiles(); + // 4J Stu - Remove these just now + // File testRulesPath(L"GAME:\\GameRules"); + // std::vector *packFiles = testRulesPath.listFiles(); - //for(AUTO_VAR(it,packFiles->begin()); it != packFiles->end(); ++it) - //{ - // loadGameRulesPack(*it); - //} - //delete packFiles; + // for(AUTO_VAR(it,packFiles->begin()); it != packFiles->end(); ++it) + //{ + // loadGameRulesPack(*it); + // } + // delete packFiles; #endif -#else // _XBOX +#else // _XBOX +#ifndef __linux__ +#ifdef _WINDOWS64 + File packedTutorialFile(L"Windows64Media\\Tutorial\\Tutorial.pck"); + if (!packedTutorialFile.exists()) + packedTutorialFile = File(L"Windows64\\Tutorial\\Tutorial.pck"); +#elif defined(__ORBIS__) + File packedTutorialFile(L"/app0/orbis/Tutorial/Tutorial.pck"); +#elif defined(__PSVITA__) + File packedTutorialFile(L"PSVita/Tutorial/Tutorial.pck"); +#elif defined(__PS3__) + File packedTutorialFile(L"PS3/Tutorial/Tutorial.pck"); +#else + File packedTutorialFile(L"Tutorial\\Tutorial.pck"); +#endif + if (loadGameRulesPack(&packedTutorialFile)) { + m_levelGenerators.getLevelGenerators()->at(0)->setWorldName( + app.GetString(IDS_PLAY_TUTORIAL)); + // m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(L"Tutorial"); + m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName( + app.GetString(IDS_TUTORIALSAVENAME)); + } +#else // 4jcraft, TODO this is using old pre-TU19 logic for loading the tutorial, modify to use the above ifdefs std::wstring fpTutorial = L"Tutorial.pck"; if(app.getArchiveFileSize(fpTutorial) >= 0) { DLCPack *pack = new DLCPack(L"",0xffffffff); - unsigned int dwFilesProcessed = 0; + DWORD dwFilesProcessed = 0; if ( app.m_dlcManager.readDLCDataFile(dwFilesProcessed,fpTutorial,pack,true) ) { app.m_dlcManager.addPack(pack); - if (!m_levelGenerators.getLevelGenerators()->empty()) - { - m_levelGenerators.getLevelGenerators()->at(0)->setWorldName(app.GetString(IDS_PLAY_TUTORIAL)); - m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME)); - } - else - { - app.DebugPrintf("loadDefaultGameRules: Tutorial.pck parsed OK but no level generators were added (missing GameRules/LevelGenerationOptions tag?)\n"); - } - } - else - { - app.DebugPrintf("loadDefaultGameRules: readDLCDataFile failed for Tutorial.pck (version too old, IO error, or DLC_TYPE_GameRules not found)\n"); - delete pack; + m_levelGenerators.getLevelGenerators()->at(0)->setWorldName(app.GetString(IDS_PLAY_TUTORIAL)); + m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME)); } + else delete pack; } - else - { - app.DebugPrintf("loadDefaultGameRules: Tutorial.pck not found in archive\n"); - } - - // Linux/PC port fallback: if Tutorial.pck parsing didn't populate level generators - // (e.g. DLC version mismatch, missing GameRules tag), create a minimal placeholder so - // the game doesn't crash with vector::at(0) in LoadTrial(). - if (m_levelGenerators.getLevelGenerators()->empty()) - { - app.DebugPrintf("loadDefaultGameRules: creating minimal fallback LevelGenerationOptions\n"); - LevelGenerationOptions *lgo = new LevelGenerationOptions(); - lgo->setGrSource(new JustGrSource()); - lgo->setSrc(LevelGenerationOptions::eSrc_tutorial); - lgo->setWorldName(app.GetString(IDS_PLAY_TUTORIAL)); - lgo->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME)); - lgo->setLoadedData(); - addLevelGenerationOptions(lgo); - } - - /*StringTable *strings = new StringTable(baStrings.data, baStrings.length); - LevelGenerationOptions *lgo = new LevelGenerationOptions(); - lgo->setGrSource( new JustGrSource() ); - lgo->setSrc( LevelGenerationOptions::eSrc_tutorial ); - readRuleFile(lgo, tutorial.data, tutorial.length, strings); - lgo->setLoadedData();*/ - +#endif #endif } -bool GameRuleManager::loadGameRulesPack(File *path) -{ - bool success = false; -#ifdef _XBOX - if(path->exists()) - { - DLCPack *pack = new DLCPack(L"",0xffffffff); - unsigned int dwFilesProcessed = 0; - if( app.m_dlcManager.readDLCDataFile(dwFilesProcessed, path->getPath(),pack)) - { - app.m_dlcManager.addPack(pack); - success = true; - } - else - { - delete pack; - } - } -#endif - return success; +bool GameRuleManager::loadGameRulesPack(File* path) { + bool success = false; + if (path->exists()) { + DLCPack* pack = new DLCPack(L"", 0xffffffff); + unsigned int dwFilesProcessed = 0; + if (app.m_dlcManager.readDLCDataFile(dwFilesProcessed, path->getPath(), + pack)) { + app.m_dlcManager.addPack(pack); + success = true; + } else { + delete pack; + } + } + return success; } -void GameRuleManager::setLevelGenerationOptions(LevelGenerationOptions *levelGen) -{ - m_currentGameRuleDefinitions = NULL; - m_currentLevelGenerationOptions = levelGen; +void GameRuleManager::setLevelGenerationOptions( + LevelGenerationOptions* levelGen) { + unloadCurrentGameRules(); - if(m_currentLevelGenerationOptions != NULL && m_currentLevelGenerationOptions->requiresGameRules() ) - { - m_currentGameRuleDefinitions = m_currentLevelGenerationOptions->getRequiredGameRules(); - } + m_currentGameRuleDefinitions = NULL; + m_currentLevelGenerationOptions = levelGen; - if(m_currentLevelGenerationOptions != NULL) - m_currentLevelGenerationOptions->reset_start(); + if (m_currentLevelGenerationOptions != NULL && + m_currentLevelGenerationOptions->requiresGameRules()) { + m_currentGameRuleDefinitions = + m_currentLevelGenerationOptions->getRequiredGameRules(); + } + + if (m_currentLevelGenerationOptions != NULL) + m_currentLevelGenerationOptions->reset_start(); } -const wchar_t *GameRuleManager::GetGameRulesString(const std::wstring &key) -{ - if(m_currentGameRuleDefinitions != NULL && !key.empty() ) - { - return m_currentGameRuleDefinitions->getString(key); - } - else - { - return L""; - } +const wchar_t* GameRuleManager::GetGameRulesString(const std::wstring& key) { + if (m_currentGameRuleDefinitions != NULL && !key.empty()) { + return m_currentGameRuleDefinitions->getString(key); + } else { + return L""; + } } -LEVEL_GEN_ID GameRuleManager::addLevelGenerationOptions(LevelGenerationOptions *lgo) -{ - std::vector *lgs = m_levelGenerators.getLevelGenerators(); - - for (int i = 0; isize(); i++) - if (lgs->at(i) == lgo) - return i; +LEVEL_GEN_ID GameRuleManager::addLevelGenerationOptions( + LevelGenerationOptions* lgo) { + std::vector* lgs = + m_levelGenerators.getLevelGenerators(); - lgs->push_back(lgo); - return lgs->size() - 1; + for (int i = 0; i < lgs->size(); i++) + if (lgs->at(i) == lgo) return i; + + lgs->push_back(lgo); + return lgs->size() - 1; } -void GameRuleManager::unloadCurrentGameRules() -{ - if (m_currentLevelGenerationOptions != NULL) - { - if (m_currentGameRuleDefinitions != NULL - && m_currentLevelGenerationOptions->isFromSave()) - m_levelRules.removeLevelRule( m_currentGameRuleDefinitions ); +void GameRuleManager::unloadCurrentGameRules() { + if (m_currentLevelGenerationOptions != NULL) { + if (m_currentGameRuleDefinitions != NULL && + m_currentLevelGenerationOptions->isFromSave()) + m_levelRules.removeLevelRule(m_currentGameRuleDefinitions); - if (m_currentLevelGenerationOptions->isFromSave()) - { - m_levelGenerators.removeLevelGenerator( m_currentLevelGenerationOptions ); - - delete m_currentLevelGenerationOptions; - } - else if (m_currentLevelGenerationOptions->isFromDLC()) - { - m_currentLevelGenerationOptions->reset_finish(); - } - } + if (m_currentLevelGenerationOptions->isFromSave()) { + m_levelGenerators.removeLevelGenerator( + m_currentLevelGenerationOptions); - m_currentGameRuleDefinitions = NULL; - m_currentLevelGenerationOptions = NULL; + delete m_currentLevelGenerationOptions; + } else if (m_currentLevelGenerationOptions->isFromDLC()) { + m_currentLevelGenerationOptions->reset_finish(); + } + } + + m_currentGameRuleDefinitions = NULL; + m_currentLevelGenerationOptions = NULL; } diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.h b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.h index 95a0dbf4d..8553077f5 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.h +++ b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.h @@ -3,12 +3,14 @@ #include "LevelGenerators.h" #include "LevelRules.h" +#include "../DLC/DLCGameRulesHeader.h" + class LevelGenerationOptions; class RootGameRulesDefinition; class LevelChunk; class DLCPack; class DLCGameRulesFile; -class DLCGameRulesHeader; +// class DLCGameRulesHeader; class StringTable; class GameRuleDefinition; class DataInputStream; @@ -17,64 +19,78 @@ class WstringLookup; #define GAME_RULE_SAVENAME L"requiredGameRules.grf" -// 4J-JEV: +// 4J-JEV: #define LEVEL_GEN_ID int #define LEVEL_GEN_ID_NULL 0 -class GameRuleManager -{ +class GameRuleManager { public: - static const WCHAR *wchTagNameA[ConsoleGameRules::eGameRuleType_Count]; - static const WCHAR *wchAttrNameA[ConsoleGameRules::eGameRuleAttr_Count]; + static const WCHAR* wchTagNameA[ConsoleGameRules::eGameRuleType_Count]; + static const WCHAR* wchAttrNameA[ConsoleGameRules::eGameRuleAttr_Count]; - static const short version_number = 2; + static const short version_number = 2; private: - LevelGenerationOptions *m_currentLevelGenerationOptions; - LevelRuleset *m_currentGameRuleDefinitions; - LevelGenerators m_levelGenerators; - LevelRules m_levelRules; + LevelGenerationOptions* m_currentLevelGenerationOptions; + LevelRuleset* m_currentGameRuleDefinitions; + LevelGenerators m_levelGenerators; + LevelRules m_levelRules; public: - GameRuleManager(); + GameRuleManager(); - void loadGameRules(DLCPack *); + void loadGameRules(DLCPack*); - LevelGenerationOptions *loadGameRules(uint8_t *dIn, unsigned int dSize); - void loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, unsigned int dSize); + LevelGenerationOptions* loadGameRules(uint8_t* dIn, unsigned int dSize); + void loadGameRules(LevelGenerationOptions* lgo, uint8_t* dIn, + unsigned int dSize); - void saveGameRules(uint8_t **dOut, unsigned int *dSize); + void saveGameRules(uint8_t** dOut, unsigned int* dSize); private: - LevelGenerationOptions *readHeader(DLCGameRulesHeader *grh); + LevelGenerationOptions* readHeader(DLCGameRulesHeader* grh); - void writeRuleFile(DataOutputStream *dos); + void writeRuleFile(DataOutputStream* dos); public: - bool readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, unsigned int dSize, StringTable *strings); //(DLCGameRulesFile *dlcFile, StringTable *strings); + bool readRuleFile(LevelGenerationOptions* lgo, uint8_t* dIn, + unsigned int dSize, + StringTable* strings); //(DLCGameRulesFile *dlcFile, + //StringTable *strings); private: - void readAttributes(DataInputStream *dis, std::vector *tagsAndAtts, GameRuleDefinition *rule); - void readChildren(DataInputStream *dis, std::vector *tagsAndAtts, std::unordered_map *tagIdMap, GameRuleDefinition *rule); + void readAttributes(DataInputStream* dis, + std::vector* tagsAndAtts, + GameRuleDefinition* rule); + void readChildren( + DataInputStream* dis, std::vector* tagsAndAtts, + std::unordered_map* tagIdMap, + GameRuleDefinition* rule); public: - void processSchematics(LevelChunk *levelChunk); - void processSchematicsLighting(LevelChunk *levelChunk); - void loadDefaultGameRules(); + void processSchematics(LevelChunk* levelChunk); + void processSchematicsLighting(LevelChunk* levelChunk); + void loadDefaultGameRules(); private: - bool loadGameRulesPack(File *path); + bool loadGameRulesPack(File* path); - LEVEL_GEN_ID addLevelGenerationOptions(LevelGenerationOptions *); + LEVEL_GEN_ID addLevelGenerationOptions(LevelGenerationOptions*); public: - std::vector *getLevelGenerators() { return m_levelGenerators.getLevelGenerators(); } - void setLevelGenerationOptions(LevelGenerationOptions *levelGen); - LevelRuleset *getGameRuleDefinitions() { return m_currentGameRuleDefinitions; } - LevelGenerationOptions *getLevelGenerationOptions() { return m_currentLevelGenerationOptions; } - const wchar_t *GetGameRulesString(const std::wstring &key); + std::vector* getLevelGenerators() { + return m_levelGenerators.getLevelGenerators(); + } + void setLevelGenerationOptions(LevelGenerationOptions* levelGen); + LevelRuleset* getGameRuleDefinitions() { + return m_currentGameRuleDefinitions; + } + LevelGenerationOptions* getLevelGenerationOptions() { + return m_currentLevelGenerationOptions; + } + const wchar_t* GetGameRulesString(const std::wstring& key); - // 4J-JEV: - // Properly cleans-up and unloads the current set of gameRules. - void unloadCurrentGameRules(); + // 4J-JEV: + // Properly cleans-up and unloads the current set of gameRules. + void unloadCurrentGameRules(); }; diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRulesInstance.h b/Minecraft.Client/Platform/Common/GameRules/GameRulesInstance.h index c2c79547c..93f3e28cd 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRulesInstance.h +++ b/Minecraft.Client/Platform/Common/GameRules/GameRulesInstance.h @@ -1,24 +1,24 @@ #pragma once -//using namespace std; +// using namespace std; #include #include "GameRule.h" class GameRuleDefinition; -// The game rule manager belongs to a player/server or other object, and maintains their current state for each of -// the rules that apply to them -class GameRulesInstance : public GameRule -{ +// The game rule manager belongs to a player/server or other object, and +// maintains their current state for each of the rules that apply to them +class GameRulesInstance : public GameRule { public: - // These types are used by the GameRuleDefinition to know which rules to add to this GameRulesInstance - enum EGameRulesInstanceType - { - eGameRulesInstanceType_ServerPlayer, - eGameRulesInstanceType_Server, - eGameRulesInstanceType_Count - }; + // These types are used by the GameRuleDefinition to know which rules to add + // to this GameRulesInstance + enum EGameRulesInstanceType { + eGameRulesInstanceType_ServerPlayer, + eGameRulesInstanceType_Server, + eGameRulesInstanceType_Count + }; public: - GameRulesInstance(GameRuleDefinition *definition, Connection *connection) : GameRule(definition,connection) {} - // Functions for all the hooks should go here + GameRulesInstance(GameRuleDefinition* definition, Connection* connection) + : GameRule(definition, connection) {} + // Functions for all the hooks should go here }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp index c3875f134..8e2260a11 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp @@ -11,465 +11,649 @@ #include "LevelGenerationOptions.h" #include "ConsoleGameRules.h" -JustGrSource::JustGrSource() -{ - m_displayName = L"Default_DisplayName"; - m_worldName= L"Default_WorldName"; - m_defaultSaveName = L"Default_DefaultSaveName"; - m_bRequiresTexturePack = false; - m_requiredTexturePackId = 0; - m_grfPath = L"__NO_GRF_PATH__"; - m_bRequiresBaseSave = false; +JustGrSource::JustGrSource() { + m_displayName = L"Default_DisplayName"; + m_worldName = L"Default_WorldName"; + m_defaultSaveName = L"Default_DefaultSaveName"; + m_bRequiresTexturePack = false; + m_requiredTexturePackId = 0; + m_grfPath = L"__NO_GRF_PATH__"; + m_bRequiresBaseSave = false; } -bool JustGrSource::requiresTexturePack() {return m_bRequiresTexturePack;} -std::uint32_t JustGrSource::getRequiredTexturePackId() {return m_requiredTexturePackId;} -std::wstring JustGrSource::getDefaultSaveName() {return m_defaultSaveName;} -const wchar_t *JustGrSource::getWorldName() {return m_worldName.c_str();} -const wchar_t *JustGrSource::getDisplayName() {return m_displayName.c_str();} -std::wstring JustGrSource::getGrfPath() {return m_grfPath;} +bool JustGrSource::requiresTexturePack() { return m_bRequiresTexturePack; } +std::uint32_t JustGrSource::getRequiredTexturePackId() { + return m_requiredTexturePackId; +} +std::wstring JustGrSource::getDefaultSaveName() { return m_defaultSaveName; } +const wchar_t* JustGrSource::getWorldName() { return m_worldName.c_str(); } +const wchar_t* JustGrSource::getDisplayName() { return m_displayName.c_str(); } +std::wstring JustGrSource::getGrfPath() { return m_grfPath; } bool JustGrSource::requiresBaseSave() { return m_bRequiresBaseSave; }; std::wstring JustGrSource::getBaseSavePath() { return m_baseSavePath; }; -void JustGrSource::setRequiresTexturePack(bool x) {m_bRequiresTexturePack = x;} -void JustGrSource::setRequiredTexturePackId(std::uint32_t x) {m_requiredTexturePackId = x;} -void JustGrSource::setDefaultSaveName(const std::wstring &x) {m_defaultSaveName = x;} -void JustGrSource::setWorldName(const std::wstring &x) {m_worldName = x;} -void JustGrSource::setDisplayName(const std::wstring &x) {m_displayName = x;} -void JustGrSource::setGrfPath(const std::wstring &x) {m_grfPath = x;} -void JustGrSource::setBaseSavePath(const std::wstring &x) { m_baseSavePath = x; m_bRequiresBaseSave = true; } +void JustGrSource::setRequiresTexturePack(bool x) { + m_bRequiresTexturePack = x; +} +void JustGrSource::setRequiredTexturePackId(std::uint32_t x) { + m_requiredTexturePackId = x; +} +void JustGrSource::setDefaultSaveName(const std::wstring& x) { + m_defaultSaveName = x; +} +void JustGrSource::setWorldName(const std::wstring& x) { m_worldName = x; } +void JustGrSource::setDisplayName(const std::wstring& x) { m_displayName = x; } +void JustGrSource::setGrfPath(const std::wstring& x) { m_grfPath = x; } +void JustGrSource::setBaseSavePath(const std::wstring& x) { + m_baseSavePath = x; + m_bRequiresBaseSave = true; +} bool JustGrSource::ready() { return true; } -LevelGenerationOptions::LevelGenerationOptions() -{ - m_spawnPos = NULL; - m_stringTable = NULL; +LevelGenerationOptions::LevelGenerationOptions(DLCPack* parentPack) { + m_spawnPos = NULL; + m_stringTable = NULL; - m_hasLoadedData = false; + m_hasLoadedData = false; - m_seed = 0; - m_useFlatWorld = false; - m_bHaveMinY = false; - m_minY = INT_MAX; - m_bRequiresGameRules = false; + m_seed = 0; + m_bHasBeenInCreative = true; + m_useFlatWorld = false; + m_bHaveMinY = false; + m_minY = INT_MAX; + m_bRequiresGameRules = false; - m_pbBaseSaveData = NULL; - m_baseSaveSize = 0; + m_pbBaseSaveData = NULL; + m_baseSaveSize = 0; + + m_parentDLCPack = parentPack; + m_bLoadingData = false; } -LevelGenerationOptions::~LevelGenerationOptions() -{ - clearSchematics(); - if(m_spawnPos != NULL) delete m_spawnPos; - for(AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); ++it) - { - delete *it; - } - for(AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); ++it) - { - delete *it; - } - - for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it) - { - delete *it; - } - - for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it) - { - delete *it; - } - - if (m_stringTable) - if (!isTutorial()) - delete m_stringTable; +LevelGenerationOptions::~LevelGenerationOptions() { + clearSchematics(); + if (m_spawnPos != NULL) delete m_spawnPos; + for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); + ++it) { + delete *it; + } + for (AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); + ++it) { + delete *it; + } - if (isFromSave()) delete m_pSrc; + for (AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); + ++it) { + delete *it; + } + + for (AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it) { + delete *it; + } + + if (m_stringTable) + if (!isTutorial()) delete m_stringTable; + + if (isFromSave()) delete m_pSrc; } -ConsoleGameRules::EGameRuleType LevelGenerationOptions::getActionType() { return ConsoleGameRules::eGameRuleType_LevelGenerationOptions; } - -void LevelGenerationOptions::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) -{ - GameRuleDefinition::writeAttributes(dos, numAttrs + 5); - - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX); - dos->writeUTF(_toString(m_spawnPos->x)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnY); - dos->writeUTF(_toString(m_spawnPos->y)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnZ); - dos->writeUTF(_toString(m_spawnPos->z)); - - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_seed); - dos->writeUTF(_toString(m_seed)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_flatworld); - dos->writeUTF(_toString(m_useFlatWorld)); +ConsoleGameRules::EGameRuleType LevelGenerationOptions::getActionType() { + return ConsoleGameRules::eGameRuleType_LevelGenerationOptions; } -void LevelGenerationOptions::getChildren(std::vector *children) -{ - GameRuleDefinition::getChildren(children); - - std::vector used_schematics; - for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); it++) - if ( !(*it)->isComplete() ) - used_schematics.push_back( *it ); - - for(AUTO_VAR(it, m_structureRules.begin()); it!=m_structureRules.end(); it++) - children->push_back( *it ); - for(AUTO_VAR(it, used_schematics.begin()); it!=used_schematics.end(); it++) - children->push_back( *it ); - for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it) - children->push_back( *it ); - for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it) - children->push_back( *it ); +void LevelGenerationOptions::writeAttributes(DataOutputStream* dos, + unsigned int numAttrs) { + GameRuleDefinition::writeAttributes(dos, numAttrs + 5); + + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX); + dos->writeUTF(_toString(m_spawnPos->x)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnY); + dos->writeUTF(_toString(m_spawnPos->y)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnZ); + dos->writeUTF(_toString(m_spawnPos->z)); + + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_seed); + dos->writeUTF(_toString(m_seed)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_flatworld); + dos->writeUTF(_toString(m_useFlatWorld)); } -GameRuleDefinition *LevelGenerationOptions::addChild(ConsoleGameRules::EGameRuleType ruleType) -{ - GameRuleDefinition *rule = NULL; - if(ruleType == ConsoleGameRules::eGameRuleType_ApplySchematic) - { - rule = new ApplySchematicRuleDefinition(this); - m_schematicRules.push_back((ApplySchematicRuleDefinition *)rule); - } - else if(ruleType == ConsoleGameRules::eGameRuleType_GenerateStructure) - { - rule = new ConsoleGenerateStructure(); - m_structureRules.push_back((ConsoleGenerateStructure *)rule); - } - else if(ruleType == ConsoleGameRules::eGameRuleType_BiomeOverride) - { - rule = new BiomeOverride(); - m_biomeOverrides.push_back((BiomeOverride *)rule); - } - else if(ruleType == ConsoleGameRules::eGameRuleType_StartFeature) - { - rule = new StartFeature(); - m_features.push_back((StartFeature *)rule); - } - else - { +void LevelGenerationOptions::getChildren( + std::vector* children) { + GameRuleDefinition::getChildren(children); + + std::vector used_schematics; + for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); + it++) + if (!(*it)->isComplete()) used_schematics.push_back(*it); + + for (AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); + it++) + children->push_back(*it); + for (AUTO_VAR(it, used_schematics.begin()); it != used_schematics.end(); + it++) + children->push_back(*it); + for (AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); + ++it) + children->push_back(*it); + for (AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it) + children->push_back(*it); +} + +GameRuleDefinition* LevelGenerationOptions::addChild( + ConsoleGameRules::EGameRuleType ruleType) { + GameRuleDefinition* rule = NULL; + if (ruleType == ConsoleGameRules::eGameRuleType_ApplySchematic) { + rule = new ApplySchematicRuleDefinition(this); + m_schematicRules.push_back((ApplySchematicRuleDefinition*)rule); + } else if (ruleType == ConsoleGameRules::eGameRuleType_GenerateStructure) { + rule = new ConsoleGenerateStructure(); + m_structureRules.push_back((ConsoleGenerateStructure*)rule); + } else if (ruleType == ConsoleGameRules::eGameRuleType_BiomeOverride) { + rule = new BiomeOverride(); + m_biomeOverrides.push_back((BiomeOverride*)rule); + } else if (ruleType == ConsoleGameRules::eGameRuleType_StartFeature) { + rule = new StartFeature(); + m_features.push_back((StartFeature*)rule); + } else { #ifndef _CONTENT_PACKAGE - wprintf(L"LevelGenerationOptions: Attempted to add invalid child rule - %d\n", ruleType ); + wprintf( + L"LevelGenerationOptions: Attempted to add invalid child rule - " + L"%d\n", + ruleType); #endif - } - return rule; + } + return rule; } -void LevelGenerationOptions::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) -{ - if(attributeName.compare(L"seed") == 0) - { - m_seed = _fromString<__int64>(attributeValue); - app.DebugPrintf("LevelGenerationOptions: Adding parameter m_seed=%I64d\n",m_seed); - } - else if(attributeName.compare(L"spawnX") == 0) - { - if(m_spawnPos == NULL) m_spawnPos = new Pos(); - int value = _fromString(attributeValue); - m_spawnPos->x = value; - app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnX=%d\n",value); - } - else if(attributeName.compare(L"spawnY") == 0) - { - if(m_spawnPos == NULL) m_spawnPos = new Pos(); - int value = _fromString(attributeValue); - m_spawnPos->y = value; - app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnY=%d\n",value); - } - else if(attributeName.compare(L"spawnZ") == 0) - { - if(m_spawnPos == NULL) m_spawnPos = new Pos(); - int value = _fromString(attributeValue); - m_spawnPos->z = value; - app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnZ=%d\n",value); - } - else if(attributeName.compare(L"flatworld") == 0) - { - if(attributeValue.compare(L"true") == 0) m_useFlatWorld = true; - app.DebugPrintf("LevelGenerationOptions: Adding parameter flatworld=%s\n",m_useFlatWorld?"TRUE":"FALSE"); - } - else if(attributeName.compare(L"saveName") == 0) - { - std::wstring string(getString(attributeValue)); - if(!string.empty()) setDefaultSaveName( string ); - else setDefaultSaveName( attributeValue ); - app.DebugPrintf("LevelGenerationOptions: Adding parameter saveName=%ls\n", getDefaultSaveName().c_str()); - } - else if(attributeName.compare(L"worldName") == 0) - { - std::wstring string(getString(attributeValue)); - if(!string.empty()) setWorldName( string ); - else setWorldName( attributeValue ); - app.DebugPrintf("LevelGenerationOptions: Adding parameter worldName=%ls\n", getWorldName()); - } - else if(attributeName.compare(L"displayName") == 0) - { - std::wstring string(getString(attributeValue)); - if(!string.empty()) setDisplayName( string ); - else setDisplayName( attributeValue ); - app.DebugPrintf("LevelGenerationOptions: Adding parameter displayName=%ls\n", getDisplayName()); - } - else if(attributeName.compare(L"texturePackId") == 0) - { - setRequiredTexturePackId( _fromString(attributeValue) ); - setRequiresTexturePack( true ); - app.DebugPrintf("LevelGenerationOptions: Adding parameter texturePackId=%0x\n", getRequiredTexturePackId()); - } - else if(attributeName.compare(L"isTutorial") == 0) - { - if(attributeValue.compare(L"true") == 0) setSrc(eSrc_tutorial); - app.DebugPrintf("LevelGenerationOptions: Adding parameter isTutorial=%s\n",isTutorial()?"TRUE":"FALSE"); - } - else if(attributeName.compare(L"baseSaveName") == 0) - { - setBaseSavePath( attributeValue ); - app.DebugPrintf("LevelGenerationOptions: Adding parameter baseSaveName=%ls\n", getBaseSavePath().c_str()); - } - else - { - GameRuleDefinition::addAttribute(attributeName, attributeValue); - } +void LevelGenerationOptions::addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue) { + if (attributeName.compare(L"seed") == 0) { + m_seed = _fromString<__int64>(attributeValue); + app.DebugPrintf( + "LevelGenerationOptions: Adding parameter m_seed=%I64d\n", m_seed); + } else if (attributeName.compare(L"spawnX") == 0) { + if (m_spawnPos == NULL) m_spawnPos = new Pos(); + int value = _fromString(attributeValue); + m_spawnPos->x = value; + app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnX=%d\n", + value); + } else if (attributeName.compare(L"spawnY") == 0) { + if (m_spawnPos == NULL) m_spawnPos = new Pos(); + int value = _fromString(attributeValue); + m_spawnPos->y = value; + app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnY=%d\n", + value); + } else if (attributeName.compare(L"spawnZ") == 0) { + if (m_spawnPos == NULL) m_spawnPos = new Pos(); + int value = _fromString(attributeValue); + m_spawnPos->z = value; + app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnZ=%d\n", + value); + } else if (attributeName.compare(L"flatworld") == 0) { + if (attributeValue.compare(L"true") == 0) m_useFlatWorld = true; + app.DebugPrintf( + "LevelGenerationOptions: Adding parameter flatworld=%s\n", + m_useFlatWorld ? "TRUE" : "FALSE"); + } else if (attributeName.compare(L"saveName") == 0) { + std::wstring string(getString(attributeValue)); + if (!string.empty()) + setDefaultSaveName(string); + else + setDefaultSaveName(attributeValue); + app.DebugPrintf( + "LevelGenerationOptions: Adding parameter saveName=%ls\n", + getDefaultSaveName().c_str()); + } else if (attributeName.compare(L"worldName") == 0) { + std::wstring string(getString(attributeValue)); + if (!string.empty()) + setWorldName(string); + else + setWorldName(attributeValue); + app.DebugPrintf( + "LevelGenerationOptions: Adding parameter worldName=%ls\n", + getWorldName()); + } else if (attributeName.compare(L"displayName") == 0) { + std::wstring string(getString(attributeValue)); + if (!string.empty()) + setDisplayName(string); + else + setDisplayName(attributeValue); + app.DebugPrintf( + "LevelGenerationOptions: Adding parameter displayName=%ls\n", + getDisplayName()); + } else if (attributeName.compare(L"texturePackId") == 0) { + setRequiredTexturePackId(_fromString(attributeValue)); + setRequiresTexturePack(true); + app.DebugPrintf( + "LevelGenerationOptions: Adding parameter texturePackId=%0x\n", + getRequiredTexturePackId()); + } else if (attributeName.compare(L"isTutorial") == 0) { + if (attributeValue.compare(L"true") == 0) setSrc(eSrc_tutorial); + app.DebugPrintf( + "LevelGenerationOptions: Adding parameter isTutorial=%s\n", + isTutorial() ? "TRUE" : "FALSE"); + } else if (attributeName.compare(L"baseSaveName") == 0) { + setBaseSavePath(attributeValue); + app.DebugPrintf( + "LevelGenerationOptions: Adding parameter baseSaveName=%ls\n", + getBaseSavePath().c_str()); + } else if (attributeName.compare(L"hasBeenInCreative") == 0) { + bool value = _fromString(attributeValue); + m_bHasBeenInCreative = value; + app.DebugPrintf( + "LevelGenerationOptions: Adding parameter gameMode=%d\n", + m_bHasBeenInCreative); + } else { + GameRuleDefinition::addAttribute(attributeName, attributeValue); + } } -void LevelGenerationOptions::processSchematics(LevelChunk *chunk) -{ - PIXBeginNamedEvent(0,"Processing schematics for chunk (%d,%d)", chunk->x, chunk->z); - AABB *chunkBox = AABB::newTemp(chunk->x*16,0,chunk->z*16,chunk->x*16 + 16,Level::maxBuildHeight,chunk->z*16 + 16); - for( AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it) - { - ApplySchematicRuleDefinition *rule = *it; - rule->processSchematic(chunkBox, chunk); - } +void LevelGenerationOptions::processSchematics(LevelChunk* chunk) { + PIXBeginNamedEvent(0, "Processing schematics for chunk (%d,%d)", chunk->x, + chunk->z); + AABB* chunkBox = + AABB::newTemp(chunk->x * 16, 0, chunk->z * 16, chunk->x * 16 + 16, + Level::maxBuildHeight, chunk->z * 16 + 16); + for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); + ++it) { + ApplySchematicRuleDefinition* rule = *it; + rule->processSchematic(chunkBox, chunk); + } - // 4jcraft added cast to unsigned - int cx = ((unsigned)chunk->x << 4); - int cz = ((unsigned)chunk->z << 4); + int cx = (chunk->x << 4); + int cz = (chunk->z << 4); - for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ ) - { - ConsoleGenerateStructure *structureStart = *it; + for (AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); + it++) { + ConsoleGenerateStructure* structureStart = *it; - if (structureStart->getBoundingBox()->intersects(cx, cz, cx + 15, cz + 15)) - { - BoundingBox *bb = new BoundingBox(cx, cz, cx + 15, cz + 15); - structureStart->postProcess(chunk->level, NULL, bb); - delete bb; - } - } - PIXEndNamedEvent(); + if (structureStart->getBoundingBox()->intersects(cx, cz, cx + 15, + cz + 15)) { + BoundingBox* bb = new BoundingBox(cx, cz, cx + 15, cz + 15); + structureStart->postProcess(chunk->level, NULL, bb); + delete bb; + } + } + PIXEndNamedEvent(); } -void LevelGenerationOptions::processSchematicsLighting(LevelChunk *chunk) -{ - PIXBeginNamedEvent(0,"Processing schematics (lighting) for chunk (%d,%d)", chunk->x, chunk->z); - AABB *chunkBox = AABB::newTemp(chunk->x*16,0,chunk->z*16,chunk->x*16 + 16,Level::maxBuildHeight,chunk->z*16 + 16); - for( AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it) - { - ApplySchematicRuleDefinition *rule = *it; - rule->processSchematicLighting(chunkBox, chunk); - } - PIXEndNamedEvent(); +void LevelGenerationOptions::processSchematicsLighting(LevelChunk* chunk) { + PIXBeginNamedEvent(0, "Processing schematics (lighting) for chunk (%d,%d)", + chunk->x, chunk->z); + AABB* chunkBox = + AABB::newTemp(chunk->x * 16, 0, chunk->z * 16, chunk->x * 16 + 16, + Level::maxBuildHeight, chunk->z * 16 + 16); + for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); + ++it) { + ApplySchematicRuleDefinition* rule = *it; + rule->processSchematicLighting(chunkBox, chunk); + } + PIXEndNamedEvent(); } -bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1) -{ - PIXBeginNamedEvent(0,"Check Intersects"); +bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, + int y1, int z1) { + PIXBeginNamedEvent(0, "Check Intersects"); - // As an optimisation, we can quickly discard things below a certain y which makes most ore checks faster due to - // a) ores generally being below ground/sea level and b) tutorial world additions generally being above ground/sea level - if(!m_bHaveMinY) - { - for(AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it) - { - ApplySchematicRuleDefinition *rule = *it; - int minY = rule->getMinY(); - if(minY < m_minY) m_minY = minY; - } + // As an optimisation, we can quickly discard things below a certain y which + // makes most ore checks faster due to a) ores generally being below + // ground/sea level and b) tutorial world additions generally being above + // ground/sea level + if (!m_bHaveMinY) { + for (AUTO_VAR(it, m_schematicRules.begin()); + it != m_schematicRules.end(); ++it) { + ApplySchematicRuleDefinition* rule = *it; + int minY = rule->getMinY(); + if (minY < m_minY) m_minY = minY; + } - for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ ) - { - ConsoleGenerateStructure *structureStart = *it; - int minY = structureStart->getMinY(); - if(minY < m_minY) m_minY = minY; - } + for (AUTO_VAR(it, m_structureRules.begin()); + it != m_structureRules.end(); it++) { + ConsoleGenerateStructure* structureStart = *it; + int minY = structureStart->getMinY(); + if (minY < m_minY) m_minY = minY; + } - m_bHaveMinY = true; - } - - // 4J Stu - We DO NOT intersect if our upper bound is below the lower bound for all schematics - if( y1 < m_minY ) return false; + m_bHaveMinY = true; + } - bool intersects = false; - for(AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it) - { - ApplySchematicRuleDefinition *rule = *it; - intersects = rule->checkIntersects(x0,y0,z0,x1,y1,z1); - if(intersects) break; - } + // 4J Stu - We DO NOT intersect if our upper bound is below the lower bound + // for all schematics + if (y1 < m_minY) return false; - if(!intersects) - { - for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ ) - { - ConsoleGenerateStructure *structureStart = *it; - intersects = structureStart->checkIntersects(x0,y0,z0,x1,y1,z1); - if(intersects) break; - } - } - PIXEndNamedEvent(); - return intersects; + bool intersects = false; + for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); + ++it) { + ApplySchematicRuleDefinition* rule = *it; + intersects = rule->checkIntersects(x0, y0, z0, x1, y1, z1); + if (intersects) break; + } + + if (!intersects) { + for (AUTO_VAR(it, m_structureRules.begin()); + it != m_structureRules.end(); it++) { + ConsoleGenerateStructure* structureStart = *it; + intersects = + structureStart->checkIntersects(x0, y0, z0, x1, y1, z1); + if (intersects) break; + } + } + PIXEndNamedEvent(); + return intersects; } -void LevelGenerationOptions::clearSchematics() -{ - for(AUTO_VAR(it, m_schematics.begin()); it != m_schematics.end(); ++it) - { - delete it->second; - } - m_schematics.clear(); +void LevelGenerationOptions::clearSchematics() { + for (AUTO_VAR(it, m_schematics.begin()); it != m_schematics.end(); ++it) { + delete it->second; + } + m_schematics.clear(); } -ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const std::wstring &filename, std::uint8_t *pbData, unsigned int dataLength) -{ - // If we have already loaded this, just return - AUTO_VAR(it, m_schematics.find(filename)); - if(it != m_schematics.end()) - { +ConsoleSchematicFile* LevelGenerationOptions::loadSchematicFile( + const std::wstring& filename, std::uint8_t* pbData, + unsigned int dataLength) { + // If we have already loaded this, just return + AUTO_VAR(it, m_schematics.find(filename)); + if (it != m_schematics.end()) { #ifndef _CONTENT_PACKAGE - wprintf(L"We have already loaded schematic file %ls\n", filename.c_str() ); + wprintf(L"We have already loaded schematic file %ls\n", + filename.c_str()); #endif - it->second->incrementRefCount(); - return it->second; - } + it->second->incrementRefCount(); + return it->second; + } - ConsoleSchematicFile *schematic = NULL; - byteArray data(pbData, dataLength); - ByteArrayInputStream bais(data); - DataInputStream dis(&bais); - schematic = new ConsoleSchematicFile(); - schematic->load(&dis); - m_schematics[filename] = schematic; - bais.reset(); - return schematic; + ConsoleSchematicFile* schematic = NULL; + byteArray data(pbData, dataLength); + ByteArrayInputStream bais(data); + DataInputStream dis(&bais); + schematic = new ConsoleSchematicFile(); + schematic->load(&dis); + m_schematics[filename] = schematic; + bais.reset(); + return schematic; } -ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const std::wstring &filename) -{ - ConsoleSchematicFile *schematic = NULL; - // If we have already loaded this, just return - AUTO_VAR(it, m_schematics.find(filename)); - if(it != m_schematics.end()) - { - schematic = it->second; - } - return schematic; +ConsoleSchematicFile* LevelGenerationOptions::getSchematicFile( + const std::wstring& filename) { + ConsoleSchematicFile* schematic = NULL; + // If we have already loaded this, just return + AUTO_VAR(it, m_schematics.find(filename)); + if (it != m_schematics.end()) { + schematic = it->second; + } + return schematic; } -void LevelGenerationOptions::releaseSchematicFile(const std::wstring &filename) -{ - // 4J Stu - We don't want to delete them when done, but probably want to keep a set of active schematics for the current world - //AUTO_VAR(it, m_schematics.find(filename)); - //if(it != m_schematics.end()) - //{ - // ConsoleSchematicFile *schematic = it->second; - // schematic->decrementRefCount(); - // if(schematic->shouldDelete()) - // { - // delete schematic; - // m_schematics.erase(it); - // } - //} +void LevelGenerationOptions::releaseSchematicFile( + const std::wstring& filename) { + // 4J Stu - We don't want to delete them when done, but probably want to + // keep a set of active schematics for the current world + // AUTO_VAR(it, m_schematics.find(filename)); + // if(it != m_schematics.end()) + //{ + // ConsoleSchematicFile *schematic = it->second; + // schematic->decrementRefCount(); + // if(schematic->shouldDelete()) + // { + // delete schematic; + // m_schematics.erase(it); + // } + //} } -void LevelGenerationOptions::loadStringTable(StringTable *table) -{ - m_stringTable = table; +void LevelGenerationOptions::loadStringTable(StringTable* table) { + m_stringTable = table; } -const wchar_t *LevelGenerationOptions::getString(const std::wstring &key) -{ - if(m_stringTable == NULL) - { - return L""; - } - else - { - return m_stringTable->getString(key); - } +const wchar_t* LevelGenerationOptions::getString(const std::wstring& key) { + if (m_stringTable == NULL) { + return L""; + } else { + return m_stringTable->getString(key); + } } -void LevelGenerationOptions::getBiomeOverride(int biomeId, std::uint8_t &tile, std::uint8_t &topTile) -{ - for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it) - { - BiomeOverride *bo = *it; - if(bo->isBiome(biomeId)) - { - bo->getTileValues(tile,topTile); - break; - } - } +void LevelGenerationOptions::getBiomeOverride(int biomeId, std::uint8_t& tile, + std::uint8_t& topTile) { + for (AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); + ++it) { + BiomeOverride* bo = *it; + if (bo->isBiome(biomeId)) { + bo->getTileValues(tile, topTile); + break; + } + } } -bool LevelGenerationOptions::isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature) -{ - bool isFeature = false; +bool LevelGenerationOptions::isFeatureChunk( + int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, + int* orientation) { + bool isFeature = false; - for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it) - { - StartFeature *sf = *it; - if(sf->isFeatureChunk(chunkX, chunkZ, feature)) - { - isFeature = true; - break; - } - } - return isFeature; + for (AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it) { + StartFeature* sf = *it; + if (sf->isFeatureChunk(chunkX, chunkZ, feature, orientation)) { + isFeature = true; + break; + } + } + return isFeature; } -std::unordered_map *LevelGenerationOptions::getUnfinishedSchematicFiles() -{ - // Clean schematic rules. - std::unordered_set usedFiles = std::unordered_set(); - for (AUTO_VAR(it, m_schematicRules.begin()); it!=m_schematicRules.end(); it++) - if ( !(*it)->isComplete() ) - usedFiles.insert( (*it)->getSchematicName() ); +std::unordered_map* +LevelGenerationOptions::getUnfinishedSchematicFiles() { + // Clean schematic rules. + std::unordered_set usedFiles = + std::unordered_set(); + for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); + it++) + if (!(*it)->isComplete()) usedFiles.insert((*it)->getSchematicName()); - // Clean schematic files. - std::unordered_map *out - = new std::unordered_map(); - for (AUTO_VAR(it, usedFiles.begin()); it!=usedFiles.end(); it++) - out->insert( std::pair(*it, getSchematicFile(*it)) ); - - return out; + // Clean schematic files. + std::unordered_map* out = + new std::unordered_map(); + for (AUTO_VAR(it, usedFiles.begin()); it != usedFiles.end(); it++) + out->insert(std::pair( + *it, getSchematicFile(*it))); + + return out; } -void LevelGenerationOptions::reset_start() -{ - for ( AUTO_VAR( it, m_schematicRules.begin()); - it != m_schematicRules.end(); - it++ ) - { - (*it)->reset(); - } +void LevelGenerationOptions::loadBaseSaveData() { + int mountIndex = -1; + if (m_parentDLCPack != NULL) + mountIndex = m_parentDLCPack->GetDLCMountIndex(); + + if (mountIndex > -1) { +#ifdef _DURANGO + if (StorageManager.MountInstalledDLC( + ProfileManager.GetPrimaryPad(), mountIndex, + &LevelGenerationOptions::packMounted, this, + L"WPACK") != ERROR_IO_PENDING) +#else + if (StorageManager.MountInstalledDLC( + ProfileManager.GetPrimaryPad(), mountIndex, + &LevelGenerationOptions::packMounted, this, + "WPACK") != ERROR_IO_PENDING) +#endif + { + // corrupt DLC + setLoadedData(); + app.DebugPrintf("Failed to mount LGO DLC %d for pad %d\n", + mountIndex, ProfileManager.GetPrimaryPad()); + } else { + m_bLoadingData = true; + app.DebugPrintf("Attempted to mount DLC data for LGO %d\n", + mountIndex); + } + } else { + setLoadedData(); + app.SetAction(ProfileManager.GetPrimaryPad(), + eAppAction_ReloadTexturePack); + } } -void LevelGenerationOptions::reset_finish() -{ - //if (m_spawnPos) { delete m_spawnPos; m_spawnPos = NULL; } - //if (m_stringTable) { delete m_stringTable; m_stringTable = NULL; } +int LevelGenerationOptions::packMounted(LPVOID pParam, int iPad, DWORD dwErr, + DWORD dwLicenceMask) { + LevelGenerationOptions* lgo = (LevelGenerationOptions*)pParam; + lgo->m_bLoadingData = false; + if (dwErr != ERROR_SUCCESS) { + // corrupt DLC + app.DebugPrintf("Failed to mount LGO DLC for pad %d: %d\n", iPad, + dwErr); + } else { + app.DebugPrintf("Mounted DLC for LGO, attempting to load data\n"); + DWORD dwFilesProcessed = 0; + 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); - if (isFromDLC()) - { - m_hasLoadedData = false; - } + if (!dlcFile->getGrfPath().empty()) { + File grf(app.getFilePath(lgo->m_parentDLCPack->GetPackID(), + dlcFile->getGrfPath(), true, + L"WPACK:")); + if (grf.exists()) { +#ifdef _UNICODE + std::wstring path = grf.getPath(); + const WCHAR* pchFilename = path.c_str(); + HANDLE fileHandle = CreateFile( + pchFilename, // file name + GENERIC_READ, // access mode + 0, // share mode // TODO 4J Stu - Will we need to share + // file? Probably not but... + NULL, // Unused + OPEN_EXISTING, // how to create // TODO 4J Stu - + // Assuming that the file already exists + // if we are opening to read from it + FILE_FLAG_SEQUENTIAL_SCAN, // file attributes + NULL // Unsupported + ); +#else + const char* pchFilename = wstringtofilename(grf.getPath()); + HANDLE fileHandle = CreateFile( + pchFilename, // file name + GENERIC_READ, // access mode + 0, // share mode // TODO 4J Stu - Will we need to share + // file? Probably not but... + NULL, // Unused + OPEN_EXISTING, // how to create // TODO 4J Stu - + // Assuming that the file already exists + // if we are opening to read from it + FILE_FLAG_SEQUENTIAL_SCAN, // file attributes + NULL // Unsupported + ); +#endif + + if (fileHandle != INVALID_HANDLE_VALUE) { + DWORD dwFileSize = grf.length(); + DWORD bytesRead; + PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; + BOOL bSuccess = ReadFile(fileHandle, pbData, dwFileSize, + &bytesRead, NULL); + if (bSuccess == FALSE) { + app.FatalLoadError(); + } + CloseHandle(fileHandle); + + // 4J-PB - is it possible that we can get here after a + // read fail and it's not an error? + dlcFile->setGrfData(pbData, dwFileSize, + lgo->m_stringTable); + + delete[] pbData; + + app.m_gameRules.setLevelGenerationOptions(dlcFile->lgo); + } + } + } + } + if (lgo->requiresBaseSave() && !lgo->getBaseSavePath().empty()) { + File save(app.getFilePath(lgo->m_parentDLCPack->GetPackID(), + lgo->getBaseSavePath(), true, L"WPACK:")); + if (save.exists()) { +#ifdef _UNICODE + std::wstring path = save.getPath(); + const WCHAR* pchFilename = path.c_str(); + HANDLE fileHandle = CreateFile( + pchFilename, // file name + GENERIC_READ, // access mode + 0, // share mode // TODO 4J Stu - Will we need to share + // file? Probably not but... + NULL, // Unused + OPEN_EXISTING, // how to create // TODO 4J Stu - Assuming + // that the file already exists if we are + // opening to read from it + FILE_FLAG_SEQUENTIAL_SCAN, // file attributes + NULL // Unsupported + ); +#else + const char* pchFilename = wstringtofilename(save.getPath()); + HANDLE fileHandle = CreateFile( + pchFilename, // file name + GENERIC_READ, // access mode + 0, // share mode // TODO 4J Stu - Will we need to share + // file? Probably not but... + NULL, // Unused + OPEN_EXISTING, // how to create // TODO 4J Stu - Assuming + // that the file already exists if we are + // opening to read from it + FILE_FLAG_SEQUENTIAL_SCAN, // file attributes + NULL // Unsupported + ); +#endif + + if (fileHandle != INVALID_HANDLE_VALUE) { + DWORD bytesRead, dwFileSize = GetFileSize(fileHandle, NULL); + PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; + BOOL bSuccess = ReadFile(fileHandle, pbData, dwFileSize, + &bytesRead, NULL); + if (bSuccess == FALSE) { + app.FatalLoadError(); + } + CloseHandle(fileHandle); + + // 4J-PB - is it possible that we can get here after a read + // fail and it's not an error? + lgo->setBaseSaveData(pbData, dwFileSize); + } + } + } +#ifdef _DURANGO + DWORD result = StorageManager.UnmountInstalledDLC(L"WPACK"); +#else + DWORD result = StorageManager.UnmountInstalledDLC("WPACK"); +#endif + } + + lgo->setLoadedData(); + + return 0; } +void LevelGenerationOptions::reset_start() { + for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); + it++) { + (*it)->reset(); + } +} -GrSource *LevelGenerationOptions::info() { return m_pSrc; } +void LevelGenerationOptions::reset_finish() { + // if (m_spawnPos) { delete m_spawnPos; m_spawnPos + // = NULL; } if (m_stringTable) { delete m_stringTable; + // m_stringTable = NULL; } + + if (isFromDLC()) { + m_hasLoadedData = false; + } +} + +GrSource* LevelGenerationOptions::info() { return m_pSrc; } void LevelGenerationOptions::setSrc(eSrc src) { m_src = src; } LevelGenerationOptions::eSrc LevelGenerationOptions::getSrc() { return m_src; } @@ -477,39 +661,122 @@ bool LevelGenerationOptions::isTutorial() { return getSrc() == eSrc_tutorial; } bool LevelGenerationOptions::isFromSave() { return getSrc() == eSrc_fromSave; } bool LevelGenerationOptions::isFromDLC() { return getSrc() == eSrc_fromDLC; } -bool LevelGenerationOptions::requiresTexturePack() { return info()->requiresTexturePack(); } -std::uint32_t LevelGenerationOptions::getRequiredTexturePackId() { return info()->getRequiredTexturePackId(); } -std::wstring LevelGenerationOptions::getDefaultSaveName() { return info()->getDefaultSaveName(); } -const wchar_t *LevelGenerationOptions::getWorldName() { return info()->getWorldName(); } -const wchar_t *LevelGenerationOptions::getDisplayName() { return info()->getDisplayName(); } -std::wstring LevelGenerationOptions::getGrfPath() { return info()->getGrfPath(); } -bool LevelGenerationOptions::requiresBaseSave() { return info()->requiresBaseSave(); } -std::wstring LevelGenerationOptions::getBaseSavePath() { return info()->getBaseSavePath(); } +bool LevelGenerationOptions::requiresTexturePack() { + return info()->requiresTexturePack(); +} +std::uint32_t LevelGenerationOptions::getRequiredTexturePackId() { + return info()->getRequiredTexturePackId(); +} +std::wstring LevelGenerationOptions::getDefaultSaveName() { + switch (getSrc()) { + case eSrc_fromSave: + return getString(info()->getDefaultSaveName()); + case eSrc_fromDLC: + return getString(info()->getDefaultSaveName()); + case eSrc_tutorial: + return app.GetString(IDS_TUTORIALSAVENAME); + default: + break; + } + return L""; +} +LPCWSTR LevelGenerationOptions::getWorldName() { + switch (getSrc()) { + case eSrc_fromSave: + return getString(info()->getWorldName()); + case eSrc_fromDLC: + return getString(info()->getWorldName()); + case eSrc_tutorial: + return app.GetString(IDS_PLAY_TUTORIAL); + default: + break; + } + return L""; +} +LPCWSTR LevelGenerationOptions::getDisplayName() { + switch (getSrc()) { + case eSrc_fromSave: + return getString(info()->getDisplayName()); + case eSrc_fromDLC: + return getString(info()->getDisplayName()); + case eSrc_tutorial: + return L""; + default: + break; + } + return L""; +} +std::wstring LevelGenerationOptions::getGrfPath() { + return info()->getGrfPath(); +} +bool LevelGenerationOptions::requiresBaseSave() { + return info()->requiresBaseSave(); +} +std::wstring LevelGenerationOptions::getBaseSavePath() { + return info()->getBaseSavePath(); +} -void LevelGenerationOptions::setGrSource(GrSource *grs) { m_pSrc = grs; } +void LevelGenerationOptions::setGrSource(GrSource* grs) { m_pSrc = grs; } -void LevelGenerationOptions::setRequiresTexturePack(bool x) { info()->setRequiresTexturePack(x); } -void LevelGenerationOptions::setRequiredTexturePackId(std::uint32_t x) { info()->setRequiredTexturePackId(x); } -void LevelGenerationOptions::setDefaultSaveName(const std::wstring &x) { info()->setDefaultSaveName(x); } -void LevelGenerationOptions::setWorldName(const std::wstring &x) { info()->setWorldName(x); } -void LevelGenerationOptions::setDisplayName(const std::wstring &x) { info()->setDisplayName(x); } -void LevelGenerationOptions::setGrfPath(const std::wstring &x) { info()->setGrfPath(x); } -void LevelGenerationOptions::setBaseSavePath(const std::wstring &x) { info()->setBaseSavePath(x); } +void LevelGenerationOptions::setRequiresTexturePack(bool x) { + info()->setRequiresTexturePack(x); +} +void LevelGenerationOptions::setRequiredTexturePackId(std::uint32_t x) { + info()->setRequiredTexturePackId(x); +} +void LevelGenerationOptions::setDefaultSaveName(const std::wstring& x) { + info()->setDefaultSaveName(x); +} +void LevelGenerationOptions::setWorldName(const std::wstring& x) { + info()->setWorldName(x); +} +void LevelGenerationOptions::setDisplayName(const std::wstring& x) { + info()->setDisplayName(x); +} +void LevelGenerationOptions::setGrfPath(const std::wstring& x) { + info()->setGrfPath(x); +} +void LevelGenerationOptions::setBaseSavePath(const std::wstring& x) { + info()->setBaseSavePath(x); +} bool LevelGenerationOptions::ready() { return info()->ready(); } -void LevelGenerationOptions::setBaseSaveData(std::uint8_t *pbData, unsigned int dataSize) { m_pbBaseSaveData = pbData; m_baseSaveSize = dataSize; } -std::uint8_t *LevelGenerationOptions::getBaseSaveData(unsigned int &size) { size = m_baseSaveSize; return m_pbBaseSaveData; } -bool LevelGenerationOptions::hasBaseSaveData() { return m_baseSaveSize > 0 && m_pbBaseSaveData != NULL; } -void LevelGenerationOptions::deleteBaseSaveData() { delete[] m_pbBaseSaveData; m_pbBaseSaveData = NULL; m_baseSaveSize = 0; } +void LevelGenerationOptions::setBaseSaveData(std::uint8_t* pbData, + unsigned int dataSize) { + m_pbBaseSaveData = pbData; + m_baseSaveSize = dataSize; +} +std::uint8_t* LevelGenerationOptions::getBaseSaveData(unsigned int& size) { + size = m_baseSaveSize; + return m_pbBaseSaveData; +} +bool LevelGenerationOptions::hasBaseSaveData() { + return m_baseSaveSize > 0 && m_pbBaseSaveData != NULL; +} +void LevelGenerationOptions::deleteBaseSaveData() { + delete[] m_pbBaseSaveData; + m_pbBaseSaveData = NULL; + m_baseSaveSize = 0; +} bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; } void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; } -__int64 LevelGenerationOptions::getLevelSeed() { return m_seed; } -Pos *LevelGenerationOptions::getSpawnPos() { return m_spawnPos; } +int64_t LevelGenerationOptions::getLevelSeed() { return m_seed; } +int LevelGenerationOptions::getLevelHasBeenInCreative() { + return m_bHasBeenInCreative; +} +Pos* LevelGenerationOptions::getSpawnPos() { return m_spawnPos; } bool LevelGenerationOptions::getuseFlatWorld() { return m_useFlatWorld; } -bool LevelGenerationOptions::requiresGameRules() { return m_bRequiresGameRules; } -void LevelGenerationOptions::setRequiredGameRules(LevelRuleset *rules) { m_requiredGameRules = rules; m_bRequiresGameRules = true; } -LevelRuleset *LevelGenerationOptions::getRequiredGameRules() { return m_requiredGameRules; } +bool LevelGenerationOptions::requiresGameRules() { + return m_bRequiresGameRules; +} +void LevelGenerationOptions::setRequiredGameRules(LevelRuleset* rules) { + m_requiredGameRules = rules; + m_bRequiresGameRules = true; +} +LevelRuleset* LevelGenerationOptions::getRequiredGameRules() { + return m_requiredGameRules; +} diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h index 1ba465405..0777d85dd 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h +++ b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.h @@ -1,5 +1,5 @@ #pragma once -//using namespace std; +// using namespace std; // #pragma message("LevelGenerationOptions.h ") @@ -16,204 +16,219 @@ class LevelRuleset; class BiomeOverride; class StartFeature; -class GrSource -{ +class GrSource { public: - // 4J-JEV: - // Moved all this here; I didn't like that all this header information - // was being mixed in with all the game information as they have - // completely different lifespans. + // 4J-JEV: + // Moved all this here; I didn't like that all this header information + // was being mixed in with all the game information as they have + // completely different lifespans. - virtual ~GrSource(){} - virtual bool requiresTexturePack()=0; - virtual std::uint32_t getRequiredTexturePackId()=0; - virtual std::wstring getDefaultSaveName()=0; - virtual const wchar_t *getWorldName()=0; - virtual const wchar_t *getDisplayName()=0; - virtual std::wstring getGrfPath()=0; - virtual bool requiresBaseSave() = 0; - virtual std::wstring getBaseSavePath() = 0; + virtual ~GrSource() {} + virtual bool requiresTexturePack() = 0; + virtual std::uint32_t getRequiredTexturePackId() = 0; + virtual std::wstring getDefaultSaveName() = 0; + virtual const wchar_t* getWorldName() = 0; + virtual const wchar_t* getDisplayName() = 0; + virtual std::wstring getGrfPath() = 0; + virtual bool requiresBaseSave() = 0; + virtual std::wstring getBaseSavePath() = 0; - virtual void setRequiresTexturePack(bool)=0; - virtual void setRequiredTexturePackId(std::uint32_t)=0; - virtual void setDefaultSaveName(const std::wstring &)=0; - virtual void setWorldName(const std::wstring &)=0; - virtual void setDisplayName(const std::wstring &)=0; - virtual void setGrfPath(const std::wstring &)=0; - virtual void setBaseSavePath(const std::wstring &)=0; + virtual void setRequiresTexturePack(bool) = 0; + virtual void setRequiredTexturePackId(std::uint32_t) = 0; + virtual void setDefaultSaveName(const std::wstring&) = 0; + virtual void setWorldName(const std::wstring&) = 0; + virtual void setDisplayName(const std::wstring&) = 0; + virtual void setGrfPath(const std::wstring&) = 0; + virtual void setBaseSavePath(const std::wstring&) = 0; - virtual bool ready()=0; + virtual bool ready() = 0; - //virtual void getGrfData(std::uint8_t *&pData, unsigned int &pSize)=0; + // virtual void getGrfData(std::uint8_t *&pData, unsigned int &pSize)=0; }; -class JustGrSource : public GrSource -{ +class JustGrSource : public GrSource { protected: - std::wstring m_worldName; - std::wstring m_displayName; - std::wstring m_defaultSaveName; - bool m_bRequiresTexturePack; - std::uint32_t m_requiredTexturePackId; - std::wstring m_grfPath; - std::wstring m_baseSavePath; - bool m_bRequiresBaseSave; + std::wstring m_worldName; + std::wstring m_displayName; + std::wstring m_defaultSaveName; + bool m_bRequiresTexturePack; + std::uint32_t m_requiredTexturePackId; + std::wstring m_grfPath; + std::wstring m_baseSavePath; + bool m_bRequiresBaseSave; public: - virtual bool requiresTexturePack(); - virtual std::uint32_t getRequiredTexturePackId(); - virtual std::wstring getDefaultSaveName(); - virtual const wchar_t *getWorldName(); - virtual const wchar_t *getDisplayName(); - virtual std::wstring getGrfPath(); - virtual bool requiresBaseSave(); - virtual std::wstring getBaseSavePath(); + virtual bool requiresTexturePack(); + virtual std::uint32_t getRequiredTexturePackId(); + virtual std::wstring getDefaultSaveName(); + virtual const wchar_t* getWorldName(); + virtual const wchar_t* getDisplayName(); + virtual std::wstring getGrfPath(); + virtual bool requiresBaseSave(); + virtual std::wstring getBaseSavePath(); - virtual void setRequiresTexturePack(bool x); - virtual void setRequiredTexturePackId(std::uint32_t x); - virtual void setDefaultSaveName(const std::wstring &x); - virtual void setWorldName(const std::wstring &x); - virtual void setDisplayName(const std::wstring &x); - virtual void setGrfPath(const std::wstring &x); - virtual void setBaseSavePath(const std::wstring &x); + virtual void setRequiresTexturePack(bool x); + virtual void setRequiredTexturePackId(std::uint32_t x); + virtual void setDefaultSaveName(const std::wstring& x); + virtual void setWorldName(const std::wstring& x); + virtual void setDisplayName(const std::wstring& x); + virtual void setGrfPath(const std::wstring& x); + virtual void setBaseSavePath(const std::wstring& x); - virtual bool ready(); + virtual bool ready(); - JustGrSource(); + JustGrSource(); }; -class LevelGenerationOptions : public GameRuleDefinition -{ +class LevelGenerationOptions : public GameRuleDefinition { public: - enum eSrc - { - eSrc_none, + enum eSrc { + eSrc_none, - eSrc_fromSave, // Neither content or header is persistent. + eSrc_fromSave, // Neither content or header is persistent. - eSrc_fromDLC, // Header is persistent, content should be deleted to conserve space. + eSrc_fromDLC, // Header is persistent, content should be deleted to + // conserve space. - eSrc_tutorial, // Both header and content is persistent, content cannot be reloaded. + eSrc_tutorial, // Both header and content is persistent, content cannot + // be reloaded. - eSrc_MAX - }; + eSrc_MAX + }; private: - eSrc m_src; + eSrc m_src; - GrSource *m_pSrc; - GrSource *info(); + GrSource* m_pSrc; + GrSource* info(); - bool m_hasLoadedData; + bool m_hasLoadedData; - std::uint8_t *m_pbBaseSaveData; - unsigned int m_baseSaveSize; + std::uint8_t* m_pbBaseSaveData; + unsigned int m_baseSaveSize; public: + void setSrc(eSrc src); + eSrc getSrc(); - void setSrc(eSrc src); - eSrc getSrc(); + bool isTutorial(); + bool isFromSave(); + bool isFromDLC(); - bool isTutorial(); - bool isFromSave(); - bool isFromDLC(); + bool requiresTexturePack(); + std::uint32_t getRequiredTexturePackId(); + std::wstring getDefaultSaveName(); + const wchar_t* getWorldName(); + const wchar_t* getDisplayName(); + std::wstring getGrfPath(); + bool requiresBaseSave(); + std::wstring getBaseSavePath(); - bool requiresTexturePack(); - std::uint32_t getRequiredTexturePackId(); - std::wstring getDefaultSaveName(); - const wchar_t *getWorldName(); - const wchar_t *getDisplayName(); - std::wstring getGrfPath(); - bool requiresBaseSave(); - std::wstring getBaseSavePath(); + void setGrSource(GrSource* grs); - void setGrSource(GrSource *grs); + void setRequiresTexturePack(bool x); + void setRequiredTexturePackId(std::uint32_t x); + void setDefaultSaveName(const std::wstring& x); + void setWorldName(const std::wstring& x); + void setDisplayName(const std::wstring& x); + void setGrfPath(const std::wstring& x); + void setBaseSavePath(const std::wstring& x); - void setRequiresTexturePack(bool x); - void setRequiredTexturePackId(std::uint32_t x); - void setDefaultSaveName(const std::wstring &x); - void setWorldName(const std::wstring &x); - void setDisplayName(const std::wstring &x); - void setGrfPath(const std::wstring &x); - void setBaseSavePath(const std::wstring &x); + bool ready(); - bool ready(); + void setBaseSaveData(std::uint8_t* pbData, unsigned int dataSize); + std::uint8_t* getBaseSaveData(unsigned int& size); + bool hasBaseSaveData(); + void deleteBaseSaveData(); - void setBaseSaveData(std::uint8_t *pbData, unsigned int dataSize); - std::uint8_t *getBaseSaveData(unsigned int &size); - bool hasBaseSaveData(); - void deleteBaseSaveData(); - - bool hasLoadedData(); - void setLoadedData(); + bool hasLoadedData(); + void setLoadedData(); private: - // This should match the "MapOptionsRule" definition in the XML schema - __int64 m_seed; - bool m_useFlatWorld; - Pos *m_spawnPos; - std::vector m_schematicRules; - std::vector m_structureRules; - bool m_bHaveMinY; - int m_minY; - std::unordered_map m_schematics; - std::vector m_biomeOverrides; - std::vector m_features; + // This should match the "MapOptionsRule" definition in the XML schema + int64_t m_seed; + bool m_useFlatWorld; + Pos* m_spawnPos; + int m_bHasBeenInCreative; + std::vector m_schematicRules; + std::vector m_structureRules; + bool m_bHaveMinY; + int m_minY; + std::unordered_map m_schematics; + std::vector m_biomeOverrides; + std::vector m_features; - bool m_bRequiresGameRules; - LevelRuleset *m_requiredGameRules; + bool m_bRequiresGameRules; + LevelRuleset* m_requiredGameRules; - StringTable *m_stringTable; + StringTable* m_stringTable; + + DLCPack* m_parentDLCPack; + bool m_bLoadingData; public: - LevelGenerationOptions(); - ~LevelGenerationOptions(); + LevelGenerationOptions(DLCPack* parentPack = NULL); + ~LevelGenerationOptions(); - virtual ConsoleGameRules::EGameRuleType getActionType(); - - virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttributes); - virtual void getChildren(std::vector *children); - virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); - virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); + virtual ConsoleGameRules::EGameRuleType getActionType(); - __int64 getLevelSeed(); - Pos *getSpawnPos(); - bool getuseFlatWorld(); + virtual void writeAttributes(DataOutputStream* dos, + unsigned int numAttributes); + virtual void getChildren(std::vector* children); + virtual GameRuleDefinition* addChild( + ConsoleGameRules::EGameRuleType ruleType); + virtual void addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue); - void processSchematics(LevelChunk *chunk); - void processSchematicsLighting(LevelChunk *chunk); + int64_t getLevelSeed(); + int getLevelHasBeenInCreative(); + Pos* getSpawnPos(); + bool getuseFlatWorld(); - bool checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1); + void processSchematics(LevelChunk* chunk); + void processSchematicsLighting(LevelChunk* chunk); + + bool checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1); private: - void clearSchematics(); - -public: - ConsoleSchematicFile *loadSchematicFile(const std::wstring &filename, std::uint8_t *pbData, unsigned int dataLength); + void clearSchematics(); public: - ConsoleSchematicFile *getSchematicFile(const std::wstring &filename); - void releaseSchematicFile(const std::wstring &filename); + ConsoleSchematicFile* loadSchematicFile(const std::wstring& filename, + std::uint8_t* pbData, + unsigned int dataLength); - bool requiresGameRules(); - void setRequiredGameRules(LevelRuleset *rules); - LevelRuleset *getRequiredGameRules(); +public: + ConsoleSchematicFile* getSchematicFile(const std::wstring& filename); + void releaseSchematicFile(const std::wstring& filename); - void getBiomeOverride(int biomeId, std::uint8_t &tile, std::uint8_t &topTile); - bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature); + bool requiresGameRules(); + void setRequiredGameRules(LevelRuleset* rules); + LevelRuleset* getRequiredGameRules(); - void loadStringTable(StringTable *table); - const wchar_t *getString(const std::wstring &key); + void getBiomeOverride(int biomeId, std::uint8_t& tile, + std::uint8_t& topTile); + bool isFeatureChunk(int chunkX, int chunkZ, + StructureFeature::EFeatureTypes feature, + int* orientation = NULL); - std::unordered_map *getUnfinishedSchematicFiles(); - - // 4J-JEV: - // ApplySchematicRules contain limited state - // which needs to be reset BEFORE a new game starts. - void reset_start(); + void loadStringTable(StringTable* table); + const wchar_t* getString(const std::wstring& key); - // 4J-JEV: - // This file contains state that needs to be deleted - // or reset once a game has finished. - void reset_finish(); + std::unordered_map* + getUnfinishedSchematicFiles(); + + void loadBaseSaveData(); + static int packMounted(LPVOID pParam, int iPad, DWORD dwErr, + DWORD dwLicenceMask); + + // 4J-JEV: + // ApplySchematicRules contain limited state + // which needs to be reset BEFORE a new game starts. + void reset_start(); + + // 4J-JEV: + // This file contains state that needs to be deleted + // or reset once a game has finished. + void reset_finish(); }; diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelGenerators.cpp b/Minecraft.Client/Platform/Common/GameRules/LevelGenerators.cpp index 0140f5851..5c8fdff78 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelGenerators.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/LevelGenerators.cpp @@ -2,25 +2,18 @@ #include "LevelGenerationOptions.h" #include "LevelGenerators.h" +LevelGenerators::LevelGenerators() {} -LevelGenerators::LevelGenerators() -{ +void LevelGenerators::addLevelGenerator(const std::wstring& displayName, + LevelGenerationOptions* generator) { + if (!displayName.empty()) generator->setDisplayName(displayName); + m_levelGenerators.push_back(generator); } -void LevelGenerators::addLevelGenerator(const std::wstring &displayName, LevelGenerationOptions *generator) -{ - if(!displayName.empty()) generator->setDisplayName(displayName); - m_levelGenerators.push_back(generator); -} - -void LevelGenerators::removeLevelGenerator(LevelGenerationOptions *generator) -{ - std::vector::iterator it; - while ( (it = find( m_levelGenerators.begin(), - m_levelGenerators.end(), - generator ) ) - != m_levelGenerators.end() ) - { - m_levelGenerators.erase(it); - } +void LevelGenerators::removeLevelGenerator(LevelGenerationOptions* generator) { + std::vector::iterator it; + while ((it = find(m_levelGenerators.begin(), m_levelGenerators.end(), + generator)) != m_levelGenerators.end()) { + m_levelGenerators.erase(it); + } } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelGenerators.h b/Minecraft.Client/Platform/Common/GameRules/LevelGenerators.h index ac05ee857..ccfbff3ad 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelGenerators.h +++ b/Minecraft.Client/Platform/Common/GameRules/LevelGenerators.h @@ -1,19 +1,21 @@ #pragma once -//using namespace std; +// using namespace std; class LevelGenerationOptions; -class LevelGenerators -{ +class LevelGenerators { private: - std::vector m_levelGenerators; + std::vector m_levelGenerators; public: - LevelGenerators(); + LevelGenerators(); - void addLevelGenerator(const std::wstring &displayName, LevelGenerationOptions *generator); - void removeLevelGenerator(LevelGenerationOptions *generator); + void addLevelGenerator(const std::wstring& displayName, + LevelGenerationOptions* generator); + void removeLevelGenerator(LevelGenerationOptions* generator); - std::vector *getLevelGenerators() { return &m_levelGenerators; } + std::vector* getLevelGenerators() { + return &m_levelGenerators; + } }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelRules.cpp b/Minecraft.Client/Platform/Common/GameRules/LevelRules.cpp index 94d2d55f7..8e280e0ac 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelRules.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/LevelRules.cpp @@ -1,20 +1,14 @@ #include "../../Minecraft.World/Platform/stdafx.h" #include "LevelRules.h" +LevelRules::LevelRules() {} -LevelRules::LevelRules() -{ -} +void LevelRules::addLevelRule(const std::wstring& displayName, + std::uint8_t* pbData, unsigned int dataLength) {} -void LevelRules::addLevelRule(const std::wstring &displayName, std::uint8_t *pbData, unsigned int dataLength) -{ -} +void LevelRules::addLevelRule(const std::wstring& displayName, + LevelRuleset* rootRule) {} -void LevelRules::addLevelRule(const std::wstring &displayName, LevelRuleset *rootRule) -{ -} - -void LevelRules::removeLevelRule(LevelRuleset *removing) -{ - // TODO ? +void LevelRules::removeLevelRule(LevelRuleset* removing) { + // TODO ? } diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelRules.h b/Minecraft.Client/Platform/Common/GameRules/LevelRules.h index d32577eef..d297beb2a 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelRules.h +++ b/Minecraft.Client/Platform/Common/GameRules/LevelRules.h @@ -2,13 +2,13 @@ class LevelRuleset; -class LevelRules -{ +class LevelRules { public: - LevelRules(); + LevelRules(); - void addLevelRule(const std::wstring &displayName, std::uint8_t *pbData, unsigned int dataLength); - void addLevelRule(const std::wstring &displayName, LevelRuleset *rootRule); + void addLevelRule(const std::wstring& displayName, std::uint8_t* pbData, + unsigned int dataLength); + void addLevelRule(const std::wstring& displayName, LevelRuleset* rootRule); - void removeLevelRule(LevelRuleset *removing); + void removeLevelRule(LevelRuleset* removing); }; diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.cpp b/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.cpp index 0c0e2cb08..30bc16254 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.cpp @@ -4,68 +4,51 @@ #include "ConsoleGameRules.h" #include "LevelRuleset.h" -LevelRuleset::LevelRuleset() -{ - m_stringTable = NULL; +LevelRuleset::LevelRuleset() { m_stringTable = NULL; } + +LevelRuleset::~LevelRuleset() { + for (AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); ++it) { + delete *it; + } } -LevelRuleset::~LevelRuleset() -{ - for(AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); ++it) - { - delete *it; - } +void LevelRuleset::getChildren(std::vector* children) { + CompoundGameRuleDefinition::getChildren(children); + for (AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); it++) + children->push_back(*it); } -void LevelRuleset::getChildren(std::vector *children) -{ - CompoundGameRuleDefinition::getChildren(children); - for (AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); it++) - children->push_back(*it); +GameRuleDefinition* LevelRuleset::addChild( + ConsoleGameRules::EGameRuleType ruleType) { + GameRuleDefinition* rule = NULL; + if (ruleType == ConsoleGameRules::eGameRuleType_NamedArea) { + rule = new NamedAreaRuleDefinition(); + m_areas.push_back((NamedAreaRuleDefinition*)rule); + } else { + rule = CompoundGameRuleDefinition::addChild(ruleType); + } + return rule; } -GameRuleDefinition *LevelRuleset::addChild(ConsoleGameRules::EGameRuleType ruleType) -{ - GameRuleDefinition *rule = NULL; - if(ruleType == ConsoleGameRules::eGameRuleType_NamedArea) - { - rule = new NamedAreaRuleDefinition(); - m_areas.push_back((NamedAreaRuleDefinition *)rule); - } - else - { - rule = CompoundGameRuleDefinition::addChild(ruleType); - } - return rule; +void LevelRuleset::loadStringTable(StringTable* table) { + m_stringTable = table; } -void LevelRuleset::loadStringTable(StringTable *table) -{ - m_stringTable = table; +const wchar_t* LevelRuleset::getString(const std::wstring& key) { + if (m_stringTable == NULL) { + return L""; + } else { + return m_stringTable->getString(key); + } } -const wchar_t *LevelRuleset::getString(const std::wstring &key) -{ - if(m_stringTable == NULL) - { - return L""; - } - else - { - return m_stringTable->getString(key); - } -} - -AABB *LevelRuleset::getNamedArea(const std::wstring &areaName) -{ - AABB *area = NULL; - for(AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); ++it) - { - if( (*it)->getName().compare(areaName) == 0 ) - { - area = (*it)->getArea(); - break; - } - } - return area; +AABB* LevelRuleset::getNamedArea(const std::wstring& areaName) { + AABB* area = NULL; + for (AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); ++it) { + if ((*it)->getName().compare(areaName) == 0) { + area = (*it)->getArea(); + break; + } + } + return area; } diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.h b/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.h index 1b7810659..c44c19d91 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.h +++ b/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.h @@ -4,24 +4,27 @@ class NamedAreaRuleDefinition; -class LevelRuleset : public CompoundGameRuleDefinition -{ +class LevelRuleset : public CompoundGameRuleDefinition { private: - std::vector m_areas; - StringTable *m_stringTable; + std::vector m_areas; + StringTable* m_stringTable; + public: - LevelRuleset(); - ~LevelRuleset(); + LevelRuleset(); + ~LevelRuleset(); - virtual void getChildren(std::vector *children); - virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); + virtual void getChildren(std::vector* children); + virtual GameRuleDefinition* addChild( + ConsoleGameRules::EGameRuleType ruleType); - virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_LevelRules; } + virtual ConsoleGameRules::EGameRuleType getActionType() { + return ConsoleGameRules::eGameRuleType_LevelRules; + } - void loadStringTable(StringTable *table); - const wchar_t *getString(const std::wstring &key); + void loadStringTable(StringTable* table); + const wchar_t* getString(const std::wstring& key); - AABB *getNamedArea(const std::wstring &areaName); + AABB* getNamedArea(const std::wstring& areaName); - StringTable *getStringTable() { return m_stringTable; } + StringTable* getStringTable() { return m_stringTable; } }; diff --git a/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.cpp index bf79d1c14..b09982ae9 100644 --- a/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.cpp @@ -3,82 +3,70 @@ #include "../../Minecraft.World/Util/StringHelpers.h" #include "../../Minecraft.World/Headers/net.minecraft.world.phys.h" -NamedAreaRuleDefinition::NamedAreaRuleDefinition() -{ - m_name = L""; - m_area = AABB::newPermanent(0,0,0,0,0,0); +NamedAreaRuleDefinition::NamedAreaRuleDefinition() { + m_name = L""; + m_area = AABB::newPermanent(0, 0, 0, 0, 0, 0); } -NamedAreaRuleDefinition::~NamedAreaRuleDefinition() -{ - delete m_area; +NamedAreaRuleDefinition::~NamedAreaRuleDefinition() { delete m_area; } + +void NamedAreaRuleDefinition::writeAttributes(DataOutputStream* dos, + unsigned int numAttributes) { + GameRuleDefinition::writeAttributes(dos, numAttributes + 7); + + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_name); + dos->writeUTF(m_name); + + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0); + dos->writeUTF(_toString(m_area->x0)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0); + dos->writeUTF(_toString(m_area->y0)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0); + dos->writeUTF(_toString(m_area->z0)); + + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1); + dos->writeUTF(_toString(m_area->x1)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1); + dos->writeUTF(_toString(m_area->y1)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1); + dos->writeUTF(_toString(m_area->z1)); } -void NamedAreaRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes) -{ - GameRuleDefinition::writeAttributes(dos, numAttributes + 7); - - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_name); - dos->writeUTF(m_name); - - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0); - dos->writeUTF(_toString(m_area->x0)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0); - dos->writeUTF(_toString(m_area->y0)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0); - dos->writeUTF(_toString(m_area->z0)); - - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1); - dos->writeUTF(_toString(m_area->x1)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1); - dos->writeUTF(_toString(m_area->y1)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1); - dos->writeUTF(_toString(m_area->z1)); -} - -void NamedAreaRuleDefinition::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) -{ - if(attributeName.compare(L"name") == 0) - { - m_name = attributeValue; +void NamedAreaRuleDefinition::addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue) { + if (attributeName.compare(L"name") == 0) { + m_name = attributeValue; #ifndef _CONTENT_PACKAGE - wprintf(L"NamedAreaRuleDefinition: Adding parameter name=%ls\n",m_name.c_str()); + wprintf(L"NamedAreaRuleDefinition: Adding parameter name=%ls\n", + m_name.c_str()); #endif - } - else if(attributeName.compare(L"x0") == 0) - { - m_area->x0 = _fromString(attributeValue); - app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter x0=%f\n",m_area->x0); - } - else if(attributeName.compare(L"y0") == 0) - { - m_area->y0 = _fromString(attributeValue); - if(m_area->y0 < 0) m_area->y0 = 0; - app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter y0=%f\n",m_area->y0); - } - else if(attributeName.compare(L"z0") == 0) - { - m_area->z0 = _fromString(attributeValue); - app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter z0=%f\n",m_area->z0); - } - else if(attributeName.compare(L"x1") == 0) - { - m_area->x1 = _fromString(attributeValue); - app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter x1=%f\n",m_area->x1); - } - else if(attributeName.compare(L"y1") == 0) - { - m_area->y1 = _fromString(attributeValue); - if(m_area->y1 < 0) m_area->y1 = 0; - app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter y1=%f\n",m_area->y1); - } - else if(attributeName.compare(L"z1") == 0) - { - m_area->z1 = _fromString(attributeValue); - app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter z1=%f\n",m_area->z1); - } - else - { - GameRuleDefinition::addAttribute(attributeName, attributeValue); - } + } else if (attributeName.compare(L"x0") == 0) { + m_area->x0 = _fromString(attributeValue); + app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter x0=%f\n", + m_area->x0); + } else if (attributeName.compare(L"y0") == 0) { + m_area->y0 = _fromString(attributeValue); + if (m_area->y0 < 0) m_area->y0 = 0; + app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter y0=%f\n", + m_area->y0); + } else if (attributeName.compare(L"z0") == 0) { + m_area->z0 = _fromString(attributeValue); + app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter z0=%f\n", + m_area->z0); + } else if (attributeName.compare(L"x1") == 0) { + m_area->x1 = _fromString(attributeValue); + app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter x1=%f\n", + m_area->x1); + } else if (attributeName.compare(L"y1") == 0) { + m_area->y1 = _fromString(attributeValue); + if (m_area->y1 < 0) m_area->y1 = 0; + app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter y1=%f\n", + m_area->y1); + } else if (attributeName.compare(L"z1") == 0) { + m_area->z1 = _fromString(attributeValue); + app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter z1=%f\n", + m_area->z1); + } else { + GameRuleDefinition::addAttribute(attributeName, attributeValue); + } } diff --git a/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.h index ff3eb3cb9..93f8a0c47 100644 --- a/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.h @@ -2,22 +2,25 @@ #include "GameRuleDefinition.h" -class NamedAreaRuleDefinition : public GameRuleDefinition -{ +class NamedAreaRuleDefinition : public GameRuleDefinition { private: - std::wstring m_name; - AABB *m_area; + std::wstring m_name; + AABB* m_area; public: - NamedAreaRuleDefinition(); - ~NamedAreaRuleDefinition(); + NamedAreaRuleDefinition(); + ~NamedAreaRuleDefinition(); - virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttributes); + virtual void writeAttributes(DataOutputStream* dos, + unsigned int numAttributes); - virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_NamedArea; } - - virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); + virtual ConsoleGameRules::EGameRuleType getActionType() { + return ConsoleGameRules::eGameRuleType_NamedArea; + } - AABB *getArea() { return m_area; } - std::wstring getName() { return m_name; } + virtual void addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue); + + AABB* getArea() { return m_area; } + std::wstring getName() { return m_name; } }; diff --git a/Minecraft.Client/Platform/Common/GameRules/StartFeature.cpp b/Minecraft.Client/Platform/Common/GameRules/StartFeature.cpp index be44ca2b4..e1d316ea4 100644 --- a/Minecraft.Client/Platform/Common/GameRules/StartFeature.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/StartFeature.cpp @@ -2,52 +2,55 @@ #include "../../Minecraft.World/Util/StringHelpers.h" #include "StartFeature.h" -StartFeature::StartFeature() -{ - m_chunkX = 0; - m_chunkZ = 0; - m_feature = StructureFeature::eFeature_Temples; +StartFeature::StartFeature() { + m_chunkX = 0; + m_chunkZ = 0; + m_orientation = 0; + m_feature = StructureFeature::eFeature_Temples; } -void StartFeature::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) -{ - GameRuleDefinition::writeAttributes(dos, numAttrs + 3); +void StartFeature::writeAttributes(DataOutputStream* dos, + unsigned int numAttrs) { + GameRuleDefinition::writeAttributes(dos, numAttrs + 4); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkX); - dos->writeUTF(_toString(m_chunkX)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkZ); - dos->writeUTF(_toString(m_chunkZ)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_feature); - dos->writeUTF(_toString((int)m_feature)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkX); + dos->writeUTF(_toString(m_chunkX)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkZ); + dos->writeUTF(_toString(m_chunkZ)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_feature); + dos->writeUTF(_toString((int)m_feature)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation); + dos->writeUTF(_toString(m_orientation)); } -void StartFeature::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) -{ - if(attributeName.compare(L"chunkX") == 0) - { - int value = _fromString(attributeValue); - m_chunkX = value; - app.DebugPrintf("StartFeature: Adding parameter chunkX=%d\n",m_chunkX); - } - else if(attributeName.compare(L"chunkZ") == 0) - { - int value = _fromString(attributeValue); - m_chunkZ = value; - app.DebugPrintf("StartFeature: Adding parameter chunkZ=%d\n",m_chunkZ); - } - else if(attributeName.compare(L"feature") == 0) - { - int value = _fromString(attributeValue); - m_feature = (StructureFeature::EFeatureTypes)value; - app.DebugPrintf("StartFeature: Adding parameter feature=%d\n",m_feature); - } - else - { - GameRuleDefinition::addAttribute(attributeName, attributeValue); - } +void StartFeature::addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue) { + if (attributeName.compare(L"chunkX") == 0) { + int value = _fromString(attributeValue); + m_chunkX = value; + app.DebugPrintf("StartFeature: Adding parameter chunkX=%d\n", m_chunkX); + } else if (attributeName.compare(L"chunkZ") == 0) { + int value = _fromString(attributeValue); + m_chunkZ = value; + app.DebugPrintf("StartFeature: Adding parameter chunkZ=%d\n", m_chunkZ); + } else if (attributeName.compare(L"orientation") == 0) { + int value = _fromString(attributeValue); + m_orientation = value; + app.DebugPrintf("StartFeature: Adding parameter orientation=%d\n", + m_orientation); + } else if (attributeName.compare(L"feature") == 0) { + int value = _fromString(attributeValue); + m_feature = (StructureFeature::EFeatureTypes)value; + app.DebugPrintf("StartFeature: Adding parameter feature=%d\n", + m_feature); + } else { + GameRuleDefinition::addAttribute(attributeName, attributeValue); + } } -bool StartFeature::isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature) -{ - return chunkX == m_chunkX && chunkZ == m_chunkZ && feature == m_feature; +bool StartFeature::isFeatureChunk(int chunkX, int chunkZ, + StructureFeature::EFeatureTypes feature, + int* orientation) { + if (orientation != NULL) *orientation = m_orientation; + return chunkX == m_chunkX && chunkZ == m_chunkZ && feature == m_feature; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/StartFeature.h b/Minecraft.Client/Platform/Common/GameRules/StartFeature.h index 6a153bfcd..d2c7c9d24 100644 --- a/Minecraft.Client/Platform/Common/GameRules/StartFeature.h +++ b/Minecraft.Client/Platform/Common/GameRules/StartFeature.h @@ -1,22 +1,26 @@ #pragma once -//using namespace std; +// using namespace std; #include "GameRuleDefinition.h" #include "../../Minecraft.World/WorldGen/Features/StructureFeature.h" -class StartFeature : public GameRuleDefinition -{ +class StartFeature : public GameRuleDefinition { private: - int m_chunkX, m_chunkZ; - StructureFeature::EFeatureTypes m_feature; + int m_chunkX, m_chunkZ, m_orientation; + StructureFeature::EFeatureTypes m_feature; public: - StartFeature(); + StartFeature(); - virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_StartFeature; } - - virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs); - virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); + virtual ConsoleGameRules::EGameRuleType getActionType() { + return ConsoleGameRules::eGameRuleType_StartFeature; + } - bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature); -}; + virtual void writeAttributes(DataOutputStream* dos, unsigned int numAttrs); + virtual void addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue); + + bool isFeatureChunk(int chunkX, int chunkZ, + StructureFeature::EFeatureTypes feature, + int* orientation); +}; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.cpp index 38ffc2768..1a160a017 100644 --- a/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.cpp @@ -7,165 +7,149 @@ #include "../../Minecraft.World/Headers/net.minecraft.world.food.h" #include "../../Minecraft.World/Headers/net.minecraft.world.item.h" -UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition() -{ - m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false;; - m_health = 0; - m_food = 0; - m_spawnPos = NULL; - m_yRot = 0.0f; +UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition() { + m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false; + ; + m_health = 0; + m_food = 0; + m_spawnPos = NULL; + m_yRot = 0.0f; } -UpdatePlayerRuleDefinition::~UpdatePlayerRuleDefinition() -{ - for(AUTO_VAR(it, m_items.begin()); it != m_items.end(); ++it) - { - delete *it; - } +UpdatePlayerRuleDefinition::~UpdatePlayerRuleDefinition() { + for (AUTO_VAR(it, m_items.begin()); it != m_items.end(); ++it) { + delete *it; + } } -void UpdatePlayerRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes) -{ - int attrCount = 3; - if(m_bUpdateHealth) ++attrCount; - if(m_bUpdateFood) ++attrCount; - if(m_bUpdateYRot) ++attrCount; - GameRuleDefinition::writeAttributes(dos, numAttributes + attrCount ); +void UpdatePlayerRuleDefinition::writeAttributes(DataOutputStream* dos, + unsigned int numAttributes) { + int attrCount = 3; + if (m_bUpdateHealth) ++attrCount; + if (m_bUpdateFood) ++attrCount; + if (m_bUpdateYRot) ++attrCount; + GameRuleDefinition::writeAttributes(dos, numAttributes + attrCount); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX); - dos->writeUTF(_toString(m_spawnPos->x)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnY); - dos->writeUTF(_toString(m_spawnPos->y)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnZ); - dos->writeUTF(_toString(m_spawnPos->z)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX); + dos->writeUTF(_toString(m_spawnPos->x)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnY); + dos->writeUTF(_toString(m_spawnPos->y)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnZ); + dos->writeUTF(_toString(m_spawnPos->z)); - if(m_bUpdateYRot) - { - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_yRot); - dos->writeUTF(_toString(m_yRot)); - } - if(m_bUpdateHealth) - { - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_food); - dos->writeUTF(_toString(m_health)); - } - if(m_bUpdateFood) - { - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_health); - dos->writeUTF(_toString(m_food)); - } + if (m_bUpdateYRot) { + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_yRot); + dos->writeUTF(_toString(m_yRot)); + } + if (m_bUpdateHealth) { + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_food); + dos->writeUTF(_toString(m_health)); + } + if (m_bUpdateFood) { + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_health); + dos->writeUTF(_toString(m_food)); + } } -void UpdatePlayerRuleDefinition::getChildren(std::vector *children) -{ - GameRuleDefinition::getChildren(children); - for(AUTO_VAR(it, m_items.begin()); it!=m_items.end(); it++) - children->push_back(*it); +void UpdatePlayerRuleDefinition::getChildren( + std::vector* children) { + GameRuleDefinition::getChildren(children); + for (AUTO_VAR(it, m_items.begin()); it != m_items.end(); it++) + children->push_back(*it); } -GameRuleDefinition *UpdatePlayerRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType) -{ - GameRuleDefinition *rule = NULL; - if(ruleType == ConsoleGameRules::eGameRuleType_AddItem) - { - rule = new AddItemRuleDefinition(); - m_items.push_back((AddItemRuleDefinition *)rule); - } - else - { +GameRuleDefinition* UpdatePlayerRuleDefinition::addChild( + ConsoleGameRules::EGameRuleType ruleType) { + GameRuleDefinition* rule = NULL; + if (ruleType == ConsoleGameRules::eGameRuleType_AddItem) { + rule = new AddItemRuleDefinition(); + m_items.push_back((AddItemRuleDefinition*)rule); + } else { #ifndef _CONTENT_PACKAGE - wprintf(L"UpdatePlayerRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType ); + wprintf( + L"UpdatePlayerRuleDefinition: Attempted to add invalid child rule " + L"- %d\n", + ruleType); #endif - } - return rule; + } + return rule; } -void UpdatePlayerRuleDefinition::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) -{ - if(attributeName.compare(L"spawnX") == 0) - { - if(m_spawnPos == NULL) m_spawnPos = new Pos(); - int value = _fromString(attributeValue); - m_spawnPos->x = value; - app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnX=%d\n",value); - } - else if(attributeName.compare(L"spawnY") == 0) - { - if(m_spawnPos == NULL) m_spawnPos = new Pos(); - int value = _fromString(attributeValue); - m_spawnPos->y = value; - app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnY=%d\n",value); - } - else if(attributeName.compare(L"spawnZ") == 0) - { - if(m_spawnPos == NULL) m_spawnPos = new Pos(); - int value = _fromString(attributeValue); - m_spawnPos->z = value; - app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnZ=%d\n",value); - } - else if(attributeName.compare(L"health") == 0) - { - int value = _fromString(attributeValue); - m_health = value; - m_bUpdateHealth = true; - app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter health=%d\n",value); - } - else if(attributeName.compare(L"food") == 0) - { - int value = _fromString(attributeValue); - m_food = value; - m_bUpdateFood = true; - app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter health=%d\n",value); - } - else if(attributeName.compare(L"yRot") == 0) - { - float value = _fromString(attributeValue); - m_yRot = value; - m_bUpdateYRot = true; - app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter yRot=%f\n",value); - } - else - { - GameRuleDefinition::addAttribute(attributeName, attributeValue); - } +void UpdatePlayerRuleDefinition::addAttribute( + const std::wstring& attributeName, const std::wstring& attributeValue) { + if (attributeName.compare(L"spawnX") == 0) { + if (m_spawnPos == NULL) m_spawnPos = new Pos(); + int value = _fromString(attributeValue); + m_spawnPos->x = value; + app.DebugPrintf( + "UpdatePlayerRuleDefinition: Adding parameter spawnX=%d\n", value); + } else if (attributeName.compare(L"spawnY") == 0) { + if (m_spawnPos == NULL) m_spawnPos = new Pos(); + int value = _fromString(attributeValue); + m_spawnPos->y = value; + app.DebugPrintf( + "UpdatePlayerRuleDefinition: Adding parameter spawnY=%d\n", value); + } else if (attributeName.compare(L"spawnZ") == 0) { + if (m_spawnPos == NULL) m_spawnPos = new Pos(); + int value = _fromString(attributeValue); + m_spawnPos->z = value; + app.DebugPrintf( + "UpdatePlayerRuleDefinition: Adding parameter spawnZ=%d\n", value); + } else if (attributeName.compare(L"health") == 0) { + int value = _fromString(attributeValue); + m_health = value; + m_bUpdateHealth = true; + app.DebugPrintf( + "UpdatePlayerRuleDefinition: Adding parameter health=%d\n", value); + } else if (attributeName.compare(L"food") == 0) { + int value = _fromString(attributeValue); + m_food = value; + m_bUpdateFood = true; + app.DebugPrintf( + "UpdatePlayerRuleDefinition: Adding parameter health=%d\n", value); + } else if (attributeName.compare(L"yRot") == 0) { + float value = _fromString(attributeValue); + m_yRot = value; + m_bUpdateYRot = true; + app.DebugPrintf( + "UpdatePlayerRuleDefinition: Adding parameter yRot=%f\n", value); + } else { + GameRuleDefinition::addAttribute(attributeName, attributeValue); + } } -void UpdatePlayerRuleDefinition::postProcessPlayer(std::shared_ptr player) -{ - if(m_bUpdateHealth) - { - player->lastHealth = m_health; - player->setHealth(m_health); - } +void UpdatePlayerRuleDefinition::postProcessPlayer( + std::shared_ptr player) { + if (m_bUpdateHealth) { + player->lastHealth = m_health; + player->setHealth(m_health); + } - if(m_bUpdateFood) - { - player->getFoodData()->setFoodLevel(m_food); - } + if (m_bUpdateFood) { + player->getFoodData()->setFoodLevel(m_food); + } - double x = player->x; - double y = player->y; - double z = player->z; - float yRot = player->yRot; - float xRot = player->xRot; - if(m_spawnPos != NULL) - { - x = m_spawnPos->x; - y = m_spawnPos->y; - z = m_spawnPos->z; - } + double x = player->x; + double y = player->y; + double z = player->z; + float yRot = player->yRot; + float xRot = player->xRot; + if (m_spawnPos != NULL) { + x = m_spawnPos->x; + y = m_spawnPos->y; + z = m_spawnPos->z; + } - if(m_bUpdateYRot) - { - yRot = m_yRot; - } + if (m_bUpdateYRot) { + yRot = m_yRot; + } - if(m_spawnPos != NULL || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot); + if (m_spawnPos != NULL || m_bUpdateYRot) + player->absMoveTo(x, y, z, yRot, xRot); - for(AUTO_VAR(it, m_items.begin()); it != m_items.end(); ++it) - { - AddItemRuleDefinition *addItem = *it; + for (AUTO_VAR(it, m_items.begin()); it != m_items.end(); ++it) { + AddItemRuleDefinition* addItem = *it; - addItem->addItemToContainer(player->inventory, -1); - } + addItem->addItemToContainer(player->inventory, -1); + } } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.h index 0ac062dd7..5f768ff35 100644 --- a/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.h @@ -1,33 +1,37 @@ #pragma once -//using namespace std; +// using namespace std; #include "GameRuleDefinition.h" class AddItemRuleDefinition; class Pos; -class UpdatePlayerRuleDefinition : public GameRuleDefinition -{ +class UpdatePlayerRuleDefinition : public GameRuleDefinition { private: - std::vector m_items; + std::vector m_items; - bool m_bUpdateHealth, m_bUpdateFood, m_bUpdateYRot, m_bUpdateInventory; - int m_health; - int m_food; - Pos *m_spawnPos; - float m_yRot; + bool m_bUpdateHealth, m_bUpdateFood, m_bUpdateYRot, m_bUpdateInventory; + int m_health; + int m_food; + Pos* m_spawnPos; + float m_yRot; public: - UpdatePlayerRuleDefinition(); - ~UpdatePlayerRuleDefinition(); + UpdatePlayerRuleDefinition(); + ~UpdatePlayerRuleDefinition(); - virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_UpdatePlayerRule; } - - virtual void getChildren(std::vector *children); - virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); + virtual ConsoleGameRules::EGameRuleType getActionType() { + return ConsoleGameRules::eGameRuleType_UpdatePlayerRule; + } - virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttributes); - virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); + virtual void getChildren(std::vector* children); + virtual GameRuleDefinition* addChild( + ConsoleGameRules::EGameRuleType ruleType); - virtual void postProcessPlayer(std::shared_ptr player); + virtual void writeAttributes(DataOutputStream* dos, + unsigned int numAttributes); + virtual void addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue); + + virtual void postProcessPlayer(std::shared_ptr player); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/UseTileRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/UseTileRuleDefinition.cpp index 5b775ea81..3ea08b987 100644 --- a/Minecraft.Client/Platform/Common/GameRules/UseTileRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/UseTileRuleDefinition.cpp @@ -2,81 +2,75 @@ #include "../../Minecraft.World/Util/StringHelpers.h" #include "UseTileRuleDefinition.h" -UseTileRuleDefinition::UseTileRuleDefinition() -{ - m_tileId = -1; - m_useCoords = false; +UseTileRuleDefinition::UseTileRuleDefinition() { + m_tileId = -1; + m_useCoords = false; } -void UseTileRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes) -{ - GameRuleDefinition::writeAttributes(dos, numAttributes + 5); +void UseTileRuleDefinition::writeAttributes(DataOutputStream* dos, + unsigned int numAttributes) { + GameRuleDefinition::writeAttributes(dos, numAttributes + 5); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId); - dos->writeUTF(_toString(m_tileId)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId); + dos->writeUTF(_toString(m_tileId)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_useCoords); - dos->writeUTF(_toString(m_useCoords)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_useCoords); + dos->writeUTF(_toString(m_useCoords)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x); - dos->writeUTF(_toString(m_coordinates.x)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x); + dos->writeUTF(_toString(m_coordinates.x)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y); - dos->writeUTF(_toString(m_coordinates.y)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y); + dos->writeUTF(_toString(m_coordinates.y)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z); - dos->writeUTF(_toString(m_coordinates.z)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z); + dos->writeUTF(_toString(m_coordinates.z)); } -void UseTileRuleDefinition::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) -{ - if(attributeName.compare(L"tileId") == 0) - { - m_tileId = _fromString(attributeValue); - app.DebugPrintf("UseTileRule: Adding parameter tileId=%d\n",m_tileId); - } - else if(attributeName.compare(L"useCoords") == 0) - { - m_useCoords = _fromString(attributeValue); - app.DebugPrintf("UseTileRule: Adding parameter useCoords=%s\n",m_useCoords?"TRUE":"FALSE"); - } - else if(attributeName.compare(L"x") == 0) - { - m_coordinates.x = _fromString(attributeValue); - app.DebugPrintf("UseTileRule: Adding parameter x=%d\n",m_coordinates.x); - } - else if(attributeName.compare(L"y") == 0) - { - m_coordinates.y = _fromString(attributeValue); - app.DebugPrintf("UseTileRule: Adding parameter y=%d\n",m_coordinates.y); - } - else if(attributeName.compare(L"z") == 0) - { - m_coordinates.z = _fromString(attributeValue); - app.DebugPrintf("UseTileRule: Adding parameter z=%d\n",m_coordinates.z); - } - else - { - GameRuleDefinition::addAttribute(attributeName, attributeValue); - } +void UseTileRuleDefinition::addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue) { + if (attributeName.compare(L"tileId") == 0) { + m_tileId = _fromString(attributeValue); + app.DebugPrintf("UseTileRule: Adding parameter tileId=%d\n", m_tileId); + } else if (attributeName.compare(L"useCoords") == 0) { + m_useCoords = _fromString(attributeValue); + app.DebugPrintf("UseTileRule: Adding parameter useCoords=%s\n", + m_useCoords ? "TRUE" : "FALSE"); + } else if (attributeName.compare(L"x") == 0) { + m_coordinates.x = _fromString(attributeValue); + app.DebugPrintf("UseTileRule: Adding parameter x=%d\n", + m_coordinates.x); + } else if (attributeName.compare(L"y") == 0) { + m_coordinates.y = _fromString(attributeValue); + app.DebugPrintf("UseTileRule: Adding parameter y=%d\n", + m_coordinates.y); + } else if (attributeName.compare(L"z") == 0) { + m_coordinates.z = _fromString(attributeValue); + app.DebugPrintf("UseTileRule: Adding parameter z=%d\n", + m_coordinates.z); + } else { + GameRuleDefinition::addAttribute(attributeName, attributeValue); + } } -bool UseTileRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, int y, int z) -{ - bool statusChanged = false; - if( m_tileId == tileId ) - { - if( !m_useCoords || (m_coordinates.x == x && m_coordinates.y == y && m_coordinates.z == z) ) - { - if(!getComplete(rule)) - { - statusChanged = true; - setComplete(rule,true); - app.DebugPrintf("Completed UseTileRule with info - t:%d, coords:%s, x:%d, y:%d, z:%d\n", m_tileId,m_useCoords?"TRUE":"FALSE",m_coordinates.x,m_coordinates.y,m_coordinates.z); +bool UseTileRuleDefinition::onUseTile(GameRule* rule, int tileId, int x, int y, + int z) { + bool statusChanged = false; + if (m_tileId == tileId) { + if (!m_useCoords || (m_coordinates.x == x && m_coordinates.y == y && + m_coordinates.z == z)) { + if (!getComplete(rule)) { + statusChanged = true; + setComplete(rule, true); + app.DebugPrintf( + "Completed UseTileRule with info - t:%d, coords:%s, x:%d, " + "y:%d, z:%d\n", + m_tileId, m_useCoords ? "TRUE" : "FALSE", m_coordinates.x, + m_coordinates.y, m_coordinates.z); - // Send a packet or some other announcement here - } - } - } - return statusChanged; + // Send a packet or some other announcement here + } + } + } + return statusChanged; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/UseTileRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/UseTileRuleDefinition.h index ee047d96b..d4b3e2eff 100644 --- a/Minecraft.Client/Platform/Common/GameRules/UseTileRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/UseTileRuleDefinition.h @@ -1,24 +1,27 @@ #pragma once -//using namespace std; +// using namespace std; #include "GameRuleDefinition.h" #include "../../Minecraft.World/Util/Pos.h" -class UseTileRuleDefinition : public GameRuleDefinition -{ +class UseTileRuleDefinition : public GameRuleDefinition { private: - // These values should map directly to the xsd definition for this Rule - int m_tileId; - bool m_useCoords; - Pos m_coordinates; + // These values should map directly to the xsd definition for this Rule + int m_tileId; + bool m_useCoords; + Pos m_coordinates; public: - UseTileRuleDefinition(); + UseTileRuleDefinition(); - ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_UseTileRule; } + ConsoleGameRules::EGameRuleType getActionType() { + return ConsoleGameRules::eGameRuleType_UseTileRule; + } - virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttributes); - virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); - - virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z); + virtual void writeAttributes(DataOutputStream* dos, + unsigned int numAttributes); + virtual void addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue); + + virtual bool onUseTile(GameRule* rule, int tileId, int x, int y, int z); }; diff --git a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionGenerateBox.cpp b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionGenerateBox.cpp index a16822fe9..39afbe7f4 100644 --- a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionGenerateBox.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionGenerateBox.cpp @@ -3,102 +3,95 @@ #include "../../Minecraft.World/Util/StringHelpers.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.levelgen.structure.h" -XboxStructureActionGenerateBox::XboxStructureActionGenerateBox() -{ - m_x0 = m_y0 = m_z0 = m_x1 = m_y1 = m_z1 = m_edgeTile = m_fillTile = 0; - m_skipAir = false; +XboxStructureActionGenerateBox::XboxStructureActionGenerateBox() { + m_x0 = m_y0 = m_z0 = m_x1 = m_y1 = m_z1 = m_edgeTile = m_fillTile = 0; + m_skipAir = false; } -void XboxStructureActionGenerateBox::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) -{ - ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 9); +void XboxStructureActionGenerateBox::writeAttributes(DataOutputStream* dos, + unsigned int numAttrs) { + ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 9); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0); - dos->writeUTF(_toString(m_x0)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0); - dos->writeUTF(_toString(m_y0)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0); - dos->writeUTF(_toString(m_z0)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0); + dos->writeUTF(_toString(m_x0)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0); + dos->writeUTF(_toString(m_y0)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0); + dos->writeUTF(_toString(m_z0)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1); - dos->writeUTF(_toString(m_x1)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1); - dos->writeUTF(_toString(m_y1)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1); - dos->writeUTF(_toString(m_z1)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1); + dos->writeUTF(_toString(m_x1)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1); + dos->writeUTF(_toString(m_y1)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1); + dos->writeUTF(_toString(m_z1)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_edgeTile); - dos->writeUTF(_toString(m_edgeTile)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_fillTile); - dos->writeUTF(_toString(m_fillTile)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_skipAir); - dos->writeUTF(_toString(m_skipAir)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_edgeTile); + dos->writeUTF(_toString(m_edgeTile)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_fillTile); + dos->writeUTF(_toString(m_fillTile)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_skipAir); + dos->writeUTF(_toString(m_skipAir)); } -void XboxStructureActionGenerateBox::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) -{ - if(attributeName.compare(L"x0") == 0) - { - int value = _fromString(attributeValue); - m_x0 = value; - app.DebugPrintf("XboxStructureActionGenerateBox: Adding parameter x0=%d\n",m_x0); - } - else if(attributeName.compare(L"y0") == 0) - { - int value = _fromString(attributeValue); - m_y0 = value; - app.DebugPrintf("XboxStructureActionGenerateBox: Adding parameter y0=%d\n",m_y0); - } - else if(attributeName.compare(L"z0") == 0) - { - int value = _fromString(attributeValue); - m_z0 = value; - app.DebugPrintf("XboxStructureActionGenerateBox: Adding parameter z0=%d\n",m_z0); - } - else if(attributeName.compare(L"x1") == 0) - { - int value = _fromString(attributeValue); - m_x1 = value; - app.DebugPrintf("XboxStructureActionGenerateBox: Adding parameter x1=%d\n",m_x1); - } - else if(attributeName.compare(L"y1") == 0) - { - int value = _fromString(attributeValue); - m_y1 = value; - app.DebugPrintf("XboxStructureActionGenerateBox: Adding parameter y1=%d\n",m_y1); - } - else if(attributeName.compare(L"z1") == 0) - { - int value = _fromString(attributeValue); - m_z1 = value; - app.DebugPrintf("XboxStructureActionGenerateBox: Adding parameter z1=%d\n",m_z1); - } - else if(attributeName.compare(L"edgeTile") == 0) - { - int value = _fromString(attributeValue); - m_edgeTile = value; - app.DebugPrintf("XboxStructureActionGenerateBox: Adding parameter edgeTile=%d\n",m_edgeTile); - } - else if(attributeName.compare(L"fillTile") == 0) - { - int value = _fromString(attributeValue); - m_fillTile = value; - app.DebugPrintf("XboxStructureActionGenerateBox: Adding parameter fillTile=%d\n",m_fillTile); - } - else if(attributeName.compare(L"skipAir") == 0) - { - if(attributeValue.compare(L"true") == 0) m_skipAir = true; - app.DebugPrintf("XboxStructureActionGenerateBox: Adding parameter skipAir=%s\n",m_skipAir?"TRUE":"FALSE"); - } - else - { - GameRuleDefinition::addAttribute(attributeName, attributeValue); - } +void XboxStructureActionGenerateBox::addAttribute( + const std::wstring& attributeName, const std::wstring& attributeValue) { + if (attributeName.compare(L"x0") == 0) { + int value = _fromString(attributeValue); + m_x0 = value; + app.DebugPrintf( + "XboxStructureActionGenerateBox: Adding parameter x0=%d\n", m_x0); + } else if (attributeName.compare(L"y0") == 0) { + int value = _fromString(attributeValue); + m_y0 = value; + app.DebugPrintf( + "XboxStructureActionGenerateBox: Adding parameter y0=%d\n", m_y0); + } else if (attributeName.compare(L"z0") == 0) { + int value = _fromString(attributeValue); + m_z0 = value; + app.DebugPrintf( + "XboxStructureActionGenerateBox: Adding parameter z0=%d\n", m_z0); + } else if (attributeName.compare(L"x1") == 0) { + int value = _fromString(attributeValue); + m_x1 = value; + app.DebugPrintf( + "XboxStructureActionGenerateBox: Adding parameter x1=%d\n", m_x1); + } else if (attributeName.compare(L"y1") == 0) { + int value = _fromString(attributeValue); + m_y1 = value; + app.DebugPrintf( + "XboxStructureActionGenerateBox: Adding parameter y1=%d\n", m_y1); + } else if (attributeName.compare(L"z1") == 0) { + int value = _fromString(attributeValue); + m_z1 = value; + app.DebugPrintf( + "XboxStructureActionGenerateBox: Adding parameter z1=%d\n", m_z1); + } else if (attributeName.compare(L"edgeTile") == 0) { + int value = _fromString(attributeValue); + m_edgeTile = value; + app.DebugPrintf( + "XboxStructureActionGenerateBox: Adding parameter edgeTile=%d\n", + m_edgeTile); + } else if (attributeName.compare(L"fillTile") == 0) { + int value = _fromString(attributeValue); + m_fillTile = value; + app.DebugPrintf( + "XboxStructureActionGenerateBox: Adding parameter fillTile=%d\n", + m_fillTile); + } else if (attributeName.compare(L"skipAir") == 0) { + if (attributeValue.compare(L"true") == 0) m_skipAir = true; + app.DebugPrintf( + "XboxStructureActionGenerateBox: Adding parameter skipAir=%s\n", + m_skipAir ? "TRUE" : "FALSE"); + } else { + GameRuleDefinition::addAttribute(attributeName, attributeValue); + } } -bool XboxStructureActionGenerateBox::generateBoxInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB) -{ - app.DebugPrintf("XboxStructureActionGenerateBox - generating a box\n"); - structure->generateBox(level,chunkBB,m_x0,m_y0,m_z0,m_x1,m_y1,m_z1,m_edgeTile,m_fillTile,m_skipAir); - return true; +bool XboxStructureActionGenerateBox::generateBoxInLevel( + StructurePiece* structure, Level* level, BoundingBox* chunkBB) { + app.DebugPrintf("XboxStructureActionGenerateBox - generating a box\n"); + structure->generateBox(level, chunkBB, m_x0, m_y0, m_z0, m_x1, m_y1, m_z1, + m_edgeTile, m_fillTile, m_skipAir); + return true; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionGenerateBox.h b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionGenerateBox.h index 44ff199c9..7625f141c 100644 --- a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionGenerateBox.h +++ b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionGenerateBox.h @@ -5,22 +5,26 @@ class StructurePiece; class Level; class BoundingBox; -class XboxStructureActionGenerateBox : public ConsoleGenerateStructureAction -{ +class XboxStructureActionGenerateBox : public ConsoleGenerateStructureAction { private: - int m_x0, m_y0, m_z0, m_x1, m_y1, m_z1, m_edgeTile, m_fillTile; - bool m_skipAir; + int m_x0, m_y0, m_z0, m_x1, m_y1, m_z1, m_edgeTile, m_fillTile; + bool m_skipAir; + public: - XboxStructureActionGenerateBox(); + XboxStructureActionGenerateBox(); - virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_GenerateBox; } + virtual ConsoleGameRules::EGameRuleType getActionType() { + return ConsoleGameRules::eGameRuleType_GenerateBox; + } - virtual int getEndX() { return m_x1; } - virtual int getEndY() { return m_y1; } - virtual int getEndZ() { return m_z1; } + virtual int getEndX() { return m_x1; } + virtual int getEndY() { return m_y1; } + virtual int getEndZ() { return m_z1; } - virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs); - virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); + virtual void writeAttributes(DataOutputStream* dos, unsigned int numAttrs); + virtual void addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue); - bool generateBoxInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB); + bool generateBoxInLevel(StructurePiece* structure, Level* level, + BoundingBox* chunkBB); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceBlock.cpp b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceBlock.cpp index dcc5d59ed..b98d4a974 100644 --- a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceBlock.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceBlock.cpp @@ -3,70 +3,65 @@ #include "../../Minecraft.World/Util/StringHelpers.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.levelgen.structure.h" -XboxStructureActionPlaceBlock::XboxStructureActionPlaceBlock() -{ - m_x = m_y = m_z = m_tile = m_data = 0; +XboxStructureActionPlaceBlock::XboxStructureActionPlaceBlock() { + m_x = m_y = m_z = m_tile = m_data = 0; } -void XboxStructureActionPlaceBlock::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) -{ - ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 5); +void XboxStructureActionPlaceBlock::writeAttributes(DataOutputStream* dos, + unsigned int numAttrs) { + ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 5); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x); - dos->writeUTF(_toString(m_x)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y); - dos->writeUTF(_toString(m_y)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z); - dos->writeUTF(_toString(m_z)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x); + dos->writeUTF(_toString(m_x)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y); + dos->writeUTF(_toString(m_y)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z); + dos->writeUTF(_toString(m_z)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_data); - dos->writeUTF(_toString(m_data)); - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_block); - dos->writeUTF(_toString(m_tile)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_data); + dos->writeUTF(_toString(m_data)); + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_block); + dos->writeUTF(_toString(m_tile)); } - -void XboxStructureActionPlaceBlock::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) -{ - if(attributeName.compare(L"x") == 0) - { - int value = _fromString(attributeValue); - m_x = value; - app.DebugPrintf("XboxStructureActionPlaceBlock: Adding parameter x=%d\n",m_x); - } - else if(attributeName.compare(L"y") == 0) - { - int value = _fromString(attributeValue); - m_y = value; - app.DebugPrintf("XboxStructureActionPlaceBlock: Adding parameter y=%d\n",m_y); - } - else if(attributeName.compare(L"z") == 0) - { - int value = _fromString(attributeValue); - m_z = value; - app.DebugPrintf("XboxStructureActionPlaceBlock: Adding parameter z=%d\n",m_z); - } - else if(attributeName.compare(L"block") == 0) - { - int value = _fromString(attributeValue); - m_tile = value; - app.DebugPrintf("XboxStructureActionPlaceBlock: Adding parameter block=%d\n",m_tile); - } - else if(attributeName.compare(L"data") == 0) - { - int value = _fromString(attributeValue); - m_data = value; - app.DebugPrintf("XboxStructureActionPlaceBlock: Adding parameter data=%d\n",m_data); - } - else - { - GameRuleDefinition::addAttribute(attributeName, attributeValue); - } +void XboxStructureActionPlaceBlock::addAttribute( + const std::wstring& attributeName, const std::wstring& attributeValue) { + if (attributeName.compare(L"x") == 0) { + int value = _fromString(attributeValue); + m_x = value; + app.DebugPrintf( + "XboxStructureActionPlaceBlock: Adding parameter x=%d\n", m_x); + } else if (attributeName.compare(L"y") == 0) { + int value = _fromString(attributeValue); + m_y = value; + app.DebugPrintf( + "XboxStructureActionPlaceBlock: Adding parameter y=%d\n", m_y); + } else if (attributeName.compare(L"z") == 0) { + int value = _fromString(attributeValue); + m_z = value; + app.DebugPrintf( + "XboxStructureActionPlaceBlock: Adding parameter z=%d\n", m_z); + } else if (attributeName.compare(L"block") == 0) { + int value = _fromString(attributeValue); + m_tile = value; + app.DebugPrintf( + "XboxStructureActionPlaceBlock: Adding parameter block=%d\n", + m_tile); + } else if (attributeName.compare(L"data") == 0) { + int value = _fromString(attributeValue); + m_data = value; + app.DebugPrintf( + "XboxStructureActionPlaceBlock: Adding parameter data=%d\n", + m_data); + } else { + GameRuleDefinition::addAttribute(attributeName, attributeValue); + } } -bool XboxStructureActionPlaceBlock::placeBlockInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB) -{ - app.DebugPrintf("XboxStructureActionPlaceBlock - placing a block\n"); - structure->placeBlock(level,m_tile,m_data,m_x,m_y,m_z,chunkBB); - return true; +bool XboxStructureActionPlaceBlock::placeBlockInLevel(StructurePiece* structure, + Level* level, + BoundingBox* chunkBB) { + app.DebugPrintf("XboxStructureActionPlaceBlock - placing a block\n"); + structure->placeBlock(level, m_tile, m_data, m_x, m_y, m_z, chunkBB); + return true; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceBlock.h b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceBlock.h index 4101028a0..63a4b6754 100644 --- a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceBlock.h +++ b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceBlock.h @@ -5,21 +5,25 @@ class StructurePiece; class Level; class BoundingBox; -class XboxStructureActionPlaceBlock : public ConsoleGenerateStructureAction -{ +class XboxStructureActionPlaceBlock : public ConsoleGenerateStructureAction { protected: - int m_x, m_y, m_z, m_tile, m_data; + int m_x, m_y, m_z, m_tile, m_data; + public: - XboxStructureActionPlaceBlock(); + XboxStructureActionPlaceBlock(); - virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_PlaceBlock; } + virtual ConsoleGameRules::EGameRuleType getActionType() { + return ConsoleGameRules::eGameRuleType_PlaceBlock; + } - virtual int getEndX() { return m_x; } - virtual int getEndY() { return m_y; } - virtual int getEndZ() { return m_z; } + virtual int getEndX() { return m_x; } + virtual int getEndY() { return m_y; } + virtual int getEndZ() { return m_z; } - virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs); - virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); + virtual void writeAttributes(DataOutputStream* dos, unsigned int numAttrs); + virtual void addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue); - bool placeBlockInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB); + bool placeBlockInLevel(StructurePiece* structure, Level* level, + BoundingBox* chunkBB); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.cpp b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.cpp index 04606e7ca..2a8f5950b 100644 --- a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.cpp @@ -7,93 +7,97 @@ #include "../../Minecraft.World/Headers/net.minecraft.world.level.tile.h" #include "../../Minecraft.World/Headers/net.minecraft.world.inventory.h" -XboxStructureActionPlaceContainer::XboxStructureActionPlaceContainer() -{ - m_tile = Tile::chest_Id; +XboxStructureActionPlaceContainer::XboxStructureActionPlaceContainer() { + m_tile = Tile::chest_Id; } -XboxStructureActionPlaceContainer::~XboxStructureActionPlaceContainer() -{ - for(AUTO_VAR(it, m_items.begin()); it != m_items.end(); ++it) - { - delete *it; - } +XboxStructureActionPlaceContainer::~XboxStructureActionPlaceContainer() { + for (AUTO_VAR(it, m_items.begin()); it != m_items.end(); ++it) { + delete *it; + } } // 4J-JEV: Super class handles attr-facing fine. -//void XboxStructureActionPlaceContainer::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) - +// void XboxStructureActionPlaceContainer::writeAttributes(DataOutputStream +// *dos, UINT numAttrs) -void XboxStructureActionPlaceContainer::getChildren(std::vector *children) -{ - XboxStructureActionPlaceBlock::getChildren(children); - for(AUTO_VAR(it, m_items.begin()); it!=m_items.end(); it++) - children->push_back( *it ); +void XboxStructureActionPlaceContainer::getChildren( + std::vector* children) { + XboxStructureActionPlaceBlock::getChildren(children); + for (AUTO_VAR(it, m_items.begin()); it != m_items.end(); it++) + children->push_back(*it); } -GameRuleDefinition *XboxStructureActionPlaceContainer::addChild(ConsoleGameRules::EGameRuleType ruleType) -{ - GameRuleDefinition *rule = NULL; - if(ruleType == ConsoleGameRules::eGameRuleType_AddItem) - { - rule = new AddItemRuleDefinition(); - m_items.push_back((AddItemRuleDefinition *)rule); - } - else - { +GameRuleDefinition* XboxStructureActionPlaceContainer::addChild( + ConsoleGameRules::EGameRuleType ruleType) { + GameRuleDefinition* rule = NULL; + if (ruleType == ConsoleGameRules::eGameRuleType_AddItem) { + rule = new AddItemRuleDefinition(); + m_items.push_back((AddItemRuleDefinition*)rule); + } else { #ifndef _CONTENT_PACKAGE - wprintf(L"XboxStructureActionPlaceContainer: Attempted to add invalid child rule - %d\n", ruleType ); + wprintf( + L"XboxStructureActionPlaceContainer: Attempted to add invalid " + L"child rule - %d\n", + ruleType); #endif - } - return rule; + } + return rule; } -void XboxStructureActionPlaceContainer::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) -{ - if(attributeName.compare(L"facing") == 0) - { - int value = _fromString(attributeValue); - m_data = value; - app.DebugPrintf("XboxStructureActionPlaceContainer: Adding parameter facing=%d\n",m_data); - } - else - { - XboxStructureActionPlaceBlock::addAttribute(attributeName, attributeValue); - } +void XboxStructureActionPlaceContainer::addAttribute( + const std::wstring& attributeName, const std::wstring& attributeValue) { + if (attributeName.compare(L"facing") == 0) { + int value = _fromString(attributeValue); + m_data = value; + app.DebugPrintf( + "XboxStructureActionPlaceContainer: Adding parameter facing=%d\n", + m_data); + } else { + XboxStructureActionPlaceBlock::addAttribute(attributeName, + attributeValue); + } } -bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB) -{ - int worldX = structure->getWorldX( m_x, m_z ); - int worldY = structure->getWorldY( m_y ); - int worldZ = structure->getWorldZ( m_x, m_z ); +bool XboxStructureActionPlaceContainer::placeContainerInLevel( + StructurePiece* structure, Level* level, BoundingBox* chunkBB) { + int worldX = structure->getWorldX(m_x, m_z); + int worldY = structure->getWorldY(m_y); + int worldZ = structure->getWorldZ(m_x, m_z); - if ( chunkBB->isInside( worldX, worldY, worldZ ) ) - { - if ( level->getTileEntity( worldX, worldY, worldZ ) != NULL ) - { - // Remove the current tile entity - level->removeTileEntity( worldX, worldY, worldZ ); - level->setTile( worldX, worldY, worldZ, 0 ); - } + if (chunkBB->isInside(worldX, worldY, worldZ)) { + if (level->getTileEntity(worldX, worldY, worldZ) != NULL) { + // Remove the current tile entity + level->removeTileEntity(worldX, worldY, worldZ); + level->setTileAndData(worldX, worldY, worldZ, 0, 0, + Tile::UPDATE_ALL); + } - level->setTile( worldX, worldY, worldZ, m_tile ); - std::shared_ptr container = std::dynamic_pointer_cast(level->getTileEntity( worldX, worldY, worldZ )); - - app.DebugPrintf("XboxStructureActionPlaceContainer - placing a container at (%d,%d,%d)\n", worldX, worldY, worldZ); - if ( container != NULL ) - { - level->setData( worldX, worldY, worldZ, m_data); - // Add items - int slotId = 0; - for(AUTO_VAR(it, m_items.begin()); it != m_items.end() && (slotId < container->getContainerSize()); ++it, ++slotId ) - { - AddItemRuleDefinition *addItem = *it; + level->setTileAndData(worldX, worldY, worldZ, m_tile, 0, + Tile::UPDATE_ALL); + std::shared_ptr container = + std::dynamic_pointer_cast( + level->getTileEntity(worldX, worldY, worldZ)); - addItem->addItemToContainer(container,slotId); - } - } - return true; - } - return false; + app.DebugPrintf( + "XboxStructureActionPlaceContainer - placing a container at " + "(%d,%d,%d)\n", + worldX, worldY, worldZ); + if (container != NULL) { + level->setData(worldX, worldY, worldZ, m_data, + Tile::UPDATE_CLIENTS); + // Add items + int slotId = 0; + for (AUTO_VAR(it, m_items.begin()); + it != m_items.end() && + (slotId < container->getContainerSize()); + ++it, ++slotId) { + AddItemRuleDefinition* addItem = *it; + + addItem->addItemToContainer(container, slotId); + } + } + return true; + } + return false; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.h b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.h index f9950e1ba..7168a3ff1 100644 --- a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.h +++ b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.h @@ -7,23 +7,28 @@ class StructurePiece; class Level; class BoundingBox; -class XboxStructureActionPlaceContainer : public XboxStructureActionPlaceBlock -{ +class XboxStructureActionPlaceContainer : public XboxStructureActionPlaceBlock { private: - std::vector m_items; + std::vector m_items; + public: - XboxStructureActionPlaceContainer(); - ~XboxStructureActionPlaceContainer(); + XboxStructureActionPlaceContainer(); + ~XboxStructureActionPlaceContainer(); - virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_PlaceContainer; } - - virtual void getChildren(std::vector *children); - virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); - - // 4J-JEV: Super class handles attr-facing fine. - //virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttributes); - - virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); + virtual ConsoleGameRules::EGameRuleType getActionType() { + return ConsoleGameRules::eGameRuleType_PlaceContainer; + } - bool placeContainerInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB); + virtual void getChildren(std::vector* children); + virtual GameRuleDefinition* addChild( + ConsoleGameRules::EGameRuleType ruleType); + + // 4J-JEV: Super class handles attr-facing fine. + // virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes); + + virtual void addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue); + + bool placeContainerInLevel(StructurePiece* structure, Level* level, + BoundingBox* chunkBB); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceSpawner.cpp b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceSpawner.cpp index af33a418d..843f0e8f2 100644 --- a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceSpawner.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceSpawner.cpp @@ -5,65 +5,66 @@ #include "../../Minecraft.World/Headers/net.minecraft.world.level.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.tile.entity.h" -XboxStructureActionPlaceSpawner::XboxStructureActionPlaceSpawner() -{ - m_tile = Tile::mobSpawner_Id; - m_entityId = L"Pig"; +XboxStructureActionPlaceSpawner::XboxStructureActionPlaceSpawner() { + m_tile = Tile::mobSpawner_Id; + m_entityId = L"Pig"; } -XboxStructureActionPlaceSpawner::~XboxStructureActionPlaceSpawner() -{ +XboxStructureActionPlaceSpawner::~XboxStructureActionPlaceSpawner() {} + +void XboxStructureActionPlaceSpawner::writeAttributes(DataOutputStream* dos, + unsigned int numAttrs) { + XboxStructureActionPlaceBlock::writeAttributes(dos, numAttrs + 1); + + ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_entity); + dos->writeUTF(m_entityId); } -void XboxStructureActionPlaceSpawner::writeAttributes(DataOutputStream *dos, unsigned int numAttrs) -{ - XboxStructureActionPlaceBlock::writeAttributes(dos, numAttrs + 1); - - ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_entity); - dos->writeUTF(m_entityId); -} - -void XboxStructureActionPlaceSpawner::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) -{ - if(attributeName.compare(L"entity") == 0) - { - m_entityId = attributeValue; +void XboxStructureActionPlaceSpawner::addAttribute( + const std::wstring& attributeName, const std::wstring& attributeValue) { + if (attributeName.compare(L"entity") == 0) { + m_entityId = attributeValue; #ifndef _CONTENT_PACKAGE - wprintf(L"XboxStructureActionPlaceSpawner: Adding parameter entity=%ls\n",m_entityId.c_str()); + wprintf( + L"XboxStructureActionPlaceSpawner: Adding parameter entity=%ls\n", + m_entityId.c_str()); #endif - } - else - { - XboxStructureActionPlaceBlock::addAttribute(attributeName, attributeValue); - } + } else { + XboxStructureActionPlaceBlock::addAttribute(attributeName, + attributeValue); + } } -bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB) -{ - int worldX = structure->getWorldX( m_x, m_z ); - int worldY = structure->getWorldY( m_y ); - int worldZ = structure->getWorldZ( m_x, m_z ); +bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel( + StructurePiece* structure, Level* level, BoundingBox* chunkBB) { + int worldX = structure->getWorldX(m_x, m_z); + int worldY = structure->getWorldY(m_y); + int worldZ = structure->getWorldZ(m_x, m_z); - if ( chunkBB->isInside( worldX, worldY, worldZ ) ) - { - if ( level->getTileEntity( worldX, worldY, worldZ ) != NULL ) - { - // Remove the current tile entity - level->removeTileEntity( worldX, worldY, worldZ ); - level->setTile( worldX, worldY, worldZ, 0 ); - } + if (chunkBB->isInside(worldX, worldY, worldZ)) { + if (level->getTileEntity(worldX, worldY, worldZ) != NULL) { + // Remove the current tile entity + level->removeTileEntity(worldX, worldY, worldZ); + level->setTileAndData(worldX, worldY, worldZ, 0, 0, + Tile::UPDATE_ALL); + } - level->setTile( worldX, worldY, worldZ, m_tile ); - std::shared_ptr entity = std::dynamic_pointer_cast(level->getTileEntity( worldX, worldY, worldZ )); + level->setTileAndData(worldX, worldY, worldZ, m_tile, 0, + Tile::UPDATE_ALL); + std::shared_ptr entity = + std::dynamic_pointer_cast( + level->getTileEntity(worldX, worldY, worldZ)); #ifndef _CONTENT_PACKAGE - wprintf(L"XboxStructureActionPlaceSpawner - placing a %ls spawner at (%d,%d,%d)\n", m_entityId.c_str(), worldX, worldY, worldZ); + wprintf( + L"XboxStructureActionPlaceSpawner - placing a %ls spawner at " + L"(%d,%d,%d)\n", + m_entityId.c_str(), worldX, worldY, worldZ); #endif - if( entity != NULL ) - { - entity->setEntityId(m_entityId); - } - return true; - } - return false; + if (entity != NULL) { + entity->setEntityId(m_entityId); + } + return true; + } + return false; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceSpawner.h b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceSpawner.h index 933a467c4..300066c22 100644 --- a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceSpawner.h +++ b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceSpawner.h @@ -7,18 +7,22 @@ class Level; class BoundingBox; class GRFObject; -class XboxStructureActionPlaceSpawner : public XboxStructureActionPlaceBlock -{ +class XboxStructureActionPlaceSpawner : public XboxStructureActionPlaceBlock { private: - std::wstring m_entityId; + std::wstring m_entityId; + public: - XboxStructureActionPlaceSpawner(); - ~XboxStructureActionPlaceSpawner(); + XboxStructureActionPlaceSpawner(); + ~XboxStructureActionPlaceSpawner(); - virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_PlaceSpawner; } - - virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs); - virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); + virtual ConsoleGameRules::EGameRuleType getActionType() { + return ConsoleGameRules::eGameRuleType_PlaceSpawner; + } - bool placeSpawnerInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB); + virtual void writeAttributes(DataOutputStream* dos, unsigned int numAttrs); + virtual void addAttribute(const std::wstring& attributeName, + const std::wstring& attributeValue); + + bool placeSpawnerInLevel(StructurePiece* structure, Level* level, + BoundingBox* chunkBB); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Leaderboards/LeaderboardInterface.cpp b/Minecraft.Client/Platform/Common/Leaderboards/LeaderboardInterface.cpp new file mode 100644 index 000000000..94c320420 --- /dev/null +++ b/Minecraft.Client/Platform/Common/Leaderboards/LeaderboardInterface.cpp @@ -0,0 +1,97 @@ +#include "../../stdafx.h" +#include "LeaderboardInterface.h" + +LeaderboardInterface::LeaderboardInterface(LeaderboardManager* man) { + m_manager = man; + m_pending = false; + + m_filter = (LeaderboardManager::EFilterMode)-1; + m_callback = NULL; + m_difficulty = 0; + m_type = LeaderboardManager::eStatsType_UNDEFINED; + m_startIndex = 0; + m_readCount = 0; + + m_manager->OpenSession(); +} + +LeaderboardInterface::~LeaderboardInterface() { + m_manager->CancelOperation(); + m_manager->CloseSession(); +} + +void LeaderboardInterface::ReadStats_Friends( + LeaderboardReadListener* callback, int difficulty, + LeaderboardManager::EStatsType type, PlayerUID myUID, + unsigned int startIndex, unsigned int readCount) { + m_filter = LeaderboardManager::eFM_Friends; + m_pending = true; + + m_callback = callback; + m_difficulty = difficulty; + m_type = type; + m_myUID = myUID; + m_startIndex = startIndex; + m_readCount = readCount; + + tick(); +} + +void LeaderboardInterface::ReadStats_MyScore( + LeaderboardReadListener* callback, int difficulty, + LeaderboardManager::EStatsType type, PlayerUID myUID, + unsigned int readCount) { + m_filter = LeaderboardManager::eFM_MyScore; + m_pending = true; + + m_callback = callback; + m_difficulty = difficulty; + m_type = type; + m_myUID = myUID; + m_readCount = readCount; + + tick(); +} + +void LeaderboardInterface::ReadStats_TopRank( + LeaderboardReadListener* callback, int difficulty, + LeaderboardManager::EStatsType type, unsigned int startIndex, + unsigned int readCount) { + m_filter = LeaderboardManager::eFM_TopRank; + m_pending = true; + + m_callback = callback; + m_difficulty = difficulty; + m_type = type; + m_startIndex = startIndex; + m_readCount = readCount; + + tick(); +} + +void LeaderboardInterface::CancelOperation() { + m_manager->CancelOperation(); + m_pending = false; +} + +void LeaderboardInterface::tick() { + if (m_pending) m_pending = !callManager(); +} + +bool LeaderboardInterface::callManager() { + switch (m_filter) { + case LeaderboardManager::eFM_Friends: + return m_manager->ReadStats_Friends(m_callback, m_difficulty, + m_type, m_myUID, m_startIndex, + m_readCount); + case LeaderboardManager::eFM_MyScore: + return m_manager->ReadStats_MyScore(m_callback, m_difficulty, + m_type, m_myUID, m_readCount); + case LeaderboardManager::eFM_TopRank: + return m_manager->ReadStats_TopRank( + m_callback, m_difficulty, m_type, m_startIndex, m_readCount); + default: + assert(false); + return true; + } +} \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Leaderboards/LeaderboardInterface.h b/Minecraft.Client/Platform/Common/Leaderboards/LeaderboardInterface.h new file mode 100644 index 000000000..1f9d49b9d --- /dev/null +++ b/Minecraft.Client/Platform/Common/Leaderboards/LeaderboardInterface.h @@ -0,0 +1,40 @@ +#pragma once + +#include "LeaderboardManager.h" + +// 4J-JEV: Simple interface for handling ReadStat failures. +class LeaderboardInterface { +private: + LeaderboardManager* m_manager; + bool m_pending; + + // Arguments. + LeaderboardManager::EFilterMode m_filter; + LeaderboardReadListener* m_callback; + int m_difficulty; + LeaderboardManager::EStatsType m_type; + PlayerUID m_myUID; + unsigned int m_startIndex; + unsigned int m_readCount; + +public: + LeaderboardInterface(LeaderboardManager* man); + ~LeaderboardInterface(); + + void ReadStats_Friends(LeaderboardReadListener* callback, int difficulty, + LeaderboardManager::EStatsType type, PlayerUID myUID, + unsigned int startIndex, unsigned int readCount); + void ReadStats_MyScore(LeaderboardReadListener* callback, int difficulty, + LeaderboardManager::EStatsType type, PlayerUID myUID, + unsigned int readCount); + void ReadStats_TopRank(LeaderboardReadListener* callback, int difficulty, + LeaderboardManager::EStatsType type, + unsigned int startIndex, unsigned int readCount); + + void CancelOperation(); + + void tick(); + +private: + bool callManager(); +}; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Leaderboards/SonyLeaderboardManager.cpp b/Minecraft.Client/Platform/Common/Leaderboards/SonyLeaderboardManager.cpp new file mode 100644 index 000000000..88a4077d9 --- /dev/null +++ b/Minecraft.Client/Platform/Common/Leaderboards/SonyLeaderboardManager.cpp @@ -0,0 +1,1122 @@ +#include "../../stdafx.h" + +#include +#include +// #include + +#include "SonyLeaderboardManager.h" + +#include "base64.h" + +#include "Common/Consoles_App.h" +#include "Common/Network/Sony/SQRNetworkManager.h" + +#include "../../../../Minecraft.World/Util/StringHelpers.h" + +#ifdef __ORBIS__ +#include "Orbis/OrbisExtras/ShutdownManager.h" +#include "Orbis/Orbis_App.h" +#elif defined __PSVITA__ +#include "PSVita/PSVitaExtras/ShutdownManager.h" +#include "PSVita/PSVita_App.h" +#elif defined __PS3__ +#include "PS3/PS3Extras/ShutdownManager.h" +#include "PS3/PS3_App.h" +#else +#error "SonyLeaderboardManager is included for a non-sony platform." +#endif + +SonyLeaderboardManager::SonyLeaderboardManager() { + m_eStatsState = eStatsState_Idle; + + m_titleContext = -1; + + m_myXUID = INVALID_XUID; + + m_scores = NULL; + + m_statsType = eStatsType_Kills; + m_difficulty = 0; + + m_requestId = 0; + + m_openSessions = 0; + + InitializeCriticalSection(&m_csViewsLock); + + m_running = false; + m_threadScoreboard = NULL; +} + +SonyLeaderboardManager::~SonyLeaderboardManager() { + m_running = false; + + // 4J-JEV: Wait for thread to stop and hope it doesn't take too long. + long long startShutdown = System::currentTimeMillis(); + while (m_threadScoreboard->isRunning()) { + Sleep(1); + assert((System::currentTimeMillis() - startShutdown) < 16); + } + + delete m_threadScoreboard; + + DeleteCriticalSection(&m_csViewsLock); +} + +int SonyLeaderboardManager::scoreboardThreadEntry(LPVOID lpParam) { + ShutdownManager::HasStarted(ShutdownManager::eLeaderboardThread); + SonyLeaderboardManager* self = + reinterpret_cast(lpParam); + + self->m_running = true; + app.DebugPrintf("[SonyLeaderboardManager] Thread started.\n"); + + bool needsWriting = false; + do { + if (self->m_openSessions > 0 || needsWriting) { + self->scoreboardThreadInternal(); + } + + EnterCriticalSection(&self->m_csViewsLock); + needsWriting = self->m_views.size() > 0; + LeaveCriticalSection(&self->m_csViewsLock); + + // 4J Stu - We can't write while we aren't signed in to live + if (!ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) { + needsWriting = false; + } + + if ((!needsWriting) && (self->m_eStatsState != eStatsState_Getting)) { + Sleep(50); // 4J-JEV: When we're not reading or writing. + } + + } while ((self->m_running || self->m_eStatsState == eStatsState_Getting || + needsWriting) && + ShutdownManager::ShouldRun(ShutdownManager::eLeaderboardThread)); + + // 4J-JEV, moved this here so setScore can finish up. + self->destroyTitleContext(self->m_titleContext); + + // TODO sceNpScoreTerm(); + app.DebugPrintf("[SonyLeaderboardManager] Thread closed.\n"); + ShutdownManager::HasFinished(ShutdownManager::eLeaderboardThread); + return 0; +} + +void SonyLeaderboardManager::scoreboardThreadInternal() { + // 4J-JEV: Just initialise the context the once now. + if (m_titleContext == -1) { + int primaryPad = ProfileManager.GetPrimaryPad(); + + if (!ProfileManager.IsSignedInLive(primaryPad)) return; + + int ret = initialiseScoreUtility(); + if (ret < 0) { + if (!scoreUtilityAlreadyInitialised(ret)) { + app.DebugPrintf( + "[SonyLeaderboardManager] initialiseScoreUtility() failed. " + "ret = 0x%x\n", + ret); + return; + } else { + app.DebugPrintf( + "[SonyLeaderboardManager] initialiseScoreUtility() already " + "initialised, (0x%x)\n", + ret); + } + } + + SceNpId npId; + ProfileManager.GetSceNpId(primaryPad, &npId); + + ret = createTitleContext(npId); + + if (ret < 0) + return; + else + m_titleContext = ret; + } else + assert(m_titleContext > 0); // Paranoia + + switch (m_eStatsState) { + case eStatsState_Getting: + // Player starts using async multiplayer feature + // 4J-PB - Fix for SCEA FQA #4 - TRC R4064 - Incorrect usage of + // AsyncMultiplay Note 1: The following NP call should be reserved + // for asynchronous multiplayer modes that require PS Plus to be + // accessed. + // + // Note 2: + // The message is not displayed with a user without PlayStation�Plus + // subscription and they are able to access the Leaderboards. + + // NotifyAsyncPlusFeature(); + + switch (m_eFilterMode) { + case eFM_MyScore: + case eFM_Friends: + getScoreByIds(); + break; + case eFM_TopRank: + getScoreByRange(); + break; + } + break; + + case eStatsState_Canceled: + case eStatsState_Failed: + case eStatsState_Ready: + case eStatsState_Idle: + + // 4J-JEV: Moved this here, I don't want reading and + // writing going on at the same time. + // -- + // 4J-JEV: Writing no longer changes the manager state, + // we'll manage the write queue seperately. + + EnterCriticalSection(&m_csViewsLock); + bool hasWork = !m_views.empty(); + LeaveCriticalSection(&m_csViewsLock); + + if (hasWork) { + setScore(); + } + + break; + } +} + +HRESULT SonyLeaderboardManager::fillByIdsQuery(const SceNpId& myNpId, + SceNpId*& npIds, uint32_t& len) { + HRESULT ret; + + // Get queried users. + switch (m_eFilterMode) { + case eFM_Friends: { + // 4J-JEV: Implementation for Orbis & Vita as they a very similar. +#if (defined __ORBIS__) || (defined __PSVITA__) + + sce::Toolkit::NP::Utilities::Future + s_friendList; + ret = getFriendsList(s_friendList); + + if (ret != SCE_TOOLKIT_NP_SUCCESS) { + // Error handling + if (m_eStatsState != eStatsState_Canceled) + m_eStatsState = eStatsState_Failed; + app.DebugPrintf( + "[SonyLeaderboardManager] 'getFriendslist' fail, 0x%x.\n", + ret); + return false; + } else if (s_friendList.hasResult()) { + // 4J-JEV: Friends list doesn't include player, leave space for + // them. + len = s_friendList.get()->size() + 1; + + npIds = new SceNpId[len]; + + int i = 0; + + sce::Toolkit::NP::FriendsList::const_iterator itr; + for (itr = s_friendList.get()->begin(); + itr != s_friendList.get()->end(); itr++) { + npIds[i] = itr->npid; + i++; + } + + npIds[len - 1] = + myNpId; // 4J-JEV: Append player to end of query. + } else { + // 4J-JEV: Something terrible must have happend, + // 'getFriendslist' was supposed to be a synchronous operation. + __debugbreak(); + + // 4J-JEV: We can at least fall-back to just the players score. + len = 1; + npIds = new SceNpId[1]; + + npIds[0] = myNpId; + } + +#elif (defined __PS3__) + // PS3 + + // 4J-JEV: Doesn't include the player (its just their friends). + ret = sceNpBasicGetFriendListEntryCount(&len); + len += 1; + + npIds = new SceNpId[len]; + + for (uint32_t i = 0; i < len - 1; i++) { + ret = sceNpBasicGetFriendListEntry(i, npIds + i); + if (ret < 0) return ret; + } + npIds[len - 1] = myNpId; // 4J-JEV: Append player to end of query. + +#endif + } break; + case eFM_MyScore: { + len = 1; + npIds = new SceNpId[1]; + npIds[0] = myNpId; + } break; + } + + return S_OK; +} + +bool SonyLeaderboardManager::getScoreByIds() { + if (m_eStatsState == eStatsState_Canceled) return false; + + // ---------------------------- + SonyRtcTick last_sort_date; + SceNpScoreRankNumber mTotalRecord; + + SceNpId* npIds = NULL; + + int ret; + uint32_t num = 0; + + SceNpScorePlayerRankData* ptr; + SceNpScoreComment* comments; + // ---------------------------- + + // Check for invalid LManager state. + assert(m_eFilterMode == eFM_Friends || m_eFilterMode == eFM_MyScore); + + SceNpId myNpId; + // 4J-PB - should it be user 0? + if (!ProfileManager.IsSignedInLive(0)) { + app.DebugPrintf( + "[SonyLeaderboardManager] OpenSession() fail: User isn't signed in " + "to PSN\n"); + return false; + } + ProfileManager.GetSceNpId(0, &myNpId); + + ret = fillByIdsQuery(myNpId, npIds, num); +#ifdef __PS3__ + if (ret < 0) goto error2; +#endif + + ptr = new SceNpScorePlayerRankData[num]; + comments = new SceNpScoreComment[num]; + + ZeroMemory(ptr, sizeof(SceNpScorePlayerRankData) * num); + ZeroMemory(comments, sizeof(SceNpScoreComment) * num); + + /* app.DebugPrintf("sceNpScoreGetRankingByNpId(\n\t transaction=%i,\n\t + boardID=0,\n\t npId=%i,\n\t friendCount*sizeof(SceNpId)=%i*%i=%i,\ + rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t NULL, + 0, NULL, 0,\n\t friendCount=%i,\n...\n", transaction, npId, friendCount, + sizeof(SceNpId), friendCount*sizeof(SceNpId), rankData, + friendCount*sizeof(SceNpScorePlayerRankData), friendCount + ); */ + + int boardId = getBoardId(m_difficulty, m_statsType); + + // 4J-JEV: Orbis can only do with 100 ids max, so we use batches. +#ifdef __ORBIS__ + for (int batch = 0; batch < num; batch += 100) { +#endif + ret = createTransactionContext(m_titleContext); + if (m_eStatsState == eStatsState_Canceled) { + // Cancel operation has been called, abort. + app.DebugPrintf( + "[SonyLeaderboardManager]\tgetScoreByIds() - m_eStatsState == " + "eStatsState_Canceled.\n"); + + destroyTransactionContext(ret); + + if (npIds != NULL) delete[] npIds; + if (ptr != NULL) delete[] ptr; + if (comments != NULL) delete[] comments; + + return false; + } else if (ret < 0) { + // Error occurred creating a transacion, abort. + app.DebugPrintf( + "[SonyLeaderboardManager]\tgetScoreByIds() - createTransaction " + "failed, ret=0x%X\n", + ret); + + m_eStatsState = eStatsState_Failed; + + if (npIds != NULL) delete[] npIds; + if (ptr != NULL) delete[] ptr; + if (comments != NULL) delete[] comments; + + return false; + } else { + // Transaction created successfully, continue. + m_requestId = ret; + } + +#ifdef __ORBIS__ + int tmpNum = std::min(num - batch, (unsigned int)100); + app.DebugPrintf( + "[SonyLeaderboardManager]\t Requesting ids %i-%i of %i.\n", batch, + batch + tmpNum, num); +#else + int tmpNum = num; +#endif + ret = sceNpScoreGetRankingByNpId( + m_requestId, + boardId, // BoardId + +#ifdef __ORBIS__ + batch + npIds, sizeof(SceNpId) * tmpNum, // IN: Player IDs + batch + ptr, + sizeof(SceNpScorePlayerRankData) * tmpNum, // OUT: Rank Data + batch + comments, + sizeof(SceNpScoreComment) * tmpNum, // OUT: Comments +#else + npIds, sizeof(SceNpId) * tmpNum, // IN: Player IDs + ptr, sizeof(SceNpScorePlayerRankData) * tmpNum, // OUT: Rank Data + comments, sizeof(SceNpScoreComment) * tmpNum, // OUT: Comments +#endif + + NULL, 0, // GameData. (unused) + + tmpNum, + + &last_sort_date, &mTotalRecord, + + NULL // Reserved, specify null. + ); + + if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) { + ret = destroyTransactionContext(m_requestId); + app.DebugPrintf( + "[SonyLeaderboardManager] getScoreByIds(): " + "'sceNpScoreGetRankingByRange' aborted (0x%X).\n", + ret); + + delete[] ptr; + delete[] comments; + delete[] npIds; + + return false; + } else if (ret == + SCE_NP_COMMUNITY_SERVER_ERROR_GAME_RANKING_NOT_FOUND) { + // 4J-JEV: Keep going, other batches might have scores. + } else if (ret < 0) + goto error3; + + // Return. + destroyTransactionContext(m_requestId); + m_requestId = 0; + +#ifdef __ORBIS__ + } +#endif + + m_readCount = num; + + // Filter scorers and construct output structure. + if (m_scores != NULL) delete[] m_scores; + m_scores = new ReadScore[m_readCount]; + convertToOutput(m_readCount, m_scores, ptr, comments); + m_maxRank = m_readCount; + + app.DebugPrintf( + "[SonyLeaderboardManager] getScoreByIds(), Success!\n" + "\t Board %i\n" + "\t %i of %i results have an entry\n" + "1stScore=%i\n", + boardId, m_readCount, num, ptr->rankData.scoreValue); + + // Sort scores + std::sort(m_scores, m_scores + m_readCount, SortByRank); + + delete[] ptr; + delete[] comments; + delete[] npIds; + + m_eStatsState = eStatsState_Ready; + return true; + + // Error. +error3: + if (ret != SCE_NP_COMMUNITY_ERROR_ABORTED) // 0x8002a109 + destroyTransactionContext(m_requestId); + m_requestId = 0; + delete[] ptr; + delete[] comments; +error2: + if (npIds != NULL) delete[] npIds; +error1: + if (m_eStatsState != eStatsState_Canceled) + m_eStatsState = eStatsState_Failed; + app.DebugPrintf( + "[SonyLeaderboardManager] getScoreByIds() FAILED, ret=0x%X\n", ret); + return false; +} + +bool SonyLeaderboardManager::getScoreByRange() { + SonyRtcTick last_sort_date; + SceNpScoreRankNumber mTotalRecord; + + unsigned int num = m_readCount; + SceNpScoreRankData* ptr; + SceNpScoreComment* comments; + + assert(m_eFilterMode == eFM_TopRank); + + int ret = createTransactionContext(m_titleContext); + if (m_eStatsState == eStatsState_Canceled) { + // Cancel operation has been called, abort. + app.DebugPrintf( + "[SonyLeaderboardManager]\tgetScoreByRange() - m_eStatsState == " + "eStatsState_Canceled.\n"); + destroyTransactionContext(ret); + return false; + } else if (ret < 0) { + // Error occurred creating a transaction, abort. + m_eStatsState = eStatsState_Failed; + app.DebugPrintf( + "[SonyLeaderboardManager]\tgetScoreByRange() - createTransaction " + "failed, ret=0x%X\n", + ret); + return false; + } else { + // Transaction created successfully, continue. + m_requestId = ret; + } + + ptr = new SceNpScoreRankData[num]; + comments = new SceNpScoreComment[num]; + + int boardId = getBoardId(m_difficulty, m_statsType); + ret = sceNpScoreGetRankingByRange( + m_requestId, + boardId, // BoardId + + m_startIndex, + + ptr, sizeof(SceNpScoreRankData) * num, // OUT: Rank Data + + comments, sizeof(SceNpScoreComment) * num, // OUT: Comment Data + + NULL, 0, // GameData. + + num, + + &last_sort_date, + &m_maxRank, // 'Total number of players registered in the target + // scoreboard.' + + NULL // Reserved, specify null. + ); + + if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) { + ret = destroyTransactionContext(m_requestId); + app.DebugPrintf( + "[SonyLeaderboardManager] getScoreByRange(): " + "'sceNpScoreGetRankingByRange' aborted (0x%X).\n", + ret); + + delete[] ptr; + delete[] comments; + + return false; + } else if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_GAME_RANKING_NOT_FOUND) { + ret = destroyTransactionContext(m_requestId); + app.DebugPrintf( + "[SonyLeaderboardManager] getScoreByRange(): Game ranking not " + "found."); + + delete[] ptr; + delete[] comments; + + m_scores = NULL; + m_readCount = 0; + + m_eStatsState = eStatsState_Ready; + return false; + } else if (ret < 0) + goto error2; + else { + app.DebugPrintf( + "[SonyLeaderboardManager] getScoreByRange(), success, " + "1stScore=%i.\n", + ptr->scoreValue); + } + + // Return. + destroyTransactionContext(m_requestId); + m_requestId = 0; + + // m_stats = ptr; //Maybe: addPadding(num,ptr); + + if (m_scores != NULL) delete[] m_scores; + m_readCount = ret; + m_scores = new ReadScore[m_readCount]; + for (int i = 0; i < m_readCount; i++) { + // memcpy(m_scores+i, ptr+i, sizeof(SceNpScoreRankData)); + initReadScoreStruct(m_scores[i], ptr[i]); + // fromBase32(m_scores+i, comments+i); + fillReadScoreStruct(m_scores[i], comments[i]); + } + + m_eStatsState = eStatsState_Ready; + return true; + + // Error. +error2: + if (ret != SCE_NP_COMMUNITY_ERROR_ABORTED) // 0x8002a109 + destroyTransactionContext(m_requestId); + m_requestId = 0; + + delete[] ptr; + delete[] comments; +error1: + if (m_eStatsState != eStatsState_Canceled) + m_eStatsState = eStatsState_Failed; + app.DebugPrintf( + "[SonyLeaderboardManager]\tgetScoreByRange() failed, ret=0x%X\n", ret); + return false; +} + +bool SonyLeaderboardManager::setScore() { + int ret; + SceNpId npId; + int32_t writeTitleContext = 0; + SceNpScoreRankNumber tmp = 0; + SceNpScoreComment comment; + + // Get next job. + + EnterCriticalSection(&m_csViewsLock); + RegisterScore rscore = m_views.front(); + m_views.pop(); + LeaveCriticalSection(&m_csViewsLock); + + if (ProfileManager.IsGuest(rscore.m_iPad)) { + app.DebugPrintf( + "[SonyLeaderboardManager] setScore(): m_iPad[%i] is guest.\n", + rscore.m_iPad); + return true; + } + + ProfileManager.GetSceNpId(rscore.m_iPad, &npId); + writeTitleContext = createTitleContext(npId); + if (writeTitleContext < 0) { + app.DebugPrintf( + "[SonyLeaderboardManager] setScore(): sceNpScoreCreateTitleCtx " + "FAILED, ret == %X.\n", + ret); + return false; + } + + ret = createTransactionContext(writeTitleContext); + + // Start emptying queue if leaderboards has been closed. + if (ret == SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED) { + EnterCriticalSection(&m_csViewsLock); + m_views.pop(); + LeaveCriticalSection(&m_csViewsLock); + } + + // Error handling. + if (ret < 0) { + app.DebugPrintf( + "[SonyLeaderboardManager] setScore() FAILED, ret=0x%X\n", ret); + destroyTitleContext(writeTitleContext); + return false; + } + m_requestId = ret; + + toBase32(&comment, (void*)&rscore.m_commentData); + + int boardId = + getBoardId(rscore.m_difficulty, rscore.m_commentData.m_statsType); + ret = sceNpScoreRecordScore(m_requestId, // transId, + boardId, // boardId, + rscore.m_score, // IN: new score, + + &comment, // Comments + NULL, // GameInfo + + &tmp, // OUT: current rank, + +#ifndef __PS3__ + NULL, // compareDate +#endif + + NULL // Reserved, specify null. + ); + + if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_NOT_BEST_SCORE) // 0x8002A415 + { + app.DebugPrintf( + "[SonyLeaderboardManager] setScore(), doesn't beat current score, " + "%i.\n", + tmp); + } else if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) { + goto error1; // 0x8002a109 + } else if (ret < 0) { + goto error2; + } else { + app.DebugPrintf( + "[SonyLeaderboardManager] setScore(), success. boardId=%i, " + "score=%i\n", + boardId, rscore.m_score); + } + + // Return. + destroyTransactionContext(m_requestId); + m_requestId = 0; + // m_eStatsState = eStatsState_Idle; + return true; + + // Error. +error2: + destroyTransactionContext(m_requestId); + m_requestId = 0; + +error1: + app.DebugPrintf("[SonyLeaderboardManager] setScore() FAILED, ret=0x%X\n", + ret); + destroyTitleContext(writeTitleContext); + return false; +} + +void SonyLeaderboardManager::Tick() { + ReadView view; + + switch (m_eStatsState) { + case eStatsState_Ready: { + assert(m_scores != NULL || m_readCount == 0); + + view.m_numQueries = m_readCount; + view.m_queries = m_scores; + + // 4J-JEV: Debugging. + // LeaderboardManager::printStats(view); + + eStatsReturn ret = eStatsReturn_NoResults; + if (view.m_numQueries > 0) ret = eStatsReturn_Success; + + if (m_readListener != NULL) { + app.DebugPrintf( + "[SonyLeaderboardManager] OnStatsReadComplete(%i, %i, _), " + "m_readCount=%i.\n", + ret, m_maxRank, m_readCount); + m_readListener->OnStatsReadComplete(ret, m_maxRank, view); + } + + m_eStatsState = eStatsState_Idle; + + delete[] m_scores; + m_scores = NULL; + } break; + + case eStatsState_Failed: { + view.m_numQueries = 0; + view.m_queries = NULL; + + if (m_readListener != NULL) + m_readListener->OnStatsReadComplete(eStatsReturn_NetworkError, + 0, view); + + m_eStatsState = eStatsState_Idle; + } break; + + case eStatsState_Canceled: { + m_eStatsState = eStatsState_Idle; + } break; + + default: // Getting or Idle. + break; + } +} + +bool SonyLeaderboardManager::OpenSession() { + if (m_openSessions == 0) { + if (m_threadScoreboard == NULL) { + m_threadScoreboard = + new C4JThread(&scoreboardThreadEntry, this, "4JScoreboard"); + m_threadScoreboard->SetProcessor(CPU_CORE_LEADERBOARDS); + m_threadScoreboard->SetPriority(THREAD_PRIORITY_BELOW_NORMAL); + m_threadScoreboard->Run(); + } + + app.DebugPrintf( + "[SonyLeaderboardManager] OpenSession(): Starting sceNpScore " + "utility.\n"); + } else { + app.DebugPrintf( + "[SonyLeaderboardManager] OpenSession(): Another session opened, " + "total=%i\n", + m_openSessions + 1); + } + + m_openSessions++; + return true; +} + +void SonyLeaderboardManager::CloseSession() { + m_openSessions--; + + if (m_openSessions == 0) + app.DebugPrintf( + "[SonyLeaderboardManager] CloseSession(): Quitting sceNpScore " + "utility.\n"); + else + app.DebugPrintf( + "[SonyLeaderboardManager] CloseSession(): %i sessions still " + "open.\n", + m_openSessions); +} + +void SonyLeaderboardManager::DeleteSession() {} + +bool SonyLeaderboardManager::WriteStats(unsigned int viewCount, ViewIn views) { + // Need to cancel read/write operation first. + // if (m_eStatsState != eStatsState_Idle) return false; + + // Write relevant parameters. + // RegisterScore *regScore = reinterpret_cast(views); + + EnterCriticalSection(&m_csViewsLock); + for (int i = 0; i < viewCount; i++) { + app.DebugPrintf( + "[SonyLeaderboardManager] WriteStats(), starting. difficulty=%i, " + "statsType=%i, score=%i\n", + views[i].m_difficulty, views[i].m_commentData.m_statsType, + views[i].m_score); + + m_views.push(views[i]); + } + LeaveCriticalSection(&m_csViewsLock); + + delete[] views; //*regScore; + + // m_eStatsState = eStatsState_Writing; + return true; +} + +// myUID ignored on PS3. +bool SonyLeaderboardManager::ReadStats_Friends( + LeaderboardReadListener* listener, int difficulty, EStatsType type, + PlayerUID myUID, unsigned int startIndex, unsigned int readCount) { + // Need to cancel read/write operation first. + if (m_eStatsState != eStatsState_Idle) return false; + if (!LeaderboardManager::ReadStats_Friends(listener, difficulty, type, + myUID, startIndex, readCount)) + return false; + + m_eStatsState = eStatsState_Getting; + return true; +} + +// myUID ignored on PS3. +bool SonyLeaderboardManager::ReadStats_MyScore( + LeaderboardReadListener* listener, int difficulty, EStatsType type, + PlayerUID myUID, unsigned int readCount) { + // Need to cancel read/write operation first. + if (m_eStatsState != eStatsState_Idle) return false; + if (!LeaderboardManager::ReadStats_MyScore(listener, difficulty, type, + myUID, readCount)) + return false; + + m_eStatsState = eStatsState_Getting; + return true; +} + +// myUID ignored on PS3. +bool SonyLeaderboardManager::ReadStats_TopRank( + LeaderboardReadListener* listener, int difficulty, EStatsType type, + unsigned int startIndex, unsigned int readCount) { + // Need to cancel read/write operation first. + if (m_eStatsState != eStatsState_Idle) return false; + if (!LeaderboardManager::ReadStats_TopRank(listener, difficulty, type, + startIndex, readCount)) + return false; + + m_eStatsState = eStatsState_Getting; + return true; +} + +void SonyLeaderboardManager::FlushStats() {} + +void SonyLeaderboardManager::CancelOperation() { + m_readListener = NULL; + m_eStatsState = eStatsState_Canceled; + + if (m_requestId != 0) { + int ret = abortTransactionContext(m_requestId); + if (ret < 0) + app.DebugPrintf( + "[SonyLeaderboardManager] CancelOperation(): Problem " + "encountered aborting current operation, 0x%X.\n", + ret); + else + app.DebugPrintf( + "[SonyLeaderboardManager] CancelOperation(): Operation aborted " + "successfully.\n"); + } else { + app.DebugPrintf( + "[SonyLeaderboardManager] CancelOperation(): No current " + "operation.\n"); + } +} + +bool SonyLeaderboardManager::isIdle() { + return m_eStatsState == eStatsState_Idle; +} + +int SonyLeaderboardManager::getBoardId(int difficulty, EStatsType statsType) { + switch (statsType) { + case eStatsType_Travelling: + if (0 <= difficulty && difficulty < 4) + return 1 + difficulty; // [1,2,3,4] + else + return -1; + + case eStatsType_Mining: + if (0 <= difficulty && difficulty < 4) + return 5 + difficulty; // [5,6,7,8] + else + return -1; + + case eStatsType_Farming: + if (0 <= difficulty && difficulty < 4) + return 9 + difficulty; // [9,10,11,12] + else + return -1; + + case eStatsType_Kills: + if (1 <= difficulty && difficulty < 4) + return 13 + difficulty - 1; // [13,14,15,16] + else + return -1; + + default: + return -1; + } +} + +// 4J-JEV: Filter out all friends who don't have scores. +/* +SceNpScoreRankData *SonyLeaderboardManager::filterJustScorers(unsigned int &num, +SceNpScorePlayerRankData *friendsData) +{ +int num2 = 0; +for (int i=0; i> (8 - dIndex); + + fivebits = (fivebits >> 3) & 0x1F; + + if (fivebits < 10) // 0 - 9 + chars[i] = '0' + fivebits; + else if (fivebits < 32) // A - V + chars[i] = 'A' + (fivebits - 10); + else + assert(false); + } + + toSymbols(getComment(out)); +} + +void SonyLeaderboardManager::fromBase32(void* out, SceNpScoreComment* in) { + PBYTE bytes = (PBYTE)out; + ZeroMemory(bytes, RECORD_SIZE); + + fromSymbols(getComment(in)); + + char ch[2] = {0, 0}; + for (int i = 0; i < SCE_NP_SCORE_COMMENT_MAXLEN; i++) { + ch[0] = getComment(in)[i]; + unsigned char fivebits = strtol(ch, NULL, 32) << 3; + + int sByte = (i * 5) / 8; + int eByte = (5 + (i * 5)) / 8; + int dIndex = (i * 5) % 8; + + *(bytes + sByte) = *(bytes + sByte) | (fivebits >> dIndex); + + if (eByte != sByte) *(bytes + eByte) = fivebits << (8 - dIndex); + } +} + +char symbBase32[32] = {' ', '!', '\"', '#', '$', '%', '&', '\'', '(', ')', '*', + '+', '`', '-', '.', '/', ':', ';', '<', '=', '>', '?', + '[', '\\', ']', '^', '_', '{', '|', '}', '~', '@'}; + +char charBase32[32] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', + 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', + 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V'}; + +void SonyLeaderboardManager::toSymbols(char* str) { + for (int i = 0; i < 63; i++) { + for (int j = 0; j < 32; j++) { + if (str[i] == charBase32[j]) str[i] = symbBase32[j]; + } + } +} + +void SonyLeaderboardManager::fromSymbols(char* str) { + for (int i = 0; i < 63; i++) { + for (int j = 0; j < 32; j++) { + if (str[i] == symbBase32[j]) str[i] = charBase32[j]; + } + } +} + +bool SonyLeaderboardManager::test_string(std::string testing) { +#ifndef _CONTENT_PACKAGE + static SceNpScoreComment comment; + ZeroMemory(&comment, sizeof(SceNpScoreComment)); + memcpy(&comment, testing.c_str(), SCE_NP_SCORE_COMMENT_MAXLEN); + + int ctx = createTransactionContext(m_titleContext); + if (ctx < 0) return false; + + int ret = sceNpScoreCensorComment(ctx, (const char*)&comment, NULL); + + if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED) { + app.DebugPrintf("\n[TEST_STRING]: REJECTED "); + } else if (ret < 0) { + destroyTransactionContext(ctx); + return false; + } else { + app.DebugPrintf("\n[TEST_STRING]: permitted "); + } + + app.DebugPrintf("'%s'\n", getComment(&comment)); + destroyTransactionContext(ctx); + return true; +#else + return true; +#endif +} + +void SonyLeaderboardManager::initReadScoreStruct(ReadScore& out, + SceNpScoreRankData& rankData) { + ZeroMemory(&out, sizeof(ReadScore)); + + // Init rank and onlineID + out.m_uid.setOnlineID(rankData.npId.handle, true); + out.m_rank = rankData.rank; + + // Convert to std::wstring and copy name. + std::wstring wstrName = + convStringToWstring(std::string(rankData.npId.handle.data)).c_str(); + // memcpy(&out.m_name, wstrName.c_str(), XUSER_NAME_SIZE); + out.m_name = wstrName; +} + +void SonyLeaderboardManager::fillReadScoreStruct(ReadScore& out, + SceNpScoreComment& comment) { + StatsData statsData; + fromBase32((void*)&statsData, &comment); + + switch (statsData.m_statsType) { + case eStatsType_Farming: + out.m_statsSize = 6; + out.m_statsData[0] = statsData.m_farming.m_eggs; + out.m_statsData[1] = statsData.m_farming.m_wheat; + out.m_statsData[2] = statsData.m_farming.m_mushroom; + out.m_statsData[3] = statsData.m_farming.m_sugarcane; + out.m_statsData[4] = statsData.m_farming.m_milk; + out.m_statsData[5] = statsData.m_farming.m_pumpkin; + break; + case eStatsType_Mining: + out.m_statsSize = 7; + out.m_statsData[0] = statsData.m_mining.m_dirt; + out.m_statsData[1] = statsData.m_mining.m_cobblestone; + out.m_statsData[2] = statsData.m_mining.m_sand; + out.m_statsData[3] = statsData.m_mining.m_stone; + out.m_statsData[4] = statsData.m_mining.m_gravel; + out.m_statsData[5] = statsData.m_mining.m_clay; + out.m_statsData[6] = statsData.m_mining.m_obsidian; + break; + case eStatsType_Kills: + out.m_statsSize = 7; + out.m_statsData[0] = statsData.m_kills.m_zombie; + out.m_statsData[1] = statsData.m_kills.m_skeleton; + out.m_statsData[2] = statsData.m_kills.m_creeper; + out.m_statsData[3] = statsData.m_kills.m_spider; + out.m_statsData[4] = statsData.m_kills.m_spiderJockey; + out.m_statsData[5] = statsData.m_kills.m_zombiePigman; + out.m_statsData[6] = statsData.m_kills.m_slime; + break; + case eStatsType_Travelling: + out.m_statsSize = 4; + out.m_statsData[0] = statsData.m_travelling.m_walked; + out.m_statsData[1] = statsData.m_travelling.m_fallen; + out.m_statsData[2] = statsData.m_travelling.m_minecart; + out.m_statsData[3] = statsData.m_travelling.m_boat; + break; + } +} + +bool SonyLeaderboardManager::SortByRank(const ReadScore& lhs, + const ReadScore& rhs) { + return lhs.m_rank < rhs.m_rank; +} diff --git a/Minecraft.Client/Platform/Common/Leaderboards/SonyLeaderboardManager.h b/Minecraft.Client/Platform/Common/Leaderboards/SonyLeaderboardManager.h new file mode 100644 index 000000000..79e7ecf3c --- /dev/null +++ b/Minecraft.Client/Platform/Common/Leaderboards/SonyLeaderboardManager.h @@ -0,0 +1,145 @@ +#pragma once + +#include "Common/Leaderboards/LeaderboardManager.h" + +#ifdef __PS3__ +typedef CellRtcTick SonyRtcTick; +#else +typedef SceRtcTick SonyRtcTick; +#endif + +class SonyLeaderboardManager : public LeaderboardManager { +protected: + enum EStatsState { + eStatsState_Idle, + eStatsState_Getting, + eStatsState_Failed, + eStatsState_Ready, + eStatsState_Canceled, + eStatsState_Max + }; + +public: + SonyLeaderboardManager(); + virtual ~SonyLeaderboardManager(); + +protected: + unsigned short m_openSessions; + + C4JThread* m_threadScoreboard; + bool m_running; + + int m_titleContext; + int32_t m_requestId; + + // SceNpId m_myNpId; + + static int scoreboardThreadEntry(LPVOID lpParam); + void scoreboardThreadInternal(); + + virtual bool getScoreByIds(); + virtual bool getScoreByRange(); + + virtual bool setScore(); + + std::queue m_views; + + CRITICAL_SECTION m_csViewsLock; + + EStatsState m_eStatsState; // State of the stats read + // EFilterMode m_eFilterMode; + + ReadScore* m_scores; + unsigned int m_maxRank; + // SceNpScoreRankData *m_stats; + +public: + virtual void Tick(); + + // Open a session + virtual bool OpenSession(); + + // Close a session + virtual void CloseSession(); + + // Delete a session + virtual void DeleteSession(); + + // Write the given stats + // This is called synchronously and will not free any memory allocated for + // views when it is done + + virtual bool WriteStats(unsigned int viewCount, ViewIn views); + + virtual bool ReadStats_Friends(LeaderboardReadListener* callback, + int difficulty, EStatsType type, + PlayerUID myUID, unsigned int startIndex, + unsigned int readCount); + virtual bool ReadStats_MyScore(LeaderboardReadListener* callback, + int difficulty, EStatsType type, + PlayerUID myUID, unsigned int readCount); + virtual bool ReadStats_TopRank(LeaderboardReadListener* callback, + int difficulty, EStatsType type, + unsigned int startIndex, + unsigned int readCount); + + // Perform a flush of the stats + virtual void FlushStats(); + + // Cancel the current operation + virtual void CancelOperation(); + + // Is the leaderboard manager idle. + virtual bool isIdle(); + +protected: + int getBoardId(int difficulty, EStatsType); + + SceNpScorePlayerRankData* addPadding(unsigned int num, + SceNpScoreRankData* rankData); + + void convertToOutput(unsigned int& num, ReadScore* out, + SceNpScorePlayerRankData* rankData, + SceNpScoreComment* comm); + + void toBinary(void* out, SceNpScoreComment* in); + void fromBinary(SceNpScoreComment** out, void* in); + + void toBase32(SceNpScoreComment* out, void* in); + void fromBase32(void* out, SceNpScoreComment* in); + + void toSymbols(char*); + void fromSymbols(char*); + + bool test_string(std::string); + + void initReadScoreStruct(ReadScore& out, SceNpScoreRankData&); + void fillReadScoreStruct(ReadScore& out, SceNpScoreComment& comment); + + static bool SortByRank(const ReadScore& lhs, const ReadScore& rhs); + +protected: + // 4J-JEV: Interface differences: + + // Sce NP score library function redirects. + virtual HRESULT initialiseScoreUtility() { return ERROR_SUCCESS; } + virtual bool scoreUtilityAlreadyInitialised(HRESULT hr) { return false; } + + virtual HRESULT createTitleContext(const SceNpId& npId) = 0; + virtual HRESULT destroyTitleContext(int titleContext) = 0; + + virtual HRESULT createTransactionContext(int titleContext) = 0; + virtual HRESULT abortTransactionContext(int transactionContext) = 0; + virtual HRESULT destroyTransactionContext(int transactionContext) = 0; + + virtual HRESULT fillByIdsQuery(const SceNpId& myNpId, SceNpId*& npIds, + uint32_t& len); + +#if (defined __ORBIS__) || (defined __PSVITA__) + virtual HRESULT getFriendsList( + sce::Toolkit::NP::Utilities::Future& + friendsList) = 0; +#endif + + virtual char* getComment(SceNpScoreComment* comment) = 0; +}; diff --git a/Minecraft.Client/Platform/Common/Leaderboards/base64.cpp b/Minecraft.Client/Platform/Common/Leaderboards/base64.cpp new file mode 100644 index 000000000..de32488bc --- /dev/null +++ b/Minecraft.Client/Platform/Common/Leaderboards/base64.cpp @@ -0,0 +1,283 @@ + +/* + base64.cpp and base64.h + + base64 encoding and decoding with C++. + More information at + https://renenyffenegger.ch/notes/development/Base64/Encoding-and-decoding-base-64-with-cpp + + Version: 2.rc.09 (release candidate) + + Copyright (C) 2004-2017, 2020-2022 René Nyffenegger + + This source code is provided 'as-is', without any express or implied + warranty. In no event will the author be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this source code must not be misrepresented; you must not + claim that you wrote the original source code. If you use this source code + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original source code. + + 3. This notice may not be removed or altered from any source distribution. + + René Nyffenegger rene.nyffenegger@adp-gmbh.ch + +*/ + +#include "base64.h" + +#include +#include + + // + // Depending on the url parameter in base64_chars, one of + // two sets of base64 characters needs to be chosen. + // They differ in their last two characters. + // +static const char* base64_chars[2] = { + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789" + "+/", + + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789" + "-_"}; + +static unsigned int pos_of_char(const unsigned char chr) { + // + // Return the position of chr within base64_encode() + // + + if (chr >= 'A' && chr <= 'Z') return chr - 'A'; + else if (chr >= 'a' && chr <= 'z') return chr - 'a' + ('Z' - 'A') + 1; + else if (chr >= '0' && chr <= '9') return chr - '0' + ('Z' - 'A') + ('z' - 'a') + 2; + else if (chr == '+' || chr == '-') return 62; // Be liberal with input and accept both url ('-') and non-url ('+') base 64 characters ( + else if (chr == '/' || chr == '_') return 63; // Ditto for '/' and '_' + else + // + // 2020-10-23: Throw std::exception rather than const char* + //(Pablo Martin-Gomez, https://github.com/Bouska) + // + throw std::runtime_error("Input is not valid base64-encoded data."); +} + +static std::string insert_linebreaks(std::string str, size_t distance) { + // + // Provided by https://github.com/JomaCorpFX, adapted by me. + // + if (!str.length()) { + return ""; + } + + size_t pos = distance; + + while (pos < str.size()) { + str.insert(pos, "\n"); + pos += distance + 1; + } + + return str; +} + +template +static std::string encode_with_line_breaks(String s) { + return insert_linebreaks(base64_encode(s, false), line_length); +} + +template +static std::string encode_pem(String s) { + return encode_with_line_breaks(s); +} + +template +static std::string encode_mime(String s) { + return encode_with_line_breaks(s); +} + +template +static std::string encode(String s, bool url) { + return base64_encode(reinterpret_cast(s.data()), s.length(), url); +} + +std::string base64_encode(unsigned char const* bytes_to_encode, size_t in_len, bool url) { + + size_t len_encoded = (in_len +2) / 3 * 4; + + unsigned char trailing_char = url ? '.' : '='; + + // + // Choose set of base64 characters. They differ + // for the last two positions, depending on the url + // parameter. + // A bool (as is the parameter url) is guaranteed + // to evaluate to either 0 or 1 in C++ therefore, + // the correct character set is chosen by subscripting + // base64_chars with url. + // + const char* base64_chars_ = base64_chars[url]; + + std::string ret; + ret.reserve(len_encoded); + + unsigned int pos = 0; + + while (pos < in_len) { + ret.push_back(base64_chars_[(bytes_to_encode[pos + 0] & 0xfc) >> 2]); + + if (pos+1 < in_len) { + ret.push_back(base64_chars_[((bytes_to_encode[pos + 0] & 0x03) << 4) + ((bytes_to_encode[pos + 1] & 0xf0) >> 4)]); + + if (pos+2 < in_len) { + ret.push_back(base64_chars_[((bytes_to_encode[pos + 1] & 0x0f) << 2) + ((bytes_to_encode[pos + 2] & 0xc0) >> 6)]); + ret.push_back(base64_chars_[ bytes_to_encode[pos + 2] & 0x3f]); + } + else { + ret.push_back(base64_chars_[(bytes_to_encode[pos + 1] & 0x0f) << 2]); + ret.push_back(trailing_char); + } + } + else { + + ret.push_back(base64_chars_[(bytes_to_encode[pos + 0] & 0x03) << 4]); + ret.push_back(trailing_char); + ret.push_back(trailing_char); + } + + pos += 3; + } + + + return ret; +} + +template +static std::string decode(String const& encoded_string, bool remove_linebreaks) { + // + // decode(…) is templated so that it can be used with String = const std::string& + // or std::string_view (requires at least C++17) + // + + if (encoded_string.empty()) return std::string(); + + if (remove_linebreaks) { + + std::string copy(encoded_string); + + copy.erase(std::remove(copy.begin(), copy.end(), '\n'), copy.end()); + + return base64_decode(copy, false); + } + + size_t length_of_string = encoded_string.length(); + size_t pos = 0; + + // + // The approximate length (bytes) of the decoded string might be one or + // two bytes smaller, depending on the amount of trailing equal signs + // in the encoded string. This approximation is needed to reserve + // enough space in the string to be returned. + // + size_t approx_length_of_decoded_string = length_of_string / 4 * 3; + std::string ret; + ret.reserve(approx_length_of_decoded_string); + + while (pos < length_of_string) { + // + // Iterate over encoded input string in chunks. The size of all + // chunks except the last one is 4 bytes. + // + // The last chunk might be padded with equal signs or dots + // in order to make it 4 bytes in size as well, but this + // is not required as per RFC 2045. + // + // All chunks except the last one produce three output bytes. + // + // The last chunk produces at least one and up to three bytes. + // + + size_t pos_of_char_1 = pos_of_char(encoded_string.at(pos+1) ); + + // + // Emit the first output byte that is produced in each chunk: + // + ret.push_back(static_cast( ( (pos_of_char(encoded_string.at(pos+0)) ) << 2 ) + ( (pos_of_char_1 & 0x30 ) >> 4))); + + if ( ( pos + 2 < length_of_string ) && // Check for data that is not padded with equal signs (which is allowed by RFC 2045) + encoded_string.at(pos+2) != '=' && + encoded_string.at(pos+2) != '.' // accept URL-safe base 64 strings, too, so check for '.' also. + ) + { + // + // Emit a chunk's second byte (which might not be produced in the last chunk). + // + unsigned int pos_of_char_2 = pos_of_char(encoded_string.at(pos+2) ); + ret.push_back(static_cast( (( pos_of_char_1 & 0x0f) << 4) + (( pos_of_char_2 & 0x3c) >> 2))); + + if ( ( pos + 3 < length_of_string ) && + encoded_string.at(pos+3) != '=' && + encoded_string.at(pos+3) != '.' + ) + { + // + // Emit a chunk's third byte (which might not be produced in the last chunk). + // + ret.push_back(static_cast( ( (pos_of_char_2 & 0x03 ) << 6 ) + pos_of_char(encoded_string.at(pos+3)) )); + } + } + + pos += 4; + } + + return ret; +} + +std::string base64_decode(std::string const& s, bool remove_linebreaks) { + return decode(s, remove_linebreaks); +} + +std::string base64_encode(std::string const& s, bool url) { + return encode(s, url); +} + +std::string base64_encode_pem (std::string const& s) { + return encode_pem(s); +} + +std::string base64_encode_mime(std::string const& s) { + return encode_mime(s); +} + +#if __cplusplus >= 201703L +// +// Interface with std::string_view rather than const std::string& +// Requires C++17 +// Provided by Yannic Bonenberger (https://github.com/Yannic) +// + +std::string base64_encode(std::string_view s, bool url) { + return encode(s, url); +} + +std::string base64_encode_pem(std::string_view s) { + return encode_pem(s); +} + +std::string base64_encode_mime(std::string_view s) { + return encode_mime(s); +} + +std::string base64_decode(std::string_view s, bool remove_linebreaks) { + return decode(s, remove_linebreaks); +} + +#endif // __cplusplus >= 201703L diff --git a/Minecraft.Client/Platform/Common/Leaderboards/base64.h b/Minecraft.Client/Platform/Common/Leaderboards/base64.h new file mode 100644 index 000000000..052cea5a3 --- /dev/null +++ b/Minecraft.Client/Platform/Common/Leaderboards/base64.h @@ -0,0 +1,35 @@ +// +// base64 encoding and decoding with C++. +// Version: 2.rc.09 (release candidate) +// + +#ifndef BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A +#define BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A + +#include + +#if __cplusplus >= 201703L +#include +#endif // __cplusplus >= 201703L + +std::string base64_encode (std::string const& s, bool url = false); +std::string base64_encode_pem (std::string const& s); +std::string base64_encode_mime(std::string const& s); + +std::string base64_decode(std::string const& s, bool remove_linebreaks = false); +std::string base64_encode(unsigned char const*, size_t len, bool url = false); + +#if __cplusplus >= 201703L +// +// Interface with std::string_view rather than const std::string& +// Requires C++17 +// Provided by Yannic Bonenberger (https://github.com/Yannic) +// +std::string base64_encode (std::string_view s, bool url = false); +std::string base64_encode_pem (std::string_view s); +std::string base64_encode_mime(std::string_view s); + +std::string base64_decode(std::string_view s, bool remove_linebreaks = false); +#endif // __cplusplus >= 201703L + +#endif /* BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A */ \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp index 2948e1297..625b526e7 100644 --- a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp @@ -6,6 +6,7 @@ #include "../../Minecraft.World/Util/ThreadName.h" #include "../../Minecraft.World/Entities/Entity.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.tile.h" +#include "../../Minecraft.World/Recipes/FireworksRecipe.h" #include "../../Minecraft.Client/Network/ClientConnection.h" #include "../../Minecraft.Client/Minecraft.h" #include "../../Minecraft.Client/Player/User.h" @@ -40,1738 +41,1923 @@ #include "../../Minecraft.World/Stats/DurangoStats.h" #endif -#define WAIT_TIMEOUT 258 - // Global instance CGameNetworkManager g_NetworkManager; -CPlatformNetworkManager *CGameNetworkManager::s_pPlatformNetworkManager; +CPlatformNetworkManager* CGameNetworkManager::s_pPlatformNetworkManager; -__int64 CGameNetworkManager::messageQueue[512]; -__int64 CGameNetworkManager::byteQueue[512]; +int64_t CGameNetworkManager::messageQueue[512]; +int64_t CGameNetworkManager::byteQueue[512]; int CGameNetworkManager::messageQueuePos = 0; -CGameNetworkManager::CGameNetworkManager() -{ - m_bInitialised = false; - m_bLastDisconnectWasLostRoomOnly = false; - m_bFullSessionMessageOnNextSessionChange = false; +CGameNetworkManager::CGameNetworkManager() { + m_bInitialised = false; + m_bLastDisconnectWasLostRoomOnly = false; + m_bFullSessionMessageOnNextSessionChange = false; #ifdef __ORBIS__ - m_pUpsell = NULL; - m_pInviteInfo = NULL; + m_pUpsell = NULL; + m_pInviteInfo = NULL; #endif } -void CGameNetworkManager::Initialise() -{ - ServerStoppedCreate( false ); - ServerReadyCreate( false ); - int flagIndexSize = LevelRenderer::getGlobalChunkCount() / (Level::maxBuildHeight / 16); // dividing here by number of renderer chunks in one column +void CGameNetworkManager::Initialise() { + ServerStoppedCreate(false); + ServerReadyCreate(false); + int flagIndexSize = + LevelRenderer::getGlobalChunkCount() / + (Level::maxBuildHeight / + 16); // dividing here by number of renderer chunks in one column #ifdef _XBOX - s_pPlatformNetworkManager = new CPlatformNetworkManagerXbox(); + s_pPlatformNetworkManager = new CPlatformNetworkManagerXbox(); #elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ - s_pPlatformNetworkManager = new CPlatformNetworkManagerSony(); + s_pPlatformNetworkManager = new CPlatformNetworkManagerSony(); #elif defined _DURANGO - s_pPlatformNetworkManager = new CPlatformNetworkManagerDurango(); + s_pPlatformNetworkManager = new CPlatformNetworkManagerDurango(); #else - s_pPlatformNetworkManager = new CPlatformNetworkManagerStub(); + s_pPlatformNetworkManager = new CPlatformNetworkManagerStub(); #endif - s_pPlatformNetworkManager->Initialise( this, flagIndexSize ); - m_bNetworkThreadRunning = false; - m_bInitialised = true; + s_pPlatformNetworkManager->Initialise(this, flagIndexSize); + m_bNetworkThreadRunning = false; + m_bInitialised = true; } -void CGameNetworkManager::Terminate() -{ - if( m_bInitialised ) - { - s_pPlatformNetworkManager->Terminate(); - } +void CGameNetworkManager::Terminate() { + if (m_bInitialised) { + s_pPlatformNetworkManager->Terminate(); + } } -void CGameNetworkManager::DoWork() -{ +void CGameNetworkManager::DoWork() { #ifdef _XBOX - // did we get any notifications from the game listener? - if(app.GetNotifications()->size()!=0) - { - PNOTIFICATION pNotification=app.GetNotifications()->back(); + // did we get any notifications from the game listener? + if (app.GetNotifications()->size() != 0) { + PNOTIFICATION pNotification = app.GetNotifications()->back(); - switch(pNotification->dwNotification) - { - case XN_LIVE_LINK_STATE_CHANGED: - { - int iPrimaryPlayer = g_NetworkManager.GetPrimaryPad(); - bool bConnected = (pNotification->uiParam!=0)?true:false; - if((g_NetworkManager.GetLockedProfile()!=-1) && iPrimaryPlayer!=-1 && bConnected == false && g_NetworkManager.IsInSession() ) - { - app.SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected); - } - } - break; - case XN_LIVE_INVITE_ACCEPTED: - s_pPlatformNetworkManager->Notify(pNotification->dwNotification,pNotification->uiParam); - break; - } + switch (pNotification->dwNotification) { + case XN_LIVE_LINK_STATE_CHANGED: { + int iPrimaryPlayer = g_NetworkManager.GetPrimaryPad(); + bool bConnected = (pNotification->uiParam != 0) ? true : false; + if ((g_NetworkManager.GetLockedProfile() != -1) && + iPrimaryPlayer != -1 && bConnected == false && + g_NetworkManager.IsInSession()) { + app.SetAction(iPrimaryPlayer, + eAppAction_EthernetDisconnected); + } + } break; + case XN_LIVE_INVITE_ACCEPTED: + s_pPlatformNetworkManager->Notify(pNotification->dwNotification, + pNotification->uiParam); + break; + } - app.GetNotifications()->pop_back(); - delete pNotification; - } + app.GetNotifications()->pop_back(); + delete pNotification; + } #endif - s_pPlatformNetworkManager->DoWork(); + s_pPlatformNetworkManager->DoWork(); #ifdef __ORBIS__ - if (m_pUpsell != NULL && m_pUpsell->hasResponse()) - { - int iPad_invited = m_iPlayerInvited, iPad_checking = m_pUpsell->m_userIndex; + if (m_pUpsell != NULL && m_pUpsell->hasResponse()) { + int iPad_invited = m_iPlayerInvited, + iPad_checking = m_pUpsell->m_userIndex; - m_iPlayerInvited = -1; + m_iPlayerInvited = -1; - delete m_pUpsell; - m_pUpsell = NULL; + delete m_pUpsell; + m_pUpsell = NULL; - if (ProfileManager.HasPlayStationPlus(iPad_checking)) - { - this->GameInviteReceived(iPad_invited, m_pInviteInfo); + if (ProfileManager.HasPlayStationPlus(iPad_checking)) { + this->GameInviteReceived(iPad_invited, m_pInviteInfo); - // m_pInviteInfo deleted by GameInviteReceived. - m_pInviteInfo = NULL; - } - else - { - delete m_pInviteInfo; - m_pInviteInfo = NULL; - } - } + // m_pInviteInfo deleted by GameInviteReceived. + m_pInviteInfo = NULL; + } else { + delete m_pInviteInfo; + m_pInviteInfo = NULL; + } + } #endif } -bool CGameNetworkManager::_RunNetworkGame(void *lpParameter) -{ - bool success = true; +bool CGameNetworkManager::_RunNetworkGame(void* lpParameter) { + bool success = true; - bool isHost = g_NetworkManager.IsHost(); - // Start the network game - Minecraft *pMinecraft=Minecraft::GetInstance(); - success = StartNetworkGame(pMinecraft,lpParameter); + bool isHost = g_NetworkManager.IsHost(); + // Start the network game + Minecraft* pMinecraft = Minecraft::GetInstance(); + success = StartNetworkGame(pMinecraft, lpParameter); - if(!success) return false; + if (!success) return false; - if( isHost ) - { - // We do not have a lobby, so the only players in the game at this point are local ones. + if (isHost) { + // We do not have a lobby, so the only players in the game at this point + // are local ones. - success = s_pPlatformNetworkManager->_RunNetworkGame(); - if(!success) - { - app.SetAction(ProfileManager.GetPrimaryPad(),eAppAction_ExitWorld,(void *)TRUE); - return true; - } - } - - if( g_NetworkManager.IsLeavingGame() ) return false; + success = s_pPlatformNetworkManager->_RunNetworkGame(); + if (!success) { + app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_ExitWorld, + (void*)TRUE); + return true; + } + } - app.SetGameStarted(true); + if (g_NetworkManager.IsLeavingGame()) return false; - // 4J-PB - if this is the trial game, start the trial timer - if(!ProfileManager.IsFullVersion()) - { - ui.SetTrialTimerLimitSecs(MinecraftDynamicConfigurations::GetTrialTime()); - app.SetTrialTimerStart(); - } - //app.CloseXuiScenes(ProfileManager.GetPrimaryPad()); + app.SetGameStarted(true); - return success; + // 4J-PB - if this is the trial game, start the trial timer + if (!ProfileManager.IsFullVersion()) { + ui.SetTrialTimerLimitSecs( + MinecraftDynamicConfigurations::GetTrialTime()); + app.SetTrialTimerStart(); + } + // app.CloseXuiScenes(ProfileManager.GetPrimaryPad()); + + return success; } -bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, void *lpParameter) -{ +bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, + void* lpParameter) { #ifdef _DURANGO - ProfileManager.SetDeferredSignoutEnabled(true); + ProfileManager.SetDeferredSignoutEnabled(true); #endif - __int64 seed = 0; - if(lpParameter != NULL) - { - NetworkGameInitData *param = (NetworkGameInitData *)lpParameter; - seed = param->seed; - - app.setLevelGenerationOptions(param->levelGen); - if(param->levelGen != NULL) - { - if(app.getLevelGenerationOptions() == NULL) - { - app.DebugPrintf("Game rule was not loaded, and seed is required. Exiting.\n"); - return false; - } - else - { - param->seed = seed = app.getLevelGenerationOptions()->getLevelSeed(); - } - } - } + int64_t seed = 0; + if (lpParameter != NULL) { + NetworkGameInitData* param = (NetworkGameInitData*)lpParameter; + seed = param->seed; - static __int64 sseed = seed; // Create static version so this will be valid until next call to this function & whilst thread is running + app.setLevelGenerationOptions(param->levelGen); + if (param->levelGen != NULL) { + if (app.getLevelGenerationOptions() == NULL) { + app.DebugPrintf( + "Game rule was not loaded, and seed is required. " + "Exiting.\n"); + return false; + } else { + param->seed = seed = + app.getLevelGenerationOptions()->getLevelSeed(); - ServerStoppedCreate(false); - if( g_NetworkManager.IsHost() ) - { - ServerStoppedCreate(true); - ServerReadyCreate(true); - // Ready to go - create actual networking thread & start hosting - C4JThread* thread = new C4JThread(&CGameNetworkManager::ServerThreadProc, lpParameter, "Server", 256 * 1024); + if (param->levelGen->isTutorial()) { + // Load the tutorial save data here + if (param->levelGen->requiresBaseSave() && + !param->levelGen->getBaseSavePath().empty()) { +#ifdef _XBOX +#ifdef _TU_BUILD + std::wstring fileRoot = + L"UPDATE:\\res\\GameRules\\" + + param->levelGen->getBaseSavePath(); +#else + std::wstring fileRoot = + L"GAME:\\res\\TitleUpdate\\GameRules\\" + + param->levelGen->getBaseSavePath(); +#endif +#else +#ifdef _WINDOWS64 + std::wstring fileRoot = + L"Windows64Media\\Tutorial\\" + + param->levelGen->getBaseSavePath(); + File root(fileRoot); + if (!root.exists()) + fileRoot = L"Windows64\\Tutorial\\" + + param->levelGen->getBaseSavePath(); +#elif defined(__ORBIS__) + std::wstring fileRoot = + L"/app0/orbis/Tutorial/" + + param->levelGen->getBaseSavePath(); +#elif defined(__PSVITA__) + std::wstring fileRoot = + L"PSVita/Tutorial/" + + param->levelGen->getBaseSavePath(); +#elif defined(__PS3__) + std::wstring fileRoot = + L"PS3/Tutorial/" + + param->levelGen->getBaseSavePath(); +#else + std::wstring fileRoot = + L"Tutorial\\" + param->levelGen->getBaseSavePath(); +#endif +#endif + File grf(fileRoot); + if (grf.exists()) { +#ifdef _UNICODE + std::wstring path = grf.getPath(); + const WCHAR* pchFilename = path.c_str(); + HANDLE fileHandle = CreateFile( + pchFilename, // file name + GENERIC_READ, // access mode + 0, // share mode // TODO 4J Stu - Will we need + // to share file? Probably not but... + NULL, // Unused + OPEN_EXISTING, // how to create // TODO 4J Stu + // - Assuming that the file + // already exists if we are + // opening to read from it + FILE_FLAG_SEQUENTIAL_SCAN, // file attributes + NULL // Unsupported + ); +#else + const char* pchFilename = + wstringtofilename(grf.getPath()); + HANDLE fileHandle = CreateFile( + pchFilename, // file name + GENERIC_READ, // access mode + 0, // share mode // TODO 4J Stu - Will we need + // to share file? Probably not but... + NULL, // Unused + OPEN_EXISTING, // how to create // TODO 4J Stu + // - Assuming that the file + // already exists if we are + // opening to read from it + FILE_FLAG_SEQUENTIAL_SCAN, // file attributes + NULL // Unsupported + ); +#endif + + if (fileHandle != INVALID_HANDLE_VALUE) { + DWORD bytesRead, + dwFileSize = GetFileSize(fileHandle, NULL); + PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; + BOOL bSuccess = + ReadFile(fileHandle, pbData, dwFileSize, + &bytesRead, NULL); + if (bSuccess == FALSE) { + app.FatalLoadError(); + } + CloseHandle(fileHandle); + + // 4J-PB - is it possible that we can get here + // after a read fail and it's not an error? + param->levelGen->setBaseSaveData(pbData, + dwFileSize); + } + } + } + } + } + } + } + + static int64_t sseed = + seed; // Create static version so this will be valid until next call to + // this function & whilst thread is running + ServerStoppedCreate(false); + if (g_NetworkManager.IsHost()) { + ServerStoppedCreate(true); + ServerReadyCreate(true); + // Ready to go - create actual networking thread & start hosting + C4JThread* thread = + new C4JThread(&CGameNetworkManager::ServerThreadProc, lpParameter, + "Server", 256 * 1024); #if defined __PS3__ || defined __PSVITA__ - thread->SetPriority(THREAD_PRIORITY_BELOW_NORMAL); -#endif //__PS3__ + thread->SetPriority(THREAD_PRIORITY_BELOW_NORMAL); +#endif //__PS3__ - thread->SetProcessor(CPU_CORE_SERVER); - thread->Run(); + thread->SetProcessor(CPU_CORE_SERVER); + thread->Run(); - app.DebugPrintf("[NET] Waiting for server ready...\n"); - ServerReadyWait(); - ServerReadyDestroy(); - app.DebugPrintf("[NET] Server ready! serverHalted=%d\n", MinecraftServer::serverHalted()); + app.DebugPrintf("[NET] Waiting for server ready...\n"); + ServerReadyWait(); + ServerReadyDestroy(); + app.DebugPrintf("[NET] Server ready! serverHalted=%d\n", + MinecraftServer::serverHalted()); - if( MinecraftServer::serverHalted() ) - return false; + if (MinecraftServer::serverHalted()) return false; -// printf("Server ready to go!\n"); - } - else - { - Socket::Initialise(NULL); - } + // printf("Server ready to go!\n"); + } else { + Socket::Initialise(NULL); + } #ifndef _XBOX - Minecraft *pMinecraft = Minecraft::GetInstance(); - app.DebugPrintf("[NET] IsReadyToPlayOrIdle=%d IsInSession=%d\n", IsReadyToPlayOrIdle(), IsInSession()); - // Make sure that we have transitioned through any joining/creating stages and are actually playing the game, so that we know the players should be valid - bool changedMessage = false; - while(!IsReadyToPlayOrIdle()) - { - changedMessage = true; - pMinecraft->progressRenderer->progressStage( g_NetworkManager.CorrectErrorIDS(IDS_PROGRESS_SAVING_TO_DISC) ); // "Finalizing..." vaguest message I could find - pMinecraft->progressRenderer->progressStagePercentage( g_NetworkManager.GetJoiningReadyPercentage() ); - Sleep(10); - } - if( changedMessage ) - { - pMinecraft->progressRenderer->progressStagePercentage( 100 ); - } + Minecraft* pMinecraft = Minecraft::GetInstance(); + app.DebugPrintf("[NET] IsReadyToPlayOrIdle=%d IsInSession=%d\n", + IsReadyToPlayOrIdle(), IsInSession()); + // Make sure that we have transitioned through any joining/creating stages + // and are actually playing the game, so that we know the players should be + // valid + bool changedMessage = false; + while (!IsReadyToPlayOrIdle()) { + changedMessage = true; + pMinecraft->progressRenderer->progressStage( + g_NetworkManager.CorrectErrorIDS( + IDS_PROGRESS_SAVING_TO_DISC)); // "Finalizing..." vaguest + // message I could find + pMinecraft->progressRenderer->progressStagePercentage( + g_NetworkManager.GetJoiningReadyPercentage()); + Sleep(10); + } + if (changedMessage) { + pMinecraft->progressRenderer->progressStagePercentage(100); + } #endif - // If we aren't in session, then something bad must have happened - we aren't joining, creating or ready play - app.DebugPrintf("[NET] Checking IsInSession...=%d\n", IsInSession()); - if(!IsInSession() ) - { - app.DebugPrintf("[NET] NOT in session! Halting server.\n"); - MinecraftServer::HaltServer(); - return false; - } + // If we aren't in session, then something bad must have happened - we + // aren't joining, creating or ready play + app.DebugPrintf("[NET] Checking IsInSession...=%d\n", IsInSession()); + if (!IsInSession()) { + app.DebugPrintf("[NET] NOT in session! Halting server.\n"); + MinecraftServer::HaltServer(); + return false; + } - app.DebugPrintf("[NET] DLC check: completed=%d pending=%d\n", app.DLCInstallProcessCompleted(), app.DLCInstallPending()); - // 4J Stu - Wait a while to make sure that DLC is loaded. This is the last point before the network communication starts - // so the latest we can check this - while( !app.DLCInstallProcessCompleted() && app.DLCInstallPending() && !g_NetworkManager.IsLeavingGame() ) - { - Sleep( 10 ); - } - if( g_NetworkManager.IsLeavingGame() ) - { - MinecraftServer::HaltServer(); - return false; - } + app.DebugPrintf("[NET] DLC check: completed=%d pending=%d\n", + app.DLCInstallProcessCompleted(), app.DLCInstallPending()); + // 4J Stu - Wait a while to make sure that DLC is loaded. This is the last + // point before the network communication starts so the latest we can check + // this + while (!app.DLCInstallProcessCompleted() && app.DLCInstallPending() && + !g_NetworkManager.IsLeavingGame()) { + Sleep(10); + } + if (g_NetworkManager.IsLeavingGame()) { + MinecraftServer::HaltServer(); + return false; + } - // PRIMARY PLAYER + // PRIMARY PLAYER - app.DebugPrintf("[NET] Creating ClientConnection (IsHost=%d)...\n", g_NetworkManager.IsHost()); - std::vector createdConnections; - ClientConnection *connection; + app.DebugPrintf("[NET] Creating ClientConnection (IsHost=%d)...\n", + g_NetworkManager.IsHost()); + std::vector createdConnections; + ClientConnection* connection; - if( g_NetworkManager.IsHost() ) - { - connection = new ClientConnection(minecraft, NULL); - app.DebugPrintf("[NET] ClientConnection created, createdOk=%d\n", connection->createdOk); - } - else - { - INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(ProfileManager.GetLockedProfile()); - if(pNetworkPlayer == NULL) - { - MinecraftServer::HaltServer(); - app.DebugPrintf("%d\n",ProfileManager.GetLockedProfile()); - // If the player is NULL here then something went wrong in the session setup, and continuing will end up in a crash - return false; - } + if (g_NetworkManager.IsHost()) { + connection = new ClientConnection(minecraft, NULL); + app.DebugPrintf("[NET] ClientConnection created, createdOk=%d\n", + connection->createdOk); + } else { + INetworkPlayer* pNetworkPlayer = + g_NetworkManager.GetLocalPlayerByUserIndex( + ProfileManager.GetLockedProfile()); + if (pNetworkPlayer == NULL) { + MinecraftServer::HaltServer(); + app.DebugPrintf("%d\n", ProfileManager.GetLockedProfile()); + // If the player is NULL here then something went wrong in the + // session setup, and continuing will end up in a crash + return false; + } - Socket *socket = pNetworkPlayer->GetSocket(); + Socket* socket = pNetworkPlayer->GetSocket(); - // Fix for #13259 - CRASH: Gameplay: loading process is halted when player loads saved data - if(socket == NULL) - { - assert(false); - MinecraftServer::HaltServer(); - // If the socket is NULL here then something went wrong in the session setup, and continuing will end up in a crash - return false; - } + // Fix for #13259 - CRASH: Gameplay: loading process is halted when + // player loads saved data + if (socket == NULL) { + assert(false); + MinecraftServer::HaltServer(); + // If the socket is NULL here then something went wrong in the + // session setup, and continuing will end up in a crash + return false; + } - connection = new ClientConnection(minecraft, socket); - } + connection = new ClientConnection(minecraft, socket); + } - if( !connection->createdOk ) - { - assert(false); - delete connection; - connection = NULL; - MinecraftServer::HaltServer(); - return false; - } + if (!connection->createdOk) { + assert(false); + delete connection; + connection = NULL; + MinecraftServer::HaltServer(); + return false; + } - app.DebugPrintf("[NET] Sending PreLoginPacket...\n"); - connection->send( std::shared_ptr( new PreLoginPacket(minecraft->user->name) ) ); - app.DebugPrintf("[NET] PreLoginPacket sent. Entering connection tick loop...\n"); + app.DebugPrintf("[NET] Sending PreLoginPacket...\n"); + connection->send(std::shared_ptr( + new PreLoginPacket(minecraft->user->name))); + app.DebugPrintf( + "[NET] PreLoginPacket sent. Entering connection tick loop...\n"); - // Tick connection until we're ready to go. The stages involved in this are: - // (1) Creating the ClientConnection sends a prelogin packet to the server - // (2) the server sends a prelogin back, which is handled by the clientConnection, and returns a login packet - // (3) the server sends a login back, which is handled by the client connection to start the game - if( !g_NetworkManager.IsHost() ) - { - Minecraft::GetInstance()->progressRenderer->progressStart(IDS_PROGRESS_CONNECTING); - } - else - { - // 4J Stu - Host needs to generate a unique multiplayer id for sentient telemetry reporting - int multiplayerInstanceId = TelemetryManager->GenerateMultiplayerInstanceId(); - TelemetryManager->SetMultiplayerInstanceId(multiplayerInstanceId); - } - TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); - do - { - app.DebugPrintf("ticking connection A\n"); - connection->tick(); + // Tick connection until we're ready to go. The stages involved in this are: + // (1) Creating the ClientConnection sends a prelogin packet to the server + // (2) the server sends a prelogin back, which is handled by the + // clientConnection, and returns a login packet (3) the server sends a login + // back, which is handled by the client connection to start the game + if (!g_NetworkManager.IsHost()) { + Minecraft::GetInstance()->progressRenderer->progressStart( + IDS_PROGRESS_CONNECTING); + } else { + // 4J Stu - Host needs to generate a unique multiplayer id for sentient + // telemetry reporting + int multiplayerInstanceId = + TelemetryManager->GenerateMultiplayerInstanceId(); + TelemetryManager->SetMultiplayerInstanceId(multiplayerInstanceId); + } + TexturePack* tPack = Minecraft::GetInstance()->skins->getSelected(); + do { + app.DebugPrintf("ticking connection A\n"); + connection->tick(); - // 4J Stu - We were ticking this way too fast which could cause the connection to time out - // The connections should tick at 20 per second - Sleep(50); - } while ( (IsInSession() && !connection->isStarted() && !connection->isClosed() && !g_NetworkManager.IsLeavingGame()) || tPack->isLoadingData() || (Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin()) ); - ui.CleanUpSkinReload(); + // 4J Stu - We were ticking this way too fast which could cause the + // connection to time out The connections should tick at 20 per second + Sleep(50); + } while ((IsInSession() && !connection->isStarted() && + !connection->isClosed() && !g_NetworkManager.IsLeavingGame()) || + tPack->isLoadingData() || + (Minecraft::GetInstance()->skins->needsUIUpdate() || + ui.IsReloadingSkin())); + ui.CleanUpSkinReload(); - // 4J Stu - Fix for #11279 - CRASH: TCR 001: BAS Game Stability: Signing out of game will cause title to crash - // We need to break out of the above loop if m_bLeavingGame is set, and close the connection - if( g_NetworkManager.IsLeavingGame() || !IsInSession() ) - { - connection->close(); - } + // 4J Stu - Fix for #11279 - CRASH: TCR 001: BAS Game Stability: Signing out + // of game will cause title to crash We need to break out of the above loop + // if m_bLeavingGame is set, and close the connection + if (g_NetworkManager.IsLeavingGame() || !IsInSession()) { + connection->close(); + } - if( connection->isStarted() && !connection->isClosed() ) - { - createdConnections.push_back( connection ); + if (connection->isStarted() && !connection->isClosed()) { + createdConnections.push_back(connection); - int primaryPad = ProfileManager.GetPrimaryPad(); - app.SetRichPresenceContext(primaryPad,CONTEXT_GAME_STATE_BLANK); - if (GetPlayerCount() > 1) // Are we offline or online, and how many players are there - { - if (IsLocalGame()) ProfileManager.SetCurrentGameActivity(primaryPad,CONTEXT_PRESENCE_MULTIPLAYEROFFLINE,false); - else ProfileManager.SetCurrentGameActivity(primaryPad,CONTEXT_PRESENCE_MULTIPLAYER,false); - } - else - { - if(IsLocalGame()) ProfileManager.SetCurrentGameActivity(primaryPad,CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE,false); - else ProfileManager.SetCurrentGameActivity(primaryPad,CONTEXT_PRESENCE_MULTIPLAYER_1P,false); - } + int primaryPad = ProfileManager.GetPrimaryPad(); + app.SetRichPresenceContext(primaryPad, CONTEXT_GAME_STATE_BLANK); + if (GetPlayerCount() > + 1) // Are we offline or online, and how many players are there + { + if (IsLocalGame()) + ProfileManager.SetCurrentGameActivity( + primaryPad, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false); + else + ProfileManager.SetCurrentGameActivity( + primaryPad, CONTEXT_PRESENCE_MULTIPLAYER, false); + } else { + if (IsLocalGame()) + ProfileManager.SetCurrentGameActivity( + primaryPad, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, false); + else + ProfileManager.SetCurrentGameActivity( + primaryPad, CONTEXT_PRESENCE_MULTIPLAYER_1P, false); + } + // ALL OTHER LOCAL PLAYERS + for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { + // Already have setup the primary pad + if (idx == ProfileManager.GetPrimaryPad()) continue; - // ALL OTHER LOCAL PLAYERS - for(int idx = 0; idx < XUSER_MAX_COUNT; ++idx) - { - // Already have setup the primary pad - if(idx == ProfileManager.GetPrimaryPad() ) continue; + if (GetLocalPlayerByUserIndex(idx) != NULL && + !ProfileManager.IsSignedIn(idx)) { + INetworkPlayer* pNetworkPlayer = + g_NetworkManager.GetLocalPlayerByUserIndex(idx); + Socket* socket = pNetworkPlayer->GetSocket(); + app.DebugPrintf( + "Closing socket due to player %d not being signed in any " + "more\n"); + if (!socket->close(false)) socket->close(true); - if( GetLocalPlayerByUserIndex(idx) != NULL && !ProfileManager.IsSignedIn(idx) ) - { - INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx); - Socket *socket = pNetworkPlayer->GetSocket(); - app.DebugPrintf("Closing socket due to player %d not being signed in any more\n"); - if( !socket->close(false) ) socket->close(true); + continue; + } - continue; - } + // By default when we host we only have the local player, but + // currently allow multiple local players to join when joining any + // other way, so just because they are signed in doesn't mean they + // are in the session 4J Stu - If they are in the session, then we + // should add them to the game. Otherwise we won't be able to add + // them later + INetworkPlayer* pNetworkPlayer = + g_NetworkManager.GetLocalPlayerByUserIndex(idx); + if (pNetworkPlayer == NULL) continue; - // By default when we host we only have the local player, but currently allow multiple local players to join - // when joining any other way, so just because they are signed in doesn't mean they are in the session - // 4J Stu - If they are in the session, then we should add them to the game. Otherwise we won't be able to add them later - INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx); - if( pNetworkPlayer == NULL ) - continue; + ClientConnection* connection; - ClientConnection *connection; + Socket* socket = pNetworkPlayer->GetSocket(); + connection = new ClientConnection(minecraft, socket, idx); - Socket *socket = pNetworkPlayer->GetSocket(); - connection = new ClientConnection(minecraft, socket, idx); + minecraft->addPendingLocalConnection(idx, connection); + // minecraft->createExtraLocalPlayer(idx, (convStringToWstring( + // ProfileManager.GetGamertag(idx) )).c_str(), idx, connection); - minecraft->addPendingLocalConnection(idx, connection); - //minecraft->createExtraLocalPlayer(idx, (convStringToWstring( ProfileManager.GetGamertag(idx) )).c_str(), idx, connection); + // Open the socket on the server end to accept incoming data + Socket::addIncomingSocket(socket); - // Open the socket on the server end to accept incoming data - Socket::addIncomingSocket(socket); + connection->send(std::shared_ptr(new PreLoginPacket( + convStringToWstring(ProfileManager.GetGamertag(idx))))); - connection->send( std::shared_ptr( new PreLoginPacket(convStringToWstring( ProfileManager.GetGamertag(idx) )) ) ); + createdConnections.push_back(connection); - createdConnections.push_back( connection ); + // Tick connection until we're ready to go. The stages involved in + // this are: (1) Creating the ClientConnection sends a prelogin + // packet to the server (2) the server sends a prelogin back, which + // is handled by the clientConnection, and returns a login packet + // (3) the server sends a login back, which is handled by the client + // connection to start the game + do { + // We need to keep ticking the connections for players that + // already logged in + for (AUTO_VAR(it, createdConnections.begin()); + it < createdConnections.end(); ++it) { + (*it)->tick(); + } - // Tick connection until we're ready to go. The stages involved in this are: - // (1) Creating the ClientConnection sends a prelogin packet to the server - // (2) the server sends a prelogin back, which is handled by the clientConnection, and returns a login packet - // (3) the server sends a login back, which is handled by the client connection to start the game - do - { - // We need to keep ticking the connections for players that already logged in - for(AUTO_VAR(it, createdConnections.begin()); it < createdConnections.end(); ++it) - { - (*it)->tick(); - } - - // 4J Stu - We were ticking this way too fast which could cause the connection to time out - // The connections should tick at 20 per second - Sleep(50); - app.DebugPrintf("<***> %d %d %d %d %d\n",IsInSession(), !connection->isStarted(),!connection->isClosed(),ProfileManager.IsSignedIn(idx),!g_NetworkManager.IsLeavingGame()); + // 4J Stu - We were ticking this way too fast which could cause + // the connection to time out The connections should tick at 20 + // per second + Sleep(50); + app.DebugPrintf("<***> %d %d %d %d %d\n", IsInSession(), + !connection->isStarted(), + !connection->isClosed(), + ProfileManager.IsSignedIn(idx), + !g_NetworkManager.IsLeavingGame()); #if defined _XBOX || __PS3__ - } while (IsInSession() && !connection->isStarted() && !connection->isClosed() && ProfileManager.IsSignedIn(idx) && !g_NetworkManager.IsLeavingGame() ); + } while (IsInSession() && !connection->isStarted() && + !connection->isClosed() && + ProfileManager.IsSignedIn(idx) && + !g_NetworkManager.IsLeavingGame()); #else - // TODO - This SHOULD be something just like the code above but temporarily changing here so that we don't have to depend on the profilemanager behaviour - } while (IsInSession() && !connection->isStarted() && !connection->isClosed() && !g_NetworkManager.IsLeavingGame() ); + // TODO - This SHOULD be something just like the code above but + // temporarily changing here so that we don't have to depend on + // the profilemanager behaviour + } while (IsInSession() && !connection->isStarted() && + !connection->isClosed() && + !g_NetworkManager.IsLeavingGame()); #endif - // 4J Stu - Fix for #11279 - CRASH: TCR 001: BAS Game Stability: Signing out of game will cause title to crash - // We need to break out of the above loop if m_bLeavingGame is set, and stop creating new connections - // The connections in the createdConnections vector get closed at the end of the thread - if( g_NetworkManager.IsLeavingGame() || !IsInSession() ) break; + // 4J Stu - Fix for #11279 - CRASH: TCR 001: BAS Game Stability: + // Signing out of game will cause title to crash We need to break + // out of the above loop if m_bLeavingGame is set, and stop creating + // new connections The connections in the createdConnections vector + // get closed at the end of the thread + if (g_NetworkManager.IsLeavingGame() || !IsInSession()) break; - if( ProfileManager.IsSignedIn(idx) && !connection->isClosed() ) - { - app.SetRichPresenceContext(idx,CONTEXT_GAME_STATE_BLANK); - if (IsLocalGame()) ProfileManager.SetCurrentGameActivity(idx,CONTEXT_PRESENCE_MULTIPLAYEROFFLINE,false); - else ProfileManager.SetCurrentGameActivity(idx,CONTEXT_PRESENCE_MULTIPLAYER,false); - } - else - { - connection->close(); - AUTO_VAR(it, find( createdConnections.begin(), createdConnections.end(), connection )); - if(it != createdConnections.end() ) createdConnections.erase( it ); - } - } + if (ProfileManager.IsSignedIn(idx) && !connection->isClosed()) { + app.SetRichPresenceContext(idx, CONTEXT_GAME_STATE_BLANK); + if (IsLocalGame()) + ProfileManager.SetCurrentGameActivity( + idx, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false); + else + ProfileManager.SetCurrentGameActivity( + idx, CONTEXT_PRESENCE_MULTIPLAYER, false); + } else { + connection->close(); + AUTO_VAR(it, find(createdConnections.begin(), + createdConnections.end(), connection)); + if (it != createdConnections.end()) + createdConnections.erase(it); + } + } - app.SetGameMode( eMode_Multiplayer ); - } - else if ( connection->isClosed() || !IsInSession()) - { -// assert(false); - MinecraftServer::HaltServer(); - return false; - } + app.SetGameMode(eMode_Multiplayer); + } else if (connection->isClosed() || !IsInSession()) { + // assert(false); + MinecraftServer::HaltServer(); + return false; + } - - if(g_NetworkManager.IsLeavingGame() || !IsInSession() ) - { - for(AUTO_VAR(it, createdConnections.begin()); it < createdConnections.end(); ++it) - { - (*it)->close(); - } -// assert(false); - MinecraftServer::HaltServer(); - return false; - } + if (g_NetworkManager.IsLeavingGame() || !IsInSession()) { + for (AUTO_VAR(it, createdConnections.begin()); + it < createdConnections.end(); ++it) { + (*it)->close(); + } + // assert(false); + MinecraftServer::HaltServer(); + return false; + } - // Catch in-case server has been halted (by a player signout). - if ( MinecraftServer::serverHalted() ) - return false; + // Catch in-case server has been halted (by a player signout). + if (MinecraftServer::serverHalted()) return false; - return true; + return true; } -int CGameNetworkManager::CorrectErrorIDS(int IDS) -{ - return s_pPlatformNetworkManager->CorrectErrorIDS(IDS); +int CGameNetworkManager::CorrectErrorIDS(int IDS) { + return s_pPlatformNetworkManager->CorrectErrorIDS(IDS); } -int CGameNetworkManager::GetLocalPlayerMask(int playerIndex) -{ - return s_pPlatformNetworkManager->GetLocalPlayerMask( playerIndex ); +int CGameNetworkManager::GetLocalPlayerMask(int playerIndex) { + return s_pPlatformNetworkManager->GetLocalPlayerMask(playerIndex); } -int CGameNetworkManager::GetPlayerCount() -{ - return s_pPlatformNetworkManager->GetPlayerCount(); +int CGameNetworkManager::GetPlayerCount() { + return s_pPlatformNetworkManager->GetPlayerCount(); } -int CGameNetworkManager::GetOnlinePlayerCount() -{ - return s_pPlatformNetworkManager->GetOnlinePlayerCount(); +int CGameNetworkManager::GetOnlinePlayerCount() { + return s_pPlatformNetworkManager->GetOnlinePlayerCount(); } -bool CGameNetworkManager::AddLocalPlayerByUserIndex( int userIndex ) -{ - return s_pPlatformNetworkManager->AddLocalPlayerByUserIndex( userIndex ); +bool CGameNetworkManager::AddLocalPlayerByUserIndex(int userIndex) { + return s_pPlatformNetworkManager->AddLocalPlayerByUserIndex(userIndex); } -bool CGameNetworkManager::RemoveLocalPlayerByUserIndex( int userIndex ) -{ - return s_pPlatformNetworkManager->RemoveLocalPlayerByUserIndex( userIndex ); +bool CGameNetworkManager::RemoveLocalPlayerByUserIndex(int userIndex) { + return s_pPlatformNetworkManager->RemoveLocalPlayerByUserIndex(userIndex); } -INetworkPlayer *CGameNetworkManager::GetLocalPlayerByUserIndex(int userIndex ) -{ - return s_pPlatformNetworkManager->GetLocalPlayerByUserIndex( userIndex ); +INetworkPlayer* CGameNetworkManager::GetLocalPlayerByUserIndex(int userIndex) { + return s_pPlatformNetworkManager->GetLocalPlayerByUserIndex(userIndex); } -INetworkPlayer *CGameNetworkManager::GetPlayerByIndex(int playerIndex) -{ - return s_pPlatformNetworkManager->GetPlayerByIndex( playerIndex ); +INetworkPlayer* CGameNetworkManager::GetPlayerByIndex(int playerIndex) { + return s_pPlatformNetworkManager->GetPlayerByIndex(playerIndex); } -INetworkPlayer *CGameNetworkManager::GetPlayerByXuid(PlayerUID xuid) -{ - return s_pPlatformNetworkManager->GetPlayerByXuid( xuid ); +INetworkPlayer* CGameNetworkManager::GetPlayerByXuid(PlayerUID xuid) { + return s_pPlatformNetworkManager->GetPlayerByXuid(xuid); } -INetworkPlayer *CGameNetworkManager::GetPlayerBySmallId(unsigned char smallId) -{ - return s_pPlatformNetworkManager->GetPlayerBySmallId( smallId ); +INetworkPlayer* CGameNetworkManager::GetPlayerBySmallId(unsigned char smallId) { + return s_pPlatformNetworkManager->GetPlayerBySmallId(smallId); } #ifdef _DURANGO -std::wstring CGameNetworkManager::GetDisplayNameByGamertag(std::wstring gamertag) -{ - return s_pPlatformNetworkManager->GetDisplayNameByGamertag(gamertag); +std::wstring CGameNetworkManager::GetDisplayNameByGamertag( + std::wstring gamertag) { + return s_pPlatformNetworkManager->GetDisplayNameByGamertag(gamertag); } #endif -INetworkPlayer *CGameNetworkManager::GetHostPlayer() -{ - return s_pPlatformNetworkManager->GetHostPlayer(); +INetworkPlayer* CGameNetworkManager::GetHostPlayer() { + return s_pPlatformNetworkManager->GetHostPlayer(); } -void CGameNetworkManager::RegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam) -{ - s_pPlatformNetworkManager->RegisterPlayerChangedCallback( iPad, callback, callbackParam ); +void CGameNetworkManager::RegisterPlayerChangedCallback( + int iPad, + void (*callback)(void* callbackParam, INetworkPlayer* pPlayer, + bool leaving), + void* callbackParam) { + s_pPlatformNetworkManager->RegisterPlayerChangedCallback(iPad, callback, + callbackParam); } -void CGameNetworkManager::UnRegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam) -{ - s_pPlatformNetworkManager->UnRegisterPlayerChangedCallback( iPad, callback, callbackParam ); +void CGameNetworkManager::UnRegisterPlayerChangedCallback( + int iPad, + void (*callback)(void* callbackParam, INetworkPlayer* pPlayer, + bool leaving), + void* callbackParam) { + s_pPlatformNetworkManager->UnRegisterPlayerChangedCallback(iPad, callback, + callbackParam); } -void CGameNetworkManager::HandleSignInChange() -{ - s_pPlatformNetworkManager->HandleSignInChange(); +void CGameNetworkManager::HandleSignInChange() { + s_pPlatformNetworkManager->HandleSignInChange(); } -bool CGameNetworkManager::ShouldMessageForFullSession() -{ - return s_pPlatformNetworkManager->ShouldMessageForFullSession(); +bool CGameNetworkManager::ShouldMessageForFullSession() { + return s_pPlatformNetworkManager->ShouldMessageForFullSession(); } -bool CGameNetworkManager::IsInSession() -{ - return s_pPlatformNetworkManager->IsInSession(); +bool CGameNetworkManager::IsInSession() { + return s_pPlatformNetworkManager->IsInSession(); } -bool CGameNetworkManager::IsInGameplay() -{ - return s_pPlatformNetworkManager->IsInGameplay(); +bool CGameNetworkManager::IsInGameplay() { + return s_pPlatformNetworkManager->IsInGameplay(); } -bool CGameNetworkManager::IsReadyToPlayOrIdle() -{ - return s_pPlatformNetworkManager->IsReadyToPlayOrIdle(); +bool CGameNetworkManager::IsReadyToPlayOrIdle() { + return s_pPlatformNetworkManager->IsReadyToPlayOrIdle(); } -bool CGameNetworkManager::IsLeavingGame() -{ - return s_pPlatformNetworkManager->IsLeavingGame(); +bool CGameNetworkManager::IsLeavingGame() { + return s_pPlatformNetworkManager->IsLeavingGame(); } -bool CGameNetworkManager::SetLocalGame(bool isLocal) -{ - return s_pPlatformNetworkManager->SetLocalGame( isLocal ); +bool CGameNetworkManager::SetLocalGame(bool isLocal) { + return s_pPlatformNetworkManager->SetLocalGame(isLocal); } -bool CGameNetworkManager::IsLocalGame() -{ - return s_pPlatformNetworkManager->IsLocalGame(); +bool CGameNetworkManager::IsLocalGame() { + return s_pPlatformNetworkManager->IsLocalGame(); } -void CGameNetworkManager::SetPrivateGame(bool isPrivate) -{ - s_pPlatformNetworkManager->SetPrivateGame( isPrivate ); +void CGameNetworkManager::SetPrivateGame(bool isPrivate) { + s_pPlatformNetworkManager->SetPrivateGame(isPrivate); } -bool CGameNetworkManager::IsPrivateGame() -{ - return s_pPlatformNetworkManager->IsPrivateGame(); +bool CGameNetworkManager::IsPrivateGame() { + return s_pPlatformNetworkManager->IsPrivateGame(); } -void CGameNetworkManager::HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, unsigned char publicSlots, unsigned char privateSlots) -{ - // 4J Stu - clear any previous connection errors - Minecraft::GetInstance()->clearConnectionFailed(); +void CGameNetworkManager::HostGame(int localUsersMask, bool bOnlineGame, + bool bIsPrivate, unsigned char publicSlots, + unsigned char privateSlots) { + // 4J Stu - clear any previous connection errors + Minecraft::GetInstance()->clearConnectionFailed(); - s_pPlatformNetworkManager->HostGame( localUsersMask, bOnlineGame, bIsPrivate, publicSlots, privateSlots ); + s_pPlatformNetworkManager->HostGame(localUsersMask, bOnlineGame, bIsPrivate, + publicSlots, privateSlots); } -bool CGameNetworkManager::IsHost() -{ - return (s_pPlatformNetworkManager->IsHost() == TRUE); +bool CGameNetworkManager::IsHost() { + return (s_pPlatformNetworkManager->IsHost() == TRUE); } -bool CGameNetworkManager::IsInStatsEnabledSession() -{ - return s_pPlatformNetworkManager->IsInStatsEnabledSession(); +bool CGameNetworkManager::IsInStatsEnabledSession() { + return s_pPlatformNetworkManager->IsInStatsEnabledSession(); } -bool CGameNetworkManager::SessionHasSpace(unsigned int spaceRequired) -{ - return s_pPlatformNetworkManager->SessionHasSpace( spaceRequired ); +bool CGameNetworkManager::SessionHasSpace(unsigned int spaceRequired) { + return s_pPlatformNetworkManager->SessionHasSpace(spaceRequired); } -std::vector *CGameNetworkManager::GetSessionList(int iPad, int localPlayers, bool partyOnly) -{ - return s_pPlatformNetworkManager->GetSessionList( iPad, localPlayers, partyOnly ); +std::vector* CGameNetworkManager::GetSessionList( + int iPad, int localPlayers, bool partyOnly) { + return s_pPlatformNetworkManager->GetSessionList(iPad, localPlayers, + partyOnly); } -bool CGameNetworkManager::GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession) -{ - return s_pPlatformNetworkManager->GetGameSessionInfo( iPad, sessionId, foundSession ); +bool CGameNetworkManager::GetGameSessionInfo(int iPad, SessionID sessionId, + FriendSessionInfo* foundSession) { + return s_pPlatformNetworkManager->GetGameSessionInfo(iPad, sessionId, + foundSession); } -void CGameNetworkManager::SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam ) -{ - s_pPlatformNetworkManager->SetSessionsUpdatedCallback( SessionsUpdatedCallback, pSearchParam ); +void CGameNetworkManager::SetSessionsUpdatedCallback( + void (*SessionsUpdatedCallback)(void* pParam), void* pSearchParam) { + s_pPlatformNetworkManager->SetSessionsUpdatedCallback( + SessionsUpdatedCallback, pSearchParam); } -void CGameNetworkManager::GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ) -{ - s_pPlatformNetworkManager->GetFullFriendSessionInfo(foundSession, FriendSessionUpdatedFn, pParam); +void CGameNetworkManager::GetFullFriendSessionInfo( + FriendSessionInfo* foundSession, + void (*FriendSessionUpdatedFn)(bool success, void* pParam), void* pParam) { + s_pPlatformNetworkManager->GetFullFriendSessionInfo( + foundSession, FriendSessionUpdatedFn, pParam); } -void CGameNetworkManager::ForceFriendsSessionRefresh() -{ - s_pPlatformNetworkManager->ForceFriendsSessionRefresh(); +void CGameNetworkManager::ForceFriendsSessionRefresh() { + s_pPlatformNetworkManager->ForceFriendsSessionRefresh(); } -bool CGameNetworkManager::JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo) -{ - return s_pPlatformNetworkManager->JoinGameFromInviteInfo( userIndex, userMask, pInviteInfo ); +bool CGameNetworkManager::JoinGameFromInviteInfo( + int userIndex, int userMask, const INVITE_INFO* pInviteInfo) { + return s_pPlatformNetworkManager->JoinGameFromInviteInfo( + userIndex, userMask, pInviteInfo); } -CGameNetworkManager::eJoinGameResult CGameNetworkManager::JoinGame(FriendSessionInfo *searchResult, int localUsersMask) -{ - app.SetTutorialMode( false ); - g_NetworkManager.SetLocalGame(false); +CGameNetworkManager::eJoinGameResult CGameNetworkManager::JoinGame( + FriendSessionInfo* searchResult, int localUsersMask) { + app.SetTutorialMode(false); + g_NetworkManager.SetLocalGame(false); - int primaryUserIndex = ProfileManager.GetLockedProfile(); + int primaryUserIndex = ProfileManager.GetLockedProfile(); - // 4J-PB - clear any previous connection errors - Minecraft::GetInstance()->clearConnectionFailed(); + // 4J-PB - clear any previous connection errors + Minecraft::GetInstance()->clearConnectionFailed(); - // Make sure that the Primary Pad is in by default - localUsersMask |= GetLocalPlayerMask( ProfileManager.GetPrimaryPad() ); + // Make sure that the Primary Pad is in by default + localUsersMask |= GetLocalPlayerMask(ProfileManager.GetPrimaryPad()); - return (eJoinGameResult)(s_pPlatformNetworkManager->JoinGame( searchResult, localUsersMask, primaryUserIndex )); + return (eJoinGameResult)(s_pPlatformNetworkManager->JoinGame( + searchResult, localUsersMask, primaryUserIndex)); } -void CGameNetworkManager::CancelJoinGame(void *lpParam) -{ +void CGameNetworkManager::CancelJoinGame(void* lpParam) { #ifdef _XBOX_ONE - s_pPlatformNetworkManager->CancelJoinGame(); + s_pPlatformNetworkManager->CancelJoinGame(); #endif } -bool CGameNetworkManager::LeaveGame(bool bMigrateHost) -{ - Minecraft::GetInstance()->gui->clearMessages(); - return s_pPlatformNetworkManager->LeaveGame( bMigrateHost ); +bool CGameNetworkManager::LeaveGame(bool bMigrateHost) { + Minecraft::GetInstance()->gui->clearMessages(); + return s_pPlatformNetworkManager->LeaveGame(bMigrateHost); } -int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad) -{ - INVITE_INFO * pInviteInfo = (INVITE_INFO *)pParam; +int CGameNetworkManager::JoinFromInvite_SignInReturned(void* pParam, + bool bContinue, + int iPad) { + INVITE_INFO* pInviteInfo = (INVITE_INFO*)pParam; - if(bContinue==true) - { + if (bContinue == true) { #ifdef __ORBIS__ - // Check if PSN is unavailable because of age restriction - int npAvailability = ProfileManager.getNPAvailability(iPad); - if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) - { - unsigned int uiIDA[1]; - uiIDA[0] = IDS_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable()); + // Check if PSN is unavailable because of age restriction + int npAvailability = ProfileManager.getNPAvailability(iPad); + if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_OK; + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, + IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad); - return 0; - } + return 0; + } #endif - app.DebugPrintf("JoinFromInvite_SignInReturned, iPad %d\n",iPad); - // It's possible that the player has not signed in - they can back out - if(ProfileManager.IsSignedIn(iPad) && ProfileManager.IsSignedInLive(iPad) ) - { - app.DebugPrintf("JoinFromInvite_SignInReturned, passed sign-in tests\n"); - int localUsersMask = 0; - int joiningUsers = 0; + app.DebugPrintf("JoinFromInvite_SignInReturned, iPad %d\n", iPad); + // It's possible that the player has not signed in - they can back out + if (ProfileManager.IsSignedIn(iPad) && + ProfileManager.IsSignedInLive(iPad)) { + app.DebugPrintf( + "JoinFromInvite_SignInReturned, passed sign-in tests\n"); + int localUsersMask = 0; + int joiningUsers = 0; - bool noPrivileges = false; - for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) - { - if(ProfileManager.IsSignedIn(index) ) - { - ++joiningUsers; - if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true; - localUsersMask |= GetLocalPlayerMask( index ); - } - } + bool noPrivileges = false; + for (unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) { + if (ProfileManager.IsSignedIn(index)) { + ++joiningUsers; + if (!ProfileManager.AllowedToPlayMultiplayer(index)) + noPrivileges = true; + localUsersMask |= GetLocalPlayerMask(index); + } + } - // Check if user-created content is allowed, as we cannot play multiplayer if it's not - bool noUGC = false; + // Check if user-created content is allowed, as we cannot play + // multiplayer if it's not + bool noUGC = false; #if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(iPad,false,&noUGC,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(iPad, false, &noUGC, + NULL, NULL); #elif defined(__ORBIS__) - ProfileManager.GetChatAndContentRestrictions(iPad,false,NULL,&noUGC,NULL); + ProfileManager.GetChatAndContentRestrictions(iPad, false, NULL, + &noUGC, NULL); #endif - if(noUGC) - { - int messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL; - if(joiningUsers > 1) messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL; + if (noUGC) { + int messageText = + IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL; + if (joiningUsers > 1) + messageText = + IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL; - ui.RequestUGCMessageBox(IDS_CONNECTION_FAILED, messageText); - } - else if(noPrivileges) - { - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); - } - else - { + ui.RequestUGCMessageBox(IDS_CONNECTION_FAILED, messageText); + } else if (noPrivileges) { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + ui.RequestErrorMessage(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, + IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, + uiIDA, 1, + ProfileManager.GetPrimaryPad()); + } else { #if defined(__ORBIS__) || defined(__PSVITA__) - bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(iPad,false,&chatRestricted,NULL,NULL); - if(chatRestricted) - { - ProfileManager.DisplaySystemMessage( 0, ProfileManager.GetPrimaryPad() ); - } + bool chatRestricted = false; + ProfileManager.GetChatAndContentRestrictions( + iPad, false, &chatRestricted, NULL, NULL); + if (chatRestricted) { + ProfileManager.DisplaySystemMessage( + 0, ProfileManager.GetPrimaryPad()); + } #endif - ProfileManager.SetLockedProfile(iPad); - ProfileManager.SetPrimaryPad(iPad); + ProfileManager.SetLockedProfile(iPad); + ProfileManager.SetPrimaryPad(iPad); - g_NetworkManager.SetLocalGame(false); - - // If the player was signed in before selecting play, we'll not have read the profile yet, so query the sign-in status to get this to happen - ProfileManager.QuerySigninStatus(); + g_NetworkManager.SetLocalGame(false); - // 4J-PB - clear any previous connection errors - Minecraft::GetInstance()->clearConnectionFailed(); + // If the player was signed in before selecting play, we'll not + // have read the profile yet, so query the sign-in status to get + // this to happen + ProfileManager.QuerySigninStatus(); - // change the minecraft player name - Minecraft::GetInstance()->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); + // 4J-PB - clear any previous connection errors + Minecraft::GetInstance()->clearConnectionFailed(); - bool success = g_NetworkManager.JoinGameFromInviteInfo( - iPad, // dwUserIndex - localUsersMask, // dwUserMask - pInviteInfo ); // pInviteInfo - if( !success ) - { - app.DebugPrintf( "Failed joining game from invite\n" ); - } - } - } - else - { - app.DebugPrintf("JoinFromInvite_SignInReturned, failed sign-in tests :%d %d\n",ProfileManager.IsSignedIn(iPad),ProfileManager.IsSignedInLive(iPad)); - } - } - return 0; + // change the minecraft player name + Minecraft::GetInstance()->user->name = convStringToWstring( + ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); + bool success = g_NetworkManager.JoinGameFromInviteInfo( + iPad, // dwUserIndex + localUsersMask, // dwUserMask + pInviteInfo); // pInviteInfo + if (!success) { + app.DebugPrintf("Failed joining game from invite\n"); + } + } + } else { + app.DebugPrintf( + "JoinFromInvite_SignInReturned, failed sign-in tests :%d %d\n", + ProfileManager.IsSignedIn(iPad), + ProfileManager.IsSignedInLive(iPad)); + } + } + return 0; } -void CGameNetworkManager::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving) -{ - Minecraft *pMinecraft = Minecraft::GetInstance(); - TexturePack *tPack = pMinecraft->skins->getSelected(); - s_pPlatformNetworkManager->SetSessionTexturePackParentId( tPack->getDLCParentPackId() ); - s_pPlatformNetworkManager->SetSessionSubTexturePackId( tPack->getDLCSubPackId() ); +void CGameNetworkManager::UpdateAndSetGameSessionData( + INetworkPlayer* pNetworkPlayerLeaving) { + Minecraft* pMinecraft = Minecraft::GetInstance(); + TexturePack* tPack = pMinecraft->skins->getSelected(); + s_pPlatformNetworkManager->SetSessionTexturePackParentId( + tPack->getDLCParentPackId()); + s_pPlatformNetworkManager->SetSessionSubTexturePackId( + tPack->getDLCSubPackId()); - s_pPlatformNetworkManager->UpdateAndSetGameSessionData( pNetworkPlayerLeaving ); + s_pPlatformNetworkManager->UpdateAndSetGameSessionData( + pNetworkPlayerLeaving); } -void CGameNetworkManager::SendInviteGUI(int quadrant) -{ - s_pPlatformNetworkManager->SendInviteGUI(quadrant); +void CGameNetworkManager::SendInviteGUI(int quadrant) { + s_pPlatformNetworkManager->SendInviteGUI(quadrant); } -void CGameNetworkManager::ResetLeavingGame() -{ - s_pPlatformNetworkManager->ResetLeavingGame(); +void CGameNetworkManager::ResetLeavingGame() { + s_pPlatformNetworkManager->ResetLeavingGame(); } -bool CGameNetworkManager::IsNetworkThreadRunning() -{ - return m_bNetworkThreadRunning;; +bool CGameNetworkManager::IsNetworkThreadRunning() { + return m_bNetworkThreadRunning; + ; } -int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter ) -{ - // Share AABB & Vec3 pools with default (main thread) - should be ok as long as we don't tick the main thread whilst this thread is running - AABB::UseDefaultThreadStorage(); - Vec3::UseDefaultThreadStorage(); - Compression::UseDefaultThreadStorage(); - Tile::CreateNewThreadStorage(); - IntCache::CreateNewThreadStorage(); - - g_NetworkManager.m_bNetworkThreadRunning = true; - bool success = g_NetworkManager._RunNetworkGame(lpParameter); - g_NetworkManager.m_bNetworkThreadRunning = false; - if( !success) - { - TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); - while ( tPack->isLoadingData() || (Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin()) ) - { - Sleep(1); - } - ui.CleanUpSkinReload(); - if(app.GetDisconnectReason() == DisconnectPacket::eDisconnect_None) - { - app.SetDisconnectReason( DisconnectPacket::eDisconnect_ConnectionCreationFailed ); - } - // If we failed before the server started, clear the game rules. Otherwise the server will clear it up. - if(MinecraftServer::getInstance() == NULL) app.m_gameRules.unloadCurrentGameRules(); - Tile::ReleaseThreadStorage(); - return -1; - } +int CGameNetworkManager::RunNetworkGameThreadProc(void* lpParameter) { + // Share AABB & Vec3 pools with default (main thread) - should be ok as long + // as we don't tick the main thread whilst this thread is running + AABB::UseDefaultThreadStorage(); + Vec3::UseDefaultThreadStorage(); + Compression::UseDefaultThreadStorage(); + Tile::CreateNewThreadStorage(); + IntCache::CreateNewThreadStorage(); + + g_NetworkManager.m_bNetworkThreadRunning = true; + bool success = g_NetworkManager._RunNetworkGame(lpParameter); + g_NetworkManager.m_bNetworkThreadRunning = false; + if (!success) { + TexturePack* tPack = Minecraft::GetInstance()->skins->getSelected(); + while (tPack->isLoadingData() || + (Minecraft::GetInstance()->skins->needsUIUpdate() || + ui.IsReloadingSkin())) { + Sleep(1); + } + ui.CleanUpSkinReload(); + if (app.GetDisconnectReason() == DisconnectPacket::eDisconnect_None) { + app.SetDisconnectReason( + DisconnectPacket::eDisconnect_ConnectionCreationFailed); + } + // If we failed before the server started, clear the game rules. + // Otherwise the server will clear it up. + if (MinecraftServer::getInstance() == NULL) + app.m_gameRules.unloadCurrentGameRules(); + Tile::ReleaseThreadStorage(); + return -1; + } #ifdef __PSVITA__ - // 4J-JEV: Wait for the loading/saving to finish. - while (StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle) Sleep(10); + // 4J-JEV: Wait for the loading/saving to finish. + while (StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle) + Sleep(10); #endif - Tile::ReleaseThreadStorage(); - IntCache::ReleaseThreadStorage(); - return 0; + Tile::ReleaseThreadStorage(); + IntCache::ReleaseThreadStorage(); + return 0; } -int CGameNetworkManager::ServerThreadProc( void* lpParameter ) -{ - __int64 seed = 0; - if(lpParameter != NULL) - { - NetworkGameInitData *param = (NetworkGameInitData *)lpParameter; - seed = param->seed; - app.SetGameHostOption(eGameHostOption_All,param->settings); - } +int CGameNetworkManager::ServerThreadProc(void* lpParameter) { + int64_t seed = 0; + if (lpParameter != NULL) { + NetworkGameInitData* param = (NetworkGameInitData*)lpParameter; + seed = param->seed; + app.SetGameHostOption(eGameHostOption_All, param->settings); - SetThreadName(-1, "Minecraft Server thread"); - AABB::CreateNewThreadStorage(); - Vec3::CreateNewThreadStorage(); - IntCache::CreateNewThreadStorage(); - Compression::UseDefaultThreadStorage(); - OldChunkStorage::UseDefaultThreadStorage(); - Entity::useSmallIds(); - Level::enableLightingCache(); - Tile::CreateNewThreadStorage(); + // 4J Stu - If we are loading a DLC save that's separate from the + // texture pack, load + if (param->levelGen != NULL && + (param->texturePackId == 0 || + param->levelGen->getRequiredTexturePackId() != + param->texturePackId)) { + while ((Minecraft::GetInstance()->skins->needsUIUpdate() || + ui.IsReloadingSkin())) { + Sleep(1); + } + param->levelGen->loadBaseSaveData(); + } + } - MinecraftServer::main(seed, lpParameter); //saveData, app.GetGameHostOption(eGameHostOption_All)); - - Tile::ReleaseThreadStorage(); - AABB::ReleaseThreadStorage(); - Vec3::ReleaseThreadStorage(); - IntCache::ReleaseThreadStorage(); - Level::destroyLightingCache(); + SetThreadName(-1, "Minecraft Server thread"); + AABB::CreateNewThreadStorage(); + Vec3::CreateNewThreadStorage(); + IntCache::CreateNewThreadStorage(); + Compression::UseDefaultThreadStorage(); + OldChunkStorage::UseDefaultThreadStorage(); + Entity::useSmallIds(); + Level::enableLightingCache(); + Tile::CreateNewThreadStorage(); + FireworksRecipe::CreateNewThreadStorage(); - if(lpParameter != NULL) delete (NetworkGameInitData*)lpParameter; + MinecraftServer::main( + seed, + lpParameter); // saveData, app.GetGameHostOption(eGameHostOption_All)); - return 0; + Tile::ReleaseThreadStorage(); + AABB::ReleaseThreadStorage(); + Vec3::ReleaseThreadStorage(); + IntCache::ReleaseThreadStorage(); + Level::destroyLightingCache(); + + if (lpParameter != NULL) delete (NetworkGameInitData*)lpParameter; + + return S_OK; } -int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam ) -{ - // Share AABB & Vec3 pools with default (main thread) - should be ok as long as we don't tick the main thread whilst this thread is running - AABB::UseDefaultThreadStorage(); - Vec3::UseDefaultThreadStorage(); - Compression::UseDefaultThreadStorage(); +int CGameNetworkManager::ExitAndJoinFromInviteThreadProc(void* lpParam) { + // Share AABB & Vec3 pools with default (main thread) - should be ok as long + // as we don't tick the main thread whilst this thread is running + AABB::UseDefaultThreadStorage(); + Vec3::UseDefaultThreadStorage(); + Compression::UseDefaultThreadStorage(); - //app.SetGameStarted(false); + // app.SetGameStarted(false); + UIScene_PauseMenu::_ExitWorld(NULL); -#ifndef __PSVITA__ - UIScene_PauseMenu::_ExitWorld(NULL); -#endif + while (g_NetworkManager.IsInSession()) { + Sleep(1); + } - while( g_NetworkManager.IsInSession() ) - { - Sleep(1); - } - - // Xbox should always be online when receiving invites - on PS3 we need to check & ask the user to sign in -#ifndef __PS3__ - JoinFromInviteData *inviteData = (JoinFromInviteData *)lpParam; - app.SetAction(inviteData->dwUserIndex, eAppAction_JoinFromInvite, 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; + app.SetAction(inviteData->dwUserIndex, eAppAction_JoinFromInvite, lpParam); #else - if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) - { - JoinFromInviteData *inviteData = (JoinFromInviteData *)lpParam; - app.SetAction(inviteData->dwUserIndex, eAppAction_JoinFromInvite, lpParam); - } - else - { - unsigned int uiIDA[2]; - uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CGameNetworkManager::MustSignInReturned_0,lpParam, app.GetStringTable()); - } + if (ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) { + JoinFromInviteData* inviteData = (JoinFromInviteData*)lpParam; + app.SetAction(inviteData->dwUserIndex, eAppAction_JoinFromInvite, + lpParam); + } else { + unsigned int uiIDA[2]; + uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; + uiIDA[1] = IDS_PRO_NOTONLINE_DECLINE; + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, + uiIDA, 2, ProfileManager.GetPrimaryPad(), + &CGameNetworkManager::MustSignInReturned_0, + lpParam); + } #endif - return 0; + return S_OK; } #if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__ -// This case happens when we have been returned from the game to the main menu after receiving an invite and are now trying to go back in to join the new game -// The pair of methods MustSignInReturned_0 & PSNSignInReturned_0 handle this -int CGameNetworkManager::MustSignInReturned_0(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - if(result==C4JStorage::EMessage_ResultAccept) - { +// This case happens when we have been returned from the game to the main menu +// after receiving an invite and are now trying to go back in to join the new +// game The pair of methods MustSignInReturned_0 & PSNSignInReturned_0 handle +// this +int CGameNetworkManager::MustSignInReturned_0( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + if (result == C4JStorage::EMessage_ResultAccept) { #ifdef __PS3__ - SQRNetworkManager_PS3::AttemptPSNSignIn(&CGameNetworkManager::PSNSignInReturned_0, pParam,true); + SQRNetworkManager_PS3::AttemptPSNSignIn( + &CGameNetworkManager::PSNSignInReturned_0, pParam, true); #elif defined __PSVITA__ - SQRNetworkManager_Vita::AttemptPSNSignIn(&CGameNetworkManager::PSNSignInReturned_0, pParam,true); + SQRNetworkManager_Vita::AttemptPSNSignIn( + &CGameNetworkManager::PSNSignInReturned_0, pParam, true); #elif defined __ORBIS__ - SQRNetworkManager_Orbis::AttemptPSNSignIn(&CGameNetworkManager::PSNSignInReturned_0, pParam,true); + SQRNetworkManager_Orbis::AttemptPSNSignIn( + &CGameNetworkManager::PSNSignInReturned_0, pParam, true); #endif - } - else - { - app.SetAction(0,eAppAction_Idle); - ui.NavigateToHomeMenu(); - ui.UpdatePlayerBasePositions(); - } + } else { + app.SetAction(0, eAppAction_Idle); + ui.NavigateToHomeMenu(); + ui.UpdatePlayerBasePositions(); + } - return 0; + return 0; } -int CGameNetworkManager::PSNSignInReturned_0(void* pParam, bool bContinue, int iPad) -{ - JoinFromInviteData *inviteData = (JoinFromInviteData *)pParam; +int CGameNetworkManager::PSNSignInReturned_0(void* pParam, bool bContinue, + int iPad) { + JoinFromInviteData* inviteData = (JoinFromInviteData*)pParam; - // If the invite data isn't set up yet (indicated by it being all zeroes, easiest detected via the net version), then try and get it again... this can happen if we got - // the invite whilst signed out + // If the invite data isn't set up yet (indicated by it being all zeroes, + // easiest detected via the net version), then try and get it again... this + // can happen if we got the invite whilst signed out - if( bContinue ) - { - if(inviteData->pInviteInfo->netVersion == 0) - { + if (bContinue) { + if (inviteData->pInviteInfo->netVersion == 0) { #if defined __PS3__ || defined __VITA__ - if(!SQRNetworkManager_PS3::UpdateInviteData((SQRNetworkManager::PresenceSyncInfo *)inviteData->pInviteInfo)) - { - bContinue = false; - } + if (!SQRNetworkManager_PS3::UpdateInviteData( + (SQRNetworkManager::PresenceSyncInfo*) + inviteData->pInviteInfo)) { + bContinue = false; + } #elif defined __ORBIS__ - // TODO: No Orbis equivalent (should there be?) + // TODO: No Orbis equivalent (should there be?) #endif - } - } + } + } - if( bContinue ) - { - app.SetAction(inviteData->dwUserIndex, eAppAction_JoinFromInvite, pParam); - } - else - { - app.SetAction(inviteData->dwUserIndex,eAppAction_Idle); - ui.NavigateToHomeMenu(); - ui.UpdatePlayerBasePositions(); - } + if (bContinue) { + app.SetAction(inviteData->dwUserIndex, eAppAction_JoinFromInvite, + pParam); + } else { + app.SetAction(inviteData->dwUserIndex, eAppAction_Idle); + ui.NavigateToHomeMenu(); + ui.UpdatePlayerBasePositions(); + } - return 0; + return 0; } -// This case happens when we were in the main menus when we got an invite, and weren't signed in... now can proceed with the normal flow of code for this situation -// The pair of methods MustSignInReturned_1 & PSNSignInReturned_1 handle this -int CGameNetworkManager::MustSignInReturned_1(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - if(result==C4JStorage::EMessage_ResultAccept) - { +// This case happens when we were in the main menus when we got an invite, and +// weren't signed in... now can proceed with the normal flow of code for this +// situation The pair of methods MustSignInReturned_1 & PSNSignInReturned_1 +// handle this +int CGameNetworkManager::MustSignInReturned_1( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + if (result == C4JStorage::EMessage_ResultAccept) { #ifdef __PS3__ - SQRNetworkManager_PS3::AttemptPSNSignIn(&CGameNetworkManager::PSNSignInReturned_1, pParam,true); + SQRNetworkManager_PS3::AttemptPSNSignIn( + &CGameNetworkManager::PSNSignInReturned_1, pParam, true); #elif defined __PSVITA__ - SQRNetworkManager_Vita::AttemptPSNSignIn(&CGameNetworkManager::PSNSignInReturned_1, pParam,true); + SQRNetworkManager_Vita::AttemptPSNSignIn( + &CGameNetworkManager::PSNSignInReturned_1, pParam, true); #elif defined __ORBIS__ - SQRNetworkManager_Orbis::AttemptPSNSignIn(&CGameNetworkManager::PSNSignInReturned_1, pParam,true); + SQRNetworkManager_Orbis::AttemptPSNSignIn( + &CGameNetworkManager::PSNSignInReturned_1, pParam, true); #endif - } - return 0; + } + return 0; } -int CGameNetworkManager::PSNSignInReturned_1(void* pParam, bool bContinue, int iPad) -{ - INVITE_INFO *inviteInfo = (INVITE_INFO *)pParam; +int CGameNetworkManager::PSNSignInReturned_1(void* pParam, bool bContinue, + int iPad) { + INVITE_INFO* inviteInfo = (INVITE_INFO*)pParam; - // If the invite data isn't set up yet (indicated by it being all zeroes, easiest detected via the net version), then try and get it again... this can happen if we got - // the invite whilst signed out + // If the invite data isn't set up yet (indicated by it being all zeroes, + // easiest detected via the net version), then try and get it again... this + // can happen if we got the invite whilst signed out - if( bContinue ) - { - if(inviteInfo->netVersion == 0) - { + if (bContinue) { + if (inviteInfo->netVersion == 0) { #if defined __PS3__ || defined __VITA__ - if(!SQRNetworkManager_PS3::UpdateInviteData((SQRNetworkManager::PresenceSyncInfo *)inviteInfo)) - { - bContinue = false; - } + if (!SQRNetworkManager_PS3::UpdateInviteData( + (SQRNetworkManager::PresenceSyncInfo*)inviteInfo)) { + bContinue = false; + } #elif defined __ORBIS__ - // TODO: No Orbis equivalent (should there be?) + // TODO: No Orbis equivalent (should there be?) #endif - - } - } + } + } - if( bContinue ) - { - g_NetworkManager.HandleInviteWhenInMenus(0, inviteInfo); - } + if (bContinue) { + g_NetworkManager.HandleInviteWhenInMenus(0, inviteInfo); + } - return 0; + return 0; } #endif -void CGameNetworkManager::_LeaveGame() -{ - s_pPlatformNetworkManager->_LeaveGame(false, true); +void CGameNetworkManager::_LeaveGame() { + s_pPlatformNetworkManager->_LeaveGame(false, true); } -int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam ) -{ - // Share AABB & Vec3 pools with default (main thread) - should be ok as long as we don't tick the main thread whilst this thread is running - AABB::UseDefaultThreadStorage(); - Vec3::UseDefaultThreadStorage(); - Compression::UseDefaultThreadStorage(); +int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) { + // Share AABB & Vec3 pools with default (main thread) - should be ok as long + // as we don't tick the main thread whilst this thread is running + AABB::UseDefaultThreadStorage(); + Vec3::UseDefaultThreadStorage(); + Compression::UseDefaultThreadStorage(); - Minecraft *pMinecraft = Minecraft::GetInstance(); - MinecraftServer *pServer = MinecraftServer::getInstance(); + Minecraft* pMinecraft = Minecraft::GetInstance(); + MinecraftServer* pServer = MinecraftServer::getInstance(); #if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__ - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - if( g_NetworkManager.m_bLastDisconnectWasLostRoomOnly ) - { - if(g_NetworkManager.m_bSignedOutofPSN) - { - C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME, IDS_ERROR_PSN_SIGN_OUT, uiIDA,1,ProfileManager.GetPrimaryPad()); - } - else - { - C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME, uiIDA,1,ProfileManager.GetPrimaryPad()); - } - } - else - { - C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_CONNECTION_LOST, g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT), uiIDA,1,ProfileManager.GetPrimaryPad()); - } + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + if (g_NetworkManager.m_bLastDisconnectWasLostRoomOnly) { + if (g_NetworkManager.m_bSignedOutofPSN) { + C4JStorage::EMessageResult result = ui.RequestErrorMessage( + IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME, IDS_ERROR_PSN_SIGN_OUT, + uiIDA, 1, ProfileManager.GetPrimaryPad()); + } else { + C4JStorage::EMessageResult result = ui.RequestErrorMessage( + IDS_ERROR_NETWORK_TITLE, + IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME, uiIDA, 1, + ProfileManager.GetPrimaryPad()); + } + } else { + C4JStorage::EMessageResult result = ui.RequestErrorMessage( + IDS_CONNECTION_LOST, + g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT), + uiIDA, 1, ProfileManager.GetPrimaryPad()); + } - // Swap these two messages around as one is too long to display at 480 - pMinecraft->progressRenderer->progressStartNoAbort( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME ); - pMinecraft->progressRenderer->progressStage( -1 ); //g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT) ); + // Swap these two messages around as one is too long to display at 480 + pMinecraft->progressRenderer->progressStartNoAbort( + IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME); + pMinecraft->progressRenderer->progressStage( + -1); // g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT) + // ); #elif defined(_XBOX_ONE) - if( g_NetworkManager.m_bFullSessionMessageOnNextSessionChange ) - { - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME, IDS_IN_PARTY_SESSION_FULL, uiIDA,1,ProfileManager.GetPrimaryPad()); - pMinecraft->progressRenderer->progressStartNoAbort( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME ); - pMinecraft->progressRenderer->progressStage( -1 ); - } - else - { - pMinecraft->progressRenderer->progressStartNoAbort( g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT) ); - pMinecraft->progressRenderer->progressStage( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME ); - } - + if (g_NetworkManager.m_bFullSessionMessageOnNextSessionChange) { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + C4JStorage::EMessageResult result = ui.RequestErrorMessage( + IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME, IDS_IN_PARTY_SESSION_FULL, + uiIDA, 1, ProfileManager.GetPrimaryPad()); + pMinecraft->progressRenderer->progressStartNoAbort( + IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME); + pMinecraft->progressRenderer->progressStage(-1); + } else { + pMinecraft->progressRenderer->progressStartNoAbort( + g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT)); + pMinecraft->progressRenderer->progressStage( + IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME); + } + #else - pMinecraft->progressRenderer->progressStartNoAbort( g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT) ); - pMinecraft->progressRenderer->progressStage( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME ); + pMinecraft->progressRenderer->progressStartNoAbort( + g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT)); + pMinecraft->progressRenderer->progressStage( + IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME); #endif - while( app.GetXuiServerAction(ProfileManager.GetPrimaryPad() ) != eXuiServerAction_Idle && !MinecraftServer::serverHalted() ) - { - Sleep(10); - } - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_PauseServer,(void *)TRUE); + while (app.GetXuiServerAction(ProfileManager.GetPrimaryPad()) != + eXuiServerAction_Idle && + !MinecraftServer::serverHalted()) { + Sleep(10); + } + app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + eXuiServerAction_PauseServer, (void*)TRUE); + + // wait for the server to be in a non-ticking state + pServer->m_serverPausedEvent->WaitForSignal(INFINITE); - // wait for the server to be in a non-ticking state - pServer->m_serverPausedEvent->WaitForSignal(INFINITE); - #if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__ - // Swap these two messages around as one is too long to display at 480 - pMinecraft->progressRenderer->progressStartNoAbort( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME ); - pMinecraft->progressRenderer->progressStage( -1 ); //g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT) ); + // Swap these two messages around as one is too long to display at 480 + pMinecraft->progressRenderer->progressStartNoAbort( + IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME); + pMinecraft->progressRenderer->progressStage( + -1); // g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT) + // ); #elif defined(_XBOX_ONE) - if( g_NetworkManager.m_bFullSessionMessageOnNextSessionChange ) - { - pMinecraft->progressRenderer->progressStartNoAbort( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME ); - pMinecraft->progressRenderer->progressStage( -1 ); - } - else - { - pMinecraft->progressRenderer->progressStartNoAbort( g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT) ); - pMinecraft->progressRenderer->progressStage( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME ); - } + if (g_NetworkManager.m_bFullSessionMessageOnNextSessionChange) { + pMinecraft->progressRenderer->progressStartNoAbort( + IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME); + pMinecraft->progressRenderer->progressStage(-1); + } else { + pMinecraft->progressRenderer->progressStartNoAbort( + g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT)); + pMinecraft->progressRenderer->progressStage( + IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME); + } #else - pMinecraft->progressRenderer->progressStartNoAbort( g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT) ); - pMinecraft->progressRenderer->progressStage( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME ); + pMinecraft->progressRenderer->progressStartNoAbort( + g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT)); + pMinecraft->progressRenderer->progressStage( + IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME); #endif - pMinecraft->progressRenderer->progressStagePercentage(25); + pMinecraft->progressRenderer->progressStagePercentage(25); #ifdef _XBOX_ONE - // wait for any players that were being added, to finish doing this. On XB1, if we don't do this then there's an async thread running doing this, - // which could then finish at any inappropriate time later - while( s_pPlatformNetworkManager->IsAddingPlayer() ) - { - Sleep(1); - } + // wait for any players that were being added, to finish doing this. On XB1, + // if we don't do this then there's an async thread running doing this, + // which could then finish at any inappropriate time later + while (s_pPlatformNetworkManager->IsAddingPlayer()) { + Sleep(1); + } #endif - // Null the network player of all the server players that are local, to stop them being removed from the server when removed from the session - if( pServer != NULL ) - { - PlayerList *players = pServer->getPlayers(); - for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it) - { - std::shared_ptr servPlayer = *it; - if( servPlayer->connection->isLocal() && !servPlayer->connection->isGuest() ) - { - servPlayer->connection->connection->getSocket()->setPlayer(NULL); - } - } - } + // Null the network player of all the server players that are local, to stop + // them being removed from the server when removed from the session + if (pServer != NULL) { + PlayerList* players = pServer->getPlayers(); + for (AUTO_VAR(it, players->players.begin()); + it < players->players.end(); ++it) { + std::shared_ptr servPlayer = *it; + if (servPlayer->connection->isLocal() && + !servPlayer->connection->isGuest()) { + servPlayer->connection->connection->getSocket()->setPlayer( + NULL); + } + } + } - // delete the current session - if we weren't actually disconnected fully from the network but have just lost our room, then pass a bLeaveRoom flag of false - // here as by definition we don't need to leave the room (again). This is currently only an issue for sony platforms. - if( g_NetworkManager.m_bLastDisconnectWasLostRoomOnly ) - { - s_pPlatformNetworkManager->_LeaveGame(false, false); - } - else - { - s_pPlatformNetworkManager->_LeaveGame(false, true); - } + // delete the current session - if we weren't actually disconnected fully + // from the network but have just lost our room, then pass a bLeaveRoom flag + // of false here as by definition we don't need to leave the room (again). + // This is currently only an issue for sony platforms. + if (g_NetworkManager.m_bLastDisconnectWasLostRoomOnly) { + s_pPlatformNetworkManager->_LeaveGame(false, false); + } else { + s_pPlatformNetworkManager->_LeaveGame(false, true); + } - // wait for the current session to end - while( g_NetworkManager.IsInSession() ) - { - Sleep(1); - } - - // Reset this flag as the we don't need to know that we only lost the room only from this point onwards, the behaviour is exactly the same - g_NetworkManager.m_bLastDisconnectWasLostRoomOnly = false; - g_NetworkManager.m_bFullSessionMessageOnNextSessionChange = false; + // wait for the current session to end + while (g_NetworkManager.IsInSession()) { + Sleep(1); + } - pMinecraft->progressRenderer->progressStagePercentage(50); + // Reset this flag as the we don't need to know that we only lost the room + // only from this point onwards, the behaviour is exactly the same + g_NetworkManager.m_bLastDisconnectWasLostRoomOnly = false; + g_NetworkManager.m_bFullSessionMessageOnNextSessionChange = false; - // Defaulting to making this a local game - g_NetworkManager.SetLocalGame(true); + pMinecraft->progressRenderer->progressStagePercentage(50); - // Create a new session with all the players that were in the old one - int localUsersMask = 0; - char numLocalPlayers = 0; - for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) - { - if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != NULL ) - { - numLocalPlayers++; - localUsersMask |= GetLocalPlayerMask(index); - } - } + // Defaulting to making this a local game + g_NetworkManager.SetLocalGame(true); - s_pPlatformNetworkManager->_HostGame( localUsersMask ); + // Create a new session with all the players that were in the old one + int localUsersMask = 0; + char numLocalPlayers = 0; + for (unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) { + if (ProfileManager.IsSignedIn(index) && + pMinecraft->localplayers[index] != NULL) { + numLocalPlayers++; + localUsersMask |= GetLocalPlayerMask(index); + } + } - pMinecraft->progressRenderer->progressStagePercentage(75); + s_pPlatformNetworkManager->_HostGame(localUsersMask); - // Wait for all the local players to rejoin the session - while( g_NetworkManager.GetPlayerCount() < numLocalPlayers ) - { - Sleep(1); - } - - // Restore the network player of all the server players that are local - if( pServer != NULL ) - { - for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) - { - if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != NULL ) - { - PlayerUID localPlayerXuid = pMinecraft->localplayers[index]->getXuid(); + pMinecraft->progressRenderer->progressStagePercentage(75); - PlayerList *players = pServer->getPlayers(); - for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it) - { - std::shared_ptr servPlayer = *it; - if( servPlayer->getXuid() == localPlayerXuid ) - { - servPlayer->connection->connection->getSocket()->setPlayer( g_NetworkManager.GetLocalPlayerByUserIndex(index) ); - } - } + // Wait for all the local players to rejoin the session + while (g_NetworkManager.GetPlayerCount() < numLocalPlayers) { + Sleep(1); + } - // Player might have a pending connection - if (pMinecraft->m_pendingLocalConnections[index] != NULL) - { - // Update the network player - pMinecraft->m_pendingLocalConnections[index]->getConnection()->getSocket()->setPlayer(g_NetworkManager.GetLocalPlayerByUserIndex(index)); - } - } - } - } - - pMinecraft->progressRenderer->progressStagePercentage(100); + // Restore the network player of all the server players that are local + if (pServer != NULL) { + for (unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) { + if (ProfileManager.IsSignedIn(index) && + pMinecraft->localplayers[index] != NULL) { + PlayerUID localPlayerXuid = + pMinecraft->localplayers[index]->getXuid(); + + PlayerList* players = pServer->getPlayers(); + for (AUTO_VAR(it, players->players.begin()); + it < players->players.end(); ++it) { + std::shared_ptr servPlayer = *it; + if (servPlayer->getXuid() == localPlayerXuid) { + servPlayer->connection->connection->getSocket() + ->setPlayer( + g_NetworkManager.GetLocalPlayerByUserIndex( + index)); + } + } + + // Player might have a pending connection + if (pMinecraft->m_pendingLocalConnections[index] != NULL) { + // Update the network player + pMinecraft->m_pendingLocalConnections[index] + ->getConnection() + ->getSocket() + ->setPlayer( + g_NetworkManager.GetLocalPlayerByUserIndex(index)); + } else if (pMinecraft->m_connectionFailed[index] && + (pMinecraft->m_connectionFailedReason[index] == + DisconnectPacket:: + eDisconnect_ConnectionCreationFailed)) { + pMinecraft->removeLocalPlayerIdx(index); +#ifdef _XBOX_ONE + ProfileManager.RemoveGamepadFromGame(index); +#endif + } + } + } + } + + pMinecraft->progressRenderer->progressStagePercentage(100); #ifndef _XBOX - // Make sure that we have transitioned through any joining/creating stages so we're actually ready to set to play - while(!s_pPlatformNetworkManager->IsReadyToPlayOrIdle()) - { - Sleep(10); - } + // Make sure that we have transitioned through any joining/creating stages + // so we're actually ready to set to play + while (!s_pPlatformNetworkManager->IsReadyToPlayOrIdle()) { + Sleep(10); + } #endif - s_pPlatformNetworkManager->_StartGame(); + s_pPlatformNetworkManager->_StartGame(); #ifndef _XBOX - // Wait until the message box has been closed - while(ui.IsSceneInStack(XUSER_INDEX_ANY, eUIScene_MessageBox)) - { - Sleep(10); - } + // Wait until the message box has been closed + while (ui.IsSceneInStack(XUSER_INDEX_ANY, eUIScene_MessageBox)) { + Sleep(10); + } #endif - // Start the game again - app.SetGameStarted(true); - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_PauseServer,(void *)FALSE); - app.SetChangingSessionType(false); - app.SetReallyChangingSessionType(false); - - return 0; + // Start the game again + app.SetGameStarted(true); + app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + eXuiServerAction_PauseServer, (void*)FALSE); + app.SetChangingSessionType(false); + app.SetReallyChangingSessionType(false); + return S_OK; } -void CGameNetworkManager::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index) -{ - s_pPlatformNetworkManager->SystemFlagSet( pNetworkPlayer, index ); +void CGameNetworkManager::SystemFlagSet(INetworkPlayer* pNetworkPlayer, + int index) { + s_pPlatformNetworkManager->SystemFlagSet(pNetworkPlayer, index); } -bool CGameNetworkManager::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index) -{ - return s_pPlatformNetworkManager->SystemFlagGet( pNetworkPlayer, index ); +bool CGameNetworkManager::SystemFlagGet(INetworkPlayer* pNetworkPlayer, + int index) { + return s_pPlatformNetworkManager->SystemFlagGet(pNetworkPlayer, index); } -std::wstring CGameNetworkManager::GatherStats() -{ - return s_pPlatformNetworkManager->GatherStats(); +std::wstring CGameNetworkManager::GatherStats() { + return s_pPlatformNetworkManager->GatherStats(); } -void CGameNetworkManager::renderQueueMeter() -{ +void CGameNetworkManager::renderQueueMeter() { #ifdef _XBOX - int height = 720; + int height = 720; - CGameNetworkManager::byteQueue[(CGameNetworkManager::messageQueuePos) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeBytes(NULL, false); - CGameNetworkManager::messageQueue[(CGameNetworkManager::messageQueuePos++) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeMessages(NULL, false); + CGameNetworkManager::byteQueue[(CGameNetworkManager::messageQueuePos) & + (CGameNetworkManager::messageQueue_length - + 1)] = + GetHostPlayer()->GetSendQueueSizeBytes(NULL, false); + CGameNetworkManager::messageQueue + [(CGameNetworkManager::messageQueuePos++) & + (CGameNetworkManager::messageQueue_length - 1)] = + GetHostPlayer()->GetSendQueueSizeMessages(NULL, false); - Minecraft *pMinecraft = Minecraft::GetInstance(); - pMinecraft->gui->renderGraph(CGameNetworkManager::messageQueue_length, CGameNetworkManager::messageQueuePos, CGameNetworkManager::messageQueue, 10, 1000, CGameNetworkManager::byteQueue, 100, 25000); + Minecraft* pMinecraft = Minecraft::GetInstance(); + pMinecraft->gui->renderGraph(CGameNetworkManager::messageQueue_length, + CGameNetworkManager::messageQueuePos, + CGameNetworkManager::messageQueue, 10, 1000, + CGameNetworkManager::byteQueue, 100, 25000); #endif } -std::wstring CGameNetworkManager::GatherRTTStats() -{ - return s_pPlatformNetworkManager->GatherRTTStats(); +std::wstring CGameNetworkManager::GatherRTTStats() { + return s_pPlatformNetworkManager->GatherRTTStats(); } -void CGameNetworkManager::StateChange_AnyToHosting() -{ - app.DebugPrintf("Disabling Guest Signin\n"); - XEnableGuestSignin(FALSE); - Minecraft::GetInstance()->clearPendingClientTextureRequests(); +void CGameNetworkManager::StateChange_AnyToHosting() { + app.DebugPrintf("Disabling Guest Signin\n"); + XEnableGuestSignin(FALSE); + Minecraft::GetInstance()->clearPendingClientTextureRequests(); } -void CGameNetworkManager::StateChange_AnyToJoining() -{ - app.DebugPrintf("Disabling Guest Signin\n"); - XEnableGuestSignin(FALSE); - Minecraft::GetInstance()->clearPendingClientTextureRequests(); - - ConnectionProgressParams *param = new ConnectionProgressParams(); - param->iPad = ProfileManager.GetPrimaryPad(); - param->stringId = -1; - param->showTooltips = false; - param->setFailTimer = true; - param->timerTime = CONNECTING_PROGRESS_CHECK_TIME; +void CGameNetworkManager::StateChange_AnyToJoining() { + app.DebugPrintf("Disabling Guest Signin\n"); + XEnableGuestSignin(FALSE); + Minecraft::GetInstance()->clearPendingClientTextureRequests(); - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_ConnectingProgress, param); + ConnectionProgressParams* param = new ConnectionProgressParams(); + param->iPad = ProfileManager.GetPrimaryPad(); + param->stringId = -1; + param->showTooltips = false; + param->setFailTimer = true; + param->timerTime = CONNECTING_PROGRESS_CHECK_TIME; + + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_ConnectingProgress, param); } -void CGameNetworkManager::StateChange_JoiningToIdle(CPlatformNetworkManager::eJoinFailedReason reason) -{ - DisconnectPacket::eDisconnectReason disconnectReason; - switch(reason) - { - case CPlatformNetworkManager::JOIN_FAILED_SERVER_FULL: - disconnectReason = DisconnectPacket::eDisconnect_ServerFull; - break; - case CPlatformNetworkManager::JOIN_FAILED_INSUFFICIENT_PRIVILEGES: - disconnectReason = DisconnectPacket::eDisconnect_NoMultiplayerPrivilegesJoin; - app.SetAction(ProfileManager.GetPrimaryPad(),eAppAction_FailedToJoinNoPrivileges); - break; - default: - disconnectReason = DisconnectPacket::eDisconnect_ConnectionCreationFailed; - break; - }; - Minecraft::GetInstance()->connectionDisconnected(ProfileManager.GetPrimaryPad(), disconnectReason); +void CGameNetworkManager::StateChange_JoiningToIdle( + CPlatformNetworkManager::eJoinFailedReason reason) { + DisconnectPacket::eDisconnectReason disconnectReason; + switch (reason) { + case CPlatformNetworkManager::JOIN_FAILED_SERVER_FULL: + disconnectReason = DisconnectPacket::eDisconnect_ServerFull; + break; + case CPlatformNetworkManager::JOIN_FAILED_INSUFFICIENT_PRIVILEGES: + disconnectReason = + DisconnectPacket::eDisconnect_NoMultiplayerPrivilegesJoin; + app.SetAction(ProfileManager.GetPrimaryPad(), + eAppAction_FailedToJoinNoPrivileges); + break; + default: + disconnectReason = + DisconnectPacket::eDisconnect_ConnectionCreationFailed; + break; + }; + Minecraft::GetInstance()->connectionDisconnected( + ProfileManager.GetPrimaryPad(), disconnectReason); } -void CGameNetworkManager::StateChange_AnyToStarting() -{ +void CGameNetworkManager::StateChange_AnyToStarting() { #if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ - app.getRemoteStorage()->shutdown(); // shut the remote storage lib down and hopefully get our 7mb back + app.getRemoteStorage()->shutdown(); // shut the remote storage lib down and + // hopefully get our 7mb back #endif - if(!g_NetworkManager.IsHost()) - { - LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = NULL; + if (!g_NetworkManager.IsHost()) { + LoadingInputParams* loadingParams = new LoadingInputParams(); + loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; + loadingParams->lpParam = NULL; - UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); - completionData->bShowBackground=TRUE; - completionData->bShowLogo=TRUE; - completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes; - completionData->iPad = ProfileManager.GetPrimaryPad(); - loadingParams->completionData = completionData; - - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams); - } + UIFullscreenProgressCompletionData* completionData = + new UIFullscreenProgressCompletionData(); + completionData->bShowBackground = TRUE; + completionData->bShowLogo = TRUE; + completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes; + completionData->iPad = ProfileManager.GetPrimaryPad(); + loadingParams->completionData = completionData; + + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_FullscreenProgress, loadingParams); + } } -void CGameNetworkManager::StateChange_AnyToEnding(bool bStateWasPlaying) -{ - // Kick off a stats write for players that are signed into LIVE, if this is a local game - if( bStateWasPlaying && g_NetworkManager.IsLocalGame() ) - { - for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) - { - INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(i); - if(pNetworkPlayer != NULL && ProfileManager.IsSignedIn( i ) ) - { - app.DebugPrintf("Stats save for an offline game for the player at index %d\n", i ); - Minecraft::GetInstance()->forceStatsSave(pNetworkPlayer->GetUserIndex()); - } - } - } +void CGameNetworkManager::StateChange_AnyToEnding(bool bStateWasPlaying) { + // Kick off a stats write for players that are signed into LIVE, if this is + // a local game + if (bStateWasPlaying && g_NetworkManager.IsLocalGame()) { + for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { + INetworkPlayer* pNetworkPlayer = + g_NetworkManager.GetLocalPlayerByUserIndex(i); + if (pNetworkPlayer != NULL && ProfileManager.IsSignedIn(i)) { + app.DebugPrintf( + "Stats save for an offline game for the player at index " + "%d\n", + i); + Minecraft::GetInstance()->forceStatsSave( + pNetworkPlayer->GetUserIndex()); + } + } + } - Minecraft::GetInstance()->gui->clearMessages(); + Minecraft::GetInstance()->gui->clearMessages(); - if(!g_NetworkManager.IsHost() && !g_NetworkManager.IsLeavingGame() ) - { - // 4J Stu - If the host is saving then it might take a while to quite the session, so do it ourself - //m_bLeavingGame = true; + if (!g_NetworkManager.IsHost() && !g_NetworkManager.IsLeavingGame()) { + // 4J Stu - If the host is saving then it might take a while to quite + // the session, so do it ourself + // m_bLeavingGame = true; - // The host has notified that the game is about to end - if(app.GetDisconnectReason() == DisconnectPacket::eDisconnect_None) app.SetDisconnectReason( DisconnectPacket::eDisconnect_Quitting ); - app.SetAction(ProfileManager.GetPrimaryPad(),eAppAction_ExitWorld,(void *)TRUE); - } + // The host has notified that the game is about to end + if (app.GetDisconnectReason() == DisconnectPacket::eDisconnect_None) + app.SetDisconnectReason(DisconnectPacket::eDisconnect_Quitting); + app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_ExitWorld, + (void*)TRUE); + } } -void CGameNetworkManager::StateChange_AnyToIdle() -{ - app.DebugPrintf("Enabling Guest Signin\n"); - XEnableGuestSignin(TRUE); - // Reset this here so that we can search for games again - // 4J Stu - If we are changing session type there is a race between that thread setting the game to local, and this setting it to not local - if(!app.GetChangingSessionType()) g_NetworkManager.SetLocalGame( false ); - +void CGameNetworkManager::StateChange_AnyToIdle() { + app.DebugPrintf("Enabling Guest Signin\n"); + XEnableGuestSignin(TRUE); + // Reset this here so that we can search for games again + // 4J Stu - If we are changing session type there is a race between that + // thread setting the game to local, and this setting it to not local + if (!app.GetChangingSessionType()) g_NetworkManager.SetLocalGame(false); } -void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool localPlayer ) -{ - Minecraft *pMinecraft = Minecraft::GetInstance(); +void CGameNetworkManager::CreateSocket(INetworkPlayer* pNetworkPlayer, + bool localPlayer) { + Minecraft* pMinecraft = Minecraft::GetInstance(); - Socket *socket = NULL; - std::shared_ptr mpPlayer = pMinecraft->localplayers[pNetworkPlayer->GetUserIndex()]; - if( localPlayer && mpPlayer != NULL && mpPlayer->connection != NULL) - { - // If we already have a MultiplayerLocalPlayer here then we are doing a session type change - socket = mpPlayer->connection->getSocket(); + Socket* socket = NULL; + std::shared_ptr mpPlayer = + pMinecraft->localplayers[pNetworkPlayer->GetUserIndex()]; + if (localPlayer && mpPlayer != NULL && mpPlayer->connection != NULL) { + // If we already have a MultiplayerLocalPlayer here then we are doing a + // session type change + socket = mpPlayer->connection->getSocket(); - // Pair this socket and network player - pNetworkPlayer->SetSocket( socket); - if( socket ) - { - socket->setPlayer( pNetworkPlayer ); - } - } - else - { - socket = new Socket( pNetworkPlayer, g_NetworkManager.IsHost(), g_NetworkManager.IsHost() && localPlayer ); - pNetworkPlayer->SetSocket( socket ); + // Pair this socket and network player + pNetworkPlayer->SetSocket(socket); + if (socket) { + socket->setPlayer(pNetworkPlayer); + } + } else { + socket = new Socket(pNetworkPlayer, g_NetworkManager.IsHost(), + g_NetworkManager.IsHost() && localPlayer); + pNetworkPlayer->SetSocket(socket); - // 4J Stu - May be other states we want to accept aswell - // Add this user to the game server if the game is started already - if( g_NetworkManager.IsHost() && g_NetworkManager.IsInGameplay() ) - { - Socket::addIncomingSocket(socket); - } + // 4J Stu - May be other states we want to accept aswell + // Add this user to the game server if the game is started already + if (g_NetworkManager.IsHost() && g_NetworkManager.IsInGameplay()) { + Socket::addIncomingSocket(socket); + } - // If this is a local player and we are already in the game, we need to setup a local connection and log - // the player in to the game server - if( localPlayer && g_NetworkManager.IsInGameplay() ) - { - int idx = pNetworkPlayer->GetUserIndex(); - app.DebugPrintf("Creating new client connection for idx: %d\n", idx); + // If this is a local player and we are already in the game, we need to + // setup a local connection and log the player in to the game server + if (localPlayer && g_NetworkManager.IsInGameplay()) { + int idx = pNetworkPlayer->GetUserIndex(); + app.DebugPrintf("Creating new client connection for idx: %d\n", + idx); - ClientConnection *connection; - connection = new ClientConnection(pMinecraft, socket, idx); - - if( connection->createdOk ) - { - connection->send( std::shared_ptr( new PreLoginPacket( pNetworkPlayer->GetOnlineName() ) ) ); - pMinecraft->addPendingLocalConnection(idx, connection); - } - else - { - pMinecraft->connectionDisconnected( idx , DisconnectPacket::eDisconnect_ConnectionCreationFailed ); - delete connection; - connection = NULL; - } - } - } + ClientConnection* connection; + connection = new ClientConnection(pMinecraft, socket, idx); + if (connection->createdOk) { + connection->send(std::shared_ptr( + new PreLoginPacket(pNetworkPlayer->GetOnlineName()))); + pMinecraft->addPendingLocalConnection(idx, connection); + } else { + pMinecraft->connectionDisconnected( + idx, + DisconnectPacket::eDisconnect_ConnectionCreationFailed); + delete connection; + connection = NULL; + } + } + } } -void CGameNetworkManager::CloseConnection( INetworkPlayer *pNetworkPlayer ) -{ - MinecraftServer *server = MinecraftServer::getInstance(); - if( server != NULL ) - { - PlayerList *players = server->getPlayers(); - if( players != NULL ) - { - players->closePlayerConnectionBySmallId(pNetworkPlayer->GetSmallId()); - } - } +void CGameNetworkManager::CloseConnection(INetworkPlayer* pNetworkPlayer) { + MinecraftServer* server = MinecraftServer::getInstance(); + if (server != NULL) { + PlayerList* players = server->getPlayers(); + if (players != NULL) { + players->closePlayerConnectionBySmallId( + pNetworkPlayer->GetSmallId()); + } + } } -void CGameNetworkManager::PlayerJoining( INetworkPlayer *pNetworkPlayer ) -{ - if (g_NetworkManager.IsInGameplay()) // 4J-JEV: Wait to do this at StartNetworkGame if not in-game yet. - { - // 4J-JEV: Update RichPresence when a player joins the game. - bool multiplayer = g_NetworkManager.GetPlayerCount() > 1, localgame = g_NetworkManager.IsLocalGame(); - for (int iPad=0; iPadIsLocal() ) +void CGameNetworkManager::PlayerJoining(INetworkPlayer* pNetworkPlayer) { + if (g_NetworkManager + .IsInGameplay()) // 4J-JEV: Wait to do this at StartNetworkGame if + // not in-game yet. { - TelemetryManager->RecordPlayerSessionStart(pNetworkPlayer->GetUserIndex()); + // 4J-JEV: Update RichPresence when a player joins the game. + bool multiplayer = g_NetworkManager.GetPlayerCount() > 1, + localgame = g_NetworkManager.IsLocalGame(); + for (int iPad = 0; iPad < XUSER_MAX_COUNT; ++iPad) { + INetworkPlayer* pNetworkPlayer = + g_NetworkManager.GetLocalPlayerByUserIndex(iPad); + if (pNetworkPlayer == NULL) continue; + + app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_BLANK); + if (multiplayer) { + if (localgame) + ProfileManager.SetCurrentGameActivity( + iPad, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false); + else + ProfileManager.SetCurrentGameActivity( + iPad, CONTEXT_PRESENCE_MULTIPLAYER, false); + } else { + if (localgame) + ProfileManager.SetCurrentGameActivity( + iPad, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, false); + else + ProfileManager.SetCurrentGameActivity( + iPad, CONTEXT_PRESENCE_MULTIPLAYER_1P, false); + } + } + } + + if (pNetworkPlayer->IsLocal()) { + TelemetryManager->RecordPlayerSessionStart( + pNetworkPlayer->GetUserIndex()); } #ifdef _XBOX - else - { - if( !pNetworkPlayer->IsHost() ) - { - for(int idx = 0; idx < XUSER_MAX_COUNT; ++idx) - { - if(Minecraft::GetInstance()->localplayers[idx] != NULL) - { - TelemetryManager->RecordLevelStart(idx, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->level->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount()); - } - } + else { + if (!pNetworkPlayer->IsHost()) { + for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { + if (Minecraft::GetInstance()->localplayers[idx] != NULL) { + TelemetryManager->RecordLevelStart( + idx, eSen_FriendOrMatch_Playing_With_Invited_Friends, + eSen_CompeteOrCoop_Coop_and_Competitive, + Minecraft::GetInstance()->level->difficulty, + app.GetLocalPlayerCount(), + g_NetworkManager.GetOnlinePlayerCount()); + } + } } - } + } #endif } -void CGameNetworkManager::PlayerLeaving( INetworkPlayer *pNetworkPlayer ) -{ - if( pNetworkPlayer->IsLocal() ) - { - ProfileManager.SetCurrentGameActivity(pNetworkPlayer->GetUserIndex(),CONTEXT_PRESENCE_IDLE,false); +void CGameNetworkManager::PlayerLeaving(INetworkPlayer* pNetworkPlayer) { + if (pNetworkPlayer->IsLocal()) { + ProfileManager.SetCurrentGameActivity(pNetworkPlayer->GetUserIndex(), + CONTEXT_PRESENCE_IDLE, false); - TelemetryManager->RecordPlayerSessionExit(pNetworkPlayer->GetUserIndex(), app.GetDisconnectReason()); - } + TelemetryManager->RecordPlayerSessionExit( + pNetworkPlayer->GetUserIndex(), app.GetDisconnectReason()); + } #ifdef _XBOX - else - { - for(int idx = 0; idx < XUSER_MAX_COUNT; ++idx) - { - if(Minecraft::GetInstance()->localplayers[idx] != NULL) - { - TelemetryManager->RecordLevelStart(idx, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->level->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount()); - } - } - } + else { + for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { + if (Minecraft::GetInstance()->localplayers[idx] != NULL) { + TelemetryManager->RecordLevelStart( + idx, eSen_FriendOrMatch_Playing_With_Invited_Friends, + eSen_CompeteOrCoop_Coop_and_Competitive, + Minecraft::GetInstance()->level->difficulty, + app.GetLocalPlayerCount(), + g_NetworkManager.GetOnlinePlayerCount()); + } + } + } #endif } -void CGameNetworkManager::HostChanged() -{ - // Disable host migration - app.SetAction(ProfileManager.GetPrimaryPad(),eAppAction_ExitWorld,(void *)TRUE); +void CGameNetworkManager::HostChanged() { + // Disable host migration + app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_ExitWorld, + (void*)TRUE); } -void CGameNetworkManager::WriteStats( INetworkPlayer *pNetworkPlayer ) -{ - Minecraft::GetInstance()->forceStatsSave( pNetworkPlayer->GetUserIndex() ); +void CGameNetworkManager::WriteStats(INetworkPlayer* pNetworkPlayer) { + Minecraft::GetInstance()->forceStatsSave(pNetworkPlayer->GetUserIndex()); } -void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *pInviteInfo) -{ +void CGameNetworkManager::GameInviteReceived(int userIndex, + const INVITE_INFO* pInviteInfo) { #ifdef __ORBIS__ - if (m_pUpsell != NULL) - { - delete pInviteInfo; - return; - } + if (m_pUpsell != NULL) { + delete pInviteInfo; + return; + } - // Need to check we're signed in to PSN - bool isSignedInLive = true; - bool isLocalMultiplayerAvailable = app.IsLocalMultiplayerAvailable(); - int iPadNotSignedInLive = -1; - for(unsigned int i = 0; i < XUSER_MAX_COUNT; i++) - { - if (ProfileManager.IsSignedIn(i) && (i == ProfileManager.GetPrimaryPad() || isLocalMultiplayerAvailable)) - { - if (isSignedInLive && !ProfileManager.IsSignedInLive(i)) - { - // Record the first non signed in live pad - iPadNotSignedInLive = i; - } + // Need to check we're signed in to PSN + bool isSignedInLive = true; + bool isLocalMultiplayerAvailable = app.IsLocalMultiplayerAvailable(); + int iPadNotSignedInLive = -1; + for (unsigned int i = 0; i < XUSER_MAX_COUNT; i++) { + if (ProfileManager.IsSignedIn(i) && + (i == ProfileManager.GetPrimaryPad() || + isLocalMultiplayerAvailable)) { + if (isSignedInLive && !ProfileManager.IsSignedInLive(i)) { + // Record the first non signed in live pad + iPadNotSignedInLive = i; + } - isSignedInLive = isSignedInLive && ProfileManager.IsSignedInLive(i); - } - } + isSignedInLive = isSignedInLive && ProfileManager.IsSignedInLive(i); + } + } - if (!isSignedInLive) - { - // Determine why they're not "signed in live" + if (!isSignedInLive) { + // Determine why they're not "signed in live" - // Check if PSN is unavailable because of age restriction - int npAvailability = ProfileManager.getNPAvailability(iPadNotSignedInLive); - if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) - { - // 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive if the npAvailability isn't SCE_OK - unsigned int uiIDA[1]; - uiIDA[0]=IDS_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPadNotSignedInLive, NULL, NULL, app.GetStringTable()); - } - else if (ProfileManager.isSignedInPSN(iPadNotSignedInLive)) - { - // Signed in to PSN but not connected (no internet access) - assert(!ProfileManager.isConnectedToPSN(iPadNotSignedInLive)); + // Check if PSN is unavailable because of age restriction + int npAvailability = + ProfileManager.getNPAvailability(iPadNotSignedInLive); + if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) { + // 4J Stu - This is a bit messy and is due to the library + // incorrectly returning false for IsSignedInLive if the + // npAvailability isn't SCE_OK + unsigned int uiIDA[1]; + uiIDA[0] = IDS_OK; + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, + IDS_CONTENT_RESTRICTION, uiIDA, 1, + iPadNotSignedInLive); + } else if (ProfileManager.isSignedInPSN(iPadNotSignedInLive)) { + // Signed in to PSN but not connected (no internet access) + assert(!ProfileManager.isConnectedToPSN(iPadNotSignedInLive)); - unsigned int uiIDA[1]; - uiIDA[0] = IDS_OK; - ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPadNotSignedInLive, NULL, NULL, app.GetStringTable()); - } - else - { - // Not signed in to PSN - unsigned int uiIDA[1]; - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, iPadNotSignedInLive, &CGameNetworkManager::MustSignInReturned_1, (void *)pInviteInfo, app.GetStringTable(), NULL, 0, false); - } - return; - } + unsigned int uiIDA[1]; + uiIDA[0] = IDS_OK; + ui.RequestErrorMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, + uiIDA, 1, iPadNotSignedInLive); + } else { + // Not signed in to PSN + unsigned int uiIDA[1]; + uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; + ui.RequestAlertMessage( + IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, + iPadNotSignedInLive, &CGameNetworkManager::MustSignInReturned_1, + (void*)pInviteInfo); + } + return; + } - // 4J-JEV: Check that all players are authorised for PsPlus, present upsell to players that aren't and try again. - for (unsigned int index = 0; index < XUSER_MAX_COUNT; index++) - { - if ( ProfileManager.IsSignedIn(index) - && !ProfileManager.HasPlayStationPlus(userIndex) ) - { - m_pInviteInfo = (INVITE_INFO *) pInviteInfo; - m_iPlayerInvited = userIndex; - - m_pUpsell = new PsPlusUpsellWrapper(index); - m_pUpsell->displayUpsell(); - - return; - } - } + // if this is the trial game, we'll check and send the user to unlock the + // game later, in HandleInviteWhenInMenus + if (ProfileManager.IsFullVersion()) { + // 4J-JEV: Check that all players are authorised for PsPlus, present + // upsell to players that aren't and try again. + for (unsigned int index = 0; index < XUSER_MAX_COUNT; index++) { + if (ProfileManager.IsSignedIn(index) && + !ProfileManager.HasPlayStationPlus(userIndex)) { + m_pInviteInfo = (INVITE_INFO*)pInviteInfo; + m_iPlayerInvited = userIndex; + + m_pUpsell = new PsPlusUpsellWrapper(index); + m_pUpsell->displayUpsell(); + + return; + } + } + } #endif -#ifdef __PSVITA__ - // Need to check we're signed in to PSN - bool isSignedInLive = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()); - if (!isSignedInLive) - { - // Determine why they're not "signed in live" - // MGH - we need to add a new message at some point for connecting when already signed in -// if (ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad())) -// { -// // Signed in to PSN but not connected (no internet access) -// unsigned int uiIDA[1]; -// uiIDA[0] = IDS_OK; -// ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL, app.GetStringTable()); -// } -// else - { - // Not signed in to PSN - unsigned int uiIDA[1]; - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &CGameNetworkManager::MustSignInReturned_1, (void *)pInviteInfo, app.GetStringTable(), NULL, 0, false); - } - return; - } -#endif + int localUsersMask = 0; + Minecraft* pMinecraft = Minecraft::GetInstance(); + int joiningUsers = 0; + bool noPrivileges = false; + for (unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) { + if (ProfileManager.IsSignedIn(index)) { + // 4J-PB we shouldn't bring any inactive players into the game, + // except for the invited player (who may be an inactive player) 4J + // Stu - If we are not in a game, then bring in all players signed + // in + if (index == userIndex || pMinecraft->localplayers[index] != NULL) { + ++joiningUsers; + if (!ProfileManager.AllowedToPlayMultiplayer(index)) + noPrivileges = true; + localUsersMask |= GetLocalPlayerMask(index); + } + } + } - int localUsersMask = 0; - Minecraft *pMinecraft = Minecraft::GetInstance(); - int joiningUsers = 0; - - bool noPrivileges = false; - for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) - { - if(ProfileManager.IsSignedIn(index) ) - { - // 4J-PB we shouldn't bring any inactive players into the game, except for the invited player (who may be an inactive player) - // 4J Stu - If we are not in a game, then bring in all players signed in - if(index==userIndex || pMinecraft->localplayers[index]!=NULL ) - { - ++joiningUsers; - if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true; - localUsersMask |= GetLocalPlayerMask( index ); - } - } - } - - // Check if user-created content is allowed, as we cannot play multiplayer if it's not - bool noUGC = false; - bool bContentRestricted=false; - bool pccAllowed = true; - bool pccFriendsAllowed = true; + // Check if user-created content is allowed, as we cannot play multiplayer + // if it's not + bool noUGC = false; + bool bContentRestricted = false; + bool pccAllowed = true; + bool pccFriendsAllowed = true; #if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(userIndex,false,&noUGC,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(userIndex, false, &noUGC, + &bContentRestricted, NULL); #else - ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); - if(!pccAllowed && !pccFriendsAllowed) noUGC = true; + ProfileManager.AllowedPlayerCreatedContent( + ProfileManager.GetPrimaryPad(), false, &pccAllowed, &pccFriendsAllowed); + if (!pccAllowed && !pccFriendsAllowed) noUGC = true; #endif - + #if defined(_XBOX) || defined(__PS3__) - if(joiningUsers > 1 && !RenderManager.IsHiDef() && userIndex != ProfileManager.GetPrimaryPad()) - { - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; + if (joiningUsers > 1 && !RenderManager.IsHiDef() && + userIndex != ProfileManager.GetPrimaryPad()) { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; - // 4J-PB - it's possible there is no primary pad here, when accepting an invite from the dashboard - ui.RequestMessageBox( IDS_CONNECTION_FAILED, IDS_CONNECTION_FAILED_NO_SD_SPLITSCREEN, uiIDA,1,XUSER_INDEX_ANY,NULL,NULL, app.GetStringTable()); - } - else + // 4J-PB - it's possible there is no primary pad here, when accepting an + // invite from the dashboard + ui.RequestErrorMessage(IDS_CONNECTION_FAILED, + IDS_CONNECTION_FAILED_NO_SD_SPLITSCREEN, uiIDA, + 1, XUSER_INDEX_ANY); + } else #endif - if( noUGC ) - { - int messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL; - if(joiningUsers > 1) messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL; - - ui.RequestUGCMessageBox(IDS_CONNECTION_FAILED, messageText, XUSER_INDEX_ANY); - } -#if defined(__PS3__) || defined __PSVITA__ - else if(bContentRestricted) - { - int messageText = IDS_CONTENT_RESTRICTION; - if(joiningUsers > 1) messageText = IDS_CONTENT_RESTRICTION_MULTIPLAYER; - - ui.RequestContentRestrictedMessageBox(IDS_CONNECTION_FAILED, messageText, XUSER_INDEX_ANY); - } -#endif - else if(noPrivileges) - { - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - - // 4J-PB - it's possible there is no primary pad here, when accepting an invite from the dashboard - //StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); - ui.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,XUSER_INDEX_ANY,NULL,NULL, app.GetStringTable()); - } - else - { -#if defined(__ORBIS__) || defined(__PSVITA__) - bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL); - if(chatRestricted) - { - ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() ); - } -#endif - if( !g_NetworkManager.IsInSession() ) - { -#ifndef __PS3__ - HandleInviteWhenInMenus(userIndex, pInviteInfo); -#else - // PS3 is more complicated here - we need to make sure that the player is online. If they are then we can do the same as the xbox, if not we need to try and get them online and then, if they do sign in, go down the same path - if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) - { - HandleInviteWhenInMenus(userIndex, pInviteInfo); - } - else - { - unsigned int uiIDA[2]; - uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CGameNetworkManager::MustSignInReturned_1,(void *)pInviteInfo, app.GetStringTable()); - } -#endif - } - else - { - app.DebugPrintf("We are already in a multiplayer game...need to leave it\n"); - -// JoinFromInviteData *joinData = new JoinFromInviteData(); -// joinData->dwUserIndex = dwUserIndex; -// joinData->dwLocalUsersMask = dwLocalUsersMask; -// joinData->pInviteInfo = pInviteInfo; - - // tell the app to process this + if (noUGC) { #ifdef __PSVITA__ - if(((CPlatformNetworkManagerSony*)s_pPlatformNetworkManager)->checkValidInviteData(pInviteInfo)) + // showing the system message for chat restriction here instead now, to + // fix FQA bug report + ProfileManager.DisplaySystemMessage( + SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, + ProfileManager.GetPrimaryPad()); +#else + int messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL; + if (joiningUsers > 1) + messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL; + + ui.RequestUGCMessageBox(IDS_CONNECTION_FAILED, messageText, + XUSER_INDEX_ANY); #endif - { - app.ProcessInvite(userIndex,localUsersMask,pInviteInfo); - } - } - } + } +#if defined(__PS3__) || defined __PSVITA__ + else if (bContentRestricted) { + int messageText = IDS_CONTENT_RESTRICTION; + if (joiningUsers > 1) messageText = IDS_CONTENT_RESTRICTION_MULTIPLAYER; + + ui.RequestContentRestrictedMessageBox(IDS_CONNECTION_FAILED, + messageText, XUSER_INDEX_ANY); + } +#endif + else if (noPrivileges) { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + + // 4J-PB - it's possible there is no primary pad here, when accepting an + // invite from the dashboard + // StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, + // IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, + // uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, + // app.GetStringTable()); + ui.RequestErrorMessage(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, + IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, + XUSER_INDEX_ANY); + } else { +#if defined(__ORBIS__) || defined(__PSVITA__) + bool chatRestricted = false; + ProfileManager.GetChatAndContentRestrictions( + ProfileManager.GetPrimaryPad(), false, &chatRestricted, NULL, NULL); + if (chatRestricted) { + ProfileManager.DisplaySystemMessage( + SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, + ProfileManager.GetPrimaryPad()); + } +#endif + if (!g_NetworkManager.IsInSession()) { +#if defined(__PS3__) || defined(__PSVITA__) + // PS3 is more complicated here - we need to make sure that the + // player is online. If they are then we can do the same as the + // xbox, if not we need to try and get them online and then, if they + // do sign in, go down the same path + + // Determine why they're not "signed in live" + // MGH - On Vita we need to add a new message at some point for + // connecting when already signed in + if (ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) { + HandleInviteWhenInMenus(userIndex, pInviteInfo); + } else { + unsigned int uiIDA[2]; + uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; + uiIDA[1] = IDS_PRO_NOTONLINE_DECLINE; + ui.RequestErrorMessage( + IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, + ProfileManager.GetPrimaryPad(), + &CGameNetworkManager::MustSignInReturned_1, + (void*)pInviteInfo); + } + +#else + HandleInviteWhenInMenus(userIndex, pInviteInfo); +#endif + } else { + app.DebugPrintf( + "We are already in a multiplayer game...need to leave it\n"); + + // JoinFromInviteData *joinData = new + // JoinFromInviteData(); joinData->dwUserIndex = + // dwUserIndex; joinData->dwLocalUsersMask = + // dwLocalUsersMask; joinData->pInviteInfo = + // pInviteInfo; + + // tell the app to process this +#ifdef __PSVITA__ + if (((CPlatformNetworkManagerSony*)s_pPlatformNetworkManager) + ->checkValidInviteData(pInviteInfo)) +#endif + { + app.ProcessInvite(userIndex, localUsersMask, pInviteInfo); + } + } + } } volatile bool waitHere = true; -void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_INFO *pInviteInfo) -{ - // We are in the root menus somewhere +void CGameNetworkManager::HandleInviteWhenInMenus( + int userIndex, const INVITE_INFO* pInviteInfo) { + // We are in the root menus somewhere #if 0 while( waitHere ) @@ -1780,262 +1966,256 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I } #endif - // if this is the trial game, then we need the user to unlock the full game - if(!ProfileManager.IsFullVersion()) - { - // The marketplace will fail with the primary player set to -1 - ProfileManager.SetPrimaryPad(userIndex); + // if this is the trial game, then we need the user to unlock the full game + if (!ProfileManager.IsFullVersion()) { + // The marketplace will fail with the primary player set to -1 + ProfileManager.SetPrimaryPad(userIndex); - app.SetAction(userIndex,eAppAction_DashboardTrialJoinFromInvite); - } - else - { - ProfileManager.SetPrimaryPad(userIndex); - - // 4J Stu - If we accept an invite from the main menu before going to play game we need to load the DLC - // These checks are done within the StartInstallDLCProcess - (!app.DLCInstallProcessCompleted() && !app.DLCInstallPending()) app.StartInstallDLCProcess(dwUserIndex); - app.StartInstallDLCProcess(userIndex); - - // 4J Stu - Fix for #10936 - MP Lab: TCR 001: Matchmaking: Player is stuck in a soft-locked state after selecting the guest account when prompted - // The locked profile should not be changed if we are in menus as the main player might sign out in the sign-in ui - //ProfileManager.SetLockedProfile(-1); - - if(!app.IsLocalMultiplayerAvailable()) - { - bool noPrivileges=!ProfileManager.AllowedToPlayMultiplayer(userIndex); - - if(noPrivileges) - { - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); - } - else - { - ProfileManager.SetLockedProfile(userIndex); - ProfileManager.SetPrimaryPad(userIndex); - - int localUsersMask=0; - localUsersMask |= GetLocalPlayerMask( userIndex ); - - // If the player was signed in before selecting play, we'll not have read the profile yet, so query the sign-in status to get this to happen - ProfileManager.QuerySigninStatus(); - - // 4J-PB - clear any previous connection errors - Minecraft::GetInstance()->clearConnectionFailed(); - - g_NetworkManager.SetLocalGame(false); - - // change the minecraft player name - Minecraft::GetInstance()->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); - - bool success = g_NetworkManager.JoinGameFromInviteInfo( userIndex, localUsersMask, pInviteInfo ); - if( !success ) - { - app.DebugPrintf( "Failed joining game from invite\n" ); - } - } - } - else - { - // the FromInvite will make the lib decide how many panes to display based on connected pads/signed in players -#ifdef _XBOX - ProfileManager.RequestSignInUI(true, false, false, false, false,&CGameNetworkManager::JoinFromInvite_SignInReturned, (void *)pInviteInfo,userIndex); -#else - SignInInfo info; - info.Func = &CGameNetworkManager::JoinFromInvite_SignInReturned; - info.lpParam = (void *)pInviteInfo; - info.requireOnline = true; - app.DebugPrintf("Using fullscreen layer\n"); - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_QuadrantSignin,&info,eUILayer_Alert,eUIGroup_Fullscreen); + app.SetAction(userIndex, eAppAction_DashboardTrialJoinFromInvite); + } else { +#ifndef _XBOX_ONE + ProfileManager.SetPrimaryPad(userIndex); #endif - } - } + + // 4J Stu - If we accept an invite from the main menu before going to + // play game we need to load the DLC These checks are done within the + // StartInstallDLCProcess - (!app.DLCInstallProcessCompleted() && + // !app.DLCInstallPending()) app.StartInstallDLCProcess(dwUserIndex); + app.StartInstallDLCProcess(userIndex); + + // 4J Stu - Fix for #10936 - MP Lab: TCR 001: Matchmaking: Player is + // stuck in a soft-locked state after selecting the guest account when + // prompted The locked profile should not be changed if we are in menus + // as the main player might sign out in the sign-in ui + // ProfileManager.SetLockedProfile(-1); + +#ifdef _XBOX_ONE + if ((!app.IsLocalMultiplayerAvailable()) && + InputManager.IsPadLocked(userIndex)) +#else + if (!app.IsLocalMultiplayerAvailable()) +#endif + { + bool noPrivileges = + !ProfileManager.AllowedToPlayMultiplayer(userIndex); + + if (noPrivileges) { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + ui.RequestErrorMessage(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, + IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, + uiIDA, 1, + ProfileManager.GetPrimaryPad()); + } else { + ProfileManager.SetLockedProfile(userIndex); + ProfileManager.SetPrimaryPad(userIndex); + + int localUsersMask = 0; + localUsersMask |= GetLocalPlayerMask(userIndex); + + // If the player was signed in before selecting play, we'll not + // have read the profile yet, so query the sign-in status to get + // this to happen + ProfileManager.QuerySigninStatus(); + + // 4J-PB - clear any previous connection errors + Minecraft::GetInstance()->clearConnectionFailed(); + + g_NetworkManager.SetLocalGame(false); + + // change the minecraft player name + Minecraft::GetInstance()->user->name = convStringToWstring( + ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); + + bool success = g_NetworkManager.JoinGameFromInviteInfo( + userIndex, localUsersMask, pInviteInfo); + if (!success) { + app.DebugPrintf("Failed joining game from invite\n"); + } + } + } else { + // the FromInvite will make the lib decide how many panes to display + // based on connected pads/signed in players +#ifdef _XBOX + ProfileManager.RequestSignInUI( + true, false, false, false, false, + &CGameNetworkManager::JoinFromInvite_SignInReturned, + (void*)pInviteInfo, userIndex); +#else + SignInInfo info; + info.Func = &CGameNetworkManager::JoinFromInvite_SignInReturned; + info.lpParam = (void*)pInviteInfo; + info.requireOnline = true; + app.DebugPrintf("Using fullscreen layer\n"); + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_QuadrantSignin, &info, eUILayer_Alert, + eUIGroup_Fullscreen); +#endif + } + } } -void CGameNetworkManager::AddLocalPlayerFailed(int idx, bool serverFull/* = false*/) -{ - Minecraft::GetInstance()->connectionDisconnected(idx, serverFull ? DisconnectPacket::eDisconnect_ServerFull : DisconnectPacket::eDisconnect_ConnectionCreationFailed); +void CGameNetworkManager::AddLocalPlayerFailed(int idx, + bool serverFull /* = false*/) { + Minecraft::GetInstance()->connectionDisconnected( + idx, serverFull + ? DisconnectPacket::eDisconnect_ServerFull + : DisconnectPacket::eDisconnect_ConnectionCreationFailed); } #if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__ -void CGameNetworkManager::HandleDisconnect(bool bLostRoomOnly,bool bPSNSignout) +void CGameNetworkManager::HandleDisconnect(bool bLostRoomOnly, bool bPSNSignout) #else void CGameNetworkManager::HandleDisconnect(bool bLostRoomOnly) #endif { - int iPrimaryPlayer = g_NetworkManager.GetPrimaryPad(); + int iPrimaryPlayer = g_NetworkManager.GetPrimaryPad(); - if((g_NetworkManager.GetLockedProfile()!=-1) && iPrimaryPlayer!=-1 && g_NetworkManager.IsInSession() ) - { - m_bLastDisconnectWasLostRoomOnly = bLostRoomOnly; + if ((g_NetworkManager.GetLockedProfile() != -1) && iPrimaryPlayer != -1 && + g_NetworkManager.IsInSession()) { + m_bLastDisconnectWasLostRoomOnly = bLostRoomOnly; #if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__ - m_bSignedOutofPSN=bPSNSignout; + m_bSignedOutofPSN = bPSNSignout; #endif - app.SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected); - } - else - { - m_bLastDisconnectWasLostRoomOnly = false; - } + app.SetAction(iPrimaryPlayer, eAppAction_EthernetDisconnected); + } else { + m_bLastDisconnectWasLostRoomOnly = false; + } } -int CGameNetworkManager::GetPrimaryPad() -{ - return ProfileManager.GetPrimaryPad(); +int CGameNetworkManager::GetPrimaryPad() { + return ProfileManager.GetPrimaryPad(); } -int CGameNetworkManager::GetLockedProfile() -{ - return ProfileManager.GetLockedProfile(); +int CGameNetworkManager::GetLockedProfile() { + return ProfileManager.GetLockedProfile(); } -bool CGameNetworkManager::IsSignedInLive(int playerIdx) -{ - return ProfileManager.IsSignedInLive(playerIdx); +bool CGameNetworkManager::IsSignedInLive(int playerIdx) { + return ProfileManager.IsSignedInLive(playerIdx); } -bool CGameNetworkManager::AllowedToPlayMultiplayer(int playerIdx) -{ - return ProfileManager.AllowedToPlayMultiplayer(playerIdx); +bool CGameNetworkManager::AllowedToPlayMultiplayer(int playerIdx) { + return ProfileManager.AllowedToPlayMultiplayer(playerIdx); } -char *CGameNetworkManager::GetOnlineName(int playerIdx) -{ - return ProfileManager.GetGamertag(playerIdx); +char* CGameNetworkManager::GetOnlineName(int playerIdx) { + return ProfileManager.GetGamertag(playerIdx); } -void CGameNetworkManager::ServerReadyCreate(bool create) -{ - m_hServerReadyEvent = ( create ? ( new C4JThread::Event ) : NULL ); +void CGameNetworkManager::ServerReadyCreate(bool create) { + m_hServerReadyEvent = (create ? (new C4JThread::Event) : NULL); } -void CGameNetworkManager::ServerReady() -{ - if (m_hServerReadyEvent != NULL) - { - m_hServerReadyEvent->Set(); - } - else - { - app.DebugPrintf("[NET] Warning: ServerReady() called but m_hServerReadyEvent is NULL\n"); - } +void CGameNetworkManager::ServerReady() { + if (m_hServerReadyEvent != NULL) { + m_hServerReadyEvent->Set(); + } else { + app.DebugPrintf( + "[NET] Warning: ServerReady() called but m_hServerReadyEvent is " + "NULL\n"); + } } -void CGameNetworkManager::ServerReadyWait() -{ - if (m_hServerReadyEvent != NULL) - { - m_hServerReadyEvent->WaitForSignal(INFINITE); - } - else - { - app.DebugPrintf("[NET] Warning: ServerReadyWait() called but m_hServerReadyEvent is NULL\n"); - } +void CGameNetworkManager::ServerReadyWait() { + if (m_hServerReadyEvent != NULL) { + m_hServerReadyEvent->WaitForSignal(INFINITE); + } else { + app.DebugPrintf( + "[NET] Warning: ServerReadyWait() called but m_hServerReadyEvent " + "is NULL\n"); + } } -void CGameNetworkManager::ServerReadyDestroy() -{ - delete m_hServerReadyEvent; - m_hServerReadyEvent = NULL; +void CGameNetworkManager::ServerReadyDestroy() { + delete m_hServerReadyEvent; + m_hServerReadyEvent = NULL; } -bool CGameNetworkManager::ServerReadyValid() -{ - return ( m_hServerReadyEvent != NULL ); +bool CGameNetworkManager::ServerReadyValid() { + return (m_hServerReadyEvent != NULL); } -void CGameNetworkManager::ServerStoppedCreate(bool create) -{ - m_hServerStoppedEvent = ( create ? ( new C4JThread::Event ) : NULL ); +void CGameNetworkManager::ServerStoppedCreate(bool create) { + m_hServerStoppedEvent = (create ? (new C4JThread::Event) : NULL); } -void CGameNetworkManager::ServerStopped() -{ - if (m_hServerStoppedEvent != NULL) - { - m_hServerStoppedEvent->Set(); - } - else - { - app.DebugPrintf("[NET] Warning: ServerStopped() called but m_hServerStoppedEvent is NULL\n"); - } +void CGameNetworkManager::ServerStopped() { + if (m_hServerStoppedEvent != NULL) { + m_hServerStoppedEvent->Set(); + } else { + app.DebugPrintf( + "[NET] Warning: ServerStopped() called but m_hServerStoppedEvent " + "is NULL\n"); + } } -void CGameNetworkManager::ServerStoppedWait() -{ - // If this is called from the main thread, then this won't be ticking anything which can mean that the storage manager state can't progress. - // This means that the server thread we are waiting on won't ever finish, as it might be locked waiting for this to complete itself. - // Do some ticking here then if this is the case. - if( C4JThread::isMainThread() ) - { - int result = WAIT_TIMEOUT; - do - { +void CGameNetworkManager::ServerStoppedWait() { + // If this is called from the main thread, then this won't be ticking + // anything which can mean that the storage manager state can't progress. + // This means that the server thread we are waiting on won't ever finish, as + // it might be locked waiting for this to complete itself. Do some ticking + // here then if this is the case. + if (C4JThread::isMainThread()) { + int result = WAIT_TIMEOUT; + do { #ifndef _XBOX - RenderManager.StartFrame(); + RenderManager.StartFrame(); #endif - result = m_hServerStoppedEvent->WaitForSignal(20); - // Tick some simple things - ProfileManager.Tick(); - StorageManager.Tick(); - InputManager.Tick(); - RenderManager.Tick(); - ui.tick(); - ui.render(); - RenderManager.Present(); - } while( result == WAIT_TIMEOUT ); - } - else - { - if (m_hServerStoppedEvent != NULL) - { - m_hServerStoppedEvent->WaitForSignal(INFINITE); - } - else - { - app.DebugPrintf("[NET] Warning: ServerStoppedWait() called but m_hServerStoppedEvent is NULL\n"); - } - } + result = m_hServerStoppedEvent->WaitForSignal(20); + // Tick some simple things + ProfileManager.Tick(); + StorageManager.Tick(); + InputManager.Tick(); + RenderManager.Tick(); + ui.tick(); + ui.render(); + RenderManager.Present(); + } while (result == WAIT_TIMEOUT); + } else { + if (m_hServerStoppedEvent != NULL) { + m_hServerStoppedEvent->WaitForSignal(INFINITE); + } else { + app.DebugPrintf( + "[NET] Warning: ServerStoppedWait() called but " + "m_hServerStoppedEvent is NULL\n"); + } + } } -void CGameNetworkManager::ServerStoppedDestroy() -{ - delete m_hServerStoppedEvent; - m_hServerStoppedEvent = NULL; +void CGameNetworkManager::ServerStoppedDestroy() { + delete m_hServerStoppedEvent; + m_hServerStoppedEvent = NULL; } -bool CGameNetworkManager::ServerStoppedValid() -{ - return ( m_hServerStoppedEvent != NULL ); +bool CGameNetworkManager::ServerStoppedValid() { + return (m_hServerStoppedEvent != NULL); } -int CGameNetworkManager::GetJoiningReadyPercentage() -{ - return s_pPlatformNetworkManager->GetJoiningReadyPercentage(); +int CGameNetworkManager::GetJoiningReadyPercentage() { + return s_pPlatformNetworkManager->GetJoiningReadyPercentage(); } #ifndef _XBOX -void CGameNetworkManager::FakeLocalPlayerJoined() -{ - s_pPlatformNetworkManager->FakeLocalPlayerJoined(); +void CGameNetworkManager::FakeLocalPlayerJoined() { + s_pPlatformNetworkManager->FakeLocalPlayerJoined(); } #endif #ifdef __PSVITA__ -bool CGameNetworkManager::usingAdhocMode() -{ - return ((CPlatformNetworkManagerSony*)s_pPlatformNetworkManager)->usingAdhocMode(); +bool CGameNetworkManager::usingAdhocMode() { + return ((CPlatformNetworkManagerSony*)s_pPlatformNetworkManager) + ->usingAdhocMode(); } -void CGameNetworkManager::setAdhocMode(bool bAdhoc) -{ - ((CPlatformNetworkManagerSony*)s_pPlatformNetworkManager)->setAdhocMode(bAdhoc); +void CGameNetworkManager::setAdhocMode(bool bAdhoc) { + ((CPlatformNetworkManagerSony*)s_pPlatformNetworkManager) + ->setAdhocMode(bAdhoc); } -void CGameNetworkManager::startAdhocMatching() -{ - ((CPlatformNetworkManagerSony*)s_pPlatformNetworkManager)->startAdhocMatching(); +void CGameNetworkManager::startAdhocMatching() { + ((CPlatformNetworkManagerSony*)s_pPlatformNetworkManager) + ->startAdhocMatching(); } #endif diff --git a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.h b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.h index 7110b50ad..2abdb4ba9 100644 --- a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.h +++ b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.h @@ -1,5 +1,5 @@ #pragma once -//using namespace std; +// using namespace std; #include #ifndef __linux__ #include @@ -24,209 +24,237 @@ class ClientConnection; class Minecraft; +const int NON_QNET_SENDDATA_ACK_REQUIRED = 1; -// This class implements the game-side interface to the networking system. As such, it is platform independent and may contain bits of game-side code where appropriate. -// It shouldn't ever reference any platform specifics of the network implementation (eg QNET), rather it should interface with an implementation of PlatformNetworkManager to -// provide this functionality. +// This class implements the game-side interface to the networking system. As +// such, it is platform independent and may contain bits of game-side code where +// appropriate. It shouldn't ever reference any platform specifics of the +// network implementation (eg QNET), rather it should interface with an +// implementation of PlatformNetworkManager to provide this functionality. -class CGameNetworkManager -{ +class CGameNetworkManager { #ifdef _XBOX - friend class CPlatformNetworkManagerXbox; + friend class CPlatformNetworkManagerXbox; #elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ - friend class CPlatformNetworkManagerSony; + friend class CPlatformNetworkManagerSony; #elif defined _DURANGO - friend class CPlatformNetworkManagerDurango; + friend class CPlatformNetworkManagerDurango; #else - friend class CPlatformNetworkManagerStub; + friend class CPlatformNetworkManagerStub; #endif public: - CGameNetworkManager(); - // Misc high level flow + CGameNetworkManager(); + // Misc high level flow - typedef enum - { - JOINGAME_SUCCESS, - JOINGAME_FAIL_GENERAL, - JOINGAME_FAIL_SERVER_FULL - } eJoinGameResult; + typedef enum { + JOINGAME_SUCCESS, + JOINGAME_FAIL_GENERAL, + JOINGAME_FAIL_SERVER_FULL + } eJoinGameResult; - void Initialise(); - void Terminate(); - void DoWork(); - bool _RunNetworkGame(void *lpParameter); - bool StartNetworkGame(Minecraft *minecraft, void *lpParameter); - int CorrectErrorIDS(int IDS); + void Initialise(); + void Terminate(); + void DoWork(); + bool _RunNetworkGame(void* lpParameter); + bool StartNetworkGame(Minecraft* minecraft, void* lpParameter); + int CorrectErrorIDS(int IDS); - // Player management + // Player management - static int GetLocalPlayerMask(int playerIndex); - int GetPlayerCount(); - int GetOnlinePlayerCount(); - bool AddLocalPlayerByUserIndex( int userIndex ); - bool RemoveLocalPlayerByUserIndex( int userIndex ); - INetworkPlayer *GetLocalPlayerByUserIndex(int userIndex ); - INetworkPlayer *GetPlayerByIndex(int playerIndex); - INetworkPlayer *GetPlayerByXuid(PlayerUID xuid); - INetworkPlayer *GetPlayerBySmallId(unsigned char smallId); - std::wstring GetDisplayNameByGamertag(std::wstring gamertag); - INetworkPlayer *GetHostPlayer(); - void RegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam); - void UnRegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam); - void HandleSignInChange(); - bool ShouldMessageForFullSession(); + static int GetLocalPlayerMask(int playerIndex); + int GetPlayerCount(); + int GetOnlinePlayerCount(); + bool AddLocalPlayerByUserIndex(int userIndex); + bool RemoveLocalPlayerByUserIndex(int userIndex); + INetworkPlayer* GetLocalPlayerByUserIndex(int userIndex); + INetworkPlayer* GetPlayerByIndex(int playerIndex); + INetworkPlayer* GetPlayerByXuid(PlayerUID xuid); + INetworkPlayer* GetPlayerBySmallId(unsigned char smallId); + std::wstring GetDisplayNameByGamertag(std::wstring gamertag); + INetworkPlayer* GetHostPlayer(); + void RegisterPlayerChangedCallback(int iPad, + void (*callback)(void* callbackParam, + INetworkPlayer* pPlayer, + bool leaving), + void* callbackParam); + void UnRegisterPlayerChangedCallback( + int iPad, + void (*callback)(void* callbackParam, INetworkPlayer* pPlayer, + bool leaving), + void* callbackParam); + void HandleSignInChange(); + bool ShouldMessageForFullSession(); - // State management + // State management - bool IsInSession(); - bool IsInGameplay(); - bool IsLeavingGame(); - bool IsReadyToPlayOrIdle(); + bool IsInSession(); + bool IsInGameplay(); + bool IsLeavingGame(); + bool IsReadyToPlayOrIdle(); - // Hosting and game type + // Hosting and game type - bool SetLocalGame(bool isLocal); - bool IsLocalGame(); - void SetPrivateGame(bool isPrivate); - bool IsPrivateGame(); - void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0); - bool IsHost(); - bool IsInStatsEnabledSession(); + bool SetLocalGame(bool isLocal); + bool IsLocalGame(); + void SetPrivateGame(bool isPrivate); + bool IsPrivateGame(); + void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, + unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, + unsigned char privateSlots = 0); + bool IsHost(); + bool IsInStatsEnabledSession(); - // Client session discovery + // Client session discovery - bool SessionHasSpace(unsigned int spaceRequired = 1); - std::vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); - bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession); - void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam ); - void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ); - void ForceFriendsSessionRefresh(); - - // Session joining and leaving + bool SessionHasSpace(unsigned int spaceRequired = 1); + std::vector* GetSessionList(int iPad, int localPlayers, + bool partyOnly); + bool GetGameSessionInfo(int iPad, SessionID sessionId, + FriendSessionInfo* foundSession); + void SetSessionsUpdatedCallback( + void (*SessionsUpdatedCallback)(void* pParam), void* pSearchParam); + void GetFullFriendSessionInfo(FriendSessionInfo* foundSession, + void (*FriendSessionUpdatedFn)(bool success, + void* pParam), + void* pParam); + void ForceFriendsSessionRefresh(); - bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo); - eJoinGameResult JoinGame(FriendSessionInfo *searchResult, int localUsersMask); - static void CancelJoinGame(void *lpParam); // Not part of the shared interface - bool LeaveGame(bool bMigrateHost); - static int JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad); - void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); - void SendInviteGUI(int iPad); - void ResetLeavingGame(); + // Session joining and leaving - // Threads - - bool IsNetworkThreadRunning(); - static int RunNetworkGameThreadProc( void* lpParameter ); - static int ServerThreadProc( void* lpParameter ); - static int ExitAndJoinFromInviteThreadProc( void* lpParam ); + bool JoinGameFromInviteInfo(int userIndex, int userMask, + const INVITE_INFO* pInviteInfo); + eJoinGameResult JoinGame(FriendSessionInfo* searchResult, + int localUsersMask); + static void CancelJoinGame( + void* lpParam); // Not part of the shared interface + bool LeaveGame(bool bMigrateHost); + static int JoinFromInvite_SignInReturned(void* pParam, bool bContinue, + int iPad); + void UpdateAndSetGameSessionData( + INetworkPlayer* pNetworkPlayerLeaving = NULL); + void SendInviteGUI(int iPad); + void ResetLeavingGame(); -#if (defined __PS3__) || (defined __ORBIS__) || (defined __PSVITA__) - static int MustSignInReturned_0(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int PSNSignInReturned_0(void* pParam, bool bContinue, int iPad); + // Threads - static int MustSignInReturned_1(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int PSNSignInReturned_1(void* pParam, bool bContinue, int iPad); + bool IsNetworkThreadRunning(); + static int RunNetworkGameThreadProc(void* lpParameter); + static int ServerThreadProc(void* lpParameter); + static int ExitAndJoinFromInviteThreadProc(void* lpParam); + +#if (defined __PS3__) || (defined __ORBIS__) || (defined __PSVITA__) + static int MustSignInReturned_0(void* pParam, int iPad, + C4JStorage::EMessageResult result); + static int PSNSignInReturned_0(void* pParam, bool bContinue, int iPad); + + static int MustSignInReturned_1(void* pParam, int iPad, + C4JStorage::EMessageResult result); + static int PSNSignInReturned_1(void* pParam, bool bContinue, int iPad); #endif - static void _LeaveGame(); - static int ChangeSessionTypeThreadProc( void* lpParam ); + static void _LeaveGame(); + static int ChangeSessionTypeThreadProc(void* lpParam); - // System flags + // System flags - void SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index); - bool SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index); + void SystemFlagSet(INetworkPlayer* pNetworkPlayer, int index); + bool SystemFlagGet(INetworkPlayer* pNetworkPlayer, int index); - // Events + // Events - void ServerReadyCreate(bool create); // Create the signal (or set to NULL) - void ServerReady(); // Signal that we are ready - void ServerReadyWait(); // Wait for the signal - void ServerReadyDestroy(); // Destroy signal - bool ServerReadyValid(); // Is non-NULL + void ServerReadyCreate(bool create); // Create the signal (or set to NULL) + void ServerReady(); // Signal that we are ready + void ServerReadyWait(); // Wait for the signal + void ServerReadyDestroy(); // Destroy signal + bool ServerReadyValid(); // Is non-NULL - void ServerStoppedCreate(bool create); // Create the signal - void ServerStopped(); // Signal that we are ready - void ServerStoppedWait(); // Wait for the signal - void ServerStoppedDestroy(); // Destroy signal - bool ServerStoppedValid(); // Is non-NULL + void ServerStoppedCreate(bool create); // Create the signal + void ServerStopped(); // Signal that we are ready + void ServerStoppedWait(); // Wait for the signal + void ServerStoppedDestroy(); // Destroy signal + bool ServerStoppedValid(); // Is non-NULL #ifdef __PSVITA__ - static bool usingAdhocMode(); - static void setAdhocMode(bool bAdhoc); - static void startAdhocMatching(); + static bool usingAdhocMode(); + static void setAdhocMode(bool bAdhoc); + static void startAdhocMatching(); #endif - // Debug output + // Debug output - std::wstring GatherStats(); - void renderQueueMeter(); - std::wstring GatherRTTStats(); + std::wstring GatherStats(); + void renderQueueMeter(); + std::wstring GatherRTTStats(); - // GUI debug output + // GUI debug output - // Used for debugging output - static const int messageQueue_length = 512; - static __int64 messageQueue[messageQueue_length]; - static const int byteQueue_length = 512; + // Used for debugging output + static const int messageQueue_length = 512; + static __int64 messageQueue[messageQueue_length]; + static const int byteQueue_length = 512; static __int64 byteQueue[byteQueue_length]; - static int messageQueuePos; + static int messageQueuePos; - // Methods called from PlatformNetworkManager + // Methods called from PlatformNetworkManager private: - void StateChange_AnyToHosting(); - void StateChange_AnyToJoining(); - void StateChange_JoiningToIdle(CPlatformNetworkManager::eJoinFailedReason reason); - void StateChange_AnyToStarting(); - void StateChange_AnyToEnding(bool bStateWasPlaying); - void StateChange_AnyToIdle(); - void CreateSocket( INetworkPlayer *pNetworkPlayer, bool localPlayer ); - void CloseConnection( INetworkPlayer *pNetworkPlayer ); - void PlayerJoining( INetworkPlayer *pNetworkPlayer ); - void PlayerLeaving( INetworkPlayer *pNetworkPlayer ); - void HostChanged(); - void WriteStats( INetworkPlayer *pNetworkPlayer ); - void GameInviteReceived( int userIndex, const INVITE_INFO *pInviteInfo); - void HandleInviteWhenInMenus( int userIndex, const INVITE_INFO *pInviteInfo); - void AddLocalPlayerFailed(int idx, bool serverFull = false); + void StateChange_AnyToHosting(); + void StateChange_AnyToJoining(); + void StateChange_JoiningToIdle( + CPlatformNetworkManager::eJoinFailedReason reason); + void StateChange_AnyToStarting(); + void StateChange_AnyToEnding(bool bStateWasPlaying); + void StateChange_AnyToIdle(); + void CreateSocket(INetworkPlayer* pNetworkPlayer, bool localPlayer); + void CloseConnection(INetworkPlayer* pNetworkPlayer); + void PlayerJoining(INetworkPlayer* pNetworkPlayer); + void PlayerLeaving(INetworkPlayer* pNetworkPlayer); + void HostChanged(); + void WriteStats(INetworkPlayer* pNetworkPlayer); + void GameInviteReceived(int userIndex, const INVITE_INFO* pInviteInfo); + void HandleInviteWhenInMenus(int userIndex, const INVITE_INFO* pInviteInfo); + void AddLocalPlayerFailed(int idx, bool serverFull = false); #if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__ - void HandleDisconnect(bool bLostRoomOnly,bool bPSNSignOut); + void HandleDisconnect(bool bLostRoomOnly, bool bPSNSignOut); #else - void HandleDisconnect(bool bLostRoomOnly); + void HandleDisconnect(bool bLostRoomOnly); #endif - int GetPrimaryPad(); - int GetLockedProfile(); - bool IsSignedInLive(int playerIdx); - bool AllowedToPlayMultiplayer(int playerIdx); - char *GetOnlineName(int playerIdx); + int GetPrimaryPad(); + int GetLockedProfile(); + bool IsSignedInLive(int playerIdx); + bool AllowedToPlayMultiplayer(int playerIdx); + char* GetOnlineName(int playerIdx); - C4JThread::Event* m_hServerStoppedEvent; - C4JThread::Event* m_hServerReadyEvent; - bool m_bInitialised; + C4JThread::Event* m_hServerStoppedEvent; + C4JThread::Event* m_hServerReadyEvent; + bool m_bInitialised; #ifdef _XBOX_ONE public: - void SetFullSessionMessageOnNextSessionChange() { m_bFullSessionMessageOnNextSessionChange = true; } + void SetFullSessionMessageOnNextSessionChange() { + m_bFullSessionMessageOnNextSessionChange = true; + } #endif private: - float m_lastPlayerEventTimeStart; // For telemetry - static CPlatformNetworkManager *s_pPlatformNetworkManager; - bool m_bNetworkThreadRunning; - int GetJoiningReadyPercentage(); - bool m_bLastDisconnectWasLostRoomOnly; - bool m_bFullSessionMessageOnNextSessionChange; + float m_lastPlayerEventTimeStart; // For telemetry + static CPlatformNetworkManager* s_pPlatformNetworkManager; + bool m_bNetworkThreadRunning; + int GetJoiningReadyPercentage(); + bool m_bLastDisconnectWasLostRoomOnly; + bool m_bFullSessionMessageOnNextSessionChange; #if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__ - bool m_bSignedOutofPSN; + bool m_bSignedOutofPSN; #endif #ifdef __ORBIS__ - PsPlusUpsellWrapper *m_pUpsell; - INVITE_INFO *m_pInviteInfo; - int m_iPlayerInvited; + PsPlusUpsellWrapper* m_pUpsell; + INVITE_INFO* m_pInviteInfo; + int m_iPlayerInvited; #endif public: #ifndef _XBOX - void FakeLocalPlayerJoined(); // Temporary method whilst we don't have real networking to make this happen + void FakeLocalPlayerJoined(); // Temporary method whilst we don't have real + // networking to make this happen #endif }; diff --git a/Minecraft.Client/Platform/Common/Network/NetworkPlayerInterface.h b/Minecraft.Client/Platform/Common/Network/NetworkPlayerInterface.h index 28db131e9..9206a9405 100644 --- a/Minecraft.Client/Platform/Common/Network/NetworkPlayerInterface.h +++ b/Minecraft.Client/Platform/Common/Network/NetworkPlayerInterface.h @@ -2,30 +2,37 @@ class Socket; -// This is the platform independent interface for dealing with players within a network game. This should be used directly by game code (and GameNetworkManager) rather than the platform-specific implementations. +// This is the platform independent interface for dealing with players within a +// network game. This should be used directly by game code (and +// GameNetworkManager) rather than the platform-specific implementations. -class INetworkPlayer -{ +class INetworkPlayer { public: - virtual ~INetworkPlayer() {} - virtual unsigned char GetSmallId() = 0; - virtual void SendData(INetworkPlayer *player, const void *pvData, int dataSize, bool lowPriority) = 0; - virtual bool IsSameSystem(INetworkPlayer *player) = 0; - virtual int GetSendQueueSizeBytes( INetworkPlayer *player, bool lowPriority ) = 0; - virtual int GetSendQueueSizeMessages( INetworkPlayer *player, bool lowPriority ) = 0; - virtual int GetCurrentRtt() = 0; - virtual bool IsHost() = 0; - virtual bool IsGuest() = 0; - virtual bool IsLocal() = 0; - virtual int GetSessionIndex() = 0; - virtual bool IsTalking() = 0; - virtual bool IsMutedByLocalUser(int userIndex) = 0; - virtual bool HasVoice() = 0; - virtual bool HasCamera() = 0; - virtual int GetUserIndex() = 0; - virtual void SetSocket(Socket *pSocket) = 0; - virtual Socket *GetSocket() = 0; - virtual const wchar_t *GetOnlineName() = 0; - virtual std::wstring GetDisplayName() = 0; - virtual PlayerUID GetUID() = 0; + virtual ~INetworkPlayer() {} + virtual unsigned char GetSmallId() = 0; + virtual void SendData(INetworkPlayer* player, const void* pvData, + int dataSize, bool lowPriority, bool ack) = 0; + virtual bool IsSameSystem(INetworkPlayer* player) = 0; + virtual int GetOutstandingAckCount() = 0; + virtual int GetSendQueueSizeBytes(INetworkPlayer* player, + bool lowPriority) = 0; + virtual int GetSendQueueSizeMessages(INetworkPlayer* player, + bool lowPriority) = 0; + virtual int GetCurrentRtt() = 0; + virtual bool IsHost() = 0; + virtual bool IsGuest() = 0; + virtual bool IsLocal() = 0; + virtual int GetSessionIndex() = 0; + virtual bool IsTalking() = 0; + virtual bool IsMutedByLocalUser(int userIndex) = 0; + virtual bool HasVoice() = 0; + virtual bool HasCamera() = 0; + virtual int GetUserIndex() = 0; + virtual void SetSocket(Socket* pSocket) = 0; + virtual Socket* GetSocket() = 0; + virtual const wchar_t* GetOnlineName() = 0; + virtual std::wstring GetDisplayName() = 0; + virtual PlayerUID GetUID() = 0; + virtual void SentChunkPacket() = 0; + virtual int GetTimeSinceLastChunkPacket_ms() = 0; }; diff --git a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerInterface.h b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerInterface.h index 6b9aa04bb..017c993dc 100644 --- a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerInterface.h +++ b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerInterface.h @@ -1,9 +1,9 @@ #pragma once -//using namespace std; +// using namespace std; #include #ifndef __linux__ #include -#endif // __linux__ +#endif // __linux__ #include "../../Minecraft.World/Util/C4JThread.h" #include "NetworkPlayerInterface.h" #include "SessionInfo.h" @@ -12,117 +12,139 @@ class ClientConnection; class Minecraft; class CGameNetworkManager; -// This is the interface to be implemented by the platform-specific versions of the PlatformNetworkManagers. This API is used directly by GameNetworkManager so that -// it can remain as platform independent as possible. +// This is the interface to be implemented by the platform-specific versions of +// the PlatformNetworkManagers. This API is used directly by GameNetworkManager +// so that it can remain as platform independent as possible. -// This value should be incremented if the server version changes, or the game session data changes +// This value should be incremented if the server version changes, or the game +// session data changes #define MINECRAFT_NET_VERSION VER_NETWORK - -typedef struct _SearchForGamesData -{ - unsigned int sessionIDCount; - XSESSION_SEARCHRESULT_HEADER *searchBuffer; - XNQOS **ppQos; - SessionID *sessionIDList; - XOVERLAPPED *pOverlapped; +typedef struct _SearchForGamesData { + unsigned int sessionIDCount; + XSESSION_SEARCHRESULT_HEADER* searchBuffer; + XNQOS** ppQos; + SessionID* sessionIDList; + XOVERLAPPED* pOverlapped; } SearchForGamesData; -class CPlatformNetworkManager -{ - friend class CGameNetworkManager; +class CPlatformNetworkManager { + friend class CGameNetworkManager; + public: + typedef enum { + JOIN_FAILED_SERVER_FULL, + JOIN_FAILED_INSUFFICIENT_PRIVILEGES, + JOIN_FAILED_NONSPECIFIC, + } eJoinFailedReason; - typedef enum - { - JOIN_FAILED_SERVER_FULL, - JOIN_FAILED_INSUFFICIENT_PRIVILEGES, - JOIN_FAILED_NONSPECIFIC, - } eJoinFailedReason; + virtual bool Initialise(CGameNetworkManager* pGameNetworkManager, + int flagIndexSize) = 0; + virtual void Terminate() = 0; + virtual int GetJoiningReadyPercentage() = 0; + virtual int CorrectErrorIDS(int IDS) = 0; - virtual bool Initialise(CGameNetworkManager *pGameNetworkManager, int flagIndexSize) = 0; - virtual void Terminate() = 0; - virtual int GetJoiningReadyPercentage() = 0; - virtual int CorrectErrorIDS(int IDS) = 0; + virtual void DoWork() = 0; + virtual int GetPlayerCount() = 0; + virtual int GetOnlinePlayerCount() = 0; + virtual int GetLocalPlayerMask(int playerIndex) = 0; + virtual bool AddLocalPlayerByUserIndex(int userIndex) = 0; + virtual bool RemoveLocalPlayerByUserIndex(int userIndex) = 0; + virtual INetworkPlayer* GetLocalPlayerByUserIndex(int userIndex) = 0; + virtual INetworkPlayer* GetPlayerByIndex(int playerIndex) = 0; + virtual INetworkPlayer* GetPlayerByXuid(PlayerUID xuid) = 0; + virtual INetworkPlayer* GetPlayerBySmallId(unsigned char smallId) = 0; + virtual bool ShouldMessageForFullSession() = 0; - virtual void DoWork() = 0; - virtual int GetPlayerCount() = 0; - virtual int GetOnlinePlayerCount() = 0; - virtual int GetLocalPlayerMask(int playerIndex) = 0; - virtual bool AddLocalPlayerByUserIndex( int userIndex ) = 0; - virtual bool RemoveLocalPlayerByUserIndex( int userIndex ) = 0; - virtual INetworkPlayer *GetLocalPlayerByUserIndex( int userIndex ) = 0; - virtual INetworkPlayer *GetPlayerByIndex(int playerIndex) = 0; - virtual INetworkPlayer * GetPlayerByXuid(PlayerUID xuid) = 0; - virtual INetworkPlayer * GetPlayerBySmallId(unsigned char smallId) = 0; - virtual bool ShouldMessageForFullSession() = 0; + virtual INetworkPlayer* GetHostPlayer() = 0; + virtual bool IsHost() = 0; + virtual bool JoinGameFromInviteInfo(int userIndex, int userMask, + const INVITE_INFO* pInviteInfo) = 0; + virtual bool LeaveGame(bool bMigrateHost) = 0; - virtual INetworkPlayer *GetHostPlayer() = 0; - virtual bool IsHost() = 0; - virtual bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo) = 0; - virtual bool LeaveGame(bool bMigrateHost) = 0; + virtual bool IsInSession() = 0; + virtual bool IsInGameplay() = 0; + virtual bool IsReadyToPlayOrIdle() = 0; + virtual bool IsInStatsEnabledSession() = 0; + virtual bool SessionHasSpace(unsigned int spaceRequired = 1) = 0; + virtual void SendInviteGUI(int quadrant) = 0; + virtual bool IsAddingPlayer() = 0; - virtual bool IsInSession() = 0; - virtual bool IsInGameplay() = 0; - virtual bool IsReadyToPlayOrIdle() = 0; - virtual bool IsInStatsEnabledSession() = 0; - virtual bool SessionHasSpace(unsigned int spaceRequired = 1) = 0; - virtual void SendInviteGUI(int quadrant) = 0; - virtual bool IsAddingPlayer() = 0; + virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, + unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, + unsigned char privateSlots = 0) = 0; + virtual int JoinGame(FriendSessionInfo* searchResult, int dwLocalUsersMask, + int dwPrimaryUserIndex) = 0; + virtual void CancelJoinGame() {}; + virtual bool SetLocalGame(bool isLocal) = 0; + virtual bool IsLocalGame() = 0; + virtual void SetPrivateGame(bool isPrivate) = 0; + virtual bool IsPrivateGame() = 0; + virtual bool IsLeavingGame() = 0; + virtual void ResetLeavingGame() = 0; - virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0) = 0; - virtual int JoinGame(FriendSessionInfo *searchResult, int dwLocalUsersMask, int dwPrimaryUserIndex ) = 0; - virtual void CancelJoinGame() {}; - virtual bool SetLocalGame(bool isLocal) = 0; - virtual bool IsLocalGame() = 0; - virtual void SetPrivateGame(bool isPrivate) = 0; - virtual bool IsPrivateGame() = 0; - virtual bool IsLeavingGame() = 0; - virtual void ResetLeavingGame() = 0; + virtual void RegisterPlayerChangedCallback( + int iPad, + void (*callback)(void* callbackParam, INetworkPlayer* pPlayer, + bool leaving), + void* callbackParam) = 0; + virtual void UnRegisterPlayerChangedCallback( + int iPad, + void (*callback)(void* callbackParam, INetworkPlayer* pPlayer, + bool leaving), + void* callbackParam) = 0; - virtual void RegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam) = 0; - virtual void UnRegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam) = 0; + virtual void HandleSignInChange() = 0; - virtual void HandleSignInChange() = 0; - - virtual bool _RunNetworkGame() = 0; + virtual bool _RunNetworkGame() = 0; private: - virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom) = 0; - virtual void _HostGame(int usersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0) = 0; - virtual bool _StartGame() = 0; - + virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom) = 0; + virtual void _HostGame( + int usersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, + unsigned char privateSlots = 0) = 0; + virtual bool _StartGame() = 0; public: - virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL) = 0; + virtual void UpdateAndSetGameSessionData( + INetworkPlayer* pNetworkPlayerLeaving = NULL) = 0; private: - virtual bool RemoveLocalPlayer( INetworkPlayer *pNetworkPlayer ) = 0; + virtual bool RemoveLocalPlayer(INetworkPlayer* pNetworkPlayer) = 0; public: - virtual void SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index) = 0; - virtual bool SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index) = 0; + virtual void SystemFlagSet(INetworkPlayer* pNetworkPlayer, int index) = 0; + virtual bool SystemFlagGet(INetworkPlayer* pNetworkPlayer, int index) = 0; - virtual std::wstring GatherStats() = 0; - virtual std::wstring GatherRTTStats() = 0; + virtual std::wstring GatherStats() = 0; + virtual std::wstring GatherRTTStats() = 0; -private: - virtual void SetSessionTexturePackParentId( int id ) = 0; - virtual void SetSessionSubTexturePackId( int id ) = 0; - virtual void Notify(int ID, ULONG_PTR Param) = 0; +private: + virtual void SetSessionTexturePackParentId(int id) = 0; + virtual void SetSessionSubTexturePackId(int id) = 0; + virtual void Notify(int ID, ULONG_PTR Param) = 0; public: - virtual std::vector *GetSessionList(int iPad, int localPlayers, bool partyOnly) = 0; - virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession) = 0; - virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam ) = 0; - virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ) = 0; - virtual void ForceFriendsSessionRefresh() = 0; + virtual std::vector* GetSessionList(int iPad, + int localPlayers, + bool partyOnly) = 0; + virtual bool GetGameSessionInfo(int iPad, SessionID sessionId, + FriendSessionInfo* foundSession) = 0; + virtual void SetSessionsUpdatedCallback( + void (*SessionsUpdatedCallback)(void* pParam), void* pSearchParam) = 0; + virtual void GetFullFriendSessionInfo( + FriendSessionInfo* foundSession, + void (*FriendSessionUpdatedFn)(bool success, void* pParam), + void* pParam) = 0; + virtual void ForceFriendsSessionRefresh() = 0; #ifndef _XBOX - virtual void FakeLocalPlayerJoined() {}; // Temporary method whilst we don't have real networking to make this happen + virtual void FakeLocalPlayerJoined() { + }; // Temporary method whilst we don't have real networking to make this + // happen #endif #ifdef _DURANGO - virtual std::wstring GetDisplayNameByGamertag(std::wstring gamertag) = 0; + virtual std::wstring GetDisplayNameByGamertag(std::wstring gamertag) = 0; #endif }; diff --git a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.cpp index f50d09559..e8f35b3dc 100644 --- a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.cpp @@ -1,649 +1,580 @@ -#include "../../Minecraft.World/Platform/stdafx.h" +#include "../../Minecraft.World/Platform/stdafx.h" #include "../../Minecraft.World/Network/Socket.h" #include "../../Minecraft.World/Util/StringHelpers.h" #include "PlatformNetworkManagerStub.h" -#include "../../Minecraft.Client/Platform/Xbox/Network/NetworkPlayerXbox.h" // TODO - stub version of this? +#include "../../Minecraft.Client/Platform/Xbox/Network/NetworkPlayerXbox.h" // TODO - stub version of this? -CPlatformNetworkManagerStub *g_pPlatformNetworkManager; +CPlatformNetworkManagerStub* g_pPlatformNetworkManager; +void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer* pQNetPlayer) { + const char* pszDescription; -void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer ) -{ - const char * pszDescription; + // 4J Stu - We create a fake socket for every where that we need an INBOUND + // queue of game data. Outbound is all handled by QNet so we don't need + // that. Therefore each client player has one, and the host has one for each + // client player. + bool createFakeSocket = false; + bool localPlayer = false; - // 4J Stu - We create a fake socket for every where that we need an INBOUND queue of game data. Outbound - // is all handled by QNet so we don't need that. Therefore each client player has one, and the host has one - // for each client player. - bool createFakeSocket = false; - bool localPlayer = false; + NetworkPlayerXbox* networkPlayer = + (NetworkPlayerXbox*)addNetworkPlayer(pQNetPlayer); - NetworkPlayerXbox *networkPlayer = (NetworkPlayerXbox *)addNetworkPlayer(pQNetPlayer); - - if( pQNetPlayer->IsLocal() ) - { - localPlayer = true; - if( pQNetPlayer->IsHost() ) - { + if (pQNetPlayer->IsLocal()) { + localPlayer = true; + if (pQNetPlayer->IsHost()) { pszDescription = "local host"; - // 4J Stu - No socket for the localhost as it uses a special loopback queue + // 4J Stu - No socket for the localhost as it uses a special + // loopback queue - m_machineQNetPrimaryPlayers.push_back( pQNetPlayer ); - } - else - { + m_machineQNetPrimaryPlayers.push_back(pQNetPlayer); + } else { pszDescription = "local"; - // We need an inbound queue on all local players to receive data from the host - createFakeSocket = true; + // We need an inbound queue on all local players to receive data + // from the host + createFakeSocket = true; } - } - else - { - if( pQNetPlayer->IsHost() ) - { + } else { + if (pQNetPlayer->IsHost()) { pszDescription = "remote host"; - } - else - { + } else { pszDescription = "remote"; - // If we are the host, then create a fake socket for every remote player - if( m_pIQNet->IsHost() ) - { - createFakeSocket = true; - } + // If we are the host, then create a fake socket for every remote + // player + if (m_pIQNet->IsHost()) { + createFakeSocket = true; + } } - if( m_pIQNet->IsHost() && !m_bHostChanged ) - { - // Do we already have a primary player for this system? - bool systemHasPrimaryPlayer = false; - for(AUTO_VAR(it, m_machineQNetPrimaryPlayers.begin()); it < m_machineQNetPrimaryPlayers.end(); ++it) - { - IQNetPlayer *pQNetPrimaryPlayer = *it; - if( pQNetPlayer->IsSameSystem(pQNetPrimaryPlayer) ) - { - systemHasPrimaryPlayer = true; - break; - } - } - if( !systemHasPrimaryPlayer ) - m_machineQNetPrimaryPlayers.push_back( pQNetPlayer ); - } + if (m_pIQNet->IsHost() && !m_bHostChanged) { + // Do we already have a primary player for this system? + bool systemHasPrimaryPlayer = false; + for (AUTO_VAR(it, m_machineQNetPrimaryPlayers.begin()); + it < m_machineQNetPrimaryPlayers.end(); ++it) { + IQNetPlayer* pQNetPrimaryPlayer = *it; + if (pQNetPlayer->IsSameSystem(pQNetPrimaryPlayer)) { + systemHasPrimaryPlayer = true; + break; + } + } + if (!systemHasPrimaryPlayer) + m_machineQNetPrimaryPlayers.push_back(pQNetPlayer); + } } - g_NetworkManager.PlayerJoining( networkPlayer ); - - if( createFakeSocket == true && !m_bHostChanged ) - { - g_NetworkManager.CreateSocket( networkPlayer, localPlayer ); - } + g_NetworkManager.PlayerJoining(networkPlayer); - app.DebugPrintf( "Player 0x%p \"%ls\" joined; %s; voice %i; camera %i.\n", - pQNetPlayer, - pQNetPlayer->GetGamertag(), - pszDescription, - (int) pQNetPlayer->HasVoice(), - (int) pQNetPlayer->HasCamera() ); + if (createFakeSocket == true && !m_bHostChanged) { + g_NetworkManager.CreateSocket(networkPlayer, localPlayer); + } + app.DebugPrintf("Player 0x%p \"%ls\" joined; %s; voice %i; camera %i.\n", + pQNetPlayer, pQNetPlayer->GetGamertag(), pszDescription, + (int)pQNetPlayer->HasVoice(), + (int)pQNetPlayer->HasCamera()); - if( m_pIQNet->IsHost() ) - { - // 4J-PB - only the host should do this -// g_NetworkManager.UpdateAndSetGameSessionData(); - SystemFlagAddPlayer( networkPlayer ); - } - - for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) - { - if(playerChangedCallback[idx] != NULL) - playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false ); - } + if (m_pIQNet->IsHost()) { + // 4J-PB - only the host should do this + // g_NetworkManager.UpdateAndSetGameSessionData(); + SystemFlagAddPlayer(networkPlayer); + } - if(m_pIQNet->GetState() == QNET_STATE_GAME_PLAY) - { - int localPlayerCount = 0; - for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) - { - if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; - } + for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { + if (playerChangedCallback[idx] != NULL) + playerChangedCallback[idx](playerChangedCallbackParam[idx], + networkPlayer, false); + } - float appTime = app.getAppTime(); + if (m_pIQNet->GetState() == QNET_STATE_GAME_PLAY) { + int localPlayerCount = 0; + for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { + if (m_pIQNet->GetLocalPlayerByUserIndex(idx) != NULL) + ++localPlayerCount; + } - // Only record stats for the primary player here - m_lastPlayerEventTimeStart = appTime; - } + float appTime = app.getAppTime(); + + // Only record stats for the primary player here + m_lastPlayerEventTimeStart = appTime; + } } -bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkManager, int flagIndexSize) -{ - m_pGameNetworkManager = pGameNetworkManager; - m_flagIndexSize = flagIndexSize; - g_pPlatformNetworkManager = this; - // 4jcraft added this, as it was never called - m_pIQNet = new IQNet(); - for( int i = 0; i < XUSER_MAX_COUNT; i++ ) - { - playerChangedCallback[ i ] = NULL; - } - - m_bLeavingGame = false; - m_bLeaveGameOnTick = false; - m_bHostChanged = false; +bool CPlatformNetworkManagerStub::Initialise( + CGameNetworkManager* pGameNetworkManager, int flagIndexSize) { + m_pGameNetworkManager = pGameNetworkManager; + m_flagIndexSize = flagIndexSize; + g_pPlatformNetworkManager = this; + // 4jcraft added this, as it was never called + m_pIQNet = new IQNet(); + for (int i = 0; i < XUSER_MAX_COUNT; i++) { + playerChangedCallback[i] = NULL; + } - m_bSearchResultsReady = false; - m_bSearchPending = false; + m_bLeavingGame = false; + m_bLeaveGameOnTick = false; + m_bHostChanged = false; - m_bIsOfflineGame = false; - m_pSearchParam = nullptr; - m_SessionsUpdatedCallback = nullptr; + m_bSearchResultsReady = false; + m_bSearchPending = false; - for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) - { - m_searchResultsCount[i] = 0; - m_lastSearchStartTime[i] = 0; + m_bIsOfflineGame = false; + m_pSearchParam = nullptr; + m_SessionsUpdatedCallback = nullptr; - // The results that will be filled in with the current search - m_pSearchResults[i] = NULL; - m_pQoSResult[i] = NULL; - m_pCurrentSearchResults[i] = NULL; - m_pCurrentQoSResult[i] = NULL; - m_currentSearchResultsCount[i] = 0; - } + for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { + m_searchResultsCount[i] = 0; + m_lastSearchStartTime[i] = 0; + + // The results that will be filled in with the current search + m_pSearchResults[i] = NULL; + m_pQoSResult[i] = NULL; + m_pCurrentSearchResults[i] = NULL; + m_pCurrentQoSResult[i] = NULL; + m_currentSearchResultsCount[i] = 0; + } // Success! return true; } -void CPlatformNetworkManagerStub::Terminate() -{ - //TODO: 4jcraft, no release of ressources +void CPlatformNetworkManagerStub::Terminate() { + // TODO: 4jcraft, no release of ressources } -int CPlatformNetworkManagerStub::GetJoiningReadyPercentage() -{ - return 100; +int CPlatformNetworkManagerStub::GetJoiningReadyPercentage() { return 100; } + +int CPlatformNetworkManagerStub::CorrectErrorIDS(int IDS) { return IDS; } + +bool CPlatformNetworkManagerStub::isSystemPrimaryPlayer( + IQNetPlayer* pQNetPlayer) { + return true; } -int CPlatformNetworkManagerStub::CorrectErrorIDS(int IDS) -{ - return IDS; +// We call this twice a frame, either side of the render call so is a good place +// to "tick" things +void CPlatformNetworkManagerStub::DoWork() {} + +int CPlatformNetworkManagerStub::GetPlayerCount() { + return m_pIQNet->GetPlayerCount(); } -bool CPlatformNetworkManagerStub::isSystemPrimaryPlayer(IQNetPlayer *pQNetPlayer) -{ - return true; +bool CPlatformNetworkManagerStub::ShouldMessageForFullSession() { + return false; } -// We call this twice a frame, either side of the render call so is a good place to "tick" things -void CPlatformNetworkManagerStub::DoWork() -{ +int CPlatformNetworkManagerStub::GetOnlinePlayerCount() { return 1; } + +int CPlatformNetworkManagerStub::GetLocalPlayerMask(int playerIndex) { + return 1 << playerIndex; } -int CPlatformNetworkManagerStub::GetPlayerCount() -{ - return m_pIQNet->GetPlayerCount(); +bool CPlatformNetworkManagerStub::AddLocalPlayerByUserIndex(int userIndex) { + NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(userIndex)); + return (m_pIQNet->AddLocalPlayerByUserIndex(userIndex) == S_OK); } -bool CPlatformNetworkManagerStub::ShouldMessageForFullSession() -{ - return false; +bool CPlatformNetworkManagerStub::RemoveLocalPlayerByUserIndex(int userIndex) { + return true; } -int CPlatformNetworkManagerStub::GetOnlinePlayerCount() -{ - return 1; +bool CPlatformNetworkManagerStub::IsInStatsEnabledSession() { return true; } + +bool CPlatformNetworkManagerStub::SessionHasSpace( + unsigned int spaceRequired /*= 1*/) { + return true; } -int CPlatformNetworkManagerStub::GetLocalPlayerMask(int playerIndex) -{ - return 1 << playerIndex; +void CPlatformNetworkManagerStub::SendInviteGUI(int quadrant) {} + +bool CPlatformNetworkManagerStub::IsAddingPlayer() { return false; } + +bool CPlatformNetworkManagerStub::LeaveGame(bool bMigrateHost) { + if (m_bLeavingGame) return true; + + m_bLeavingGame = true; + + // If we are the host wait for the game server to end + if (m_pIQNet->IsHost() && g_NetworkManager.ServerStoppedValid()) { + m_pIQNet->EndGame(); + g_NetworkManager.ServerStoppedWait(); + g_NetworkManager.ServerStoppedDestroy(); + } + return true; } -bool CPlatformNetworkManagerStub::AddLocalPlayerByUserIndex( int userIndex ) -{ - NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(userIndex)); - return ( m_pIQNet->AddLocalPlayerByUserIndex(userIndex) == S_OK ); +bool CPlatformNetworkManagerStub::_LeaveGame(bool bMigrateHost, + bool bLeaveRoom) { + return true; } -bool CPlatformNetworkManagerStub::RemoveLocalPlayerByUserIndex( int userIndex ) -{ - return true; +void CPlatformNetworkManagerStub::HostGame( + int localUsersMask, bool bOnlineGame, bool bIsPrivate, + unsigned char publicSlots /*= MINECRAFT_NET_MAX_PLAYERS*/, + unsigned char privateSlots /*= 0*/) { + // #ifdef _XBOX + // 4J Stu - We probably did this earlier as well, but just to be sure! + SetLocalGame(!bOnlineGame); + SetPrivateGame(bIsPrivate); + SystemFlagReset(); + + // Make sure that the Primary Pad is in by default + localUsersMask |= GetLocalPlayerMask(g_NetworkManager.GetPrimaryPad()); + + m_bLeavingGame = false; + + m_pIQNet->HostGame(); + + _HostGame(localUsersMask, publicSlots, privateSlots); + // #endif } -bool CPlatformNetworkManagerStub::IsInStatsEnabledSession() -{ - return true; +void CPlatformNetworkManagerStub::_HostGame( + int usersMask, unsigned char publicSlots /*= MINECRAFT_NET_MAX_PLAYERS*/, + unsigned char privateSlots /*= 0*/) {} + +bool CPlatformNetworkManagerStub::_StartGame() { return true; } + +int CPlatformNetworkManagerStub::JoinGame(FriendSessionInfo* searchResult, + int localUsersMask, + int primaryUserIndex) { + return CGameNetworkManager::JOINGAME_SUCCESS; } -bool CPlatformNetworkManagerStub::SessionHasSpace(unsigned int spaceRequired /*= 1*/) -{ - return true; +bool CPlatformNetworkManagerStub::SetLocalGame(bool isLocal) { + m_bIsOfflineGame = isLocal; + + return true; } -void CPlatformNetworkManagerStub::SendInviteGUI(int quadrant) -{ +void CPlatformNetworkManagerStub::SetPrivateGame(bool isPrivate) { + app.DebugPrintf("Setting as private game: %s\n", isPrivate ? "yes" : "no"); + m_bIsPrivateGame = isPrivate; } -bool CPlatformNetworkManagerStub::IsAddingPlayer() -{ - return false; +void CPlatformNetworkManagerStub::RegisterPlayerChangedCallback( + int iPad, + void (*callback)(void* callbackParam, INetworkPlayer* pPlayer, + bool leaving), + void* callbackParam) { + playerChangedCallback[iPad] = callback; + playerChangedCallbackParam[iPad] = callbackParam; } -bool CPlatformNetworkManagerStub::LeaveGame(bool bMigrateHost) -{ - if( m_bLeavingGame ) return true; - - m_bLeavingGame = true; - - // If we are the host wait for the game server to end - if(m_pIQNet->IsHost() && g_NetworkManager.ServerStoppedValid()) - { - m_pIQNet->EndGame(); - g_NetworkManager.ServerStoppedWait(); - g_NetworkManager.ServerStoppedDestroy(); - } - return true; +void CPlatformNetworkManagerStub::UnRegisterPlayerChangedCallback( + int iPad, + void (*callback)(void* callbackParam, INetworkPlayer* pPlayer, + bool leaving), + void* callbackParam) { + if (playerChangedCallbackParam[iPad] == callbackParam) { + playerChangedCallback[iPad] = NULL; + playerChangedCallbackParam[iPad] = NULL; + } } -bool CPlatformNetworkManagerStub::_LeaveGame(bool bMigrateHost, bool bLeaveRoom) -{ - return true; +void CPlatformNetworkManagerStub::HandleSignInChange() { return; } + +bool CPlatformNetworkManagerStub::_RunNetworkGame() { return true; } + +void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData( + INetworkPlayer* pNetworkPlayerLeaving /*= NULL*/) { + // DWORD playerCount = m_pIQNet->GetPlayerCount(); + // + // if( this->m_bLeavingGame ) + // return; + // + // if( GetHostPlayer() == NULL ) + // return; + // + // for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) + // { + // if( i < playerCount ) + // { + // INetworkPlayer *pNetworkPlayer = GetPlayerByIndex(i); + // + // // 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(); + // + // char *temp; + // temp = (char *)wstringtofilename( + // pNetworkPlayer->GetOnlineName() ); + // memcpy(m_hostGameSessionData.szPlayers[i],temp,XUSER_NAME_SIZE); + // } + // else + // { + // m_hostGameSessionData.players[i] = NULL; + // memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); + // } + // } + // else + // { + // m_hostGameSessionData.players[i] = NULL; + // memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); + // } + // } + // + // m_hostGameSessionData.hostPlayerUID = ((NetworkPlayerXbox + // *)GetHostPlayer())->GetQNetPlayer()->GetXuid(); + // m_hostGameSessionData.m_uiGameHostSettings = + // app.GetGameHostOption(eGameHostOption_All); } -void CPlatformNetworkManagerStub::HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, unsigned char publicSlots /*= MINECRAFT_NET_MAX_PLAYERS*/, unsigned char privateSlots /*= 0*/) -{ -// #ifdef _XBOX - // 4J Stu - We probably did this earlier as well, but just to be sure! - SetLocalGame( !bOnlineGame ); - SetPrivateGame( bIsPrivate ); - SystemFlagReset(); +int CPlatformNetworkManagerStub::RemovePlayerOnSocketClosedThreadProc( + void* lpParam) { + INetworkPlayer* pNetworkPlayer = (INetworkPlayer*)lpParam; - // Make sure that the Primary Pad is in by default - localUsersMask |= GetLocalPlayerMask( g_NetworkManager.GetPrimaryPad() ); + Socket* socket = pNetworkPlayer->GetSocket(); - m_bLeavingGame = false; + if (socket != NULL) { + // printf("Waiting for socket closed event\n"); + socket->m_socketClosedEvent->WaitForSignal(INFINITE); - m_pIQNet->HostGame(); + // printf("Socket closed event has fired\n"); + // 4J Stu - Clear our reference to this socket + pNetworkPlayer->SetSocket(NULL); + delete socket; + } - _HostGame( localUsersMask, publicSlots, privateSlots ); -//#endif + return g_pPlatformNetworkManager->RemoveLocalPlayer(pNetworkPlayer); } -void CPlatformNetworkManagerStub::_HostGame(int usersMask, unsigned char publicSlots /*= MINECRAFT_NET_MAX_PLAYERS*/, unsigned char privateSlots /*= 0*/) -{ +bool CPlatformNetworkManagerStub::RemoveLocalPlayer( + INetworkPlayer* pNetworkPlayer) { + return true; } -bool CPlatformNetworkManagerStub::_StartGame() -{ - return true; +CPlatformNetworkManagerStub::PlayerFlags::PlayerFlags( + INetworkPlayer* pNetworkPlayer, unsigned int count) { + // 4J Stu - Don't assert, just make it a multiple of 8! This count is + // calculated from a load of separate values, and makes tweaking + // world/render sizes a pain if we hit an assert here + count = (count + 8 - 1) & ~(8 - 1); + // assert( ( count % 8 ) == 0 ); + this->m_pNetworkPlayer = pNetworkPlayer; + this->flags = new unsigned char[count / 8]; + memset(this->flags, 0, count / 8); + this->count = count; +} +CPlatformNetworkManagerStub::PlayerFlags::~PlayerFlags() { delete[] flags; } + +// Add a player to the per system flag storage - if we've already got a player +// from that system, copy its flags over +void CPlatformNetworkManagerStub::SystemFlagAddPlayer( + INetworkPlayer* pNetworkPlayer) { + PlayerFlags* newPlayerFlags = + new PlayerFlags(pNetworkPlayer, m_flagIndexSize); + // If any of our existing players are on the same system, then copy over + // flags from that one + for (unsigned int i = 0; i < m_playerFlags.size(); i++) { + if (pNetworkPlayer->IsSameSystem(m_playerFlags[i]->m_pNetworkPlayer)) { + memcpy(newPlayerFlags->flags, m_playerFlags[i]->flags, + m_playerFlags[i]->count / 8); + break; + } + } + m_playerFlags.push_back(newPlayerFlags); } -int CPlatformNetworkManagerStub::JoinGame(FriendSessionInfo *searchResult, int localUsersMask, int primaryUserIndex) -{ - return CGameNetworkManager::JOINGAME_SUCCESS; +// Remove a player from the per system flag storage - just maintains the +// m_playerFlags vector without any gaps in it +void CPlatformNetworkManagerStub::SystemFlagRemovePlayer( + INetworkPlayer* pNetworkPlayer) { + for (unsigned int i = 0; i < m_playerFlags.size(); i++) { + if (m_playerFlags[i]->m_pNetworkPlayer == pNetworkPlayer) { + delete m_playerFlags[i]; + m_playerFlags[i] = m_playerFlags.back(); + m_playerFlags.pop_back(); + return; + } + } } -bool CPlatformNetworkManagerStub::SetLocalGame(bool isLocal) -{ - m_bIsOfflineGame = isLocal; - - return true; +void CPlatformNetworkManagerStub::SystemFlagReset() { + for (unsigned int i = 0; i < m_playerFlags.size(); i++) { + delete m_playerFlags[i]; + } + m_playerFlags.clear(); } -void CPlatformNetworkManagerStub::SetPrivateGame(bool isPrivate) -{ - app.DebugPrintf("Setting as private game: %s\n", isPrivate ? "yes" : "no" ); - m_bIsPrivateGame = isPrivate; +// Set a per system flag - this is done by setting the flag on every player that +// shares that system +void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer* pNetworkPlayer, + int index) { + if ((index < 0) || (index >= m_flagIndexSize)) return; + if (pNetworkPlayer == NULL) return; + + for (unsigned int i = 0; i < m_playerFlags.size(); i++) { + if (pNetworkPlayer->IsSameSystem(m_playerFlags[i]->m_pNetworkPlayer)) { + m_playerFlags[i]->flags[index / 8] |= (128 >> (index % 8)); + } + } } -void CPlatformNetworkManagerStub::RegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam) -{ - playerChangedCallback[iPad] = callback; - playerChangedCallbackParam[iPad] = callbackParam; +// Get value of a per system flag - can be read from the flags of the passed in +// player as anything else sent to that system should also have been duplicated +// here +bool CPlatformNetworkManagerStub::SystemFlagGet(INetworkPlayer* pNetworkPlayer, + int index) { + if ((index < 0) || (index >= m_flagIndexSize)) return false; + if (pNetworkPlayer == NULL) { + return false; + } + + for (unsigned int i = 0; i < m_playerFlags.size(); i++) { + if (m_playerFlags[i]->m_pNetworkPlayer == pNetworkPlayer) { + return ((m_playerFlags[i]->flags[index / 8] & + (128 >> (index % 8))) != 0); + } + } + return false; } -void CPlatformNetworkManagerStub::UnRegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam) -{ - if(playerChangedCallbackParam[iPad] == callbackParam) - { - playerChangedCallback[iPad] = NULL; - playerChangedCallbackParam[iPad] = NULL; - } +std::wstring CPlatformNetworkManagerStub::GatherStats() { return L""; } + +std::wstring CPlatformNetworkManagerStub::GatherRTTStats() { + std::wstring stats(L"Rtt: "); + + wchar_t stat[32]; + + for (unsigned int i = 0; i < GetPlayerCount(); ++i) { + IQNetPlayer* pQNetPlayer = + ((NetworkPlayerXbox*)GetPlayerByIndex(i))->GetQNetPlayer(); + + if (!pQNetPlayer->IsLocal()) { + ZeroMemory(stat, 32 * sizeof(WCHAR)); + swprintf(stat, 32, L"%d: %d/", i, pQNetPlayer->GetCurrentRtt()); + stats.append(stat); + } + } + return stats; } -void CPlatformNetworkManagerStub::HandleSignInChange() -{ - return; +void CPlatformNetworkManagerStub::TickSearch() {} + +void CPlatformNetworkManagerStub::SearchForGames() {} + +int CPlatformNetworkManagerStub::SearchForGamesThreadProc(void* lpParameter) { + return 0; } -bool CPlatformNetworkManagerStub::_RunNetworkGame() -{ - return true; +void CPlatformNetworkManagerStub::SetSearchResultsReady(int resultCount) { + m_bSearchResultsReady = true; + m_searchResultsCount[m_lastSearchPad] = resultCount; } -void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/) -{ -// DWORD playerCount = m_pIQNet->GetPlayerCount(); -// -// if( this->m_bLeavingGame ) -// return; -// -// if( GetHostPlayer() == NULL ) -// return; -// -// for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) -// { -// if( i < playerCount ) -// { -// INetworkPlayer *pNetworkPlayer = GetPlayerByIndex(i); -// -// // 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(); -// -// char *temp; -// temp = (char *)wstringtofilename( pNetworkPlayer->GetOnlineName() ); -// memcpy(m_hostGameSessionData.szPlayers[i],temp,XUSER_NAME_SIZE); -// } -// else -// { -// m_hostGameSessionData.players[i] = NULL; -// memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); -// } -// } -// else -// { -// m_hostGameSessionData.players[i] = NULL; -// memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); -// } -// } -// -// m_hostGameSessionData.hostPlayerUID = ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetXuid(); -// m_hostGameSessionData.m_uiGameHostSettings = app.GetGameHostOption(eGameHostOption_All); +std::vector* CPlatformNetworkManagerStub::GetSessionList( + int iPad, int localPlayers, bool partyOnly) { + std::vector* filteredList = + new std::vector(); + ; + return filteredList; } -int CPlatformNetworkManagerStub::RemovePlayerOnSocketClosedThreadProc( void* lpParam ) -{ - INetworkPlayer *pNetworkPlayer = (INetworkPlayer *)lpParam; - - Socket *socket = pNetworkPlayer->GetSocket(); - - if( socket != NULL ) - { - //printf("Waiting for socket closed event\n"); - socket->m_socketClosedEvent->WaitForSignal(INFINITE); - - //printf("Socket closed event has fired\n"); - // 4J Stu - Clear our reference to this socket - pNetworkPlayer->SetSocket( NULL ); - delete socket; - } - - return g_pPlatformNetworkManager->RemoveLocalPlayer( pNetworkPlayer ); +bool CPlatformNetworkManagerStub::GetGameSessionInfo( + int iPad, SessionID sessionId, FriendSessionInfo* foundSessionInfo) { + return false; } -bool CPlatformNetworkManagerStub::RemoveLocalPlayer( INetworkPlayer *pNetworkPlayer ) -{ - return true; +void CPlatformNetworkManagerStub::SetSessionsUpdatedCallback( + void (*SessionsUpdatedCallback)(void* pParam), void* pSearchParam) { + m_SessionsUpdatedCallback = SessionsUpdatedCallback; + m_pSearchParam = pSearchParam; } -CPlatformNetworkManagerStub::PlayerFlags::PlayerFlags(INetworkPlayer *pNetworkPlayer, unsigned int count) -{ - // 4J Stu - Don't assert, just make it a multiple of 8! This count is calculated from a load of separate values, - // and makes tweaking world/render sizes a pain if we hit an assert here - count = (count + 8 - 1) & ~(8 - 1); - //assert( ( count % 8 ) == 0 ); - this->m_pNetworkPlayer = pNetworkPlayer; - this->flags = new unsigned char [ count / 8 ]; - memset( this->flags, 0, count / 8 ); - this->count = count; -} -CPlatformNetworkManagerStub::PlayerFlags::~PlayerFlags() -{ - delete [] flags; +void CPlatformNetworkManagerStub::GetFullFriendSessionInfo( + FriendSessionInfo* foundSession, + void (*FriendSessionUpdatedFn)(bool success, void* pParam), void* pParam) { + FriendSessionUpdatedFn(true, pParam); } -// Add a player to the per system flag storage - if we've already got a player from that system, copy its flags over -void CPlatformNetworkManagerStub::SystemFlagAddPlayer(INetworkPlayer *pNetworkPlayer) -{ - PlayerFlags *newPlayerFlags = new PlayerFlags( pNetworkPlayer, m_flagIndexSize); - // If any of our existing players are on the same system, then copy over flags from that one - for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) - { - if( pNetworkPlayer->IsSameSystem(m_playerFlags[i]->m_pNetworkPlayer) ) - { - memcpy( newPlayerFlags->flags, m_playerFlags[i]->flags, m_playerFlags[i]->count / 8 ); - break; - } - } - m_playerFlags.push_back(newPlayerFlags); +void CPlatformNetworkManagerStub::ForceFriendsSessionRefresh() { + app.DebugPrintf("Resetting friends session search data\n"); + + for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { + m_searchResultsCount[i] = 0; + m_lastSearchStartTime[i] = 0; + delete m_pSearchResults[i]; + m_pSearchResults[i] = NULL; + } } -// Remove a player from the per system flag storage - just maintains the m_playerFlags vector without any gaps in it -void CPlatformNetworkManagerStub::SystemFlagRemovePlayer(INetworkPlayer *pNetworkPlayer) -{ - for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) - { - if( m_playerFlags[i]->m_pNetworkPlayer == pNetworkPlayer ) - { - delete m_playerFlags[i]; - m_playerFlags[i] = m_playerFlags.back(); - m_playerFlags.pop_back(); - return; - } - } +INetworkPlayer* CPlatformNetworkManagerStub::addNetworkPlayer( + IQNetPlayer* pQNetPlayer) { + NetworkPlayerXbox* pNetworkPlayer = new NetworkPlayerXbox(pQNetPlayer); + pQNetPlayer->SetCustomDataValue((ULONG_PTR)pNetworkPlayer); + currentNetworkPlayers.push_back(pNetworkPlayer); + return pNetworkPlayer; } -void CPlatformNetworkManagerStub::SystemFlagReset() -{ - for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) - { - delete m_playerFlags[i]; - } - m_playerFlags.clear(); +void CPlatformNetworkManagerStub::removeNetworkPlayer( + IQNetPlayer* pQNetPlayer) { + INetworkPlayer* pNetworkPlayer = getNetworkPlayer(pQNetPlayer); + for (AUTO_VAR(it, currentNetworkPlayers.begin()); + it != currentNetworkPlayers.end(); it++) { + if (*it == pNetworkPlayer) { + currentNetworkPlayers.erase(it); + return; + } + } } -// Set a per system flag - this is done by setting the flag on every player that shares that system -void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index) -{ - if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return; - if( pNetworkPlayer == NULL ) return; - - for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) - { - if( pNetworkPlayer->IsSameSystem(m_playerFlags[i]->m_pNetworkPlayer) ) - { - m_playerFlags[i]->flags[ index / 8 ] |= ( 128 >> ( index % 8 ) ); - } - } +INetworkPlayer* CPlatformNetworkManagerStub::getNetworkPlayer( + IQNetPlayer* pQNetPlayer) { + return pQNetPlayer ? (INetworkPlayer*)(pQNetPlayer->GetCustomDataValue()) + : NULL; } -// Get value of a per system flag - can be read from the flags of the passed in player as anything else sent to that -// system should also have been duplicated here -bool CPlatformNetworkManagerStub::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index) -{ - if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false; - if( pNetworkPlayer == NULL ) - { - return false; - } - - for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) - { - if( m_playerFlags[i]->m_pNetworkPlayer == pNetworkPlayer ) - { - return ( ( m_playerFlags[i]->flags[ index / 8 ] & ( 128 >> ( index % 8 ) ) ) != 0 ); - } - } - return false; +INetworkPlayer* CPlatformNetworkManagerStub::GetLocalPlayerByUserIndex( + int userIndex) { + return getNetworkPlayer(m_pIQNet->GetLocalPlayerByUserIndex(userIndex)); } -std::wstring CPlatformNetworkManagerStub::GatherStats() -{ - return L""; +INetworkPlayer* CPlatformNetworkManagerStub::GetPlayerByIndex(int playerIndex) { + return getNetworkPlayer(m_pIQNet->GetPlayerByIndex(playerIndex)); } -std::wstring CPlatformNetworkManagerStub::GatherRTTStats() -{ - std::wstring stats(L"Rtt: "); - - wchar_t stat[32]; - - for(unsigned int i = 0; i < GetPlayerCount(); ++i) - { - IQNetPlayer *pQNetPlayer = ((NetworkPlayerXbox *)GetPlayerByIndex( i ))->GetQNetPlayer(); - - if(!pQNetPlayer->IsLocal()) - { - ZeroMemory(stat,32*sizeof(WCHAR)); - swprintf(stat, 32, L"%d: %d/", i, pQNetPlayer->GetCurrentRtt() ); - stats.append(stat); - } - } - return stats; +INetworkPlayer* CPlatformNetworkManagerStub::GetPlayerByXuid(PlayerUID xuid) { + return getNetworkPlayer(m_pIQNet->GetPlayerByXuid(xuid)); } -void CPlatformNetworkManagerStub::TickSearch() -{ +INetworkPlayer* CPlatformNetworkManagerStub::GetPlayerBySmallId( + unsigned char smallId) { + return getNetworkPlayer(m_pIQNet->GetPlayerBySmallId(smallId)); } -void CPlatformNetworkManagerStub::SearchForGames() -{ +INetworkPlayer* CPlatformNetworkManagerStub::GetHostPlayer() { + return getNetworkPlayer(m_pIQNet->GetHostPlayer()); } -int CPlatformNetworkManagerStub::SearchForGamesThreadProc( void* lpParameter ) -{ - return 0; +bool CPlatformNetworkManagerStub::IsHost() { + return m_pIQNet->IsHost() && !m_bHostChanged; } -void CPlatformNetworkManagerStub::SetSearchResultsReady(int resultCount) -{ - m_bSearchResultsReady = true; - m_searchResultsCount[m_lastSearchPad] = resultCount; +bool CPlatformNetworkManagerStub::JoinGameFromInviteInfo( + int userIndex, int userMask, const INVITE_INFO* pInviteInfo) { + return (m_pIQNet->JoinGameFromInviteInfo(userIndex, userMask, + pInviteInfo) == S_OK); } -std::vector *CPlatformNetworkManagerStub::GetSessionList(int iPad, int localPlayers, bool partyOnly) -{ - std::vector *filteredList = new std::vector();; - return filteredList; +void CPlatformNetworkManagerStub::SetSessionTexturePackParentId(int id) { + m_hostGameSessionData.texturePackParentId = id; } -bool CPlatformNetworkManagerStub::GetGameSessionInfo(int iPad, SessionID sessionId, FriendSessionInfo *foundSessionInfo) -{ - return false; +void CPlatformNetworkManagerStub::SetSessionSubTexturePackId(int id) { + m_hostGameSessionData.subTexturePackId = id; } -void CPlatformNetworkManagerStub::SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam ) -{ - m_SessionsUpdatedCallback = SessionsUpdatedCallback; m_pSearchParam = pSearchParam; +void CPlatformNetworkManagerStub::Notify(int ID, ULONG_PTR Param) {} + +bool CPlatformNetworkManagerStub::IsInSession() { + return m_pIQNet->GetState() != QNET_STATE_IDLE; } -void CPlatformNetworkManagerStub::GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ) -{ - FriendSessionUpdatedFn(true, pParam); +bool CPlatformNetworkManagerStub::IsInGameplay() { + return m_pIQNet->GetState() == QNET_STATE_GAME_PLAY; } -void CPlatformNetworkManagerStub::ForceFriendsSessionRefresh() -{ - app.DebugPrintf("Resetting friends session search data\n"); - - for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) - { - m_searchResultsCount[i] = 0; - m_lastSearchStartTime[i] = 0; - delete m_pSearchResults[i]; - m_pSearchResults[i] = NULL; - } -} - -INetworkPlayer *CPlatformNetworkManagerStub::addNetworkPlayer(IQNetPlayer *pQNetPlayer) -{ - NetworkPlayerXbox *pNetworkPlayer = new NetworkPlayerXbox(pQNetPlayer); - pQNetPlayer->SetCustomDataValue((ULONG_PTR)pNetworkPlayer); - currentNetworkPlayers.push_back( pNetworkPlayer ); - return pNetworkPlayer; -} - -void CPlatformNetworkManagerStub::removeNetworkPlayer(IQNetPlayer *pQNetPlayer) -{ - INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pQNetPlayer); - for( AUTO_VAR(it, currentNetworkPlayers.begin()); it != currentNetworkPlayers.end(); it++ ) - { - if( *it == pNetworkPlayer ) - { - currentNetworkPlayers.erase(it); - return; - } - } -} - -INetworkPlayer *CPlatformNetworkManagerStub::getNetworkPlayer(IQNetPlayer *pQNetPlayer) -{ - return pQNetPlayer ? (INetworkPlayer *)(pQNetPlayer->GetCustomDataValue()) : NULL; -} - - -INetworkPlayer *CPlatformNetworkManagerStub::GetLocalPlayerByUserIndex(int userIndex ) -{ - return getNetworkPlayer(m_pIQNet->GetLocalPlayerByUserIndex(userIndex)); -} - -INetworkPlayer *CPlatformNetworkManagerStub::GetPlayerByIndex(int playerIndex) -{ - return getNetworkPlayer(m_pIQNet->GetPlayerByIndex(playerIndex)); -} - -INetworkPlayer * CPlatformNetworkManagerStub::GetPlayerByXuid(PlayerUID xuid) -{ - return getNetworkPlayer( m_pIQNet->GetPlayerByXuid(xuid)) ; -} - -INetworkPlayer * CPlatformNetworkManagerStub::GetPlayerBySmallId(unsigned char smallId) -{ - return getNetworkPlayer(m_pIQNet->GetPlayerBySmallId(smallId)); -} - -INetworkPlayer *CPlatformNetworkManagerStub::GetHostPlayer() -{ - return getNetworkPlayer(m_pIQNet->GetHostPlayer()); -} - -bool CPlatformNetworkManagerStub::IsHost() -{ - return m_pIQNet->IsHost() && !m_bHostChanged; -} - -bool CPlatformNetworkManagerStub::JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo) -{ - return ( m_pIQNet->JoinGameFromInviteInfo( userIndex, userMask, pInviteInfo ) == S_OK); -} - -void CPlatformNetworkManagerStub::SetSessionTexturePackParentId( int id ) -{ - m_hostGameSessionData.texturePackParentId = id; -} - -void CPlatformNetworkManagerStub::SetSessionSubTexturePackId( int id ) -{ - m_hostGameSessionData.subTexturePackId = id; -} - -void CPlatformNetworkManagerStub::Notify(int ID, ULONG_PTR Param) -{ -} - -bool CPlatformNetworkManagerStub::IsInSession() -{ - return m_pIQNet->GetState() != QNET_STATE_IDLE; -} - -bool CPlatformNetworkManagerStub::IsInGameplay() -{ - return m_pIQNet->GetState() == QNET_STATE_GAME_PLAY; -} - -bool CPlatformNetworkManagerStub::IsReadyToPlayOrIdle() -{ - return true; -} +bool CPlatformNetworkManagerStub::IsReadyToPlayOrIdle() { return true; } diff --git a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.h b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.h index 19a5a938c..1a64cba27 100644 --- a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.h +++ b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.h @@ -1,170 +1,201 @@ #pragma once -//using namespace std; +// using namespace std; #include #include "../../Minecraft.World/Util/C4JThread.h" #include "NetworkPlayerInterface.h" #include "PlatformNetworkManagerInterface.h" #include "SessionInfo.h" -class CPlatformNetworkManagerStub : public CPlatformNetworkManager -{ - friend class CGameNetworkManager; +class CPlatformNetworkManagerStub : public CPlatformNetworkManager { + friend class CGameNetworkManager; + public: - virtual bool Initialise(CGameNetworkManager *pGameNetworkManager, int flagIndexSize); - virtual void Terminate(); - virtual int GetJoiningReadyPercentage(); - virtual int CorrectErrorIDS(int IDS); + virtual bool Initialise(CGameNetworkManager* pGameNetworkManager, + int flagIndexSize); + virtual void Terminate(); + virtual int GetJoiningReadyPercentage(); + virtual int CorrectErrorIDS(int IDS); - virtual void DoWork(); - virtual int GetPlayerCount(); - virtual int GetOnlinePlayerCount(); - virtual int GetLocalPlayerMask(int playerIndex); - virtual bool AddLocalPlayerByUserIndex( int userIndex ); - virtual bool RemoveLocalPlayerByUserIndex( int userIndex ); - virtual INetworkPlayer *GetLocalPlayerByUserIndex( int userIndex ); - virtual INetworkPlayer *GetPlayerByIndex(int playerIndex); - virtual INetworkPlayer * GetPlayerByXuid(PlayerUID xuid); - virtual INetworkPlayer * GetPlayerBySmallId(unsigned char smallId); - virtual bool ShouldMessageForFullSession(); + virtual void DoWork(); + virtual int GetPlayerCount(); + virtual int GetOnlinePlayerCount(); + virtual int GetLocalPlayerMask(int playerIndex); + virtual bool AddLocalPlayerByUserIndex(int userIndex); + virtual bool RemoveLocalPlayerByUserIndex(int userIndex); + virtual INetworkPlayer* GetLocalPlayerByUserIndex(int userIndex); + virtual INetworkPlayer* GetPlayerByIndex(int playerIndex); + virtual INetworkPlayer* GetPlayerByXuid(PlayerUID xuid); + virtual INetworkPlayer* GetPlayerBySmallId(unsigned char smallId); + virtual bool ShouldMessageForFullSession(); - virtual INetworkPlayer *GetHostPlayer(); - virtual bool IsHost(); - virtual bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo); - virtual bool LeaveGame(bool bMigrateHost); + virtual INetworkPlayer* GetHostPlayer(); + virtual bool IsHost(); + virtual bool JoinGameFromInviteInfo(int userIndex, int userMask, + const INVITE_INFO* pInviteInfo); + virtual bool LeaveGame(bool bMigrateHost); - virtual bool IsInSession(); - virtual bool IsInGameplay(); - virtual bool IsReadyToPlayOrIdle(); - virtual bool IsInStatsEnabledSession(); - virtual bool SessionHasSpace(unsigned int spaceRequired = 1); - virtual void SendInviteGUI(int quadrant); - virtual bool IsAddingPlayer(); + virtual bool IsInSession(); + virtual bool IsInGameplay(); + virtual bool IsReadyToPlayOrIdle(); + virtual bool IsInStatsEnabledSession(); + virtual bool SessionHasSpace(unsigned int spaceRequired = 1); + virtual void SendInviteGUI(int quadrant); + virtual bool IsAddingPlayer(); - virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0); - virtual int JoinGame(FriendSessionInfo *searchResult, int localUsersMask, int primaryUserIndex ); - virtual bool SetLocalGame(bool isLocal); - virtual bool IsLocalGame() { return m_bIsOfflineGame; } - virtual void SetPrivateGame(bool isPrivate); - virtual bool IsPrivateGame() { return m_bIsPrivateGame; } - virtual bool IsLeavingGame() { return m_bLeavingGame; } - virtual void ResetLeavingGame() { m_bLeavingGame = false; } + virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, + unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, + unsigned char privateSlots = 0); + virtual int JoinGame(FriendSessionInfo* searchResult, int localUsersMask, + int primaryUserIndex); + virtual bool SetLocalGame(bool isLocal); + virtual bool IsLocalGame() { return m_bIsOfflineGame; } + virtual void SetPrivateGame(bool isPrivate); + virtual bool IsPrivateGame() { return m_bIsPrivateGame; } + virtual bool IsLeavingGame() { return m_bLeavingGame; } + virtual void ResetLeavingGame() { m_bLeavingGame = false; } - virtual void RegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam); - virtual void UnRegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam); + virtual void RegisterPlayerChangedCallback( + int iPad, + void (*callback)(void* callbackParam, INetworkPlayer* pPlayer, + bool leaving), + void* callbackParam); + virtual void UnRegisterPlayerChangedCallback( + int iPad, + void (*callback)(void* callbackParam, INetworkPlayer* pPlayer, + bool leaving), + void* callbackParam); - virtual void HandleSignInChange(); + virtual void HandleSignInChange(); - virtual bool _RunNetworkGame(); - -private: - bool isSystemPrimaryPlayer(IQNetPlayer *pQNetPlayer); - virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom); - virtual void _HostGame(int dwUsersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0); - virtual bool _StartGame(); - - IQNet * m_pIQNet; // pointer to QNet interface - - HANDLE m_notificationListener; - - std::vector m_machineQNetPrimaryPlayers; // collection of players that we deem to be the main one for that system - - bool m_bLeavingGame; - bool m_bLeaveGameOnTick; - bool m_migrateHostOnLeave; - bool m_bHostChanged; - - bool m_bIsOfflineGame; - bool m_bIsPrivateGame; - int m_flagIndexSize; - - // This is only maintained by the host, and is not valid on client machines - GameSessionData m_hostGameSessionData; - CGameNetworkManager *m_pGameNetworkManager; -public: - virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); + virtual bool _RunNetworkGame(); private: - // TODO 4J Stu - Do we need to be able to have more than one of these? - void (*playerChangedCallback[XUSER_MAX_COUNT])(void *callbackParam, INetworkPlayer *pPlayer, bool leaving); - void *playerChangedCallbackParam[XUSER_MAX_COUNT]; + bool isSystemPrimaryPlayer(IQNetPlayer* pQNetPlayer); + virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom); + virtual void _HostGame( + int dwUsersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, + unsigned char privateSlots = 0); + virtual bool _StartGame(); - static int RemovePlayerOnSocketClosedThreadProc( void* lpParam ); - virtual bool RemoveLocalPlayer( INetworkPlayer *pNetworkPlayer ); + IQNet* m_pIQNet; // pointer to QNet interface - // Things for handling per-system flags - class PlayerFlags - { - public: - INetworkPlayer *m_pNetworkPlayer; - unsigned char *flags; - unsigned int count; - PlayerFlags(INetworkPlayer *pNetworkPlayer, unsigned int count); - ~PlayerFlags(); - }; - std::vector m_playerFlags; - void SystemFlagAddPlayer(INetworkPlayer *pNetworkPlayer); - void SystemFlagRemovePlayer(INetworkPlayer *pNetworkPlayer); - void SystemFlagReset(); -public: - virtual void SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index); - virtual bool SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index); + HANDLE m_notificationListener; - // For telemetry -private: - float m_lastPlayerEventTimeStart; + std::vector + m_machineQNetPrimaryPlayers; // collection of players that we deem to + // be the main one for that system + + bool m_bLeavingGame; + bool m_bLeaveGameOnTick; + bool m_migrateHostOnLeave; + bool m_bHostChanged; + + bool m_bIsOfflineGame; + bool m_bIsPrivateGame; + int m_flagIndexSize; + + // This is only maintained by the host, and is not valid on client machines + GameSessionData m_hostGameSessionData; + CGameNetworkManager* m_pGameNetworkManager; public: - std::wstring GatherStats(); - std::wstring GatherRTTStats(); - -private: - std::vector friendsSessions[XUSER_MAX_COUNT]; - int m_searchResultsCount[XUSER_MAX_COUNT]; - int m_lastSearchStartTime[XUSER_MAX_COUNT]; - - // The results that will be filled in with the current search - XSESSION_SEARCHRESULT_HEADER *m_pSearchResults[XUSER_MAX_COUNT]; - XNQOS *m_pQoSResult[XUSER_MAX_COUNT]; - - // The results from the previous search, which are currently displayed in the game - XSESSION_SEARCHRESULT_HEADER *m_pCurrentSearchResults[XUSER_MAX_COUNT]; - XNQOS *m_pCurrentQoSResult[XUSER_MAX_COUNT]; - int m_currentSearchResultsCount[XUSER_MAX_COUNT]; - - int m_lastSearchPad; - bool m_bSearchResultsReady; - bool m_bSearchPending; - void *m_pSearchParam; - void (*m_SessionsUpdatedCallback)(void *pParam); - - C4JThread* m_SearchingThread; - - void TickSearch(); - void SearchForGames(); - static int SearchForGamesThreadProc( void* lpParameter ); - - void SetSearchResultsReady(int resultCount = 0); - - std::vectorcurrentNetworkPlayers; - INetworkPlayer *addNetworkPlayer(IQNetPlayer *pQNetPlayer); - void removeNetworkPlayer(IQNetPlayer *pQNetPlayer); - static INetworkPlayer *getNetworkPlayer(IQNetPlayer *pQNetPlayer); - - virtual void SetSessionTexturePackParentId( int id ); - virtual void SetSessionSubTexturePackId( int id ); - virtual void Notify(int ID, ULONG_PTR Param); - -public: - virtual std::vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); - virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession); - virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam ); - virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ); - virtual void ForceFriendsSessionRefresh(); + virtual void UpdateAndSetGameSessionData( + INetworkPlayer* pNetworkPlayerLeaving = NULL); private: - void NotifyPlayerJoined( IQNetPlayer *pQNetPlayer ); + // TODO 4J Stu - Do we need to be able to have more than one of these? + void (*playerChangedCallback[XUSER_MAX_COUNT])(void* callbackParam, + INetworkPlayer* pPlayer, + bool leaving); + void* playerChangedCallbackParam[XUSER_MAX_COUNT]; + + static int RemovePlayerOnSocketClosedThreadProc(void* lpParam); + virtual bool RemoveLocalPlayer(INetworkPlayer* pNetworkPlayer); + + // Things for handling per-system flags + class PlayerFlags { + public: + INetworkPlayer* m_pNetworkPlayer; + unsigned char* flags; + unsigned int count; + PlayerFlags(INetworkPlayer* pNetworkPlayer, unsigned int count); + ~PlayerFlags(); + }; + std::vector m_playerFlags; + void SystemFlagAddPlayer(INetworkPlayer* pNetworkPlayer); + void SystemFlagRemovePlayer(INetworkPlayer* pNetworkPlayer); + void SystemFlagReset(); + +public: + virtual void SystemFlagSet(INetworkPlayer* pNetworkPlayer, int index); + virtual bool SystemFlagGet(INetworkPlayer* pNetworkPlayer, int index); + + // For telemetry +private: + float m_lastPlayerEventTimeStart; + +public: + std::wstring GatherStats(); + std::wstring GatherRTTStats(); + +private: + std::vector friendsSessions[XUSER_MAX_COUNT]; + int m_searchResultsCount[XUSER_MAX_COUNT]; + int m_lastSearchStartTime[XUSER_MAX_COUNT]; + + // The results that will be filled in with the current search + XSESSION_SEARCHRESULT_HEADER* m_pSearchResults[XUSER_MAX_COUNT]; + XNQOS* m_pQoSResult[XUSER_MAX_COUNT]; + + // The results from the previous search, which are currently displayed in + // the game + XSESSION_SEARCHRESULT_HEADER* m_pCurrentSearchResults[XUSER_MAX_COUNT]; + XNQOS* m_pCurrentQoSResult[XUSER_MAX_COUNT]; + int m_currentSearchResultsCount[XUSER_MAX_COUNT]; + + int m_lastSearchPad; + bool m_bSearchResultsReady; + bool m_bSearchPending; + void* m_pSearchParam; + void (*m_SessionsUpdatedCallback)(void* pParam); + + C4JThread* m_SearchingThread; + + void TickSearch(); + void SearchForGames(); + static int SearchForGamesThreadProc(void* lpParameter); + + void SetSearchResultsReady(int resultCount = 0); + + std::vector currentNetworkPlayers; + INetworkPlayer* addNetworkPlayer(IQNetPlayer* pQNetPlayer); + void removeNetworkPlayer(IQNetPlayer* pQNetPlayer); + static INetworkPlayer* getNetworkPlayer(IQNetPlayer* pQNetPlayer); + + virtual void SetSessionTexturePackParentId(int id); + virtual void SetSessionSubTexturePackId(int id); + virtual void Notify(int ID, ULONG_PTR Param); + +public: + virtual std::vector* GetSessionList(int iPad, + int localPlayers, + bool partyOnly); + virtual bool GetGameSessionInfo(int iPad, SessionID sessionId, + FriendSessionInfo* foundSession); + virtual void SetSessionsUpdatedCallback( + void (*SessionsUpdatedCallback)(void* pParam), void* pSearchParam); + virtual void GetFullFriendSessionInfo( + FriendSessionInfo* foundSession, + void (*FriendSessionUpdatedFn)(bool success, void* pParam), + void* pParam); + virtual void ForceFriendsSessionRefresh(); + +private: + void NotifyPlayerJoined(IQNetPlayer* pQNetPlayer); #ifndef _XBOX - void FakeLocalPlayerJoined() { NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(0)); } + void FakeLocalPlayerJoined() { + NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(0)); + } #endif }; diff --git a/Minecraft.Client/Platform/Common/Network/SessionInfo.h b/Minecraft.Client/Platform/Common/Network/SessionInfo.h index e93b14584..0020b4978 100644 --- a/Minecraft.Client/Platform/Common/Network/SessionInfo.h +++ b/Minecraft.Client/Platform/Common/Network/SessionInfo.h @@ -4,110 +4,104 @@ #include "Sony/SQRNetworkManager.h" #endif - -// A struct that we store in the QoS data when we are hosting the session. Max size 1020 bytes. +// A struct that we store in the QoS data when we are hosting the session. Max +// size 1020 bytes. #ifdef _XBOX -typedef struct _GameSessionData -{ - unsigned short netVersion; // 2 bytes - char hostName[XUSER_NAME_SIZE]; // 16 bytes ( 16*1 ) - GameSessionUID hostPlayerUID; // 8 bytes ( 8*1 ) on xbox, 24 bytes on PS3 - GameSessionUID players[MINECRAFT_NET_MAX_PLAYERS]; // 64 bytes ( 8*8 ) on xbox, 192 ( 24*8) on PS3 - char szPlayers[MINECRAFT_NET_MAX_PLAYERS][XUSER_NAME_SIZE]; // 128 bytes ( 8*16) - unsigned int m_uiGameHostSettings; // 4 bytes - unsigned int texturePackParentId; // 4 bytes - unsigned char subTexturePackId; // 1 byte +typedef struct _GameSessionData { + unsigned short netVersion; // 2 bytes + char hostName[XUSER_NAME_SIZE]; // 16 bytes ( 16*1 ) + GameSessionUID hostPlayerUID; // 8 bytes ( 8*1 ) on xbox, 24 bytes on PS3 + GameSessionUID + players[MINECRAFT_NET_MAX_PLAYERS]; // 64 bytes ( 8*8 ) on xbox, 192 ( + // 24*8) on PS3 + char szPlayers[MINECRAFT_NET_MAX_PLAYERS] + [XUSER_NAME_SIZE]; // 128 bytes ( 8*16) + unsigned int m_uiGameHostSettings; // 4 bytes + unsigned int texturePackParentId; // 4 bytes + unsigned char subTexturePackId; // 1 byte - bool isJoinable; // 1 byte + bool isJoinable; // 1 byte - _GameSessionData() - { - netVersion = 0; - memset(hostName,0,XUSER_NAME_SIZE); - memset(players,0,MINECRAFT_NET_MAX_PLAYERS*sizeof(players[0])); - memset(szPlayers,0,MINECRAFT_NET_MAX_PLAYERS*XUSER_NAME_SIZE); - isJoinable = true; - m_uiGameHostSettings = 0; - texturePackParentId = 0; - subTexturePackId = 0; - } + _GameSessionData() { + netVersion = 0; + memset(hostName, 0, XUSER_NAME_SIZE); + memset(players, 0, MINECRAFT_NET_MAX_PLAYERS * sizeof(players[0])); + memset(szPlayers, 0, MINECRAFT_NET_MAX_PLAYERS * XUSER_NAME_SIZE); + isJoinable = true; + m_uiGameHostSettings = 0; + texturePackParentId = 0; + subTexturePackId = 0; + } } GameSessionData; #elif defined __PS3__ || defined __ORBIS__ || defined(__PSVITA__) -typedef struct _GameSessionData -{ - unsigned short netVersion; // 2 bytes - GameSessionUID hostPlayerUID; // 8 bytes ( 8*1 ) on xbox, 24 bytes on PS3 - GameSessionUID players[MINECRAFT_NET_MAX_PLAYERS]; // 64 bytes ( 8*8 ) on xbox, 192 ( 24*8) on PS3 - unsigned int m_uiGameHostSettings; // 4 bytes - unsigned int texturePackParentId; // 4 bytes - unsigned char subTexturePackId; // 1 byte +typedef struct _GameSessionData { + unsigned short netVersion; // 2 bytes + GameSessionUID hostPlayerUID; // 8 bytes ( 8*1 ) on xbox, 24 bytes on PS3 + GameSessionUID + players[MINECRAFT_NET_MAX_PLAYERS]; // 64 bytes ( 8*8 ) on xbox, 192 ( + // 24*8) on PS3 + unsigned int m_uiGameHostSettings; // 4 bytes + unsigned int texturePackParentId; // 4 bytes + unsigned char subTexturePackId; // 1 byte - bool isJoinable; // 1 byte + bool isJoinable; // 1 byte - unsigned char playerCount; // 1 byte - bool isReadyToJoin; // 1 byte + unsigned char playerCount; // 1 byte + bool isReadyToJoin; // 1 byte - _GameSessionData() - { - netVersion = 0; - memset(players,0,MINECRAFT_NET_MAX_PLAYERS*sizeof(players[0])); - isJoinable = true; - m_uiGameHostSettings = 0; - texturePackParentId = 0; - subTexturePackId = 0; - playerCount = 0; - isReadyToJoin = false; - - } + _GameSessionData() { + netVersion = 0; + memset(players, 0, MINECRAFT_NET_MAX_PLAYERS * sizeof(players[0])); + isJoinable = true; + m_uiGameHostSettings = 0; + texturePackParentId = 0; + subTexturePackId = 0; + playerCount = 0; + isReadyToJoin = false; + } } GameSessionData; #else -typedef struct _GameSessionData -{ - unsigned short netVersion; // 2 bytes - unsigned int m_uiGameHostSettings; // 4 bytes - unsigned int texturePackParentId; // 4 bytes - unsigned char subTexturePackId; // 1 byte +typedef struct _GameSessionData { + unsigned short netVersion; // 2 bytes + unsigned int m_uiGameHostSettings; // 4 bytes + unsigned int texturePackParentId; // 4 bytes + unsigned char subTexturePackId; // 1 byte - bool isReadyToJoin; // 1 byte + bool isReadyToJoin; // 1 byte - _GameSessionData() - { - netVersion = 0; - m_uiGameHostSettings = 0; - texturePackParentId = 0; - subTexturePackId = 0; - } + _GameSessionData() { + netVersion = 0; + m_uiGameHostSettings = 0; + texturePackParentId = 0; + subTexturePackId = 0; + } } GameSessionData; #endif -class FriendSessionInfo -{ +class FriendSessionInfo { public: - SessionID sessionId; + SessionID sessionId; #ifdef _XBOX - XSESSION_SEARCHRESULT searchResult; -#elif defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) - SQRNetworkManager::SessionSearchResult searchResult; + XSESSION_SEARCHRESULT searchResult; +#elif defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) + SQRNetworkManager::SessionSearchResult searchResult; #elif defined(_DURANGO) - DQRNetworkManager::SessionSearchResult searchResult; + DQRNetworkManager::SessionSearchResult searchResult; #endif - wchar_t *displayLabel; - unsigned char displayLabelLength; - unsigned char displayLabelViewableStartIndex; - GameSessionData data; - bool hasPartyMember; + wchar_t* displayLabel; + unsigned char displayLabelLength; + unsigned char displayLabelViewableStartIndex; + GameSessionData data; + bool hasPartyMember; - FriendSessionInfo() - { - displayLabel = NULL; - displayLabelLength = 0; - displayLabelViewableStartIndex = 0; - hasPartyMember = false; - } + FriendSessionInfo() { + displayLabel = NULL; + displayLabelLength = 0; + displayLabelViewableStartIndex = 0; + hasPartyMember = false; + } - ~FriendSessionInfo() - { - if(displayLabel!=NULL) - delete displayLabel; - } + ~FriendSessionInfo() { + if (displayLabel != NULL) delete displayLabel; + } }; diff --git a/Minecraft.Client/Platform/Common/Network/Sony/NetworkPlayerSony.cpp b/Minecraft.Client/Platform/Common/Network/Sony/NetworkPlayerSony.cpp index ee589aabb..a4acdd542 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/NetworkPlayerSony.cpp +++ b/Minecraft.Client/Platform/Common/Network/Sony/NetworkPlayerSony.cpp @@ -1,114 +1,80 @@ #include "../../../Minecraft.World/Platform/stdafx.h" #include "NetworkPlayerSony.h" -NetworkPlayerSony::NetworkPlayerSony(SQRNetworkPlayer *qnetPlayer) -{ - m_sqrPlayer = qnetPlayer; - m_pSocket = NULL; +NetworkPlayerSony::NetworkPlayerSony(SQRNetworkPlayer* qnetPlayer) { + m_sqrPlayer = qnetPlayer; + m_pSocket = NULL; } -unsigned char NetworkPlayerSony::GetSmallId() -{ - return m_sqrPlayer->GetSmallId(); +unsigned char NetworkPlayerSony::GetSmallId() { + return m_sqrPlayer->GetSmallId(); } -void NetworkPlayerSony::SendData(INetworkPlayer *player, const void *pvData, int dataSize, bool lowPriority) -{ - // TODO - handle priority - m_sqrPlayer->SendData( ((NetworkPlayerSony *)player)->m_sqrPlayer, pvData, dataSize ); +void NetworkPlayerSony::SendData(INetworkPlayer* player, const void* pvData, + int dataSize, bool lowPriority) { + // TODO - handle priority + m_sqrPlayer->SendData(((NetworkPlayerSony*)player)->m_sqrPlayer, pvData, + dataSize); } -bool NetworkPlayerSony::IsSameSystem(INetworkPlayer *player) -{ - return m_sqrPlayer->IsSameSystem(((NetworkPlayerSony *)player)->m_sqrPlayer); +bool NetworkPlayerSony::IsSameSystem(INetworkPlayer* player) { + return m_sqrPlayer->IsSameSystem(((NetworkPlayerSony*)player)->m_sqrPlayer); } -int NetworkPlayerSony::GetSendQueueSizeBytes( INetworkPlayer *player, bool lowPriority ) -{ - return 0; // TODO +int NetworkPlayerSony::GetSendQueueSizeBytes(INetworkPlayer* player, + bool lowPriority) { + return 0; // TODO } -int NetworkPlayerSony::GetSendQueueSizeMessages( INetworkPlayer *player, bool lowPriority ) -{ - return 0; // TODO +int NetworkPlayerSony::GetSendQueueSizeMessages(INetworkPlayer* player, + bool lowPriority) { + return 0; // TODO } -int NetworkPlayerSony::GetCurrentRtt() -{ - return 0; // TODO +int NetworkPlayerSony::GetCurrentRtt() { + return 0; // TODO } -bool NetworkPlayerSony::IsHost() -{ - return m_sqrPlayer->IsHost(); +bool NetworkPlayerSony::IsHost() { return m_sqrPlayer->IsHost(); } + +bool NetworkPlayerSony::IsGuest() { + return false; // TODO } -bool NetworkPlayerSony::IsGuest() -{ - return false; // TODO +bool NetworkPlayerSony::IsLocal() { return m_sqrPlayer->IsLocal(); } + +int NetworkPlayerSony::GetSessionIndex() { + return m_sqrPlayer->GetSessionIndex(); } -bool NetworkPlayerSony::IsLocal() -{ - return m_sqrPlayer->IsLocal(); +bool NetworkPlayerSony::IsTalking() { return m_sqrPlayer->IsTalking(); } + +bool NetworkPlayerSony::IsMutedByLocalUser(int userIndex) { + return m_sqrPlayer->IsMutedByLocalUser(userIndex); } -int NetworkPlayerSony::GetSessionIndex() -{ - return m_sqrPlayer->GetSessionIndex(); +bool NetworkPlayerSony::HasVoice() { return m_sqrPlayer->HasVoice(); } + +bool NetworkPlayerSony::HasCamera() { + return false; // TODO } -bool NetworkPlayerSony::IsTalking() -{ - return m_sqrPlayer->IsTalking(); +int NetworkPlayerSony::GetUserIndex() { + return m_sqrPlayer->GetLocalPlayerIndex(); } -bool NetworkPlayerSony::IsMutedByLocalUser(int userIndex) -{ - return m_sqrPlayer->IsMutedByLocalUser(userIndex); +void NetworkPlayerSony::SetSocket(Socket* pSocket) { m_pSocket = pSocket; } + +Socket* NetworkPlayerSony::GetSocket() { return m_pSocket; } + +const wchar_t* NetworkPlayerSony::GetOnlineName() { + return m_sqrPlayer->GetName(); } -bool NetworkPlayerSony::HasVoice() -{ - return m_sqrPlayer->HasVoice(); +std::wstring NetworkPlayerSony::GetDisplayName() { + return m_sqrPlayer->GetName(); } -bool NetworkPlayerSony::HasCamera() -{ - return false; // TODO -} +PlayerUID NetworkPlayerSony::GetUID() { return m_sqrPlayer->GetUID(); } -int NetworkPlayerSony::GetUserIndex() -{ - return m_sqrPlayer->GetLocalPlayerIndex(); -} - -void NetworkPlayerSony::SetSocket(Socket *pSocket) -{ - m_pSocket = pSocket; -} - -Socket *NetworkPlayerSony::GetSocket() -{ - return m_pSocket; -} - -const wchar_t *NetworkPlayerSony::GetOnlineName() -{ - return m_sqrPlayer->GetName(); -} - -std::wstring NetworkPlayerSony::GetDisplayName() -{ - return m_sqrPlayer->GetName(); -} - -PlayerUID NetworkPlayerSony::GetUID() -{ - return m_sqrPlayer->GetUID(); -} - -void NetworkPlayerSony::SetUID(PlayerUID UID) -{ - m_sqrPlayer->SetUID(UID); -} +void NetworkPlayerSony::SetUID(PlayerUID UID) { m_sqrPlayer->SetUID(UID); } diff --git a/Minecraft.Client/Platform/Common/Network/Sony/NetworkPlayerSony.h b/Minecraft.Client/Platform/Common/Network/Sony/NetworkPlayerSony.h index c71b343b6..4f509464e 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/NetworkPlayerSony.h +++ b/Minecraft.Client/Platform/Common/Network/Sony/NetworkPlayerSony.h @@ -3,37 +3,40 @@ #include "../NetworkPlayerInterface.h" #include "SQRNetworkPlayer.h" -// This is an implementation of the INetworkPlayer interface, for Sony platforms. It effectively wraps the SQRNetworkPlayer class in a non-platform-specific way. +// This is an implementation of the INetworkPlayer interface, for Sony +// platforms. It effectively wraps the SQRNetworkPlayer class in a +// non-platform-specific way. -class NetworkPlayerSony : public INetworkPlayer -{ +class NetworkPlayerSony : public INetworkPlayer { public: - // Common player interface - NetworkPlayerSony(SQRNetworkPlayer *sqrPlayer); - virtual unsigned char GetSmallId(); - virtual void SendData(INetworkPlayer *player, const void *pvData, int dataSize, bool lowPriority); - virtual bool IsSameSystem(INetworkPlayer *player); - virtual int GetSendQueueSizeBytes( INetworkPlayer *player, bool lowPriority ); - virtual int GetSendQueueSizeMessages( INetworkPlayer *player, bool lowPriority ); - virtual int GetCurrentRtt(); - virtual bool IsHost(); - virtual bool IsGuest(); - virtual bool IsLocal(); - virtual int GetSessionIndex(); - virtual bool IsTalking(); - virtual bool IsMutedByLocalUser(int userIndex); - virtual bool HasVoice(); - virtual bool HasCamera(); - virtual int GetUserIndex(); - virtual void SetSocket(Socket *pSocket); - virtual Socket *GetSocket(); - virtual const wchar_t *GetOnlineName(); - virtual std::wstring GetDisplayName(); - virtual PlayerUID GetUID(); + // Common player interface + NetworkPlayerSony(SQRNetworkPlayer* sqrPlayer); + virtual unsigned char GetSmallId(); + virtual void SendData(INetworkPlayer* player, const void* pvData, + int dataSize, bool lowPriority); + virtual bool IsSameSystem(INetworkPlayer* player); + virtual int GetSendQueueSizeBytes(INetworkPlayer* player, bool lowPriority); + virtual int GetSendQueueSizeMessages(INetworkPlayer* player, + bool lowPriority); + virtual int GetCurrentRtt(); + virtual bool IsHost(); + virtual bool IsGuest(); + virtual bool IsLocal(); + virtual int GetSessionIndex(); + virtual bool IsTalking(); + virtual bool IsMutedByLocalUser(int userIndex); + virtual bool HasVoice(); + virtual bool HasCamera(); + virtual int GetUserIndex(); + virtual void SetSocket(Socket* pSocket); + virtual Socket* GetSocket(); + virtual const wchar_t* GetOnlineName(); + virtual std::wstring GetDisplayName(); + virtual PlayerUID GetUID(); - void SetUID(PlayerUID UID); + void SetUID(PlayerUID UID); private: - SQRNetworkPlayer *m_sqrPlayer; - Socket *m_pSocket; + SQRNetworkPlayer* m_sqrPlayer; + Socket* m_pSocket; }; diff --git a/Minecraft.Client/Platform/Common/Network/Sony/PlatformNetworkManagerSony.cpp b/Minecraft.Client/Platform/Common/Network/Sony/PlatformNetworkManagerSony.cpp index abb1116fb..be6075080 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/PlatformNetworkManagerSony.cpp +++ b/Minecraft.Client/Platform/Common/Network/Sony/PlatformNetworkManagerSony.cpp @@ -5,210 +5,178 @@ #include "NetworkPlayerSony.h" #include "../GameNetworkManager.h" -CPlatformNetworkManagerSony *g_pPlatformNetworkManager; +CPlatformNetworkManagerSony* g_pPlatformNetworkManager; -bool CPlatformNetworkManagerSony::IsLocalGame() -{ - return m_bIsOfflineGame; -} -bool CPlatformNetworkManagerSony::IsPrivateGame() -{ - return m_bIsPrivateGame; -} -bool CPlatformNetworkManagerSony::IsLeavingGame() -{ - return m_bLeavingGame; -} -void CPlatformNetworkManagerSony::ResetLeavingGame() -{ - m_bLeavingGame = false; -} +bool CPlatformNetworkManagerSony::IsLocalGame() { return m_bIsOfflineGame; } +bool CPlatformNetworkManagerSony::IsPrivateGame() { return m_bIsPrivateGame; } +bool CPlatformNetworkManagerSony::IsLeavingGame() { return m_bLeavingGame; } +void CPlatformNetworkManagerSony::ResetLeavingGame() { m_bLeavingGame = false; } - -void CPlatformNetworkManagerSony::HandleStateChange(SQRNetworkManager::eSQRNetworkManagerState oldState, SQRNetworkManager::eSQRNetworkManagerState newState, bool idleReasonIsSessionFull) -{ - static const char * c_apszStateNames[] = - { - "SNM_STATE_INITIALISING", - "SNM_STATE_INITIALISE_FAILED", - "SNM_STATE_IDLE", - "SNM_STATE_HOSTING", - "SNM_STATE_JOINING", - "SNM_STATE_STARTING", - "SNM_STATE_PLAYING", - "SNM_STATE_LEAVING", - "SNM_STATE_ENDING", +void CPlatformNetworkManagerSony::HandleStateChange( + SQRNetworkManager::eSQRNetworkManagerState oldState, + SQRNetworkManager::eSQRNetworkManagerState newState, + bool idleReasonIsSessionFull) { + static const char* c_apszStateNames[] = { + "SNM_STATE_INITIALISING", "SNM_STATE_INITIALISE_FAILED", + "SNM_STATE_IDLE", "SNM_STATE_HOSTING", + "SNM_STATE_JOINING", "SNM_STATE_STARTING", + "SNM_STATE_PLAYING", "SNM_STATE_LEAVING", + "SNM_STATE_ENDING", }; - app.DebugPrintf( "Network State: %s ==> %s\n", - c_apszStateNames[ oldState ], - c_apszStateNames[ newState ] ); + app.DebugPrintf("Network State: %s ==> %s\n", c_apszStateNames[oldState], + c_apszStateNames[newState]); - if( newState == SQRNetworkManager::SNM_STATE_HOSTING ) - { - m_bLeavingGame = false; - m_bLeaveGameOnTick = false; - m_bHostChanged = false; - g_NetworkManager.StateChange_AnyToHosting(); - } - else if( newState == SQRNetworkManager::SNM_STATE_JOINING ) - { - // 4J Stu - We may be accepting an invite from the DLC menu, so hide the icon + if (newState == SQRNetworkManager::SNM_STATE_HOSTING) { + m_bLeavingGame = false; + m_bLeaveGameOnTick = false; + m_bHostChanged = false; + g_NetworkManager.StateChange_AnyToHosting(); + } else if (newState == SQRNetworkManager::SNM_STATE_JOINING) { + // 4J Stu - We may be accepting an invite from the DLC menu, so hide the + // icon #ifdef __ORBIS__ - sceNpCommerceHidePsStoreIcon(); + sceNpCommerceHidePsStoreIcon(); #elif defined __PSVITA__ - sceNpCommerce2HidePsStoreIcon(); + sceNpCommerce2HidePsStoreIcon(); #endif - m_bLeavingGame = false; - m_bLeaveGameOnTick = false; - m_bHostChanged = false; - g_NetworkManager.StateChange_AnyToJoining(); - } - else if( newState == SQRNetworkManager::SNM_STATE_IDLE && oldState == SQRNetworkManager::SNM_STATE_JOINING ) - { - if( idleReasonIsSessionFull ) - { - g_NetworkManager.StateChange_JoiningToIdle(JOIN_FAILED_SERVER_FULL); - } - else - { - g_NetworkManager.StateChange_JoiningToIdle(JOIN_FAILED_NONSPECIFIC); - } - } - else if( newState == SQRNetworkManager::SNM_STATE_IDLE && oldState == SQRNetworkManager::SNM_STATE_HOSTING ) - { - m_bLeavingGame = true; - } - else if( newState == SQRNetworkManager::SNM_STATE_STARTING ) - { - m_lastPlayerEventTimeStart = app.getAppTime(); - - g_NetworkManager.StateChange_AnyToStarting(); - } - // Fix for #93148 - TCR 001: BAS Game Stability: Title will crash for the multiplayer client if host of the game will exit during the clients loading to created world. - // 4J Stu - If the client joins just as the host is exiting, then they can skip to leaving without passing through ending - else if( newState == SQRNetworkManager::SNM_STATE_ENDING ) - { - g_NetworkManager.StateChange_AnyToEnding( oldState == SQRNetworkManager::SNM_STATE_PLAYING ); - - // 4J-PB - Only the host can leave here - the clients will hang if m_bLeavingGame is set to true here - if( m_pSQRNet->IsHost() ) - { - m_bLeavingGame = true; - } - } - - if( newState == SQRNetworkManager::SNM_STATE_IDLE ) - { - // On PS3, sometimes we're getting a SNM_STATE_ENDING transition to SNM_STATE_IDLE on joining, because the server context being deleted sets the state away from SNM_STATE_JOINING before we detect - // the cause for the disconnection. This means we don't pick up on the joining->idle transition. Set disconnection reason here too for this case. - if( idleReasonIsSessionFull ) - { - app.SetDisconnectReason( DisconnectPacket::eDisconnect_ServerFull ); - } - g_NetworkManager.StateChange_AnyToIdle(); - } -} - -void CPlatformNetworkManagerSony::HandleDataReceived(SQRNetworkPlayer *playerFrom, SQRNetworkPlayer *playerTo, unsigned char *data, unsigned int dataSize) -{ - if(m_pSQRNet->GetState() == SQRNetworkManager::SNM_STATE_ENDING) - { - return; - } - - if( playerTo->IsHost() ) - { - // If we are the host we care who this came from - //app.DebugPrintf( "Pushing data into host read queue for user \"%ls\"\n", pPlayerFrom->GetGamertag()); - // Push this data into the read queue for the player that sent it - INetworkPlayer *pPlayerFrom = getNetworkPlayer(playerFrom); - Socket *socket = pPlayerFrom->GetSocket(); - - if(socket != NULL) - socket->pushDataToQueue(data, dataSize, false); - } - else - { - // If we are not the host the message must have come from the host, so we care more about who it is addressed to - INetworkPlayer *pPlayerTo = getNetworkPlayer(playerTo); - Socket *socket = pPlayerTo->GetSocket(); - //app.DebugPrintf( "Pushing data into read queue for user \"%ls\"\n", apPlayersTo[dwPlayer]->GetGamertag()); - if(socket != NULL) - socket->pushDataToQueue(data, dataSize); - } -} - -void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer * pSQRPlayer) -{ - const char * pszDescription; - - // 4J Stu - We create a fake socket for every where that we need an INBOUND queue of game data. Outbound - // is all handled by QNet so we don't need that. Therefore each client player has one, and the host has one - // for each client player. - bool createFakeSocket = false; - bool localPlayer = false; - - NetworkPlayerSony *networkPlayer = (NetworkPlayerSony *)addNetworkPlayer(pSQRPlayer); - - if( pSQRPlayer->IsLocal() ) - { - localPlayer = true; - if( pSQRPlayer->IsHost() ) - { - pszDescription = "local host"; - // 4J Stu - No socket for the localhost as it uses a special loopback queue - - m_machineSQRPrimaryPlayers.push_back( pSQRPlayer ); + m_bLeavingGame = false; + m_bLeaveGameOnTick = false; + m_bHostChanged = false; + g_NetworkManager.StateChange_AnyToJoining(); + } else if (newState == SQRNetworkManager::SNM_STATE_IDLE && + oldState == SQRNetworkManager::SNM_STATE_JOINING) { + if (idleReasonIsSessionFull) { + g_NetworkManager.StateChange_JoiningToIdle(JOIN_FAILED_SERVER_FULL); + } else { + g_NetworkManager.StateChange_JoiningToIdle(JOIN_FAILED_NONSPECIFIC); } - else - { + } else if (newState == SQRNetworkManager::SNM_STATE_IDLE && + oldState == SQRNetworkManager::SNM_STATE_HOSTING) { + m_bLeavingGame = true; + } else if (newState == SQRNetworkManager::SNM_STATE_STARTING) { + m_lastPlayerEventTimeStart = app.getAppTime(); + + g_NetworkManager.StateChange_AnyToStarting(); + } + // Fix for #93148 - TCR 001: BAS Game Stability: Title will crash for the + // multiplayer client if host of the game will exit during the clients + // loading to created world. 4J Stu - If the client joins just as the host + // is exiting, then they can skip to leaving without passing through ending + else if (newState == SQRNetworkManager::SNM_STATE_ENDING) { + g_NetworkManager.StateChange_AnyToEnding( + oldState == SQRNetworkManager::SNM_STATE_PLAYING); + + // 4J-PB - Only the host can leave here - the clients will hang if + // m_bLeavingGame is set to true here + if (m_pSQRNet->IsHost()) { + m_bLeavingGame = true; + } + } + + if (newState == SQRNetworkManager::SNM_STATE_IDLE) { + // On PS3, sometimes we're getting a SNM_STATE_ENDING transition to + // SNM_STATE_IDLE on joining, because the server context being deleted + // sets the state away from SNM_STATE_JOINING before we detect the cause + // for the disconnection. This means we don't pick up on the + // joining->idle transition. Set disconnection reason here too for this + // case. + if (idleReasonIsSessionFull) { + app.SetDisconnectReason(DisconnectPacket::eDisconnect_ServerFull); + } + g_NetworkManager.StateChange_AnyToIdle(); + } +} + +void CPlatformNetworkManagerSony::HandleDataReceived( + SQRNetworkPlayer* playerFrom, SQRNetworkPlayer* playerTo, + unsigned char* data, unsigned int dataSize) { + if (m_pSQRNet->GetState() == SQRNetworkManager::SNM_STATE_ENDING) { + return; + } + + if (playerTo->IsHost()) { + // If we are the host we care who this came from + // app.DebugPrintf( "Pushing data into host read queue for user + // \"%ls\"\n", pPlayerFrom->GetGamertag()); + // Push this data into the read queue for the player that sent it + INetworkPlayer* pPlayerFrom = getNetworkPlayer(playerFrom); + Socket* socket = pPlayerFrom->GetSocket(); + + if (socket != NULL) socket->pushDataToQueue(data, dataSize, false); + } else { + // If we are not the host the message must have come from the host, so + // we care more about who it is addressed to + INetworkPlayer* pPlayerTo = getNetworkPlayer(playerTo); + Socket* socket = pPlayerTo->GetSocket(); + // app.DebugPrintf( "Pushing data into read queue for user \"%ls\"\n", + // apPlayersTo[dwPlayer]->GetGamertag()); + if (socket != NULL) socket->pushDataToQueue(data, dataSize); + } +} + +void CPlatformNetworkManagerSony::HandlePlayerJoined( + SQRNetworkPlayer* pSQRPlayer) { + const char* pszDescription; + + // 4J Stu - We create a fake socket for every where that we need an INBOUND + // queue of game data. Outbound is all handled by QNet so we don't need + // that. Therefore each client player has one, and the host has one for each + // client player. + bool createFakeSocket = false; + bool localPlayer = false; + + NetworkPlayerSony* networkPlayer = + (NetworkPlayerSony*)addNetworkPlayer(pSQRPlayer); + + if (pSQRPlayer->IsLocal()) { + localPlayer = true; + if (pSQRPlayer->IsHost()) { + pszDescription = "local host"; + // 4J Stu - No socket for the localhost as it uses a special + // loopback queue + + m_machineSQRPrimaryPlayers.push_back(pSQRPlayer); + } else { pszDescription = "local"; - // We need an inbound queue on all local players to receive data from the host - createFakeSocket = true; + // We need an inbound queue on all local players to receive data + // from the host + createFakeSocket = true; } - } - else - { - if( pSQRPlayer->IsHost() ) - { + } else { + if (pSQRPlayer->IsHost()) { pszDescription = "remote host"; - } - else - { + } else { pszDescription = "remote"; - // If we are the host, then create a fake socket for every remote player - if( m_pSQRNet->IsHost() ) - { - createFakeSocket = true; - } + // If we are the host, then create a fake socket for every remote + // player + if (m_pSQRNet->IsHost()) { + createFakeSocket = true; + } } - if( m_pSQRNet->IsHost() && !m_bHostChanged ) - { - // Do we already have a primary player for this system? - bool systemHasPrimaryPlayer = false; - for(AUTO_VAR(it, m_machineSQRPrimaryPlayers.begin()); it < m_machineSQRPrimaryPlayers.end(); ++it) - { - SQRNetworkPlayer *pQNetPrimaryPlayer = *it; - if( pSQRPlayer->IsSameSystem(pQNetPrimaryPlayer) ) - { - systemHasPrimaryPlayer = true; - break; - } - } - if( !systemHasPrimaryPlayer ) - m_machineSQRPrimaryPlayers.push_back( pSQRPlayer ); - } + if (m_pSQRNet->IsHost() && !m_bHostChanged) { + // Do we already have a primary player for this system? + bool systemHasPrimaryPlayer = false; + for (AUTO_VAR(it, m_machineSQRPrimaryPlayers.begin()); + it < m_machineSQRPrimaryPlayers.end(); ++it) { + SQRNetworkPlayer* pQNetPrimaryPlayer = *it; + if (pSQRPlayer->IsSameSystem(pQNetPrimaryPlayer)) { + systemHasPrimaryPlayer = true; + break; + } + } + if (!systemHasPrimaryPlayer) + m_machineSQRPrimaryPlayers.push_back(pSQRPlayer); + } + } + g_NetworkManager.PlayerJoining(networkPlayer); + + if (createFakeSocket == true && !m_bHostChanged) { + g_NetworkManager.CreateSocket(networkPlayer, localPlayer); } - g_NetworkManager.PlayerJoining( networkPlayer ); - - if( createFakeSocket == true && !m_bHostChanged ) - { - g_NetworkManager.CreateSocket( networkPlayer, localPlayer ); - } #if 0 app.DebugPrintf( "Player 0x%p \"%ls\" joined; %s; voice %i; camera %i.\n", @@ -219,332 +187,311 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer * (int) pSQRPlayer->HasCamera() ); #endif + if (m_pSQRNet->IsHost()) { + // 4J-PB - only the host should do this + g_NetworkManager.UpdateAndSetGameSessionData(); + SystemFlagAddPlayer(networkPlayer); + } - if( m_pSQRNet->IsHost() ) - { - // 4J-PB - only the host should do this - g_NetworkManager.UpdateAndSetGameSessionData(); - SystemFlagAddPlayer( networkPlayer ); - } - - for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) - { - if(playerChangedCallback[idx] != NULL) - playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false ); - } + for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { + if (playerChangedCallback[idx] != NULL) + playerChangedCallback[idx](playerChangedCallbackParam[idx], + networkPlayer, false); + } - if(true) // TODO m_pSQRNet->GetState() == QNET_STATE_GAME_PLAY) - { - int localPlayerCount = 0; - for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) - { - if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; - } + if (true) // TODO m_pSQRNet->GetState() == QNET_STATE_GAME_PLAY) + { + int localPlayerCount = 0; + for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { + if (m_pSQRNet->GetLocalPlayerByUserIndex(idx) != NULL) + ++localPlayerCount; + } - float appTime = app.getAppTime(); + float appTime = app.getAppTime(); - // Only record stats for the primary player here - m_lastPlayerEventTimeStart = appTime; - } + // Only record stats for the primary player here + m_lastPlayerEventTimeStart = appTime; + } } -void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlayer) -{ - //__debugbreak(); +void CPlatformNetworkManagerSony::HandlePlayerLeaving( + SQRNetworkPlayer* pSQRPlayer) { + //__debugbreak(); - app.DebugPrintf( "Player 0x%p leaving.\n", - pSQRPlayer ); + app.DebugPrintf("Player 0x%p leaving.\n", pSQRPlayer); - INetworkPlayer *networkPlayer = getNetworkPlayer(pSQRPlayer); + INetworkPlayer* networkPlayer = getNetworkPlayer(pSQRPlayer); - if( networkPlayer ) - { - // Get our wrapper object associated with this player. - Socket *socket = networkPlayer->GetSocket(); - if( socket != NULL ) - { - // If we are in game then remove this player from the game as well. - // We may get here either from the player requesting to exit the game, - // in which case we they will already have left the game server, or from a disconnection - // where we then have to remove them from the game server - if( m_pSQRNet->IsHost() && !m_bHostChanged ) - { - g_NetworkManager.CloseConnection(networkPlayer); - } + if (networkPlayer) { + // Get our wrapper object associated with this player. + Socket* socket = networkPlayer->GetSocket(); + if (socket != NULL) { + // If we are in game then remove this player from the game as well. + // We may get here either from the player requesting to exit the + // game, in which case we they will already have left the game + // server, or from a disconnection where we then have to remove them + // from the game server + if (m_pSQRNet->IsHost() && !m_bHostChanged) { + g_NetworkManager.CloseConnection(networkPlayer); + } - // Free the wrapper object memory. - // TODO 4J Stu - We may still be using this at the point that the player leaves the session. - // We need this as long as the game server still needs to communicate with the player - //delete socket; + // Free the wrapper object memory. + // TODO 4J Stu - We may still be using this at the point that the + // player leaves the session. We need this as long as the game + // server still needs to communicate with the player + // delete socket; - networkPlayer->SetSocket( NULL ); - } + networkPlayer->SetSocket(NULL); + } - if( m_pSQRNet->IsHost() && !m_bHostChanged ) - { - if( isSystemPrimaryPlayer(pSQRPlayer) ) - { - SQRNetworkPlayer *pNewSQRPrimaryPlayer = NULL; - for(unsigned int i = 0; i < m_pSQRNet->GetPlayerCount(); ++i ) - { - SQRNetworkPlayer *pSQRPlayer2 = m_pSQRNet->GetPlayerByIndex( i ); + if (m_pSQRNet->IsHost() && !m_bHostChanged) { + if (isSystemPrimaryPlayer(pSQRPlayer)) { + SQRNetworkPlayer* pNewSQRPrimaryPlayer = NULL; + for (unsigned int i = 0; i < m_pSQRNet->GetPlayerCount(); ++i) { + SQRNetworkPlayer* pSQRPlayer2 = + m_pSQRNet->GetPlayerByIndex(i); - if ( pSQRPlayer2 != NULL && pSQRPlayer2 != pSQRPlayer && pSQRPlayer2->IsSameSystem( pSQRPlayer ) ) - { - pNewSQRPrimaryPlayer = pSQRPlayer2; - break; - } - } - AUTO_VAR(it, find( m_machineSQRPrimaryPlayers.begin(), m_machineSQRPrimaryPlayers.end(), pSQRPlayer)); - if( it != m_machineSQRPrimaryPlayers.end() ) - { - m_machineSQRPrimaryPlayers.erase( it ); - } + if (pSQRPlayer2 != NULL && pSQRPlayer2 != pSQRPlayer && + pSQRPlayer2->IsSameSystem(pSQRPlayer)) { + pNewSQRPrimaryPlayer = pSQRPlayer2; + break; + } + } + AUTO_VAR(it, + find(m_machineSQRPrimaryPlayers.begin(), + m_machineSQRPrimaryPlayers.end(), pSQRPlayer)); + if (it != m_machineSQRPrimaryPlayers.end()) { + m_machineSQRPrimaryPlayers.erase(it); + } - if( pNewSQRPrimaryPlayer != NULL ) - m_machineSQRPrimaryPlayers.push_back( pNewSQRPrimaryPlayer ); - } + if (pNewSQRPrimaryPlayer != NULL) + m_machineSQRPrimaryPlayers.push_back(pNewSQRPrimaryPlayer); + } - g_NetworkManager.UpdateAndSetGameSessionData( networkPlayer ); - SystemFlagRemovePlayer( networkPlayer ); + g_NetworkManager.UpdateAndSetGameSessionData(networkPlayer); + SystemFlagRemovePlayer(networkPlayer); + } - } + g_NetworkManager.PlayerLeaving(networkPlayer); - g_NetworkManager.PlayerLeaving( networkPlayer ); - - for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) - { - if(playerChangedCallback[idx] != NULL) - playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, true ); - } + for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { + if (playerChangedCallback[idx] != NULL) + playerChangedCallback[idx](playerChangedCallbackParam[idx], + networkPlayer, true); + } - if(m_pSQRNet->GetState() == SQRNetworkManager::SNM_STATE_PLAYING) - { - int localPlayerCount = 0; - for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) - { - if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; - } + if (m_pSQRNet->GetState() == SQRNetworkManager::SNM_STATE_PLAYING) { + int localPlayerCount = 0; + for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { + if (m_pSQRNet->GetLocalPlayerByUserIndex(idx) != NULL) + ++localPlayerCount; + } - float appTime = app.getAppTime(); - m_lastPlayerEventTimeStart = appTime; - } + float appTime = app.getAppTime(); + m_lastPlayerEventTimeStart = appTime; + } - removeNetworkPlayer(pSQRPlayer); - } + removeNetworkPlayer(pSQRPlayer); + } } -// Update our external data to match the current internal player slots, and resync back out (host only) -void CPlatformNetworkManagerSony::HandleResyncPlayerRequest(SQRNetworkPlayer **aPlayers) -{ - m_hostGameSessionData.playerCount = 0; - for(int i = 0; i < SQRNetworkManager::MAX_ONLINE_PLAYER_COUNT; i++ ) - { - if( aPlayers[i] ) - { - m_hostGameSessionData.players[i] = aPlayers[i]->GetUID(); - m_hostGameSessionData.playerCount++; - } - else - { - memset(&m_hostGameSessionData.players[i],0,sizeof(m_hostGameSessionData.players[i])); - } - } - m_pSQRNet->UpdateExternalRoomData(); +// Update our external data to match the current internal player slots, and +// resync back out (host only) +void CPlatformNetworkManagerSony::HandleResyncPlayerRequest( + SQRNetworkPlayer** aPlayers) { + m_hostGameSessionData.playerCount = 0; + for (int i = 0; i < SQRNetworkManager::MAX_ONLINE_PLAYER_COUNT; i++) { + if (aPlayers[i]) { + m_hostGameSessionData.players[i] = aPlayers[i]->GetUID(); + m_hostGameSessionData.playerCount++; + } else { + memset(&m_hostGameSessionData.players[i], 0, + sizeof(m_hostGameSessionData.players[i])); + } + } + m_pSQRNet->UpdateExternalRoomData(); } -void CPlatformNetworkManagerSony::HandleAddLocalPlayerFailed(int idx) -{ - g_NetworkManager.AddLocalPlayerFailed(idx); +void CPlatformNetworkManagerSony::HandleAddLocalPlayerFailed(int idx) { + g_NetworkManager.AddLocalPlayerFailed(idx); } -void CPlatformNetworkManagerSony::HandleDisconnect(bool bLostRoomOnly,bool bPSNSignOut) -{ - g_NetworkManager.HandleDisconnect(bLostRoomOnly,bPSNSignOut); +void CPlatformNetworkManagerSony::HandleDisconnect(bool bLostRoomOnly, + bool bPSNSignOut) { + g_NetworkManager.HandleDisconnect(bLostRoomOnly, bPSNSignOut); } -void CPlatformNetworkManagerSony::HandleInviteReceived( int userIndex, const SQRNetworkManager::PresenceSyncInfo *pInviteInfo) -{ - g_NetworkManager.GameInviteReceived( userIndex, pInviteInfo ); +void CPlatformNetworkManagerSony::HandleInviteReceived( + int userIndex, const SQRNetworkManager::PresenceSyncInfo* pInviteInfo) { + g_NetworkManager.GameInviteReceived(userIndex, pInviteInfo); } -extern SQRNetworkManager *testSQRNetworkManager; +extern SQRNetworkManager* testSQRNetworkManager; -bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkManager, int flagIndexSize) -{ - // Create a sony network manager, and go online +bool CPlatformNetworkManagerSony::Initialise( + CGameNetworkManager* pGameNetworkManager, int flagIndexSize) { + // Create a sony network manager, and go online #ifdef __ORBIS__ - m_pSQRNet = new SQRNetworkManager_Orbis(this); - m_pSQRNet->Initialise(); -#elif defined __PS3__ - m_pSQRNet = new SQRNetworkManager_PS3(this); - m_pSQRNet->Initialise(); -#else // __PSVITA__ - // m_pSQRNet = new SQRNetworkManager_Vita(this); - m_bUsingAdhocMode = false; - m_pSQRNet_Vita_Adhoc = new SQRNetworkManager_AdHoc_Vita(this); - m_pSQRNet_Vita = new SQRNetworkManager_Vita(this); + m_pSQRNet = new SQRNetworkManager_Orbis(this); + m_pSQRNet->Initialise(); +#elif defined __PS3__ + m_pSQRNet = new SQRNetworkManager_PS3(this); + m_pSQRNet->Initialise(); +#else // __PSVITA__ + // m_pSQRNet = new SQRNetworkManager_Vita(this); + m_bUsingAdhocMode = false; + m_pSQRNet_Vita_Adhoc = new SQRNetworkManager_AdHoc_Vita(this); + m_pSQRNet_Vita = new SQRNetworkManager_Vita(this); - m_pSQRNet = m_pSQRNet_Vita; + m_pSQRNet = m_pSQRNet_Vita; - // 4J-PB - seems we can't initialise both adhoc and psn comms - from Rohan - "having adhoc matching and matching2 library initialised together results in undesired behaviour", but probably having other parts initialised also is 'undesirable' + // 4J-PB - seems we can't initialise both adhoc and psn comms - from Rohan - + // "having adhoc matching and matching2 library initialised together results + // in undesired behaviour", but probably having other parts initialised also + // is 'undesirable' - m_pSQRNet_Vita->Initialise(); - - if(ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad())) - { - // we're signed into the PSN, but we won't be online yet, force a sign-in online here - m_pSQRNet_Vita->AttemptPSNSignIn(NULL, NULL); - } + m_pSQRNet_Vita->Initialise(); + if (ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad())) { + // we're signed into the PSN, but we won't be online yet, force a + // sign-in online here + m_pSQRNet_Vita->AttemptPSNSignIn(NULL, NULL); + } #endif - m_pGameNetworkManager = pGameNetworkManager; - m_flagIndexSize = flagIndexSize; - g_pPlatformNetworkManager = this; - for( int i = 0; i < XUSER_MAX_COUNT; i++ ) - { - playerChangedCallback[ i ] = NULL; - } - - m_bLeavingGame = false; - m_bLeaveGameOnTick = false; - m_bHostChanged = false; - m_bLeaveRoomWhenLeavingGame = true; + m_pGameNetworkManager = pGameNetworkManager; + m_flagIndexSize = flagIndexSize; + g_pPlatformNetworkManager = this; + for (int i = 0; i < XUSER_MAX_COUNT; i++) { + playerChangedCallback[i] = NULL; + } - m_bSearchPending = false; + m_bLeavingGame = false; + m_bLeaveGameOnTick = false; + m_bHostChanged = false; + m_bLeaveRoomWhenLeavingGame = true; - m_bIsOfflineGame = false; - m_pSearchParam = nullptr; - m_SessionsUpdatedCallback = nullptr; + m_bSearchPending = false; - m_searchResultsCount = 0; - m_pSearchResults = NULL; - - m_lastSearchStartTime = 0; + m_bIsOfflineGame = false; + m_pSearchParam = nullptr; + m_SessionsUpdatedCallback = nullptr; + + m_searchResultsCount = 0; + m_pSearchResults = NULL; + + m_lastSearchStartTime = 0; // Success! return true; } -void CPlatformNetworkManagerSony::Terminate() -{ - m_pSQRNet->Terminate(); +void CPlatformNetworkManagerSony::Terminate() { m_pSQRNet->Terminate(); } + +int CPlatformNetworkManagerSony::GetJoiningReadyPercentage() { + return m_pSQRNet->GetJoiningReadyPercentage(); } -int CPlatformNetworkManagerSony::GetJoiningReadyPercentage() -{ - return m_pSQRNet->GetJoiningReadyPercentage(); -} +int CPlatformNetworkManagerSony::CorrectErrorIDS(int IDS) { + // Attempts to remap the following messages to provide something that PS3 + // TCRs are happier with + // + // IDS_CONNECTION_LOST - "Connection lost" + // IDS_CONNECTION_FAILED - "Connection failed" + // IDS_CONNECTION_LOST_LIVE - "Connection to "PSN" was + //lost. Exiting to the main menu." + // IDS_CONNECTION_LOST_LIVE_NO_EXIT - "Connection to "PSN" was lost." + // IDS_CONNECTION_LOST_SERVER - "Connection to the server + // was lost. Exiting to the main menu." + // + // Map to: + // + // IDS_ERROR_NETWORK - "A network error + // has occurred" IDS_ERROR_NETWORK_TITLE - "Network + // Error" IDS_ERROR_NETWORK_EXIT - "A network error + // has occurred. Exiting to Main Menu." IDS_ERROR_PSN_SIGN_OUT + // - You have been signed out from the "PSN". IDS_ERROR_PSN_SIGN_OUT_EXIT + // - You have been signed out from the "PSN". Exiting to Main Menu -int CPlatformNetworkManagerSony::CorrectErrorIDS(int IDS) -{ - // Attempts to remap the following messages to provide something that PS3 TCRs are happier with - // - // IDS_CONNECTION_LOST - "Connection lost" - // IDS_CONNECTION_FAILED - "Connection failed" - // IDS_CONNECTION_LOST_LIVE - "Connection to "PSN" was lost. Exiting to the main menu." - // IDS_CONNECTION_LOST_LIVE_NO_EXIT - "Connection to "PSN" was lost." - // IDS_CONNECTION_LOST_SERVER - "Connection to the server was lost. Exiting to the main menu." - // - // Map to: - // - // IDS_ERROR_NETWORK - "A network error has occurred" - // IDS_ERROR_NETWORK_TITLE - "Network Error" - // IDS_ERROR_NETWORK_EXIT - "A network error has occurred. Exiting to Main Menu." - // IDS_ERROR_PSN_SIGN_OUT - You have been signed out from the "PSN". - // IDS_ERROR_PSN_SIGN_OUT_EXIT - You have been signed out from the "PSN". Exiting to Main Menu - - // Determine if we'd prefer to present errors as a signing out issue, rather than a network issue, based on whether we have a network connection at all or not - bool preferSignoutError = false; - int state; + // Determine if we'd prefer to present errors as a signing out issue, rather + // than a network issue, based on whether we have a network connection at + // all or not + bool preferSignoutError = false; + int state; #ifdef __PS3__ - int ret = cellNetCtlGetState( &state ); - int IPObtainedState = CELL_NET_CTL_STATE_IPObtained; + int ret = cellNetCtlGetState(&state); + int IPObtainedState = CELL_NET_CTL_STATE_IPObtained; #elif defined __ORBIS__ - int ret = sceNetCtlGetState( &state ); - int IPObtainedState = SCE_NET_CTL_STATE_IPOBTAINED; + int ret = sceNetCtlGetState(&state); + int IPObtainedState = SCE_NET_CTL_STATE_IPOBTAINED; #elif defined __PSVITA__ - int ret = sceNetCtlInetGetState( &state ); - int IPObtainedState = SCE_NET_CTL_STATE_IPOBTAINED; + int ret = sceNetCtlInetGetState(&state); + int IPObtainedState = SCE_NET_CTL_STATE_IPOBTAINED; #endif - if( ret == 0 ) - { - if( state == IPObtainedState ) - { - preferSignoutError = true; - } - } + if (ret == 0) { + if (state == IPObtainedState) { + preferSignoutError = true; + } + } #ifdef __PSVITA__ - // If we're in ad-hoc mode this problem definitely wasn't PSN related - if (usingAdhocMode()) preferSignoutError = false; + // If we're in ad-hoc mode this problem definitely wasn't PSN related + if (usingAdhocMode()) preferSignoutError = false; #endif - // If we're the host we haven't lost connection to the server - if (IDS == IDS_CONNECTION_LOST_SERVER && g_NetworkManager.IsHost()) - { - IDS = IDS_CONNECTION_LOST_LIVE; - } + // If we're the host we haven't lost connection to the server + if (IDS == IDS_CONNECTION_LOST_SERVER && g_NetworkManager.IsHost()) { + IDS = IDS_CONNECTION_LOST_LIVE; + } - switch(IDS) - { - case IDS_CONNECTION_LOST: - case IDS_CONNECTION_FAILED: - return IDS_ERROR_NETWORK_TITLE; - case IDS_CONNECTION_LOST_LIVE: - if( preferSignoutError ) - { - return IDS_ERROR_PSN_SIGN_OUT_EXIT; - } - else - { - return IDS_ERROR_NETWORK_EXIT; - } - case IDS_CONNECTION_LOST_LIVE_NO_EXIT: - if( preferSignoutError ) - { - return IDS_ERROR_PSN_SIGN_OUT; - } - else - { - return IDS_ERROR_NETWORK_TITLE; - } - break; + switch (IDS) { + case IDS_CONNECTION_LOST: + case IDS_CONNECTION_FAILED: + return IDS_ERROR_NETWORK_TITLE; + case IDS_CONNECTION_LOST_LIVE: + if (preferSignoutError) { + return IDS_ERROR_PSN_SIGN_OUT_EXIT; + } else { + return IDS_ERROR_NETWORK_EXIT; + } + case IDS_CONNECTION_LOST_LIVE_NO_EXIT: + if (preferSignoutError) { + return IDS_ERROR_PSN_SIGN_OUT; + } else { + return IDS_ERROR_NETWORK_TITLE; + } + break; #ifdef __PSVITA__ - case IDS_CONNECTION_LOST_SERVER: - if(preferSignoutError) - { - if(ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad()) == false) - return IDS_ERROR_PSN_SIGN_OUT_EXIT; - } + case IDS_CONNECTION_LOST_SERVER: + if (preferSignoutError) { + if (ProfileManager.IsSignedInPSN( + ProfileManager.GetPrimaryPad()) == false) + return IDS_ERROR_PSN_SIGN_OUT_EXIT; + } #endif - default: - return IDS; - } - - + default: + return IDS; + } } -bool CPlatformNetworkManagerSony::isSystemPrimaryPlayer(SQRNetworkPlayer *pSQRPlayer) -{ - bool playerIsSystemPrimary = false; - for(AUTO_VAR(it, m_machineSQRPrimaryPlayers.begin()); it < m_machineSQRPrimaryPlayers.end(); ++it) - { - SQRNetworkPlayer *pSQRPrimaryPlayer = *it; - if( pSQRPrimaryPlayer == pSQRPlayer ) - { - playerIsSystemPrimary = true; - break; - } - } - return playerIsSystemPrimary; +bool CPlatformNetworkManagerSony::isSystemPrimaryPlayer( + SQRNetworkPlayer* pSQRPlayer) { + bool playerIsSystemPrimary = false; + for (AUTO_VAR(it, m_machineSQRPrimaryPlayers.begin()); + it < m_machineSQRPrimaryPlayers.end(); ++it) { + SQRNetworkPlayer* pSQRPrimaryPlayer = *it; + if (pSQRPrimaryPlayer == pSQRPlayer) { + playerIsSystemPrimary = true; + break; + } + } + return playerIsSystemPrimary; } -// We call this twice a frame, either side of the render call so is a good place to "tick" things -void CPlatformNetworkManagerSony::DoWork() -{ +// We call this twice a frame, either side of the render call so is a good place +// to "tick" things +void CPlatformNetworkManagerSony::DoWork() { #if 0 DWORD dwNotifyId; ULONG_PTR ulpNotifyParam; @@ -583,70 +530,63 @@ void CPlatformNetworkManagerSony::DoWork() m_pIQNet->DoWork(); #else - TickSearch(); + TickSearch(); - if( m_bLeaveGameOnTick ) - { - m_pSQRNet->LeaveRoom(m_bLeaveRoomWhenLeavingGame); - m_bLeaveGameOnTick = false; - } + if (m_bLeaveGameOnTick) { + m_pSQRNet->LeaveRoom(m_bLeaveRoomWhenLeavingGame); + m_bLeaveGameOnTick = false; + } - m_pSQRNet->Tick(); + m_pSQRNet->Tick(); #endif } -int CPlatformNetworkManagerSony::GetPlayerCount() -{ - return m_pSQRNet->GetPlayerCount(); +int CPlatformNetworkManagerSony::GetPlayerCount() { + return m_pSQRNet->GetPlayerCount(); } -bool CPlatformNetworkManagerSony::ShouldMessageForFullSession() -{ - return false; +bool CPlatformNetworkManagerSony::ShouldMessageForFullSession() { + return false; } -int CPlatformNetworkManagerSony::GetOnlinePlayerCount() -{ - return m_pSQRNet->GetOnlinePlayerCount(); +int CPlatformNetworkManagerSony::GetOnlinePlayerCount() { + return m_pSQRNet->GetOnlinePlayerCount(); } -int CPlatformNetworkManagerSony::GetLocalPlayerMask(int playerIndex) -{ - return 1 << playerIndex; +int CPlatformNetworkManagerSony::GetLocalPlayerMask(int playerIndex) { + return 1 << playerIndex; } -bool CPlatformNetworkManagerSony::AddLocalPlayerByUserIndex( int userIndex ) -{ - return m_pSQRNet->AddLocalPlayerByUserIndex(userIndex); +bool CPlatformNetworkManagerSony::AddLocalPlayerByUserIndex(int userIndex) { + return m_pSQRNet->AddLocalPlayerByUserIndex(userIndex); } -bool CPlatformNetworkManagerSony::RemoveLocalPlayerByUserIndex( int userIndex ) -{ - SQRNetworkPlayer *pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(userIndex); - INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer); +bool CPlatformNetworkManagerSony::RemoveLocalPlayerByUserIndex(int userIndex) { + SQRNetworkPlayer* pSQRPlayer = + m_pSQRNet->GetLocalPlayerByUserIndex(userIndex); + INetworkPlayer* pNetworkPlayer = getNetworkPlayer(pSQRPlayer); - if(pNetworkPlayer != NULL) - { - Socket *socket = pNetworkPlayer->GetSocket(); + if (pNetworkPlayer != NULL) { + Socket* socket = pNetworkPlayer->GetSocket(); - if( socket != NULL ) - { - // We can't remove the player from qnet until we have stopped using it to communicate - C4JThread* thread = new C4JThread(&CPlatformNetworkManagerSony::RemovePlayerOnSocketClosedThreadProc, pNetworkPlayer, "RemovePlayerOnSocketClosed"); - thread->SetProcessor( CPU_CORE_REMOVE_PLAYER ); - thread->Run(); - } - else - { - // Safe to remove the player straight away - return m_pSQRNet->RemoveLocalPlayerByUserIndex(userIndex); - } - } - return true; + if (socket != NULL) { + // We can't remove the player from qnet until we have stopped using + // it to communicate + C4JThread* thread = + new C4JThread(&CPlatformNetworkManagerSony:: + RemovePlayerOnSocketClosedThreadProc, + pNetworkPlayer, "RemovePlayerOnSocketClosed"); + thread->SetProcessor(CPU_CORE_REMOVE_PLAYER); + thread->Run(); + } else { + // Safe to remove the player straight away + return m_pSQRNet->RemoveLocalPlayerByUserIndex(userIndex); + } + } + return true; } -bool CPlatformNetworkManagerSony::IsInStatsEnabledSession() -{ +bool CPlatformNetworkManagerSony::IsInStatsEnabledSession() { #if 0 DWORD dataSize = sizeof(QNET_LIVE_STATS_MODE); QNET_LIVE_STATS_MODE statsMode; @@ -656,12 +596,12 @@ bool CPlatformNetworkManagerSony::IsInStatsEnabledSession() bool statsEnabled = statsMode == QNET_LIVE_STATS_MODE_ENABLED; return m_pIQNet->GetState() != QNET_STATE_IDLE && statsEnabled; #endif - return true; + return true; } -bool CPlatformNetworkManagerSony::SessionHasSpace(unsigned int spaceRequired /*= 1*/) -{ - return m_pSQRNet->SessionHasSpace(spaceRequired); +bool CPlatformNetworkManagerSony::SessionHasSpace( + unsigned int spaceRequired /*= 1*/) { + return m_pSQRNet->SessionHasSpace(spaceRequired); #if 0 // This function is used while a session is running, so all players trying to join // should use public slots, @@ -680,118 +620,120 @@ bool CPlatformNetworkManagerSony::SessionHasSpace(unsigned int spaceRequired /*= return spaceLeft >= spaceRequired; #else - return true; + return true; #endif } -void CPlatformNetworkManagerSony::SendInviteGUI(int quadrant) -{ - m_pSQRNet->SendInviteGUI(); +void CPlatformNetworkManagerSony::SendInviteGUI(int quadrant) { + m_pSQRNet->SendInviteGUI(); } -bool CPlatformNetworkManagerSony::IsAddingPlayer() -{ - return false; +bool CPlatformNetworkManagerSony::IsAddingPlayer() { return false; } + +bool CPlatformNetworkManagerSony::LeaveGame(bool bMigrateHost) { + if (m_bLeavingGame) return true; + + m_bLeavingGame = true; + + // If we are a client, wait for all client connections to close + // TODO Possibly need to do multiple objects depending on how split screen + // online works + SQRNetworkPlayer* pSQRPlayer = + m_pSQRNet->GetLocalPlayerByUserIndex(g_NetworkManager.GetPrimaryPad()); + INetworkPlayer* pNetworkPlayer = getNetworkPlayer(pSQRPlayer); + + if (pNetworkPlayer != NULL) { + Socket* socket = pNetworkPlayer->GetSocket(); + + if (socket != NULL) { + // printf("Waiting for socket closed event\n"); + socket->m_socketClosedEvent->WaitForSignal(INFINITE); + + // The session might be gone once the socket releases + if (IsInSession()) { + // printf("Socket closed event has fired\n"); + // 4J Stu - Clear our reference to this socket + pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex( + g_NetworkManager.GetPrimaryPad()); + pNetworkPlayer = getNetworkPlayer(pSQRPlayer); + pNetworkPlayer->SetSocket(NULL); + } + delete socket; + } else { + // printf("Socket is already NULL\n"); + } + } + + // If we are the host wait for the game server to end + if (m_pSQRNet->IsHost() && g_NetworkManager.ServerStoppedValid()) { + m_pSQRNet->EndGame(); + g_NetworkManager.ServerStoppedWait(); + g_NetworkManager.ServerStoppedDestroy(); + } + + return _LeaveGame(bMigrateHost, true); } -bool CPlatformNetworkManagerSony::LeaveGame(bool bMigrateHost) -{ - if( m_bLeavingGame ) return true; +bool CPlatformNetworkManagerSony::_LeaveGame(bool bMigrateHost, + bool bLeaveRoom) { + // 4J Stu - Fix for #10490 - TCR 001 BAS Game Stability: When a party of + // four players leave a world to join another world without saving the title + // will crash. Changed this to make it threadsafe + m_bLeavingGame = + true; // Added for Sony platforms but unsure why the 360 doesn't need + // it - without this, the leaving triggered by this causes the + // game to respond by leaving again when it transitions to the + // SNM_STATE_ENDING state + m_bLeaveRoomWhenLeavingGame = bLeaveRoom; + m_bLeaveGameOnTick = true; + m_migrateHostOnLeave = bMigrateHost; - m_bLeavingGame = true; - - // If we are a client, wait for all client connections to close - // TODO Possibly need to do multiple objects depending on how split screen online works - SQRNetworkPlayer *pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(g_NetworkManager.GetPrimaryPad()); - INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer); - - if(pNetworkPlayer != NULL) - { - Socket *socket = pNetworkPlayer->GetSocket(); - - if( socket != NULL ) - { - //printf("Waiting for socket closed event\n"); - socket->m_socketClosedEvent->WaitForSignal(INFINITE); - - // The session might be gone once the socket releases - if( IsInSession() ) - { - //printf("Socket closed event has fired\n"); - // 4J Stu - Clear our reference to this socket - pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(g_NetworkManager.GetPrimaryPad()); - pNetworkPlayer = getNetworkPlayer(pSQRPlayer); - pNetworkPlayer->SetSocket( NULL ); - } - delete socket; - } - else - { - //printf("Socket is already NULL\n"); - } - } - - // If we are the host wait for the game server to end - if(m_pSQRNet->IsHost() && g_NetworkManager.ServerStoppedValid()) - { - m_pSQRNet->EndGame(); - g_NetworkManager.ServerStoppedWait(); - g_NetworkManager.ServerStoppedDestroy(); - } - - return _LeaveGame(bMigrateHost, true); + return true; } -bool CPlatformNetworkManagerSony::_LeaveGame(bool bMigrateHost, bool bLeaveRoom) -{ - // 4J Stu - Fix for #10490 - TCR 001 BAS Game Stability: When a party of four players leave a world to join another world without saving the title will crash. - // Changed this to make it threadsafe - m_bLeavingGame = true; // Added for Sony platforms but unsure why the 360 doesn't need it - without this, the leaving triggered by this causes the game to respond by leaving again when it transitions to the SNM_STATE_ENDING state - m_bLeaveRoomWhenLeavingGame = bLeaveRoom; - m_bLeaveGameOnTick = true; - m_migrateHostOnLeave = bMigrateHost; +void CPlatformNetworkManagerSony::HostGame( + int localUsersMask, bool bOnlineGame, bool bIsPrivate, + unsigned char publicSlots /*= MINECRAFT_NET_MAX_PLAYERS*/, + unsigned char privateSlots /*= 0*/) { + // #ifdef _XBOX + // 4J Stu - We probably did this earlier as well, but just to be sure! + SetLocalGame(!bOnlineGame); + SetPrivateGame(bIsPrivate); + SystemFlagReset(); - return true; + // Make sure that the Primary Pad is in by default + localUsersMask |= GetLocalPlayerMask(g_NetworkManager.GetPrimaryPad()); + + _HostGame(localUsersMask, publicSlots, privateSlots); + // #endif } -void CPlatformNetworkManagerSony::HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, unsigned char publicSlots /*= MINECRAFT_NET_MAX_PLAYERS*/, unsigned char privateSlots /*= 0*/) -{ -// #ifdef _XBOX - // 4J Stu - We probably did this earlier as well, but just to be sure! - SetLocalGame( !bOnlineGame ); - SetPrivateGame( bIsPrivate ); - SystemFlagReset(); +void CPlatformNetworkManagerSony::_HostGame( + int usersMask, unsigned char publicSlots /*= MINECRAFT_NET_MAX_PLAYERS*/, + unsigned char privateSlots /*= 0*/) { + // Start hosting a new game - // Make sure that the Primary Pad is in by default - localUsersMask |= GetLocalPlayerMask( g_NetworkManager.GetPrimaryPad() ); + memset(&m_hostGameSessionData, 0, sizeof(m_hostGameSessionData)); + m_hostGameSessionData.netVersion = MINECRAFT_NET_VERSION; + m_hostGameSessionData.isJoinable = !IsPrivateGame(); + m_hostGameSessionData.isReadyToJoin = false; + m_hostGameSessionData.playerCount = 0; + m_hostGameSessionData.m_uiGameHostSettings = + app.GetGameHostOption(eGameHostOption_All); + for (int i = 0; i < SQRNetworkManager::MAX_LOCAL_PLAYER_COUNT; i++) { + if (usersMask & (1 << i)) { + m_hostGameSessionData.playerCount++; + } + } - _HostGame( localUsersMask, publicSlots, privateSlots ); -//#endif + m_pSQRNet->CreateAndJoinRoom( + g_NetworkManager.GetPrimaryPad(), usersMask, &m_hostGameSessionData, + sizeof(m_hostGameSessionData), + IsLocalGame()); // Should be using: g_NetworkManager.GetLockedProfile() + // but that isn't being set currently } -void CPlatformNetworkManagerSony::_HostGame(int usersMask, unsigned char publicSlots /*= MINECRAFT_NET_MAX_PLAYERS*/, unsigned char privateSlots /*= 0*/) -{ - // Start hosting a new game - - memset(&m_hostGameSessionData,0,sizeof(m_hostGameSessionData)); - m_hostGameSessionData.netVersion = MINECRAFT_NET_VERSION; - m_hostGameSessionData.isJoinable = !IsPrivateGame(); - m_hostGameSessionData.isReadyToJoin = false; - m_hostGameSessionData.playerCount = 0; - m_hostGameSessionData.m_uiGameHostSettings = app.GetGameHostOption(eGameHostOption_All); - for( int i = 0; i < SQRNetworkManager::MAX_LOCAL_PLAYER_COUNT; i++ ) - { - if( usersMask & ( 1 << i ) ) - { - m_hostGameSessionData.playerCount++; - } - } - - m_pSQRNet->CreateAndJoinRoom(g_NetworkManager.GetPrimaryPad(),usersMask, &m_hostGameSessionData, sizeof(m_hostGameSessionData), IsLocalGame()); // Should be using: g_NetworkManager.GetLockedProfile() but that isn't being set currently -} - -bool CPlatformNetworkManagerSony::_StartGame() -{ +bool CPlatformNetworkManagerSony::_StartGame() { #if 0 // Set the options that now allow players to join this game BOOL enableJip = TRUE; // Must always be true othewise nobody can join the game while in the PLAY state @@ -803,41 +745,35 @@ bool CPlatformNetworkManagerSony::_StartGame() return ( m_pIQNet->StartGame() == S_OK ); #else - m_pSQRNet->StartGame(); - return true; + m_pSQRNet->StartGame(); + return true; #endif } -int CPlatformNetworkManagerSony::JoinGame(FriendSessionInfo *searchResult, int localUsersMask, int primaryUserIndex) -{ - int joinPlayerCount = 0; - for( int i = 0; i < SQRNetworkManager::MAX_LOCAL_PLAYER_COUNT; i++ ) - { - if( localUsersMask & ( 1 << i ) ) - { - joinPlayerCount++; - } - } - GameSessionData *gameSession = (GameSessionData *)(&searchResult->data); - if( ( gameSession->playerCount + joinPlayerCount ) > SQRNetworkManager::MAX_ONLINE_PLAYER_COUNT ) - { - return CGameNetworkManager::JOINGAME_FAIL_SERVER_FULL; - } +int CPlatformNetworkManagerSony::JoinGame(FriendSessionInfo* searchResult, + int localUsersMask, + int primaryUserIndex) { + int joinPlayerCount = 0; + for (int i = 0; i < SQRNetworkManager::MAX_LOCAL_PLAYER_COUNT; i++) { + if (localUsersMask & (1 << i)) { + joinPlayerCount++; + } + } + GameSessionData* gameSession = (GameSessionData*)(&searchResult->data); + if ((gameSession->playerCount + joinPlayerCount) > + SQRNetworkManager::MAX_ONLINE_PLAYER_COUNT) { + return CGameNetworkManager::JOINGAME_FAIL_SERVER_FULL; + } - if( m_pSQRNet->JoinRoom(&searchResult->searchResult, localUsersMask) ) - { - return CGameNetworkManager::JOINGAME_SUCCESS; - } - else - { - return CGameNetworkManager::JOINGAME_FAIL_GENERAL; - } + if (m_pSQRNet->JoinRoom(&searchResult->searchResult, localUsersMask)) { + return CGameNetworkManager::JOINGAME_SUCCESS; + } else { + return CGameNetworkManager::JOINGAME_FAIL_GENERAL; + } } -bool CPlatformNetworkManagerSony::SetLocalGame(bool isLocal) -{ - if( m_pSQRNet->GetState() == SQRNetworkManager::SNM_STATE_IDLE) - { +bool CPlatformNetworkManagerSony::SetLocalGame(bool isLocal) { + if (m_pSQRNet->GetState() == SQRNetworkManager::SNM_STATE_IDLE) { #if 0 QNET_SESSIONTYPE sessionType = isLocal ? QNET_SESSIONTYPE_LOCAL : QNET_SESSIONTYPE_LIVE_STANDARD; m_pIQNet->SetOpt(QNET_OPTION_TYPE_SESSIONTYPE, &sessionType , sizeof QNET_SESSIONTYPE); @@ -854,45 +790,45 @@ bool CPlatformNetworkManagerSony::SetLocalGame(bool isLocal) m_pIQNet->SetOpt(QNET_OPTION_LIVE_PRESENCE_MODE, &presenceMode , sizeof QNET_LIVE_PRESENCE_MODE); #endif - m_bIsOfflineGame = isLocal; - app.DebugPrintf("Setting as local game: %s\n", isLocal ? "yes" : "no" ); - } - else - { - app.DebugPrintf("Tried to change session type while not in idle or offline state\n"); - } + m_bIsOfflineGame = isLocal; + app.DebugPrintf("Setting as local game: %s\n", isLocal ? "yes" : "no"); + } else { + app.DebugPrintf( + "Tried to change session type while not in idle or offline " + "state\n"); + } - return true; + return true; } -void CPlatformNetworkManagerSony::SetPrivateGame(bool isPrivate) -{ - app.DebugPrintf("Setting as private game: %s\n", isPrivate ? "yes" : "no" ); - m_bIsPrivateGame = isPrivate; +void CPlatformNetworkManagerSony::SetPrivateGame(bool isPrivate) { + app.DebugPrintf("Setting as private game: %s\n", isPrivate ? "yes" : "no"); + m_bIsPrivateGame = isPrivate; } -void CPlatformNetworkManagerSony::RegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam) -{ - playerChangedCallback[iPad] = callback; - playerChangedCallbackParam[iPad] = callbackParam; +void CPlatformNetworkManagerSony::RegisterPlayerChangedCallback( + int iPad, + void (*callback)(void* callbackParam, INetworkPlayer* pPlayer, + bool leaving), + void* callbackParam) { + playerChangedCallback[iPad] = callback; + playerChangedCallbackParam[iPad] = callbackParam; } -void CPlatformNetworkManagerSony::UnRegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam) -{ - if(playerChangedCallbackParam[iPad] == callbackParam) - { - playerChangedCallback[iPad] = NULL; - playerChangedCallbackParam[iPad] = NULL; - } +void CPlatformNetworkManagerSony::UnRegisterPlayerChangedCallback( + int iPad, + void (*callback)(void* callbackParam, INetworkPlayer* pPlayer, + bool leaving), + void* callbackParam) { + if (playerChangedCallbackParam[iPad] == callbackParam) { + playerChangedCallback[iPad] = NULL; + playerChangedCallbackParam[iPad] = NULL; + } } -void CPlatformNetworkManagerSony::HandleSignInChange() -{ - return; -} +void CPlatformNetworkManagerSony::HandleSignInChange() { return; } -bool CPlatformNetworkManagerSony::_RunNetworkGame() -{ +bool CPlatformNetworkManagerSony::_RunNetworkGame() { #if 0 // We delay actually starting the session so that we know the game server is running by the time the clients try to join // This does result in a host advantage @@ -907,175 +843,168 @@ bool CPlatformNetworkManagerSony::_RunNetworkGame() BOOL enablePres = !IsPrivateGame() && !IsLocalGame(); m_pIQNet->SetOpt( QNET_OPTION_PRESENCE_JOIN_MODE, &enablePres, sizeof BOOL ); #endif - if( IsHost() ) - { - m_pSQRNet->StartGame(); - m_hostGameSessionData.isReadyToJoin = true; - m_pSQRNet->UpdateExternalRoomData(); - m_pSQRNet->SetPresenceDataStartHostingGame(); - } + if (IsHost()) { + m_pSQRNet->StartGame(); + m_hostGameSessionData.isReadyToJoin = true; + m_pSQRNet->UpdateExternalRoomData(); + m_pSQRNet->SetPresenceDataStartHostingGame(); + } - return true; + return true; } -// Note that this does less than the xbox equivalent as we have HandleResyncPlayerRequest that is called by the underlying SQRNetworkManager when players are added/removed etc., so this -// call is only used to update the game host settings & then do the final push out of the data. -void CPlatformNetworkManagerSony::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/) -{ - if( this->m_bLeavingGame ) - return; +// Note that this does less than the xbox equivalent as we have +// HandleResyncPlayerRequest that is called by the underlying SQRNetworkManager +// when players are added/removed etc., so this call is only used to update the +// game host settings & then do the final push out of the data. +void CPlatformNetworkManagerSony::UpdateAndSetGameSessionData( + INetworkPlayer* pNetworkPlayerLeaving /*= NULL*/) { + if (this->m_bLeavingGame) return; - m_hostGameSessionData.hostPlayerUID = GetHostPlayer()->GetUID(); + m_hostGameSessionData.hostPlayerUID = GetHostPlayer()->GetUID(); #ifdef __PSVITA__ - if(usingAdhocMode()) - { - m_hostGameSessionData.hostPlayerUID.setForAdhoc(); - } -#endif + if (usingAdhocMode()) { + m_hostGameSessionData.hostPlayerUID.setForAdhoc(); + } +#endif - m_hostGameSessionData.m_uiGameHostSettings = app.GetGameHostOption(eGameHostOption_All); + m_hostGameSessionData.m_uiGameHostSettings = + app.GetGameHostOption(eGameHostOption_All); - // If this is called With a pNetworkPlayerLeaving, then the call has ultimately started within SQRNetworkManager::RemoveRemotePlayersAndSync, so we don't need to sync each change - // as that function does a sync at the end of all changes. - if( pNetworkPlayerLeaving == NULL ) - { - m_pSQRNet->UpdateExternalRoomData(); - } + // If this is called With a pNetworkPlayerLeaving, then the call has + // ultimately started within SQRNetworkManager::RemoveRemotePlayersAndSync, + // so we don't need to sync each change as that function does a sync at the + // end of all changes. + if (pNetworkPlayerLeaving == NULL) { + m_pSQRNet->UpdateExternalRoomData(); + } } -int CPlatformNetworkManagerSony::RemovePlayerOnSocketClosedThreadProc( void* lpParam ) -{ - INetworkPlayer *pNetworkPlayer = (INetworkPlayer *)lpParam; +int CPlatformNetworkManagerSony::RemovePlayerOnSocketClosedThreadProc( + void* lpParam) { + INetworkPlayer* pNetworkPlayer = (INetworkPlayer*)lpParam; - Socket *socket = pNetworkPlayer->GetSocket(); + Socket* socket = pNetworkPlayer->GetSocket(); - if( socket != NULL ) - { - //printf("Waiting for socket closed event\n"); - socket->m_socketClosedEvent->WaitForSignal(INFINITE); + if (socket != NULL) { + // printf("Waiting for socket closed event\n"); + socket->m_socketClosedEvent->WaitForSignal(INFINITE); - //printf("Socket closed event has fired\n"); - // 4J Stu - Clear our reference to this socket - pNetworkPlayer->SetSocket( NULL ); - delete socket; - } + // printf("Socket closed event has fired\n"); + // 4J Stu - Clear our reference to this socket + pNetworkPlayer->SetSocket(NULL); + delete socket; + } - return g_pPlatformNetworkManager->RemoveLocalPlayer( pNetworkPlayer ); + return g_pPlatformNetworkManager->RemoveLocalPlayer(pNetworkPlayer); } -bool CPlatformNetworkManagerSony::RemoveLocalPlayer( INetworkPlayer *pNetworkPlayer ) -{ - if( pNetworkPlayer->IsLocal() ) - { - return m_pSQRNet->RemoveLocalPlayerByUserIndex( pNetworkPlayer->GetUserIndex() ); - } +bool CPlatformNetworkManagerSony::RemoveLocalPlayer( + INetworkPlayer* pNetworkPlayer) { + if (pNetworkPlayer->IsLocal()) { + return m_pSQRNet->RemoveLocalPlayerByUserIndex( + pNetworkPlayer->GetUserIndex()); + } - return true; + return true; } -CPlatformNetworkManagerSony::PlayerFlags::PlayerFlags(INetworkPlayer *pNetworkPlayer, unsigned int count) -{ - // 4J Stu - Don't assert, just make it a multiple of 8! This count is calculated from a load of separate values, - // and makes tweaking world/render sizes a pain if we hit an assert here - count = (count + 8 - 1) & ~(8 - 1); - //assert( ( count % 8 ) == 0 ); - this->m_pNetworkPlayer = pNetworkPlayer; - this->flags = new unsigned char [ count / 8 ]; - memset( this->flags, 0, count / 8 ); - this->count = count; +CPlatformNetworkManagerSony::PlayerFlags::PlayerFlags( + INetworkPlayer* pNetworkPlayer, unsigned int count) { + // 4J Stu - Don't assert, just make it a multiple of 8! This count is + // calculated from a load of separate values, and makes tweaking + // world/render sizes a pain if we hit an assert here + count = (count + 8 - 1) & ~(8 - 1); + // assert( ( count % 8 ) == 0 ); + this->m_pNetworkPlayer = pNetworkPlayer; + this->flags = new unsigned char[count / 8]; + memset(this->flags, 0, count / 8); + this->count = count; } -CPlatformNetworkManagerSony::PlayerFlags::~PlayerFlags() -{ - delete [] flags; +CPlatformNetworkManagerSony::PlayerFlags::~PlayerFlags() { delete[] flags; } + +// Add a player to the per system flag storage - if we've already got a player +// from that system, copy its flags over +void CPlatformNetworkManagerSony::SystemFlagAddPlayer( + INetworkPlayer* pNetworkPlayer) { + PlayerFlags* newPlayerFlags = + new PlayerFlags(pNetworkPlayer, m_flagIndexSize); + // If any of our existing players are on the same system, then copy over + // flags from that one + for (unsigned int i = 0; i < m_playerFlags.size(); i++) { + if (pNetworkPlayer->IsSameSystem(m_playerFlags[i]->m_pNetworkPlayer)) { + memcpy(newPlayerFlags->flags, m_playerFlags[i]->flags, + m_playerFlags[i]->count / 8); + break; + } + } + m_playerFlags.push_back(newPlayerFlags); } -// Add a player to the per system flag storage - if we've already got a player from that system, copy its flags over -void CPlatformNetworkManagerSony::SystemFlagAddPlayer(INetworkPlayer *pNetworkPlayer) -{ - PlayerFlags *newPlayerFlags = new PlayerFlags( pNetworkPlayer, m_flagIndexSize); - // If any of our existing players are on the same system, then copy over flags from that one - for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) - { - if( pNetworkPlayer->IsSameSystem(m_playerFlags[i]->m_pNetworkPlayer) ) - { - memcpy( newPlayerFlags->flags, m_playerFlags[i]->flags, m_playerFlags[i]->count / 8 ); - break; - } - } - m_playerFlags.push_back(newPlayerFlags); +// Remove a player from the per system flag storage - just maintains the +// m_playerFlags vector without any gaps in it +void CPlatformNetworkManagerSony::SystemFlagRemovePlayer( + INetworkPlayer* pNetworkPlayer) { + for (unsigned int i = 0; i < m_playerFlags.size(); i++) { + if (m_playerFlags[i]->m_pNetworkPlayer == pNetworkPlayer) { + delete m_playerFlags[i]; + m_playerFlags[i] = m_playerFlags.back(); + m_playerFlags.pop_back(); + return; + } + } } -// Remove a player from the per system flag storage - just maintains the m_playerFlags vector without any gaps in it -void CPlatformNetworkManagerSony::SystemFlagRemovePlayer(INetworkPlayer *pNetworkPlayer) -{ - for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) - { - if( m_playerFlags[i]->m_pNetworkPlayer == pNetworkPlayer ) - { - delete m_playerFlags[i]; - m_playerFlags[i] = m_playerFlags.back(); - m_playerFlags.pop_back(); - return; - } - } +void CPlatformNetworkManagerSony::SystemFlagReset() { + for (unsigned int i = 0; i < m_playerFlags.size(); i++) { + delete m_playerFlags[i]; + } + m_playerFlags.clear(); } -void CPlatformNetworkManagerSony::SystemFlagReset() -{ - for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) - { - delete m_playerFlags[i]; - } - m_playerFlags.clear(); +// Set a per system flag - this is done by setting the flag on every player that +// shares that system +void CPlatformNetworkManagerSony::SystemFlagSet(INetworkPlayer* pNetworkPlayer, + int index) { + if ((index < 0) || (index >= m_flagIndexSize)) return; + if (pNetworkPlayer == NULL) return; + + for (unsigned int i = 0; i < m_playerFlags.size(); i++) { + if (pNetworkPlayer->IsSameSystem(m_playerFlags[i]->m_pNetworkPlayer)) { + m_playerFlags[i]->flags[index / 8] |= (128 >> (index % 8)); + } + } } -// Set a per system flag - this is done by setting the flag on every player that shares that system -void CPlatformNetworkManagerSony::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index) -{ - if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return; - if( pNetworkPlayer == NULL ) return; +// Get value of a per system flag - can be read from the flags of the passed in +// player as anything else sent to that system should also have been duplicated +// here +bool CPlatformNetworkManagerSony::SystemFlagGet(INetworkPlayer* pNetworkPlayer, + int index) { + if ((index < 0) || (index >= m_flagIndexSize)) return false; + if (pNetworkPlayer == NULL) { + return false; + } - for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) - { - if( pNetworkPlayer->IsSameSystem(m_playerFlags[i]->m_pNetworkPlayer) ) - { - m_playerFlags[i]->flags[ index / 8 ] |= ( 128 >> ( index % 8 ) ); - } - } + for (unsigned int i = 0; i < m_playerFlags.size(); i++) { + if (m_playerFlags[i]->m_pNetworkPlayer == pNetworkPlayer) { + return ((m_playerFlags[i]->flags[index / 8] & + (128 >> (index % 8))) != 0); + } + } + return false; } -// Get value of a per system flag - can be read from the flags of the passed in player as anything else sent to that -// system should also have been duplicated here -bool CPlatformNetworkManagerSony::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index) -{ - if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false; - if( pNetworkPlayer == NULL ) - { - return false; - } - - for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) - { - if( m_playerFlags[i]->m_pNetworkPlayer == pNetworkPlayer ) - { - return ( ( m_playerFlags[i]->flags[ index / 8 ] & ( 128 >> ( index % 8 ) ) ) != 0 ); - } - } - return false; -} - -std::wstring CPlatformNetworkManagerSony::GatherStats() -{ +std::wstring CPlatformNetworkManagerSony::GatherStats() { #if 0 return L"Queue messages: " + _toString(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) ) + L" Queue bytes: " + _toString( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ) ); #else - return L""; + return L""; #endif } -std::wstring CPlatformNetworkManagerSony::GatherRTTStats() -{ +std::wstring CPlatformNetworkManagerSony::GatherRTTStats() { #if 0 std::wstring stats(L"Rtt: "); @@ -1094,88 +1023,84 @@ std::wstring CPlatformNetworkManagerSony::GatherRTTStats() } return stats; #else - return L""; + return L""; #endif } -void CPlatformNetworkManagerSony::TickSearch() -{ - if( m_bSearchPending ) - { - if( !m_pSQRNet->FriendRoomManagerIsBusy() ) - { - m_searchResultsCount = m_pSQRNet->FriendRoomManagerGetCount(); - delete m_pSearchResults; - m_pSearchResults = new SQRNetworkManager::SessionSearchResult[m_searchResultsCount]; +void CPlatformNetworkManagerSony::TickSearch() { + if (m_bSearchPending) { + if (!m_pSQRNet->FriendRoomManagerIsBusy()) { + m_searchResultsCount = m_pSQRNet->FriendRoomManagerGetCount(); + delete m_pSearchResults; + m_pSearchResults = new SQRNetworkManager::SessionSearchResult + [m_searchResultsCount]; - for( int i = 0; i < m_searchResultsCount; i++ ) - { - m_pSQRNet->FriendRoomManagerGetRoomInfo(i, &m_pSearchResults[i] ); - } - m_bSearchPending = false; + for (int i = 0; i < m_searchResultsCount; i++) { + m_pSQRNet->FriendRoomManagerGetRoomInfo(i, + &m_pSearchResults[i]); + } + m_bSearchPending = false; - if( m_SessionsUpdatedCallback != NULL ) m_SessionsUpdatedCallback(m_pSearchParam); - } - } - else - { - if( !m_pSQRNet->FriendRoomManagerIsBusy() ) - { - // Don't start searches unless we have registered a callback - int searchDelay = MINECRAFT_PS3ROOM_SEARCH_DELAY_MILLISECONDS; + if (m_SessionsUpdatedCallback != NULL) + m_SessionsUpdatedCallback(m_pSearchParam); + } + } else { + if (!m_pSQRNet->FriendRoomManagerIsBusy()) { + // Don't start searches unless we have registered a callback + int searchDelay = MINECRAFT_PS3ROOM_SEARCH_DELAY_MILLISECONDS; #ifdef __PSVITA__ - // in adhoc mode we can keep searching, as the friend list is populated in callbacks - // 4J Stu - Every second seems a bit much as it makes the friend list flash every time it updates. Changed this to 5 seconds. - if( usingAdhocMode()) - searchDelay = 5000; + // in adhoc mode we can keep searching, as the friend list is + // populated in callbacks 4J Stu - Every second seems a bit much as + // it makes the friend list flash every time it updates. Changed + // this to 5 seconds. + if (usingAdhocMode()) searchDelay = 5000; #endif - if( m_SessionsUpdatedCallback != NULL && (m_lastSearchStartTime + searchDelay) < GetTickCount() ) - { - if( m_pSQRNet->FriendRoomManagerSearch() ) - { - m_bSearchPending = true; - m_lastSearchStartTime = GetTickCount(); - } - } - } - } + if (m_SessionsUpdatedCallback != NULL && + (m_lastSearchStartTime + searchDelay) < GetTickCount()) { + if (m_pSQRNet->FriendRoomManagerSearch()) { + m_bSearchPending = true; + m_lastSearchStartTime = GetTickCount(); + } + } + } + } } -std::vector *CPlatformNetworkManagerSony::GetSessionList(int iPad, int localPlayers, bool partyOnly) -{ - std::vector *filteredList = new std::vector(); - for( int i = 0; i < m_searchResultsCount; i++ ) - { - if( m_pSearchResults[i].m_extData ) - { - FriendSessionInfo *newInfo = new FriendSessionInfo(); - newInfo->displayLabel = new wchar_t[17]; - ZeroMemory(newInfo->displayLabel, sizeof(wchar_t)*17); - // TODO - this mbstowcs shouldn't encounter any non-ascii characters, but I imagine we'll want to actually use the online name here which is UTF-8 - mbstowcs(newInfo->displayLabel, m_pSearchResults[i].m_NpId.handle.data, 17); - newInfo->displayLabelLength = strlen(m_pSearchResults[i].m_NpId.handle.data); - newInfo->hasPartyMember = false; - newInfo->searchResult = m_pSearchResults[i]; - newInfo->sessionId = m_pSearchResults[i].m_sessionId; - memcpy(&newInfo->data, m_pSearchResults[i].m_extData, sizeof(GameSessionData)); - if( ( newInfo->data.isReadyToJoin ) && - ( newInfo->data.isJoinable ) && - ( newInfo->data.netVersion == MINECRAFT_NET_VERSION ) ) - { - filteredList->push_back(newInfo); - } - else - { - delete newInfo; - } - } - } +std::vector* CPlatformNetworkManagerSony::GetSessionList( + int iPad, int localPlayers, bool partyOnly) { + std::vector* filteredList = + new std::vector(); + for (int i = 0; i < m_searchResultsCount; i++) { + if (m_pSearchResults[i].m_extData) { + FriendSessionInfo* newInfo = new FriendSessionInfo(); + newInfo->displayLabel = new wchar_t[17]; + ZeroMemory(newInfo->displayLabel, sizeof(wchar_t) * 17); + // TODO - this mbstowcs shouldn't encounter any non-ascii + // characters, but I imagine we'll want to actually use the online + // name here which is UTF-8 + mbstowcs(newInfo->displayLabel, + m_pSearchResults[i].m_NpId.handle.data, 17); + newInfo->displayLabelLength = + strlen(m_pSearchResults[i].m_NpId.handle.data); + newInfo->hasPartyMember = false; + newInfo->searchResult = m_pSearchResults[i]; + newInfo->sessionId = m_pSearchResults[i].m_sessionId; + memcpy(&newInfo->data, m_pSearchResults[i].m_extData, + sizeof(GameSessionData)); + if ((newInfo->data.isReadyToJoin) && (newInfo->data.isJoinable) && + (newInfo->data.netVersion == MINECRAFT_NET_VERSION)) { + filteredList->push_back(newInfo); + } else { + delete newInfo; + } + } + } - return filteredList; + return filteredList; } -bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID sessionId, FriendSessionInfo *foundSessionInfo) -{ +bool CPlatformNetworkManagerSony::GetGameSessionInfo( + int iPad, SessionID sessionId, FriendSessionInfo* foundSessionInfo) { #if 0 HRESULT hr = E_FAIL; @@ -1250,213 +1175,194 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session return ( hr == S_OK ); #else - return false; + return false; #endif } -void CPlatformNetworkManagerSony::SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam ) -{ - m_SessionsUpdatedCallback = SessionsUpdatedCallback; m_pSearchParam = pSearchParam; +void CPlatformNetworkManagerSony::SetSessionsUpdatedCallback( + void (*SessionsUpdatedCallback)(void* pParam), void* pSearchParam) { + m_SessionsUpdatedCallback = SessionsUpdatedCallback; + m_pSearchParam = pSearchParam; } -void CPlatformNetworkManagerSony::GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ) -{ - m_pSQRNet->GetExtDataForRoom( foundSession->sessionId.m_RoomId, &foundSession->data, FriendSessionUpdatedFn, pParam); +void CPlatformNetworkManagerSony::GetFullFriendSessionInfo( + FriendSessionInfo* foundSession, + void (*FriendSessionUpdatedFn)(bool success, void* pParam), void* pParam) { + m_pSQRNet->GetExtDataForRoom(foundSession->sessionId.m_RoomId, + &foundSession->data, FriendSessionUpdatedFn, + pParam); } -void CPlatformNetworkManagerSony::ForceFriendsSessionRefresh() -{ - app.DebugPrintf("Resetting friends session search data\n"); - m_lastSearchStartTime = 0; - m_searchResultsCount = 0; - delete m_pSearchResults; - m_pSearchResults = NULL; +void CPlatformNetworkManagerSony::ForceFriendsSessionRefresh() { + app.DebugPrintf("Resetting friends session search data\n"); + m_lastSearchStartTime = 0; + m_searchResultsCount = 0; + delete m_pSearchResults; + m_pSearchResults = NULL; } -INetworkPlayer *CPlatformNetworkManagerSony::addNetworkPlayer(SQRNetworkPlayer *pSQRPlayer) -{ - NetworkPlayerSony *pNetworkPlayer = new NetworkPlayerSony(pSQRPlayer); - pSQRPlayer->SetCustomDataValue((ULONG_PTR)pNetworkPlayer); - currentNetworkPlayers.push_back( pNetworkPlayer ); - return pNetworkPlayer; +INetworkPlayer* CPlatformNetworkManagerSony::addNetworkPlayer( + SQRNetworkPlayer* pSQRPlayer) { + NetworkPlayerSony* pNetworkPlayer = new NetworkPlayerSony(pSQRPlayer); + pSQRPlayer->SetCustomDataValue((ULONG_PTR)pNetworkPlayer); + currentNetworkPlayers.push_back(pNetworkPlayer); + return pNetworkPlayer; } -void CPlatformNetworkManagerSony::removeNetworkPlayer(SQRNetworkPlayer *pSQRPlayer) -{ - INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer); - for( AUTO_VAR(it, currentNetworkPlayers.begin()); it != currentNetworkPlayers.end(); it++ ) - { - if( *it == pNetworkPlayer ) - { - currentNetworkPlayers.erase(it); - return; - } - } +void CPlatformNetworkManagerSony::removeNetworkPlayer( + SQRNetworkPlayer* pSQRPlayer) { + INetworkPlayer* pNetworkPlayer = getNetworkPlayer(pSQRPlayer); + for (AUTO_VAR(it, currentNetworkPlayers.begin()); + it != currentNetworkPlayers.end(); it++) { + if (*it == pNetworkPlayer) { + currentNetworkPlayers.erase(it); + return; + } + } } -INetworkPlayer *CPlatformNetworkManagerSony::getNetworkPlayer(SQRNetworkPlayer *pSQRPlayer) -{ - return pSQRPlayer ? (INetworkPlayer *)(pSQRPlayer->GetCustomDataValue()) : NULL; +INetworkPlayer* CPlatformNetworkManagerSony::getNetworkPlayer( + SQRNetworkPlayer* pSQRPlayer) { + return pSQRPlayer ? (INetworkPlayer*)(pSQRPlayer->GetCustomDataValue()) + : NULL; } - -INetworkPlayer *CPlatformNetworkManagerSony::GetLocalPlayerByUserIndex(int userIndex ) -{ - return getNetworkPlayer(m_pSQRNet->GetLocalPlayerByUserIndex(userIndex)); +INetworkPlayer* CPlatformNetworkManagerSony::GetLocalPlayerByUserIndex( + int userIndex) { + return getNetworkPlayer(m_pSQRNet->GetLocalPlayerByUserIndex(userIndex)); } -INetworkPlayer *CPlatformNetworkManagerSony::GetPlayerByIndex(int playerIndex) -{ - return getNetworkPlayer(m_pSQRNet->GetPlayerByIndex(playerIndex)); +INetworkPlayer* CPlatformNetworkManagerSony::GetPlayerByIndex(int playerIndex) { + return getNetworkPlayer(m_pSQRNet->GetPlayerByIndex(playerIndex)); } -INetworkPlayer * CPlatformNetworkManagerSony::GetPlayerByXuid(PlayerUID xuid) -{ - return getNetworkPlayer(m_pSQRNet->GetPlayerByXuid(xuid)); +INetworkPlayer* CPlatformNetworkManagerSony::GetPlayerByXuid(PlayerUID xuid) { + return getNetworkPlayer(m_pSQRNet->GetPlayerByXuid(xuid)); } -INetworkPlayer * CPlatformNetworkManagerSony::GetPlayerBySmallId(unsigned char smallId) -{ - return getNetworkPlayer(m_pSQRNet->GetPlayerBySmallId(smallId)); +INetworkPlayer* CPlatformNetworkManagerSony::GetPlayerBySmallId( + unsigned char smallId) { + return getNetworkPlayer(m_pSQRNet->GetPlayerBySmallId(smallId)); } -INetworkPlayer *CPlatformNetworkManagerSony::GetHostPlayer() -{ - return getNetworkPlayer(m_pSQRNet->GetHostPlayer()); +INetworkPlayer* CPlatformNetworkManagerSony::GetHostPlayer() { + return getNetworkPlayer(m_pSQRNet->GetHostPlayer()); } -bool CPlatformNetworkManagerSony::IsHost() -{ - return m_pSQRNet->IsHost() && !m_bHostChanged; +bool CPlatformNetworkManagerSony::IsHost() { + return m_pSQRNet->IsHost() && !m_bHostChanged; } -bool CPlatformNetworkManagerSony::JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo) -{ - return m_pSQRNet->JoinRoom( pInviteInfo->m_RoomId, pInviteInfo->m_ServerId, userMask, pInviteInfo ); +bool CPlatformNetworkManagerSony::JoinGameFromInviteInfo( + int userIndex, int userMask, const INVITE_INFO* pInviteInfo) { + return m_pSQRNet->JoinRoom(pInviteInfo->m_RoomId, pInviteInfo->m_ServerId, + userMask, pInviteInfo); } -void CPlatformNetworkManagerSony::SetSessionTexturePackParentId( int id ) -{ - m_hostGameSessionData.texturePackParentId = id; +void CPlatformNetworkManagerSony::SetSessionTexturePackParentId(int id) { + m_hostGameSessionData.texturePackParentId = id; } -void CPlatformNetworkManagerSony::SetSessionSubTexturePackId( int id ) -{ - m_hostGameSessionData.subTexturePackId = id; +void CPlatformNetworkManagerSony::SetSessionSubTexturePackId(int id) { + m_hostGameSessionData.subTexturePackId = id; } -void CPlatformNetworkManagerSony::Notify(int ID, ULONG_PTR Param) -{ +void CPlatformNetworkManagerSony::Notify(int ID, ULONG_PTR Param) { #if 0 m_pSQRNet->Notify( ID, Param ); #endif } -bool CPlatformNetworkManagerSony::IsInSession() -{ - return m_pSQRNet->IsInSession(); +bool CPlatformNetworkManagerSony::IsInSession() { + return m_pSQRNet->IsInSession(); } -bool CPlatformNetworkManagerSony::IsInGameplay() -{ - return m_pSQRNet->GetState() == SQRNetworkManager::SNM_STATE_PLAYING; +bool CPlatformNetworkManagerSony::IsInGameplay() { + return m_pSQRNet->GetState() == SQRNetworkManager::SNM_STATE_PLAYING; } -bool CPlatformNetworkManagerSony::IsReadyToPlayOrIdle() -{ - return m_pSQRNet->IsReadyToPlayOrIdle(); +bool CPlatformNetworkManagerSony::IsReadyToPlayOrIdle() { + return m_pSQRNet->IsReadyToPlayOrIdle(); } -void CPlatformNetworkManagerSony::SetSQRPresenceInfoFromExtData(SQRNetworkManager::PresenceSyncInfo *presence, void *pExtData, SceNpMatching2RoomId roomId, SceNpMatching2ServerId serverId) -{ - GameSessionData *gsd = (GameSessionData *)pExtData; +void CPlatformNetworkManagerSony::SetSQRPresenceInfoFromExtData( + SQRNetworkManager::PresenceSyncInfo* presence, void* pExtData, + SceNpMatching2RoomId roomId, SceNpMatching2ServerId serverId) { + GameSessionData* gsd = (GameSessionData*)pExtData; - memcpy(&presence->hostPlayerUID, &gsd->hostPlayerUID, sizeof(GameSessionUID) ); - presence->m_RoomId = roomId; - presence->m_ServerId = serverId; - presence->texturePackParentId = gsd->texturePackParentId; - presence->subTexturePackId = gsd->subTexturePackId; - presence->netVersion = gsd->netVersion; - presence->inviteOnly = !gsd->isJoinable; + memcpy(&presence->hostPlayerUID, &gsd->hostPlayerUID, + sizeof(GameSessionUID)); + presence->m_RoomId = roomId; + presence->m_ServerId = serverId; + presence->texturePackParentId = gsd->texturePackParentId; + presence->subTexturePackId = gsd->subTexturePackId; + presence->netVersion = gsd->netVersion; + presence->inviteOnly = !gsd->isJoinable; } -void CPlatformNetworkManagerSony::MallocAndSetExtDataFromSQRPresenceInfo(void **pExtData, SQRNetworkManager::PresenceSyncInfo *presence) -{ - GameSessionData *gsd = (GameSessionData *)malloc(sizeof(GameSessionData)); - memset(gsd, 0, sizeof(GameSessionData)); - if( presence->netVersion != 0 ) - { - memcpy(&gsd->hostPlayerUID, &presence->hostPlayerUID, sizeof(GameSessionUID) ); - gsd->texturePackParentId = presence->texturePackParentId; - gsd->subTexturePackId = presence->subTexturePackId; - gsd->netVersion = presence->netVersion; - gsd->isJoinable = !presence->inviteOnly; - gsd->isReadyToJoin = true; - } - *pExtData = gsd; +void CPlatformNetworkManagerSony::MallocAndSetExtDataFromSQRPresenceInfo( + void** pExtData, SQRNetworkManager::PresenceSyncInfo* presence) { + GameSessionData* gsd = (GameSessionData*)malloc(sizeof(GameSessionData)); + memset(gsd, 0, sizeof(GameSessionData)); + if (presence->netVersion != 0) { + memcpy(&gsd->hostPlayerUID, &presence->hostPlayerUID, + sizeof(GameSessionUID)); + gsd->texturePackParentId = presence->texturePackParentId; + gsd->subTexturePackId = presence->subTexturePackId; + gsd->netVersion = presence->netVersion; + gsd->isJoinable = !presence->inviteOnly; + gsd->isReadyToJoin = true; + } + *pExtData = gsd; } #ifdef __PSVITA__ -bool CPlatformNetworkManagerSony::setAdhocMode( bool bAdhoc ) -{ - if(m_bUsingAdhocMode != bAdhoc) - { - m_bUsingAdhocMode = bAdhoc; - if(m_bUsingAdhocMode) - { - // uninit the PSN, and init adhoc - if(m_pSQRNet_Vita->IsInitialised()) - { - m_pSQRNet_Vita->UnInitialise(); - } +bool CPlatformNetworkManagerSony::setAdhocMode(bool bAdhoc) { + if (m_bUsingAdhocMode != bAdhoc) { + m_bUsingAdhocMode = bAdhoc; + if (m_bUsingAdhocMode) { + // uninit the PSN, and init adhoc + if (m_pSQRNet_Vita->IsInitialised()) { + m_pSQRNet_Vita->UnInitialise(); + } - if(m_pSQRNet_Vita_Adhoc->IsInitialised()==false) - { - m_pSQRNet_Vita_Adhoc->Initialise(); - } + if (m_pSQRNet_Vita_Adhoc->IsInitialised() == false) { + m_pSQRNet_Vita_Adhoc->Initialise(); + } - m_pSQRNet = m_pSQRNet_Vita_Adhoc; - } - else - { - if(m_pSQRNet_Vita_Adhoc->IsInitialised()) - { - int ret = sceNetCtlAdhocDisconnect(); - // uninit the adhoc, and init psn - m_pSQRNet_Vita_Adhoc->UnInitialise(); - } + m_pSQRNet = m_pSQRNet_Vita_Adhoc; + } else { + if (m_pSQRNet_Vita_Adhoc->IsInitialised()) { + int ret = sceNetCtlAdhocDisconnect(); + // uninit the adhoc, and init psn + m_pSQRNet_Vita_Adhoc->UnInitialise(); + } - if(m_pSQRNet_Vita->IsInitialised()==false) - { - m_pSQRNet_Vita->Initialise(); - } + if (m_pSQRNet_Vita->IsInitialised() == false) { + m_pSQRNet_Vita->Initialise(); + } - m_pSQRNet = m_pSQRNet_Vita; - } - } + m_pSQRNet = m_pSQRNet_Vita; + } + } - return true; + return true; } -void CPlatformNetworkManagerSony::startAdhocMatching( ) -{ - assert(m_pSQRNet == m_pSQRNet_Vita_Adhoc); - ((SQRNetworkManager_AdHoc_Vita*)m_pSQRNet_Vita_Adhoc)->startMatching(); +void CPlatformNetworkManagerSony::startAdhocMatching() { + assert(m_pSQRNet == m_pSQRNet_Vita_Adhoc); + ((SQRNetworkManager_AdHoc_Vita*)m_pSQRNet_Vita_Adhoc)->startMatching(); } -bool CPlatformNetworkManagerSony::checkValidInviteData(const INVITE_INFO* pInviteInfo) -{ - if(((SQRNetworkManager_Vita*)m_pSQRNet_Vita)->GetHostUID() == pInviteInfo->hostPlayerUID) - { - // we're trying to join a game we're already in, so we just ignore this - return false; - } - else - { - return true; - } +bool CPlatformNetworkManagerSony::checkValidInviteData( + const INVITE_INFO* pInviteInfo) { + if (((SQRNetworkManager_Vita*)m_pSQRNet_Vita)->GetHostUID() == + pInviteInfo->hostPlayerUID) { + // we're trying to join a game we're already in, so we just ignore this + return false; + } else { + return true; + } } - - -#endif // __PSVITA__ +#endif // __PSVITA__ diff --git a/Minecraft.Client/Platform/Common/Network/Sony/PlatformNetworkManagerSony.h b/Minecraft.Client/Platform/Common/Network/Sony/PlatformNetworkManagerSony.h index a244c3190..ea959d6f5 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/PlatformNetworkManagerSony.h +++ b/Minecraft.Client/Platform/Common/Network/Sony/PlatformNetworkManagerSony.h @@ -1,5 +1,5 @@ #pragma once -//using namespace std; +// using namespace std; #include #include "../../../Minecraft.World/Util/C4JThread.h" #include "../NetworkPlayerInterface.h" @@ -10,178 +10,220 @@ // This is how often we allow a search for new games #define MINECRAFT_PS3ROOM_SEARCH_DELAY_MILLISECONDS 30000 -// This is the Sony platform specific implementation of CPlatformNetworkManager. It is implemented using SQRNetworkManager/SQRNetworkPlayer. There shouldn't be any general game code in here, -// this class is for providing a bridge between the common game-side network implementation, and the lowest level platform specific libraries. +// This is the Sony platform specific implementation of CPlatformNetworkManager. +// It is implemented using SQRNetworkManager/SQRNetworkPlayer. There shouldn't +// be any general game code in here, this class is for providing a bridge +// between the common game-side network implementation, and the lowest level +// platform specific libraries. + +class CPlatformNetworkManagerSony : public CPlatformNetworkManager, + ISQRNetworkManagerListener { + friend class CGameNetworkManager; -class CPlatformNetworkManagerSony : public CPlatformNetworkManager, ISQRNetworkManagerListener -{ - friend class CGameNetworkManager; public: - virtual bool Initialise(CGameNetworkManager *pGameNetworkManager, int flagIndexSize); - virtual void Terminate(); - virtual int GetJoiningReadyPercentage(); - virtual int CorrectErrorIDS(int IDS); + virtual bool Initialise(CGameNetworkManager* pGameNetworkManager, + int flagIndexSize); + virtual void Terminate(); + virtual int GetJoiningReadyPercentage(); + virtual int CorrectErrorIDS(int IDS); - virtual void DoWork(); - virtual int GetPlayerCount(); - virtual int GetOnlinePlayerCount(); - virtual int GetLocalPlayerMask(int playerIndex); - virtual bool AddLocalPlayerByUserIndex( int userIndex ); - virtual bool RemoveLocalPlayerByUserIndex( int userIndex ); - virtual INetworkPlayer *GetLocalPlayerByUserIndex( int userIndex ); - virtual INetworkPlayer *GetPlayerByIndex(int playerIndex); - virtual INetworkPlayer * GetPlayerByXuid(PlayerUID xuid); - virtual INetworkPlayer * GetPlayerBySmallId(unsigned char smallId); - virtual bool ShouldMessageForFullSession(); + virtual void DoWork(); + virtual int GetPlayerCount(); + virtual int GetOnlinePlayerCount(); + virtual int GetLocalPlayerMask(int playerIndex); + virtual bool AddLocalPlayerByUserIndex(int userIndex); + virtual bool RemoveLocalPlayerByUserIndex(int userIndex); + virtual INetworkPlayer* GetLocalPlayerByUserIndex(int userIndex); + virtual INetworkPlayer* GetPlayerByIndex(int playerIndex); + virtual INetworkPlayer* GetPlayerByXuid(PlayerUID xuid); + virtual INetworkPlayer* GetPlayerBySmallId(unsigned char smallId); + virtual bool ShouldMessageForFullSession(); - virtual INetworkPlayer *GetHostPlayer(); - virtual bool IsHost(); - virtual bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo); - virtual bool LeaveGame(bool bMigrateHost); + virtual INetworkPlayer* GetHostPlayer(); + virtual bool IsHost(); + virtual bool JoinGameFromInviteInfo(int userIndex, int userMask, + const INVITE_INFO* pInviteInfo); + virtual bool LeaveGame(bool bMigrateHost); - virtual bool IsInSession(); - virtual bool IsInGameplay(); - virtual bool IsReadyToPlayOrIdle(); - virtual bool IsInStatsEnabledSession(); - virtual bool SessionHasSpace(unsigned int spaceRequired = 1); + virtual bool IsInSession(); + virtual bool IsInGameplay(); + virtual bool IsReadyToPlayOrIdle(); + virtual bool IsInStatsEnabledSession(); + virtual bool SessionHasSpace(unsigned int spaceRequired = 1); - virtual void SendInviteGUI(int quadrant); - virtual bool IsAddingPlayer(); + virtual void SendInviteGUI(int quadrant); + virtual bool IsAddingPlayer(); - virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0); - virtual int JoinGame(FriendSessionInfo *searchResult, int localUsersMask, int primaryUserIndex ); - virtual bool SetLocalGame(bool isLocal); - virtual bool IsLocalGame(); - virtual void SetPrivateGame(bool isPrivate); - virtual bool IsPrivateGame(); - virtual bool IsLeavingGame(); - virtual void ResetLeavingGame(); + virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, + unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, + unsigned char privateSlots = 0); + virtual int JoinGame(FriendSessionInfo* searchResult, int localUsersMask, + int primaryUserIndex); + virtual bool SetLocalGame(bool isLocal); + virtual bool IsLocalGame(); + virtual void SetPrivateGame(bool isPrivate); + virtual bool IsPrivateGame(); + virtual bool IsLeavingGame(); + virtual void ResetLeavingGame(); - virtual void RegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam); - virtual void UnRegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam); + virtual void RegisterPlayerChangedCallback( + int iPad, + void (*callback)(void* callbackParam, INetworkPlayer* pPlayer, + bool leaving), + void* callbackParam); + virtual void UnRegisterPlayerChangedCallback( + int iPad, + void (*callback)(void* callbackParam, INetworkPlayer* pPlayer, + bool leaving), + void* callbackParam); - virtual void HandleSignInChange(); + virtual void HandleSignInChange(); - virtual bool _RunNetworkGame(); + virtual bool _RunNetworkGame(); #ifdef __PSVITA__ - bool usingAdhocMode() { return m_bUsingAdhocMode; } - bool setAdhocMode(bool bAdhoc); - void startAdhocMatching(); - bool checkValidInviteData(const INVITE_INFO* pInviteInfo); + bool usingAdhocMode() { return m_bUsingAdhocMode; } + bool setAdhocMode(bool bAdhoc); + void startAdhocMatching(); + bool checkValidInviteData(const INVITE_INFO* pInviteInfo); #endif - + private: - bool isSystemPrimaryPlayer(SQRNetworkPlayer *pQNetPlayer); - virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom); - virtual void _HostGame(int dwUsersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0); - virtual bool _StartGame(); + bool isSystemPrimaryPlayer(SQRNetworkPlayer* pQNetPlayer); + virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom); + virtual void _HostGame( + int dwUsersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, + unsigned char privateSlots = 0); + virtual bool _StartGame(); #ifdef __PSVITA__ - bool m_bUsingAdhocMode; - SQRNetworkManager_Vita* m_pSQRNet_Vita; - SQRNetworkManager_AdHoc_Vita* m_pSQRNet_Vita_Adhoc; + bool m_bUsingAdhocMode; + SQRNetworkManager_Vita* m_pSQRNet_Vita; + SQRNetworkManager_AdHoc_Vita* m_pSQRNet_Vita_Adhoc; #endif - SQRNetworkManager * m_pSQRNet; // pointer to SQRNetworkManager interface + SQRNetworkManager* m_pSQRNet; // pointer to SQRNetworkManager interface - HANDLE m_notificationListener; + HANDLE m_notificationListener; - std::vector m_machineSQRPrimaryPlayers; // collection of players that we deem to be the main one for that system + std::vector + m_machineSQRPrimaryPlayers; // collection of players that we deem to be + // the main one for that system - bool m_bLeavingGame; - bool m_bLeaveGameOnTick; - bool m_migrateHostOnLeave; - bool m_bHostChanged; - bool m_bLeaveRoomWhenLeavingGame; + bool m_bLeavingGame; + bool m_bLeaveGameOnTick; + bool m_migrateHostOnLeave; + bool m_bHostChanged; + bool m_bLeaveRoomWhenLeavingGame; - bool m_bIsOfflineGame; - bool m_bIsPrivateGame; - int m_flagIndexSize; + bool m_bIsOfflineGame; + bool m_bIsPrivateGame; + int m_flagIndexSize; + + // This is only maintained by the host, and is not valid on client machines + GameSessionData m_hostGameSessionData; + CGameNetworkManager* m_pGameNetworkManager; - // This is only maintained by the host, and is not valid on client machines - GameSessionData m_hostGameSessionData; - CGameNetworkManager *m_pGameNetworkManager; public: - virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); + virtual void UpdateAndSetGameSessionData( + INetworkPlayer* pNetworkPlayerLeaving = NULL); private: - // TODO 4J Stu - Do we need to be able to have more than one of these? - void (*playerChangedCallback[XUSER_MAX_COUNT])(void *callbackParam, INetworkPlayer *pPlayer, bool leaving); - void *playerChangedCallbackParam[XUSER_MAX_COUNT]; + // TODO 4J Stu - Do we need to be able to have more than one of these? + void (*playerChangedCallback[XUSER_MAX_COUNT])(void* callbackParam, + INetworkPlayer* pPlayer, + bool leaving); + void* playerChangedCallbackParam[XUSER_MAX_COUNT]; - static int RemovePlayerOnSocketClosedThreadProc( void* lpParam ); - virtual bool RemoveLocalPlayer( INetworkPlayer *pNetworkPlayer ); + static int RemovePlayerOnSocketClosedThreadProc(void* lpParam); + virtual bool RemoveLocalPlayer(INetworkPlayer* pNetworkPlayer); + + // Things for handling per-system flags + class PlayerFlags { + public: + INetworkPlayer* m_pNetworkPlayer; + unsigned char* flags; + unsigned int count; + PlayerFlags(INetworkPlayer* pNetworkPlayer, unsigned int count); + ~PlayerFlags(); + }; + std::vector m_playerFlags; + void SystemFlagAddPlayer(INetworkPlayer* pNetworkPlayer); + void SystemFlagRemovePlayer(INetworkPlayer* pNetworkPlayer); + void SystemFlagReset(); - // Things for handling per-system flags - class PlayerFlags - { - public: - INetworkPlayer *m_pNetworkPlayer; - unsigned char *flags; - unsigned int count; - PlayerFlags(INetworkPlayer *pNetworkPlayer, unsigned int count); - ~PlayerFlags(); - }; - std::vector m_playerFlags; - void SystemFlagAddPlayer(INetworkPlayer *pNetworkPlayer); - void SystemFlagRemovePlayer(INetworkPlayer *pNetworkPlayer); - void SystemFlagReset(); public: - virtual void SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index); - virtual bool SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index); + virtual void SystemFlagSet(INetworkPlayer* pNetworkPlayer, int index); + virtual bool SystemFlagGet(INetworkPlayer* pNetworkPlayer, int index); - // For telemetry + // For telemetry private: - float m_lastPlayerEventTimeStart; + float m_lastPlayerEventTimeStart; public: - std::wstring GatherStats(); - std::wstring GatherRTTStats(); + std::wstring GatherStats(); + std::wstring GatherRTTStats(); -private: - std::vector friendsSessions; - - int m_lastSearchStartTime; +private: + std::vector friendsSessions; - // The results that will be filled in with the current search - int m_searchResultsCount; - SQRNetworkManager::SessionSearchResult *m_pSearchResults; + int m_lastSearchStartTime; - int m_lastSearchPad; - bool m_bSearchPending; - void *m_pSearchParam; - void (*m_SessionsUpdatedCallback)(void *pParam); + // The results that will be filled in with the current search + int m_searchResultsCount; + SQRNetworkManager::SessionSearchResult* m_pSearchResults; - C4JThread* m_SearchingThread; + int m_lastSearchPad; + bool m_bSearchPending; + void* m_pSearchParam; + void (*m_SessionsUpdatedCallback)(void* pParam); - void TickSearch(); + C4JThread* m_SearchingThread; - std::vectorcurrentNetworkPlayers; - INetworkPlayer *addNetworkPlayer(SQRNetworkPlayer *pSQRPlayer); - void removeNetworkPlayer(SQRNetworkPlayer *pSQRPlayer); - static INetworkPlayer *getNetworkPlayer(SQRNetworkPlayer *pSQRPlayer); + void TickSearch(); - virtual void SetSessionTexturePackParentId( int id ); - virtual void SetSessionSubTexturePackId( int id ); - virtual void Notify(int ID, ULONG_PTR Param); + std::vector currentNetworkPlayers; + INetworkPlayer* addNetworkPlayer(SQRNetworkPlayer* pSQRPlayer); + void removeNetworkPlayer(SQRNetworkPlayer* pSQRPlayer); + static INetworkPlayer* getNetworkPlayer(SQRNetworkPlayer* pSQRPlayer); + + virtual void SetSessionTexturePackParentId(int id); + virtual void SetSessionSubTexturePackId(int id); + virtual void Notify(int ID, ULONG_PTR Param); public: - virtual std::vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); - virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession); - virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam ); - virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ); - virtual void ForceFriendsSessionRefresh(); + virtual std::vector* GetSessionList(int iPad, + int localPlayers, + bool partyOnly); + virtual bool GetGameSessionInfo(int iPad, SessionID sessionId, + FriendSessionInfo* foundSession); + virtual void SetSessionsUpdatedCallback( + void (*SessionsUpdatedCallback)(void* pParam), void* pSearchParam); + virtual void GetFullFriendSessionInfo( + FriendSessionInfo* foundSession, + void (*FriendSessionUpdatedFn)(bool success, void* pParam), + void* pParam); + virtual void ForceFriendsSessionRefresh(); - // ... and the new ones that have been converted to ISQRNetworkManagerListener - virtual void HandleDataReceived(SQRNetworkPlayer *playerFrom, SQRNetworkPlayer *playerTo, unsigned char *data, unsigned int dataSize); - virtual void HandlePlayerJoined(SQRNetworkPlayer *player); - virtual void HandlePlayerLeaving(SQRNetworkPlayer *player); - virtual void HandleStateChange(SQRNetworkManager::eSQRNetworkManagerState oldState, SQRNetworkManager::eSQRNetworkManagerState newState, bool idleReasonIsSessionFull); - virtual void HandleResyncPlayerRequest(SQRNetworkPlayer **aPlayers); - virtual void HandleAddLocalPlayerFailed(int idx); - virtual void HandleDisconnect(bool bLostRoomOnly,bool bPSNSignOut=false); - virtual void HandleInviteReceived( int userIndex, const SQRNetworkManager::PresenceSyncInfo *pInviteInfo); + // ... and the new ones that have been converted to + // ISQRNetworkManagerListener + virtual void HandleDataReceived(SQRNetworkPlayer* playerFrom, + SQRNetworkPlayer* playerTo, + unsigned char* data, unsigned int dataSize); + virtual void HandlePlayerJoined(SQRNetworkPlayer* player); + virtual void HandlePlayerLeaving(SQRNetworkPlayer* player); + virtual void HandleStateChange( + SQRNetworkManager::eSQRNetworkManagerState oldState, + SQRNetworkManager::eSQRNetworkManagerState newState, + bool idleReasonIsSessionFull); + virtual void HandleResyncPlayerRequest(SQRNetworkPlayer** aPlayers); + virtual void HandleAddLocalPlayerFailed(int idx); + virtual void HandleDisconnect(bool bLostRoomOnly, bool bPSNSignOut = false); + virtual void HandleInviteReceived( + int userIndex, const SQRNetworkManager::PresenceSyncInfo* pInviteInfo); - static void SetSQRPresenceInfoFromExtData(SQRNetworkManager::PresenceSyncInfo *presence, void *pExtData, SceNpMatching2RoomId roomId, SceNpMatching2ServerId serverId); - static void MallocAndSetExtDataFromSQRPresenceInfo(void **pExtData, SQRNetworkManager::PresenceSyncInfo *presence); + static void SetSQRPresenceInfoFromExtData( + SQRNetworkManager::PresenceSyncInfo* presence, void* pExtData, + SceNpMatching2RoomId roomId, SceNpMatching2ServerId serverId); + static void MallocAndSetExtDataFromSQRPresenceInfo( + void** pExtData, SQRNetworkManager::PresenceSyncInfo* presence); }; diff --git a/Minecraft.Client/Platform/Common/Network/Sony/SQRNetworkManager.cpp b/Minecraft.Client/Platform/Common/Network/Sony/SQRNetworkManager.cpp index 56c007077..dd67952d4 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/SQRNetworkManager.cpp +++ b/Minecraft.Client/Platform/Common/Network/Sony/SQRNetworkManager.cpp @@ -4,7 +4,6 @@ bool SQRNetworkManager::s_safeToRespondToGameBootInvite = false; -void SQRNetworkManager::SafeToRespondToGameBootInvite() -{ - s_safeToRespondToGameBootInvite = true; +void SQRNetworkManager::SafeToRespondToGameBootInvite() { + s_safeToRespondToGameBootInvite = true; } diff --git a/Minecraft.Client/Platform/Common/Network/Sony/SQRNetworkManager.h b/Minecraft.Client/Platform/Common/Network/Sony/SQRNetworkManager.h index c93368d8b..58c5e4bfe 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/SQRNetworkManager.h +++ b/Minecraft.Client/Platform/Common/Network/Sony/SQRNetworkManager.h @@ -17,297 +17,324 @@ class ISQRNetworkManagerListener; class SonyVoiceChat; class C4JThread; -// This is the lowest level manager for providing network functionality on Sony platforms. This manages various network activities including the players within a gaming session. -// The game shouldn't directly use this class, it is here to provide functionality required by PlatformNetworkManagerSony. +// This is the lowest level manager for providing network functionality on Sony +// platforms. This manages various network activities including the players +// within a gaming session. The game shouldn't directly use this class, it is +// here to provide functionality required by PlatformNetworkManagerSony. -class SQRNetworkManager -{ +class SQRNetworkManager { public: - static const int MAX_LOCAL_PLAYER_COUNT = XUSER_MAX_COUNT; - static const int MAX_ONLINE_PLAYER_COUNT = MINECRAFT_NET_MAX_PLAYERS; + static const int MAX_LOCAL_PLAYER_COUNT = XUSER_MAX_COUNT; + static const int MAX_ONLINE_PLAYER_COUNT = MINECRAFT_NET_MAX_PLAYERS; + + static const int NP_POOL_SIZE = 128 * 1024; - static const int NP_POOL_SIZE = 128 * 1024; protected: - friend class SQRNetworkPlayer; - friend class SonyVoiceChat; + friend class SQRNetworkPlayer; + friend class SonyVoiceChat; - - static const int MAX_FRIENDS = 100; + static const int MAX_FRIENDS = 100; #ifdef __PS3__ - static const int RUDP_THREAD_PRIORITY = 999; -#else // __ORBIS_ - static const int RUDP_THREAD_PRIORITY = 500; + static const int RUDP_THREAD_PRIORITY = 999; +#else // __ORBIS_ + static const int RUDP_THREAD_PRIORITY = 500; #endif - static const int RUDP_THREAD_STACK_SIZE = 32878; - static const int MAX_SIMULTANEOUS_INVITES = 10; - + static const int RUDP_THREAD_STACK_SIZE = 32878; + static const int MAX_SIMULTANEOUS_INVITES = 10; - // This class stores everything about a player that must be synchronised between machines. This syncing is carried out - // by the Matching2 lib by using internal room binary data (ie data that is only visible to current members of a room) - class PlayerSyncData - { - public: - PlayerUID m_UID; // Assigned by the associated player->GetUID() - SceNpMatching2RoomMemberId m_roomMemberId; // Assigned by Matching2 lib, we can use to indicate which machine this player belongs to (note - 16 bits) - unsigned char m_smallId; // Assigned by SQRNetworkManager, to attach a permanent id to this player (until we have to wrap round), to match a similar concept in qnet - unsigned char m_localIdx : 4; // Which local player (by controller index) this represents - unsigned char m_playerCount : 4; - }; + // This class stores everything about a player that must be synchronised + // between machines. This syncing is carried out by the Matching2 lib by + // using internal room binary data (ie data that is only visible to current + // members of a room) + class PlayerSyncData { + public: + PlayerUID m_UID; // Assigned by the associated player->GetUID() + SceNpMatching2RoomMemberId + m_roomMemberId; // Assigned by Matching2 lib, we can use to + // indicate which machine this player belongs to + // (note - 16 bits) + unsigned char + m_smallId; // Assigned by SQRNetworkManager, to attach a permanent + // id to this player (until we have to wrap round), to + // match a similar concept in qnet + unsigned char m_localIdx + : 4; // Which local player (by controller index) this represents + unsigned char m_playerCount : 4; + }; - class RoomSyncData - { - public: - PlayerSyncData players[MAX_ONLINE_PLAYER_COUNT]; - void setPlayerCount(int c) { players[0].m_playerCount = c;} - int getPlayerCount() { return players[0].m_playerCount;} - }; + class RoomSyncData { + public: + PlayerSyncData players[MAX_ONLINE_PLAYER_COUNT]; + void setPlayerCount(int c) { players[0].m_playerCount = c; } + int getPlayerCount() { return players[0].m_playerCount; } + }; public: - class PresenceSyncInfo - { - public: - GameSessionUID hostPlayerUID; - SceNpMatching2RoomId m_RoomId; - SceNpMatching2ServerId m_ServerId; - unsigned int texturePackParentId; - unsigned short netVersion; - unsigned char subTexturePackId; - bool inviteOnly; - }; + class PresenceSyncInfo { + public: + GameSessionUID hostPlayerUID; + SceNpMatching2RoomId m_RoomId; + SceNpMatching2ServerId m_ServerId; + unsigned int texturePackParentId; + unsigned short netVersion; + unsigned char subTexturePackId; + bool inviteOnly; + }; + // Externally exposed state. All internal states are mapped to one of these + // broader states. + typedef enum { + SNM_STATE_INITIALISING, + SNM_STATE_INITIALISE_FAILED, + SNM_STATE_IDLE, - // Externally exposed state. All internal states are mapped to one of these broader states. - typedef enum - { - SNM_STATE_INITIALISING, - SNM_STATE_INITIALISE_FAILED, - SNM_STATE_IDLE, + SNM_STATE_HOSTING, + SNM_STATE_JOINING, - SNM_STATE_HOSTING, - SNM_STATE_JOINING, + SNM_STATE_STARTING, + SNM_STATE_PLAYING, - SNM_STATE_STARTING, - SNM_STATE_PLAYING, + SNM_STATE_LEAVING, + SNM_STATE_ENDING, + } eSQRNetworkManagerState; - SNM_STATE_LEAVING, - SNM_STATE_ENDING, - } eSQRNetworkManagerState; + struct SessionID { + SceNpMatching2RoomId m_RoomId; + SceNpMatching2ServerId m_ServerId; + }; - struct SessionID - { - SceNpMatching2RoomId m_RoomId; - SceNpMatching2ServerId m_ServerId; - }; - - struct SessionSearchResult - { - SceNpId m_NpId; - SessionID m_sessionId; - void *m_extData; + struct SessionSearchResult { + SceNpId m_NpId; + SessionID m_sessionId; + void* m_extData; #ifdef __PSVITA__ - SceNetInAddr m_netAddr; + SceNetInAddr m_netAddr; #endif - }; + }; protected: + // On initialisation, state should transition from + // SNM_INT_STATE_UNINITIALISED -> SNM_INT_STATE_SIGNING_IN -> + // SNM_INT_STATE_SIGNED_IN -> SNM_INT_STATE_STARTING_CONTEXT -> + // SNM_INT_STATE_IDLE. Error indicated if we transition at any point to + // SNM_INT_STATE_INITIALISE_FAILED. - // On initialisation, state should transition from SNM_INT_STATE_UNINITIALISED -> SNM_INT_STATE_SIGNING_IN -> SNM_INT_STATE_SIGNED_IN -> SNM_INT_STATE_STARTING_CONTEXT -> SNM_INT_STATE_IDLE. - // Error indicated if we transition at any point to SNM_INT_STATE_INITIALISE_FAILED. + // NOTE: If anything changes in here, then the mapping from internal -> + // external state needs to be updated (m_INTtoEXTStateMappings, defined in + // the cpp file) + typedef enum { + SNM_INT_STATE_UNINITIALISED, + SNM_INT_STATE_SIGNING_IN, + SNM_INT_STATE_STARTING_CONTEXT, + SNM_INT_STATE_INITIALISE_FAILED, - // NOTE: If anything changes in here, then the mapping from internal -> external state needs to be updated (m_INTtoEXTStateMappings, defined in the cpp file) - typedef enum - { - SNM_INT_STATE_UNINITIALISED, - SNM_INT_STATE_SIGNING_IN, - SNM_INT_STATE_STARTING_CONTEXT, - SNM_INT_STATE_INITIALISE_FAILED, + SNM_INT_STATE_IDLE, + SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT, - SNM_INT_STATE_IDLE, - SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT, + SNM_INT_STATE_HOSTING_STARTING_MATCHING_CONTEXT, + SNM_INT_STATE_HOSTING_SEARCHING_FOR_SERVER, + SNM_INT_STATE_HOSTING_SERVER_SEARCH_SERVER_ERROR, + SNM_INT_STATE_HOSTING_SERVER_FOUND, + SNM_INT_STATE_HOSTING_SERVER_SEARCH_CREATING_CONTEXT, + SNM_INT_STATE_HOSTING_SERVER_SEARCH_FAILED, - SNM_INT_STATE_HOSTING_STARTING_MATCHING_CONTEXT, - SNM_INT_STATE_HOSTING_SEARCHING_FOR_SERVER, - SNM_INT_STATE_HOSTING_SERVER_SEARCH_SERVER_ERROR, - SNM_INT_STATE_HOSTING_SERVER_FOUND, - SNM_INT_STATE_HOSTING_SERVER_SEARCH_CREATING_CONTEXT, - SNM_INT_STATE_HOSTING_SERVER_SEARCH_FAILED, + SNM_INT_STATE_HOSTING_CREATE_ROOM_SEARCHING_FOR_WORLD, + SNM_INT_STATE_HOSTING_CREATE_ROOM_WORLD_FOUND, + SNM_INT_STATE_HOSTING_CREATE_ROOM_CREATING_ROOM, + SNM_INT_STATE_HOSTING_CREATE_ROOM_SUCCESS, + SNM_INT_STATE_HOSTING_CREATE_ROOM_FAILED, + SNM_INT_STATE_HOSTING_CREATE_ROOM_RESTART_MATCHING_CONTEXT, + SNM_INT_STATE_HOSTING_WAITING_TO_PLAY, - SNM_INT_STATE_HOSTING_CREATE_ROOM_SEARCHING_FOR_WORLD, - SNM_INT_STATE_HOSTING_CREATE_ROOM_WORLD_FOUND, - SNM_INT_STATE_HOSTING_CREATE_ROOM_CREATING_ROOM, - SNM_INT_STATE_HOSTING_CREATE_ROOM_SUCCESS, - SNM_INT_STATE_HOSTING_CREATE_ROOM_FAILED, - SNM_INT_STATE_HOSTING_CREATE_ROOM_RESTART_MATCHING_CONTEXT, - SNM_INT_STATE_HOSTING_WAITING_TO_PLAY, + SNM_INT_STATE_JOINING_STARTING_MATCHING_CONTEXT, + SNM_INT_STATE_JOINING_SEARCHING_FOR_SERVER, + SNM_INT_STATE_JOINING_SERVER_SEARCH_SERVER_ERROR, + SNM_INT_STATE_JOINING_SERVER_FOUND, + SNM_INT_STATE_JOINING_SERVER_SEARCH_CREATING_CONTEXT, + SNM_INT_STATE_JOINING_SERVER_SEARCH_FAILED, - SNM_INT_STATE_JOINING_STARTING_MATCHING_CONTEXT, - SNM_INT_STATE_JOINING_SEARCHING_FOR_SERVER, - SNM_INT_STATE_JOINING_SERVER_SEARCH_SERVER_ERROR, - SNM_INT_STATE_JOINING_SERVER_FOUND, - SNM_INT_STATE_JOINING_SERVER_SEARCH_CREATING_CONTEXT, - SNM_INT_STATE_JOINING_SERVER_SEARCH_FAILED, + SNM_INT_STATE_JOINING_JOIN_ROOM, + SNM_INT_STATE_JOINING_JOIN_ROOM_FAILED, - SNM_INT_STATE_JOINING_JOIN_ROOM, - SNM_INT_STATE_JOINING_JOIN_ROOM_FAILED, + SNM_INT_STATE_JOINING_WAITING_FOR_LOCAL_PLAYERS, - SNM_INT_STATE_JOINING_WAITING_FOR_LOCAL_PLAYERS, + SNM_INT_STATE_SERVER_DELETING_CONTEXT, - SNM_INT_STATE_SERVER_DELETING_CONTEXT, + SNM_INT_STATE_STARTING, + SNM_INT_STATE_PLAYING, - SNM_INT_STATE_STARTING, - SNM_INT_STATE_PLAYING, + SNM_INT_STATE_LEAVING, + SNM_INT_STATE_LEAVING_FAILED, - SNM_INT_STATE_LEAVING, - SNM_INT_STATE_LEAVING_FAILED, + SNM_INT_STATE_ENDING, - SNM_INT_STATE_ENDING, + SNM_INT_STATE_COUNT - SNM_INT_STATE_COUNT - - } eSQRNetworkManagerInternalState; + } eSQRNetworkManagerInternalState; - typedef enum - { - SNM_FORCE_ERROR_NP2_INIT, - SNM_FORCE_ERROR_NET_INITIALIZE_NETWORK, - SNM_FORCE_ERROR_NET_CTL_INIT, - SNM_FORCE_ERROR_RUDP_INIT, - SNM_FORCE_ERROR_NET_START_DIALOG, - SNM_FORCE_ERROR_MATCHING2_INIT, - SNM_FORCE_ERROR_REGISTER_NP_CALLBACK, - SNM_FORCE_ERROR_GET_NPID, - SNM_FORCE_ERROR_CREATE_MATCHING_CONTEXT, - SNM_FORCE_ERROR_REGISTER_CALLBACKS, - SNM_FORCE_ERROR_CONTEXT_START_ASYNC, - SNM_FORCE_ERROR_SET_EXTERNAL_ROOM_DATA, - SNM_FORCE_ERROR_GET_FRIEND_LIST_ENTRY_COUNT, - SNM_FORCE_ERROR_GET_FRIEND_LIST_ENTRY, - SNM_FORCE_ERROR_GET_USER_INFO_LIST, - SNM_FORCE_ERROR_LEAVE_ROOM, - SNM_FORCE_ERROR_SET_ROOM_MEMBER_DATA_INTERNAL, - SNM_FORCE_ERROR_SET_ROOM_MEMBER_DATA_INTERNAL2, - SNM_FORCE_ERROR_CREATE_SERVER_CONTEXT, - SNM_FORCE_ERROR_CREATE_JOIN_ROOM, - SNM_FORCE_ERROR_GET_SERVER_INFO, - SNM_FORCE_ERROR_DELETE_SERVER_CONTEXT, - SNM_FORCE_ERROR_SETSOCKOPT_0, - SNM_FORCE_ERROR_SETSOCKOPT_1, - SNM_FORCE_ERROR_SETSOCKOPT_2, - SNM_FORCE_ERROR_SOCK_BIND, - SNM_FORCE_ERROR_CREATE_RUDP_CONTEXT, - SNM_FORCE_ERROR_RUDP_BIND, - SNM_FORCE_ERROR_RUDP_INIT2, - SNM_FORCE_ERROR_GET_ROOM_EXTERNAL_DATA, - SNM_FORCE_ERROR_GET_SERVER_INFO_DATA, - SNM_FORCE_ERROR_GET_WORLD_INFO_DATA, - SNM_FORCE_ERROR_GET_CREATE_JOIN_ROOM_DATA, - SNM_FORCE_ERROR_GET_USER_INFO_LIST_DATA, - SNM_FORCE_ERROR_GET_JOIN_ROOM_DATA, - SNM_FORCE_ERROR_GET_ROOM_MEMBER_DATA_INTERNAL, - SNM_FORCE_ERROR_GET_ROOM_EXTERNAL_DATA2, - SNM_FORCE_ERROR_CREATE_SERVER_CONTEXT_CALLBACK, - SNM_FORCE_ERROR_SET_ROOM_DATA_CALLBACK, - SNM_FORCE_ERROR_UPDATED_ROOM_DATA, - SNM_FORCE_ERROR_UPDATED_ROOM_MEMBER_DATA_INTERNAL1, - SNM_FORCE_ERROR_UPDATED_ROOM_MEMBER_DATA_INTERNAL2, - SNM_FORCE_ERROR_UPDATED_ROOM_MEMBER_DATA_INTERNAL3, - SNM_FORCE_ERROR_UPDATED_ROOM_MEMBER_DATA_INTERNAL4, - SNM_FORCE_ERROR_GET_WORLD_INFO_LIST, - SNM_FORCE_ERROR_JOIN_ROOM, + typedef enum { + SNM_FORCE_ERROR_NP2_INIT, + SNM_FORCE_ERROR_NET_INITIALIZE_NETWORK, + SNM_FORCE_ERROR_NET_CTL_INIT, + SNM_FORCE_ERROR_RUDP_INIT, + SNM_FORCE_ERROR_NET_START_DIALOG, + SNM_FORCE_ERROR_MATCHING2_INIT, + SNM_FORCE_ERROR_REGISTER_NP_CALLBACK, + SNM_FORCE_ERROR_GET_NPID, + SNM_FORCE_ERROR_CREATE_MATCHING_CONTEXT, + SNM_FORCE_ERROR_REGISTER_CALLBACKS, + SNM_FORCE_ERROR_CONTEXT_START_ASYNC, + SNM_FORCE_ERROR_SET_EXTERNAL_ROOM_DATA, + SNM_FORCE_ERROR_GET_FRIEND_LIST_ENTRY_COUNT, + SNM_FORCE_ERROR_GET_FRIEND_LIST_ENTRY, + SNM_FORCE_ERROR_GET_USER_INFO_LIST, + SNM_FORCE_ERROR_LEAVE_ROOM, + SNM_FORCE_ERROR_SET_ROOM_MEMBER_DATA_INTERNAL, + SNM_FORCE_ERROR_SET_ROOM_MEMBER_DATA_INTERNAL2, + SNM_FORCE_ERROR_CREATE_SERVER_CONTEXT, + SNM_FORCE_ERROR_CREATE_JOIN_ROOM, + SNM_FORCE_ERROR_GET_SERVER_INFO, + SNM_FORCE_ERROR_DELETE_SERVER_CONTEXT, + SNM_FORCE_ERROR_SETSOCKOPT_0, + SNM_FORCE_ERROR_SETSOCKOPT_1, + SNM_FORCE_ERROR_SETSOCKOPT_2, + SNM_FORCE_ERROR_SOCK_BIND, + SNM_FORCE_ERROR_CREATE_RUDP_CONTEXT, + SNM_FORCE_ERROR_RUDP_BIND, + SNM_FORCE_ERROR_RUDP_INIT2, + SNM_FORCE_ERROR_GET_ROOM_EXTERNAL_DATA, + SNM_FORCE_ERROR_GET_SERVER_INFO_DATA, + SNM_FORCE_ERROR_GET_WORLD_INFO_DATA, + SNM_FORCE_ERROR_GET_CREATE_JOIN_ROOM_DATA, + SNM_FORCE_ERROR_GET_USER_INFO_LIST_DATA, + SNM_FORCE_ERROR_GET_JOIN_ROOM_DATA, + SNM_FORCE_ERROR_GET_ROOM_MEMBER_DATA_INTERNAL, + SNM_FORCE_ERROR_GET_ROOM_EXTERNAL_DATA2, + SNM_FORCE_ERROR_CREATE_SERVER_CONTEXT_CALLBACK, + SNM_FORCE_ERROR_SET_ROOM_DATA_CALLBACK, + SNM_FORCE_ERROR_UPDATED_ROOM_DATA, + SNM_FORCE_ERROR_UPDATED_ROOM_MEMBER_DATA_INTERNAL1, + SNM_FORCE_ERROR_UPDATED_ROOM_MEMBER_DATA_INTERNAL2, + SNM_FORCE_ERROR_UPDATED_ROOM_MEMBER_DATA_INTERNAL3, + SNM_FORCE_ERROR_UPDATED_ROOM_MEMBER_DATA_INTERNAL4, + SNM_FORCE_ERROR_GET_WORLD_INFO_LIST, + SNM_FORCE_ERROR_JOIN_ROOM, - SNM_FORCE_ERROR_COUNT, - } eSQRForceError; + SNM_FORCE_ERROR_COUNT, + } eSQRForceError; + class StateChangeInfo { + public: + eSQRNetworkManagerState m_oldState; + eSQRNetworkManagerState m_newState; + bool m_idleReasonIsSessionFull; + StateChangeInfo(eSQRNetworkManagerState oldState, + eSQRNetworkManagerState newState, + bool idleReasonIsSessionFull) + : m_oldState(oldState), + m_newState(newState), + m_idleReasonIsSessionFull(idleReasonIsSessionFull) {} + }; - class StateChangeInfo - { - public: - eSQRNetworkManagerState m_oldState; - eSQRNetworkManagerState m_newState; - bool m_idleReasonIsSessionFull; - StateChangeInfo(eSQRNetworkManagerState oldState, eSQRNetworkManagerState newState,bool idleReasonIsSessionFull) : m_oldState(oldState), m_newState(newState), m_idleReasonIsSessionFull(idleReasonIsSessionFull) {} - }; + std::queue m_stateChangeQueue; + CRITICAL_SECTION m_csStateChangeQueue; + CRITICAL_SECTION m_csMatching; - std::queue m_stateChangeQueue; - CRITICAL_SECTION m_csStateChangeQueue; - CRITICAL_SECTION m_csMatching; + typedef enum { + SNM_FRIEND_SEARCH_STATE_IDLE, // Idle - search result will be valid + // (although it may not have any entries) + SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_COUNT, // Getting count of + // friends in friend list + SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_INFO, // Getting presence/NpId + // info for each friend + } eSQRNetworkManagerFriendSearchState; - typedef enum - { - SNM_FRIEND_SEARCH_STATE_IDLE, // Idle - search result will be valid (although it may not have any entries) - SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_COUNT, // Getting count of friends in friend list - SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_INFO, // Getting presence/NpId info for each friend - } eSQRNetworkManagerFriendSearchState; + typedef void (*ServerContextValidCallback)(SQRNetworkManager* manager); - typedef void (*ServerContextValidCallback)(SQRNetworkManager *manager); - - static bool s_safeToRespondToGameBootInvite; + static bool s_safeToRespondToGameBootInvite; public: - - // General - virtual void Tick() = 0; - virtual void Initialise() = 0; + // General + virtual void Tick() = 0; + virtual void Initialise() = 0; #ifdef __PSVITA__ - virtual void UnInitialise() = 0; // to switch from PSN to Adhoc - virtual bool IsInitialised() = 0; + virtual void UnInitialise() = 0; // to switch from PSN to Adhoc + virtual bool IsInitialised() = 0; #endif - virtual void Terminate() = 0; - virtual eSQRNetworkManagerState GetState() = 0; - virtual bool IsHost() = 0; - virtual bool IsReadyToPlayOrIdle() = 0; - virtual bool IsInSession() = 0; + virtual void Terminate() = 0; + virtual eSQRNetworkManagerState GetState() = 0; + virtual bool IsHost() = 0; + virtual bool IsReadyToPlayOrIdle() = 0; + virtual bool IsInSession() = 0; - // Session management - virtual void CreateAndJoinRoom(int hostIndex, int localPlayerMask, void *extData, int extDataSize, bool offline) = 0; - virtual void UpdateExternalRoomData() = 0; - virtual bool FriendRoomManagerIsBusy() = 0; - virtual bool FriendRoomManagerSearch() = 0; - virtual bool FriendRoomManagerSearch2() = 0; - virtual int FriendRoomManagerGetCount() = 0; - virtual void FriendRoomManagerGetRoomInfo(int idx, SessionSearchResult *searchResult) = 0; - virtual bool JoinRoom(SessionSearchResult *searchResult, int localPlayerMask) = 0; - virtual bool JoinRoom(SceNpMatching2RoomId roomId, SceNpMatching2ServerId serverId, int localPlayerMask, const SQRNetworkManager::PresenceSyncInfo *presence) = 0; - virtual void StartGame() = 0; - virtual void LeaveRoom(bool bActuallyLeaveRoom) = 0; - virtual void EndGame() = 0; - virtual bool SessionHasSpace(int spaceRequired) = 0; - virtual bool AddLocalPlayerByUserIndex(int idx) = 0; - virtual bool RemoveLocalPlayerByUserIndex(int idx) = 0; - virtual void SendInviteGUI() = 0; + // Session management + virtual void CreateAndJoinRoom(int hostIndex, int localPlayerMask, + void* extData, int extDataSize, + bool offline) = 0; + virtual void UpdateExternalRoomData() = 0; + virtual bool FriendRoomManagerIsBusy() = 0; + virtual bool FriendRoomManagerSearch() = 0; + virtual bool FriendRoomManagerSearch2() = 0; + virtual int FriendRoomManagerGetCount() = 0; + virtual void FriendRoomManagerGetRoomInfo( + int idx, SessionSearchResult* searchResult) = 0; + virtual bool JoinRoom(SessionSearchResult* searchResult, + int localPlayerMask) = 0; + virtual bool JoinRoom( + SceNpMatching2RoomId roomId, SceNpMatching2ServerId serverId, + int localPlayerMask, + const SQRNetworkManager::PresenceSyncInfo* presence) = 0; + virtual void StartGame() = 0; + virtual void LeaveRoom(bool bActuallyLeaveRoom) = 0; + virtual void EndGame() = 0; + virtual bool SessionHasSpace(int spaceRequired) = 0; + virtual bool AddLocalPlayerByUserIndex(int idx) = 0; + virtual bool RemoveLocalPlayerByUserIndex(int idx) = 0; + virtual void SendInviteGUI() = 0; - virtual void GetExtDataForRoom( SceNpMatching2RoomId roomId, void *extData, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ) = 0; + virtual void GetExtDataForRoom(SceNpMatching2RoomId roomId, void* extData, + void (*FriendSessionUpdatedFn)(bool success, + void* pParam), + void* pParam) = 0; - // Player retrieval - virtual int GetPlayerCount() = 0; - virtual int GetOnlinePlayerCount() = 0; - virtual SQRNetworkPlayer *GetPlayerByIndex(int idx) = 0; - virtual SQRNetworkPlayer *GetPlayerBySmallId(int idx) = 0; - virtual SQRNetworkPlayer *GetPlayerByXuid(PlayerUID xuid) = 0; - virtual SQRNetworkPlayer *GetLocalPlayerByUserIndex(int idx) = 0; - virtual SQRNetworkPlayer *GetHostPlayer() = 0; + // Player retrieval + virtual int GetPlayerCount() = 0; + virtual int GetOnlinePlayerCount() = 0; + virtual SQRNetworkPlayer* GetPlayerByIndex(int idx) = 0; + virtual SQRNetworkPlayer* GetPlayerBySmallId(int idx) = 0; + virtual SQRNetworkPlayer* GetPlayerByXuid(PlayerUID xuid) = 0; + virtual SQRNetworkPlayer* GetLocalPlayerByUserIndex(int idx) = 0; + virtual SQRNetworkPlayer* GetHostPlayer() = 0; - virtual void SetPresenceDataStartHostingGame() = 0; - virtual int GetJoiningReadyPercentage() = 0; + virtual void SetPresenceDataStartHostingGame() = 0; + virtual int GetJoiningReadyPercentage() = 0; - virtual void LocalDataSend(SQRNetworkPlayer *playerFrom, SQRNetworkPlayer *playerTo, const void *data, unsigned int dataSize) = 0; - virtual int GetSessionIndex(SQRNetworkPlayer *player) = 0; - - static void SafeToRespondToGameBootInvite(); + virtual void LocalDataSend(SQRNetworkPlayer* playerFrom, + SQRNetworkPlayer* playerTo, const void* data, + unsigned int dataSize) = 0; + virtual int GetSessionIndex(SQRNetworkPlayer* player) = 0; + static void SafeToRespondToGameBootInvite(); }; - // Class defining interface to be implemented for class that handles callbacks -class ISQRNetworkManagerListener -{ +class ISQRNetworkManagerListener { public: - virtual void HandleDataReceived(SQRNetworkPlayer *playerFrom, SQRNetworkPlayer *playerTo, unsigned char *data, unsigned int dataSize) = 0; - virtual void HandlePlayerJoined(SQRNetworkPlayer *player) = 0; - virtual void HandlePlayerLeaving(SQRNetworkPlayer *player) = 0; - virtual void HandleStateChange(SQRNetworkManager::eSQRNetworkManagerState oldState, SQRNetworkManager::eSQRNetworkManagerState newState, bool idleReasonIsSessionFull) = 0; - virtual void HandleResyncPlayerRequest(SQRNetworkPlayer **aPlayers) = 0; - virtual void HandleAddLocalPlayerFailed(int idx) = 0; - virtual void HandleDisconnect(bool bLostRoomOnly,bool bPSNSignOut=false) = 0; - virtual void HandleInviteReceived( int userIndex, const SQRNetworkManager::PresenceSyncInfo *pInviteInfo) = 0; + virtual void HandleDataReceived(SQRNetworkPlayer* playerFrom, + SQRNetworkPlayer* playerTo, + unsigned char* data, + unsigned int dataSize) = 0; + virtual void HandlePlayerJoined(SQRNetworkPlayer* player) = 0; + virtual void HandlePlayerLeaving(SQRNetworkPlayer* player) = 0; + virtual void HandleStateChange( + SQRNetworkManager::eSQRNetworkManagerState oldState, + SQRNetworkManager::eSQRNetworkManagerState newState, + bool idleReasonIsSessionFull) = 0; + virtual void HandleResyncPlayerRequest(SQRNetworkPlayer** aPlayers) = 0; + virtual void HandleAddLocalPlayerFailed(int idx) = 0; + virtual void HandleDisconnect(bool bLostRoomOnly, + bool bPSNSignOut = false) = 0; + virtual void HandleInviteReceived( + int userIndex, + const SQRNetworkManager::PresenceSyncInfo* pInviteInfo) = 0; }; diff --git a/Minecraft.Client/Platform/Common/Network/Sony/SQRNetworkPlayer.cpp b/Minecraft.Client/Platform/Common/Network/Sony/SQRNetworkPlayer.cpp index 365e3e654..f0c86bbbf 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/SQRNetworkPlayer.cpp +++ b/Minecraft.Client/Platform/Common/Network/Sony/SQRNetworkPlayer.cpp @@ -9,391 +9,360 @@ #include #include "../../../../Platform/Orbis/Network/SonyVoiceChat_Orbis.h" -#else // __PSVITA__ +#else // __PSVITA__ #include #include #include "../../../../Platform/PSVita/Network/SonyVoiceChat_Vita.h" #endif - static const bool sc_verbose = false; -int SQRNetworkPlayer::GetSmallId() -{ - return m_ISD.m_smallId; +int SQRNetworkPlayer::GetSmallId() { return m_ISD.m_smallId; } + +wchar_t* SQRNetworkPlayer::GetName() { return m_name; } + +bool SQRNetworkPlayer::IsRemote() { return !IsLocal(); } + +bool SQRNetworkPlayer::IsHost() { return (m_type == SNP_TYPE_HOST); } + +bool SQRNetworkPlayer::IsLocal() { + // m_host determines whether this *machine* is hosting the game, not this + // player (which is determined by m_type) + if (m_host) { + // If we are the hosting machine, then both the host & local players are + // local to this machine + return (m_type == SNP_TYPE_HOST) || (m_type == SNP_TYPE_LOCAL); + } else { + // Not hosting, just local players are actually physically local + return (m_type == SNP_TYPE_LOCAL); + } } -wchar_t *SQRNetworkPlayer::GetName() -{ - return m_name; +int SQRNetworkPlayer::GetLocalPlayerIndex() { return m_localPlayerIdx; } + +bool SQRNetworkPlayer::IsSameSystem(SQRNetworkPlayer* other) { + return (m_roomMemberId == other->m_roomMemberId); } -bool SQRNetworkPlayer::IsRemote() -{ - return !IsLocal(); +uintptr_t SQRNetworkPlayer::GetCustomDataValue() { return m_customData; } + +void SQRNetworkPlayer::SetCustomDataValue(uintptr_t data) { + m_customData = data; } -bool SQRNetworkPlayer::IsHost() -{ - return (m_type == SNP_TYPE_HOST); -} - -bool SQRNetworkPlayer::IsLocal() -{ - // m_host determines whether this *machine* is hosting the game, not this player (which is determined by m_type) - if( m_host ) - { - // If we are the hosting machine, then both the host & local players are local to this machine - return (m_type == SNP_TYPE_HOST) || (m_type == SNP_TYPE_LOCAL); - } - else - { - // Not hosting, just local players are actually physically local - return (m_type == SNP_TYPE_LOCAL) ; - } -} - -int SQRNetworkPlayer::GetLocalPlayerIndex() -{ - return m_localPlayerIdx; -} - -bool SQRNetworkPlayer::IsSameSystem(SQRNetworkPlayer *other) -{ - return (m_roomMemberId == other->m_roomMemberId); -} - -uintptr_t SQRNetworkPlayer::GetCustomDataValue() -{ - return m_customData; -} - -void SQRNetworkPlayer::SetCustomDataValue(uintptr_t data) -{ - m_customData = data; -} - -SQRNetworkPlayer::SQRNetworkPlayer(SQRNetworkManager *manager, eSQRNetworkPlayerType playerType, bool onHost, SceNpMatching2RoomMemberId roomMemberId, int localPlayerIdx, int rudpCtx, PlayerUID *pUID) -{ - m_roomMemberId = roomMemberId; - m_localPlayerIdx = localPlayerIdx; - m_rudpCtx = rudpCtx; - m_flags = 0; - m_type = playerType; - m_host = onHost; - m_manager = manager; - m_customData = 0; - if( pUID ) - { - memcpy(&m_ISD.m_UID,pUID,sizeof(PlayerUID)); +SQRNetworkPlayer::SQRNetworkPlayer(SQRNetworkManager* manager, + eSQRNetworkPlayerType playerType, + bool onHost, + SceNpMatching2RoomMemberId roomMemberId, + int localPlayerIdx, int rudpCtx, + PlayerUID* pUID) { + m_roomMemberId = roomMemberId; + m_localPlayerIdx = localPlayerIdx; + m_rudpCtx = rudpCtx; + m_flags = 0; + m_type = playerType; + m_host = onHost; + m_manager = manager; + m_customData = 0; + if (pUID) { + memcpy(&m_ISD.m_UID, pUID, sizeof(PlayerUID)); #ifdef __PSVITA__ - if(CGameNetworkManager::usingAdhocMode() && pUID->getOnlineID()[0] == 0) - { - assert(localPlayerIdx == 0); - // player doesn't have an online UID, set it from the player name - m_ISD.m_UID.setForAdhoc(); - } -#endif // __PSVITA__ - } - else - { - memset(&m_ISD.m_UID,0,sizeof(PlayerUID)); - } - SetNameFromUID(); - InitializeCriticalSection(&m_csQueue); + if (CGameNetworkManager::usingAdhocMode() && + pUID->getOnlineID()[0] == 0) { + assert(localPlayerIdx == 0); + // player doesn't have an online UID, set it from the player name + m_ISD.m_UID.setForAdhoc(); + } +#endif // __PSVITA__ + } else { + memset(&m_ISD.m_UID, 0, sizeof(PlayerUID)); + } + SetNameFromUID(); + InitializeCriticalSection(&m_csQueue); #ifdef __ORBIS__ - if(IsLocal()) - { - SonyVoiceChat_Orbis::initLocalPlayer(m_localPlayerIdx); - } + if (IsLocal()) { + SonyVoiceChat_Orbis::initLocalPlayer(m_localPlayerIdx); + } #endif - } -SQRNetworkPlayer::~SQRNetworkPlayer() -{ +SQRNetworkPlayer::~SQRNetworkPlayer() { #ifdef __ORBIS__ - SQRNetworkManager_Orbis* pMan = (SQRNetworkManager_Orbis*)m_manager; + SQRNetworkManager_Orbis* pMan = (SQRNetworkManager_Orbis*)m_manager; // pMan->removePlayerFromVoiceChat(this); // m_roomMemberId = -1; #endif - DeleteCriticalSection(&m_csQueue); + DeleteCriticalSection(&m_csQueue); } -bool SQRNetworkPlayer::IsReady() -{ - return ( ( m_flags & SNP_FLAG_READY_MASK ) == SNP_FLAG_READY_MASK ); -} - -PlayerUID SQRNetworkPlayer::GetUID() -{ - return m_ISD.m_UID; +bool SQRNetworkPlayer::IsReady() { + return ((m_flags & SNP_FLAG_READY_MASK) == SNP_FLAG_READY_MASK); } -void SQRNetworkPlayer::SetUID(PlayerUID UID) -{ - m_ISD.m_UID = UID; - SetNameFromUID(); +PlayerUID SQRNetworkPlayer::GetUID() { return m_ISD.m_UID; } + +void SQRNetworkPlayer::SetUID(PlayerUID UID) { + m_ISD.m_UID = UID; + SetNameFromUID(); } -bool SQRNetworkPlayer::HasConnectionAndSmallId() -{ - const int reqFlags = ( SNP_FLAG_CONNECTION_COMPLETE | SNP_FLAG_SMALLID_ALLOCATED ); - return (( m_flags & reqFlags) == reqFlags); +bool SQRNetworkPlayer::HasConnectionAndSmallId() { + const int reqFlags = + (SNP_FLAG_CONNECTION_COMPLETE | SNP_FLAG_SMALLID_ALLOCATED); + return ((m_flags & reqFlags) == reqFlags); } -void SQRNetworkPlayer::ConnectionComplete() -{ - m_host ? app.DebugPrintf(sc_verbose, "host : ") : app.DebugPrintf(sc_verbose, "client:"); - app.DebugPrintf(sc_verbose, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ConnectionComplete\n"); - m_flags |= SNP_FLAG_CONNECTION_COMPLETE; +void SQRNetworkPlayer::ConnectionComplete() { + m_host ? app.DebugPrintf(sc_verbose, "host : ") + : app.DebugPrintf(sc_verbose, "client:"); + app.DebugPrintf(sc_verbose, + ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + ">> ConnectionComplete\n"); + m_flags |= SNP_FLAG_CONNECTION_COMPLETE; } -void SQRNetworkPlayer::SmallIdAllocated(unsigned char smallId) -{ - m_ISD.m_smallId = smallId; - m_flags |= SNP_FLAG_SMALLID_ALLOCATED; - m_host ? app.DebugPrintf(sc_verbose, "host : ") : app.DebugPrintf(sc_verbose, "client:"); - app.DebugPrintf(sc_verbose, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Small ID allocated\n"); +void SQRNetworkPlayer::SmallIdAllocated(unsigned char smallId) { + m_ISD.m_smallId = smallId; + m_flags |= SNP_FLAG_SMALLID_ALLOCATED; + m_host ? app.DebugPrintf(sc_verbose, "host : ") + : app.DebugPrintf(sc_verbose, "client:"); + app.DebugPrintf(sc_verbose, + ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + ">> Small ID allocated\n"); + // If this is a non-network sort of player then flag now as having its small + // id confirmed + if ((m_type == SNP_TYPE_HOST) || (m_host && (m_type == SNP_TYPE_LOCAL)) || + (!m_host && (m_type == SNP_TYPE_REMOTE))) { + m_host ? app.DebugPrintf(sc_verbose, "host : ") + : app.DebugPrintf(sc_verbose, "client:"); + app.DebugPrintf(sc_verbose, + ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + ">>>>>> Small ID confirmed\n"); - // If this is a non-network sort of player then flag now as having its small id confirmed - if( ( m_type == SNP_TYPE_HOST ) || - ( m_host && ( m_type == SNP_TYPE_LOCAL ) ) || - ( !m_host && ( m_type == SNP_TYPE_REMOTE ) ) ) - { - m_host ? app.DebugPrintf(sc_verbose, "host : ") : app.DebugPrintf(sc_verbose, "client:"); - app.DebugPrintf(sc_verbose, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Small ID confirmed\n"); - - m_flags |= SNP_FLAG_SMALLID_CONFIRMED; - } + m_flags |= SNP_FLAG_SMALLID_CONFIRMED; + } } -void SQRNetworkPlayer::InitialDataReceived(SQRNetworkPlayer::InitSendData *ISD) -{ - assert(m_ISD.m_smallId == ISD->m_smallId); - memcpy(&m_ISD, ISD, sizeof(InitSendData) ); +void SQRNetworkPlayer::InitialDataReceived( + SQRNetworkPlayer::InitSendData* ISD) { + assert(m_ISD.m_smallId == ISD->m_smallId); + memcpy(&m_ISD, ISD, sizeof(InitSendData)); #ifdef __PSVITA__ - SetNameFromUID(); + SetNameFromUID(); #endif - m_host ? app.DebugPrintf(sc_verbose, "host : ") : app.DebugPrintf(sc_verbose, "client:"); - app.DebugPrintf(sc_verbose, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Small ID confirmed\n"); - m_flags |= SNP_FLAG_SMALLID_CONFIRMED; + m_host ? app.DebugPrintf(sc_verbose, "host : ") + : app.DebugPrintf(sc_verbose, "client:"); + app.DebugPrintf(sc_verbose, + ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + ">> Small ID confirmed\n"); + m_flags |= SNP_FLAG_SMALLID_CONFIRMED; } -bool SQRNetworkPlayer::HasSmallIdConfirmed() -{ - return ( m_flags & SNP_FLAG_SMALLID_CONFIRMED ); +bool SQRNetworkPlayer::HasSmallIdConfirmed() { + return (m_flags & SNP_FLAG_SMALLID_CONFIRMED); } -// To confirm to the host that we are ready, send a single byte with our small id. -void SQRNetworkPlayer::ConfirmReady() -{ +// To confirm to the host that we are ready, send a single byte with our small +// id. +void SQRNetworkPlayer::ConfirmReady() { #ifdef __PS3__ - int ret = cellRudpWrite( m_rudpCtx, &m_ISD, sizeof(InitSendData), CELL_RUDP_MSG_LATENCY_CRITICAL ); -#else //__ORBIS__ - int ret = sceRudpWrite( m_rudpCtx, &m_ISD, sizeof(InitSendData), SCE_RUDP_MSG_LATENCY_CRITICAL ); + int ret = cellRudpWrite(m_rudpCtx, &m_ISD, sizeof(InitSendData), + CELL_RUDP_MSG_LATENCY_CRITICAL); +#else //__ORBIS__ + int ret = sceRudpWrite(m_rudpCtx, &m_ISD, sizeof(InitSendData), + SCE_RUDP_MSG_LATENCY_CRITICAL); #endif - // TODO - error handling here? - assert ( ret == sizeof(InitSendData) ); - // Final flag for a local player on the client, as we are now safe to send data on to the host - m_host ? app.DebugPrintf(sc_verbose, "host : ") : app.DebugPrintf(sc_verbose, "client:"); - app.DebugPrintf(sc_verbose, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Small ID confirmed\n"); - m_flags |= SNP_FLAG_SMALLID_CONFIRMED; + // TODO - error handling here? + assert(ret == sizeof(InitSendData)); + // Final flag for a local player on the client, as we are now safe to send + // data on to the host + m_host ? app.DebugPrintf(sc_verbose, "host : ") + : app.DebugPrintf(sc_verbose, "client:"); + app.DebugPrintf(sc_verbose, + ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + ">> Small ID confirmed\n"); + m_flags |= SNP_FLAG_SMALLID_CONFIRMED; } -// Attempt to send data, of any size, from this player to that specified by pPlayerTarget. This may not be possible depending on the two players, due to -// our star shaped network connectivity. Data may be any size, and is copied so on returning from this method it does not need to be preserved. -void SQRNetworkPlayer::SendData( SQRNetworkPlayer *pPlayerTarget, const void *data, unsigned int dataSize ) -{ - // Our network is connected as a star. If we are the host, then we can send to any remote player. If we're a client, we can send only to the host. - // The host can also send to other local players, but this doesn't need to go through Rudp. - if( m_host ) - { - if( ( m_type == SNP_TYPE_HOST ) && ( pPlayerTarget->m_type == SNP_TYPE_LOCAL ) ) - { - // Special internal communication from host to local player - m_manager->LocalDataSend( this, pPlayerTarget, data, dataSize ); - } - else if( ( m_type == SNP_TYPE_LOCAL ) && ( pPlayerTarget->m_type == SNP_TYPE_HOST ) ) - { - // Special internal communication from local player to host - m_manager->LocalDataSend( this, pPlayerTarget, data, dataSize ); - } - else if( ( m_type == SNP_TYPE_HOST ) && ( pPlayerTarget->m_type == SNP_TYPE_REMOTE ) ) - { - // Rudp communication from host to remote player - handled by remote player instance - pPlayerTarget->SendInternal(data,dataSize); - } - else - { - // Can't do any other types of communications - assert(false); - } - } - else - { - if( ( m_type == SNP_TYPE_LOCAL ) && ( pPlayerTarget->m_type == SNP_TYPE_HOST ) ) - { - // Rudp communication from client to host - handled by this player instace - SendInternal(data, dataSize); - } - else - { - // Can't do any other types of communications - assert(false); - } - } +// Attempt to send data, of any size, from this player to that specified by +// pPlayerTarget. This may not be possible depending on the two players, due to +// our star shaped network connectivity. Data may be any size, and is copied so +// on returning from this method it does not need to be preserved. +void SQRNetworkPlayer::SendData(SQRNetworkPlayer* pPlayerTarget, + const void* data, unsigned int dataSize) { + // Our network is connected as a star. If we are the host, then we can send + // to any remote player. If we're a client, we can send only to the host. + // The host can also send to other local players, but this doesn't need to + // go through Rudp. + if (m_host) { + if ((m_type == SNP_TYPE_HOST) && + (pPlayerTarget->m_type == SNP_TYPE_LOCAL)) { + // Special internal communication from host to local player + m_manager->LocalDataSend(this, pPlayerTarget, data, dataSize); + } else if ((m_type == SNP_TYPE_LOCAL) && + (pPlayerTarget->m_type == SNP_TYPE_HOST)) { + // Special internal communication from local player to host + m_manager->LocalDataSend(this, pPlayerTarget, data, dataSize); + } else if ((m_type == SNP_TYPE_HOST) && + (pPlayerTarget->m_type == SNP_TYPE_REMOTE)) { + // Rudp communication from host to remote player - handled by remote + // player instance + pPlayerTarget->SendInternal(data, dataSize); + } else { + // Can't do any other types of communications + assert(false); + } + } else { + if ((m_type == SNP_TYPE_LOCAL) && + (pPlayerTarget->m_type == SNP_TYPE_HOST)) { + // Rudp communication from client to host - handled by this player + // instace + SendInternal(data, dataSize); + } else { + // Can't do any other types of communications + assert(false); + } + } } -// Internal send function - to simplify the number of mechanisms we have for sending data, this method just adds the data to be send to the player's internal queue, -// and then calls SendMoreInternal. This method can take any size of data, which it will split up into payload size chunks before sending. All input data is copied -// into internal buffers. -void SQRNetworkPlayer::SendInternal(const void *data, unsigned int dataSize) -{ - EnterCriticalSection(&m_csQueue); +// Internal send function - to simplify the number of mechanisms we have for +// sending data, this method just adds the data to be send to the player's +// internal queue, and then calls SendMoreInternal. This method can take any +// size of data, which it will split up into payload size chunks before sending. +// All input data is copied into internal buffers. +void SQRNetworkPlayer::SendInternal(const void* data, unsigned int dataSize) { + EnterCriticalSection(&m_csQueue); - QueuedSendBlock sendBlock; + QueuedSendBlock sendBlock; - unsigned char *dataCurrent = (unsigned char *)data; - unsigned int dataRemaining = dataSize; + unsigned char* dataCurrent = (unsigned char*)data; + unsigned int dataRemaining = dataSize; - while( dataRemaining ) - { - int dataSize = dataRemaining; - if( dataSize > SNP_MAX_PAYLOAD ) dataSize = SNP_MAX_PAYLOAD; - sendBlock.start = new unsigned char [dataSize]; - sendBlock.end = sendBlock.start + dataSize; - sendBlock.current = sendBlock.start; - memcpy( sendBlock.start, dataCurrent, dataSize); - m_sendQueue.push(sendBlock); - dataRemaining -= dataSize; - dataCurrent += dataSize; - } + while (dataRemaining) { + int dataSize = dataRemaining; + if (dataSize > SNP_MAX_PAYLOAD) dataSize = SNP_MAX_PAYLOAD; + sendBlock.start = new unsigned char[dataSize]; + sendBlock.end = sendBlock.start + dataSize; + sendBlock.current = sendBlock.start; + memcpy(sendBlock.start, dataCurrent, dataSize); + m_sendQueue.push(sendBlock); + dataRemaining -= dataSize; + dataCurrent += dataSize; + } - // Now try and send as much as we can - SendMoreInternal(); + // Now try and send as much as we can + SendMoreInternal(); - LeaveCriticalSection(&m_csQueue); + LeaveCriticalSection(&m_csQueue); } - - - -// Internal send function. This attempts to send as many elements in the queue as possible until the write function tells us that we can't send any more. This way, -// we are guaranteed that if there *is* anything more in the queue left to send, we'll get a CELL_RUDP_CONTEXT_EVENT_WRITABLE event when whatever we've managed to -// send here is complete, and can continue on. -void SQRNetworkPlayer::SendMoreInternal() -{ - EnterCriticalSection(&m_csQueue); - bool keepSending; - do - { - keepSending = false; - if( m_sendQueue.size() > 0) - { - // Attempt to send the full data in the first element in our queue - unsigned char *data= m_sendQueue.front().current; - int dataSize = m_sendQueue.front().end - m_sendQueue.front().current; +// Internal send function. This attempts to send as many elements in the queue +// as possible until the write function tells us that we can't send any more. +// This way, we are guaranteed that if there *is* anything more in the queue +// left to send, we'll get a CELL_RUDP_CONTEXT_EVENT_WRITABLE event when +// whatever we've managed to send here is complete, and can continue on. +void SQRNetworkPlayer::SendMoreInternal() { + EnterCriticalSection(&m_csQueue); + bool keepSending; + do { + keepSending = false; + if (m_sendQueue.size() > 0) { + // Attempt to send the full data in the first element in our queue + unsigned char* data = m_sendQueue.front().current; + int dataSize = + m_sendQueue.front().end - m_sendQueue.front().current; #ifdef __PS3__ - int ret = cellRudpWrite( m_rudpCtx, data, dataSize, 0);//CELL_RUDP_MSG_LATENCY_CRITICAL ); - int wouldBlockFlag = CELL_RUDP_ERROR_WOULDBLOCK; + int ret = cellRudpWrite(m_rudpCtx, data, dataSize, + 0); // CELL_RUDP_MSG_LATENCY_CRITICAL ); + int wouldBlockFlag = CELL_RUDP_ERROR_WOULDBLOCK; -#else // __ORBIS__ - int ret = sceRudpWrite( m_rudpCtx, data, dataSize, 0);//CELL_RUDP_MSG_LATENCY_CRITICAL ); - int wouldBlockFlag = SCE_RUDP_ERROR_WOULDBLOCK; +#else // __ORBIS__ + int ret = sceRudpWrite(m_rudpCtx, data, dataSize, + 0); // CELL_RUDP_MSG_LATENCY_CRITICAL ); + int wouldBlockFlag = SCE_RUDP_ERROR_WOULDBLOCK; #endif - if( ret == dataSize ) - { - // Fully sent, remove from queue - will loop in the while loop to see if there's anything else in the queue we could send - delete [] m_sendQueue.front().start; - m_sendQueue.pop(); - if( m_sendQueue.size() ) - { - keepSending = true; - } - } - else if( ( ret >= 0 ) || ( ret == wouldBlockFlag ) ) - { - - - // Things left to send - adjust this element in the queue - int remainingBytes; - if( ret >= 0 ) - { - // Only ret bytes sent so far - remainingBytes = dataSize - ret; - assert(remainingBytes > 0 ); - } - else - { - // Is CELL_RUDP_ERROR_WOULDBLOCK, nothing has yet been sent - remainingBytes = dataSize; - } - m_sendQueue.front().current = m_sendQueue.front().end - remainingBytes; - } - } - } while (keepSending); - LeaveCriticalSection(&m_csQueue); + if (ret == dataSize) { + // Fully sent, remove from queue - will loop in the while loop + // to see if there's anything else in the queue we could send + delete[] m_sendQueue.front().start; + m_sendQueue.pop(); + if (m_sendQueue.size()) { + keepSending = true; + } + } else if ((ret >= 0) || (ret == wouldBlockFlag)) { + // Things left to send - adjust this element in the queue + int remainingBytes; + if (ret >= 0) { + // Only ret bytes sent so far + remainingBytes = dataSize - ret; + assert(remainingBytes > 0); + } else { + // Is CELL_RUDP_ERROR_WOULDBLOCK, nothing has yet been sent + remainingBytes = dataSize; + } + m_sendQueue.front().current = + m_sendQueue.front().end - remainingBytes; + } + } + } while (keepSending); + LeaveCriticalSection(&m_csQueue); } -void SQRNetworkPlayer::SetNameFromUID() -{ - mbstowcs(m_name, m_ISD.m_UID.getOnlineID(), 16); - m_name[16] = 0; -#ifdef __PS3__ // only 1 player on vita, and they have to be online (or adhoc), and with PS4 all local players need to be signed in - // Not an online player? Add a suffix with the controller ID on - if( m_ISD.m_UID.isSignedIntoPSN() == 0) - { - int pos = wcslen(m_name); - swprintf(&m_name[pos], 5, L" (%d)", m_ISD.m_UID.getQuadrant() + 1 ); - } +void SQRNetworkPlayer::SetNameFromUID() { + mbstowcs(m_name, m_ISD.m_UID.getOnlineID(), 16); + m_name[16] = 0; +#ifdef __PS3__ // only 1 player on vita, and they have to be online (or adhoc), + // and with PS4 all local players need to be signed in + // Not an online player? Add a suffix with the controller ID on + if (m_ISD.m_UID.isSignedIntoPSN() == 0) { + int pos = wcslen(m_name); + swprintf(&m_name[pos], 5, L" (%d)", m_ISD.m_UID.getQuadrant() + 1); + } #endif } -void SQRNetworkPlayer::SetName(char *name) -{ - mbstowcs(m_name, name, 20); - m_name[20] = 0; +void SQRNetworkPlayer::SetName(char* name) { + mbstowcs(m_name, name, 20); + m_name[20] = 0; } -int SQRNetworkPlayer::GetSessionIndex() -{ - return m_manager->GetSessionIndex(this); +int SQRNetworkPlayer::GetSessionIndex() { + return m_manager->GetSessionIndex(this); } -bool SQRNetworkPlayer::HasVoice() -{ +bool SQRNetworkPlayer::HasVoice() { #ifdef __ORBIS__ - return SonyVoiceChat_Orbis::hasMicConnected(this); + return SonyVoiceChat_Orbis::hasMicConnected(this); #elif defined __PSVITA__ - return SonyVoiceChat_Vita::hasMicConnected(this); + return SonyVoiceChat_Vita::hasMicConnected(this); #else - return SonyVoiceChat::hasMicConnected(&m_roomMemberId); + return SonyVoiceChat::hasMicConnected(&m_roomMemberId); #endif } -bool SQRNetworkPlayer::IsTalking() -{ +bool SQRNetworkPlayer::IsTalking() { #ifdef __ORBIS__ - return SonyVoiceChat_Orbis::isTalking(this); + return SonyVoiceChat_Orbis::isTalking(this); #elif defined __PSVITA__ - return SonyVoiceChat_Vita::isTalking(this); + return SonyVoiceChat_Vita::isTalking(this); #else - return SonyVoiceChat::isTalking(&m_roomMemberId); + return SonyVoiceChat::isTalking(&m_roomMemberId); #endif } -bool SQRNetworkPlayer::IsMutedByLocalUser(int userIndex) -{ +bool SQRNetworkPlayer::IsMutedByLocalUser(int userIndex) { #ifdef __ORBIS__ -// assert(0); // this is never called, so isn't implemented in the PS4 voice stuff at the moment - return false; + // assert(0); // this is never called, so isn't implemented in the PS4 + // voice stuff at the moment + return false; #elif defined __PSVITA__ - return false;// this is never called, so isn't implemented in the Vita voice stuff at the moment + return false; // this is never called, so isn't implemented in the Vita + // voice stuff at the moment #else - SQRNetworkManager_PS3* pMan = (SQRNetworkManager_PS3*)m_manager; - return SonyVoiceChat::isMutedPlayer(pMan->m_roomSyncData.players[userIndex].m_roomMemberId); + SQRNetworkManager_PS3* pMan = (SQRNetworkManager_PS3*)m_manager; + return SonyVoiceChat::isMutedPlayer( + pMan->m_roomSyncData.players[userIndex].m_roomMemberId); #endif } diff --git a/Minecraft.Client/Platform/Common/Network/Sony/SQRNetworkPlayer.h b/Minecraft.Client/Platform/Common/Network/Sony/SQRNetworkPlayer.h index 0cd56e8d6..8610e4417 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/SQRNetworkPlayer.h +++ b/Minecraft.Client/Platform/Common/Network/Sony/SQRNetworkPlayer.h @@ -2,102 +2,139 @@ #include "SQRNetworkManager.h" #include -// This is the lowest level class for handling the concept of a player on Sony platforms. This is managed by SQRNetworkManager. The game shouldn't directly communicate -// with this class, as it is wrapped by NetworkPlayerSony which is an implementation of a platform-independent interface INetworkPlayer. +// This is the lowest level class for handling the concept of a player on Sony +// platforms. This is managed by SQRNetworkManager. The game shouldn't directly +// communicate with this class, as it is wrapped by NetworkPlayerSony which is +// an implementation of a platform-independent interface INetworkPlayer. -class SQRNetworkPlayer -{ +class SQRNetworkPlayer { #ifdef __ORBIS__ - friend class SQRNetworkManager_Orbis; - friend class SonyVoiceChat_Orbis; + friend class SQRNetworkManager_Orbis; + friend class SonyVoiceChat_Orbis; #elif defined __PS3__ - friend class SQRNetworkManager_PS3; -#else // __PSVITA__ - friend class SQRNetworkManager_Vita; - friend class SQRNetworkManager_AdHoc_Vita; - friend class SonyVoiceChat_Vita; + friend class SQRNetworkManager_PS3; +#else // __PSVITA__ + friend class SQRNetworkManager_Vita; + friend class SQRNetworkManager_AdHoc_Vita; + friend class SonyVoiceChat_Vita; #endif - friend class SQRNetworkManager; - friend class NetworkPlayerSony; - friend class CPlatformNetworkManagerSony; + friend class SQRNetworkManager; + friend class NetworkPlayerSony; + friend class CPlatformNetworkManagerSony; - int GetSmallId(); - wchar_t *GetName(); - bool IsRemote(); - bool IsHost(); - bool IsLocal(); - int GetLocalPlayerIndex(); - bool IsSameSystem(SQRNetworkPlayer *other); - uintptr_t GetCustomDataValue(); - void SetCustomDataValue(uintptr_t data); - bool HasVoice(); - bool IsTalking(); - bool IsMutedByLocalUser(int userIndex); + int GetSmallId(); + wchar_t* GetName(); + bool IsRemote(); + bool IsHost(); + bool IsLocal(); + int GetLocalPlayerIndex(); + bool IsSameSystem(SQRNetworkPlayer* other); + uintptr_t GetCustomDataValue(); + void SetCustomDataValue(uintptr_t data); + bool HasVoice(); + bool IsTalking(); + bool IsMutedByLocalUser(int userIndex); - static const int SNP_FLAG_CONNECTION_COMPLETE = 1; // This player has a fully connected Rudp or other local link established (to a remote player if this is on the host, to the host if this is a client) - or isn't expected to have one - static const int SNP_FLAG_SMALLID_ALLOCATED = 2; // This player has a small id allocated - static const int SNP_FLAG_SMALLID_CONFIRMED = 4; // This player's small id has been confirmed as received by the client (only relevant for players using network communications, others set at the same time as allocating) - static const int SNP_FLAG_READY_MASK = 7; // Mask indicated all bits which must be set in the flags for this player to be considered "ready" + static const int SNP_FLAG_CONNECTION_COMPLETE = + 1; // This player has a fully connected Rudp or other local link + // established (to a remote player if this is on the host, to the + // host if this is a client) - or isn't expected to have one + static const int SNP_FLAG_SMALLID_ALLOCATED = + 2; // This player has a small id allocated + static const int SNP_FLAG_SMALLID_CONFIRMED = + 4; // This player's small id has been confirmed as received by the + // client (only relevant for players using network communications, + // others set at the same time as allocating) + static const int SNP_FLAG_READY_MASK = + 7; // Mask indicated all bits which must be set in the flags for this + // player to be considered "ready" - static const int SNP_MAX_PAYLOAD = 1346; // This is the default RUDP payload size - if we want to change this we'll need to use cellRudpSetOption to set something else & adjust segment size + static const int SNP_MAX_PAYLOAD = + 1346; // This is the default RUDP payload size - if we want to change + // this we'll need to use cellRudpSetOption to set something else + // & adjust segment size - typedef enum - { - SNP_TYPE_HOST, // This player represents the host - SNP_TYPE_LOCAL, // On host - this player is a local player that needs communicated with specially not using rudp. On clients - this is a local player, where m_rudpCtx is the context used to communicate from this player to/from the host - SNP_TYPE_REMOTE, // On host - this player's m_rupdCtx can be used to communicate from between the host and this player. On clients - this is a remote player that cannot be communicated with - } eSQRNetworkPlayerType; + typedef enum { + SNP_TYPE_HOST, // This player represents the host + SNP_TYPE_LOCAL, // On host - this player is a local player that needs + // communicated with specially not using rudp. On + // clients - this is a local player, where m_rudpCtx is + // the context used to communicate from this player + // to/from the host + SNP_TYPE_REMOTE, // On host - this player's m_rupdCtx can be used to + // communicate from between the host and this player. + // On clients - this is a remote player that cannot be + // communicated with + } eSQRNetworkPlayerType; - class QueuedSendBlock - { - public: - unsigned char *start; - unsigned char *end; - unsigned char *current; - }; + class QueuedSendBlock { + public: + unsigned char* start; + unsigned char* end; + unsigned char* current; + }; - class InitSendData - { - public: - unsigned char m_smallId; // Id to uniquely and permanently identify this player between machines - assigned by the server - PlayerUID m_UID; - }; + class InitSendData { + public: + unsigned char + m_smallId; // Id to uniquely and permanently identify this player + // between machines - assigned by the server + PlayerUID m_UID; + }; - SQRNetworkPlayer(SQRNetworkManager *manager, eSQRNetworkPlayerType playerType, bool onHost, SceNpMatching2RoomMemberId roomMemberId, int localPlayerIdx, int rudpCtx, PlayerUID *pUID); - ~SQRNetworkPlayer(); + SQRNetworkPlayer(SQRNetworkManager* manager, + eSQRNetworkPlayerType playerType, bool onHost, + SceNpMatching2RoomMemberId roomMemberId, + int localPlayerIdx, int rudpCtx, PlayerUID* pUID); + ~SQRNetworkPlayer(); - PlayerUID GetUID(); - void SetUID(PlayerUID UID); - bool HasConnectionAndSmallId(); - bool IsReady(); - void ConnectionComplete(); - void SmallIdAllocated(unsigned char smallId); - void InitialDataReceived(InitSendData *ISD); // Only for remote players as viewed from the host, this is set when the host has received confirmation that the client has received the small id for this player, ie it is now safe to send data to - bool HasSmallIdConfirmed(); + PlayerUID GetUID(); + void SetUID(PlayerUID UID); + bool HasConnectionAndSmallId(); + bool IsReady(); + void ConnectionComplete(); + void SmallIdAllocated(unsigned char smallId); + void InitialDataReceived( + InitSendData* + ISD); // Only for remote players as viewed from the host, this is + // set when the host has received confirmation that the + // client has received the small id for this player, ie it is + // now safe to send data to + bool HasSmallIdConfirmed(); - void SendData( SQRNetworkPlayer *pPlayerTarget, const void *data, unsigned int dataSize ); + void SendData(SQRNetworkPlayer* pPlayerTarget, const void* data, + unsigned int dataSize); - void ConfirmReady(); - void SendInternal(const void *data, unsigned int dataSize); - void SendMoreInternal(); + void ConfirmReady(); + void SendInternal(const void* data, unsigned int dataSize); + void SendMoreInternal(); #ifdef __PSVITA__ - void SendInternal_VitaAdhoc(const void *data, unsigned int dataSize, EAdhocDataTag tag = e_dataTag_Normal); - void SendMoreInternal_VitaAdhoc(); + void SendInternal_VitaAdhoc(const void* data, unsigned int dataSize, + EAdhocDataTag tag = e_dataTag_Normal); + void SendMoreInternal_VitaAdhoc(); #endif - void SetNameFromUID(); - void SetName(char *name); - int GetSessionIndex(); + void SetNameFromUID(); + void SetName(char* name); + int GetSessionIndex(); - eSQRNetworkPlayerType m_type; // The player type - bool m_host; // Whether this actual player class is stored on a host (not whether it represents the host, or a player on the host machine) - int m_flags; // Flags reflecting current state of this player - int m_rudpCtx; // Rudp context that can be used to communicate between this player & the host (see comments for eSQRNetworkPlayerType above) - int m_localPlayerIdx; // Index of this player on the machine to which it belongs - SceNpMatching2RoomMemberId m_roomMemberId; // The room member id, effectively a per machine id - InitSendData m_ISD; // Player UID & ID that get sent together to the host when connection is established - SQRNetworkManager *m_manager; // Pointer back to the manager that is managing this player - wchar_t m_name[21]; - uintptr_t m_customData; - CRITICAL_SECTION m_csQueue; - std::queue m_sendQueue; + eSQRNetworkPlayerType m_type; // The player type + bool m_host; // Whether this actual player class is stored on a host (not + // whether it represents the host, or a player on the host + // machine) + int m_flags; // Flags reflecting current state of this player + int m_rudpCtx; // Rudp context that can be used to communicate between this + // player & the host (see comments for eSQRNetworkPlayerType + // above) + int m_localPlayerIdx; // Index of this player on the machine to which it + // belongs + SceNpMatching2RoomMemberId + m_roomMemberId; // The room member id, effectively a per machine id + InitSendData m_ISD; // Player UID & ID that get sent together to the host + // when connection is established + SQRNetworkManager* + m_manager; // Pointer back to the manager that is managing this player + wchar_t m_name[21]; + uintptr_t m_customData; + CRITICAL_SECTION m_csQueue; + std::queue m_sendQueue; }; diff --git a/Minecraft.Client/Platform/Common/Network/Sony/SonyCommerce.cpp b/Minecraft.Client/Platform/Common/Network/Sony/SonyCommerce.cpp index 1beafa953..3ce5ec6e0 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/SonyCommerce.cpp +++ b/Minecraft.Client/Platform/Common/Network/Sony/SonyCommerce.cpp @@ -4,1488 +4,1410 @@ #include "../../../../Platform/PS3/PS3Extras/ShutdownManager.h" #include +bool SonyCommerce::m_bCommerceInitialised = false; +SceNpCommerce2SessionInfo SonyCommerce::m_sessionInfo; +SonyCommerce::State SonyCommerce::m_state = e_state_noSession; +int SonyCommerce::m_errorCode = 0; +void* SonyCommerce::m_callbackParam = NULL; -bool SonyCommerce::m_bCommerceInitialised = false; -SceNpCommerce2SessionInfo SonyCommerce::m_sessionInfo; -SonyCommerce::State SonyCommerce::m_state = e_state_noSession; -int SonyCommerce::m_errorCode = 0; -void* SonyCommerce::m_callbackParam = NULL; +void* SonyCommerce::m_receiveBuffer = NULL; +SonyCommerce::Event SonyCommerce::m_event; +std::queue SonyCommerce::m_messageQueue; +std::vector* SonyCommerce::m_pProductInfoList = NULL; +SonyCommerce::ProductInfoDetailed* SonyCommerce::m_pProductInfoDetailed = NULL; +SonyCommerce::ProductInfo* SonyCommerce::m_pProductInfo = NULL; -void* SonyCommerce::m_receiveBuffer = NULL; -SonyCommerce::Event SonyCommerce::m_event; -std::queue SonyCommerce::m_messageQueue; -std::vector* SonyCommerce::m_pProductInfoList = NULL; -SonyCommerce::ProductInfoDetailed* SonyCommerce::m_pProductInfoDetailed = NULL; -SonyCommerce::ProductInfo* SonyCommerce::m_pProductInfo = NULL; +SonyCommerce::CategoryInfo* SonyCommerce::m_pCategoryInfo = NULL; +const char* SonyCommerce::m_pProductID = NULL; +char* SonyCommerce::m_pCategoryID = NULL; +SonyCommerce::CheckoutInputParams SonyCommerce::m_checkoutInputParams; +SonyCommerce::DownloadListInputParams SonyCommerce::m_downloadInputParams; -SonyCommerce::CategoryInfo* SonyCommerce::m_pCategoryInfo = NULL; -const char* SonyCommerce::m_pProductID = NULL; -char* SonyCommerce::m_pCategoryID = NULL; -SonyCommerce::CheckoutInputParams SonyCommerce::m_checkoutInputParams; -SonyCommerce::DownloadListInputParams SonyCommerce::m_downloadInputParams; +SonyCommerce::CallbackFunc SonyCommerce::m_callbackFunc = NULL; +sys_memory_container_t SonyCommerce::m_memContainer = + SYS_MEMORY_CONTAINER_ID_INVALID; +bool SonyCommerce::m_bUpgradingTrial = false; -SonyCommerce::CallbackFunc SonyCommerce::m_callbackFunc = NULL; -sys_memory_container_t SonyCommerce::m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; -bool SonyCommerce::m_bUpgradingTrial = false; +SonyCommerce::CallbackFunc SonyCommerce::m_trialUpgradeCallbackFunc; +void* SonyCommerce::m_trialUpgradeCallbackParam; -SonyCommerce::CallbackFunc SonyCommerce::m_trialUpgradeCallbackFunc; -void* SonyCommerce::m_trialUpgradeCallbackParam; +CRITICAL_SECTION SonyCommerce::m_queueLock; -CRITICAL_SECTION SonyCommerce::m_queueLock; - - - -uint32_t SonyCommerce::m_contextId=0; ///< The npcommerce2 context ID -bool SonyCommerce::m_contextCreated=false; ///< npcommerce2 context ID created? -SonyCommerce::Phase SonyCommerce::m_currentPhase = e_phase_stopped; ///< Current commerce2 util -char SonyCommerce::m_commercebuffer[SCE_NP_COMMERCE2_RECV_BUF_SIZE]; - -C4JThread* SonyCommerce::m_tickThread = NULL; -bool SonyCommerce::m_bLicenseChecked=false; // Check the trial/full license for the game +uint32_t SonyCommerce::m_contextId = 0; ///< The npcommerce2 context ID +bool SonyCommerce::m_contextCreated = + false; ///< npcommerce2 context ID created? +SonyCommerce::Phase SonyCommerce::m_currentPhase = + e_phase_stopped; ///< Current commerce2 util +char SonyCommerce::m_commercebuffer[SCE_NP_COMMERCE2_RECV_BUF_SIZE]; +C4JThread* SonyCommerce::m_tickThread = NULL; +bool SonyCommerce::m_bLicenseChecked = + false; // Check the trial/full license for the game SonyCommerce::ProductInfoDetailed s_trialUpgradeProductInfoDetailed; -void SonyCommerce::Delete() -{ - m_pProductInfoList=NULL; - m_pProductInfoDetailed=NULL; - m_pProductInfo=NULL; - m_pCategoryInfo = NULL; - m_pProductID = NULL; - m_pCategoryID = NULL; +void SonyCommerce::Delete() { + m_pProductInfoList = NULL; + m_pProductInfoDetailed = NULL; + m_pProductInfo = NULL; + m_pCategoryInfo = NULL; + m_pProductID = NULL; + m_pCategoryID = NULL; } -void SonyCommerce::Init() -{ - int ret; +void SonyCommerce::Init() { + int ret; - assert(m_state == e_state_noSession); - if(!m_bCommerceInitialised) - { - ret = sceNpCommerce2Init(); - if (ret < 0) - { - app.DebugPrintf(4,"sceNpCommerce2Init failed (0x%x)\n", ret); - return; - } - else - { - m_bCommerceInitialised = true; - } - m_pCategoryID=(char *)malloc(sizeof(char) * 100); - InitializeCriticalSection(&m_queueLock); - } - - return ; + assert(m_state == e_state_noSession); + if (!m_bCommerceInitialised) { + ret = sceNpCommerce2Init(); + if (ret < 0) { + app.DebugPrintf(4, "sceNpCommerce2Init failed (0x%x)\n", ret); + return; + } else { + m_bCommerceInitialised = true; + } + m_pCategoryID = (char*)malloc(sizeof(char) * 100); + InitializeCriticalSection(&m_queueLock); + } + return; } - - -void SonyCommerce::CheckForTrialUpgradeKey_Callback(void* param, bool bFullVersion) -{ - ProfileManager.SetFullVersion(bFullVersion); - if(ProfileManager.IsFullVersion()) - { - StorageManager.SetSaveDisabled(false); - ConsoleUIController::handleUnlockFullVersionCallback(); - // licence has been checked, so we're ok to install the trophies now - ProfileManager.InitialiseTrophies( SQRNetworkManager_PS3::GetSceNpCommsId(), - SQRNetworkManager_PS3::GetSceNpCommsSig()); - - } - m_bLicenseChecked=true; +void SonyCommerce::CheckForTrialUpgradeKey_Callback(void* param, + bool bFullVersion) { + ProfileManager.SetFullVersion(bFullVersion); + if (ProfileManager.IsFullVersion()) { + StorageManager.SetSaveDisabled(false); + ConsoleUIController::handleUnlockFullVersionCallback(); + // licence has been checked, so we're ok to install the trophies now + ProfileManager.InitialiseTrophies( + SQRNetworkManager_PS3::GetSceNpCommsId(), + SQRNetworkManager_PS3::GetSceNpCommsSig()); + } + m_bLicenseChecked = true; } -bool SonyCommerce::LicenseChecked() -{ - return m_bLicenseChecked; +bool SonyCommerce::LicenseChecked() { return m_bLicenseChecked; } + +void SonyCommerce::CheckForTrialUpgradeKey() { + StorageManager.CheckForTrialUpgradeKey(CheckForTrialUpgradeKey_Callback, + NULL); } -void SonyCommerce::CheckForTrialUpgradeKey() -{ - StorageManager.CheckForTrialUpgradeKey(CheckForTrialUpgradeKey_Callback, NULL); +int SonyCommerce::Shutdown() { + int ret = 0; + if (m_contextCreated) { + ret = sceNpCommerce2DestroyCtx(m_contextId); + if (ret != 0) { + return ret; + } + + m_contextId = 0; + m_contextCreated = false; + } + + ret = sceNpCommerce2Term(); + m_bCommerceInitialised = false; + if (ret != 0) { + return ret; + } + delete m_pCategoryID; + DeleteCriticalSection(&m_queueLock); + + return ret; } -int SonyCommerce::Shutdown() -{ - int ret=0; - if (m_contextCreated) - { - ret = sceNpCommerce2DestroyCtx(m_contextId); - if (ret != 0) - { - return ret; - } +int SonyCommerce::TickLoop(void* lpParam) { + ShutdownManager::HasStarted(ShutdownManager::eCommerceThread); + while ((m_currentPhase != e_phase_stopped) && + ShutdownManager::ShouldRun(ShutdownManager::eCommerceThread)) { + processEvent(); + processMessage(); + Sleep(16); // sleep for a frame + } - m_contextId = 0; - m_contextCreated = false; - } + ShutdownManager::HasFinished(ShutdownManager::eCommerceThread); - ret = sceNpCommerce2Term(); - m_bCommerceInitialised = false; - if (ret != 0) - { - return ret; - } - delete m_pCategoryID; - DeleteCriticalSection(&m_queueLock); - - return ret; + return 0; } +int SonyCommerce::getProductList(std::vector* productList, + char* categoryId) { + int ret = 0; + uint32_t requestId; + size_t bufSize = sizeof(m_commercebuffer); + size_t fillSize = 0; + SceNpCommerce2GetCategoryContentsResult result; + SceNpCommerce2CategoryInfo categoryInfo; + SceNpCommerce2ContentInfo contentInfo; + SceNpCommerce2GameProductInfo productInfo; + SceNpCommerce2GameSkuInfo skuInfo; + ProductInfo tempInfo; + std::vector tempProductVec; + if (!m_contextCreated) { + ret = createContext(); + if (ret < 0) { + setError(ret); + return ret; + } + } -int SonyCommerce::TickLoop(void* lpParam) -{ - ShutdownManager::HasStarted(ShutdownManager::eCommerceThread); - while( (m_currentPhase != e_phase_stopped) && ShutdownManager::ShouldRun(ShutdownManager::eCommerceThread) ) - { - processEvent(); - processMessage(); - Sleep(16); // sleep for a frame - } + // Create request ID + ret = sceNpCommerce2GetCategoryContentsCreateReq(m_contextId, &requestId); + if (ret < 0) { + setError(ret); + return ret; + } - ShutdownManager::HasFinished(ShutdownManager::eCommerceThread); + // Obtain category content data + ret = sceNpCommerce2GetCategoryContentsStart( + requestId, categoryId, 0, SCE_NP_COMMERCE2_GETCAT_MAX_COUNT); + if (ret < 0) { + sceNpCommerce2DestroyReq(requestId); + setError(ret); + return ret; + } - return 0; -} + ret = sceNpCommerce2GetCategoryContentsGetResult( + requestId, m_commercebuffer, bufSize, &fillSize); + if (ret < 0) { + sceNpCommerce2DestroyReq(requestId); + setError(ret); + return ret; + } -int SonyCommerce::getProductList(std::vector* productList, char *categoryId) -{ - int ret = 0; - uint32_t requestId; - size_t bufSize = sizeof(m_commercebuffer); - size_t fillSize = 0; - SceNpCommerce2GetCategoryContentsResult result; - SceNpCommerce2CategoryInfo categoryInfo; - SceNpCommerce2ContentInfo contentInfo; - SceNpCommerce2GameProductInfo productInfo; - SceNpCommerce2GameSkuInfo skuInfo; - ProductInfo tempInfo; - std::vector tempProductVec; + ret = sceNpCommerce2DestroyReq(requestId); + if (ret < 0) { + setError(ret); + return ret; + } - if (!m_contextCreated) - { - ret = createContext(); - if (ret < 0) - { - setError(ret); - return ret; - } - } + // We have the initial category content data, + // now to take out the category content information. + ret = sceNpCommerce2InitGetCategoryContentsResult(&result, m_commercebuffer, + fillSize); + if (ret < 0) { + setError(ret); + return ret; + } - // Create request ID - ret = sceNpCommerce2GetCategoryContentsCreateReq(m_contextId, &requestId); - if (ret < 0) - { - setError(ret); - return ret; - } + // Get the category information + ret = sceNpCommerce2GetCategoryInfo(&result, &categoryInfo); + if (ret < 0) { + sceNpCommerce2DestroyGetCategoryContentsResult(&result); + setError(ret); + return ret; + } - // Obtain category content data - ret = sceNpCommerce2GetCategoryContentsStart(requestId, categoryId, 0, SCE_NP_COMMERCE2_GETCAT_MAX_COUNT); - if (ret < 0) - { - sceNpCommerce2DestroyReq(requestId); - setError(ret); - return ret; - } + if (categoryInfo.countOfProduct == 0) { + // There is no DLC + return 0; + } - ret = sceNpCommerce2GetCategoryContentsGetResult(requestId, m_commercebuffer, bufSize, &fillSize); - if (ret < 0) - { - sceNpCommerce2DestroyReq(requestId); - setError(ret); - return ret; - } + // Reserve some space + tempProductVec.reserve(categoryInfo.countOfProduct); - ret = sceNpCommerce2DestroyReq(requestId); - if (ret < 0) - { - setError(ret); - return ret; - } + // For each product, obtain information + for (int i = 0; i < result.rangeOfContents.count; i++) { + ret = sceNpCommerce2GetContentInfo(&result, i, &contentInfo); + if (ret < 0) { + sceNpCommerce2DestroyGetCategoryContentsResult(&result); + setError(ret); + return ret; + } - // We have the initial category content data, - // now to take out the category content information. - ret = sceNpCommerce2InitGetCategoryContentsResult(&result, m_commercebuffer, fillSize); - if (ret < 0) - { - setError(ret); - return ret; - } + // Only process if it is a product + if (contentInfo.contentType == SCE_NP_COMMERCE2_CONTENT_TYPE_PRODUCT) { + // reset tempInfo + memset(&tempInfo, 0x0, sizeof(tempInfo)); - // Get the category information - ret = sceNpCommerce2GetCategoryInfo(&result, &categoryInfo); - if (ret < 0) - { - sceNpCommerce2DestroyGetCategoryContentsResult(&result); - setError(ret); - return ret; - } + // Get product info + ret = sceNpCommerce2GetGameProductInfoFromContentInfo(&contentInfo, + &productInfo); + if (ret < 0) { + sceNpCommerce2DestroyGetCategoryContentsResult(&result); + setError(ret); + return ret; + } - if(categoryInfo.countOfProduct==0) - { - // There is no DLC - return 0; - } + // populate our temp struct - // Reserve some space - tempProductVec.reserve(categoryInfo.countOfProduct); - - // For each product, obtain information - for (int i = 0; i < result.rangeOfContents.count; i++) - { - ret = sceNpCommerce2GetContentInfo(&result, i, &contentInfo); - if (ret < 0) - { - sceNpCommerce2DestroyGetCategoryContentsResult(&result); - setError(ret); - return ret; - } - - // Only process if it is a product - if (contentInfo.contentType == SCE_NP_COMMERCE2_CONTENT_TYPE_PRODUCT) - { - - // reset tempInfo - memset(&tempInfo, 0x0, sizeof(tempInfo)); - - // Get product info - ret = sceNpCommerce2GetGameProductInfoFromContentInfo(&contentInfo, &productInfo); - if (ret < 0) - { - sceNpCommerce2DestroyGetCategoryContentsResult(&result); - setError(ret); - return ret; - } - - // populate our temp struct - - strncpy(tempInfo.productId, productInfo.productId, SCE_NP_COMMERCE2_PRODUCT_ID_LEN); - strncpy(tempInfo.productName, productInfo.productName, SCE_NP_COMMERCE2_PRODUCT_NAME_LEN); - strncpy(tempInfo.shortDescription, productInfo.productShortDescription, SCE_NP_COMMERCE2_PRODUCT_SHORT_DESCRIPTION_LEN); - if(tempInfo.longDescription[0]!=0) - { - strncpy(tempInfo.longDescription, productInfo.productLongDescription, SCE_NP_COMMERCE2_PRODUCT_LONG_DESCRIPTION_LEN); - } - else - { + strncpy(tempInfo.productId, productInfo.productId, + SCE_NP_COMMERCE2_PRODUCT_ID_LEN); + strncpy(tempInfo.productName, productInfo.productName, + SCE_NP_COMMERCE2_PRODUCT_NAME_LEN); + strncpy(tempInfo.shortDescription, + productInfo.productShortDescription, + SCE_NP_COMMERCE2_PRODUCT_SHORT_DESCRIPTION_LEN); + if (tempInfo.longDescription[0] != 0) { + strncpy(tempInfo.longDescription, + productInfo.productLongDescription, + SCE_NP_COMMERCE2_PRODUCT_LONG_DESCRIPTION_LEN); + } else { #ifdef _DEBUG - strcpy(tempInfo.longDescription,"Missing long description"); + strcpy(tempInfo.longDescription, "Missing long description"); #endif - } - strncpy(tempInfo.spName, productInfo.spName, SCE_NP_COMMERCE2_SP_NAME_LEN); - strncpy(tempInfo.imageUrl, productInfo.imageUrl, SCE_NP_COMMERCE2_URL_LEN); - tempInfo.releaseDate = productInfo.releaseDate; + } + strncpy(tempInfo.spName, productInfo.spName, + SCE_NP_COMMERCE2_SP_NAME_LEN); + strncpy(tempInfo.imageUrl, productInfo.imageUrl, + SCE_NP_COMMERCE2_URL_LEN); + tempInfo.releaseDate = productInfo.releaseDate; - if (productInfo.countOfSku == 1) - { - // Get SKU info - ret = sceNpCommerce2GetGameSkuInfoFromGameProductInfo(&productInfo, 0, &skuInfo); - if (ret < 0) - { - sceNpCommerce2DestroyGetCategoryContentsResult(&result); - setError(ret); - return ret; - } - tempInfo.purchasabilityFlag = skuInfo.purchasabilityFlag; + if (productInfo.countOfSku == 1) { + // Get SKU info + ret = sceNpCommerce2GetGameSkuInfoFromGameProductInfo( + &productInfo, 0, &skuInfo); + if (ret < 0) { + sceNpCommerce2DestroyGetCategoryContentsResult(&result); + setError(ret); + return ret; + } + tempInfo.purchasabilityFlag = skuInfo.purchasabilityFlag; - // Take out the price. Nicely formatted - // but also keep the price as a value in case it's 0 - we need to show "free" for that - tempInfo.ui32Price= skuInfo.price; - ret = sceNpCommerce2GetPrice(m_contextId, tempInfo.price, sizeof(tempInfo.price), skuInfo.price); - - if (ret < 0) - { - sceNpCommerce2DestroyGetCategoryContentsResult(&result); - setError(ret); - return ret; - } - } - tempProductVec.push_back(tempInfo); - } - } + // Take out the price. Nicely formatted + // but also keep the price as a value in case it's 0 - we need + // to show "free" for that + tempInfo.ui32Price = skuInfo.price; + ret = sceNpCommerce2GetPrice(m_contextId, tempInfo.price, + sizeof(tempInfo.price), + skuInfo.price); - // Set our result - *productList = tempProductVec; + if (ret < 0) { + sceNpCommerce2DestroyGetCategoryContentsResult(&result); + setError(ret); + return ret; + } + } + tempProductVec.push_back(tempInfo); + } + } - // Destroy the category contents result - ret = sceNpCommerce2DestroyGetCategoryContentsResult(&result); - if (ret < 0) - { - return ret; - } + // Set our result + *productList = tempProductVec; - return ret; + // Destroy the category contents result + ret = sceNpCommerce2DestroyGetCategoryContentsResult(&result); + if (ret < 0) { + return ret; + } + + return ret; } -int SonyCommerce::getCategoryInfo(CategoryInfo *pInfo, char *categoryId) -{ - int ret = 0; - uint32_t requestId; - size_t bufSize = sizeof(m_commercebuffer); - size_t fillSize = 0; - SceNpCommerce2GetCategoryContentsResult result; - SceNpCommerce2CategoryInfo categoryInfo; - SceNpCommerce2ContentInfo contentInfo; - //CategoryInfo tempCatInfo; - CategoryInfoSub tempSubCatInfo; +int SonyCommerce::getCategoryInfo(CategoryInfo* pInfo, char* categoryId) { + int ret = 0; + uint32_t requestId; + size_t bufSize = sizeof(m_commercebuffer); + size_t fillSize = 0; + SceNpCommerce2GetCategoryContentsResult result; + SceNpCommerce2CategoryInfo categoryInfo; + SceNpCommerce2ContentInfo contentInfo; + // CategoryInfo + // tempCatInfo; + CategoryInfoSub tempSubCatInfo; - if (!m_contextCreated) - { - ret = createContext(); - if (ret < 0) - { - m_errorCode = ret; - return ret; - } - } + if (!m_contextCreated) { + ret = createContext(); + if (ret < 0) { + m_errorCode = ret; + return ret; + } + } - // Create request ID - ret = sceNpCommerce2GetCategoryContentsCreateReq(m_contextId, &requestId); - if (ret < 0) - { - m_errorCode = ret; - return ret; - } + // Create request ID + ret = sceNpCommerce2GetCategoryContentsCreateReq(m_contextId, &requestId); + if (ret < 0) { + m_errorCode = ret; + return ret; + } - // Obtain category content data - if (categoryId) - { - ret = sceNpCommerce2GetCategoryContentsStart(requestId, categoryId, 0, SCE_NP_COMMERCE2_GETCAT_MAX_COUNT); - } - else - { - ret = sceNpCommerce2GetCategoryContentsStart(requestId,categoryId, - 0, SCE_NP_COMMERCE2_GETCAT_MAX_COUNT); - } - if (ret < 0) - { - sceNpCommerce2DestroyReq(requestId); - m_errorCode = ret; - return ret; - } + // Obtain category content data + if (categoryId) { + ret = sceNpCommerce2GetCategoryContentsStart( + requestId, categoryId, 0, SCE_NP_COMMERCE2_GETCAT_MAX_COUNT); + } else { + ret = sceNpCommerce2GetCategoryContentsStart( + requestId, categoryId, 0, SCE_NP_COMMERCE2_GETCAT_MAX_COUNT); + } + if (ret < 0) { + sceNpCommerce2DestroyReq(requestId); + m_errorCode = ret; + return ret; + } - ret = sceNpCommerce2GetCategoryContentsGetResult(requestId, m_commercebuffer, bufSize, &fillSize); - if (ret < 0) - { - if(ret==SCE_NP_COMMERCE2_ERROR_SERVER_MAINTENANCE) - { - app.DebugPrintf(4,"\n--- SCE_NP_COMMERCE2_ERROR_SERVER_MAINTENANCE ---\n\n"); - } - sceNpCommerce2DestroyReq(requestId); - m_errorCode = ret; - return ret; - } + ret = sceNpCommerce2GetCategoryContentsGetResult( + requestId, m_commercebuffer, bufSize, &fillSize); + if (ret < 0) { + if (ret == SCE_NP_COMMERCE2_ERROR_SERVER_MAINTENANCE) { + app.DebugPrintf( + 4, "\n--- SCE_NP_COMMERCE2_ERROR_SERVER_MAINTENANCE ---\n\n"); + } + sceNpCommerce2DestroyReq(requestId); + m_errorCode = ret; + return ret; + } - ret = sceNpCommerce2DestroyReq(requestId); - if (ret < 0) - { - m_errorCode = ret; - return ret; - } + ret = sceNpCommerce2DestroyReq(requestId); + if (ret < 0) { + m_errorCode = ret; + return ret; + } - // We have the initial category content data, - // now to take out the category content information. - ret = sceNpCommerce2InitGetCategoryContentsResult(&result, m_commercebuffer, fillSize); - if (ret < 0) { - m_errorCode = ret; - return ret; - } + // We have the initial category content data, + // now to take out the category content information. + ret = sceNpCommerce2InitGetCategoryContentsResult(&result, m_commercebuffer, + fillSize); + if (ret < 0) { + m_errorCode = ret; + return ret; + } - // Get the category information - ret = sceNpCommerce2GetCategoryInfo(&result, &categoryInfo); - if (ret < 0) { - sceNpCommerce2DestroyGetCategoryContentsResult(&result); - m_errorCode = ret; - return ret; - } + // Get the category information + ret = sceNpCommerce2GetCategoryInfo(&result, &categoryInfo); + if (ret < 0) { + sceNpCommerce2DestroyGetCategoryContentsResult(&result); + m_errorCode = ret; + return ret; + } - strcpy(pInfo->current.categoryId, categoryInfo.categoryId); - strcpy(pInfo->current.categoryName, categoryInfo.categoryName); - strcpy(pInfo->current.categoryDescription, categoryInfo.categoryDescription); - strcpy(pInfo->current.imageUrl, categoryInfo.imageUrl); - pInfo->countOfProducts = categoryInfo.countOfProduct; - pInfo->countOfSubCategories = categoryInfo.countOfSubCategory; + strcpy(pInfo->current.categoryId, categoryInfo.categoryId); + strcpy(pInfo->current.categoryName, categoryInfo.categoryName); + strcpy(pInfo->current.categoryDescription, + categoryInfo.categoryDescription); + strcpy(pInfo->current.imageUrl, categoryInfo.imageUrl); + pInfo->countOfProducts = categoryInfo.countOfProduct; + pInfo->countOfSubCategories = categoryInfo.countOfSubCategory; - if (categoryInfo.countOfSubCategory > 0) - { - // For each sub category, obtain information - for (int i = 0; i < result.rangeOfContents.count; i++) - { + if (categoryInfo.countOfSubCategory > 0) { + // For each sub category, obtain information + for (int i = 0; i < result.rangeOfContents.count; i++) { + ret = sceNpCommerce2GetContentInfo(&result, i, &contentInfo); + if (ret < 0) { + sceNpCommerce2DestroyGetCategoryContentsResult(&result); + m_errorCode = ret; + return ret; + } - ret = sceNpCommerce2GetContentInfo(&result, i, &contentInfo); - if (ret < 0) - { - sceNpCommerce2DestroyGetCategoryContentsResult(&result); - m_errorCode = ret; - return ret; - } + // Only process if it is a category + if (contentInfo.contentType == + SCE_NP_COMMERCE2_CONTENT_TYPE_CATEGORY) { + ret = sceNpCommerce2GetCategoryInfoFromContentInfo( + &contentInfo, &categoryInfo); + if (ret < 0) { + sceNpCommerce2DestroyGetCategoryContentsResult(&result); + m_errorCode = ret; + return ret; + } - // Only process if it is a category - if (contentInfo.contentType == SCE_NP_COMMERCE2_CONTENT_TYPE_CATEGORY) - { + strcpy(tempSubCatInfo.categoryId, categoryInfo.categoryId); + strcpy(tempSubCatInfo.categoryName, categoryInfo.categoryName); + strcpy(tempSubCatInfo.categoryDescription, + categoryInfo.categoryDescription); + strcpy(tempSubCatInfo.imageUrl, categoryInfo.imageUrl); - ret = sceNpCommerce2GetCategoryInfoFromContentInfo(&contentInfo, &categoryInfo); - if (ret < 0) - { - sceNpCommerce2DestroyGetCategoryContentsResult(&result); - m_errorCode = ret; - return ret; - } + // Add to the list + pInfo->subCategories.push_back(tempSubCatInfo); + } + } + } - strcpy(tempSubCatInfo.categoryId, categoryInfo.categoryId); - strcpy(tempSubCatInfo.categoryName, categoryInfo.categoryName); - strcpy(tempSubCatInfo.categoryDescription, categoryInfo.categoryDescription); - strcpy(tempSubCatInfo.imageUrl, categoryInfo.imageUrl); + // Set our result + //*info = tempCatInfo; - // Add to the list - pInfo->subCategories.push_back(tempSubCatInfo); - } - } - } + // Destroy the category contents result + ret = sceNpCommerce2DestroyGetCategoryContentsResult(&result); + if (ret < 0) { + return ret; + } - // Set our result - //*info = tempCatInfo; - - // Destroy the category contents result - ret = sceNpCommerce2DestroyGetCategoryContentsResult(&result); - if (ret < 0) { - return ret; - } - - return ret; + return ret; } +int SonyCommerce::getDetailedProductInfo(ProductInfoDetailed* pInfo, + const char* productId, + char* categoryId) { + int ret = 0; + uint32_t requestId; + size_t bufSize = sizeof(m_commercebuffer); + size_t fillSize = 0; + std::list ratingDescList; + SceNpCommerce2GetProductInfoResult result; + SceNpCommerce2ContentRatingInfo ratingInfo; + SceNpCommerce2GameProductInfo productInfo; + SceNpCommerce2GameSkuInfo skuInfo; + // ProductInfoDetailed + // tempInfo; -int SonyCommerce::getDetailedProductInfo(ProductInfoDetailed *pInfo, const char *productId, char *categoryId) -{ - int ret = 0; - uint32_t requestId; - size_t bufSize = sizeof(m_commercebuffer); - size_t fillSize = 0; - std::list ratingDescList; - SceNpCommerce2GetProductInfoResult result; - SceNpCommerce2ContentRatingInfo ratingInfo; - SceNpCommerce2GameProductInfo productInfo; - SceNpCommerce2GameSkuInfo skuInfo; - //ProductInfoDetailed tempInfo; + if (!m_contextCreated) { + ret = createContext(); + if (ret < 0) { + m_errorCode = ret; + return ret; + } + } - if (!m_contextCreated) { - ret = createContext(); - if (ret < 0) { - m_errorCode = ret; - return ret; - } - } + // Obtain product data + ret = sceNpCommerce2GetProductInfoCreateReq(m_contextId, &requestId); + if (ret < 0) { + m_errorCode = ret; + return ret; + } - // Obtain product data - ret = sceNpCommerce2GetProductInfoCreateReq(m_contextId, &requestId); - if (ret < 0) { - m_errorCode = ret; - return ret; - } + if (categoryId && categoryId[0] != 0) { + ret = + sceNpCommerce2GetProductInfoStart(requestId, categoryId, productId); + } else { + ret = sceNpCommerce2GetProductInfoStart(requestId, NULL, productId); + } + if (ret < 0) { + sceNpCommerce2DestroyReq(requestId); + m_errorCode = ret; + return ret; + } - if (categoryId && categoryId[0] != 0) { - ret = sceNpCommerce2GetProductInfoStart(requestId, categoryId, productId); - } else { - ret = sceNpCommerce2GetProductInfoStart(requestId, NULL, productId); - } - if (ret < 0) { - sceNpCommerce2DestroyReq(requestId); - m_errorCode = ret; - return ret; - } + ret = sceNpCommerce2GetProductInfoGetResult(requestId, m_commercebuffer, + bufSize, &fillSize); + if (ret < 0) { + sceNpCommerce2DestroyReq(requestId); + m_errorCode = ret; + return ret; + } - ret = sceNpCommerce2GetProductInfoGetResult(requestId, m_commercebuffer, bufSize, &fillSize); - if (ret < 0) { - sceNpCommerce2DestroyReq(requestId); - m_errorCode = ret; - return ret; - } + ret = sceNpCommerce2DestroyReq(requestId); + if (ret < 0) { + m_errorCode = ret; + return ret; + } - ret = sceNpCommerce2DestroyReq(requestId); - if (ret < 0) - { - m_errorCode = ret; - return ret; - } + // Take Out Game Product Information + ret = sceNpCommerce2InitGetProductInfoResult(&result, m_commercebuffer, + fillSize); + if (ret < 0) { + m_errorCode = ret; + return ret; + } - // Take Out Game Product Information - ret = sceNpCommerce2InitGetProductInfoResult(&result, m_commercebuffer, fillSize); - if (ret < 0) - { - m_errorCode = ret; - return ret; - } + ret = sceNpCommerce2GetGameProductInfo(&result, &productInfo); + if (ret < 0) { + sceNpCommerce2DestroyGetProductInfoResult(&result); + m_errorCode = ret; + return ret; + } - ret = sceNpCommerce2GetGameProductInfo(&result, &productInfo); - if (ret < 0) - { - sceNpCommerce2DestroyGetProductInfoResult(&result); - m_errorCode = ret; - return ret; - } + // Get rating info + ret = sceNpCommerce2GetContentRatingInfoFromGameProductInfo(&productInfo, + &ratingInfo); + if (ret < 0) { + sceNpCommerce2DestroyGetProductInfoResult(&result); + m_errorCode = ret; + return ret; + } - // Get rating info - ret = sceNpCommerce2GetContentRatingInfoFromGameProductInfo(&productInfo, &ratingInfo); - if (ret < 0) - { - sceNpCommerce2DestroyGetProductInfoResult(&result); - m_errorCode = ret; - return ret; - } + for (int index = 0; index < ratingInfo.countOfContentRatingDescriptor; + index++) { + SceNpCommerce2ContentRatingDescriptor desc; + sceNpCommerce2GetContentRatingDescriptor(&ratingInfo, index, &desc); + ratingDescList.push_back(desc); + } - for (int index = 0; index < ratingInfo.countOfContentRatingDescriptor; index++) - { - SceNpCommerce2ContentRatingDescriptor desc; - sceNpCommerce2GetContentRatingDescriptor(&ratingInfo, index, &desc); - ratingDescList.push_back(desc); - } + // populate our temp struct + pInfo->ratingDescriptors = ratingDescList; + strncpy(pInfo->productId, productInfo.productId, + SCE_NP_COMMERCE2_PRODUCT_ID_LEN); + strncpy(pInfo->productName, productInfo.productName, + SCE_NP_COMMERCE2_PRODUCT_NAME_LEN); + strncpy(pInfo->shortDescription, productInfo.productShortDescription, + SCE_NP_COMMERCE2_PRODUCT_SHORT_DESCRIPTION_LEN); + strncpy(pInfo->longDescription, productInfo.productLongDescription, + SCE_NP_COMMERCE2_PRODUCT_LONG_DESCRIPTION_LEN); + strncpy(pInfo->legalDescription, productInfo.legalDescription, + SCE_NP_COMMERCE2_PRODUCT_LEGAL_DESCRIPTION_LEN); + strncpy(pInfo->spName, productInfo.spName, SCE_NP_COMMERCE2_SP_NAME_LEN); + strncpy(pInfo->imageUrl, productInfo.imageUrl, SCE_NP_COMMERCE2_URL_LEN); + pInfo->releaseDate = productInfo.releaseDate; + strncpy(pInfo->ratingSystemId, ratingInfo.ratingSystemId, + SCE_NP_COMMERCE2_RATING_SYSTEM_ID_LEN); + strncpy(pInfo->ratingImageUrl, ratingInfo.imageUrl, + SCE_NP_COMMERCE2_URL_LEN); - // populate our temp struct - pInfo->ratingDescriptors = ratingDescList; - strncpy(pInfo->productId, productInfo.productId, SCE_NP_COMMERCE2_PRODUCT_ID_LEN); - strncpy(pInfo->productName, productInfo.productName, SCE_NP_COMMERCE2_PRODUCT_NAME_LEN); - strncpy(pInfo->shortDescription, productInfo.productShortDescription, SCE_NP_COMMERCE2_PRODUCT_SHORT_DESCRIPTION_LEN); - strncpy(pInfo->longDescription, productInfo.productLongDescription, SCE_NP_COMMERCE2_PRODUCT_LONG_DESCRIPTION_LEN); - strncpy(pInfo->legalDescription, productInfo.legalDescription, SCE_NP_COMMERCE2_PRODUCT_LEGAL_DESCRIPTION_LEN); - strncpy(pInfo->spName, productInfo.spName, SCE_NP_COMMERCE2_SP_NAME_LEN); - strncpy(pInfo->imageUrl, productInfo.imageUrl, SCE_NP_COMMERCE2_URL_LEN); - pInfo->releaseDate = productInfo.releaseDate; - strncpy(pInfo->ratingSystemId, ratingInfo.ratingSystemId, SCE_NP_COMMERCE2_RATING_SYSTEM_ID_LEN); - strncpy(pInfo->ratingImageUrl, ratingInfo.imageUrl, SCE_NP_COMMERCE2_URL_LEN); + // Get SKU info + if (productInfo.countOfSku == 1) { + ret = sceNpCommerce2GetGameSkuInfoFromGameProductInfo(&productInfo, 0, + &skuInfo); + if (ret < 0) { + sceNpCommerce2DestroyGetProductInfoResult(&result); + m_errorCode = ret; + return ret; + } + strncpy(pInfo->skuId, skuInfo.skuId, SCE_NP_COMMERCE2_SKU_ID_LEN); + pInfo->purchasabilityFlag = skuInfo.purchasabilityFlag; - // Get SKU info - if (productInfo.countOfSku == 1) - { - ret = sceNpCommerce2GetGameSkuInfoFromGameProductInfo(&productInfo, 0, &skuInfo); - if (ret < 0) - { - sceNpCommerce2DestroyGetProductInfoResult(&result); - m_errorCode = ret; - return ret; - } - strncpy(pInfo->skuId, skuInfo.skuId, SCE_NP_COMMERCE2_SKU_ID_LEN); - pInfo->purchasabilityFlag = skuInfo.purchasabilityFlag; + // Take out the price. Nicely formatted + // but also keep the price as a value in case it's 0 - we need to show + // "free" for that + pInfo->ui32Price = skuInfo.price; + ret = sceNpCommerce2GetPrice(m_contextId, pInfo->price, + sizeof(pInfo->price), skuInfo.price); + if (ret < 0) { + sceNpCommerce2DestroyGetProductInfoResult(&result); + m_errorCode = ret; + return ret; + } + } - // Take out the price. Nicely formatted - // but also keep the price as a value in case it's 0 - we need to show "free" for that - pInfo->ui32Price= skuInfo.price; - ret = sceNpCommerce2GetPrice(m_contextId, pInfo->price, sizeof(pInfo->price), skuInfo.price); - if (ret < 0) - { - sceNpCommerce2DestroyGetProductInfoResult(&result); - m_errorCode = ret; - return ret; - } - } + // Set our result + //*info = tempInfo; - // Set our result - //*info = tempInfo; + ret = sceNpCommerce2DestroyGetProductInfoResult(&result); + if (ret < 0) { + return ret; + } - ret = sceNpCommerce2DestroyGetProductInfoResult(&result); - if (ret < 0) - { - return ret; - } - - return ret; + return ret; } +int SonyCommerce::addDetailedProductInfo(ProductInfo* info, + const char* productId, + char* categoryId) { + int ret = 0; + uint32_t requestId; + size_t bufSize = sizeof(m_commercebuffer); + size_t fillSize = 0; + std::list ratingDescList; + SceNpCommerce2GetProductInfoResult result; + SceNpCommerce2ContentRatingInfo ratingInfo; + SceNpCommerce2GameProductInfo productInfo; + SceNpCommerce2GameSkuInfo skuInfo; + // ProductInfoDetailed + // tempInfo; -int SonyCommerce::addDetailedProductInfo(ProductInfo *info, const char *productId, char *categoryId) -{ - int ret = 0; - uint32_t requestId; - size_t bufSize = sizeof(m_commercebuffer); - size_t fillSize = 0; - std::list ratingDescList; - SceNpCommerce2GetProductInfoResult result; - SceNpCommerce2ContentRatingInfo ratingInfo; - SceNpCommerce2GameProductInfo productInfo; - SceNpCommerce2GameSkuInfo skuInfo; - //ProductInfoDetailed tempInfo; + if (!m_contextCreated) { + ret = createContext(); + if (ret < 0) { + m_errorCode = ret; + return ret; + } + } - if (!m_contextCreated) - { - ret = createContext(); - if (ret < 0) - { - m_errorCode = ret; - return ret; - } - } + // Obtain product data + ret = sceNpCommerce2GetProductInfoCreateReq(m_contextId, &requestId); + if (ret < 0) { + m_errorCode = ret; + return ret; + } - // Obtain product data - ret = sceNpCommerce2GetProductInfoCreateReq(m_contextId, &requestId); - if (ret < 0) - { - m_errorCode = ret; - return ret; - } + if (categoryId && categoryId[0] != 0) { + ret = + sceNpCommerce2GetProductInfoStart(requestId, categoryId, productId); + } else { + ret = + sceNpCommerce2GetProductInfoStart(requestId, categoryId, productId); + } + if (ret < 0) { + sceNpCommerce2DestroyReq(requestId); + m_errorCode = ret; + return ret; + } - if (categoryId && categoryId[0] != 0) - { - ret = sceNpCommerce2GetProductInfoStart(requestId, categoryId, productId); - } - else - { - ret = sceNpCommerce2GetProductInfoStart(requestId, categoryId, productId); - } - if (ret < 0) { - sceNpCommerce2DestroyReq(requestId); - m_errorCode = ret; - return ret; - } + ret = sceNpCommerce2GetProductInfoGetResult(requestId, m_commercebuffer, + bufSize, &fillSize); + if (ret < 0) { + sceNpCommerce2DestroyReq(requestId); + m_errorCode = ret; + return ret; + } - ret = sceNpCommerce2GetProductInfoGetResult(requestId, m_commercebuffer, bufSize, &fillSize); - if (ret < 0) - { - sceNpCommerce2DestroyReq(requestId); - m_errorCode = ret; - return ret; - } + ret = sceNpCommerce2DestroyReq(requestId); + if (ret < 0) { + m_errorCode = ret; + return ret; + } - ret = sceNpCommerce2DestroyReq(requestId); - if (ret < 0) - { - m_errorCode = ret; - return ret; - } + // Take Out Game Product Information + ret = sceNpCommerce2InitGetProductInfoResult(&result, m_commercebuffer, + fillSize); + if (ret < 0) { + m_errorCode = ret; + return ret; + } - // Take Out Game Product Information - ret = sceNpCommerce2InitGetProductInfoResult(&result, m_commercebuffer, fillSize); - if (ret < 0) - { - m_errorCode = ret; - return ret; - } + ret = sceNpCommerce2GetGameProductInfo(&result, &productInfo); + if (ret < 0) { + sceNpCommerce2DestroyGetProductInfoResult(&result); + m_errorCode = ret; + return ret; + } - ret = sceNpCommerce2GetGameProductInfo(&result, &productInfo); - if (ret < 0) - { - sceNpCommerce2DestroyGetProductInfoResult(&result); - m_errorCode = ret; - return ret; - } + // Get rating info + ret = sceNpCommerce2GetContentRatingInfoFromGameProductInfo(&productInfo, + &ratingInfo); + if (ret < 0) { + sceNpCommerce2DestroyGetProductInfoResult(&result); + m_errorCode = ret; + return ret; + } - // Get rating info - ret = sceNpCommerce2GetContentRatingInfoFromGameProductInfo(&productInfo, &ratingInfo); - if (ret < 0) - { - sceNpCommerce2DestroyGetProductInfoResult(&result); - m_errorCode = ret; - return ret; - } + for (int index = 0; index < ratingInfo.countOfContentRatingDescriptor; + index++) { + SceNpCommerce2ContentRatingDescriptor desc; + sceNpCommerce2GetContentRatingDescriptor(&ratingInfo, index, &desc); + ratingDescList.push_back(desc); + } - for (int index = 0; index < ratingInfo.countOfContentRatingDescriptor; index++) - { - SceNpCommerce2ContentRatingDescriptor desc; - sceNpCommerce2GetContentRatingDescriptor(&ratingInfo, index, &desc); - ratingDescList.push_back(desc); - } + // populate our temp struct + // tempInfo.ratingDescriptors = ratingDescList; + // strncpy(tempInfo.productId, productInfo.productId, + // SCE_NP_COMMERCE2_PRODUCT_ID_LEN); strncpy(tempInfo.productName, + // productInfo.productName, SCE_NP_COMMERCE2_PRODUCT_NAME_LEN); + // strncpy(tempInfo.shortDescription, productInfo.productShortDescription, + // SCE_NP_COMMERCE2_PRODUCT_SHORT_DESCRIPTION_LEN); + strncpy(info->longDescription, productInfo.productLongDescription, + SCE_NP_COMMERCE2_PRODUCT_LONG_DESCRIPTION_LEN); + // strncpy(tempInfo.legalDescription, productInfo.legalDescription, + // SCE_NP_COMMERCE2_PRODUCT_LEGAL_DESCRIPTION_LEN); strncpy(tempInfo.spName, + // productInfo.spName, SCE_NP_COMMERCE2_SP_NAME_LEN); + // strncpy(tempInfo.imageUrl, productInfo.imageUrl, + // SCE_NP_COMMERCE2_URL_LEN); tempInfo.releaseDate = + // productInfo.releaseDate; strncpy(tempInfo.ratingSystemId, + // ratingInfo.ratingSystemId, SCE_NP_COMMERCE2_RATING_SYSTEM_ID_LEN); + // strncpy(tempInfo.ratingImageUrl, ratingInfo.imageUrl, + // SCE_NP_COMMERCE2_URL_LEN); - // populate our temp struct -// tempInfo.ratingDescriptors = ratingDescList; -// strncpy(tempInfo.productId, productInfo.productId, SCE_NP_COMMERCE2_PRODUCT_ID_LEN); -// strncpy(tempInfo.productName, productInfo.productName, SCE_NP_COMMERCE2_PRODUCT_NAME_LEN); -// strncpy(tempInfo.shortDescription, productInfo.productShortDescription, SCE_NP_COMMERCE2_PRODUCT_SHORT_DESCRIPTION_LEN); - strncpy(info->longDescription, productInfo.productLongDescription, SCE_NP_COMMERCE2_PRODUCT_LONG_DESCRIPTION_LEN); -// strncpy(tempInfo.legalDescription, productInfo.legalDescription, SCE_NP_COMMERCE2_PRODUCT_LEGAL_DESCRIPTION_LEN); -// strncpy(tempInfo.spName, productInfo.spName, SCE_NP_COMMERCE2_SP_NAME_LEN); -// strncpy(tempInfo.imageUrl, productInfo.imageUrl, SCE_NP_COMMERCE2_URL_LEN); -// tempInfo.releaseDate = productInfo.releaseDate; -// strncpy(tempInfo.ratingSystemId, ratingInfo.ratingSystemId, SCE_NP_COMMERCE2_RATING_SYSTEM_ID_LEN); -// strncpy(tempInfo.ratingImageUrl, ratingInfo.imageUrl, SCE_NP_COMMERCE2_URL_LEN); + // Get SKU info + if (productInfo.countOfSku == 1) { + ret = sceNpCommerce2GetGameSkuInfoFromGameProductInfo(&productInfo, 0, + &skuInfo); + if (ret < 0) { + sceNpCommerce2DestroyGetProductInfoResult(&result); + m_errorCode = ret; + return ret; + } + strncpy(info->skuId, skuInfo.skuId, SCE_NP_COMMERCE2_SKU_ID_LEN); + info->purchasabilityFlag = skuInfo.purchasabilityFlag; + info->annotation = skuInfo.annotation; - // Get SKU info - if (productInfo.countOfSku == 1) - { - ret = sceNpCommerce2GetGameSkuInfoFromGameProductInfo(&productInfo, 0, &skuInfo); - if (ret < 0) - { - sceNpCommerce2DestroyGetProductInfoResult(&result); - m_errorCode = ret; - return ret; - } - strncpy(info->skuId, skuInfo.skuId, SCE_NP_COMMERCE2_SKU_ID_LEN); - info->purchasabilityFlag = skuInfo.purchasabilityFlag; - info->annotation = skuInfo.annotation; + // Take out the price. Nicely formatted + // but also keep the price as a value in case it's 0 - we need to show + // "free" for that + info->ui32Price = skuInfo.price; + ret = sceNpCommerce2GetPrice(m_contextId, info->price, + sizeof(info->price), skuInfo.price); + if (ret < 0) { + sceNpCommerce2DestroyGetProductInfoResult(&result); + m_errorCode = ret; + return ret; + } + } else { + // 4J-PB - more than one sku id! We have to be able to use the sku id + // returned for a product, so there is not supposed to be more than 1 + app.DebugPrintf("MORE THAN 1 SKU ID FOR %s\n", info->productName); + } - // Take out the price. Nicely formatted - // but also keep the price as a value in case it's 0 - we need to show "free" for that - info->ui32Price= skuInfo.price; - ret = sceNpCommerce2GetPrice(m_contextId, info->price, sizeof(info->price), skuInfo.price); - if (ret < 0) - { - sceNpCommerce2DestroyGetProductInfoResult(&result); - m_errorCode = ret; - return ret; - } - } - else - { - // 4J-PB - more than one sku id! We have to be able to use the sku id returned for a product, so there is not supposed to be more than 1 - app.DebugPrintf("MORE THAN 1 SKU ID FOR %s\n",info->productName); - } + // Set our result + //*info = tempInfo; - // Set our result - //*info = tempInfo; + ret = sceNpCommerce2DestroyGetProductInfoResult(&result); + if (ret < 0) { + return ret; + } - ret = sceNpCommerce2DestroyGetProductInfoResult(&result); - if (ret < 0) - { - return ret; - } - - return ret; + return ret; } +int SonyCommerce::checkout(CheckoutInputParams& params) { + int ret = 0; + const char* skuIdsTemp[SCE_NP_COMMERCE2_SKU_CHECKOUT_MAX]; + std::list::iterator iter = params.skuIds.begin(); + std::list::iterator iterEnd = params.skuIds.end(); -int SonyCommerce::checkout(CheckoutInputParams ¶ms) -{ - int ret = 0; - const char *skuIdsTemp[SCE_NP_COMMERCE2_SKU_CHECKOUT_MAX]; - std::list::iterator iter = params.skuIds.begin(); - std::list::iterator iterEnd = params.skuIds.end(); + if (!m_contextCreated) { + ret = createContext(); + if (ret < 0) { + return ret; + } + } - if (!m_contextCreated) { - ret = createContext(); - if (ret < 0) { - return ret; - } - } + for (int i = 0; i < params.skuIds.size(); i++) { + skuIdsTemp[i] = (const char*)(*iter); + iter++; + } - for (int i = 0; i < params.skuIds.size(); i++) { - skuIdsTemp[i] = (const char *)(*iter); - iter++; - } + ret = sceNpCommerce2DoCheckoutStartAsync( + m_contextId, skuIdsTemp, params.skuIds.size(), *params.memContainer); + if (ret < 0) { + return ret; + } - ret = sceNpCommerce2DoCheckoutStartAsync(m_contextId, skuIdsTemp, params.skuIds.size(), *params.memContainer); - if (ret < 0) { - return ret; - } - - return CELL_OK; + return CELL_OK; } +int SonyCommerce::downloadList(DownloadListInputParams& params) { + int ret = 0; + const char* skuIdsTemp[SCE_NP_COMMERCE2_SKU_CHECKOUT_MAX]; + std::list::iterator iter = params.skuIds.begin(); + std::list::iterator iterEnd = params.skuIds.end(); -int SonyCommerce::downloadList(DownloadListInputParams ¶ms) -{ - int ret = 0; - const char *skuIdsTemp[SCE_NP_COMMERCE2_SKU_CHECKOUT_MAX]; - std::list::iterator iter = params.skuIds.begin(); - std::list::iterator iterEnd = params.skuIds.end(); + if (!m_contextCreated) { + ret = createContext(); + if (ret < 0) { + return ret; + } + } - if (!m_contextCreated) { - ret = createContext(); - if (ret < 0) { - return ret; - } - } + for (int i = 0; i < params.skuIds.size(); i++) { + skuIdsTemp[i] = (const char*)(*iter); + iter++; + } + ret = sceNpCommerce2DoDlListStartAsync( + m_contextId, app.GetCommerceCategory(), skuIdsTemp, + params.skuIds.size(), *params.memContainer); + if (ret < 0) { + return ret; + } - for (int i = 0; i < params.skuIds.size(); i++) { - skuIdsTemp[i] = (const char *)(*iter); - iter++; - } - ret = sceNpCommerce2DoDlListStartAsync(m_contextId, app.GetCommerceCategory(), skuIdsTemp, params.skuIds.size(), *params.memContainer); - if (ret < 0) { - return ret; - } - - return CELL_OK; + return CELL_OK; } -void SonyCommerce::UpgradeTrialCallback2(void* lpParam,int err) -{ - app.DebugPrintf(4,"SonyCommerce_UpgradeTrialCallback2 : err : 0x%08x\n", err); - SonyCommerce::CheckForTrialUpgradeKey(); - if(err != CELL_OK) - { - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_PRO_UNLOCKGAME_TITLE, IDS_NO_DLCOFFERS, uiIDA,1,ProfileManager.GetPrimaryPad()); - } - m_trialUpgradeCallbackFunc(m_trialUpgradeCallbackParam, m_errorCode); +void SonyCommerce::UpgradeTrialCallback2(void* lpParam, int err) { + app.DebugPrintf(4, "SonyCommerce_UpgradeTrialCallback2 : err : 0x%08x\n", + err); + SonyCommerce::CheckForTrialUpgradeKey(); + if (err != CELL_OK) { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + C4JStorage::EMessageResult result = + ui.RequestMessageBox(IDS_PRO_UNLOCKGAME_TITLE, IDS_NO_DLCOFFERS, + uiIDA, 1, ProfileManager.GetPrimaryPad()); + } + m_trialUpgradeCallbackFunc(m_trialUpgradeCallbackParam, m_errorCode); } -void SonyCommerce::UpgradeTrialCallback1(void* lpParam,int err) -{ - - app.DebugPrintf(4,"SonyCommerce_UpgradeTrialCallback1 : err : 0x%08x\n", err); - if(err == CELL_OK) - { - const char* skuID = s_trialUpgradeProductInfoDetailed.skuId; - if(s_trialUpgradeProductInfoDetailed.purchasabilityFlag == SCE_NP_COMMERCE2_SKU_PURCHASABILITY_FLAG_OFF) - { - app.DebugPrintf(4,"UpgradeTrialCallback1 - DownloadAlreadyPurchased\n"); - SonyCommerce::DownloadAlreadyPurchased( UpgradeTrialCallback2, NULL, skuID); - } - else - { - app.DebugPrintf(4,"UpgradeTrialCallback1 - Checkout\n"); - SonyCommerce::Checkout( UpgradeTrialCallback2, NULL, skuID); - } - } - else - { - unsigned int uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_PRO_UNLOCKGAME_TITLE, IDS_NO_DLCOFFERS, uiIDA,1,ProfileManager.GetPrimaryPad()); - m_trialUpgradeCallbackFunc(m_trialUpgradeCallbackParam, m_errorCode); - } +void SonyCommerce::UpgradeTrialCallback1(void* lpParam, int err) { + app.DebugPrintf(4, "SonyCommerce_UpgradeTrialCallback1 : err : 0x%08x\n", + err); + if (err == CELL_OK) { + const char* skuID = s_trialUpgradeProductInfoDetailed.skuId; + if (s_trialUpgradeProductInfoDetailed.purchasabilityFlag == + SCE_NP_COMMERCE2_SKU_PURCHASABILITY_FLAG_OFF) { + app.DebugPrintf( + 4, "UpgradeTrialCallback1 - DownloadAlreadyPurchased\n"); + SonyCommerce::DownloadAlreadyPurchased(UpgradeTrialCallback2, NULL, + skuID); + } else { + app.DebugPrintf(4, "UpgradeTrialCallback1 - Checkout\n"); + SonyCommerce::Checkout(UpgradeTrialCallback2, NULL, skuID); + } + } else { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + C4JStorage::EMessageResult result = + ui.RequestMessageBox(IDS_PRO_UNLOCKGAME_TITLE, IDS_NO_DLCOFFERS, + uiIDA, 1, ProfileManager.GetPrimaryPad()); + m_trialUpgradeCallbackFunc(m_trialUpgradeCallbackParam, m_errorCode); + } } - - // global func, so we can call from the profile lib -void SonyCommerce_UpgradeTrial() -{ - // we're now calling the app function here, which manages pending requests - app.UpgradeTrial(); +void SonyCommerce_UpgradeTrial() { + // we're now calling the app function here, which manages pending requests + app.UpgradeTrial(); } -void SonyCommerce::UpgradeTrial(CallbackFunc cb, void* lpParam) -{ - m_trialUpgradeCallbackFunc = cb; - m_trialUpgradeCallbackParam = lpParam; - -// static char szTrialUpgradeSkuID[64]; -// sprintf(szTrialUpgradeSkuID, "%s-TRIALUPGRADE0001", app.GetCommerceCategory());//, szSKUSuffix); - GetDetailedProductInfo(UpgradeTrialCallback1, NULL, &s_trialUpgradeProductInfoDetailed, app.GetUpgradeKey(), app.GetCommerceCategory()); +void SonyCommerce::UpgradeTrial(CallbackFunc cb, void* lpParam) { + m_trialUpgradeCallbackFunc = cb; + m_trialUpgradeCallbackParam = lpParam; + + // static char szTrialUpgradeSkuID[64]; + // sprintf(szTrialUpgradeSkuID, "%s-TRIALUPGRADE0001", + // app.GetCommerceCategory());//, szSKUSuffix); + GetDetailedProductInfo(UpgradeTrialCallback1, NULL, + &s_trialUpgradeProductInfoDetailed, + app.GetUpgradeKey(), app.GetCommerceCategory()); } +int SonyCommerce::createContext() { + SceNpId npId; + int ret = sceNpManagerGetNpId(&npId); + if (ret < 0) { + app.DebugPrintf(4, "createContext sceNpManagerGetNpId problem\n"); + return ret; + } -int SonyCommerce::createContext() -{ - SceNpId npId; - int ret = sceNpManagerGetNpId(&npId); - if(ret < 0) - { - app.DebugPrintf(4,"createContext sceNpManagerGetNpId problem\n"); - return ret; - } + if (m_contextCreated) { + ret = sceNpCommerce2DestroyCtx(m_contextId); + if (ret < 0) { + app.DebugPrintf(4, + "createContext sceNpCommerce2DestroyCtx problem\n"); + return ret; + } + } - if (m_contextCreated) { - ret = sceNpCommerce2DestroyCtx(m_contextId); - if (ret < 0) - { - app.DebugPrintf(4,"createContext sceNpCommerce2DestroyCtx problem\n"); - return ret; - } - } + // Create commerce2 context + ret = sceNpCommerce2CreateCtx(SCE_NP_COMMERCE2_VERSION, &npId, + commerce2Handler, NULL, &m_contextId); + if (ret < 0) { + app.DebugPrintf(4, "createContext sceNpCommerce2CreateCtx problem\n"); + return ret; + } - // Create commerce2 context - ret = sceNpCommerce2CreateCtx(SCE_NP_COMMERCE2_VERSION, &npId, commerce2Handler, NULL, &m_contextId); - if (ret < 0) - { - app.DebugPrintf(4,"createContext sceNpCommerce2CreateCtx problem\n"); - return ret; - } + m_contextCreated = true; - m_contextCreated = true; - - return CELL_OK; + return CELL_OK; } -int SonyCommerce::createSession() -{ - int ret = createContext(); - if (ret < 0) { - return ret; - } +int SonyCommerce::createSession() { + int ret = createContext(); + if (ret < 0) { + return ret; + } - m_currentPhase = e_phase_creatingSessionPhase; - ret = sceNpCommerce2CreateSessionStart(m_contextId); - if (ret < 0) { - return ret; - } - return ret; + m_currentPhase = e_phase_creatingSessionPhase; + ret = sceNpCommerce2CreateSessionStart(m_contextId); + if (ret < 0) { + return ret; + } + return ret; } +void SonyCommerce::commerce2Handler(uint32_t contextId, uint32_t subjectId, + int event, int errorCode, void* arg) { + // Event reply; + // reply.service = Toolkit::NP::commerce; + // + EnterCriticalSection(&m_queueLock); -void SonyCommerce::commerce2Handler(uint32_t contextId, uint32_t subjectId, int event, int errorCode, void *arg) -{ -// Event reply; -// reply.service = Toolkit::NP::commerce; -// - EnterCriticalSection(&m_queueLock); + switch (event) { + case SCE_NP_COMMERCE2_EVENT_REQUEST_ERROR: { + m_messageQueue.push(e_message_commerceEnd); + m_errorCode = errorCode; + break; + } + case SCE_NP_COMMERCE2_EVENT_CREATE_SESSION_DONE: { + m_messageQueue.push(e_message_commerceEnd); + m_event = e_event_commerceSessionCreated; + break; + } + case SCE_NP_COMMERCE2_EVENT_CREATE_SESSION_ABORT: { + m_messageQueue.push(e_message_commerceEnd); + m_event = e_event_commerceSessionAborted; + break; + } + case SCE_NP_COMMERCE2_EVENT_DO_CHECKOUT_STARTED: { + m_currentPhase = e_phase_checkoutPhase; + m_event = e_event_commerceCheckoutStarted; + break; + } + case SCE_NP_COMMERCE2_EVENT_DO_CHECKOUT_SUCCESS: { + m_messageQueue.push(e_message_commerceEnd); + m_event = e_event_commerceCheckoutSuccess; + break; + } + case SCE_NP_COMMERCE2_EVENT_DO_CHECKOUT_BACK: { + m_messageQueue.push(e_message_commerceEnd); + m_event = e_event_commerceCheckoutAborted; + break; + } + case SCE_NP_COMMERCE2_EVENT_DO_CHECKOUT_FINISHED: { + m_event = e_event_commerceCheckoutFinished; + break; + } + case SCE_NP_COMMERCE2_EVENT_DO_DL_LIST_STARTED: { + m_currentPhase = e_phase_downloadListPhase; + m_event = e_event_commerceDownloadListStarted; + break; + } + case SCE_NP_COMMERCE2_EVENT_DO_DL_LIST_SUCCESS: { + m_messageQueue.push(e_message_commerceEnd); + m_event = e_event_commerceDownloadListSuccess; + break; + } + case SCE_NP_COMMERCE2_EVENT_DO_DL_LIST_FINISHED: { + m_event = e_event_commerceDownloadListFinished; + break; + } + case SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_STARTED: + m_currentPhase = e_phase_productBrowsePhase; + m_event = e_event_commerceProductBrowseStarted; + break; + case SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_SUCCESS: { + m_messageQueue.push(e_message_commerceEnd); + m_event = e_event_commerceProductBrowseSuccess; + break; + } + case SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_BACK: { + m_messageQueue.push(e_message_commerceEnd); + m_event = e_event_commerceProductBrowseAborted; + break; + } + case SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_FINISHED: { + m_event = e_event_commerceProductBrowseFinished; + break; + } + case SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_OPENED: + break; + case SCE_NP_COMMERCE2_EVENT_DO_PRODUCT_CODE_STARTED: { + m_currentPhase = e_phase_voucherRedeemPhase; + m_event = e_event_commerceVoucherInputStarted; + break; + } + case SCE_NP_COMMERCE2_EVENT_DO_PRODUCT_CODE_SUCCESS: { + m_messageQueue.push(e_message_commerceEnd); + m_event = e_event_commerceVoucherInputSuccess; + break; + } + case SCE_NP_COMMERCE2_EVENT_DO_PRODUCT_CODE_BACK: { + m_messageQueue.push(e_message_commerceEnd); + m_event = e_event_commerceVoucherInputAborted; + break; + } + case SCE_NP_COMMERCE2_EVENT_DO_PRODUCT_CODE_FINISHED: { + m_event = e_event_commerceVoucherInputFinished; + break; + } + default: + break; + }; - switch (event) { - case SCE_NP_COMMERCE2_EVENT_REQUEST_ERROR: - { - m_messageQueue.push(e_message_commerceEnd); - m_errorCode = errorCode; - break; - } - case SCE_NP_COMMERCE2_EVENT_CREATE_SESSION_DONE: - { - m_messageQueue.push(e_message_commerceEnd); - m_event = e_event_commerceSessionCreated; - break; - } - case SCE_NP_COMMERCE2_EVENT_CREATE_SESSION_ABORT: - { - m_messageQueue.push(e_message_commerceEnd); - m_event = e_event_commerceSessionAborted; - break; - } - case SCE_NP_COMMERCE2_EVENT_DO_CHECKOUT_STARTED: - { - m_currentPhase = e_phase_checkoutPhase; - m_event = e_event_commerceCheckoutStarted; - break; - } - case SCE_NP_COMMERCE2_EVENT_DO_CHECKOUT_SUCCESS: - { - m_messageQueue.push(e_message_commerceEnd); - m_event = e_event_commerceCheckoutSuccess; - break; - } - case SCE_NP_COMMERCE2_EVENT_DO_CHECKOUT_BACK: - { - m_messageQueue.push(e_message_commerceEnd); - m_event = e_event_commerceCheckoutAborted; - break; - } - case SCE_NP_COMMERCE2_EVENT_DO_CHECKOUT_FINISHED: - { - m_event = e_event_commerceCheckoutFinished; - break; - } - case SCE_NP_COMMERCE2_EVENT_DO_DL_LIST_STARTED: - { - m_currentPhase = e_phase_downloadListPhase; - m_event = e_event_commerceDownloadListStarted; - break; - } - case SCE_NP_COMMERCE2_EVENT_DO_DL_LIST_SUCCESS: - { - m_messageQueue.push(e_message_commerceEnd); - m_event = e_event_commerceDownloadListSuccess; - break; - } - case SCE_NP_COMMERCE2_EVENT_DO_DL_LIST_FINISHED: - { - m_event = e_event_commerceDownloadListFinished; - break; - } - case SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_STARTED: - m_currentPhase = e_phase_productBrowsePhase; - m_event = e_event_commerceProductBrowseStarted; - break; - case SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_SUCCESS: - { - m_messageQueue.push(e_message_commerceEnd); - m_event = e_event_commerceProductBrowseSuccess; - break; - } - case SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_BACK: - { - m_messageQueue.push(e_message_commerceEnd); - m_event = e_event_commerceProductBrowseAborted; - break; - } - case SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_FINISHED: - { - m_event = e_event_commerceProductBrowseFinished; - break; - } - case SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_OPENED: - break; - case SCE_NP_COMMERCE2_EVENT_DO_PRODUCT_CODE_STARTED: - { - m_currentPhase = e_phase_voucherRedeemPhase; - m_event = e_event_commerceVoucherInputStarted; - break; - } - case SCE_NP_COMMERCE2_EVENT_DO_PRODUCT_CODE_SUCCESS: - { - m_messageQueue.push(e_message_commerceEnd); - m_event = e_event_commerceVoucherInputSuccess; - break; - } - case SCE_NP_COMMERCE2_EVENT_DO_PRODUCT_CODE_BACK: - { - m_messageQueue.push(e_message_commerceEnd); - m_event = e_event_commerceVoucherInputAborted; - break; - } - case SCE_NP_COMMERCE2_EVENT_DO_PRODUCT_CODE_FINISHED: - { - m_event = e_event_commerceVoucherInputFinished; - break; - } - default: - break; - }; - - LeaveCriticalSection(&m_queueLock); + LeaveCriticalSection(&m_queueLock); } +void SonyCommerce::processMessage() { + EnterCriticalSection(&m_queueLock); + int ret; + if (m_messageQueue.empty()) { + LeaveCriticalSection(&m_queueLock); + return; + } + Message msg = m_messageQueue.front(); + m_messageQueue.pop(); + switch (msg) { + case e_message_commerceCreateSession: + ret = createSession(); + if (ret < 0) { + m_event = e_event_commerceError; + m_errorCode = ret; + } + break; -void SonyCommerce::processMessage() -{ - EnterCriticalSection(&m_queueLock); - int ret; - if(m_messageQueue.empty()) - { - LeaveCriticalSection(&m_queueLock); - return; - } - Message msg = m_messageQueue.front(); - m_messageQueue.pop(); + case e_message_commerceGetCategoryInfo: { + ret = getCategoryInfo(m_pCategoryInfo, m_pCategoryID); + if (ret < 0) { + m_event = e_event_commerceError; + app.DebugPrintf( + 4, "ERROR - e_event_commerceGotCategoryInfo - %s\n", + m_pCategoryID); + m_errorCode = ret; + } else { + m_event = e_event_commerceGotCategoryInfo; + app.DebugPrintf(4, "e_event_commerceGotCategoryInfo - %s\n", + m_pCategoryID); + } + break; + } - switch (msg) - { + case e_message_commerceGetProductList: { + ret = getProductList(m_pProductInfoList, m_pCategoryID); + if (ret < 0) { + m_event = e_event_commerceError; + } else { + m_event = e_event_commerceGotProductList; + app.DebugPrintf(4, "e_event_commerceGotProductList - %s\n", + m_pCategoryID); + } + break; + } - case e_message_commerceCreateSession: - ret = createSession(); - if (ret < 0) - { - m_event = e_event_commerceError; - m_errorCode = ret; - } - break; + case e_message_commerceGetDetailedProductInfo: { + ret = getDetailedProductInfo(m_pProductInfoDetailed, m_pProductID, + m_pCategoryID); + if (ret < 0) { + m_event = e_event_commerceError; + m_errorCode = ret; + } else { + m_event = e_event_commerceGotDetailedProductInfo; + app.DebugPrintf(4, + "e_event_commerceGotDetailedProductInfo - %s\n", + m_pCategoryID); + } + break; + } + case e_message_commerceAddDetailedProductInfo: { + ret = addDetailedProductInfo(m_pProductInfo, m_pProductID, + m_pCategoryID); + if (ret < 0) { + m_event = e_event_commerceError; + m_errorCode = ret; + } else { + m_event = e_event_commerceAddedDetailedProductInfo; + } + break; + } - case e_message_commerceGetCategoryInfo: - { - ret = getCategoryInfo(m_pCategoryInfo, m_pCategoryID); - if (ret < 0) - { - m_event = e_event_commerceError; - app.DebugPrintf(4,"ERROR - e_event_commerceGotCategoryInfo - %s\n",m_pCategoryID); - m_errorCode = ret; - } - else - { - m_event = e_event_commerceGotCategoryInfo; - app.DebugPrintf(4,"e_event_commerceGotCategoryInfo - %s\n",m_pCategoryID); - } - break; - } + // + // case e_message_commerceStoreProductBrowse: + // { + // ret = productBrowse(*(ProductBrowseParams + // *)msg.inputArgs); if (ret < 0) { m_event = e_event_commerceError; + // m_errorCode = ret; + // } + // _TOOLKIT_NP_DEL (ProductBrowseParams + // *)msg.inputArgs; break; + // } + // + // case e_message_commerceUpgradeTrial: + // { + // ret = upgradeTrial(); + // if (ret < 0) { + // m_event = e_event_commerceError; + // m_errorCode = ret; + // } + // break; + // } + // + // case e_message_commerceRedeemVoucher: + // { + // ret = voucherCodeInput(*(VoucherInputParams + // *)msg.inputArgs); if (ret < 0) { m_event = e_event_commerceError; + // m_errorCode = ret; + // } + // _TOOLKIT_NP_DEL (VoucherInputParams + // *)msg.inputArgs; break; + // } + // + // case e_message_commerceGetEntitlementList: + // { + // Job > + // tmpJob(static_cast > + // *>(msg.output)); + // + // int state = 0; + // int ret = sceNpManagerGetStatus(&state); + // + // // We don't want to process this if we are + // offline if (ret < 0 || state != SCE_NP_MANAGER_STATUS_ONLINE) { + // m_event = e_event_commerceError; + // reply.returnCode = + // SCE_TOOLKIT_NP_OFFLINE; tmpJob.setError(SCE_TOOLKIT_NP_OFFLINE); + // } else { + // getEntitlementList(&tmpJob); + // } + // break; + // } + // + // case e_message_commerceConsumeEntitlement: + // { + // int state = 0; + // int ret = sceNpManagerGetStatus(&state); + // + // // We don't want to process this if we are + // offline if (ret < 0 || state != SCE_NP_MANAGER_STATUS_ONLINE) { + // m_event = e_event_commerceError; + // reply.returnCode = + // SCE_TOOLKIT_NP_OFFLINE; } else { + // + // ret = + // consumeEntitlement(*(EntitlementToConsume *)msg.inputArgs); if + // (ret < 0) { m_event = e_event_commerceError; m_errorCode = ret; + // } else { + // m_event = + // e_event_commerceConsumedEntitlement; + // } + // } + // _TOOLKIT_NP_DEL (EntitlementToConsume + // *)msg.inputArgs; + // + // break; + // } + // + case e_message_commerceCheckout: { + ret = checkout(m_checkoutInputParams); + if (ret < 0) { + m_event = e_event_commerceError; + m_errorCode = ret; + } + break; + } - case e_message_commerceGetProductList: - { - ret = getProductList(m_pProductInfoList, m_pCategoryID); - if (ret < 0) - { - m_event = e_event_commerceError; - } - else - { - m_event = e_event_commerceGotProductList; - app.DebugPrintf(4,"e_event_commerceGotProductList - %s\n",m_pCategoryID); - } - break; - } + case e_message_commerceDownloadList: { + ret = downloadList(m_downloadInputParams); + if (ret < 0) { + m_event = e_event_commerceError; + m_errorCode = ret; + } + break; + } - case e_message_commerceGetDetailedProductInfo: - { - ret = getDetailedProductInfo(m_pProductInfoDetailed, m_pProductID, m_pCategoryID); - if (ret < 0) - { - m_event = e_event_commerceError; - m_errorCode = ret; - } - else - { - m_event = e_event_commerceGotDetailedProductInfo; - app.DebugPrintf(4,"e_event_commerceGotDetailedProductInfo - %s\n",m_pCategoryID); - } - break; - } - case e_message_commerceAddDetailedProductInfo: - { - ret = addDetailedProductInfo(m_pProductInfo, m_pProductID, m_pCategoryID); - if (ret < 0) - { - m_event = e_event_commerceError; - m_errorCode = ret; - } - else - { - m_event = e_event_commerceAddedDetailedProductInfo; - } - break; - } + case e_message_commerceEnd: + app.DebugPrintf("XXX - e_message_commerceEnd!\n"); + ret = commerceEnd(); + if (ret < 0) { + m_event = e_event_commerceError; + m_errorCode = ret; + } + // 4J-PB - we don't seem to handle the error code here + else if (m_errorCode != 0) { + m_event = e_event_commerceError; + } + break; -// -// case e_message_commerceStoreProductBrowse: -// { -// ret = productBrowse(*(ProductBrowseParams *)msg.inputArgs); -// if (ret < 0) { -// m_event = e_event_commerceError; -// m_errorCode = ret; -// } -// _TOOLKIT_NP_DEL (ProductBrowseParams *)msg.inputArgs; -// break; -// } -// -// case e_message_commerceUpgradeTrial: -// { -// ret = upgradeTrial(); -// if (ret < 0) { -// m_event = e_event_commerceError; -// m_errorCode = ret; -// } -// break; -// } -// -// case e_message_commerceRedeemVoucher: -// { -// ret = voucherCodeInput(*(VoucherInputParams *)msg.inputArgs); -// if (ret < 0) { -// m_event = e_event_commerceError; -// m_errorCode = ret; -// } -// _TOOLKIT_NP_DEL (VoucherInputParams *)msg.inputArgs; -// break; -// } -// -// case e_message_commerceGetEntitlementList: -// { -// Job > tmpJob(static_cast > *>(msg.output)); -// -// int state = 0; -// int ret = sceNpManagerGetStatus(&state); -// -// // We don't want to process this if we are offline -// if (ret < 0 || state != SCE_NP_MANAGER_STATUS_ONLINE) { -// m_event = e_event_commerceError; -// reply.returnCode = SCE_TOOLKIT_NP_OFFLINE; -// tmpJob.setError(SCE_TOOLKIT_NP_OFFLINE); -// } else { -// getEntitlementList(&tmpJob); -// } -// break; -// } -// -// case e_message_commerceConsumeEntitlement: -// { -// int state = 0; -// int ret = sceNpManagerGetStatus(&state); -// -// // We don't want to process this if we are offline -// if (ret < 0 || state != SCE_NP_MANAGER_STATUS_ONLINE) { -// m_event = e_event_commerceError; -// reply.returnCode = SCE_TOOLKIT_NP_OFFLINE; -// } else { -// -// ret = consumeEntitlement(*(EntitlementToConsume *)msg.inputArgs); -// if (ret < 0) { -// m_event = e_event_commerceError; -// m_errorCode = ret; -// } else { -// m_event = e_event_commerceConsumedEntitlement; -// } -// } -// _TOOLKIT_NP_DEL (EntitlementToConsume *)msg.inputArgs; -// -// break; -// } -// - case e_message_commerceCheckout: - { - ret = checkout(m_checkoutInputParams); - if (ret < 0) { - m_event = e_event_commerceError; - m_errorCode = ret; - } - break; - } + default: + break; + } - case e_message_commerceDownloadList: - { - ret = downloadList(m_downloadInputParams); - if (ret < 0) { - m_event = e_event_commerceError; - m_errorCode = ret; - } - break; - } - - case e_message_commerceEnd: - app.DebugPrintf("XXX - e_message_commerceEnd!\n"); - ret = commerceEnd(); - if (ret < 0) - { - m_event = e_event_commerceError; - m_errorCode = ret; - } - // 4J-PB - we don't seem to handle the error code here - else if(m_errorCode!=0) - { - m_event = e_event_commerceError; - } - break; - - default: - break; - } - - LeaveCriticalSection(&m_queueLock); + LeaveCriticalSection(&m_queueLock); } +void SonyCommerce::processEvent() { + int ret = 0; -void SonyCommerce::processEvent() -{ - int ret = 0; + switch (m_event) { + case e_event_none: + break; + case e_event_commerceSessionCreated: + app.DebugPrintf(4, "Commerce Session Created.\n"); + runCallback(); + break; + case e_event_commerceSessionAborted: + app.DebugPrintf(4, "Commerce Session aborted.\n"); + runCallback(); + break; + case e_event_commerceGotProductList: + app.DebugPrintf(4, "Got product list.\n"); + runCallback(); + break; + case e_event_commerceGotCategoryInfo: + app.DebugPrintf(4, "Got category info\n"); + runCallback(); + break; + case e_event_commerceGotDetailedProductInfo: + app.DebugPrintf(4, "Got detailed product info.\n"); + runCallback(); + break; + case e_event_commerceAddedDetailedProductInfo: + app.DebugPrintf(4, "Added detailed product info.\n"); + runCallback(); + break; + case e_event_commerceProductBrowseStarted: + break; + case e_event_commerceProductBrowseSuccess: + break; + case e_event_commerceProductBrowseAborted: + break; + case e_event_commerceProductBrowseFinished: + assert(0); + // ret = sys_memory_container_destroy(s_memContainer); + // if (ret < 0) { + // printf("Failed to destroy memory container"); + // } + // s_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; + break; + case e_event_commerceVoucherInputStarted: + break; + case e_event_commerceVoucherInputSuccess: + break; + case e_event_commerceVoucherInputAborted: + break; + case e_event_commerceVoucherInputFinished: + assert(0); + // ret = sys_memory_container_destroy(s_memContainer); + // if (ret < 0) { + // printf("Failed to destroy memory container"); + // } + // s_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; + break; + case e_event_commerceGotEntitlementList: + break; + case e_event_commerceConsumedEntitlement: + break; + case e_event_commerceCheckoutStarted: + app.DebugPrintf(4, "Checkout Started\n"); + break; + case e_event_commerceCheckoutSuccess: + app.DebugPrintf(4, "Checkout succeeded: 0x%x\n", m_errorCode); + // clear the DLC installed and check again + app.ClearDLCInstalled(); + ui.HandleDLCInstalled(0); + break; + case e_event_commerceCheckoutAborted: + app.DebugPrintf(4, "Checkout aborted: 0x%x\n", m_errorCode); + break; + case e_event_commerceCheckoutFinished: + app.DebugPrintf(4, "Checkout Finished: 0x%x\n", m_errorCode); + ret = sys_memory_container_destroy(m_memContainer); + if (ret < 0) { + app.DebugPrintf(4, "Failed to destroy memory container"); + } - switch (m_event) - { - case e_event_none: - break; - case e_event_commerceSessionCreated: - app.DebugPrintf(4,"Commerce Session Created.\n"); - runCallback(); - break; - case e_event_commerceSessionAborted: - app.DebugPrintf(4,"Commerce Session aborted.\n"); - runCallback(); - break; - case e_event_commerceGotProductList: - app.DebugPrintf(4,"Got product list.\n"); - runCallback(); - break; - case e_event_commerceGotCategoryInfo: - app.DebugPrintf(4,"Got category info\n"); - runCallback(); - break; - case e_event_commerceGotDetailedProductInfo: - app.DebugPrintf(4,"Got detailed product info.\n"); - runCallback(); - break; - case e_event_commerceAddedDetailedProductInfo: - app.DebugPrintf(4,"Added detailed product info.\n"); - runCallback(); - break; - case e_event_commerceProductBrowseStarted: - break; - case e_event_commerceProductBrowseSuccess: - break; - case e_event_commerceProductBrowseAborted: - break; - case e_event_commerceProductBrowseFinished: - assert(0); -// ret = sys_memory_container_destroy(s_memContainer); -// if (ret < 0) { -// printf("Failed to destroy memory container"); -// } -// s_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; - break; - case e_event_commerceVoucherInputStarted: - break; - case e_event_commerceVoucherInputSuccess: - break; - case e_event_commerceVoucherInputAborted: - break; - case e_event_commerceVoucherInputFinished: - assert(0); -// ret = sys_memory_container_destroy(s_memContainer); -// if (ret < 0) { -// printf("Failed to destroy memory container"); -// } -// s_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; - break; - case e_event_commerceGotEntitlementList: - break; - case e_event_commerceConsumedEntitlement: - break; - case e_event_commerceCheckoutStarted: - app.DebugPrintf(4,"Checkout Started\n"); - break; - case e_event_commerceCheckoutSuccess: - app.DebugPrintf(4,"Checkout succeeded: 0x%x\n", m_errorCode); - // clear the DLC installed and check again - app.ClearDLCInstalled(); - ui.HandleDLCInstalled(0); - break; - case e_event_commerceCheckoutAborted: - app.DebugPrintf(4,"Checkout aborted: 0x%x\n", m_errorCode); - break; - case e_event_commerceCheckoutFinished: - app.DebugPrintf(4,"Checkout Finished: 0x%x\n", m_errorCode); - ret = sys_memory_container_destroy(m_memContainer); - if (ret < 0) { - app.DebugPrintf(4,"Failed to destroy memory container"); - } + m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; + // 4J-PB - if there's been an error - like dlc already purchased, + // the runcallback has already happened, and will crash this time + if (m_callbackFunc != NULL) { + runCallback(); + } + break; + case e_event_commerceDownloadListStarted: + app.DebugPrintf(4, "Download List Started\n"); + break; + case e_event_commerceDownloadListSuccess: + app.DebugPrintf(4, "Download succeeded: 0x%x\n", m_errorCode); + break; + case e_event_commerceDownloadListFinished: + app.DebugPrintf(4, "Download Finished: 0x%x\n", m_errorCode); + ret = sys_memory_container_destroy(m_memContainer); + if (ret < 0) { + app.DebugPrintf(4, "Failed to destroy memory container"); + } - m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; - // 4J-PB - if there's been an error - like dlc already purchased, the runcallback has already happened, and will crash this time - if(m_callbackFunc!=NULL) - { - runCallback(); - } - break; - case e_event_commerceDownloadListStarted: - app.DebugPrintf(4,"Download List Started\n"); - break; - case e_event_commerceDownloadListSuccess: - app.DebugPrintf(4,"Download succeeded: 0x%x\n", m_errorCode); - break; - case e_event_commerceDownloadListFinished: - app.DebugPrintf(4,"Download Finished: 0x%x\n", m_errorCode); - ret = sys_memory_container_destroy(m_memContainer); - if (ret < 0) { - app.DebugPrintf(4,"Failed to destroy memory container"); - } + m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; + // 4J-PB - if there's been an error - like dlc already purchased, + // the runcallback has already happened, and will crash this time + if (m_callbackFunc != NULL) { + runCallback(); + } + break; + case e_event_commerceError: + app.DebugPrintf(4, "Commerce Error 0x%x\n", m_errorCode); - m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; - // 4J-PB - if there's been an error - like dlc already purchased, the runcallback has already happened, and will crash this time - if(m_callbackFunc!=NULL) - { - runCallback(); - } - break; - case e_event_commerceError: - app.DebugPrintf(4,"Commerce Error 0x%x\n", m_errorCode); + if (m_memContainer != SYS_MEMORY_CONTAINER_ID_INVALID) { + ret = sys_memory_container_destroy(m_memContainer); + if (ret < 0) { + app.DebugPrintf(4, "Failed to destroy memory container"); + } - if(m_memContainer != SYS_MEMORY_CONTAINER_ID_INVALID) - { - ret = sys_memory_container_destroy(m_memContainer); - if (ret < 0) { - app.DebugPrintf(4,"Failed to destroy memory container"); - } + m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; + } - m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; - } - - runCallback(); - break; - default: - break; - } - m_event = e_event_none; + runCallback(); + break; + default: + break; + } + m_event = e_event_none; } +int SonyCommerce::commerceEnd() { + int ret = 0; -int SonyCommerce::commerceEnd() -{ - int ret = 0; + if (m_currentPhase == e_phase_voucherRedeemPhase) + ret = sceNpCommerce2DoProductCodeFinishAsync(m_contextId); + else if (m_currentPhase == e_phase_productBrowsePhase) + ret = sceNpCommerce2DoProductBrowseFinishAsync(m_contextId); + else if (m_currentPhase == e_phase_creatingSessionPhase) + ret = sceNpCommerce2CreateSessionFinish(m_contextId, &m_sessionInfo); + else if (m_currentPhase == e_phase_checkoutPhase) + ret = sceNpCommerce2DoCheckoutFinishAsync(m_contextId); + else if (m_currentPhase == e_phase_downloadListPhase) + ret = sceNpCommerce2DoDlListFinishAsync(m_contextId); - if (m_currentPhase == e_phase_voucherRedeemPhase) - ret = sceNpCommerce2DoProductCodeFinishAsync(m_contextId); - else if (m_currentPhase == e_phase_productBrowsePhase) - ret = sceNpCommerce2DoProductBrowseFinishAsync(m_contextId); - else if (m_currentPhase == e_phase_creatingSessionPhase) - ret = sceNpCommerce2CreateSessionFinish(m_contextId, &m_sessionInfo); - else if (m_currentPhase == e_phase_checkoutPhase) - ret = sceNpCommerce2DoCheckoutFinishAsync(m_contextId); - else if (m_currentPhase == e_phase_downloadListPhase) - ret = sceNpCommerce2DoDlListFinishAsync(m_contextId); - - m_currentPhase = e_phase_idle; + m_currentPhase = e_phase_idle; - return ret; + return ret; } -void SonyCommerce::CreateSession( CallbackFunc cb, void* lpParam ) -{ - Init(); - EnterCriticalSection(&m_queueLock); - setCallback(cb,lpParam); - m_messageQueue.push(e_message_commerceCreateSession); - if(m_tickThread == NULL) - m_tickThread = new C4JThread(TickLoop, NULL, "SonyCommerce tick"); - if(m_tickThread->isRunning() == false) - { - m_currentPhase = e_phase_idle; - m_tickThread->Run(); - } - LeaveCriticalSection(&m_queueLock); +void SonyCommerce::CreateSession(CallbackFunc cb, void* lpParam) { + Init(); + EnterCriticalSection(&m_queueLock); + setCallback(cb, lpParam); + m_messageQueue.push(e_message_commerceCreateSession); + if (m_tickThread == NULL) + m_tickThread = new C4JThread(TickLoop, NULL, "SonyCommerce tick"); + if (m_tickThread->isRunning() == false) { + m_currentPhase = e_phase_idle; + m_tickThread->Run(); + } + LeaveCriticalSection(&m_queueLock); } -void SonyCommerce::CloseSession() -{ - assert(m_currentPhase == e_phase_idle); - m_currentPhase = e_phase_stopped; - Shutdown(); +void SonyCommerce::CloseSession() { + assert(m_currentPhase == e_phase_idle); + m_currentPhase = e_phase_stopped; + Shutdown(); } -void SonyCommerce::GetProductList( CallbackFunc cb, void* lpParam, std::vector* productList, const char *categoryId) -{ - EnterCriticalSection(&m_queueLock); - setCallback(cb,lpParam); - m_pProductInfoList = productList; - strcpy(m_pCategoryID,categoryId); - m_messageQueue.push(e_message_commerceGetProductList); - LeaveCriticalSection(&m_queueLock); +void SonyCommerce::GetProductList(CallbackFunc cb, void* lpParam, + std::vector* productList, + const char* categoryId) { + EnterCriticalSection(&m_queueLock); + setCallback(cb, lpParam); + m_pProductInfoList = productList; + strcpy(m_pCategoryID, categoryId); + m_messageQueue.push(e_message_commerceGetProductList); + LeaveCriticalSection(&m_queueLock); } -void SonyCommerce::GetDetailedProductInfo( CallbackFunc cb, void* lpParam, ProductInfoDetailed* productInfo, const char *productId, const char *categoryId ) -{ - EnterCriticalSection(&m_queueLock); - setCallback(cb,lpParam); - m_pProductInfoDetailed = productInfo; - m_pProductID = productId; - strcpy(m_pCategoryID,categoryId); - m_messageQueue.push(e_message_commerceGetDetailedProductInfo); - LeaveCriticalSection(&m_queueLock); +void SonyCommerce::GetDetailedProductInfo(CallbackFunc cb, void* lpParam, + ProductInfoDetailed* productInfo, + const char* productId, + const char* categoryId) { + EnterCriticalSection(&m_queueLock); + setCallback(cb, lpParam); + m_pProductInfoDetailed = productInfo; + m_pProductID = productId; + strcpy(m_pCategoryID, categoryId); + m_messageQueue.push(e_message_commerceGetDetailedProductInfo); + LeaveCriticalSection(&m_queueLock); } // 4J-PB - fill out the long description and the price for the product -void SonyCommerce::AddDetailedProductInfo( CallbackFunc cb, void* lpParam, ProductInfo* productInfo, const char *productId, const char *categoryId ) -{ - EnterCriticalSection(&m_queueLock); - setCallback(cb,lpParam); - m_pProductInfo = productInfo; - m_pProductID = productId; - strcpy(m_pCategoryID,categoryId); - m_messageQueue.push(e_message_commerceAddDetailedProductInfo); - LeaveCriticalSection(&m_queueLock); +void SonyCommerce::AddDetailedProductInfo(CallbackFunc cb, void* lpParam, + ProductInfo* productInfo, + const char* productId, + const char* categoryId) { + EnterCriticalSection(&m_queueLock); + setCallback(cb, lpParam); + m_pProductInfo = productInfo; + m_pProductID = productId; + strcpy(m_pCategoryID, categoryId); + m_messageQueue.push(e_message_commerceAddDetailedProductInfo); + LeaveCriticalSection(&m_queueLock); } -void SonyCommerce::GetCategoryInfo( CallbackFunc cb, void* lpParam, CategoryInfo *info, const char *categoryId ) -{ - EnterCriticalSection(&m_queueLock); - setCallback(cb,lpParam); - m_pCategoryInfo = info; - strcpy(m_pCategoryID,categoryId); - m_messageQueue.push(e_message_commerceGetCategoryInfo); - LeaveCriticalSection(&m_queueLock); +void SonyCommerce::GetCategoryInfo(CallbackFunc cb, void* lpParam, + CategoryInfo* info, const char* categoryId) { + EnterCriticalSection(&m_queueLock); + setCallback(cb, lpParam); + m_pCategoryInfo = info; + strcpy(m_pCategoryID, categoryId); + m_messageQueue.push(e_message_commerceGetCategoryInfo); + LeaveCriticalSection(&m_queueLock); } -void SonyCommerce::Checkout( CallbackFunc cb, void* lpParam, const char* skuID ) -{ - if(m_memContainer != SYS_MEMORY_CONTAINER_ID_INVALID) - { - return; - } - EnterCriticalSection(&m_queueLock); - setCallback(cb,lpParam); - int ret = sys_memory_container_create(&m_memContainer, SCE_NP_COMMERCE2_DO_CHECKOUT_MEMORY_CONTAINER_SIZE); - if (ret < 0) - { - app.DebugPrintf(4,"sys_memory_container_create() failed. ret = 0x%x\n", ret); - } +void SonyCommerce::Checkout(CallbackFunc cb, void* lpParam, const char* skuID) { + if (m_memContainer != SYS_MEMORY_CONTAINER_ID_INVALID) { + return; + } + EnterCriticalSection(&m_queueLock); + setCallback(cb, lpParam); + int ret = sys_memory_container_create( + &m_memContainer, SCE_NP_COMMERCE2_DO_CHECKOUT_MEMORY_CONTAINER_SIZE); + if (ret < 0) { + app.DebugPrintf(4, "sys_memory_container_create() failed. ret = 0x%x\n", + ret); + } - m_checkoutInputParams.memContainer = &m_memContainer; - m_checkoutInputParams.skuIds.clear(); - m_checkoutInputParams.skuIds.push_back(skuID); - m_messageQueue.push(e_message_commerceCheckout); - LeaveCriticalSection(&m_queueLock); + m_checkoutInputParams.memContainer = &m_memContainer; + m_checkoutInputParams.skuIds.clear(); + m_checkoutInputParams.skuIds.push_back(skuID); + m_messageQueue.push(e_message_commerceCheckout); + LeaveCriticalSection(&m_queueLock); } -void SonyCommerce::DownloadAlreadyPurchased( CallbackFunc cb, void* lpParam, const char* skuID ) -{ - if(m_memContainer != SYS_MEMORY_CONTAINER_ID_INVALID) - return; - EnterCriticalSection(&m_queueLock); - setCallback(cb,lpParam); - int ret = sys_memory_container_create(&m_memContainer, SCE_NP_COMMERCE2_DO_CHECKOUT_MEMORY_CONTAINER_SIZE); - if (ret < 0) - { - app.DebugPrintf(4,"sys_memory_container_create() failed. ret = 0x%x\n", ret); - } +void SonyCommerce::DownloadAlreadyPurchased(CallbackFunc cb, void* lpParam, + const char* skuID) { + if (m_memContainer != SYS_MEMORY_CONTAINER_ID_INVALID) return; + EnterCriticalSection(&m_queueLock); + setCallback(cb, lpParam); + int ret = sys_memory_container_create( + &m_memContainer, SCE_NP_COMMERCE2_DO_CHECKOUT_MEMORY_CONTAINER_SIZE); + if (ret < 0) { + app.DebugPrintf(4, "sys_memory_container_create() failed. ret = 0x%x\n", + ret); + } - m_downloadInputParams.memContainer = &m_memContainer; - m_downloadInputParams.skuIds.clear(); - m_downloadInputParams.skuIds.push_back(skuID); - m_messageQueue.push(e_message_commerceDownloadList); - LeaveCriticalSection(&m_queueLock); + m_downloadInputParams.memContainer = &m_memContainer; + m_downloadInputParams.skuIds.clear(); + m_downloadInputParams.skuIds.push_back(skuID); + m_messageQueue.push(e_message_commerceDownloadList); + LeaveCriticalSection(&m_queueLock); } - - diff --git a/Minecraft.Client/Platform/Common/Network/Sony/SonyCommerce.h b/Minecraft.Client/Platform/Common/Network/Sony/SonyCommerce.h index 8b0e2e4dd..fa92357e4 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/SonyCommerce.h +++ b/Minecraft.Client/Platform/Common/Network/Sony/SonyCommerce.h @@ -10,164 +10,257 @@ #elif defined __PSVITA__ #include #include -#else // __ORBIS__ +#else // __ORBIS__ -#define SCE_NP_COMMERCE2_CATEGORY_ID_LEN SCE_TOOLKIT_NP_COMMERCE_CATEGORY_ID_LEN ///< The size of the category ID. -#define SCE_NP_COMMERCE2_PRODUCT_ID_LEN SCE_TOOLKIT_NP_COMMERCE_PRODUCT_ID_LEN ///< The size of the product ID. -#define SCE_NP_COMMERCE2_CATEGORY_NAME_LEN SCE_TOOLKIT_NP_COMMERCE_CATEGORY_NAME_LEN ///< The size of the category name. -#define SCE_NP_COMMERCE2_CATEGORY_DESCRIPTION_LEN SCE_TOOLKIT_NP_COMMERCE_CATEGORY_DESCRIPTION_LEN ///< The size of the category description. -#define SCE_NP_COMMERCE2_URL_LEN SCE_TOOLKIT_NP_COMMERCE_URL_LEN ///< The size of the URL. -#define SCE_NP_COMMERCE2_PRODUCT_NAME_LEN SCE_TOOLKIT_NP_COMMERCE_PRODUCT_NAME_LEN ///< The size of the product name. -#define SCE_NP_COMMERCE2_PRODUCT_SHORT_DESCRIPTION_LEN SCE_TOOLKIT_NP_COMMERCE_PRODUCT_SHORT_DESCRIPTION_LEN ///< The size of the product short description. -#define SCE_NP_COMMERCE2_SP_NAME_LEN SCE_TOOLKIT_NP_COMMERCE_SP_NAME_LEN ///< The size of the licensee (publisher) name. -#define SCE_NP_COMMERCE2_CURRENCY_CODE_LEN SCE_TOOLKIT_NP_COMMERCE_CURRENCY_CODE_LEN ///< The size of currency code. -#define SCE_NP_COMMERCE2_CURRENCY_CODE_LEN SCE_TOOLKIT_NP_COMMERCE_CURRENCY_CODE_LEN -#define SCE_NP_COMMERCE2_CURRENCY_SYMBOL_LEN SCE_TOOLKIT_NP_COMMERCE_CURRENCY_SYMBOL_LEN ///< The size of currency symbol. -#define SCE_NP_COMMERCE2_THOUSAND_SEPARATOR_LEN SCE_TOOLKIT_NP_COMMERCE_THOUSAND_SEPARATOR_LEN ///< The size of the character separating every 3 digits of the price. -#define SCE_NP_COMMERCE2_DECIMAL_LETTER_LEN SCE_TOOLKIT_NP_COMMERCE_DECIMAL_LETTER_LEN ///< The size of the character indicating the decimal point in the price. -#define SCE_NP_COMMERCE2_SKU_ID_LEN SCE_TOOLKIT_NP_COMMERCE_SKU_ID_LEN ///< The size of the SKU ID. -#define SCE_NP_COMMERCE2_PRODUCT_LONG_DESCRIPTION_LEN SCE_TOOLKIT_NP_COMMERCE_PRODUCT_LONG_DESCRIPTION_LEN ///< The size of the product long description. -#define SCE_NP_COMMERCE2_PRODUCT_LEGAL_DESCRIPTION_LEN SCE_TOOLKIT_NP_COMMERCE_PRODUCT_LEGAL_DESCRIPTION_LEN ///< The size of the product legal description. -#define SCE_NP_COMMERCE2_RATING_SYSTEM_ID_LEN SCE_TOOLKIT_NP_COMMERCE_RATING_SYSTEM_ID_LEN ///< The size of the rating system ID. -#define SCE_NP_ENTITLEMENT_ID_SIZE SCE_TOOLKIT_NP_COMMERCE_ENTITLEMENT_ID_LEN ///< The size of entitlement ID. +#define SCE_NP_COMMERCE2_CATEGORY_ID_LEN \ + SCE_TOOLKIT_NP_COMMERCE_CATEGORY_ID_LEN ///< The size of the category ID. +#define SCE_NP_COMMERCE2_PRODUCT_ID_LEN \ + SCE_TOOLKIT_NP_COMMERCE_PRODUCT_ID_LEN ///< The size of the product ID. +#define SCE_NP_COMMERCE2_CATEGORY_NAME_LEN \ + SCE_TOOLKIT_NP_COMMERCE_CATEGORY_NAME_LEN ///< The size of the category + ///< name. +#define SCE_NP_COMMERCE2_CATEGORY_DESCRIPTION_LEN \ + SCE_TOOLKIT_NP_COMMERCE_CATEGORY_DESCRIPTION_LEN ///< The size of the + ///< category description. +#define SCE_NP_COMMERCE2_URL_LEN \ + SCE_TOOLKIT_NP_COMMERCE_URL_LEN ///< The size of the URL. +#define SCE_NP_COMMERCE2_PRODUCT_NAME_LEN \ + SCE_TOOLKIT_NP_COMMERCE_PRODUCT_NAME_LEN ///< The size of the product name. +#define SCE_NP_COMMERCE2_PRODUCT_SHORT_DESCRIPTION_LEN \ + SCE_TOOLKIT_NP_COMMERCE_PRODUCT_SHORT_DESCRIPTION_LEN ///< The size of the + ///< product short + ///< description. +#define SCE_NP_COMMERCE2_SP_NAME_LEN \ + SCE_TOOLKIT_NP_COMMERCE_SP_NAME_LEN ///< The size of the licensee + ///< (publisher) name. +#define SCE_NP_COMMERCE2_CURRENCY_CODE_LEN \ + SCE_TOOLKIT_NP_COMMERCE_CURRENCY_CODE_LEN ///< The size of currency code. +#define SCE_NP_COMMERCE2_CURRENCY_CODE_LEN \ + SCE_TOOLKIT_NP_COMMERCE_CURRENCY_CODE_LEN +#define SCE_NP_COMMERCE2_CURRENCY_SYMBOL_LEN \ + SCE_TOOLKIT_NP_COMMERCE_CURRENCY_SYMBOL_LEN ///< The size of currency + ///< symbol. +#define SCE_NP_COMMERCE2_THOUSAND_SEPARATOR_LEN \ + SCE_TOOLKIT_NP_COMMERCE_THOUSAND_SEPARATOR_LEN ///< The size of the + ///< character separating + ///< every 3 digits of the + ///< price. +#define SCE_NP_COMMERCE2_DECIMAL_LETTER_LEN \ + SCE_TOOLKIT_NP_COMMERCE_DECIMAL_LETTER_LEN ///< The size of the character + ///< indicating the decimal + ///< point in the price. +#define SCE_NP_COMMERCE2_SKU_ID_LEN \ + SCE_TOOLKIT_NP_COMMERCE_SKU_ID_LEN ///< The size of the SKU ID. +#define SCE_NP_COMMERCE2_PRODUCT_LONG_DESCRIPTION_LEN \ + SCE_TOOLKIT_NP_COMMERCE_PRODUCT_LONG_DESCRIPTION_LEN ///< The size of the + ///< product long + ///< description. +#define SCE_NP_COMMERCE2_PRODUCT_LEGAL_DESCRIPTION_LEN \ + SCE_TOOLKIT_NP_COMMERCE_PRODUCT_LEGAL_DESCRIPTION_LEN ///< The size of the + ///< product legal + ///< description. +#define SCE_NP_COMMERCE2_RATING_SYSTEM_ID_LEN \ + SCE_TOOLKIT_NP_COMMERCE_RATING_SYSTEM_ID_LEN ///< The size of the rating + ///< system ID. +#define SCE_NP_ENTITLEMENT_ID_SIZE \ + SCE_TOOLKIT_NP_COMMERCE_ENTITLEMENT_ID_LEN ///< The size of entitlement ID. #endif #ifndef __PSVITA__ -#define SCE_TOOLKIT_NP_SKU_PRICE_LEN (SCE_NP_COMMERCE2_CURRENCY_CODE_LEN \ - + SCE_NP_COMMERCE2_CURRENCY_SYMBOL_LEN \ - + SCE_NP_COMMERCE2_THOUSAND_SEPARATOR_LEN \ - + SCE_NP_COMMERCE2_DECIMAL_LETTER_LEN) ///< The maximum length of a price in characters. +#define SCE_TOOLKIT_NP_SKU_PRICE_LEN \ + (SCE_NP_COMMERCE2_CURRENCY_CODE_LEN + \ + SCE_NP_COMMERCE2_CURRENCY_SYMBOL_LEN + \ + SCE_NP_COMMERCE2_THOUSAND_SEPARATOR_LEN + \ + SCE_NP_COMMERCE2_DECIMAL_LETTER_LEN) ///< The maximum length of a price in + ///< characters. #endif -class SonyCommerce -{ - +class SonyCommerce { public: - typedef void (*CallbackFunc)(void* lpParam, int error_code); + typedef void (*CallbackFunc)(void* lpParam, int error_code); + /// @brief + /// Contains information about a subcategory on the PlayStation(R)Store. + /// + /// Contains information about a subcategory on the PlayStation(R)Store. + typedef struct CategoryInfoSub { + char categoryId[SCE_NP_COMMERCE2_CATEGORY_ID_LEN]; ///< The ID of the + ///< subcategory. + char + categoryName[SCE_NP_COMMERCE2_CATEGORY_NAME_LEN]; ///< The name of + ///< the + ///< subcategory. + char categoryDescription + [SCE_NP_COMMERCE2_CATEGORY_DESCRIPTION_LEN]; ///< The detailed + ///< description of + ///< the subcategory. + char imageUrl[SCE_NP_COMMERCE2_URL_LEN]; ///< The image URL of the + ///< subcategory. + } CategoryInfoSub; - /// @brief - /// Contains information about a subcategory on the PlayStation(R)Store. - /// - /// Contains information about a subcategory on the PlayStation(R)Store. - typedef struct CategoryInfoSub - { - char categoryId[SCE_NP_COMMERCE2_CATEGORY_ID_LEN]; ///< The ID of the subcategory. - char categoryName[SCE_NP_COMMERCE2_CATEGORY_NAME_LEN]; ///< The name of the subcategory. - char categoryDescription[SCE_NP_COMMERCE2_CATEGORY_DESCRIPTION_LEN]; ///< The detailed description of the subcategory. - char imageUrl[SCE_NP_COMMERCE2_URL_LEN]; ///< The image URL of the subcategory. - } - CategoryInfoSub; + /// @brief + /// Current category information + /// + /// This structure contains information about a category on the + /// PlayStation(R)Store + typedef struct CategoryInfo { + CategoryInfoSub current; ///< The currently selected subcategory. + std::list + subCategories; ///< Information about the subcategories in this + ///< category. + uint32_t countOfProducts; ///< The number of products in the category. + uint32_t countOfSubCategories; ///< The number of subcategories. + } CategoryInfo; - /// @brief - /// Current category information - /// - /// This structure contains information about a category on the PlayStation(R)Store - typedef struct CategoryInfo - { - CategoryInfoSub current; ///< The currently selected subcategory. - std::list subCategories; ///< Information about the subcategories in this category. - uint32_t countOfProducts; ///< The number of products in the category. - uint32_t countOfSubCategories; ///< The number of subcategories. - } - CategoryInfo; - - /// Contains information about a product in the PlayStation(R)Store. - typedef struct ProductInfo - { - uint32_t purchasabilityFlag; ///< A flag that indicates whether the product can be purchased (SCE_NP_COMMERCE2_SKU_PURCHASABILITY_FLAG_XXX). - uint32_t annotation; // SCE_NP_COMMERCE2_SKU_ANN_PURCHASED_CANNOT_PURCHASE_AGAIN or SCE_NP_COMMERCE2_SKU_ANN_PURCHASED_CAN_PURCHASE_AGAIN - uint32_t ui32Price; - char productId[SCE_NP_COMMERCE2_PRODUCT_ID_LEN]; ///< The product ID. - char productName[SCE_NP_COMMERCE2_PRODUCT_NAME_LEN]; ///< The name of the product. - char shortDescription[SCE_NP_COMMERCE2_PRODUCT_SHORT_DESCRIPTION_LEN]; ///< A short description of the product. - char longDescription[SCE_NP_COMMERCE2_PRODUCT_LONG_DESCRIPTION_LEN]; ///< A long description of the product. - char skuId[SCE_NP_COMMERCE2_SKU_ID_LEN]; ///< The SKU ID - char spName[SCE_NP_COMMERCE2_SP_NAME_LEN]; ///< The service provider name. - char imageUrl[SCE_NP_COMMERCE2_URL_LEN]; ///< The product image URL. - char price[SCE_TOOLKIT_NP_SKU_PRICE_LEN]; ///< The price of the product. This is formatted to include the currency code. - char padding[6]; ///< Padding. + /// Contains information about a product in the PlayStation(R)Store. + typedef struct ProductInfo { + uint32_t + purchasabilityFlag; ///< A flag that indicates whether the product + ///< can be purchased + ///< (SCE_NP_COMMERCE2_SKU_PURCHASABILITY_FLAG_XXX). + uint32_t + annotation; // SCE_NP_COMMERCE2_SKU_ANN_PURCHASED_CANNOT_PURCHASE_AGAIN + // or + // SCE_NP_COMMERCE2_SKU_ANN_PURCHASED_CAN_PURCHASE_AGAIN + uint32_t ui32Price; + char productId[SCE_NP_COMMERCE2_PRODUCT_ID_LEN]; ///< The product ID. + char productName[SCE_NP_COMMERCE2_PRODUCT_NAME_LEN]; ///< The name of + ///< the product. + char shortDescription + [SCE_NP_COMMERCE2_PRODUCT_SHORT_DESCRIPTION_LEN]; ///< A short + ///< description + ///< of the + ///< product. + char longDescription + [SCE_NP_COMMERCE2_PRODUCT_LONG_DESCRIPTION_LEN]; ///< A long + ///< description + ///< of the + ///< product. + char skuId[SCE_NP_COMMERCE2_SKU_ID_LEN]; ///< The SKU ID + char spName[SCE_NP_COMMERCE2_SP_NAME_LEN]; ///< The service provider + ///< name. + char imageUrl[SCE_NP_COMMERCE2_URL_LEN]; ///< The product image URL. + char price[SCE_TOOLKIT_NP_SKU_PRICE_LEN]; ///< The price of the + ///< product. This is + ///< formatted to include the + ///< currency code. + char padding[6]; ///< Padding. #ifdef __PS3__ - CellRtcTick releaseDate; ///< The product release date. + CellRtcTick releaseDate; ///< The product release date. #else - SceRtcTick releaseDate; + SceRtcTick releaseDate; #endif - } - ProductInfo; + } ProductInfo; - /// @brief - /// Contains detailed information about a product on the PlayStation(R)Store. - /// - /// Contains detailed information about a product on the PlayStation(R)Store. - typedef struct ProductInfoDetailed - { - uint32_t purchasabilityFlag; ///< A flag that indicates whether the product can be purchased (SCE_NP_COMMERCE2_SKU_PURCHASABILITY_FLAG_XXX). - uint32_t ui32Price; - char skuId[SCE_NP_COMMERCE2_SKU_ID_LEN]; ///< The SKU ID - char productId[SCE_NP_COMMERCE2_PRODUCT_ID_LEN]; ///< The product ID. - char productName[SCE_NP_COMMERCE2_PRODUCT_NAME_LEN]; ///< The name of the product. - char shortDescription[SCE_NP_COMMERCE2_PRODUCT_SHORT_DESCRIPTION_LEN]; ///< A short description of the product. - char longDescription[SCE_NP_COMMERCE2_PRODUCT_LONG_DESCRIPTION_LEN]; ///< A long description of the product. - char legalDescription[SCE_NP_COMMERCE2_PRODUCT_LEGAL_DESCRIPTION_LEN]; ///< The legal description for the product. - char spName[SCE_NP_COMMERCE2_SP_NAME_LEN]; ///< The service provider name. - char imageUrl[SCE_NP_COMMERCE2_URL_LEN]; ///< The product image URL. - char price[SCE_TOOLKIT_NP_SKU_PRICE_LEN]; ///< The price of the product. This is formatted to include the currency code. - char ratingSystemId[SCE_NP_COMMERCE2_RATING_SYSTEM_ID_LEN]; ///< The ID of the rating system (for example: PEGI, ESRB). - char ratingImageUrl[SCE_NP_COMMERCE2_URL_LEN]; ///< The URL of the rating icon. - char padding[2]; ///< Padding. + /// @brief + /// Contains detailed information about a product on the + /// PlayStation(R)Store. + /// + /// Contains detailed information about a product on the + /// PlayStation(R)Store. + typedef struct ProductInfoDetailed { + uint32_t + purchasabilityFlag; ///< A flag that indicates whether the product + ///< can be purchased + ///< (SCE_NP_COMMERCE2_SKU_PURCHASABILITY_FLAG_XXX). + uint32_t ui32Price; + char skuId[SCE_NP_COMMERCE2_SKU_ID_LEN]; ///< The SKU ID + char productId[SCE_NP_COMMERCE2_PRODUCT_ID_LEN]; ///< The product ID. + char productName[SCE_NP_COMMERCE2_PRODUCT_NAME_LEN]; ///< The name of + ///< the product. + char shortDescription + [SCE_NP_COMMERCE2_PRODUCT_SHORT_DESCRIPTION_LEN]; ///< A short + ///< description + ///< of the + ///< product. + char longDescription + [SCE_NP_COMMERCE2_PRODUCT_LONG_DESCRIPTION_LEN]; ///< A long + ///< description + ///< of the + ///< product. + char legalDescription + [SCE_NP_COMMERCE2_PRODUCT_LEGAL_DESCRIPTION_LEN]; ///< The legal + ///< description + ///< for the + ///< product. + char spName[SCE_NP_COMMERCE2_SP_NAME_LEN]; ///< The service provider + ///< name. + char imageUrl[SCE_NP_COMMERCE2_URL_LEN]; ///< The product image URL. + char price[SCE_TOOLKIT_NP_SKU_PRICE_LEN]; ///< The price of the + ///< product. This is + ///< formatted to include the + ///< currency code. + char ratingSystemId + [SCE_NP_COMMERCE2_RATING_SYSTEM_ID_LEN]; ///< The ID of the rating + ///< system (for example: + ///< PEGI, ESRB). + char ratingImageUrl[SCE_NP_COMMERCE2_URL_LEN]; ///< The URL of the + ///< rating icon. + char padding[2]; ///< Padding. #ifdef __PS3__ - std::list ratingDescriptors; ///< The list of rating descriptors. - CellRtcTick releaseDate; ///< The product release date. -#else - SceRtcTick releaseDate; ///< The product release date. + std::list + ratingDescriptors; ///< The list of rating descriptors. + CellRtcTick releaseDate; ///< The product release date. +#else + SceRtcTick releaseDate; ///< The product release date. #endif - } - ProductInfoDetailed; + } ProductInfoDetailed; - /// @brief - /// Checkout parameters - /// - /// This structure contains list of SKUs to checkout to and a memory container - typedef struct CheckoutInputParams - { - std::list skuIds; ///< List of SKU IDs + /// @brief + /// Checkout parameters + /// + /// This structure contains list of SKUs to checkout to and a memory + /// container + typedef struct CheckoutInputParams { + std::list skuIds; ///< List of SKU IDs #ifdef __PS3__ - sys_memory_container_t *memContainer; ///< Memory container for checkout overlay + sys_memory_container_t* + memContainer; ///< Memory container for checkout overlay #endif - } - CheckoutInputParams; + } CheckoutInputParams; - /// @brief - /// Contains download list parameters. - /// - /// Contains download list parameters. - typedef struct DownloadListInputParams - { - std::list skuIds; ///< The list of SKU IDs + /// @brief + /// Contains download list parameters. + /// + /// Contains download list parameters. + typedef struct DownloadListInputParams { + std::list skuIds; ///< The list of SKU IDs #ifdef __PS3__ - sys_memory_container_t *memContainer; ///< A memory container for checkout overlay. + sys_memory_container_t* + memContainer; ///< A memory container for checkout overlay. #endif - const char* categoryID; - } - DownloadListInputParams; - + const char* categoryID; + } DownloadListInputParams; public: - virtual void CreateSession(CallbackFunc cb, void* lpParam) = 0; - virtual void CloseSession() = 0; + virtual void CreateSession(CallbackFunc cb, void* lpParam) = 0; + virtual void CloseSession() = 0; - virtual void GetCategoryInfo(CallbackFunc cb, void* lpParam, CategoryInfo *info, const char *categoryId) = 0; - virtual void GetProductList(CallbackFunc cb, void* lpParam, std::vector* productList, const char *categoryId) = 0; - virtual void GetDetailedProductInfo(CallbackFunc cb, void* lpParam, ProductInfoDetailed* productInfoDetailed, const char *productId, const char *categoryId) = 0; - virtual void AddDetailedProductInfo( CallbackFunc cb, void* lpParam, ProductInfo* productInfo, const char *productId, const char *categoryId ) = 0; - virtual void Checkout(CallbackFunc cb, void* lpParam, const char* skuID) = 0; - virtual void DownloadAlreadyPurchased(CallbackFunc cb, void* lpParam, const char* skuID) = 0; -#if defined(__ORBIS__) || defined( __PSVITA__) - virtual void Checkout_Game(CallbackFunc cb, void* lpParam, const char* skuID) = 0; - virtual void DownloadAlreadyPurchased_Game(CallbackFunc cb, void* lpParam, const char* skuID) = 0; + virtual void GetCategoryInfo(CallbackFunc cb, void* lpParam, + CategoryInfo* info, + const char* categoryId) = 0; + virtual void GetProductList(CallbackFunc cb, void* lpParam, + std::vector* productList, + const char* categoryId) = 0; + virtual void GetDetailedProductInfo( + CallbackFunc cb, void* lpParam, + ProductInfoDetailed* productInfoDetailed, const char* productId, + const char* categoryId) = 0; + virtual void AddDetailedProductInfo(CallbackFunc cb, void* lpParam, + ProductInfo* productInfo, + const char* productId, + const char* categoryId) = 0; + virtual void Checkout(CallbackFunc cb, void* lpParam, + const char* skuID) = 0; + virtual void DownloadAlreadyPurchased(CallbackFunc cb, void* lpParam, + const char* skuID) = 0; +#if defined(__ORBIS__) || defined(__PSVITA__) + virtual void Checkout_Game(CallbackFunc cb, void* lpParam, + const char* skuID) = 0; + virtual void DownloadAlreadyPurchased_Game(CallbackFunc cb, void* lpParam, + const char* skuID) = 0; #endif - virtual void UpgradeTrial(CallbackFunc cb, void* lpParam) = 0; - virtual void CheckForTrialUpgradeKey() = 0; - virtual bool LicenseChecked() = 0; - + virtual void UpgradeTrial(CallbackFunc cb, void* lpParam) = 0; + virtual void CheckForTrialUpgradeKey() = 0; + virtual bool LicenseChecked() = 0; }; diff --git a/Minecraft.Client/Platform/Common/Network/Sony/SonyHttp.cpp b/Minecraft.Client/Platform/Common/Network/Sony/SonyHttp.cpp index 9b745a274..78a9a0d3c 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/SonyHttp.cpp +++ b/Minecraft.Client/Platform/Common/Network/Sony/SonyHttp.cpp @@ -1,7 +1,6 @@ #include "../../../Minecraft.World/Platform/stdafx.h" #include "SonyHttp.h" - #ifdef __PS3__ #include "../../../../Platform/PS3/Network/SonyHttp_PS3.h" SonyHttp_PS3 g_SonyHttp; @@ -16,19 +15,11 @@ SonyHttp_Vita g_SonyHttp; #endif +bool SonyHttp::init() { return g_SonyHttp.init(); } +void SonyHttp::shutdown() { g_SonyHttp.shutdown(); } -bool SonyHttp::init() -{ - return g_SonyHttp.init(); -} - -void SonyHttp::shutdown() -{ - g_SonyHttp.shutdown(); -} - -bool SonyHttp::getDataFromURL(const char* szURL, void** ppOutData, int* pDataSize) -{ - return g_SonyHttp.getDataFromURL(szURL, ppOutData, pDataSize); +bool SonyHttp::getDataFromURL(const char* szURL, void** ppOutData, + int* pDataSize) { + return g_SonyHttp.getDataFromURL(szURL, ppOutData, pDataSize); } diff --git a/Minecraft.Client/Platform/Common/Network/Sony/SonyHttp.h b/Minecraft.Client/Platform/Common/Network/Sony/SonyHttp.h index 3fa526b0c..e3595bc0c 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/SonyHttp.h +++ b/Minecraft.Client/Platform/Common/Network/Sony/SonyHttp.h @@ -1,11 +1,9 @@ #pragma once - - -class SonyHttp -{ +class SonyHttp { public: - static bool init(); - static void shutdown(); - static bool getDataFromURL(const char* szURL, void** ppOutData, int* pDataSize); + static bool init(); + static void shutdown(); + static bool getDataFromURL(const char* szURL, void** ppOutData, + int* pDataSize); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Network/Sony/SonyRemoteStorage.cpp b/Minecraft.Client/Platform/Common/Network/Sony/SonyRemoteStorage.cpp index db885e5ea..132c17034 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/SonyRemoteStorage.cpp +++ b/Minecraft.Client/Platform/Common/Network/Sony/SonyRemoteStorage.cpp @@ -3,7 +3,6 @@ #include "../../../Minecraft.World/Platform/stdafx.h" #include "SonyRemoteStorage.h" - static const char sc_remoteSaveFilename[] = "/minecraft_save/gamedata.rs"; #ifdef __PSVITA__ static const char sc_localSaveFilename[] = "CloudSave_Vita.bin"; @@ -18,323 +17,278 @@ static const char sc_localSaveFullPath[] = "/app0/CloudSave_Orbis.bin"; static SceRemoteStorageStatus statParams; - - - -// void remoteStorageGetCallback(void* lpParam, SonyRemoteStorage::Status s, int error_code) +// void remoteStorageGetCallback(void* lpParam, SonyRemoteStorage::Status s, int +// error_code) // { // app.DebugPrintf("remoteStorageGetCallback err : 0x%08x\n"); // } -// -// void remoteStorageCallback(void* lpParam, SonyRemoteStorage::Status s, int error_code) +// +// void remoteStorageCallback(void* lpParam, SonyRemoteStorage::Status s, int +// error_code) // { // app.DebugPrintf("remoteStorageCallback err : 0x%08x\n"); -// -// app.getRemoteStorage()->getRemoteFileInfo(&statParams, remoteStorageGetInfoCallback, NULL); +// +// app.getRemoteStorage()->getRemoteFileInfo(&statParams, +// remoteStorageGetInfoCallback, NULL); // } - - - - - - - -void getSaveInfoReturnCallback(void* lpParam, SonyRemoteStorage::Status s, int error_code) -{ - SonyRemoteStorage* pRemoteStorage = (SonyRemoteStorage*)lpParam; - app.DebugPrintf("remoteStorageGetInfoCallback err : 0x%08x\n", error_code); - if(error_code == 0) - { - for(int i=0;im_getInfoStatus = SonyRemoteStorage::e_infoFound; - pRemoteStorage->m_remoteFileInfo = &statParams.data[i]; - } - } - } - if(pRemoteStorage->m_getInfoStatus != SonyRemoteStorage::e_infoFound) - pRemoteStorage->m_getInfoStatus = SonyRemoteStorage::e_noInfoFound; +void getSaveInfoReturnCallback(void* lpParam, SonyRemoteStorage::Status s, + int error_code) { + SonyRemoteStorage* pRemoteStorage = (SonyRemoteStorage*)lpParam; + app.DebugPrintf("remoteStorageGetInfoCallback err : 0x%08x\n", error_code); + if (error_code == 0) { + for (int i = 0; i < statParams.numFiles; i++) { + if (strcmp(statParams.data[i].fileName, sc_remoteSaveFilename) == + 0) { + // found the file we need in the cloud + pRemoteStorage->m_getInfoStatus = + SonyRemoteStorage::e_infoFound; + pRemoteStorage->m_remoteFileInfo = &statParams.data[i]; + } + } + } + if (pRemoteStorage->m_getInfoStatus != SonyRemoteStorage::e_infoFound) + pRemoteStorage->m_getInfoStatus = SonyRemoteStorage::e_noInfoFound; } - - - - - -static void getSaveInfoInitCallback(void* lpParam, SonyRemoteStorage::Status s, int error_code) -{ - SonyRemoteStorage* pRemoteStorage = (SonyRemoteStorage*)lpParam; - if(error_code != 0) - { - app.DebugPrintf("getSaveInfoInitCallback err : 0x%08x\n", error_code); - pRemoteStorage->m_getInfoStatus = SonyRemoteStorage::e_noInfoFound; - } - else - { - app.DebugPrintf("getSaveInfoInitCallback calling getRemoteFileInfo\n"); - app.getRemoteStorage()->getRemoteFileInfo(&statParams, getSaveInfoReturnCallback, pRemoteStorage); - } +static void getSaveInfoInitCallback(void* lpParam, SonyRemoteStorage::Status s, + int error_code) { + SonyRemoteStorage* pRemoteStorage = (SonyRemoteStorage*)lpParam; + if (error_code != 0) { + app.DebugPrintf("getSaveInfoInitCallback err : 0x%08x\n", error_code); + pRemoteStorage->m_getInfoStatus = SonyRemoteStorage::e_noInfoFound; + } else { + app.DebugPrintf("getSaveInfoInitCallback calling getRemoteFileInfo\n"); + app.getRemoteStorage()->getRemoteFileInfo( + &statParams, getSaveInfoReturnCallback, pRemoteStorage); + } } -void SonyRemoteStorage::getSaveInfo() -{ - if(m_getInfoStatus == e_gettingInfo) - { - app.DebugPrintf("SonyRemoteStorage::getSaveInfo already running!!!\n"); - return; - } +void SonyRemoteStorage::getSaveInfo() { + if (m_getInfoStatus == e_gettingInfo) { + app.DebugPrintf("SonyRemoteStorage::getSaveInfo already running!!!\n"); + return; + } - m_getInfoStatus = e_gettingInfo; - if(!ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) - { - m_getInfoStatus = e_noInfoFound; - return; - } - app.DebugPrintf("SonyRemoteStorage::getSaveInfo calling init\n"); + m_getInfoStatus = e_gettingInfo; + if (!ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) { + m_getInfoStatus = e_noInfoFound; + return; + } + app.DebugPrintf("SonyRemoteStorage::getSaveInfo calling init\n"); - bool bOK = init(getSaveInfoInitCallback, this); - if(!bOK) - m_getInfoStatus = e_noInfoFound; + bool bOK = init(getSaveInfoInitCallback, this); + if (!bOK) m_getInfoStatus = e_noInfoFound; } -bool SonyRemoteStorage::getSaveData( const char* localDirname, CallbackFunc cb, void* lpParam ) -{ - m_startTime = System::currentTimeMillis(); - m_dataProgress = 0; - return getData(sc_remoteSaveFilename, localDirname, cb, lpParam); +bool SonyRemoteStorage::getSaveData(const char* localDirname, CallbackFunc cb, + void* lpParam) { + m_startTime = System::currentTimeMillis(); + m_dataProgress = 0; + return getData(sc_remoteSaveFilename, localDirname, cb, lpParam); } - -static void setSaveDataInitCallback(void* lpParam, SonyRemoteStorage::Status s, int error_code) -{ - SonyRemoteStorage* pRemoteStorage = (SonyRemoteStorage*)lpParam; - if(error_code != 0) - { - app.DebugPrintf("setSaveDataInitCallback err : 0x%08x\n", error_code); - pRemoteStorage->m_setDataStatus = SonyRemoteStorage::e_settingDataFailed; - if(pRemoteStorage->m_initCallbackFunc) - pRemoteStorage->m_initCallbackFunc(pRemoteStorage->m_initCallbackParam, s, error_code); - } - else - { - app.getRemoteStorage()->setData(pRemoteStorage->m_setSaveDataInfo, pRemoteStorage->m_initCallbackFunc, pRemoteStorage->m_initCallbackParam); - } - +static void setSaveDataInitCallback(void* lpParam, SonyRemoteStorage::Status s, + int error_code) { + SonyRemoteStorage* pRemoteStorage = (SonyRemoteStorage*)lpParam; + if (error_code != 0) { + app.DebugPrintf("setSaveDataInitCallback err : 0x%08x\n", error_code); + pRemoteStorage->m_setDataStatus = + SonyRemoteStorage::e_settingDataFailed; + if (pRemoteStorage->m_initCallbackFunc) + pRemoteStorage->m_initCallbackFunc( + pRemoteStorage->m_initCallbackParam, s, error_code); + } else { + app.getRemoteStorage()->setData(pRemoteStorage->m_setSaveDataInfo, + pRemoteStorage->m_initCallbackFunc, + pRemoteStorage->m_initCallbackParam); + } } -bool SonyRemoteStorage::setSaveData(PSAVE_INFO info, CallbackFunc cb, void* lpParam) -{ - m_setSaveDataInfo = info; - m_setDataStatus = e_settingData; - m_initCallbackFunc = cb; - m_initCallbackParam = lpParam; - m_dataProgress = 0; - bool bOK = init(setSaveDataInitCallback, this); - if(!bOK) - m_setDataStatus = e_settingDataFailed; +bool SonyRemoteStorage::setSaveData(PSAVE_INFO info, CallbackFunc cb, + void* lpParam) { + m_setSaveDataInfo = info; + m_setDataStatus = e_settingData; + m_initCallbackFunc = cb; + m_initCallbackParam = lpParam; + m_dataProgress = 0; + bool bOK = init(setSaveDataInitCallback, this); + if (!bOK) m_setDataStatus = e_settingDataFailed; - return bOK; + return bOK; } -const char* SonyRemoteStorage::getLocalFilename() -{ - return sc_localSaveFullPath; +const char* SonyRemoteStorage::getLocalFilename() { + return sc_localSaveFullPath; } -const char* SonyRemoteStorage::getSaveNameUTF8() -{ - if(m_getInfoStatus != e_infoFound) - return NULL; - DescriptionData* pDescData = (DescriptionData*)m_remoteFileInfo->fileDescription; - return pDescData->m_saveNameUTF8; +const char* SonyRemoteStorage::getSaveNameUTF8() { + if (m_getInfoStatus != e_infoFound) return NULL; + DescriptionData* pDescData = + (DescriptionData*)m_remoteFileInfo->fileDescription; + return pDescData->m_saveNameUTF8; } -ESavePlatform SonyRemoteStorage::getSavePlatform() -{ - if(m_getInfoStatus != e_infoFound) - return SAVE_FILE_PLATFORM_NONE; - DescriptionData* pDescData = (DescriptionData*)m_remoteFileInfo->fileDescription; - return (ESavePlatform)MAKE_FOURCC(pDescData->m_platform[0], pDescData->m_platform[1], pDescData->m_platform[2], pDescData->m_platform[3]); - +ESavePlatform SonyRemoteStorage::getSavePlatform() { + if (m_getInfoStatus != e_infoFound) return SAVE_FILE_PLATFORM_NONE; + DescriptionData* pDescData = + (DescriptionData*)m_remoteFileInfo->fileDescription; + return (ESavePlatform)MAKE_FOURCC( + pDescData->m_platform[0], pDescData->m_platform[1], + pDescData->m_platform[2], pDescData->m_platform[3]); } -__int64 SonyRemoteStorage::getSaveSeed() -{ - if(m_getInfoStatus != e_infoFound) - return 0; - DescriptionData* pDescData = (DescriptionData*)m_remoteFileInfo->fileDescription; +__int64 SonyRemoteStorage::getSaveSeed() { + if (m_getInfoStatus != e_infoFound) return 0; + DescriptionData* pDescData = + (DescriptionData*)m_remoteFileInfo->fileDescription; - char seedString[17]; - ZeroMemory(seedString,17); - memcpy(seedString, pDescData->m_seed,16); + char seedString[17]; + ZeroMemory(seedString, 17); + memcpy(seedString, pDescData->m_seed, 16); - __uint64 seed = 0; - std::stringstream ss; - ss << seedString; - ss >> std::hex >> seed; - return seed; + __uint64 seed = 0; + std::stringstream ss; + ss << seedString; + ss >> std::hex >> seed; + return seed; } -unsigned int SonyRemoteStorage::getSaveHostOptions() -{ - if(m_getInfoStatus != e_infoFound) - return 0; - DescriptionData* pDescData = (DescriptionData*)m_remoteFileInfo->fileDescription; +unsigned int SonyRemoteStorage::getSaveHostOptions() { + if (m_getInfoStatus != e_infoFound) return 0; + DescriptionData* pDescData = + (DescriptionData*)m_remoteFileInfo->fileDescription; - char optionsString[9]; - ZeroMemory(optionsString,9); - memcpy(optionsString, pDescData->m_hostOptions,8); + char optionsString[9]; + ZeroMemory(optionsString, 9); + memcpy(optionsString, pDescData->m_hostOptions, 8); - unsigned int uiHostOptions = 0; - std::stringstream ss; - ss << optionsString; - ss >> std::hex >> uiHostOptions; - return uiHostOptions; + unsigned int uiHostOptions = 0; + std::stringstream ss; + ss << optionsString; + ss >> std::hex >> uiHostOptions; + return uiHostOptions; } -unsigned int SonyRemoteStorage::getSaveTexturePack() -{ - if(m_getInfoStatus != e_infoFound) - return 0; - DescriptionData* pDescData = (DescriptionData*)m_remoteFileInfo->fileDescription; +unsigned int SonyRemoteStorage::getSaveTexturePack() { + if (m_getInfoStatus != e_infoFound) return 0; + DescriptionData* pDescData = + (DescriptionData*)m_remoteFileInfo->fileDescription; - char textureString[9]; - ZeroMemory(textureString,9); - memcpy(textureString, pDescData->m_texturePack,8); + char textureString[9]; + ZeroMemory(textureString, 9); + memcpy(textureString, pDescData->m_texturePack, 8); - unsigned int uiTexturePack = 0; - std::stringstream ss; - ss << textureString; - ss >> std::hex >> uiTexturePack; - return uiTexturePack; + unsigned int uiTexturePack = 0; + std::stringstream ss; + ss << textureString; + ss >> std::hex >> uiTexturePack; + return uiTexturePack; } -const char* SonyRemoteStorage::getRemoteSaveFilename() -{ - return sc_remoteSaveFilename; +const char* SonyRemoteStorage::getRemoteSaveFilename() { + return sc_remoteSaveFilename; } -int SonyRemoteStorage::getSaveFilesize() -{ - if(m_getInfoStatus == e_infoFound) - { - return m_remoteFileInfo->fileSize; - } - return 0; +int SonyRemoteStorage::getSaveFilesize() { + if (m_getInfoStatus == e_infoFound) { + return m_remoteFileInfo->fileSize; + } + return 0; } +bool SonyRemoteStorage::setData(PSAVE_INFO info, CallbackFunc cb, + void* lpParam) { + m_setDataSaveInfo = info; + m_callbackFunc = cb; + m_callbackParam = lpParam; + m_status = e_setDataInProgress; -bool SonyRemoteStorage::setData( PSAVE_INFO info, CallbackFunc cb, void* lpParam ) -{ - m_setDataSaveInfo = info; - m_callbackFunc = cb; - m_callbackParam = lpParam; - m_status = e_setDataInProgress; - - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(info,&LoadSaveDataThumbnailReturned,this); - return true; + C4JStorage::ESaveGameState eLoadStatus = + StorageManager.LoadSaveDataThumbnail( + info, &LoadSaveDataThumbnailReturned, this); + return true; } -int SonyRemoteStorage::LoadSaveDataThumbnailReturned(void *lpParam,std::uint8_t *thumbnailData,unsigned int thumbnailBytes) -{ - SonyRemoteStorage *pClass= (SonyRemoteStorage *)lpParam; +int SonyRemoteStorage::LoadSaveDataThumbnailReturned( + void* lpParam, std::uint8_t* thumbnailData, unsigned int thumbnailBytes) { + SonyRemoteStorage* pClass = (SonyRemoteStorage*)lpParam; - if(pClass->m_bAborting) - { - pClass->runCallback(); - return 0; - } + if (pClass->m_bAborting) { + pClass->runCallback(); + return 0; + } - app.DebugPrintf("Received data for a thumbnail\n"); + app.DebugPrintf("Received data for a thumbnail\n"); - if(thumbnailData && thumbnailBytes) - { - pClass->m_thumbnailData = thumbnailData; - pClass->m_thumbnailDataSize = thumbnailBytes; - } - else - { - app.DebugPrintf("Thumbnail data is NULL, or has size 0\n"); - pClass->m_thumbnailData = NULL; - pClass->m_thumbnailDataSize = 0; - } + if (thumbnailData && thumbnailBytes) { + pClass->m_thumbnailData = thumbnailData; + pClass->m_thumbnailDataSize = thumbnailBytes; + } else { + app.DebugPrintf("Thumbnail data is NULL, or has size 0\n"); + pClass->m_thumbnailData = NULL; + pClass->m_thumbnailDataSize = 0; + } - if(pClass->m_SetDataThread != NULL) - delete pClass->m_SetDataThread; + if (pClass->m_SetDataThread != NULL) delete pClass->m_SetDataThread; - pClass->m_SetDataThread = new C4JThread(setDataThread, pClass, "setDataThread"); - pClass->m_SetDataThread->Run(); + pClass->m_SetDataThread = + new C4JThread(setDataThread, pClass, "setDataThread"); + pClass->m_SetDataThread->Run(); - return 0; + return 0; } -int SonyRemoteStorage::setDataThread(void* lpParam) -{ - SonyRemoteStorage* pClass = (SonyRemoteStorage*)lpParam; - pClass->m_startTime = System::currentTimeMillis(); - pClass->setDataInternal(); - return 0; +int SonyRemoteStorage::setDataThread(void* lpParam) { + SonyRemoteStorage* pClass = (SonyRemoteStorage*)lpParam; + pClass->m_startTime = System::currentTimeMillis(); + pClass->setDataInternal(); + return 0; } -bool SonyRemoteStorage::saveIsAvailable() -{ - if(m_getInfoStatus != e_infoFound) - return false; +bool SonyRemoteStorage::saveIsAvailable() { + if (m_getInfoStatus != e_infoFound) return false; #ifdef __PS3__ - return (getSavePlatform() == SAVE_FILE_PLATFORM_PSVITA); + return (getSavePlatform() == SAVE_FILE_PLATFORM_PSVITA); #elif defined __PSVITA__ - return (getSavePlatform() == SAVE_FILE_PLATFORM_PS3); -#else // __ORBIS__ - return true; + return (getSavePlatform() == SAVE_FILE_PLATFORM_PS3); +#else // __ORBIS__ + return true; #endif } -int SonyRemoteStorage::getDataProgress() -{ - __int64 time = System::currentTimeMillis(); - int elapsedSecs = (time - m_startTime) / 1000; - int progVal = m_dataProgress + (elapsedSecs/3); - if(progVal > 95) - { - return m_dataProgress; - } - return progVal; +int SonyRemoteStorage::getDataProgress() { + __int64 time = System::currentTimeMillis(); + int elapsedSecs = (time - m_startTime) / 1000; + int progVal = m_dataProgress + (elapsedSecs / 3); + if (progVal > 95) { + return m_dataProgress; + } + return progVal; } - -bool SonyRemoteStorage::shutdown() -{ - if(m_bInitialised) - { - int ret = sceRemoteStorageTerm(); - if(ret >= 0) - { - app.DebugPrintf("Term request done \n"); - m_bInitialised = false; - free(m_memPoolBuffer); - m_memPoolBuffer = NULL; - return true; - } - else - { - app.DebugPrintf("Error in Term request: 0x%x \n", ret); - return false; - } - } - return true; +bool SonyRemoteStorage::shutdown() { + if (m_bInitialised) { + int ret = sceRemoteStorageTerm(); + if (ret >= 0) { + app.DebugPrintf("Term request done \n"); + m_bInitialised = false; + free(m_memPoolBuffer); + m_memPoolBuffer = NULL; + return true; + } else { + app.DebugPrintf("Error in Term request: 0x%x \n", ret); + return false; + } + } + return true; } - -void SonyRemoteStorage::waitForStorageManagerIdle() -{ - C4JStorage::ESaveGameState storageState = StorageManager.GetSaveState(); - while(storageState != C4JStorage::ESaveGame_Idle) - { - Sleep(10); -// app.DebugPrintf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>> storageState = %d\n", storageState); - storageState = StorageManager.GetSaveState(); - } +void SonyRemoteStorage::waitForStorageManagerIdle() { + C4JStorage::ESaveGameState storageState = StorageManager.GetSaveState(); + while (storageState != C4JStorage::ESaveGame_Idle) { + Sleep(10); + // app.DebugPrintf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + // >>>>> storageState = %d\n", storageState); + storageState = StorageManager.GetSaveState(); + } } diff --git a/Minecraft.Client/Platform/Common/Network/Sony/SonyRemoteStorage.h b/Minecraft.Client/Platform/Common/Network/Sony/SonyRemoteStorage.h index dccb52949..e35e58719 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/SonyRemoteStorage.h +++ b/Minecraft.Client/Platform/Common/Network/Sony/SonyRemoteStorage.h @@ -1,121 +1,114 @@ -#pragma once - +#pragma once #include "sceRemoteStorage/header/sceRemoteStorage.h" #include -class SonyRemoteStorage -{ +class SonyRemoteStorage { public: - enum Status - { - e_idle, - e_accountLinked, - e_error, - e_signInRequired, - e_compressInProgress, - e_setDataInProgress, - e_setDataSucceeded, - e_getDataInProgress, - e_getDataSucceeded, - e_getStatusInProgress, - e_getStatusSucceeded - }; - typedef void (*CallbackFunc)(void* lpParam, Status s, int error_code); + enum Status { + e_idle, + e_accountLinked, + e_error, + e_signInRequired, + e_compressInProgress, + e_setDataInProgress, + e_setDataSucceeded, + e_getDataInProgress, + e_getDataSucceeded, + e_getStatusInProgress, + e_getStatusSucceeded + }; + typedef void (*CallbackFunc)(void* lpParam, Status s, int error_code); - enum GetInfoStatus - { - e_gettingInfo, - e_infoFound, - e_noInfoFound - }; - GetInfoStatus m_getInfoStatus; + enum GetInfoStatus { e_gettingInfo, e_infoFound, e_noInfoFound }; + GetInfoStatus m_getInfoStatus; - enum SetDataStatus - { - e_settingData, - e_settingDataFailed, - e_settingDataSucceeded - }; - SetDataStatus m_setDataStatus; + enum SetDataStatus { + e_settingData, + e_settingDataFailed, + e_settingDataSucceeded + }; + SetDataStatus m_setDataStatus; - PSAVE_INFO m_setSaveDataInfo; - SceRemoteStorageData* m_remoteFileInfo; + PSAVE_INFO m_setSaveDataInfo; + SceRemoteStorageData* m_remoteFileInfo; - class DescriptionData - { - // this stuff is read from a JSON query, so it all has to be text based, max 256 bytes - public: - char m_platform[4]; - char m_seed[16]; // 8 bytes as hex - char m_hostOptions[8]; // 4 bytes as hex - char m_texturePack[8]; // 4 bytes as hex - char m_saveNameUTF8[128]; - }; + class DescriptionData { + // this stuff is read from a JSON query, so it all has to be text based, + // max 256 bytes + public: + char m_platform[4]; + char m_seed[16]; // 8 bytes as hex + char m_hostOptions[8]; // 4 bytes as hex + char m_texturePack[8]; // 4 bytes as hex + char m_saveNameUTF8[128]; + }; - CallbackFunc m_callbackFunc; - void* m_callbackParam; + CallbackFunc m_callbackFunc; + void* m_callbackParam; + CallbackFunc m_initCallbackFunc; + void* m_initCallbackParam; - CallbackFunc m_initCallbackFunc; - void* m_initCallbackParam; + void getSaveInfo(); + bool waitingForSaveInfo() { return (m_getInfoStatus == e_gettingInfo); } + bool saveIsAvailable(); - void getSaveInfo(); - bool waitingForSaveInfo() { return (m_getInfoStatus == e_gettingInfo); } - bool saveIsAvailable(); + int getSaveFilesize(); + bool getSaveData(const char* localDirname, CallbackFunc cb, void* lpParam); - int getSaveFilesize(); - bool getSaveData(const char* localDirname, CallbackFunc cb, void* lpParam); + bool setSaveData(PSAVE_INFO info, CallbackFunc cb, void* lpParam); + bool waitingForSetData() { return (m_setDataStatus == e_settingData); } - bool setSaveData(PSAVE_INFO info, CallbackFunc cb, void* lpParam); - bool waitingForSetData() { return (m_setDataStatus == e_settingData); } + const char* getLocalFilename(); + const char* getSaveNameUTF8(); + ESavePlatform getSavePlatform(); + __int64 getSaveSeed(); + unsigned int getSaveHostOptions(); + unsigned int getSaveTexturePack(); - const char* getLocalFilename(); - const char* getSaveNameUTF8(); - ESavePlatform getSavePlatform(); - __int64 getSaveSeed(); - unsigned int getSaveHostOptions(); - unsigned int getSaveTexturePack(); + void SetServiceID(char* pchServiceID) { m_pchServiceID = pchServiceID; } - void SetServiceID(char *pchServiceID) { m_pchServiceID=pchServiceID; } + virtual bool init(CallbackFunc cb, void* lpParam) = 0; + virtual bool getRemoteFileInfo(SceRemoteStorageStatus* pInfo, + CallbackFunc cb, void* lpParam) = 0; + virtual bool getData(const char* remotePath, const char* localPath, + CallbackFunc cb, void* lpParam) = 0; + virtual void abort() = 0; + virtual bool shutdown(); + virtual bool setDataInternal() = 0; + virtual void runCallback() = 0; - virtual bool init(CallbackFunc cb, void* lpParam) = 0; - virtual bool getRemoteFileInfo(SceRemoteStorageStatus* pInfo, CallbackFunc cb, void* lpParam) = 0; - virtual bool getData(const char* remotePath, const char* localPath, CallbackFunc cb, void* lpParam) = 0; - virtual void abort() = 0; - virtual bool shutdown(); - virtual bool setDataInternal() = 0; - virtual void runCallback() = 0; + Status getStatus() { return m_status; } + int getDataProgress(); + void waitForStorageManagerIdle(); + bool setData(PSAVE_INFO info, CallbackFunc cb, void* lpParam); + static int LoadSaveDataThumbnailReturned(void* lpParam, + std::uint8_t* thumbnailData, + unsigned int thumbnailBytes); + static int setDataThread(void* lpParam); - Status getStatus() { return m_status; } - int getDataProgress(); - void waitForStorageManagerIdle(); - - - - bool setData( PSAVE_INFO info, CallbackFunc cb, void* lpParam ); - static int LoadSaveDataThumbnailReturned(void *lpParam,std::uint8_t *thumbnailData,unsigned int thumbnailBytes); - static int setDataThread(void* lpParam); - - SonyRemoteStorage() : m_memPoolBuffer(NULL), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {} + SonyRemoteStorage() + : m_memPoolBuffer(NULL), + m_bInitialised(false), + m_getInfoStatus(e_noInfoFound) {} protected: - const char* getRemoteSaveFilename(); - bool m_bInitialised; - void* m_memPoolBuffer; - Status m_status; - int m_dataProgress; - char *m_pchServiceID; + const char* getRemoteSaveFilename(); + bool m_bInitialised; + void* m_memPoolBuffer; + Status m_status; + int m_dataProgress; + char* m_pchServiceID; - std::uint8_t *m_thumbnailData; - unsigned int m_thumbnailDataSize; - C4JThread* m_SetDataThread; - PSAVE_INFO m_setDataSaveInfo; - __int64 m_startTime; - - bool m_bAborting; - bool m_bTransferStarted; + std::uint8_t* m_thumbnailData; + unsigned int m_thumbnailDataSize; + C4JThread* m_SetDataThread; + PSAVE_INFO m_setDataSaveInfo; + __int64 m_startTime; + bool m_bAborting; + bool m_bTransferStarted; }; diff --git a/Minecraft.Client/Platform/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorage.h b/Minecraft.Client/Platform/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorage.h index de70398d7..c07809b9d 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorage.h +++ b/Minecraft.Client/Platform/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorage.h @@ -7,131 +7,212 @@ /// @brief /// Initialises the RemoteStorage library. /// -/// Initialises the RemoteStorage library, creates a session on the server and starts the Thread to process requests. -/// This method must be executed to start the RemoteStorage library or none of its functionality will be available. -/// This method will block while it initializes its thread and will return an error if it is -/// unable to do so. The session will be created on the thread once this is created and it won't be a blocking operation. +/// Initialises the RemoteStorage library, creates a session on the server and +/// starts the Thread to process requests. This method must be executed to start +/// the RemoteStorage library or none of its functionality will be available. +/// This method will block while it initializes its thread and will return an +/// error if it is unable to do so. The session will be created on the thread +/// once this is created and it won't be a blocking operation. /// -/// It is important to note that HTTP, SSL and NET libraries are not being initialised by the library and should be initialised outside of it. +/// It is important to note that HTTP, SSL and NET libraries are not being +/// initialised by the library and should be initialised outside of it. /// -/// @param params The structure of type <>SceRemoteStorageInitParams that contains necessary information to start the library. +/// @param params The structure of type +/// <>SceRemoteStorageInitParams that contains necessary information to +/// start the library. /// -/// @retval SCE_REMOTE_STORAGE_SUCCESS The operation was successfully registered on the thread. -/// @retval SCE_REMOTE_STORAGE_ERROR_INVALID_ARGUMENT At least one of the arguments passed in the input structure is not valid. -/// @retval SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE There is no enough memory on the library to perform an allocation. -/// @retval USER_ACCOUNT_LINKED This event will be sent to the event callback when the session is created and linked to PSN on the server -/// @retval PSN_SIGN_IN_REQUIRED This event will be sent to the event callback when the session is created but not linked to PSN on the server. -/// This will only happen on the PC version and requires to call sceRemoteStorageOpenWebBrowser() function. -/// @retval ERROR_OCCURRED This event will be sent to the event callback when an error has occurred in the thread. +/// @retval SCE_REMOTE_STORAGE_SUCCESS +/// The operation was successfully registered on the thread. +/// @retval SCE_REMOTE_STORAGE_ERROR_INVALID_ARGUMENT At least one of +/// the arguments passed in the input structure is not valid. +/// @retval SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE There is no +/// enough memory on the library to perform an allocation. +/// @retval USER_ACCOUNT_LINKED +/// This event will be sent to the event callback when the session is created +/// and linked to PSN on the server +/// @retval PSN_SIGN_IN_REQUIRED +/// This event will be sent to the event callback when the session is created +/// but not linked to PSN on the server. +/// This +///will only happen on the PC version and requires to call +///sceRemoteStorageOpenWebBrowser() function. +/// @retval ERROR_OCCURRED +/// This event will be sent to the event callback when an error has occurred in +/// the thread. /// -/// @note System errors may be returned. Design your code so it does expect other errors. -int32_t sceRemoteStorageInit(const SceRemoteStorageInitParams & params); +/// @note System errors may be returned. Design your code so it does expect +/// other errors. +int32_t sceRemoteStorageInit(const SceRemoteStorageInitParams& params); /// @brief /// Terminates the RemoteStorage library. /// -/// Terminates the RemoteStorage library and deletes the thread that process requests. -/// This method must be executed to terminate the RemoteStorage library to prevent leaks in memory and resources. -/// This method will abort any other pending requests and terminate the library. It won't wait for requests to finish. -/// This method is synchronous and does not make use of the callback to inform the user of success termination. It is executed on the calling thread. +/// Terminates the RemoteStorage library and deletes the thread that process +/// requests. This method must be executed to terminate the RemoteStorage +/// library to prevent leaks in memory and resources. This method will abort any +/// other pending requests and terminate the library. It won't wait for requests +/// to finish. This method is synchronous and does not make use of the callback +/// to inform the user of success termination. It is executed on the calling +/// thread. /// -/// @retval SCE_REMOTE_STORAGE_SUCCESS The operation was successful. -/// @retval SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED The RemoteStorage library was not initialised. +/// @retval SCE_REMOTE_STORAGE_SUCCESS +/// The operation was successful. +/// @retval SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED The +/// RemoteStorage library was not initialised. /// -/// @note System errors may be returned. Design your code so it does expect other errors. +/// @note System errors may be returned. Design your code so it does expect +/// other errors. int32_t sceRemoteStorageTerm(); /// @brief /// Aborts a request sent to the RemoteStorage library. /// -/// Aborts a request being processed or pending to be processed by the RemoteStorage library. -/// This method is synchronous and does not make use of the callback to inform the user of success termination. It is executed on the calling thread. +/// Aborts a request being processed or pending to be processed by the +/// RemoteStorage library. This method is synchronous and does not make use of +/// the callback to inform the user of success termination. It is executed on +/// the calling thread. /// -/// @param param A structure containing the request Id to be aborted. -/// This request Id is provided by other functions (get/setData, getStatus and OpenWebBrowser) so they can be referenced. +/// @param param A structure containing the request Id to be aborted. +/// This request Id is provided by other +///functions (get/setData, getStatus and OpenWebBrowser) so they can be +///referenced. /// -/// @retval SCE_REMOTE_STORAGE_SUCCESS The operation was successful. -/// @retval SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED The RemoteStorage library was not initialised. -/// @retval SCE_REMOTE_STORAGE_ERROR_REQ_ID_NOT_FOUND The request Id sent is not found. +/// @retval SCE_REMOTE_STORAGE_SUCCESS +/// The operation was successful. +/// @retval SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED The +/// RemoteStorage library was not initialised. +/// @retval SCE_REMOTE_STORAGE_ERROR_REQ_ID_NOT_FOUND The request Id +/// sent is not found. /// -/// @note System errors may be returned. Design your code so it does expect other errors. -int32_t sceRemoteStorageAbort(const SceRemoteStorageAbortReqParams & params); +/// @note System errors may be returned. Design your code so it does expect +/// other errors. +int32_t sceRemoteStorageAbort(const SceRemoteStorageAbortReqParams& params); /// @brief /// Opens the default web browser to sign in to PSN on PC. /// -/// Opens the default web browser to sign in to PSN on PC. This function does not have any functionality on other platforms. -/// This method does make use of the callback to inform the user of success termination. This function has priority over other functions on the thread (as getData(), getStatus() -/// and setData()) and it will be executed as soon as the thread finishes processing a pending request. +/// Opens the default web browser to sign in to PSN on PC. This function does +/// not have any functionality on other platforms. This method does make use of +/// the callback to inform the user of success termination. This function has +/// priority over other functions on the thread (as getData(), getStatus() and +/// setData()) and it will be executed as soon as the thread finishes processing +/// a pending request. /// -/// @param param The structure containing extra parameters to be passed in. This structure does only exist for future expansions. +/// @param param The structure containing extra parameters to be +/// passed in. This structure does only exist for future expansions. /// -/// @retval SCE_REMOTE_STORAGE_SUCCESS The operation was successfully registered on the thread. -/// @retval SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED The RemoteStorage library was not initialised. -/// @retval SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE There is no enough memory on the library to perform an allocation. -/// @retval ERROR_OCCURRED This event will be sent to the event callback when an error has occurred in the thread. +/// @retval SCE_REMOTE_STORAGE_SUCCESS +/// The operation was successfully registered on the thread. +/// @retval SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED The +/// RemoteStorage library was not initialised. +/// @retval SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE There is no +/// enough memory on the library to perform an allocation. +/// @retval ERROR_OCCURRED +/// This event will be sent to the event callback when an error has occurred in +/// the thread. /// -/// @note System errors may be returned. Design your code so it does expect other errors. -int32_t sceRemoteStorageOpenWebBrowser(const SceRemoteStorageWebBrowserReqParams & params); +/// @note System errors may be returned. Design your code so it does expect +/// other errors. +int32_t sceRemoteStorageOpenWebBrowser( + const SceRemoteStorageWebBrowserReqParams& params); /// @brief /// Gives details for all files of a user. /// -/// Gives details for all files of a user. It provides generic information (remaining bandwidth per day, HDD space per user, number of files) as well as -/// specific file information (number of bytes, file name, file description, MD5 checksum, timestamp and file visibility). File data is not provided. -/// This method does make use of the callback to inform the user of success termination. The SceRemoteStorageStatus pointer must be pointer a to a valid -/// location in memory until the callback is called as the output information will be stored in such location. +/// Gives details for all files of a user. It provides generic information +/// (remaining bandwidth per day, HDD space per user, number of files) as well +/// as specific file information (number of bytes, file name, file description, +/// MD5 checksum, timestamp and file visibility). File data is not provided. +/// This method does make use of the callback to inform the user of success +/// termination. The SceRemoteStorageStatus pointer must be pointer a to a valid +/// location in memory until the callback is called as the output information +/// will be stored in such location. /// -/// @param params The structure containing extra parameters to be passed in. This structure does only exist for future expansions. -/// @param status The structure where the output information will be stored. The memory location being pointed must be valid until the callback gets called. +/// @param params The structure containing extra parameters to be +/// passed in. This structure does only exist for future expansions. +/// @param status The structure where the output information will +/// be stored. The memory location being pointed must be valid until the +/// callback gets called. /// -/// @retval SCE_REMOTE_STORAGE_SUCCESS The operation was successfully registered on the thread. -/// @retval SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED The RemoteStorage library was not initialised. -/// @retval SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE There is no enough memory on the library to perform an allocation. -/// @retval ERROR_OCCURRED This event will be sent to the event callback when an error has occurred in the thread. +/// @retval SCE_REMOTE_STORAGE_SUCCESS +/// The operation was successfully registered on the thread. +/// @retval SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED The +/// RemoteStorage library was not initialised. +/// @retval SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE There is no +/// enough memory on the library to perform an allocation. +/// @retval ERROR_OCCURRED +/// This event will be sent to the event callback when an error has occurred in +/// the thread. /// -/// @note System errors may be returned. Design your code so it does expect other errors. -int32_t sceRemoteStorageGetStatus(const SceRemoteStorageStatusReqParams & params, SceRemoteStorageStatus * status); +/// @note System errors may be returned. Design your code so it does expect +/// other errors. +int32_t sceRemoteStorageGetStatus(const SceRemoteStorageStatusReqParams& params, + SceRemoteStorageStatus* status); /// @brief /// Gets section of data from a file specified. /// -/// Gets section of data from a file specified. The amount of data requested can be of any size. To request this information the name of file, the number of bytes and -/// the byte to start reading along with a buffer to store such data must be provided. -/// Metadata information of the file, as description or visibility, will be provided only in the case the first amount of bytes for the file are requested (offset = 0). -/// This method does make use of the callback to inform the user of success termination. The SceRemoteStorageData pointer must be a pointer to a valid -/// location in memory until the callback is called as the output information will be stored in such location. +/// Gets section of data from a file specified. The amount of data requested can +/// be of any size. To request this information the name of file, the number of +/// bytes and the byte to start reading along with a buffer to store such data +/// must be provided. Metadata information of the file, as description or +/// visibility, will be provided only in the case the first amount of bytes for +/// the file are requested (offset = 0). This method does make use of the +/// callback to inform the user of success termination. The SceRemoteStorageData +/// pointer must be a pointer to a valid location in memory until the callback +/// is called as the output information will be stored in such location. /// -/// @param params The structure containing the file name to read, the start byte to start reading and the amount of bytes to read. -/// @param status The structure where the output information will be stored. The memory location being pointed must be valid until the callback gets called. +/// @param params The structure containing the file name to read, +/// the start byte to start reading and the amount of bytes to read. +/// @param status The structure where the output information will +/// be stored. The memory location being pointed must be valid until the +/// callback gets called. /// -/// @retval SCE_REMOTE_STORAGE_SUCCESS The operation was successfully registered on the thread. -/// @retval SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED The RemoteStorage library was not initialised. -/// @retval SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE There is no enough memory on the library to perform an allocation. -/// @retval ERROR_OCCURRED This event will be sent to the event callback when an error has occurred in the thread. +/// @retval SCE_REMOTE_STORAGE_SUCCESS +/// The operation was successfully registered on the thread. +/// @retval SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED The +/// RemoteStorage library was not initialised. +/// @retval SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE There is no +/// enough memory on the library to perform an allocation. +/// @retval ERROR_OCCURRED +/// This event will be sent to the event callback when an error has occurred in +/// the thread. /// -/// @note System errors may be returned. Design your code so it does expect other errors. -int32_t sceRemoteStorageGetData(const SceRemoteStorageGetDataReqParams & params, SceRemoteStorageData * data); +/// @note System errors may be returned. Design your code so it does expect +/// other errors. +int32_t sceRemoteStorageGetData(const SceRemoteStorageGetDataReqParams& params, + SceRemoteStorageData* data); /// @brief /// Sets chunk of data to a file specified. /// -/// Sets chunk of data to a file specified. The amount of data sent must be of, at least, 5 Megabytes per chunk excepts -/// in the case of the last chunk of the file (or the only one if that is the case) as it can be smaller. -/// The information provided regarding the chunk as the chunk number, total number of chunks, data buffer and its size should be provided in every call. -/// The information provided regarding the file as its name, description and visibility should be provided in the last chunk only (this is, when -/// chunk number = number of chunks). -/// This method does make use of the callback to inform the user of success termination. The data attribute of the SceRemoteStorageSetDataReqParams pointer -/// must be a pointer to a valid location in memory until the callback is called as the buffer won't be copied internally. +/// Sets chunk of data to a file specified. The amount of data sent must be of, +/// at least, 5 Megabytes per chunk excepts in the case of the last chunk of the +/// file (or the only one if that is the case) as it can be smaller. The +/// information provided regarding the chunk as the chunk number, total number +/// of chunks, data buffer and its size should be provided in every call. The +/// information provided regarding the file as its name, description and +/// visibility should be provided in the last chunk only (this is, when chunk +/// number = number of chunks). This method does make use of the callback to +/// inform the user of success termination. The data attribute of the +/// SceRemoteStorageSetDataReqParams pointer must be a pointer to a valid +/// location in memory until the callback is called as the buffer won't be +/// copied internally. /// /// @param data The structure containing the chunk information. /// -/// @retval SCE_REMOTE_STORAGE_SUCCESS The operation was successfully registered on the thread. -/// @retval SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED The RemoteStorage library was not initialised. -/// @retval SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE There is no enough memory on the library to perform an allocation. -/// @retval ERROR_OCCURRED This event will be sent to the event callback when an error has occurred in the thread. +/// @retval SCE_REMOTE_STORAGE_SUCCESS +/// The operation was successfully registered on the thread. +/// @retval SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED The +/// RemoteStorage library was not initialised. +/// @retval SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE There is no +/// enough memory on the library to perform an allocation. +/// @retval ERROR_OCCURRED +/// This event will be sent to the event callback when an error has occurred in +/// the thread. /// -/// @note System errors may be returned. Design your code so it does expect other errors. -int32_t sceRemoteStorageSetData(const SceRemoteStorageSetDataReqParams & data); +/// @note System errors may be returned. Design your code so it does expect +/// other errors. +int32_t sceRemoteStorageSetData(const SceRemoteStorageSetDataReqParams& data); #endif \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorageDefines.h b/Minecraft.Client/Platform/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorageDefines.h index 3e6e517f5..692942f11 100644 --- a/Minecraft.Client/Platform/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorageDefines.h +++ b/Minecraft.Client/Platform/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorageDefines.h @@ -15,153 +15,201 @@ #include // Macros -#define SCE_REMOTE_STORAGE_MAX_FILES 16 -#define SCE_REMOTE_STORAGE_DATA_NAME_MAX_LEN 64 -#define SCE_REMOTE_STORAGE_CLIENT_ID_MAX_LEN 64 -#define SCE_REMOTE_STORAGE_PLATFORM_NAME_MAX_LEN 16 -#define SCE_REMOTE_STORAGE_MD5_STRING_LENGTH 33 -#define SCE_REMOTE_STORAGE_RFC2822_LENGTH 32 -#define SCE_REMOTE_STORAGE_DATA_DESCRIPTION_MAX_LEN 256 -#define SCE_REMOTE_STORAGE_DATA_LOCATION_MAX_LEN 256 -#define SCE_REMOTE_STORAGE_PS3_SAVEDATA_SECUREFILEID_SIZE 16 -#define SCE_REMOTE_STORAGE_PS3_SAVEDATA_FILENAME_SIZE 13 -#define SCE_REMOTE_STORAGE_AUTH_CODE_MAX_LEN 128 +#define SCE_REMOTE_STORAGE_MAX_FILES 16 +#define SCE_REMOTE_STORAGE_DATA_NAME_MAX_LEN 64 +#define SCE_REMOTE_STORAGE_CLIENT_ID_MAX_LEN 64 +#define SCE_REMOTE_STORAGE_PLATFORM_NAME_MAX_LEN 16 +#define SCE_REMOTE_STORAGE_MD5_STRING_LENGTH 33 +#define SCE_REMOTE_STORAGE_RFC2822_LENGTH 32 +#define SCE_REMOTE_STORAGE_DATA_DESCRIPTION_MAX_LEN 256 +#define SCE_REMOTE_STORAGE_DATA_LOCATION_MAX_LEN 256 +#define SCE_REMOTE_STORAGE_PS3_SAVEDATA_SECUREFILEID_SIZE 16 +#define SCE_REMOTE_STORAGE_PS3_SAVEDATA_FILENAME_SIZE 13 +#define SCE_REMOTE_STORAGE_AUTH_CODE_MAX_LEN 128 // Return values -#define SCE_REMOTE_STORAGE_SUCCESS 0 +#define SCE_REMOTE_STORAGE_SUCCESS 0 // Error codes -#define SCE_REMOTE_STORAGE_ERROR_INVALID_ARGUMENT 0x80001001 -#define SCE_REMOTE_STORAGE_ERROR_FAILED_TO_CREATE_THREAD 0x80001002 -#define SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED 0x80001003 -#define SCE_REMOTE_STORAGE_ERROR_FAILED_TO_OPEN_WEB_BROWSER 0x80001004 -#define SCE_REMOTE_STORAGE_ERROR_PSN_ACCOUNT_NOT_LINKED 0x80001005 -#define SCE_REMOTE_STORAGE_ERROR_COULD_NOT_CREATE_SESSION 0x80001006 -#define SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE 0x80001007 -#define SCE_REMOTE_STORAGE_ERROR_SESSION_DOES_NOT_EXIST 0x80001008 -#define SCE_REMOTE_STORAGE_ERROR_REQ_ID_NOT_FOUND 0x80001009 -#define SCE_REMOTE_STORAGE_ERROR_MAX_NUMBER_FILES_REACHED 0x8000100A -#define SCE_REMOTE_STORAGE_ERROR_NO_MORE_SYNCS 0x8000100B -#define SCE_REMOTE_STORAGE_ERROR_ALREADY_INITIALISED 0x8000100C -#define SCE_REMOTE_STORAGE_ERROR_INVALID_UPLOADID 0x8000100D -#define SCE_REMOTE_STORAGE_ERROR_FAILED_TO_OPEN_FILE 0x8000100E -#define SCE_REMOTE_STORAGE_ERROR_CLOUD_DATA_CORRUPTED 0x8000100F -#define SCE_REMOTE_STORAGE_ERROR_INVALID_CHAR_IN_FILE_NAME 0x80001010 -#define SCE_REMOTE_STORAGE_ERROR_INVALID_JSON_RESPONSE 0x80001011 -#define SCE_REMOTE_STORAGE_ERROR_REQUEST_ABORTED 0x80001012 -#define SCE_REMOTE_STORAGE_ERROR_SERVER_ERROR 0x80002000 // Server errors can be between 0x80002064 to 0x800022BB both included +#define SCE_REMOTE_STORAGE_ERROR_INVALID_ARGUMENT 0x80001001 +#define SCE_REMOTE_STORAGE_ERROR_FAILED_TO_CREATE_THREAD 0x80001002 +#define SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED 0x80001003 +#define SCE_REMOTE_STORAGE_ERROR_FAILED_TO_OPEN_WEB_BROWSER 0x80001004 +#define SCE_REMOTE_STORAGE_ERROR_PSN_ACCOUNT_NOT_LINKED 0x80001005 +#define SCE_REMOTE_STORAGE_ERROR_COULD_NOT_CREATE_SESSION 0x80001006 +#define SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE 0x80001007 +#define SCE_REMOTE_STORAGE_ERROR_SESSION_DOES_NOT_EXIST 0x80001008 +#define SCE_REMOTE_STORAGE_ERROR_REQ_ID_NOT_FOUND 0x80001009 +#define SCE_REMOTE_STORAGE_ERROR_MAX_NUMBER_FILES_REACHED 0x8000100A +#define SCE_REMOTE_STORAGE_ERROR_NO_MORE_SYNCS 0x8000100B +#define SCE_REMOTE_STORAGE_ERROR_ALREADY_INITIALISED 0x8000100C +#define SCE_REMOTE_STORAGE_ERROR_INVALID_UPLOADID 0x8000100D +#define SCE_REMOTE_STORAGE_ERROR_FAILED_TO_OPEN_FILE 0x8000100E +#define SCE_REMOTE_STORAGE_ERROR_CLOUD_DATA_CORRUPTED 0x8000100F +#define SCE_REMOTE_STORAGE_ERROR_INVALID_CHAR_IN_FILE_NAME 0x80001010 +#define SCE_REMOTE_STORAGE_ERROR_INVALID_JSON_RESPONSE 0x80001011 +#define SCE_REMOTE_STORAGE_ERROR_REQUEST_ABORTED 0x80001012 +#define SCE_REMOTE_STORAGE_ERROR_SERVER_ERROR \ + 0x80002000 // Server errors can be between 0x80002064 to 0x800022BB both + // included - -typedef enum SceRemoteStorageDataVisibility -{ - PRIVATE = 0, // Only data owner can read and write data - PUBLIC_READ_ONLY, // Everyone can read this data. Owner can write to it - PUBLIC_READ_WRITE // Everyone can read and write data +typedef enum SceRemoteStorageDataVisibility { + PRIVATE = 0, // Only data owner can read and write data + PUBLIC_READ_ONLY, // Everyone can read this data. Owner can write to it + PUBLIC_READ_WRITE // Everyone can read and write data } SceRemoteStorageDataVisibility; -typedef enum SceRemoteStorageEvent -{ - USER_ACCOUNT_LINKED = 0, // User's account has been linked with PSN - PSN_SIGN_IN_REQUIRED, // User's PSN sign-in through web browser is required - WEB_BROWSER_RESULT, // Result of sceRemoteStorageOpenWebBrowser(). Please check retCode - GET_DATA_RESULT, // Result of sceRemoteStorageGetData(). Please check retCode - GET_DATA_PROGRESS, // Progress of sceRemoteStorageGetData() completion as a percentage. Please check retCode - SET_DATA_RESULT, // Result of sceRemoteStorageSetData(). Please check retCode - SET_DATA_PROGRESS, // Progress of sceRemoteStorageSetData() completion as a percentage. Please check retCode - GET_STATUS_RESULT, // Result of sceRemoteStorageGetStatus(). Please check retCode - ERROR_OCCURRED // A generic error has occurred. Please check retCode +typedef enum SceRemoteStorageEvent { + USER_ACCOUNT_LINKED = 0, // User's account has been linked with PSN + PSN_SIGN_IN_REQUIRED, // User's PSN sign-in through web browser is required + WEB_BROWSER_RESULT, // Result of sceRemoteStorageOpenWebBrowser(). Please + // check retCode + GET_DATA_RESULT, // Result of sceRemoteStorageGetData(). Please check + // retCode + GET_DATA_PROGRESS, // Progress of sceRemoteStorageGetData() completion as a + // percentage. Please check retCode + SET_DATA_RESULT, // Result of sceRemoteStorageSetData(). Please check + // retCode + SET_DATA_PROGRESS, // Progress of sceRemoteStorageSetData() completion as a + // percentage. Please check retCode + GET_STATUS_RESULT, // Result of sceRemoteStorageGetStatus(). Please check + // retCode + ERROR_OCCURRED // A generic error has occurred. Please check retCode } SceRemoteStorageEvent; -typedef enum SceRemoteStorageEnvironment -{ - DEVELOPMENT = 0, - PRODUCTION -}SceRemoteStorageEnvironment; +typedef enum SceRemoteStorageEnvironment { + DEVELOPMENT = 0, + PRODUCTION +} SceRemoteStorageEnvironment; -typedef void (*sceRemoteStorageCallback)(const SceRemoteStorageEvent event, int32_t retCode, void * userData); +typedef void (*sceRemoteStorageCallback)(const SceRemoteStorageEvent event, + int32_t retCode, void* userData); -typedef struct SceRemoteStorageInitParamsThread -{ - int32_t threadAffinity; // Thread affinity - int32_t threadPriority; // Priority that the thread runs out +typedef struct SceRemoteStorageInitParamsThread { + int32_t threadAffinity; // Thread affinity + int32_t threadPriority; // Priority that the thread runs out } SceRemoteStorageInitParamsThread; -typedef struct SceRemoteStorageInitParamsPool -{ - void * memPoolBuffer; // Memory pool used by sceRemoteStorage library - size_t memPoolSize; // Size of memPoolBuffer +typedef struct SceRemoteStorageInitParamsPool { + void* memPoolBuffer; // Memory pool used by sceRemoteStorage library + size_t memPoolSize; // Size of memPoolBuffer } SceRemoteStorageInitParamsPool; -typedef struct SceRemoteStorageInitTimeout -{ - uint32_t resolveMs; //Timeout for DNS resolution in milliseconds. Defaults to 30 seconds - uint32_t connectMs; //Timeout for first connection between client and server. Defaults to 30 seconds - uint32_t sendMs; //Timeout to send request to server. Defaults to 120 seconds - uint32_t receiveMs; //Timeout to receive information from server. Defaults to 120 seconds - - SceRemoteStorageInitTimeout() : resolveMs(30 * 1000), connectMs(30 * 1000), sendMs(120 * 1000), receiveMs(120 * 1000) {} -}SceRemoteStorageInitTimeout; +typedef struct SceRemoteStorageInitTimeout { + uint32_t resolveMs; // Timeout for DNS resolution in milliseconds. Defaults + // to 30 seconds + uint32_t connectMs; // Timeout for first connection between client and + // server. Defaults to 30 seconds + uint32_t + sendMs; // Timeout to send request to server. Defaults to 120 seconds + uint32_t receiveMs; // Timeout to receive information from server. Defaults + // to 120 seconds -typedef struct SceRemoteStorageInitParams -{ - sceRemoteStorageCallback callback; // Event callback - void * userData; // Application defined data for callback - int32_t httpContextId; // PS4 only: Http context ID that was returned from sceHttpInit() - int32_t userId; // PS4 only: Current user, see SceUserServiceUserId - void * psnTicket; // PS3 only: The PSN ticket used to authenticate the user - size_t psnTicketSize; // PS3 only: The size of the PSN ticket in bytes - char clientId[SCE_REMOTE_STORAGE_CLIENT_ID_MAX_LEN]; // This represents your application on PSN, used to sign PSN user in for your title - SceRemoteStorageInitTimeout timeout; // Timeout for network transactions - SceRemoteStorageInitParamsPool pool; // Memory pool parameters - SceRemoteStorageInitParamsThread thread; // Thread creation parameters - SceRemoteStorageEnvironment environment; // Only used on non-PlayStation platforms: PSN Environment used by the library + SceRemoteStorageInitTimeout() + : resolveMs(30 * 1000), + connectMs(30 * 1000), + sendMs(120 * 1000), + receiveMs(120 * 1000) {} +} SceRemoteStorageInitTimeout; + +typedef struct SceRemoteStorageInitParams { + sceRemoteStorageCallback callback; // Event callback + void* userData; // Application defined data for callback + int32_t httpContextId; // PS4 only: Http context ID that was returned from + // sceHttpInit() + int32_t userId; // PS4 only: Current user, see SceUserServiceUserId + void* psnTicket; // PS3 only: The PSN ticket used to authenticate the user + size_t psnTicketSize; // PS3 only: The size of the PSN ticket in bytes + char clientId[SCE_REMOTE_STORAGE_CLIENT_ID_MAX_LEN]; // This represents + // your application on + // PSN, used to sign + // PSN user in for + // your title + SceRemoteStorageInitTimeout timeout; // Timeout for network transactions + SceRemoteStorageInitParamsPool pool; // Memory pool parameters + SceRemoteStorageInitParamsThread thread; // Thread creation parameters + SceRemoteStorageEnvironment + environment; // Only used on non-PlayStation platforms: PSN Environment + // used by the library } SceRemoteStorageInitParams; -typedef struct SceRemoteStorageGetDataReqParams -{ - char fileName[SCE_REMOTE_STORAGE_DATA_NAME_MAX_LEN]; // Name of file on remote storage server - char pathLocation[SCE_REMOTE_STORAGE_DATA_LOCATION_MAX_LEN]; // File location on the HDD - char secureFileId[SCE_REMOTE_STORAGE_PS3_SAVEDATA_SECUREFILEID_SIZE]; // PS3 only. ID used for save data encryption - char ps3DataFilename[SCE_REMOTE_STORAGE_PS3_SAVEDATA_FILENAME_SIZE]; // PS3 only. Name of data file in save data - uint32_t ps3FileType; // PS3 only. Type of file, CELL_SAVEDATA_FILETYPE_XXX - SceAppUtilSaveDataDataSlot psVitaSaveDataSlot; // PS Vita only. Save data slot information +typedef struct SceRemoteStorageGetDataReqParams { + char fileName[SCE_REMOTE_STORAGE_DATA_NAME_MAX_LEN]; // Name of file on + // remote storage + // server + char pathLocation + [SCE_REMOTE_STORAGE_DATA_LOCATION_MAX_LEN]; // File location on the HDD + char secureFileId + [SCE_REMOTE_STORAGE_PS3_SAVEDATA_SECUREFILEID_SIZE]; // PS3 only. ID + // used for save + // data encryption + char ps3DataFilename + [SCE_REMOTE_STORAGE_PS3_SAVEDATA_FILENAME_SIZE]; // PS3 only. Name of + // data file in save + // data + uint32_t ps3FileType; // PS3 only. Type of file, CELL_SAVEDATA_FILETYPE_XXX + SceAppUtilSaveDataDataSlot + psVitaSaveDataSlot; // PS Vita only. Save data slot information } SceRemoteStorageGetDataReqParams; -typedef struct SceRemoteStorageSetDataReqParams -{ - char fileName[SCE_REMOTE_STORAGE_DATA_NAME_MAX_LEN]; // Name of file on remote storage server - char fileDescription[SCE_REMOTE_STORAGE_DATA_DESCRIPTION_MAX_LEN]; // Description of file on remote storage server - char pathLocation[SCE_REMOTE_STORAGE_DATA_LOCATION_MAX_LEN]; // File location on the HDD - char secureFileId[SCE_REMOTE_STORAGE_PS3_SAVEDATA_SECUREFILEID_SIZE]; // PS3 only. ID used for save data encryption - char ps3DataFilename[SCE_REMOTE_STORAGE_PS3_SAVEDATA_FILENAME_SIZE]; // PS3 only. Name of data file in save data - uint32_t ps3FileType; // PS3 only. Type of file, CELL_SAVEDATA_FILETYPE_XXX - SceRemoteStorageDataVisibility visibility; // Visibility of data +typedef struct SceRemoteStorageSetDataReqParams { + char fileName[SCE_REMOTE_STORAGE_DATA_NAME_MAX_LEN]; // Name of file on + // remote storage + // server + char fileDescription + [SCE_REMOTE_STORAGE_DATA_DESCRIPTION_MAX_LEN]; // Description of file + // on remote storage + // server + char pathLocation + [SCE_REMOTE_STORAGE_DATA_LOCATION_MAX_LEN]; // File location on the HDD + char secureFileId + [SCE_REMOTE_STORAGE_PS3_SAVEDATA_SECUREFILEID_SIZE]; // PS3 only. ID + // used for save + // data encryption + char ps3DataFilename + [SCE_REMOTE_STORAGE_PS3_SAVEDATA_FILENAME_SIZE]; // PS3 only. Name of + // data file in save + // data + uint32_t ps3FileType; // PS3 only. Type of file, CELL_SAVEDATA_FILETYPE_XXX + SceRemoteStorageDataVisibility visibility; // Visibility of data } SceRemoteStorageSetDataReqParams; -typedef struct SceRemoteStorageData -{ - char fileName[SCE_REMOTE_STORAGE_DATA_NAME_MAX_LEN]; // Name of file on remote storage server - char fileDescription[SCE_REMOTE_STORAGE_DATA_DESCRIPTION_MAX_LEN]; // Description of file on remote storage server - size_t fileSize; // Size of file in bytes - char md5Checksum[SCE_REMOTE_STORAGE_MD5_STRING_LENGTH]; // File MD5 checksum - char timeStamp[SCE_REMOTE_STORAGE_RFC2822_LENGTH]; // Time that data was written on the server. Format is RFC2822 - SceRemoteStorageDataVisibility visibility; // Visibility of data +typedef struct SceRemoteStorageData { + char fileName[SCE_REMOTE_STORAGE_DATA_NAME_MAX_LEN]; // Name of file on + // remote storage + // server + char fileDescription + [SCE_REMOTE_STORAGE_DATA_DESCRIPTION_MAX_LEN]; // Description of file + // on remote storage + // server + size_t fileSize; // Size of file in bytes + char + md5Checksum[SCE_REMOTE_STORAGE_MD5_STRING_LENGTH]; // File MD5 checksum + char + timeStamp[SCE_REMOTE_STORAGE_RFC2822_LENGTH]; // Time that data was + // written on the server. + // Format is RFC2822 + SceRemoteStorageDataVisibility visibility; // Visibility of data } SceRemoteStorageData; -typedef struct SceRemoteStorageWebBrowserReqParams { } SceRemoteStorageWebBrowseReqParams; +typedef struct SceRemoteStorageWebBrowserReqParams { +} SceRemoteStorageWebBrowseReqParams; -typedef struct SceRemoteStorageStatusReqParams { } SceRemoteStorageStatusReqParams; +typedef struct SceRemoteStorageStatusReqParams { +} SceRemoteStorageStatusReqParams; -typedef struct SceRemoteStorageAbortReqParams -{ - uint32_t requestId; // The request Id to be aborted +typedef struct SceRemoteStorageAbortReqParams { + uint32_t requestId; // The request Id to be aborted } SceRemoteStorageAbortReqParams; -typedef struct SceRemoteStorageStatus -{ - uint32_t numFiles; // Number of files user has on remote storage server - SceRemoteStorageData data[SCE_REMOTE_STORAGE_MAX_FILES]; // Details about data if available. Data buffer will not be retrieved - uint64_t remainingSyncs; // Remaining syncs. the user has for upload/download +typedef struct SceRemoteStorageStatus { + uint32_t numFiles; // Number of files user has on remote storage server + SceRemoteStorageData + data[SCE_REMOTE_STORAGE_MAX_FILES]; // Details about data if available. + // Data buffer will not be + // retrieved + uint64_t + remainingSyncs; // Remaining syncs. the user has for upload/download } SceRemoteStorageStatus; #endif diff --git a/Minecraft.Client/Platform/Common/Telemetry/TelemetryManager.h b/Minecraft.Client/Platform/Common/Telemetry/TelemetryManager.h index 03d21cfa6..1241c1e86 100644 --- a/Minecraft.Client/Platform/Common/Telemetry/TelemetryManager.h +++ b/Minecraft.Client/Platform/Common/Telemetry/TelemetryManager.h @@ -4,7 +4,7 @@ // SentientManager.h -> MinecraftTelemetry.h. Using the Windows64 path would // cause duplicate enum definitions. #if defined(__linux__) -#include "../../Minecraft.Client/Platform/Orbis/Sentient/TelemetryEnum.h" +#include "../../Minecraft.Client/Platform/Linux/Sentient/TelemetryEnum.h" #else #include "../../Minecraft.Client/Platform/Windows64/Sentient/TelemetryEnum.h" #endif diff --git a/Minecraft.Client/Platform/Common/Tutorial/AreaConstraint.cpp b/Minecraft.Client/Platform/Common/Tutorial/AreaConstraint.cpp index d62e04127..ddd57b539 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/AreaConstraint.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/AreaConstraint.cpp @@ -5,48 +5,47 @@ #include "AreaConstraint.h" #include "../../Minecraft.World/Util/AABB.h" -AreaConstraint::AreaConstraint( int descriptionId, double x0, double y0, double z0, double x1, double y1, double z1, bool contains /*= true*/, bool restrictsMovement /*=true*/ ) - : TutorialConstraint( descriptionId ) -{ - messageArea = AABB::newPermanent(x0+2, y0+2, z0+2, x1-2, y1-2, z1-2); - movementArea = AABB::newPermanent(x0, y0, z0, x1, y1, z1); +AreaConstraint::AreaConstraint(int descriptionId, double x0, double y0, + double z0, double x1, double y1, double z1, + bool contains /*= true*/, + bool restrictsMovement /*=true*/) + : TutorialConstraint(descriptionId) { + messageArea = + AABB::newPermanent(x0 + 2, y0 + 2, z0 + 2, x1 - 2, y1 - 2, z1 - 2); + movementArea = AABB::newPermanent(x0, y0, z0, x1, y1, z1); - this->contains = contains; - m_restrictsMovement = restrictsMovement; + this->contains = contains; + m_restrictsMovement = restrictsMovement; } -AreaConstraint::~AreaConstraint() -{ - delete messageArea; - delete movementArea; +AreaConstraint::~AreaConstraint() { + delete messageArea; + delete movementArea; } -bool AreaConstraint::isConstraintSatisfied(int iPad) -{ - Minecraft *minecraft = Minecraft::GetInstance(); - return messageArea->contains( minecraft->localplayers[iPad]->getPos(1) ) == contains; +bool AreaConstraint::isConstraintSatisfied(int iPad) { + Minecraft* minecraft = Minecraft::GetInstance(); + return messageArea->contains(minecraft->localplayers[iPad]->getPos(1)) == + contains; } -bool AreaConstraint::isConstraintRestrictive(int iPad) -{ - return m_restrictsMovement; +bool AreaConstraint::isConstraintRestrictive(int iPad) { + return m_restrictsMovement; } +bool AreaConstraint::canMoveToPosition(double xo, double yo, double zo, + double xt, double yt, double zt) { + if (!m_restrictsMovement) return true; -bool AreaConstraint::canMoveToPosition(double xo, double yo, double zo, double xt, double yt, double zt) -{ - if(!m_restrictsMovement) return true; + Vec3* targetPos = Vec3::newTemp(xt, yt, zt); + Minecraft* minecraft = Minecraft::GetInstance(); - Vec3 *targetPos = Vec3::newTemp(xt, yt, zt); - Minecraft *minecraft = Minecraft::GetInstance(); - - if(movementArea->contains( targetPos ) == contains) - { - return true; - } - Vec3 *origPos = Vec3::newTemp(xo, yo, zo); + if (movementArea->contains(targetPos) == contains) { + return true; + } + Vec3* origPos = Vec3::newTemp(xo, yo, zo); - double currDist = origPos->distanceTo(movementArea); - double targetDist = targetPos->distanceTo(movementArea); - return targetDist < currDist; + double currDist = origPos->distanceTo(movementArea); + double targetDist = targetPos->distanceTo(movementArea); + return targetDist < currDist; } diff --git a/Minecraft.Client/Platform/Common/Tutorial/AreaConstraint.h b/Minecraft.Client/Platform/Common/Tutorial/AreaConstraint.h index f98945e1b..721ab6eb1 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/AreaConstraint.h +++ b/Minecraft.Client/Platform/Common/Tutorial/AreaConstraint.h @@ -4,21 +4,24 @@ class AABB; -class AreaConstraint : public TutorialConstraint -{ +class AreaConstraint : public TutorialConstraint { private: - AABB *movementArea; - AABB *messageArea; - bool contains; // If true we must stay in this area, if false must stay out of this area - bool m_restrictsMovement; + AABB* movementArea; + AABB* messageArea; + bool contains; // If true we must stay in this area, if false must stay out + // of this area + bool m_restrictsMovement; public: - virtual ConstraintType getType() { return e_ConstraintArea; } + virtual ConstraintType getType() { return e_ConstraintArea; } - AreaConstraint( int descriptionId, double x0, double y0, double z0, double x1, double y1, double z1, bool contains = true, bool restrictsMovement =true ); - ~AreaConstraint(); + AreaConstraint(int descriptionId, double x0, double y0, double z0, + double x1, double y1, double z1, bool contains = true, + bool restrictsMovement = true); + ~AreaConstraint(); - virtual bool isConstraintSatisfied(int iPad); - virtual bool isConstraintRestrictive(int iPad); - virtual bool canMoveToPosition(double xo, double yo, double zo, double xt, double yt, double zt); + virtual bool isConstraintSatisfied(int iPad); + virtual bool isConstraintRestrictive(int iPad); + virtual bool canMoveToPosition(double xo, double yo, double zo, double xt, + double yt, double zt); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/AreaHint.cpp b/Minecraft.Client/Platform/Common/Tutorial/AreaHint.cpp index ceaa63470..729b361d0 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/AreaHint.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/AreaHint.cpp @@ -6,44 +6,37 @@ #include "../../Minecraft.World/Util/AABB.h" #include "Tutorial.h" -AreaHint::AreaHint(eTutorial_Hint id, Tutorial *tutorial, eTutorial_State displayState, eTutorial_State completeState, - int descriptionId, double x0, double y0, double z0, double x1, double y1, double z1, bool allowFade /*= false*/, bool contains /*= true*/ ) - : TutorialHint( id, tutorial, descriptionId, e_Hint_Area, allowFade ) -{ - area = AABB::newPermanent(x0, y0, z0, x1, y1, z1); +AreaHint::AreaHint(eTutorial_Hint id, Tutorial* tutorial, + eTutorial_State displayState, eTutorial_State completeState, + int descriptionId, double x0, double y0, double z0, + double x1, double y1, double z1, bool allowFade /*= false*/, + bool contains /*= true*/) + : TutorialHint(id, tutorial, descriptionId, e_Hint_Area, allowFade) { + area = AABB::newPermanent(x0, y0, z0, x1, y1, z1); - this->contains = contains; + this->contains = contains; - m_displayState = displayState; - m_completeState = completeState; + m_displayState = displayState; + m_completeState = completeState; } -AreaHint::~AreaHint() -{ - delete area; -} +AreaHint::~AreaHint() { delete area; } -int AreaHint::tick() -{ - Minecraft *minecraft = Minecraft::GetInstance(); - if( (m_displayState == e_Tutorial_State_Any || m_tutorial->getCurrentState() == m_displayState) && - m_hintNeeded && - area->contains( minecraft->player->getPos(1) ) == contains ) - { - if( m_completeState == e_Tutorial_State_None ) - { - m_hintNeeded = false; - } - else if ( m_tutorial->isStateCompleted( m_completeState ) ) - { - m_hintNeeded = false; - return -1; - } +int AreaHint::tick() { + Minecraft* minecraft = Minecraft::GetInstance(); + if ((m_displayState == e_Tutorial_State_Any || + m_tutorial->getCurrentState() == m_displayState) && + m_hintNeeded && + area->contains(minecraft->player->getPos(1)) == contains) { + if (m_completeState == e_Tutorial_State_None) { + m_hintNeeded = false; + } else if (m_tutorial->isStateCompleted(m_completeState)) { + m_hintNeeded = false; + return -1; + } - return m_descriptionId; - } - else - { - return -1; - } + return m_descriptionId; + } else { + return -1; + } } diff --git a/Minecraft.Client/Platform/Common/Tutorial/AreaHint.h b/Minecraft.Client/Platform/Common/Tutorial/AreaHint.h index 12ef89771..71d8219f2 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/AreaHint.h +++ b/Minecraft.Client/Platform/Common/Tutorial/AreaHint.h @@ -4,22 +4,24 @@ class AABB; -class AreaHint : public TutorialHint -{ +class AreaHint : public TutorialHint { private: - AABB *area; - bool contains; // If true we must stay in this area, if false must stay out of this area + AABB* area; + bool contains; // If true we must stay in this area, if false must stay out + // of this area - // Only display the hint if the game is in this state - eTutorial_State m_displayState; + // Only display the hint if the game is in this state + eTutorial_State m_displayState; - // Only display the hint if this state is not completed - eTutorial_State m_completeState; + // Only display the hint if this state is not completed + eTutorial_State m_completeState; public: - AreaHint(eTutorial_Hint id, Tutorial *tutorial, eTutorial_State displayState, eTutorial_State completeState, - int descriptionId, double x0, double y0, double z0, double x1, double y1, double z1, bool allowFade = true, bool contains = true ); - ~AreaHint(); + AreaHint(eTutorial_Hint id, Tutorial* tutorial, + eTutorial_State displayState, eTutorial_State completeState, + int descriptionId, double x0, double y0, double z0, double x1, + double y1, double z1, bool allowFade = true, bool contains = true); + ~AreaHint(); - virtual int tick(); + virtual int tick(); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/AreaTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/AreaTask.cpp index 4a84c2a86..87cdb2126 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/AreaTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/AreaTask.cpp @@ -2,68 +2,58 @@ #include "Tutorial.h" #include "AreaTask.h" -AreaTask::AreaTask(eTutorial_State state, Tutorial *tutorial, std::vector *inConstraints, int descriptionId, EAreaTaskCompletionStates completionState) - : TutorialTask( tutorial, descriptionId, false, inConstraints, false, false, false ) -{ - m_tutorialState = state; - if(m_tutorialState == e_Tutorial_State_Gameplay) - { - enableConstraints(true); - } - m_completionState = completionState; +AreaTask::AreaTask(eTutorial_State state, Tutorial* tutorial, + std::vector* inConstraints, + int descriptionId, EAreaTaskCompletionStates completionState) + : TutorialTask(tutorial, descriptionId, false, inConstraints, false, false, + false) { + m_tutorialState = state; + if (m_tutorialState == e_Tutorial_State_Gameplay) { + enableConstraints(true); + } + m_completionState = completionState; } -bool AreaTask::isCompleted() -{ - if(bIsCompleted) return true; +bool AreaTask::isCompleted() { + if (bIsCompleted) return true; - bool complete = false; - switch(m_completionState) - { - case eAreaTaskCompletion_CompleteOnConstraintsSatisfied: - { - bool allSatisfied = true; - for(AUTO_VAR(it, constraints.begin()); it != constraints.end(); ++it) - { - TutorialConstraint *constraint = *it; - if(!constraint->isConstraintSatisfied(tutorial->getPad())) - { - allSatisfied = false; - break; - } - } - complete = allSatisfied; - } - break; - case eAreaTaskCompletion_CompleteOnActivation: - complete = bHasBeenActivated; - break; - }; - bIsCompleted = complete; - return complete; + bool complete = false; + switch (m_completionState) { + case eAreaTaskCompletion_CompleteOnConstraintsSatisfied: { + bool allSatisfied = true; + for (AUTO_VAR(it, constraints.begin()); it != constraints.end(); + ++it) { + TutorialConstraint* constraint = *it; + if (!constraint->isConstraintSatisfied(tutorial->getPad())) { + allSatisfied = false; + break; + } + } + complete = allSatisfied; + } break; + case eAreaTaskCompletion_CompleteOnActivation: + complete = bHasBeenActivated; + break; + }; + bIsCompleted = complete; + return complete; } -void AreaTask::setAsCurrentTask(bool active) -{ - TutorialTask::setAsCurrentTask(active); +void AreaTask::setAsCurrentTask(bool active) { + TutorialTask::setAsCurrentTask(active); - if(m_completionState == eAreaTaskCompletion_CompleteOnConstraintsSatisfied) - { - enableConstraints(active); - } + if (m_completionState == + eAreaTaskCompletion_CompleteOnConstraintsSatisfied) { + enableConstraints(active); + } } -void AreaTask::onStateChange(eTutorial_State newState) -{ - if(m_completionState == eAreaTaskCompletion_CompleteOnActivation) - { - if(m_tutorialState == newState) - { - enableConstraints(true); - } - else if(m_tutorialState != e_Tutorial_State_Gameplay) - { - //enableConstraints(false); - } - } +void AreaTask::onStateChange(eTutorial_State newState) { + if (m_completionState == eAreaTaskCompletion_CompleteOnActivation) { + if (m_tutorialState == newState) { + enableConstraints(true); + } else if (m_tutorialState != e_Tutorial_State_Gameplay) { + // enableConstraints(false); + } + } } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/AreaTask.h b/Minecraft.Client/Platform/Common/Tutorial/AreaTask.h index 2480d398b..e1642f5bb 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/AreaTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/AreaTask.h @@ -1,24 +1,27 @@ #pragma once -//using namespace std; +// using namespace std; #include "TutorialTask.h" // A task that creates an maintains an area constraint until it is activated -class AreaTask : public TutorialTask -{ +class AreaTask : public TutorialTask { public: - enum EAreaTaskCompletionStates - { - eAreaTaskCompletion_CompleteOnActivation, - eAreaTaskCompletion_CompleteOnConstraintsSatisfied, - }; -private: - EAreaTaskCompletionStates m_completionState; - eTutorial_State m_tutorialState; -public: - AreaTask(eTutorial_State state, Tutorial *tutorial, std::vector *inConstraints, int descriptionId = -1, EAreaTaskCompletionStates completionState = eAreaTaskCompletion_CompleteOnActivation); - virtual bool isCompleted(); - virtual void setAsCurrentTask(bool active = true); - virtual void onStateChange(eTutorial_State newState); + enum EAreaTaskCompletionStates { + eAreaTaskCompletion_CompleteOnActivation, + eAreaTaskCompletion_CompleteOnConstraintsSatisfied, + }; +private: + EAreaTaskCompletionStates m_completionState; + eTutorial_State m_tutorialState; + +public: + AreaTask(eTutorial_State state, Tutorial* tutorial, + std::vector* inConstraints, + int descriptionId = -1, + EAreaTaskCompletionStates completionState = + eAreaTaskCompletion_CompleteOnActivation); + virtual bool isCompleted(); + virtual void setAsCurrentTask(bool active = true); + virtual void onStateChange(eTutorial_State newState); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/ChangeStateConstraint.cpp b/Minecraft.Client/Platform/Common/Tutorial/ChangeStateConstraint.cpp index ea49e929a..9d8d75e1d 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/ChangeStateConstraint.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/ChangeStateConstraint.cpp @@ -9,128 +9,150 @@ #include "../../Minecraft.Client/Network/ClientConnection.h" #include "../../Minecraft.World/Headers/net.minecraft.network.packet.h" -ChangeStateConstraint::ChangeStateConstraint( Tutorial *tutorial, eTutorial_State targetState, eTutorial_State sourceStates[], std::size_t sourceStatesCount, - double x0, double y0, double z0, double x1, double y1, double z1, bool contains /*= true*/, bool changeGameMode /*= false*/, GameType *targetGameMode /*= 0*/ ) - : TutorialConstraint( -1 ) -{ - movementArea = AABB::newPermanent(x0, y0, z0, x1, y1, z1); +ChangeStateConstraint::ChangeStateConstraint( + Tutorial* tutorial, eTutorial_State targetState, + eTutorial_State sourceStates[], std::size_t sourceStatesCount, double x0, + double y0, double z0, double x1, double y1, double z1, + bool contains /*= true*/, bool changeGameMode /*= false*/, + GameType* targetGameMode /*= 0*/) + : TutorialConstraint(-1) { + movementArea = AABB::newPermanent(x0, y0, z0, x1, y1, z1); - this->contains = contains; + this->contains = contains; - m_changeGameMode = changeGameMode; - m_targetGameMode = targetGameMode; - m_changedFromGameMode = 0; + m_changeGameMode = changeGameMode; + m_targetGameMode = targetGameMode; + m_changedFromGameMode = 0; - m_tutorial = tutorial; - m_targetState = targetState; - m_sourceStatesCount = sourceStatesCount; - - m_bHasChanged = false; - m_changedFromState = e_Tutorial_State_None; + m_tutorial = tutorial; + m_targetState = targetState; + m_sourceStatesCount = sourceStatesCount; - m_bComplete = false; + m_bHasChanged = false; + m_changedFromState = e_Tutorial_State_None; - m_sourceStates = new eTutorial_State [m_sourceStatesCount]; - for(unsigned int i=0;i0) delete [] m_sourceStates; +ChangeStateConstraint::~ChangeStateConstraint() { + delete movementArea; + if (m_sourceStatesCount > 0) delete[] m_sourceStates; } -void ChangeStateConstraint::tick(int iPad) -{ - if(m_bComplete) return; +void ChangeStateConstraint::tick(int iPad) { + if (m_bComplete) return; - if(m_tutorial->isStateCompleted(m_targetState)) - { - Minecraft *minecraft = Minecraft::GetInstance(); - if(m_changeGameMode) - { - unsigned int playerPrivs = minecraft->localplayers[iPad]->getAllPlayerGamePrivileges(); - Player::setPlayerGamePrivilege(playerPrivs,Player::ePlayerGamePrivilege_CreativeMode,m_changedFromGameMode == GameType::CREATIVE); + if (m_tutorial->isStateCompleted(m_targetState)) { + Minecraft* minecraft = Minecraft::GetInstance(); + if (m_changeGameMode) { + unsigned int playerPrivs = + minecraft->localplayers[iPad]->getAllPlayerGamePrivileges(); + Player::setPlayerGamePrivilege( + playerPrivs, Player::ePlayerGamePrivilege_CreativeMode, + m_changedFromGameMode == GameType::CREATIVE); - unsigned int originalPrivileges = minecraft->localplayers[iPad]->getAllPlayerGamePrivileges(); - if(originalPrivileges != playerPrivs) - { - // Send update settings packet to server - Minecraft *pMinecraft = Minecraft::GetInstance(); - std::shared_ptr player = minecraft->localplayers[iPad]; - if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL) - { - player->connection->send( std::shared_ptr( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); - } - } - } - m_bComplete = true; - return; - } + unsigned int originalPrivileges = + minecraft->localplayers[iPad]->getAllPlayerGamePrivileges(); + if (originalPrivileges != playerPrivs) { + // Send update settings packet to server + Minecraft* pMinecraft = Minecraft::GetInstance(); + std::shared_ptr player = + minecraft->localplayers[iPad]; + if (player != NULL && player->connection && + player->connection->getNetworkPlayer() != NULL) { + player->connection->send( + std::shared_ptr(new PlayerInfoPacket( + player->connection->getNetworkPlayer() + ->GetSmallId(), + -1, playerPrivs))); + } + } + } + m_bComplete = true; + return; + } - bool inASourceState = false; - Minecraft *minecraft = Minecraft::GetInstance(); - for(std::size_t i = 0; i < m_sourceStatesCount; ++i) - { - if(m_sourceStates[i] == m_tutorial->getCurrentState()) - { - inASourceState = true; - break; - } - } - if( !m_bHasChanged && inASourceState && movementArea->contains( minecraft->localplayers[iPad]->getPos(1) ) == contains ) - { - m_bHasChanged = true; - m_changedFromState = m_tutorial->getCurrentState(); - m_tutorial->changeTutorialState(m_targetState); + bool inASourceState = false; + Minecraft* minecraft = Minecraft::GetInstance(); + for (std::size_t i = 0; i < m_sourceStatesCount; ++i) { + if (m_sourceStates[i] == m_tutorial->getCurrentState()) { + inASourceState = true; + break; + } + } + if (!m_bHasChanged && inASourceState && + movementArea->contains(minecraft->localplayers[iPad]->getPos(1)) == + contains) { + m_bHasChanged = true; + m_changedFromState = m_tutorial->getCurrentState(); + m_tutorial->changeTutorialState(m_targetState); - if(m_changeGameMode) - { - if(minecraft->localgameModes[iPad] != NULL) - { - m_changedFromGameMode = minecraft->localplayers[iPad]->abilities.instabuild ? GameType::CREATIVE : GameType::SURVIVAL; + if (m_changeGameMode) { + if (minecraft->localgameModes[iPad] != NULL) { + m_changedFromGameMode = + minecraft->localplayers[iPad]->abilities.instabuild + ? GameType::CREATIVE + : GameType::SURVIVAL; - unsigned int playerPrivs = minecraft->localplayers[iPad]->getAllPlayerGamePrivileges(); - Player::setPlayerGamePrivilege(playerPrivs,Player::ePlayerGamePrivilege_CreativeMode,m_targetGameMode == GameType::CREATIVE); + unsigned int playerPrivs = + minecraft->localplayers[iPad]->getAllPlayerGamePrivileges(); + Player::setPlayerGamePrivilege( + playerPrivs, Player::ePlayerGamePrivilege_CreativeMode, + m_targetGameMode == GameType::CREATIVE); - unsigned int originalPrivileges = minecraft->localplayers[iPad]->getAllPlayerGamePrivileges(); - if(originalPrivileges != playerPrivs) - { - // Send update settings packet to server - Minecraft *pMinecraft = Minecraft::GetInstance(); - std::shared_ptr player = minecraft->localplayers[iPad]; - if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL) - { - player->connection->send( std::shared_ptr( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); - } - } - } - } - } - else if( m_bHasChanged && movementArea->contains( minecraft->localplayers[iPad]->getPos(1) ) != contains ) - { - m_bHasChanged = false; - m_tutorial->changeTutorialState(m_changedFromState); + unsigned int originalPrivileges = + minecraft->localplayers[iPad]->getAllPlayerGamePrivileges(); + if (originalPrivileges != playerPrivs) { + // Send update settings packet to server + Minecraft* pMinecraft = Minecraft::GetInstance(); + std::shared_ptr player = + minecraft->localplayers[iPad]; + if (player != NULL && player->connection && + player->connection->getNetworkPlayer() != NULL) { + player->connection->send( + std::shared_ptr( + new PlayerInfoPacket( + player->connection->getNetworkPlayer() + ->GetSmallId(), + -1, playerPrivs))); + } + } + } + } + } else if (m_bHasChanged && + movementArea->contains( + minecraft->localplayers[iPad]->getPos(1)) != contains) { + m_bHasChanged = false; + m_tutorial->changeTutorialState(m_changedFromState); - if(m_changeGameMode) - { - unsigned int playerPrivs = minecraft->localplayers[iPad]->getAllPlayerGamePrivileges(); - Player::setPlayerGamePrivilege(playerPrivs,Player::ePlayerGamePrivilege_CreativeMode,m_changedFromGameMode == GameType::CREATIVE); + if (m_changeGameMode) { + unsigned int playerPrivs = + minecraft->localplayers[iPad]->getAllPlayerGamePrivileges(); + Player::setPlayerGamePrivilege( + playerPrivs, Player::ePlayerGamePrivilege_CreativeMode, + m_changedFromGameMode == GameType::CREATIVE); - unsigned int originalPrivileges = minecraft->localplayers[iPad]->getAllPlayerGamePrivileges(); - if(originalPrivileges != playerPrivs) - { - // Send update settings packet to server - Minecraft *pMinecraft = Minecraft::GetInstance(); - std::shared_ptr player = minecraft->localplayers[iPad]; - if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL) - { - player->connection->send( std::shared_ptr( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); - } - } - } - } + unsigned int originalPrivileges = + minecraft->localplayers[iPad]->getAllPlayerGamePrivileges(); + if (originalPrivileges != playerPrivs) { + // Send update settings packet to server + Minecraft* pMinecraft = Minecraft::GetInstance(); + std::shared_ptr player = + minecraft->localplayers[iPad]; + if (player != NULL && player->connection && + player->connection->getNetworkPlayer() != NULL) { + player->connection->send( + std::shared_ptr(new PlayerInfoPacket( + player->connection->getNetworkPlayer() + ->GetSmallId(), + -1, playerPrivs))); + } + } + } + } } diff --git a/Minecraft.Client/Platform/Common/Tutorial/ChangeStateConstraint.h b/Minecraft.Client/Platform/Common/Tutorial/ChangeStateConstraint.h index 9388210c9..5ec51d437 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/ChangeStateConstraint.h +++ b/Minecraft.Client/Platform/Common/Tutorial/ChangeStateConstraint.h @@ -9,31 +9,36 @@ class AABB; class Tutorial; class GameType; -class ChangeStateConstraint : public TutorialConstraint -{ +class ChangeStateConstraint : public TutorialConstraint { private: - AABB *movementArea; - bool contains; // If true we must stay in this area, if false must stay out of this area - bool m_changeGameMode; - GameType *m_targetGameMode; - GameType *m_changedFromGameMode; + AABB* movementArea; + bool contains; // If true we must stay in this area, if false must stay out + // of this area + bool m_changeGameMode; + GameType* m_targetGameMode; + GameType* m_changedFromGameMode; - eTutorial_State m_targetState; - eTutorial_State *m_sourceStates; - std::size_t m_sourceStatesCount; + eTutorial_State m_targetState; + eTutorial_State* m_sourceStates; + std::size_t m_sourceStatesCount; - bool m_bHasChanged; - eTutorial_State m_changedFromState; + bool m_bHasChanged; + eTutorial_State m_changedFromState; - bool m_bComplete; + bool m_bComplete; - Tutorial *m_tutorial; + Tutorial* m_tutorial; public: - virtual ConstraintType getType() { return e_ConstraintChangeState; } + virtual ConstraintType getType() { return e_ConstraintChangeState; } - ChangeStateConstraint( Tutorial *tutorial, eTutorial_State targetState, eTutorial_State sourceStates[], std::size_t sourceStatesCount, double x0, double y0, double z0, double x1, double y1, double z1, bool contains = true, bool changeGameMode = false, GameType *targetGameMode = NULL ); - ~ChangeStateConstraint(); + ChangeStateConstraint(Tutorial* tutorial, eTutorial_State targetState, + eTutorial_State sourceStates[], + std::size_t sourceStatesCount, double x0, double y0, + double z0, double x1, double y1, double z1, + bool contains = true, bool changeGameMode = false, + GameType* targetGameMode = NULL); + ~ChangeStateConstraint(); - virtual void tick(int iPad); + virtual void tick(int iPad); }; diff --git a/Minecraft.Client/Platform/Common/Tutorial/ChoiceTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/ChoiceTask.cpp index c9aedfed8..8349199dc 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/ChoiceTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/ChoiceTask.cpp @@ -8,130 +8,121 @@ #include "ChoiceTask.h" #include "../../Minecraft.World/Blocks/Material.h" -ChoiceTask::ChoiceTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/, - int iConfirmMapping /*= 0*/, int iCancelMapping /*= 0*/, - eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/) - : TutorialTask( tutorial, descriptionId, false, NULL, true, false, false ) -{ - if(requiresUserInput == true) - { - constraints.push_back( new InputConstraint( iConfirmMapping ) ); - constraints.push_back( new InputConstraint( iCancelMapping ) ); - } - m_iConfirmMapping = iConfirmMapping; - m_iCancelMapping = iCancelMapping; - m_bConfirmMappingComplete = false; - m_bCancelMappingComplete = false; +ChoiceTask::ChoiceTask( + Tutorial* tutorial, int descriptionId, int promptId /*= -1*/, + bool requiresUserInput /*= false*/, int iConfirmMapping /*= 0*/, + int iCancelMapping /*= 0*/, + eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/, + ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/) + : TutorialTask(tutorial, descriptionId, false, NULL, true, false, false) { + if (requiresUserInput == true) { + constraints.push_back(new InputConstraint(iConfirmMapping)); + constraints.push_back(new InputConstraint(iCancelMapping)); + } + m_iConfirmMapping = iConfirmMapping; + m_iCancelMapping = iCancelMapping; + m_bConfirmMappingComplete = false; + m_bCancelMappingComplete = false; - m_cancelAction = cancelAction; + m_cancelAction = cancelAction; - m_promptId = promptId; - tutorial->addMessage( m_promptId ); + m_promptId = promptId; + tutorial->addMessage(m_promptId); - m_eTelemetryEvent = telemetryEvent; + m_eTelemetryEvent = telemetryEvent; } -bool ChoiceTask::isCompleted() -{ - Minecraft *pMinecraft = Minecraft::GetInstance(); +bool ChoiceTask::isCompleted() { + Minecraft* pMinecraft = Minecraft::GetInstance(); - if( m_bConfirmMappingComplete || m_bCancelMappingComplete ) - { - sendTelemetry(); - enableConstraints(false, true); - return true; - } - - if(ui.GetMenuDisplayed(tutorial->getPad())) - { - // If a menu is displayed, then we use the handleUIInput to complete the task - } - else - { - // If the player is under water then allow all keypresses so they can jump out - if( pMinecraft->localplayers[tutorial->getPad()]->isUnderLiquid(Material::water) ) return false; + if (m_bConfirmMappingComplete || m_bCancelMappingComplete) { + sendTelemetry(); + enableConstraints(false, true); + return true; + } - if(!m_bConfirmMappingComplete && InputManager.GetValue(pMinecraft->player->GetXboxPad(), m_iConfirmMapping) > 0 ) - { - m_bConfirmMappingComplete = true; - } - if(!m_bCancelMappingComplete && InputManager.GetValue(pMinecraft->player->GetXboxPad(), m_iCancelMapping) > 0 ) - { - m_bCancelMappingComplete = true; - } - } + if (ui.GetMenuDisplayed(tutorial->getPad())) { + // If a menu is displayed, then we use the handleUIInput to complete the + // task + } else { + // If the player is under water then allow all keypresses so they can + // jump out + if (pMinecraft->localplayers[tutorial->getPad()]->isUnderLiquid( + Material::water)) + return false; - if(m_bConfirmMappingComplete || m_bCancelMappingComplete) - { - sendTelemetry(); - enableConstraints(false, true); - } - return m_bConfirmMappingComplete || m_bCancelMappingComplete; + if (!m_bConfirmMappingComplete && + InputManager.GetValue(pMinecraft->player->GetXboxPad(), + m_iConfirmMapping) > 0) { + m_bConfirmMappingComplete = true; + } + if (!m_bCancelMappingComplete && + InputManager.GetValue(pMinecraft->player->GetXboxPad(), + m_iCancelMapping) > 0) { + m_bCancelMappingComplete = true; + } + } + + if (m_bConfirmMappingComplete || m_bCancelMappingComplete) { + sendTelemetry(); + enableConstraints(false, true); + } + return m_bConfirmMappingComplete || m_bCancelMappingComplete; } -eTutorial_CompletionAction ChoiceTask::getCompletionAction() -{ - if(m_bCancelMappingComplete) - { - return m_cancelAction; - } - else - { - return e_Tutorial_Completion_None; - } +eTutorial_CompletionAction ChoiceTask::getCompletionAction() { + if (m_bCancelMappingComplete) { + return m_cancelAction; + } else { + return e_Tutorial_Completion_None; + } } -int ChoiceTask::getPromptId() -{ - if( m_bShownForMinimumTime ) - return m_promptId; - else - return -1; +int ChoiceTask::getPromptId() { + if (m_bShownForMinimumTime) + return m_promptId; + else + return -1; } -void ChoiceTask::setAsCurrentTask(bool active /*= true*/) -{ - enableConstraints( active ); - TutorialTask::setAsCurrentTask(active); +void ChoiceTask::setAsCurrentTask(bool active /*= true*/) { + enableConstraints(active); + TutorialTask::setAsCurrentTask(active); } -void ChoiceTask::handleUIInput(int iAction) -{ - if(bHasBeenActivated && m_bShownForMinimumTime) - { - if( iAction == m_iConfirmMapping ) - { - m_bConfirmMappingComplete = true; - } - else if(iAction == m_iCancelMapping ) - { - m_bCancelMappingComplete = true; - } - } +void ChoiceTask::handleUIInput(int iAction) { + if (bHasBeenActivated && m_bShownForMinimumTime) { + if (iAction == m_iConfirmMapping) { + m_bConfirmMappingComplete = true; + } else if (iAction == m_iCancelMapping) { + m_bCancelMappingComplete = true; + } + } } -void ChoiceTask::sendTelemetry() -{ - Minecraft *pMinecraft = Minecraft::GetInstance(); +void ChoiceTask::sendTelemetry() { + Minecraft* pMinecraft = Minecraft::GetInstance(); - if( m_eTelemetryEvent != eTelemetryChallenges_Unknown ) - { - bool firstPlay = true; - // We only store first play for some of the events - switch(m_eTelemetryEvent) - { - case eTelemetryTutorial_TrialStart: - firstPlay = !tutorial->getCompleted( eTutorial_Telemetry_TrialStart ); - tutorial->setCompleted( eTutorial_Telemetry_TrialStart ); - break; - case eTelemetryTutorial_Halfway: - firstPlay = !tutorial->getCompleted( eTutorial_Telemetry_Halfway ); - tutorial->setCompleted( eTutorial_Telemetry_Halfway ); - break; - default: - break; - }; + if (m_eTelemetryEvent != eTelemetryChallenges_Unknown) { + bool firstPlay = true; + // We only store first play for some of the events + switch (m_eTelemetryEvent) { + case eTelemetryTutorial_TrialStart: + firstPlay = + !tutorial->getCompleted(eTutorial_Telemetry_TrialStart); + tutorial->setCompleted(eTutorial_Telemetry_TrialStart); + break; + case eTelemetryTutorial_Halfway: + firstPlay = + !tutorial->getCompleted(eTutorial_Telemetry_Halfway); + tutorial->setCompleted(eTutorial_Telemetry_Halfway); + break; + default: + break; + }; - TelemetryManager->RecordEnemyKilledOrOvercome(pMinecraft->player->GetXboxPad(), 0, 0, 0, 0, 0, 0, m_eTelemetryEvent); - } + TelemetryManager->RecordEnemyKilledOrOvercome( + pMinecraft->player->GetXboxPad(), 0, 0, 0, 0, 0, 0, + m_eTelemetryEvent); + } } diff --git a/Minecraft.Client/Platform/Common/Tutorial/ChoiceTask.h b/Minecraft.Client/Platform/Common/Tutorial/ChoiceTask.h index f10168b19..198c71038 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/ChoiceTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/ChoiceTask.h @@ -1,27 +1,32 @@ #pragma once -//using namespace std; +// using namespace std; #include "TutorialTask.h" // Information messages with a choice -class ChoiceTask : public TutorialTask -{ +class ChoiceTask : public TutorialTask { private: - int m_iConfirmMapping, m_iCancelMapping; - bool m_bConfirmMappingComplete, m_bCancelMappingComplete; - eTutorial_CompletionAction m_cancelAction; + int m_iConfirmMapping, m_iCancelMapping; + bool m_bConfirmMappingComplete, m_bCancelMappingComplete; + eTutorial_CompletionAction m_cancelAction; - ETelemetryChallenges m_eTelemetryEvent; + ETelemetryChallenges m_eTelemetryEvent; + + bool CompletionMaskIsValid(); - bool CompletionMaskIsValid(); public: - ChoiceTask(Tutorial *tutorial, int descriptionId, int promptId = -1, bool requiresUserInput = false, int iConfirmMapping = 0, int iCancelMapping = 0, eTutorial_CompletionAction cancelAction = e_Tutorial_Completion_None, ETelemetryChallenges telemetryEvent = eTelemetryChallenges_Unknown); - virtual bool isCompleted(); - virtual eTutorial_CompletionAction getCompletionAction(); - virtual int getPromptId(); - virtual void setAsCurrentTask(bool active = true); - virtual void handleUIInput(int iAction); + ChoiceTask( + Tutorial* tutorial, int descriptionId, int promptId = -1, + bool requiresUserInput = false, int iConfirmMapping = 0, + int iCancelMapping = 0, + eTutorial_CompletionAction cancelAction = e_Tutorial_Completion_None, + ETelemetryChallenges telemetryEvent = eTelemetryChallenges_Unknown); + virtual bool isCompleted(); + virtual eTutorial_CompletionAction getCompletionAction(); + virtual int getPromptId(); + virtual void setAsCurrentTask(bool active = true); + virtual void handleUIInput(int iAction); private: - void sendTelemetry(); + void sendTelemetry(); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/CompleteUsingItemTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/CompleteUsingItemTask.cpp index 6f5ebabf7..74300bf8f 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/CompleteUsingItemTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/CompleteUsingItemTask.cpp @@ -2,36 +2,29 @@ #include "../../Minecraft.World/Items/ItemInstance.h" #include "CompleteUsingItemTask.h" -CompleteUsingItemTask::CompleteUsingItemTask(Tutorial *tutorial, int descriptionId, int itemIds[], unsigned int itemIdsLength, bool enablePreCompletion) - : TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL) -{ - m_iValidItemsA= new int [itemIdsLength]; - for(int i=0;i item) -{ - if(!hasBeenActivated() && !isPreCompletionEnabled()) return; - for(int i=0;iid == m_iValidItemsA[i] ) - { - bIsCompleted = true; - break; - } - } +void CompleteUsingItemTask::completeUsingItem( + std::shared_ptr item) { + if (!hasBeenActivated() && !isPreCompletionEnabled()) return; + for (int i = 0; i < m_iValidItemsCount; i++) { + if (item->id == m_iValidItemsA[i]) { + bIsCompleted = true; + break; + } + } } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/CompleteUsingItemTask.h b/Minecraft.Client/Platform/Common/Tutorial/CompleteUsingItemTask.h index 8cc5dbff2..5a86c69f2 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/CompleteUsingItemTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/CompleteUsingItemTask.h @@ -1,20 +1,21 @@ #pragma once -//using namespace std; +// using namespace std; #include "TutorialTask.h" class Level; -class CompleteUsingItemTask : public TutorialTask -{ +class CompleteUsingItemTask : public TutorialTask { private: - int *m_iValidItemsA; - int m_iValidItemsCount; - bool completed; + int* m_iValidItemsA; + int m_iValidItemsCount; + bool completed; public: - CompleteUsingItemTask(Tutorial *tutorial, int descriptionId, int itemIds[], unsigned int itemIdsLength, bool enablePreCompletion = false); - virtual ~CompleteUsingItemTask(); - virtual bool isCompleted(); - virtual void completeUsingItem(std::shared_ptr item); + CompleteUsingItemTask(Tutorial* tutorial, int descriptionId, int itemIds[], + unsigned int itemIdsLength, + bool enablePreCompletion = false); + virtual ~CompleteUsingItemTask(); + virtual bool isCompleted(); + virtual void completeUsingItem(std::shared_ptr item); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/ControllerTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/ControllerTask.cpp index 0e0c9b355..02c1a3eb3 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/ControllerTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/ControllerTask.cpp @@ -7,58 +7,55 @@ #include "TutorialConstraints.h" #include "ControllerTask.h" -ControllerTask::ControllerTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, bool showMinimumTime, - int mappings[], unsigned int mappingsLength, int iCompletionMaskA[], int iCompletionMaskACount, int iSouthpawMappings[], unsigned int uiSouthpawMappingsCount) - : TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL, showMinimumTime ) -{ - for(unsigned int i = 0; i < mappingsLength; ++i) - { - constraints.push_back( new InputConstraint( mappings[i] ) ); - completedMappings[mappings[i]] = false; - } - if(uiSouthpawMappingsCount > 0 ) m_bHasSouthpaw = true; - for(unsigned int i = 0; i < uiSouthpawMappingsCount; ++i) - { - southpawCompletedMappings[iSouthpawMappings[i]] = false; - } +ControllerTask::ControllerTask(Tutorial* tutorial, int descriptionId, + bool enablePreCompletion, bool showMinimumTime, + int mappings[], unsigned int mappingsLength, + int iCompletionMaskA[], + int iCompletionMaskACount, + int iSouthpawMappings[], + unsigned int uiSouthpawMappingsCount) + : TutorialTask(tutorial, descriptionId, enablePreCompletion, NULL, + showMinimumTime) { + for (unsigned int i = 0; i < mappingsLength; ++i) { + constraints.push_back(new InputConstraint(mappings[i])); + completedMappings[mappings[i]] = false; + } + if (uiSouthpawMappingsCount > 0) m_bHasSouthpaw = true; + for (unsigned int i = 0; i < uiSouthpawMappingsCount; ++i) { + southpawCompletedMappings[iSouthpawMappings[i]] = false; + } - m_iCompletionMaskA= new int [iCompletionMaskACount]; - for(int i=0;iplayer->yRot; + m_lastYaw = pMinecraft->player->yRot; m_lastPitch = pMinecraft->player->xRot; m_initialized = true; } else { - float deltaYaw = fabs(pMinecraft->player->yRot - m_lastYaw); + float deltaYaw = fabs(pMinecraft->player->yRot - m_lastYaw); float deltaPitch = fabs(pMinecraft->player->xRot - m_lastPitch); - m_lastYaw = pMinecraft->player->yRot; + m_lastYaw = pMinecraft->player->yRot; m_lastPitch = pMinecraft->player->xRot; const float LOOK_THRESHOLD = 0.1f; @@ -70,10 +67,13 @@ bool ControllerTask::isCompleted() bool bAllComplete = true; int iCurrent = 0; - if (m_bHasSouthpaw && app.GetGameSettings(pMinecraft->player->GetXboxPad(), eGameSetting_ControlSouthPaw)) { - for (auto it = southpawCompletedMappings.begin(); it != southpawCompletedMappings.end(); ++it) { + if (m_bHasSouthpaw && app.GetGameSettings(pMinecraft->player->GetXboxPad(), + eGameSetting_ControlSouthPaw)) { + for (auto it = southpawCompletedMappings.begin(); + it != southpawCompletedMappings.end(); ++it) { if (!it->second) { - if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), it->first) > 0) { + if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), + it->first) > 0) { it->second = true; m_uiCompletionMask |= 1 << iCurrent; } else { @@ -83,9 +83,11 @@ bool ControllerTask::isCompleted() iCurrent++; } } else { - for (auto it = completedMappings.begin(); it != completedMappings.end(); ++it) { + for (auto it = completedMappings.begin(); it != completedMappings.end(); + ++it) { if (!it->second) { - if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), it->first) > 0) { + if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), + it->first) > 0) { it->second = true; m_uiCompletionMask |= 1 << iCurrent; } else { @@ -105,17 +107,14 @@ bool ControllerTask::isCompleted() return bIsCompleted; } -bool ControllerTask::CompletionMaskIsValid() -{ - for(int i=0;i completedMappings; - std::unordered_map southpawCompletedMappings; - bool m_bHasSouthpaw; - unsigned int m_uiCompletionMask; - int *m_iCompletionMaskA; - int m_iCompletionMaskACount; - bool CompletionMaskIsValid(); + std::unordered_map completedMappings; + std::unordered_map southpawCompletedMappings; + bool m_bHasSouthpaw; + unsigned int m_uiCompletionMask; + int* m_iCompletionMaskA; + int m_iCompletionMaskACount; + bool CompletionMaskIsValid(); + + // Mouse tracking for tutorial look-around task + float m_lastYaw; + float m_lastPitch; + bool m_initialized = false; - // Mouse tracking for tutorial look-around task - float m_lastYaw; - float m_lastPitch; - bool m_initialized = false; public: - ControllerTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, bool showMinimumTime, - int mappings[], unsigned int mappingsLength, int iCompletionMaskA[]=NULL, int iCompletionMaskACount=0, int iSouthpawMappings[]=NULL, unsigned int uiSouthpawMappingsCount=0); - ~ControllerTask(); - virtual bool isCompleted(); - virtual void setAsCurrentTask(bool active = true); - + ControllerTask(Tutorial* tutorial, int descriptionId, + bool enablePreCompletion, bool showMinimumTime, + int mappings[], unsigned int mappingsLength, + int iCompletionMaskA[] = NULL, int iCompletionMaskACount = 0, + int iSouthpawMappings[] = NULL, + unsigned int uiSouthpawMappingsCount = 0); + ~ControllerTask(); + virtual bool isCompleted(); + virtual void setAsCurrentTask(bool active = true); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/CraftTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/CraftTask.cpp index 037d41c9e..59d3f9597 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/CraftTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/CraftTask.cpp @@ -2,65 +2,64 @@ #include "CraftTask.h" #include "../../Minecraft.World/Headers/net.minecraft.world.item.h" -CraftTask::CraftTask( int itemId, int auxValue, int quantity, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, std::vector *inConstraints /*= NULL*/, - bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/ ) - : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), - m_quantity( quantity ), - m_count( 0 ) -{ - m_numItems = 1; - m_items = new int[1]; - m_items[0] = itemId; - m_auxValues = new int[1]; - m_auxValues[0] = auxValue; +CraftTask::CraftTask(int itemId, int auxValue, int quantity, Tutorial* tutorial, + int descriptionId, bool enablePreCompletion /*= true*/, + std::vector* inConstraints /*= NULL*/, + bool bShowMinimumTime /*=false*/, + bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/) + : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, + bShowMinimumTime, bAllowFade, m_bTaskReminders), + m_quantity(quantity), + m_count(0) { + m_numItems = 1; + m_items = new int[1]; + m_items[0] = itemId; + m_auxValues = new int[1]; + m_auxValues[0] = auxValue; } -CraftTask::CraftTask( int *items, int *auxValues, int numItems, int quantity, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, std::vector *inConstraints /*= NULL*/, - bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/ ) - : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), - m_quantity( quantity ), - m_count( 0 ) -{ - m_numItems = numItems; - m_items = new int[m_numItems]; - m_auxValues = new int[m_numItems]; +CraftTask::CraftTask(int* items, int* auxValues, int numItems, int quantity, + Tutorial* tutorial, int descriptionId, + bool enablePreCompletion /*= true*/, + std::vector* inConstraints /*= NULL*/, + bool bShowMinimumTime /*=false*/, + bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/) + : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, + bShowMinimumTime, bAllowFade, m_bTaskReminders), + m_quantity(quantity), + m_count(0) { + m_numItems = numItems; + m_items = new int[m_numItems]; + m_auxValues = new int[m_numItems]; - for(int i = 0; i < m_numItems; ++i) - { - m_items[i] = items[i]; - m_auxValues[i] = auxValues[i]; - } + for (int i = 0; i < m_numItems; ++i) { + m_items[i] = items[i]; + m_auxValues[i] = auxValues[i]; + } } -CraftTask::~CraftTask() -{ - delete[] m_items; - delete[] m_auxValues; +CraftTask::~CraftTask() { + delete[] m_items; + delete[] m_auxValues; } -void CraftTask::onCrafted(std::shared_ptr item) -{ +void CraftTask::onCrafted(std::shared_ptr item) { #ifndef _CONTENT_PACKAGE - wprintf(L"CraftTask::onCrafted - %ls\n", item->toString().c_str() ); + wprintf(L"CraftTask::onCrafted - %ls\n", item->toString().c_str()); #endif - bool itemFound = false; - for(int i = 0; i < m_numItems; ++i) - { - if(m_items[i] == item->id && (m_auxValues[i] == -1 || m_auxValues[i] == item->getAuxValue())) - { - itemFound = true; - break; - } - } + bool itemFound = false; + for (int i = 0; i < m_numItems; ++i) { + if (m_items[i] == item->id && + (m_auxValues[i] == -1 || m_auxValues[i] == item->getAuxValue())) { + itemFound = true; + break; + } + } - if(itemFound) - { - ++m_count; - } - if( m_count >= m_quantity) - { - bIsCompleted = true; - } + if (itemFound) { + ++m_count; + } + if (m_count >= m_quantity) { + bIsCompleted = true; + } } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/CraftTask.h b/Minecraft.Client/Platform/Common/Tutorial/CraftTask.h index 1a26b9264..20f4f16b8 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/CraftTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/CraftTask.h @@ -1,25 +1,29 @@ #pragma once #include "TutorialTask.h" -class CraftTask : public TutorialTask -{ +class CraftTask : public TutorialTask { public: - CraftTask( int itemId, int auxValue, int quantity, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, std::vector *inConstraints = NULL, - bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ); - CraftTask( int *items, int *auxValues, int numItems, int quantity, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, std::vector *inConstraints = NULL, - bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ); + CraftTask(int itemId, int auxValue, int quantity, Tutorial* tutorial, + int descriptionId, bool enablePreCompletion = true, + std::vector* inConstraints = NULL, + bool bShowMinimumTime = false, bool bAllowFade = true, + bool m_bTaskReminders = true); + CraftTask(int* items, int* auxValues, int numItems, int quantity, + Tutorial* tutorial, int descriptionId, + bool enablePreCompletion = true, + std::vector* inConstraints = NULL, + bool bShowMinimumTime = false, bool bAllowFade = true, + bool m_bTaskReminders = true); - ~CraftTask(); + ~CraftTask(); - virtual bool isCompleted() { return bIsCompleted; } - virtual void onCrafted(std::shared_ptr item); + virtual bool isCompleted() { return bIsCompleted; } + virtual void onCrafted(std::shared_ptr item); private: - int *m_items; - int *m_auxValues; - int m_numItems; - int m_quantity; - int m_count; + int* m_items; + int* m_auxValues; + int m_numItems; + int m_quantity; + int m_count; }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/DiggerItemHint.cpp b/Minecraft.Client/Platform/Common/Tutorial/DiggerItemHint.cpp index f448ae741..d28b027a9 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/DiggerItemHint.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/DiggerItemHint.cpp @@ -6,71 +6,59 @@ #include "Tutorial.h" #include "DiggerItemHint.h" +DiggerItemHint::DiggerItemHint(eTutorial_Hint id, Tutorial* tutorial, + int descriptionId, int items[], + unsigned int itemsLength) + : TutorialHint(id, tutorial, descriptionId, e_Hint_DiggerItem) { + m_iItemsCount = itemsLength; -DiggerItemHint::DiggerItemHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, int items[], unsigned int itemsLength) - : TutorialHint(id, tutorial, descriptionId, e_Hint_DiggerItem) -{ - m_iItemsCount = itemsLength; - - m_iItems= new int [m_iItemsCount]; - for(unsigned int i=0;iaddMessage(IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL, true); + m_iItems = new int[m_iItemsCount]; + for (unsigned int i = 0; i < m_iItemsCount; i++) { + m_iItems[i] = items[i]; + } + tutorial->addMessage(IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL, true); } -int DiggerItemHint::startDestroyBlock(std::shared_ptr item, Tile *tile) -{ - if(item != NULL) - { - bool itemFound = false; - for(unsigned int i=0;iid == m_iItems[i]) - { - itemFound = true; - break; - } - } - if(itemFound) - { - float speed = item->getDestroySpeed(tile); - if(speed == 1) - { - // Display hint - return m_descriptionId; - } - } - } - return -1; +int DiggerItemHint::startDestroyBlock(std::shared_ptr item, + Tile* tile) { + if (item != NULL) { + bool itemFound = false; + for (unsigned int i = 0; i < m_iItemsCount; i++) { + if (item->id == m_iItems[i]) { + itemFound = true; + break; + } + } + if (itemFound) { + float speed = item->getDestroySpeed(tile); + if (speed == 1) { + // Display hint + return m_descriptionId; + } + } + } + return -1; } -int DiggerItemHint::attack(std::shared_ptr item, std::shared_ptr entity) -{ - if(item != NULL) - { - bool itemFound = false; - for(unsigned int i=0;iid == m_iItems[i]) - { - itemFound = true; - break; - } - } - if(itemFound) - { - // It's also possible that we could hit TileEntities (eg falling sand) so don't want to give this hint then - if( std::dynamic_pointer_cast( entity ) != NULL ) - { - return IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL; - } - else - { - return -1; - } - } - } - return -1; +int DiggerItemHint::attack(std::shared_ptr item, + std::shared_ptr entity) { + if (item != NULL) { + bool itemFound = false; + for (unsigned int i = 0; i < m_iItemsCount; i++) { + if (item->id == m_iItems[i]) { + itemFound = true; + break; + } + } + if (itemFound) { + // It's also possible that we could hit TileEntities (eg falling + // sand) so don't want to give this hint then + if (entity->instanceof(eTYPE_MOB)) { + return IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL; + } else { + return -1; + } + } + } + return -1; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/DiggerItemHint.h b/Minecraft.Client/Platform/Common/Tutorial/DiggerItemHint.h index b23a8be3d..11f3109ea 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/DiggerItemHint.h +++ b/Minecraft.Client/Platform/Common/Tutorial/DiggerItemHint.h @@ -5,14 +5,16 @@ class DiggerItem; class Level; -class DiggerItemHint : public TutorialHint -{ +class DiggerItemHint : public TutorialHint { private: - int *m_iItems; - unsigned int m_iItemsCount; + int* m_iItems; + unsigned int m_iItemsCount; public: - DiggerItemHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, int items[], unsigned int itemsLength); - virtual int startDestroyBlock(std::shared_ptr item, Tile *tile); - virtual int attack(std::shared_ptr item, std::shared_ptr entity); + DiggerItemHint(eTutorial_Hint id, Tutorial* tutorial, int descriptionId, + int items[], unsigned int itemsLength); + virtual int startDestroyBlock(std::shared_ptr item, + Tile* tile); + virtual int attack(std::shared_ptr item, + std::shared_ptr entity); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/EffectChangedTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/EffectChangedTask.cpp index c81ce0c7f..6a36d34b3 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/EffectChangedTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/EffectChangedTask.cpp @@ -2,30 +2,26 @@ #include "../../Minecraft.World/Headers/net.minecraft.world.effect.h" #include "EffectChangedTask.h" -EffectChangedTask::EffectChangedTask(Tutorial *tutorial, int descriptionId, MobEffect *effect, bool apply, - bool enablePreCompletion, bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders ) - : TutorialTask(tutorial,descriptionId,enablePreCompletion,NULL,bShowMinimumTime,bAllowFade,bTaskReminders) -{ - m_effect = effect; - m_apply = apply; +EffectChangedTask::EffectChangedTask(Tutorial* tutorial, int descriptionId, + MobEffect* effect, bool apply, + bool enablePreCompletion, + bool bShowMinimumTime, bool bAllowFade, + bool bTaskReminders) + : TutorialTask(tutorial, descriptionId, enablePreCompletion, NULL, + bShowMinimumTime, bAllowFade, bTaskReminders) { + m_effect = effect; + m_apply = apply; } -bool EffectChangedTask::isCompleted() -{ - return bIsCompleted; -} +bool EffectChangedTask::isCompleted() { return bIsCompleted; } -void EffectChangedTask::onEffectChanged(MobEffect *effect, bool bRemoved /*=false*/) -{ - if(effect == m_effect) - { - if(m_apply == !bRemoved) - { - bIsCompleted = true; - } - else - { - bIsCompleted = false; - } - } +void EffectChangedTask::onEffectChanged(MobEffect* effect, + bool bRemoved /*=false*/) { + if (effect == m_effect) { + if (m_apply == !bRemoved) { + bIsCompleted = true; + } else { + bIsCompleted = false; + } + } } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/EffectChangedTask.h b/Minecraft.Client/Platform/Common/Tutorial/EffectChangedTask.h index 796653200..00bca0eb1 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/EffectChangedTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/EffectChangedTask.h @@ -1,19 +1,20 @@ #pragma once -//using namespace std; +// using namespace std; #include "TutorialTask.h" class MobEffect; -class EffectChangedTask : public TutorialTask -{ +class EffectChangedTask : public TutorialTask { private: - MobEffect *m_effect; - bool m_apply; + MobEffect* m_effect; + bool m_apply; public: - EffectChangedTask(Tutorial *tutorial, int descriptionId, MobEffect *effect, bool apply = true, - bool enablePreCompletion = true, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); - virtual bool isCompleted(); - virtual void onEffectChanged(MobEffect *effect, bool bRemoved=false); + EffectChangedTask(Tutorial* tutorial, int descriptionId, MobEffect* effect, + bool apply = true, bool enablePreCompletion = true, + bool bShowMinimumTime = false, bool bAllowFade = true, + bool bTaskReminders = true); + virtual bool isCompleted(); + virtual void onEffectChanged(MobEffect* effect, bool bRemoved = false); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/FullTutorial.cpp b/Minecraft.Client/Platform/Common/Tutorial/FullTutorial.cpp index e24d7245a..85c54405b 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/FullTutorial.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/FullTutorial.cpp @@ -12,642 +12,1302 @@ #include "TutorialConstraints.h" FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) - : Tutorial(iPad, true) -{ - m_isTrial = isTrial; - m_freezeTime = true; - m_progressFlags = 0; + : Tutorial(iPad, true) { + m_isTrial = isTrial; + m_freezeTime = true; + m_progressFlags = 0; - for(unsigned int i = 0; i < e_Tutorial_State_Max; ++i) - { - m_completedStates[i] = false; - } + for (unsigned int i = 0; i < e_Tutorial_State_Max; ++i) { + m_completedStates[i] = false; + } - addMessage(IDS_TUTORIAL_COMPLETED); + addMessage(IDS_TUTORIAL_COMPLETED); - /* - * - * - * GAMEPLAY - * - */ - // START OF BASIC TUTORIAL - if( m_isTrial ) - { - addTask(e_Tutorial_State_Gameplay, new ChoiceTask(this, IDS_TUTORIAL_TASK_OVERVIEW, IDS_TUTORIAL_PROMPT_START_TUTORIAL, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Jump_To_Last_Task, eTelemetryTutorial_TrialStart) ); - } - else - { + /* + * + * + * GAMEPLAY + * + */ + // START OF BASIC TUTORIAL + if (m_isTrial) { + addTask(e_Tutorial_State_Gameplay, + new ChoiceTask(this, IDS_TUTORIAL_TASK_OVERVIEW, + IDS_TUTORIAL_PROMPT_START_TUTORIAL, true, + ACTION_MENU_A, ACTION_MENU_B, + e_Tutorial_Completion_Jump_To_Last_Task, + eTelemetryTutorial_TrialStart)); + } else { #ifdef _XBOX - if(getCompleted(eTutorial_Telemetry_Halfway) && !isStateCompleted(e_Tutorial_State_Redstone_And_Piston) ) - { - addTask(e_Tutorial_State_Gameplay, new ChoiceTask(this, IDS_TUTORIAL_NEW_FEATURES_CHOICE, IDS_TUTORIAL_PROMPT_NEW_FEATURES_CHOICE, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Jump_To_Last_Task, eTelemetryTutorial_TrialStart) ); - } + if (getCompleted(eTutorial_Telemetry_Halfway) && + !isStateCompleted(e_Tutorial_State_Redstone_And_Piston)) { + addTask(e_Tutorial_State_Gameplay, + new ChoiceTask(this, IDS_TUTORIAL_NEW_FEATURES_CHOICE, + IDS_TUTORIAL_PROMPT_NEW_FEATURES_CHOICE, + true, ACTION_MENU_A, ACTION_MENU_B, + e_Tutorial_Completion_Jump_To_Last_Task, + eTelemetryTutorial_TrialStart)); + } - addTask(e_Tutorial_State_Gameplay, new InfoTask(this, IDS_TUTORIAL_TASK_OVERVIEW, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); + addTask(e_Tutorial_State_Gameplay, + new InfoTask(this, IDS_TUTORIAL_TASK_OVERVIEW, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); #else - if(getCompleted(eTutorial_Telemetry_Halfway)) - { - addTask(e_Tutorial_State_Gameplay, new ChoiceTask(this, IDS_TUTORIAL_TASK_OVERVIEW, IDS_TUTORIAL_PROMPT_START_TUTORIAL, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Jump_To_Last_Task, eTelemetryTutorial_TrialStart) ); - } - else - { - addTask(e_Tutorial_State_Gameplay, new InfoTask(this, IDS_TUTORIAL_TASK_OVERVIEW, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - } + if (getCompleted(eTutorial_Telemetry_Halfway)) { + addTask(e_Tutorial_State_Gameplay, + new ChoiceTask(this, IDS_TUTORIAL_TASK_OVERVIEW, + IDS_TUTORIAL_PROMPT_START_TUTORIAL, true, + ACTION_MENU_A, ACTION_MENU_B, + e_Tutorial_Completion_Jump_To_Last_Task, + eTelemetryTutorial_TrialStart)); + } else { + addTask(e_Tutorial_State_Gameplay, + new InfoTask(this, IDS_TUTORIAL_TASK_OVERVIEW, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } #endif - } - - int lookMappings[] = {MINECRAFT_ACTION_LOOK_UP, MINECRAFT_ACTION_LOOK_DOWN, MINECRAFT_ACTION_LOOK_LEFT, MINECRAFT_ACTION_LOOK_RIGHT}; - int moveMappings[] = {MINECRAFT_ACTION_FORWARD, MINECRAFT_ACTION_BACKWARD, MINECRAFT_ACTION_LEFT, MINECRAFT_ACTION_RIGHT}; - int iLookCompletionMaskA[]= { 10, // 1010 - 9, // 1001 - 6, // 0110 - 5 // 0101 - }; - addTask(e_Tutorial_State_Gameplay, new ControllerTask( this, IDS_TUTORIAL_TASK_LOOK, false, false, lookMappings, 4, iLookCompletionMaskA, 4, moveMappings, 4) ); - - addTask(e_Tutorial_State_Gameplay, new ControllerTask( this, IDS_TUTORIAL_TASK_MOVE, false, false, moveMappings, 4, iLookCompletionMaskA, 4, lookMappings, 4) ); - - addTask(e_Tutorial_State_Gameplay, new InfoTask(this, IDS_TUTORIAL_TASK_SPRINT, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - - int jumpMappings[] = {MINECRAFT_ACTION_JUMP}; - addTask(e_Tutorial_State_Gameplay, new ControllerTask( this, IDS_TUTORIAL_TASK_JUMP, false, true, jumpMappings, 1) ); - - int mineMappings[] = {MINECRAFT_ACTION_ACTION}; - addTask(e_Tutorial_State_Gameplay, new ControllerTask( this, IDS_TUTORIAL_TASK_MINE, false, true, mineMappings, 1) ); - addTask(e_Tutorial_State_Gameplay, new PickupTask( Tile::treeTrunk_Id, 4, -1, this, IDS_TUTORIAL_TASK_CHOP_WOOD ) ); - - int scrollMappings[] = {MINECRAFT_ACTION_LEFT_SCROLL,MINECRAFT_ACTION_RIGHT_SCROLL}; - //int scrollMappings[] = {ACTION_MENU_LEFT_SCROLL,ACTION_MENU_RIGHT_SCROLL}; - int iScrollCompletionMaskA[]= { 2, // 10 - 1};// 01 - addTask(e_Tutorial_State_Gameplay, new ControllerTask( this, IDS_TUTORIAL_TASK_SCROLL, false, false, scrollMappings, 2,iScrollCompletionMaskA,2) ); - - int invMappings[] = {MINECRAFT_ACTION_INVENTORY}; - addTask(e_Tutorial_State_Gameplay, new ControllerTask( this, IDS_TUTORIAL_TASK_INVENTORY, false, false, invMappings, 1) ); - addTask(e_Tutorial_State_Gameplay, new StateChangeTask( e_Tutorial_State_Inventory_Menu, this) ); - - addTask(e_Tutorial_State_Gameplay, new InfoTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_DEPLETE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Gameplay, new InfoTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_HEAL, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Gameplay, new InfoTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_FEED, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - - // While they should only eat the item we give them, includ the ability to complete this task with different items - int foodItems[] = {Item::mushroomStew_Id, Item::apple_Id, Item::bread_Id, Item::porkChop_raw_Id, Item::porkChop_cooked_Id, - Item::apple_gold_Id, Item::fish_raw_Id, Item::fish_cooked_Id, Item::cookie_Id, Item::beef_cooked_Id, - Item::beef_raw_Id, Item::chicken_cooked_Id, Item::chicken_raw_Id, Item::melon_Id, Item::rotten_flesh_Id}; - addTask(e_Tutorial_State_Gameplay, new CompleteUsingItemTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_EAT_STEAK, foodItems, 15, true) ); - - int crftMappings[] = {MINECRAFT_ACTION_CRAFTING}; - addTask(e_Tutorial_State_Gameplay, new ControllerTask( this, IDS_TUTORIAL_TASK_CRAFTING, false, false, crftMappings, 1) ); - - addTask(e_Tutorial_State_Gameplay, new ProgressFlagTask( &m_progressFlags, FULL_TUTORIAL_PROGRESS_2_X_2_Crafting, ProgressFlagTask::e_Progress_Set_Flag, this ) ); - addTask(e_Tutorial_State_Gameplay, new StateChangeTask( e_Tutorial_State_2x2Crafting_Menu, this) ); - - addTask(e_Tutorial_State_Gameplay, new CraftTask( Tile::wood_Id, -1, 1, this, IDS_TUTORIAL_TASK_CREATE_PLANKS) ); - addTask(e_Tutorial_State_Gameplay, new CraftTask( Tile::workBench_Id, -1, 1, this, IDS_TUTORIAL_TASK_CREATE_CRAFTING_TABLE) ); - - //int useMappings[] = {MINECRAFT_ACTION_USE}; - //addTask(e_Tutorial_State_Gameplay, new ControllerTask( this, IDS_TUTORIAL_TASK_USE, false, false, useMappings, 1) ); - addTask(e_Tutorial_State_Gameplay, new InfoTask(this, IDS_TUTORIAL_TASK_USE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Gameplay, new UseItemTask( Tile::workBench_Id, this, IDS_TUTORIAL_TASK_PLACE_WORKBENCH, true ) ); - - addTask(e_Tutorial_State_Gameplay, new InfoTask(this, IDS_TUTORIAL_TASK_NIGHT_DANGER, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Gameplay, new InfoTask(this, IDS_TUTORIAL_TASK_NEARBY_SHELTER, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Gameplay, new InfoTask(this, IDS_TUTORIAL_TASK_COLLECT_RESOURCES, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - - // END OF BASIC TUTORIAL - - addTask(e_Tutorial_State_Gameplay, new ChoiceTask(this, IDS_TUTORIAL_TASK_BASIC_COMPLETE, IDS_TUTORIAL_PROMPT_BASIC_COMPLETE, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Jump_To_Last_Task, eTelemetryTutorial_Halfway) ); - - // START OF FULL TUTORIAL - - addTask(e_Tutorial_State_Gameplay, new UseTileTask( Tile::workBench_Id, this, IDS_TUTORIAL_TASK_OPEN_WORKBENCH, false ) ); - - addTask(e_Tutorial_State_Gameplay, new ProgressFlagTask( &m_progressFlags, FULL_TUTORIAL_PROGRESS_3_X_3_Crafting, ProgressFlagTask::e_Progress_Set_Flag, this ) ); - addTask(e_Tutorial_State_Gameplay, new StateChangeTask( e_Tutorial_State_3x3Crafting_Menu, this) ); - - addTask(e_Tutorial_State_Gameplay, new CraftTask( Item::stick->id, -1, 1, this, IDS_TUTORIAL_TASK_CREATE_STICKS) ); - - int shovelItems[] = {Item::shovel_wood->id, Item::shovel_stone->id, Item::shovel_iron->id, Item::shovel_gold->id, Item::shovel_diamond->id}; - int shovelAuxVals[] = {-1,-1,-1,-1,-1}; - addTask(e_Tutorial_State_Gameplay, new CraftTask( shovelItems, shovelAuxVals, 5, 1, this, IDS_TUTORIAL_TASK_CREATE_WOODEN_SHOVEL) ); - - int hatchetItems[] = {Item::hatchet_wood->id, Item::hatchet_stone->id, Item::hatchet_iron->id, Item::hatchet_gold->id, Item::hatchet_diamond->id}; - int hatchetAuxVals[] = {-1,-1,-1,-1,-1}; - addTask(e_Tutorial_State_Gameplay, new CraftTask( hatchetItems, hatchetAuxVals, 5, 1, this, IDS_TUTORIAL_TASK_CREATE_WOODEN_HATCHET) ); - - int pickaxeItems[] = {Item::pickAxe_wood->id, Item::pickAxe_stone->id, Item::pickAxe_iron->id, Item::pickAxe_gold->id, Item::pickAxe_diamond->id}; - int pickaxeAuxVals[] = {-1,-1,-1,-1,-1}; - addTask(e_Tutorial_State_Gameplay, new CraftTask( pickaxeItems, pickaxeAuxVals, 5, 1, this, IDS_TUTORIAL_TASK_CREATE_WOODEN_PICKAXE) ); - - addTask(e_Tutorial_State_Gameplay, new PickupTask( Tile::stoneBrick_Id, 8, -1, this, IDS_TUTORIAL_TASK_MINE_STONE ) ); - - addTask(e_Tutorial_State_Gameplay, new ProgressFlagTask( &m_progressFlags, FULL_TUTORIAL_PROGRESS_CRAFT_FURNACE, ProgressFlagTask::e_Progress_Set_Flag, this ) ); - addTask(e_Tutorial_State_Gameplay, new CraftTask( Tile::furnace_Id, -1, 1, this, IDS_TUTORIAL_TASK_CREATE_FURNACE ) ); - addTask(e_Tutorial_State_Gameplay, new UseTileTask(Tile::furnace_Id, this, IDS_TUTORIAL_TASK_PLACE_AND_OPEN_FURNACE) ); - - addTask(e_Tutorial_State_Gameplay, new ProgressFlagTask( &m_progressFlags, FULL_TUTORIAL_PROGRESS_USE_FURNACE, ProgressFlagTask::e_Progress_Set_Flag, this ) ); - addTask(e_Tutorial_State_Gameplay, new StateChangeTask( e_Tutorial_State_Furnace_Menu, this) ); - addTask(e_Tutorial_State_Gameplay, new CraftTask( Item::coal->id, -1, 1, this, IDS_TUTORIAL_TASK_CREATE_CHARCOAL) ); - addTask(e_Tutorial_State_Gameplay, new CraftTask( Tile::glass_Id, -1, 1, this, IDS_TUTORIAL_TASK_CREATE_GLASS) ); - addTask(e_Tutorial_State_Gameplay, new CraftTask( Item::door_wood->id, -1, 1, this, IDS_TUTORIAL_TASK_CREATE_WOODEN_DOOR) ); - addTask(e_Tutorial_State_Gameplay, new UseItemTask(Item::door_wood->id, this, IDS_TUTORIAL_TASK_PLACE_DOOR) ); - addTask(e_Tutorial_State_Gameplay, new CraftTask( Tile::torch_Id, -1, 1, this, IDS_TUTORIAL_TASK_CREATE_TORCH) ); - - if(app.getGameRuleDefinitions() != NULL) - { - AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"tutorialArea"); - if(area != NULL) - { - std::vector *areaConstraints = new std::vector(); - areaConstraints->push_back( new AreaConstraint( IDS_TUTORIAL_CONSTRAINT_TUTORIAL_AREA, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); - addTask(e_Tutorial_State_Gameplay, new AreaTask(e_Tutorial_State_Gameplay,this, areaConstraints) ); - } - } - - // This MUST be the last task in the e_Tutorial_State_Gameplay state. Some of the earlier tasks will skip to the last - // task when complete, and this is the one that we want the player to see. - ProcedureCompoundTask *finalTask = new ProcedureCompoundTask( this ); - finalTask->AddTask( new InfoTask(this, IDS_TUTORIAL_COMPLETED, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A, eTelemetryTutorial_Complete) ); - // 4J Stu - Remove this string as it refers to things that don't exist in the current tutorial world! - //finalTask->AddTask( new InfoTask(this, IDS_TUTORIAL_FEATURES_IN_THIS_AREA, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - finalTask->AddTask( new InfoTask(this, IDS_TUTORIAL_FEATURES_OUTSIDE_THIS_AREA, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - finalTask->AddTask( new InfoTask(this, IDS_TUTORIAL_COMPLETED_EXPLORE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Gameplay, finalTask); - // END OF FULL TUTORIAL - - - /* - * - * - * INVENTORY - * - */ - // Some tasks already added in the super class ctor - addTask(e_Tutorial_State_Inventory_Menu, new FullTutorialActiveTask( this, e_Tutorial_Completion_Complete_State) ); - addTask(e_Tutorial_State_Inventory_Menu, new InfoTask(this, IDS_TUTORIAL_TASK_INV_EXIT, -1, false, ACTION_MENU_B) ); - - /* - * - * - * CRAFTING - * - */ - // Some tasks already added in the super class ctor - - addTask(e_Tutorial_State_2x2Crafting_Menu, new FullTutorialActiveTask( this, e_Tutorial_Completion_Complete_State) ); - // To block progress - addTask(e_Tutorial_State_2x2Crafting_Menu, new ProgressFlagTask( &m_progressFlags, FULL_TUTORIAL_PROGRESS_2_X_2_Crafting, ProgressFlagTask::e_Progress_Flag_On, this ) ); - - addTask(e_Tutorial_State_2x2Crafting_Menu, new FullTutorialActiveTask( this, e_Tutorial_Completion_Complete_State) ); - - addTask(e_Tutorial_State_2x2Crafting_Menu, new CraftTask( Tile::wood_Id, -1, 1, this, IDS_TUTORIAL_TASK_CRAFT_CREATE_PLANKS) ); - - ProcedureCompoundTask *workbenchCompound = new ProcedureCompoundTask( this ); - workbenchCompound->AddTask( new XuiCraftingTask( this, IDS_TUTORIAL_TASK_CRAFT_SELECT_STRUCTURES, Recipy::eGroupType_Structure) ); - workbenchCompound->AddTask( new XuiCraftingTask( this, IDS_TUTORIAL_TASK_CRAFT_SELECT_CRAFTING_TABLE, Tile::workBench_Id) ); - workbenchCompound->AddTask( new CraftTask( Tile::workBench_Id, -1, 1, this, IDS_TUTORIAL_TASK_CREATE_CRAFTING_TABLE) ); - addTask(e_Tutorial_State_2x2Crafting_Menu, workbenchCompound ); - addTask(e_Tutorial_State_2x2Crafting_Menu, new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_EXIT_AND_PLACE_TABLE, -1, false, ACTION_MENU_B) ); - - // 3x3 Crafting - addTask(e_Tutorial_State_3x3Crafting_Menu, new FullTutorialActiveTask( this, e_Tutorial_Completion_Complete_State) ); - - addTask(e_Tutorial_State_3x3Crafting_Menu, new ProgressFlagTask( &m_progressFlags, FULL_TUTORIAL_PROGRESS_3_X_3_Crafting, ProgressFlagTask::e_Progress_Flag_On, this ) ); - - addTask(e_Tutorial_State_3x3Crafting_Menu, new CraftTask( Item::stick->id, -1, 1, this, IDS_TUTORIAL_TASK_CREATE_STICKS) ); - - ProcedureCompoundTask *shovelCompound = new ProcedureCompoundTask( this ); - shovelCompound->AddTask( new XuiCraftingTask( this, IDS_TUTORIAL_TASK_CRAFT_SELECT_TOOLS, Recipy::eGroupType_Tool) ); - shovelCompound->AddTask( new XuiCraftingTask( this, IDS_TUTORIAL_TASK_CRAFT_SELECT_WOODEN_SHOVEL, Item::shovel_wood->id) ); - shovelCompound->AddTask( new CraftTask( shovelItems, shovelAuxVals, 5, 1, this, IDS_TUTORIAL_TASK_CREATE_WOODEN_SHOVEL) ); - addTask(e_Tutorial_State_3x3Crafting_Menu, shovelCompound ); - addTask(e_Tutorial_State_3x3Crafting_Menu, new CraftTask( hatchetItems, hatchetAuxVals, 5, 1, this, IDS_TUTORIAL_TASK_CREATE_WOODEN_HATCHET) ); - addTask(e_Tutorial_State_3x3Crafting_Menu, new CraftTask( pickaxeItems, pickaxeAuxVals, 5, 1, this, IDS_TUTORIAL_TASK_CREATE_WOODEN_PICKAXE) ); - - addTask(e_Tutorial_State_3x3Crafting_Menu, new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_TOOLS_BUILT, -1, false, ACTION_MENU_B) ); - - // To block progress - addTask(e_Tutorial_State_3x3Crafting_Menu, new ProgressFlagTask( &m_progressFlags, FULL_TUTORIAL_PROGRESS_CRAFT_FURNACE, ProgressFlagTask::e_Progress_Flag_On, this ) ); - - addTask(e_Tutorial_State_3x3Crafting_Menu, new CraftTask( Tile::furnace_Id, -1, 1, this, IDS_TUTORIAL_TASK_CRAFT_CREATE_FURNACE) ); - addTask(e_Tutorial_State_3x3Crafting_Menu, new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_EXIT_AND_PLACE_FURNACE, -1, false, ACTION_MENU_B) ); - - // No need to block here, as it's fine if the player wants to do this out of order - addTask(e_Tutorial_State_3x3Crafting_Menu, new CraftTask( Item::door_wood->id, -1, 1, this, IDS_TUTORIAL_TASK_CREATE_WOODEN_DOOR) ); - addTask(e_Tutorial_State_3x3Crafting_Menu, new CraftTask( Tile::torch_Id, -1, 1, this, IDS_TUTORIAL_TASK_CREATE_TORCH) ); - - /* - * - * - * FURNACE - * - */ - // Some tasks already added in the super class ctor - - addTask(e_Tutorial_State_Furnace_Menu, new FullTutorialActiveTask( this, e_Tutorial_Completion_Complete_State) ); - - // Blocking - addTask(e_Tutorial_State_Furnace_Menu, new ProgressFlagTask( &m_progressFlags, FULL_TUTORIAL_PROGRESS_USE_FURNACE, ProgressFlagTask::e_Progress_Flag_On, this ) ); - - addTask(e_Tutorial_State_Furnace_Menu, new CraftTask( Item::coal->id, -1, 1, this, IDS_TUTORIAL_TASK_FURNACE_CREATE_CHARCOAL) ); - addTask(e_Tutorial_State_Furnace_Menu, new InfoTask(this, IDS_TUTORIAL_TASK_FURNACE_CHARCOAL_USES, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Furnace_Menu, new CraftTask( Tile::glass_Id, -1, 1, this, IDS_TUTORIAL_TASK_FURNACE_CREATE_GLASS) ); - - /* - * - * - * BREWING - * - */ - - // To block progress - addTask(e_Tutorial_State_Brewing_Menu, new ProgressFlagTask( &m_progressFlags, EXTENDED_TUTORIAL_PROGRESS_USE_BREWING_STAND, ProgressFlagTask::e_Progress_Flag_On, this ) ); - - int potionItems[] = {Item::potion_Id,Item::potion_Id,Item::potion_Id,Item::potion_Id,Item::potion_Id,Item::potion_Id,Item::potion_Id,Item::potion_Id}; - int potionAuxVals[] = { MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_FIRE_RESISTANCE), - MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_FIRE_RESISTANCE), - MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_FIRE_RESISTANCE), - MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_FIRE_RESISTANCE), - MACRO_MAKEPOTION_AUXVAL(0, MASK_EXTENDED, MASK_FIRE_RESISTANCE), - MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_EXTENDED, MASK_FIRE_RESISTANCE), - MACRO_MAKEPOTION_AUXVAL(0, MASK_EXTENDED, MASK_FIRE_RESISTANCE), - MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_EXTENDED, MASK_FIRE_RESISTANCE) - }; - addTask(e_Tutorial_State_Brewing_Menu, new CraftTask( potionItems, potionAuxVals, 8, 1, this, IDS_TUTORIAL_TASK_BREWING_MENU_CREATE_FIRE_POTION) ); - addTask(e_Tutorial_State_Brewing_Menu, new InfoTask(this, IDS_TUTORIAL_TASK_BREWING_MENU_EXIT, -1, false, ACTION_MENU_B) ); - - /* - * - * - * MINECART - * - */ - if(app.getGameRuleDefinitions() != NULL) - { - AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"minecartArea"); - if(area != NULL) - { - addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_Riding_Minecart, IDS_TUTORIAL_HINT_MINECART, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1 ) ); - } - } - - /* - * - * - * BOAT - * - */ - if(app.getGameRuleDefinitions() != NULL) - { - AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"boatArea"); - if(area != NULL) - { - addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_Riding_Boat, IDS_TUTORIAL_HINT_BOAT, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1 ) ); - } - } - - /* - * - * - * FISHING - * - */ - if(app.getGameRuleDefinitions() != NULL) - { - AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"fishingArea"); - if(area != NULL) - { - addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_Fishing, IDS_TUTORIAL_HINT_FISHING, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1 ) ); - } - } - - /* - * - * - * PISTON - SELF-REPAIRING BRIDGE - * - */ - if(app.getGameRuleDefinitions() != NULL) - { - AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"pistonBridgeArea"); - if(area != NULL) - { - addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_None, IDS_TUTORIAL_HINT_PISTON_SELF_REPAIRING_BRIDGE, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1, true ) ); - } - } - - /* - * - * - * PISTON - PISTON AND REDSTONE CIRCUITS - * - */ - if(app.getGameRuleDefinitions() != NULL) - { - AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"pistonArea"); - if(area != NULL) - { - eTutorial_State redstoneAndPistonStates[] = {e_Tutorial_State_Gameplay}; - AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Redstone_And_Piston, redstoneAndPistonStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); - - addTask(e_Tutorial_State_Redstone_And_Piston, new ChoiceTask(this, IDS_TUTORIAL_REDSTONE_OVERVIEW, IDS_TUTORIAL_PROMPT_REDSTONE_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Redstone_And_Pistons) ); - addTask(e_Tutorial_State_Redstone_And_Piston, new InfoTask(this, IDS_TUTORIAL_TASK_REDSTONE_POWER_SOURCES, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Redstone_And_Piston, new InfoTask(this, IDS_TUTORIAL_TASK_REDSTONE_TRIPWIRE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Redstone_And_Piston, new InfoTask(this, IDS_TUTORIAL_TASK_REDSTONE_POWER_SOURCES_POSITION, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Redstone_And_Piston, new InfoTask(this, IDS_TUTORIAL_TASK_REDSTONE_DUST, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Redstone_And_Piston, new InfoTask(this, IDS_TUTORIAL_TASK_REDSTONE_REPEATER, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Redstone_And_Piston, new InfoTask(this, IDS_TUTORIAL_TASK_PISTONS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Redstone_And_Piston, new InfoTask(this, IDS_TUTORIAL_TASK_TRY_IT, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - } - } - - /* - * - * - * PORTAL - * - */ - if(app.getGameRuleDefinitions() != NULL) - { - AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"portalArea"); - if(area != NULL) - { - eTutorial_State portalStates[] = {e_Tutorial_State_Gameplay}; - AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Portal, portalStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); - - addTask(e_Tutorial_State_Portal, new ChoiceTask(this, IDS_TUTORIAL_PORTAL_OVERVIEW, IDS_TUTORIAL_PROMPT_PORTAL_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Portal) ); - addTask(e_Tutorial_State_Portal, new InfoTask(this, IDS_TUTORIAL_TASK_BUILD_PORTAL, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Portal, new InfoTask(this, IDS_TUTORIAL_TASK_ACTIVATE_PORTAL, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Portal, new InfoTask(this, IDS_TUTORIAL_TASK_USE_PORTAL, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Portal, new InfoTask(this, IDS_TUTORIAL_TASK_NETHER, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Portal, new InfoTask(this, IDS_TUTORIAL_TASK_NETHER_FAST_TRAVEL, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - } - } - - /* - * - * - * CREATIVE - * - */ - if(app.getGameRuleDefinitions() != NULL) - { - AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"creativeArea"); - if(area != NULL) - { - eTutorial_State creativeStates[] = {e_Tutorial_State_Gameplay}; - AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_CreativeMode, creativeStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1,true,true,GameType::CREATIVE) ); - - addTask(e_Tutorial_State_CreativeMode, new ChoiceTask(this, IDS_TUTORIAL_CREATIVE_OVERVIEW, IDS_TUTORIAL_PROMPT_CREATIVE_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Jump_To_Last_Task, eTelemetryTutorial_CreativeMode) ); - addTask(e_Tutorial_State_CreativeMode, new InfoTask(this, IDS_TUTORIAL_TASK_CREATIVE_MODE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_CreativeMode, new InfoTask(this, IDS_TUTORIAL_TASK_FLY, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - - int crftMappings[] = {MINECRAFT_ACTION_CRAFTING}; - addTask(e_Tutorial_State_CreativeMode, new ControllerTask( this, IDS_TUTORIAL_TASK_OPEN_CREATIVE_INVENTORY, false, false, crftMappings, 1) ); - addTask(e_Tutorial_State_CreativeMode, new StateChangeTask( e_Tutorial_State_Creative_Inventory_Menu, this) ); - - // This last task ensures that the player is still in creative mode until they exit the area (but could skip the previous instructional stuff) - ProcedureCompoundTask *creativeFinalTask = new ProcedureCompoundTask( this ); - - AABB *exitArea = app.getGameRuleDefinitions()->getNamedArea(L"creativeExitArea"); - if(exitArea != NULL) - { - std::vector *creativeExitAreaConstraints = new std::vector(); - creativeExitAreaConstraints->push_back( new AreaConstraint( -1, exitArea->x0,exitArea->y0,exitArea->z0,exitArea->x1,exitArea->y1,exitArea->z1,true,false) ); - creativeFinalTask->AddTask( new AreaTask(e_Tutorial_State_CreativeMode, this, creativeExitAreaConstraints,IDS_TUTORIAL_TASK_CREATIVE_EXIT,AreaTask::eAreaTaskCompletion_CompleteOnConstraintsSatisfied) ); - } - - std::vector *creativeAreaConstraints = new std::vector(); - creativeAreaConstraints->push_back( new AreaConstraint( IDS_TUTORIAL_CONSTRAINT_TUTORIAL_AREA, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); - creativeFinalTask->AddTask( new AreaTask(e_Tutorial_State_CreativeMode, this, creativeAreaConstraints) ); - - creativeFinalTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CREATIVE_COMPLETE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - - addTask(e_Tutorial_State_CreativeMode,creativeFinalTask); - } - } - - /* - * - * - * BREWING - * - */ - if(app.getGameRuleDefinitions() != NULL) - { - AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"brewingArea"); - if(area != NULL) - { - eTutorial_State brewingStates[] = {e_Tutorial_State_Gameplay}; - AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Brewing, brewingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); - - addTask(e_Tutorial_State_Brewing, new ChoiceTask(this, IDS_TUTORIAL_TASK_BREWING_OVERVIEW, IDS_TUTORIAL_PROMPT_BREWING_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Brewing) ); - - ProcedureCompoundTask *fillWaterBottleTask = new ProcedureCompoundTask( this ); - fillWaterBottleTask->AddTask( new PickupTask( Item::glassBottle_Id, 1, -1, this, IDS_TUTORIAL_TASK_BREWING_GET_GLASS_BOTTLE ) ); - fillWaterBottleTask->AddTask( new PickupTask( Item::potion_Id, 1, 0, this, IDS_TUTORIAL_TASK_BREWING_FILL_GLASS_BOTTLE ) ); - addTask(e_Tutorial_State_Brewing, fillWaterBottleTask); - - addTask(e_Tutorial_State_Brewing, new InfoTask(this, IDS_TUTORIAL_TASK_BREWING_FILL_CAULDRON, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - - - addTask(e_Tutorial_State_Brewing, new ProgressFlagTask( &m_progressFlags, EXTENDED_TUTORIAL_PROGRESS_USE_BREWING_STAND, ProgressFlagTask::e_Progress_Set_Flag, this ) ); - addTask(e_Tutorial_State_Brewing, new CraftTask( potionItems, potionAuxVals, 8, 1, this, IDS_TUTORIAL_TASK_BREWING_CREATE_FIRE_POTION) ); - - addTask(e_Tutorial_State_Brewing, new InfoTask(this, IDS_TUTORIAL_TASK_BREWING_USE_POTION, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Brewing, new EffectChangedTask(this, IDS_TUTORIAL_TASK_BREWING_DRINK_FIRE_POTION, MobEffect::fireResistance) ); - addTask(e_Tutorial_State_Brewing, new InfoTask(this, IDS_TUTORIAL_TASK_BREWING_USE_EFFECTS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - } - } - - /* - * - * - * ENCHANTING - * - */ - if(app.getGameRuleDefinitions() != NULL) - { - AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"enchantingArea"); - if(area != NULL) - { - eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay}; - AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Enchanting, enchantingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); - - addTask(e_Tutorial_State_Enchanting, new ChoiceTask(this, IDS_TUTORIAL_TASK_ENCHANTING_OVERVIEW, IDS_TUTORIAL_PROMPT_ENCHANTING_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Enchanting) ); - - addTask(e_Tutorial_State_Enchanting, new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_SUMMARY, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Enchanting, new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_BOOKS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Enchanting, new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_BOOKCASES, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Enchanting, new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_EXPERIENCE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Enchanting, new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_BOTTLE_O_ENCHANTING, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Enchanting, new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_USE_CHESTS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - } - } - - /* - * - * - * ANVIL - * - */ - if(app.getGameRuleDefinitions() != NULL) - { - AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"anvilArea"); - if(area != NULL) - { - eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay}; - AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Anvil, enchantingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); - - addTask(e_Tutorial_State_Anvil, new ChoiceTask(this, IDS_TUTORIAL_TASK_ANVIL_OVERVIEW, IDS_TUTORIAL_PROMPT_ANVIL_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Anvil) ); - - addTask(e_Tutorial_State_Anvil, new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_SUMMARY, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Anvil, new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_ENCHANTED_BOOKS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Anvil, new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_COST, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Anvil, new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_COST2, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Anvil, new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_RENAMING, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Anvil, new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_USE_CHESTS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - } - } - - /* - * - * - * TRADING - * - */ - if(app.getGameRuleDefinitions() != NULL) - { - AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"tradingArea"); - if(area != NULL) - { - eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay}; - AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Trading, enchantingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); - - addTask(e_Tutorial_State_Trading, new ChoiceTask(this, IDS_TUTORIAL_TASK_TRADING_OVERVIEW, IDS_TUTORIAL_PROMPT_TRADING_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Trading) ); - - addTask(e_Tutorial_State_Trading, new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_SUMMARY, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Trading, new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_TRADES, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Trading, new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_INCREASE_TRADES, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Trading, new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_DECREASE_TRADES, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Trading, new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_USE_CHESTS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - } - } - - /* - * - * - * ENDERCHEST - * - */ - if(app.getGameRuleDefinitions() != NULL) - { - AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"enderchestArea"); - if(area != NULL) - { - eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay}; - AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Enderchests, enchantingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); - - addTask(e_Tutorial_State_Enderchests, new ChoiceTask(this, IDS_TUTORIAL_TASK_ENDERCHEST_OVERVIEW, IDS_TUTORIAL_PROMPT_ENDERCHEST_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Enderchest) ); - - addTask(e_Tutorial_State_Enderchests, new InfoTask(this, IDS_TUTORIAL_TASK_ENDERCHEST_SUMMARY, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Enderchests, new InfoTask(this, IDS_TUTORIAL_TASK_ENDERCHEST_PLAYERS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Enderchests, new InfoTask(this, IDS_TUTORIAL_TASK_ENDERCHEST_FUNCTION, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - } - } - - /* - * - * - * FARMING - * - */ - if(app.getGameRuleDefinitions() != NULL) - { - AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"farmingArea"); - if(area != NULL) - { - eTutorial_State farmingStates[] = {e_Tutorial_State_Gameplay}; - AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Farming, farmingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); - - addTask(e_Tutorial_State_Farming, new ChoiceTask(this, IDS_TUTORIAL_FARMING_OVERVIEW, IDS_TUTORIAL_PROMPT_FARMING_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Farming) ); - - addTask(e_Tutorial_State_Farming, new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_SEEDS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Farming, new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_FARMLAND, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Farming, new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_WHEAT, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Farming, new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_PUMPKIN_AND_MELON, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Farming, new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_CARROTS_AND_POTATOES, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Farming, new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_SUGARCANE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Farming, new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_CACTUS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Farming, new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_MUSHROOM, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Farming, new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_BONEMEAL, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Farming, new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_COMPLETE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - } - } - - /* - * - * - * BREEDING - * - */ - if(app.getGameRuleDefinitions() != NULL) - { - AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"breedingArea"); - if(area != NULL) - { - eTutorial_State breedingStates[] = {e_Tutorial_State_Gameplay}; - AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Breeding, breedingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); - - addTask(e_Tutorial_State_Breeding, new ChoiceTask(this, IDS_TUTORIAL_BREEDING_OVERVIEW, IDS_TUTORIAL_PROMPT_BREEDING_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Breeding) ); - - addTask(e_Tutorial_State_Breeding, new InfoTask(this, IDS_TUTORIAL_TASK_BREEDING_FEED, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Breeding, new InfoTask(this, IDS_TUTORIAL_TASK_BREEDING_FEED_FOOD, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Breeding, new InfoTask(this, IDS_TUTORIAL_TASK_BREEDING_BABY, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Breeding, new InfoTask(this, IDS_TUTORIAL_TASK_BREEDING_DELAY, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Breeding, new InfoTask(this, IDS_TUTORIAL_TASK_BREEDING_FOLLOW, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Breeding, new InfoTask(this, IDS_TUTORIAL_TASK_BREEDING_RIDING_PIGS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Breeding, new InfoTask(this, IDS_TUTORIAL_TASK_BREEDING_WOLF_TAMING, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Breeding, new InfoTask(this, IDS_TUTORIAL_TASK_BREEDING_WOLF_COLLAR, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Breeding, new InfoTask(this, IDS_TUTORIAL_TASK_BREEDING_COMPLETE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - } - } - - /* - * - * - * SNOW AND IRON GOLEM - * - */ - if(app.getGameRuleDefinitions() != NULL) - { - AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"golemArea"); - if(area != NULL) - { - eTutorial_State golemStates[] = {e_Tutorial_State_Gameplay}; - AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Golem, golemStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); - - addTask(e_Tutorial_State_Golem, new ChoiceTask(this, IDS_TUTORIAL_GOLEM_OVERVIEW, IDS_TUTORIAL_PROMPT_GOLEM_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Golem) ); - - addTask(e_Tutorial_State_Golem, new InfoTask(this, IDS_TUTORIAL_TASK_GOLEM_PUMPKIN, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Golem, new InfoTask(this, IDS_TUTORIAL_TASK_GOLEM_SNOW, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Golem, new InfoTask(this, IDS_TUTORIAL_TASK_GOLEM_IRON, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Golem, new InfoTask(this, IDS_TUTORIAL_TASK_GOLEM_IRON_VILLAGE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - - } - } - + } + + int lookMappings[] = {MINECRAFT_ACTION_LOOK_UP, MINECRAFT_ACTION_LOOK_DOWN, + MINECRAFT_ACTION_LOOK_LEFT, + MINECRAFT_ACTION_LOOK_RIGHT}; + int moveMappings[] = {MINECRAFT_ACTION_FORWARD, MINECRAFT_ACTION_BACKWARD, + MINECRAFT_ACTION_LEFT, MINECRAFT_ACTION_RIGHT}; + int iLookCompletionMaskA[] = { + 10, // 1010 + 9, // 1001 + 6, // 0110 + 5 // 0101 + }; + addTask(e_Tutorial_State_Gameplay, + new ControllerTask(this, IDS_TUTORIAL_TASK_LOOK, false, false, + lookMappings, 4, iLookCompletionMaskA, 4, + moveMappings, 4)); + + addTask(e_Tutorial_State_Gameplay, + new ControllerTask(this, IDS_TUTORIAL_TASK_MOVE, false, false, + moveMappings, 4, iLookCompletionMaskA, 4, + lookMappings, 4)); + + addTask(e_Tutorial_State_Gameplay, + new InfoTask(this, IDS_TUTORIAL_TASK_SPRINT, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + + int jumpMappings[] = {MINECRAFT_ACTION_JUMP}; + addTask(e_Tutorial_State_Gameplay, + new ControllerTask(this, IDS_TUTORIAL_TASK_JUMP, false, true, + jumpMappings, 1)); + + int mineMappings[] = {MINECRAFT_ACTION_ACTION}; + addTask(e_Tutorial_State_Gameplay, + new ControllerTask(this, IDS_TUTORIAL_TASK_MINE, false, true, + mineMappings, 1)); + addTask(e_Tutorial_State_Gameplay, + new PickupTask(Tile::treeTrunk_Id, 4, -1, this, + IDS_TUTORIAL_TASK_CHOP_WOOD)); + + int scrollMappings[] = {MINECRAFT_ACTION_LEFT_SCROLL, + MINECRAFT_ACTION_RIGHT_SCROLL}; + // int scrollMappings[] = + // {ACTION_MENU_LEFT_SCROLL,ACTION_MENU_RIGHT_SCROLL}; + int iScrollCompletionMaskA[] = {2, // 10 + 1}; // 01 + addTask(e_Tutorial_State_Gameplay, + new ControllerTask(this, IDS_TUTORIAL_TASK_SCROLL, false, false, + scrollMappings, 2, iScrollCompletionMaskA, 2)); + + int invMappings[] = {MINECRAFT_ACTION_INVENTORY}; + addTask(e_Tutorial_State_Gameplay, + new ControllerTask(this, IDS_TUTORIAL_TASK_INVENTORY, false, false, + invMappings, 1)); + addTask(e_Tutorial_State_Gameplay, + new StateChangeTask(e_Tutorial_State_Inventory_Menu, this)); + + addTask(e_Tutorial_State_Gameplay, + new InfoTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_DEPLETE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Gameplay, + new InfoTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_HEAL, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Gameplay, + new InfoTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_FEED, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + + // While they should only eat the item we give them, includ the ability to + // complete this task with different items + int foodItems[] = {Item::mushroomStew_Id, Item::apple_Id, + Item::bread_Id, Item::porkChop_raw_Id, + Item::porkChop_cooked_Id, Item::apple_gold_Id, + Item::fish_raw_Id, Item::fish_cooked_Id, + Item::cookie_Id, Item::beef_cooked_Id, + Item::beef_raw_Id, Item::chicken_cooked_Id, + Item::chicken_raw_Id, Item::melon_Id, + Item::rotten_flesh_Id}; + addTask( + e_Tutorial_State_Gameplay, + new CompleteUsingItemTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_EAT_STEAK, + foodItems, 15, true)); + + int crftMappings[] = {MINECRAFT_ACTION_CRAFTING}; + addTask(e_Tutorial_State_Gameplay, + new ControllerTask(this, IDS_TUTORIAL_TASK_CRAFTING, false, false, + crftMappings, 1)); + + addTask(e_Tutorial_State_Gameplay, + new ProgressFlagTask(&m_progressFlags, + FULL_TUTORIAL_PROGRESS_2_X_2_Crafting, + ProgressFlagTask::e_Progress_Set_Flag, this)); + addTask(e_Tutorial_State_Gameplay, + new StateChangeTask(e_Tutorial_State_2x2Crafting_Menu, this)); + + addTask(e_Tutorial_State_Gameplay, + new CraftTask(Tile::wood_Id, -1, 1, this, + IDS_TUTORIAL_TASK_CREATE_PLANKS)); + addTask(e_Tutorial_State_Gameplay, + new CraftTask(Tile::workBench_Id, -1, 1, this, + IDS_TUTORIAL_TASK_CREATE_CRAFTING_TABLE)); + + // int useMappings[] = {MINECRAFT_ACTION_USE}; + // addTask(e_Tutorial_State_Gameplay, new ControllerTask( this, + // IDS_TUTORIAL_TASK_USE, false, false, useMappings, 1) ); + addTask(e_Tutorial_State_Gameplay, + new InfoTask(this, IDS_TUTORIAL_TASK_USE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Gameplay, + new UseItemTask(Tile::workBench_Id, this, + IDS_TUTORIAL_TASK_PLACE_WORKBENCH, true)); + + addTask(e_Tutorial_State_Gameplay, + new InfoTask(this, IDS_TUTORIAL_TASK_NIGHT_DANGER, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Gameplay, + new InfoTask(this, IDS_TUTORIAL_TASK_NEARBY_SHELTER, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Gameplay, + new InfoTask(this, IDS_TUTORIAL_TASK_COLLECT_RESOURCES, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + + // END OF BASIC TUTORIAL + + addTask( + e_Tutorial_State_Gameplay, + new ChoiceTask(this, IDS_TUTORIAL_TASK_BASIC_COMPLETE, + IDS_TUTORIAL_PROMPT_BASIC_COMPLETE, true, ACTION_MENU_A, + ACTION_MENU_B, e_Tutorial_Completion_Jump_To_Last_Task, + eTelemetryTutorial_Halfway)); + + // START OF FULL TUTORIAL + + addTask(e_Tutorial_State_Gameplay, + new UseTileTask(Tile::workBench_Id, this, + IDS_TUTORIAL_TASK_OPEN_WORKBENCH, false)); + + addTask(e_Tutorial_State_Gameplay, + new ProgressFlagTask(&m_progressFlags, + FULL_TUTORIAL_PROGRESS_3_X_3_Crafting, + ProgressFlagTask::e_Progress_Set_Flag, this)); + addTask(e_Tutorial_State_Gameplay, + new StateChangeTask(e_Tutorial_State_3x3Crafting_Menu, this)); + + addTask(e_Tutorial_State_Gameplay, + new CraftTask(Item::stick->id, -1, 1, this, + IDS_TUTORIAL_TASK_CREATE_STICKS)); + + int shovelItems[] = {Item::shovel_wood->id, Item::shovel_stone->id, + Item::shovel_iron->id, Item::shovel_gold->id, + Item::shovel_diamond->id}; + int shovelAuxVals[] = {-1, -1, -1, -1, -1}; + addTask(e_Tutorial_State_Gameplay, + new CraftTask(shovelItems, shovelAuxVals, 5, 1, this, + IDS_TUTORIAL_TASK_CREATE_WOODEN_SHOVEL)); + + int hatchetItems[] = {Item::hatchet_wood->id, Item::hatchet_stone->id, + Item::hatchet_iron->id, Item::hatchet_gold->id, + Item::hatchet_diamond->id}; + int hatchetAuxVals[] = {-1, -1, -1, -1, -1}; + addTask(e_Tutorial_State_Gameplay, + new CraftTask(hatchetItems, hatchetAuxVals, 5, 1, this, + IDS_TUTORIAL_TASK_CREATE_WOODEN_HATCHET)); + + int pickaxeItems[] = {Item::pickAxe_wood->id, Item::pickAxe_stone->id, + Item::pickAxe_iron->id, Item::pickAxe_gold->id, + Item::pickAxe_diamond->id}; + int pickaxeAuxVals[] = {-1, -1, -1, -1, -1}; + addTask(e_Tutorial_State_Gameplay, + new CraftTask(pickaxeItems, pickaxeAuxVals, 5, 1, this, + IDS_TUTORIAL_TASK_CREATE_WOODEN_PICKAXE)); + + addTask(e_Tutorial_State_Gameplay, + new PickupTask(Tile::cobblestone_Id, 8, -1, this, + IDS_TUTORIAL_TASK_MINE_STONE)); + + addTask(e_Tutorial_State_Gameplay, + new ProgressFlagTask(&m_progressFlags, + FULL_TUTORIAL_PROGRESS_CRAFT_FURNACE, + ProgressFlagTask::e_Progress_Set_Flag, this)); + addTask(e_Tutorial_State_Gameplay, + new CraftTask(Tile::furnace_Id, -1, 1, this, + IDS_TUTORIAL_TASK_CREATE_FURNACE)); + addTask(e_Tutorial_State_Gameplay, + new UseTileTask(Tile::furnace_Id, this, + IDS_TUTORIAL_TASK_PLACE_AND_OPEN_FURNACE)); + + addTask(e_Tutorial_State_Gameplay, + new ProgressFlagTask(&m_progressFlags, + FULL_TUTORIAL_PROGRESS_USE_FURNACE, + ProgressFlagTask::e_Progress_Set_Flag, this)); + addTask(e_Tutorial_State_Gameplay, + new StateChangeTask(e_Tutorial_State_Furnace_Menu, this)); + addTask(e_Tutorial_State_Gameplay, + new CraftTask(Item::coal->id, -1, 1, this, + IDS_TUTORIAL_TASK_CREATE_CHARCOAL)); + addTask(e_Tutorial_State_Gameplay, + new CraftTask(Tile::glass_Id, -1, 1, this, + IDS_TUTORIAL_TASK_CREATE_GLASS)); + addTask(e_Tutorial_State_Gameplay, + new CraftTask(Item::door_wood->id, -1, 1, this, + IDS_TUTORIAL_TASK_CREATE_WOODEN_DOOR)); + addTask(e_Tutorial_State_Gameplay, + new UseItemTask(Item::door_wood->id, this, + IDS_TUTORIAL_TASK_PLACE_DOOR)); + addTask(e_Tutorial_State_Gameplay, + new CraftTask(Tile::torch_Id, -1, 1, this, + IDS_TUTORIAL_TASK_CREATE_TORCH)); + + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = + app.getGameRuleDefinitions()->getNamedArea(L"tutorialArea"); + if (area != NULL) { + std::vector* areaConstraints = + new std::vector(); + areaConstraints->push_back(new AreaConstraint( + IDS_TUTORIAL_CONSTRAINT_TUTORIAL_AREA, area->x0, area->y0, + area->z0, area->x1, area->y1, area->z1)); + addTask( + e_Tutorial_State_Gameplay, + new AreaTask(e_Tutorial_State_Gameplay, this, areaConstraints)); + } + } + + // This MUST be the last task in the e_Tutorial_State_Gameplay state. Some + // of the earlier tasks will skip to the last task when complete, and this + // is the one that we want the player to see. + ProcedureCompoundTask* finalTask = new ProcedureCompoundTask(this); + finalTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_COMPLETED, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, + true, ACTION_MENU_A, eTelemetryTutorial_Complete)); + // 4J Stu - Remove this string as it refers to things that don't exist in + // the current tutorial world! + // finalTask->AddTask( new InfoTask(this, + // IDS_TUTORIAL_FEATURES_IN_THIS_AREA, + // IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); + finalTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_FEATURES_OUTSIDE_THIS_AREA, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + finalTask->AddTask(new InfoTask(this, IDS_TUTORIAL_COMPLETED_EXPLORE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, + true, ACTION_MENU_A)); + addTask(e_Tutorial_State_Gameplay, finalTask); + // END OF FULL TUTORIAL + + /* + * + * + * INVENTORY + * + */ + // Some tasks already added in the super class ctor + addTask( + e_Tutorial_State_Inventory_Menu, + new FullTutorialActiveTask(this, e_Tutorial_Completion_Complete_State)); + addTask(e_Tutorial_State_Inventory_Menu, + new InfoTask(this, IDS_TUTORIAL_TASK_INV_EXIT, -1, false, + ACTION_MENU_B)); + + /* + * + * + * CRAFTING + * + */ + // Some tasks already added in the super class ctor + + addTask( + e_Tutorial_State_2x2Crafting_Menu, + new FullTutorialActiveTask(this, e_Tutorial_Completion_Complete_State)); + // To block progress + addTask(e_Tutorial_State_2x2Crafting_Menu, + new ProgressFlagTask(&m_progressFlags, + FULL_TUTORIAL_PROGRESS_2_X_2_Crafting, + ProgressFlagTask::e_Progress_Flag_On, this)); + + addTask( + e_Tutorial_State_2x2Crafting_Menu, + new FullTutorialActiveTask(this, e_Tutorial_Completion_Complete_State)); + + addTask(e_Tutorial_State_2x2Crafting_Menu, + new CraftTask(Tile::wood_Id, -1, 1, this, + IDS_TUTORIAL_TASK_CRAFT_CREATE_PLANKS)); + + ProcedureCompoundTask* workbenchCompound = new ProcedureCompoundTask(this); + workbenchCompound->AddTask( + new XuiCraftingTask(this, IDS_TUTORIAL_TASK_CRAFT_SELECT_STRUCTURES, + Recipy::eGroupType_Structure)); + workbenchCompound->AddTask( + new XuiCraftingTask(this, IDS_TUTORIAL_TASK_CRAFT_SELECT_CRAFTING_TABLE, + Tile::workBench_Id)); + workbenchCompound->AddTask( + new CraftTask(Tile::workBench_Id, -1, 1, this, + IDS_TUTORIAL_TASK_CREATE_CRAFTING_TABLE)); + addTask(e_Tutorial_State_2x2Crafting_Menu, workbenchCompound); + addTask(e_Tutorial_State_2x2Crafting_Menu, + new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_EXIT_AND_PLACE_TABLE, -1, + false, ACTION_MENU_B)); + + // 3x3 Crafting + addTask( + e_Tutorial_State_3x3Crafting_Menu, + new FullTutorialActiveTask(this, e_Tutorial_Completion_Complete_State)); + + addTask(e_Tutorial_State_3x3Crafting_Menu, + new ProgressFlagTask(&m_progressFlags, + FULL_TUTORIAL_PROGRESS_3_X_3_Crafting, + ProgressFlagTask::e_Progress_Flag_On, this)); + + addTask(e_Tutorial_State_3x3Crafting_Menu, + new CraftTask(Item::stick->id, -1, 1, this, + IDS_TUTORIAL_TASK_CREATE_STICKS)); + + ProcedureCompoundTask* shovelCompound = new ProcedureCompoundTask(this); + shovelCompound->AddTask(new XuiCraftingTask( + this, IDS_TUTORIAL_TASK_CRAFT_SELECT_TOOLS, Recipy::eGroupType_Tool)); + shovelCompound->AddTask( + new XuiCraftingTask(this, IDS_TUTORIAL_TASK_CRAFT_SELECT_WOODEN_SHOVEL, + Item::shovel_wood->id)); + shovelCompound->AddTask( + new CraftTask(shovelItems, shovelAuxVals, 5, 1, this, + IDS_TUTORIAL_TASK_CREATE_WOODEN_SHOVEL)); + addTask(e_Tutorial_State_3x3Crafting_Menu, shovelCompound); + addTask(e_Tutorial_State_3x3Crafting_Menu, + new CraftTask(hatchetItems, hatchetAuxVals, 5, 1, this, + IDS_TUTORIAL_TASK_CREATE_WOODEN_HATCHET)); + addTask(e_Tutorial_State_3x3Crafting_Menu, + new CraftTask(pickaxeItems, pickaxeAuxVals, 5, 1, this, + IDS_TUTORIAL_TASK_CREATE_WOODEN_PICKAXE)); + + addTask(e_Tutorial_State_3x3Crafting_Menu, + new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_TOOLS_BUILT, -1, false, + ACTION_MENU_B)); + + // To block progress + addTask(e_Tutorial_State_3x3Crafting_Menu, + new ProgressFlagTask(&m_progressFlags, + FULL_TUTORIAL_PROGRESS_CRAFT_FURNACE, + ProgressFlagTask::e_Progress_Flag_On, this)); + + addTask(e_Tutorial_State_3x3Crafting_Menu, + new CraftTask(Tile::furnace_Id, -1, 1, this, + IDS_TUTORIAL_TASK_CRAFT_CREATE_FURNACE)); + addTask(e_Tutorial_State_3x3Crafting_Menu, + new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_EXIT_AND_PLACE_FURNACE, + -1, false, ACTION_MENU_B)); + + // No need to block here, as it's fine if the player wants to do this out of + // order + addTask(e_Tutorial_State_3x3Crafting_Menu, + new CraftTask(Item::door_wood->id, -1, 1, this, + IDS_TUTORIAL_TASK_CREATE_WOODEN_DOOR)); + addTask(e_Tutorial_State_3x3Crafting_Menu, + new CraftTask(Tile::torch_Id, -1, 1, this, + IDS_TUTORIAL_TASK_CREATE_TORCH)); + + /* + * + * + * FURNACE + * + */ + // Some tasks already added in the super class ctor + + addTask( + e_Tutorial_State_Furnace_Menu, + new FullTutorialActiveTask(this, e_Tutorial_Completion_Complete_State)); + + // Blocking + addTask(e_Tutorial_State_Furnace_Menu, + new ProgressFlagTask(&m_progressFlags, + FULL_TUTORIAL_PROGRESS_USE_FURNACE, + ProgressFlagTask::e_Progress_Flag_On, this)); + + addTask(e_Tutorial_State_Furnace_Menu, + new CraftTask(Item::coal->id, -1, 1, this, + IDS_TUTORIAL_TASK_FURNACE_CREATE_CHARCOAL)); + addTask(e_Tutorial_State_Furnace_Menu, + new InfoTask(this, IDS_TUTORIAL_TASK_FURNACE_CHARCOAL_USES, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Furnace_Menu, + new CraftTask(Tile::glass_Id, -1, 1, this, + IDS_TUTORIAL_TASK_FURNACE_CREATE_GLASS)); + + /* + * + * + * BREWING + * + */ + + // To block progress + addTask(e_Tutorial_State_Brewing_Menu, + new ProgressFlagTask(&m_progressFlags, + EXTENDED_TUTORIAL_PROGRESS_USE_BREWING_STAND, + ProgressFlagTask::e_Progress_Flag_On, this)); + + int potionItems[] = {Item::potion_Id, Item::potion_Id, Item::potion_Id, + Item::potion_Id, Item::potion_Id, Item::potion_Id, + Item::potion_Id, Item::potion_Id}; + int potionAuxVals[] = { + MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_FIRE_RESISTANCE), + MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_FIRE_RESISTANCE), + MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_FIRE_RESISTANCE), + MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, 0, MASK_FIRE_RESISTANCE), + MACRO_MAKEPOTION_AUXVAL(0, MASK_EXTENDED, MASK_FIRE_RESISTANCE), + MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_EXTENDED, + MASK_FIRE_RESISTANCE), + MACRO_MAKEPOTION_AUXVAL(0, MASK_EXTENDED, MASK_FIRE_RESISTANCE), + MACRO_MAKEPOTION_AUXVAL(MASK_SPLASH, MASK_EXTENDED, + MASK_FIRE_RESISTANCE)}; + addTask(e_Tutorial_State_Brewing_Menu, + new CraftTask(potionItems, potionAuxVals, 8, 1, this, + IDS_TUTORIAL_TASK_BREWING_MENU_CREATE_FIRE_POTION)); + addTask(e_Tutorial_State_Brewing_Menu, + new InfoTask(this, IDS_TUTORIAL_TASK_BREWING_MENU_EXIT, -1, false, + ACTION_MENU_B)); + + /* + * + * + * MINECART + * + */ + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = + app.getGameRuleDefinitions()->getNamedArea(L"minecartArea"); + if (area != NULL) { + addHint(e_Tutorial_State_Gameplay, + new AreaHint(e_Tutorial_Hint_Always_On, this, + e_Tutorial_State_Gameplay, + e_Tutorial_State_Riding_Minecart, + IDS_TUTORIAL_HINT_MINECART, area->x0, area->y0, + area->z0, area->x1, area->y1, area->z1)); + } + } + + /* + * + * + * BOAT + * + */ + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"boatArea"); + if (area != NULL) { + addHint(e_Tutorial_State_Gameplay, + new AreaHint(e_Tutorial_Hint_Always_On, this, + e_Tutorial_State_Gameplay, + e_Tutorial_State_Riding_Boat, + IDS_TUTORIAL_HINT_BOAT, area->x0, area->y0, + area->z0, area->x1, area->y1, area->z1)); + } + } + + /* + * + * + * FISHING + * + */ + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"fishingArea"); + if (area != NULL) { + addHint(e_Tutorial_State_Gameplay, + new AreaHint(e_Tutorial_Hint_Always_On, this, + e_Tutorial_State_Gameplay, + e_Tutorial_State_Fishing, + IDS_TUTORIAL_HINT_FISHING, area->x0, area->y0, + area->z0, area->x1, area->y1, area->z1)); + } + } + + /* + * + * + * PISTON - SELF-REPAIRING BRIDGE + * + */ + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = + app.getGameRuleDefinitions()->getNamedArea(L"pistonBridgeArea"); + if (area != NULL) { + addHint( + e_Tutorial_State_Gameplay, + new AreaHint(e_Tutorial_Hint_Always_On, this, + e_Tutorial_State_Gameplay, e_Tutorial_State_None, + IDS_TUTORIAL_HINT_PISTON_SELF_REPAIRING_BRIDGE, + area->x0, area->y0, area->z0, area->x1, area->y1, + area->z1, true)); + } + } + + /* + * + * + * PISTON - PISTON AND REDSTONE CIRCUITS + * + */ + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"pistonArea"); + if (area != NULL) { + eTutorial_State redstoneAndPistonStates[] = { + e_Tutorial_State_Gameplay}; + AddGlobalConstraint(new ChangeStateConstraint( + this, e_Tutorial_State_Redstone_And_Piston, + redstoneAndPistonStates, 1, area->x0, area->y0, area->z0, + area->x1, area->y1, area->z1)); + + addTask( + e_Tutorial_State_Redstone_And_Piston, + new ChoiceTask( + this, IDS_TUTORIAL_REDSTONE_OVERVIEW, + IDS_TUTORIAL_PROMPT_REDSTONE_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_Redstone_And_Pistons)); + addTask(e_Tutorial_State_Redstone_And_Piston, + new InfoTask(this, IDS_TUTORIAL_TASK_REDSTONE_POWER_SOURCES, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Redstone_And_Piston, + new InfoTask(this, IDS_TUTORIAL_TASK_REDSTONE_TRIPWIRE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Redstone_And_Piston, + new InfoTask( + this, IDS_TUTORIAL_TASK_REDSTONE_POWER_SOURCES_POSITION, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Redstone_And_Piston, + new InfoTask(this, IDS_TUTORIAL_TASK_REDSTONE_DUST, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Redstone_And_Piston, + new InfoTask(this, IDS_TUTORIAL_TASK_REDSTONE_REPEATER, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Redstone_And_Piston, + new InfoTask(this, IDS_TUTORIAL_TASK_PISTONS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Redstone_And_Piston, + new InfoTask(this, IDS_TUTORIAL_TASK_TRY_IT, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } + } + + /* + * + * + * PORTAL + * + */ + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"portalArea"); + if (area != NULL) { + eTutorial_State portalStates[] = {e_Tutorial_State_Gameplay}; + AddGlobalConstraint(new ChangeStateConstraint( + this, e_Tutorial_State_Portal, portalStates, 1, area->x0, + area->y0, area->z0, area->x1, area->y1, area->z1)); + + addTask( + e_Tutorial_State_Portal, + new ChoiceTask( + this, IDS_TUTORIAL_PORTAL_OVERVIEW, + IDS_TUTORIAL_PROMPT_PORTAL_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_Portal)); + addTask(e_Tutorial_State_Portal, + new InfoTask(this, IDS_TUTORIAL_TASK_BUILD_PORTAL, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Portal, + new InfoTask(this, IDS_TUTORIAL_TASK_ACTIVATE_PORTAL, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Portal, + new InfoTask(this, IDS_TUTORIAL_TASK_USE_PORTAL, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Portal, + new InfoTask(this, IDS_TUTORIAL_TASK_NETHER, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Portal, + new InfoTask(this, IDS_TUTORIAL_TASK_NETHER_FAST_TRAVEL, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } + } + + /* + * + * + * CREATIVE + * + */ + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = + app.getGameRuleDefinitions()->getNamedArea(L"creativeArea"); + if (area != NULL) { + eTutorial_State creativeStates[] = {e_Tutorial_State_Gameplay}; + AddGlobalConstraint(new ChangeStateConstraint( + this, e_Tutorial_State_CreativeMode, creativeStates, 1, + area->x0, area->y0, area->z0, area->x1, area->y1, area->z1, + true, true, GameType::CREATIVE)); + + addTask(e_Tutorial_State_CreativeMode, + new ChoiceTask(this, IDS_TUTORIAL_CREATIVE_OVERVIEW, + IDS_TUTORIAL_PROMPT_CREATIVE_OVERVIEW, true, + ACTION_MENU_A, ACTION_MENU_B, + e_Tutorial_Completion_Jump_To_Last_Task, + eTelemetryTutorial_CreativeMode)); + addTask(e_Tutorial_State_CreativeMode, + new InfoTask(this, IDS_TUTORIAL_TASK_CREATIVE_MODE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_CreativeMode, + new InfoTask(this, IDS_TUTORIAL_TASK_FLY, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + + int crftMappings[] = {MINECRAFT_ACTION_CRAFTING}; + addTask(e_Tutorial_State_CreativeMode, + new ControllerTask( + this, IDS_TUTORIAL_TASK_OPEN_CREATIVE_INVENTORY, false, + false, crftMappings, 1)); + addTask(e_Tutorial_State_CreativeMode, + new StateChangeTask( + e_Tutorial_State_Creative_Inventory_Menu, this)); + + // This last task ensures that the player is still in creative mode + // until they exit the area (but could skip the previous + // instructional stuff) + ProcedureCompoundTask* creativeFinalTask = + new ProcedureCompoundTask(this); + + AABB* exitArea = + app.getGameRuleDefinitions()->getNamedArea(L"creativeExitArea"); + if (exitArea != NULL) { + std::vector* creativeExitAreaConstraints = + new std::vector(); + creativeExitAreaConstraints->push_back(new AreaConstraint( + -1, exitArea->x0, exitArea->y0, exitArea->z0, exitArea->x1, + exitArea->y1, exitArea->z1, true, false)); + creativeFinalTask->AddTask(new AreaTask( + e_Tutorial_State_CreativeMode, this, + creativeExitAreaConstraints, + IDS_TUTORIAL_TASK_CREATIVE_EXIT, + AreaTask:: + eAreaTaskCompletion_CompleteOnConstraintsSatisfied)); + } + + std::vector* creativeAreaConstraints = + new std::vector(); + creativeAreaConstraints->push_back(new AreaConstraint( + IDS_TUTORIAL_CONSTRAINT_TUTORIAL_AREA, area->x0, area->y0, + area->z0, area->x1, area->y1, area->z1)); + creativeFinalTask->AddTask(new AreaTask( + e_Tutorial_State_CreativeMode, this, creativeAreaConstraints)); + + creativeFinalTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_CREATIVE_COMPLETE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + + addTask(e_Tutorial_State_CreativeMode, creativeFinalTask); + } + } + + /* + * + * + * BREWING + * + */ + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"brewingArea"); + if (area != NULL) { + eTutorial_State brewingStates[] = {e_Tutorial_State_Gameplay}; + AddGlobalConstraint(new ChangeStateConstraint( + this, e_Tutorial_State_Brewing, brewingStates, 1, area->x0, + area->y0, area->z0, area->x1, area->y1, area->z1)); + + addTask( + e_Tutorial_State_Brewing, + new ChoiceTask( + this, IDS_TUTORIAL_TASK_BREWING_OVERVIEW, + IDS_TUTORIAL_PROMPT_BREWING_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_Brewing)); + + ProcedureCompoundTask* fillWaterBottleTask = + new ProcedureCompoundTask(this); + fillWaterBottleTask->AddTask( + new PickupTask(Item::glassBottle_Id, 1, -1, this, + IDS_TUTORIAL_TASK_BREWING_GET_GLASS_BOTTLE)); + fillWaterBottleTask->AddTask( + new PickupTask(Item::potion_Id, 1, 0, this, + IDS_TUTORIAL_TASK_BREWING_FILL_GLASS_BOTTLE)); + addTask(e_Tutorial_State_Brewing, fillWaterBottleTask); + + addTask(e_Tutorial_State_Brewing, + new InfoTask(this, IDS_TUTORIAL_TASK_BREWING_FILL_CAULDRON, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + + addTask(e_Tutorial_State_Brewing, + new ProgressFlagTask( + &m_progressFlags, + EXTENDED_TUTORIAL_PROGRESS_USE_BREWING_STAND, + ProgressFlagTask::e_Progress_Set_Flag, this)); + addTask( + e_Tutorial_State_Brewing, + new CraftTask(potionItems, potionAuxVals, 8, 1, this, + IDS_TUTORIAL_TASK_BREWING_CREATE_FIRE_POTION)); + + addTask(e_Tutorial_State_Brewing, + new InfoTask(this, IDS_TUTORIAL_TASK_BREWING_USE_POTION, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Brewing, + new EffectChangedTask( + this, IDS_TUTORIAL_TASK_BREWING_DRINK_FIRE_POTION, + MobEffect::fireResistance)); + addTask(e_Tutorial_State_Brewing, + new InfoTask(this, IDS_TUTORIAL_TASK_BREWING_USE_EFFECTS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } + } + + /* + * + * + * ENCHANTING + * + */ + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = + app.getGameRuleDefinitions()->getNamedArea(L"enchantingArea"); + if (area != NULL) { + eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay}; + AddGlobalConstraint(new ChangeStateConstraint( + this, e_Tutorial_State_Enchanting, enchantingStates, 1, + area->x0, area->y0, area->z0, area->x1, area->y1, area->z1)); + + addTask( + e_Tutorial_State_Enchanting, + new ChoiceTask( + this, IDS_TUTORIAL_TASK_ENCHANTING_OVERVIEW, + IDS_TUTORIAL_PROMPT_ENCHANTING_OVERVIEW, true, + ACTION_MENU_A, ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_Enchanting)); + + addTask(e_Tutorial_State_Enchanting, + new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_SUMMARY, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Enchanting, + new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_BOOKS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Enchanting, + new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_BOOKCASES, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Enchanting, + new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_EXPERIENCE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Enchanting, + new InfoTask( + this, IDS_TUTORIAL_TASK_ENCHANTING_BOTTLE_O_ENCHANTING, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Enchanting, + new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_USE_CHESTS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } + } + + /* + * + * + * ANVIL + * + */ + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"anvilArea"); + if (area != NULL) { + eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay}; + AddGlobalConstraint(new ChangeStateConstraint( + this, e_Tutorial_State_Anvil, enchantingStates, 1, area->x0, + area->y0, area->z0, area->x1, area->y1, area->z1)); + + addTask( + e_Tutorial_State_Anvil, + new ChoiceTask( + this, IDS_TUTORIAL_TASK_ANVIL_OVERVIEW, + IDS_TUTORIAL_PROMPT_ANVIL_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_Anvil)); + + addTask(e_Tutorial_State_Anvil, + new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_SUMMARY, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Anvil, + new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_ENCHANTED_BOOKS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Anvil, + new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_COST, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Anvil, + new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_COST2, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Anvil, + new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_RENAMING, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Anvil, + new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_USE_CHESTS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } + } + + /* + * + * + * TRADING + * + */ + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"tradingArea"); + if (area != NULL) { + eTutorial_State tradingStates[] = {e_Tutorial_State_Gameplay}; + AddGlobalConstraint(new ChangeStateConstraint( + this, e_Tutorial_State_Trading, tradingStates, 1, area->x0, + area->y0, area->z0, area->x1, area->y1, area->z1)); + + addTask( + e_Tutorial_State_Trading, + new ChoiceTask( + this, IDS_TUTORIAL_TASK_TRADING_OVERVIEW, + IDS_TUTORIAL_PROMPT_TRADING_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_Trading)); + + addTask(e_Tutorial_State_Trading, + new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_SUMMARY, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Trading, + new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_TRADES, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask( + e_Tutorial_State_Trading, + new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_INCREASE_TRADES, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask( + e_Tutorial_State_Trading, + new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_DECREASE_TRADES, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Trading, + new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_USE_CHESTS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } + } + + /* + * + * + * FIREWORKS + * + */ + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = + app.getGameRuleDefinitions()->getNamedArea(L"fireworksArea"); + if (area != NULL) { + eTutorial_State fireworkStates[] = {e_Tutorial_State_Gameplay}; + AddGlobalConstraint(new ChangeStateConstraint( + this, e_Tutorial_State_Fireworks, fireworkStates, 1, area->x0, + area->y0, area->z0, area->x1, area->y1, area->z1)); + + addTask( + e_Tutorial_State_Fireworks, + new ChoiceTask( + this, IDS_TUTORIAL_TASK_FIREWORK_OVERVIEW, + IDS_TUTORIAL_PROMPT_FIREWORK_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_Trading)); + + addTask(e_Tutorial_State_Fireworks, + new InfoTask(this, IDS_TUTORIAL_TASK_FIREWORK_PURPOSE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Fireworks, + new InfoTask(this, IDS_TUTORIAL_TASK_FIREWORK_CUSTOMISE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); // + addTask(e_Tutorial_State_Fireworks, + new InfoTask(this, IDS_TUTORIAL_TASK_FIREWORK_CRAFTING, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } + } + + /* + * + * + * BEACON + * + */ + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"beaconArea"); + if (area != NULL) { + eTutorial_State beaconStates[] = {e_Tutorial_State_Gameplay}; + AddGlobalConstraint(new ChangeStateConstraint( + this, e_Tutorial_State_Beacon, beaconStates, 1, area->x0, + area->y0, area->z0, area->x1, area->y1, area->z1)); + + addTask( + e_Tutorial_State_Beacon, + new ChoiceTask( + this, IDS_TUTORIAL_TASK_BEACON_OVERVIEW, + IDS_TUTORIAL_PROMPT_BEACON_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_Beacon)); + + addTask(e_Tutorial_State_Beacon, + new InfoTask(this, IDS_TUTORIAL_TASK_BEACON_PURPOSE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Beacon, + new InfoTask(this, IDS_TUTORIAL_TASK_BEACON_DESIGN, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Beacon, + new InfoTask(this, IDS_TUTORIAL_TASK_BEACON_CHOOSING_POWERS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } + } + + /* + * + * + * HOPPER + * + */ + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"hopperArea"); + if (area != NULL) { + eTutorial_State hopperStates[] = {e_Tutorial_State_Gameplay}; + AddGlobalConstraint(new ChangeStateConstraint( + this, e_Tutorial_State_Hopper, hopperStates, 1, area->x0, + area->y0, area->z0, area->x1, area->y1, area->z1)); + + addTask( + e_Tutorial_State_Hopper, + new ChoiceTask( + this, IDS_TUTORIAL_TASK_HOPPER_OVERVIEW, + IDS_TUTORIAL_PROMPT_HOPPER_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_Hopper)); + + addTask(e_Tutorial_State_Hopper, + new InfoTask(this, IDS_TUTORIAL_TASK_HOPPER_PURPOSE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Hopper, + new InfoTask(this, IDS_TUTORIAL_TASK_HOPPER_CONTAINERS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Hopper, + new InfoTask(this, IDS_TUTORIAL_TASK_HOPPER_MECHANICS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Hopper, + new InfoTask(this, IDS_TUTORIAL_TASK_HOPPER_REDSTONE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Hopper, + new InfoTask(this, IDS_TUTORIAL_TASK_HOPPER_OUTPUT, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Hopper, + new InfoTask(this, IDS_TUTORIAL_TASK_HOPPER_AREA, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } + } + + /* + * + * + * ENDERCHEST + * + */ + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = + app.getGameRuleDefinitions()->getNamedArea(L"enderchestArea"); + if (area != NULL) { + eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay}; + AddGlobalConstraint(new ChangeStateConstraint( + this, e_Tutorial_State_Enderchests, enchantingStates, 1, + area->x0, area->y0, area->z0, area->x1, area->y1, area->z1)); + + addTask( + e_Tutorial_State_Enderchests, + new ChoiceTask( + this, IDS_TUTORIAL_TASK_ENDERCHEST_OVERVIEW, + IDS_TUTORIAL_PROMPT_ENDERCHEST_OVERVIEW, true, + ACTION_MENU_A, ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_Enderchest)); + + addTask(e_Tutorial_State_Enderchests, + new InfoTask(this, IDS_TUTORIAL_TASK_ENDERCHEST_SUMMARY, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Enderchests, + new InfoTask(this, IDS_TUTORIAL_TASK_ENDERCHEST_PLAYERS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Enderchests, + new InfoTask(this, IDS_TUTORIAL_TASK_ENDERCHEST_FUNCTION, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } + } + + /* + * + * + * FARMING + * + */ + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"farmingArea"); + if (area != NULL) { + eTutorial_State farmingStates[] = {e_Tutorial_State_Gameplay}; + AddGlobalConstraint(new ChangeStateConstraint( + this, e_Tutorial_State_Farming, farmingStates, 1, area->x0, + area->y0, area->z0, area->x1, area->y1, area->z1)); + + addTask( + e_Tutorial_State_Farming, + new ChoiceTask( + this, IDS_TUTORIAL_FARMING_OVERVIEW, + IDS_TUTORIAL_PROMPT_FARMING_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_Farming)); + + addTask(e_Tutorial_State_Farming, + new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_SEEDS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Farming, + new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_FARMLAND, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Farming, + new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_WHEAT, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask( + e_Tutorial_State_Farming, + new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_PUMPKIN_AND_MELON, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Farming, + new InfoTask(this, + IDS_TUTORIAL_TASK_FARMING_CARROTS_AND_POTATOES, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Farming, + new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_SUGARCANE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Farming, + new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_CACTUS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Farming, + new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_MUSHROOM, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Farming, + new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_BONEMEAL, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Farming, + new InfoTask(this, IDS_TUTORIAL_TASK_FARMING_COMPLETE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } + } + + /* + * + * + * BREEDING + * + */ + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = + app.getGameRuleDefinitions()->getNamedArea(L"breedingArea"); + if (area != NULL) { + eTutorial_State breedingStates[] = {e_Tutorial_State_Gameplay}; + AddGlobalConstraint(new ChangeStateConstraint( + this, e_Tutorial_State_Breeding, breedingStates, 1, area->x0, + area->y0, area->z0, area->x1, area->y1, area->z1)); + + addTask( + e_Tutorial_State_Breeding, + new ChoiceTask( + this, IDS_TUTORIAL_BREEDING_OVERVIEW, + IDS_TUTORIAL_PROMPT_BREEDING_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_Breeding)); + + addTask(e_Tutorial_State_Breeding, + new InfoTask(this, IDS_TUTORIAL_TASK_BREEDING_FEED, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Breeding, + new InfoTask(this, IDS_TUTORIAL_TASK_BREEDING_FEED_FOOD, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Breeding, + new InfoTask(this, IDS_TUTORIAL_TASK_BREEDING_BABY, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Breeding, + new InfoTask(this, IDS_TUTORIAL_TASK_BREEDING_DELAY, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Breeding, + new InfoTask(this, IDS_TUTORIAL_TASK_BREEDING_FOLLOW, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Breeding, + new InfoTask(this, IDS_TUTORIAL_TASK_BREEDING_RIDING_PIGS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Breeding, + new InfoTask(this, IDS_TUTORIAL_TASK_BREEDING_WOLF_TAMING, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Breeding, + new InfoTask(this, IDS_TUTORIAL_TASK_BREEDING_WOLF_COLLAR, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Breeding, + new InfoTask(this, IDS_TUTORIAL_TASK_BREEDING_COMPLETE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } + } + + /* + * + * + * SNOW AND IRON GOLEM + * + */ + if (app.getGameRuleDefinitions() != NULL) { + AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"golemArea"); + if (area != NULL) { + eTutorial_State golemStates[] = {e_Tutorial_State_Gameplay}; + AddGlobalConstraint(new ChangeStateConstraint( + this, e_Tutorial_State_Golem, golemStates, 1, area->x0, + area->y0, area->z0, area->x1, area->y1, area->z1)); + + addTask( + e_Tutorial_State_Golem, + new ChoiceTask( + this, IDS_TUTORIAL_GOLEM_OVERVIEW, + IDS_TUTORIAL_PROMPT_GOLEM_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_Golem)); + + addTask(e_Tutorial_State_Golem, + new InfoTask(this, IDS_TUTORIAL_TASK_GOLEM_PUMPKIN, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Golem, + new InfoTask(this, IDS_TUTORIAL_TASK_GOLEM_SNOW, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Golem, + new InfoTask(this, IDS_TUTORIAL_TASK_GOLEM_IRON, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Golem, + new InfoTask(this, IDS_TUTORIAL_TASK_GOLEM_IRON_VILLAGE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } + } } -// 4J Stu - All tutorials are onby default in the full tutorial whether the player has previously completed them or not -bool FullTutorial::isStateCompleted( eTutorial_State state ) -{ - return m_completedStates[state]; +// 4J Stu - All tutorials are onby default in the full tutorial whether the +// player has previously completed them or not +bool FullTutorial::isStateCompleted(eTutorial_State state) { + return m_completedStates[state]; } -void FullTutorial::setStateCompleted( eTutorial_State state ) -{ - m_completedStates[state] = true; - Tutorial::setStateCompleted(state); +void FullTutorial::setStateCompleted(eTutorial_State state) { + m_completedStates[state] = true; + Tutorial::setStateCompleted(state); } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/FullTutorial.h b/Minecraft.Client/Platform/Common/Tutorial/FullTutorial.h index da2641d25..c7a91226b 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/FullTutorial.h +++ b/Minecraft.Client/Platform/Common/Tutorial/FullTutorial.h @@ -7,15 +7,15 @@ #define FULL_TUTORIAL_PROGRESS_USE_FURNACE 8 #define EXTENDED_TUTORIAL_PROGRESS_USE_BREWING_STAND 16 -class FullTutorial : public Tutorial -{ +class FullTutorial : public Tutorial { private: - bool m_isTrial; - char m_progressFlags; - bool m_completedStates[e_Tutorial_State_Max]; -public: - FullTutorial(int iPad, bool isTrial = false); + bool m_isTrial; + char m_progressFlags; + bool m_completedStates[e_Tutorial_State_Max]; - virtual bool isStateCompleted( eTutorial_State state ); - virtual void setStateCompleted( eTutorial_State state ); +public: + FullTutorial(int iPad, bool isTrial = false); + + virtual bool isStateCompleted(eTutorial_State state); + virtual void setStateCompleted(eTutorial_State state); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/FullTutorialActiveTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/FullTutorialActiveTask.cpp index 551acb554..775617c5d 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/FullTutorialActiveTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/FullTutorialActiveTask.cpp @@ -2,25 +2,19 @@ #include "Tutorial.h" #include "FullTutorialActiveTask.h" -FullTutorialActiveTask::FullTutorialActiveTask(Tutorial *tutorial, eTutorial_CompletionAction completeAction /*= e_Tutorial_Completion_None*/) - : TutorialTask( tutorial, -1, false, NULL, false, false, false ) -{ - m_completeAction = completeAction; +FullTutorialActiveTask::FullTutorialActiveTask( + Tutorial* tutorial, + eTutorial_CompletionAction completeAction /*= e_Tutorial_Completion_None*/) + : TutorialTask(tutorial, -1, false, NULL, false, false, false) { + m_completeAction = completeAction; } -bool FullTutorialActiveTask::isCompleted() -{ - return bHasBeenActivated; -} +bool FullTutorialActiveTask::isCompleted() { return bHasBeenActivated; } -eTutorial_CompletionAction FullTutorialActiveTask::getCompletionAction() -{ - if( tutorial->m_fullTutorialComplete ) - { - return m_completeAction; - } - else - { - return e_Tutorial_Completion_None; - } +eTutorial_CompletionAction FullTutorialActiveTask::getCompletionAction() { + if (tutorial->m_fullTutorialComplete) { + return m_completeAction; + } else { + return e_Tutorial_Completion_None; + } } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/FullTutorialActiveTask.h b/Minecraft.Client/Platform/Common/Tutorial/FullTutorialActiveTask.h index 8f827d593..8d1b75cad 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/FullTutorialActiveTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/FullTutorialActiveTask.h @@ -1,18 +1,19 @@ #pragma once -//using namespace std; +// using namespace std; #include "TutorialTask.h" // Information messages with a choice -class FullTutorialActiveTask : public TutorialTask -{ +class FullTutorialActiveTask : public TutorialTask { private: - eTutorial_CompletionAction m_completeAction; + eTutorial_CompletionAction m_completeAction; + + bool CompletionMaskIsValid(); - bool CompletionMaskIsValid(); public: - FullTutorialActiveTask(Tutorial *tutorial, eTutorial_CompletionAction completeAction = e_Tutorial_Completion_None); - virtual bool isCompleted(); - virtual eTutorial_CompletionAction getCompletionAction(); - + FullTutorialActiveTask( + Tutorial* tutorial, + eTutorial_CompletionAction completeAction = e_Tutorial_Completion_None); + virtual bool isCompleted(); + virtual eTutorial_CompletionAction getCompletionAction(); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/FullTutorialMode.cpp b/Minecraft.Client/Platform/Common/Tutorial/FullTutorialMode.cpp index 52b0b00e4..274fcb3c8 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/FullTutorialMode.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/FullTutorialMode.cpp @@ -3,14 +3,13 @@ #include "FullTutorial.h" #include "FullTutorialMode.h" -FullTutorialMode::FullTutorialMode(int iPad, Minecraft *minecraft, ClientConnection *connection) - : TutorialMode(iPad, minecraft, connection) -{ - tutorial = new FullTutorial( iPad ); - minecraft->playerStartedTutorial( iPad ); +FullTutorialMode::FullTutorialMode(int iPad, Minecraft* minecraft, + ClientConnection* connection) + : TutorialMode(iPad, minecraft, connection) { + tutorial = new FullTutorial(iPad); + minecraft->playerStartedTutorial(iPad); } -bool FullTutorialMode::isTutorial() -{ - return !tutorial->m_fullTutorialComplete; +bool FullTutorialMode::isTutorial() { + return !tutorial->m_fullTutorialComplete; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/FullTutorialMode.h b/Minecraft.Client/Platform/Common/Tutorial/FullTutorialMode.h index ce6f18194..de3e28824 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/FullTutorialMode.h +++ b/Minecraft.Client/Platform/Common/Tutorial/FullTutorialMode.h @@ -1,12 +1,12 @@ #pragma once #include "TutorialMode.h" -class FullTutorialMode : public TutorialMode -{ +class FullTutorialMode : public TutorialMode { public: - FullTutorialMode(int iPad, Minecraft *minecraft, ClientConnection *connection); + FullTutorialMode(int iPad, Minecraft* minecraft, + ClientConnection* connection); - virtual bool isImplemented() { return true; } + virtual bool isImplemented() { return true; } - virtual bool isTutorial(); + virtual bool isTutorial(); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/HorseChoiceTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/HorseChoiceTask.cpp new file mode 100644 index 000000000..aa3214bee --- /dev/null +++ b/Minecraft.Client/Platform/Common/Tutorial/HorseChoiceTask.cpp @@ -0,0 +1,47 @@ +#include "../../stdafx.h" + +#include + +#include "../../../Minecraft.h" +#include "Tutorial.h" + +#include "../../../../Minecraft.World/Entities/Mobs/EntityHorse.h" + +#include "HorseChoiceTask.h" + +HorseChoiceTask::HorseChoiceTask(Tutorial* tutorial, int iDescHorse, + int iDescDonkey, int iDescMule, int iPromptId, + bool requiresUserInput, int iConfirmMapping, + int iCancelMapping, + eTutorial_CompletionAction cancelAction, + ETelemetryChallenges telemetryEvent) + + : ChoiceTask(tutorial, -1, iPromptId, requiresUserInput, iConfirmMapping, + iCancelMapping, cancelAction, telemetryEvent) { + m_eHorseType = -1; + m_iDescMule = iDescMule; + m_iDescDonkey = iDescDonkey; + m_iDescHorse = iDescHorse; +} + +int HorseChoiceTask::getDescriptionId() { + switch (m_eHorseType) { + case EntityHorse::TYPE_HORSE: + return m_iDescHorse; + case EntityHorse::TYPE_DONKEY: + return m_iDescDonkey; + case EntityHorse::TYPE_MULE: + return m_iDescMule; + default: + return -1; + } + return -1; +} + +void HorseChoiceTask::onLookAtEntity(std::shared_ptr entity) { + if ((m_eHorseType < 0) && entity->instanceof(eTYPE_HORSE)) { + std::shared_ptr horse = + std::dynamic_pointer_cast(entity); + if (horse->isAdult()) m_eHorseType = horse->getType(); + } +} \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/HorseChoiceTask.h b/Minecraft.Client/Platform/Common/Tutorial/HorseChoiceTask.h new file mode 100644 index 000000000..f89c1207f --- /dev/null +++ b/Minecraft.Client/Platform/Common/Tutorial/HorseChoiceTask.h @@ -0,0 +1,23 @@ +#pragma once + +#include "ChoiceTask.h" + +// Same as choice task, but switches description based on horse type. +class HorseChoiceTask : public ChoiceTask { +protected: + int m_eHorseType; + + int m_iDescHorse, m_iDescDonkey, m_iDescMule; + +public: + HorseChoiceTask( + Tutorial* tutorial, int iDescHorse, int iDescDonkey, int iDescMule, + int iPromptId = -1, bool requiresUserInput = false, + int iConfirmMapping = 0, int iCancelMapping = 0, + eTutorial_CompletionAction cancelAction = e_Tutorial_Completion_None, + ETelemetryChallenges telemetryEvent = eTelemetryChallenges_Unknown); + + virtual int getDescriptionId(); + + virtual void onLookAtEntity(std::shared_ptr entity); +}; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/InfoTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/InfoTask.cpp index cbeaab82c..2149d03e3 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/InfoTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/InfoTask.cpp @@ -8,132 +8,118 @@ #include "InfoTask.h" #include "../../Minecraft.World/Blocks/Material.h" -InfoTask::InfoTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/, - int iMapping /*= 0*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/) - : TutorialTask( tutorial, descriptionId, false, NULL, true, false, false ) -{ - if(requiresUserInput == true) - { - constraints.push_back( new InputConstraint( iMapping ) ); - } - completedMappings[iMapping]=false; +InfoTask::InfoTask( + Tutorial* tutorial, int descriptionId, int promptId /*= -1*/, + bool requiresUserInput /*= false*/, int iMapping /*= 0*/, + ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/) + : TutorialTask(tutorial, descriptionId, false, NULL, true, false, false) { + if (requiresUserInput == true) { + constraints.push_back(new InputConstraint(iMapping)); + } + completedMappings[iMapping] = false; - m_promptId = promptId; - tutorial->addMessage( m_promptId ); + m_promptId = promptId; + tutorial->addMessage(m_promptId); - m_eTelemetryEvent = telemetryEvent; + m_eTelemetryEvent = telemetryEvent; } -bool InfoTask::isCompleted() -{ - if( bIsCompleted ) - return true; +bool InfoTask::isCompleted() { + if (bIsCompleted) return true; - if( tutorial->m_hintDisplayed ) - return false; + if (tutorial->m_hintDisplayed) return false; - if( !bHasBeenActivated || !m_bShownForMinimumTime ) - return false; + if (!bHasBeenActivated || !m_bShownForMinimumTime) return false; - bool bAllComplete = true; - - Minecraft *pMinecraft = Minecraft::GetInstance(); + bool bAllComplete = true; - // If the player is under water then allow all keypresses so they can jump out - if( pMinecraft->localplayers[tutorial->getPad()]->isUnderLiquid(Material::water) ) return false; + Minecraft* pMinecraft = Minecraft::GetInstance(); - if(ui.GetMenuDisplayed(tutorial->getPad())) - { - // If a menu is displayed, then we use the handleUIInput to complete the task - bAllComplete = true; - for(AUTO_VAR(it, completedMappings.begin()); it != completedMappings.end(); ++it) - { - bool current = (*it).second; - if(!current) - { - bAllComplete = false; - break; - } - } - } - else - { - int iCurrent=0; + // If the player is under water then allow all keypresses so they can jump + // out + if (pMinecraft->localplayers[tutorial->getPad()]->isUnderLiquid( + Material::water)) + return false; - for(AUTO_VAR(it, completedMappings.begin()); it != completedMappings.end(); ++it) - { - bool current = (*it).second; - if(!current) - { - if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0 ) - { - (*it).second = true; - bAllComplete=true; - } - else - { - bAllComplete = false; - } - } - iCurrent++; - } - } + if (ui.GetMenuDisplayed(tutorial->getPad())) { + // If a menu is displayed, then we use the handleUIInput to complete the + // task + bAllComplete = true; + for (AUTO_VAR(it, completedMappings.begin()); + it != completedMappings.end(); ++it) { + bool current = (*it).second; + if (!current) { + bAllComplete = false; + break; + } + } + } else { + int iCurrent = 0; - if(bAllComplete==true) - { - sendTelemetry(); - enableConstraints(false, true); - } - bIsCompleted = bAllComplete; - return bAllComplete; + for (AUTO_VAR(it, completedMappings.begin()); + it != completedMappings.end(); ++it) { + bool current = (*it).second; + if (!current) { + if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), + (*it).first) > 0) { + (*it).second = true; + bAllComplete = true; + } else { + bAllComplete = false; + } + } + iCurrent++; + } + } + + if (bAllComplete == true) { + sendTelemetry(); + enableConstraints(false, true); + } + bIsCompleted = bAllComplete; + return bAllComplete; } -int InfoTask::getPromptId() -{ - if( m_bShownForMinimumTime ) - return m_promptId; - else - return -1; +int InfoTask::getPromptId() { + if (m_bShownForMinimumTime) + return m_promptId; + else + return -1; } -void InfoTask::setAsCurrentTask(bool active /*= true*/) -{ - enableConstraints( active ); - TutorialTask::setAsCurrentTask(active); +void InfoTask::setAsCurrentTask(bool active /*= true*/) { + enableConstraints(active); + TutorialTask::setAsCurrentTask(active); } -void InfoTask::handleUIInput(int iAction) -{ - if(bHasBeenActivated) - { - for(AUTO_VAR(it, completedMappings.begin()); it != completedMappings.end(); ++it) - { - if( iAction == (*it).first ) - { - (*it).second = true; - } - } - } +void InfoTask::handleUIInput(int iAction) { + if (bHasBeenActivated) { + for (AUTO_VAR(it, completedMappings.begin()); + it != completedMappings.end(); ++it) { + if (iAction == (*it).first) { + (*it).second = true; + } + } + } } +void InfoTask::sendTelemetry() { + Minecraft* pMinecraft = Minecraft::GetInstance(); -void InfoTask::sendTelemetry() -{ - Minecraft *pMinecraft = Minecraft::GetInstance(); - - if( m_eTelemetryEvent != eTelemetryChallenges_Unknown ) - { - bool firstPlay = true; - // We only store first play for some of the events - switch(m_eTelemetryEvent) - { - case eTelemetryTutorial_Complete: - firstPlay = !tutorial->getCompleted( eTutorial_Telemetry_Complete ); - tutorial->setCompleted( eTutorial_Telemetry_Complete ); - break; - default: - break; - }; - TelemetryManager->RecordEnemyKilledOrOvercome(pMinecraft->player->GetXboxPad(), 0, 0, 0, 0, 0, 0, m_eTelemetryEvent); - } + if (m_eTelemetryEvent != eTelemetryChallenges_Unknown) { + bool firstPlay = true; + // We only store first play for some of the events + switch (m_eTelemetryEvent) { + case eTelemetryTutorial_Complete: + firstPlay = + !tutorial->getCompleted(eTutorial_Telemetry_Complete); + tutorial->setCompleted(eTutorial_Telemetry_Complete); + break; + default: + break; + }; + TelemetryManager->RecordEnemyKilledOrOvercome( + pMinecraft->player->GetXboxPad(), 0, 0, 0, 0, 0, 0, + m_eTelemetryEvent); + } } diff --git a/Minecraft.Client/Platform/Common/Tutorial/InfoTask.h b/Minecraft.Client/Platform/Common/Tutorial/InfoTask.h index 1362ad52c..37905f48b 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/InfoTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/InfoTask.h @@ -1,25 +1,27 @@ #pragma once -//using namespace std; +// using namespace std; #include "TutorialTask.h" // Information messages -class InfoTask : public TutorialTask -{ +class InfoTask : public TutorialTask { private: - std::unordered_map completedMappings; + std::unordered_map completedMappings; - ETelemetryChallenges m_eTelemetryEvent; + ETelemetryChallenges m_eTelemetryEvent; + + bool CompletionMaskIsValid(); - bool CompletionMaskIsValid(); public: - InfoTask(Tutorial *tutorial, int descriptionId, int promptId = -1, bool requiresUserInput = false, int iMapping = 0, ETelemetryChallenges telemetryEvent = eTelemetryChallenges_Unknown); - virtual bool isCompleted(); - virtual int getPromptId(); - virtual void setAsCurrentTask(bool active = true); - virtual void handleUIInput(int iAction); + InfoTask( + Tutorial* tutorial, int descriptionId, int promptId = -1, + bool requiresUserInput = false, int iMapping = 0, + ETelemetryChallenges telemetryEvent = eTelemetryChallenges_Unknown); + virtual bool isCompleted(); + virtual int getPromptId(); + virtual void setAsCurrentTask(bool active = true); + virtual void handleUIInput(int iAction); private: - void sendTelemetry(); - + void sendTelemetry(); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/InputConstraint.cpp b/Minecraft.Client/Platform/Common/Tutorial/InputConstraint.cpp index 68368e56e..5037d260b 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/InputConstraint.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/InputConstraint.cpp @@ -1,18 +1,18 @@ #include "../../Minecraft.World/Platform/stdafx.h" #include "InputConstraint.h" -bool InputConstraint::isMappingConstrained(int iPad, int mapping) -{ - // If it's a menu button, then we ignore all inputs - if((m_inputMapping == mapping) || (mapping < ACTION_MAX_MENU)) - { - return true; - } - - // Otherwise see if they map to the same actual button - unsigned char layoutMapping = InputManager.GetJoypadMapVal( iPad ); +bool InputConstraint::isMappingConstrained(int iPad, int mapping) { + // If it's a menu button, then we ignore all inputs + if ((m_inputMapping == mapping) || (mapping < ACTION_MAX_MENU)) { + return true; + } - // 4J HEG - Replaced the equivalance test with bitwise AND, important in some mapping configurations - // (e.g. when comparing two action map values and one has extra buttons mapped) - return (InputManager.GetGameJoypadMaps(layoutMapping,m_inputMapping) & InputManager.GetGameJoypadMaps(layoutMapping,mapping)) > 0; + // Otherwise see if they map to the same actual button + unsigned char layoutMapping = InputManager.GetJoypadMapVal(iPad); + + // 4J HEG - Replaced the equivalance test with bitwise AND, important in + // some mapping configurations (e.g. when comparing two action map values + // and one has extra buttons mapped) + return (InputManager.GetGameJoypadMaps(layoutMapping, m_inputMapping) & + InputManager.GetGameJoypadMaps(layoutMapping, mapping)) > 0; } diff --git a/Minecraft.Client/Platform/Common/Tutorial/InputConstraint.h b/Minecraft.Client/Platform/Common/Tutorial/InputConstraint.h index 3d6bee61b..377bf693b 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/InputConstraint.h +++ b/Minecraft.Client/Platform/Common/Tutorial/InputConstraint.h @@ -2,14 +2,14 @@ #include "TutorialConstraint.h" -class InputConstraint : public TutorialConstraint -{ +class InputConstraint : public TutorialConstraint { private: - int m_inputMapping; // Should be one of the EControllerActions -public: - virtual ConstraintType getType() { return e_ConstraintInput; } + int m_inputMapping; // Should be one of the EControllerActions +public: + virtual ConstraintType getType() { return e_ConstraintInput; } - InputConstraint(int mapping) : TutorialConstraint(-1), m_inputMapping( mapping ) {} + InputConstraint(int mapping) + : TutorialConstraint(-1), m_inputMapping(mapping) {} - virtual bool isMappingConstrained(int iPad, int mapping); + virtual bool isMappingConstrained(int iPad, int mapping); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/LookAtEntityHint.cpp b/Minecraft.Client/Platform/Common/Tutorial/LookAtEntityHint.cpp index 1e4bcb22b..2c7eff378 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/LookAtEntityHint.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/LookAtEntityHint.cpp @@ -2,24 +2,23 @@ #include "Tutorial.h" #include "LookAtEntityHint.h" - -LookAtEntityHint::LookAtEntityHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, int titleId, eINSTANCEOF type) - : TutorialHint(id, tutorial, descriptionId, e_Hint_LookAtEntity) -{ - m_type = type; - m_titleId = titleId; +LookAtEntityHint::LookAtEntityHint(eTutorial_Hint id, Tutorial* tutorial, + int descriptionId, int titleId, + eINSTANCEOF type) + : TutorialHint(id, tutorial, descriptionId, e_Hint_LookAtEntity) { + m_type = type; + m_titleId = titleId; } -bool LookAtEntityHint::onLookAtEntity(eINSTANCEOF type) -{ - if(m_type == type) - { - // Display hint - Tutorial::PopupMessageDetails *message = new Tutorial::PopupMessageDetails(); - message->m_messageId = m_descriptionId; - message->m_titleId = m_titleId; - message->m_delay = true; - return m_tutorial->setMessage(this, message); - } - return false; +bool LookAtEntityHint::onLookAtEntity(eINSTANCEOF type) { + if (m_type == type) { + // Display hint + Tutorial::PopupMessageDetails* message = + new Tutorial::PopupMessageDetails(); + message->m_messageId = m_descriptionId; + message->m_titleId = m_titleId; + message->m_delay = true; + return m_tutorial->setMessage(this, message); + } + return false; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/LookAtEntityHint.h b/Minecraft.Client/Platform/Common/Tutorial/LookAtEntityHint.h index 035a88e68..fdd209517 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/LookAtEntityHint.h +++ b/Minecraft.Client/Platform/Common/Tutorial/LookAtEntityHint.h @@ -1,21 +1,21 @@ #pragma once -//using namespace std; +// using namespace std; #include "../../Minecraft.World/Util/Class.h" #include "TutorialHint.h" class ItemInstance; -class LookAtEntityHint : public TutorialHint -{ +class LookAtEntityHint : public TutorialHint { private: - eINSTANCEOF m_type; - int m_titleId; + eINSTANCEOF m_type; + int m_titleId; public: - LookAtEntityHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, int titleId, eINSTANCEOF type); - //TODO: 4jcraft added, this was not implemented - ~LookAtEntityHint(){}; + LookAtEntityHint(eTutorial_Hint id, Tutorial* tutorial, int descriptionId, + int titleId, eINSTANCEOF type); + // TODO: 4jcraft added, this was not implemented + ~LookAtEntityHint() {}; - virtual bool onLookAtEntity(eINSTANCEOF type); + virtual bool onLookAtEntity(eINSTANCEOF type); }; diff --git a/Minecraft.Client/Platform/Common/Tutorial/LookAtTileHint.cpp b/Minecraft.Client/Platform/Common/Tutorial/LookAtTileHint.cpp index 760d5b54f..d79d0e679 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/LookAtTileHint.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/LookAtTileHint.cpp @@ -4,66 +4,56 @@ #include "Tutorial.h" #include "LookAtTileHint.h" +LookAtTileHint::LookAtTileHint(eTutorial_Hint id, Tutorial* tutorial, + int tiles[], unsigned int tilesLength, + int iconOverride /*= -1*/, int iData /* = -1 */, + int iDataOverride /*= -1*/) + : TutorialHint(id, tutorial, -1, e_Hint_LookAtTile) { + m_iTilesCount = tilesLength; -LookAtTileHint::LookAtTileHint(eTutorial_Hint id, Tutorial *tutorial, int tiles[], unsigned int tilesLength, int iconOverride /*= -1*/, int iData /* = -1 */, int iDataOverride /*= -1*/) - : TutorialHint(id, tutorial, -1, e_Hint_LookAtTile) -{ - m_iTilesCount = tilesLength; + // TODO: 4jcraft: allocating but never freeing mem, leak + m_iTiles = new int[m_iTilesCount]; + for (unsigned int i = 0; i < m_iTilesCount; i++) { + m_iTiles[i] = tiles[i]; + } - //TODO: 4jcraft: allocating but never freeing mem, leak - m_iTiles= new int [m_iTilesCount]; - for(unsigned int i=0;i 0 && id < 256 && (m_iData == -1 || m_iData == iData) ) - { - bool itemFound = false; - for(unsigned int i=0;im_delay = true; - if( m_iconOverride >= 0 ) - { - message->m_icon = m_iconOverride; - } - else if(m_iconOverride == -2) - { - message->m_icon = TUTORIAL_NO_ICON; - } - else - { - message->m_icon = id; - if(m_iDataOverride > -1) - { - message->m_iAuxVal = m_iDataOverride; - } - else - { - message->m_iAuxVal = iData; - } - } - message->m_messageId = Item::items[id]->getUseDescriptionId(); - message->m_titleId = Item::items[id]->getDescriptionId(message->m_iAuxVal); - return m_tutorial->setMessage(this, message); - } - } - return false; +bool LookAtTileHint::onLookAt(int id, int iData) { + if (id > 0 && id < 256 && (m_iData == -1 || m_iData == iData)) { + bool itemFound = false; + for (unsigned int i = 0; i < m_iTilesCount; i++) { + if (id == m_iTiles[i]) { + itemFound = true; + break; + } + } + if (itemFound) { + // Display hint + Tutorial::PopupMessageDetails* message = + new Tutorial::PopupMessageDetails(); + message->m_delay = true; + if (m_iconOverride >= 0) { + message->m_icon = m_iconOverride; + } else if (m_iconOverride == -2) { + message->m_icon = TUTORIAL_NO_ICON; + } else { + message->m_icon = id; + } + + // 4J-JEV: Moved to keep data override even if we're overriding the + // icon as well. + message->m_iAuxVal = + (m_iDataOverride > -1) ? m_iDataOverride : iData; + + message->m_messageId = Item::items[id]->getUseDescriptionId(); + message->m_titleId = + Item::items[id]->getDescriptionId(message->m_iAuxVal); + return m_tutorial->setMessage(this, message); + } + } + return false; } diff --git a/Minecraft.Client/Platform/Common/Tutorial/LookAtTileHint.h b/Minecraft.Client/Platform/Common/Tutorial/LookAtTileHint.h index b3d90ed4c..868662264 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/LookAtTileHint.h +++ b/Minecraft.Client/Platform/Common/Tutorial/LookAtTileHint.h @@ -1,23 +1,24 @@ #pragma once -//using namespace std; +// using namespace std; #include "TutorialHint.h" class ItemInstance; -class LookAtTileHint : public TutorialHint -{ +class LookAtTileHint : public TutorialHint { private: - int *m_iTiles; - unsigned int m_iTilesCount; - int m_iconOverride; - int m_iData; - int m_iDataOverride; + int* m_iTiles; + unsigned int m_iTilesCount; + int m_iconOverride; + int m_iData; + int m_iDataOverride; public: - LookAtTileHint(eTutorial_Hint id, Tutorial *tutorial, int tiles[], unsigned int tilesLength, int iconOverride = -1, int iData=-1, int iDataOverride = -1); - //TODO: 4jcraft, added, destructor was never implemented - ~LookAtTileHint(){}; + LookAtTileHint(eTutorial_Hint id, Tutorial* tutorial, int tiles[], + unsigned int tilesLength, int iconOverride = -1, + int iData = -1, int iDataOverride = -1); + // TODO: 4jcraft, added, destructor was never implemented + ~LookAtTileHint() {}; - virtual bool onLookAt(int id, int iData=0); + virtual bool onLookAt(int id, int iData = 0); }; diff --git a/Minecraft.Client/Platform/Common/Tutorial/PickupTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/PickupTask.cpp index ba0084473..544ede0b4 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/PickupTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/PickupTask.cpp @@ -1,17 +1,15 @@ #include "../../Minecraft.World/Platform/stdafx.h" #include "PickupTask.h" -void PickupTask::onTake(std::shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) -{ - if(item->id == m_itemId) - { - if(m_auxValue == -1 && invItemCountAnyAux >= m_quantity) - { - bIsCompleted = true; - } - else if( m_auxValue == item->getAuxValue() && invItemCountThisAux >= m_quantity) - { - bIsCompleted = true; - } - } +void PickupTask::onTake(std::shared_ptr item, + unsigned int invItemCountAnyAux, + unsigned int invItemCountThisAux) { + if (item->id == m_itemId) { + if (m_auxValue == -1 && invItemCountAnyAux >= m_quantity) { + bIsCompleted = true; + } else if (m_auxValue == item->getAuxValue() && + invItemCountThisAux >= m_quantity) { + bIsCompleted = true; + } + } } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/PickupTask.h b/Minecraft.Client/Platform/Common/Tutorial/PickupTask.h index 91b800212..b5f070416 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/PickupTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/PickupTask.h @@ -1,26 +1,31 @@ #pragma once -//using namespace std; +// using namespace std; #include "TutorialTask.h" class ItemInstance; -class PickupTask : public TutorialTask -{ +class PickupTask : public TutorialTask { public: - PickupTask( int itemId, unsigned int quantity, int auxValue, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, std::vector *inConstraints = NULL, - bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) - : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), - m_itemId( itemId), - m_quantity( quantity ), - m_auxValue( auxValue ) - {} + PickupTask(int itemId, unsigned int quantity, int auxValue, + Tutorial* tutorial, int descriptionId, + bool enablePreCompletion = true, + std::vector* inConstraints = NULL, + bool bShowMinimumTime = false, bool bAllowFade = true, + bool m_bTaskReminders = true) + : TutorialTask(tutorial, descriptionId, enablePreCompletion, + inConstraints, bShowMinimumTime, bAllowFade, + m_bTaskReminders), + m_itemId(itemId), + m_quantity(quantity), + m_auxValue(auxValue) {} - virtual bool isCompleted() { return bIsCompleted; } - virtual void onTake(std::shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux); + virtual bool isCompleted() { return bIsCompleted; } + virtual void onTake(std::shared_ptr item, + unsigned int invItemCountAnyAux, + unsigned int invItemCountThisAux); private: - int m_itemId; - unsigned int m_quantity; - int m_auxValue; + int m_itemId; + unsigned int m_quantity; + int m_auxValue; }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/ProcedureCompoundTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/ProcedureCompoundTask.cpp index 3ac555b18..5850ee83f 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/ProcedureCompoundTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/ProcedureCompoundTask.cpp @@ -1,263 +1,213 @@ #include "../../Minecraft.World/Platform/stdafx.h" #include "ProcedureCompoundTask.h" -ProcedureCompoundTask::~ProcedureCompoundTask() -{ - for(AUTO_VAR(it, m_taskSequence.begin()); it < m_taskSequence.end(); ++it) - { - delete (*it); - } +ProcedureCompoundTask::~ProcedureCompoundTask() { + for (AUTO_VAR(it, m_taskSequence.begin()); it < m_taskSequence.end(); + ++it) { + delete (*it); + } } -void ProcedureCompoundTask::AddTask(TutorialTask *task) -{ - if(task != NULL) - { - m_taskSequence.push_back(task); - } +void ProcedureCompoundTask::AddTask(TutorialTask* task) { + if (task != NULL) { + m_taskSequence.push_back(task); + } } -int ProcedureCompoundTask::getDescriptionId() -{ - if(bIsCompleted) - return -1; +int ProcedureCompoundTask::getDescriptionId() { + if (bIsCompleted) return -1; - // Return the id of the first task not completed - int descriptionId = -1; - AUTO_VAR(itEnd, m_taskSequence.end()); - for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) - { - TutorialTask *task = *it; - if(!task->isCompleted()) - { - task->setAsCurrentTask(true); - descriptionId = task->getDescriptionId(); - break; - } - else if(task->getCompletionAction() == e_Tutorial_Completion_Complete_State) - { - bIsCompleted = true; - break; - } - } - return descriptionId; + // Return the id of the first task not completed + int descriptionId = -1; + AUTO_VAR(itEnd, m_taskSequence.end()); + for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + TutorialTask* task = *it; + if (!task->isCompleted()) { + task->setAsCurrentTask(true); + descriptionId = task->getDescriptionId(); + break; + } else if (task->getCompletionAction() == + e_Tutorial_Completion_Complete_State) { + bIsCompleted = true; + break; + } + } + return descriptionId; } -int ProcedureCompoundTask::getPromptId() -{ - if(bIsCompleted) - return -1; +int ProcedureCompoundTask::getPromptId() { + if (bIsCompleted) return -1; - // Return the id of the first task not completed - int promptId = -1; - AUTO_VAR(itEnd, m_taskSequence.end()); - for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) - { - TutorialTask *task = *it; - if(!task->isCompleted()) - { - promptId = task->getPromptId(); - break; - } - } - return promptId; + // Return the id of the first task not completed + int promptId = -1; + AUTO_VAR(itEnd, m_taskSequence.end()); + for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + TutorialTask* task = *it; + if (!task->isCompleted()) { + promptId = task->getPromptId(); + break; + } + } + return promptId; } -bool ProcedureCompoundTask::isCompleted() -{ - // Return whether all tasks are completed +bool ProcedureCompoundTask::isCompleted() { + // Return whether all tasks are completed - bool allCompleted = true; - bool isCurrentTask = true; - AUTO_VAR(itEnd, m_taskSequence.end()); - for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) - { - TutorialTask *task = *it; + bool allCompleted = true; + bool isCurrentTask = true; + AUTO_VAR(itEnd, m_taskSequence.end()); + for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + TutorialTask* task = *it; - if(allCompleted && isCurrentTask) - { - if(task->isCompleted()) - { - if(task->getCompletionAction() == e_Tutorial_Completion_Complete_State) - { - allCompleted = true; - break; - } - } - else - { - task->setAsCurrentTask(true); - allCompleted = false; - isCurrentTask = false; - } - } - else if (!allCompleted) - { - task->setAsCurrentTask(false); - } - } + if (allCompleted && isCurrentTask) { + if (task->isCompleted()) { + if (task->getCompletionAction() == + e_Tutorial_Completion_Complete_State) { + allCompleted = true; + break; + } + } else { + task->setAsCurrentTask(true); + allCompleted = false; + isCurrentTask = false; + } + } else if (!allCompleted) { + task->setAsCurrentTask(false); + } + } - if(allCompleted) - { - //Disable all constraints - itEnd = m_taskSequence.end(); - for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) - { - TutorialTask *task = *it; - task->enableConstraints(false); - } - } - bIsCompleted = allCompleted; - return allCompleted; + if (allCompleted) { + // Disable all constraints + itEnd = m_taskSequence.end(); + for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + TutorialTask* task = *it; + task->enableConstraints(false); + } + } + bIsCompleted = allCompleted; + return allCompleted; } -void ProcedureCompoundTask::onCrafted(std::shared_ptr item) -{ - AUTO_VAR(itEnd, m_taskSequence.end()); - for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) - { - TutorialTask *task = *it; - task->onCrafted(item); - } +void ProcedureCompoundTask::onCrafted(std::shared_ptr item) { + AUTO_VAR(itEnd, m_taskSequence.end()); + for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + TutorialTask* task = *it; + task->onCrafted(item); + } } -void ProcedureCompoundTask::handleUIInput(int iAction) -{ - AUTO_VAR(itEnd, m_taskSequence.end()); - for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) - { - TutorialTask *task = *it; - task->handleUIInput(iAction); - } +void ProcedureCompoundTask::handleUIInput(int iAction) { + AUTO_VAR(itEnd, m_taskSequence.end()); + for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + TutorialTask* task = *it; + task->handleUIInput(iAction); + } } - -void ProcedureCompoundTask::setAsCurrentTask(bool active /*= true*/) -{ - bool allCompleted = true; - AUTO_VAR(itEnd, m_taskSequence.end()); - for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) - { - TutorialTask *task = *it; - if(allCompleted && !task->isCompleted()) - { - task->setAsCurrentTask(true); - allCompleted = false; - } - else if (!allCompleted) - { - task->setAsCurrentTask(false); - } - } +void ProcedureCompoundTask::setAsCurrentTask(bool active /*= true*/) { + bool allCompleted = true; + AUTO_VAR(itEnd, m_taskSequence.end()); + for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + TutorialTask* task = *it; + if (allCompleted && !task->isCompleted()) { + task->setAsCurrentTask(true); + allCompleted = false; + } else if (!allCompleted) { + task->setAsCurrentTask(false); + } + } } -bool ProcedureCompoundTask::ShowMinimumTime() -{ - if(bIsCompleted) - return false; +bool ProcedureCompoundTask::ShowMinimumTime() { + if (bIsCompleted) return false; - bool showMinimumTime = false; - AUTO_VAR(itEnd, m_taskSequence.end()); - for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) - { - TutorialTask *task = *it; - if(!task->isCompleted()) - { - showMinimumTime = task->ShowMinimumTime(); - break; - } - } - return showMinimumTime; + bool showMinimumTime = false; + AUTO_VAR(itEnd, m_taskSequence.end()); + for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + TutorialTask* task = *it; + if (!task->isCompleted()) { + showMinimumTime = task->ShowMinimumTime(); + break; + } + } + return showMinimumTime; } -bool ProcedureCompoundTask::hasBeenActivated() -{ - if(bIsCompleted) - return true; +bool ProcedureCompoundTask::hasBeenActivated() { + if (bIsCompleted) return true; - bool hasBeenActivated = false; - AUTO_VAR(itEnd, m_taskSequence.end()); - for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) - { - TutorialTask *task = *it; - if(!task->isCompleted()) - { - hasBeenActivated = task->hasBeenActivated(); - break; - } - } - return hasBeenActivated; + bool hasBeenActivated = false; + AUTO_VAR(itEnd, m_taskSequence.end()); + for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + TutorialTask* task = *it; + if (!task->isCompleted()) { + hasBeenActivated = task->hasBeenActivated(); + break; + } + } + return hasBeenActivated; } -void ProcedureCompoundTask::setShownForMinimumTime() -{ - AUTO_VAR(itEnd, m_taskSequence.end()); - for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) - { - TutorialTask *task = *it; - if(!task->isCompleted()) - { - task->setShownForMinimumTime(); - break; - } - } +void ProcedureCompoundTask::setShownForMinimumTime() { + AUTO_VAR(itEnd, m_taskSequence.end()); + for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + TutorialTask* task = *it; + if (!task->isCompleted()) { + task->setShownForMinimumTime(); + break; + } + } } -bool ProcedureCompoundTask::AllowFade() -{ - if(bIsCompleted) - return true; +bool ProcedureCompoundTask::AllowFade() { + if (bIsCompleted) return true; - bool allowFade = true; - AUTO_VAR(itEnd, m_taskSequence.end()); - for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) - { - TutorialTask *task = *it; - if(!task->isCompleted()) - { - allowFade = task->AllowFade(); - break; - } - } - return allowFade; + bool allowFade = true; + AUTO_VAR(itEnd, m_taskSequence.end()); + for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + TutorialTask* task = *it; + if (!task->isCompleted()) { + allowFade = task->AllowFade(); + break; + } + } + return allowFade; } -void ProcedureCompoundTask::useItemOn(Level *level, std::shared_ptr item, int x, int y, int z,bool bTestUseOnly) -{ - AUTO_VAR(itEnd, m_taskSequence.end()); - for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) - { - TutorialTask *task = *it; - task->useItemOn(level, item, x, y, z, bTestUseOnly); - } +void ProcedureCompoundTask::useItemOn(Level* level, + std::shared_ptr item, int x, + int y, int z, bool bTestUseOnly) { + AUTO_VAR(itEnd, m_taskSequence.end()); + for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + TutorialTask* task = *it; + task->useItemOn(level, item, x, y, z, bTestUseOnly); + } } -void ProcedureCompoundTask::useItem(std::shared_ptr item, bool bTestUseOnly) -{ - AUTO_VAR(itEnd, m_taskSequence.end()); - for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) - { - TutorialTask *task = *it; - task->useItem(item, bTestUseOnly); - } +void ProcedureCompoundTask::useItem(std::shared_ptr item, + bool bTestUseOnly) { + AUTO_VAR(itEnd, m_taskSequence.end()); + for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + TutorialTask* task = *it; + task->useItem(item, bTestUseOnly); + } } -void ProcedureCompoundTask::onTake(std::shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) -{ - AUTO_VAR(itEnd, m_taskSequence.end()); - for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) - { - TutorialTask *task = *it; - task->onTake(item, invItemCountAnyAux, invItemCountThisAux); - } +void ProcedureCompoundTask::onTake(std::shared_ptr item, + unsigned int invItemCountAnyAux, + unsigned int invItemCountThisAux) { + AUTO_VAR(itEnd, m_taskSequence.end()); + for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + TutorialTask* task = *it; + task->onTake(item, invItemCountAnyAux, invItemCountThisAux); + } } -void ProcedureCompoundTask::onStateChange(eTutorial_State newState) -{ - AUTO_VAR(itEnd, m_taskSequence.end()); - for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) - { - TutorialTask *task = *it; - task->onStateChange(newState); - } +void ProcedureCompoundTask::onStateChange(eTutorial_State newState) { + AUTO_VAR(itEnd, m_taskSequence.end()); + for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + TutorialTask* task = *it; + task->onStateChange(newState); + } } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/ProcedureCompoundTask.h b/Minecraft.Client/Platform/Common/Tutorial/ProcedureCompoundTask.h index 9be159aad..2e0ea82e5 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/ProcedureCompoundTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/ProcedureCompoundTask.h @@ -2,35 +2,38 @@ #include "TutorialTask.h" -// A tutorial task that requires each of the task to be completed in order until the last one is complete. -// If an earlier task that was complete is now not complete then it's hint should be shown. -class ProcedureCompoundTask : public TutorialTask -{ +// A tutorial task that requires each of the task to be completed in order until +// the last one is complete. If an earlier task that was complete is now not +// complete then it's hint should be shown. +class ProcedureCompoundTask : public TutorialTask { public: - ProcedureCompoundTask(Tutorial *tutorial ) - : TutorialTask(tutorial, -1, false, NULL, false, true, false ) - {} + ProcedureCompoundTask(Tutorial* tutorial) + : TutorialTask(tutorial, -1, false, NULL, false, true, false) {} - ~ProcedureCompoundTask(); + ~ProcedureCompoundTask(); - void AddTask(TutorialTask *task); + void AddTask(TutorialTask* task); - virtual int getDescriptionId(); - virtual int getPromptId(); - virtual bool isCompleted(); - virtual void onCrafted(std::shared_ptr item); - virtual void handleUIInput(int iAction); - virtual void setAsCurrentTask(bool active = true); - virtual bool ShowMinimumTime(); - virtual bool hasBeenActivated(); - virtual void setShownForMinimumTime(); - virtual bool AllowFade(); + virtual int getDescriptionId(); + virtual int getPromptId(); + virtual bool isCompleted(); + virtual void onCrafted(std::shared_ptr item); + virtual void handleUIInput(int iAction); + virtual void setAsCurrentTask(bool active = true); + virtual bool ShowMinimumTime(); + virtual bool hasBeenActivated(); + virtual void setShownForMinimumTime(); + virtual bool AllowFade(); - virtual void useItemOn(Level *level, std::shared_ptr item, int x, int y, int z, bool bTestUseOnly=false); - virtual void useItem(std::shared_ptr item, bool bTestUseOnly=false); - virtual void onTake(std::shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux); - virtual void onStateChange(eTutorial_State newState); + virtual void useItemOn(Level* level, std::shared_ptr item, + int x, int y, int z, bool bTestUseOnly = false); + virtual void useItem(std::shared_ptr item, + bool bTestUseOnly = false); + virtual void onTake(std::shared_ptr item, + unsigned int invItemCountAnyAux, + unsigned int invItemCountThisAux); + virtual void onStateChange(eTutorial_State newState); private: - std::vector m_taskSequence; + std::vector m_taskSequence; }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/ProgressFlagTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/ProgressFlagTask.cpp index f68af17ec..6c849e030 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/ProgressFlagTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/ProgressFlagTask.cpp @@ -1,17 +1,15 @@ #include "../../Minecraft.World/Platform/stdafx.h" #include "ProgressFlagTask.h" -bool ProgressFlagTask::isCompleted() -{ - switch( m_type ) - { - case e_Progress_Set_Flag: - (*flags) |= m_mask; - bIsCompleted = true; - break; - case e_Progress_Flag_On: - bIsCompleted = ((*flags) & m_mask) == m_mask; - break; - } - return bIsCompleted; +bool ProgressFlagTask::isCompleted() { + switch (m_type) { + case e_Progress_Set_Flag: + (*flags) |= m_mask; + bIsCompleted = true; + break; + case e_Progress_Flag_On: + bIsCompleted = ((*flags) & m_mask) == m_mask; + break; + } + return bIsCompleted; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/ProgressFlagTask.h b/Minecraft.Client/Platform/Common/Tutorial/ProgressFlagTask.h index 1d51c1751..2d12cb11a 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/ProgressFlagTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/ProgressFlagTask.h @@ -1,25 +1,27 @@ #pragma once -//using namespace std; +// using namespace std; #include "Tutorial.h" #include "TutorialTask.h" -class ProgressFlagTask : public TutorialTask -{ +class ProgressFlagTask : public TutorialTask { public: - enum EProgressFlagType - { - e_Progress_Set_Flag, - e_Progress_Flag_On, - }; -private: - char *flags; // Not a member of this object - char m_mask; - EProgressFlagType m_type; -public: - ProgressFlagTask(char *flags, char mask, EProgressFlagType type, Tutorial *tutorial ) : - TutorialTask(tutorial, -1, false, NULL ), - flags( flags ), m_mask( mask ), m_type( type ) - {} + enum EProgressFlagType { + e_Progress_Set_Flag, + e_Progress_Flag_On, + }; - virtual bool isCompleted(); +private: + char* flags; // Not a member of this object + char m_mask; + EProgressFlagType m_type; + +public: + ProgressFlagTask(char* flags, char mask, EProgressFlagType type, + Tutorial* tutorial) + : TutorialTask(tutorial, -1, false, NULL), + flags(flags), + m_mask(mask), + m_type(type) {} + + virtual bool isCompleted(); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/RideEntityTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/RideEntityTask.cpp new file mode 100644 index 000000000..7325da1a6 --- /dev/null +++ b/Minecraft.Client/Platform/Common/Tutorial/RideEntityTask.cpp @@ -0,0 +1,27 @@ +#include "../../stdafx.h" + +#include + +#include "../../../Minecraft.h" +#include "Tutorial.h" + +#include "../../../../Minecraft.World/Entities/Mobs/EntityHorse.h" + +#include "RideEntityTask.h" + +RideEntityTask::RideEntityTask(const int eType, Tutorial* tutorial, + int descriptionId, bool enablePreCompletion, + std::vector* inConstraints, + bool bShowMinimumTime, bool bAllowFade, + bool bTaskReminders) + : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, + bShowMinimumTime, bAllowFade, bTaskReminders), + m_eType(eType) {} + +bool RideEntityTask::isCompleted() { return bIsCompleted; } + +void RideEntityTask::onRideEntity(std::shared_ptr entity) { + if (entity->instanceof((eINSTANCEOF)m_eType)) { + bIsCompleted = true; + } +} \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/RideEntityTask.h b/Minecraft.Client/Platform/Common/Tutorial/RideEntityTask.h new file mode 100644 index 000000000..014979f1a --- /dev/null +++ b/Minecraft.Client/Platform/Common/Tutorial/RideEntityTask.h @@ -0,0 +1,22 @@ +#pragma once + +#include "TutorialTask.h" + +class Level; + +// 4J-JEV: Tasks that involve riding an entity. +class RideEntityTask : public TutorialTask { +protected: + const int m_eType; + +public: + RideEntityTask(const int eTYPE, Tutorial* tutorial, int descriptionId, + bool enablePreCompletion = false, + std::vector* inConstraints = NULL, + bool bShowMinimumTime = false, bool bAllowFade = true, + bool bTaskReminders = true); + + virtual bool isCompleted(); + + virtual void onRideEntity(std::shared_ptr entity); +}; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/StatTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/StatTask.cpp index 59534605f..dfa321daf 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/StatTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/StatTask.cpp @@ -5,21 +5,23 @@ #include "../../Minecraft.World/Headers/net.minecraft.stats.h" #include "StatTask.h" -StatTask::StatTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, Stat *stat, int variance /*= 1*/) - : TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL ) -{ - this->stat = stat; +StatTask::StatTask(Tutorial* tutorial, int descriptionId, + bool enablePreCompletion, Stat* stat, int variance /*= 1*/) + : TutorialTask(tutorial, descriptionId, enablePreCompletion, NULL) { + this->stat = stat; - Minecraft *minecraft = Minecraft::GetInstance(); - targetValue = minecraft->stats[ProfileManager.GetPrimaryPad()]->getTotalValue( stat ) + variance; + Minecraft* minecraft = Minecraft::GetInstance(); + targetValue = + minecraft->stats[ProfileManager.GetPrimaryPad()]->getTotalValue(stat) + + variance; } -bool StatTask::isCompleted() -{ - if( bIsCompleted ) - return true; +bool StatTask::isCompleted() { + if (bIsCompleted) return true; - Minecraft *minecraft = Minecraft::GetInstance(); - bIsCompleted = minecraft->stats[ProfileManager.GetPrimaryPad()]->getTotalValue( stat ) >= (unsigned int)targetValue; - return bIsCompleted; + Minecraft* minecraft = Minecraft::GetInstance(); + bIsCompleted = + minecraft->stats[ProfileManager.GetPrimaryPad()]->getTotalValue(stat) >= + (unsigned int)targetValue; + return bIsCompleted; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/StatTask.h b/Minecraft.Client/Platform/Common/Tutorial/StatTask.h index 95af208a8..02b75fb0e 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/StatTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/StatTask.h @@ -1,18 +1,19 @@ #pragma once -//using namespace std; +// using namespace std; #include "TutorialTask.h" class Stat; -// 4J Stu - Tutorial tasks that can use the current stat trackin code. This is things like blocks mined/items crafted. -class StatTask : public TutorialTask -{ +// 4J Stu - Tutorial tasks that can use the current stat trackin code. This is +// things like blocks mined/items crafted. +class StatTask : public TutorialTask { private: - Stat *stat; - int targetValue; + Stat* stat; + int targetValue; public: - StatTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, Stat *stat, int variance = 1); - virtual bool isCompleted(); + StatTask(Tutorial* tutorial, int descriptionId, bool enablePreCompletion, + Stat* stat, int variance = 1); + virtual bool isCompleted(); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/StateChangeTask.h b/Minecraft.Client/Platform/Common/Tutorial/StateChangeTask.h index 89602bf1a..a6e9b3cee 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/StateChangeTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/StateChangeTask.h @@ -1,27 +1,28 @@ #pragma once -//using namespace std; +// using namespace std; #include "Tutorial.h" #include "TutorialTask.h" -class StateChangeTask : public TutorialTask -{ +class StateChangeTask : public TutorialTask { private: - eTutorial_State m_state; + eTutorial_State m_state; + public: - StateChangeTask(eTutorial_State state, - Tutorial *tutorial, int descriptionId = -1, bool enablePreCompletion = false, std::vector *inConstraints = NULL, - bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) : - TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), - m_state( state ) - {} + StateChangeTask(eTutorial_State state, Tutorial* tutorial, + int descriptionId = -1, bool enablePreCompletion = false, + std::vector* inConstraints = NULL, + bool bShowMinimumTime = false, bool bAllowFade = true, + bool m_bTaskReminders = true) + : TutorialTask(tutorial, descriptionId, enablePreCompletion, + inConstraints, bShowMinimumTime, bAllowFade, + m_bTaskReminders), + m_state(state) {} - virtual bool isCompleted() { return bIsCompleted; } + virtual bool isCompleted() { return bIsCompleted; } - virtual void onStateChange(eTutorial_State newState) - { - if(newState == m_state) - { - bIsCompleted = true; - } - } + virtual void onStateChange(eTutorial_State newState) { + if (newState == m_state) { + bIsCompleted = true; + } + } }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/TakeItemHint.cpp b/Minecraft.Client/Platform/Common/Tutorial/TakeItemHint.cpp index 16bb9f995..ef2b973b0 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TakeItemHint.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/TakeItemHint.cpp @@ -4,42 +4,36 @@ #include "Tutorial.h" #include "TakeItemHint.h" +TakeItemHint::TakeItemHint(eTutorial_Hint id, Tutorial* tutorial, int items[], + unsigned int itemsLength) + : TutorialHint(id, tutorial, -1, e_Hint_TakeItem) { + m_iItemsCount = itemsLength; -TakeItemHint::TakeItemHint(eTutorial_Hint id, Tutorial *tutorial, int items[], unsigned int itemsLength) - : TutorialHint(id, tutorial, -1, e_Hint_TakeItem) -{ - m_iItemsCount = itemsLength; - - m_iItems= new int [m_iItemsCount]; - for(unsigned int i=0;i item) -{ - if(item != NULL) - { - bool itemFound = false; - for(unsigned int i=0;iid == m_iItems[i]) - { - itemFound = true; - break; - } - } - if(itemFound) - { - // Display hint - Tutorial::PopupMessageDetails *message = new Tutorial::PopupMessageDetails(); - message->m_messageId = item->getUseDescriptionId(); - message->m_titleId = item->getDescriptionId(); - message->m_icon = item->id; - message->m_delay = true; - return m_tutorial->setMessage(this, message); - } - } - return false; +bool TakeItemHint::onTake(std::shared_ptr item) { + if (item != NULL) { + bool itemFound = false; + for (unsigned int i = 0; i < m_iItemsCount; i++) { + if (item->id == m_iItems[i]) { + itemFound = true; + break; + } + } + if (itemFound) { + // Display hint + Tutorial::PopupMessageDetails* message = + new Tutorial::PopupMessageDetails(); + message->m_messageId = item->getUseDescriptionId(); + message->m_titleId = item->getDescriptionId(); + message->m_icon = item->id; + message->m_delay = true; + return m_tutorial->setMessage(this, message); + } + } + return false; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/TakeItemHint.h b/Minecraft.Client/Platform/Common/Tutorial/TakeItemHint.h index 4a7620b06..5992fb0ca 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TakeItemHint.h +++ b/Minecraft.Client/Platform/Common/Tutorial/TakeItemHint.h @@ -1,20 +1,20 @@ #pragma once -//using namespace std; +// using namespace std; #include "TutorialHint.h" class ItemInstance; -class TakeItemHint : public TutorialHint -{ +class TakeItemHint : public TutorialHint { private: - int *m_iItems; - unsigned int m_iItemsCount; + int* m_iItems; + unsigned int m_iItemsCount; public: - TakeItemHint(eTutorial_Hint id, Tutorial *tutorial, int items[], unsigned int itemsLength); - //TODO: 4jcraft, added, it was never implemented - virtual ~TakeItemHint(){}; + TakeItemHint(eTutorial_Hint id, Tutorial* tutorial, int items[], + unsigned int itemsLength); + // TODO: 4jcraft, added, it was never implemented + virtual ~TakeItemHint() {}; - virtual bool onTake( std::shared_ptr item ); + virtual bool onTake(std::shared_ptr item); }; diff --git a/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp b/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp index bd2cee98f..fe45db1fb 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp @@ -20,2144 +20,3052 @@ std::vector Tutorial::s_completableTasks; - int Tutorial::m_iTutorialHintDelayTime = 14000; int Tutorial::m_iTutorialDisplayMessageTime = 7000; int Tutorial::m_iTutorialMinimumDisplayMessageTime = 2000; int Tutorial::m_iTutorialExtraReminderTime = 13000; -int Tutorial::m_iTutorialReminderTime = m_iTutorialDisplayMessageTime + m_iTutorialExtraReminderTime; +int Tutorial::m_iTutorialReminderTime = + m_iTutorialDisplayMessageTime + m_iTutorialExtraReminderTime; int Tutorial::m_iTutorialConstraintDelayRemoveTicks = 15; int Tutorial::m_iTutorialFreezeTimeValue = 8000; -bool Tutorial::PopupMessageDetails::isSameContent(PopupMessageDetails *other) -{ - if(other == NULL) return false; +bool Tutorial::PopupMessageDetails::isSameContent(PopupMessageDetails* other) { + if (other == NULL) return false; - bool textTheSame = (m_messageId == other->m_messageId) && (m_messageString.compare(other->m_messageString) == 0); - bool titleTheSame = (m_titleId == other->m_titleId) && (m_titleString.compare(other->m_titleString) == 0); - bool promptTheSame = (m_promptId == other->m_promptId) && (m_promptString.compare(other->m_promptString) == 0); - return textTheSame && titleTheSame && promptTheSame; + bool textTheSame = (m_messageId == other->m_messageId) && + (m_messageString.compare(other->m_messageString) == 0); + bool titleTheSame = (m_titleId == other->m_titleId) && + (m_titleString.compare(other->m_titleString) == 0); + bool promptTheSame = (m_promptId == other->m_promptId) && + (m_promptString.compare(other->m_promptString) == 0); + return textTheSame && titleTheSame && promptTheSame; } -void Tutorial::staticCtor() -{ - // - /* - ***** - ***** - THE ORDERING OF THESE SHOULD NOT CHANGE - Although the ordering may not be totally logical due to the order tasks were added, these map - to bits in the profile data in this order. New tasks/hints should be added at the end. - ***** - ***** - */ - s_completableTasks.push_back( e_Tutorial_State_Inventory_Menu ); - s_completableTasks.push_back( e_Tutorial_State_2x2Crafting_Menu ); - s_completableTasks.push_back( e_Tutorial_State_3x3Crafting_Menu ); - s_completableTasks.push_back( e_Tutorial_State_Furnace_Menu ); +void Tutorial::staticCtor() { + // + /* + ***** + ***** + THE ORDERING OF THESE SHOULD NOT CHANGE - Although the ordering may not be + totally logical due to the order tasks were added, these map to bits in the + profile data in this order. New tasks/hints should be added at the end. + ***** + ***** + */ + s_completableTasks.push_back(e_Tutorial_State_Inventory_Menu); + s_completableTasks.push_back(e_Tutorial_State_2x2Crafting_Menu); + s_completableTasks.push_back(e_Tutorial_State_3x3Crafting_Menu); + s_completableTasks.push_back(e_Tutorial_State_Furnace_Menu); - s_completableTasks.push_back( e_Tutorial_State_Riding_Minecart ); - s_completableTasks.push_back( e_Tutorial_State_Riding_Boat ); - s_completableTasks.push_back( e_Tutorial_State_Fishing ); - s_completableTasks.push_back( e_Tutorial_State_Bed ); + s_completableTasks.push_back(e_Tutorial_State_Riding_Minecart); + s_completableTasks.push_back(e_Tutorial_State_Riding_Boat); + s_completableTasks.push_back(e_Tutorial_State_Fishing); + s_completableTasks.push_back(e_Tutorial_State_Bed); - s_completableTasks.push_back( e_Tutorial_State_Container_Menu ); - s_completableTasks.push_back( e_Tutorial_State_Trap_Menu ); - s_completableTasks.push_back( e_Tutorial_State_Redstone_And_Piston ); - s_completableTasks.push_back( e_Tutorial_State_Portal ); - s_completableTasks.push_back( e_Tutorial_State_Creative_Inventory_Menu ); - s_completableTasks.push_back( e_Tutorial_State_Food_Bar ); - s_completableTasks.push_back( e_Tutorial_State_CreativeMode ); - s_completableTasks.push_back( e_Tutorial_State_Brewing ); - s_completableTasks.push_back( e_Tutorial_State_Brewing_Menu ); - s_completableTasks.push_back( e_Tutorial_State_Enchanting ); + s_completableTasks.push_back(e_Tutorial_State_Container_Menu); + s_completableTasks.push_back(e_Tutorial_State_Trap_Menu); + s_completableTasks.push_back(e_Tutorial_State_Redstone_And_Piston); + s_completableTasks.push_back(e_Tutorial_State_Portal); + s_completableTasks.push_back(e_Tutorial_State_Creative_Inventory_Menu); + s_completableTasks.push_back(e_Tutorial_State_Food_Bar); + s_completableTasks.push_back(e_Tutorial_State_CreativeMode); + s_completableTasks.push_back(e_Tutorial_State_Brewing); + s_completableTasks.push_back(e_Tutorial_State_Brewing_Menu); + s_completableTasks.push_back(e_Tutorial_State_Enchanting); - s_completableTasks.push_back( e_Tutorial_Hint_Hold_To_Mine ); - s_completableTasks.push_back( e_Tutorial_Hint_Tool_Damaged ); - s_completableTasks.push_back( e_Tutorial_Hint_Swim_Up ); + s_completableTasks.push_back(e_Tutorial_Hint_Hold_To_Mine); + s_completableTasks.push_back(e_Tutorial_Hint_Tool_Damaged); + s_completableTasks.push_back(e_Tutorial_Hint_Swim_Up); - s_completableTasks.push_back( e_Tutorial_Hint_Unused_2 ); - s_completableTasks.push_back( e_Tutorial_Hint_Unused_3 ); - s_completableTasks.push_back( e_Tutorial_Hint_Unused_4 ); - s_completableTasks.push_back( e_Tutorial_Hint_Unused_5 ); - s_completableTasks.push_back( e_Tutorial_Hint_Unused_6 ); - s_completableTasks.push_back( e_Tutorial_Hint_Unused_7 ); - s_completableTasks.push_back( e_Tutorial_Hint_Unused_8 ); - s_completableTasks.push_back( e_Tutorial_Hint_Unused_9 ); - s_completableTasks.push_back( e_Tutorial_Hint_Unused_10 ); + s_completableTasks.push_back(e_Tutorial_Hint_Unused_2); + s_completableTasks.push_back(e_Tutorial_Hint_Unused_3); + s_completableTasks.push_back(e_Tutorial_Hint_Unused_4); + s_completableTasks.push_back(e_Tutorial_Hint_Unused_5); + s_completableTasks.push_back(e_Tutorial_Hint_Unused_6); + s_completableTasks.push_back(e_Tutorial_Hint_Unused_7); + s_completableTasks.push_back(e_Tutorial_Hint_Unused_8); + s_completableTasks.push_back(e_Tutorial_Hint_Unused_9); + s_completableTasks.push_back(e_Tutorial_Hint_Unused_10); - s_completableTasks.push_back( e_Tutorial_Hint_Rock ); - s_completableTasks.push_back( e_Tutorial_Hint_Stone ); - s_completableTasks.push_back( e_Tutorial_Hint_Planks ); - s_completableTasks.push_back( e_Tutorial_Hint_Sapling ); - s_completableTasks.push_back( e_Tutorial_Hint_Unbreakable ); - s_completableTasks.push_back( e_Tutorial_Hint_Water ); - s_completableTasks.push_back( e_Tutorial_Hint_Lava ); - s_completableTasks.push_back( e_Tutorial_Hint_Sand ); - s_completableTasks.push_back( e_Tutorial_Hint_Gravel ); - s_completableTasks.push_back( e_Tutorial_Hint_Gold_Ore ); - s_completableTasks.push_back( e_Tutorial_Hint_Iron_Ore ); - s_completableTasks.push_back( e_Tutorial_Hint_Coal_Ore ); - s_completableTasks.push_back( e_Tutorial_Hint_Tree_Trunk ); - s_completableTasks.push_back( e_Tutorial_Hint_Glass ); - s_completableTasks.push_back( e_Tutorial_Hint_Leaves ); - s_completableTasks.push_back( e_Tutorial_Hint_Lapis_Ore ); - s_completableTasks.push_back( e_Tutorial_Hint_Lapis_Block ); - s_completableTasks.push_back( e_Tutorial_Hint_Dispenser ); - s_completableTasks.push_back( e_Tutorial_Hint_Sandstone ); - s_completableTasks.push_back( e_Tutorial_Hint_Note_Block ); - s_completableTasks.push_back( e_Tutorial_Hint_Powered_Rail ); - s_completableTasks.push_back( e_Tutorial_Hint_Detector_Rail ); - s_completableTasks.push_back( e_Tutorial_Hint_Tall_Grass ); - s_completableTasks.push_back( e_Tutorial_Hint_Wool ); - s_completableTasks.push_back( e_Tutorial_Hint_Flower ); - s_completableTasks.push_back( e_Tutorial_Hint_Mushroom ); - s_completableTasks.push_back( e_Tutorial_Hint_Gold_Block ); - s_completableTasks.push_back( e_Tutorial_Hint_Iron_Block ); - s_completableTasks.push_back( e_Tutorial_Hint_Stone_Slab ); - s_completableTasks.push_back( e_Tutorial_Hint_Red_Brick ); - s_completableTasks.push_back( e_Tutorial_Hint_Tnt ); - s_completableTasks.push_back( e_Tutorial_Hint_Bookshelf ); - s_completableTasks.push_back( e_Tutorial_Hint_Moss_Stone ); - s_completableTasks.push_back( e_Tutorial_Hint_Obsidian ); - s_completableTasks.push_back( e_Tutorial_Hint_Torch ); - s_completableTasks.push_back( e_Tutorial_Hint_MobSpawner ); - s_completableTasks.push_back( e_Tutorial_Hint_Chest ); - s_completableTasks.push_back( e_Tutorial_Hint_Redstone ); - s_completableTasks.push_back( e_Tutorial_Hint_Diamond_Ore ); - s_completableTasks.push_back( e_Tutorial_Hint_Diamond_Block ); - s_completableTasks.push_back( e_Tutorial_Hint_Crafting_Table ); - s_completableTasks.push_back( e_Tutorial_Hint_Crops ); - s_completableTasks.push_back( e_Tutorial_Hint_Farmland ); - s_completableTasks.push_back( e_Tutorial_Hint_Furnace ); - s_completableTasks.push_back( e_Tutorial_Hint_Sign ); - s_completableTasks.push_back( e_Tutorial_Hint_Door_Wood ); - s_completableTasks.push_back( e_Tutorial_Hint_Ladder ); - s_completableTasks.push_back( e_Tutorial_Hint_Rail ); - s_completableTasks.push_back( e_Tutorial_Hint_Stairs_Stone ); - s_completableTasks.push_back( e_Tutorial_Hint_Lever ); - s_completableTasks.push_back( e_Tutorial_Hint_PressurePlate ); - s_completableTasks.push_back( e_Tutorial_Hint_Door_Iron ); - s_completableTasks.push_back( e_Tutorial_Hint_Redstone_Ore ); - s_completableTasks.push_back( e_Tutorial_Hint_Redstone_Torch ); - s_completableTasks.push_back( e_Tutorial_Hint_Button ); - s_completableTasks.push_back( e_Tutorial_Hint_Snow ); - s_completableTasks.push_back( e_Tutorial_Hint_Ice ); - s_completableTasks.push_back( e_Tutorial_Hint_Cactus ); - s_completableTasks.push_back( e_Tutorial_Hint_Clay ); - s_completableTasks.push_back( e_Tutorial_Hint_Sugarcane ); - s_completableTasks.push_back( e_Tutorial_Hint_Record_Player ); - s_completableTasks.push_back( e_Tutorial_Hint_Pumpkin ); - s_completableTasks.push_back( e_Tutorial_Hint_Hell_Rock ); - s_completableTasks.push_back( e_Tutorial_Hint_Hell_Sand ); - s_completableTasks.push_back( e_Tutorial_Hint_Glowstone ); - s_completableTasks.push_back( e_Tutorial_Hint_Portal ); - s_completableTasks.push_back( e_Tutorial_Hint_Pumpkin_Lit ); - s_completableTasks.push_back( e_Tutorial_Hint_Cake ); - s_completableTasks.push_back( e_Tutorial_Hint_Redstone_Repeater ); - s_completableTasks.push_back( e_Tutorial_Hint_Trapdoor ); - s_completableTasks.push_back( e_Tutorial_Hint_Piston ); - s_completableTasks.push_back( e_Tutorial_Hint_Sticky_Piston ); - s_completableTasks.push_back( e_Tutorial_Hint_Monster_Stone_Egg ); - s_completableTasks.push_back( e_Tutorial_Hint_Stone_Brick_Smooth ); - s_completableTasks.push_back( e_Tutorial_Hint_Huge_Mushroom ); - s_completableTasks.push_back( e_Tutorial_Hint_Iron_Fence ); - s_completableTasks.push_back( e_Tutorial_Hint_Thin_Glass ); - s_completableTasks.push_back( e_Tutorial_Hint_Melon ); - s_completableTasks.push_back( e_Tutorial_Hint_Vine ); - s_completableTasks.push_back( e_Tutorial_Hint_Fence_Gate ); - s_completableTasks.push_back( e_Tutorial_Hint_Mycel ); - s_completableTasks.push_back( e_Tutorial_Hint_Water_Lily ); - s_completableTasks.push_back( e_Tutorial_Hint_Nether_Brick ); - s_completableTasks.push_back( e_Tutorial_Hint_Nether_Fence ); - s_completableTasks.push_back( e_Tutorial_Hint_Nether_Stalk ); - s_completableTasks.push_back( e_Tutorial_Hint_Enchant_Table ); - s_completableTasks.push_back( e_Tutorial_Hint_Brewing_Stand ); - s_completableTasks.push_back( e_Tutorial_Hint_Cauldron ); - s_completableTasks.push_back( e_Tutorial_Hint_End_Portal ); - s_completableTasks.push_back( e_Tutorial_Hint_End_Portal_Frame ); + s_completableTasks.push_back(e_Tutorial_Hint_Rock); + s_completableTasks.push_back(e_Tutorial_Hint_Stone); + s_completableTasks.push_back(e_Tutorial_Hint_Planks); + s_completableTasks.push_back(e_Tutorial_Hint_Sapling); + s_completableTasks.push_back(e_Tutorial_Hint_Unbreakable); + s_completableTasks.push_back(e_Tutorial_Hint_Water); + s_completableTasks.push_back(e_Tutorial_Hint_Lava); + s_completableTasks.push_back(e_Tutorial_Hint_Sand); + s_completableTasks.push_back(e_Tutorial_Hint_Gravel); + s_completableTasks.push_back(e_Tutorial_Hint_Gold_Ore); + s_completableTasks.push_back(e_Tutorial_Hint_Iron_Ore); + s_completableTasks.push_back(e_Tutorial_Hint_Coal_Ore); + s_completableTasks.push_back(e_Tutorial_Hint_Tree_Trunk); + s_completableTasks.push_back(e_Tutorial_Hint_Glass); + s_completableTasks.push_back(e_Tutorial_Hint_Leaves); + s_completableTasks.push_back(e_Tutorial_Hint_Lapis_Ore); + s_completableTasks.push_back(e_Tutorial_Hint_Lapis_Block); + s_completableTasks.push_back(e_Tutorial_Hint_Dispenser); + s_completableTasks.push_back(e_Tutorial_Hint_Sandstone); + s_completableTasks.push_back(e_Tutorial_Hint_Note_Block); + s_completableTasks.push_back(e_Tutorial_Hint_Powered_Rail); + s_completableTasks.push_back(e_Tutorial_Hint_Detector_Rail); + s_completableTasks.push_back(e_Tutorial_Hint_Tall_Grass); + s_completableTasks.push_back(e_Tutorial_Hint_Wool); + s_completableTasks.push_back(e_Tutorial_Hint_Flower); + s_completableTasks.push_back(e_Tutorial_Hint_Mushroom); + s_completableTasks.push_back(e_Tutorial_Hint_Gold_Block); + s_completableTasks.push_back(e_Tutorial_Hint_Iron_Block); + s_completableTasks.push_back(e_Tutorial_Hint_Stone_Slab); + s_completableTasks.push_back(e_Tutorial_Hint_Red_Brick); + s_completableTasks.push_back(e_Tutorial_Hint_Tnt); + s_completableTasks.push_back(e_Tutorial_Hint_Bookshelf); + s_completableTasks.push_back(e_Tutorial_Hint_Moss_Stone); + s_completableTasks.push_back(e_Tutorial_Hint_Obsidian); + s_completableTasks.push_back(e_Tutorial_Hint_Torch); + s_completableTasks.push_back(e_Tutorial_Hint_MobSpawner); + s_completableTasks.push_back(e_Tutorial_Hint_Chest); + s_completableTasks.push_back(e_Tutorial_Hint_Redstone); + s_completableTasks.push_back(e_Tutorial_Hint_Diamond_Ore); + s_completableTasks.push_back(e_Tutorial_Hint_Diamond_Block); + s_completableTasks.push_back(e_Tutorial_Hint_Crafting_Table); + s_completableTasks.push_back(e_Tutorial_Hint_Crops); + s_completableTasks.push_back(e_Tutorial_Hint_Farmland); + s_completableTasks.push_back(e_Tutorial_Hint_Furnace); + s_completableTasks.push_back(e_Tutorial_Hint_Sign); + s_completableTasks.push_back(e_Tutorial_Hint_Door_Wood); + s_completableTasks.push_back(e_Tutorial_Hint_Ladder); + s_completableTasks.push_back(e_Tutorial_Hint_Rail); + s_completableTasks.push_back(e_Tutorial_Hint_Stairs_Stone); + s_completableTasks.push_back(e_Tutorial_Hint_Lever); + s_completableTasks.push_back(e_Tutorial_Hint_PressurePlate); + s_completableTasks.push_back(e_Tutorial_Hint_Door_Iron); + s_completableTasks.push_back(e_Tutorial_Hint_Redstone_Ore); + s_completableTasks.push_back(e_Tutorial_Hint_Redstone_Torch); + s_completableTasks.push_back(e_Tutorial_Hint_Button); + s_completableTasks.push_back(e_Tutorial_Hint_Snow); + s_completableTasks.push_back(e_Tutorial_Hint_Ice); + s_completableTasks.push_back(e_Tutorial_Hint_Cactus); + s_completableTasks.push_back(e_Tutorial_Hint_Clay); + s_completableTasks.push_back(e_Tutorial_Hint_Sugarcane); + s_completableTasks.push_back(e_Tutorial_Hint_Record_Player); + s_completableTasks.push_back(e_Tutorial_Hint_Pumpkin); + s_completableTasks.push_back(e_Tutorial_Hint_Hell_Rock); + s_completableTasks.push_back(e_Tutorial_Hint_Hell_Sand); + s_completableTasks.push_back(e_Tutorial_Hint_Glowstone); + s_completableTasks.push_back(e_Tutorial_Hint_Portal); + s_completableTasks.push_back(e_Tutorial_Hint_Pumpkin_Lit); + s_completableTasks.push_back(e_Tutorial_Hint_Cake); + s_completableTasks.push_back(e_Tutorial_Hint_Redstone_Repeater); + s_completableTasks.push_back(e_Tutorial_Hint_Trapdoor); + s_completableTasks.push_back(e_Tutorial_Hint_Piston); + s_completableTasks.push_back(e_Tutorial_Hint_Sticky_Piston); + s_completableTasks.push_back(e_Tutorial_Hint_Monster_Stone_Egg); + s_completableTasks.push_back(e_Tutorial_Hint_Stone_Brick_Smooth); + s_completableTasks.push_back(e_Tutorial_Hint_Huge_Mushroom); + s_completableTasks.push_back(e_Tutorial_Hint_Iron_Fence); + s_completableTasks.push_back(e_Tutorial_Hint_Thin_Glass); + s_completableTasks.push_back(e_Tutorial_Hint_Melon); + s_completableTasks.push_back(e_Tutorial_Hint_Vine); + s_completableTasks.push_back(e_Tutorial_Hint_Fence_Gate); + s_completableTasks.push_back(e_Tutorial_Hint_Mycel); + s_completableTasks.push_back(e_Tutorial_Hint_Water_Lily); + s_completableTasks.push_back(e_Tutorial_Hint_Nether_Brick); + s_completableTasks.push_back(e_Tutorial_Hint_Nether_Fence); + s_completableTasks.push_back(e_Tutorial_Hint_Nether_Stalk); + s_completableTasks.push_back(e_Tutorial_Hint_Enchant_Table); + s_completableTasks.push_back(e_Tutorial_Hint_Brewing_Stand); + s_completableTasks.push_back(e_Tutorial_Hint_Cauldron); + s_completableTasks.push_back(e_Tutorial_Hint_End_Portal); + s_completableTasks.push_back(e_Tutorial_Hint_End_Portal_Frame); - s_completableTasks.push_back( e_Tutorial_Hint_Squid ); - s_completableTasks.push_back( e_Tutorial_Hint_Cow ); - s_completableTasks.push_back( e_Tutorial_Hint_Sheep ); - s_completableTasks.push_back( e_Tutorial_Hint_Chicken ); - s_completableTasks.push_back( e_Tutorial_Hint_Pig ); - s_completableTasks.push_back( e_Tutorial_Hint_Wolf ); - s_completableTasks.push_back( e_Tutorial_Hint_Creeper ); - s_completableTasks.push_back( e_Tutorial_Hint_Skeleton ); - s_completableTasks.push_back( e_Tutorial_Hint_Spider ); - s_completableTasks.push_back( e_Tutorial_Hint_Zombie ); - s_completableTasks.push_back( e_Tutorial_Hint_Pig_Zombie ); - s_completableTasks.push_back( e_Tutorial_Hint_Ghast ); - s_completableTasks.push_back( e_Tutorial_Hint_Slime ); - s_completableTasks.push_back( e_Tutorial_Hint_Enderman ); - s_completableTasks.push_back( e_Tutorial_Hint_Silverfish ); - s_completableTasks.push_back( e_Tutorial_Hint_Cave_Spider ); - s_completableTasks.push_back( e_Tutorial_Hint_MushroomCow ); - s_completableTasks.push_back( e_Tutorial_Hint_SnowMan ); - s_completableTasks.push_back( e_Tutorial_Hint_IronGolem ); - s_completableTasks.push_back( e_Tutorial_Hint_EnderDragon ); - s_completableTasks.push_back( e_Tutorial_Hint_Blaze ); - s_completableTasks.push_back( e_Tutorial_Hint_Lava_Slime ); + s_completableTasks.push_back(e_Tutorial_Hint_Squid); + s_completableTasks.push_back(e_Tutorial_Hint_Cow); + s_completableTasks.push_back(e_Tutorial_Hint_Sheep); + s_completableTasks.push_back(e_Tutorial_Hint_Chicken); + s_completableTasks.push_back(e_Tutorial_Hint_Pig); + s_completableTasks.push_back(e_Tutorial_Hint_Wolf); + s_completableTasks.push_back(e_Tutorial_Hint_Creeper); + s_completableTasks.push_back(e_Tutorial_Hint_Skeleton); + s_completableTasks.push_back(e_Tutorial_Hint_Spider); + s_completableTasks.push_back(e_Tutorial_Hint_Zombie); + s_completableTasks.push_back(e_Tutorial_Hint_Pig_Zombie); + s_completableTasks.push_back(e_Tutorial_Hint_Ghast); + s_completableTasks.push_back(e_Tutorial_Hint_Slime); + s_completableTasks.push_back(e_Tutorial_Hint_Enderman); + s_completableTasks.push_back(e_Tutorial_Hint_Silverfish); + s_completableTasks.push_back(e_Tutorial_Hint_Cave_Spider); + s_completableTasks.push_back(e_Tutorial_Hint_MushroomCow); + s_completableTasks.push_back(e_Tutorial_Hint_SnowMan); + s_completableTasks.push_back(e_Tutorial_Hint_IronGolem); + s_completableTasks.push_back(e_Tutorial_Hint_EnderDragon); + s_completableTasks.push_back(e_Tutorial_Hint_Blaze); + s_completableTasks.push_back(e_Tutorial_Hint_Lava_Slime); - s_completableTasks.push_back( e_Tutorial_Hint_Ozelot ); - s_completableTasks.push_back( e_Tutorial_Hint_Villager ); + s_completableTasks.push_back(e_Tutorial_Hint_Ozelot); + s_completableTasks.push_back(e_Tutorial_Hint_Villager); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Shovel ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Hatchet ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Pickaxe ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Flint_And_Steel ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Apple ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Bow ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Arrow ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Coal ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Diamond ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Iron_Ingot ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Gold_Ingot ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Sword ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Stick ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Bowl ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Mushroom_Stew ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_String ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Feather ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Sulphur ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Hoe ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Seeds ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Wheat ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Bread ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Helmet ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Chestplate ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Leggings ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Boots ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Flint ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Porkchop_Raw ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Porkchop_Cooked ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Painting ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Apple_Gold ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Sign ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Door_Wood ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Bucket_Empty ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Bucket_Water ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Bucket_Lava ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Minecart ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Saddle ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Door_Iron ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Redstone ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Snowball ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Boat ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Leather ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Milk ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Brick ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Clay ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Reeds ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Paper ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Book ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Slimeball ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Minecart_Chest ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Minecart_Furnace ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Egg ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Compass ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Clock ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Yellow_Dust ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Fish_Raw ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Fish_Cooked ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Dye_Powder ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Bone ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Sugar ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Cake ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Diode ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Cookie ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Map ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Record ); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Shovel); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Hatchet); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Pickaxe); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Flint_And_Steel); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Apple); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Bow); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Arrow); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Coal); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Diamond); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Iron_Ingot); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Gold_Ingot); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Sword); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Stick); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Bowl); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Mushroom_Stew); + s_completableTasks.push_back(e_Tutorial_Hint_Item_String); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Feather); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Sulphur); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Hoe); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Seeds); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Wheat); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Bread); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Helmet); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Chestplate); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Leggings); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Boots); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Flint); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Porkchop_Raw); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Porkchop_Cooked); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Painting); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Apple_Gold); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Sign); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Door_Wood); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Bucket_Empty); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Bucket_Water); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Bucket_Lava); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Minecart); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Saddle); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Door_Iron); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Redstone); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Snowball); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Boat); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Leather); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Milk); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Brick); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Clay); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Reeds); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Paper); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Book); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Slimeball); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Minecart_Chest); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Minecart_Furnace); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Egg); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Compass); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Clock); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Yellow_Dust); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Fish_Raw); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Fish_Cooked); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Dye_Powder); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Bone); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Sugar); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Cake); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Diode); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Cookie); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Map); + s_completableTasks.push_back(e_Tutorial_Hint_Item_Record); - s_completableTasks.push_back( e_Tutorial_Hint_White_Stone ); - s_completableTasks.push_back( e_Tutorial_Hint_Dragon_Egg ); - s_completableTasks.push_back( e_Tutorial_Hint_RedstoneLamp ); - s_completableTasks.push_back( e_Tutorial_Hint_Cocoa); + s_completableTasks.push_back(e_Tutorial_Hint_White_Stone); + s_completableTasks.push_back(e_Tutorial_Hint_Dragon_Egg); + s_completableTasks.push_back(e_Tutorial_Hint_RedstoneLamp); + s_completableTasks.push_back(e_Tutorial_Hint_Cocoa); - s_completableTasks.push_back( e_Tutorial_Hint_EmeraldOre ); - s_completableTasks.push_back( e_Tutorial_Hint_EmeraldBlock ); - s_completableTasks.push_back( e_Tutorial_Hint_EnderChest ); - s_completableTasks.push_back( e_Tutorial_Hint_TripwireSource ); - s_completableTasks.push_back( e_Tutorial_Hint_Tripwire ); - s_completableTasks.push_back( e_Tutorial_Hint_CobblestoneWall ); - s_completableTasks.push_back( e_Tutorial_Hint_Flowerpot ); - s_completableTasks.push_back( e_Tutorial_Hint_Anvil ); - s_completableTasks.push_back( e_Tutorial_Hint_QuartzOre ); - s_completableTasks.push_back( e_Tutorial_Hint_QuartzBlock ); - s_completableTasks.push_back( e_Tutorial_Hint_WoolCarpet ); + s_completableTasks.push_back(e_Tutorial_Hint_EmeraldOre); + s_completableTasks.push_back(e_Tutorial_Hint_EmeraldBlock); + s_completableTasks.push_back(e_Tutorial_Hint_EnderChest); + s_completableTasks.push_back(e_Tutorial_Hint_TripwireSource); + s_completableTasks.push_back(e_Tutorial_Hint_Tripwire); + s_completableTasks.push_back(e_Tutorial_Hint_CobblestoneWall); + s_completableTasks.push_back(e_Tutorial_Hint_Flowerpot); + s_completableTasks.push_back(e_Tutorial_Hint_Anvil); + s_completableTasks.push_back(e_Tutorial_Hint_QuartzOre); + s_completableTasks.push_back(e_Tutorial_Hint_QuartzBlock); + s_completableTasks.push_back(e_Tutorial_Hint_WoolCarpet); - s_completableTasks.push_back( e_Tutorial_Hint_Potato ); - s_completableTasks.push_back( e_Tutorial_Hint_Carrot ); + s_completableTasks.push_back(e_Tutorial_Hint_Potato); + s_completableTasks.push_back(e_Tutorial_Hint_Carrot); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Unused_18 ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Unused_19 ); - s_completableTasks.push_back( e_Tutorial_Hint_Item_Unused_20 ); + s_completableTasks.push_back(e_Tutorial_Hint_CommandBlock); + s_completableTasks.push_back(e_Tutorial_Hint_Beacon); + s_completableTasks.push_back(e_Tutorial_Hint_Activator_Rail); - s_completableTasks.push_back( eTutorial_Telemetry_TrialStart ); - s_completableTasks.push_back( eTutorial_Telemetry_Halfway ); - s_completableTasks.push_back( eTutorial_Telemetry_Complete ); + s_completableTasks.push_back(eTutorial_Telemetry_TrialStart); + s_completableTasks.push_back(eTutorial_Telemetry_Halfway); + s_completableTasks.push_back(eTutorial_Telemetry_Complete); - s_completableTasks.push_back( eTutorial_Telemetry_Unused_1 ); - s_completableTasks.push_back( eTutorial_Telemetry_Unused_2 ); - s_completableTasks.push_back( eTutorial_Telemetry_Unused_3 ); - s_completableTasks.push_back( eTutorial_Telemetry_Unused_4 ); - s_completableTasks.push_back( eTutorial_Telemetry_Unused_5 ); - s_completableTasks.push_back( eTutorial_Telemetry_Unused_6 ); - s_completableTasks.push_back( eTutorial_Telemetry_Unused_7 ); - s_completableTasks.push_back( eTutorial_Telemetry_Unused_8 ); - s_completableTasks.push_back( eTutorial_Telemetry_Unused_9 ); - s_completableTasks.push_back( eTutorial_Telemetry_Unused_10 ); + s_completableTasks.push_back(eTutorial_Telemetry_Unused_1); + s_completableTasks.push_back(eTutorial_Telemetry_Unused_2); + s_completableTasks.push_back(eTutorial_Telemetry_Unused_3); + s_completableTasks.push_back(eTutorial_Telemetry_Unused_4); + s_completableTasks.push_back(eTutorial_Telemetry_Unused_5); + s_completableTasks.push_back(eTutorial_Telemetry_Unused_6); + s_completableTasks.push_back(eTutorial_Telemetry_Unused_7); + s_completableTasks.push_back(eTutorial_Telemetry_Unused_8); + s_completableTasks.push_back(eTutorial_Telemetry_Unused_9); + s_completableTasks.push_back(eTutorial_Telemetry_Unused_10); - s_completableTasks.push_back( e_Tutorial_State_Enchanting_Menu ); - s_completableTasks.push_back( e_Tutorial_State_Farming ); - s_completableTasks.push_back( e_Tutorial_State_Breeding ); - s_completableTasks.push_back( e_Tutorial_State_Golem ); - s_completableTasks.push_back( e_Tutorial_State_Trading ); - s_completableTasks.push_back( e_Tutorial_State_Trading_Menu ); - s_completableTasks.push_back( e_Tutorial_State_Anvil ); - s_completableTasks.push_back( e_Tutorial_State_Anvil_Menu ); - s_completableTasks.push_back( e_Tutorial_State_Enderchests ); + s_completableTasks.push_back(e_Tutorial_State_Enchanting_Menu); + s_completableTasks.push_back(e_Tutorial_State_Farming); + s_completableTasks.push_back(e_Tutorial_State_Breeding); + s_completableTasks.push_back(e_Tutorial_State_Golem); + s_completableTasks.push_back(e_Tutorial_State_Trading); + s_completableTasks.push_back(e_Tutorial_State_Trading_Menu); + s_completableTasks.push_back(e_Tutorial_State_Anvil); + s_completableTasks.push_back(e_Tutorial_State_Anvil_Menu); + s_completableTasks.push_back(e_Tutorial_State_Enderchests); + s_completableTasks.push_back(e_Tutorial_State_Horse_Menu); + s_completableTasks.push_back(e_Tutorial_State_Hopper_Menu); - s_completableTasks.push_back( e_Tutorial_State_Unused_9 ); - s_completableTasks.push_back( e_Tutorial_State_Unused_10 ); + s_completableTasks.push_back(e_Tutorial_Hint_Wither); + s_completableTasks.push_back(e_Tutorial_Hint_Witch); + s_completableTasks.push_back(e_Tutorial_Hint_Bat); + s_completableTasks.push_back(e_Tutorial_Hint_Horse); - if( s_completableTasks.size() > TUTORIAL_PROFILE_STORAGE_BITS ) - { - app.DebugPrintf("Warning: Too many tutorial completable tasks added, not enough bits allocated to stored them in the profile data"); - assert(false); - } + s_completableTasks.push_back(e_Tutorial_Hint_RedstoneBlock); + s_completableTasks.push_back(e_Tutorial_Hint_DaylightDetector); + s_completableTasks.push_back(e_Tutorial_Hint_Dropper); + s_completableTasks.push_back(e_Tutorial_Hint_Hopper); + s_completableTasks.push_back(e_Tutorial_Hint_Comparator); + s_completableTasks.push_back(e_Tutorial_Hint_ChestTrap); + s_completableTasks.push_back(e_Tutorial_Hint_HayBlock); + s_completableTasks.push_back(e_Tutorial_Hint_ClayHardened); + s_completableTasks.push_back(e_Tutorial_Hint_ClayHardenedColored); + s_completableTasks.push_back(e_Tutorial_Hint_CoalBlock); + + s_completableTasks.push_back(e_Tutorial_State_Beacon_Menu); + s_completableTasks.push_back(e_Tutorial_State_Fireworks_Menu); + s_completableTasks.push_back(e_Tutorial_State_Horse); + s_completableTasks.push_back(e_Tutorial_State_Hopper); + s_completableTasks.push_back(e_Tutorial_State_Beacon); + s_completableTasks.push_back(e_Tutorial_State_Fireworks); + + if (s_completableTasks.size() > TUTORIAL_PROFILE_STORAGE_BITS) { + app.DebugPrintf( + "Warning: Too many tutorial completable tasks added, not enough " + "bits allocated to stored them in the profile data"); + assert(false); + } } -Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad ) -{ - m_isFullTutorial = isFullTutorial; - m_fullTutorialComplete = false; - m_allTutorialsComplete = false; - hasRequestedUI = false; - uiTempDisabled = false; - m_hintDisplayed = false; - m_freezeTime = false; - m_timeFrozen = false; - m_UIScene = NULL; - m_allowShow = true; - m_bHasTickedOnce = false; - m_firstTickTime = 0; +Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { + m_isFullTutorial = isFullTutorial; + m_fullTutorialComplete = false; + m_allTutorialsComplete = false; + hasRequestedUI = false; + uiTempDisabled = false; + m_hintDisplayed = false; + m_freezeTime = false; + m_timeFrozen = false; + m_UIScene = NULL; + m_allowShow = true; + m_bHasTickedOnce = false; + m_firstTickTime = 0; - // 4jcraft added, not initialized - m_bSceneIsSplitscreen = false; + // 4jcraft added, not initialized + m_bSceneIsSplitscreen = false; - m_lastMessage = NULL; + m_lastMessage = NULL; - lastMessageTime = 0; - m_iTaskReminders = 0; - m_lastMessageState = e_Tutorial_State_Gameplay; + lastMessageTime = 0; + m_iTaskReminders = 0; + m_lastMessageState = e_Tutorial_State_Gameplay; - m_CurrentState = e_Tutorial_State_Gameplay; - m_hasStateChanged = false; + m_CurrentState = e_Tutorial_State_Gameplay; + m_hasStateChanged = false; #ifdef _XBOX - m_hTutorialScene=NULL; + m_hTutorialScene = NULL; #endif - for(unsigned int i = 0; i < e_Tutorial_State_Max; ++i) - { - currentTask[i] = NULL; - currentFailedConstraint[i] = NULL; - } - - // DEFAULT TASKS THAT ALL TUTORIALS SHARE - /* - * - * - * GAMEPLAY - * - */ - - if(!isHintCompleted(e_Tutorial_Hint_Hold_To_Mine)) addHint(e_Tutorial_State_Gameplay, new TutorialHint(e_Tutorial_Hint_Hold_To_Mine, this, IDS_TUTORIAL_HINT_HOLD_TO_MINE, TutorialHint::e_Hint_HoldToMine) ); - if(!isHintCompleted(e_Tutorial_Hint_Tool_Damaged)) addHint(e_Tutorial_State_Gameplay, new TutorialHint(e_Tutorial_Hint_Tool_Damaged, this, IDS_TUTORIAL_HINT_TOOL_DAMAGED, TutorialHint::e_Hint_ToolDamaged) ); - if(!isHintCompleted(e_Tutorial_Hint_Swim_Up)) addHint(e_Tutorial_State_Gameplay, new TutorialHint(e_Tutorial_Hint_Swim_Up, this, IDS_TUTORIAL_HINT_SWIM_UP, TutorialHint::e_Hint_SwimUp) ); - - /* - * TILE HINTS - */ - int rockItems[] = {Tile::rock_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Rock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Rock, this, rockItems, 1 ) ); - - int stoneItems[] = {Tile::stoneBrick_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Stone)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone, this, stoneItems, 1 ) ); - - int plankItems[] = {Tile::wood_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Planks)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Planks, this, plankItems, 1 ) ); - - int saplingItems[] = {Tile::sapling_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Sapling)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Sapling, this, saplingItems, 1 ) ); - - int unbreakableItems[] = {Tile::unbreakable_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Unbreakable)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Unbreakable, this, unbreakableItems, 1 ) ); - - int waterItems[] = {Tile::water_Id, Tile::calmWater_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Water)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Water, this, waterItems, 2 ) ); - - int lavaItems[] = {Tile::lava_Id, Tile::calmLava_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Lava)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Lava, this, lavaItems, 2 ) ); - - int sandItems[] = {Tile::sand_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Sand)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Sand, this, sandItems, 1 ) ); - - int gravelItems[] = {Tile::gravel_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Gravel)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Gravel, this, gravelItems, 1 ) ); - - int goldOreItems[] = {Tile::goldOre_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Gold_Ore)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Gold_Ore, this, goldOreItems, 1 ) ); - - int ironOreItems[] = {Tile::ironOre_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Iron_Ore)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Iron_Ore, this, ironOreItems, 1 ) ); - - int coalOreItems[] = {Tile::coalOre_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Coal_Ore)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Coal_Ore, this, coalOreItems, 1 ) ); - - int treeTrunkItems[] = {Tile::treeTrunk_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Tree_Trunk)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tree_Trunk, this, treeTrunkItems, 1 ) ); - - int leavesItems[] = {Tile::leaves_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Leaves)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Leaves, this, leavesItems, 1 ) ); - - int glassItems[] = {Tile::glass_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Glass)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Glass, this, glassItems, 1 ) ); - - int lapisOreItems[] = {Tile::lapisOre_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Lapis_Ore)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Lapis_Ore, this, lapisOreItems, 1 ) ); - - int lapisBlockItems[] = {Tile::lapisBlock_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Lapis_Block)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Lapis_Block, this, lapisBlockItems, 1 ) ); - - int dispenserItems[] = {Tile::dispenser_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Dispenser)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Dispenser, this, dispenserItems, 1 ) ); - - int sandstoneItems[] = {Tile::sandStone_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Sandstone)) - { - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Sandstone, this, sandstoneItems, 1, -1, SandStoneTile::TYPE_DEFAULT ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Sandstone, this, sandstoneItems, 1, -1, SandStoneTile::TYPE_HEIROGLYPHS ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Sandstone, this, sandstoneItems, 1, -1, SandStoneTile::TYPE_SMOOTHSIDE ) ); - } - - int noteBlockItems[] = {Tile::musicBlock_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Note_Block)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Note_Block, this, noteBlockItems, 1 ) ); - - int poweredRailItems[] = {Tile::goldenRail_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Powered_Rail)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Powered_Rail, this, poweredRailItems, 1 ) ); - - int detectorRailItems[] = {Tile::detectorRail_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Detector_Rail)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Detector_Rail, this, detectorRailItems, 1 ) ); - - int tallGrassItems[] = {Tile::tallgrass_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Tall_Grass)) - { - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tall_Grass, this, tallGrassItems, 1, -1, TallGrass::DEAD_SHRUB ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tall_Grass, this, tallGrassItems, 1, -1, TallGrass::TALL_GRASS ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tall_Grass, this, tallGrassItems, 1, -1, TallGrass::FERN ) ); - } - - int woolItems[] = {Tile::cloth_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Wool)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Wool, this, woolItems, 1 ) ); - - int flowerItems[] = {Tile::flower_Id, Tile::rose_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Flower)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Flower, this, flowerItems, 2 ) ); - - int mushroomItems[] = {Tile::mushroom1_Id, Tile::mushroom2_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Mushroom)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Mushroom, this, mushroomItems, 2 ) ); - - int goldBlockItems[] = {Tile::goldBlock_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Gold_Block)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Gold_Block, this, goldBlockItems, 1 ) ); - - int ironBlockItems[] = {Tile::ironBlock_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Iron_Block)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Iron_Block, this, ironBlockItems, 1 ) ); - - int stoneSlabItems[] = {Tile::stoneSlabHalf_Id, Tile::stoneSlab_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Stone_Slab)) - { - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, 2, -1, StoneSlabTile::STONE_SLAB ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, 2, -1, StoneSlabTile::SAND_SLAB ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, 2, -1, StoneSlabTile::WOOD_SLAB ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, 2, -1, StoneSlabTile::COBBLESTONE_SLAB ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, 2, -1, StoneSlabTile::BRICK_SLAB ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, 2, -1, StoneSlabTile::SMOOTHBRICK_SLAB ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, 2, -1, StoneSlabTile::NETHERBRICK_SLAB ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, 2, -1, StoneSlabTile::QUARTZ_SLAB ) ); - } - - int woodSlabItems[] = {Tile::woodSlabHalf_Id, Tile::woodSlab_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Stone_Slab)) - { - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, woodSlabItems, 2, -1, TreeTile::BIRCH_TRUNK ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, woodSlabItems, 2, -1, TreeTile::DARK_TRUNK ) ); - } - - int redBrickItems[] = {Tile::redBrick_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Red_Brick)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Red_Brick, this, redBrickItems, 1 ) ); - - int tntItems[] = {Tile::tnt_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Tnt)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tnt, this, tntItems, 1 ) ); - - int bookshelfItems[] = {Tile::bookshelf_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Bookshelf)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Bookshelf, this, bookshelfItems, 1 ) ); - - int mossStoneItems[] = {Tile::mossStone_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Moss_Stone)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Moss_Stone, this, mossStoneItems, 1 ) ); - - int obsidianItems[] = {Tile::obsidian_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Obsidian)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Obsidian, this, obsidianItems, 1 ) ); - - int torchItems[] = {Tile::torch_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Torch)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Torch, this, torchItems, 1 ) ); - - int mobSpawnerItems[] = {Tile::mobSpawner_Id}; - if(!isHintCompleted(e_Tutorial_Hint_MobSpawner)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_MobSpawner, this, mobSpawnerItems, 1 ) ); - - int chestItems[] = {Tile::chest_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Chest)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Chest, this, chestItems, 1 ) ); - - int redstoneItems[] = {Tile::redStoneDust_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Redstone)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Redstone, this, redstoneItems, 1, Item::redStone_Id ) ); - - int diamondOreItems[] = {Tile::diamondOre_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Diamond_Ore)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Diamond_Ore, this, diamondOreItems, 1 ) ); - - int diamondBlockItems[] = {Tile::diamondBlock_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Diamond_Block)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Diamond_Block, this, diamondBlockItems, 1 ) ); - - int craftingTableItems[] = {Tile::workBench_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Crafting_Table)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Crafting_Table, this, craftingTableItems, 1 ) ); - - int cropsItems[] = {Tile::crops_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Crops)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Crops, this, cropsItems, 1, -1, -1, 7 ) ); - - int farmlandItems[] = {Tile::farmland_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Farmland)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Farmland, this, farmlandItems, 1 ) ); - - int furnaceItems[] = {Tile::furnace_Id, Tile::furnace_lit_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Furnace)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Furnace, this, furnaceItems, 2 ) ); - - int signItems[] = {Tile::sign_Id, Tile::wallSign_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Sign)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Sign, this, signItems, 2, Item::sign_Id ) ); - - int doorWoodItems[] = {Tile::door_wood_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Door_Wood)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Door_Wood, this, doorWoodItems, 1, Item::door_wood->id ) ); - - int ladderItems[] = {Tile::ladder_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Ladder)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Ladder, this, ladderItems, 1 ) ); - - int stairsStoneItems[] = {Tile::stairs_stone_Id,Tile::stairs_bricks_Id,Tile::stairs_stoneBrickSmooth_Id,Tile::stairs_wood_Id,Tile::stairs_sprucewood_Id,Tile::stairs_birchwood_Id,Tile::stairs_netherBricks_Id,Tile::stairs_sandstone_Id,Tile::stairs_quartz_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Stairs_Stone)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stairs_Stone, this, stairsStoneItems, 9 ) ); - - int railItems[] = {Tile::rail_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Rail)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Rail, this, railItems, 1 ) ); - - int leverItems[] = {Tile::lever_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Lever)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Lever, this, leverItems, 1 ) ); - - int pressurePlateItems[] = {Tile::pressurePlate_stone_Id, Tile::pressurePlate_wood_Id}; - if(!isHintCompleted(e_Tutorial_Hint_PressurePlate)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_PressurePlate, this, pressurePlateItems, 2 ) ); - - int doorIronItems[] = {Tile::door_iron_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Door_Iron)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Door_Iron, this, doorIronItems, 1, Item::door_iron->id ) ); - - int redstoneOreItems[] = {Tile::redStoneOre_Id, Tile::redStoneOre_lit_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Redstone_Ore)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Redstone_Ore, this, redstoneOreItems, 2 ) ); - - int redstoneTorchItems[] = {Tile::notGate_off_Id, Tile::notGate_on_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Redstone_Torch)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Redstone_Torch, this, redstoneTorchItems, 2 ) ); - - int buttonItems[] = {Tile::button_stone_Id, Tile::button_wood_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Button)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Button, this, buttonItems, 2 ) ); - - int snowItems[] = {Tile::snow_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Snow)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Snow, this, snowItems, 1 ) ); - - int iceItems[] = {Tile::ice_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Ice)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Ice, this, iceItems, 1 ) ); - - int cactusItems[] = {Tile::cactus_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Cactus)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Cactus, this, cactusItems, 1 ) ); - - int clayItems[] = {Tile::clay_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Clay)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Clay, this, clayItems, 1 ) ); - - int sugarCaneItems[] = {Tile::reeds_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Sugarcane)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Sugarcane, this, sugarCaneItems, 1 ) ); - - int recordPlayerItems[] = {Tile::recordPlayer_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Record_Player)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Record_Player, this, recordPlayerItems, 1 ) ); - - int pumpkinItems[] = {Tile::pumpkin_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Pumpkin)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Pumpkin, this, pumpkinItems, 1, -1, -1, 0 ) ); - - int hellRockItems[] = {Tile::hellRock_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Hell_Rock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Hell_Rock, this, hellRockItems, 1 ) ); - - int hellSandItems[] = {Tile::hellSand_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Hell_Sand)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Hell_Sand, this, hellSandItems, 1 ) ); - - int glowstoneItems[] = {Tile::lightGem_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Glowstone)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Glowstone, this, glowstoneItems, 1 ) ); - - int portalItems[] = {Tile::portalTile_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Portal)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Portal, this, portalItems, 1 ) ); - - int pumpkinLitItems[] = {Tile::litPumpkin_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Pumpkin_Lit)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Pumpkin_Lit, this, pumpkinLitItems, 1, -1, -1, 0 ) ); - - int cakeItems[] = {Tile::cake_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Cake)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Cake, this, cakeItems, 1 ) ); - - int redstoneRepeaterItems[] = {Tile::diode_on_Id, Tile::diode_off_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Redstone_Repeater)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Redstone_Repeater, this, redstoneRepeaterItems, 2, Item::diode_Id ) ); - - int trapdoorItems[] = {Tile::trapdoor_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Trapdoor)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Trapdoor, this, trapdoorItems, 1 ) ); - - int pistonItems[] = {Tile::pistonBase_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Piston)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Piston, this, pistonItems, 1 ) ); - - int stickyPistonItems[] = {Tile::pistonStickyBase_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Sticky_Piston)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Sticky_Piston, this, stickyPistonItems, 1 ) ); - - int monsterStoneEggItems[] = {Tile::monsterStoneEgg_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Monster_Stone_Egg)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Monster_Stone_Egg, this, monsterStoneEggItems, 1 ) ); - - int stoneBrickSmoothItems[] = {Tile::stoneBrickSmooth_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Stone_Brick_Smooth)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Brick_Smooth, this, stoneBrickSmoothItems, 1 ) ); - - int hugeMushroomItems[] = {Tile::hugeMushroom1_Id,Tile::hugeMushroom2_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Huge_Mushroom)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Huge_Mushroom, this, hugeMushroomItems, 2 ) ); - - int ironFenceItems[] = {Tile::ironFence_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Iron_Fence)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Iron_Fence, this, ironFenceItems, 1 ) ); - - int thisGlassItems[] = {Tile::thinGlass_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Thin_Glass)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Thin_Glass, this, thisGlassItems, 1 ) ); - - int melonItems[] = {Tile::melon_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Melon)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Melon, this, melonItems, 1 ) ); - - int vineItems[] = {Tile::vine_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Vine)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Vine, this, vineItems, 1 ) ); - - int fenceGateItems[] = {Tile::fenceGate_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Fence_Gate)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Fence_Gate, this, fenceGateItems, 1 ) ); - - int mycelItems[] = {Tile::mycel_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Mycel)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Mycel, this, mycelItems, 1 ) ); - - int waterLilyItems[] = {Tile::waterLily_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Water_Lily)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Water_Lily, this, waterLilyItems, 1 ) ); - - int netherBrickItems[] = {Tile::netherBrick_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Nether_Brick)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Nether_Brick, this, netherBrickItems, 1 ) ); - - int netherFenceItems[] = {Tile::netherFence_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Nether_Fence)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Nether_Fence, this, netherFenceItems, 1 ) ); - - int netherStalkItems[] = {Tile::netherStalk_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Nether_Stalk)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Nether_Stalk, this, netherStalkItems, 1 ) ); - - int enchantTableItems[] = {Tile::enchantTable_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Enchant_Table)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Enchant_Table, this, enchantTableItems, 1 ) ); - - int brewingStandItems[] = {Tile::brewingStand_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Brewing_Stand)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Brewing_Stand, this, brewingStandItems, 1, Item::brewingStand_Id ) ); - - int cauldronItems[] = {Tile::cauldron_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Cauldron)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Cauldron, this, cauldronItems, 1, Item::cauldron_Id ) ); - - int endPortalItems[] = {Tile::endPortalTile_Id}; - if(!isHintCompleted(e_Tutorial_Hint_End_Portal)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_End_Portal, this, endPortalItems, 1, -2 ) ); - - int endPortalFrameItems[] = {Tile::endPortalFrameTile_Id}; - if(!isHintCompleted(e_Tutorial_Hint_End_Portal_Frame)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_End_Portal_Frame, this, endPortalFrameItems, 1 ) ); - - int whiteStoneItems[] = {Tile::whiteStone_Id}; - if(!isHintCompleted(e_Tutorial_Hint_White_Stone)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_White_Stone, this, whiteStoneItems, 1 ) ); - - int dragonEggItems[] = {Tile::dragonEgg_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Dragon_Egg)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Dragon_Egg, this, dragonEggItems, 1 ) ); - - int redstoneLampItems[] = {Tile::redstoneLight_Id, Tile::redstoneLight_lit_Id}; - if(!isHintCompleted(e_Tutorial_Hint_RedstoneLamp)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_RedstoneLamp, this, redstoneLampItems, 2 ) ); - - int cocoaItems[] = {Tile::cocoa_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Cocoa)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Cocoa, this, cocoaItems, 1 ) ); - - int emeraldOreItems[] = {Tile::emeraldOre_Id}; - if(!isHintCompleted(e_Tutorial_Hint_EmeraldOre)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_EmeraldOre, this, emeraldOreItems, 1 ) ); - - int emeraldBlockItems[] = {Tile::emeraldBlock_Id}; - if(!isHintCompleted(e_Tutorial_Hint_EmeraldBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_EmeraldBlock, this, emeraldBlockItems, 1 ) ); - - int enderChestItems[] = {Tile::enderChest_Id}; - if(!isHintCompleted(e_Tutorial_Hint_EnderChest)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_EnderChest, this, enderChestItems, 1 ) ); - - int tripwireSourceItems[] = {Tile::tripWireSource_Id}; - if(!isHintCompleted(e_Tutorial_Hint_TripwireSource)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_TripwireSource, this, tripwireSourceItems, 1 ) ); - - int tripwireItems[] = {Tile::tripWire_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Tripwire)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tripwire, this, tripwireItems, 1, Item::string_Id ) ); - - int cobblestoneWallItems[] = {Tile::cobbleWall_Id}; - if(!isHintCompleted(e_Tutorial_Hint_CobblestoneWall)) - { - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_CobblestoneWall, this, cobblestoneWallItems, 1, -1, WallTile::TYPE_NORMAL ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_CobblestoneWall, this, cobblestoneWallItems, 1, -1, WallTile::TYPE_MOSSY ) ); - } - - int flowerpotItems[] = {Tile::flowerPot_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Flowerpot)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Flowerpot, this, flowerpotItems, 1, Item::flowerPot_Id ) ); - - int anvilItems[] = {Tile::anvil_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Anvil)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Anvil, this, anvilItems, 1 ) ); - - int quartzOreItems[] = {Tile::netherQuartz_Id}; - if(!isHintCompleted(e_Tutorial_Hint_QuartzOre)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_QuartzOre, this, quartzOreItems, 1 ) ); - - int quartzBlockItems[] = {Tile::quartzBlock_Id}; - if(!isHintCompleted(e_Tutorial_Hint_QuartzBlock)) - { - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_QuartzBlock, this, quartzBlockItems, 1, -1, QuartzBlockTile::TYPE_DEFAULT ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_QuartzBlock, this, quartzBlockItems, 1, -1, QuartzBlockTile::TYPE_CHISELED ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_QuartzBlock, this, quartzBlockItems, 1, -1, QuartzBlockTile::TYPE_LINES_Y ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_QuartzBlock, this, quartzBlockItems, 1, -1, QuartzBlockTile::TYPE_LINES_X ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_QuartzBlock, this, quartzBlockItems, 1, -1, QuartzBlockTile::TYPE_LINES_Z ) ); - } - - int carpetItems[] = {Tile::woolCarpet_Id}; - if(!isHintCompleted(e_Tutorial_Hint_WoolCarpet)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_WoolCarpet, this, carpetItems, 1 ) ); - - int potatoItems[] = {Tile::potatoes_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Potato)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Potato, this, potatoItems, 1, -1, -1, 7 ) ); - - int carrotItems[] = {Tile::carrots_Id}; - if(!isHintCompleted(e_Tutorial_Hint_Carrot)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Carrot, this, carrotItems, 1, -1, -1, 7 ) ); - - /* - * ENTITY HINTS - */ - if(!isHintCompleted(e_Tutorial_Hint_Squid)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Squid, this, IDS_DESC_SQUID, IDS_SQUID, eTYPE_SQUID ) ); - if(!isHintCompleted(e_Tutorial_Hint_Cow)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Cow, this, IDS_DESC_COW, IDS_COW, eTYPE_COW ) ); - if(!isHintCompleted(e_Tutorial_Hint_Sheep)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Sheep, this, IDS_DESC_SHEEP, IDS_SHEEP, eTYPE_SHEEP ) ); - if(!isHintCompleted(e_Tutorial_Hint_Chicken)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Chicken, this, IDS_DESC_CHICKEN, IDS_CHICKEN, eTYPE_CHICKEN ) ); - if(!isHintCompleted(e_Tutorial_Hint_Pig)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Pig, this, IDS_DESC_PIG, IDS_PIG, eTYPE_PIG ) ); - if(!isHintCompleted(e_Tutorial_Hint_Wolf)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Wolf, this, IDS_DESC_WOLF, IDS_WOLF, eTYPE_WOLF ) ); - if(!isHintCompleted(e_Tutorial_Hint_Creeper)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Creeper, this, IDS_DESC_CREEPER, IDS_CREEPER, eTYPE_CREEPER ) ); - if(!isHintCompleted(e_Tutorial_Hint_Skeleton)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Skeleton, this, IDS_DESC_SKELETON, IDS_SKELETON, eTYPE_SKELETON ) ); - if(!isHintCompleted(e_Tutorial_Hint_Spider)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Spider, this, IDS_DESC_SPIDER, IDS_SPIDER, eTYPE_SPIDER ) ); - if(!isHintCompleted(e_Tutorial_Hint_Zombie)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Zombie, this, IDS_DESC_ZOMBIE, IDS_ZOMBIE, eTYPE_ZOMBIE ) ); - if(!isHintCompleted(e_Tutorial_Hint_Pig_Zombie)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Pig_Zombie, this, IDS_DESC_PIGZOMBIE, IDS_PIGZOMBIE, eTYPE_PIGZOMBIE ) ); - if(!isHintCompleted(e_Tutorial_Hint_Ghast)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Ghast, this, IDS_DESC_GHAST, IDS_GHAST, eTYPE_GHAST ) ); - if(!isHintCompleted(e_Tutorial_Hint_Slime)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Slime, this, IDS_DESC_SLIME, IDS_SLIME, eTYPE_SLIME ) ); - if(!isHintCompleted(e_Tutorial_Hint_Enderman)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Enderman, this, IDS_DESC_ENDERMAN, IDS_ENDERMAN, eTYPE_ENDERMAN ) ); - if(!isHintCompleted(e_Tutorial_Hint_Silverfish)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Silverfish, this, IDS_DESC_SILVERFISH, IDS_SILVERFISH, eTYPE_SILVERFISH ) ); - if(!isHintCompleted(e_Tutorial_Hint_Cave_Spider)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Cave_Spider, this, IDS_DESC_CAVE_SPIDER, IDS_CAVE_SPIDER, eTYPE_CAVESPIDER ) ); - if(!isHintCompleted(e_Tutorial_Hint_MushroomCow)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_MushroomCow, this, IDS_DESC_MUSHROOM_COW, IDS_MUSHROOM_COW, eTYPE_MUSHROOMCOW) ); - if(!isHintCompleted(e_Tutorial_Hint_SnowMan)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_SnowMan, this, IDS_DESC_SNOWMAN, IDS_SNOWMAN, eTYPE_SNOWMAN ) ); - if(!isHintCompleted(e_Tutorial_Hint_IronGolem)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_IronGolem, this, IDS_DESC_IRONGOLEM, IDS_IRONGOLEM, eTYPE_VILLAGERGOLEM ) ); - if(!isHintCompleted(e_Tutorial_Hint_EnderDragon)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_EnderDragon, this, IDS_DESC_ENDERDRAGON, IDS_ENDERDRAGON, eTYPE_ENDERDRAGON ) ); - if(!isHintCompleted(e_Tutorial_Hint_Blaze)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Blaze, this, IDS_DESC_BLAZE, IDS_BLAZE, eTYPE_BLAZE ) ); - if(!isHintCompleted(e_Tutorial_Hint_Lava_Slime)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Lava_Slime, this, IDS_DESC_LAVA_SLIME, IDS_LAVA_SLIME, eTYPE_LAVASLIME ) ); - if(!isHintCompleted(e_Tutorial_Hint_Ozelot)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Ozelot, this, IDS_DESC_OZELOT, IDS_OZELOT, eTYPE_OZELOT ) ); - if(!isHintCompleted(e_Tutorial_Hint_Villager)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Villager, this, IDS_DESC_VILLAGER, IDS_VILLAGER, eTYPE_VILLAGER) ); - - - /* - * ITEM HINTS - */ - int shovelItems[] = {Item::shovel_wood->id, Item::shovel_stone->id, Item::shovel_iron->id, Item::shovel_gold->id, Item::shovel_diamond->id}; - if(!isHintCompleted(e_Tutorial_Hint_Item_Shovel)) addHint(e_Tutorial_State_Gameplay, new DiggerItemHint(e_Tutorial_Hint_Item_Shovel, this, IDS_TUTORIAL_HINT_DIGGER_ITEM_SHOVEL, shovelItems, 5) ); - - int hatchetItems[] = {Item::hatchet_wood->id, Item::hatchet_stone->id, Item::hatchet_iron->id, Item::hatchet_gold->id, Item::hatchet_diamond->id}; - if(!isHintCompleted(e_Tutorial_Hint_Item_Hatchet)) addHint(e_Tutorial_State_Gameplay, new DiggerItemHint(e_Tutorial_Hint_Item_Hatchet, this, IDS_TUTORIAL_HINT_DIGGER_ITEM_HATCHET, hatchetItems, 5 ) ); - - int pickaxeItems[] = {Item::pickAxe_wood->id, Item::pickAxe_stone->id, Item::pickAxe_iron->id, Item::pickAxe_gold->id, Item::pickAxe_diamond->id}; - if(!isHintCompleted(e_Tutorial_Hint_Item_Pickaxe)) addHint(e_Tutorial_State_Gameplay, new DiggerItemHint(e_Tutorial_Hint_Item_Pickaxe, this, IDS_TUTORIAL_HINT_DIGGER_ITEM_PICKAXE, pickaxeItems, 5 ) ); - - /* - * - * - * INVENTORY - * - */ - if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Inventory_Menu) ) - { - ProcedureCompoundTask *inventoryOverviewTask = new ProcedureCompoundTask( this ); - inventoryOverviewTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_INV_OVERVIEW, IDS_TUTORIAL_PROMPT_INV_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_Inventory) ); - inventoryOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_INV_PICK_UP, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - inventoryOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_INV_MOVE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - inventoryOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_INV_DROP, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - inventoryOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_INV_INFO, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Inventory_Menu, inventoryOverviewTask ); - } - - /* - * - * - * CREATIVE INVENTORY - * - */ - if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Creative_Inventory_Menu) ) - { - ProcedureCompoundTask *creativeInventoryOverviewTask = new ProcedureCompoundTask( this ); - creativeInventoryOverviewTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_CREATIVE_INV_OVERVIEW, IDS_TUTORIAL_PROMPT_CREATIVE_INV_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_CreativeInventory) ); - creativeInventoryOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CREATIVE_INV_PICK_UP, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - creativeInventoryOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CREATIVE_INV_MOVE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - creativeInventoryOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CREATIVE_INV_DROP, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - creativeInventoryOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CREATIVE_INV_NAV, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - creativeInventoryOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CREATIVE_INV_INFO, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Creative_Inventory_Menu, creativeInventoryOverviewTask ); - } - - /* - * - * - * CRAFTING - * - */ - if(isFullTutorial || !isStateCompleted( e_Tutorial_State_2x2Crafting_Menu ) ) - { - ProcedureCompoundTask *craftingOverviewTask = new ProcedureCompoundTask( this ); - craftingOverviewTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_CRAFT_OVERVIEW, IDS_TUTORIAL_PROMPT_CRAFT_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_Crafting) ); - craftingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_NAV, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - craftingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_CREATE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - craftingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_CRAFT_TABLE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - craftingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_INVENTORY, IDS_TUTORIAL_PROMPT_PRESS_X_TO_TOGGLE_DESCRIPTION, false, ACTION_MENU_X) ); - craftingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_DESCRIPTION, IDS_TUTORIAL_PROMPT_PRESS_X_TO_TOGGLE_INGREDIENTS, false, ACTION_MENU_X) ); - craftingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_INGREDIENTS, IDS_TUTORIAL_PROMPT_PRESS_X_TO_TOGGLE_INVENTORY, false, ACTION_MENU_X) ); - addTask(e_Tutorial_State_2x2Crafting_Menu, craftingOverviewTask ); - } - // Other tasks can be added in the derived classes - - addHint(e_Tutorial_State_2x2Crafting_Menu, new TutorialHint(e_Tutorial_Hint_Always_On, this, IDS_TUTORIAL_HINT_CRAFT_NO_INGREDIENTS, TutorialHint::e_Hint_NoIngredients) ); - - addHint(e_Tutorial_State_3x3Crafting_Menu, new TutorialHint(e_Tutorial_Hint_Always_On, this, IDS_TUTORIAL_HINT_CRAFT_NO_INGREDIENTS, TutorialHint::e_Hint_NoIngredients) ); - - /* - * - * - * FURNACE - * - */ - if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Furnace_Menu ) ) - { - ProcedureCompoundTask *furnaceOverviewTask = new ProcedureCompoundTask( this ); - furnaceOverviewTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_FURNACE_OVERVIEW, IDS_TUTORIAL_PROMPT_FURNACE_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_Furnace) ); - furnaceOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_FURNACE_METHOD, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - furnaceOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_FURNACE_FUELS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - furnaceOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_FURNACE_INGREDIENTS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Furnace_Menu, furnaceOverviewTask ); - } - // Other tasks can be added in the derived classes - - /* - * - * - * BREWING MENU - * - */ - if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Brewing_Menu ) ) - { - ProcedureCompoundTask *brewingOverviewTask = new ProcedureCompoundTask( this ); - brewingOverviewTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_BREWING_MENU_OVERVIEW, IDS_TUTORIAL_PROMPT_BREWING_MENU_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_BrewingMenu) ); - brewingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_BREWING_MENU_METHOD, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - brewingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_BREWING_MENU_BASIC_INGREDIENTS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - brewingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_BREWING_MENU_EXTENDED_INGREDIENTS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - brewingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_BREWING_MENU_EXTENDED_INGREDIENTS_2, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Brewing_Menu, brewingOverviewTask ); - } - // Other tasks can be added in the derived classes - - /* - * - * - * ENCHANTING MENU - * - */ - if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Enchanting_Menu ) ) - { - ProcedureCompoundTask *enchantingOverviewTask = new ProcedureCompoundTask( this ); - enchantingOverviewTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_ENCHANTING_MENU_OVERVIEW, IDS_TUTORIAL_PROMPT_ENCHANTING_MENU_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_EnchantingMenu) ); - enchantingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_MENU_START, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - enchantingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_MENU_ENCHANTMENTS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - enchantingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_MENU_COST, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - enchantingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_MENU_ENCHANT, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - enchantingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_MENU_BETTER_ENCHANTMENTS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Enchanting_Menu, enchantingOverviewTask ); - } - // Other tasks can be added in the derived classes - - /* - * - * - * ANVIL MENU - * - */ - if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Anvil_Menu ) ) - { - ProcedureCompoundTask *anvilOverviewTask = new ProcedureCompoundTask( this ); - anvilOverviewTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_ANVIL_MENU_OVERVIEW, IDS_TUTORIAL_PROMPT_ANVIL_MENU_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_AnvilMenu) ); - anvilOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_MENU_START, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - anvilOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_MENU_REPAIR, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - anvilOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_MENU_SACRIFICE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - anvilOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_MENU_ENCHANT, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - anvilOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_MENU_COST, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - anvilOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_MENU_RENAMING, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - anvilOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_MENU_SMITH, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Anvil_Menu, anvilOverviewTask ); - } - // Other tasks can be added in the derived classes - - /* - * - * - * TRADING MENU - * - */ - if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Trading_Menu ) ) - { - ProcedureCompoundTask *tradingOverviewTask = new ProcedureCompoundTask( this ); - tradingOverviewTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_TRADING_MENU_OVERVIEW, IDS_TUTORIAL_PROMPT_TRADING_MENU_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_TradingMenu) ); - tradingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_MENU_START, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - tradingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_MENU_UNAVAILABLE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - tradingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_MENU_DETAILS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - tradingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_MENU_INVENTORY, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - tradingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_MENU_TRADE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Trading_Menu, tradingOverviewTask ); - } - // Other tasks can be added in the derived classes - - /* - * - * - * MINECART - * - */ - if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Riding_Minecart ) ) - { - addTask(e_Tutorial_State_Riding_Minecart, new ChoiceTask(this, IDS_TUTORIAL_TASK_MINECART_OVERVIEW, IDS_TUTORIAL_PROMPT_MINECART_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Minecart) ); - addTask(e_Tutorial_State_Riding_Minecart, new InfoTask(this, IDS_TUTORIAL_TASK_MINECART_RAILS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Riding_Minecart, new InfoTask(this, IDS_TUTORIAL_TASK_MINECART_POWERED_RAILS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Riding_Minecart, new InfoTask(this, IDS_TUTORIAL_TASK_MINECART_PUSHING, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - } - - /* - * - * - * BOAT - * - */ - if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Riding_Boat ) ) - { - addTask(e_Tutorial_State_Riding_Boat, new ChoiceTask(this, IDS_TUTORIAL_TASK_BOAT_OVERVIEW, IDS_TUTORIAL_PROMPT_BOAT_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Boat) ); - addTask(e_Tutorial_State_Riding_Boat, new InfoTask(this, IDS_TUTORIAL_TASK_BOAT_STEER, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - } - - /* - * - * - * FISHING - * - */ - if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Fishing ) ) - { - addTask(e_Tutorial_State_Fishing, new ChoiceTask(this, IDS_TUTORIAL_TASK_FISHING_OVERVIEW, IDS_TUTORIAL_PROMPT_FISHING_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Fishing) ); - addTask(e_Tutorial_State_Fishing, new InfoTask(this, IDS_TUTORIAL_TASK_FISHING_CAST, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Fishing, new InfoTask(this, IDS_TUTORIAL_TASK_FISHING_FISH, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Fishing, new InfoTask(this, IDS_TUTORIAL_TASK_FISHING_USES, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - } - - /* - * - * - * BED - * - */ - if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Bed ) ) - { - addTask(e_Tutorial_State_Bed, new ChoiceTask(this, IDS_TUTORIAL_TASK_BED_OVERVIEW, IDS_TUTORIAL_PROMPT_BED_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Bed) ); - addTask(e_Tutorial_State_Bed, new InfoTask(this, IDS_TUTORIAL_TASK_BED_PLACEMENT, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Bed, new InfoTask(this, IDS_TUTORIAL_TASK_BED_MULTIPLAYER, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - } - - /* - * - * - * FOOD BAR - * - */ - if(!isFullTutorial && !isStateCompleted( e_Tutorial_State_Food_Bar ) ) - { - addTask(e_Tutorial_State_Food_Bar, new ChoiceTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_OVERVIEW, IDS_TUTORIAL_PROMPT_FOOD_BAR_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_FoodBar) ); - addTask(e_Tutorial_State_Food_Bar, new InfoTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_DEPLETE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Food_Bar, new InfoTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_HEAL, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - addTask(e_Tutorial_State_Food_Bar, new InfoTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_FEED, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); - } + for (unsigned int i = 0; i < e_Tutorial_State_Max; ++i) { + currentTask[i] = NULL; + currentFailedConstraint[i] = NULL; + } + + // DEFAULT TASKS THAT ALL TUTORIALS SHARE + /* + * + * + * GAMEPLAY + * + */ + + if (!isHintCompleted(e_Tutorial_Hint_Hold_To_Mine)) + addHint(e_Tutorial_State_Gameplay, + new TutorialHint(e_Tutorial_Hint_Hold_To_Mine, this, + IDS_TUTORIAL_HINT_HOLD_TO_MINE, + TutorialHint::e_Hint_HoldToMine)); + if (!isHintCompleted(e_Tutorial_Hint_Tool_Damaged)) + addHint(e_Tutorial_State_Gameplay, + new TutorialHint(e_Tutorial_Hint_Tool_Damaged, this, + IDS_TUTORIAL_HINT_TOOL_DAMAGED, + TutorialHint::e_Hint_ToolDamaged)); + if (!isHintCompleted(e_Tutorial_Hint_Swim_Up)) + addHint(e_Tutorial_State_Gameplay, + new TutorialHint(e_Tutorial_Hint_Swim_Up, this, + IDS_TUTORIAL_HINT_SWIM_UP, + TutorialHint::e_Hint_SwimUp)); + + /* + * TILE HINTS + */ + int rockItems[] = {Tile::stone_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Rock)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Rock, this, rockItems, 1)); + + int stoneItems[] = {Tile::cobblestone_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Stone)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Stone, this, stoneItems, 1)); + + int plankItems[] = {Tile::wood_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Planks)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Planks, this, plankItems, 1)); + + int saplingItems[] = {Tile::sapling_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Sapling)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Sapling, this, saplingItems, 1)); + + int unbreakableItems[] = {Tile::unbreakable_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Unbreakable)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Unbreakable, this, + unbreakableItems, 1)); + + int waterItems[] = {Tile::water_Id, Tile::calmWater_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Water)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Water, this, waterItems, 2)); + + int lavaItems[] = {Tile::lava_Id, Tile::calmLava_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Lava)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Lava, this, lavaItems, 2)); + + int sandItems[] = {Tile::sand_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Sand)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Sand, this, sandItems, 1)); + + int gravelItems[] = {Tile::gravel_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Gravel)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Gravel, this, gravelItems, 1)); + + int goldOreItems[] = {Tile::goldOre_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Gold_Ore)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Gold_Ore, this, goldOreItems, + 1)); + + int ironOreItems[] = {Tile::ironOre_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Iron_Ore)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Iron_Ore, this, ironOreItems, + 1)); + + int coalOreItems[] = {Tile::coalOre_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Coal_Ore)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Coal_Ore, this, coalOreItems, + 1)); + + int treeTrunkItems[] = {Tile::treeTrunk_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Tree_Trunk)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Tree_Trunk, this, + treeTrunkItems, 1)); + + int leavesItems[] = {Tile::leaves_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Leaves)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Leaves, this, leavesItems, 1)); + + int glassItems[] = {Tile::glass_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Glass)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Glass, this, glassItems, 1)); + + int lapisOreItems[] = {Tile::lapisOre_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Lapis_Ore)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Lapis_Ore, this, + lapisOreItems, 1)); + + int lapisBlockItems[] = {Tile::lapisBlock_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Lapis_Block)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Lapis_Block, this, + lapisBlockItems, 1)); + + int dispenserItems[] = {Tile::dispenser_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Dispenser)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Dispenser, this, + dispenserItems, 1)); + + int sandstoneItems[] = {Tile::sandStone_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Sandstone)) { + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Sandstone, this, sandstoneItems, + 1, -1, SandStoneTile::TYPE_DEFAULT)); + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Sandstone, this, sandstoneItems, + 1, -1, SandStoneTile::TYPE_HEIROGLYPHS)); + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Sandstone, this, sandstoneItems, + 1, -1, SandStoneTile::TYPE_SMOOTHSIDE)); + } + + int noteBlockItems[] = {Tile::noteblock_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Note_Block)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Note_Block, this, + noteBlockItems, 1)); + + int poweredRailItems[] = {Tile::goldenRail_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Powered_Rail)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Powered_Rail, this, + poweredRailItems, 1)); + + int detectorRailItems[] = {Tile::detectorRail_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Detector_Rail)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Detector_Rail, this, + detectorRailItems, 1)); + + int tallGrassItems[] = {Tile::tallgrass_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Tall_Grass)) { + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Tall_Grass, this, tallGrassItems, + 1, -1, TallGrass::DEAD_SHRUB)); + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Tall_Grass, this, tallGrassItems, + 1, -1, TallGrass::TALL_GRASS)); + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Tall_Grass, this, + tallGrassItems, 1, -1, TallGrass::FERN)); + } + + int woolItems[] = {Tile::wool_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Wool)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Wool, this, woolItems, 1)); + + int flowerItems[] = {Tile::flower_Id, Tile::rose_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Flower)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Flower, this, flowerItems, 2)); + + int mushroomItems[] = {Tile::mushroom_brown_Id, Tile::mushroom_red_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Mushroom)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Mushroom, this, + mushroomItems, 2)); + + int goldBlockItems[] = {Tile::goldBlock_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Gold_Block)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Gold_Block, this, + goldBlockItems, 1)); + + int ironBlockItems[] = {Tile::ironBlock_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Iron_Block)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Iron_Block, this, + ironBlockItems, 1)); + + int stoneSlabItems[] = {Tile::stoneSlabHalf_Id, Tile::stoneSlab_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Stone_Slab)) { + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, + 2, -1, StoneSlabTile::STONE_SLAB)); + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, + 2, -1, StoneSlabTile::SAND_SLAB)); + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, + 2, -1, StoneSlabTile::WOOD_SLAB)); + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, + 2, -1, StoneSlabTile::COBBLESTONE_SLAB)); + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, + 2, -1, StoneSlabTile::BRICK_SLAB)); + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, + 2, -1, StoneSlabTile::SMOOTHBRICK_SLAB)); + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, + 2, -1, StoneSlabTile::NETHERBRICK_SLAB)); + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, + 2, -1, StoneSlabTile::QUARTZ_SLAB)); + } + + int woodSlabItems[] = {Tile::woodSlabHalf_Id, Tile::woodSlab_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Stone_Slab)) { + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, woodSlabItems, + 2, -1, TreeTile::BIRCH_TRUNK)); + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, + woodSlabItems, 2, -1, TreeTile::DARK_TRUNK)); + } + + int redBrickItems[] = {Tile::redBrick_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Red_Brick)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Red_Brick, this, + redBrickItems, 1)); + + int tntItems[] = {Tile::tnt_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Tnt)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Tnt, this, tntItems, 1)); + + int bookshelfItems[] = {Tile::bookshelf_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Bookshelf)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Bookshelf, this, + bookshelfItems, 1)); + + int mossStoneItems[] = {Tile::mossyCobblestone_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Moss_Stone)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Moss_Stone, this, + mossStoneItems, 1)); + + int obsidianItems[] = {Tile::obsidian_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Obsidian)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Obsidian, this, + obsidianItems, 1)); + + int torchItems[] = {Tile::torch_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Torch)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Torch, this, torchItems, 1)); + + int mobSpawnerItems[] = {Tile::mobSpawner_Id}; + if (!isHintCompleted(e_Tutorial_Hint_MobSpawner)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_MobSpawner, this, + mobSpawnerItems, 1)); + + int chestItems[] = {Tile::chest_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Chest)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Chest, this, chestItems, 1)); + + int redstoneItems[] = {Tile::redStoneDust_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Redstone)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Redstone, this, + redstoneItems, 1, Item::redStone_Id)); + + int diamondOreItems[] = {Tile::diamondOre_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Diamond_Ore)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Diamond_Ore, this, + diamondOreItems, 1)); + + int diamondBlockItems[] = {Tile::diamondBlock_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Diamond_Block)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Diamond_Block, this, + diamondBlockItems, 1)); + + int craftingTableItems[] = {Tile::workBench_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Crafting_Table)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Crafting_Table, this, + craftingTableItems, 1)); + + int cropsItems[] = {Tile::wheat_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Crops)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Crops, this, cropsItems, 1, + -1, -1, 7)); + + int farmlandItems[] = {Tile::farmland_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Farmland)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Farmland, this, + farmlandItems, 1)); + + int furnaceItems[] = {Tile::furnace_Id, Tile::furnace_lit_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Furnace)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Furnace, this, furnaceItems, 2)); + + int signItems[] = {Tile::sign_Id, Tile::wallSign_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Sign)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Sign, this, signItems, 2, + Item::sign_Id)); + + int doorWoodItems[] = {Tile::door_wood_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Door_Wood)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Door_Wood, this, + doorWoodItems, 1, Item::door_wood->id)); + + int ladderItems[] = {Tile::ladder_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Ladder)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Ladder, this, ladderItems, 1)); + + int stairsStoneItems[] = { + Tile::stairs_stone_Id, Tile::stairs_bricks_Id, + Tile::stairs_stoneBrick_Id, Tile::stairs_wood_Id, + Tile::stairs_sprucewood_Id, Tile::stairs_birchwood_Id, + Tile::stairs_netherBricks_Id, Tile::stairs_sandstone_Id, + Tile::stairs_quartz_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Stairs_Stone)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Stairs_Stone, this, + stairsStoneItems, 9)); + + int railItems[] = {Tile::rail_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Rail)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Rail, this, railItems, 1)); + + int leverItems[] = {Tile::lever_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Lever)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Lever, this, leverItems, 1)); + + int pressurePlateItems[] = {Tile::pressurePlate_stone_Id, + Tile::pressurePlate_wood_Id}; + if (!isHintCompleted(e_Tutorial_Hint_PressurePlate)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_PressurePlate, this, + pressurePlateItems, 2)); + + int doorIronItems[] = {Tile::door_iron_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Door_Iron)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Door_Iron, this, + doorIronItems, 1, Item::door_iron->id)); + + int redstoneOreItems[] = {Tile::redStoneOre_Id, Tile::redStoneOre_lit_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Redstone_Ore)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Redstone_Ore, this, + redstoneOreItems, 2)); + + int redstoneTorchItems[] = {Tile::redstoneTorch_off_Id, + Tile::redstoneTorch_on_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Redstone_Torch)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Redstone_Torch, this, + redstoneTorchItems, 2)); + + int buttonItems[] = {Tile::button_stone_Id, Tile::button_wood_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Button)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Button, this, buttonItems, 2)); + + int snowItems[] = {Tile::snow_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Snow)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Snow, this, snowItems, 1)); + + int iceItems[] = {Tile::ice_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Ice)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Ice, this, iceItems, 1)); + + int cactusItems[] = {Tile::cactus_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Cactus)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Cactus, this, cactusItems, 1)); + + int clayItems[] = {Tile::clay_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Clay)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Clay, this, clayItems, 1)); + + int sugarCaneItems[] = {Tile::reeds_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Sugarcane)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Sugarcane, this, + sugarCaneItems, 1)); + + int recordPlayerItems[] = {Tile::jukebox_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Record_Player)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Record_Player, this, + recordPlayerItems, 1)); + + int pumpkinItems[] = {Tile::pumpkin_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Pumpkin)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Pumpkin, this, pumpkinItems, + 1, -1, -1, 0)); + + int hellRockItems[] = {Tile::netherRack_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Hell_Rock)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Hell_Rock, this, + hellRockItems, 1)); + + int hellSandItems[] = {Tile::soulsand_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Hell_Sand)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Hell_Sand, this, + hellSandItems, 1)); + + int glowstoneItems[] = {Tile::glowstone_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Glowstone)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Glowstone, this, + glowstoneItems, 1)); + + int portalItems[] = {Tile::portalTile_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Portal)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Portal, this, portalItems, 1)); + + int pumpkinLitItems[] = {Tile::litPumpkin_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Pumpkin_Lit)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Pumpkin_Lit, this, + pumpkinLitItems, 1, -1, -1, 0)); + + int cakeItems[] = {Tile::cake_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Cake)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Cake, this, cakeItems, 1)); + + int redstoneRepeaterItems[] = {Tile::diode_on_Id, Tile::diode_off_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Redstone_Repeater)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Redstone_Repeater, this, + redstoneRepeaterItems, 2, Item::repeater_Id)); + + int trapdoorItems[] = {Tile::trapdoor_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Trapdoor)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Trapdoor, this, + trapdoorItems, 1)); + + int pistonItems[] = {Tile::pistonBase_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Piston)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Piston, this, pistonItems, 1)); + + int stickyPistonItems[] = {Tile::pistonStickyBase_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Sticky_Piston)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Sticky_Piston, this, + stickyPistonItems, 1)); + + int monsterStoneEggItems[] = {Tile::monsterStoneEgg_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Monster_Stone_Egg)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Monster_Stone_Egg, this, + monsterStoneEggItems, 1)); + + int stoneBrickSmoothItems[] = {Tile::stoneBrick_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Stone_Brick_Smooth)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Stone_Brick_Smooth, this, + stoneBrickSmoothItems, 1)); + + int hugeMushroomItems[] = {Tile::hugeMushroom_brown_Id, + Tile::hugeMushroom_red_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Huge_Mushroom)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Huge_Mushroom, this, + hugeMushroomItems, 2)); + + int ironFenceItems[] = {Tile::ironFence_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Iron_Fence)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Iron_Fence, this, + ironFenceItems, 1)); + + int thisGlassItems[] = {Tile::thinGlass_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Thin_Glass)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Thin_Glass, this, + thisGlassItems, 1)); + + int melonItems[] = {Tile::melon_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Melon)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Melon, this, melonItems, 1)); + + int vineItems[] = {Tile::vine_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Vine)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Vine, this, vineItems, 1)); + + int fenceGateItems[] = {Tile::fenceGate_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Fence_Gate)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Fence_Gate, this, + fenceGateItems, 1)); + + int mycelItems[] = {Tile::mycel_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Mycel)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Mycel, this, mycelItems, 1)); + + int waterLilyItems[] = {Tile::waterLily_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Water_Lily)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Water_Lily, this, + waterLilyItems, 1)); + + int netherBrickItems[] = {Tile::netherBrick_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Nether_Brick)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Nether_Brick, this, + netherBrickItems, 1)); + + int netherFenceItems[] = {Tile::netherFence_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Nether_Fence)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Nether_Fence, this, + netherFenceItems, 1)); + + int netherStalkItems[] = {Tile::netherStalk_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Nether_Stalk)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Nether_Stalk, this, + netherStalkItems, 1)); + + int enchantTableItems[] = {Tile::enchantTable_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Enchant_Table)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Enchant_Table, this, + enchantTableItems, 1)); + + int brewingStandItems[] = {Tile::brewingStand_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Brewing_Stand)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Brewing_Stand, this, + brewingStandItems, 1, Item::brewingStand_Id)); + + int cauldronItems[] = {Tile::cauldron_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Cauldron)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Cauldron, this, + cauldronItems, 1, Item::cauldron_Id)); + + int endPortalItems[] = {Tile::endPortalTile_Id}; + if (!isHintCompleted(e_Tutorial_Hint_End_Portal)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_End_Portal, this, + endPortalItems, 1, -2)); + + int endPortalFrameItems[] = {Tile::endPortalFrameTile_Id}; + if (!isHintCompleted(e_Tutorial_Hint_End_Portal_Frame)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_End_Portal_Frame, this, + endPortalFrameItems, 1)); + + int whiteStoneItems[] = {Tile::endStone_Id}; + if (!isHintCompleted(e_Tutorial_Hint_White_Stone)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_White_Stone, this, + whiteStoneItems, 1)); + + int dragonEggItems[] = {Tile::dragonEgg_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Dragon_Egg)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Dragon_Egg, this, + dragonEggItems, 1)); + + int redstoneLampItems[] = {Tile::redstoneLight_Id, + Tile::redstoneLight_lit_Id}; + if (!isHintCompleted(e_Tutorial_Hint_RedstoneLamp)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_RedstoneLamp, this, + redstoneLampItems, 2)); + + int cocoaItems[] = {Tile::cocoa_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Cocoa)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Cocoa, this, cocoaItems, 1, + Item::dye_powder_Id, -1, DyePowderItem::BROWN)); + + int emeraldOreItems[] = {Tile::emeraldOre_Id}; + if (!isHintCompleted(e_Tutorial_Hint_EmeraldOre)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_EmeraldOre, this, + emeraldOreItems, 1)); + + int emeraldBlockItems[] = {Tile::emeraldBlock_Id}; + if (!isHintCompleted(e_Tutorial_Hint_EmeraldBlock)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_EmeraldBlock, this, + emeraldBlockItems, 1)); + + int enderChestItems[] = {Tile::enderChest_Id}; + if (!isHintCompleted(e_Tutorial_Hint_EnderChest)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_EnderChest, this, + enderChestItems, 1)); + + int tripwireSourceItems[] = {Tile::tripWireSource_Id}; + if (!isHintCompleted(e_Tutorial_Hint_TripwireSource)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_TripwireSource, this, + tripwireSourceItems, 1)); + + int tripwireItems[] = {Tile::tripWire_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Tripwire)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Tripwire, this, + tripwireItems, 1, Item::string_Id)); + + int cobblestoneWallItems[] = {Tile::cobbleWall_Id}; + if (!isHintCompleted(e_Tutorial_Hint_CobblestoneWall)) { + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_CobblestoneWall, this, + cobblestoneWallItems, 1, -1, + WallTile::TYPE_NORMAL)); + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_CobblestoneWall, this, + cobblestoneWallItems, 1, -1, + WallTile::TYPE_MOSSY)); + } + + int flowerpotItems[] = {Tile::flowerPot_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Flowerpot)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Flowerpot, this, + flowerpotItems, 1, Item::flowerPot_Id)); + + int anvilItems[] = {Tile::anvil_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Anvil)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Anvil, this, anvilItems, 1)); + + int quartzOreItems[] = {Tile::netherQuartz_Id}; + if (!isHintCompleted(e_Tutorial_Hint_QuartzOre)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_QuartzOre, this, + quartzOreItems, 1)); + + int quartzBlockItems[] = {Tile::quartzBlock_Id}; + if (!isHintCompleted(e_Tutorial_Hint_QuartzBlock)) { + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_QuartzBlock, this, + quartzBlockItems, 1, -1, + QuartzBlockTile::TYPE_DEFAULT)); + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_QuartzBlock, this, + quartzBlockItems, 1, -1, + QuartzBlockTile::TYPE_CHISELED)); + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_QuartzBlock, this, + quartzBlockItems, 1, -1, + QuartzBlockTile::TYPE_LINES_Y)); + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_QuartzBlock, this, + quartzBlockItems, 1, -1, + QuartzBlockTile::TYPE_LINES_X)); + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_QuartzBlock, this, + quartzBlockItems, 1, -1, + QuartzBlockTile::TYPE_LINES_Z)); + } + + int carpetItems[] = {Tile::woolCarpet_Id}; + if (!isHintCompleted(e_Tutorial_Hint_WoolCarpet)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_WoolCarpet, this, + carpetItems, 1)); + + int potatoItems[] = {Tile::potatoes_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Potato)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Potato, this, potatoItems, 1, + -1, -1, 7)); + + int carrotItems[] = {Tile::carrots_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Carrot)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Carrot, this, carrotItems, 1, + -1, -1, 7)); + + int commandBlockItems[] = {Tile::commandBlock_Id}; + if (!isHintCompleted(e_Tutorial_Hint_CommandBlock)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_CommandBlock, this, + commandBlockItems, 1)); + + int beaconItems[] = {Tile::beacon_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Beacon)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Beacon, this, beaconItems, 1)); + + int activatorRailItems[] = {Tile::activatorRail_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Activator_Rail)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Activator_Rail, this, + activatorRailItems, 1)); + + int redstoneBlockItems[] = {Tile::redstoneBlock_Id}; + if (!isHintCompleted(e_Tutorial_Hint_RedstoneBlock)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_RedstoneBlock, this, + redstoneBlockItems, 1)); + + int daylightDetectorItems[] = {Tile::daylightDetector_Id}; + if (!isHintCompleted(e_Tutorial_Hint_DaylightDetector)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_DaylightDetector, this, + daylightDetectorItems, 1)); + + int dropperItems[] = {Tile::dropper_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Dropper)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Dropper, this, dropperItems, 1)); + + int hopperItems[] = {Tile::hopper_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Hopper)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Hopper, this, hopperItems, 1)); + + int comparatorItems[] = {Tile::comparator_off_Id, Tile::comparator_on_Id}; + if (!isHintCompleted(e_Tutorial_Hint_Comparator)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_Comparator, this, + comparatorItems, 2, Item::comparator_Id)); + + int trappedChestItems[] = {Tile::chest_trap_Id}; + if (!isHintCompleted(e_Tutorial_Hint_ChestTrap)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_ChestTrap, this, + trappedChestItems, 1)); + + int hayBlockItems[] = {Tile::hayBlock_Id}; + if (!isHintCompleted(e_Tutorial_Hint_HayBlock)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_HayBlock, this, + hayBlockItems, 1)); + + int clayHardenedItems[] = {Tile::clayHardened_Id}; + if (!isHintCompleted(e_Tutorial_Hint_ClayHardened)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_ClayHardened, this, + clayHardenedItems, 1)); + + int clayHardenedColoredItems[] = {Tile::clayHardened_colored_Id}; + if (!isHintCompleted(e_Tutorial_Hint_ClayHardenedColored)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_ClayHardenedColored, this, + clayHardenedColoredItems, 1)); + + int coalBlockItems[] = {Tile::coalBlock_Id}; + if (!isHintCompleted(e_Tutorial_Hint_CoalBlock)) + addHint(e_Tutorial_State_Gameplay, + new LookAtTileHint(e_Tutorial_Hint_CoalBlock, this, + coalBlockItems, 1)); + + /* + * ENTITY HINTS + */ + if (!isHintCompleted(e_Tutorial_Hint_Squid)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Squid, this, + IDS_DESC_SQUID, IDS_SQUID, eTYPE_SQUID)); + if (!isHintCompleted(e_Tutorial_Hint_Cow)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Cow, this, IDS_DESC_COW, + IDS_COW, eTYPE_COW)); + if (!isHintCompleted(e_Tutorial_Hint_Sheep)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Sheep, this, + IDS_DESC_SHEEP, IDS_SHEEP, eTYPE_SHEEP)); + if (!isHintCompleted(e_Tutorial_Hint_Chicken)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Chicken, this, + IDS_DESC_CHICKEN, IDS_CHICKEN, eTYPE_CHICKEN)); + if (!isHintCompleted(e_Tutorial_Hint_Pig)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Pig, this, IDS_DESC_PIG, + IDS_PIG, eTYPE_PIG)); + if (!isHintCompleted(e_Tutorial_Hint_Wolf)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Wolf, this, IDS_DESC_WOLF, + IDS_WOLF, eTYPE_WOLF)); + if (!isHintCompleted(e_Tutorial_Hint_Creeper)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Creeper, this, + IDS_DESC_CREEPER, IDS_CREEPER, eTYPE_CREEPER)); + if (!isHintCompleted(e_Tutorial_Hint_Skeleton)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Skeleton, this, + IDS_DESC_SKELETON, IDS_SKELETON, + eTYPE_SKELETON)); + if (!isHintCompleted(e_Tutorial_Hint_Spider)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Spider, this, IDS_DESC_SPIDER, + IDS_SPIDER, eTYPE_SPIDER)); + if (!isHintCompleted(e_Tutorial_Hint_Zombie)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Zombie, this, IDS_DESC_ZOMBIE, + IDS_ZOMBIE, eTYPE_ZOMBIE)); + if (!isHintCompleted(e_Tutorial_Hint_Pig_Zombie)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Pig_Zombie, this, + IDS_DESC_PIGZOMBIE, IDS_PIGZOMBIE, + eTYPE_PIGZOMBIE)); + if (!isHintCompleted(e_Tutorial_Hint_Ghast)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Ghast, this, + IDS_DESC_GHAST, IDS_GHAST, eTYPE_GHAST)); + if (!isHintCompleted(e_Tutorial_Hint_Slime)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Slime, this, + IDS_DESC_SLIME, IDS_SLIME, eTYPE_SLIME)); + if (!isHintCompleted(e_Tutorial_Hint_Enderman)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Enderman, this, + IDS_DESC_ENDERMAN, IDS_ENDERMAN, + eTYPE_ENDERMAN)); + if (!isHintCompleted(e_Tutorial_Hint_Silverfish)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Silverfish, this, + IDS_DESC_SILVERFISH, IDS_SILVERFISH, + eTYPE_SILVERFISH)); + if (!isHintCompleted(e_Tutorial_Hint_Cave_Spider)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Cave_Spider, this, + IDS_DESC_CAVE_SPIDER, IDS_CAVE_SPIDER, + eTYPE_CAVESPIDER)); + if (!isHintCompleted(e_Tutorial_Hint_MushroomCow)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_MushroomCow, this, + IDS_DESC_MUSHROOM_COW, IDS_MUSHROOM_COW, + eTYPE_MUSHROOMCOW)); + if (!isHintCompleted(e_Tutorial_Hint_SnowMan)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_SnowMan, this, + IDS_DESC_SNOWMAN, IDS_SNOWMAN, eTYPE_SNOWMAN)); + if (!isHintCompleted(e_Tutorial_Hint_IronGolem)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_IronGolem, this, + IDS_DESC_IRONGOLEM, IDS_IRONGOLEM, + eTYPE_VILLAGERGOLEM)); + if (!isHintCompleted(e_Tutorial_Hint_EnderDragon)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_EnderDragon, this, + IDS_DESC_ENDERDRAGON, IDS_ENDERDRAGON, + eTYPE_ENDERDRAGON)); + if (!isHintCompleted(e_Tutorial_Hint_Blaze)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Blaze, this, + IDS_DESC_BLAZE, IDS_BLAZE, eTYPE_BLAZE)); + if (!isHintCompleted(e_Tutorial_Hint_Lava_Slime)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Lava_Slime, this, + IDS_DESC_LAVA_SLIME, IDS_LAVA_SLIME, + eTYPE_LAVASLIME)); + if (!isHintCompleted(e_Tutorial_Hint_Ozelot)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Ozelot, this, IDS_DESC_OZELOT, + IDS_OZELOT, eTYPE_OCELOT)); + if (!isHintCompleted(e_Tutorial_Hint_Villager)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Villager, this, + IDS_DESC_VILLAGER, IDS_VILLAGER, + eTYPE_VILLAGER)); + if (!isHintCompleted(e_Tutorial_Hint_Wither)) + addHint( + e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Wither, this, IDS_DESC_WITHER, + IDS_WITHER, eTYPE_WITHERBOSS)); + if (!isHintCompleted(e_Tutorial_Hint_Witch)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Witch, this, + IDS_DESC_WITCH, IDS_WITCH, eTYPE_WITCH)); + if (!isHintCompleted(e_Tutorial_Hint_Bat)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Bat, this, IDS_DESC_BAT, + IDS_BAT, eTYPE_BAT)); + if (!isHintCompleted(e_Tutorial_Hint_Horse)) + addHint(e_Tutorial_State_Gameplay, + new LookAtEntityHint(e_Tutorial_Hint_Horse, this, + IDS_DESC_HORSE, IDS_HORSE, eTYPE_HORSE)); + + /* + * ITEM HINTS + */ + int shovelItems[] = {Item::shovel_wood->id, Item::shovel_stone->id, + Item::shovel_iron->id, Item::shovel_gold->id, + Item::shovel_diamond->id}; + if (!isHintCompleted(e_Tutorial_Hint_Item_Shovel)) + addHint(e_Tutorial_State_Gameplay, + new DiggerItemHint(e_Tutorial_Hint_Item_Shovel, this, + IDS_TUTORIAL_HINT_DIGGER_ITEM_SHOVEL, + shovelItems, 5)); + + int hatchetItems[] = {Item::hatchet_wood->id, Item::hatchet_stone->id, + Item::hatchet_iron->id, Item::hatchet_gold->id, + Item::hatchet_diamond->id}; + if (!isHintCompleted(e_Tutorial_Hint_Item_Hatchet)) + addHint(e_Tutorial_State_Gameplay, + new DiggerItemHint(e_Tutorial_Hint_Item_Hatchet, this, + IDS_TUTORIAL_HINT_DIGGER_ITEM_HATCHET, + hatchetItems, 5)); + + int pickaxeItems[] = {Item::pickAxe_wood->id, Item::pickAxe_stone->id, + Item::pickAxe_iron->id, Item::pickAxe_gold->id, + Item::pickAxe_diamond->id}; + if (!isHintCompleted(e_Tutorial_Hint_Item_Pickaxe)) + addHint(e_Tutorial_State_Gameplay, + new DiggerItemHint(e_Tutorial_Hint_Item_Pickaxe, this, + IDS_TUTORIAL_HINT_DIGGER_ITEM_PICKAXE, + pickaxeItems, 5)); + + /* + * + * + * INVENTORY + * + */ + if (isFullTutorial || !isStateCompleted(e_Tutorial_State_Inventory_Menu)) { + ProcedureCompoundTask* inventoryOverviewTask = + new ProcedureCompoundTask(this); + inventoryOverviewTask->AddTask(new ChoiceTask( + this, IDS_TUTORIAL_TASK_INV_OVERVIEW, + IDS_TUTORIAL_PROMPT_INV_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, e_Tutorial_Completion_Complete_State, + eTelemetryTutorial_Inventory)); + inventoryOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_INV_PICK_UP, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + inventoryOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_INV_MOVE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + inventoryOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_INV_DROP, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + inventoryOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_INV_INFO, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + addTask(e_Tutorial_State_Inventory_Menu, inventoryOverviewTask); + } + + /* + * + * + * CREATIVE INVENTORY + * + */ + if (isFullTutorial || + !isStateCompleted(e_Tutorial_State_Creative_Inventory_Menu)) { + ProcedureCompoundTask* creativeInventoryOverviewTask = + new ProcedureCompoundTask(this); + creativeInventoryOverviewTask->AddTask(new ChoiceTask( + this, IDS_TUTORIAL_TASK_CREATIVE_INV_OVERVIEW, + IDS_TUTORIAL_PROMPT_CREATIVE_INV_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, e_Tutorial_Completion_Complete_State, + eTelemetryTutorial_CreativeInventory)); + creativeInventoryOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_CREATIVE_INV_PICK_UP, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + creativeInventoryOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_CREATIVE_INV_MOVE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + creativeInventoryOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_CREATIVE_INV_DROP, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + creativeInventoryOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_CREATIVE_INV_NAV, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + creativeInventoryOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_CREATIVE_INV_INFO, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + addTask(e_Tutorial_State_Creative_Inventory_Menu, + creativeInventoryOverviewTask); + } + + /* + * + * + * CRAFTING + * + */ + if (isFullTutorial || + !isStateCompleted(e_Tutorial_State_2x2Crafting_Menu)) { + ProcedureCompoundTask* craftingOverviewTask = + new ProcedureCompoundTask(this); + craftingOverviewTask->AddTask(new ChoiceTask( + this, IDS_TUTORIAL_TASK_CRAFT_OVERVIEW, + IDS_TUTORIAL_PROMPT_CRAFT_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, e_Tutorial_Completion_Complete_State, + eTelemetryTutorial_Crafting)); + craftingOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_CRAFT_NAV, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + craftingOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_CRAFT_CREATE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + craftingOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_CRAFT_CRAFT_TABLE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + craftingOverviewTask->AddTask( + new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_INVENTORY, + IDS_TUTORIAL_PROMPT_PRESS_X_TO_TOGGLE_DESCRIPTION, + false, ACTION_MENU_X)); + craftingOverviewTask->AddTask( + new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_DESCRIPTION, + IDS_TUTORIAL_PROMPT_PRESS_X_TO_TOGGLE_INGREDIENTS, + false, ACTION_MENU_X)); + craftingOverviewTask->AddTask( + new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_INGREDIENTS, + IDS_TUTORIAL_PROMPT_PRESS_X_TO_TOGGLE_INVENTORY, false, + ACTION_MENU_X)); + addTask(e_Tutorial_State_2x2Crafting_Menu, craftingOverviewTask); + } + // Other tasks can be added in the derived classes + + addHint(e_Tutorial_State_2x2Crafting_Menu, + new TutorialHint(e_Tutorial_Hint_Always_On, this, + IDS_TUTORIAL_HINT_CRAFT_NO_INGREDIENTS, + TutorialHint::e_Hint_NoIngredients)); + + addHint(e_Tutorial_State_3x3Crafting_Menu, + new TutorialHint(e_Tutorial_Hint_Always_On, this, + IDS_TUTORIAL_HINT_CRAFT_NO_INGREDIENTS, + TutorialHint::e_Hint_NoIngredients)); + + /* + * + * + * FURNACE + * + */ + if (isFullTutorial || !isStateCompleted(e_Tutorial_State_Furnace_Menu)) { + ProcedureCompoundTask* furnaceOverviewTask = + new ProcedureCompoundTask(this); + furnaceOverviewTask->AddTask(new ChoiceTask( + this, IDS_TUTORIAL_TASK_FURNACE_OVERVIEW, + IDS_TUTORIAL_PROMPT_FURNACE_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, e_Tutorial_Completion_Complete_State, + eTelemetryTutorial_Furnace)); + furnaceOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_FURNACE_METHOD, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + furnaceOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_FURNACE_FUELS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + furnaceOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_FURNACE_INGREDIENTS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + addTask(e_Tutorial_State_Furnace_Menu, furnaceOverviewTask); + } + // Other tasks can be added in the derived classes + + /* + * + * + * BREWING MENU + * + */ + if (isFullTutorial || !isStateCompleted(e_Tutorial_State_Brewing_Menu)) { + ProcedureCompoundTask* brewingOverviewTask = + new ProcedureCompoundTask(this); + brewingOverviewTask->AddTask(new ChoiceTask( + this, IDS_TUTORIAL_TASK_BREWING_MENU_OVERVIEW, + IDS_TUTORIAL_PROMPT_BREWING_MENU_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, e_Tutorial_Completion_Complete_State, + eTelemetryTutorial_BrewingMenu)); + brewingOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_BREWING_MENU_METHOD, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + brewingOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_BREWING_MENU_BASIC_INGREDIENTS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + brewingOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_BREWING_MENU_EXTENDED_INGREDIENTS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + brewingOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_BREWING_MENU_EXTENDED_INGREDIENTS_2, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + addTask(e_Tutorial_State_Brewing_Menu, brewingOverviewTask); + } + // Other tasks can be added in the derived classes + + /* + * + * + * ENCHANTING MENU + * + */ + if (isFullTutorial || !isStateCompleted(e_Tutorial_State_Enchanting_Menu)) { + ProcedureCompoundTask* enchantingOverviewTask = + new ProcedureCompoundTask(this); + enchantingOverviewTask->AddTask(new ChoiceTask( + this, IDS_TUTORIAL_TASK_ENCHANTING_MENU_OVERVIEW, + IDS_TUTORIAL_PROMPT_ENCHANTING_MENU_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, e_Tutorial_Completion_Complete_State, + eTelemetryTutorial_EnchantingMenu)); + enchantingOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_ENCHANTING_MENU_START, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + enchantingOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_ENCHANTING_MENU_ENCHANTMENTS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + enchantingOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_ENCHANTING_MENU_COST, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + enchantingOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_ENCHANTING_MENU_ENCHANT, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + enchantingOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_ENCHANTING_MENU_BETTER_ENCHANTMENTS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + addTask(e_Tutorial_State_Enchanting_Menu, enchantingOverviewTask); + } + // Other tasks can be added in the derived classes + + /* + * + * + * ANVIL MENU + * + */ + if (isFullTutorial || !isStateCompleted(e_Tutorial_State_Anvil_Menu)) { + ProcedureCompoundTask* anvilOverviewTask = + new ProcedureCompoundTask(this); + anvilOverviewTask->AddTask(new ChoiceTask( + this, IDS_TUTORIAL_TASK_ANVIL_MENU_OVERVIEW, + IDS_TUTORIAL_PROMPT_ANVIL_MENU_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, e_Tutorial_Completion_Complete_State, + eTelemetryTutorial_AnvilMenu)); + anvilOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_ANVIL_MENU_START, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + anvilOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_ANVIL_MENU_REPAIR, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + anvilOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_ANVIL_MENU_SACRIFICE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + anvilOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_ANVIL_MENU_ENCHANT, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + anvilOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_ANVIL_MENU_COST, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + anvilOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_ANVIL_MENU_RENAMING, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + anvilOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_ANVIL_MENU_SMITH, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + addTask(e_Tutorial_State_Anvil_Menu, anvilOverviewTask); + } + // Other tasks can be added in the derived classes + + /* + * + * + * TRADING MENU + * + */ + if (isFullTutorial || !isStateCompleted(e_Tutorial_State_Trading_Menu)) { + ProcedureCompoundTask* tradingOverviewTask = + new ProcedureCompoundTask(this); + tradingOverviewTask->AddTask(new ChoiceTask( + this, IDS_TUTORIAL_TASK_TRADING_MENU_OVERVIEW, + IDS_TUTORIAL_PROMPT_TRADING_MENU_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, e_Tutorial_Completion_Complete_State, + eTelemetryTutorial_TradingMenu)); + tradingOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_TRADING_MENU_START, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + tradingOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_TRADING_MENU_UNAVAILABLE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + tradingOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_TRADING_MENU_DETAILS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + tradingOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_TRADING_MENU_INVENTORY, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + tradingOverviewTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_TRADING_MENU_TRADE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + addTask(e_Tutorial_State_Trading_Menu, tradingOverviewTask); + } + // Other tasks can be added in the derived classes + + /* + * + * + * HORSE ENCOUNTER + * + */ + if (isFullTutorial || !isStateCompleted(e_Tutorial_State_Horse)) { + addTask(e_Tutorial_State_Horse, + new HorseChoiceTask( + this, IDS_TUTORIAL_TASK_HORSE_OVERVIEW, + IDS_TUTORIAL_TASK_DONKEY_OVERVIEW, + IDS_TUTORIAL_TASK_MULE_OVERVIEW, + IDS_TUTORIAL_PROMPT_HORSE_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_Horse)); + + addTask(e_Tutorial_State_Horse, + new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_INTRO, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Horse, + new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_PURPOSE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Horse, + new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_TAMING, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Horse, + new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_TAMING2, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + + // 4J-JEV: Only force the RideEntityTask if we're on the full-tutorial. + if (isFullTutorial) + addTask(e_Tutorial_State_Horse, + new RideEntityTask(eTYPE_HORSE, this, + IDS_TUTORIAL_TASK_HORSE_RIDE, true, NULL, + false, false, false)); + else + addTask(e_Tutorial_State_Horse, + new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_RIDE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + + addTask(e_Tutorial_State_Horse, + new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_SADDLES, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Horse, + new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_SADDLEBAGS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Horse, + new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_BREEDING, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } + + /* + * + * + * HORSE MENU + * + */ + if (isFullTutorial || !isStateCompleted(e_Tutorial_State_Horse_Menu)) { + ProcedureCompoundTask* horseMenuTask = new ProcedureCompoundTask(this); + horseMenuTask->AddTask(new ChoiceTask( + this, IDS_TUTORIAL_TASK_HORSE_MENU_OVERVIEW, + IDS_TUTORIAL_PROMPT_HORSE_MENU_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, e_Tutorial_Completion_Complete_State, + eTelemetryTutorial_HorseMenu)); + horseMenuTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_HORSE_MENU_LAYOUT, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + horseMenuTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_HORSE_MENU_EQUIPMENT, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + horseMenuTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_HORSE_MENU_SADDLEBAGS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + addTask(e_Tutorial_State_Horse_Menu, horseMenuTask); + } + + /* + * + * + * FIREWORKS MENU + * + */ + if (isFullTutorial || !isStateCompleted(e_Tutorial_State_Fireworks_Menu)) { + ProcedureCompoundTask* fireworksMenuTask = + new ProcedureCompoundTask(this); + fireworksMenuTask->AddTask(new ChoiceTask( + this, IDS_TUTORIAL_TASK_FIREWORK_MENU_OVERVIEW, + IDS_TUTORIAL_PROMPT_FIREWORK_MENU_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, e_Tutorial_Completion_Complete_State, + eTelemetryTutorial_FireworksMenu)); + fireworksMenuTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_FIREWORK_MENU_BASIC_START, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + fireworksMenuTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_FIREWORK_MENU_BASIC_STARS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + fireworksMenuTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_FIREWORK_MENU_BASIC_HEIGHT, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + fireworksMenuTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_FIREWORK_MENU_BASIC_CRAFT, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + fireworksMenuTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_START, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + fireworksMenuTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_COLOUR, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + fireworksMenuTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_SHAPE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + fireworksMenuTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_EFFECT, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + fireworksMenuTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_FADE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + addTask(e_Tutorial_State_Fireworks_Menu, fireworksMenuTask); + } + + /* + * + * + * BEACON MENU + * + */ + if (isFullTutorial || !isStateCompleted(e_Tutorial_State_Beacon_Menu)) { + ProcedureCompoundTask* beaconMenuTask = new ProcedureCompoundTask(this); + beaconMenuTask->AddTask(new ChoiceTask( + this, IDS_TUTORIAL_TASK_BEACON_MENU_OVERVIEW, + IDS_TUTORIAL_PROMPT_BEACON_MENU_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, e_Tutorial_Completion_Complete_State, + eTelemetryTutorial_BeaconMenu)); + beaconMenuTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_BEACON_MENU_PRIMARY_POWERS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + beaconMenuTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_BEACON_MENU_SECONDARY_POWER, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + beaconMenuTask->AddTask(new InfoTask( + this, IDS_TUTORIAL_TASK_BEACON_MENU_ACTIVATION, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A)); + addTask(e_Tutorial_State_Beacon_Menu, beaconMenuTask); + } + + /* + * + * + * MINECART + * + */ + if (isFullTutorial || !isStateCompleted(e_Tutorial_State_Riding_Minecart)) { + addTask(e_Tutorial_State_Riding_Minecart, + new ChoiceTask( + this, IDS_TUTORIAL_TASK_MINECART_OVERVIEW, + IDS_TUTORIAL_PROMPT_MINECART_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_Minecart)); + addTask(e_Tutorial_State_Riding_Minecart, + new InfoTask(this, IDS_TUTORIAL_TASK_MINECART_RAILS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Riding_Minecart, + new InfoTask(this, IDS_TUTORIAL_TASK_MINECART_POWERED_RAILS, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Riding_Minecart, + new InfoTask(this, IDS_TUTORIAL_TASK_MINECART_PUSHING, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } + + /* + * + * + * BOAT + * + */ + if (isFullTutorial || !isStateCompleted(e_Tutorial_State_Riding_Boat)) { + addTask(e_Tutorial_State_Riding_Boat, + new ChoiceTask( + this, IDS_TUTORIAL_TASK_BOAT_OVERVIEW, + IDS_TUTORIAL_PROMPT_BOAT_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_Boat)); + addTask(e_Tutorial_State_Riding_Boat, + new InfoTask(this, IDS_TUTORIAL_TASK_BOAT_STEER, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } + + /* + * + * + * FISHING + * + */ + if (isFullTutorial || !isStateCompleted(e_Tutorial_State_Fishing)) { + addTask(e_Tutorial_State_Fishing, + new ChoiceTask( + this, IDS_TUTORIAL_TASK_FISHING_OVERVIEW, + IDS_TUTORIAL_PROMPT_FISHING_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_Fishing)); + addTask(e_Tutorial_State_Fishing, + new InfoTask(this, IDS_TUTORIAL_TASK_FISHING_CAST, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Fishing, + new InfoTask(this, IDS_TUTORIAL_TASK_FISHING_FISH, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Fishing, + new InfoTask(this, IDS_TUTORIAL_TASK_FISHING_USES, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } + + /* + * + * + * BED + * + */ + if (isFullTutorial || !isStateCompleted(e_Tutorial_State_Bed)) { + addTask(e_Tutorial_State_Bed, + new ChoiceTask( + this, IDS_TUTORIAL_TASK_BED_OVERVIEW, + IDS_TUTORIAL_PROMPT_BED_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_Bed)); + addTask(e_Tutorial_State_Bed, + new InfoTask(this, IDS_TUTORIAL_TASK_BED_PLACEMENT, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Bed, + new InfoTask(this, IDS_TUTORIAL_TASK_BED_MULTIPLAYER, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } + + /* + * + * + * FOOD BAR + * + */ + if (!isFullTutorial && !isStateCompleted(e_Tutorial_State_Food_Bar)) { + addTask(e_Tutorial_State_Food_Bar, + new ChoiceTask( + this, IDS_TUTORIAL_TASK_FOOD_BAR_OVERVIEW, + IDS_TUTORIAL_PROMPT_FOOD_BAR_OVERVIEW, true, ACTION_MENU_A, + ACTION_MENU_B, + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, + eTelemetryTutorial_FoodBar)); + addTask(e_Tutorial_State_Food_Bar, + new InfoTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_DEPLETE, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Food_Bar, + new InfoTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_HEAL, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + addTask(e_Tutorial_State_Food_Bar, + new InfoTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_FEED, + IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, + ACTION_MENU_A)); + } } -Tutorial::~Tutorial() -{ - for(AUTO_VAR(it, m_globalConstraints.begin()); it != m_globalConstraints.end(); ++it) - { - delete (*it); - } - for(std::unordered_map::iterator it = messages.begin(); it != messages.end(); ++it) - { - delete (*it).second; - } - for(unsigned int i = 0; i < e_Tutorial_State_Max; ++i) - { - for(AUTO_VAR(it, activeTasks[i].begin()); it < activeTasks[i].end(); ++it) - { - delete (*it); - } - for(AUTO_VAR(it, hints[i].begin()); it < hints[i].end(); ++it) - { - delete (*it); - } +Tutorial::~Tutorial() { + for (AUTO_VAR(it, m_globalConstraints.begin()); + it != m_globalConstraints.end(); ++it) { + delete (*it); + } + for (std::unordered_map::iterator it = + messages.begin(); + it != messages.end(); ++it) { + delete (*it).second; + } + for (unsigned int i = 0; i < e_Tutorial_State_Max; ++i) { + for (AUTO_VAR(it, activeTasks[i].begin()); it < activeTasks[i].end(); + ++it) { + delete (*it); + } + for (AUTO_VAR(it, hints[i].begin()); it < hints[i].end(); ++it) { + delete (*it); + } - currentTask[i] = NULL; - currentFailedConstraint[i] = NULL; - } + currentTask[i] = NULL; + currentFailedConstraint[i] = NULL; + } } -void Tutorial::debugResetPlayerSavedProgress(int iPad) -{ -#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) - GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)StorageManager.GetGameDefinedProfileData(iPad); +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 = + (GAME_SETTINGS*)ProfileManager.GetGameDefinedProfileData(iPad); #endif - ZeroMemory( pGameSettings->ucTutorialCompletion, TUTORIAL_PROFILE_STORAGE_BYTES ); - pGameSettings->uiSpecialTutorialBitmask = 0; + ZeroMemory(pGameSettings->ucTutorialCompletion, + TUTORIAL_PROFILE_STORAGE_BYTES); + pGameSettings->uiSpecialTutorialBitmask = 0; } -void Tutorial::setCompleted( int completableId ) -{ - //if(app.GetGameSettingsDebugMask(m_iPad) && app.GetGameSettingsDebugMask()&(1L<= 0 && completableIndex < TUTORIAL_PROFILE_STORAGE_BITS ) - { - // Set the bit for this position -#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) - GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)StorageManager.GetGameDefinedProfileData(m_iPad); + int completableIndex = -1; + for (AUTO_VAR(it, s_completableTasks.begin()); + it < s_completableTasks.end(); ++it) { + ++completableIndex; + if (*it == completableId) { + break; + } + } + if (completableIndex >= 0 && + completableIndex < TUTORIAL_PROFILE_STORAGE_BITS) { + // Set the bit for this position +#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 = + (GAME_SETTINGS*)ProfileManager.GetGameDefinedProfileData(m_iPad); #endif - int arrayIndex = completableIndex >> 3; - int bitIndex = 7 - (completableIndex % 8); - pGameSettings->ucTutorialCompletion[arrayIndex] |= 1<bSettingsChanged=true; - } + int arrayIndex = completableIndex >> 3; + int bitIndex = 7 - (completableIndex % 8); + pGameSettings->ucTutorialCompletion[arrayIndex] |= 1 << bitIndex; + // flag a profile write needed + pGameSettings->bSettingsChanged = true; + } } -bool Tutorial::getCompleted( int completableId ) -{ - //if(app.GetGameSettingsDebugMask(m_iPad) && app.GetGameSettingsDebugMask()&(1L<= 0 && completableIndex < TUTORIAL_PROFILE_STORAGE_BITS ) - { - // Read the bit for this position - //Retrieve the data pointer from the profile -#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) - GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)StorageManager.GetGameDefinedProfileData(m_iPad); + int completableIndex = -1; + for (AUTO_VAR(it, s_completableTasks.begin()); + it < s_completableTasks.end(); ++it) { + ++completableIndex; + if (*it == completableId) { + break; + } + } + if (completableIndex >= 0 && + completableIndex < TUTORIAL_PROFILE_STORAGE_BITS) { + // Read the bit for this position + // Retrieve the data pointer from the profile +#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 = + (GAME_SETTINGS*)ProfileManager.GetGameDefinedProfileData(m_iPad); #endif - int arrayIndex = completableIndex >> 3; - int bitIndex = 7 - (completableIndex % 8); - return (pGameSettings->ucTutorialCompletion[arrayIndex] & 1<> 3; + int bitIndex = 7 - (completableIndex % 8); + return (pGameSettings->ucTutorialCompletion[arrayIndex] & + 1 << bitIndex) == (1 << bitIndex); + } else { + return false; + } } -bool Tutorial::isStateCompleted( eTutorial_State state ) -{ - return getCompleted(state); +bool Tutorial::isStateCompleted(eTutorial_State state) { + return getCompleted(state); } -void Tutorial::setStateCompleted( eTutorial_State state ) -{ - setCompleted( state ); +void Tutorial::setStateCompleted(eTutorial_State state) { setCompleted(state); } + +bool Tutorial::isHintCompleted(eTutorial_Hint hint) { + return getCompleted(hint); } -bool Tutorial::isHintCompleted( eTutorial_Hint hint ) -{ - return getCompleted(hint); +void Tutorial::setHintCompleted(eTutorial_Hint hint) { + // if(app.GetGameSettingsDebugMask(m_iPad) && + // app.GetGameSettingsDebugMask()&(1L<getId(); + + if (hintId != e_Tutorial_Hint_Always_On) { + setHintCompleted(hint->getId()); + hints[m_CurrentState].erase(find(hints[m_CurrentState].begin(), + hints[m_CurrentState].end(), hint)); + delete hint; + } + // else + // { + // find(hints[m_CurrentState].begin(), hints[m_CurrentState].end(), + // hint); + // } } -void Tutorial::setHintCompleted( TutorialHint *hint ) -{ - //if(app.GetGameSettingsDebugMask(m_iPad) && app.GetGameSettingsDebugMask()&(1L< 1500) { + m_bHasTickedOnce = true; + } + } + if (!m_bHasTickedOnce) { + return; + } - eTutorial_Hint hintId = hint->getId(); + bool constraintChanged = false; + bool taskChanged = false; - if( hintId != e_Tutorial_Hint_Always_On ) - { - setHintCompleted( hint->getId() ); - hints[m_CurrentState].erase( find(hints[m_CurrentState].begin(), hints[m_CurrentState].end(), hint) ); - delete hint; - } - // else - // { - // find(hints[m_CurrentState].begin(), hints[m_CurrentState].end(), hint); - // } -} + for (unsigned int state = 0; state < e_Tutorial_State_Max; ++state) { + AUTO_VAR(it, constraintsToRemove[state].begin()); + while (it < constraintsToRemove[state].end()) { + ++(*it).second; + if ((*it).second > m_iTutorialConstraintDelayRemoveTicks) { + TutorialConstraint* c = (*it).first; + constraints[state].erase(find(constraints[state].begin(), + constraints[state].end(), c)); + c->setQueuedForRemoval(false); + it = constraintsToRemove[state].erase(it); -void Tutorial::tick() -{ - // Don't do anything for the first 2 seconds so that the loading screen is gone - if(!m_bHasTickedOnce) - { - int time = GetTickCount(); - if(m_firstTickTime == 0) - { - m_firstTickTime = time; - } - else if ( time - m_firstTickTime > 1500 ) - { - m_bHasTickedOnce = true; - } - } - if(!m_bHasTickedOnce) - { - return; - } + if (c->getDeleteOnDeactivate()) { + delete c; + } + } else { + ++it; + } + } + } - bool constraintChanged = false; - bool taskChanged = false; + // 4J Stu TODO - Make this a constraint + Minecraft* pMinecraft = Minecraft::GetInstance(); + if (m_freezeTime && !m_timeFrozen && !m_fullTutorialComplete) { + // Need to set the time on both levels to stop the flickering as the + // local level tries to predict the time + MinecraftServer::SetTimeOfDay(m_iTutorialFreezeTimeValue); + pMinecraft->level->setDayTime( + m_iTutorialFreezeTimeValue); // Always daytime + m_timeFrozen = true; + } else if (m_freezeTime && m_timeFrozen && m_fullTutorialComplete) { + MinecraftServer::SetTimeOfDay(m_iTutorialFreezeTimeValue); + pMinecraft->level->setDayTime(m_iTutorialFreezeTimeValue); + app.SetGameHostOption(eGameHostOption_DoDaylightCycle, 1); + m_timeFrozen = false; + } - for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state) - { - AUTO_VAR(it, constraintsToRemove[state].begin()); - while(it < constraintsToRemove[state].end() ) - { - ++(*it).second; - if( (*it).second > m_iTutorialConstraintDelayRemoveTicks ) - { - TutorialConstraint *c = (*it).first; - constraints[state].erase( find( constraints[state].begin(), constraints[state].end(), c) ); - c->setQueuedForRemoval(false); - it = constraintsToRemove[state].erase( it ); + if (!m_allowShow) { + if (currentTask[m_CurrentState] != NULL && + (!currentTask[m_CurrentState]->AllowFade() || + (lastMessageTime + m_iTutorialDisplayMessageTime) > + GetTickCount())) { + uiTempDisabled = true; + } + ui.SetTutorialVisible(m_iPad, false); + return; + } - if( c->getDeleteOnDeactivate() ) - { - delete c; - } - } - else - { - ++it; - } - } - } - - // 4J Stu TODO - Make this a constraint - Minecraft *pMinecraft = Minecraft::GetInstance(); - if(m_freezeTime && !m_timeFrozen && !m_fullTutorialComplete ) - { - // Need to set the time on both levels to stop the flickering as the local level - // tries to predict the time - MinecraftServer::SetTimeOfDay(m_iTutorialFreezeTimeValue); - pMinecraft->level->setOverrideTimeOfDay(m_iTutorialFreezeTimeValue); // Always daytime - m_timeFrozen = true; - } - else if(m_freezeTime && m_timeFrozen && m_fullTutorialComplete) - { - __int64 currentTime = pMinecraft->level->getTime(); - int currentDayTime = (currentTime % Level::TICKS_PER_DAY); - int timeToAdd = 0; - if(currentDayTime > m_iTutorialFreezeTimeValue) - { - timeToAdd = (Level::TICKS_PER_DAY - currentDayTime) + m_iTutorialFreezeTimeValue; - } - else - { - timeToAdd = m_iTutorialFreezeTimeValue - currentDayTime; - } - __int64 targetTime = currentTime + timeToAdd; - MinecraftServer::SetTimeOfDay(-1); - MinecraftServer::SetTime(targetTime); - pMinecraft->level->setOverrideTimeOfDay(-1); - pMinecraft->level->setTime(targetTime); - m_timeFrozen = false; - } - - if(!m_allowShow) - { - if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) - { - uiTempDisabled = true; - } - ui.SetTutorialVisible( m_iPad, false ); - return; - } - - - if(!hasRequestedUI ) - { + if (!hasRequestedUI) { #ifdef _XBOX - m_bSceneIsSplitscreen=app.GetLocalPlayerCount()>1; - if(m_bSceneIsSplitscreen) - { - app.NavigateToScene(m_iPad, eUIComponent_TutorialPopup,(void *)this, false, false, &m_hTutorialScene); - } - else - { - app.NavigateToScene(m_iPad, eUIComponent_TutorialPopup,(void *)this, false, false, &m_hTutorialScene); - } + m_bSceneIsSplitscreen = app.GetLocalPlayerCount() > 1; + if (m_bSceneIsSplitscreen) { + app.NavigateToScene(m_iPad, eUIComponent_TutorialPopup, (void*)this, + false, false, &m_hTutorialScene); + } else { + app.NavigateToScene(m_iPad, eUIComponent_TutorialPopup, (void*)this, + false, false, &m_hTutorialScene); + } #else - ui.SetTutorial(m_iPad, this); + ui.SetTutorial(m_iPad, this); #endif - hasRequestedUI = true; - } - else - { - // if we've changed mode, we may need to change scene - if(m_bSceneIsSplitscreen != (app.GetLocalPlayerCount() > 1)) - { + hasRequestedUI = true; + } else { + // if we've changed mode, we may need to change scene + if (m_bSceneIsSplitscreen != (app.GetLocalPlayerCount() > 1)) { #ifdef _XBOX - app.TutorialSceneNavigateBack(m_iPad); - m_bSceneIsSplitscreen=app.GetLocalPlayerCount()>1; - if(m_bSceneIsSplitscreen) - { - app.NavigateToScene(m_iPad, eUIComponent_TutorialPopup,(void *)this, false, false, &m_hTutorialScene); - } - else - { - app.NavigateToScene(m_iPad, eUIComponent_TutorialPopup,(void *)this, false, false, &m_hTutorialScene); - } + app.TutorialSceneNavigateBack(m_iPad); + m_bSceneIsSplitscreen = app.GetLocalPlayerCount() > 1; + if (m_bSceneIsSplitscreen) { + app.NavigateToScene(m_iPad, eUIComponent_TutorialPopup, + (void*)this, false, false, + &m_hTutorialScene); + } else { + app.NavigateToScene(m_iPad, eUIComponent_TutorialPopup, + (void*)this, false, false, + &m_hTutorialScene); + } #else - ui.SetTutorial(m_iPad, this); + ui.SetTutorial(m_iPad, this); #endif - } - } + } + } - if(ui.IsPauseMenuDisplayed( m_iPad ) ) - { - if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) - { - uiTempDisabled = true; - } - ui.SetTutorialVisible( m_iPad, false ); - return; - } - if( uiTempDisabled ) - { - ui.SetTutorialVisible( m_iPad, true ); - lastMessageTime = GetTickCount(); - uiTempDisabled = false; - } + if (ui.IsPauseMenuDisplayed(m_iPad)) { + if (currentTask[m_CurrentState] != NULL && + (!currentTask[m_CurrentState]->AllowFade() || + (lastMessageTime + m_iTutorialDisplayMessageTime) > + GetTickCount())) { + uiTempDisabled = true; + } + ui.SetTutorialVisible(m_iPad, false); + return; + } + if (uiTempDisabled) { + ui.SetTutorialVisible(m_iPad, true); + lastMessageTime = GetTickCount(); + uiTempDisabled = false; + } - // Check constraints - for(AUTO_VAR(it, m_globalConstraints.begin()); it < m_globalConstraints.end(); ++it) - { - TutorialConstraint *constraint = *it; - constraint->tick(m_iPad); - } + // Check constraints + for (AUTO_VAR(it, m_globalConstraints.begin()); + it < m_globalConstraints.end(); ++it) { + TutorialConstraint* constraint = *it; + constraint->tick(m_iPad); + } - // Check hints - int hintNeeded = -1; - if(!m_hintDisplayed) - { - // 4J Stu - TU-1 interim - // Allow turning off all the hints - bool hintsOn = m_isFullTutorial || app.GetGameSettings(m_iPad,eGameSetting_Hints); + // Check hints + int hintNeeded = -1; + if (!m_hintDisplayed) { + // 4J Stu - TU-1 interim + // Allow turning off all the hints + bool hintsOn = + m_isFullTutorial || app.GetGameSettings(m_iPad, eGameSetting_Hints); - if(hintsOn) - { - for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) - { - TutorialHint *hint = *it; - hintNeeded = hint->tick(); - if(hintNeeded >= 0) - { - PopupMessageDetails *message = new PopupMessageDetails(); - message->m_messageId = hintNeeded; - message->m_allowFade = hint->allowFade(); - message->m_forceDisplay = true; - setMessage( hint, message ); - break; - } - } - } - } + if (hintsOn) { + for (AUTO_VAR(it, hints[m_CurrentState].begin()); + it < hints[m_CurrentState].end(); ++it) { + TutorialHint* hint = *it; + hintNeeded = hint->tick(); + if (hintNeeded >= 0) { + PopupMessageDetails* message = new PopupMessageDetails(); + message->m_messageId = hintNeeded; + message->m_allowFade = hint->allowFade(); + message->m_forceDisplay = true; + setMessage(hint, message); + break; + } + } + } + } - // Check constraints - // Only need to update these if we aren't already failing something - if( !m_allTutorialsComplete && (currentFailedConstraint[m_CurrentState] == NULL || currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad)) ) - { - if( currentFailedConstraint[m_CurrentState] != NULL && currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad) ) - { - constraintChanged = true; - currentFailedConstraint[m_CurrentState] = NULL; - } - for(AUTO_VAR(it, constraints[m_CurrentState].begin()); it < constraints[m_CurrentState].end(); ++it) - { - TutorialConstraint *constraint = *it; - if( !constraint->isConstraintSatisfied(m_iPad) && constraint->isConstraintRestrictive(m_iPad) ) - { - constraintChanged = true; - currentFailedConstraint[m_CurrentState] = constraint; - } - } - } + // Check constraints + // Only need to update these if we aren't already failing something + if (!m_allTutorialsComplete && + (currentFailedConstraint[m_CurrentState] == NULL || + currentFailedConstraint[m_CurrentState]->isConstraintSatisfied( + m_iPad))) { + if (currentFailedConstraint[m_CurrentState] != NULL && + currentFailedConstraint[m_CurrentState]->isConstraintSatisfied( + m_iPad)) { + constraintChanged = true; + currentFailedConstraint[m_CurrentState] = NULL; + } + for (AUTO_VAR(it, constraints[m_CurrentState].begin()); + it < constraints[m_CurrentState].end(); ++it) { + TutorialConstraint* constraint = *it; + if (!constraint->isConstraintSatisfied(m_iPad) && + constraint->isConstraintRestrictive(m_iPad)) { + constraintChanged = true; + currentFailedConstraint[m_CurrentState] = constraint; + } + } + } - if( !m_allTutorialsComplete && currentFailedConstraint[m_CurrentState] == NULL ) - { - // Update tasks - bool isCurrentTask = true; - AUTO_VAR(it, activeTasks[m_CurrentState].begin()); - while(activeTasks[m_CurrentState].size() > 0 && it < activeTasks[m_CurrentState].end()) - { - TutorialTask *task = *it; - if( isCurrentTask || task->isPreCompletionEnabled() ) - { - isCurrentTask = false; - if( - ( !task->ShowMinimumTime() || ( task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() ) ) - && task->isCompleted() - ) - { - eTutorial_CompletionAction compAction = task->getCompletionAction(); - it = activeTasks[m_CurrentState].erase( it ); - delete task; - task = NULL; + if (!m_allTutorialsComplete && + currentFailedConstraint[m_CurrentState] == NULL) { + // Update tasks + bool isCurrentTask = true; + AUTO_VAR(it, activeTasks[m_CurrentState].begin()); + while (activeTasks[m_CurrentState].size() > 0 && + it < activeTasks[m_CurrentState].end()) { + TutorialTask* task = *it; + if (isCurrentTask || task->isPreCompletionEnabled()) { + isCurrentTask = false; + if ((!task->ShowMinimumTime() || + (task->hasBeenActivated() && + (lastMessageTime + m_iTutorialMinimumDisplayMessageTime) < + GetTickCount())) && + task->isCompleted()) { + eTutorial_CompletionAction compAction = + task->getCompletionAction(); + it = activeTasks[m_CurrentState].erase(it); + delete task; + task = NULL; - if( activeTasks[m_CurrentState].size() > 0 ) - { - switch( compAction ) - { - case e_Tutorial_Completion_Complete_State_Gameplay_Constraints: - { - // 4J Stu - Move the delayed constraints to the gameplay state so that they are in - // effect for a bit longer - AUTO_VAR(itCon, constraintsToRemove[m_CurrentState].begin()); - while(itCon != constraintsToRemove[m_CurrentState].end() ) - { - constraints[e_Tutorial_State_Gameplay].push_back(itCon->first); - constraintsToRemove[e_Tutorial_State_Gameplay].push_back( std::pair(itCon->first, itCon->second) ); + if (activeTasks[m_CurrentState].size() > 0) { + switch (compAction) { + case e_Tutorial_Completion_Complete_State_Gameplay_Constraints: { + // 4J Stu - Move the delayed constraints to the + // gameplay state so that they are in effect for + // a bit longer + AUTO_VAR(itCon, + constraintsToRemove[m_CurrentState] + .begin()); + while ( + itCon != + constraintsToRemove[m_CurrentState].end()) { + constraints[e_Tutorial_State_Gameplay] + .push_back(itCon->first); + constraintsToRemove + [e_Tutorial_State_Gameplay] + .push_back( + std::pair( + itCon->first, + itCon->second)); - constraints[m_CurrentState].erase( find( constraints[m_CurrentState].begin(), constraints[m_CurrentState].end(), itCon->first) ); - itCon = constraintsToRemove[m_CurrentState].erase(itCon); - } - } - // Fall through the the normal complete state - case e_Tutorial_Completion_Complete_State: - for(AUTO_VAR(itRem, activeTasks[m_CurrentState].begin()); itRem < activeTasks[m_CurrentState].end(); ++itRem) - { - delete (*itRem); - } - activeTasks[m_CurrentState].clear(); - break; - case e_Tutorial_Completion_Jump_To_Last_Task: - { - TutorialTask *lastTask = activeTasks[m_CurrentState].at( activeTasks[m_CurrentState].size() - 1 ); - activeTasks[m_CurrentState].pop_back(); - for(AUTO_VAR(itRem, activeTasks[m_CurrentState].begin()); itRem < activeTasks[m_CurrentState].end(); ++itRem) - { - delete (*itRem); - } - activeTasks[m_CurrentState].clear(); - activeTasks[m_CurrentState].push_back( lastTask ); - it = activeTasks[m_CurrentState].begin(); - } - break; - case e_Tutorial_Completion_None: - default: - break; - } - } + constraints[m_CurrentState].erase(find( + constraints[m_CurrentState].begin(), + constraints[m_CurrentState].end(), + itCon->first)); + itCon = constraintsToRemove[m_CurrentState] + .erase(itCon); + } + } + // Fall through the the normal complete state + case e_Tutorial_Completion_Complete_State: + for (AUTO_VAR( + itRem, + activeTasks[m_CurrentState].begin()); + itRem < activeTasks[m_CurrentState].end(); + ++itRem) { + delete (*itRem); + } + activeTasks[m_CurrentState].clear(); + break; + case e_Tutorial_Completion_Jump_To_Last_Task: { + TutorialTask* lastTask = + activeTasks[m_CurrentState].at( + activeTasks[m_CurrentState].size() - 1); + activeTasks[m_CurrentState].pop_back(); + for (AUTO_VAR( + itRem, + activeTasks[m_CurrentState].begin()); + itRem < activeTasks[m_CurrentState].end(); + ++itRem) { + delete (*itRem); + } + activeTasks[m_CurrentState].clear(); + activeTasks[m_CurrentState].push_back(lastTask); + it = activeTasks[m_CurrentState].begin(); + } break; + case e_Tutorial_Completion_None: + default: + break; + } + } - if( activeTasks[m_CurrentState].size() > 0 ) - { - currentTask[m_CurrentState] = activeTasks[m_CurrentState][0]; - currentTask[m_CurrentState]->setAsCurrentTask(); - } - else - { - setStateCompleted( m_CurrentState ); + if (activeTasks[m_CurrentState].size() > 0) { + currentTask[m_CurrentState] = + activeTasks[m_CurrentState][0]; + currentTask[m_CurrentState]->setAsCurrentTask(); + } else { + setStateCompleted(m_CurrentState); - currentTask[m_CurrentState] = NULL; - } - taskChanged = true; + currentTask[m_CurrentState] = NULL; + } + taskChanged = true; - // If we can complete this early, check if we can complete it right now - if( currentTask[m_CurrentState] != NULL && currentTask[m_CurrentState]->isPreCompletionEnabled() ) - { - isCurrentTask = true; - } - } - else - { - ++it; - } - if( task != NULL && task->ShowMinimumTime() && task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() ) - { - task->setShownForMinimumTime(); + // If we can complete this early, check if we can complete + // it right now + if (currentTask[m_CurrentState] != NULL && + currentTask[m_CurrentState]->isPreCompletionEnabled()) { + isCurrentTask = true; + } + } else { + ++it; + } + if (task != NULL && task->ShowMinimumTime() && + task->hasBeenActivated() && + (lastMessageTime + m_iTutorialMinimumDisplayMessageTime) < + GetTickCount()) { + task->setShownForMinimumTime(); - if( !m_hintDisplayed ) - { - PopupMessageDetails *message = new PopupMessageDetails(); - message->m_messageId = task->getDescriptionId(); - message->m_promptId = task->getPromptId(); - message->m_allowFade = task->AllowFade(); - message->m_replaceCurrent = true; - setMessage( message ); - } - } - } - else - { - ++it; - } - } + if (!m_hintDisplayed) { + PopupMessageDetails* message = + new PopupMessageDetails(); + message->m_messageId = task->getDescriptionId(); + message->m_promptId = task->getPromptId(); + message->m_allowFade = task->AllowFade(); + message->m_replaceCurrent = true; + setMessage(message); + } + } + } else { + ++it; + } + } - if( currentTask[m_CurrentState] == NULL && activeTasks[m_CurrentState].size() > 0 ) - { - currentTask[m_CurrentState] = activeTasks[m_CurrentState][0]; - currentTask[m_CurrentState]->setAsCurrentTask(); - taskChanged = true; - } - } + if (currentTask[m_CurrentState] == NULL && + activeTasks[m_CurrentState].size() > 0) { + currentTask[m_CurrentState] = activeTasks[m_CurrentState][0]; + currentTask[m_CurrentState]->setAsCurrentTask(); + taskChanged = true; + } + } - if(!m_allTutorialsComplete && (taskChanged || m_hasStateChanged) ) - { - bool allComplete = true; - for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state) - { - if(activeTasks[state].size() > 0 ) - { - allComplete = false; - break; - } - if(state==e_Tutorial_State_Gameplay) - { - m_fullTutorialComplete = true; - Minecraft::GetInstance()->playerLeftTutorial(m_iPad); - } - } - if(allComplete) - m_allTutorialsComplete = true; - } + if (!m_allTutorialsComplete && (taskChanged || m_hasStateChanged)) { + bool allComplete = true; + for (unsigned int state = 0; state < e_Tutorial_State_Max; ++state) { + if (activeTasks[state].size() > 0) { + allComplete = false; + break; + } + if (state == e_Tutorial_State_Gameplay) { + m_fullTutorialComplete = true; + Minecraft::GetInstance()->playerLeftTutorial(m_iPad); + } + } + if (allComplete) m_allTutorialsComplete = true; + } - if( constraintChanged || taskChanged || m_hasStateChanged || - (currentFailedConstraint[m_CurrentState] == NULL && currentTask[m_CurrentState] != NULL && (m_lastMessage == NULL || currentTask[m_CurrentState]->getDescriptionId() != m_lastMessage->m_messageId) && !m_hintDisplayed) - ) - { - if( currentFailedConstraint[m_CurrentState] != NULL ) - { - PopupMessageDetails *message = new PopupMessageDetails(); - message->m_messageId = currentFailedConstraint[m_CurrentState]->getDescriptionId(); - message->m_allowFade = false; - setMessage( message ); - } - else if( currentTask[m_CurrentState] != NULL ) - { - PopupMessageDetails *message = new PopupMessageDetails(); - message->m_messageId = currentTask[m_CurrentState]->getDescriptionId(); - message->m_promptId = currentTask[m_CurrentState]->getPromptId(); - message->m_allowFade = currentTask[m_CurrentState]->AllowFade(); - setMessage( message ); - currentTask[m_CurrentState]->TaskReminders()? m_iTaskReminders = 1 : m_iTaskReminders = 0; - } - else - { - setMessage( NULL ); - } - } + if (constraintChanged || taskChanged || m_hasStateChanged || + (currentFailedConstraint[m_CurrentState] == NULL && + currentTask[m_CurrentState] != NULL && + (m_lastMessage == NULL || + currentTask[m_CurrentState]->getDescriptionId() != + m_lastMessage->m_messageId) && + !m_hintDisplayed)) { + if (currentFailedConstraint[m_CurrentState] != NULL) { + PopupMessageDetails* message = new PopupMessageDetails(); + message->m_messageId = + currentFailedConstraint[m_CurrentState]->getDescriptionId(); + message->m_allowFade = false; + setMessage(message); + } else if (currentTask[m_CurrentState] != NULL) { + PopupMessageDetails* message = new PopupMessageDetails(); + message->m_messageId = + currentTask[m_CurrentState]->getDescriptionId(); + message->m_promptId = currentTask[m_CurrentState]->getPromptId(); + message->m_allowFade = currentTask[m_CurrentState]->AllowFade(); + setMessage(message); + currentTask[m_CurrentState]->TaskReminders() ? m_iTaskReminders = 1 + : m_iTaskReminders = 0; + } else { + setMessage(NULL); + } + } - if(m_hintDisplayed && (lastMessageTime + m_iTutorialDisplayMessageTime ) < GetTickCount() ) - { - m_hintDisplayed = false; - } + if (m_hintDisplayed && + (lastMessageTime + m_iTutorialDisplayMessageTime) < GetTickCount()) { + m_hintDisplayed = false; + } - if( currentFailedConstraint[m_CurrentState] == NULL && currentTask[m_CurrentState] != NULL && (m_iTaskReminders!=0) && (lastMessageTime + (m_iTaskReminders * m_iTutorialReminderTime) ) < GetTickCount() ) - { - // Reminder - PopupMessageDetails *message = new PopupMessageDetails(); - message->m_messageId = currentTask[m_CurrentState]->getDescriptionId(); - message->m_promptId = currentTask[m_CurrentState]->getPromptId(); - message->m_allowFade = currentTask[m_CurrentState]->AllowFade(); - message->m_isReminder = true; - setMessage( message ); - ++m_iTaskReminders; - if( m_iTaskReminders > 1 ) - m_iTaskReminders = 1; - } + if (currentFailedConstraint[m_CurrentState] == NULL && + currentTask[m_CurrentState] != NULL && (m_iTaskReminders != 0) && + (lastMessageTime + (m_iTaskReminders * m_iTutorialReminderTime)) < + GetTickCount()) { + // Reminder + PopupMessageDetails* message = new PopupMessageDetails(); + message->m_messageId = currentTask[m_CurrentState]->getDescriptionId(); + message->m_promptId = currentTask[m_CurrentState]->getPromptId(); + message->m_allowFade = currentTask[m_CurrentState]->AllowFade(); + message->m_isReminder = true; + setMessage(message); + ++m_iTaskReminders; + if (m_iTaskReminders > 1) m_iTaskReminders = 1; + } - m_hasStateChanged = false; + m_hasStateChanged = false; - // If we have completed this state, and it is one that occurs during normal gameplay then change back to the gameplay track - if( m_CurrentState != e_Tutorial_State_Gameplay && activeTasks[m_CurrentState].size() == 0 && (isSelectedItemState() || !ui.GetMenuDisplayed(m_iPad) ) ) - { - this->changeTutorialState( e_Tutorial_State_Gameplay ); - } + // If we have completed this state, and it is one that occurs during normal + // gameplay then change back to the gameplay track + if (m_CurrentState != e_Tutorial_State_Gameplay && + activeTasks[m_CurrentState].size() == 0 && + (isSelectedItemState() || !ui.GetMenuDisplayed(m_iPad))) { + this->changeTutorialState(e_Tutorial_State_Gameplay); + } } -bool Tutorial::setMessage(PopupMessageDetails *message) -{ - if(message != NULL && !message->m_forceDisplay && - m_lastMessageState == m_CurrentState && - message->isSameContent(m_lastMessage) && - ( !message->m_isReminder || ( (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() && message->m_isReminder ) ) - ) - { - delete message; - return false; - } +bool Tutorial::setMessage(PopupMessageDetails* message) { + if (message != NULL && !message->m_forceDisplay && + m_lastMessageState == m_CurrentState && + message->isSameContent(m_lastMessage) && + (!message->m_isReminder || + ((lastMessageTime + m_iTutorialReminderTime) > GetTickCount() && + message->m_isReminder))) { + delete message; + return false; + } - if(message != NULL && (message->m_messageId > 0 || !message->m_messageString.empty()) ) - { - m_lastMessageState = m_CurrentState; + if (message != NULL && + (message->m_messageId > 0 || !message->m_messageString.empty())) { + m_lastMessageState = m_CurrentState; - if(!message->m_replaceCurrent) lastMessageTime = GetTickCount(); + if (!message->m_replaceCurrent) lastMessageTime = GetTickCount(); - std::wstring text; - if(!message->m_messageString.empty()) - { - text = message->m_messageString; - } - else - { - AUTO_VAR(it, messages.find(message->m_messageId)); - if( it != messages.end() && it->second != NULL ) - { - TutorialMessage *messageString = it->second; - text = std::wstring( messageString->getMessageForDisplay() ); - } - else - { - text = std::wstring( app.GetString(message->m_messageId) ); - } - } + std::wstring text; + if (!message->m_messageString.empty()) { + text = message->m_messageString; + } else { + AUTO_VAR(it, messages.find(message->m_messageId)); + if (it != messages.end() && it->second != NULL) { + TutorialMessage* messageString = it->second; + text = std::wstring(messageString->getMessageForDisplay()); - if(!message->m_promptString.empty()) - { - text.append(message->m_promptString); - } - else if(message->m_promptId >= 0) - { - AUTO_VAR(it, messages.find(message->m_promptId)); - if(it != messages.end() && it->second != NULL) - { - TutorialMessage *prompt = it->second; - text.append( prompt->getMessageForDisplay() ); - } - } + // 4J Stu - Quick fix for boat tutorial being incorrect + if (message->m_messageId == IDS_TUTORIAL_TASK_BOAT_OVERVIEW) { + text = replaceAll(text, L"{*CONTROLLER_ACTION_USE*}", + L"{*CONTROLLER_ACTION_DISMOUNT*}"); + } + } else { + text = std::wstring(app.GetString(message->m_messageId)); - std::wstring title; - TutorialPopupInfo popupInfo; - popupInfo.interactScene = m_UIScene; - popupInfo.desc = text.c_str(); - popupInfo.icon = message->m_icon; - popupInfo.iAuxVal = message->m_iAuxVal; - popupInfo.allowFade = message->m_allowFade; - popupInfo.isReminder = message->m_isReminder; - popupInfo.tutorial = this; - if( !message->m_titleString.empty() || message->m_titleId > 0 ) - { - if(message->m_titleString.empty()) title = std::wstring( app.GetString(message->m_titleId) ); - else title = message->m_titleString; + // 4J Stu - Quick fix for boat tutorial being incorrect + if (message->m_messageId == IDS_TUTORIAL_TASK_BOAT_OVERVIEW) { + text = replaceAll(text, L"{*CONTROLLER_ACTION_USE*}", + L"{*CONTROLLER_ACTION_DISMOUNT*}"); + } + } + } - popupInfo.title = title.c_str(); - ui.SetTutorialDescription( m_iPad, &popupInfo ); - } - else - { - ui.SetTutorialDescription( m_iPad, &popupInfo ); - } - } - else if( (m_lastMessage != NULL && m_lastMessage->m_messageId != -1) ) //&& (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() ) - { - // This should cause the popup to dissappear - TutorialPopupInfo popupInfo; - popupInfo.interactScene = m_UIScene; - popupInfo.tutorial = this; - ui.SetTutorialDescription( m_iPad, &popupInfo ); - } + if (!message->m_promptString.empty()) { + text.append(message->m_promptString); + } else if (message->m_promptId >= 0) { + AUTO_VAR(it, messages.find(message->m_promptId)); + if (it != messages.end() && it->second != NULL) { + TutorialMessage* prompt = it->second; + text.append(prompt->getMessageForDisplay()); + } + } - if(m_lastMessage != NULL) delete m_lastMessage; - m_lastMessage = message; + std::wstring title; + TutorialPopupInfo popupInfo; + popupInfo.interactScene = m_UIScene; + popupInfo.desc = text.c_str(); + popupInfo.icon = message->m_icon; + popupInfo.iAuxVal = message->m_iAuxVal; + popupInfo.allowFade = message->m_allowFade; + popupInfo.isReminder = message->m_isReminder; + popupInfo.tutorial = this; + if (!message->m_titleString.empty() || message->m_titleId > 0) { + if (message->m_titleString.empty()) + title = std::wstring(app.GetString(message->m_titleId)); + else + title = message->m_titleString; - return true; + popupInfo.title = title.c_str(); + ui.SetTutorialDescription(m_iPad, &popupInfo); + } else { + ui.SetTutorialDescription(m_iPad, &popupInfo); + } + } else if ((m_lastMessage != NULL && + m_lastMessage->m_messageId != + -1)) //&& (lastMessageTime + m_iTutorialReminderTime ) > + // GetTickCount() ) + { + // This should cause the popup to dissappear + TutorialPopupInfo popupInfo; + popupInfo.interactScene = m_UIScene; + popupInfo.tutorial = this; + ui.SetTutorialDescription(m_iPad, &popupInfo); + } + + if (m_lastMessage != NULL) delete m_lastMessage; + m_lastMessage = message; + + return true; } -bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message) -{ - // 4J Stu - TU-1 interim - // Allow turning off all the hints - bool hintsOn = m_isFullTutorial || (app.GetGameSettings(m_iPad,eGameSetting_Hints) && app.GetGameSettings(m_iPad,eGameSetting_DisplayHUD)); +bool Tutorial::setMessage(TutorialHint* hint, PopupMessageDetails* message) { + // 4J Stu - TU-1 interim + // Allow turning off all the hints + bool hintsOn = m_isFullTutorial || + (app.GetGameSettings(m_iPad, eGameSetting_Hints) && + app.GetGameSettings(m_iPad, eGameSetting_DisplayHUD)); - bool messageShown = false; - std::uint32_t time = GetTickCount(); - if(message != NULL && (message->m_forceDisplay || hintsOn) && - (!message->m_delay || - ( - (m_hintDisplayed && (time - m_lastHintDisplayedTime) > m_iTutorialHintDelayTime ) || - (!m_hintDisplayed && (time - lastMessageTime) > m_iTutorialMinimumDisplayMessageTime ) - ) - ) - ) - { - messageShown = setMessage( message ); + bool messageShown = false; + std::uint32_t time = GetTickCount(); + if (message != NULL && (message->m_forceDisplay || hintsOn) && + (!message->m_delay || + ((m_hintDisplayed && + (time - m_lastHintDisplayedTime) > m_iTutorialHintDelayTime) || + (!m_hintDisplayed && + (time - lastMessageTime) > m_iTutorialMinimumDisplayMessageTime)))) { + messageShown = setMessage(message); - if(messageShown) - { - m_lastHintDisplayedTime = time; - m_hintDisplayed = true; - if(hint!=NULL) setHintCompleted( hint ); - } - } - return messageShown; + if (messageShown) { + m_lastHintDisplayedTime = time; + m_hintDisplayed = true; + if (hint != NULL) setHintCompleted(hint); + } + } + return messageShown; } -bool Tutorial::setMessage(const std::wstring &messageString, int icon, int auxValue) -{ - PopupMessageDetails *message = new PopupMessageDetails(); - message->m_messageString = messageString; - message->m_icon = icon; - message->m_iAuxVal = auxValue; - message->m_forceDisplay = true; +bool Tutorial::setMessage(const std::wstring& messageString, int icon, + int auxValue) { + PopupMessageDetails* message = new PopupMessageDetails(); + message->m_messageString = messageString; + message->m_icon = icon; + message->m_iAuxVal = auxValue; + message->m_forceDisplay = true; - return setMessage(message); + return setMessage(message); } -void Tutorial::showTutorialPopup(bool show) -{ - m_allowShow = show; +void Tutorial::showTutorialPopup(bool show) { + m_allowShow = show; - if(!show) - { - if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) - { - uiTempDisabled = true; - } - ui.SetTutorialVisible( m_iPad, show ); - } + if (!show) { + if (currentTask[m_CurrentState] != NULL && + (!currentTask[m_CurrentState]->AllowFade() || + (lastMessageTime + m_iTutorialDisplayMessageTime) > + GetTickCount())) { + uiTempDisabled = true; + } + ui.SetTutorialVisible(m_iPad, show); + } } -void Tutorial::useItemOn(Level *level, std::shared_ptr item, int x, int y, int z, bool bTestUseOnly) -{ - for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it) - { - TutorialTask *task = *it; - task->useItemOn(level, item, x, y, z, bTestUseOnly); - } +void Tutorial::useItemOn(Level* level, std::shared_ptr item, + int x, int y, int z, bool bTestUseOnly) { + for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); + it < activeTasks[m_CurrentState].end(); ++it) { + TutorialTask* task = *it; + task->useItemOn(level, item, x, y, z, bTestUseOnly); + } } -void Tutorial::useItemOn(std::shared_ptr item, bool bTestUseOnly) -{ - for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it) - { - TutorialTask *task = *it; - task->useItem(item, bTestUseOnly); - } +void Tutorial::useItemOn(std::shared_ptr item, + bool bTestUseOnly) { + for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); + it < activeTasks[m_CurrentState].end(); ++it) { + TutorialTask* task = *it; + task->useItem(item, bTestUseOnly); + } } -void Tutorial::completeUsingItem(std::shared_ptr item) -{ - for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it) - { - TutorialTask *task = *it; - task->completeUsingItem(item); - } +void Tutorial::completeUsingItem(std::shared_ptr item) { + for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); + it < activeTasks[m_CurrentState].end(); ++it) { + TutorialTask* task = *it; + task->completeUsingItem(item); + } - // Fix for #46922 - TU5: UI: Player receives a reminder that he is hungry while "hunger bar" is full (triggered in split-screen mode) - if(m_CurrentState != e_Tutorial_State_Gameplay) - { - for(AUTO_VAR(it, activeTasks[e_Tutorial_State_Gameplay].begin()); it < activeTasks[e_Tutorial_State_Gameplay].end(); ++it) - { - TutorialTask *task = *it; - task->completeUsingItem(item); - } - } + // Fix for #46922 - TU5: UI: Player receives a reminder that he is hungry + // while "hunger bar" is full (triggered in split-screen mode) + if (m_CurrentState != e_Tutorial_State_Gameplay) { + for (AUTO_VAR(it, activeTasks[e_Tutorial_State_Gameplay].begin()); + it < activeTasks[e_Tutorial_State_Gameplay].end(); ++it) { + TutorialTask* task = *it; + task->completeUsingItem(item); + } + } } -void Tutorial::startDestroyBlock(std::shared_ptr item, Tile *tile) -{ - int hintNeeded = -1; - for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) - { - TutorialHint *hint = *it; - hintNeeded = hint->startDestroyBlock(item, tile); - if(hintNeeded >= 0) - { - PopupMessageDetails *message = new PopupMessageDetails(); - message->m_messageId = hintNeeded; - setMessage( hint, message ); - break; - } - - } +void Tutorial::startDestroyBlock(std::shared_ptr item, + Tile* tile) { + int hintNeeded = -1; + for (AUTO_VAR(it, hints[m_CurrentState].begin()); + it < hints[m_CurrentState].end(); ++it) { + TutorialHint* hint = *it; + hintNeeded = hint->startDestroyBlock(item, tile); + if (hintNeeded >= 0) { + PopupMessageDetails* message = new PopupMessageDetails(); + message->m_messageId = hintNeeded; + setMessage(hint, message); + break; + } + } } -void Tutorial::destroyBlock(Tile *tile) -{ - int hintNeeded = -1; - for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) - { - TutorialHint *hint = *it; - hintNeeded = hint->destroyBlock(tile); - if(hintNeeded >= 0) - { - PopupMessageDetails *message = new PopupMessageDetails(); - message->m_messageId = hintNeeded; - setMessage( hint, message ); - break; - } - - } +void Tutorial::destroyBlock(Tile* tile) { + int hintNeeded = -1; + for (AUTO_VAR(it, hints[m_CurrentState].begin()); + it < hints[m_CurrentState].end(); ++it) { + TutorialHint* hint = *it; + hintNeeded = hint->destroyBlock(tile); + if (hintNeeded >= 0) { + PopupMessageDetails* message = new PopupMessageDetails(); + message->m_messageId = hintNeeded; + setMessage(hint, message); + break; + } + } } -void Tutorial::attack(std::shared_ptr player, std::shared_ptr entity) -{ - int hintNeeded = -1; - for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) - { - TutorialHint *hint = *it; - hintNeeded = hint->attack(player->inventory->getSelected(), entity); - if(hintNeeded >= 0) - { - PopupMessageDetails *message = new PopupMessageDetails(); - message->m_messageId = hintNeeded; - setMessage( hint, message ); - break; - } - - } +void Tutorial::attack(std::shared_ptr player, + std::shared_ptr entity) { + int hintNeeded = -1; + for (AUTO_VAR(it, hints[m_CurrentState].begin()); + it < hints[m_CurrentState].end(); ++it) { + TutorialHint* hint = *it; + hintNeeded = hint->attack(player->inventory->getSelected(), entity); + if (hintNeeded >= 0) { + PopupMessageDetails* message = new PopupMessageDetails(); + message->m_messageId = hintNeeded; + setMessage(hint, message); + break; + } + } } -void Tutorial::itemDamaged(std::shared_ptr item) -{ - int hintNeeded = -1; - for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) - { - TutorialHint *hint = *it; - hintNeeded = hint->itemDamaged(item); - if(hintNeeded >= 0) - { - PopupMessageDetails *message = new PopupMessageDetails(); - message->m_messageId = hintNeeded; - setMessage( hint, message ); - break; - } - - } +void Tutorial::itemDamaged(std::shared_ptr item) { + int hintNeeded = -1; + for (AUTO_VAR(it, hints[m_CurrentState].begin()); + it < hints[m_CurrentState].end(); ++it) { + TutorialHint* hint = *it; + hintNeeded = hint->itemDamaged(item); + if (hintNeeded >= 0) { + PopupMessageDetails* message = new PopupMessageDetails(); + message->m_messageId = hintNeeded; + setMessage(hint, message); + break; + } + } } -void Tutorial::handleUIInput(int iAction) -{ - if( m_hintDisplayed ) return; +void Tutorial::handleUIInput(int iAction) { + if (m_hintDisplayed) return; - //for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it) - //{ - // TutorialTask *task = *it; - // task->handleUIInput(iAction); - //} - if(currentTask[m_CurrentState] != NULL) - currentTask[m_CurrentState]->handleUIInput(iAction); + // for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < + // activeTasks[m_CurrentState].end(); ++it) + //{ + // TutorialTask *task = *it; + // task->handleUIInput(iAction); + // } + if (currentTask[m_CurrentState] != NULL) + currentTask[m_CurrentState]->handleUIInput(iAction); } -void Tutorial::createItemSelected(std::shared_ptr item, bool canMake) -{ - int hintNeeded = -1; - for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) - { - TutorialHint *hint = *it; - hintNeeded = hint->createItemSelected(item, canMake); - if(hintNeeded >= 0) - { - PopupMessageDetails *message = new PopupMessageDetails(); - message->m_messageId = hintNeeded; - setMessage( hint, message ); - break; - } - - } +void Tutorial::createItemSelected(std::shared_ptr item, + bool canMake) { + int hintNeeded = -1; + for (AUTO_VAR(it, hints[m_CurrentState].begin()); + it < hints[m_CurrentState].end(); ++it) { + TutorialHint* hint = *it; + hintNeeded = hint->createItemSelected(item, canMake); + if (hintNeeded >= 0) { + PopupMessageDetails* message = new PopupMessageDetails(); + message->m_messageId = hintNeeded; + setMessage(hint, message); + break; + } + } } -void Tutorial::onCrafted(std::shared_ptr item) -{ - for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state) - { - for(AUTO_VAR(it, activeTasks[state].begin()); it < activeTasks[state].end(); ++it) - { - TutorialTask *task = *it; - task->onCrafted(item); - } - } +void Tutorial::onCrafted(std::shared_ptr item) { + for (unsigned int state = 0; state < e_Tutorial_State_Max; ++state) { + for (AUTO_VAR(it, activeTasks[state].begin()); + it < activeTasks[state].end(); ++it) { + TutorialTask* task = *it; + task->onCrafted(item); + } + } } -void Tutorial::onTake(std::shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) -{ - if( !m_hintDisplayed ) - { - bool hintNeeded = false; - for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) - { - TutorialHint *hint = *it; - hintNeeded = hint->onTake(item); - if(hintNeeded) - { - break; - } +void Tutorial::onTake(std::shared_ptr item, + unsigned int invItemCountAnyAux, + unsigned int invItemCountThisAux) { + if (!m_hintDisplayed) { + bool hintNeeded = false; + for (AUTO_VAR(it, hints[m_CurrentState].begin()); + it < hints[m_CurrentState].end(); ++it) { + TutorialHint* hint = *it; + hintNeeded = hint->onTake(item); + if (hintNeeded) { + break; + } + } + } - } - } - - for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state) - { - for(AUTO_VAR(it, activeTasks[state].begin()); it < activeTasks[state].end(); ++it) - { - TutorialTask *task = *it; - task->onTake(item, invItemCountAnyAux, invItemCountThisAux); - } - } + for (unsigned int state = 0; state < e_Tutorial_State_Max; ++state) { + for (AUTO_VAR(it, activeTasks[state].begin()); + it < activeTasks[state].end(); ++it) { + TutorialTask* task = *it; + task->onTake(item, invItemCountAnyAux, invItemCountThisAux); + } + } } -void Tutorial::onSelectedItemChanged(std::shared_ptr item) -{ - // We only handle this if we are in a state that allows changing based on the selected item - // Menus and states like riding in a minecart will NOT allow this - if( isSelectedItemState() ) - { - if(item != NULL) - { - switch(item->id) - { - case Item::fishingRod_Id: - changeTutorialState(e_Tutorial_State_Fishing); - break; - default: - changeTutorialState(e_Tutorial_State_Gameplay); - break; - } - } - else - { - changeTutorialState(e_Tutorial_State_Gameplay); - } - } +void Tutorial::onSelectedItemChanged(std::shared_ptr item) { + // We only handle this if we are in a state that allows changing based on + // the selected item Menus and states like riding in a minecart will NOT + // allow this + if (isSelectedItemState()) { + if (item != NULL) { + switch (item->id) { + case Item::fishingRod_Id: + changeTutorialState(e_Tutorial_State_Fishing); + break; + default: + changeTutorialState(e_Tutorial_State_Gameplay); + break; + } + } else { + changeTutorialState(e_Tutorial_State_Gameplay); + } + } } -void Tutorial::onLookAt(int id, int iData) -{ - if( m_hintDisplayed ) return; +void Tutorial::onLookAt(int id, int iData) { + if (m_hintDisplayed) return; - bool hintNeeded = false; - for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) - { - TutorialHint *hint = *it; - hintNeeded = hint->onLookAt(id, iData); - if(hintNeeded) - { - break; - } - } + bool hintNeeded = false; + for (AUTO_VAR(it, hints[m_CurrentState].begin()); + it < hints[m_CurrentState].end(); ++it) { + TutorialHint* hint = *it; + hintNeeded = hint->onLookAt(id, iData); + if (hintNeeded) { + break; + } + } - if( m_CurrentState == e_Tutorial_State_Gameplay ) - { - if(id > 0) - { - switch(id) - { - case Tile::bed_Id: - changeTutorialState(e_Tutorial_State_Bed); - break; - default: - break; - } - } - } + if (m_CurrentState == e_Tutorial_State_Gameplay) { + if (id > 0) { + switch (id) { + case Tile::bed_Id: + changeTutorialState(e_Tutorial_State_Bed); + break; + default: + break; + } + } + } } -void Tutorial::onLookAtEntity(eINSTANCEOF type) -{ - if( m_hintDisplayed ) return; +void Tutorial::onLookAtEntity(std::shared_ptr entity) { + if (m_hintDisplayed) return; - bool hintNeeded = false; - for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) - { - TutorialHint *hint = *it; - hintNeeded = hint->onLookAtEntity(type); - if(hintNeeded) - { - break; - } - } + bool hintNeeded = false; + for (AUTO_VAR(it, hints[m_CurrentState].begin()); + it < hints[m_CurrentState].end(); ++it) { + TutorialHint* hint = *it; + hintNeeded = hint->onLookAtEntity(entity->GetType()); + if (hintNeeded) { + break; + } + } + + if ((m_CurrentState == e_Tutorial_State_Gameplay) && entity->instanceof + (eTYPE_HORSE)) { + changeTutorialState(e_Tutorial_State_Horse); + } + + for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); + it != activeTasks[m_CurrentState].end(); ++it) { + (*it)->onLookAtEntity(entity); + } } -void Tutorial::onEffectChanged(MobEffect *effect, bool bRemoved) -{ - for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it) - { - TutorialTask *task = *it; - task->onEffectChanged(effect,bRemoved); - } +void Tutorial::onRideEntity(std::shared_ptr entity) { + if (m_CurrentState == e_Tutorial_State_Gameplay) { + switch (entity->GetType()) { + case eTYPE_MINECART: + changeTutorialState(e_Tutorial_State_Riding_Minecart); + break; + case eTYPE_BOAT: + changeTutorialState(e_Tutorial_State_Riding_Boat); + break; + default: + break; + } + } + + for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); + it != activeTasks[m_CurrentState].end(); ++it) { + (*it)->onRideEntity(entity); + } } -bool Tutorial::canMoveToPosition(double xo, double yo, double zo, double xt, double yt, double zt) -{ - bool allowed = true; - for(AUTO_VAR(it, constraints[m_CurrentState].begin()); it < constraints[m_CurrentState].end(); ++it) - { - TutorialConstraint *constraint = *it; - if( !constraint->isConstraintSatisfied(m_iPad) && !constraint->canMoveToPosition(xo,yo,zo,xt,yt,zt) ) - { - allowed = false; - break; - } - } - return allowed; +void Tutorial::onEffectChanged(MobEffect* effect, bool bRemoved) { + for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); + it < activeTasks[m_CurrentState].end(); ++it) { + TutorialTask* task = *it; + task->onEffectChanged(effect, bRemoved); + } } -bool Tutorial::isInputAllowed(int mapping) -{ - if( m_hintDisplayed ) return true; - - // If the player is under water then allow all keypresses so they can jump out - if( Minecraft::GetInstance()->localplayers[m_iPad]->isUnderLiquid(Material::water) ) return true; - - bool allowed = true; - for(AUTO_VAR(it, constraints[m_CurrentState].begin()); it < constraints[m_CurrentState].end(); ++it) - { - TutorialConstraint *constraint = *it; - if( constraint->isMappingConstrained( m_iPad, mapping ) ) - { - allowed = false; - break; - } - } - return allowed; +bool Tutorial::canMoveToPosition(double xo, double yo, double zo, double xt, + double yt, double zt) { + bool allowed = true; + for (AUTO_VAR(it, constraints[m_CurrentState].begin()); + it < constraints[m_CurrentState].end(); ++it) { + TutorialConstraint* constraint = *it; + if (!constraint->isConstraintSatisfied(m_iPad) && + !constraint->canMoveToPosition(xo, yo, zo, xt, yt, zt)) { + allowed = false; + break; + } + } + return allowed; } -std::vector *Tutorial::getTasks() -{ - return &tasks; +bool Tutorial::isInputAllowed(int mapping) { + if (m_hintDisplayed) return true; + + // If the player is under water then allow all keypresses so they can jump + // out + if (Minecraft::GetInstance()->localplayers[m_iPad]->isUnderLiquid( + Material::water)) + return true; + + bool allowed = true; + for (AUTO_VAR(it, constraints[m_CurrentState].begin()); + it < constraints[m_CurrentState].end(); ++it) { + TutorialConstraint* constraint = *it; + if (constraint->isMappingConstrained(m_iPad, mapping)) { + allowed = false; + break; + } + } + return allowed; } -unsigned int Tutorial::getCurrentTaskIndex() -{ - unsigned int index = 0; - for(AUTO_VAR(it, tasks.begin()); it < tasks.end(); ++it) - { - if(*it == currentTask[e_Tutorial_State_Gameplay]) - break; +std::vector* Tutorial::getTasks() { return &tasks; } - ++index; - } - return index; +unsigned int Tutorial::getCurrentTaskIndex() { + unsigned int index = 0; + for (AUTO_VAR(it, tasks.begin()); it < tasks.end(); ++it) { + if (*it == currentTask[e_Tutorial_State_Gameplay]) break; + + ++index; + } + return index; } -void Tutorial::AddGlobalConstraint(TutorialConstraint *c) -{ - m_globalConstraints.push_back(c); +void Tutorial::AddGlobalConstraint(TutorialConstraint* c) { + m_globalConstraints.push_back(c); } -void Tutorial::AddConstraint(TutorialConstraint *c) -{ - constraints[m_CurrentState].push_back(c); +void Tutorial::AddConstraint(TutorialConstraint* c) { + constraints[m_CurrentState].push_back(c); } -void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= false*/) -{ - if( currentFailedConstraint[m_CurrentState] == c ) - currentFailedConstraint[m_CurrentState] = NULL; +void Tutorial::RemoveConstraint(TutorialConstraint* c, + bool delayedRemove /*= false*/) { + if (currentFailedConstraint[m_CurrentState] == c) + currentFailedConstraint[m_CurrentState] = NULL; - if( c->getQueuedForRemoval() ) - { - // If it is already queued for removal, remove it on the next tick - /*for(AUTO_VAR(it, constraintsToRemove[m_CurrentState].begin()); it < constraintsToRemove[m_CurrentState].end(); ++it) - { - if( it->first == c ) - { - it->second = m_iTutorialConstraintDelayRemoveTicks; - break; - } - }*/ - } - else if(delayedRemove) - { - c->setQueuedForRemoval(true); - constraintsToRemove[m_CurrentState].push_back( std::pair(c, 0) ); - } - else - { - for( AUTO_VAR(it, constraintsToRemove[m_CurrentState].begin()); it < constraintsToRemove[m_CurrentState].end(); ++it) - { - if( it->first == c ) - { - constraintsToRemove[m_CurrentState].erase( it ); - break; - } - } + if (c->getQueuedForRemoval()) { + // If it is already queued for removal, remove it on the next tick + /*for(AUTO_VAR(it, constraintsToRemove[m_CurrentState].begin()); it < + constraintsToRemove[m_CurrentState].end(); ++it) + { + if( it->first == c ) + { + it->second = m_iTutorialConstraintDelayRemoveTicks; + break; + } + }*/ + } else if (delayedRemove) { + c->setQueuedForRemoval(true); + constraintsToRemove[m_CurrentState].push_back( + std::pair(c, 0)); + } else { + for (AUTO_VAR(it, constraintsToRemove[m_CurrentState].begin()); + it < constraintsToRemove[m_CurrentState].end(); ++it) { + if (it->first == c) { + constraintsToRemove[m_CurrentState].erase(it); + break; + } + } - AUTO_VAR(it, find( constraints[m_CurrentState].begin(), constraints[m_CurrentState].end(), c)); - if( it != constraints[m_CurrentState].end() ) constraints[m_CurrentState].erase( find( constraints[m_CurrentState].begin(), constraints[m_CurrentState].end(), c) ); + AUTO_VAR(it, find(constraints[m_CurrentState].begin(), + constraints[m_CurrentState].end(), c)); + if (it != constraints[m_CurrentState].end()) + constraints[m_CurrentState].erase( + find(constraints[m_CurrentState].begin(), + constraints[m_CurrentState].end(), c)); - // It may be in the gameplay list, so remove it from there if it is - it = find( constraints[e_Tutorial_State_Gameplay].begin(), constraints[e_Tutorial_State_Gameplay].end(), c); - if( it != constraints[e_Tutorial_State_Gameplay].end() ) constraints[e_Tutorial_State_Gameplay].erase( find( constraints[e_Tutorial_State_Gameplay].begin(), constraints[e_Tutorial_State_Gameplay].end(), c) ); - } + // It may be in the gameplay list, so remove it from there if it is + it = find(constraints[e_Tutorial_State_Gameplay].begin(), + constraints[e_Tutorial_State_Gameplay].end(), c); + if (it != constraints[e_Tutorial_State_Gameplay].end()) + constraints[e_Tutorial_State_Gameplay].erase( + find(constraints[e_Tutorial_State_Gameplay].begin(), + constraints[e_Tutorial_State_Gameplay].end(), c)); + } } -void Tutorial::addTask(eTutorial_State state, TutorialTask *t) -{ - if( state == e_Tutorial_State_Gameplay ) - { - tasks.push_back(t); - } - activeTasks[state].push_back(t); +void Tutorial::addTask(eTutorial_State state, TutorialTask* t) { + if (state == e_Tutorial_State_Gameplay) { + tasks.push_back(t); + } + activeTasks[state].push_back(t); } -void Tutorial::addHint(eTutorial_State state, TutorialHint *h) -{ - hints[state].push_back(h); +void Tutorial::addHint(eTutorial_State state, TutorialHint* h) { + hints[state].push_back(h); } -void Tutorial::addMessage(int messageId, bool limitRepeats /*= false*/, unsigned char numRepeats /*= TUTORIAL_MESSAGE_DEFAULT_SHOW*/) -{ - if(messageId >= 0 && messages.find(messageId)==messages.end()) - messages[messageId] = new TutorialMessage(messageId, limitRepeats, numRepeats); +void Tutorial::addMessage( + int messageId, bool limitRepeats /*= false*/, + unsigned char numRepeats /*= TUTORIAL_MESSAGE_DEFAULT_SHOW*/) { + if (messageId >= 0 && messages.find(messageId) == messages.end()) + messages[messageId] = + new TutorialMessage(messageId, limitRepeats, numRepeats); } #ifdef _XBOX -void Tutorial::changeTutorialState(eTutorial_State newState, CXuiScene *scene /*= NULL*/) +void Tutorial::changeTutorialState(eTutorial_State newState, + CXuiScene* scene /*= NULL*/) #else -void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*= NULL*/) +void Tutorial::changeTutorialState(eTutorial_State newState, + UIScene* scene /*= NULL*/) #endif { - if(newState == m_CurrentState) - { - // If clearing the scene, make sure that the tutorial popup has its reference to this scene removed + if (newState == m_CurrentState) { + // If clearing the scene, make sure that the tutorial popup has its + // reference to this scene removed #ifndef _XBOX - if( scene == NULL ) - { - ui.RemoveInteractSceneReference(m_iPad, m_UIScene); - } + if (scene == NULL) { + ui.RemoveInteractSceneReference(m_iPad, m_UIScene); + } #endif - m_UIScene = scene; - return; - } - // 4J Stu - TU-1 interim - // Allow turning off all the hints - bool hintsOn = m_isFullTutorial || app.GetGameSettings(m_iPad,eGameSetting_Hints); + m_UIScene = scene; + return; + } + // 4J Stu - TU-1 interim + // Allow turning off all the hints + bool hintsOn = + m_isFullTutorial || app.GetGameSettings(m_iPad, eGameSetting_Hints); - if(hintsOn) - { - // If we have completed this state, and it is one that occurs during normal gameplay then change back to the gameplay track - if( newState != e_Tutorial_State_Gameplay && activeTasks[newState].size() == 0 && !ui.GetMenuDisplayed(m_iPad) ) - { - return; - } + if (hintsOn) { + // If we have completed this state, and it is one that occurs during + // normal gameplay then change back to the gameplay track + if (newState != e_Tutorial_State_Gameplay && + activeTasks[newState].size() == 0 && !ui.GetMenuDisplayed(m_iPad)) { + return; + } - // The action that caused the change of state may also have completed the current task - if( currentTask[m_CurrentState] != NULL && currentTask[m_CurrentState]->isCompleted() ) - { - activeTasks[m_CurrentState].erase( find( activeTasks[m_CurrentState].begin(), activeTasks[m_CurrentState].end(), currentTask[m_CurrentState]) ); + // The action that caused the change of state may also have completed + // the current task + if (currentTask[m_CurrentState] != NULL && + currentTask[m_CurrentState]->isCompleted()) { + activeTasks[m_CurrentState].erase( + find(activeTasks[m_CurrentState].begin(), + activeTasks[m_CurrentState].end(), + currentTask[m_CurrentState])); - if( activeTasks[m_CurrentState].size() > 0 ) - { - currentTask[m_CurrentState] = activeTasks[m_CurrentState][0]; - currentTask[m_CurrentState]->setAsCurrentTask(); - } - else - { - currentTask[m_CurrentState] = NULL; - } - } + if (activeTasks[m_CurrentState].size() > 0) { + currentTask[m_CurrentState] = activeTasks[m_CurrentState][0]; + currentTask[m_CurrentState]->setAsCurrentTask(); + } else { + currentTask[m_CurrentState] = NULL; + } + } - if( currentTask[m_CurrentState] != NULL ) - { - currentTask[m_CurrentState]->onStateChange(newState); - } + if (currentTask[m_CurrentState] != NULL) { + currentTask[m_CurrentState]->onStateChange(newState); + } - // Make sure that the current message is cleared - setMessage( NULL ); + // Make sure that the current message is cleared + setMessage(NULL); - // If clearing the scene, make sure that the tutorial popup has its reference to this scene removed + // If clearing the scene, make sure that the tutorial popup has its + // reference to this scene removed #ifndef _XBOX - if( scene == NULL ) - { - ui.RemoveInteractSceneReference(m_iPad, m_UIScene); - } + if (scene == NULL) { + ui.RemoveInteractSceneReference(m_iPad, m_UIScene); + } #endif - m_UIScene = scene; + m_UIScene = scene; - - if( m_CurrentState != newState ) - { - for(AUTO_VAR(it, activeTasks[newState].begin()); it < activeTasks[newState].end(); ++it) - { - TutorialTask *task = *it; - task->onStateChange(newState); - } - m_CurrentState = newState; - m_hasStateChanged = true; - m_hintDisplayed = false; - } - } + if (m_CurrentState != newState) { + for (AUTO_VAR(it, activeTasks[newState].begin()); + it < activeTasks[newState].end(); ++it) { + TutorialTask* task = *it; + task->onStateChange(newState); + } + m_CurrentState = newState; + m_hasStateChanged = true; + m_hintDisplayed = false; + } + } } -bool Tutorial::isSelectedItemState() -{ - bool isSelectedItemState = false; - switch(m_CurrentState) - { - case e_Tutorial_State_Gameplay: - case e_Tutorial_State_Fishing: - isSelectedItemState = true; - break; - default: - break; - } - return isSelectedItemState; +bool Tutorial::isSelectedItemState() { + bool isSelectedItemState = false; + switch (m_CurrentState) { + case e_Tutorial_State_Gameplay: + case e_Tutorial_State_Fishing: + isSelectedItemState = true; + break; + default: + break; + } + return isSelectedItemState; } diff --git a/Minecraft.Client/Platform/Common/Tutorial/Tutorial.h b/Minecraft.Client/Platform/Common/Tutorial/Tutorial.h index af0fdca19..2cef6e98b 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/Tutorial.h +++ b/Minecraft.Client/Platform/Common/Tutorial/Tutorial.h @@ -1,5 +1,5 @@ #pragma once -//using namespace std; +// using namespace std; #include "TutorialTask.h" #include "TutorialConstraint.h" #include "TutorialHint.h" @@ -8,194 +8,207 @@ #include -// #define TUTORIAL_HINT_DELAY_TIME 14000 // How long we should wait from displaying one hint to the next -// #define TUTORIAL_DISPLAY_MESSAGE_TIME 7000 +// #define TUTORIAL_HINT_DELAY_TIME 14000 // How long we should wait from +// displaying one hint to the next #define TUTORIAL_DISPLAY_MESSAGE_TIME 7000 // #define TUTORIAL_MINIMUM_DISPLAY_MESSAGE_TIME 2000 // #define TUTORIAL_REMINDER_TIME (TUTORIAL_DISPLAY_MESSAGE_TIME + 20000) // #define TUTORIAL_CONSTRAINT_DELAY_REMOVE_TICKS 15 -// +// // // 0-24000 // #define TUTORIAL_FREEZE_TIME_VALUE 8000 class Level; class CXuiScene; -class Tutorial -{ +class Tutorial { public: - class PopupMessageDetails - { - public: - int m_messageId; - int m_promptId; - int m_titleId; - std::wstring m_messageString; - std::wstring m_promptString; - std::wstring m_titleString; - int m_icon; - int m_iAuxVal; - bool m_allowFade; - bool m_isReminder; - bool m_replaceCurrent; - bool m_forceDisplay; - bool m_delay; + class PopupMessageDetails { + public: + int m_messageId; + int m_promptId; + int m_titleId; + std::wstring m_messageString; + std::wstring m_promptString; + std::wstring m_titleString; + int m_icon; + int m_iAuxVal; + bool m_allowFade; + bool m_isReminder; + bool m_replaceCurrent; + bool m_forceDisplay; + bool m_delay; - PopupMessageDetails() - { - m_messageId = -1; - m_promptId = -1; - m_titleId = -1; - m_messageString = L""; - m_promptString = L""; - m_titleString = L""; - m_icon = TUTORIAL_NO_ICON; - m_iAuxVal = 0; - m_allowFade = true; - m_isReminder = false; - m_replaceCurrent = false; - m_forceDisplay = false; - m_delay = false; - } + PopupMessageDetails() { + m_messageId = -1; + m_promptId = -1; + m_titleId = -1; + m_messageString = L""; + m_promptString = L""; + m_titleString = L""; + m_icon = TUTORIAL_NO_ICON; + m_iAuxVal = 0; + m_allowFade = true; + m_isReminder = false; + m_replaceCurrent = false; + m_forceDisplay = false; + m_delay = false; + } - bool isSameContent(PopupMessageDetails *other); - - }; + bool isSameContent(PopupMessageDetails* other); + }; private: - static int m_iTutorialHintDelayTime; - static int m_iTutorialDisplayMessageTime; - static int m_iTutorialMinimumDisplayMessageTime; - static int m_iTutorialExtraReminderTime; - static int m_iTutorialReminderTime; - static int m_iTutorialConstraintDelayRemoveTicks; - static int m_iTutorialFreezeTimeValue; - eTutorial_State m_CurrentState; - bool m_hasStateChanged; + static int m_iTutorialHintDelayTime; + static int m_iTutorialDisplayMessageTime; + static int m_iTutorialMinimumDisplayMessageTime; + static int m_iTutorialExtraReminderTime; + static int m_iTutorialReminderTime; + static int m_iTutorialConstraintDelayRemoveTicks; + static int m_iTutorialFreezeTimeValue; + eTutorial_State m_CurrentState; + bool m_hasStateChanged; #ifdef _XBOX - HXUIOBJ m_hTutorialScene; // to store the popup scene (splitscreen or normal) + HXUIOBJ + m_hTutorialScene; // to store the popup scene (splitscreen or normal) #endif - bool m_bSceneIsSplitscreen; + bool m_bSceneIsSplitscreen; - bool m_bHasTickedOnce; - int m_firstTickTime; + bool m_bHasTickedOnce; + int m_firstTickTime; protected: - std::unordered_map messages; - std::vector m_globalConstraints; - std::vector constraints[e_Tutorial_State_Max]; - std::vector< std::pair > constraintsToRemove[e_Tutorial_State_Max]; - std::vector tasks; // We store a copy of the tasks for the main gameplay tutorial so that we could display an overview menu - std::vector activeTasks[e_Tutorial_State_Max]; - std::vector hints[e_Tutorial_State_Max]; - TutorialTask *currentTask[e_Tutorial_State_Max]; - TutorialConstraint *currentFailedConstraint[e_Tutorial_State_Max]; + std::unordered_map messages; + std::vector m_globalConstraints; + std::vector constraints[e_Tutorial_State_Max]; + std::vector > + constraintsToRemove[e_Tutorial_State_Max]; + std::vector + tasks; // We store a copy of the tasks for the main gameplay tutorial + // so that we could display an overview menu + std::vector activeTasks[e_Tutorial_State_Max]; + std::vector hints[e_Tutorial_State_Max]; + TutorialTask* currentTask[e_Tutorial_State_Max]; + TutorialConstraint* currentFailedConstraint[e_Tutorial_State_Max]; - bool m_freezeTime; - bool m_timeFrozen; - //D3DXVECTOR3 m_OriginalPosition; + bool m_freezeTime; + bool m_timeFrozen; + // D3DXVECTOR3 m_OriginalPosition; public: - std::uint32_t lastMessageTime; - std::uint32_t m_lastHintDisplayedTime; -private: - PopupMessageDetails *m_lastMessage; - - eTutorial_State m_lastMessageState; - unsigned int m_iTaskReminders; - - bool m_allowShow; - -public: - bool m_hintDisplayed; + std::uint32_t lastMessageTime; + std::uint32_t m_lastHintDisplayedTime; private: - bool hasRequestedUI; - bool uiTempDisabled; + PopupMessageDetails* m_lastMessage; -#ifdef _XBOX - CXuiScene *m_UIScene; -#else - UIScene *m_UIScene; -#endif + eTutorial_State m_lastMessageState; + unsigned int m_iTaskReminders; + + bool m_allowShow; - int m_iPad; public: - bool m_allTutorialsComplete; - bool m_fullTutorialComplete; - bool m_isFullTutorial; + bool m_hintDisplayed; + +private: + bool hasRequestedUI; + bool uiTempDisabled; + +#ifdef _XBOX + CXuiScene* m_UIScene; +#else + UIScene* m_UIScene; +#endif + + int m_iPad; + public: - Tutorial(int iPad, bool isFullTutorial = false); - virtual ~Tutorial(); - void tick(); + bool m_allTutorialsComplete; + bool m_fullTutorialComplete; + bool m_isFullTutorial; - int getPad() { return m_iPad; } +public: + Tutorial(int iPad, bool isFullTutorial = false); + virtual ~Tutorial(); + void tick(); - virtual bool isStateCompleted( eTutorial_State state ); - virtual void setStateCompleted( eTutorial_State state ); - bool isHintCompleted( eTutorial_Hint hint ); - void setHintCompleted( eTutorial_Hint hint ); - void setHintCompleted( TutorialHint *hint ); + int getPad() { return m_iPad; } - // completableId will be either a eTutorial_State value or eTutorial_Hint - void setCompleted( int completableId ); - bool getCompleted( int completableId ); + virtual bool isStateCompleted(eTutorial_State state); + virtual void setStateCompleted(eTutorial_State state); + bool isHintCompleted(eTutorial_Hint hint); + void setHintCompleted(eTutorial_Hint hint); + void setHintCompleted(TutorialHint* hint); + + // completableId will be either a eTutorial_State value or eTutorial_Hint + void setCompleted(int completableId); + bool getCompleted(int completableId); #ifdef _XBOX - void changeTutorialState(eTutorial_State newState, CXuiScene *scene = NULL); + void changeTutorialState(eTutorial_State newState, CXuiScene* scene = NULL); #else - void changeTutorialState(eTutorial_State newState, UIScene *scene = NULL); + void changeTutorialState(eTutorial_State newState, UIScene* scene = NULL); #endif - bool isSelectedItemState(); + bool isSelectedItemState(); - bool setMessage(PopupMessageDetails *message); - bool setMessage(TutorialHint *hint, PopupMessageDetails *message); - bool setMessage(const std::wstring &message, int icon, int auxValue); + bool setMessage(PopupMessageDetails* message); + bool setMessage(TutorialHint* hint, PopupMessageDetails* message); + bool setMessage(const std::wstring& message, int icon, int auxValue); - void showTutorialPopup(bool show); + void showTutorialPopup(bool show); - void useItemOn(Level *level, std::shared_ptr item, int x, int y, int z,bool bTestUseOnly=false); - void useItemOn(std::shared_ptr item, bool bTestUseOnly=false); - void completeUsingItem(std::shared_ptr item); - void startDestroyBlock(std::shared_ptr item, Tile *tile); - void destroyBlock(Tile *tile); - void attack(std::shared_ptr player, std::shared_ptr entity); - void itemDamaged(std::shared_ptr item); + void useItemOn(Level* level, std::shared_ptr item, int x, + int y, int z, bool bTestUseOnly = false); + void useItemOn(std::shared_ptr item, + bool bTestUseOnly = false); + void completeUsingItem(std::shared_ptr item); + void startDestroyBlock(std::shared_ptr item, Tile* tile); + void destroyBlock(Tile* tile); + void attack(std::shared_ptr player, std::shared_ptr entity); + void itemDamaged(std::shared_ptr item); - void handleUIInput(int iAction); - void createItemSelected(std::shared_ptr item, bool canMake); - void onCrafted(std::shared_ptr item); - void onTake(std::shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux); - void onSelectedItemChanged(std::shared_ptr item); - void onLookAt(int id, int iData=0); - void onLookAtEntity(eINSTANCEOF type); - void onEffectChanged(MobEffect *effect, bool bRemoved=false); + void handleUIInput(int iAction); + void createItemSelected(std::shared_ptr item, bool canMake); + void onCrafted(std::shared_ptr item); + void onTake(std::shared_ptr item, + unsigned int invItemCountAnyAux, + unsigned int invItemCountThisAux); + void onSelectedItemChanged(std::shared_ptr item); + void onLookAt(int id, int iData = 0); + void onLookAtEntity(std::shared_ptr entity); + void onRideEntity(std::shared_ptr entity); + void onEffectChanged(MobEffect* effect, bool bRemoved = false); - bool canMoveToPosition(double xo, double yo, double zo, double xt, double yt, double zt); - bool isInputAllowed(int mapping); + bool canMoveToPosition(double xo, double yo, double zo, double xt, + double yt, double zt); + bool isInputAllowed(int mapping); - void AddGlobalConstraint(TutorialConstraint *c); - void AddConstraint(TutorialConstraint *c); - void RemoveConstraint(TutorialConstraint *c, bool delayedRemove = false); - void addTask(eTutorial_State state, TutorialTask *t); - void addHint(eTutorial_State state, TutorialHint *h); - void addMessage(int messageId, bool limitRepeats = false, unsigned char numRepeats = TUTORIAL_MESSAGE_DEFAULT_SHOW); + void AddGlobalConstraint(TutorialConstraint* c); + void AddConstraint(TutorialConstraint* c); + void RemoveConstraint(TutorialConstraint* c, bool delayedRemove = false); + void addTask(eTutorial_State state, TutorialTask* t); + void addHint(eTutorial_State state, TutorialHint* h); + void addMessage(int messageId, bool limitRepeats = false, + unsigned char numRepeats = TUTORIAL_MESSAGE_DEFAULT_SHOW); - int GetTutorialDisplayMessageTime() {return m_iTutorialDisplayMessageTime;} + int GetTutorialDisplayMessageTime() { + return m_iTutorialDisplayMessageTime; + } - // Only for the main gameplay tutorial - std::vector *getTasks(); - unsigned int getCurrentTaskIndex(); + // Only for the main gameplay tutorial + std::vector* getTasks(); + unsigned int getCurrentTaskIndex(); #ifdef _XBOX - CXuiScene *getScene() { return m_UIScene; } + CXuiScene* getScene() { return m_UIScene; } #else - UIScene *getScene() { return m_UIScene; } + UIScene* getScene() { return m_UIScene; } #endif - eTutorial_State getCurrentState() { return m_CurrentState; } + eTutorial_State getCurrentState() { return m_CurrentState; } - // These are required so that we have a consistent mapping of the completion bits stored in the profile data - static void staticCtor(); - static std::vector s_completableTasks; + // These are required so that we have a consistent mapping of the completion + // bits stored in the profile data + static void staticCtor(); + static std::vector s_completableTasks; - static void debugResetPlayerSavedProgress(int iPad); + static void debugResetPlayerSavedProgress(int iPad); }; diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialConstraint.h b/Minecraft.Client/Platform/Common/Tutorial/TutorialConstraint.h index 877fd57e5..e353e6efd 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialConstraint.h +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialConstraint.h @@ -1,41 +1,49 @@ #pragma once -// 4J Stu - An abstract class that represents a constraint on what the user is able to do -class TutorialConstraint -{ +// 4J Stu - An abstract class that represents a constraint on what the user is +// able to do +class TutorialConstraint { private: - int descriptionId; - bool m_deleteOnDeactivate; - bool m_queuedForRemoval; + int descriptionId; + bool m_deleteOnDeactivate; + bool m_queuedForRemoval; + public: - enum ConstraintType - { - e_ConstraintInput = 0, // Constraint on controller input - e_ConstraintArea, - e_ConstraintAllInput, - e_ConstraintXuiInput, - e_ConstraintChangeState, - }; + enum ConstraintType { + e_ConstraintInput = 0, // Constraint on controller input + e_ConstraintArea, + e_ConstraintAllInput, + e_ConstraintXuiInput, + e_ConstraintChangeState, + }; - TutorialConstraint(int descriptionId) : descriptionId( descriptionId ), m_deleteOnDeactivate( false ), m_queuedForRemoval( false ) {} - virtual ~TutorialConstraint() {} + TutorialConstraint(int descriptionId) + : descriptionId(descriptionId), + m_deleteOnDeactivate(false), + m_queuedForRemoval(false) {} + virtual ~TutorialConstraint() {} - int getDescriptionId() { return descriptionId; } + int getDescriptionId() { return descriptionId; } - virtual ConstraintType getType() = 0; + virtual ConstraintType getType() = 0; - virtual void tick(int iPad) {} - virtual bool isConstraintSatisfied(int iPad) { return true; } - virtual bool isConstraintRestrictive(int iPad) { return true; } + virtual void tick(int iPad) {} + virtual bool isConstraintSatisfied(int iPad) { return true; } + virtual bool isConstraintRestrictive(int iPad) { return true; } - virtual bool isMappingConstrained(int iPad, int mapping) { return false;} - virtual bool isXuiInputConstrained(int vk) { return false;} + virtual bool isMappingConstrained(int iPad, int mapping) { return false; } + virtual bool isXuiInputConstrained(int vk) { return false; } - void setDeleteOnDeactivate(bool deleteOnDeactivated) { m_deleteOnDeactivate = deleteOnDeactivated; } - bool getDeleteOnDeactivate() { return m_deleteOnDeactivate; } + void setDeleteOnDeactivate(bool deleteOnDeactivated) { + m_deleteOnDeactivate = deleteOnDeactivated; + } + bool getDeleteOnDeactivate() { return m_deleteOnDeactivate; } - void setQueuedForRemoval(bool queued) { m_queuedForRemoval = queued; } - bool getQueuedForRemoval() { return m_queuedForRemoval; } + void setQueuedForRemoval(bool queued) { m_queuedForRemoval = queued; } + bool getQueuedForRemoval() { return m_queuedForRemoval; } - virtual bool canMoveToPosition(double xo, double yo, double zo, double xt, double yt, double zt) { return true; } + virtual bool canMoveToPosition(double xo, double yo, double zo, double xt, + double yt, double zt) { + return true; + } }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialEnum.h b/Minecraft.Client/Platform/Common/Tutorial/TutorialEnum.h index 69497ef02..c5cadb0a7 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialEnum.h +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialEnum.h @@ -3,94 +3,100 @@ #include typedef struct { - std::uint16_t index; - std::uint32_t diffsSize; - std::uint8_t *diffs; - std::uint32_t lastByteChanged; + std::uint16_t index; + std::uint32_t diffsSize; + std::uint8_t* diffs; + std::uint32_t lastByteChanged; } TutorialDiff_Chunk; typedef struct { - std::uint32_t diffCount; - TutorialDiff_Chunk *diffs; + std::uint32_t diffCount; + TutorialDiff_Chunk* diffs; } TutorialDiff_File; #define TUTORIAL_NO_TEXT -1 #define TUTORIAL_NO_ICON -1 -// If you want to make these bigger, be aware that that will affect what is stored after the tutorial data in the profile data -// See Xbox_App.h for the struct +// If you want to make these bigger, be aware that that will affect what is +// stored after the tutorial data in the profile data See Xbox_App.h for the +// struct #define TUTORIAL_PROFILE_STORAGE_BITS 512 -#define TUTORIAL_PROFILE_STORAGE_BYTES (TUTORIAL_PROFILE_STORAGE_BITS/8) +#define TUTORIAL_PROFILE_STORAGE_BYTES (TUTORIAL_PROFILE_STORAGE_BITS / 8) -// 4J Stu - The total number of eTutorial_State and eTutorial_Hint must be less than 512, as we only have 512 bits of profile -// data to flag whether or not the player has seen them -// In general a block or tool will have one each. We have a state if we need more than one message, or a hint if just once -// message will suffice -// Tasks added here should also be added in the Tutorial::staticCtor() if you wish to store completion in the profile data -enum eTutorial_State -{ - e_Tutorial_State_Any = -2, - e_Tutorial_State_None = -1, +// 4J Stu - The total number of eTutorial_State and eTutorial_Hint must be less +// than 512, as we only have 512 bits of profile data to flag whether or not the +// player has seen them In general a block or tool will have one each. We have a +// state if we need more than one message, or a hint if just once message will +// suffice Tasks added here should also be added in the Tutorial::staticCtor() +// if you wish to store completion in the profile data +enum eTutorial_State { + e_Tutorial_State_Any = -2, + e_Tutorial_State_None = -1, - e_Tutorial_State_Gameplay = 0, + e_Tutorial_State_Gameplay = 0, - e_Tutorial_State_Inventory_Menu, - e_Tutorial_State_2x2Crafting_Menu, - e_Tutorial_State_3x3Crafting_Menu, - e_Tutorial_State_Furnace_Menu, + e_Tutorial_State_Inventory_Menu, + e_Tutorial_State_2x2Crafting_Menu, + e_Tutorial_State_3x3Crafting_Menu, + e_Tutorial_State_Furnace_Menu, - e_Tutorial_State_Riding_Minecart, - e_Tutorial_State_Riding_Boat, - e_Tutorial_State_Fishing, + e_Tutorial_State_Riding_Minecart, + e_Tutorial_State_Riding_Boat, + e_Tutorial_State_Fishing, - e_Tutorial_State_Bed, + e_Tutorial_State_Bed, - e_Tutorial_State_Container_Menu, - e_Tutorial_State_Trap_Menu, - e_Tutorial_State_Redstone_And_Piston, - e_Tutorial_State_Portal, - e_Tutorial_State_Creative_Inventory_Menu, // Added TU5 - e_Tutorial_State_Food_Bar, // Added TU5 - e_Tutorial_State_CreativeMode, // Added TU7 - e_Tutorial_State_Brewing, - e_Tutorial_State_Brewing_Menu, - e_Tutorial_State_Enchanting, - e_Tutorial_State_Enchanting_Menu, - e_Tutorial_State_Farming, - e_Tutorial_State_Breeding, - e_Tutorial_State_Golem, - e_Tutorial_State_Trading, - e_Tutorial_State_Trading_Menu, - e_Tutorial_State_Anvil, - e_Tutorial_State_Anvil_Menu, - e_Tutorial_State_Enderchests, - - e_Tutorial_State_Unused_9, - e_Tutorial_State_Unused_10, + e_Tutorial_State_Container_Menu, + e_Tutorial_State_Trap_Menu, + e_Tutorial_State_Redstone_And_Piston, + e_Tutorial_State_Portal, + e_Tutorial_State_Creative_Inventory_Menu, // Added TU5 + e_Tutorial_State_Food_Bar, // Added TU5 + e_Tutorial_State_CreativeMode, // Added TU7 + e_Tutorial_State_Brewing, + e_Tutorial_State_Brewing_Menu, + e_Tutorial_State_Enchanting, + e_Tutorial_State_Enchanting_Menu, + e_Tutorial_State_Farming, + e_Tutorial_State_Breeding, + e_Tutorial_State_Golem, + e_Tutorial_State_Trading, + e_Tutorial_State_Trading_Menu, + e_Tutorial_State_Anvil, + e_Tutorial_State_Anvil_Menu, + e_Tutorial_State_Enderchests, + e_Tutorial_State_Horse, + e_Tutorial_State_Horse_Menu, + e_Tutorial_State_Hopper, + e_Tutorial_State_Hopper_Menu, + e_Tutorial_State_Beacon, + e_Tutorial_State_Beacon_Menu, + e_Tutorial_State_Fireworks, + e_Tutorial_State_Fireworks_Menu, - e_Tutorial_State_Max + e_Tutorial_State_Max }; -// Hints added here should also be added in the Tutorial::staticCtor() if you wish to store completion in the profile data -enum eTutorial_Hint -{ - e_Tutorial_Hint_Always_On = e_Tutorial_State_Max, +// Hints added here should also be added in the Tutorial::staticCtor() if you +// wish to store completion in the profile data +enum eTutorial_Hint { + e_Tutorial_Hint_Always_On = e_Tutorial_State_Max, - e_Tutorial_Hint_Hold_To_Mine, - e_Tutorial_Hint_Tool_Damaged, - e_Tutorial_Hint_Swim_Up, + e_Tutorial_Hint_Hold_To_Mine, + e_Tutorial_Hint_Tool_Damaged, + e_Tutorial_Hint_Swim_Up, - e_Tutorial_Hint_Unused_2, - e_Tutorial_Hint_Unused_3, - e_Tutorial_Hint_Unused_4, - e_Tutorial_Hint_Unused_5, - e_Tutorial_Hint_Unused_6, - e_Tutorial_Hint_Unused_7, - e_Tutorial_Hint_Unused_8, - e_Tutorial_Hint_Unused_9, - e_Tutorial_Hint_Unused_10, + e_Tutorial_Hint_Unused_2, + e_Tutorial_Hint_Unused_3, + e_Tutorial_Hint_Unused_4, + e_Tutorial_Hint_Unused_5, + e_Tutorial_Hint_Unused_6, + e_Tutorial_Hint_Unused_7, + e_Tutorial_Hint_Unused_8, + e_Tutorial_Hint_Unused_9, + e_Tutorial_Hint_Unused_10, - e_Tutorial_Hint_Rock, + e_Tutorial_Hint_Rock, e_Tutorial_Hint_Stone, e_Tutorial_Hint_Planks, e_Tutorial_Hint_Sapling, @@ -103,10 +109,10 @@ enum eTutorial_Hint e_Tutorial_Hint_Iron_Ore, e_Tutorial_Hint_Coal_Ore, e_Tutorial_Hint_Tree_Trunk, - e_Tutorial_Hint_Leaves, + e_Tutorial_Hint_Leaves, e_Tutorial_Hint_Glass, e_Tutorial_Hint_Lapis_Ore, - e_Tutorial_Hint_Lapis_Block, + e_Tutorial_Hint_Lapis_Block, e_Tutorial_Hint_Dispenser, e_Tutorial_Hint_Sandstone, e_Tutorial_Hint_Note_Block, @@ -116,28 +122,28 @@ enum eTutorial_Hint e_Tutorial_Hint_Wool, e_Tutorial_Hint_Flower, e_Tutorial_Hint_Mushroom, - e_Tutorial_Hint_Gold_Block, - e_Tutorial_Hint_Iron_Block, - e_Tutorial_Hint_Stone_Slab, - e_Tutorial_Hint_Red_Brick, + e_Tutorial_Hint_Gold_Block, + e_Tutorial_Hint_Iron_Block, + e_Tutorial_Hint_Stone_Slab, + e_Tutorial_Hint_Red_Brick, e_Tutorial_Hint_Tnt, - e_Tutorial_Hint_Bookshelf, - e_Tutorial_Hint_Moss_Stone, + e_Tutorial_Hint_Bookshelf, + e_Tutorial_Hint_Moss_Stone, e_Tutorial_Hint_Obsidian, e_Tutorial_Hint_Torch, e_Tutorial_Hint_MobSpawner, e_Tutorial_Hint_Chest, e_Tutorial_Hint_Redstone, e_Tutorial_Hint_Diamond_Ore, - e_Tutorial_Hint_Diamond_Block, + e_Tutorial_Hint_Diamond_Block, e_Tutorial_Hint_Crafting_Table, e_Tutorial_Hint_Crops, - e_Tutorial_Hint_Farmland, + e_Tutorial_Hint_Farmland, e_Tutorial_Hint_Furnace, e_Tutorial_Hint_Sign, e_Tutorial_Hint_Door_Wood, - e_Tutorial_Hint_Ladder, - e_Tutorial_Hint_Stairs_Stone, + e_Tutorial_Hint_Ladder, + e_Tutorial_Hint_Stairs_Stone, e_Tutorial_Hint_Rail, e_Tutorial_Hint_Lever, e_Tutorial_Hint_PressurePlate, @@ -146,7 +152,7 @@ enum eTutorial_Hint e_Tutorial_Hint_Redstone_Torch, e_Tutorial_Hint_Button, e_Tutorial_Hint_Snow, - e_Tutorial_Hint_Ice, + e_Tutorial_Hint_Ice, e_Tutorial_Hint_Cactus, e_Tutorial_Hint_Clay, e_Tutorial_Hint_Sugarcane, @@ -162,14 +168,14 @@ enum eTutorial_Hint e_Tutorial_Hint_Trapdoor, e_Tutorial_Hint_Piston, e_Tutorial_Hint_Sticky_Piston, - e_Tutorial_Hint_Monster_Stone_Egg, - e_Tutorial_Hint_Stone_Brick_Smooth, - e_Tutorial_Hint_Huge_Mushroom, - e_Tutorial_Hint_Iron_Fence, - e_Tutorial_Hint_Thin_Glass, - e_Tutorial_Hint_Melon, - e_Tutorial_Hint_Vine, - e_Tutorial_Hint_Fence_Gate, + e_Tutorial_Hint_Monster_Stone_Egg, + e_Tutorial_Hint_Stone_Brick_Smooth, + e_Tutorial_Hint_Huge_Mushroom, + e_Tutorial_Hint_Iron_Fence, + e_Tutorial_Hint_Thin_Glass, + e_Tutorial_Hint_Melon, + e_Tutorial_Hint_Vine, + e_Tutorial_Hint_Fence_Gate, e_Tutorial_Hint_Mycel, e_Tutorial_Hint_Water_Lily, e_Tutorial_Hint_Nether_Brick, @@ -181,151 +187,175 @@ enum eTutorial_Hint e_Tutorial_Hint_End_Portal, e_Tutorial_Hint_End_Portal_Frame, - e_Tutorial_Hint_Squid, - e_Tutorial_Hint_Cow, - e_Tutorial_Hint_Sheep, - e_Tutorial_Hint_Chicken, - e_Tutorial_Hint_Pig, - e_Tutorial_Hint_Wolf, - e_Tutorial_Hint_Creeper, - e_Tutorial_Hint_Skeleton, - e_Tutorial_Hint_Spider, - e_Tutorial_Hint_Zombie, - e_Tutorial_Hint_Pig_Zombie, - e_Tutorial_Hint_Ghast, - e_Tutorial_Hint_Slime, + e_Tutorial_Hint_Squid, + e_Tutorial_Hint_Cow, + e_Tutorial_Hint_Sheep, + e_Tutorial_Hint_Chicken, + e_Tutorial_Hint_Pig, + e_Tutorial_Hint_Wolf, + e_Tutorial_Hint_Creeper, + e_Tutorial_Hint_Skeleton, + e_Tutorial_Hint_Spider, + e_Tutorial_Hint_Zombie, + e_Tutorial_Hint_Pig_Zombie, + e_Tutorial_Hint_Ghast, + e_Tutorial_Hint_Slime, e_Tutorial_Hint_Enderman, e_Tutorial_Hint_Silverfish, e_Tutorial_Hint_Cave_Spider, e_Tutorial_Hint_MushroomCow, e_Tutorial_Hint_SnowMan, - e_Tutorial_Hint_IronGolem, + e_Tutorial_Hint_IronGolem, e_Tutorial_Hint_EnderDragon, e_Tutorial_Hint_Blaze, e_Tutorial_Hint_Lava_Slime, e_Tutorial_Hint_Ozelot, e_Tutorial_Hint_Villager, + e_Tutorial_Hint_Wither, + e_Tutorial_Hint_Witch, + e_Tutorial_Hint_Bat, + e_Tutorial_Hint_Horse, - e_Tutorial_Hint_Item_Shovel, - e_Tutorial_Hint_Item_Hatchet, - e_Tutorial_Hint_Item_Pickaxe, - e_Tutorial_Hint_Item_Flint_And_Steel, - e_Tutorial_Hint_Item_Apple, - e_Tutorial_Hint_Item_Bow, - e_Tutorial_Hint_Item_Arrow, - e_Tutorial_Hint_Item_Coal, - e_Tutorial_Hint_Item_Diamond, - e_Tutorial_Hint_Item_Iron_Ingot, - e_Tutorial_Hint_Item_Gold_Ingot, - e_Tutorial_Hint_Item_Sword, - e_Tutorial_Hint_Item_Stick, - e_Tutorial_Hint_Item_Bowl, - e_Tutorial_Hint_Item_Mushroom_Stew, - e_Tutorial_Hint_Item_String, - e_Tutorial_Hint_Item_Feather, - e_Tutorial_Hint_Item_Sulphur, - e_Tutorial_Hint_Item_Hoe, - e_Tutorial_Hint_Item_Seeds, - e_Tutorial_Hint_Item_Wheat, - e_Tutorial_Hint_Item_Bread, - e_Tutorial_Hint_Item_Helmet, - e_Tutorial_Hint_Item_Chestplate, - e_Tutorial_Hint_Item_Leggings, - e_Tutorial_Hint_Item_Boots, - e_Tutorial_Hint_Item_Flint, - e_Tutorial_Hint_Item_Porkchop_Raw, - e_Tutorial_Hint_Item_Porkchop_Cooked, - e_Tutorial_Hint_Item_Painting, - e_Tutorial_Hint_Item_Apple_Gold, - e_Tutorial_Hint_Item_Sign, - e_Tutorial_Hint_Item_Door_Wood, - e_Tutorial_Hint_Item_Bucket_Empty, - e_Tutorial_Hint_Item_Bucket_Water, - e_Tutorial_Hint_Item_Bucket_Lava, - e_Tutorial_Hint_Item_Minecart, - e_Tutorial_Hint_Item_Saddle, - e_Tutorial_Hint_Item_Door_Iron, - e_Tutorial_Hint_Item_Redstone, - e_Tutorial_Hint_Item_Snowball, - e_Tutorial_Hint_Item_Boat, - e_Tutorial_Hint_Item_Leather, - e_Tutorial_Hint_Item_Milk, - e_Tutorial_Hint_Item_Brick, - e_Tutorial_Hint_Item_Clay, - e_Tutorial_Hint_Item_Reeds, - e_Tutorial_Hint_Item_Paper, - e_Tutorial_Hint_Item_Book, - e_Tutorial_Hint_Item_Slimeball, - e_Tutorial_Hint_Item_Minecart_Chest, - e_Tutorial_Hint_Item_Minecart_Furnace, - e_Tutorial_Hint_Item_Egg, - e_Tutorial_Hint_Item_Compass, - e_Tutorial_Hint_Item_Clock, - e_Tutorial_Hint_Item_Yellow_Dust, - e_Tutorial_Hint_Item_Fish_Raw, - e_Tutorial_Hint_Item_Fish_Cooked, - e_Tutorial_Hint_Item_Dye_Powder, - e_Tutorial_Hint_Item_Bone, - e_Tutorial_Hint_Item_Sugar, - e_Tutorial_Hint_Item_Cake, - e_Tutorial_Hint_Item_Diode, - e_Tutorial_Hint_Item_Cookie, - e_Tutorial_Hint_Item_Map, - e_Tutorial_Hint_Item_Record, + e_Tutorial_Hint_Item_Shovel, + e_Tutorial_Hint_Item_Hatchet, + e_Tutorial_Hint_Item_Pickaxe, + e_Tutorial_Hint_Item_Flint_And_Steel, + e_Tutorial_Hint_Item_Apple, + e_Tutorial_Hint_Item_Bow, + e_Tutorial_Hint_Item_Arrow, + e_Tutorial_Hint_Item_Coal, + e_Tutorial_Hint_Item_Diamond, + e_Tutorial_Hint_Item_Iron_Ingot, + e_Tutorial_Hint_Item_Gold_Ingot, + e_Tutorial_Hint_Item_Sword, + e_Tutorial_Hint_Item_Stick, + e_Tutorial_Hint_Item_Bowl, + e_Tutorial_Hint_Item_Mushroom_Stew, + e_Tutorial_Hint_Item_String, + e_Tutorial_Hint_Item_Feather, + e_Tutorial_Hint_Item_Sulphur, + e_Tutorial_Hint_Item_Hoe, + e_Tutorial_Hint_Item_Seeds, + e_Tutorial_Hint_Item_Wheat, + e_Tutorial_Hint_Item_Bread, + e_Tutorial_Hint_Item_Helmet, + e_Tutorial_Hint_Item_Chestplate, + e_Tutorial_Hint_Item_Leggings, + e_Tutorial_Hint_Item_Boots, + e_Tutorial_Hint_Item_Flint, + e_Tutorial_Hint_Item_Porkchop_Raw, + e_Tutorial_Hint_Item_Porkchop_Cooked, + e_Tutorial_Hint_Item_Painting, + e_Tutorial_Hint_Item_Apple_Gold, + e_Tutorial_Hint_Item_Sign, + e_Tutorial_Hint_Item_Door_Wood, + e_Tutorial_Hint_Item_Bucket_Empty, + e_Tutorial_Hint_Item_Bucket_Water, + e_Tutorial_Hint_Item_Bucket_Lava, + e_Tutorial_Hint_Item_Minecart, + e_Tutorial_Hint_Item_Saddle, + e_Tutorial_Hint_Item_Door_Iron, + e_Tutorial_Hint_Item_Redstone, + e_Tutorial_Hint_Item_Snowball, + e_Tutorial_Hint_Item_Boat, + e_Tutorial_Hint_Item_Leather, + e_Tutorial_Hint_Item_Milk, + e_Tutorial_Hint_Item_Brick, + e_Tutorial_Hint_Item_Clay, + e_Tutorial_Hint_Item_Reeds, + e_Tutorial_Hint_Item_Paper, + e_Tutorial_Hint_Item_Book, + e_Tutorial_Hint_Item_Slimeball, + e_Tutorial_Hint_Item_Minecart_Chest, + e_Tutorial_Hint_Item_Minecart_Furnace, + e_Tutorial_Hint_Item_Egg, + e_Tutorial_Hint_Item_Compass, + e_Tutorial_Hint_Item_Clock, + e_Tutorial_Hint_Item_Yellow_Dust, + e_Tutorial_Hint_Item_Fish_Raw, + e_Tutorial_Hint_Item_Fish_Cooked, + e_Tutorial_Hint_Item_Dye_Powder, + e_Tutorial_Hint_Item_Bone, + e_Tutorial_Hint_Item_Sugar, + e_Tutorial_Hint_Item_Cake, + e_Tutorial_Hint_Item_Diode, + e_Tutorial_Hint_Item_Cookie, + e_Tutorial_Hint_Item_Map, + e_Tutorial_Hint_Item_Record, - e_Tutorial_Hint_White_Stone, - e_Tutorial_Hint_Dragon_Egg, - e_Tutorial_Hint_RedstoneLamp, - e_Tutorial_Hint_Cocoa, + e_Tutorial_Hint_White_Stone, + e_Tutorial_Hint_Dragon_Egg, + e_Tutorial_Hint_RedstoneLamp, + e_Tutorial_Hint_Cocoa, - e_Tutorial_Hint_EmeraldOre, - e_Tutorial_Hint_EmeraldBlock, - e_Tutorial_Hint_EnderChest, - e_Tutorial_Hint_TripwireSource, - e_Tutorial_Hint_Tripwire, - e_Tutorial_Hint_CobblestoneWall, - e_Tutorial_Hint_Flowerpot, - e_Tutorial_Hint_Anvil, - e_Tutorial_Hint_QuartzOre, - e_Tutorial_Hint_QuartzBlock, - e_Tutorial_Hint_WoolCarpet, + e_Tutorial_Hint_EmeraldOre, + e_Tutorial_Hint_EmeraldBlock, + e_Tutorial_Hint_EnderChest, + e_Tutorial_Hint_TripwireSource, + e_Tutorial_Hint_Tripwire, + e_Tutorial_Hint_CobblestoneWall, + e_Tutorial_Hint_Flowerpot, + e_Tutorial_Hint_Anvil, + e_Tutorial_Hint_QuartzOre, + e_Tutorial_Hint_QuartzBlock, + e_Tutorial_Hint_WoolCarpet, - e_Tutorial_Hint_Potato, - e_Tutorial_Hint_Carrot, + e_Tutorial_Hint_Potato, + e_Tutorial_Hint_Carrot, - e_Tutorial_Hint_Item_Unused_18, - e_Tutorial_Hint_Item_Unused_19, - e_Tutorial_Hint_Item_Unused_20, + e_Tutorial_Hint_CommandBlock, + e_Tutorial_Hint_Beacon, + e_Tutorial_Hint_Activator_Rail, + e_Tutorial_Hint_RedstoneBlock, + e_Tutorial_Hint_DaylightDetector, + e_Tutorial_Hint_Dropper, + e_Tutorial_Hint_Hopper, + e_Tutorial_Hint_Comparator, + e_Tutorial_Hint_ChestTrap, + e_Tutorial_Hint_HayBlock, + e_Tutorial_Hint_ClayHardened, + e_Tutorial_Hint_ClayHardenedColored, + e_Tutorial_Hint_CoalBlock, - e_Tutorial_Hint_Item_Max, + e_Tutorial_Hint_Item_Max, }; // We store the first time that we complete these tasks to be used in telemetry -enum eTutorial_Telemetry -{ - eTutorial_Telemetry_None = e_Tutorial_Hint_Item_Max, +enum eTutorial_Telemetry { + eTutorial_Telemetry_None = e_Tutorial_Hint_Item_Max, - eTutorial_Telemetry_TrialStart, - eTutorial_Telemetry_Halfway, - eTutorial_Telemetry_Complete, + eTutorial_Telemetry_TrialStart, + eTutorial_Telemetry_Halfway, + eTutorial_Telemetry_Complete, - eTutorial_Telemetry_Unused_1, - eTutorial_Telemetry_Unused_2, - eTutorial_Telemetry_Unused_3, - eTutorial_Telemetry_Unused_4, - eTutorial_Telemetry_Unused_5, - eTutorial_Telemetry_Unused_6, - eTutorial_Telemetry_Unused_7, - eTutorial_Telemetry_Unused_8, - eTutorial_Telemetry_Unused_9, - eTutorial_Telemetry_Unused_10, + eTutorial_Telemetry_Unused_1, + eTutorial_Telemetry_Unused_2, + eTutorial_Telemetry_Unused_3, + eTutorial_Telemetry_Unused_4, + eTutorial_Telemetry_Unused_5, + eTutorial_Telemetry_Unused_6, + eTutorial_Telemetry_Unused_7, + eTutorial_Telemetry_Unused_8, + eTutorial_Telemetry_Unused_9, + eTutorial_Telemetry_Unused_10, }; -enum eTutorial_CompletionAction -{ - e_Tutorial_Completion_None, - e_Tutorial_Completion_Complete_State, // This will make the current tutorial state complete - e_Tutorial_Completion_Complete_State_Gameplay_Constraints, // This will make the current tutorial state complete, and move the delayed constraints to the gameplay state - e_Tutorial_Completion_Jump_To_Last_Task, +enum eTutorial_CompletionAction { + e_Tutorial_Completion_None, + e_Tutorial_Completion_Complete_State, // This will make the current + // tutorial state complete + e_Tutorial_Completion_Complete_State_Gameplay_Constraints, // This will + // make the + // current + // tutorial + // state + // complete, and + // move the + // delayed + // constraints + // to the + // gameplay + // state + e_Tutorial_Completion_Jump_To_Last_Task, }; diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialHint.cpp b/Minecraft.Client/Platform/Common/Tutorial/TutorialHint.cpp index 18e5ffdbe..e45fa4358 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialHint.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialHint.cpp @@ -7,124 +7,111 @@ #include "../../Minecraft.Client/Minecraft.h" #include "../../Minecraft.Client/Player/MultiPlayerLocalPlayer.h" -TutorialHint::TutorialHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, eHintType type, bool allowFade /*= true*/) - : m_id( id ), m_tutorial(tutorial), m_descriptionId( descriptionId ), m_type( type ), m_counter( 0 ), - m_lastTile( NULL ), m_hintNeeded( true ), m_allowFade(allowFade) -{ - tutorial->addMessage(descriptionId, type != e_Hint_NoIngredients); +TutorialHint::TutorialHint(eTutorial_Hint id, Tutorial* tutorial, + int descriptionId, eHintType type, + bool allowFade /*= true*/) + : m_id(id), + m_tutorial(tutorial), + m_descriptionId(descriptionId), + m_type(type), + m_counter(0), + m_lastTile(NULL), + m_hintNeeded(true), + m_allowFade(allowFade) { + tutorial->addMessage(descriptionId, type != e_Hint_NoIngredients); } -int TutorialHint::startDestroyBlock(std::shared_ptr item, Tile *tile) -{ - int returnVal = -1; - switch(m_type) - { - case e_Hint_HoldToMine: - if( tile == m_lastTile && m_hintNeeded ) - { - ++m_counter; - if(m_counter > TUTORIAL_HINT_MAX_MINE_REPEATS) - { - returnVal = m_descriptionId; - } - } - else - { - m_counter = 0; - } - m_lastTile = tile; - break; - default: - break; - } +int TutorialHint::startDestroyBlock(std::shared_ptr item, + Tile* tile) { + int returnVal = -1; + switch (m_type) { + case e_Hint_HoldToMine: + if (tile == m_lastTile && m_hintNeeded) { + ++m_counter; + if (m_counter > TUTORIAL_HINT_MAX_MINE_REPEATS) { + returnVal = m_descriptionId; + } + } else { + m_counter = 0; + } + m_lastTile = tile; + break; + default: + break; + } - return returnVal; + return returnVal; } -int TutorialHint::destroyBlock(Tile *tile) -{ - int returnVal = -1; - switch(m_type) - { - case e_Hint_HoldToMine: - if(tile == m_lastTile && m_counter > 0) - { - m_hintNeeded = false; - } - break; - default: - break; - } +int TutorialHint::destroyBlock(Tile* tile) { + int returnVal = -1; + switch (m_type) { + case e_Hint_HoldToMine: + if (tile == m_lastTile && m_counter > 0) { + m_hintNeeded = false; + } + break; + default: + break; + } - return returnVal; + return returnVal; } -int TutorialHint::attack(std::shared_ptr item, std::shared_ptr entity) -{ - /* - switch(m_type) - { - default: - return -1; - } - */ - return -1; +int TutorialHint::attack(std::shared_ptr item, + std::shared_ptr entity) { + /* + switch(m_type) + { + default: + return -1; + } + */ + return -1; } -int TutorialHint::createItemSelected(std::shared_ptr item, bool canMake) -{ - int returnVal = -1; - switch(m_type) - { - case e_Hint_NoIngredients: - if(!canMake) - returnVal = m_descriptionId; - break; - default: - break; - } - return returnVal; +int TutorialHint::createItemSelected(std::shared_ptr item, + bool canMake) { + int returnVal = -1; + switch (m_type) { + case e_Hint_NoIngredients: + if (!canMake) returnVal = m_descriptionId; + break; + default: + break; + } + return returnVal; } -int TutorialHint::itemDamaged(std::shared_ptr item) -{ - int returnVal = -1; - switch(m_type) - { - case e_Hint_ToolDamaged: - returnVal = m_descriptionId; - break; - default: - break; - } - return returnVal; +int TutorialHint::itemDamaged(std::shared_ptr item) { + int returnVal = -1; + switch (m_type) { + case e_Hint_ToolDamaged: + returnVal = m_descriptionId; + break; + default: + break; + } + return returnVal; } -bool TutorialHint::onTake( std::shared_ptr item ) -{ - return false; -} +bool TutorialHint::onTake(std::shared_ptr item) { return false; } -bool TutorialHint::onLookAt(int id, int iData) -{ - return false; -} +bool TutorialHint::onLookAt(int id, int iData) { return false; } -bool TutorialHint::onLookAtEntity(eINSTANCEOF type) -{ - return false; -} +bool TutorialHint::onLookAtEntity(eINSTANCEOF type) { return false; } -int TutorialHint::tick() -{ - int returnVal = -1; - switch(m_type) - { - case e_Hint_SwimUp: - if( Minecraft::GetInstance()->localplayers[m_tutorial->getPad()]->isUnderLiquid(Material::water) ) returnVal = m_descriptionId; - break; - default: - break; - } - return returnVal; +int TutorialHint::tick() { + int returnVal = -1; + switch (m_type) { + case e_Hint_SwimUp: + if (Minecraft::GetInstance() + ->localplayers[m_tutorial->getPad()] + ->isUnderLiquid(Material::water)) + returnVal = m_descriptionId; + break; + default: + break; + } + return returnVal; } diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialHint.h b/Minecraft.Client/Platform/Common/Tutorial/TutorialHint.h index e40759841..901713572 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialHint.h +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialHint.h @@ -1,5 +1,5 @@ #pragma once -//using namespace std; +// using namespace std; #include "TutorialEnum.h" @@ -8,47 +8,49 @@ class Level; class Tutorial; -class TutorialHint -{ -public: - enum eHintType - { - e_Hint_DiggerItem, - e_Hint_HoldToMine, - e_Hint_NoIngredients, - e_Hint_ToolDamaged, - e_Hint_TakeItem, - e_Hint_Area, - e_Hint_LookAtTile, - e_Hint_LookAtEntity, - e_Hint_SwimUp, - }; +class TutorialHint { +public: + enum eHintType { + e_Hint_DiggerItem, + e_Hint_HoldToMine, + e_Hint_NoIngredients, + e_Hint_ToolDamaged, + e_Hint_TakeItem, + e_Hint_Area, + e_Hint_LookAtTile, + e_Hint_LookAtEntity, + e_Hint_SwimUp, + }; protected: - eHintType m_type; - int m_descriptionId; - Tutorial *m_tutorial; - eTutorial_Hint m_id; + eHintType m_type; + int m_descriptionId; + Tutorial* m_tutorial; + eTutorial_Hint m_id; - int m_counter; - Tile *m_lastTile; - bool m_hintNeeded; - bool m_allowFade; + int m_counter; + Tile* m_lastTile; + bool m_hintNeeded; + bool m_allowFade; public: - TutorialHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, eHintType type, bool allowFade = true); - virtual ~TutorialHint(){} + TutorialHint(eTutorial_Hint id, Tutorial* tutorial, int descriptionId, + eHintType type, bool allowFade = true); + virtual ~TutorialHint() {} - eTutorial_Hint getId() { return m_id; } + eTutorial_Hint getId() { return m_id; } - virtual int startDestroyBlock(std::shared_ptr item, Tile *tile); - virtual int destroyBlock(Tile *tile); - virtual int attack(std::shared_ptr item, std::shared_ptr entity); - virtual int createItemSelected(std::shared_ptr item, bool canMake); - virtual int itemDamaged(std::shared_ptr item); - virtual bool onTake( std::shared_ptr item ); - virtual bool onLookAt(int id, int iData=0); - virtual bool onLookAtEntity(eINSTANCEOF type); - virtual int tick(); - virtual bool allowFade() { return m_allowFade; } + virtual int startDestroyBlock(std::shared_ptr item, + Tile* tile); + virtual int destroyBlock(Tile* tile); + virtual int attack(std::shared_ptr item, + std::shared_ptr entity); + virtual int createItemSelected(std::shared_ptr item, + bool canMake); + virtual int itemDamaged(std::shared_ptr item); + virtual bool onTake(std::shared_ptr item); + virtual bool onLookAt(int id, int iData = 0); + virtual bool onLookAtEntity(eINSTANCEOF type); + virtual int tick(); + virtual bool allowFade() { return m_allowFade; } }; diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.cpp b/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.cpp index dfae8b21c..30fd6cd1d 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.cpp @@ -1,23 +1,22 @@ #include "../../Minecraft.World/Platform/stdafx.h" #include "TutorialMessage.h" -TutorialMessage::TutorialMessage(int messageId, bool limitRepeats /*= false*/, unsigned char numRepeats /*= TUTORIAL_MESSAGE_DEFAULT_SHOW*/) - : messageId( messageId ), limitRepeats( limitRepeats ), numRepeats( numRepeats ), timesShown( 0 ) -{ +TutorialMessage::TutorialMessage( + int messageId, bool limitRepeats /*= false*/, + unsigned char numRepeats /*= TUTORIAL_MESSAGE_DEFAULT_SHOW*/) + : messageId(messageId), + limitRepeats(limitRepeats), + numRepeats(numRepeats), + timesShown(0) {} + +bool TutorialMessage::canDisplay() { + return !limitRepeats || (timesShown < numRepeats); } -bool TutorialMessage::canDisplay() -{ - return !limitRepeats || (timesShown < numRepeats); -} - -const wchar_t *TutorialMessage::getMessageForDisplay() -{ - if(!canDisplay()) - return L""; - - if(limitRepeats) - ++timesShown; - - return app.GetString( messageId ); +const wchar_t* TutorialMessage::getMessageForDisplay() { + if (!canDisplay()) return L""; + + if (limitRepeats) ++timesShown; + + return app.GetString(messageId); } diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.h b/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.h index dbc399819..89446ce03 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.h +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.h @@ -3,17 +3,18 @@ // The default number of times any message should be shown #define TUTORIAL_MESSAGE_DEFAULT_SHOW 3 -class TutorialMessage -{ +class TutorialMessage { private: - int messageId; - bool limitRepeats; - unsigned char numRepeats; - unsigned char timesShown; + int messageId; + bool limitRepeats; + unsigned char numRepeats; + unsigned char timesShown; + DWORD lastDisplayed; public: - TutorialMessage(int messageId, bool limitRepeats = false, unsigned char numRepeats = TUTORIAL_MESSAGE_DEFAULT_SHOW); + TutorialMessage(int messageId, bool limitRepeats = false, + unsigned char numRepeats = TUTORIAL_MESSAGE_DEFAULT_SHOW); - bool canDisplay(); - const wchar_t *getMessageForDisplay(); + bool canDisplay(); + const wchar_t* getMessageForDisplay(); }; diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialMode.cpp b/Minecraft.Client/Platform/Common/Tutorial/TutorialMode.cpp index afe3b822a..a51d6030e 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialMode.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialMode.cpp @@ -9,116 +9,102 @@ #include "../../Minecraft.World/Headers/net.minecraft.world.level.tile.h" #include "TutorialMode.h" -TutorialMode::TutorialMode(int iPad, Minecraft *minecraft, ClientConnection *connection) : MultiPlayerGameMode( minecraft, connection ), m_iPad( iPad ) -{ +TutorialMode::TutorialMode(int iPad, Minecraft* minecraft, + ClientConnection* connection) + : MultiPlayerGameMode(minecraft, connection), m_iPad(iPad) {} + +TutorialMode::~TutorialMode() { + if (tutorial != NULL) delete tutorial; } -TutorialMode::~TutorialMode() -{ - if(tutorial != NULL) - delete tutorial; +void TutorialMode::startDestroyBlock(int x, int y, int z, int face) { + if (!tutorial->m_allTutorialsComplete) { + int t = minecraft->level->getTile(x, y, z); + tutorial->startDestroyBlock(minecraft->player->inventory->getSelected(), + Tile::tiles[t]); + } + MultiPlayerGameMode::startDestroyBlock(x, y, z, face); } -void TutorialMode::startDestroyBlock(int x, int y, int z, int face) -{ - if(!tutorial->m_allTutorialsComplete) - { - int t = minecraft->level->getTile(x, y, z); - tutorial->startDestroyBlock(minecraft->player->inventory->getSelected(), Tile::tiles[t]); - } - MultiPlayerGameMode::startDestroyBlock( x, y, z, face ); +bool TutorialMode::destroyBlock(int x, int y, int z, int face) { + if (!tutorial->m_allTutorialsComplete) { + int t = minecraft->level->getTile(x, y, z); + tutorial->destroyBlock(Tile::tiles[t]); + } + std::shared_ptr item = minecraft->player->getSelectedItem(); + int damageBefore; + if (item != NULL) { + damageBefore = item->getDamageValue(); + } + bool changed = MultiPlayerGameMode::destroyBlock(x, y, z, face); + + if (!tutorial->m_allTutorialsComplete) { + if (item != NULL && item->isDamageableItem()) { + int max = item->getMaxDamage(); + int damageNow = item->getDamageValue(); + + if (damageNow > damageBefore && damageNow > (max / 2)) { + tutorial->itemDamaged(item); + } + } + } + + return changed; } -bool TutorialMode::destroyBlock(int x, int y, int z, int face) -{ - if(!tutorial->m_allTutorialsComplete) - { - int t = minecraft->level->getTile(x, y, z); - tutorial->destroyBlock(Tile::tiles[t]); - } - std::shared_ptr item = minecraft->player->getSelectedItem(); - int damageBefore; - if(item != NULL) - { - damageBefore = item->getDamageValue(); - } - bool changed = MultiPlayerGameMode::destroyBlock( x, y, z, face ); +void TutorialMode::tick() { + MultiPlayerGameMode::tick(); - if(!tutorial->m_allTutorialsComplete) - { - if ( item != NULL && item->isDamageableItem() ) - { - int max = item->getMaxDamage(); - int damageNow = item->getDamageValue(); + if (!tutorial->m_allTutorialsComplete) tutorial->tick(); - if(damageNow > damageBefore && damageNow > (max/2) ) - { - tutorial->itemDamaged( item ); - } - } - } - - return changed; + /* + if( tutorial.m_allTutorialsComplete && (tutorial.lastMessageTime + + m_iTutorialDisplayMessageTime) < GetTickCount() ) + { + // Exit tutorial + minecraft->gameMode = new SurvivalMode( this ); + delete this; + } + */ } -void TutorialMode::tick() -{ - MultiPlayerGameMode::tick(); +bool TutorialMode::useItemOn(std::shared_ptr player, Level* level, + std::shared_ptr item, int x, int y, + int z, int face, Vec3* hit, bool bTestUseOnly, + bool* pbUsedItem) { + bool haveItem = false; + int itemCount = 0; + if (!tutorial->m_allTutorialsComplete) { + tutorial->useItemOn(level, item, x, y, z, bTestUseOnly); - if(!tutorial->m_allTutorialsComplete) - tutorial->tick(); + if (!bTestUseOnly) { + if (item != NULL) { + haveItem = true; + itemCount = item->count; + } + } + } + bool result = MultiPlayerGameMode::useItemOn( + player, level, item, x, y, z, face, hit, bTestUseOnly, pbUsedItem); - /* - if( tutorial.m_allTutorialsComplete && (tutorial.lastMessageTime + m_iTutorialDisplayMessageTime) < GetTickCount() ) - { - // Exit tutorial - minecraft->gameMode = new SurvivalMode( this ); - delete this; - } - */ + if (!bTestUseOnly) { + if (!tutorial->m_allTutorialsComplete) { + if (result && haveItem && itemCount > item->count) { + tutorial->useItemOn(item); + } + } + } + return result; } -bool TutorialMode::useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly, bool *pbUsedItem) -{ - bool haveItem = false; - int itemCount = 0; - if(!tutorial->m_allTutorialsComplete) - { - tutorial->useItemOn(level, item, x, y, z, bTestUseOnly); +void TutorialMode::attack(std::shared_ptr player, + std::shared_ptr entity) { + if (!tutorial->m_allTutorialsComplete) tutorial->attack(player, entity); - if(!bTestUseOnly) - { - if(item != NULL) - { - haveItem = true; - itemCount = item->count; - } - } - } - bool result = MultiPlayerGameMode::useItemOn( player, level, item, x, y, z, face, hit, bTestUseOnly, pbUsedItem ); - - if(!bTestUseOnly) - { - if(!tutorial->m_allTutorialsComplete) - { - if( result && haveItem && itemCount > item->count ) - { - tutorial->useItemOn(item); - } - } - } - return result; + MultiPlayerGameMode::attack(player, entity); } -void TutorialMode::attack(std::shared_ptr player, std::shared_ptr entity) -{ - if(!tutorial->m_allTutorialsComplete) - tutorial->attack(player, entity); - - MultiPlayerGameMode::attack( player, entity ); -} - -bool TutorialMode::isInputAllowed(int mapping) -{ - return tutorial->m_allTutorialsComplete || tutorial->isInputAllowed( mapping ); +bool TutorialMode::isInputAllowed(int mapping) { + return tutorial->m_allTutorialsComplete || + tutorial->isInputAllowed(mapping); } diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialMode.h b/Minecraft.Client/Platform/Common/Tutorial/TutorialMode.h index 75a4581f2..e8448ed91 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialMode.h +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialMode.h @@ -1,28 +1,32 @@ #pragma once -//using namespace std; +// using namespace std; #include "../../Minecraft.Client/Player/MultiPlayerGameMode.h" #include "Tutorial.h" -class TutorialMode : public MultiPlayerGameMode -{ +class TutorialMode : public MultiPlayerGameMode { protected: - Tutorial *tutorial; - int m_iPad; + Tutorial* tutorial; + int m_iPad; + + // Function to make this an abstract class + virtual bool isImplemented() = 0; - // Function to make this an abstract class - virtual bool isImplemented() = 0; public: - TutorialMode(int iPad, Minecraft *minecraft, ClientConnection *connection); - virtual ~TutorialMode(); + TutorialMode(int iPad, Minecraft* minecraft, ClientConnection* connection); + virtual ~TutorialMode(); virtual void startDestroyBlock(int x, int y, int z, int face); virtual bool destroyBlock(int x, int y, int z, int face); virtual void tick(); - virtual bool useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=NULL); - virtual void attack(std::shared_ptr player, std::shared_ptr entity); + virtual bool useItemOn(std::shared_ptr player, Level* level, + std::shared_ptr item, int x, int y, + int z, int face, Vec3* hit, + bool bTestUseOnly = false, bool* pbUsedItem = NULL); + virtual void attack(std::shared_ptr player, + std::shared_ptr entity); - virtual bool isInputAllowed(int mapping); + virtual bool isInputAllowed(int mapping); - Tutorial *getTutorial() { return tutorial; } + Tutorial* getTutorial() { return tutorial; } }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.cpp index 0533c1904..1d37ce30b 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.cpp @@ -3,76 +3,72 @@ #include "TutorialConstraints.h" #include "TutorialTask.h" -TutorialTask::TutorialTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, std::vector *inConstraints, - bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders) - : tutorial( tutorial ), descriptionId( descriptionId ), m_promptId( -1 ), enablePreCompletion( enablePreCompletion ), - areConstraintsEnabled( false ), bIsCompleted( false ), bHasBeenActivated( false ), - m_bAllowFade(bAllowFade), m_bTaskReminders(bTaskReminders), m_bShowMinimumTime( bShowMinimumTime), m_bShownForMinimumTime( false ) -{ - if(inConstraints != NULL) - { - for(AUTO_VAR(it, inConstraints->begin()); it < inConstraints->end(); ++it) - { - TutorialConstraint *constraint = *it; - constraints.push_back( constraint ); - } - delete inConstraints; - } +TutorialTask::TutorialTask(Tutorial* tutorial, int descriptionId, + bool enablePreCompletion, + std::vector* inConstraints, + bool bShowMinimumTime, bool bAllowFade, + bool bTaskReminders) + : tutorial(tutorial), + descriptionId(descriptionId), + m_promptId(-1), + enablePreCompletion(enablePreCompletion), + areConstraintsEnabled(false), + bIsCompleted(false), + bHasBeenActivated(false), + m_bAllowFade(bAllowFade), + m_bTaskReminders(bTaskReminders), + m_bShowMinimumTime(bShowMinimumTime), + m_bShownForMinimumTime(false) { + if (inConstraints != NULL) { + for (AUTO_VAR(it, inConstraints->begin()); it < inConstraints->end(); + ++it) { + TutorialConstraint* constraint = *it; + constraints.push_back(constraint); + } + delete inConstraints; + } - tutorial->addMessage(descriptionId); + tutorial->addMessage(descriptionId); } -TutorialTask::~TutorialTask() -{ - enableConstraints(false); +TutorialTask::~TutorialTask() { + enableConstraints(false); - for(AUTO_VAR(it, constraints.begin()); it < constraints.end(); ++it) - { - TutorialConstraint *constraint = *it; + for (AUTO_VAR(it, constraints.begin()); it < constraints.end(); ++it) { + TutorialConstraint* constraint = *it; - if( constraint->getQueuedForRemoval() ) - { - constraint->setDeleteOnDeactivate(true); - } - else - { - delete constraint; - } - } + if (constraint->getQueuedForRemoval()) { + constraint->setDeleteOnDeactivate(true); + } else { + delete constraint; + } + } } -void TutorialTask::taskCompleted() -{ - if( areConstraintsEnabled == true ) - enableConstraints( false ); +void TutorialTask::taskCompleted() { + if (areConstraintsEnabled == true) enableConstraints(false); } -void TutorialTask::enableConstraints(bool enable, bool delayRemove /*= false*/) -{ - if( !enable && (areConstraintsEnabled || !delayRemove) ) - { - // Remove - for(AUTO_VAR(it, constraints.begin()); it != constraints.end(); ++it) - { - TutorialConstraint *constraint = *it; - //app.DebugPrintf(">>>>>>>> %i\n", constraints.size()); - tutorial->RemoveConstraint( constraint, delayRemove ); - } - areConstraintsEnabled = false; - } - else if( !areConstraintsEnabled && enable ) - { - // Add - for(AUTO_VAR(it, constraints.begin()); it != constraints.end(); ++it) - { - TutorialConstraint *constraint = *it; - tutorial->AddConstraint( constraint ); - } - areConstraintsEnabled = true; - } +void TutorialTask::enableConstraints(bool enable, + bool delayRemove /*= false*/) { + if (!enable && (areConstraintsEnabled || !delayRemove)) { + // Remove + for (AUTO_VAR(it, constraints.begin()); it != constraints.end(); ++it) { + TutorialConstraint* constraint = *it; + // app.DebugPrintf(">>>>>>>> %i\n", constraints.size()); + tutorial->RemoveConstraint(constraint, delayRemove); + } + areConstraintsEnabled = false; + } else if (!areConstraintsEnabled && enable) { + // Add + for (AUTO_VAR(it, constraints.begin()); it != constraints.end(); ++it) { + TutorialConstraint* constraint = *it; + tutorial->AddConstraint(constraint); + } + areConstraintsEnabled = true; + } } -void TutorialTask::setAsCurrentTask(bool active /*= true*/) -{ - bHasBeenActivated = active; +void TutorialTask::setAsCurrentTask(bool active /*= true*/) { + bHasBeenActivated = active; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.h b/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.h index c3074b9dc..7d7c1b6ae 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.h @@ -1,5 +1,5 @@ #pragma once -//using namespace std; +// using namespace std; #include "TutorialEnum.h" class Level; @@ -10,54 +10,72 @@ class MobEffect; // A class that represents each individual task in the tutorial. // // Members: -// enablePreCompletion - If this is true, then the player can complete this task out of sequence. -// This stops us asking them to do things they have already done -// constraints - A list of constraints which can be activated (as a whole). -// If they are active, then the constraints are removed when the task is completed -// areConstraintsEnabled- A flag which records whether or not we have added the constraints to the tutorial -class TutorialTask -{ +// enablePreCompletion - If this is true, then the player can complete this +// task out of sequence. +// This stops us asking them to do +//things they have already done +// constraints - A list of constraints which can be activated +// (as a whole). +// If they are active, then the +//constraints are removed when the task is completed +// areConstraintsEnabled- A flag which records whether or not we have added the +// constraints to the tutorial +class TutorialTask { protected: - int descriptionId; - int m_promptId; - Tutorial *tutorial; - bool enablePreCompletion; - bool bHasBeenActivated; - bool m_bAllowFade; - bool m_bTaskReminders; - bool m_bShowMinimumTime; - + int descriptionId; + int m_promptId; + Tutorial* tutorial; + bool enablePreCompletion; + bool bHasBeenActivated; + bool m_bAllowFade; + bool m_bTaskReminders; + bool m_bShowMinimumTime; + protected: - bool bIsCompleted; - bool m_bShownForMinimumTime; - std::vector constraints; - bool areConstraintsEnabled; + bool bIsCompleted; + bool m_bShownForMinimumTime; + std::vector constraints; + bool areConstraintsEnabled; + public: - TutorialTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, std::vector *inConstraints, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ); - virtual ~TutorialTask(); + TutorialTask(Tutorial* tutorial, int descriptionId, + bool enablePreCompletion, + std::vector* inConstraints, + bool bShowMinimumTime = false, bool bAllowFade = true, + bool bTaskReminders = true); + virtual ~TutorialTask(); - virtual int getDescriptionId() { return descriptionId; } - virtual int getPromptId() { return m_promptId; } + virtual int getDescriptionId() { return descriptionId; } + virtual int getPromptId() { return m_promptId; } - virtual bool isCompleted() = 0; - virtual eTutorial_CompletionAction getCompletionAction() { return e_Tutorial_Completion_None; } - virtual bool isPreCompletionEnabled() { return enablePreCompletion; } - virtual void taskCompleted(); - virtual void enableConstraints(bool enable, bool delayRemove = false); - virtual void setAsCurrentTask(bool active = true); + virtual bool isCompleted() = 0; + virtual eTutorial_CompletionAction getCompletionAction() { + return e_Tutorial_Completion_None; + } + virtual bool isPreCompletionEnabled() { return enablePreCompletion; } + virtual void taskCompleted(); + virtual void enableConstraints(bool enable, bool delayRemove = false); + virtual void setAsCurrentTask(bool active = true); - virtual void setShownForMinimumTime() { m_bShownForMinimumTime = true; } - virtual bool hasBeenActivated() { return bHasBeenActivated; } - virtual bool AllowFade() { return m_bAllowFade;} - bool TaskReminders() { return m_bTaskReminders;} - virtual bool ShowMinimumTime() { return m_bShowMinimumTime;} + virtual void setShownForMinimumTime() { m_bShownForMinimumTime = true; } + virtual bool hasBeenActivated() { return bHasBeenActivated; } + virtual bool AllowFade() { return m_bAllowFade; } + bool TaskReminders() { return m_bTaskReminders; } + virtual bool ShowMinimumTime() { return m_bShowMinimumTime; } - virtual void useItemOn(Level *level, std::shared_ptr item, int x, int y, int z, bool bTestUseOnly=false) { } - virtual void useItem(std::shared_ptr item,bool bTestUseOnly=false) { } - virtual void completeUsingItem(std::shared_ptr item) { } - virtual void handleUIInput(int iAction) { } - virtual void onCrafted(std::shared_ptr item) { } - virtual void onTake(std::shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) { } - virtual void onStateChange(eTutorial_State newState) { } - virtual void onEffectChanged(MobEffect *effect, bool bRemoved=false) { } + virtual void useItemOn(Level* level, std::shared_ptr item, + int x, int y, int z, bool bTestUseOnly = false) {} + virtual void useItem(std::shared_ptr item, + bool bTestUseOnly = false) {} + virtual void completeUsingItem(std::shared_ptr item) {} + virtual void handleUIInput(int iAction) {} + virtual void onCrafted(std::shared_ptr item) {} + virtual void onTake(std::shared_ptr item, + unsigned int invItemCountAnyAux, + unsigned int invItemCountThisAux) {} + virtual void onStateChange(eTutorial_State newState) {} + virtual void onEffectChanged(MobEffect* effect, bool bRemoved = false) {} + + virtual void onLookAtEntity(std::shared_ptr entity) {} + virtual void onRideEntity(std::shared_ptr entity) {} }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialTasks.h b/Minecraft.Client/Platform/Common/Tutorial/TutorialTasks.h index 52ee41453..d6aade628 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialTasks.h +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialTasks.h @@ -10,6 +10,8 @@ #include "XuiCraftingTask.h" #include "StateChangeTask.h" #include "ChoiceTask.h" +#include "HorseChoiceTask.h" +#include "RideEntityTask.h" #include "FullTutorialActiveTask.h" #include "AreaTask.h" #include "ProgressFlagTask.h" diff --git a/Minecraft.Client/Platform/Common/Tutorial/UseItemTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/UseItemTask.cpp index 83a9502d7..7874eec5f 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/UseItemTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/UseItemTask.cpp @@ -4,22 +4,20 @@ #include "../../Minecraft.World/Items/ItemInstance.h" #include "UseItemTask.h" -UseItemTask::UseItemTask(const int itemId, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion, std::vector *inConstraints, bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders) - : TutorialTask( tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, bTaskReminders ), - itemId( itemId ) -{ -} +UseItemTask::UseItemTask(const int itemId, Tutorial* tutorial, + int descriptionId, bool enablePreCompletion, + std::vector* inConstraints, + bool bShowMinimumTime, bool bAllowFade, + bool bTaskReminders) + : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, + bShowMinimumTime, bAllowFade, bTaskReminders), + itemId(itemId) {} -bool UseItemTask::isCompleted() -{ - return bIsCompleted; -} +bool UseItemTask::isCompleted() { return bIsCompleted; } -void UseItemTask::useItem(std::shared_ptr item,bool bTestUseOnly) -{ - if(bTestUseOnly) return; +void UseItemTask::useItem(std::shared_ptr item, + bool bTestUseOnly) { + if (bTestUseOnly) return; - if( item->id == itemId ) - bIsCompleted = true; + if (item->id == itemId) bIsCompleted = true; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/UseItemTask.h b/Minecraft.Client/Platform/Common/Tutorial/UseItemTask.h index d86cd45e5..25ca6db56 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/UseItemTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/UseItemTask.h @@ -1,20 +1,22 @@ #pragma once -//using namespace std; +// using namespace std; #include "TutorialTask.h" class Level; // 4J Stu - Tasks that involve placing a tile -class UseItemTask : public TutorialTask -{ +class UseItemTask : public TutorialTask { private: - const int itemId; - bool completed; + const int itemId; public: - UseItemTask(const int itemId, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion = false, std::vector *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); - virtual bool isCompleted(); - virtual void useItem(std::shared_ptr item, bool bTestUseOnly=false); + UseItemTask(const int itemId, Tutorial* tutorial, int descriptionId, + bool enablePreCompletion = false, + std::vector* inConstraints = NULL, + bool bShowMinimumTime = false, bool bAllowFade = true, + bool bTaskReminders = true); + virtual bool isCompleted(); + virtual void useItem(std::shared_ptr item, + bool bTestUseOnly = false); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/UseTileTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/UseTileTask.cpp index 7867f89b0..35d992d14 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/UseTileTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/UseTileTask.cpp @@ -4,37 +4,42 @@ #include "../../Minecraft.World/Items/ItemInstance.h" #include "UseTileTask.h" -UseTileTask::UseTileTask(const int tileId, int x, int y, int z, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion, std::vector *inConstraints, bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders) - : TutorialTask( tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, bTaskReminders ), - x( x ), y( y ), z( z ), tileId( tileId ) -{ - useLocation = true; +UseTileTask::UseTileTask(const int tileId, int x, int y, int z, + Tutorial* tutorial, int descriptionId, + bool enablePreCompletion, + std::vector* inConstraints, + bool bShowMinimumTime, bool bAllowFade, + bool bTaskReminders) + : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, + bShowMinimumTime, bAllowFade, bTaskReminders), + x(x), + y(y), + z(z), + tileId(tileId) { + useLocation = true; } -UseTileTask::UseTileTask(const int tileId, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion, std::vector *inConstraints, bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders) - : TutorialTask( tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, bTaskReminders ), - tileId( tileId ) -{ - useLocation = false; +UseTileTask::UseTileTask(const int tileId, Tutorial* tutorial, + int descriptionId, bool enablePreCompletion, + std::vector* inConstraints, + bool bShowMinimumTime, bool bAllowFade, + bool bTaskReminders) + : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, + bShowMinimumTime, bAllowFade, bTaskReminders), + tileId(tileId) { + useLocation = false; } -bool UseTileTask::isCompleted() -{ - return bIsCompleted; -} +bool UseTileTask::isCompleted() { return bIsCompleted; } -void UseTileTask::useItemOn(Level *level, std::shared_ptr item, int x, int y, int z,bool bTestUseOnly) -{ - if(bTestUseOnly) return; +void UseTileTask::useItemOn(Level* level, std::shared_ptr item, + int x, int y, int z, bool bTestUseOnly) { + if (bTestUseOnly) return; - if( !enablePreCompletion && !bHasBeenActivated) return; + if (!enablePreCompletion && !bHasBeenActivated) return; - if( !useLocation || ( x == this->x && y == this->y && z == this->z ) ) - { - int t = level->getTile(x, y, z); - if( t == tileId ) - bIsCompleted = true; - } + if (!useLocation || (x == this->x && y == this->y && z == this->z)) { + int t = level->getTile(x, y, z); + if (t == tileId) bIsCompleted = true; + } } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/UseTileTask.h b/Minecraft.Client/Platform/Common/Tutorial/UseTileTask.h index 7d2467086..fe1d26be3 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/UseTileTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/UseTileTask.h @@ -1,24 +1,31 @@ #pragma once -//using namespace std; +// using namespace std; #include "TutorialTask.h" class Level; -// 4J Stu - Tasks that involve using a tile, with or without an item. e.g. Opening a chest -class UseTileTask : public TutorialTask -{ +// 4J Stu - Tasks that involve using a tile, with or without an item. e.g. +// Opening a chest +class UseTileTask : public TutorialTask { private: - int x,y,z; - const int tileId; - bool useLocation; - bool completed; + int x, y, z; + const int tileId; + bool useLocation; + bool completed; public: - UseTileTask(const int tileId, int x, int y, int z, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion = false, std::vector *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); - UseTileTask(const int tileId, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion = false, std::vector *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true); - virtual bool isCompleted(); - virtual void useItemOn(Level *level, std::shared_ptr item, int x, int y, int z, bool bTestUseOnly=false); + UseTileTask(const int tileId, int x, int y, int z, Tutorial* tutorial, + int descriptionId, bool enablePreCompletion = false, + std::vector* inConstraints = NULL, + bool bShowMinimumTime = false, bool bAllowFade = true, + bool bTaskReminders = true); + UseTileTask(const int tileId, Tutorial* tutorial, int descriptionId, + bool enablePreCompletion = false, + std::vector* inConstraints = NULL, + bool bShowMinimumTime = false, bool bAllowFade = true, + bool bTaskReminders = true); + virtual bool isCompleted(); + virtual void useItemOn(Level* level, std::shared_ptr item, + int x, int y, int z, bool bTestUseOnly = false); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/XuiCraftingTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/XuiCraftingTask.cpp index c4f61b5ff..5428a318e 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/XuiCraftingTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/XuiCraftingTask.cpp @@ -6,37 +6,37 @@ #include "Tutorial.h" #include "XuiCraftingTask.h" -bool XuiCraftingTask::isCompleted() -{ +bool XuiCraftingTask::isCompleted() { #ifndef __PSVITA__ - // This doesn't seem to work - //IUIScene_CraftingMenu *craftScene = reinterpret_cast(tutorial->getScene()); + // This doesn't seem to work + // IUIScene_CraftingMenu *craftScene = + // reinterpret_cast(tutorial->getScene()); #ifdef _XBOX - CXuiSceneCraftingPanel *craftScene = (CXuiSceneCraftingPanel *)(tutorial->getScene()); + CXuiSceneCraftingPanel* craftScene = + (CXuiSceneCraftingPanel*)(tutorial->getScene()); #else - UIScene_CraftingMenu *craftScene = reinterpret_cast(tutorial->getScene()); + UIScene_CraftingMenu* craftScene = + reinterpret_cast(tutorial->getScene()); #endif - bool completed = false; + bool completed = false; - switch(m_type) - { - case e_Crafting_SelectGroup: - if(craftScene != NULL && craftScene->getCurrentGroup() == m_group) - { - completed = true; - } - break; - case e_Crafting_SelectItem: - if(craftScene != NULL && craftScene->isItemSelected(m_item)) - { - completed = true; - } - break; - } + switch (m_type) { + case e_Crafting_SelectGroup: + if (craftScene != NULL && + craftScene->getCurrentGroup() == m_group) { + completed = true; + } + break; + case e_Crafting_SelectItem: + if (craftScene != NULL && craftScene->isItemSelected(m_item)) { + completed = true; + } + break; + } - return completed; + return completed; #else - return true; + return true; #endif } diff --git a/Minecraft.Client/Platform/Common/Tutorial/XuiCraftingTask.h b/Minecraft.Client/Platform/Common/Tutorial/XuiCraftingTask.h index 583d4020b..14c94c033 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/XuiCraftingTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/XuiCraftingTask.h @@ -2,35 +2,42 @@ #include "TutorialTask.h" #include "../../Minecraft.World/Recipes/Recipy.h" -class XuiCraftingTask : public TutorialTask -{ +class XuiCraftingTask : public TutorialTask { public: - enum eCraftingTaskType - { - e_Crafting_SelectGroup, - e_Crafting_SelectItem, - }; + enum eCraftingTaskType { + e_Crafting_SelectGroup, + e_Crafting_SelectItem, + }; - // Select group - XuiCraftingTask(Tutorial *tutorial, int descriptionId, Recipy::_eGroupType groupToSelect, bool enablePreCompletion = false, std::vector *inConstraints = NULL, - bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) - : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), - m_group(groupToSelect), - m_type( e_Crafting_SelectGroup ) - {} + // Select group + XuiCraftingTask(Tutorial* tutorial, int descriptionId, + Recipy::_eGroupType groupToSelect, + bool enablePreCompletion = false, + std::vector* inConstraints = NULL, + bool bShowMinimumTime = false, bool bAllowFade = true, + bool m_bTaskReminders = true) + : TutorialTask(tutorial, descriptionId, enablePreCompletion, + inConstraints, bShowMinimumTime, bAllowFade, + m_bTaskReminders), + m_group(groupToSelect), + m_type(e_Crafting_SelectGroup) {} - // Select Item - XuiCraftingTask(Tutorial *tutorial, int descriptionId, int itemId, bool enablePreCompletion = false, std::vector *inConstraints = NULL, - bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) - : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), - m_item(itemId), - m_type( e_Crafting_SelectItem ) - {} + // Select Item + XuiCraftingTask(Tutorial* tutorial, int descriptionId, int itemId, + bool enablePreCompletion = false, + std::vector* inConstraints = NULL, + bool bShowMinimumTime = false, bool bAllowFade = true, + bool m_bTaskReminders = true) + : TutorialTask(tutorial, descriptionId, enablePreCompletion, + inConstraints, bShowMinimumTime, bAllowFade, + m_bTaskReminders), + m_item(itemId), + m_type(e_Crafting_SelectItem) {} - virtual bool isCompleted(); + virtual bool isCompleted(); private: - eCraftingTaskType m_type; - Recipy::_eGroupType m_group; - int m_item; + eCraftingTaskType m_type; + Recipy::_eGroupType m_group; + int m_item; }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/UI/IUIController.h b/Minecraft.Client/Platform/Common/UI/IUIController.h index 0dc12cb99..304f1459e 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIController.h +++ b/Minecraft.Client/Platform/Common/UI/IUIController.h @@ -2,76 +2,90 @@ #include "UIEnums.h" -// 4J Stu - An interface class that defines all the public functions that we use within the game code. This allows us to build the Xbox 360 version without +// 4J Stu - An interface class that defines all the public functions that we use +// within the game code. This allows us to build the Xbox 360 version without // using the base UIController class used by the other platforms -class IUIController -{ +class IUIController { public: - virtual void tick() = 0; - virtual void render() = 0; - virtual void StartReloadSkinThread() = 0; - virtual bool IsReloadingSkin() = 0; - virtual void CleanUpSkinReload() = 0; - virtual bool NavigateToScene(int iPad, EUIScene scene, void *initData = NULL, EUILayer layer = eUILayer_Scene, EUIGroup group = eUIGroup_PAD) = 0; - virtual bool NavigateBack(int iPad, bool forceUsePad = false, EUIScene eScene = eUIScene_COUNT, EUILayer eLayer = eUILayer_COUNT) = 0; - virtual void CloseUIScenes(int iPad, bool forceIPad = false) = 0; - virtual void CloseAllPlayersScenes() = 0; + virtual void tick() = 0; + virtual void render() = 0; + virtual void StartReloadSkinThread() = 0; + virtual bool IsReloadingSkin() = 0; + virtual void CleanUpSkinReload() = 0; + virtual bool NavigateToScene(int iPad, EUIScene scene, + void* initData = NULL, + EUILayer layer = eUILayer_Scene, + EUIGroup group = eUIGroup_PAD) = 0; + virtual bool NavigateBack(int iPad, bool forceUsePad = false, + EUIScene eScene = eUIScene_COUNT, + EUILayer eLayer = eUILayer_COUNT) = 0; + virtual void CloseUIScenes(int iPad, bool forceIPad = false) = 0; + virtual void CloseAllPlayersScenes() = 0; - virtual bool IsPauseMenuDisplayed(int iPad) = 0; - virtual bool IsContainerMenuDisplayed(int iPad) = 0; - virtual bool IsIgnorePlayerJoinMenuDisplayed(int iPad) = 0; - virtual bool IsIgnoreAutosaveMenuDisplayed(int iPad) = 0; - virtual void SetIgnoreAutosaveMenuDisplayed(int iPad, bool displayed) = 0; - virtual bool IsSceneInStack(int iPad, EUIScene eScene) = 0; - virtual bool GetMenuDisplayed(int iPad) = 0; - virtual void CheckMenuDisplayed() = 0; + virtual bool IsPauseMenuDisplayed(int iPad) = 0; + virtual bool IsContainerMenuDisplayed(int iPad) = 0; + virtual bool IsIgnorePlayerJoinMenuDisplayed(int iPad) = 0; + virtual bool IsIgnoreAutosaveMenuDisplayed(int iPad) = 0; + virtual void SetIgnoreAutosaveMenuDisplayed(int iPad, bool displayed) = 0; + virtual bool IsSceneInStack(int iPad, EUIScene eScene) = 0; + virtual bool GetMenuDisplayed(int iPad) = 0; + virtual void CheckMenuDisplayed() = 0; - virtual void SetTooltipText( unsigned int iPad, unsigned int tooltip, int iTextID ) = 0; - virtual void SetEnableTooltips( unsigned int iPad, bool bVal ) = 0; - virtual void ShowTooltip( unsigned int iPad, unsigned int tooltip, bool show ) = 0; - virtual void SetTooltips( unsigned int iPad, int iA, int iB=-1, int iX=-1, int iY=-1 , int iLT=-1, int iRT=-1, int iLB=-1, int iRB=-1, int iLS=-1, bool forceUpdate = false) = 0; - virtual void EnableTooltip( unsigned int iPad, unsigned int tooltip, bool enable ) = 0; - virtual void RefreshTooltips(unsigned int iPad) = 0; + virtual void SetTooltipText(unsigned int iPad, unsigned int tooltip, + int iTextID) = 0; + virtual void SetEnableTooltips(unsigned int iPad, bool bVal) = 0; + virtual void ShowTooltip(unsigned int iPad, unsigned int tooltip, + bool show) = 0; + virtual void SetTooltips(unsigned int iPad, int iA, int iB = -1, + int iX = -1, int iY = -1, int iLT = -1, + int iRT = -1, int iLB = -1, int iRB = -1, + int iLS = -1, int iRS = -1, int iBack = -1, + bool forceUpdate = false) = 0; + virtual void EnableTooltip(unsigned int iPad, unsigned int tooltip, + bool enable) = 0; + virtual void RefreshTooltips(unsigned int iPad) = 0; - virtual void PlayUISFX(ESoundEffect eSound) = 0; + virtual void PlayUISFX(ESoundEffect eSound) = 0; - virtual void ShowUIDebugConsole(bool show) {} - virtual void ShowUIDebugMarketingGuide(bool show) {} + virtual void ShowUIDebugConsole(bool show) {} + virtual void ShowUIDebugMarketingGuide(bool show) {} - virtual void DisplayGamertag(unsigned int iPad, bool show) = 0; - virtual void SetSelectedItem(unsigned int iPad, const std::wstring &name) = 0; - virtual void UpdateSelectedItemPos(unsigned int iPad) = 0; + virtual void DisplayGamertag(unsigned int iPad, bool show) = 0; + virtual void SetSelectedItem(unsigned int iPad, + const std::wstring& name) = 0; + virtual void UpdateSelectedItemPos(unsigned int iPad) = 0; - virtual void HandleDLCMountingComplete() = 0; - virtual void HandleDLCInstalled(int iPad) = 0; + virtual void HandleDLCMountingComplete() = 0; + virtual void HandleDLCInstalled(int iPad) = 0; #ifdef _XBOX_ONE - virtual void HandleDLCLicenseChange() = 0; + virtual void HandleDLCLicenseChange() = 0; #endif - virtual void HandleTMSDLCFileRetrieved(int iPad) = 0; - virtual void HandleTMSBanFileRetrieved(int iPad) = 0; - virtual void HandleInventoryUpdated(int iPad) = 0; - virtual void HandleGameTick() = 0; + virtual void HandleTMSDLCFileRetrieved(int iPad) = 0; + virtual void HandleTMSBanFileRetrieved(int iPad) = 0; + virtual void HandleInventoryUpdated(int iPad) = 0; + virtual void HandleGameTick() = 0; - virtual void SetTutorialDescription(int iPad, TutorialPopupInfo *info) = 0; - virtual void SetTutorialVisible(int iPad, bool visible) = 0; - virtual bool IsTutorialVisible(int iPad) = 0; + virtual void SetTutorialDescription(int iPad, TutorialPopupInfo* info) = 0; + virtual void SetTutorialVisible(int iPad, bool visible) = 0; + virtual bool IsTutorialVisible(int iPad) = 0; - virtual void UpdatePlayerBasePositions() = 0; - virtual void SetEmptyQuadrantLogo(int iSection) = 0; - virtual void HideAllGameUIElements() = 0; - virtual void ShowOtherPlayersBaseScene(unsigned int iPad, bool show) = 0; + virtual void UpdatePlayerBasePositions() = 0; + virtual void SetEmptyQuadrantLogo(int iSection) = 0; + virtual void HideAllGameUIElements() = 0; + virtual void ShowOtherPlayersBaseScene(unsigned int iPad, bool show) = 0; - virtual void ShowTrialTimer(bool show) = 0; - virtual void SetTrialTimerLimitSecs(unsigned int uiSeconds) = 0; - virtual void UpdateTrialTimer(unsigned int iPad) = 0; - virtual void ReduceTrialTimerValue() = 0; + virtual void ShowTrialTimer(bool show) = 0; + virtual void SetTrialTimerLimitSecs(unsigned int uiSeconds) = 0; + virtual void UpdateTrialTimer(unsigned int iPad) = 0; + virtual void ReduceTrialTimerValue() = 0; - virtual void ShowAutosaveCountdownTimer(bool show) = 0; - virtual void UpdateAutosaveCountdownTimer(unsigned int uiSeconds) = 0; - virtual void ShowSavingMessage(unsigned int iPad, C4JStorage::ESavingMessage eVal) = 0; + virtual void ShowAutosaveCountdownTimer(bool show) = 0; + virtual void UpdateAutosaveCountdownTimer(unsigned int uiSeconds) = 0; + virtual void ShowSavingMessage(unsigned int iPad, + C4JStorage::ESavingMessage eVal) = 0; - virtual bool PressStartPlaying(unsigned int iPad) = 0; - virtual void ShowPressStart(unsigned int iPad) = 0; + virtual bool PressStartPlaying(unsigned int iPad) = 0; + virtual void ShowPressStart(unsigned int iPad) = 0; - virtual void SetWinUserIndex(unsigned int iPad) = 0; + virtual void SetWinUserIndex(unsigned int iPad) = 0; }; diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.cpp index 90525f5d0..9acb8fa64 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.cpp @@ -12,1627 +12,1483 @@ #ifdef __ORBIS__ #include #endif -IUIScene_AbstractContainerMenu::IUIScene_AbstractContainerMenu() -{ - m_menu = NULL; - m_autoDeleteMenu = false; - m_lastPointerLabelSlot = NULL; - m_pointerPos.x = 0.0f; - m_pointerPos.y = 0.0f; +IUIScene_AbstractContainerMenu::IUIScene_AbstractContainerMenu() { + m_menu = NULL; + m_autoDeleteMenu = false; + m_lastPointerLabelSlot = NULL; + m_pointerPos.x = 0.0f; + m_pointerPos.y = 0.0f; } -IUIScene_AbstractContainerMenu::~IUIScene_AbstractContainerMenu() -{ - // Delete associated menu if we were requested to on initialisation. Most menus are - // created just before calling CXuiSceneAbstractContainer::Initialize, but the player's inventorymenu - // is also passed directly and we don't want to go deleting that - if( m_autoDeleteMenu ) delete m_menu; +IUIScene_AbstractContainerMenu::~IUIScene_AbstractContainerMenu() { + // Delete associated menu if we were requested to on initialisation. Most + // menus are created just before calling + // CXuiSceneAbstractContainer::Initialize, but the player's inventorymenu is + // also passed directly and we don't want to go deleting that + if (m_autoDeleteMenu) delete m_menu; } -void IUIScene_AbstractContainerMenu::Initialize(int iPad, AbstractContainerMenu* menu, bool autoDeleteMenu, int startIndex,ESceneSection firstSection,ESceneSection maxSection, bool bNavigateBack) -{ - assert( menu != NULL ); +void IUIScene_AbstractContainerMenu::Initialize( + int iPad, AbstractContainerMenu* menu, bool autoDeleteMenu, int startIndex, + ESceneSection firstSection, ESceneSection maxSection, bool bNavigateBack) { + assert(menu != NULL); - m_menu = menu; - m_autoDeleteMenu = autoDeleteMenu; + m_menu = menu; + m_autoDeleteMenu = autoDeleteMenu; - Minecraft::GetInstance()->localplayers[iPad]->containerMenu = menu; + Minecraft::GetInstance()->localplayers[iPad]->containerMenu = menu; - // 4J WESTY - New tool tips to support pointer prototype. - //UpdateTooltips(); - // Default tooltips. - for ( int i = 0; i < eToolTipNumButtons; ++i ) - { - m_aeToolTipSettings[ i ] = eToolTipNone; - } - // 4J-PB - don't set the eToolTipPickupPlace_OLD here - let the timer do it. - /*SetToolTip( eToolTipButtonA, eToolTipPickupPlace_OLD );*/ - SetToolTip( eToolTipButtonB, eToolTipExit ); - SetToolTip( eToolTipButtonA, eToolTipNone ); - SetToolTip( eToolTipButtonX, eToolTipNone ); - SetToolTip( eToolTipButtonY, eToolTipNone ); + // 4J WESTY - New tool tips to support pointer prototype. + // UpdateTooltips(); + // Default tooltips. + for (int i = 0; i < eToolTipNumButtons; ++i) { + m_aeToolTipSettings[i] = eToolTipNone; + } + // 4J-PB - don't set the eToolTipPickupPlace_OLD here - let the timer do it. + /*SetToolTip( eToolTipButtonA, eToolTipPickupPlace_OLD );*/ + SetToolTip(eToolTipButtonB, eToolTipExit); + SetToolTip(eToolTipButtonA, eToolTipNone); + SetToolTip(eToolTipButtonX, eToolTipNone); + SetToolTip(eToolTipButtonY, eToolTipNone); - // 4J WESTY : To indicate if pointer has left menu window area. - m_bPointerOutsideMenu = false; + // 4J WESTY : To indicate if pointer has left menu window area. + m_bPointerOutsideMenu = false; - // 4J Stu - Store the enum range for the current scene - m_eFirstSection = firstSection; - m_eMaxSection = maxSection; + // 4J Stu - Store the enum range for the current scene + m_eFirstSection = firstSection; + m_eMaxSection = maxSection; - m_iConsectiveInputTicks = 0; + m_iConsectiveInputTicks = 0; - m_bNavigateBack = bNavigateBack; + m_bNavigateBack = bNavigateBack; - // Put the pointer over first item in use row to start with. + // Put the pointer over first item in use row to start with. #ifdef TAP_DETECTION - m_eCurrSection = firstSection; - m_eCurrTapState = eTapStateNoInput; - m_iCurrSlotX = 0; - m_iCurrSlotY = 0; -#endif // TAP_DETECTION - // - // for(int i=0;i= rows) { + (*piTargetY) = rows - 1; + } else { + (*piTargetY) = offsetY; + } - // Update X - int offsetX = (*piTargetX) - xOffset; - if( offsetX < 0 ) - { - *piTargetX = 0; - } - else if (offsetX >= columns) - { - *piTargetX = columns - 1; - } - else - { - *piTargetX = offsetX; - } - } - else - { - // Update X - int offsetX = (*piTargetX) - xOffset; - if( offsetX < 0 ) - { - *piTargetX = columns - 1; - } - else if (offsetX >= columns) - { - *piTargetX = 0; - } - else - { - *piTargetX = offsetX; - } - } + // Update X + int offsetX = (*piTargetX) - xOffset; + if (offsetX < 0) { + *piTargetX = 0; + } else if (offsetX >= columns) { + *piTargetX = columns - 1; + } else { + *piTargetX = offsetX; + } + } else { + // Update X + int offsetX = (*piTargetX) - xOffset; + if (offsetX < 0) { + *piTargetX = columns - 1; + } else if (offsetX >= columns) { + *piTargetX = 0; + } else { + *piTargetX = offsetX; + } + } } #ifdef TAP_DETECTION -IUIScene_AbstractContainerMenu::ETapState IUIScene_AbstractContainerMenu::GetTapInputType( float fInputX, float fInputY ) -{ - if ( ( fabs( fInputX ) < 0.3f ) && ( fabs( fInputY ) < 0.3f ) ) - { - return eTapStateNoInput; - } - else if ( ( fInputX < -0.3f ) && ( fabs( fInputY ) < 0.3f ) ) - { - return eTapStateLeft; - } - else if ( ( fInputX > 0.3f ) && ( fabs( fInputY ) < 0.3f ) ) - { - return eTapStateRight; - } - else if ( ( fInputY < -0.3f ) && ( fabs( fInputX ) < 0.3f ) ) - { - return eTapStateDown; - } - else if ( ( fInputY > 0.3f ) && ( fabs( fInputX ) < 0.3f ) ) - { - return eTapStateUp; - } - else - { - return eTapNone; - } +IUIScene_AbstractContainerMenu::ETapState +IUIScene_AbstractContainerMenu::GetTapInputType(float fInputX, float fInputY) { + if ((fabs(fInputX) < 0.3f) && (fabs(fInputY) < 0.3f)) { + return eTapStateNoInput; + } else if ((fInputX < -0.3f) && (fabs(fInputY) < 0.3f)) { + return eTapStateLeft; + } else if ((fInputX > 0.3f) && (fabs(fInputY) < 0.3f)) { + return eTapStateRight; + } else if ((fInputY < -0.3f) && (fabs(fInputX) < 0.3f)) { + return eTapStateDown; + } else if ((fInputY > 0.3f) && (fabs(fInputX) < 0.3f)) { + return eTapStateUp; + } else { + return eTapNone; + } } -#endif // TAP_DETECTION +#endif // TAP_DETECTION -void IUIScene_AbstractContainerMenu::SetToolTip( EToolTipButton eButton, EToolTipItem eItem ) -{ - if ( m_aeToolTipSettings[ eButton ] != eItem ) - { - m_aeToolTipSettings[ eButton ] = eItem; - UpdateTooltips(); - } +void IUIScene_AbstractContainerMenu::SetToolTip(EToolTipButton eButton, + EToolTipItem eItem) { + if (m_aeToolTipSettings[eButton] != eItem) { + m_aeToolTipSettings[eButton] = eItem; + UpdateTooltips(); + } } -void IUIScene_AbstractContainerMenu::UpdateTooltips() -{ - // Table gives us text id for tooltip. - static const int kaToolTipextIds[ eNumToolTips ] = - { - IDS_TOOLTIPS_PICKUPPLACE, //eToolTipPickupPlace_OLD - IDS_TOOLTIPS_EXIT, // eToolTipExit - IDS_TOOLTIPS_PICKUP_GENERIC, // eToolTipPickUpGeneric - IDS_TOOLTIPS_PICKUP_ALL, // eToolTipPickUpAll - IDS_TOOLTIPS_PICKUP_HALF, // eToolTipPickUpHalf - IDS_TOOLTIPS_PLACE_GENERIC, // eToolTipPlaceGeneric - IDS_TOOLTIPS_PLACE_ONE, // eToolTipPlaceOne - IDS_TOOLTIPS_PLACE_ALL, // eToolTipPlaceAll - IDS_TOOLTIPS_DROP_GENERIC, // eToolTipDropGeneric - IDS_TOOLTIPS_DROP_ONE, // eToolTipDropOne - IDS_TOOLTIPS_DROP_ALL, // eToolTipDropAll - IDS_TOOLTIPS_SWAP, // eToolTipSwap - IDS_TOOLTIPS_QUICK_MOVE, // eToolTipQuickMove - IDS_TOOLTIPS_QUICK_MOVE_INGREDIENT, // eToolTipQuickMoveIngredient - IDS_TOOLTIPS_QUICK_MOVE_FUEL, // eToolTipQuickMoveTool - IDS_TOOLTIPS_WHAT_IS_THIS, // eToolTipWhatIsThis - IDS_TOOLTIPS_EQUIP, // eToolTipEquip - IDS_TOOLTIPS_CLEAR_QUICK_SELECT, // eToolTipClearQuickSelect - IDS_TOOLTIPS_QUICK_MOVE_TOOL, // eToolTipQuickMoveTool - IDS_TOOLTIPS_QUICK_MOVE_ARMOR, // eToolTipQuickMoveTool - IDS_TOOLTIPS_QUICK_MOVE_WEAPON, // eToolTipQuickMoveTool - IDS_TOOLTIPS_DYE, // eToolTipDye - IDS_TOOLTIPS_REPAIR, // eToolTipRepair - }; +void IUIScene_AbstractContainerMenu::UpdateTooltips() { + // Table gives us text id for tooltip. + static const int kaToolTipextIds[eNumToolTips] = { + IDS_TOOLTIPS_PICKUPPLACE, // eToolTipPickupPlace_OLD + IDS_TOOLTIPS_EXIT, // eToolTipExit + IDS_TOOLTIPS_PICKUP_GENERIC, // eToolTipPickUpGeneric + IDS_TOOLTIPS_PICKUP_ALL, // eToolTipPickUpAll + IDS_TOOLTIPS_PICKUP_HALF, // eToolTipPickUpHalf + IDS_TOOLTIPS_PLACE_GENERIC, // eToolTipPlaceGeneric + IDS_TOOLTIPS_PLACE_ONE, // eToolTipPlaceOne + IDS_TOOLTIPS_PLACE_ALL, // eToolTipPlaceAll + IDS_TOOLTIPS_DROP_GENERIC, // eToolTipDropGeneric + IDS_TOOLTIPS_DROP_ONE, // eToolTipDropOne + IDS_TOOLTIPS_DROP_ALL, // eToolTipDropAll + IDS_TOOLTIPS_SWAP, // eToolTipSwap + IDS_TOOLTIPS_QUICK_MOVE, // eToolTipQuickMove + IDS_TOOLTIPS_QUICK_MOVE_INGREDIENT, // eToolTipQuickMoveIngredient + IDS_TOOLTIPS_QUICK_MOVE_FUEL, // eToolTipQuickMoveTool + IDS_TOOLTIPS_WHAT_IS_THIS, // eToolTipWhatIsThis + IDS_TOOLTIPS_EQUIP, // eToolTipEquip + IDS_TOOLTIPS_CLEAR_QUICK_SELECT, // eToolTipClearQuickSelect + IDS_TOOLTIPS_QUICK_MOVE_TOOL, // eToolTipQuickMoveTool + IDS_TOOLTIPS_QUICK_MOVE_ARMOR, // eToolTipQuickMoveTool + IDS_TOOLTIPS_QUICK_MOVE_WEAPON, // eToolTipQuickMoveTool + IDS_TOOLTIPS_DYE, // eToolTipDye + IDS_TOOLTIPS_REPAIR, // eToolTipRepair + }; - int focusUser = getPad(); + int focusUser = getPad(); - for ( int i = 0; i < eToolTipNumButtons; ++i ) - { - if ( m_aeToolTipSettings[ i ] == eToolTipNone ) - { - ui.ShowTooltip( focusUser, i, false ); - } - else - { - ui.SetTooltipText( focusUser, i, kaToolTipextIds[ m_aeToolTipSettings[ i ] ] ); - ui.ShowTooltip( focusUser, i, true ); - } - } + for (int i = 0; i < eToolTipNumButtons; ++i) { + if (m_aeToolTipSettings[i] == eToolTipNone) { + ui.ShowTooltip(focusUser, i, false); + } else { + ui.SetTooltipText(focusUser, i, + kaToolTipextIds[m_aeToolTipSettings[i]]); + ui.ShowTooltip(focusUser, i, true); + } + } } -void IUIScene_AbstractContainerMenu::onMouseTick() -{ - Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[getPad()] != NULL) - { - Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial(); - if(tutorial != NULL) - { - if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(ACTION_MENU_UP)) - { - return; - } - } - } +void IUIScene_AbstractContainerMenu::onMouseTick() { + Minecraft* pMinecraft = Minecraft::GetInstance(); + if (pMinecraft->localgameModes[getPad()] != NULL) { + Tutorial* tutorial = + pMinecraft->localgameModes[getPad()]->getTutorial(); + if (tutorial != NULL) { + if (ui.IsTutorialVisible(getPad()) && + !tutorial->isInputAllowed(ACTION_MENU_UP)) { + return; + } + } + } - // Offset to display carried item attached to pointer. - // static const float kfCarriedItemOffsetX = -5.0f; - // static const float kfCarriedItemOffsetY = -5.0f; - float fInputDirX=0.0f; - float fInputDirY=0.0f; + // Offset to display carried item attached to pointer. + // static const float kfCarriedItemOffsetX = -5.0f; + // static const float kfCarriedItemOffsetY = -5.0f; + float fInputDirX = 0.0f; + float fInputDirY = 0.0f; - // Get current pointer position. - UIVec2D vPointerPos = m_pointerPos; + // Get current pointer position. + UIVec2D vPointerPos = m_pointerPos; - // Offset to image centre. - vPointerPos.x += m_fPointerImageOffsetX; - vPointerPos.y += m_fPointerImageOffsetY; + // Offset to image centre. + vPointerPos.x += m_fPointerImageOffsetX; + vPointerPos.y += m_fPointerImageOffsetY; - // Get stick input. - int iPad = getPad(); + // Get stick input. + 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 + 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 #ifdef __ORBIS__ - // should have sensitivity for the touchpad - //(float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_TouchPadInMenu)/100.0f + // should have sensitivity for the touchpad + //(float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_TouchPadInMenu)/100.0f - // get the touchpad input and treat it as a map to the window - ScePadTouchData *pTouchPadData=InputManager.GetTouchPadData(iPad); + // get the touchpad input and treat it as a map to the window + ScePadTouchData* pTouchPadData = InputManager.GetTouchPadData(iPad); - // make sure the touchpad button isn't down (it's the pausemenu) + // make sure the touchpad button isn't down (it's the pausemenu) - if((!InputManager.ButtonDown(iPad, ACTION_MENU_TOUCHPAD_PRESS)) && (pTouchPadData->touchNum>0)) - { - if(m_bFirstTouchStored[iPad]==false) - { - m_oldvTouchPos.x=(float)pTouchPadData->touch[0].x; - m_oldvTouchPos.y=(float)pTouchPadData->touch[0].y; - m_oldvPointerPos.x=vPointerPos.x; - m_oldvPointerPos.y=vPointerPos.y; - m_bFirstTouchStored[iPad]=true; - } + if ((!InputManager.ButtonDown(iPad, ACTION_MENU_TOUCHPAD_PRESS)) && + (pTouchPadData->touchNum > 0)) { + if (m_bFirstTouchStored[iPad] == false) { + m_oldvTouchPos.x = (float)pTouchPadData->touch[0].x; + m_oldvTouchPos.y = (float)pTouchPadData->touch[0].y; + m_oldvPointerPos.x = vPointerPos.x; + m_oldvPointerPos.y = vPointerPos.y; + m_bFirstTouchStored[iPad] = true; + } - // should take the average of multiple touch points + // should take the average of multiple touch points - float fNewX=(((float)pTouchPadData->touch[0].x)-m_oldvTouchPos.x) * m_fTouchPadMulX; - float fNewY=(((float)pTouchPadData->touch[0].y)-m_oldvTouchPos.y) * m_fTouchPadMulY; - // relative positions - needs a deadzone + float fNewX = (((float)pTouchPadData->touch[0].x) - m_oldvTouchPos.x) * + m_fTouchPadMulX; + float fNewY = (((float)pTouchPadData->touch[0].y) - m_oldvTouchPos.y) * + m_fTouchPadMulY; + // relative positions - needs a deadzone - if(fNewX>m_fTouchPadDeadZoneX) - { - vPointerPos.x=m_oldvPointerPos.x+((fNewX-m_fTouchPadDeadZoneX)*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f)); - } - else if(fNewX<-m_fTouchPadDeadZoneX) - { - vPointerPos.x=m_oldvPointerPos.x+((fNewX+m_fTouchPadDeadZoneX)*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f)); - } + if (fNewX > m_fTouchPadDeadZoneX) { + vPointerPos.x = m_oldvPointerPos.x + + ((fNewX - m_fTouchPadDeadZoneX) * + ((float)app.GetGameSettings( + iPad, eGameSetting_Sensitivity_InMenu) / + 100.0f)); + } else if (fNewX < -m_fTouchPadDeadZoneX) { + vPointerPos.x = m_oldvPointerPos.x + + ((fNewX + m_fTouchPadDeadZoneX) * + ((float)app.GetGameSettings( + iPad, eGameSetting_Sensitivity_InMenu) / + 100.0f)); + } - if(fNewY>m_fTouchPadDeadZoneY) - { - vPointerPos.y=m_oldvPointerPos.y+((fNewY-m_fTouchPadDeadZoneY)*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f)); - } - else if(fNewY<-m_fTouchPadDeadZoneY) - { - vPointerPos.y=m_oldvPointerPos.y+((fNewY+m_fTouchPadDeadZoneY)*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f)); - } + if (fNewY > m_fTouchPadDeadZoneY) { + vPointerPos.y = m_oldvPointerPos.y + + ((fNewY - m_fTouchPadDeadZoneY) * + ((float)app.GetGameSettings( + iPad, eGameSetting_Sensitivity_InMenu) / + 100.0f)); + } else if (fNewY < -m_fTouchPadDeadZoneY) { + vPointerPos.y = m_oldvPointerPos.y + + ((fNewY + m_fTouchPadDeadZoneY) * + ((float)app.GetGameSettings( + iPad, eGameSetting_Sensitivity_InMenu) / + 100.0f)); + } - // Clamp to pointer extents. - if ( vPointerPos.x < m_fPointerMinX ) vPointerPos.x = m_fPointerMinX; - else if ( vPointerPos.x > m_fPointerMaxX ) vPointerPos.x = m_fPointerMaxX; - if ( vPointerPos.y < m_fPointerMinY ) vPointerPos.y = m_fPointerMinY; - else if ( vPointerPos.y > m_fPointerMaxY ) vPointerPos.y = m_fPointerMaxY; + // Clamp to pointer extents. + if (vPointerPos.x < m_fPointerMinX) + vPointerPos.x = m_fPointerMinX; + else if (vPointerPos.x > m_fPointerMaxX) + vPointerPos.x = m_fPointerMaxX; + if (vPointerPos.y < m_fPointerMinY) + vPointerPos.y = m_fPointerMinY; + else if (vPointerPos.y > m_fPointerMaxY) + vPointerPos.y = m_fPointerMaxY; - bStickInput = true; - m_eCurrTapState=eTapStateNoInput; - } - else - { - // reset the touch flag - m_bFirstTouchStored[iPad]=false; + bStickInput = true; + m_eCurrTapState = eTapStateNoInput; + } else { + // reset the touch flag + m_bFirstTouchStored[iPad] = false; #endif - - - // If there is any input on sticks, move the pointer. - if ( ( fabs( fInputX ) >= 0.01f ) || ( fabs( fInputY ) >= 0.01f ) ) - { - fInputDirX = ( fInputX > 0.0f ) ? 1.0f : ( fInputX < 0.0f )?-1.0f : 0.0f; - fInputDirY = ( fInputY > 0.0f ) ? 1.0f : ( fInputY < 0.0f )?-1.0f : 0.0f; + // If there is any input on sticks, move the pointer. + if ((fabs(fInputX) >= 0.01f) || (fabs(fInputY) >= 0.01f)) { + fInputDirX = (fInputX > 0.0f) ? 1.0f + : (fInputX < 0.0f) ? -1.0f + : 0.0f; + fInputDirY = (fInputY > 0.0f) ? 1.0f + : (fInputY < 0.0f) ? -1.0f + : 0.0f; #ifdef TAP_DETECTION - // Check for potential tap input to jump slot. - ETapState eNewTapInput = GetTapInputType( fInputX, fInputY ); + // Check for potential tap input to jump slot. + ETapState eNewTapInput = GetTapInputType(fInputX, fInputY); - switch( m_eCurrTapState ) - { - case eTapStateNoInput: - m_eCurrTapState = eNewTapInput; - break; + switch (m_eCurrTapState) { + case eTapStateNoInput: + m_eCurrTapState = eNewTapInput; + break; - case eTapStateUp: - case eTapStateDown: - case eTapStateLeft: - case eTapStateRight: - if ( ( eNewTapInput != m_eCurrTapState ) && ( eNewTapInput != eTapStateNoInput ) ) - { - // Input is no longer suitable for tap. - m_eCurrTapState = eTapNone; - } - break; + case eTapStateUp: + case eTapStateDown: + case eTapStateLeft: + case eTapStateRight: + if ((eNewTapInput != m_eCurrTapState) && + (eNewTapInput != eTapStateNoInput)) { + // Input is no longer suitable for tap. + m_eCurrTapState = eTapNone; + } + break; - case eTapNone: - /// Nothing to do, input is not a tap. - break; - default: - break; - } -#endif // TAP_DETECTION + case eTapNone: + /// Nothing to do, input is not a tap. + break; + default: + break; + } +#endif // TAP_DETECTION - // Square it so we get more precision for small inputs. - fInputX = fInputX * fInputX * fInputDirX * POINTER_SPEED_FACTOR; - fInputY = fInputY * fInputY * fInputDirY * POINTER_SPEED_FACTOR; - //fInputX = fInputX * POINTER_SPEED_FACTOR; - //fInputY = fInputY * POINTER_SPEED_FACTOR; - float fInputScale = 1.0f; + // Square it so we get more precision for small inputs. + fInputX = fInputX * fInputX * fInputDirX * POINTER_SPEED_FACTOR; + fInputY = fInputY * fInputY * fInputDirY * POINTER_SPEED_FACTOR; + // fInputX = fInputX * POINTER_SPEED_FACTOR; + // fInputY = fInputY * POINTER_SPEED_FACTOR; + float fInputScale = 1.0f; - // Ramp up input from zero when new input is recieved over INPUT_TICKS_FOR_SCALING ticks. This is to try to improve tapping stick to move 1 box. - if ( m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_SCALING ) - { - ++m_iConsectiveInputTicks; - fInputScale = ( (float)( m_iConsectiveInputTicks) / (float)(MAX_INPUT_TICKS_FOR_SCALING) ); - } + // Ramp up input from zero when new input is recieved over + // INPUT_TICKS_FOR_SCALING ticks. This is to try to improve tapping + // stick to move 1 box. + if (m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_SCALING) { + ++m_iConsectiveInputTicks; + fInputScale = ((float)(m_iConsectiveInputTicks) / + (float)(MAX_INPUT_TICKS_FOR_SCALING)); + } #ifdef TAP_DETECTION - else if ( m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_TAPPING ) - { - ++m_iConsectiveInputTicks; - } - else - { - m_eCurrTapState = eTapNone; - } + else if (m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_TAPPING) { + ++m_iConsectiveInputTicks; + } else { + m_eCurrTapState = eTapNone; + } #endif - // 4J Stu - The cursor moves too fast in SD mode - // The SD/splitscreen scenes are approximately 0.6 times the size of the fullscreen on - if(!RenderManager.IsHiDef() || app.GetLocalPlayerCount() > 1) fInputScale *= 0.6f; + // 4J Stu - The cursor moves too fast in SD mode + // The SD/splitscreen scenes are approximately 0.6 times the size of + // the fullscreen on + if (!RenderManager.IsHiDef() || app.GetLocalPlayerCount() > 1) + fInputScale *= 0.6f; - fInputX *= fInputScale; - fInputY *= fInputScale; + fInputX *= fInputScale; + fInputY *= fInputScale; -#ifdef USE_POINTER_ACCEL - m_fPointerAccelX += fInputX / 50.0f; - m_fPointerAccelY += fInputY / 50.0f; +#ifdef USE_POINTER_ACCEL + m_fPointerAccelX += fInputX / 50.0f; + m_fPointerAccelY += fInputY / 50.0f; - if ( fabsf( fInputX ) > fabsf( m_fPointerVelX + m_fPointerAccelX ) ) - { - m_fPointerVelX += m_fPointerAccelX; - } - else - { - m_fPointerAccelX = fInputX - m_fPointerVelX; - m_fPointerVelX = fInputX; - } + if (fabsf(fInputX) > fabsf(m_fPointerVelX + m_fPointerAccelX)) { + m_fPointerVelX += m_fPointerAccelX; + } else { + m_fPointerAccelX = fInputX - m_fPointerVelX; + m_fPointerVelX = fInputX; + } - if ( fabsf( fInputY ) > fabsf( m_fPointerVelY + m_fPointerAccelY ) ) - { - m_fPointerVelY += m_fPointerAccelY; - } - else - { - m_fPointerAccelY = fInputY - m_fPointerVelY; - m_fPointerVelY = fInputY; - } - //printf( "IN %.2f VEL %.2f ACC %.2f\n", fInputY, m_fPointerVelY, m_fPointerAccelY ); + if (fabsf(fInputY) > fabsf(m_fPointerVelY + m_fPointerAccelY)) { + m_fPointerVelY += m_fPointerAccelY; + } else { + m_fPointerAccelY = fInputY - m_fPointerVelY; + m_fPointerVelY = fInputY; + } + // printf( "IN %.2f VEL %.2f ACC %.2f\n", fInputY, m_fPointerVelY, + // m_fPointerAccelY ); - vPointerPos.x += m_fPointerVelX; - vPointerPos.y -= m_fPointerVelY; + vPointerPos.x += m_fPointerVelX; + vPointerPos.y -= m_fPointerVelY; #else - // Add input to pointer position. - vPointerPos.x += fInputX; - vPointerPos.y -= fInputY; + // Add input to pointer position. + vPointerPos.x += fInputX; + vPointerPos.y -= fInputY; #endif - // Clamp to pointer extents. - if ( vPointerPos.x < m_fPointerMinX ) vPointerPos.x = m_fPointerMinX; - else if ( vPointerPos.x > m_fPointerMaxX ) vPointerPos.x = m_fPointerMaxX; - if ( vPointerPos.y < m_fPointerMinY ) vPointerPos.y = m_fPointerMinY; - else if ( vPointerPos.y > m_fPointerMaxY ) vPointerPos.y = m_fPointerMaxY; + // Clamp to pointer extents. + if (vPointerPos.x < m_fPointerMinX) + vPointerPos.x = m_fPointerMinX; + else if (vPointerPos.x > m_fPointerMaxX) + vPointerPos.x = m_fPointerMaxX; + if (vPointerPos.y < m_fPointerMinY) + vPointerPos.y = m_fPointerMinY; + else if (vPointerPos.y > m_fPointerMaxY) + vPointerPos.y = m_fPointerMaxY; - bStickInput = true; - } - else - { - m_iConsectiveInputTicks = 0; -#ifdef USE_POINTER_ACCEL - m_fPointerVelX = 0.0f; - m_fPointerVelY = 0.0f; - m_fPointerAccelX = 0.0f; - m_fPointerAccelY = 0.0f; -#endif - } + bStickInput = true; + } else { + m_iConsectiveInputTicks = 0; +#ifdef USE_POINTER_ACCEL + m_fPointerVelX = 0.0f; + m_fPointerVelY = 0.0f; + m_fPointerAccelX = 0.0f; + m_fPointerAccelY = 0.0f; +#endif + } #ifdef __ORBIS__ - } + } #endif - // Determine which slot the pointer is currently over. - ESceneSection eSectionUnderPointer = eSectionNone; - int iNewSlotX = -1; - int iNewSlotY = -1; - int iNewSlotIndex = -1; - bool bPointerIsOverSlot = false; + // Determine which slot the pointer is currently over. + ESceneSection eSectionUnderPointer = eSectionNone; + int iNewSlotX = -1; + int iNewSlotY = -1; + int iNewSlotIndex = -1; + bool bPointerIsOverSlot = false; - // Centre position of item under pointer, use this to snap pointer to item. - D3DXVECTOR3 vSnapPos; + // Centre position of item under pointer, use this to snap pointer to item. + D3DXVECTOR3 vSnapPos; - for ( int iSection = m_eFirstSection; iSection < m_eMaxSection; ++iSection ) - { - // Do not check any further if we have already found the item under the pointer. - if(m_eCurrTapState == eTapStateJump) - { - eSectionUnderPointer = m_eCurrSection; - } - else if ( eSectionUnderPointer == eSectionNone ) - { - ESceneSection eSection = ( ESceneSection )( iSection ); + for (int iSection = m_eFirstSection; iSection < m_eMaxSection; ++iSection) { + // Do not check any further if we have already found the item under the + // pointer. + if (m_eCurrTapState == eTapStateJump) { + eSectionUnderPointer = m_eCurrSection; + } else if (eSectionUnderPointer == eSectionNone) { + ESceneSection eSection = (ESceneSection)(iSection); - // Get position of this section. - UIVec2D sectionPos; - GetPositionOfSection( eSection, &( sectionPos ) ); + // Get position of this section. + UIVec2D sectionPos; + GetPositionOfSection(eSection, &(sectionPos)); - if(!IsSectionSlotList(eSection)) - { - UIVec2D itemPos; - UIVec2D itemSize; - GetItemScreenData( eSection, 0, &( itemPos ), &( itemSize ) ); + if (!IsSectionSlotList(eSection)) { + UIVec2D itemPos; + UIVec2D itemSize; + GetItemScreenData(eSection, 0, &(itemPos), &(itemSize)); - UIVec2D itemMax = itemSize; - itemMax += itemPos; + UIVec2D itemMax = itemSize; + itemMax += itemPos; - if ( ( vPointerPos.x >= sectionPos.x ) && ( vPointerPos.x <= itemMax.x ) && - ( vPointerPos.y >= sectionPos.y ) && ( vPointerPos.y <= itemMax.y ) ) - { - // Pointer is over this control! - eSectionUnderPointer = eSection; + if ((vPointerPos.x >= sectionPos.x) && + (vPointerPos.x <= itemMax.x) && + (vPointerPos.y >= sectionPos.y) && + (vPointerPos.y <= itemMax.y)) { + // Pointer is over this control! + eSectionUnderPointer = eSection; - vSnapPos.x = itemPos.x + ( itemSize.x / 2.0f ); - vSnapPos.y = itemPos.y + ( itemSize.y / 2.0f ); + vSnapPos.x = itemPos.x + (itemSize.x / 2.0f); + vSnapPos.y = itemPos.y + (itemSize.y / 2.0f); - // Does this section already have focus. - if ( !doesSectionTreeHaveFocus( eSection ) ) - { - // Give focus to this section. - setSectionFocus(eSection, getPad()); - } + // Does this section already have focus. + if (!doesSectionTreeHaveFocus(eSection)) { + // Give focus to this section. + setSectionFocus(eSection, getPad()); + } - bPointerIsOverSlot = false; + bPointerIsOverSlot = false; - // Have we actually changed slot? If so, input cannot be a tap. - if ( ( eSectionUnderPointer != m_eCurrSection ) || ( iNewSlotX != m_iCurrSlotX ) || ( iNewSlotY != m_iCurrSlotY ) ) - { - m_eCurrTapState = eTapNone; - } + // Have we actually changed slot? If so, input cannot be a + // tap. + if ((eSectionUnderPointer != m_eCurrSection) || + (iNewSlotX != m_iCurrSlotX) || + (iNewSlotY != m_iCurrSlotY)) { + m_eCurrTapState = eTapNone; + } - // Store what is currently under the pointer. - m_eCurrSection = eSectionUnderPointer; - } - } - else - { + // Store what is currently under the pointer. + m_eCurrSection = eSectionUnderPointer; + } + } else { + // Get dimensions of this section. + int iNumRows; + int iNumColumns; + int iNumItems = + GetSectionDimensions(eSection, &(iNumColumns), &(iNumRows)); - // Get dimensions of this section. - int iNumRows; - int iNumColumns; - int iNumItems = GetSectionDimensions( eSection, &( iNumColumns ), &( iNumRows ) ); + // Check each item to see if pointer is over it. + for (int iItem = 0; iItem < iNumItems; ++iItem) { + UIVec2D itemPos; + UIVec2D itemSize; + GetItemScreenData(eSection, iItem, &(itemPos), &(itemSize)); - // Check each item to see if pointer is over it. - for ( int iItem = 0; iItem < iNumItems; ++iItem ) - { - UIVec2D itemPos; - UIVec2D itemSize; - GetItemScreenData( eSection, iItem, &( itemPos ), &( itemSize ) ); + itemPos += sectionPos; - itemPos += sectionPos; + UIVec2D itemMax = itemSize; + itemMax += itemPos; - UIVec2D itemMax = itemSize; - itemMax += itemPos; + if ((vPointerPos.x >= itemPos.x) && + (vPointerPos.x <= itemMax.x) && + (vPointerPos.y >= itemPos.y) && + (vPointerPos.y <= itemMax.y)) { + // Pointer is over this slot! + eSectionUnderPointer = eSection; + iNewSlotIndex = iItem; + iNewSlotX = iNewSlotIndex % iNumColumns; + iNewSlotY = iNewSlotIndex / iNumColumns; - if ( ( vPointerPos.x >= itemPos.x ) && ( vPointerPos.x <= itemMax.x ) && - ( vPointerPos.y >= itemPos.y ) && ( vPointerPos.y <= itemMax.y ) ) - { - // Pointer is over this slot! - eSectionUnderPointer = eSection; - iNewSlotIndex = iItem; - iNewSlotX = iNewSlotIndex % iNumColumns; - iNewSlotY = iNewSlotIndex / iNumColumns; + vSnapPos.x = itemPos.x + (itemSize.x / 2.0f); + vSnapPos.y = itemPos.y + (itemSize.y / 2.0f); - vSnapPos.x = itemPos.x + ( itemSize.x / 2.0f ); - vSnapPos.y = itemPos.y + ( itemSize.y / 2.0f ); + // Does this section already have focus. + if (!doesSectionTreeHaveFocus(eSection)) { + // Give focus to this section. + setSectionFocus(eSection, getPad()); + } - // Does this section already have focus. - if ( !doesSectionTreeHaveFocus( eSection ) ) - { - // Give focus to this section. - setSectionFocus(eSection, getPad()); - } + // Set the highlight marker. + setSectionSelectedSlot(eSection, iNewSlotX, iNewSlotY); - // Set the highlight marker. - setSectionSelectedSlot(eSection, iNewSlotX, iNewSlotY ); - - bPointerIsOverSlot = true; + bPointerIsOverSlot = true; #ifdef TAP_DETECTION - // Have we actually changed slot? If so, input cannot be a tap. - if ( ( eSectionUnderPointer != m_eCurrSection ) || ( iNewSlotX != m_iCurrSlotX ) || ( iNewSlotY != m_iCurrSlotY ) ) - { - m_eCurrTapState = eTapNone; - } + // Have we actually changed slot? If so, input cannot be + // a tap. + if ((eSectionUnderPointer != m_eCurrSection) || + (iNewSlotX != m_iCurrSlotX) || + (iNewSlotY != m_iCurrSlotY)) { + m_eCurrTapState = eTapNone; + } - // Store what is currently under the pointer. - m_eCurrSection = eSectionUnderPointer; - m_iCurrSlotX = iNewSlotX; - m_iCurrSlotY = iNewSlotY; -#endif // TAP_DETECTION - // No need to check any further slots, the pointer can only ever be over one. - break; - } - } - } - } - } + // Store what is currently under the pointer. + m_eCurrSection = eSectionUnderPointer; + m_iCurrSlotX = iNewSlotX; + m_iCurrSlotY = iNewSlotY; +#endif // TAP_DETECTION + // No need to check any further slots, the pointer can only ever be over + // one. + break; + } + } + } + } + } - // If we are not over any slot, set focus elsewhere. - if ( eSectionUnderPointer == eSectionNone ) - { - setFocusToPointer( getPad() ); + // 4J - TomK - set to section none if this is a non-visible section + if (!IsVisible(eSectionUnderPointer)) eSectionUnderPointer = eSectionNone; + + // If we are not over any slot, set focus elsewhere. + if (eSectionUnderPointer == eSectionNone) { + setFocusToPointer(getPad()); #ifdef TAP_DETECTION - // Input cannot be a tap. - m_eCurrTapState = eTapNone; + // Input cannot be a tap. + m_eCurrTapState = eTapNone; - // Store what is currently under the pointer. - m_eCurrSection = eSectionNone; - m_iCurrSlotX = -1; - m_iCurrSlotY = -1; -#endif // TAP_DETECTION - } - else - { - if ( !bStickInput ) - { - // Did we get a tap input? - int iDesiredSlotX = -1; - int iDesiredSlotY = -1; + // Store what is currently under the pointer. + m_eCurrSection = eSectionNone; + m_iCurrSlotX = -1; + m_iCurrSlotY = -1; +#endif // TAP_DETECTION + } else { + if (!bStickInput) { + // Did we get a tap input? + int iDesiredSlotX = -1; + int iDesiredSlotY = -1; - switch( m_eCurrTapState ) - { - case eTapStateUp: - iDesiredSlotX = m_iCurrSlotX; - iDesiredSlotY = m_iCurrSlotY - 1; - break; - case eTapStateDown: - iDesiredSlotX = m_iCurrSlotX; - iDesiredSlotY = m_iCurrSlotY + 1; - break; - case eTapStateLeft: - iDesiredSlotX = m_iCurrSlotX - 1; - iDesiredSlotY = m_iCurrSlotY; - break; - case eTapStateRight: - iDesiredSlotX = m_iCurrSlotX + 1; - iDesiredSlotY = m_iCurrSlotY; - break; - case eTapStateJump: - iDesiredSlotX = m_iCurrSlotX; - iDesiredSlotY = m_iCurrSlotY; - break; - default: - break; - } + switch (m_eCurrTapState) { + case eTapStateUp: + iDesiredSlotX = m_iCurrSlotX; + iDesiredSlotY = m_iCurrSlotY - 1; + break; + case eTapStateDown: + iDesiredSlotX = m_iCurrSlotX; + iDesiredSlotY = m_iCurrSlotY + 1; + break; + case eTapStateLeft: + iDesiredSlotX = m_iCurrSlotX - 1; + iDesiredSlotY = m_iCurrSlotY; + break; + case eTapStateRight: + iDesiredSlotX = m_iCurrSlotX + 1; + iDesiredSlotY = m_iCurrSlotY; + break; + case eTapStateJump: + iDesiredSlotX = m_iCurrSlotX; + iDesiredSlotY = m_iCurrSlotY; + break; + default: + break; + } - int iNumRows; - int iNumColumns; - int iNumItems = GetSectionDimensions( eSectionUnderPointer, &( iNumColumns ), &( iNumRows ) ); + int iNumRows; + int iNumColumns; + int iNumItems = GetSectionDimensions(eSectionUnderPointer, + &(iNumColumns), &(iNumRows)); + if ((m_eCurrTapState != eTapNone && + m_eCurrTapState != eTapStateNoInput) && + (!IsSectionSlotList(eSectionUnderPointer) || + ((iDesiredSlotX < 0) || (iDesiredSlotX >= iNumColumns) || + (iDesiredSlotY < 0) || (iDesiredSlotY >= iNumRows)))) { + eSectionUnderPointer = GetSectionAndSlotInDirection( + eSectionUnderPointer, m_eCurrTapState, &iDesiredSlotX, + &iDesiredSlotY); - if ( (m_eCurrTapState != eTapNone && m_eCurrTapState != eTapStateNoInput) && - ( !IsSectionSlotList(eSectionUnderPointer) || - ( ( iDesiredSlotX < 0 ) || ( iDesiredSlotX >= iNumColumns ) || ( iDesiredSlotY < 0 ) || ( iDesiredSlotY >= iNumRows ) ) - )) - { + if (!IsSectionSlotList(eSectionUnderPointer)) + bPointerIsOverSlot = false; - eSectionUnderPointer = GetSectionAndSlotInDirection( eSectionUnderPointer, m_eCurrTapState, &iDesiredSlotX, &iDesiredSlotY ); + // Get the details for the new section + iNumItems = GetSectionDimensions(eSectionUnderPointer, + &(iNumColumns), &(iNumRows)); + } - if(!IsSectionSlotList(eSectionUnderPointer)) bPointerIsOverSlot = false; + if (!IsSectionSlotList(eSectionUnderPointer) || + ((iDesiredSlotX >= 0) && (iDesiredSlotX < iNumColumns) && + (iDesiredSlotY >= 0) && (iDesiredSlotY < iNumRows))) { + // Desired slot after tap input is valid, so make the jump to + // this slot. + UIVec2D sectionPos; + GetPositionOfSection(eSectionUnderPointer, &(sectionPos)); - // Get the details for the new section - iNumItems = GetSectionDimensions( eSectionUnderPointer, &( iNumColumns ), &( iNumRows ) ); - } + iNewSlotIndex = (iDesiredSlotY * iNumColumns) + iDesiredSlotX; - if ( !IsSectionSlotList(eSectionUnderPointer) || ( ( iDesiredSlotX >= 0 ) && ( iDesiredSlotX < iNumColumns ) && ( iDesiredSlotY >= 0 ) && ( iDesiredSlotY < iNumRows ) ) ) - { - // Desired slot after tap input is valid, so make the jump to this slot. - UIVec2D sectionPos; - GetPositionOfSection( eSectionUnderPointer, &( sectionPos ) ); + UIVec2D itemPos; + UIVec2D itemSize; + GetItemScreenData(eSectionUnderPointer, iNewSlotIndex, + &(itemPos), &(itemSize)); - iNewSlotIndex = ( iDesiredSlotY * iNumColumns ) + iDesiredSlotX; + if (IsSectionSlotList(eSectionUnderPointer)) + itemPos += sectionPos; - UIVec2D itemPos; - UIVec2D itemSize; - GetItemScreenData( eSectionUnderPointer, iNewSlotIndex, &( itemPos ), &( itemSize ) ); + vSnapPos.x = itemPos.x + (itemSize.x / 2.0f); + vSnapPos.y = itemPos.y + (itemSize.y / 2.0f); - if(IsSectionSlotList(eSectionUnderPointer)) itemPos += sectionPos; + m_eCurrSection = eSectionUnderPointer; + m_iCurrSlotX = iDesiredSlotX; + m_iCurrSlotY = iDesiredSlotY; + } - vSnapPos.x = itemPos.x + ( itemSize.x / 2.0f); - vSnapPos.y = itemPos.y + ( itemSize.y / 2.0f); + m_eCurrTapState = eTapStateNoInput; - m_eCurrSection = eSectionUnderPointer; - m_iCurrSlotX = iDesiredSlotX; - m_iCurrSlotY = iDesiredSlotY; - } + // If there is no stick input, and we are over a slot, then snap + // pointer to slot centre. 4J - TomK - only if this particular + // component allows so! + if (CanHaveFocus(eSectionUnderPointer)) { + vPointerPos.x = vSnapPos.x; + vPointerPos.y = vSnapPos.y; + } + } + } - m_eCurrTapState = eTapStateNoInput; + // Clamp to pointer extents. + if (vPointerPos.x < m_fPointerMinX) + vPointerPos.x = m_fPointerMinX; + else if (vPointerPos.x > m_fPointerMaxX) + vPointerPos.x = m_fPointerMaxX; + if (vPointerPos.y < m_fPointerMinY) + vPointerPos.y = m_fPointerMinY; + else if (vPointerPos.y > m_fPointerMaxY) + vPointerPos.y = m_fPointerMaxY; - // If there is no stick input, and we are over a slot, then snap pointer to slot centre. - // 4J - TomK - only if this particular component allows so! - if(CanHaveFocus(eSectionUnderPointer)) - { - vPointerPos.x = vSnapPos.x; - vPointerPos.y = vSnapPos.y; - } - } - } + // Check if the pointer is outside of the panel. + bool bPointerIsOutsidePanel = false; + if ((vPointerPos.x < m_fPanelMinX) || (vPointerPos.x > m_fPanelMaxX) || + (vPointerPos.y < m_fPanelMinY) || (vPointerPos.y > m_fPanelMaxY)) { + bPointerIsOutsidePanel = true; + } - // Clamp to pointer extents. - if ( vPointerPos.x < m_fPointerMinX ) vPointerPos.x = m_fPointerMinX; - else if ( vPointerPos.x > m_fPointerMaxX ) vPointerPos.x = m_fPointerMaxX; - if ( vPointerPos.y < m_fPointerMinY ) vPointerPos.y = m_fPointerMinY; - else if ( vPointerPos.y > m_fPointerMaxY ) vPointerPos.y = m_fPointerMaxY; + // Determine appropriate context sensitive tool tips, based on what is + // carried on the pointer and what is under the pointer. - // Check if the pointer is outside of the panel. - bool bPointerIsOutsidePanel = false; - if ( ( vPointerPos.x < m_fPanelMinX ) || ( vPointerPos.x > m_fPanelMaxX ) || ( vPointerPos.y < m_fPanelMinY ) || ( vPointerPos.y > m_fPanelMaxY ) ) - { - bPointerIsOutsidePanel = true; - } + // What are we carrying on pointer. + std::shared_ptr player = + Minecraft::GetInstance()->localplayers[getPad()]; + std::shared_ptr carriedItem = nullptr; + if (player != NULL) carriedItem = player->inventory->getCarried(); - // Determine appropriate context sensitive tool tips, based on what is carried on the pointer and what is under the pointer. + std::shared_ptr slotItem = nullptr; + Slot* slot = NULL; + int slotIndex = 0; + if (bPointerIsOverSlot) { + slotIndex = iNewSlotIndex + getSectionStartOffset(eSectionUnderPointer); + slot = m_menu->getSlot(slotIndex); + } + bool bIsItemCarried = carriedItem != NULL; + int iCarriedCount = 0; + bool bCarriedIsSameAsSlot = false; // Indicates if same item is carried on + // pointer as is in slot under pointer. + if (bIsItemCarried) { + iCarriedCount = carriedItem->count; + } - // What are we carrying on pointer. - std::shared_ptr player = Minecraft::GetInstance()->localplayers[getPad()]; - std::shared_ptr carriedItem = nullptr; - if(player != NULL) carriedItem = player->inventory->getCarried(); + // What is in the slot that we are over. + bool bSlotHasItem = false; + bool bMayPlace = false; + bool bCanPlaceOne = false; + bool bCanPlaceAll = false; + bool bCanCombine = false; + bool bCanDye = false; + int iSlotCount = 0; + int iSlotStackSizeRemaining = + 0; // How many more items can be stacked on this slot. + if (bPointerIsOverSlot) { + slotItem = slot->getItem(); + bSlotHasItem = slotItem != NULL; + if (bSlotHasItem) { + iSlotCount = slotItem->GetCount(); - std::shared_ptr slotItem = nullptr; - Slot *slot = NULL; - int slotIndex = 0; - if(bPointerIsOverSlot) - { - slotIndex = iNewSlotIndex + getSectionStartOffset( eSectionUnderPointer ); - slot = m_menu->getSlot(slotIndex); - } - bool bIsItemCarried = carriedItem != NULL; - int iCarriedCount = 0; - bool bCarriedIsSameAsSlot = false; // Indicates if same item is carried on pointer as is in slot under pointer. - if ( bIsItemCarried ) - { - iCarriedCount = carriedItem->count; - } + if (bIsItemCarried) { + bCarriedIsSameAsSlot = IsSameItemAs(carriedItem, slotItem); + bCanCombine = m_menu->mayCombine(slot, carriedItem); + bCanDye = bCanCombine && + dynamic_cast(slot->getItem()->getItem()); - // What is in the slot that we are over. - bool bSlotHasItem = false; - bool bMayPlace = false; - bool bCanPlaceOne = false; - bool bCanPlaceAll = false; - bool bCanCombine = false; - bool bCanDye = false; - int iSlotCount = 0; - int iSlotStackSizeRemaining = 0; // How many more items can be stacked on this slot. - if ( bPointerIsOverSlot ) - { - slotItem = slot->getItem(); - bSlotHasItem = slotItem != NULL; - if ( bSlotHasItem ) - { - iSlotCount = slotItem->GetCount(); + if (bCarriedIsSameAsSlot) { + iSlotStackSizeRemaining = + GetEmptyStackSpace(m_menu->getSlot(slotIndex)); + } + } + } - if ( bIsItemCarried ) - { - bCarriedIsSameAsSlot = IsSameItemAs(carriedItem, slotItem); - bCanCombine = m_menu->mayCombine(slot,carriedItem); - bCanDye = bCanCombine && dynamic_cast(slot->getItem()->getItem()); + if (bIsItemCarried) { + bMayPlace = slot->mayPlace(carriedItem); - if ( bCarriedIsSameAsSlot ) - { - iSlotStackSizeRemaining = GetEmptyStackSpace( m_menu->getSlot(slotIndex) ); - } - } - } + if (bSlotHasItem) + iSlotStackSizeRemaining = GetEmptyStackSpace(slot); + else + iSlotStackSizeRemaining = slot->getMaxStackSize(); - if( bIsItemCarried) - { - bMayPlace = slot->mayPlace(carriedItem); + if (bMayPlace && iSlotStackSizeRemaining > 0) bCanPlaceOne = true; + if (bMayPlace && iSlotStackSizeRemaining > 1 && + carriedItem->count > 1) + bCanPlaceAll = true; + } + } - if ( bSlotHasItem ) iSlotStackSizeRemaining = GetEmptyStackSpace( slot ); - else iSlotStackSizeRemaining = slot->getMaxStackSize(); + if (bPointerIsOverSlot && bSlotHasItem) { + std::vector* desc = GetItemDescription(slot); + SetPointerText(desc, slot != m_lastPointerLabelSlot); + m_lastPointerLabelSlot = slot; + delete desc; + } else if (eSectionUnderPointer != eSectionNone && + !IsSectionSlotList(eSectionUnderPointer)) { + std::vector* desc = + GetSectionHoverText(eSectionUnderPointer); + SetPointerText(desc, false); + m_lastPointerLabelSlot = NULL; + delete desc; + } else { + SetPointerText(NULL, false); + m_lastPointerLabelSlot = NULL; + } - if(bMayPlace && iSlotStackSizeRemaining > 0) bCanPlaceOne = true; - if(bMayPlace && iSlotStackSizeRemaining > 1 && carriedItem->count > 1) bCanPlaceAll = true; - } - } + EToolTipItem buttonA, buttonX, buttonY, buttonRT, buttonBack; + buttonA = buttonX = buttonY = buttonRT = buttonBack = eToolTipNone; + if (bPointerIsOverSlot) { + SetPointerOutsideMenu(false); + if (bIsItemCarried) { + if (bSlotHasItem) { + // Item in hand and item in slot ... is item in slot the same as + // in out hand? If so, can we stack on to it? + if (bCarriedIsSameAsSlot) { + // Can we stack more into this slot? + if (iSlotStackSizeRemaining == 0) { + // Cannot stack any more. + buttonRT = eToolTipWhatIsThis; + } else if (iSlotStackSizeRemaining == 1) { + // Can only put 1 more on the stack. + buttonA = eToolTipPlaceGeneric; + buttonRT = eToolTipWhatIsThis; + } else // can put 1 or all. + { + if (bCanPlaceAll) { + // Multiple items in hand. + buttonA = eToolTipPlaceAll; + buttonX = eToolTipPlaceOne; + } else if (bCanPlaceOne) { + if (iCarriedCount > 1) + buttonA = eToolTipPlaceOne; + else + buttonA = eToolTipPlaceGeneric; + } + buttonRT = eToolTipWhatIsThis; + } + } else // items are different, click here will swap them. + { + if (bMayPlace) buttonA = eToolTipSwap; + buttonRT = eToolTipWhatIsThis; + } + if (bCanDye) { + buttonX = eToolTipDye; + } else if (bCanCombine) { + buttonX = eToolTipRepair; + } + } else // slot empty. + { + // Item in hand, slot is empty. + if (iCarriedCount == 1) { + // Only one item in hand. + buttonA = eToolTipPlaceGeneric; + } else { + if (bCanPlaceAll) { + // Multiple items in hand. + buttonA = eToolTipPlaceAll; + buttonX = eToolTipPlaceOne; + } else if (bCanPlaceOne) { + buttonA = eToolTipPlaceOne; + } + } + } + } else // no object in hand + { + if (bSlotHasItem) { + if (iSlotCount == 1) { + buttonA = eToolTipPickUpGeneric; + } else { + // Multiple items in slot. + buttonA = eToolTipPickUpAll; + buttonX = eToolTipPickUpHalf; + } - if( bPointerIsOverSlot && bSlotHasItem ) - { - std::vector unformattedStrings; - std::wstring desc = GetItemDescription( slot, unformattedStrings ); - SetPointerText(desc, unformattedStrings, slot != m_lastPointerLabelSlot); - m_lastPointerLabelSlot = slot; - } - else - { - std::vector unformattedStrings; - SetPointerText(L"", unformattedStrings, false); - m_lastPointerLabelSlot = NULL; - } +#ifdef __PSVITA__ + if (!InputManager.IsVitaTV()) { + buttonBack = eToolTipWhatIsThis; + } else +#endif + { + buttonRT = eToolTipWhatIsThis; + } + } else { + // Nothing in slot and nothing in hand. + } + } - EToolTipItem buttonA, buttonX, buttonY, buttonRT; - buttonA = buttonX = buttonY = buttonRT = eToolTipNone; - if ( bPointerIsOverSlot ) - { - SetPointerOutsideMenu( false ); - if ( bIsItemCarried ) - { - if ( bSlotHasItem ) - { - // Item in hand and item in slot ... is item in slot the same as in out hand? If so, can we stack on to it? - if ( bCarriedIsSameAsSlot ) - { - // Can we stack more into this slot? - if ( iSlotStackSizeRemaining == 0 ) - { - // Cannot stack any more. - buttonRT = eToolTipWhatIsThis; - } - else if ( iSlotStackSizeRemaining == 1 ) - { - // Can only put 1 more on the stack. - buttonA = eToolTipPlaceGeneric; - buttonRT = eToolTipWhatIsThis; - } - else // can put 1 or all. - { - if(bCanPlaceAll) - { - // Multiple items in hand. - buttonA = eToolTipPlaceAll; - buttonX = eToolTipPlaceOne; - } - else if(bCanPlaceOne) - { - if(iCarriedCount > 1) buttonA = eToolTipPlaceOne; - else buttonA = eToolTipPlaceGeneric; - } - buttonRT = eToolTipWhatIsThis; - } - } - else // items are different, click here will swap them. - { + if (bSlotHasItem) { + // Item in slot - if(bMayPlace) buttonA = eToolTipSwap; - buttonRT = eToolTipWhatIsThis; - } - if(bCanDye) - { - buttonX = eToolTipDye; - } - else if(bCanCombine) - { - buttonX = eToolTipRepair; - } - } - else // slot empty. - { - // Item in hand, slot is empty. - if ( iCarriedCount == 1 ) - { - // Only one item in hand. - buttonA = eToolTipPlaceGeneric; - } - else - { - if(bCanPlaceAll) - { - // Multiple items in hand. - buttonA = eToolTipPlaceAll; - buttonX = eToolTipPlaceOne; - } - else if(bCanPlaceOne) - { - buttonA = eToolTipPlaceOne; - } - } - } - } - else // no object in hand - { - if ( bSlotHasItem ) - { - if ( iSlotCount == 1 ) - { - buttonA = eToolTipPickUpGeneric; - buttonRT = eToolTipWhatIsThis; - } - else - { - // Multiple items in slot. - buttonA = eToolTipPickUpAll; - buttonX = eToolTipPickUpHalf; - buttonRT = eToolTipWhatIsThis; - } - } - else - { - // Nothing in slot and nothing in hand. - } - } + // 4J-PB - show tooltips for quick use of armour - if ( bSlotHasItem ) - { - // Item in slot + if ((eSectionUnderPointer == eSectionInventoryUsing) || + (eSectionUnderPointer == eSectionInventoryInventory)) { + std::shared_ptr item = + getSlotItem(eSectionUnderPointer, iNewSlotIndex); + ArmorRecipes::_eArmorType eArmourType = + ArmorRecipes::GetArmorType(item->id); - // 4J-PB - show tooltips for quick use of armour + if (eArmourType == ArmorRecipes::eArmorType_None) { + buttonY = eToolTipQuickMove; + } else { + // check that the slot required is empty + switch (eArmourType) { + case ArmorRecipes::eArmorType_Helmet: + if (isSlotEmpty(eSectionInventoryArmor, 0)) { + buttonY = eToolTipEquip; + } else { + buttonY = eToolTipQuickMove; + } + break; + case ArmorRecipes::eArmorType_Chestplate: + if (isSlotEmpty(eSectionInventoryArmor, 1)) { + buttonY = eToolTipEquip; + } else { + buttonY = eToolTipQuickMove; + } + break; + case ArmorRecipes::eArmorType_Leggings: + if (isSlotEmpty(eSectionInventoryArmor, 2)) { + buttonY = eToolTipEquip; + } else { + buttonY = eToolTipQuickMove; + } + break; + case ArmorRecipes::eArmorType_Boots: + if (isSlotEmpty(eSectionInventoryArmor, 3)) { + buttonY = eToolTipEquip; + } else { + buttonY = eToolTipQuickMove; + } + break; + default: + buttonY = eToolTipQuickMove; + break; + } + } + } + // 4J-PB - show tooltips for quick use of fuel or ingredient + else if ((eSectionUnderPointer == eSectionFurnaceUsing) || + (eSectionUnderPointer == eSectionFurnaceInventory)) { + // Get the info on this item. + std::shared_ptr item = + getSlotItem(eSectionUnderPointer, iNewSlotIndex); + bool bValidFuel = FurnaceTileEntity::isFuel(item); + bool bValidIngredient = + FurnaceRecipes::getInstance()->getResult( + item->getItem()->id) != NULL; - if((eSectionUnderPointer==eSectionInventoryUsing)||(eSectionUnderPointer==eSectionInventoryInventory)) - { - std::shared_ptr item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); - ArmorRecipes::_eArmorType eArmourType=ArmorRecipes::GetArmorType(item->id); + if (bValidIngredient) { + // is there already something in the ingredient slot? + if (!isSlotEmpty(eSectionFurnaceIngredient, 0)) { + // is it the same as this item + std::shared_ptr IngredientItem = + getSlotItem(eSectionFurnaceIngredient, 0); + if (IngredientItem->id == item->id) { + buttonY = eToolTipQuickMoveIngredient; + } else { + if (FurnaceRecipes::getInstance()->getResult( + item->id) == NULL) { + buttonY = eToolTipQuickMove; + } else { + buttonY = eToolTipQuickMoveIngredient; + } + } + } else { + // ingredient slot empty + buttonY = eToolTipQuickMoveIngredient; + } + } else if (bValidFuel) { + // Is there already something in the fuel slot? + if (!isSlotEmpty(eSectionFurnaceFuel, 0)) { + // is it the same as this item + std::shared_ptr fuelItem = + getSlotItem(eSectionFurnaceFuel, 0); + if (fuelItem->id == item->id) { + buttonY = eToolTipQuickMoveFuel; + } else if (bValidIngredient) { + // check if the ingredient slot is empty, or the + // same as this + if (!isSlotEmpty(eSectionFurnaceIngredient, 0)) { + // is it the same as this item + std::shared_ptr IngredientItem = + getSlotItem(eSectionFurnaceIngredient, 0); + if (IngredientItem->id == item->id) { + buttonY = eToolTipQuickMoveIngredient; + } else { + if (FurnaceRecipes::getInstance() + ->getResult(item->id) == NULL) { + buttonY = eToolTipQuickMove; + } else { + buttonY = eToolTipQuickMoveIngredient; + } + } + } else { + // ingredient slot empty + buttonY = eToolTipQuickMoveIngredient; + } + } else { + buttonY = eToolTipQuickMove; + } + } else { + buttonY = eToolTipQuickMoveFuel; + } + } else { + buttonY = eToolTipQuickMove; + } + } + // 4J-PB - show tooltips for quick use of ingredients in brewing + else if ((eSectionUnderPointer == eSectionBrewingUsing) || + (eSectionUnderPointer == eSectionBrewingInventory)) { + // Get the info on this item. + std::shared_ptr item = + getSlotItem(eSectionUnderPointer, iNewSlotIndex); + int iId = item->id; - if(eArmourType==ArmorRecipes::eArmorType_None) - { - buttonY = eToolTipQuickMove; - } - else - { - // check that the slot required is empty - switch(eArmourType) - { - case ArmorRecipes::eArmorType_Helmet: - if(isSlotEmpty(eSectionInventoryArmor,0)) - { - buttonY = eToolTipEquip; - } - else - { - buttonY = eToolTipQuickMove; - } - break; - case ArmorRecipes::eArmorType_Chestplate: - if(isSlotEmpty(eSectionInventoryArmor,1)) - { - buttonY = eToolTipEquip; - } - else - { - buttonY = eToolTipQuickMove; - } - break; - case ArmorRecipes::eArmorType_Leggings: - if(isSlotEmpty(eSectionInventoryArmor,2)) - { - buttonY = eToolTipEquip; - } - else - { - buttonY = eToolTipQuickMove; - } - break; - case ArmorRecipes::eArmorType_Boots: - if(isSlotEmpty(eSectionInventoryArmor,3)) - { - buttonY = eToolTipEquip; - } - else - { - buttonY = eToolTipQuickMove; - } - break; - default: - buttonY = eToolTipQuickMove; - break; - } + // valid ingredient? + bool bValidIngredient = false; + // bool bValidIngredientBottom=false; - } - } - // 4J-PB - show tooltips for quick use of fuel or ingredient - else if((eSectionUnderPointer==eSectionFurnaceUsing)||(eSectionUnderPointer==eSectionFurnaceInventory)) - { - // Get the info on this item. - std::shared_ptr item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); - bool bValidFuel = FurnaceTileEntity::isFuel(item); - bool bValidIngredient = FurnaceRecipes::getInstance()->getResult(item->getItem()->id) != NULL; + if (Item::items[iId]->hasPotionBrewingFormula() || + (iId == Item::netherwart_seeds_Id)) { + bValidIngredient = true; + } - if(bValidIngredient) - { - // is there already something in the ingredient slot? - if(!isSlotEmpty(eSectionFurnaceIngredient,0)) - { - // is it the same as this item - std::shared_ptr IngredientItem = getSlotItem(eSectionFurnaceIngredient,0); - if(IngredientItem->id == item->id) - { - buttonY = eToolTipQuickMoveIngredient; - } - else - { - if(FurnaceRecipes::getInstance()->getResult(item->id)==NULL) - { - buttonY = eToolTipQuickMove; - } - else - { - buttonY = eToolTipQuickMoveIngredient; - } - } - } - else - { - // ingredient slot empty - buttonY = eToolTipQuickMoveIngredient; - } - } - else if(bValidFuel) - { - // Is there already something in the fuel slot? - if(!isSlotEmpty(eSectionFurnaceFuel,0)) - { - // is it the same as this item - std::shared_ptr fuelItem = getSlotItem(eSectionFurnaceFuel,0); - if(fuelItem->id == item->id) - { - buttonY = eToolTipQuickMoveFuel; - } - else if(bValidIngredient) - { - // check if the ingredient slot is empty, or the same as this - if(!isSlotEmpty(eSectionFurnaceIngredient,0)) - { - // is it the same as this item - std::shared_ptr IngredientItem = getSlotItem(eSectionFurnaceIngredient,0); - if(IngredientItem->id == item->id) - { - buttonY = eToolTipQuickMoveIngredient; - } - else - { - if(FurnaceRecipes::getInstance()->getResult(item->id)==NULL) - { - buttonY = eToolTipQuickMove; - } - else - { - buttonY = eToolTipQuickMoveIngredient; - } - } - } - else - { - // ingredient slot empty - buttonY = eToolTipQuickMoveIngredient; - } - } - else - { - buttonY = eToolTipQuickMove; - } - } - else - { - buttonY = eToolTipQuickMoveFuel; - } - } - else - { - buttonY = eToolTipQuickMove; - } - } - // 4J-PB - show tooltips for quick use of ingredients in brewing - else if((eSectionUnderPointer==eSectionBrewingUsing)||(eSectionUnderPointer==eSectionBrewingInventory)) - { - // Get the info on this item. - std::shared_ptr item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); - int iId=item->id; + if (bValidIngredient) { + // is there already something in the ingredient slot? + if (!isSlotEmpty(eSectionBrewingIngredient, 0)) { + // is it the same as this item + std::shared_ptr IngredientItem = + getSlotItem(eSectionBrewingIngredient, 0); + if (IngredientItem->id == item->id) { + buttonY = eToolTipQuickMoveIngredient; + } else { + buttonY = eToolTipQuickMove; + } + } else { + // ingredient slot empty + buttonY = eToolTipQuickMoveIngredient; + } + } else { + // valid potion? Glass bottle with water in it is a 'potion' + // too. + if (iId == Item::potion_Id) { + // space available? + if (isSlotEmpty(eSectionBrewingBottle1, 0) || + isSlotEmpty(eSectionBrewingBottle2, 0) || + isSlotEmpty(eSectionBrewingBottle3, 0)) { + buttonY = eToolTipQuickMoveIngredient; + } else { + buttonY = eToolTipNone; + } + } else { + buttonY = eToolTipQuickMove; + } + } + } else if ((eSectionUnderPointer == eSectionEnchantUsing) || + (eSectionUnderPointer == eSectionEnchantInventory)) { + // Get the info on this item. + std::shared_ptr item = + getSlotItem(eSectionUnderPointer, iNewSlotIndex); + int iId = item->id; - // valid ingredient? - bool bValidIngredient=false; - //bool bValidIngredientBottom=false; + // valid enchantable tool? + if (Item::items[iId]->isEnchantable(item)) { + // is there already something in the ingredient slot? + if (isSlotEmpty(eSectionEnchantSlot, 0)) { + // tool slot empty + switch (iId) { + case Item::bow_Id: + case Item::sword_wood_Id: + case Item::sword_stone_Id: + case Item::sword_iron_Id: + case Item::sword_diamond_Id: + buttonY = eToolTipQuickMoveWeapon; + break; - if(Item::items[iId]->hasPotionBrewingFormula() || (iId == Item::netherStalkSeeds_Id)) - { - bValidIngredient=true; - } + case Item::helmet_leather_Id: + case Item::chestplate_leather_Id: + case Item::leggings_leather_Id: + case Item::boots_leather_Id: - if(bValidIngredient) - { - // is there already something in the ingredient slot? - if(!isSlotEmpty(eSectionBrewingIngredient,0)) - { - // is it the same as this item - std::shared_ptr IngredientItem = getSlotItem(eSectionBrewingIngredient,0); - if(IngredientItem->id == item->id) - { - buttonY = eToolTipQuickMoveIngredient; - } - else - { - buttonY=eToolTipQuickMove; - } - } - else - { - // ingredient slot empty - buttonY = eToolTipQuickMoveIngredient; - } - } - else - { - // valid potion? Glass bottle with water in it is a 'potion' too. - if(iId==Item::potion_Id) - { - // space available? - if(isSlotEmpty(eSectionBrewingBottle1,0) || - isSlotEmpty(eSectionBrewingBottle2,0) || - isSlotEmpty(eSectionBrewingBottle3,0)) - { - buttonY = eToolTipQuickMoveIngredient; - } - else - { - buttonY=eToolTipNone; - } - } - else - { - buttonY=eToolTipQuickMove; - } - } - } - else if((eSectionUnderPointer==eSectionEnchantUsing)||(eSectionUnderPointer==eSectionEnchantInventory)) - { - // Get the info on this item. - std::shared_ptr item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); - int iId=item->id; + case Item::helmet_chain_Id: + case Item::chestplate_chain_Id: + case Item::leggings_chain_Id: + case Item::boots_chain_Id: - // valid enchantable tool? - if(Item::items[iId]->isEnchantable(item)) - { - // is there already something in the ingredient slot? - if(isSlotEmpty(eSectionEnchantSlot,0)) - { - // tool slot empty - switch(iId) - { - case Item::bow_Id: - case Item::sword_wood_Id: - case Item::sword_stone_Id: - case Item::sword_iron_Id: - case Item::sword_diamond_Id: - buttonY=eToolTipQuickMoveWeapon; - break; + case Item::helmet_iron_Id: + case Item::chestplate_iron_Id: + case Item::leggings_iron_Id: + case Item::boots_iron_Id: - case Item::helmet_cloth_Id: - case Item::chestplate_cloth_Id: - case Item::leggings_cloth_Id: - case Item::boots_cloth_Id: + case Item::helmet_diamond_Id: + case Item::chestplate_diamond_Id: + case Item::leggings_diamond_Id: + case Item::boots_diamond_Id: - case Item::helmet_chain_Id: - case Item::chestplate_chain_Id: - case Item::leggings_chain_Id: - case Item::boots_chain_Id: + case Item::helmet_gold_Id: + case Item::chestplate_gold_Id: + case Item::leggings_gold_Id: + case Item::boots_gold_Id: + buttonY = eToolTipQuickMoveArmor; - case Item::helmet_iron_Id: - case Item::chestplate_iron_Id: - case Item::leggings_iron_Id: - case Item::boots_iron_Id: + break; + case Item::book_Id: + buttonY = eToolTipQuickMove; + break; + default: + buttonY = eToolTipQuickMoveTool; + break; + } + } else { + buttonY = eToolTipQuickMove; + } + } else { + buttonY = eToolTipQuickMove; + } + } else { + buttonY = eToolTipQuickMove; + } + } + } - case Item::helmet_diamond_Id: - case Item::chestplate_diamond_Id: - case Item::leggings_diamond_Id: - case Item::boots_diamond_Id: + if (bPointerIsOutsidePanel) { + SetPointerOutsideMenu(true); + // Outside window, we dropping items. + if (bIsItemCarried) { + // int iCount = m_pointerControl->GetObjectCount( + // m_pointerControl->m_hObj ); + if (iCarriedCount > 1) { + buttonA = eToolTipDropAll; + buttonX = eToolTipDropOne; + } else { + buttonA = eToolTipDropGeneric; + } + } + } else // pointer is just over dead space ... can't really do anything. + { + SetPointerOutsideMenu(false); + } - case Item::helmet_gold_Id: - case Item::chestplate_gold_Id: - case Item::leggings_gold_Id: - case Item::boots_gold_Id: - buttonY=eToolTipQuickMoveArmor; + std::shared_ptr item = nullptr; + if (bPointerIsOverSlot && bSlotHasItem) + item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); + overrideTooltips(eSectionUnderPointer, item, bIsItemCarried, bSlotHasItem, + bCarriedIsSameAsSlot, iSlotStackSizeRemaining, buttonA, + buttonX, buttonY, buttonRT, buttonBack); - break; - case Item::book_Id: - buttonY = eToolTipQuickMove; - break; - default: - buttonY=eToolTipQuickMoveTool; - break; - } - } - else - { - buttonY = eToolTipQuickMove; - } - } - else - { - buttonY=eToolTipQuickMove; - } - } - else - { - buttonY = eToolTipQuickMove; - } - } - } + SetToolTip(eToolTipButtonA, buttonA); + SetToolTip(eToolTipButtonX, buttonX); + SetToolTip(eToolTipButtonY, buttonY); + SetToolTip(eToolTipButtonRT, buttonRT); + SetToolTip(eToolTipButtonBack, buttonBack); - if ( bPointerIsOutsidePanel ) - { - SetPointerOutsideMenu( true ); - // Outside window, we dropping items. - if ( bIsItemCarried ) - { - //int iCount = m_pointerControl->GetObjectCount( m_pointerControl->m_hObj ); - if ( iCarriedCount > 1 ) - { - buttonA = eToolTipDropAll; - buttonX = eToolTipDropOne; - } - else - { - buttonA = eToolTipDropGeneric; - } - } - } - else // pointer is just over dead space ... can't really do anything. - { - SetPointerOutsideMenu( false ); - } + // Offset back to image top left. + vPointerPos.x -= m_fPointerImageOffsetX; + vPointerPos.y -= m_fPointerImageOffsetY; - std::shared_ptr item = nullptr; - if(bPointerIsOverSlot && bSlotHasItem) item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); - overrideTooltips(eSectionUnderPointer, item, bIsItemCarried, bSlotHasItem, bCarriedIsSameAsSlot, iSlotStackSizeRemaining, buttonA, buttonX, buttonY, buttonRT); + // Update pointer position. + // 4J-PB - do not allow sub pixel positions or we get broken lines in box + // edges - SetToolTip( eToolTipButtonA, buttonA ); - SetToolTip( eToolTipButtonX, buttonX ); - SetToolTip( eToolTipButtonY, buttonY ); - SetToolTip( eToolTipButtonRT, buttonRT ); + // problem here when sensitivity is low - we'll be moving a sub pixel size, + // so it'll clamp, and we'll never move. In that case, move 1 pixel + if (fInputDirX != 0.0f) { + if (fInputDirX == 1.0f) { + vPointerPos.x += 0.999999f; + } else { + vPointerPos.x -= 0.999999f; + } + } + if (fInputDirY != 0.0f) { + if (fInputDirY == 1.0f) { + vPointerPos.y += 0.999999f; + } else { + vPointerPos.y -= 0.999999f; + } + } - // Offset back to image top left. - vPointerPos.x -= m_fPointerImageOffsetX; - vPointerPos.y -= m_fPointerImageOffsetY; + vPointerPos.x = floor(vPointerPos.x); + vPointerPos.x += ((int)vPointerPos.x % 2); + vPointerPos.y = floor(vPointerPos.y); + vPointerPos.y += ((int)vPointerPos.y % 2); + m_pointerPos = vPointerPos; - // Update pointer position. - // 4J-PB - do not allow sub pixel positions or we get broken lines in box edges - - // problem here when sensitivity is low - we'll be moving a sub pixel size, so it'll clamp, and we'll never move. In that case, move 1 pixel - if(fInputDirX!=0.0f) - { - if(fInputDirX==1.0f) - { - vPointerPos.x+=0.999999f; - } - else - { - vPointerPos.x-=0.999999f; - } - } - - if(fInputDirY!=0.0f) - { - if(fInputDirY==1.0f) - { - vPointerPos.y+=0.999999f; - } - else - { - vPointerPos.y-=0.999999f; - } - } - - vPointerPos.x = floor(vPointerPos.x); - vPointerPos.x += ( (int)vPointerPos.x%2); - vPointerPos.y = floor(vPointerPos.y); - vPointerPos.y += ( (int)vPointerPos.y%2); - m_pointerPos = vPointerPos; - - adjustPointerForSafeZone(); + adjustPointerForSafeZone(); } -bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) -{ - bool bHandled = false; +bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, + bool bRepeat) { + bool bHandled = false; - Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[getPad()] != NULL ) - { - Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial(); - if(tutorial != NULL) - { - tutorial->handleUIInput(iAction); - if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(iAction)) - { - return S_OK; - } - } - } + Minecraft* pMinecraft = Minecraft::GetInstance(); + if (pMinecraft->localgameModes[getPad()] != NULL) { + Tutorial* tutorial = + pMinecraft->localgameModes[getPad()]->getTutorial(); + if (tutorial != NULL) { + tutorial->handleUIInput(iAction); + if (ui.IsTutorialVisible(getPad()) && + !tutorial->isInputAllowed(iAction)) { + return S_OK; + } + } + } #ifdef _XBOX - ui.AnimateKeyPress(iPad, iAction); + ui.AnimateKeyPress(iPad, iAction); #else - ui.AnimateKeyPress(iPad, iAction, bRepeat, true, false); + ui.AnimateKeyPress(iPad, iAction, bRepeat, true, false); #endif - int buttonNum=0; // 0 = LeftMouse, 1 = RightMouse - bool quickKeyHeld = false; // Represents shift key on PC + int buttonNum = 0; // 0 = LeftMouse, 1 = RightMouse + BOOL quickKeyHeld = FALSE; // Represents shift key on PC - bool validKeyPress = false; - //BOOL itemEditorKeyPress = FALSE; + BOOL validKeyPress = FALSE; + bool itemEditorKeyPress = false; - // Ignore input from other players - //if(pMinecraft->player->GetXboxPad()!=pInputData->UserIndex) return S_OK; + // Ignore input from other players + // if(pMinecraft->player->GetXboxPad()!=pInputData->UserIndex) return S_OK; - switch(iAction) - { + switch (iAction) { #ifdef _DEBUG_MENUS_ENABLED -#if TO_BE_IMPLEMENTED - case VK_PAD_RTHUMB_PRESS: - itemEditorKeyPress = TRUE; - break; + case ACTION_MENU_OTHER_STICK_PRESS: + itemEditorKeyPress = TRUE; + break; #endif -#endif - case ACTION_MENU_A: + case ACTION_MENU_A: #ifdef __ORBIS__ - case ACTION_MENU_TOUCHPAD_PRESS: + case ACTION_MENU_TOUCHPAD_PRESS: #endif - if(!bRepeat) - { - validKeyPress = true; + if (!bRepeat) { + validKeyPress = true; - // Standard left click - buttonNum = 0; - quickKeyHeld = false; - ui.PlayUISFX(eSFX_Press); - } - break; - case ACTION_MENU_X: - if(!bRepeat) - { - validKeyPress = true; + // Standard left click + buttonNum = 0; + quickKeyHeld = false; + ui.PlayUISFX(eSFX_Press); + } + break; + case ACTION_MENU_X: + if (!bRepeat) { + validKeyPress = true; - // Standard right click - buttonNum = 1; - quickKeyHeld = false; - ui.PlayUISFX(eSFX_Press); - } - break; - case ACTION_MENU_Y: - if(!bRepeat) - { - //bool bIsItemCarried = !m_pointerControl->isEmpty( m_pointerControl->m_hObj ); + // Standard right click + buttonNum = 1; + quickKeyHeld = false; + ui.PlayUISFX(eSFX_Press); + } + break; + case ACTION_MENU_Y: + if (!bRepeat) { + // bool bIsItemCarried = !m_pointerControl->isEmpty( + // m_pointerControl->m_hObj ); - // 4J Stu - TU8: Remove this fix, and fix the tooltip display instead as customers liked the feature + // 4J Stu - TU8: Remove this fix, and fix the tooltip display + // instead as customers liked the feature - // Fix for #58583 - TU6: Content: UI: The Quick Move button prompt disappears even though it still works - // No quick move tooltip is shown if something is carried, so disable the action as well - //if(!bIsItemCarried) - { - validKeyPress = true; + // Fix for #58583 - TU6: Content: UI: The Quick Move button + // prompt disappears even though it still works No quick move + // tooltip is shown if something is carried, so disable the + // action as well + // if(!bIsItemCarried) + { + validKeyPress = true; - // Shift and left click - buttonNum = 0; - quickKeyHeld = true; - ui.PlayUISFX(eSFX_Press); - } - } - break; - // 4J Stu - Also enable start to exit the scene. This key is also not constrained by the tutorials. - case ACTION_MENU_PAUSEMENU: - case ACTION_MENU_B: - { + // Shift and left click + buttonNum = 0; + quickKeyHeld = true; + ui.PlayUISFX(eSFX_Press); + } + } + break; + // 4J Stu - Also enable start to exit the scene. This key is also + // not constrained by the tutorials. + case ACTION_MENU_PAUSEMENU: + case ACTION_MENU_B: { + ui.SetTooltips(iPad, -1); - ui.SetTooltips(iPad, -1); + // 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host + // crashed after being killed by the client while accessing a chest + // during burst packet loss. We need to make sure that we call + // closeContainer() anytime this menu is closed, even if it is + // forced to close by some other reason (like the player dying) + // Therefore I have moved this call to the OnDestroy() method to + // make sure that it always happens. + // Minecraft::GetInstance()->localplayers[pInputData->UserIndex]->closeContainer(); - // 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss. - // We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying) - // Therefore I have moved this call to the OnDestroy() method to make sure that it always happens. - //Minecraft::GetInstance()->localplayers[pInputData->UserIndex]->closeContainer(); + // Return to the game. We should really callback to the app here as + // well to let it know that we have closed the ui incase we need to + // do things when that happens - // Return to the game. We should really callback to the app here as well - // to let it know that we have closed the ui incase we need to do things when that happens + if (m_bNavigateBack) { + ui.NavigateBack(iPad); + } else { + ui.CloseUIScenes(iPad); + } - if(m_bNavigateBack) - { - ui.NavigateBack(iPad); - } - else - { - ui.CloseUIScenes(iPad); - } + bHandled = true; + return S_OK; + } break; + case ACTION_MENU_LEFT: { + // ui.PlayUISFX(eSFX_Focus); + m_eCurrTapState = eTapStateLeft; + } break; + case ACTION_MENU_RIGHT: { + // ui.PlayUISFX(eSFX_Focus); + m_eCurrTapState = eTapStateRight; + } break; + case ACTION_MENU_UP: { + // ui.PlayUISFX(eSFX_Focus); + m_eCurrTapState = eTapStateUp; + } break; + case ACTION_MENU_DOWN: { + // ui.PlayUISFX(eSFX_Focus); + m_eCurrTapState = eTapStateDown; + } break; + case ACTION_MENU_PAGEUP: { + // 4J Stu - Do nothing except stop this being passed anywhere else + bHandled = true; + } break; + case ACTION_MENU_PAGEDOWN: { + if (IsSectionSlotList(m_eCurrSection)) { + int currentIndex = getCurrentIndex(m_eCurrSection) - + getSectionStartOffset(m_eCurrSection); - bHandled = true; - return S_OK; - } - break; - case ACTION_MENU_LEFT: - { - //ui.PlayUISFX(eSFX_Focus); - m_eCurrTapState = eTapStateLeft; - } - break; - case ACTION_MENU_RIGHT: - { - //ui.PlayUISFX(eSFX_Focus); - m_eCurrTapState = eTapStateRight; - } - break; - case ACTION_MENU_UP: - { - //ui.PlayUISFX(eSFX_Focus); - m_eCurrTapState = eTapStateUp; - } - break; - case ACTION_MENU_DOWN: - { - //ui.PlayUISFX(eSFX_Focus); - m_eCurrTapState = eTapStateDown; - } - break; - case ACTION_MENU_PAGEUP: - { - // 4J Stu - Do nothing except stop this being passed anywhere else - bHandled = true; - } - break; -#ifdef __PSVITA__ - //CD - Vita uses select for What's this - key 40 - case MINECRAFT_ACTION_GAME_INFO: -#else - case ACTION_MENU_PAGEDOWN: -#endif + bool bSlotHasItem = !isSlotEmpty(m_eCurrSection, currentIndex); + if (bSlotHasItem) { + std::shared_ptr item = + getSlotItem(m_eCurrSection, currentIndex); + if (Minecraft::GetInstance()->localgameModes[iPad] != + NULL) { + Tutorial::PopupMessageDetails* message = + new Tutorial::PopupMessageDetails; + message->m_messageId = item->getUseDescriptionId(); - { - if( IsSectionSlotList( m_eCurrSection ) ) - { - int currentIndex = getCurrentIndex( m_eCurrSection ) - getSectionStartOffset(m_eCurrSection); + if (Item::items[item->id] != NULL) + message->m_titleString = + Item::items[item->id]->getHoverName(item); + message->m_titleId = item->getDescriptionId(); - bool bSlotHasItem = !isSlotEmpty(m_eCurrSection, currentIndex); - if ( bSlotHasItem ) - { - std::shared_ptr item = getSlotItem(m_eCurrSection, currentIndex); - if( Minecraft::GetInstance()->localgameModes[iPad] != NULL ) - { - Tutorial::PopupMessageDetails *message = new Tutorial::PopupMessageDetails; - message->m_messageId = item->getUseDescriptionId(); + message->m_icon = item->id; + message->m_iAuxVal = item->getAuxValue(); + message->m_forceDisplay = true; - if(Item::items[item->id] != NULL) message->m_titleString = Item::items[item->id]->getHoverName(item); - message->m_titleId = item->getDescriptionId(); + TutorialMode* gameMode = + (TutorialMode*)Minecraft::GetInstance() + ->localgameModes[iPad]; + gameMode->getTutorial()->setMessage(NULL, message); + ui.PlayUISFX(eSFX_Press); + } + } + } + bHandled = true; + } break; + }; - message->m_icon = item->id; - message->m_iAuxVal = item->getAuxValue(); - message->m_forceDisplay = true; + if (validKeyPress) { + if (handleValidKeyPress(iPad, buttonNum, quickKeyHeld)) { + // Used to allow overriding certain keypresses, so do nothing here + } else { + if (IsSectionSlotList(m_eCurrSection)) { + handleSlotListClicked(m_eCurrSection, buttonNum, quickKeyHeld); + } else { + // TODO Clicked something else, like for example the craft + // result. Do something here - TutorialMode *gameMode = (TutorialMode *)Minecraft::GetInstance()->localgameModes[iPad]; - gameMode->getTutorial()->setMessage(NULL, message); - ui.PlayUISFX(eSFX_Press); - } - } - } - bHandled = true; - } - break; - }; - - if(validKeyPress) - { - if(handleValidKeyPress(iPad,buttonNum,quickKeyHeld)) - { - // Used to allow overriding certain keypresses, so do nothing here - } - else - { - if( IsSectionSlotList( m_eCurrSection ) ) - { - handleSlotListClicked(m_eCurrSection,buttonNum,quickKeyHeld); - } - else - { - // TODO Clicked something else, like for example the craft result. Do something here - - // 4J WESTY : For pointer system we can legally drop items outside of the window panel here, or may press button while - // pointer is over empty panel space. - if ( m_bPointerOutsideMenu ) - { - handleOutsideClicked(iPad, buttonNum, quickKeyHeld); - } - else // - { - // over empty space or something else??? - handleOtherClicked(iPad,m_eCurrSection,buttonNum,quickKeyHeld?true:false); - //assert( FALSE ); - } - } - } - bHandled = true; - } + // 4J WESTY : For pointer system we can legally drop items + // outside of the window panel here, or may press button while + // pointer is over empty panel space. + if (m_bPointerOutsideMenu) { + handleOutsideClicked(iPad, buttonNum, quickKeyHeld); + } else // + { + // over empty space or something else??? + handleOtherClicked(iPad, m_eCurrSection, buttonNum, + quickKeyHeld ? true : false); + // assert( FALSE ); + } + } + } + bHandled = true; + } #ifdef _DEBUG_MENUS_ENABLED -#if TO_BE_IMPLEMENTED - else if(itemEditorKeyPress == TRUE) - { - HXUIOBJ hFocusObject = GetFocus(pInputData->UserIndex); - HXUIOBJ hFocusObjectParent; - XuiElementGetParent( hFocusObject, &hFocusObjectParent ); + else if (itemEditorKeyPress == TRUE) { + if (IsSectionSlotList(m_eCurrSection)) { + ItemEditorInput* initData = new ItemEditorInput(); + initData->iPad = getPad(); + initData->slot = + getSlot(m_eCurrSection, getCurrentIndex(m_eCurrSection)); + initData->menu = m_menu; - HXUICLASS hClassCXuiCtrlSlotList; - - // TODO Define values for these - hClassCXuiCtrlSlotList = XuiFindClass( L"CXuiCtrlSlotList" ); - - // If the press comes from a SlotList, cast it up then send a clicked call to it's menu - if( XuiIsInstanceOf( hFocusObjectParent, hClassCXuiCtrlSlotList ) ) - { - CXuiCtrlSlotList* slotList; - void *pObj; - XuiObjectFromHandle( hFocusObjectParent, &pObj ); - slotList = (CXuiCtrlSlotList *)pObj; - - int currentIndex = slotList->GetCurSel(); - - CXuiCtrlSlotItemListItem* pCXuiCtrlSlotItem; - slotList->GetCXuiCtrlSlotItem( currentIndex, &( pCXuiCtrlSlotItem ) ); - - //Minecraft *pMinecraft = Minecraft::GetInstance(); - - CScene_DebugItemEditor::ItemEditorInput *initData = new CScene_DebugItemEditor::ItemEditorInput(); - initData->iPad = m_iPad; - initData->slot = pCXuiCtrlSlotItem->getSlot( pCXuiCtrlSlotItem->m_hObj ); - initData->menu = m_menu; - - // Add timer to poll controller stick input at 60Hz - HRESULT timerResult = KillTimer( POINTER_INPUT_TIMER_ID ); - assert( timerResult == S_OK ); - - app.NavigateToScene(m_iPad,eUIScene_DebugItemEditor,(void *)initData,false,TRUE); - } - } + ui.NavigateToScene(getPad(), eUIScene_DebugItemEditor, + (void*)initData); + } + } #endif -#endif - else - { - handleAdditionalKeyPress(iAction); - } + else { + handleAdditionalKeyPress(iAction); + } - UpdateTooltips(); + UpdateTooltips(); - return bHandled; + return bHandled; } -bool IUIScene_AbstractContainerMenu::handleValidKeyPress(int iUserIndex, int buttonNum, bool quickKeyHeld) -{ - return false; +bool IUIScene_AbstractContainerMenu::handleValidKeyPress(int iUserIndex, + int buttonNum, + bool quickKeyHeld) { + return false; } -void IUIScene_AbstractContainerMenu::handleOutsideClicked(int iPad, int buttonNum, bool quickKeyHeld) -{ - // Drop items. +void IUIScene_AbstractContainerMenu::handleOutsideClicked(int iPad, + int buttonNum, + bool quickKeyHeld) { + // Drop items. - //pMinecraft->localgameModes[m_iPad]->handleInventoryMouseClick(menu->containerId, AbstractContainerMenu::CLICKED_OUTSIDE, buttonNum, quickKeyHeld?true:false, pMinecraft->localplayers[m_iPad] ); - slotClicked(AbstractContainerMenu::CLICKED_OUTSIDE, buttonNum, quickKeyHeld?true:false); + // pMinecraft->localgameModes[m_iPad]->handleInventoryMouseClick(menu->containerId, + // AbstractContainerMenu::CLICKED_OUTSIDE, buttonNum, + // quickKeyHeld?true:false, pMinecraft->localplayers[m_iPad] ); + slotClicked(AbstractContainerMenu::SLOT_CLICKED_OUTSIDE, buttonNum, + quickKeyHeld ? true : false); } -void IUIScene_AbstractContainerMenu::handleOtherClicked(int iPad, ESceneSection eSection, int buttonNum, bool quickKey) -{ - // Do nothing +void IUIScene_AbstractContainerMenu::handleOtherClicked(int iPad, + ESceneSection eSection, + int buttonNum, + bool quickKey) { + // Do nothing } -void IUIScene_AbstractContainerMenu::handleAdditionalKeyPress(int iAction) -{ - // Do nothing +void IUIScene_AbstractContainerMenu::handleAdditionalKeyPress(int iAction) { + // Do nothing } -void IUIScene_AbstractContainerMenu::handleSlotListClicked(ESceneSection eSection, int buttonNum, bool quickKeyHeld) -{ - int currentIndex = getCurrentIndex(eSection); +void IUIScene_AbstractContainerMenu::handleSlotListClicked( + ESceneSection eSection, int buttonNum, bool quickKeyHeld) { + int currentIndex = getCurrentIndex(eSection); - //pMinecraft->localgameModes[m_iPad]->handleInventoryMouseClick(menu->containerId, currentIndex, buttonNum, quickKeyHeld?true:false, pMinecraft->localplayers[m_iPad] ); - slotClicked(currentIndex, buttonNum, quickKeyHeld?true:false); + // pMinecraft->localgameModes[m_iPad]->handleInventoryMouseClick(menu->containerId, + // currentIndex, buttonNum, quickKeyHeld?true:false, + // pMinecraft->localplayers[m_iPad] ); + slotClicked(currentIndex, buttonNum, quickKeyHeld ? true : false); - handleSectionClick(eSection); + handleSectionClick(eSection); } -void IUIScene_AbstractContainerMenu::slotClicked(int slotId, int buttonNum, bool quickKey) -{ - // 4J Stu - Removed this line as unused - //if (slot != NULL) slotId = slot->index; +void IUIScene_AbstractContainerMenu::slotClicked(int slotId, int buttonNum, + bool quickKey) { + // 4J Stu - Removed this line as unused + // if (slot != NULL) slotId = slot->index; - Minecraft *pMinecraft = Minecraft::GetInstance(); - pMinecraft->localgameModes[getPad()]->handleInventoryMouseClick(m_menu->containerId, slotId, buttonNum, quickKey, pMinecraft->localplayers[getPad()] ); + Minecraft* pMinecraft = Minecraft::GetInstance(); + pMinecraft->localgameModes[getPad()]->handleInventoryMouseClick( + m_menu->containerId, slotId, buttonNum, quickKey, + pMinecraft->localplayers[getPad()]); } -int IUIScene_AbstractContainerMenu::getCurrentIndex(ESceneSection eSection) -{ - int rows, columns; - GetSectionDimensions( eSection, &columns, &rows ); - int currentIndex = (m_iCurrSlotY * columns) + m_iCurrSlotX; +int IUIScene_AbstractContainerMenu::getCurrentIndex(ESceneSection eSection) { + int rows, columns; + GetSectionDimensions(eSection, &columns, &rows); + int currentIndex = (m_iCurrSlotY * columns) + m_iCurrSlotX; - return currentIndex + getSectionStartOffset(eSection); + return currentIndex + getSectionStartOffset(eSection); } -bool IUIScene_AbstractContainerMenu::IsSameItemAs(std::shared_ptr itemA, std::shared_ptr itemB) -{ - if(itemA == NULL || itemB == NULL) return false; +bool IUIScene_AbstractContainerMenu::IsSameItemAs( + std::shared_ptr itemA, std::shared_ptr itemB) { + if (itemA == NULL || itemB == NULL) return false; - bool bStackedByData = itemA->isStackedByData(); - return ( ( itemA->id == itemB->id ) && ( (bStackedByData && itemA->getAuxValue() == itemB->getAuxValue()) || !bStackedByData ) ); + return (itemA->id == itemB->id && + (!itemB->isStackedByData() || + itemB->getAuxValue() == itemA->getAuxValue()) && + ItemInstance::tagMatches(itemB, itemA)); } -int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot *slot) -{ - int iResult = 0; +int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot* slot) { + int iResult = 0; - if(slot != NULL && slot->hasItem()) - { - std::shared_ptr item = slot->getItem(); - if ( item->isStackable() ) - { - int iCount = item->GetCount(); - int iMaxStackSize = std::min(item->getMaxStackSize(), slot->getMaxStackSize() ); + if (slot != NULL && slot->hasItem()) { + std::shared_ptr item = slot->getItem(); + if (item->isStackable()) { + int iCount = item->GetCount(); + int iMaxStackSize = + std::min(item->getMaxStackSize(), slot->getMaxStackSize()); - iResult = iMaxStackSize - iCount; + iResult = iMaxStackSize - iCount; - if(iResult < 0 ) iResult = 0; - } - } + if (iResult < 0) iResult = 0; + } + } - return iResult; + return iResult; } -std::wstring IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slot, std::vector &unformattedStrings) -{ - if(slot == NULL) return L""; +std::vector* IUIScene_AbstractContainerMenu::GetItemDescription( + Slot* slot) { + if (slot == NULL) return NULL; - std::wstring desc = L""; - std::vector *strings = slot->getItem()->getHoverText(nullptr, false, unformattedStrings); - bool firstLine = true; - for(AUTO_VAR(it, strings->begin()); it != strings->end(); ++it) - { - std::wstring thisString = *it; - if(!firstLine) - { - desc.append( L"
" ); - } - else - { - firstLine = false; - wchar_t formatted[256]; - eMinecraftColour rarityColour = slot->getItem()->getRarity()->color; - int colour = app.GetHTMLColour(rarityColour); + std::vector* lines = + slot->getItem()->getHoverText(nullptr, false); - if(slot->getItem()->hasCustomHoverName()) - { - colour = app.GetHTMLColour(eTextColor_RenamedItemTitle); - } + // Add rarity to first line + if (lines->size() > 0) { + lines->at(0).color = slot->getItem()->getRarity()->color; - swprintf(formatted, 256, L"%ls",colour,thisString.c_str()); - thisString = formatted; - } - desc.append( thisString ); - } - strings->clear(); - delete strings; - return desc; + if (slot->getItem()->hasCustomHoverName()) { + lines->at(0).color = eTextColor_RenamedItemTitle; + } + } + + return lines; } + +std::vector* IUIScene_AbstractContainerMenu::GetSectionHoverText( + ESceneSection eSection) { + return NULL; +} \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.h b/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.h index 43e8dbe9a..153a25b9e 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.h +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.h @@ -1,223 +1,293 @@ #pragma once -// Uncomment to enable tap input detection to jump 1 slot. Doesn't work particularly well yet, and I feel the system does not need it. -// Would probably be required if we decide to slow down the pointer movement. -// 4J Stu - There was a request to be able to navigate the scenes with the dpad, so I have used much of the TAP_DETECTION -// code as it worked well for that situation. This #define should still stop the same things happening when using the -// stick though when not defined +// Uncomment to enable tap input detection to jump 1 slot. Doesn't work +// particularly well yet, and I feel the system does not need it. Would probably +// be required if we decide to slow down the pointer movement. 4J Stu - There +// was a request to be able to navigate the scenes with the dpad, so I have used +// much of the TAP_DETECTION code as it worked well for that situation. This +// #define should still stop the same things happening when using the stick +// though when not defined #define TAP_DETECTION // Uncomment to enable acceleration on pointer input. -//#define USE_POINTER_ACCEL +// #define USE_POINTER_ACCEL -#define POINTER_INPUT_TIMER_ID (0) // Arbitrary timer ID. -#define POINTER_SPEED_FACTOR (13.0f) // Speed of pointer. -//#define POINTER_PANEL_OVER_REACH (42.0f) // Amount beyond edge of panel which pointer can go over to drop items. - comes from the pointer size in the scene +#define POINTER_INPUT_TIMER_ID (0) // Arbitrary timer ID. +#define POINTER_SPEED_FACTOR (13.0f) // Speed of pointer. +// #define POINTER_PANEL_OVER_REACH (42.0f) // Amount beyond edge of +// panel which pointer can go over to drop items. - comes from the pointer size +// in the scene -#define MAX_INPUT_TICKS_FOR_SCALING (7) -#define MAX_INPUT_TICKS_FOR_TAPPING (15) +#define MAX_INPUT_TICKS_FOR_SCALING (7) +#define MAX_INPUT_TICKS_FOR_TAPPING (15) class AbstractContainerMenu; class Slot; -class IUIScene_AbstractContainerMenu -{ +class IUIScene_AbstractContainerMenu { protected: - // Sections of this scene containing items selectable by the pointer. - // 4J Stu - Always make the Using section the first one - enum ESceneSection - { - eSectionNone = -1, - eSectionContainerUsing = 0, - eSectionContainerInventory, - eSectionContainerChest, - eSectionContainerMax, - - eSectionFurnaceUsing, - eSectionFurnaceInventory, - eSectionFurnaceIngredient, - eSectionFurnaceFuel, - eSectionFurnaceResult, - eSectionFurnaceMax, - - eSectionInventoryUsing, - eSectionInventoryInventory, - eSectionInventoryArmor, - eSectionInventoryMax, - - eSectionTrapUsing, - eSectionTrapInventory, - eSectionTrapTrap, - eSectionTrapMax, + // Sections of this scene containing items selectable by the pointer. + // 4J Stu - Always make the Using section the first one + enum ESceneSection { + eSectionNone = -1, + eSectionContainerUsing = 0, + eSectionContainerInventory, + eSectionContainerChest, + eSectionContainerMax, - eSectionInventoryCreativeUsing, - eSectionInventoryCreativeSelector, -#ifndef _XBOX - eSectionInventoryCreativeTab_0, - eSectionInventoryCreativeTab_1, - eSectionInventoryCreativeTab_2, - eSectionInventoryCreativeTab_3, - eSectionInventoryCreativeTab_4, - eSectionInventoryCreativeTab_5, - eSectionInventoryCreativeTab_6, - eSectionInventoryCreativeTab_7, - eSectionInventoryCreativeSlider, -#endif - eSectionInventoryCreativeMax, - - eSectionEnchantUsing, - eSectionEnchantInventory, - eSectionEnchantSlot, - eSectionEnchantButton1, - eSectionEnchantButton2, - eSectionEnchantButton3, - eSectionEnchantMax, + eSectionFurnaceUsing, + eSectionFurnaceInventory, + eSectionFurnaceIngredient, + eSectionFurnaceFuel, + eSectionFurnaceResult, + eSectionFurnaceMax, - eSectionBrewingUsing, - eSectionBrewingInventory, - eSectionBrewingBottle1, - eSectionBrewingBottle2, - eSectionBrewingBottle3, - eSectionBrewingIngredient, - eSectionBrewingMax, + eSectionInventoryUsing, + eSectionInventoryInventory, + eSectionInventoryArmor, + eSectionInventoryMax, - eSectionAnvilUsing, - eSectionAnvilInventory, - eSectionAnvilItem1, - eSectionAnvilItem2, - eSectionAnvilResult, - eSectionAnvilName, - eSectionAnvilMax, - }; + eSectionTrapUsing, + eSectionTrapInventory, + eSectionTrapTrap, + eSectionTrapMax, - AbstractContainerMenu* m_menu; - bool m_autoDeleteMenu; + eSectionInventoryCreativeUsing, + eSectionInventoryCreativeSelector, + eSectionInventoryCreativeTab_0, + eSectionInventoryCreativeTab_1, + eSectionInventoryCreativeTab_2, + eSectionInventoryCreativeTab_3, + eSectionInventoryCreativeTab_4, + eSectionInventoryCreativeTab_5, + eSectionInventoryCreativeTab_6, + eSectionInventoryCreativeTab_7, + eSectionInventoryCreativeSlider, + eSectionInventoryCreativeMax, - eTutorial_State m_previousTutorialState; + eSectionEnchantUsing, + eSectionEnchantInventory, + eSectionEnchantSlot, + eSectionEnchantButton1, + eSectionEnchantButton2, + eSectionEnchantButton3, + eSectionEnchantMax, - UIVec2D m_pointerPos; + eSectionBrewingUsing, + eSectionBrewingInventory, + eSectionBrewingBottle1, + eSectionBrewingBottle2, + eSectionBrewingBottle3, + eSectionBrewingIngredient, + eSectionBrewingMax, - // Offset from pointer image top left to centre (we use the centre as the actual pointer). - float m_fPointerImageOffsetX; - float m_fPointerImageOffsetY; + eSectionAnvilUsing, + eSectionAnvilInventory, + eSectionAnvilItem1, + eSectionAnvilItem2, + eSectionAnvilResult, + eSectionAnvilName, + eSectionAnvilMax, - // Min and max extents for the pointer. - float m_fPointerMinX; - float m_fPointerMaxX; - float m_fPointerMinY; - float m_fPointerMaxY; + eSectionBeaconUsing, + eSectionBeaconInventory, + eSectionBeaconItem, + eSectionBeaconPrimaryTierOneOne, + eSectionBeaconPrimaryTierOneTwo, + eSectionBeaconPrimaryTierTwoOne, + eSectionBeaconPrimaryTierTwoTwo, + eSectionBeaconPrimaryTierThree, + eSectionBeaconSecondaryOne, + eSectionBeaconSecondaryTwo, + eSectionBeaconConfirm, + eSectionBeaconMax, - // Min and max extents of the panel. - float m_fPanelMinX; - float m_fPanelMaxX; - float m_fPanelMinY; - float m_fPanelMaxY; + eSectionHopperUsing, + eSectionHopperInventory, + eSectionHopperContents, + eSectionHopperMax, - int m_iConsectiveInputTicks; + eSectionHorseUsing, + eSectionHorseInventory, + eSectionHorseChest, + eSectionHorseArmor, + eSectionHorseSaddle, + eSectionHorseMax, - // Used for detecting quick "taps" in a direction, should jump cursor to next slot. - enum ETapState - { - eTapStateNoInput = 0, - eTapStateUp, - eTapStateDown, - eTapStateLeft, - eTapStateRight, - eTapStateJump, - eTapNone - }; + eSectionFireworksUsing, + eSectionFireworksInventory, + eSectionFireworksResult, + eSectionFireworksIngredients, + eSectionFireworksMax, + }; - ETapState m_eCurrTapState; - ESceneSection m_eCurrSection; - int m_iCurrSlotX; - int m_iCurrSlotY; + AbstractContainerMenu* m_menu; + bool m_autoDeleteMenu; + + eTutorial_State m_previousTutorialState; + + UIVec2D m_pointerPos; + + // Offset from pointer image top left to centre (we use the centre as the + // actual pointer). + float m_fPointerImageOffsetX; + float m_fPointerImageOffsetY; + + // Min and max extents for the pointer. + float m_fPointerMinX; + float m_fPointerMaxX; + float m_fPointerMinY; + float m_fPointerMaxY; + + // Min and max extents of the panel. + float m_fPanelMinX; + float m_fPanelMaxX; + float m_fPanelMinY; + float m_fPanelMaxY; + + int m_iConsectiveInputTicks; + + // Used for detecting quick "taps" in a direction, should jump cursor to + // next slot. + enum ETapState { + eTapStateNoInput = 0, + eTapStateUp, + eTapStateDown, + eTapStateLeft, + eTapStateRight, + eTapStateJump, + eTapNone + }; + + ETapState m_eCurrTapState; + ESceneSection m_eCurrSection; + int m_iCurrSlotX; + int m_iCurrSlotY; #ifdef __ORBIS__ - bool m_bFirstTouchStored[XUSER_MAX_COUNT]; // monitor the first position of a touch, so we can use relative distances of movement - UIVec2D m_oldvPointerPos; - UIVec2D m_oldvTouchPos; - // store the multipliers to map the UI window to the touchpad window - float m_fTouchPadMulX; - float m_fTouchPadMulY; - float m_fTouchPadDeadZoneX; // usese the multipliers - float m_fTouchPadDeadZoneY; - + bool + m_bFirstTouchStored[XUSER_MAX_COUNT]; // monitor the first position of + // a touch, so we can use + // relative distances of movement + UIVec2D m_oldvPointerPos; + UIVec2D m_oldvTouchPos; + // store the multipliers to map the UI window to the touchpad window + float m_fTouchPadMulX; + float m_fTouchPadMulY; + float m_fTouchPadDeadZoneX; // usese the multipliers + float m_fTouchPadDeadZoneY; #endif - // ENum indexes of the first section for this scene, and 1+the last section - ESceneSection m_eFirstSection, m_eMaxSection; + // ENum indexes of the first section for this scene, and 1+the last section + ESceneSection m_eFirstSection, m_eMaxSection; - // 4J - WESTY - Added for pointer prototype. - // Current tooltip settings. - EToolTipItem m_aeToolTipSettings[ eToolTipNumButtons ]; - - // 4J - WESTY - Added for pointer prototype. - // Indicates if pointer is outside UI window (used to drop items). - bool m_bPointerOutsideMenu; - Slot *m_lastPointerLabelSlot; + // 4J - WESTY - Added for pointer prototype. + // Current tooltip settings. + EToolTipItem m_aeToolTipSettings[eToolTipNumButtons]; - bool m_bSplitscreen; - bool m_bNavigateBack; // should we exit the xuiscenes or just navigate back on exit? - - virtual bool IsSectionSlotList( ESceneSection eSection ) { return eSection != eSectionNone; } - virtual bool CanHaveFocus( ESceneSection eSection ) { return true; } - int GetSectionDimensions( ESceneSection eSection, int* piNumColumns, int* piNumRows ); - virtual int getSectionColumns(ESceneSection eSection) = 0; - virtual int getSectionRows(ESceneSection eSection) = 0; - virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY ) = 0; - virtual void GetPositionOfSection( ESceneSection eSection, UIVec2D* pPosition ) = 0; - virtual void GetItemScreenData( ESceneSection eSection, int iItemIndex, UIVec2D* pPosition, UIVec2D* pSize ) = 0; - void updateSlotPosition( ESceneSection eSection, ESceneSection newSection, ETapState eTapDirection, int *piTargetX, int *piTargetY, int xOffset ); + // 4J - WESTY - Added for pointer prototype. + // Indicates if pointer is outside UI window (used to drop items). + bool m_bPointerOutsideMenu; + Slot* m_lastPointerLabelSlot; - #ifdef TAP_DETECTION - ETapState GetTapInputType( float fInputX, float fInputY ); - #endif + bool m_bSplitscreen; + bool m_bNavigateBack; // should we exit the xuiscenes or just navigate back + // on exit? - // Current tooltip settings. - void SetToolTip( EToolTipButton eButton, EToolTipItem eItem ); - void UpdateTooltips(); + virtual bool IsSectionSlotList(ESceneSection eSection) { + return eSection != eSectionNone; + } + virtual bool CanHaveFocus(ESceneSection eSection) { return true; } + virtual bool IsVisible(ESceneSection eSection) { return true; } + int GetSectionDimensions(ESceneSection eSection, int* piNumColumns, + int* piNumRows); + virtual int getSectionColumns(ESceneSection eSection) = 0; + virtual int getSectionRows(ESceneSection eSection) = 0; + virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection, + ETapState eTapDirection, + int* piTargetX, + int* piTargetY) = 0; + virtual void GetPositionOfSection(ESceneSection eSection, + UIVec2D* pPosition) = 0; + virtual void GetItemScreenData(ESceneSection eSection, int iItemIndex, + UIVec2D* pPosition, UIVec2D* pSize) = 0; + void updateSlotPosition(ESceneSection eSection, ESceneSection newSection, + ETapState eTapDirection, int* piTargetX, + int* piTargetY, int xOffset = 0, int yOffset = 0); - // 4J - WESTY - Added for pointer prototype. - void SetPointerOutsideMenu( bool bOutside ) { m_bPointerOutsideMenu = bOutside; } - - void Initialize(int m_iPad, AbstractContainerMenu* menu, bool autoDeleteMenu, int startIndex,ESceneSection firstSection,ESceneSection maxSection, bool bNavigateBack=false); - virtual void PlatformInitialize(int iPad, int startIndex) = 0; - virtual void InitDataAssociations(int iPad, AbstractContainerMenu *menu, int startIndex = 0) = 0; +#ifdef TAP_DETECTION + ETapState GetTapInputType(float fInputX, float fInputY); +#endif - void onMouseTick(); - bool handleKeyDown(int iPad, int iAction, bool bRepeat); - virtual bool handleValidKeyPress(int iUserIndex, int buttonNum, bool quickKeyHeld); - virtual void handleOutsideClicked(int iPad, int buttonNum, bool quickKeyHeld); - virtual void handleOtherClicked(int iPad, ESceneSection eSection, int buttonNum, bool quickKey); - virtual void handleAdditionalKeyPress(int iAction); - virtual void handleSlotListClicked(ESceneSection eSection, int buttonNum, bool quickKeyHeld); - virtual void handleSectionClick(ESceneSection eSection) = 0; - void slotClicked(int slotId, int buttonNum, bool quickKey); - int getCurrentIndex(ESceneSection eSection); - virtual int getSectionStartOffset(ESceneSection eSection) = 0; - virtual bool doesSectionTreeHaveFocus(ESceneSection eSection) = 0; - virtual void setSectionFocus(ESceneSection eSection, int iPad) = 0; - virtual void setSectionSelectedSlot(ESceneSection eSection, int x, int y) = 0; - virtual void setFocusToPointer(int iPad) = 0; - virtual void SetPointerText(const std::wstring &description, std::vector &unformattedStrings, bool newSlot) = 0; - virtual std::shared_ptr getSlotItem(ESceneSection eSection, int iSlot) = 0; - virtual bool isSlotEmpty(ESceneSection eSection, int iSlot) = 0; - virtual void adjustPointerForSafeZone() = 0; + // Current tooltip settings. + void SetToolTip(EToolTipButton eButton, EToolTipItem eItem); + void UpdateTooltips(); - virtual bool overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining, - EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT) { return false; } + // 4J - WESTY - Added for pointer prototype. + void SetPointerOutsideMenu(bool bOutside) { + m_bPointerOutsideMenu = bOutside; + } + + void Initialize(int m_iPad, AbstractContainerMenu* menu, + bool autoDeleteMenu, int startIndex, + ESceneSection firstSection, ESceneSection maxSection, + bool bNavigateBack = false); + virtual void PlatformInitialize(int iPad, int startIndex) = 0; + virtual void InitDataAssociations(int iPad, AbstractContainerMenu* menu, + int startIndex = 0) = 0; + + void onMouseTick(); + bool handleKeyDown(int iPad, int iAction, bool bRepeat); + virtual bool handleValidKeyPress(int iUserIndex, int buttonNum, + bool quickKeyHeld); + virtual void handleOutsideClicked(int iPad, int buttonNum, + bool quickKeyHeld); + virtual void handleOtherClicked(int iPad, ESceneSection eSection, + int buttonNum, bool quickKey); + virtual void handleAdditionalKeyPress(int iAction); + virtual void handleSlotListClicked(ESceneSection eSection, int buttonNum, + bool quickKeyHeld); + virtual void handleSectionClick(ESceneSection eSection) = 0; + void slotClicked(int slotId, int buttonNum, bool quickKey); + int getCurrentIndex(ESceneSection eSection); + virtual int getSectionStartOffset(ESceneSection eSection) = 0; + virtual bool doesSectionTreeHaveFocus(ESceneSection eSection) = 0; + virtual void setSectionFocus(ESceneSection eSection, int iPad) = 0; + virtual void setSectionSelectedSlot(ESceneSection eSection, int x, + int y) = 0; + virtual void setFocusToPointer(int iPad) = 0; + virtual void SetPointerText(std::vector* description, + bool newSlot) = 0; + virtual std::vector* GetSectionHoverText( + ESceneSection eSection); + virtual std::shared_ptr getSlotItem(ESceneSection eSection, + int iSlot) = 0; + virtual Slot* getSlot(ESceneSection eSection, int iSlot) = 0; + virtual bool isSlotEmpty(ESceneSection eSection, int iSlot) = 0; + virtual void adjustPointerForSafeZone() = 0; + + virtual bool overrideTooltips( + ESceneSection sectionUnderPointer, + std::shared_ptr itemUnderPointer, bool bIsItemCarried, + bool bSlotHasItem, bool bCarriedIsSameAsSlot, + int iSlotStackSizeRemaining, EToolTipItem& buttonA, + EToolTipItem& buttonX, EToolTipItem& buttonY, EToolTipItem& buttonRT, + EToolTipItem& buttonBack) { + return false; + } private: - bool IsSameItemAs(std::shared_ptr itemA, std::shared_ptr itemB); - int GetEmptyStackSpace(Slot *slot); - std::wstring GetItemDescription(Slot *slot, std::vector &unformattedStrings); + bool IsSameItemAs(std::shared_ptr itemA, + std::shared_ptr itemB); + int GetEmptyStackSpace(Slot* slot); + + std::vector* GetItemDescription(Slot* slot); protected: - - IUIScene_AbstractContainerMenu(); - virtual ~IUIScene_AbstractContainerMenu(); + IUIScene_AbstractContainerMenu(); + virtual ~IUIScene_AbstractContainerMenu(); public: - virtual int getPad() = 0; + virtual int getPad() = 0; }; diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_AnvilMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_AnvilMenu.cpp index 05cfbb98f..90022c2e0 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_AnvilMenu.cpp @@ -7,270 +7,225 @@ #include "../../Minecraft.Client/Player/MultiPlayerLocalPlayer.h" #include "../../Minecraft.Client/Network/ClientConnection.h" -IUIScene_AnvilMenu::IUIScene_AnvilMenu() -{ - m_inventory = nullptr; - m_repairMenu = NULL; - m_itemName = L""; +IUIScene_AnvilMenu::IUIScene_AnvilMenu() { + m_inventory = nullptr; + m_repairMenu = NULL; + m_itemName = L""; } -IUIScene_AbstractContainerMenu::ESceneSection IUIScene_AnvilMenu::GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY ) -{ - ESceneSection newSection = eSection; - int xOffset = 0; +IUIScene_AbstractContainerMenu::ESceneSection +IUIScene_AnvilMenu::GetSectionAndSlotInDirection(ESceneSection eSection, + ETapState eTapDirection, + int* piTargetX, + int* piTargetY) { + ESceneSection newSection = eSection; + int xOffset = 0; - // Find the new section if there is one - switch( eSection ) - { - case eSectionAnvilItem1: - if(eTapDirection == eTapStateUp) - { - newSection = eSectionAnvilName; - } - else if(eTapDirection == eTapStateDown) - { - newSection = eSectionAnvilInventory; - xOffset = ANVIL_SCENE_ITEM1_SLOT_DOWN_OFFSET; - } - else if(eTapDirection == eTapStateLeft) - { - newSection = eSectionAnvilResult; - } - else if(eTapDirection == eTapStateRight) - { - newSection = eSectionAnvilItem2; - } - break; - case eSectionAnvilItem2: - if(eTapDirection == eTapStateUp) - { - newSection = eSectionAnvilName; - } - else if(eTapDirection == eTapStateDown) - { - newSection = eSectionAnvilInventory; - xOffset = ANVIL_SCENE_ITEM2_SLOT_DOWN_OFFSET; - } - else if(eTapDirection == eTapStateLeft) - { - newSection = eSectionAnvilItem1; - } - else if(eTapDirection == eTapStateRight) - { - newSection = eSectionAnvilResult; - } - break; - case eSectionAnvilResult: - if(eTapDirection == eTapStateUp) - { - newSection = eSectionAnvilName; - } - else if(eTapDirection == eTapStateDown) - { - newSection = eSectionAnvilInventory; - xOffset = ANVIL_SCENE_RESULT_SLOT_DOWN_OFFSET; - } - else if(eTapDirection == eTapStateLeft) - { - newSection = eSectionAnvilItem2; - } - else if(eTapDirection == eTapStateRight) - { - newSection = eSectionAnvilItem1; - } - break; - case eSectionAnvilName: - if(eTapDirection == eTapStateUp) - { - newSection = eSectionAnvilUsing; - xOffset = ANVIL_SCENE_ITEM2_SLOT_UP_OFFSET; - } - else if(eTapDirection == eTapStateDown) - { - newSection = eSectionAnvilItem2; - } - break; - case eSectionAnvilInventory: - if(eTapDirection == eTapStateDown) - { - newSection = eSectionAnvilUsing; - } - else if(eTapDirection == eTapStateUp) - { - if( *piTargetX <= ANVIL_SCENE_ITEM1_SLOT_UP_OFFSET) - { - newSection = eSectionAnvilItem1; - } - else if( *piTargetX <= ANVIL_SCENE_ITEM2_SLOT_UP_OFFSET) - { - newSection = eSectionAnvilItem2; - } - else if( *piTargetX >= ANVIL_SCENE_RESULT_SLOT_UP_OFFSET) - { - newSection = eSectionAnvilResult; - } - } - break; - case eSectionAnvilUsing: - if(eTapDirection == eTapStateUp) - { - newSection = eSectionAnvilInventory; - } - else if(eTapDirection == eTapStateDown) - { - if( *piTargetX <= ANVIL_SCENE_ITEM1_SLOT_UP_OFFSET) - { - newSection = eSectionAnvilItem1; - } - else if( *piTargetX <= ANVIL_SCENE_ITEM2_SLOT_UP_OFFSET) - { - newSection = eSectionAnvilName; - } - else if( *piTargetX >= ANVIL_SCENE_RESULT_SLOT_UP_OFFSET) - { - newSection = eSectionAnvilName; - } - } - break; - default: - assert( false ); - break; - } + // Find the new section if there is one + switch (eSection) { + case eSectionAnvilItem1: + if (eTapDirection == eTapStateUp) { + newSection = eSectionAnvilName; + } else if (eTapDirection == eTapStateDown) { + newSection = eSectionAnvilInventory; + xOffset = ANVIL_SCENE_ITEM1_SLOT_DOWN_OFFSET; + } else if (eTapDirection == eTapStateLeft) { + newSection = eSectionAnvilResult; + } else if (eTapDirection == eTapStateRight) { + newSection = eSectionAnvilItem2; + } + break; + case eSectionAnvilItem2: + if (eTapDirection == eTapStateUp) { + newSection = eSectionAnvilName; + } else if (eTapDirection == eTapStateDown) { + newSection = eSectionAnvilInventory; + xOffset = ANVIL_SCENE_ITEM2_SLOT_DOWN_OFFSET; + } else if (eTapDirection == eTapStateLeft) { + newSection = eSectionAnvilItem1; + } else if (eTapDirection == eTapStateRight) { + newSection = eSectionAnvilResult; + } + break; + case eSectionAnvilResult: + if (eTapDirection == eTapStateUp) { + newSection = eSectionAnvilName; + } else if (eTapDirection == eTapStateDown) { + newSection = eSectionAnvilInventory; + xOffset = ANVIL_SCENE_RESULT_SLOT_DOWN_OFFSET; + } else if (eTapDirection == eTapStateLeft) { + newSection = eSectionAnvilItem2; + } else if (eTapDirection == eTapStateRight) { + newSection = eSectionAnvilItem1; + } + break; + case eSectionAnvilName: + if (eTapDirection == eTapStateUp) { + newSection = eSectionAnvilUsing; + xOffset = ANVIL_SCENE_ITEM2_SLOT_UP_OFFSET; + } else if (eTapDirection == eTapStateDown) { + newSection = eSectionAnvilItem2; + } + break; + case eSectionAnvilInventory: + if (eTapDirection == eTapStateDown) { + newSection = eSectionAnvilUsing; + } else if (eTapDirection == eTapStateUp) { + if (*piTargetX <= ANVIL_SCENE_ITEM1_SLOT_UP_OFFSET) { + newSection = eSectionAnvilItem1; + } else if (*piTargetX <= ANVIL_SCENE_ITEM2_SLOT_UP_OFFSET) { + newSection = eSectionAnvilItem2; + } else if (*piTargetX >= ANVIL_SCENE_RESULT_SLOT_UP_OFFSET) { + newSection = eSectionAnvilResult; + } + } + break; + case eSectionAnvilUsing: + if (eTapDirection == eTapStateUp) { + newSection = eSectionAnvilInventory; + } else if (eTapDirection == eTapStateDown) { + if (*piTargetX <= ANVIL_SCENE_ITEM1_SLOT_UP_OFFSET) { + newSection = eSectionAnvilItem1; + } else if (*piTargetX <= ANVIL_SCENE_ITEM2_SLOT_UP_OFFSET) { + newSection = eSectionAnvilName; + } else if (*piTargetX >= ANVIL_SCENE_RESULT_SLOT_UP_OFFSET) { + newSection = eSectionAnvilName; + } + } + break; + default: + assert(false); + break; + } - updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, xOffset); + updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, + piTargetY, xOffset); - return newSection; + return newSection; } -int IUIScene_AnvilMenu::getSectionStartOffset(ESceneSection eSection) -{ - int offset = 0; - switch( eSection ) - { - case eSectionAnvilItem1: - offset = MerchantMenu::PAYMENT1_SLOT; - break; - case eSectionAnvilItem2: - offset = MerchantMenu::PAYMENT2_SLOT; - break; - case eSectionAnvilResult: - offset = MerchantMenu::RESULT_SLOT; - break; - case eSectionAnvilInventory: - offset = MerchantMenu::INV_SLOT_START; - break; - case eSectionAnvilUsing: - offset = MerchantMenu::USE_ROW_SLOT_START; - break; - default: - assert( false ); - break; - } - return offset; +int IUIScene_AnvilMenu::getSectionStartOffset(ESceneSection eSection) { + int offset = 0; + switch (eSection) { + case eSectionAnvilItem1: + offset = MerchantMenu::PAYMENT1_SLOT; + break; + case eSectionAnvilItem2: + offset = MerchantMenu::PAYMENT2_SLOT; + break; + case eSectionAnvilResult: + offset = MerchantMenu::RESULT_SLOT; + break; + case eSectionAnvilInventory: + offset = MerchantMenu::INV_SLOT_START; + break; + case eSectionAnvilUsing: + offset = MerchantMenu::USE_ROW_SLOT_START; + break; + default: + assert(false); + break; + } + return offset; } -void IUIScene_AnvilMenu::handleOtherClicked(int iPad, ESceneSection eSection, int buttonNum, bool quickKey) -{ - switch(eSection) - { - case eSectionAnvilName: - handleEditNamePressed(); - break; - default: - break; - }; +void IUIScene_AnvilMenu::handleOtherClicked(int iPad, ESceneSection eSection, + int buttonNum, bool quickKey) { + switch (eSection) { + case eSectionAnvilName: + handleEditNamePressed(); + break; + default: + break; + }; } -bool IUIScene_AnvilMenu::IsSectionSlotList( ESceneSection eSection ) -{ - switch( eSection ) - { - case eSectionAnvilUsing: - case eSectionAnvilInventory: - case eSectionAnvilItem1: - case eSectionAnvilItem2: - case eSectionAnvilResult: - return true; - default: - break; - } - return false; +bool IUIScene_AnvilMenu::IsSectionSlotList(ESceneSection eSection) { + switch (eSection) { + case eSectionAnvilUsing: + case eSectionAnvilInventory: + case eSectionAnvilItem1: + case eSectionAnvilItem2: + case eSectionAnvilResult: + return true; + default: + break; + } + return false; } -void IUIScene_AnvilMenu::handleTick() -{ - Minecraft *pMinecraft = Minecraft::GetInstance(); - bool canAfford = true; - std::wstring m_costString = L""; +void IUIScene_AnvilMenu::handleTick() { + Minecraft* pMinecraft = Minecraft::GetInstance(); + bool canAfford = true; + std::wstring m_costString = L""; - if(m_repairMenu->cost > 0) - { - if(m_repairMenu->cost >= 40 && !pMinecraft->localplayers[getPad()]->abilities.instabuild) - { - m_costString = app.GetString(IDS_REPAIR_EXPENSIVE); - canAfford = false; - } - else if(!m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)->hasItem()) - { - // Do nothing - } - else - { - const wchar_t *costString = app.GetString(IDS_REPAIR_COST); - wchar_t temp[256]; - swprintf(temp, 256, costString, m_repairMenu->cost); - m_costString = temp; - if(!m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)->mayPickup(std::dynamic_pointer_cast(m_inventory->player->shared_from_this()))) - { - canAfford = false; - } - } - } - setCostLabel(m_costString, canAfford); + if (m_repairMenu->cost > 0) { + if (m_repairMenu->cost >= 40 && + !pMinecraft->localplayers[getPad()]->abilities.instabuild) { + m_costString = app.GetString(IDS_REPAIR_EXPENSIVE); + canAfford = false; + } else if (!m_repairMenu->getSlot(AnvilMenu::RESULT_SLOT)->hasItem()) { + // Do nothing + } else { + const wchar_t* costString = app.GetString(IDS_REPAIR_COST); + wchar_t temp[256]; + swprintf(temp, 256, costString, m_repairMenu->cost); + m_costString = temp; + if (!m_repairMenu->getSlot(AnvilMenu::RESULT_SLOT) + ->mayPickup(std::dynamic_pointer_cast( + m_inventory->player->shared_from_this()))) { + canAfford = false; + } + } + } + setCostLabel(m_costString, canAfford); - bool crossVisible = (m_repairMenu->getSlot(RepairMenu::INPUT_SLOT)->hasItem() || m_repairMenu->getSlot(RepairMenu::ADDITIONAL_SLOT)->hasItem()) && !m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)->hasItem(); - showCross(crossVisible); + bool crossVisible = + (m_repairMenu->getSlot(AnvilMenu::INPUT_SLOT)->hasItem() || + m_repairMenu->getSlot(AnvilMenu::ADDITIONAL_SLOT)->hasItem()) && + !m_repairMenu->getSlot(AnvilMenu::RESULT_SLOT)->hasItem(); + showCross(crossVisible); } -void IUIScene_AnvilMenu::updateItemName() -{ - Slot *slot = m_repairMenu->getSlot(RepairMenu::INPUT_SLOT); - if (slot != NULL && slot->hasItem()) - { - if (!slot->getItem()->hasCustomHoverName() && m_itemName.compare(slot->getItem()->getHoverName())==0) - { - m_itemName = L""; - } - } +void IUIScene_AnvilMenu::updateItemName() { + Slot* slot = m_repairMenu->getSlot(AnvilMenu::INPUT_SLOT); + if (slot != NULL && slot->hasItem()) { + if (!slot->getItem()->hasCustomHoverName() && + m_itemName.compare(slot->getItem()->getHoverName()) == 0) { + m_itemName = L""; + } + } - m_repairMenu->setItemName(m_itemName); + m_repairMenu->setItemName(m_itemName); - // Convert to byteArray - ByteArrayOutputStream baos; - DataOutputStream dos(&baos); - dos.writeUTF(m_itemName); - Minecraft::GetInstance()->localplayers[getPad()]->connection->send(std::shared_ptr(new CustomPayloadPacket(CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray()))); + // Convert to byteArray + ByteArrayOutputStream baos; + DataOutputStream dos(&baos); + dos.writeUTF(m_itemName); + Minecraft::GetInstance()->localplayers[getPad()]->connection->send( + std::shared_ptr(new CustomPayloadPacket( + CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray()))); } -void IUIScene_AnvilMenu::refreshContainer(AbstractContainerMenu *container, std::vector > *items) -{ - slotChanged(container, RepairMenu::INPUT_SLOT, container->getSlot(0)->getItem()); +void IUIScene_AnvilMenu::refreshContainer( + AbstractContainerMenu* container, + std::vector >* items) { + slotChanged(container, AnvilMenu::INPUT_SLOT, + container->getSlot(0)->getItem()); } -void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr item) -{ - if (slotIndex == RepairMenu::INPUT_SLOT) - { - m_itemName = item == NULL ? L"" : item->getHoverName(); - setEditNameValue(m_itemName); - setEditNameEditable(item != NULL); - if (item != NULL) - { - updateItemName(); - } - } +void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu* container, + int slotIndex, + std::shared_ptr item) { + if (slotIndex == AnvilMenu::INPUT_SLOT) { + m_itemName = item == NULL ? L"" : item->getHoverName(); + setEditNameValue(m_itemName); + setEditNameEditable(item != NULL); + if (item != NULL) { + updateItemName(); + } + } } -void IUIScene_AnvilMenu::setContainerData(AbstractContainerMenu *container, int id, int value) -{ -} +void IUIScene_AnvilMenu::setContainerData(AbstractContainerMenu* container, + int id, int value) {} diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_AnvilMenu.h b/Minecraft.Client/Platform/Common/UI/IUIScene_AnvilMenu.h index 32416fcdd..5833471f8 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_AnvilMenu.h +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_AnvilMenu.h @@ -11,35 +11,42 @@ #define ANVIL_SCENE_ITEM2_SLOT_DOWN_OFFSET 4 class Inventory; -class RepairMenu; +class AnvilMenu; -class IUIScene_AnvilMenu : public virtual IUIScene_AbstractContainerMenu, public net_minecraft_world_inventory::ContainerListener -{ +class IUIScene_AnvilMenu + : public virtual IUIScene_AbstractContainerMenu, + public net_minecraft_world_inventory::ContainerListener { protected: - std::shared_ptr m_inventory; - RepairMenu *m_repairMenu; - std::wstring m_itemName; + std::shared_ptr m_inventory; + AnvilMenu* m_repairMenu; + std::wstring m_itemName; protected: - IUIScene_AnvilMenu(); + IUIScene_AnvilMenu(); - virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY ); - int getSectionStartOffset(ESceneSection eSection); - virtual void handleOtherClicked(int iPad, ESceneSection eSection, int buttonNum, bool quickKey); - bool IsSectionSlotList( ESceneSection eSection ); + virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection, + ETapState eTapDirection, + int* piTargetX, + int* piTargetY); + int getSectionStartOffset(ESceneSection eSection); + virtual void handleOtherClicked(int iPad, ESceneSection eSection, + int buttonNum, bool quickKey); + bool IsSectionSlotList(ESceneSection eSection); - void handleTick(); + void handleTick(); - // Anvil only - virtual void handleEditNamePressed() = 0; - virtual void setEditNameValue(const std::wstring &name) = 0; - virtual void setEditNameEditable(bool enabled) = 0; - virtual void setCostLabel(const std::wstring &label, bool canAfford) = 0; - virtual void showCross(bool show) = 0; - void updateItemName(); + // Anvil only + virtual void handleEditNamePressed() = 0; + virtual void setEditNameValue(const std::wstring& name) = 0; + virtual void setEditNameEditable(bool enabled) = 0; + virtual void setCostLabel(const std::wstring& label, bool canAfford) = 0; + virtual void showCross(bool show) = 0; + void updateItemName(); - // ContainerListenr - void refreshContainer(AbstractContainerMenu *container, std::vector > *items); - void slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr item); - void setContainerData(AbstractContainerMenu *container, int id, int value); + // ContainerListenr + void refreshContainer(AbstractContainerMenu* container, + std::vector >* items); + void slotChanged(AbstractContainerMenu* container, int slotIndex, + std::shared_ptr item); + void setContainerData(AbstractContainerMenu* container, int id, int value); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_BeaconMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_BeaconMenu.cpp new file mode 100644 index 000000000..6869ce689 --- /dev/null +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_BeaconMenu.cpp @@ -0,0 +1,389 @@ +#include "../../stdafx.h" +#include "../../../../Minecraft.World/Network/Packets/CustomPayloadPacket.h" +#include "../../../../Minecraft.World/Headers/net.minecraft.world.inventory.h" +#include "../../../../Minecraft.World/Headers/net.minecraft.world.level.tile.entity.h" +#include "../../../../Minecraft.World/Headers/net.minecraft.world.effect.h" +#include "../../../../Minecraft.World/Util/HtmlString.h" +#include "IUIScene_BeaconMenu.h" +#include "../../../Minecraft.h" +#include "../../../Player/MultiPlayerLocalPlayer.h" +#include "../../../Network/ClientConnection.h" + +IUIScene_BeaconMenu::IUIScene_BeaconMenu() { + m_beacon = nullptr; + m_initPowerButtons = true; +} + +IUIScene_AbstractContainerMenu::ESceneSection +IUIScene_BeaconMenu::GetSectionAndSlotInDirection(ESceneSection eSection, + ETapState eTapDirection, + int* piTargetX, + int* piTargetY) { + ESceneSection newSection = eSection; + + int xOffset = 0; + + // Find the new section if there is one + switch (eSection) { + case eSectionBeaconInventory: + if (eTapDirection == eTapStateDown) + newSection = eSectionBeaconUsing; + else if (eTapDirection == eTapStateUp) { + if (*piTargetX < 4) { + newSection = eSectionBeaconPrimaryTierThree; + } else if (*piTargetX < 7) { + newSection = eSectionBeaconItem; + } else { + newSection = eSectionBeaconConfirm; + } + } + break; + case eSectionBeaconUsing: + if (eTapDirection == eTapStateDown) { + if (*piTargetX < 2) { + newSection = eSectionBeaconPrimaryTierOneOne; + } else if (*piTargetX < 5) { + newSection = eSectionBeaconPrimaryTierOneTwo; + } else if (*piTargetX > 8 && + GetPowerButtonId(eSectionBeaconSecondaryTwo) > 0) { + newSection = eSectionBeaconSecondaryTwo; + } else { + newSection = eSectionBeaconSecondaryOne; + } + } else if (eTapDirection == eTapStateUp) + newSection = eSectionBeaconInventory; + break; + case eSectionBeaconItem: + if (eTapDirection == eTapStateDown) { + newSection = eSectionBeaconInventory; + xOffset = -5; + } else if (eTapDirection == eTapStateUp) + newSection = eSectionBeaconSecondaryOne; + else if (eTapDirection == eTapStateLeft) + newSection = eSectionBeaconConfirm; + else if (eTapDirection == eTapStateRight) + newSection = eSectionBeaconConfirm; + break; + case eSectionBeaconPrimaryTierOneOne: + if (eTapDirection == eTapStateDown) + newSection = eSectionBeaconPrimaryTierTwoOne; + else if (eTapDirection == eTapStateUp) { + newSection = eSectionBeaconUsing; + xOffset = -1; + } else if (eTapDirection == eTapStateLeft) + newSection = eSectionBeaconPrimaryTierOneTwo; + else if (eTapDirection == eTapStateRight) + newSection = eSectionBeaconPrimaryTierOneTwo; + break; + case eSectionBeaconPrimaryTierOneTwo: + if (eTapDirection == eTapStateDown) + newSection = eSectionBeaconPrimaryTierTwoTwo; + else if (eTapDirection == eTapStateUp) { + newSection = eSectionBeaconUsing; + xOffset = -3; + } else if (eTapDirection == eTapStateLeft) + newSection = eSectionBeaconPrimaryTierOneOne; + else if (eTapDirection == eTapStateRight) + newSection = eSectionBeaconPrimaryTierOneOne; + break; + case eSectionBeaconPrimaryTierTwoOne: + if (eTapDirection == eTapStateDown) + newSection = eSectionBeaconPrimaryTierThree; + else if (eTapDirection == eTapStateUp) + newSection = eSectionBeaconPrimaryTierOneOne; + else if (eTapDirection == eTapStateLeft) { + if (GetPowerButtonId(eSectionBeaconSecondaryTwo) > 0) { + newSection = eSectionBeaconSecondaryTwo; + } else { + newSection = eSectionBeaconSecondaryOne; + } + } else if (eTapDirection == eTapStateRight) + newSection = eSectionBeaconPrimaryTierTwoTwo; + break; + case eSectionBeaconPrimaryTierTwoTwo: + if (eTapDirection == eTapStateDown) + newSection = eSectionBeaconPrimaryTierThree; + else if (eTapDirection == eTapStateUp) + newSection = eSectionBeaconPrimaryTierOneTwo; + else if (eTapDirection == eTapStateLeft) + newSection = eSectionBeaconPrimaryTierTwoOne; + else if (eTapDirection == eTapStateRight) + newSection = eSectionBeaconSecondaryOne; + break; + case eSectionBeaconPrimaryTierThree: + if (eTapDirection == eTapStateDown) { + newSection = eSectionBeaconInventory; + xOffset = -3; + } else if (eTapDirection == eTapStateUp) + newSection = eSectionBeaconPrimaryTierTwoOne; + break; + case eSectionBeaconSecondaryOne: + if (eTapDirection == eTapStateDown) + newSection = eSectionBeaconItem; + else if (eTapDirection == eTapStateUp) { + newSection = eSectionBeaconUsing; + xOffset = -7; + } else if (eTapDirection == eTapStateLeft) + newSection = eSectionBeaconPrimaryTierTwoTwo; + else if (eTapDirection == eTapStateRight) { + if (GetPowerButtonId(eSectionBeaconSecondaryTwo) > 0) { + newSection = eSectionBeaconSecondaryTwo; + } else { + newSection = eSectionBeaconPrimaryTierTwoOne; + } + } + break; + case eSectionBeaconSecondaryTwo: + if (eTapDirection == eTapStateDown) + newSection = eSectionBeaconItem; + else if (eTapDirection == eTapStateUp) { + newSection = eSectionBeaconUsing; + xOffset = -8; + } else if (eTapDirection == eTapStateLeft) + newSection = eSectionBeaconSecondaryOne; + else if (eTapDirection == eTapStateRight) + newSection = eSectionBeaconPrimaryTierTwoOne; + break; + case eSectionBeaconConfirm: + if (eTapDirection == eTapStateDown) { + newSection = eSectionBeaconInventory; + xOffset = -8; + } else if (eTapDirection == eTapStateUp) { + newSection = eSectionBeaconSecondaryOne; + } else if (eTapDirection == eTapStateLeft) + newSection = eSectionBeaconItem; + else if (eTapDirection == eTapStateRight) + newSection = eSectionBeaconItem; + break; + default: + assert(false); + break; + } + + updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, + piTargetY, xOffset); + + return newSection; +} + +int IUIScene_BeaconMenu::getSectionStartOffset( + IUIScene_AbstractContainerMenu::ESceneSection eSection) { + int offset = 0; + switch (eSection) { + case eSectionBeaconItem: + offset = BeaconMenu::PAYMENT_SLOT; + break; + case eSectionBeaconInventory: + offset = BeaconMenu::INV_SLOT_START; + break; + case eSectionBeaconUsing: + offset = BeaconMenu::USE_ROW_SLOT_START; + break; + default: + assert(false); + break; + } + return offset; +} + +bool IUIScene_BeaconMenu::IsSectionSlotList(ESceneSection eSection) { + switch (eSection) { + case eSectionBeaconItem: + case eSectionBeaconInventory: + case eSectionBeaconUsing: + return true; + default: + break; + } + return false; +} + +void IUIScene_BeaconMenu::handleOtherClicked(int iPad, ESceneSection eSection, + int buttonNum, bool quickKey) { + switch (eSection) { + case eSectionBeaconConfirm: { + if ((m_beacon->getItem(0) == NULL) || + (m_beacon->getPrimaryPower() <= 0)) + return; + ByteArrayOutputStream baos; + DataOutputStream dos(&baos); + dos.writeInt(m_beacon->getPrimaryPower()); + dos.writeInt(m_beacon->getSecondaryPower()); + + Minecraft::GetInstance()->localplayers[getPad()]->connection->send( + std::shared_ptr(new CustomPayloadPacket( + CustomPayloadPacket::SET_BEACON_PACKET, + baos.toByteArray()))); + + if (m_beacon->getPrimaryPower() > 0) { + int effectId = m_beacon->getPrimaryPower(); + + bool active = true; + bool selected = false; + + int tier = 3; + if (tier >= m_beacon->getLevels()) { + active = false; + } else if (effectId == m_beacon->getSecondaryPower()) { + selected = true; + } + + AddPowerButton( + GetId(tier, m_beacon->getPrimaryPower()), + MobEffect::effects[m_beacon->getPrimaryPower()]->getIcon(), + tier, 1, active, selected); + } + } break; + case eSectionBeaconPrimaryTierOneOne: + case eSectionBeaconPrimaryTierOneTwo: + case eSectionBeaconPrimaryTierTwoOne: + case eSectionBeaconPrimaryTierTwoTwo: + case eSectionBeaconPrimaryTierThree: + case eSectionBeaconSecondaryOne: + case eSectionBeaconSecondaryTwo: { + if (IsPowerButtonSelected(eSection)) { + return; + } + + int id = GetPowerButtonId(eSection); + int effectId = (id & 0xff); + int tier = (id >> 8); + + if (tier < 3) { + m_beacon->setPrimaryPower(effectId); + } else { + m_beacon->setSecondaryPower(effectId); + } + SetPowerButtonSelected(eSection); + break; + } + default: + break; + }; +} + +void IUIScene_BeaconMenu::handleTick() { + if (m_initPowerButtons && m_beacon->getLevels() >= 0) { + m_initPowerButtons = false; + for (int tier = 0; tier <= 2; tier++) { + int count = BeaconTileEntity:: + BEACON_EFFECTS_EFFECTS; // BEACON_EFFECTS[tier].length; + int totalWidth = count * 22 + (count - 1) * 2; + + for (int c = 0; c < count; c++) { + if (BeaconTileEntity::BEACON_EFFECTS[tier][c] == NULL) continue; + + int effectId = BeaconTileEntity::BEACON_EFFECTS[tier][c]->id; + int icon = BeaconTileEntity::BEACON_EFFECTS[tier][c]->getIcon(); + + bool active = true; + bool selected = false; + + if (tier >= m_beacon->getLevels()) { + active = false; + } else if (effectId == m_beacon->getPrimaryPower()) { + selected = true; + } + + AddPowerButton(GetId(tier, effectId), icon, tier, c, active, + selected); + } + } + + { + int tier = 3; + + int count = BeaconTileEntity::BEACON_EFFECTS_EFFECTS + + 1; // BEACON_EFFECTS[tier].length + 1; + int totalWidth = count * 22 + (count - 1) * 2; + + for (int c = 0; c < count - 1; c++) { + if (BeaconTileEntity::BEACON_EFFECTS[tier][c] == NULL) continue; + + int effectId = BeaconTileEntity::BEACON_EFFECTS[tier][c]->id; + int icon = BeaconTileEntity::BEACON_EFFECTS[tier][c]->getIcon(); + + bool active = true; + bool selected = false; + + if (tier >= m_beacon->getLevels()) { + active = false; + } else if (effectId == m_beacon->getSecondaryPower()) { + selected = true; + } + + AddPowerButton(GetId(tier, effectId), icon, tier, c, active, + selected); + } + if (m_beacon->getPrimaryPower() > 0) { + int effectId = m_beacon->getPrimaryPower(); + + bool active = true; + bool selected = false; + + if (tier >= m_beacon->getLevels()) { + active = false; + } else if (effectId == m_beacon->getSecondaryPower()) { + selected = true; + } + + AddPowerButton( + GetId(tier, m_beacon->getPrimaryPower()), + MobEffect::effects[m_beacon->getPrimaryPower()]->getIcon(), + tier, 1, active, selected); + } + } + } + + SetConfirmButtonEnabled((m_beacon->getItem(0) != NULL) && + (m_beacon->getPrimaryPower() > 0)); +} + +int IUIScene_BeaconMenu::GetId(int tier, int effectId) { + return (tier << 8) | effectId; +} + +std::vector* IUIScene_BeaconMenu::GetSectionHoverText( + ESceneSection eSection) { + std::vector* desc = NULL; + switch (eSection) { + case eSectionBeaconSecondaryTwo: + if (GetPowerButtonId(eSectionBeaconSecondaryTwo) == 0) { + // This isn't visible + break; + } + // Fall through otherwise + case eSectionBeaconPrimaryTierOneOne: + case eSectionBeaconPrimaryTierOneTwo: + case eSectionBeaconPrimaryTierTwoOne: + case eSectionBeaconPrimaryTierTwoTwo: + case eSectionBeaconPrimaryTierThree: + case eSectionBeaconSecondaryOne: { + int id = GetPowerButtonId(eSection); + int effectId = (id & 0xff); + + desc = new std::vector(); + + HtmlString string( + app.GetString(MobEffect::effects[effectId]->getDescriptionId()), + eHTMLColor_White); + desc->push_back(string); + } break; + default: + break; + } + return desc; +} + +bool IUIScene_BeaconMenu::IsVisible(ESceneSection eSection) { + switch (eSection) { + case eSectionBeaconSecondaryTwo: + if (GetPowerButtonId(eSectionBeaconSecondaryTwo) == 0) { + // This isn't visible + return false; + } + default: + break; + } + return true; +} diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_BeaconMenu.h b/Minecraft.Client/Platform/Common/UI/IUIScene_BeaconMenu.h new file mode 100644 index 000000000..f09bef038 --- /dev/null +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_BeaconMenu.h @@ -0,0 +1,35 @@ +#pragma once +#include "Common/UI/IUIScene_AbstractContainerMenu.h" + +class BeaconTileEntity; + +class IUIScene_BeaconMenu : public virtual IUIScene_AbstractContainerMenu { +public: + IUIScene_BeaconMenu(); + + virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection, + ETapState eTapDirection, + int* piTargetX, + int* piTargetY); + int getSectionStartOffset(ESceneSection eSection); + virtual void handleOtherClicked(int iPad, ESceneSection eSection, + int buttonNum, bool quickKey); + virtual bool IsSectionSlotList(ESceneSection eSection); + virtual std::vector* GetSectionHoverText( + ESceneSection eSection); + bool IsVisible(ESceneSection eSection); + +protected: + void handleTick(); + int GetId(int tier, int effectId); + + virtual void SetConfirmButtonEnabled(bool enabled) = 0; + virtual void AddPowerButton(int id, int icon, int tier, int count, + bool active, bool selected) = 0; + virtual int GetPowerButtonId(ESceneSection eSection) = 0; + virtual bool IsPowerButtonSelected(ESceneSection eSection) = 0; + virtual void SetPowerButtonSelected(ESceneSection eSection) = 0; + + std::shared_ptr m_beacon; + bool m_initPowerButtons; +}; diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_BrewingMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_BrewingMenu.cpp index 99bd28400..3cccef704 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_BrewingMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_BrewingMenu.cpp @@ -3,149 +3,115 @@ #include "IUIScene_BrewingMenu.h" #include "../../Minecraft.World/Headers/net.minecraft.world.inventory.h" -IUIScene_AbstractContainerMenu::ESceneSection IUIScene_BrewingMenu::GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY ) -{ - ESceneSection newSection = eSection; - int xOffset = 0; +IUIScene_AbstractContainerMenu::ESceneSection +IUIScene_BrewingMenu::GetSectionAndSlotInDirection(ESceneSection eSection, + ETapState eTapDirection, + int* piTargetX, + int* piTargetY) { + ESceneSection newSection = eSection; + int xOffset = 0; - // Find the new section if there is one - switch( eSection ) - { - case eSectionBrewingBottle1: - if(eTapDirection == eTapStateUp) - { - newSection = eSectionBrewingIngredient; - } - else if(eTapDirection == eTapStateDown) - { - newSection = eSectionBrewingInventory; - xOffset = BREWING_SCENE_BOTTLE1_SLOT_DOWN_OFFSET; - } - else if(eTapDirection == eTapStateLeft) - { - newSection = eSectionBrewingBottle3; - } - else if(eTapDirection == eTapStateRight) - { - newSection = eSectionBrewingBottle2; - } - break; - case eSectionBrewingBottle2: - if(eTapDirection == eTapStateUp) - { - newSection = eSectionBrewingIngredient; - } - else if(eTapDirection == eTapStateDown) - { - newSection = eSectionBrewingInventory; - xOffset = BREWING_SCENE_BOTTLE2_SLOT_DOWN_OFFSET; - } - else if(eTapDirection == eTapStateLeft) - { - newSection = eSectionBrewingBottle1; - } - else if(eTapDirection == eTapStateRight) - { - newSection = eSectionBrewingBottle3; - } - break; - case eSectionBrewingBottle3: - if(eTapDirection == eTapStateUp) - { - newSection = eSectionBrewingIngredient; - } - else if(eTapDirection == eTapStateDown) - { - newSection = eSectionBrewingInventory; - xOffset = BREWING_SCENE_BOTTLE3_SLOT_DOWN_OFFSET; - } - else if(eTapDirection == eTapStateLeft) - { - newSection = eSectionBrewingBottle2; - } - else if(eTapDirection == eTapStateRight) - { - newSection = eSectionBrewingBottle1; - } - break; - case eSectionBrewingIngredient: - if(eTapDirection == eTapStateUp) - { - newSection = eSectionBrewingUsing; - xOffset = BREWING_SCENE_INGREDIENT_SLOT_DOWN_OFFSET; - } - else if(eTapDirection == eTapStateDown) - { - newSection = eSectionBrewingBottle2; - } - break; - case eSectionBrewingInventory: - if(eTapDirection == eTapStateDown) - { - newSection = eSectionBrewingUsing; - } - else if(eTapDirection == eTapStateUp) - { - if( *piTargetX <= BREWING_SCENE_BOTTLE1_SLOT_UP_OFFSET) - { - newSection = eSectionBrewingBottle1; - } - else if( *piTargetX <= BREWING_SCENE_BOTTLE2_SLOT_UP_OFFSET) - { - newSection = eSectionBrewingBottle2; - } - else if( *piTargetX >= BREWING_SCENE_BOTTLE3_SLOT_UP_OFFSET) - { - newSection = eSectionBrewingBottle3; - } - } - break; - case eSectionBrewingUsing: - if(eTapDirection == eTapStateUp) - { - newSection = eSectionBrewingInventory; - } - else if(eTapDirection == eTapStateDown) - { - newSection = eSectionBrewingIngredient; - } - break; - default: - assert( false ); - break; - } + // Find the new section if there is one + switch (eSection) { + case eSectionBrewingBottle1: + if (eTapDirection == eTapStateUp) { + newSection = eSectionBrewingIngredient; + } else if (eTapDirection == eTapStateDown) { + newSection = eSectionBrewingInventory; + xOffset = BREWING_SCENE_BOTTLE1_SLOT_DOWN_OFFSET; + } else if (eTapDirection == eTapStateLeft) { + newSection = eSectionBrewingBottle3; + } else if (eTapDirection == eTapStateRight) { + newSection = eSectionBrewingBottle2; + } + break; + case eSectionBrewingBottle2: + if (eTapDirection == eTapStateUp) { + newSection = eSectionBrewingIngredient; + } else if (eTapDirection == eTapStateDown) { + newSection = eSectionBrewingInventory; + xOffset = BREWING_SCENE_BOTTLE2_SLOT_DOWN_OFFSET; + } else if (eTapDirection == eTapStateLeft) { + newSection = eSectionBrewingBottle1; + } else if (eTapDirection == eTapStateRight) { + newSection = eSectionBrewingBottle3; + } + break; + case eSectionBrewingBottle3: + if (eTapDirection == eTapStateUp) { + newSection = eSectionBrewingIngredient; + } else if (eTapDirection == eTapStateDown) { + newSection = eSectionBrewingInventory; + xOffset = BREWING_SCENE_BOTTLE3_SLOT_DOWN_OFFSET; + } else if (eTapDirection == eTapStateLeft) { + newSection = eSectionBrewingBottle2; + } else if (eTapDirection == eTapStateRight) { + newSection = eSectionBrewingBottle1; + } + break; + case eSectionBrewingIngredient: + if (eTapDirection == eTapStateUp) { + newSection = eSectionBrewingUsing; + xOffset = BREWING_SCENE_INGREDIENT_SLOT_DOWN_OFFSET; + } else if (eTapDirection == eTapStateDown) { + newSection = eSectionBrewingBottle2; + } + break; + case eSectionBrewingInventory: + if (eTapDirection == eTapStateDown) { + newSection = eSectionBrewingUsing; + } else if (eTapDirection == eTapStateUp) { + if (*piTargetX <= BREWING_SCENE_BOTTLE1_SLOT_UP_OFFSET) { + newSection = eSectionBrewingBottle1; + } else if (*piTargetX <= BREWING_SCENE_BOTTLE2_SLOT_UP_OFFSET) { + newSection = eSectionBrewingBottle2; + } else if (*piTargetX >= BREWING_SCENE_BOTTLE3_SLOT_UP_OFFSET) { + newSection = eSectionBrewingBottle3; + } + } + break; + case eSectionBrewingUsing: + if (eTapDirection == eTapStateUp) { + newSection = eSectionBrewingInventory; + } else if (eTapDirection == eTapStateDown) { + newSection = eSectionBrewingIngredient; + } + break; + default: + assert(false); + break; + } - updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, xOffset); + updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, + piTargetY, xOffset); - return newSection; + return newSection; } -int IUIScene_BrewingMenu::getSectionStartOffset(ESceneSection eSection) -{ - int offset = 0; - switch( eSection ) - { - case eSectionBrewingBottle1: - offset = BrewingStandMenu::BOTTLE_SLOT_START; - break; - case eSectionBrewingBottle2: - offset = BrewingStandMenu::BOTTLE_SLOT_START + 1; - break; - case eSectionBrewingBottle3: - offset = BrewingStandMenu::BOTTLE_SLOT_START + 2; - break; - case eSectionBrewingIngredient: - offset = BrewingStandMenu::INGREDIENT_SLOT; - break; - case eSectionBrewingInventory: - offset = BrewingStandMenu::INV_SLOT_START; - break; - case eSectionBrewingUsing: - offset = BrewingStandMenu::INV_SLOT_START + 27; - break; - default: - assert( false ); - break; - } - return offset; +int IUIScene_BrewingMenu::getSectionStartOffset(ESceneSection eSection) { + int offset = 0; + switch (eSection) { + case eSectionBrewingBottle1: + offset = BrewingStandMenu::BOTTLE_SLOT_START; + break; + case eSectionBrewingBottle2: + offset = BrewingStandMenu::BOTTLE_SLOT_START + 1; + break; + case eSectionBrewingBottle3: + offset = BrewingStandMenu::BOTTLE_SLOT_START + 2; + break; + case eSectionBrewingIngredient: + offset = BrewingStandMenu::INGREDIENT_SLOT; + break; + case eSectionBrewingInventory: + offset = BrewingStandMenu::INV_SLOT_START; + break; + case eSectionBrewingUsing: + offset = BrewingStandMenu::INV_SLOT_START + 27; + break; + default: + assert(false); + break; + } + return offset; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_BrewingMenu.h b/Minecraft.Client/Platform/Common/UI/IUIScene_BrewingMenu.h index 2d5150bb4..806910712 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_BrewingMenu.h +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_BrewingMenu.h @@ -11,9 +11,11 @@ #define BREWING_SCENE_BOTTLE3_SLOT_UP_OFFSET 5 #define BREWING_SCENE_BOTTLE3_SLOT_DOWN_OFFSET 5 -class IUIScene_BrewingMenu : public virtual IUIScene_AbstractContainerMenu -{ +class IUIScene_BrewingMenu : public virtual IUIScene_AbstractContainerMenu { protected: - virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY ); - int getSectionStartOffset(ESceneSection eSection); + virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection, + ETapState eTapDirection, + int* piTargetX, + int* piTargetY); + int getSectionStartOffset(ESceneSection eSection); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_CommandBlockMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_CommandBlockMenu.cpp new file mode 100644 index 000000000..ae5bbf32f --- /dev/null +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_CommandBlockMenu.cpp @@ -0,0 +1,25 @@ +#include "../../stdafx.h" +#include "../../../../Minecraft.World/Network/Packets/CustomPayloadPacket.h" +#include "../../../Player/MultiPlayerLocalPlayer.h" +#include "../../../Network/ClientConnection.h" +#include "IUIScene_CommandBlockMenu.h" + +void IUIScene_CommandBlockMenu::Initialise(CommandBlockEntity* commandBlock) { + m_commandBlock = commandBlock; + SetCommand(m_commandBlock->getCommand()); +} + +void IUIScene_CommandBlockMenu::ConfirmButtonClicked() { + ByteArrayOutputStream baos; + DataOutputStream dos(&baos); + + dos.writeInt(m_commandBlock->x); + dos.writeInt(m_commandBlock->y); + dos.writeInt(m_commandBlock->z); + dos.writeUTF(GetCommand()); + + Minecraft::GetInstance()->localplayers[GetPad()]->connection->send( + std::shared_ptr(new CustomPayloadPacket( + CustomPayloadPacket::SET_ADVENTURE_COMMAND_PACKET, + baos.toByteArray()))); +} diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_CommandBlockMenu.h b/Minecraft.Client/Platform/Common/UI/IUIScene_CommandBlockMenu.h new file mode 100644 index 000000000..ee6b9b295 --- /dev/null +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_CommandBlockMenu.h @@ -0,0 +1,18 @@ +#pragma once +#include "../../../../Minecraft.World/Headers/net.minecraft.world.level.tile.entity.h" + +class IUIScene_CommandBlockMenu { +public: + virtual ~IUIScene_CommandBlockMenu() = default; + void Initialise(CommandBlockEntity* commandBlock); + +protected: + void ConfirmButtonClicked(); + + virtual std::wstring GetCommand() = 0; + virtual void SetCommand(std::wstring command) = 0; + virtual int GetPad() = 0; + +private: + CommandBlockEntity* m_commandBlock; +}; diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_ContainerMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_ContainerMenu.cpp index 92bf32b93..b4201cf59 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_ContainerMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_ContainerMenu.cpp @@ -2,70 +2,62 @@ #include "IUIScene_ContainerMenu.h" #include "../../Minecraft.World/Headers/net.minecraft.world.inventory.h" -IUIScene_AbstractContainerMenu::ESceneSection IUIScene_ContainerMenu::GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY ) -{ - ESceneSection newSection = eSection; +IUIScene_AbstractContainerMenu::ESceneSection +IUIScene_ContainerMenu::GetSectionAndSlotInDirection(ESceneSection eSection, + ETapState eTapDirection, + int* piTargetX, + int* piTargetY) { + ESceneSection newSection = eSection; - // Find the new section if there is one - switch( eSection ) - { - case eSectionContainerChest: - if(eTapDirection == eTapStateDown) - { - newSection = eSectionContainerInventory; - } - else if(eTapDirection == eTapStateUp) - { - newSection = eSectionContainerUsing; - } - break; - case eSectionContainerInventory: - if(eTapDirection == eTapStateDown) - { - newSection = eSectionContainerUsing; - } - else if(eTapDirection == eTapStateUp) - { - newSection = eSectionContainerChest; - } - break; - case eSectionContainerUsing: - if(eTapDirection == eTapStateDown) - { - newSection = eSectionContainerChest; - } - else if(eTapDirection == eTapStateUp) - { - newSection = eSectionContainerInventory; - } - break; - default: - assert( false ); - break; - } + // Find the new section if there is one + switch (eSection) { + case eSectionContainerChest: + if (eTapDirection == eTapStateDown) { + newSection = eSectionContainerInventory; + } else if (eTapDirection == eTapStateUp) { + newSection = eSectionContainerUsing; + } + break; + case eSectionContainerInventory: + if (eTapDirection == eTapStateDown) { + newSection = eSectionContainerUsing; + } else if (eTapDirection == eTapStateUp) { + newSection = eSectionContainerChest; + } + break; + case eSectionContainerUsing: + if (eTapDirection == eTapStateDown) { + newSection = eSectionContainerChest; + } else if (eTapDirection == eTapStateUp) { + newSection = eSectionContainerInventory; + } + break; + default: + assert(false); + break; + } - updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, 0); + updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, + piTargetY, 0); - return newSection; + return newSection; } -int IUIScene_ContainerMenu::getSectionStartOffset(ESceneSection eSection) -{ - int offset = 0; - switch( eSection ) - { - case eSectionContainerChest: - offset = 0; - break; - case eSectionContainerInventory: - offset = m_menu->getSize() - (27+9); - break; - case eSectionContainerUsing: - offset = m_menu->getSize() - 9; - break; - default: - assert( false ); - break; - } - return offset; +int IUIScene_ContainerMenu::getSectionStartOffset(ESceneSection eSection) { + int offset = 0; + switch (eSection) { + case eSectionContainerChest: + offset = 0; + break; + case eSectionContainerInventory: + offset = m_menu->getSize() - (27 + 9); + break; + case eSectionContainerUsing: + offset = m_menu->getSize() - 9; + break; + default: + assert(false); + break; + } + return offset; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_ContainerMenu.h b/Minecraft.Client/Platform/Common/UI/IUIScene_ContainerMenu.h index e0408b390..bb9f2e8a7 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_ContainerMenu.h +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_ContainerMenu.h @@ -2,9 +2,11 @@ #include "IUIScene_AbstractContainerMenu.h" -class IUIScene_ContainerMenu : public virtual IUIScene_AbstractContainerMenu -{ +class IUIScene_ContainerMenu : public virtual IUIScene_AbstractContainerMenu { protected: - virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY ); - int getSectionStartOffset(ESceneSection eSection); + virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection, + ETapState eTapDirection, + int* piTargetX, + int* piTargetY); + int getSectionStartOffset(ESceneSection eSection); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.cpp index 60d62372c..635258901 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.cpp @@ -6,61 +6,43 @@ #include "../../Minecraft.Client/Player/LocalPlayer.h" #include "IUIScene_CraftingMenu.h" -Recipy::_eGroupType IUIScene_CraftingMenu::m_GroupTypeMapping4GridA[IUIScene_CraftingMenu::m_iMaxGroup2x2]= -{ - Recipy::eGroupType_Structure, - Recipy::eGroupType_Tool, - Recipy::eGroupType_Food, - Recipy::eGroupType_Mechanism, - Recipy::eGroupType_Transport, - Recipy::eGroupType_Decoration, +Recipy::_eGroupType IUIScene_CraftingMenu::m_GroupTypeMapping4GridA + [IUIScene_CraftingMenu::m_iMaxGroup2x2] = { + Recipy::eGroupType_Structure, Recipy::eGroupType_Tool, + Recipy::eGroupType_Food, Recipy::eGroupType_Mechanism, + Recipy::eGroupType_Transport, Recipy::eGroupType_Decoration, }; -Recipy::_eGroupType IUIScene_CraftingMenu::m_GroupTypeMapping9GridA[IUIScene_CraftingMenu::m_iMaxGroup3x3]= -{ - Recipy::eGroupType_Structure, - Recipy::eGroupType_Tool, - Recipy::eGroupType_Food, - Recipy::eGroupType_Armour, - Recipy::eGroupType_Mechanism, - Recipy::eGroupType_Transport, - Recipy::eGroupType_Decoration, +Recipy::_eGroupType IUIScene_CraftingMenu::m_GroupTypeMapping9GridA + [IUIScene_CraftingMenu::m_iMaxGroup3x3] = { + Recipy::eGroupType_Structure, Recipy::eGroupType_Tool, + Recipy::eGroupType_Food, Recipy::eGroupType_Armour, + Recipy::eGroupType_Mechanism, Recipy::eGroupType_Transport, + Recipy::eGroupType_Decoration, }; - -const wchar_t *IUIScene_CraftingMenu::m_GroupIconNameA[m_iMaxGroup3x3]= -{ - L"Structures",//Recipy::eGroupType_Structure, - L"Tools",//Recipy::eGroupType_Tool, - L"Food",//Recipy::eGroupType_Food, - L"Armour",//Recipy::eGroupType_Armour, - L"Mechanisms",//Recipy::eGroupType_Mechanism, - L"Transport",//Recipy::eGroupType_Transport, - L"Decoration",//Recipy::eGroupType_Decoration, +const wchar_t* IUIScene_CraftingMenu::m_GroupIconNameA[m_iMaxGroup3x3] = { + L"Structures", // Recipy::eGroupType_Structure, + L"Tools", // Recipy::eGroupType_Tool, + L"Food", // Recipy::eGroupType_Food, + L"Armour", // Recipy::eGroupType_Armour, + L"Mechanisms", // Recipy::eGroupType_Mechanism, + L"Transport", // Recipy::eGroupType_Transport, + L"Decoration", // Recipy::eGroupType_Decoration, }; -IUIScene_CraftingMenu::_eGroupTab IUIScene_CraftingMenu::m_GroupTabBkgMapping2x2A[m_iMaxGroup2x2]= -{ - eGroupTab_Left, - eGroupTab_Middle, - eGroupTab_Middle, - eGroupTab_Middle, - eGroupTab_Middle, - eGroupTab_Right, +IUIScene_CraftingMenu::_eGroupTab + IUIScene_CraftingMenu::m_GroupTabBkgMapping2x2A[m_iMaxGroup2x2] = { + eGroupTab_Left, eGroupTab_Middle, eGroupTab_Middle, + eGroupTab_Middle, eGroupTab_Middle, eGroupTab_Right, }; -IUIScene_CraftingMenu::_eGroupTab IUIScene_CraftingMenu::m_GroupTabBkgMapping3x3A[m_iMaxGroup3x3]= -{ - eGroupTab_Left, - eGroupTab_Middle, - eGroupTab_Middle, - eGroupTab_Middle, - eGroupTab_Middle, - eGroupTab_Middle, - eGroupTab_Right, +IUIScene_CraftingMenu::_eGroupTab + IUIScene_CraftingMenu::m_GroupTabBkgMapping3x3A[m_iMaxGroup3x3] = { + eGroupTab_Left, eGroupTab_Middle, eGroupTab_Middle, eGroupTab_Middle, + eGroupTab_Middle, eGroupTab_Middle, eGroupTab_Right, }; - // mapping array to map the base objects to their description string // This should map the enums // enum @@ -91,499 +73,535 @@ IUIScene_CraftingMenu::_eGroupTab IUIScene_CraftingMenu::m_GroupTabBkgMapping3x3 // eBaseItemType_bow, // eBaseItemType_pockettool, // eBaseItemType_utensil, -// +// // } // eBaseItemType; -IUIScene_CraftingMenu::IUIScene_CraftingMenu() -{ - m_iCurrentSlotHIndex=0; - m_iCurrentSlotVIndex=1; +IUIScene_CraftingMenu::IUIScene_CraftingMenu() { + m_iCurrentSlotHIndex = 0; + m_iCurrentSlotVIndex = 1; - for(int i=0;ilocalgameModes[getPad()] != NULL ) - { - Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial(); - if(tutorial != NULL) - { - tutorial->handleUIInput(iAction); - if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(iAction)) - { - return S_OK; - } - } - } + if (pMinecraft->localgameModes[getPad()] != NULL) { + Tutorial* tutorial = + pMinecraft->localgameModes[getPad()]->getTutorial(); + if (tutorial != NULL) { + tutorial->handleUIInput(iAction); + if (ui.IsTutorialVisible(getPad()) && + !tutorial->isInputAllowed(iAction)) { + return S_OK; + } + } + } + switch (iAction) { + case ACTION_MENU_X: - switch(iAction) - { - case ACTION_MENU_X: + // change the display + m_iDisplayDescription++; + if (m_iDisplayDescription == DISPLAY_MAX) + m_iDisplayDescription = DISPLAY_INVENTORY; + ui.PlayUISFX(eSFX_Focus); + UpdateMultiPanel(); + UpdateTooltips(); + break; + case ACTION_MENU_PAUSEMENU: + case ACTION_MENU_B: + ui.ShowTooltip(iPad, eToolTipButtonX, false); + ui.ShowTooltip(iPad, eToolTipButtonB, false); + ui.ShowTooltip(iPad, eToolTipButtonA, false); + ui.ShowTooltip(iPad, eToolTipButtonRB, false); + // kill the crafting xui + // ui.PlayUISFX(eSFX_Back); + ui.CloseUIScenes(iPad); - // change the display - m_iDisplayDescription++; - if(m_iDisplayDescription==DISPLAY_MAX) m_iDisplayDescription=DISPLAY_INVENTORY; - ui.PlayUISFX(eSFX_Focus); - UpdateMultiPanel(); - UpdateTooltips(); - break; - case ACTION_MENU_PAUSEMENU: - case ACTION_MENU_B: - ui.ShowTooltip( iPad, eToolTipButtonX, false ); - ui.ShowTooltip( iPad, eToolTipButtonB, false ); - ui.ShowTooltip( iPad, eToolTipButtonA, false ); - ui.ShowTooltip( iPad, eToolTipButtonRB, false ); - // kill the crafting xui - //ui.PlayUISFX(eSFX_Back); - ui.CloseUIScenes(iPad); - - bHandled = true; - break; - case ACTION_MENU_A: + bHandled = true; + break; + case ACTION_MENU_A: #ifdef __ORBIS__ - case ACTION_MENU_TOUCHPAD_PRESS: + case ACTION_MENU_TOUCHPAD_PRESS: #endif - // Do some crafting! - if(m_pPlayer && m_pPlayer->inventory) - { - //RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies(); - Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray(); - // Force a make if the debug is on - if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<inventory) { + // RecipyList *recipes = ((Recipes + // *)Recipes::getInstance())->getRecipies(); + Recipy::INGREDIENTS_REQUIRED* pRecipeIngredientsRequired = + Recipes::getInstance()->getRecipeIngredientsArray(); + // Force a make if the debug is on + if (app.DebugSettingsOn() && + app.GetGameSettingsDebugMask( + ProfileManager.GetPrimaryPad()) & + (1L << eDebugSetting_CraftAnything)) { + if (CanBeMadeA[m_iCurrentSlotHIndex].iCount != 0) { + int iSlot = iVSlotIndexA[m_iCurrentSlotVIndex]; - int iRecipe= CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]; - std::shared_ptr pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); - //int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); + int iRecipe = + CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]; + std::shared_ptr pTempItemInst = + pRecipeIngredientsRequired[iRecipe] + .pRecipy->assemble(nullptr); + // int + // iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); - if( pMinecraft->localgameModes[iPad] != NULL) - { - Tutorial *tutorial = pMinecraft->localgameModes[iPad]->getTutorial(); - if(tutorial != NULL) - { - tutorial->onCrafted(pTempItemInst); - } - } + if (pMinecraft->localgameModes[iPad] != NULL) { + Tutorial* tutorial = + pMinecraft->localgameModes[iPad]->getTutorial(); + if (tutorial != NULL) { + tutorial->onCrafted(pTempItemInst); + } + } - pMinecraft->localgameModes[iPad]->handleCraftItem(iRecipe,m_pPlayer); + pMinecraft->localgameModes[iPad]->handleCraftItem( + iRecipe, m_pPlayer); - if(m_pPlayer->inventory->add(pTempItemInst)==false) - { - // no room in inventory, so throw it down - m_pPlayer->drop(pTempItemInst); - } - // play a sound - //pMinecraft->soundEngine->playUI( L"random.pop", 1.0f, 1.0f); - ui.PlayUISFX(eSFX_Craft); - } - } - else if(CanBeMadeA[m_iCurrentSlotHIndex].iCount!=0) - { - int iSlot; - if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1) - { - iSlot=iVSlotIndexA[m_iCurrentSlotVIndex]; - } - else - { - iSlot=0; - } - int iRecipe= CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]; - std::shared_ptr pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); - //int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); + if (m_pPlayer->inventory->add(pTempItemInst) == false) { + // no room in inventory, so throw it down + m_pPlayer->drop(pTempItemInst); + } + // play a sound + // pMinecraft->soundEngine->playUI( + // L"random.pop", 1.0f, 1.0f); + ui.PlayUISFX(eSFX_Craft); + } + } else if (CanBeMadeA[m_iCurrentSlotHIndex].iCount != 0) { + int iSlot; + if (CanBeMadeA[m_iCurrentSlotHIndex].iCount > 1) { + iSlot = iVSlotIndexA[m_iCurrentSlotVIndex]; + } else { + iSlot = 0; + } + int iRecipe = + CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]; + std::shared_ptr pTempItemInst = + pRecipeIngredientsRequired[iRecipe].pRecipy->assemble( + nullptr); + // int + // iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); - if( pMinecraft->localgameModes[iPad] != NULL ) - { - Tutorial *tutorial = pMinecraft->localgameModes[iPad]->getTutorial(); - if(tutorial != NULL) - { - tutorial->createItemSelected(pTempItemInst, pRecipeIngredientsRequired[iRecipe].bCanMake[iPad]); - } - } + if (pMinecraft->localgameModes[iPad] != NULL) { + Tutorial* tutorial = + pMinecraft->localgameModes[iPad]->getTutorial(); + if (tutorial != NULL) { + tutorial->createItemSelected( + pTempItemInst, + pRecipeIngredientsRequired[iRecipe] + .bCanMake[iPad]); + } + } - if(pRecipeIngredientsRequired[iRecipe].bCanMake[iPad]) - { - pTempItemInst->onCraftedBy(m_pPlayer->level, std::dynamic_pointer_cast( m_pPlayer->shared_from_this() ), pTempItemInst->count ); - // TODO 4J Stu - handleCraftItem should do a lot more than what it does, loads of the "can we craft" code should also probably be - // shifted to the GameMode - pMinecraft->localgameModes[iPad]->handleCraftItem(iRecipe,m_pPlayer); + if (pRecipeIngredientsRequired[iRecipe].bCanMake[iPad]) { + pTempItemInst->onCraftedBy( + m_pPlayer->level, + std::dynamic_pointer_cast( + m_pPlayer->shared_from_this()), + pTempItemInst->count); + // TODO 4J Stu - handleCraftItem should do a lot more + // than what it does, loads of the "can we craft" code + // should also probably be shifted to the GameMode + pMinecraft->localgameModes[iPad]->handleCraftItem( + iRecipe, m_pPlayer); - // play a sound - //pMinecraft->soundEngine->playUI( L"random.pop", 1.0f, 1.0f); - ui.PlayUISFX(eSFX_Craft); + // play a sound + // pMinecraft->soundEngine->playUI( + // L"random.pop", 1.0f, 1.0f); + ui.PlayUISFX(eSFX_Craft); - // and remove those resources from your inventory - for(int i=0;i ingItemInst = nullptr; - // do we need to remove a specific aux value? - if(pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i]!=Recipes::ANY_AUX_VALUE) - { - ingItemInst = m_pPlayer->inventory->getResourceItem( pRecipeIngredientsRequired[iRecipe].iIngIDA[i],pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i] ); - m_pPlayer->inventory->removeResource(pRecipeIngredientsRequired[iRecipe].iIngIDA[i],pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i]); - } - else - { - ingItemInst = m_pPlayer->inventory->getResourceItem( pRecipeIngredientsRequired[iRecipe].iIngIDA[i] ); - m_pPlayer->inventory->removeResource(pRecipeIngredientsRequired[iRecipe].iIngIDA[i]); - } + if (pTempItemInst->id != Item::fireworksCharge_Id && + pTempItemInst->id != Item::fireworks_Id) { + // and remove those resources from your inventory + for (int i = 0; + i < pRecipeIngredientsRequired[iRecipe].iIngC; + i++) { + for (int j = 0; + j < pRecipeIngredientsRequired[iRecipe] + .iIngValA[i]; + j++) { + std::shared_ptr ingItemInst = + nullptr; + // do we need to remove a specific aux + // value? + if (pRecipeIngredientsRequired[iRecipe] + .iIngAuxValA[i] != + Recipes::ANY_AUX_VALUE) { + ingItemInst = + m_pPlayer->inventory + ->getResourceItem( + pRecipeIngredientsRequired + [iRecipe] + .iIngIDA[i], + pRecipeIngredientsRequired + [iRecipe] + .iIngAuxValA[i]); + m_pPlayer->inventory->removeResource( + pRecipeIngredientsRequired[iRecipe] + .iIngIDA[i], + pRecipeIngredientsRequired[iRecipe] + .iIngAuxValA[i]); + } else { + ingItemInst = + m_pPlayer->inventory + ->getResourceItem( + pRecipeIngredientsRequired + [iRecipe] + .iIngIDA[i]); + m_pPlayer->inventory->removeResource( + pRecipeIngredientsRequired[iRecipe] + .iIngIDA[i]); + } - // 4J Stu - Fix for #13097 - Bug: Milk Buckets are removed when crafting Cake - if (ingItemInst != NULL) - { - if (ingItemInst->getItem()->hasCraftingRemainingItem()) - { - // replace item with remaining result - m_pPlayer->inventory->add( std::shared_ptr( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) ); - } + // 4J Stu - Fix for #13097 - Bug: Milk + // Buckets are removed when crafting Cake + if (ingItemInst != NULL) { + if (ingItemInst->getItem() + ->hasCraftingRemainingItem()) { + // replace item with remaining + // result + m_pPlayer->inventory->add( + std::shared_ptr< + ItemInstance>(new ItemInstance( + ingItemInst->getItem() + ->getCraftingRemainingItem()))); + } + } + } + } - } - } - } + // 4J Stu - Fix for #13119 - We should add the item + // after we remove the ingredients + if (m_pPlayer->inventory->add(pTempItemInst) == + false) { + // no room in inventory, so throw it down + m_pPlayer->drop(pTempItemInst); + } - // 4J Stu - Fix for #13119 - We should add the item after we remove the ingredients - if(m_pPlayer->inventory->add(pTempItemInst)==false ) - { - // no room in inventory, so throw it down - m_pPlayer->drop(pTempItemInst); - } + // 4J Gordon: Achievements + switch (pTempItemInst->id) { + case Tile::workBench_Id: + m_pPlayer->awardStat( + GenericStats::buildWorkbench(), + GenericStats::param_buildWorkbench()); + break; + case Item::pickAxe_wood_Id: + m_pPlayer->awardStat( + GenericStats::buildPickaxe(), + GenericStats::param_buildPickaxe()); + break; + case Tile::furnace_Id: + m_pPlayer->awardStat( + GenericStats::buildFurnace(), + GenericStats::param_buildFurnace()); + break; + case Item::hoe_wood_Id: + m_pPlayer->awardStat( + GenericStats::buildHoe(), + GenericStats::param_buildHoe()); + break; + case Item::bread_Id: + m_pPlayer->awardStat( + GenericStats::makeBread(), + GenericStats::param_makeBread()); + break; + case Item::cake_Id: + m_pPlayer->awardStat( + GenericStats::bakeCake(), + GenericStats::param_bakeCake()); + break; + case Item::pickAxe_stone_Id: + m_pPlayer->awardStat( + GenericStats::buildBetterPickaxe(), + GenericStats:: + param_buildBetterPickaxe()); + break; + case Item::sword_wood_Id: + m_pPlayer->awardStat( + GenericStats::buildSword(), + GenericStats::param_buildSword()); + break; + case Tile::dispenser_Id: + m_pPlayer->awardStat( + GenericStats::dispenseWithThis(), + GenericStats::param_dispenseWithThis()); + break; + case Tile::enchantTable_Id: + m_pPlayer->awardStat( + GenericStats::enchantments(), + GenericStats::param_enchantments()); + break; + case Tile::bookshelf_Id: + m_pPlayer->awardStat( + GenericStats::bookcase(), + GenericStats::param_bookcase()); + break; + } - //4J Gordon: Achievements - switch(pTempItemInst->id ) - { - case Tile::workBench_Id: m_pPlayer->awardStat(GenericStats::buildWorkbench(), GenericStats::param_buildWorkbench()); break; - case Item::pickAxe_wood_Id: m_pPlayer->awardStat(GenericStats::buildPickaxe(), GenericStats::param_buildPickaxe()); break; - case Tile::furnace_Id: m_pPlayer->awardStat(GenericStats::buildFurnace(), GenericStats::param_buildFurnace()); break; - case Item::hoe_wood_Id: m_pPlayer->awardStat(GenericStats::buildHoe(), GenericStats::param_buildHoe()); break; - case Item::bread_Id: m_pPlayer->awardStat(GenericStats::makeBread(), GenericStats::param_makeBread()); break; - case Item::cake_Id: m_pPlayer->awardStat(GenericStats::bakeCake(), GenericStats::param_bakeCake()); break; - case Item::pickAxe_stone_Id: m_pPlayer->awardStat(GenericStats::buildBetterPickaxe(), GenericStats::param_buildBetterPickaxe()); break; - case Item::sword_wood_Id: m_pPlayer->awardStat(GenericStats::buildSword(), GenericStats::param_buildSword()); break; - case Tile::dispenser_Id: m_pPlayer->awardStat(GenericStats::dispenseWithThis(), GenericStats::param_dispenseWithThis()); break; - case Tile::enchantTable_Id: m_pPlayer->awardStat(GenericStats::enchantments(), GenericStats::param_enchantments()); break; - case Tile::bookshelf_Id: m_pPlayer->awardStat(GenericStats::bookcase(), GenericStats::param_bookcase()); break; - } + // We've used some ingredients from our inventory, + // so update the recipes we can make + CheckRecipesAvailable(); + // don't reset the vertical slots - we want to stay + // where we are + UpdateVerticalSlots(); + UpdateHighlight(); + } + } else { + // pMinecraft->soundEngine->playUI( + // L"btn.back", 1.0f, 1.0f); + ui.PlayUISFX(eSFX_CraftFail); + } + } + } + break; - // We've used some ingredients from our inventory, so update the recipes we can make - CheckRecipesAvailable(); - // don't reset the vertical slots - we want to stay where we are - UpdateVerticalSlots(); - UpdateHighlight(); - } - else - { - //pMinecraft->soundEngine->playUI( L"btn.back", 1.0f, 1.0f); - ui.PlayUISFX(eSFX_CraftFail); - } - } - } - break; + case ACTION_MENU_LEFT_SCROLL: + // turn off the old group tab + showTabHighlight(m_iGroupIndex, false); - case ACTION_MENU_LEFT_SCROLL: - // turn off the old group tab - showTabHighlight(m_iGroupIndex,false); + if (m_iGroupIndex == 0) { + if (m_iContainerType == RECIPE_TYPE_3x3) { + m_iGroupIndex = m_iMaxGroup3x3 - 1; + } else { + m_iGroupIndex = m_iMaxGroup2x2 - 1; + } + } else { + m_iGroupIndex--; + } + // turn on the new group + showTabHighlight(m_iGroupIndex, true); - if(m_iGroupIndex==0) - { - if(m_iContainerType==RECIPE_TYPE_3x3) - { - m_iGroupIndex=m_iMaxGroup3x3-1; - } - else - { - m_iGroupIndex=m_iMaxGroup2x2-1; - } - } - else - { - m_iGroupIndex--; - } - // turn on the new group - showTabHighlight(m_iGroupIndex,true); + m_iCurrentSlotHIndex = 0; + m_iCurrentSlotVIndex = 1; - m_iCurrentSlotHIndex=0; - m_iCurrentSlotVIndex=1; + CheckRecipesAvailable(); + // reset the vertical slots + iVSlotIndexA[0] = CanBeMadeA[m_iCurrentSlotHIndex].iCount - 1; + iVSlotIndexA[1] = 0; + iVSlotIndexA[2] = 1; + ui.PlayUISFX(eSFX_Focus); + UpdateVerticalSlots(); + UpdateHighlight(); + setGroupText(GetGroupNameText(m_pGroupA[m_iGroupIndex])); - CheckRecipesAvailable(); - // reset the vertical slots - iVSlotIndexA[0]=CanBeMadeA[m_iCurrentSlotHIndex].iCount-1; - iVSlotIndexA[1]=0; - iVSlotIndexA[2]=1; - ui.PlayUISFX(eSFX_Focus); - UpdateVerticalSlots(); - UpdateHighlight(); - setGroupText(GetGroupNameText(m_pGroupA[m_iGroupIndex])); + break; + case ACTION_MENU_RIGHT_SCROLL: + // turn off the old group tab + showTabHighlight(m_iGroupIndex, false); - break; - case ACTION_MENU_RIGHT_SCROLL: - // turn off the old group tab - showTabHighlight(m_iGroupIndex,false); + m_iGroupIndex++; + if (m_iContainerType == RECIPE_TYPE_3x3) { + if (m_iGroupIndex == m_iMaxGroup3x3) m_iGroupIndex = 0; + } else { + if (m_iGroupIndex == m_iMaxGroup2x2) m_iGroupIndex = 0; + } + // turn on the new group + showTabHighlight(m_iGroupIndex, true); - m_iGroupIndex++; - if(m_iContainerType==RECIPE_TYPE_3x3) - { - if(m_iGroupIndex==m_iMaxGroup3x3) m_iGroupIndex=0; - } - else - { - if(m_iGroupIndex==m_iMaxGroup2x2) m_iGroupIndex=0; - } - // turn on the new group - showTabHighlight(m_iGroupIndex,true); + m_iCurrentSlotHIndex = 0; + m_iCurrentSlotVIndex = 1; + CheckRecipesAvailable(); + // reset the vertical slots + iVSlotIndexA[0] = CanBeMadeA[m_iCurrentSlotHIndex].iCount - 1; + iVSlotIndexA[1] = 0; + iVSlotIndexA[2] = 1; + ui.PlayUISFX(eSFX_Focus); + UpdateVerticalSlots(); + UpdateHighlight(); + setGroupText(GetGroupNameText(m_pGroupA[m_iGroupIndex])); + break; + } - m_iCurrentSlotHIndex=0; - m_iCurrentSlotVIndex=1; - CheckRecipesAvailable(); - // reset the vertical slots - iVSlotIndexA[0]=CanBeMadeA[m_iCurrentSlotHIndex].iCount-1; - iVSlotIndexA[1]=0; - iVSlotIndexA[2]=1; - ui.PlayUISFX(eSFX_Focus); - UpdateVerticalSlots(); - UpdateHighlight(); - setGroupText(GetGroupNameText(m_pGroupA[m_iGroupIndex])); - break; - } - - // 4J-Tomk - check if we've only got one vertical scroll slot (480, splits & Vita) - bool bNoScrollSlots = false; - if(m_bSplitscreen ||(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())) - { - bNoScrollSlots = true; - } + // 4J-Tomk - check if we've only got one vertical scroll slot (480, splits & + // Vita) + bool bNoScrollSlots = false; + if (m_bSplitscreen || + (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())) { + bNoScrollSlots = true; + } #ifdef __PSVITA__ - bNoScrollSlots = true; + bNoScrollSlots = true; #endif - // 4J Stu - We did used to swap the thumsticks based on Southpaw in this scene, but ONLY in this scene - switch(iAction) - { - case ACTION_MENU_OTHER_STICK_UP: - scrollDescriptionUp(); - break; - case ACTION_MENU_OTHER_STICK_DOWN: - scrollDescriptionDown(); - break; - case ACTION_MENU_RIGHT: - { - int iOldHSlot=m_iCurrentSlotHIndex; + // 4J Stu - We did used to swap the thumsticks based on Southpaw in this + // scene, but ONLY in this scene + switch (iAction) { + case ACTION_MENU_OTHER_STICK_UP: + scrollDescriptionUp(); + break; + case ACTION_MENU_OTHER_STICK_DOWN: + scrollDescriptionDown(); + break; + case ACTION_MENU_RIGHT: { + int iOldHSlot = m_iCurrentSlotHIndex; - m_iCurrentSlotHIndex++; - if(m_iCurrentSlotHIndex>=m_iCraftablesMaxHSlotC) m_iCurrentSlotHIndex=0; - m_iCurrentSlotVIndex=1; - // clear the indices - iVSlotIndexA[0]=CanBeMadeA[m_iCurrentSlotHIndex].iCount-1; - iVSlotIndexA[1]=0; - iVSlotIndexA[2]=1; + m_iCurrentSlotHIndex++; + if (m_iCurrentSlotHIndex >= m_iCraftablesMaxHSlotC) + m_iCurrentSlotHIndex = 0; + m_iCurrentSlotVIndex = 1; + // clear the indices + iVSlotIndexA[0] = CanBeMadeA[m_iCurrentSlotHIndex].iCount - 1; + iVSlotIndexA[1] = 0; + iVSlotIndexA[2] = 1; - UpdateVerticalSlots(); - UpdateHighlight(); - // re-enable the old hslot - if(CanBeMadeA[iOldHSlot].iCount>0) - { - setShowCraftHSlot(iOldHSlot,true); - } - ui.PlayUISFX(eSFX_Focus); - bHandled = true; - } - break; - case ACTION_MENU_LEFT: - { - if(m_iCraftablesMaxHSlotC!=0) - { - int iOldHSlot=m_iCurrentSlotHIndex; - if(m_iCurrentSlotHIndex==0) m_iCurrentSlotHIndex=m_iCraftablesMaxHSlotC-1; - else m_iCurrentSlotHIndex--; - m_iCurrentSlotVIndex=1; - // clear the indices - iVSlotIndexA[0]=CanBeMadeA[m_iCurrentSlotHIndex].iCount-1; - iVSlotIndexA[1]=0; - iVSlotIndexA[2]=1; + UpdateVerticalSlots(); + UpdateHighlight(); + // re-enable the old hslot + if (CanBeMadeA[iOldHSlot].iCount > 0) { + setShowCraftHSlot(iOldHSlot, true); + } + ui.PlayUISFX(eSFX_Focus); + bHandled = true; + } break; + case ACTION_MENU_LEFT: { + if (m_iCraftablesMaxHSlotC != 0) { + int iOldHSlot = m_iCurrentSlotHIndex; + if (m_iCurrentSlotHIndex == 0) + m_iCurrentSlotHIndex = m_iCraftablesMaxHSlotC - 1; + else + m_iCurrentSlotHIndex--; + m_iCurrentSlotVIndex = 1; + // clear the indices + iVSlotIndexA[0] = CanBeMadeA[m_iCurrentSlotHIndex].iCount - 1; + iVSlotIndexA[1] = 0; + iVSlotIndexA[2] = 1; - UpdateVerticalSlots(); - UpdateHighlight(); - // re-enable the old hslot - if(CanBeMadeA[iOldHSlot].iCount>0) - { - setShowCraftHSlot(iOldHSlot,true); - } - ui.PlayUISFX(eSFX_Focus); - } - bHandled = true; - } - break; - case ACTION_MENU_UP: - { - if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1) - { - if(bNoScrollSlots) - { - if(iVSlotIndexA[1]==0) - { - iVSlotIndexA[1]=CanBeMadeA[m_iCurrentSlotHIndex].iCount-1; - } - else - { - iVSlotIndexA[1]--; - } - ui.PlayUISFX(eSFX_Focus); - } - else - if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>2) - { - { - if(m_iCurrentSlotVIndex!=0) - { - // just move the highlight - m_iCurrentSlotVIndex--; - ui.PlayUISFX(eSFX_Focus); - } - else - { - //move the slots - iVSlotIndexA[2]=iVSlotIndexA[1]; - iVSlotIndexA[1]=iVSlotIndexA[0]; - // on 0 and went up, so cycle the values - if(iVSlotIndexA[0]==0) - { - iVSlotIndexA[0]=CanBeMadeA[m_iCurrentSlotHIndex].iCount-1; - } - else - { - iVSlotIndexA[0]--; - } - ui.PlayUISFX(eSFX_Focus); - } - } - } - else - { - if(m_iCurrentSlotVIndex!=1) - { - // just move the highlight - m_iCurrentSlotVIndex--; - ui.PlayUISFX(eSFX_Focus); - } - } - UpdateVerticalSlots(); - UpdateHighlight(); - } + UpdateVerticalSlots(); + UpdateHighlight(); + // re-enable the old hslot + if (CanBeMadeA[iOldHSlot].iCount > 0) { + setShowCraftHSlot(iOldHSlot, true); + } + ui.PlayUISFX(eSFX_Focus); + } + bHandled = true; + } break; + case ACTION_MENU_UP: { + if (CanBeMadeA[m_iCurrentSlotHIndex].iCount > 1) { + if (bNoScrollSlots) { + if (iVSlotIndexA[1] == 0) { + iVSlotIndexA[1] = + CanBeMadeA[m_iCurrentSlotHIndex].iCount - 1; + } else { + iVSlotIndexA[1]--; + } + ui.PlayUISFX(eSFX_Focus); + } else if (CanBeMadeA[m_iCurrentSlotHIndex].iCount > 2) { + { + if (m_iCurrentSlotVIndex != 0) { + // just move the highlight + m_iCurrentSlotVIndex--; + ui.PlayUISFX(eSFX_Focus); + } else { + // move the slots + iVSlotIndexA[2] = iVSlotIndexA[1]; + iVSlotIndexA[1] = iVSlotIndexA[0]; + // on 0 and went up, so cycle the values + if (iVSlotIndexA[0] == 0) { + iVSlotIndexA[0] = + CanBeMadeA[m_iCurrentSlotHIndex].iCount - 1; + } else { + iVSlotIndexA[0]--; + } + ui.PlayUISFX(eSFX_Focus); + } + } + } else { + if (m_iCurrentSlotVIndex != 1) { + // just move the highlight + m_iCurrentSlotVIndex--; + ui.PlayUISFX(eSFX_Focus); + } + } + UpdateVerticalSlots(); + UpdateHighlight(); + } - } - break; - case ACTION_MENU_DOWN: - { - if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1) - { - if(bNoScrollSlots) - { - if(iVSlotIndexA[1]==(CanBeMadeA[m_iCurrentSlotHIndex].iCount-1)) - { - iVSlotIndexA[1]=0; - } - else - { - iVSlotIndexA[1]++; - } - ui.PlayUISFX(eSFX_Focus); + } break; + case ACTION_MENU_DOWN: { + if (CanBeMadeA[m_iCurrentSlotHIndex].iCount > 1) { + if (bNoScrollSlots) { + if (iVSlotIndexA[1] == + (CanBeMadeA[m_iCurrentSlotHIndex].iCount - 1)) { + iVSlotIndexA[1] = 0; + } else { + iVSlotIndexA[1]++; + } + ui.PlayUISFX(eSFX_Focus); - } - else - if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>2) - { - if(m_iCurrentSlotVIndex!=2) - { - m_iCurrentSlotVIndex++; - ui.PlayUISFX(eSFX_Focus); - } - else - { - iVSlotIndexA[0]=iVSlotIndexA[1]; - iVSlotIndexA[1]=iVSlotIndexA[2]; - if(iVSlotIndexA[m_iCurrentSlotVIndex]==(CanBeMadeA[m_iCurrentSlotHIndex].iCount-1)) - { - iVSlotIndexA[2]=0; - } - else - { - iVSlotIndexA[2]++; - } - ui.PlayUISFX(eSFX_Focus); - } - } - else - { - if(m_iCurrentSlotVIndex!=(CanBeMadeA[m_iCurrentSlotHIndex].iCount)) - { - m_iCurrentSlotVIndex++; - ui.PlayUISFX(eSFX_Focus); - } - } - UpdateVerticalSlots(); - UpdateHighlight(); - } - } - break; - } + } else if (CanBeMadeA[m_iCurrentSlotHIndex].iCount > 2) { + if (m_iCurrentSlotVIndex != 2) { + m_iCurrentSlotVIndex++; + ui.PlayUISFX(eSFX_Focus); + } else { + iVSlotIndexA[0] = iVSlotIndexA[1]; + iVSlotIndexA[1] = iVSlotIndexA[2]; + if (iVSlotIndexA[m_iCurrentSlotVIndex] == + (CanBeMadeA[m_iCurrentSlotHIndex].iCount - 1)) { + iVSlotIndexA[2] = 0; + } else { + iVSlotIndexA[2]++; + } + ui.PlayUISFX(eSFX_Focus); + } + } else { + if (m_iCurrentSlotVIndex != + (CanBeMadeA[m_iCurrentSlotHIndex].iCount)) { + m_iCurrentSlotVIndex++; + ui.PlayUISFX(eSFX_Focus); + } + } + UpdateVerticalSlots(); + UpdateHighlight(); + } + } break; + } - return bHandled; + return bHandled; } ////////////////////////////////////////////////////////////////////////// @@ -591,293 +609,319 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) // CheckRecipesAvailable // ////////////////////////////////////////////////////////////////////////// -void IUIScene_CraftingMenu::CheckRecipesAvailable() -{ - int iHSlotBrushControl=0; +void IUIScene_CraftingMenu::CheckRecipesAvailable() { + int iHSlotBrushControl = 0; - // clear the current list - memset(CanBeMadeA,0,sizeof(CANBEMADE)*m_iCraftablesMaxHSlotC); + // clear the current list + memset(CanBeMadeA, 0, sizeof(CANBEMADE) * m_iCraftablesMaxHSlotC); - hideAllHSlots(); + hideAllHSlots(); - if(m_pPlayer && m_pPlayer->inventory) - { - // dump out the inventory - /* for (unsigned int k = 0; k < m_pPlayer->inventory->items.length; k++) - { - if (m_pPlayer->inventory->items[k] != NULL) - { - std::wstring itemstring=m_pPlayer->inventory->items[k]->toString(); + if (m_pPlayer && m_pPlayer->inventory) { + // dump out the inventory + /* for (unsigned int k = 0; k < + m_pPlayer->inventory->items.length; k++) + { + if (m_pPlayer->inventory->items[k] != NULL) + { + std::wstring itemstring=m_pPlayer->inventory->items[k]->toString(); - //printf("--- Player has "); - OutputDebugStringW(itemstring.c_str()); - //printf(" with Aux val = %d, base type = %d, Material = %d\n",m_pPlayer->inventory->items[k]->getAuxValue(),m_pPlayer->inventory->items[k]->getItem()->getBaseItemType(),m_pPlayer->inventory->items[k]->getItem()->getMaterial()); - } - } - */ - RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies(); - Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray(); - int iRecipeC=(int)recipes->size(); - AUTO_VAR(itRecipe, recipes->begin()); + //printf("--- Player has "); + OutputDebugStringW(itemstring.c_str()); + //printf(" with Aux val = %d, base type = %d, Material = + %d\n",m_pPlayer->inventory->items[k]->getAuxValue(),m_pPlayer->inventory->items[k]->getItem()->getBaseItemType(),m_pPlayer->inventory->items[k]->getItem()->getMaterial()); + } + } + */ + RecipyList* recipes = ((Recipes*)Recipes::getInstance())->getRecipies(); + Recipy::INGREDIENTS_REQUIRED* pRecipeIngredientsRequired = + Recipes::getInstance()->getRecipeIngredientsArray(); + int iRecipeC = (int)recipes->size(); + AUTO_VAR(itRecipe, recipes->begin()); - // dump out the recipe products + // dump out the recipe products - // for (int i = 0; i < iRecipeC; i++) - // { - // std::shared_ptr pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(NULL); - // if (pTempItemInst != NULL) - // { - // std::wstring itemstring=pTempItemInst->toString(); - // - // printf("Recipe [%d] = ",i); - // OutputDebugStringW(itemstring.c_str()); - // if(pTempItemInst->id!=0) - // { - // if(pTempItemInst->id<256) - // { - // Tile *pTile=Tile::tiles[pTempItemInst->id]; - // printf("[TILE] ID\t%d\tAux val\t%d\tBase type\t%d\tMaterial\t%d\t Count=%d\n",pTempItemInst->id, pTempItemInst->getAuxValue(),pTile->getBaseItemType(),pTile->getMaterial(),pTempItemInst->GetCount()); - // } - // else - // { - // printf("ID\t%d\tAux val\t%d\tBase type\t%d\tMaterial\t%d Count=%d\n",pTempItemInst->id, pTempItemInst->getAuxValue(),pTempItemInst->getItem()->getBaseItemType(),pTempItemInst->getItem()->getMaterial(),pTempItemInst->GetCount()); - // } - // - // } - // } - // } + // for (int i = 0; i < iRecipeC; i++) + // { + // std::shared_ptr + // pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(NULL); + // if (pTempItemInst != NULL) + // { + // std::wstring + // itemstring=pTempItemInst->toString(); + // + // printf("Recipe [%d] = ",i); + // OutputDebugStringW(itemstring.c_str()); + // if(pTempItemInst->id!=0) + // { + // if(pTempItemInst->id<256) + // { + // Tile + // *pTile=Tile::tiles[pTempItemInst->id]; printf("[TILE] ID\t%d\tAux + // val\t%d\tBase type\t%d\tMaterial\t%d\t Count=%d\n",pTempItemInst->id, + // pTempItemInst->getAuxValue(),pTile->getBaseItemType(),pTile->getMaterial(),pTempItemInst->GetCount()); + // } + // else + // { + // printf("ID\t%d\tAux + // val\t%d\tBase type\t%d\tMaterial\t%d Count=%d\n",pTempItemInst->id, + // pTempItemInst->getAuxValue(),pTempItemInst->getItem()->getBaseItemType(),pTempItemInst->getItem()->getMaterial(),pTempItemInst->GetCount()); + // } + // + // } + // } + // } - for(int i=0;igetGroup() != m_pGroupA[m_iGroupIndex]) { + itRecipe++; + pRecipeIngredientsRequired[i].bCanMake[getPad()] = false; + continue; + } + // if we are in the inventory menu, then we have 2x2 crafting + // available only + if ((m_iContainerType == RECIPE_TYPE_2x2) && + (pRecipeIngredientsRequired[i].iType == RECIPE_TYPE_3x3)) { + // need a crafting table for this recipe + itRecipe++; + pRecipeIngredientsRequired[i].bCanMake[getPad()] = false; + continue; + } + // clear the mask showing which ingredients are missing + pRecipeIngredientsRequired[i] + .usBitmaskMissingGridIngredients[getPad()] = 0; - // If this recipe isn't in the current grouptype, skip it - if(r->getGroup()!=m_pGroupA[m_iGroupIndex]) - { - itRecipe++; - pRecipeIngredientsRequired[i].bCanMake[getPad()]=false; - continue; - } - // if we are in the inventory menu, then we have 2x2 crafting available only - if((m_iContainerType==RECIPE_TYPE_2x2) && (pRecipeIngredientsRequired[i].iType==RECIPE_TYPE_3x3)) - { - // need a crafting table for this recipe - itRecipe++; - pRecipeIngredientsRequired[i].bCanMake[getPad()]=false; - continue; - } - // clear the mask showing which ingredients are missing - pRecipeIngredientsRequired[i].usBitmaskMissingGridIngredients[getPad()]=0; + // bool bCanMakeRecipe=true; + bool* bFoundA = new bool[pRecipeIngredientsRequired[i].iIngC]; + for (int j = 0; j < pRecipeIngredientsRequired[i].iIngC; j++) { + bFoundA[j] = false; + int iTotalCount = 0; - //bool bCanMakeRecipe=true; - bool *bFoundA= new bool [pRecipeIngredientsRequired[i].iIngC]; - for(int j=0;jinventory->items.length; + k++) { + if (m_pPlayer->inventory->items[k] != NULL) { + // do they have the ingredient, and the aux value + // matches, and enough off it? + if ((m_pPlayer->inventory->items[k]->id == + pRecipeIngredientsRequired[i].iIngIDA[j]) && + // check if the ingredient required doesn't care + // about the aux value, or if it does, does the + // inventory item aux match it + ((pRecipeIngredientsRequired[i].iIngAuxValA[j] == + Recipes::ANY_AUX_VALUE) || + (pRecipeIngredientsRequired[i].iIngAuxValA[j] == + m_pPlayer->inventory->items[k]->getAuxValue()))) { + // do they have enough? We need to check the whole + // inventory, since they may have enough in + // different slots (milk isn't milkx3, but + // milk,milk,milk) + if (m_pPlayer->inventory->items[k]->GetCount() >= + pRecipeIngredientsRequired[i].iIngValA[j]) { + // they have enough with one slot + bFoundA[j] = true; + } else { + // look at the combined value from the whole + // inventory - // Does the player have this ingredient? - for (unsigned int k = 0; k < m_pPlayer->inventory->items.length; k++) - { - if (m_pPlayer->inventory->items[k] != NULL) - { - // do they have the ingredient, and the aux value matches, and enough off it? - if((m_pPlayer->inventory->items[k]->id == pRecipeIngredientsRequired[i].iIngIDA[j]) && - // check if the ingredient required doesn't care about the aux value, or if it does, does the inventory item aux match it - ((pRecipeIngredientsRequired[i].iIngAuxValA[j]==Recipes::ANY_AUX_VALUE) || (pRecipeIngredientsRequired[i].iIngAuxValA[j]==m_pPlayer->inventory->items[k]->getAuxValue())) - ) - { - // do they have enough? We need to check the whole inventory, since they may have enough in different slots (milk isn't milkx3, but milk,milk,milk) - if(m_pPlayer->inventory->items[k]->GetCount()>=pRecipeIngredientsRequired[i].iIngValA[j]) - { - // they have enough with one slot - bFoundA[j]=true; - } - else - { - // look at the combined value from the whole inventory + for (unsigned int l = 0; + l < m_pPlayer->inventory->items.length; + l++) { + if (m_pPlayer->inventory->items[l] != + NULL) { + if ((m_pPlayer->inventory->items[l] + ->id == + pRecipeIngredientsRequired[i] + .iIngIDA[j]) && + ((pRecipeIngredientsRequired[i] + .iIngAuxValA[j] == + Recipes::ANY_AUX_VALUE) || + (pRecipeIngredientsRequired[i] + .iIngAuxValA[j] == + m_pPlayer->inventory->items[l] + ->getAuxValue()))) { + iTotalCount += + m_pPlayer->inventory->items[l] + ->GetCount(); + } + } + } - for(unsigned int l=0;linventory->items.length;l++) - { - if (m_pPlayer->inventory->items[l] != NULL) - { - if( - (m_pPlayer->inventory->items[l]->id == pRecipeIngredientsRequired[i].iIngIDA[j]) && - ( (pRecipeIngredientsRequired[i].iIngAuxValA[j]==Recipes::ANY_AUX_VALUE) || (pRecipeIngredientsRequired[i].iIngAuxValA[j]==m_pPlayer->inventory->items[l]->getAuxValue() )) - ) - { - iTotalCount+=m_pPlayer->inventory->items[l]->GetCount(); - } - } - } + if (iTotalCount >= + pRecipeIngredientsRequired[i].iIngValA[j]) { + bFoundA[j] = true; + } + } - if(iTotalCount>=pRecipeIngredientsRequired[i].iIngValA[j]) - { - bFoundA[j]=true; - } - } + // 4J Stu - TU-1 hotfix + // Fix for #13143 - Players are able to craft items + // they do not have enough ingredients for if they + // store the ingredients in multiple, smaller stacks + break; + } + } + } + // if bFoundA[j] is false, then we didn't have enough of the + // ingredient required by the recipe, so mark the grid items + // we're short of + if (bFoundA[j] == false) { + int iMissing = + pRecipeIngredientsRequired[i].iIngValA[j] - iTotalCount; + int iGridIndex = 0; + while (iMissing != 0) { + // need to check if there is an aux val and match that + if (((pRecipeIngredientsRequired[i] + .uiGridA[iGridIndex] & + 0x00FFFFFF) == + pRecipeIngredientsRequired[i].iIngIDA[j]) && + ((pRecipeIngredientsRequired[i].iIngAuxValA[j] == + Recipes::ANY_AUX_VALUE) || + (pRecipeIngredientsRequired[i].iIngAuxValA[j] == + ((pRecipeIngredientsRequired[i] + .uiGridA[iGridIndex] & + 0xFF000000) >> + 24)))) { + // this grid entry is the ingredient we don't have + // enough of + pRecipeIngredientsRequired[i] + .usBitmaskMissingGridIngredients[getPad()] |= + 1 << iGridIndex; + iMissing--; + } + iGridIndex++; + } + } + } - // 4J Stu - TU-1 hotfix - // Fix for #13143 - Players are able to craft items they do not have enough ingredients for if they store the ingredients in multiple, smaller stacks - break; - } - } - } - // if bFoundA[j] is false, then we didn't have enough of the ingredient required by the recipe, so mark the grid items we're short of - if(bFoundA[j]==false) - { - int iMissing = pRecipeIngredientsRequired[i].iIngValA[j]-iTotalCount; - int iGridIndex=0; - while(iMissing!=0) - { - // need to check if there is an aux val and match that - if(((pRecipeIngredientsRequired[i].uiGridA[iGridIndex]&0x00FFFFFF)==pRecipeIngredientsRequired[i].iIngIDA[j]) && - ((pRecipeIngredientsRequired[i].iIngAuxValA[j]==Recipes::ANY_AUX_VALUE) ||(pRecipeIngredientsRequired[i].iIngAuxValA[j]== ((pRecipeIngredientsRequired[i].uiGridA[iGridIndex]&0xFF000000)>>24))) ) - { - // this grid entry is the ingredient we don't have enough of - pRecipeIngredientsRequired[i].usBitmaskMissingGridIngredients[getPad()]|=1< pTempItemInst = + pRecipeIngredientsRequired[i].pRecipy->assemble(nullptr); + // int + // iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); + int iID = pTempItemInst->getItem()->id; + int iBaseType; - // Add the recipe to the CanBeMade list of lists - if(iHSlotBrushControl<=m_iCraftablesMaxHSlotC) - { - bool bFound=false; - std::shared_ptr pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(nullptr); - //int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); - int iID=pTempItemInst->getItem()->id; - int iBaseType; + if (iID < 256) // is it a tile? + { + iBaseType = Tile::tiles[iID]->getBaseItemType(); + } else { + iBaseType = pTempItemInst->getItem()->getBaseItemType(); + } - if(iID<256) // is it a tile? - { - iBaseType=Tile::tiles[iID]->getBaseItemType(); - } - else - { - iBaseType=pTempItemInst->getItem()->getBaseItemType(); - } + // ignore for the misc base type - these have not been placed in + // a base type group + if (iBaseType != Item::eBaseItemType_undefined) { + for (int k = 0; k < iHSlotBrushControl; k++) { + // if the item base type is the same as one already in, + // then add it to that list + if (CanBeMadeA[k].iItemBaseType == iBaseType) { + // base item type already in our list + bFound = true; + if (CanBeMadeA[k].iCount < m_iMaxVSlotC) { + CanBeMadeA[k].iRecipeA[CanBeMadeA[k].iCount++] = + i; + } else { + app.DebugPrintf("Need more V slots\n"); + } + break; + } + } + } - // ignore for the misc base type - these have not been placed in a base type group - if(iBaseType!=Item::eBaseItemType_undefined) - { - for(int k=0;kgetDescriptionId())); + OutputDebugStringW( + app.GetString(pTempItemInst->getDescriptionId())); #endif - app.DebugPrintf("\n"); + app.DebugPrintf("\n"); + } + } + } else { + app.DebugPrintf("Need more HSlots\n"); + } - } - } - } - else - { - app.DebugPrintf("Need more HSlots\n"); - } + delete[] bFoundA; + itRecipe++; + } + } - delete [] bFoundA; - itRecipe++; - } - } + // run through the canbemade list and update the icons displayed + int iIndex = 0; + // RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies(); + Recipy::INGREDIENTS_REQUIRED* pRecipeIngredientsRequired = + Recipes::getInstance()->getRecipeIngredientsArray(); - // run through the canbemade list and update the icons displayed - int iIndex=0; - //RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies(); - Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray(); + while ((iIndex < m_iCraftablesMaxHSlotC) && + CanBeMadeA[iIndex].iCount != 0) { + std::shared_ptr pTempItemInst = + pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]] + .pRecipy->assemble(nullptr); + assert(pTempItemInst->id != 0); + unsigned int uiAlpha; - while((iIndex pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]].pRecipy->assemble(nullptr); - assert(pTempItemInst->id!=0); - unsigned int uiAlpha; + if (app.DebugSettingsOn() && + app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) & + (1L << eDebugSetting_CraftAnything)) { + uiAlpha = 31; + } else { + if (pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]] + .bCanMake[getPad()]) { + uiAlpha = 31; + } else { + uiAlpha = 16; + } + } - if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<id == Item::clock_Id || + pTempItemInst->id == Item::compass_Id) { + pTempItemInst->setAuxValue(255); + } + setCraftHSlotItem(getPad(), iIndex, pTempItemInst, uiAlpha); - // 4J Stu - For clocks and compasses we set the aux value to a special one that signals we should use a default texture - // rather than the dynamic one for the player - if( pTempItemInst->id == Item::clock_Id || pTempItemInst->id == Item::compass_Id ) - { - pTempItemInst->setAuxValue( 255 ); - } - setCraftHSlotItem(getPad(),iIndex,pTempItemInst,uiAlpha); + iIndex++; + } - iIndex++; - } - - // 4J-PB - Removed - UpdateTooltips will do this - // Update tooltips - /*if(CanBeMadeA[m_iCurrentSlotHIndex].iCount!=0) - { - ui.ShowTooltip( getPad(), eToolTipButtonA, true ); - // 4J-PB - not implemented ! - //ui.EnableTooltip( getPad(), eToolTipButtonA, true ); - } - else - { - ui.ShowTooltip( getPad(), eToolTipButtonA, false ); - }*/ + // 4J-PB - Removed - UpdateTooltips will do this + // Update tooltips + /*if(CanBeMadeA[m_iCurrentSlotHIndex].iCount!=0) + { + ui.ShowTooltip( getPad(), eToolTipButtonA, true ); + // 4J-PB - not implemented ! + //ui.EnableTooltip( getPad(), eToolTipButtonA, true ); + } + else + { + ui.ShowTooltip( getPad(), eToolTipButtonA, false ); + }*/ } ////////////////////////////////////////////////////////////////////////// @@ -885,73 +929,64 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() // UpdateHighlight // ////////////////////////////////////////////////////////////////////////// -void IUIScene_CraftingMenu::UpdateHighlight() -{ - updateHighlightAndScrollPositions(); +void IUIScene_CraftingMenu::UpdateHighlight() { + updateHighlightAndScrollPositions(); - bool bCanBeMade=CanBeMadeA[m_iCurrentSlotHIndex].iCount!=0; - if(bCanBeMade) - { - //RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies(); - Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray(); - int iSlot; - if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1) - { - iSlot=iVSlotIndexA[m_iCurrentSlotVIndex]; - } - else - { - iSlot=0; - } - std::shared_ptr pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr); + bool bCanBeMade = CanBeMadeA[m_iCurrentSlotHIndex].iCount != 0; + if (bCanBeMade) { + // RecipyList *recipes = ((Recipes + // *)Recipes::getInstance())->getRecipies(); + Recipy::INGREDIENTS_REQUIRED* pRecipeIngredientsRequired = + Recipes::getInstance()->getRecipeIngredientsArray(); + int iSlot; + if (CanBeMadeA[m_iCurrentSlotHIndex].iCount > 1) { + iSlot = iVSlotIndexA[m_iCurrentSlotVIndex]; + } else { + iSlot = 0; + } + std::shared_ptr pTempItemInstAdditional = + pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex] + .iRecipeA[iSlot]] + .pRecipy->assemble(nullptr); - // special case for the torch coal/charcoal - int id=pTempItemInstAdditional->getDescriptionId(); - const wchar_t *itemstring; + // special case for the torch coal/charcoal + int id = pTempItemInstAdditional->getDescriptionId(); + const wchar_t* itemstring; - switch(id) - { - case IDS_TILE_TORCH: - { - if(pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].iIngAuxValA[0]==1) - { - itemstring=app.GetString( IDS_TILE_TORCHCHARCOAL ); - } - else - { - itemstring=app.GetString( IDS_TILE_TORCHCOAL ); - } - } - break; - case IDS_ITEM_FIREBALL: - { - if(pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].iIngAuxValA[2]==1) - { - itemstring=app.GetString( IDS_ITEM_FIREBALLCHARCOAL ); - } - else - { - itemstring=app.GetString( IDS_ITEM_FIREBALLCOAL ); - } - } - break; - default: - itemstring=app.GetString(id ); - break; - } + switch (id) { + case IDS_TILE_TORCH: { + if (pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex] + .iRecipeA[iSlot]] + .iIngAuxValA[0] == 1) { + itemstring = app.GetString(IDS_TILE_TORCHCHARCOAL); + } else { + itemstring = app.GetString(IDS_TILE_TORCHCOAL); + } + } break; + case IDS_ITEM_FIREBALL: { + if (pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex] + .iRecipeA[iSlot]] + .iIngAuxValA[2] == 1) { + itemstring = app.GetString(IDS_ITEM_FIREBALLCHARCOAL); + } else { + itemstring = app.GetString(IDS_ITEM_FIREBALLCOAL); + } + } break; + default: + itemstring = app.GetString(id); + break; + } - setItemText(itemstring); - } - else - { - setItemText(L""); - } - UpdateDescriptionText(bCanBeMade); - DisplayIngredients(); + setItemText(itemstring); + } else { + setItemText(L""); + } + UpdateDescriptionText(bCanBeMade); + DisplayIngredients(); - UpdateMultiPanel(); + UpdateMultiPanel(); - UpdateTooltips(); + UpdateTooltips(); } ////////////////////////////////////////////////////////////////////////// @@ -959,71 +994,73 @@ void IUIScene_CraftingMenu::UpdateHighlight() // UpdateVerticalSlots // ////////////////////////////////////////////////////////////////////////// -void IUIScene_CraftingMenu::UpdateVerticalSlots() -{ - //RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies(); - Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray(); +void IUIScene_CraftingMenu::UpdateVerticalSlots() { + // RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies(); + Recipy::INGREDIENTS_REQUIRED* pRecipeIngredientsRequired = + Recipes::getInstance()->getRecipeIngredientsArray(); - // update the vertical items for the current horizontal slot - hideAllVSlots(); + // update the vertical items for the current horizontal slot + hideAllVSlots(); - // could have either 1 or 2 vertical slots, above and below the horizontal slot - if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1) - { - // turn off the horizontal one since we could be cycling through others - setShowCraftHSlot(m_iCurrentSlotHIndex,false); - int iSlots=(CanBeMadeA[m_iCurrentSlotHIndex].iCount>2)?3:2; + // could have either 1 or 2 vertical slots, above and below the horizontal + // slot + if (CanBeMadeA[m_iCurrentSlotHIndex].iCount > 1) { + // turn off the horizontal one since we could be cycling through others + setShowCraftHSlot(m_iCurrentSlotHIndex, false); + int iSlots = (CanBeMadeA[m_iCurrentSlotHIndex].iCount > 2) ? 3 : 2; - // 4J-Tomk - check if we've only got one vertical scroll slot (480, splits & Vita) - bool bNoScrollSlots = false; - if(m_bSplitscreen ||(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())) - { - bNoScrollSlots = true; - } + // 4J-Tomk - check if we've only got one vertical scroll slot (480, + // splits & Vita) + bool bNoScrollSlots = false; + if (m_bSplitscreen || + (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())) { + bNoScrollSlots = true; + } #ifdef __PSVITA__ - bNoScrollSlots = true; + bNoScrollSlots = true; #endif - for(int i=0;i pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iVSlotIndexA[i]]].pRecipy->assemble(nullptr); + for (int i = 0; i < iSlots; i++) { + // 4J this check determines if the crafting scene has only one + // vertical scroll slot + if (bNoScrollSlots) { + if (i != 1) continue; + } + std::shared_ptr pTempItemInstAdditional = + pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex] + .iRecipeA[iVSlotIndexA[i]]] + .pRecipy->assemble(nullptr); - assert(pTempItemInstAdditional->id!=0); - unsigned int uiAlpha; + assert(pTempItemInstAdditional->id != 0); + unsigned int uiAlpha; - if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<id == Item::clock_Id || pTempItemInstAdditional->id == Item::compass_Id ) - { - pTempItemInstAdditional->setAuxValue( 255 ); - } + // 4J Stu - For clocks and compasses we set the aux value to a + // special one that signals we should use a default texture rather + // than the dynamic one for the player + if (pTempItemInstAdditional->id == Item::clock_Id || + pTempItemInstAdditional->id == Item::compass_Id) { + pTempItemInstAdditional->setAuxValue(255); + } - setCraftVSlotItem(getPad(),i,pTempItemInstAdditional,uiAlpha); + setCraftVSlotItem(getPad(), i, pTempItemInstAdditional, uiAlpha); - updateVSlotPositions(iSlots, i); - } - } + updateVSlotPositions(iSlots, i); + } + } } ////////////////////////////////////////////////////////////////////////// @@ -1031,261 +1068,254 @@ void IUIScene_CraftingMenu::UpdateVerticalSlots() // DisplayIngredients // ////////////////////////////////////////////////////////////////////////// -void IUIScene_CraftingMenu::DisplayIngredients() -{ - //RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies(); - Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray(); +void IUIScene_CraftingMenu::DisplayIngredients() { + // RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies(); + Recipy::INGREDIENTS_REQUIRED* pRecipeIngredientsRequired = + Recipes::getInstance()->getRecipeIngredientsArray(); - // hide the previous ingredients - hideAllIngredientsSlots(); + // hide the previous ingredients + hideAllIngredientsSlots(); - if(CanBeMadeA[m_iCurrentSlotHIndex].iCount!=0) - { - int iSlot,iRecipy; - if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1) - { - iSlot=iVSlotIndexA[m_iCurrentSlotVIndex]; - iRecipy=CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]; - } - else - { - iSlot=0; - iRecipy=CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[0]; - } + if (CanBeMadeA[m_iCurrentSlotHIndex].iCount != 0) { + int iSlot, iRecipy; + if (CanBeMadeA[m_iCurrentSlotHIndex].iCount > 1) { + iSlot = iVSlotIndexA[m_iCurrentSlotVIndex]; + iRecipy = CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]; + } else { + iSlot = 0; + iRecipy = CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[0]; + } - // show the 2x2 or 3x3 to make the current item - int iBoxWidth=(m_iContainerType==RECIPE_TYPE_2x2)?2:3; - int iRecipe=CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]; - bool bCanMakeRecipe = pRecipeIngredientsRequired[iRecipe].bCanMake[getPad()]; - std::shared_ptr pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); + // show the 2x2 or 3x3 to make the current item + int iBoxWidth = (m_iContainerType == RECIPE_TYPE_2x2) ? 2 : 3; + int iRecipe = CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]; + bool bCanMakeRecipe = + pRecipeIngredientsRequired[iRecipe].bCanMake[getPad()]; + std::shared_ptr pTempItemInst = + pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); - m_iIngredientsC=pRecipeIngredientsRequired[iRecipe].iIngC; + m_iIngredientsC = pRecipeIngredientsRequired[iRecipe].iIngC; - // update the ingredients required - these will all be hidden until cycled by the user - for(int i=0;i