feat: remove sprinting
This commit is contained in:
1 parent
5b198d7b31
commit
bdfe5350cd
14 files changed
+18
-196
No files matched your search
@@ -435,10 +435,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
}
|
||||
|
||||
int y0 = 0;
|
||||
// 4J-PB - no hardcore in xbox
|
||||
// if (minecraft.level.getLevelData().isHardcore()) {
|
||||
// y0 = 5;
|
||||
// }
|
||||
|
||||
blit(xo, yo, 16 + bg * 9, 9 * 0, 9, 9);
|
||||
if (blink)
|
||||
{
|
||||
@@ -513,11 +510,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
else if( minecraft->player->isSneaking() )
|
||||
{
|
||||
characterDisplayTimer[iPad] = 30;
|
||||
}
|
||||
else if( minecraft->player->isSprinting() )
|
||||
{
|
||||
characterDisplayTimer[iPad] = 30;
|
||||
}
|
||||
}
|
||||
else if( minecraft->player->abilities.flying)
|
||||
{
|
||||
characterDisplayTimer[iPad] = 5; // quickly get rid of the player display if they stop flying
|
||||
@@ -527,10 +520,9 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
--characterDisplayTimer[iPad];
|
||||
}
|
||||
bool displayCrouch = minecraft->player->isSneaking() || ( characterDisplayTimer[iPad] > 0 );
|
||||
bool displaySprint = minecraft->player->isSprinting() || ( characterDisplayTimer[iPad] > 0 );
|
||||
bool displayFlying = minecraft->player->abilities.flying || ( characterDisplayTimer[iPad] > 0 );
|
||||
|
||||
if( bDisplayGui && (displayCrouch || displaySprint || displayFlying) )
|
||||
if( bDisplayGui && (displayCrouch || displayFlying) )
|
||||
{
|
||||
EntityRenderDispatcher::instance->prepare(minecraft->level, minecraft->textures, minecraft->font, minecraft->cameraTargetPlayer, minecraft->options, a);
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
@@ -795,8 +787,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
#endif
|
||||
|
||||
lastTickA = a;
|
||||
// 4J Stu - This is now displayed in a xui scene
|
||||
#if 0
|
||||
#if RENDER_HUD
|
||||
// Jukebox CD message
|
||||
if (overlayMessageTime > 0)
|
||||
{
|
||||
@@ -843,8 +834,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
|
||||
// 4J Stu - We have moved the chat text to a xui
|
||||
#if 0
|
||||
#if RENDER_HUD
|
||||
glPushMatrix();
|
||||
// 4J-PB we need to move this up a bit because we've moved the quick select
|
||||
//glTranslatef(0, ((float)screenHeight) - 48, 0);
|
||||
|
||||
@@ -60,7 +60,6 @@ LocalPlayer::LocalPlayer(Minecraft *minecraft, Level *level, User *user, int dim
|
||||
flyX = flyY = flyZ = 0.0f; // 4J added
|
||||
m_awardedThisSession = 0;
|
||||
|
||||
sprintTriggerTime = 0;
|
||||
sprintTriggerRegisteredReturn = false;
|
||||
twoJumpsRegistered = false;
|
||||
sprintTime = 0;
|
||||
@@ -218,15 +217,6 @@ bool LocalPlayer::isEffectiveAI()
|
||||
|
||||
void LocalPlayer::aiStep()
|
||||
{
|
||||
if (sprintTime > 0)
|
||||
{
|
||||
sprintTime--;
|
||||
if (sprintTime == 0)
|
||||
{
|
||||
setSprinting(false);
|
||||
}
|
||||
}
|
||||
if (sprintTriggerTime > 0) sprintTriggerTime--;
|
||||
if (minecraft->gameMode->isCutScene())
|
||||
{
|
||||
x = z = 0.5;
|
||||
@@ -283,7 +273,6 @@ void LocalPlayer::aiStep()
|
||||
{
|
||||
input->xa *= 0.2f;
|
||||
input->ya *= 0.2f;
|
||||
sprintTriggerTime = 0;
|
||||
}
|
||||
// this.heightOffset = input.sneaking?1.30f:1.62f; // 4J - this was already commented out
|
||||
if (input->sneaking) // 4J - removed - TODO replace
|
||||
@@ -296,45 +285,6 @@ void LocalPlayer::aiStep()
|
||||
checkInTile(x + bbWidth * 0.35, bb->y0 + 0.5, z - bbWidth * 0.35);
|
||||
checkInTile(x + bbWidth * 0.35, bb->y0 + 0.5, z + bbWidth * 0.35);
|
||||
|
||||
bool enoughFoodToSprint = getFoodData()->getFoodLevel() > FoodConstants::MAX_FOOD * FoodConstants::FOOD_SATURATION_LOW;
|
||||
|
||||
// 4J Stu - If we can fly, then we should be able to sprint without requiring food. This is particularly a problem for people who save a survival
|
||||
// world with low food, then reload it in creative.
|
||||
if(abilities.mayfly || isAllowedToFly() ) enoughFoodToSprint = true;
|
||||
|
||||
// 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( !wasRunning && input->ya >= runTreshold )
|
||||
{
|
||||
if (sprintTriggerTime == 0)
|
||||
{
|
||||
sprintTriggerTime = 7;
|
||||
sprintTriggerRegisteredReturn = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( sprintTriggerRegisteredReturn )
|
||||
{
|
||||
setSprinting(true);
|
||||
sprintTriggerTime = 0;
|
||||
sprintTriggerRegisteredReturn = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( ( sprintTriggerTime > 0 ) && ( input->ya == 0.0f ) ) // ya of 0.0f here signifies that we have returned to the deadzone
|
||||
{
|
||||
sprintTriggerRegisteredReturn = true;
|
||||
}
|
||||
}
|
||||
if (isSneaking()) sprintTriggerTime = 0;
|
||||
// 4J-PB - try not stopping sprint on collision
|
||||
//if (isSprinting() && (input->ya < runTreshold || horizontalCollision || !enoughFoodToSprint))
|
||||
if (isSprinting() && (input->ya < runTreshold || !enoughFoodToSprint))
|
||||
{
|
||||
setSprinting(false);
|
||||
}
|
||||
|
||||
// 4J Stu - Fix for #52705 - Customer Encountered: Player can fly in bed while being in Creative mode.
|
||||
if (!isSleeping() && (abilities.mayfly || isAllowedToFly() ))
|
||||
{
|
||||
@@ -437,33 +387,16 @@ void LocalPlayer::aiStep()
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if( isSprinting() )
|
||||
flyX = 0.0f;
|
||||
flyY = 0.0f;
|
||||
flyZ = 0.0f;
|
||||
if( ullDpad_filtered & (1LL<<MINECRAFT_ACTION_DPAD_UP))
|
||||
{
|
||||
// Accelrate up to full speed if we are sprinting, moving in the direction of the view vector
|
||||
flyX = (float)viewVector->x * input->ya;
|
||||
flyY = (float)viewVector->y * input->ya;
|
||||
flyZ = (float)viewVector->z * input->ya;
|
||||
|
||||
float scale = ((float)(SPRINT_DURATION - sprintTime))/10.0f;
|
||||
scale = scale * scale;
|
||||
if ( scale > 1.0f ) scale = 1.0f;
|
||||
flyX *= scale;
|
||||
flyY *= scale;
|
||||
flyZ *= scale;
|
||||
flyY = 0.1f;
|
||||
}
|
||||
else
|
||||
if( ullDpad_filtered & (1LL<<MINECRAFT_ACTION_DPAD_DOWN))
|
||||
{
|
||||
flyX = 0.0f;
|
||||
flyY = 0.0f;
|
||||
flyZ = 0.0f;
|
||||
if( ullDpad_filtered & (1LL<<MINECRAFT_ACTION_DPAD_UP))
|
||||
{
|
||||
flyY = 0.1f;
|
||||
}
|
||||
if( ullDpad_filtered & (1LL<<MINECRAFT_ACTION_DPAD_DOWN))
|
||||
{
|
||||
flyY = -0.1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1111,13 +1044,6 @@ bool LocalPlayer::checkInTile(double x, double y, double z)
|
||||
|
||||
}
|
||||
|
||||
void LocalPlayer::setSprinting(bool value)
|
||||
{
|
||||
Player::setSprinting(value);
|
||||
if (value == false) sprintTime = 0;
|
||||
else sprintTime = SPRINT_DURATION;
|
||||
}
|
||||
|
||||
void LocalPlayer::setExperienceValues(float experienceProgress, int totalExp, int experienceLevel)
|
||||
{
|
||||
this->experienceProgress = experienceProgress;
|
||||
@@ -1236,13 +1162,6 @@ bool LocalPlayer::creativeModeHandleMouseClick(int button, bool buttonPressed)
|
||||
// If we're in disabled mode already (set when sprinting) then don't do anything - if we're sprinting, we don't auto-repeat at all.
|
||||
// With auto repeat on, we can quickly place fires causing photosensitivity issues due to rapid flashing
|
||||
if( lastClickState == lastClick_disabled ) return false;
|
||||
// If we've started sprinting, go into this mode & also don't do anything
|
||||
// Ignore repeate when sleeping
|
||||
if( isSprinting() )
|
||||
{
|
||||
lastClickState = lastClick_disabled;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get distance from last click point in each axis
|
||||
float dX = (float)x - lastClickX;
|
||||
@@ -1360,7 +1279,7 @@ bool LocalPlayer::creativeModeHandleMouseClick(int button, bool buttonPressed)
|
||||
bool itemPlaced = handleMouseClick(button);
|
||||
// If we're sprinting or riding, don't auto-repeat at all. With auto repeat on, we can quickly place fires causing photosensitivity issues due to rapid flashing
|
||||
// Also ignore repeats when the player is sleeping
|
||||
if( isSprinting() || isRiding() || isSleeping() )
|
||||
if( isRiding() || isSleeping() )
|
||||
{
|
||||
lastClickState = lastClick_disabled;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ public:
|
||||
Input *input;
|
||||
protected:
|
||||
Minecraft *minecraft;
|
||||
int sprintTriggerTime;
|
||||
bool sprintTriggerRegisteredReturn; // 4J added
|
||||
bool twoJumpsRegistered; // 4J added
|
||||
|
||||
@@ -172,7 +171,6 @@ protected:
|
||||
bool checkInTile(double x, double y, double z);
|
||||
|
||||
public:
|
||||
void setSprinting(bool value);
|
||||
void setExperienceValues(float experienceProgress, int totalExp, int experienceLevel);
|
||||
|
||||
bool hasPermission(EGameCommand command);
|
||||
|
||||
@@ -3271,7 +3271,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||
// Also disable repeat when the player is sleeping to stop the waking up right after using the bed
|
||||
bool firstClick = ( player->lastClickTick[1] == 0 );
|
||||
bool autoRepeat = ticks - player->lastClickTick[1] >= timer->ticksPerSecond / 4;
|
||||
if ( player->isRiding() || player->isSprinting() || player->isSleeping() ) autoRepeat = false;
|
||||
if ( player->isRiding() || player->isSleeping() ) autoRepeat = false;
|
||||
if (InputManager.ButtonDown(iPad, MINECRAFT_ACTION_USE) )
|
||||
{
|
||||
// If the player has just exited a bed, then delay the time before a repeat key is allowed without releasing
|
||||
|
||||
@@ -25,7 +25,6 @@ MultiplayerLocalPlayer::MultiplayerLocalPlayer(Minecraft *minecraft, Level *leve
|
||||
lastOnGround = false;
|
||||
lastSneaked = false;
|
||||
lastIdle = false;
|
||||
lastSprinting = false;
|
||||
positionReminder = 0;
|
||||
|
||||
this->connection = connection;
|
||||
@@ -72,15 +71,6 @@ void MultiplayerLocalPlayer::tick()
|
||||
|
||||
void MultiplayerLocalPlayer::sendPosition()
|
||||
{
|
||||
bool sprinting = isSprinting();
|
||||
if (sprinting != lastSprinting)
|
||||
{
|
||||
if (sprinting) connection->send(shared_ptr<PlayerCommandPacket>( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_SPRINTING)));
|
||||
else connection->send(shared_ptr<PlayerCommandPacket>( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SPRINTING)));
|
||||
|
||||
lastSprinting = sprinting;
|
||||
}
|
||||
|
||||
bool sneaking = isSneaking();
|
||||
if (sneaking != lastSneaked)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,6 @@ private:
|
||||
bool lastOnGround;
|
||||
bool lastSneaked;
|
||||
bool lastIdle;
|
||||
bool lastSprinting;
|
||||
int positionReminder;
|
||||
public:
|
||||
void sendPosition();
|
||||
|
||||
@@ -209,14 +209,6 @@ void OzelotModel::prepareMobModel(shared_ptr<Mob> mob, float time, float r, floa
|
||||
tail2->xRot = 0.5f * PI;
|
||||
state = SNEAK_STATE;
|
||||
}
|
||||
else if (ozelot->isSprinting())
|
||||
{
|
||||
tail2->y = tail1->y;
|
||||
tail2->z += 2;
|
||||
tail1->xRot = 0.5f * PI;
|
||||
tail2->xRot = 0.5f * PI;
|
||||
state = SPRINT_STATE;
|
||||
}
|
||||
else if (ozelot->isSitting())
|
||||
{
|
||||
body->xRot = 45 / (float) (180 / PI);
|
||||
|
||||
@@ -696,14 +696,6 @@ void PlayerConnection::handlePlayerCommand(shared_ptr<PlayerCommandPacket> packe
|
||||
{
|
||||
player->setSneaking(false);
|
||||
}
|
||||
else if (packet->action == PlayerCommandPacket::START_SPRINTING)
|
||||
{
|
||||
player->setSprinting(true);
|
||||
}
|
||||
else if (packet->action == PlayerCommandPacket::STOP_SPRINTING)
|
||||
{
|
||||
player->setSprinting(false);
|
||||
}
|
||||
else if (packet->action == PlayerCommandPacket::STOP_SLEEPING)
|
||||
{
|
||||
player->stopSleepInBed(false, true, true);
|
||||
|
||||
Reference in new issue
Block a user