From 58cdba39f3125ef80e68e0849a8a452aeedaeb2a Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Sun, 22 Mar 2026 03:51:48 -0500 Subject: [PATCH] TU19: merge Minecraft.Client/Platform/Common/Tutorial --- .../Common/Tutorial/DiggerItemHint.cpp | 2 +- .../Platform/Common/Tutorial/FullTutorial.cpp | 133 +++++- .../Common/Tutorial/HorseChoiceTask.cpp | 47 ++ .../Common/Tutorial/HorseChoiceTask.h | 23 + .../Common/Tutorial/LookAtTileHint.cpp | 11 +- .../Common/Tutorial/RideEntityTask.cpp | 27 ++ .../Platform/Common/Tutorial/RideEntityTask.h | 22 + .../Platform/Common/Tutorial/Tutorial.cpp | 406 +++++++++++++++--- .../Platform/Common/Tutorial/Tutorial.h | 3 +- .../Platform/Common/Tutorial/TutorialEnum.h | 31 +- .../Common/Tutorial/TutorialMessage.h | 1 + .../Platform/Common/Tutorial/TutorialTask.h | 5 +- .../Platform/Common/Tutorial/TutorialTasks.h | 2 + .../Platform/Common/Tutorial/UseItemTask.h | 1 - .../Platform/Common/UI/IUIController.h | 126 +++--- .../Platform/Linux/Linux_UIController.h | 5 +- Minecraft.Client/Player/ServerPlayer.cpp | 1 - 17 files changed, 717 insertions(+), 129 deletions(-) create mode 100644 Minecraft.Client/Platform/Common/Tutorial/HorseChoiceTask.cpp create mode 100644 Minecraft.Client/Platform/Common/Tutorial/HorseChoiceTask.h create mode 100644 Minecraft.Client/Platform/Common/Tutorial/RideEntityTask.cpp create mode 100644 Minecraft.Client/Platform/Common/Tutorial/RideEntityTask.h diff --git a/Minecraft.Client/Platform/Common/Tutorial/DiggerItemHint.cpp b/Minecraft.Client/Platform/Common/Tutorial/DiggerItemHint.cpp index 984359c44..d28b027a9 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/DiggerItemHint.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/DiggerItemHint.cpp @@ -53,7 +53,7 @@ int DiggerItemHint::attack(std::shared_ptr item, if (itemFound) { // It's also possible that we could hit TileEntities (eg falling // sand) so don't want to give this hint then - if (std::dynamic_pointer_cast(entity) != NULL) { + if (entity->instanceof(eTYPE_MOB)) { return IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL; } else { return -1; diff --git a/Minecraft.Client/Platform/Common/Tutorial/FullTutorial.cpp b/Minecraft.Client/Platform/Common/Tutorial/FullTutorial.cpp index 0432358b6..85c54405b 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/FullTutorial.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/FullTutorial.cpp @@ -248,7 +248,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) IDS_TUTORIAL_TASK_CREATE_WOODEN_PICKAXE)); addTask(e_Tutorial_State_Gameplay, - new PickupTask(Tile::stoneBrick_Id, 8, -1, this, + new PickupTask(Tile::cobblestone_Id, 8, -1, this, IDS_TUTORIAL_TASK_MINE_STONE)); addTask(e_Tutorial_State_Gameplay, @@ -922,9 +922,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) if (app.getGameRuleDefinitions() != NULL) { AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"tradingArea"); if (area != NULL) { - eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay}; + eTutorial_State tradingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint(new ChangeStateConstraint( - this, e_Tutorial_State_Trading, enchantingStates, 1, area->x0, + this, e_Tutorial_State_Trading, tradingStates, 1, area->x0, area->y0, area->z0, area->x1, area->y1, area->z1)); addTask( @@ -961,6 +961,133 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) } } + /* + * + * + * 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)); + } + } + /* * * 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/LookAtTileHint.cpp b/Minecraft.Client/Platform/Common/Tutorial/LookAtTileHint.cpp index c06b538ac..d79d0e679 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/LookAtTileHint.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/LookAtTileHint.cpp @@ -42,12 +42,13 @@ bool LookAtTileHint::onLookAt(int id, int iData) { 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; - } } + + // 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); 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/Tutorial.cpp b/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp index 5b3abb6d6..8520d4de4 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp @@ -291,9 +291,9 @@ void Tutorial::staticCtor() { 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); @@ -319,9 +319,31 @@ void Tutorial::staticCtor() { 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); + + 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( @@ -392,12 +414,12 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { /* * TILE HINTS */ - int rockItems[] = {Tile::rock_Id}; + 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::stoneBrick_Id}; + 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)); @@ -510,7 +532,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { 1, -1, SandStoneTile::TYPE_SMOOTHSIDE)); } - int noteBlockItems[] = {Tile::musicBlock_Id}; + 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, @@ -543,7 +565,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { tallGrassItems, 1, -1, TallGrass::FERN)); } - int woolItems[] = {Tile::cloth_Id}; + 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)); @@ -554,7 +576,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Flower, this, flowerItems, 2)); - int mushroomItems[] = {Tile::mushroom1_Id, Tile::mushroom2_Id}; + 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, @@ -636,7 +658,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { new LookAtTileHint(e_Tutorial_Hint_Bookshelf, this, bookshelfItems, 1)); - int mossStoneItems[] = {Tile::mossStone_Id}; + 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, @@ -688,7 +710,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { new LookAtTileHint(e_Tutorial_Hint_Crafting_Table, this, craftingTableItems, 1)); - int cropsItems[] = {Tile::crops_Id}; + 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, @@ -724,15 +746,12 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { 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}; + 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, @@ -767,7 +786,8 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { new LookAtTileHint(e_Tutorial_Hint_Redstone_Ore, this, redstoneOreItems, 2)); - int redstoneTorchItems[] = {Tile::notGate_off_Id, Tile::notGate_on_Id}; + 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, @@ -806,7 +826,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { new LookAtTileHint(e_Tutorial_Hint_Sugarcane, this, sugarCaneItems, 1)); - int recordPlayerItems[] = {Tile::recordPlayer_Id}; + 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, @@ -818,19 +838,19 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { new LookAtTileHint(e_Tutorial_Hint_Pumpkin, this, pumpkinItems, 1, -1, -1, 0)); - int hellRockItems[] = {Tile::hellRock_Id}; + 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::hellSand_Id}; + 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::lightGem_Id}; + int glowstoneItems[] = {Tile::glowstone_Id}; if (!isHintCompleted(e_Tutorial_Hint_Glowstone)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Glowstone, this, @@ -855,9 +875,10 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { 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)); + 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)) @@ -883,13 +904,14 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { new LookAtTileHint(e_Tutorial_Hint_Monster_Stone_Egg, this, monsterStoneEggItems, 1)); - int stoneBrickSmoothItems[] = {Tile::stoneBrickSmooth_Id}; + 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::hugeMushroom1_Id, Tile::hugeMushroom2_Id}; + 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, @@ -983,7 +1005,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { new LookAtTileHint(e_Tutorial_Hint_End_Portal_Frame, this, endPortalFrameItems, 1)); - int whiteStoneItems[] = {Tile::whiteStone_Id}; + 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, @@ -1004,8 +1026,10 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { 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)); + 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)) @@ -1108,6 +1132,84 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { 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 */ @@ -1217,12 +1319,29 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { addHint( e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Ozelot, this, IDS_DESC_OZELOT, - IDS_OZELOT, eTYPE_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 @@ -1529,6 +1648,160 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { } // 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); + } + /* * * @@ -1852,24 +2125,13 @@ void Tutorial::tick() { // 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( + pMinecraft->level->setDayTime( 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); + MinecraftServer::SetTimeOfDay(m_iTutorialFreezeTimeValue); + pMinecraft->level->setDayTime(m_iTutorialFreezeTimeValue); + app.SetGameHostOption(eGameHostOption_DoDaylightCycle, 1); m_timeFrozen = false; } @@ -2221,8 +2483,20 @@ bool Tutorial::setMessage(PopupMessageDetails* message) { if (it != messages.end() && it->second != NULL) { TutorialMessage* messageString = it->second; text = std::wstring(messageString->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)); + + // 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*}"); + } } } @@ -2532,18 +2806,46 @@ void Tutorial::onLookAt(int id, int iData) { } } -void Tutorial::onLookAtEntity(eINSTANCEOF type) { +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); + 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::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; + } + } + + for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); + it != activeTasks[m_CurrentState].end(); ++it) { + (*it)->onRideEntity(entity); + } } void Tutorial::onEffectChanged(MobEffect* effect, bool bRemoved) { diff --git a/Minecraft.Client/Platform/Common/Tutorial/Tutorial.h b/Minecraft.Client/Platform/Common/Tutorial/Tutorial.h index 04094d2e5..2cef6e98b 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/Tutorial.h +++ b/Minecraft.Client/Platform/Common/Tutorial/Tutorial.h @@ -174,7 +174,8 @@ public: unsigned int invItemCountThisAux); void onSelectedItemChanged(std::shared_ptr item); void onLookAt(int id, int iData = 0); - void onLookAtEntity(eINSTANCEOF type); + 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, diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialEnum.h b/Minecraft.Client/Platform/Common/Tutorial/TutorialEnum.h index b4fd88370..c5cadb0a7 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialEnum.h +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialEnum.h @@ -65,9 +65,14 @@ enum eTutorial_State { 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_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 }; @@ -207,6 +212,10 @@ enum eTutorial_Hint { 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, @@ -295,9 +304,19 @@ enum eTutorial_Hint { 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, }; diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.h b/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.h index 754f1c020..89446ce03 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.h +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialMessage.h @@ -9,6 +9,7 @@ private: bool limitRepeats; unsigned char numRepeats; unsigned char timesShown; + DWORD lastDisplayed; public: TutorialMessage(int messageId, bool limitRepeats = false, diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.h b/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.h index 845b246e0..7d7c1b6ae 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.h @@ -42,7 +42,7 @@ public: bool enablePreCompletion, std::vector* inConstraints, bool bShowMinimumTime = false, bool bAllowFade = true, - bool m_bTaskReminders = true); + bool bTaskReminders = true); virtual ~TutorialTask(); virtual int getDescriptionId() { return descriptionId; } @@ -75,4 +75,7 @@ public: 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.h b/Minecraft.Client/Platform/Common/Tutorial/UseItemTask.h index 42b57505e..25ca6db56 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/UseItemTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/UseItemTask.h @@ -9,7 +9,6 @@ class Level; class UseItemTask : public TutorialTask { private: const int itemId; - bool completed; public: UseItemTask(const int itemId, Tutorial* tutorial, int descriptionId, 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/Linux/Linux_UIController.h b/Minecraft.Client/Platform/Linux/Linux_UIController.h index aac328809..ff0a6521e 100644 --- a/Minecraft.Client/Platform/Linux/Linux_UIController.h +++ b/Minecraft.Client/Platform/Linux/Linux_UIController.h @@ -7,6 +7,8 @@ public: void init(S32 w, S32 h); void render(); + + void shutdown(); void beginIggyCustomDraw4J(IggyCustomDrawCallbackRegion* region, CustomDrawData* customDrawRegion); virtual CustomDrawData* setupCustomDraw( @@ -23,8 +25,7 @@ public: void destroySubstitutionTexture(void* destroyCallBackData, GDrawTexture* handle); -public: - void shutdown(); + static void handleUnlockFullVersionCallback(); }; extern ConsoleUIController ui; \ No newline at end of file diff --git a/Minecraft.Client/Player/ServerPlayer.cpp b/Minecraft.Client/Player/ServerPlayer.cpp index eec127e55..1070f54cf 100644 --- a/Minecraft.Client/Player/ServerPlayer.cpp +++ b/Minecraft.Client/Player/ServerPlayer.cpp @@ -602,7 +602,6 @@ void ServerPlayer::doTickB() { std::shared_ptr(new SetExperiencePacket( experienceProgress, totalExperience, experienceLevel))); } - std:: } std::shared_ptr ServerPlayer::getCarried(int slot) {