Merge remote-tracking branch 'origin/main' into dec-2014
# Conflicts: # Minecraft.Client/LocalPlayer.cpp
This commit is contained in:
@@ -359,7 +359,6 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId)
|
|||||||
m_eAction=eAction_RunUnlockOrDLC;
|
m_eAction=eAction_RunUnlockOrDLC;
|
||||||
signInReturnedFunc = &UIScene_MainMenu::UnlockFullGame_SignInReturned;
|
signInReturnedFunc = &UIScene_MainMenu::UnlockFullGame_SignInReturned;
|
||||||
break;
|
break;
|
||||||
#if defined _XBOX
|
|
||||||
case eControl_Exit:
|
case eControl_Exit:
|
||||||
if( ProfileManager.IsFullVersion() )
|
if( ProfileManager.IsFullVersion() )
|
||||||
{
|
{
|
||||||
@@ -370,13 +369,14 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef _XBOX
|
||||||
#ifdef _XBOX_ONE
|
#ifdef _XBOX_ONE
|
||||||
ui.ShowPlayerDisplayname(true);
|
ui.ShowPlayerDisplayname(true);
|
||||||
#endif
|
#endif
|
||||||
ui.NavigateToScene(primaryPad,eUIScene_TrialExitUpsell);
|
ui.NavigateToScene(primaryPad,eUIScene_TrialExitUpsell);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _DURANGO
|
#ifdef _DURANGO
|
||||||
case eControl_XboxHelp:
|
case eControl_XboxHelp:
|
||||||
|
|||||||
@@ -12,9 +12,11 @@ Input::Input()
|
|||||||
{
|
{
|
||||||
xa = 0;
|
xa = 0;
|
||||||
ya = 0;
|
ya = 0;
|
||||||
|
sprintForward = 0;
|
||||||
wasJumping = false;
|
wasJumping = false;
|
||||||
jumping = false;
|
jumping = false;
|
||||||
sneaking = false;
|
sneaking = false;
|
||||||
|
usingKeyboardMovement = false;
|
||||||
|
|
||||||
lReset = false;
|
lReset = false;
|
||||||
rReset = false;
|
rReset = false;
|
||||||
@@ -40,16 +42,18 @@ void Input::tick(LocalPlayer *player)
|
|||||||
ya = InputManager.GetJoypadStick_LY(iPad);
|
ya = InputManager.GetJoypadStick_LY(iPad);
|
||||||
else
|
else
|
||||||
ya = 0.0f;
|
ya = 0.0f;
|
||||||
|
sprintForward = ya;
|
||||||
|
usingKeyboardMovement = false;
|
||||||
|
|
||||||
#ifdef _WINDOWS64
|
#ifdef _WINDOWS64
|
||||||
// WASD movement (combine with gamepad)
|
// WASD movement (combine with gamepad)
|
||||||
if (iPad == 0)
|
if (iPad == 0)
|
||||||
{
|
{
|
||||||
float kbX = 0.0f, kbY = 0.0f;
|
float kbX = 0.0f, kbY = 0.0f;
|
||||||
if (KMInput.IsKeyDown('W')) kbY += 1.0f;
|
if (KMInput.IsKeyDown('W')) { kbY += 1.0f; sprintForward += 1.0f; usingKeyboardMovement = true; }
|
||||||
if (KMInput.IsKeyDown('S')) kbY -= 1.0f;
|
if (KMInput.IsKeyDown('S')) { kbY -= 1.0f; sprintForward -= 1.0f; usingKeyboardMovement = true; }
|
||||||
if (KMInput.IsKeyDown('A')) kbX += 1.0f; // inverted like gamepad
|
if (KMInput.IsKeyDown('A')) { kbX += 1.0f; usingKeyboardMovement = true; } // inverted like gamepad
|
||||||
if (KMInput.IsKeyDown('D')) kbX -= 1.0f;
|
if (KMInput.IsKeyDown('D')) { kbX -= 1.0f; usingKeyboardMovement = true; }
|
||||||
// Normalize diagonal
|
// Normalize diagonal
|
||||||
if (kbX != 0.0f && kbY != 0.0f) { kbX *= 0.707f; kbY *= 0.707f; }
|
if (kbX != 0.0f && kbY != 0.0f) { kbX *= 0.707f; kbY *= 0.707f; }
|
||||||
if (pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_LEFT) || pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_RIGHT))
|
if (pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_LEFT) || pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_RIGHT))
|
||||||
@@ -58,11 +62,13 @@ void Input::tick(LocalPlayer *player)
|
|||||||
ya = max(min(ya + kbY, 1.0f), -1.0f);
|
ya = max(min(ya + kbY, 1.0f), -1.0f);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
sprintForward = max(min(sprintForward, 1.0f), -1.0f);
|
||||||
|
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
if (app.GetFreezePlayers())
|
if (app.GetFreezePlayers())
|
||||||
{
|
{
|
||||||
xa = ya = 0.0f;
|
xa = ya = 0.0f;
|
||||||
|
sprintForward = 0.0f;
|
||||||
player->abilities.flying = true;
|
player->abilities.flying = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -74,6 +80,7 @@ void Input::tick(LocalPlayer *player)
|
|||||||
lReset = true;
|
lReset = true;
|
||||||
}
|
}
|
||||||
xa = ya = 0.0f;
|
xa = ya = 0.0f;
|
||||||
|
sprintForward = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J: In flying mode, don't actually toggle sneaking (unless we're riding in which case we need to sneak to dismount)
|
// 4J: In flying mode, don't actually toggle sneaking (unless we're riding in which case we need to sneak to dismount)
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ class Input
|
|||||||
public:
|
public:
|
||||||
float xa;
|
float xa;
|
||||||
float ya;
|
float ya;
|
||||||
|
float sprintForward;
|
||||||
|
|
||||||
bool wasJumping;
|
bool wasJumping;
|
||||||
bool jumping;
|
bool jumping;
|
||||||
bool sneaking;
|
bool sneaking;
|
||||||
|
bool usingKeyboardMovement;
|
||||||
|
|
||||||
Input(); // 4J - added
|
Input(); // 4J - added
|
||||||
|
|
||||||
|
|||||||
@@ -251,11 +251,13 @@ void LocalPlayer::aiStep()
|
|||||||
if (changingDimensionDelay > 0) changingDimensionDelay--;
|
if (changingDimensionDelay > 0) changingDimensionDelay--;
|
||||||
bool wasJumping = input->jumping;
|
bool wasJumping = input->jumping;
|
||||||
float runTreshold = 0.8f;
|
float runTreshold = 0.8f;
|
||||||
|
float sprintForward = input->sprintForward;
|
||||||
|
|
||||||
bool wasRunning = input->ya >= runTreshold;
|
bool wasRunning = sprintForward >= runTreshold;
|
||||||
//input->tick( dynamic_pointer_cast<Player>( shared_from_this() ) );
|
//input->tick( dynamic_pointer_cast<Player>( shared_from_this() ) );
|
||||||
// 4J-PB - make it a localplayer
|
// 4J-PB - make it a localplayer
|
||||||
input->tick( this );
|
input->tick( this );
|
||||||
|
sprintForward = input->sprintForward;
|
||||||
if (isUsingItem() && !isRiding())
|
if (isUsingItem() && !isRiding())
|
||||||
{
|
{
|
||||||
input->xa *= 0.2f;
|
input->xa *= 0.2f;
|
||||||
@@ -279,9 +281,20 @@ void LocalPlayer::aiStep()
|
|||||||
// world with low food, then reload it in creative.
|
// world with low food, then reload it in creative.
|
||||||
if(abilities.mayfly || isAllowedToFly() ) enoughFoodToSprint = true;
|
if(abilities.mayfly || isAllowedToFly() ) enoughFoodToSprint = true;
|
||||||
|
|
||||||
|
bool forwardEnoughToTriggerSprint = sprintForward >= runTreshold;
|
||||||
|
bool forwardReturnedToDeadzone = sprintForward == 0.0f;
|
||||||
|
bool forwardEnoughToContinueSprint = sprintForward >= runTreshold;
|
||||||
|
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
if (GetXboxPad() == 0 && input->usingKeyboardMovement)
|
||||||
|
{
|
||||||
|
forwardEnoughToContinueSprint = sprintForward > 0.0f;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WINDOWS64
|
#ifdef _WINDOWS64
|
||||||
// Keyboard sprint: Ctrl held while moving forward
|
// Keyboard sprint: Ctrl held while moving forward
|
||||||
if (GetXboxPad() == 0 && KMInput.IsKeyDown(VK_CONTROL) && input->ya > 0.0f &&
|
if (GetXboxPad() == 0 && input->usingKeyboardMovement && KMInput.IsKeyDown(VK_CONTROL) && sprintForward > 0.0f &&
|
||||||
enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness) && onGround)
|
enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness) && onGround)
|
||||||
{
|
{
|
||||||
if (!isSprinting()) setSprinting(true);
|
if (!isSprinting()) setSprinting(true);
|
||||||
@@ -291,7 +304,7 @@ void LocalPlayer::aiStep()
|
|||||||
// 4J - altered this slightly to make sure that the joypad returns to below returnTreshold in between registering two movements up to runThreshold
|
// 4J - altered this slightly to make sure that the joypad returns to below returnTreshold in between registering two movements up to runThreshold
|
||||||
if (onGround && !isSprinting() && enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness))
|
if (onGround && !isSprinting() && enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness))
|
||||||
{
|
{
|
||||||
if( !wasRunning && input->ya >= runTreshold )
|
if( !wasRunning && forwardEnoughToTriggerSprint )
|
||||||
{
|
{
|
||||||
if (sprintTriggerTime == 0)
|
if (sprintTriggerTime == 0)
|
||||||
{
|
{
|
||||||
@@ -308,7 +321,7 @@ void LocalPlayer::aiStep()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( ( sprintTriggerTime > 0 ) && ( input->ya == 0.0f ) ) // ya of 0.0f here signifies that we have returned to the deadzone
|
else if( ( sprintTriggerTime > 0 ) && forwardReturnedToDeadzone ) // zero sprintForward here signifies that we have returned to the deadzone
|
||||||
{
|
{
|
||||||
sprintTriggerRegisteredReturn = true;
|
sprintTriggerRegisteredReturn = true;
|
||||||
}
|
}
|
||||||
@@ -316,7 +329,7 @@ void LocalPlayer::aiStep()
|
|||||||
if (isSneaking()) sprintTriggerTime = 0;
|
if (isSneaking()) sprintTriggerTime = 0;
|
||||||
// 4J-PB - try not stopping sprint on collision
|
// 4J-PB - try not stopping sprint on collision
|
||||||
//if (isSprinting() && (input->ya < runTreshold || horizontalCollision || !enoughFoodToSprint))
|
//if (isSprinting() && (input->ya < runTreshold || horizontalCollision || !enoughFoodToSprint))
|
||||||
if (isSprinting() && (input->ya < runTreshold || !enoughFoodToSprint))
|
if (isSprinting() && (!forwardEnoughToContinueSprint || !enoughFoodToSprint || isSneaking() || isUsingItem()))
|
||||||
{
|
{
|
||||||
setSprinting(false);
|
setSprinting(false);
|
||||||
}
|
}
|
||||||
@@ -1727,4 +1740,3 @@ void LocalPlayer::SetPlayerAdditionalModelParts(vector<ModelPart *>pAdditionalMo
|
|||||||
{
|
{
|
||||||
m_pAdditionalModelParts=pAdditionalModelParts;
|
m_pAdditionalModelParts=pAdditionalModelParts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ void CConsoleMinecraftApp::StoreLaunchData()
|
|||||||
}
|
}
|
||||||
void CConsoleMinecraftApp::ExitGame()
|
void CConsoleMinecraftApp::ExitGame()
|
||||||
{
|
{
|
||||||
|
// This is likely not the correct way to exit the game, but it will do for now
|
||||||
|
ExitProcess(0);
|
||||||
}
|
}
|
||||||
void CConsoleMinecraftApp::FatalLoadError()
|
void CConsoleMinecraftApp::FatalLoadError()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -716,6 +716,26 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||||
|
|
||||||
|
|
||||||
|
WCHAR exePath[MAX_PATH] = { 0 };
|
||||||
|
GetModuleFileNameW(NULL, exePath, MAX_PATH);
|
||||||
|
WCHAR* lastSlash = wcsrchr(exePath, L'\\');
|
||||||
|
if (lastSlash) {
|
||||||
|
*lastSlash = L'\0';
|
||||||
|
|
||||||
|
WCHAR devCheckPath[MAX_PATH] = { 0 };
|
||||||
|
swprintf_s(devCheckPath, MAX_PATH, L"%s\\..\\..\\Minecraft.Client\\Minecraft.Client.vcxproj", exePath);
|
||||||
|
|
||||||
|
if (GetFileAttributesW(devCheckPath) != INVALID_FILE_ATTRIBUTES) {
|
||||||
|
WCHAR projectPath[MAX_PATH] = { 0 };
|
||||||
|
swprintf_s(projectPath, MAX_PATH, L"%s\\..\\..\\Minecraft.Client", exePath);
|
||||||
|
SetCurrentDirectoryW(projectPath);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SetCurrentDirectoryW(exePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Declare DPI awareness so GetSystemMetrics returns physical pixels
|
// Declare DPI awareness so GetSystemMetrics returns physical pixels
|
||||||
SetProcessDPIAware();
|
SetProcessDPIAware();
|
||||||
g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN);
|
g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN);
|
||||||
|
|||||||
@@ -9,18 +9,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Minecraft.Client", "Minecra
|
|||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(TeamFoundationVersionControl) = preSolution
|
|
||||||
SccNumberOfProjects = 3
|
|
||||||
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
|
|
||||||
SccTeamFoundationServer = https://tfs4jstudios.visualstudio.com/defaultcollection
|
|
||||||
SccLocalPath0 = .
|
|
||||||
SccProjectUniqueName1 = Minecraft.World\\Minecraft.World.vcxproj
|
|
||||||
SccProjectName1 = Minecraft.World
|
|
||||||
SccLocalPath1 = Minecraft.World
|
|
||||||
SccProjectUniqueName2 = Minecraft.Client\\Minecraft.Client.vcxproj
|
|
||||||
SccProjectName2 = Minecraft.Client
|
|
||||||
SccLocalPath2 = Minecraft.Client
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
ContentPackage_NO_TU|Durango = ContentPackage_NO_TU|Durango
|
ContentPackage_NO_TU|Durango = ContentPackage_NO_TU|Durango
|
||||||
ContentPackage_NO_TU|ORBIS = ContentPackage_NO_TU|ORBIS
|
ContentPackage_NO_TU|ORBIS = ContentPackage_NO_TU|ORBIS
|
||||||
|
|||||||
Reference in New Issue
Block a user