Auto Jump Option (#35)

This commit is contained in:
ts
2023-08-07 01:30:54 -07:00
committed by GitHub
parent e51edbff06
commit 2114a57a4b
5 changed files with 17 additions and 4 deletions

View File

@@ -50,6 +50,7 @@ void Options::initDefaultValues()
field_240 = 1;
field_10 = 2;
field_14 = 1;
m_bAutoJump = true;
m_bFancyGraphics = true;
field_19 = 1;
field_1C = "Default";

View File

@@ -100,6 +100,7 @@ public:
uint8_t field_23D; // @NOTE: Third person mode?
uint8_t field_23E;
bool m_bFlyCheat;
bool m_bAutoJump;
uint8_t field_240;
uint8_t field_241;
float field_244;

View File

@@ -21,6 +21,7 @@ enum eOptionsButton
OB_VIEW_BOB,
OB_VIEW_DIST,
OB_FLY_HAX,
OB_AUTO_JUMP
};
OptionsScreen::OptionsScreen()
@@ -33,7 +34,8 @@ OptionsScreen::OptionsScreen()
m_anaglyphsButton(6, 0, 0, 150, 20, ""),
m_viewBobButton (7, 0, 0, 150, 20, ""),
m_viewDistButton (8, 0, 0, 150, 20, ""),
m_flightHaxButton(9, 0, 0, 150, 20, "")
m_flightHaxButton(9, 0, 0, 150, 20, ""),
m_autoJumpButton (10, 0, 0, 150, 20, "")
#endif
{
}
@@ -71,7 +73,8 @@ void OptionsScreen::UpdateTexts()
m_anaglyphsButton.m_text = "3d Anaglyphs: " + BoolOptionStr(o.m_bAnaglyphs);
m_fancyGfxButton.m_text = "Fancy graphics: " + BoolOptionStr(o.m_bFancyGraphics);
m_flightHaxButton.m_text = "Flight hax: " + BoolOptionStr(o.m_bFlyCheat);
m_viewDistButton.m_text = "View distance: " + ViewDistanceStr(o.field_10);
m_autoJumpButton.m_text = "Auto Jump: " + BoolOptionStr(o.m_bAutoJump);
; m_viewDistButton.m_text = "View distance: " + ViewDistanceStr(o.field_10);
m_srvVisButton.m_text = "Server " + std::string(o.m_bServerVisibleDefault ? "visible" : "invisible") + " by default";
}
#endif
@@ -95,13 +98,15 @@ void OptionsScreen::init()
m_invertYButton.m_xPos =
m_anaglyphsButton.m_xPos =
m_viewBobButton.m_xPos =
m_flightHaxButton.m_xPos = m_width / 2 + 5;
m_flightHaxButton.m_xPos =
m_autoJumpButton.m_xPos = m_width / 2 + 5;
int yPos = 40;
m_AOButton.m_yPos = m_invertYButton.m_yPos = yPos; yPos += 25;
m_srvVisButton.m_yPos = m_anaglyphsButton.m_yPos = yPos; yPos += 25;
m_fancyGfxButton.m_yPos = m_viewBobButton.m_yPos = yPos; yPos += 25;
m_viewDistButton.m_yPos = m_flightHaxButton.m_yPos = yPos; yPos += 25;
m_autoJumpButton.m_yPos = yPos; yPos += 25;
m_buttons.push_back(&m_AOButton);
m_buttons.push_back(&m_srvVisButton);
@@ -111,6 +116,7 @@ void OptionsScreen::init()
m_buttons.push_back(&m_viewBobButton);
m_buttons.push_back(&m_viewDistButton);
m_buttons.push_back(&m_flightHaxButton);
m_buttons.push_back(&m_autoJumpButton);
m_buttonTabList.push_back(&m_AOButton);
m_buttonTabList.push_back(&m_srvVisButton);
@@ -120,6 +126,7 @@ void OptionsScreen::init()
m_buttonTabList.push_back(&m_anaglyphsButton);
m_buttonTabList.push_back(&m_viewBobButton);
m_buttonTabList.push_back(&m_flightHaxButton);
m_buttonTabList.push_back(&m_autoJumpButton);
m_buttonTabList.push_back(&m_BackButton);
@@ -202,6 +209,9 @@ void OptionsScreen::buttonClicked(Button* pButton)
case OB_FLY_HAX:
pOption = &o.m_bFlyCheat;
break;
case OB_AUTO_JUMP:
pOption = &o.m_bAutoJump;
break;
}
if (!pOption)

View File

@@ -33,6 +33,7 @@ private:
Button m_viewBobButton;
Button m_viewDistButton;
Button m_flightHaxButton;
Button m_autoJumpButton;
#endif
};

View File

@@ -166,7 +166,7 @@ int LocalPlayer::move(float x, float y, float z)
return 1;
// are we trying to walk into stairs or a slab?
if (tileOnTop != Tile::stairs_stone->m_ID && tileOnTop != Tile::stairs_wood->m_ID && tileOnTop != Tile::stoneSlabHalf->m_ID)
if (tileOnTop != Tile::stairs_stone->m_ID && tileOnTop != Tile::stairs_wood->m_ID && tileOnTop != Tile::stoneSlabHalf->m_ID && m_pMinecraft->m_options.m_bAutoJump)
// Nope, we're walking towards a full block. Trigger an auto jump.
m_nAutoJumpFrames = 1;
}