mirror of
https://github.com/LCEMP/LCEMP.git
synced 2026-08-19 23:27:13 +00:00
add choicetask input support for kbm
This commit is contained in:
parent
78052a4222
commit
f30619d597
|
|
@ -8,6 +8,20 @@
|
||||||
#include "ChoiceTask.h"
|
#include "ChoiceTask.h"
|
||||||
#include "..\..\..\Minecraft.World\Material.h"
|
#include "..\..\..\Minecraft.World\Material.h"
|
||||||
|
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
#include "..\..\KeyboardMouseInput.h"
|
||||||
|
|
||||||
|
static int ActionToVK(int action)
|
||||||
|
{
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case ACTION_MENU_A: return KeyboardMouseInput::KEY_CONFIRM;
|
||||||
|
case ACTION_MENU_B: return KeyboardMouseInput::KEY_CANCEL;
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ChoiceTask::ChoiceTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/,
|
ChoiceTask::ChoiceTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/,
|
||||||
int iConfirmMapping /*= 0*/, int iCancelMapping /*= 0*/,
|
int iConfirmMapping /*= 0*/, int iCancelMapping /*= 0*/,
|
||||||
eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
||||||
|
|
@ -51,11 +65,24 @@ bool ChoiceTask::isCompleted()
|
||||||
// If the player is under water then allow all keypresses so they can jump out
|
// 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( pMinecraft->localplayers[tutorial->getPad()]->isUnderLiquid(Material::water) ) return false;
|
||||||
|
|
||||||
if(!m_bConfirmMappingComplete && InputManager.GetValue(pMinecraft->player->GetXboxPad(), m_iConfirmMapping) > 0 )
|
int xboxPad = pMinecraft->player->GetXboxPad();
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
if(!m_bConfirmMappingComplete &&
|
||||||
|
(InputManager.GetValue(xboxPad, m_iConfirmMapping) > 0
|
||||||
|
|| g_KBMInput.IsKeyDown(ActionToVK(m_iConfirmMapping))))
|
||||||
|
#else
|
||||||
|
if(!m_bConfirmMappingComplete && InputManager.GetValue(xboxPad, m_iConfirmMapping) > 0 )
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
m_bConfirmMappingComplete = true;
|
m_bConfirmMappingComplete = true;
|
||||||
}
|
}
|
||||||
if(!m_bCancelMappingComplete && InputManager.GetValue(pMinecraft->player->GetXboxPad(), m_iCancelMapping) > 0 )
|
#ifdef _WINDOWS64
|
||||||
|
if(!m_bCancelMappingComplete &&
|
||||||
|
(InputManager.GetValue(xboxPad, m_iCancelMapping) > 0
|
||||||
|
|| g_KBMInput.IsKeyDown(ActionToVK(m_iCancelMapping))))
|
||||||
|
#else
|
||||||
|
if(!m_bCancelMappingComplete && InputManager.GetValue(xboxPad, m_iCancelMapping) > 0 )
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
m_bCancelMappingComplete = true;
|
m_bCancelMappingComplete = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,10 @@
|
||||||
#include "TutorialConstraints.h"
|
#include "TutorialConstraints.h"
|
||||||
#include "ControllerTask.h"
|
#include "ControllerTask.h"
|
||||||
|
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
#include "..\..\KeyboardMouseInput.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
ControllerTask::ControllerTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, bool showMinimumTime,
|
ControllerTask::ControllerTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, bool showMinimumTime,
|
||||||
int mappings[], unsigned int mappingsLength, int iCompletionMaskA[], int iCompletionMaskACount, int iSouthpawMappings[], unsigned int uiSouthpawMappingsCount)
|
int mappings[], unsigned int mappingsLength, int iCompletionMaskA[], int iCompletionMaskACount, int iSouthpawMappings[], unsigned int uiSouthpawMappingsCount)
|
||||||
: TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL, showMinimumTime )
|
: TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL, showMinimumTime )
|
||||||
|
|
@ -66,7 +70,11 @@ bool ControllerTask::isCompleted()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
bAllComplete = true;
|
||||||
|
#else
|
||||||
bAllComplete = false;
|
bAllComplete = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iCurrent++;
|
iCurrent++;
|
||||||
|
|
@ -87,7 +95,11 @@ bool ControllerTask::isCompleted()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
bAllComplete = true;
|
||||||
|
#else
|
||||||
bAllComplete = false;
|
bAllComplete = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iCurrent++;
|
iCurrent++;
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,20 @@
|
||||||
#include "InfoTask.h"
|
#include "InfoTask.h"
|
||||||
#include "..\..\..\Minecraft.World\Material.h"
|
#include "..\..\..\Minecraft.World\Material.h"
|
||||||
|
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
#include "..\..\KeyboardMouseInput.h"
|
||||||
|
|
||||||
|
static int ActionToVK(int action)
|
||||||
|
{
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case ACTION_MENU_A: return KeyboardMouseInput::KEY_CONFIRM;
|
||||||
|
case ACTION_MENU_B: return KeyboardMouseInput::KEY_CANCEL;
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
InfoTask::InfoTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/,
|
InfoTask::InfoTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/,
|
||||||
int iMapping /*= 0*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
int iMapping /*= 0*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
||||||
: TutorialTask( tutorial, descriptionId, false, NULL, true, false, false )
|
: TutorialTask( tutorial, descriptionId, false, NULL, true, false, false )
|
||||||
|
|
@ -65,12 +79,16 @@ bool InfoTask::isCompleted()
|
||||||
bool current = (*it).second;
|
bool current = (*it).second;
|
||||||
if(!current)
|
if(!current)
|
||||||
{
|
{
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0 || g_KBMInput.IsKeyDown(ActionToVK((*it).first)) )
|
||||||
|
#else
|
||||||
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0 )
|
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0 )
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
(*it).second = true;
|
(*it).second = true;
|
||||||
bAllComplete=true;
|
bAllComplete=true;
|
||||||
}
|
}
|
||||||
else
|
if (!(*it).second)
|
||||||
{
|
{
|
||||||
bAllComplete = false;
|
bAllComplete = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ public:
|
||||||
static const int KEY_DROP = 'Q';
|
static const int KEY_DROP = 'Q';
|
||||||
static const int KEY_CRAFTING = VK_TAB;
|
static const int KEY_CRAFTING = VK_TAB;
|
||||||
static const int KEY_CRAFTING_ALT = 'R';
|
static const int KEY_CRAFTING_ALT = 'R';
|
||||||
|
static const int KEY_CONFIRM = VK_RETURN;
|
||||||
|
static const int KEY_CANCEL = VK_ESCAPE;
|
||||||
static const int KEY_PAUSE = VK_ESCAPE;
|
static const int KEY_PAUSE = VK_ESCAPE;
|
||||||
static const int KEY_THIRD_PERSON = VK_F5;
|
static const int KEY_THIRD_PERSON = VK_F5;
|
||||||
static const int KEY_DEBUG_INFO = VK_F3;
|
static const int KEY_DEBUG_INFO = VK_F3;
|
||||||
|
|
|
||||||
|
|
@ -1504,7 +1504,7 @@ void Minecraft::run_middle()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Utility keys always work regardless of KBM active state
|
// Utility keys always work regardless of KBM active state
|
||||||
if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_PAUSE))
|
if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_PAUSE) && !ui.IsTutorialVisible(i))
|
||||||
{
|
{
|
||||||
localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_PAUSEMENU;
|
localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_PAUSEMENU;
|
||||||
app.DebugPrintf("PAUSE PRESSED (keyboard) - ipad = %d\n",i);
|
app.DebugPrintf("PAUSE PRESSED (keyboard) - ipad = %d\n",i);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue