From 59c6cfa51479f4a78fb51d3a1d529205f36d7ff5 Mon Sep 17 00:00:00 2001 From: swedishsplidney Date: Mon, 16 Mar 2026 19:21:57 -0600 Subject: [PATCH] changed how the tutorial detects mouse input for the first task --- .../Common/Tutorial/ControllerTask.cpp | 114 +++++++++--------- .../Platform/Common/Tutorial/ControllerTask.h | 5 + 2 files changed, 61 insertions(+), 58 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Tutorial/ControllerTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/ControllerTask.cpp index 14e80fef4..0e0c9b355 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/ControllerTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/ControllerTask.cpp @@ -33,6 +33,9 @@ ControllerTask::ControllerTask(Tutorial *tutorial, int descriptionId, bool enabl // If we don't want to be able to complete it early..then assume we want the constraints active //if( !enablePreCompletion ) // enableConstraints( true ); + + + m_initialized = false; // we can set yaw + pitch on the first tick } ControllerTask::~ControllerTask() @@ -42,69 +45,64 @@ ControllerTask::~ControllerTask() bool ControllerTask::isCompleted() { - if( bIsCompleted ) - return true; + if (bIsCompleted) + return true; - bool bAllComplete = true; - - Minecraft *pMinecraft = Minecraft::GetInstance(); + Minecraft *pMinecraft = Minecraft::GetInstance(); - int iCurrent=0; + // mouse look check + if (!m_initialized) { + m_lastYaw = pMinecraft->player->yRot; + m_lastPitch = pMinecraft->player->xRot; + m_initialized = true; + } else { + float deltaYaw = fabs(pMinecraft->player->yRot - m_lastYaw); + float deltaPitch = fabs(pMinecraft->player->xRot - m_lastPitch); + m_lastYaw = pMinecraft->player->yRot; + m_lastPitch = pMinecraft->player->xRot; - if(m_bHasSouthpaw && app.GetGameSettings(pMinecraft->player->GetXboxPad(),eGameSetting_ControlSouthPaw)) - { - for(AUTO_VAR(it, southpawCompletedMappings.begin()); it != southpawCompletedMappings.end(); ++it) - { - bool current = (*it).second; - if(!current) - { - // TODO Use a different pad - if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0 ) - { - (*it).second = true; - m_uiCompletionMask|=1<player->GetXboxPad(), (*it).first) > 0 ) - { - (*it).second = true; - m_uiCompletionMask|=1< LOOK_THRESHOLD || deltaPitch > LOOK_THRESHOLD) + return true; + } - // If this has a list of completion masks then check if there is a matching one to mark the task as complete - if(m_iCompletionMaskA && CompletionMaskIsValid()) - { - bIsCompleted = true; - } - else - { - bIsCompleted = bAllComplete; - } + // check for controller button input + bool bAllComplete = true; + int iCurrent = 0; - return bIsCompleted; + 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) { + it->second = true; + m_uiCompletionMask |= 1 << iCurrent; + } else { + bAllComplete = false; + } + } + iCurrent++; + } + } else { + for (auto it = completedMappings.begin(); it != completedMappings.end(); ++it) { + if (!it->second) { + if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), it->first) > 0) { + it->second = true; + m_uiCompletionMask |= 1 << iCurrent; + } else { + bAllComplete = false; + } + } + iCurrent++; + } + } + + // completion mask check + if (m_iCompletionMaskA && CompletionMaskIsValid()) + bIsCompleted = true; + else + bIsCompleted = bAllComplete; + + return bIsCompleted; } bool ControllerTask::CompletionMaskIsValid() diff --git a/Minecraft.Client/Platform/Common/Tutorial/ControllerTask.h b/Minecraft.Client/Platform/Common/Tutorial/ControllerTask.h index 90e0c4478..4dc0302ba 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/ControllerTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/ControllerTask.h @@ -14,6 +14,11 @@ private: 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; 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);