Options Logic Cleanup (#71)

* Output/Logging Overhaul
* Added StandardOut class
* Renamed LOGX macros to LOG_X
* Removed LogMsg macros in favor of LOG_X
* Added console window for debug Windows builds

* Options Refactor
* Moved options loading code from AppPlatform classes to Options class
* Added AppPlatform::singleton()
* Minecraft::m_options is now only accessible via Minecraft::getOptions() (as it should be)
* Making this work with SDL2 next

* Options Cleanup for SDL2

* Added AppPlatform::hasFileSystemAccess()
* Options won't try to load if hasFileSystemAccess returns false. Emscripten build will be happy.

---------

Co-authored-by: Brent Da Mage <BrentDaMage@users.noreply.github.com>
This commit is contained in:
Brent
2023-09-04 04:11:36 -05:00
committed by GitHub
parent cd4c469571
commit 2e55f99a54
25 changed files with 355 additions and 275 deletions

View File

@@ -289,63 +289,7 @@ Texture AppPlatform_sdl::loadTexture(const std::string& path, bool b)
return out;
}
std::string AppPlatform_sdl::getOptionsFilePath() const
bool AppPlatform_sdl::hasFileSystemAccess()
{
return _storageDir + "/options.txt";
}
std::vector<std::string> AppPlatform_sdl::getOptionStrings()
{
// TODO: This isn't specific to SDL2. Why isn't it in an AppPlatform base class?
std::vector<std::string> o;
LOG_I("Storage dir is %s", _storageDir.c_str());
std::ifstream ifs(getOptionsFilePath().c_str());
if (!ifs.is_open())
{
LOG_W("options.txt doesn't exist, resetting to defaults");
return o;
}
std::string str;
while (true)
{
if (!std::getline(ifs, str, '\n'))
break;
if (str.empty() || str[0] == '#')
continue;
std::stringstream ss;
ss << str;
std::string key, value;
if (std::getline(ss, key, ':') && std::getline(ss, value))
{
o.push_back(key);
o.push_back(value);
}
}
return o;
}
void AppPlatform_sdl::setOptionStrings(const std::vector<std::string>& str)
{
// TODO: This isn't specific to SDL2. Why isn't it in an AppPlatform base class?
assert(str.size() % 2 == 0);
std::ofstream os;
os.open(getOptionsFilePath().c_str());
if (!os.is_open())
{
LOG_E("Failed to read options.txt");
return;
}
os << "#Config file for Minecraft PE. The # at the start denotes a comment, removing it makes it a command.\n\n";
for (int i = 0; i < int(str.size()); i += 2)
os << str[i] << ':' << str[i + 1] << '\n';
return true;
}

View File

@@ -11,10 +11,9 @@ public:
void saveScreenshot(const std::string& fileName, int width, int height) override;
Texture loadTexture(const std::string& path, bool b = false) override;
std::vector<std::string> getOptionStrings() override;
void setOptionStrings(const std::vector<std::string>& str) override;
bool hasFileSystemAccess() override;
protected:
void ensureDirectoryExists(const char* path) override;
std::string getOptionsFilePath() const;
};

View File

@@ -176,47 +176,9 @@ Texture AppPlatform_windows::loadTexture(const std::string& str, bool b)
return Texture(width, height, img2, 1, 0);
}
std::vector<std::string> AppPlatform_windows::getOptionStrings()
bool AppPlatform_windows::hasFileSystemAccess()
{
std::vector<std::string> o;
std::ifstream ifs("options.txt");
if (!ifs.is_open())
return o;
std::string str;
while (true)
{
if (!std::getline(ifs, str, '\n'))
break;
if (str.empty() || str[0] == '#')
continue;
std::stringstream ss;
ss << str;
std::string key, value;
if (std::getline(ss, key, ':') && std::getline(ss, value))
{
o.push_back(key);
o.push_back(value);
}
}
return o;
}
void AppPlatform_windows::setOptionStrings(const std::vector<std::string>& str)
{
assert(str.size() % 2 == 0);
std::ofstream os("options.txt");
os << "#Config file for Minecraft PE. The # at the start denotes a comment, removing it makes it a command.\n\n";
for (int i = 0; i < int(str.size()); i += 2)
os << str[i] << ':' << str[i + 1] << '\n';
return true;
}
std::string AppPlatform_windows::getPatchData()

View File

@@ -34,7 +34,6 @@ public:
void showDialog(eDialogType) override;
std::string getDateString(int time) override;
Texture loadTexture(const std::string& str, bool b) override;
std::vector<std::string> getOptionStrings() override;
// Also add these to allow proper turning within the game.
void recenterMouse() override;
@@ -46,9 +45,8 @@ public:
// Also add these to allow proper text input within the game.
bool shiftPressed() override { return m_bShiftPressed; }
void setShiftPressed(bool b) { m_bShiftPressed = b; }
// Also add these to allow saving options.
void setOptionStrings(const std::vector <std::string>& str) override;
bool hasFileSystemAccess() override;
// Also add this to allow dynamic texture patching.
std::string getPatchData() override;

View File

@@ -383,7 +383,7 @@
<ClInclude Include="$(MC_ROOT)\thirdparty\zlib\zutil.h" />
<ClInclude Include="$(MC_ROOT)\compat\KeyCodes.hpp" />
<ClInclude Include="$(MC_ROOT)\compat\SDLKeyCodes.h" />
<ClInclude Include="..\..\..\source\common\Logger.hpp" />
<ClInclude Include="$(MC_ROOT)\source\common\Logger.hpp" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(MC_ROOT)\compat\GLExt.cpp" />
@@ -391,7 +391,7 @@
<ClCompile Include="$(MC_ROOT)\platforms\windows\AppPlatform_windows.cpp" />
<ClCompile Include="$(MC_ROOT)\platforms\windows\main.cpp" />
<ClCompile Include="$(MC_ROOT)\platforms\windows\SoundSystemWindows.cpp" />
<ClInclude Include="..\LoggerWindows.hpp" />
<ClInclude Include="$(MC_ROOT)\platforms\windows\LoggerWindows.hpp" />
<ClCompile Include="$(MC_ROOT)\source\App.cpp" />
<ClCompile Include="$(MC_ROOT)\source\AppPlatform.cpp" />
<ClCompile Include="$(MC_ROOT)\source\client\gui\components\AvailableGamesList.cpp" />
@@ -729,8 +729,8 @@
<ClCompile Include="$(MC_ROOT)\thirdparty\zlib\trees.c" />
<ClCompile Include="$(MC_ROOT)\thirdparty\zlib\uncompr.c" />
<ClCompile Include="$(MC_ROOT)\thirdparty\zlib\zutil.c" />
<ClCompile Include="..\..\..\source\common\Logger.cpp" />
<ClCompile Include="..\LoggerWindows.cpp" />
<ClCompile Include="$(MC_ROOT)\source\common\Logger.cpp" />
<ClCompile Include="$(MC_ROOT)\platforms\windows\LoggerWindows.cpp" />
</ItemGroup>
<ItemGroup>
<Text Include="$(MC_ROOT)\thirdparty\raknet\CMakeLists.txt" />

View File

@@ -1178,6 +1178,9 @@
<ClInclude Include="..\..\..\source\common\Logger.hpp">
<Filter>source\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\source\common\StandardOut.hpp">
<Filter>source\common</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(MC_ROOT)\thirdparty\raknet\TwoWayAuthentication.cpp">
@@ -2206,10 +2209,10 @@
<ClCompile Include="$(MC_ROOT)\platforms\windows\SoundSystemWindows.cpp">
<Filter>source\platforms\windows</Filter>
</ClCompile>
<ClCompile Include="..\LoggerWindows.cpp">
<ClCompile Include="$(MC_ROOT)\platforms\windows\LoggerWindows.cpp">
<Filter>source\platforms\windows</Filter>
</ClCompile>
<ClCompile Include="..\..\..\source\common\Logger.cpp">
<ClCompile Include="$(MC_ROOT)\source\common\Logger.cpp">
<Filter>source\common</Filter>
</ClCompile>
</ItemGroup>

View File

@@ -9,6 +9,23 @@
#include "AppPlatform.hpp"
#include "common/Utils.hpp"
AppPlatform* AppPlatform::m_singleton = nullptr;
AppPlatform* const AppPlatform::singleton()
{
return m_singleton;
}
AppPlatform::AppPlatform()
{
m_singleton = this;
}
AppPlatform::~AppPlatform()
{
}
void AppPlatform::_tick()
{
@@ -89,11 +106,6 @@ Texture AppPlatform::loadTexture(const std::string&, bool)
return Texture(0, 0, nullptr, 1, 0);
}
std::vector<std::string> AppPlatform::getOptionStrings()
{
return std::vector<std::string>();
}
void AppPlatform::recenterMouse()
{
@@ -123,8 +135,9 @@ bool AppPlatform::shiftPressed()
return false;
}
void AppPlatform::setOptionStrings(const std::vector<std::string>& vec)
bool AppPlatform::hasFileSystemAccess()
{
return false;
}
std::string AppPlatform::getPatchData()

View File

@@ -24,7 +24,14 @@ public:
DLG_RENAME_MP_WORLD,
};
private:
static AppPlatform* m_singleton;
public:
static AppPlatform* const singleton();
AppPlatform();
~AppPlatform();
virtual void buyGame();
virtual int checkLicense();
virtual void createUserInput();
@@ -39,7 +46,6 @@ public:
virtual void showDialog(eDialogType);
virtual void uploadPlatformDependentData(int, void*);
virtual Texture loadTexture(const std::string&, bool);
virtual std::vector<std::string> getOptionStrings();
#ifndef ORIGINAL_CODE
// Also add these to allow proper turning within the game.
@@ -50,8 +56,7 @@ public:
virtual void updateFocused(bool focused);
// Also add this to allow proper text input within the game.
virtual bool shiftPressed();
// Also add this to allow option saving.
virtual void setOptionStrings(const std::vector<std::string>& vec);
virtual bool hasFileSystemAccess();
// Also add this to allow dynamic patching.
virtual std::string getPatchData();
#endif

View File

@@ -50,6 +50,7 @@ const char* Minecraft::progressMessages[] =
Minecraft::Minecraft() :
m_gui(this)
{
m_options = nullptr;
field_18 = false;
field_288 = false;
m_pLevelRenderer = nullptr;
@@ -192,17 +193,10 @@ void Minecraft::onGraphicsReset()
EntityRenderDispatcher::getInstance()->onGraphicsReset();
}
void Minecraft::reloadOptions()
{
m_options.update(platform()->getOptionStrings());
// update the user's name.
m_pUser->field_0 = m_options.m_playerName;
}
void Minecraft::saveOptions()
{
platform()->setOptionStrings(m_options.getOptionStrings());
if (platform()->hasFileSystemAccess())
getOptions()->save();
}
bool Minecraft::isLevelGenerated()
@@ -399,7 +393,7 @@ void Minecraft::tickInput()
if (Mouse::isButtonDown(1))
m_gui.handleClick(1, Mouse::getX(), Mouse::getY());
if (!bIsInGUI && m_options.field_19)
if (!bIsInGUI && getOptions()->field_19)
{
if (Mouse::getEventButton() == Mouse::LEFT && Mouse::getEventButtonState() == Mouse::DOWN)
{
@@ -456,19 +450,19 @@ void Minecraft::tickInput()
for (int i = 0; i < 9; i++)
{
if (m_options.isKey(eKeyMappingIndex(KM_SLOT_1 + i), keyCode))
if (getOptions()->isKey(eKeyMappingIndex(KM_SLOT_1 + i), keyCode))
m_pLocalPlayer->m_pInventory->selectSlot(i);
}
if (m_options.isKey(KM_TOGGLE3RD, keyCode))
if (getOptions()->isKey(KM_TOGGLE3RD, keyCode))
{
m_options.m_bThirdPerson = !m_options.m_bThirdPerson;
getOptions()->m_bThirdPerson = !getOptions()->m_bThirdPerson;
}
else if (m_options.isKey(KM_MENU_CANCEL, keyCode))
else if (getOptions()->isKey(KM_MENU_CANCEL, keyCode))
{
pauseGame();
}
else if (m_options.isKey(KM_DROP, keyCode))
else if (getOptions()->isKey(KM_DROP, keyCode))
{
int itemID = m_pLocalPlayer->m_pInventory->getSelectedItemId();
if (itemID > 0)
@@ -477,33 +471,33 @@ void Minecraft::tickInput()
m_pLocalPlayer->drop(&inst);
}
}
else if (m_options.isKey(KM_TOGGLEGUI, keyCode))
else if (getOptions()->isKey(KM_TOGGLEGUI, keyCode))
{
m_options.m_bDontRenderGui = !m_options.m_bDontRenderGui;
getOptions()->m_bDontRenderGui = !getOptions()->m_bDontRenderGui;
}
else if (m_options.isKey(KM_TOGGLEDEBUG, keyCode))
else if (getOptions()->isKey(KM_TOGGLEDEBUG, keyCode))
{
m_options.m_bDebugText = !m_options.m_bDebugText;
getOptions()->m_bDebugText = !getOptions()->m_bDebugText;
}
#ifdef ENH_ALLOW_AO
else if (m_options.isKey(KM_TOGGLEAO, keyCode))
else if (getOptions()->isKey(KM_TOGGLEAO, keyCode))
{
// Toggle ambient occlusion.
m_options.m_bAmbientOcclusion = !m_options.m_bAmbientOcclusion;
Minecraft::useAmbientOcclusion = m_options.m_bAmbientOcclusion;
getOptions()->m_bAmbientOcclusion = !getOptions()->m_bAmbientOcclusion;
Minecraft::useAmbientOcclusion = getOptions()->m_bAmbientOcclusion;
m_pLevelRenderer->allChanged();
}
#endif
}
if (m_options.field_19)
if (getOptions()->field_19)
continue;
if (getTimeMs() - field_2B4 <= 200)
{
if (m_options.getKey(KM_DESTROY) == keyCode && bPressed)
if (getOptions()->getKey(KM_DESTROY) == keyCode && bPressed)
handleMouseClick(1);
if (m_options.getKey(KM_PLACE) == keyCode && bPressed)
if (getOptions()->getKey(KM_PLACE) == keyCode && bPressed)
handleMouseClick(2);
}
}
@@ -511,12 +505,12 @@ void Minecraft::tickInput()
// @TODO: fix gotos
bool v12 = false;
if (m_options.field_19)
if (getOptions()->field_19)
{
if (!Mouse::isButtonDown(Mouse::LEFT) || bIsInGUI)
goto label_12;
}
else if (Keyboard::isKeyDown(m_options.getKey(KM_DESTROY)))
else if (Keyboard::isKeyDown(getOptions()->getKey(KM_DESTROY)))
{
goto label_12;
}
@@ -743,7 +737,23 @@ void Minecraft::update()
void Minecraft::init()
{
m_pTextures = new Textures(&m_options, platform());
if (platform()->hasFileSystemAccess())
m_options = new Options(m_externalStorageDir);
else
m_options = new Options();
#ifndef ORIGINAL_CODE
m_pTurnInput = new MouseTurnInput(this);
#else
m_pTurnInput = new ControllerTurnInput;
#endif
m_pRakNetInstance = new RakNetInstance;
m_pSoundEngine = new SoundEngine;
m_pSoundEngine->init(m_options);
m_pTextures = new Textures(m_options, platform());
m_pTextures->addDynamicTexture(new WaterTexture);
m_pTextures->addDynamicTexture(new WaterSideTexture);
m_pTextures->addDynamicTexture(new LavaTexture);
@@ -752,7 +762,7 @@ void Minecraft::init()
m_pLevelRenderer = new LevelRenderer(this, m_pTextures);
m_pGameRenderer = new GameRenderer(this);
m_pParticleEngine = new ParticleEngine(m_pLevel, m_pTextures);
m_pUser = new User("TestUser", "");
m_pUser = new User(getOptions()->m_playerName, "");
#ifdef TEST_SURVIVAL_MODE
m_pGameMode = new SurvivalMode(this);
@@ -760,9 +770,7 @@ void Minecraft::init()
m_pGameMode = new CreativeMode(this);
#endif
reloadOptions();
m_pFont = new Font(&m_options, "font/default.png", m_pTextures);
m_pFont = new Font(m_options, "font/default.png", m_pTextures);
// Patch Manager
GetPatchManager()->LoadPatchData(platform()->getPatchData());
@@ -777,6 +785,7 @@ void Minecraft::init()
Minecraft::~Minecraft()
{
SAFE_DELETE(m_options);
SAFE_DELETE(m_pNetEventCallback);
SAFE_DELETE(m_pRakNetInstance);
SAFE_DELETE(m_pLevelRenderer);
@@ -956,7 +965,7 @@ void Minecraft::generateLevel(const std::string& unused, Level* pLevel)
if (pLocalPlayer)
{
pLocalPlayer->m_pKeyboardInput = new KeyboardInput(&m_options);
pLocalPlayer->m_pKeyboardInput = new KeyboardInput(m_options);
}
if (m_pLevelRenderer)

View File

@@ -40,7 +40,6 @@ public:
void grabMouse();
void tick();
void tickInput();
void reloadOptions();
void saveOptions();
void handleMouseClick(int type);
void handleMouseDown(int type, bool b);
@@ -77,6 +76,7 @@ public:
const char* getProgressMessage();
LevelStorageSource* getLevelSource();
ItemInstance* getSelectedItem();
Options* getOptions() const { return m_options; }
static void setGuiScaleMultiplier(float f);
@@ -90,10 +90,10 @@ public:
private:
Logger *m_Logger;
Options *m_options;
public:
bool field_18;
Options m_options;
bool field_288;
LevelRenderer* m_pLevelRenderer;
GameRenderer* m_pGameRenderer;

View File

@@ -382,12 +382,12 @@ void Gui::handleClick(int clickID, int mouseX, int mouseY)
void Gui::handleKeyPressed(int keyCode)
{
if (m_pMinecraft->m_options.isKey(KM_INVENTORY, keyCode))
if (m_pMinecraft->getOptions()->isKey(KM_INVENTORY, keyCode))
{
m_pMinecraft->setScreen(new IngameBlockSelectionScreen);
return;
}
if (m_pMinecraft->m_options.isKey(KM_SLOT_R, keyCode))
if (m_pMinecraft->getOptions()->isKey(KM_SLOT_R, keyCode))
{
int* slot = &m_pMinecraft->m_pLocalPlayer->m_pInventory->m_SelectedHotbarSlot;
@@ -402,7 +402,7 @@ void Gui::handleKeyPressed(int keyCode)
return;
}
if (m_pMinecraft->m_options.isKey(KM_SLOT_L, keyCode))
if (m_pMinecraft->getOptions()->isKey(KM_SLOT_L, keyCode))
{
int* slot = &m_pMinecraft->m_pLocalPlayer->m_pInventory->m_SelectedHotbarSlot;
@@ -412,12 +412,12 @@ void Gui::handleKeyPressed(int keyCode)
return;
}
if (m_pMinecraft->m_options.isKey(KM_CHAT_CMD, keyCode) || m_pMinecraft->m_options.isKey(KM_CHAT, keyCode))
if (m_pMinecraft->getOptions()->isKey(KM_CHAT_CMD, keyCode) || m_pMinecraft->getOptions()->isKey(KM_CHAT, keyCode))
{
if (m_pMinecraft->m_pScreen)
return;
m_pMinecraft->setScreen(new ChatScreen(m_pMinecraft->m_options.isKey(KM_CHAT_CMD, keyCode)));
m_pMinecraft->setScreen(new ChatScreen(m_pMinecraft->getOptions()->isKey(KM_CHAT_CMD, keyCode)));
return;
}
}

View File

@@ -70,7 +70,7 @@ bool Screen::isInGameScreen()
void Screen::keyPressed(int key)
{
if (m_pMinecraft->m_options.isKey(KM_MENU_CANCEL, key))
if (m_pMinecraft->getOptions()->isKey(KM_MENU_CANCEL, key))
{
m_pMinecraft->setScreen(nullptr);
}
@@ -78,19 +78,19 @@ void Screen::keyPressed(int key)
if (m_buttonTabList.size())
{
#ifndef ENH_HIGHLIGHT_BY_HOVER
if (m_pMinecraft->m_options.isKey(MENU_NEXT, key))
if (m_pMinecraft->getOptions()->isKey(MENU_NEXT, key))
{
m_tabButtonIndex++;
if (m_tabButtonIndex == int(m_buttonTabList.size()))
m_tabButtonIndex = 0;
}
if (m_pMinecraft->m_options.isKey(MENU_PREVIOUS, key))
if (m_pMinecraft->getOptions()->isKey(MENU_PREVIOUS, key))
{
m_tabButtonIndex--;
if (m_tabButtonIndex == -1)
m_tabButtonIndex = int(m_buttonTabList.size() - 1);
}
if (m_pMinecraft->m_options.isKey(MENU_OK, key))
if (m_pMinecraft->getOptions()->isKey(MENU_OK, key))
{
if (m_buttonTabList[m_tabButtonIndex]->m_bEnabled)
{

View File

@@ -60,7 +60,7 @@ void ChatScreen::render(int mouseX, int mouseY, float f)
void ChatScreen::keyPressed(int keyCode)
{
if (m_pMinecraft->m_options.isKey(KM_MENU_OK, keyCode))
if (m_pMinecraft->getOptions()->isKey(KM_MENU_OK, keyCode))
sendMessageAndExit();
Screen::keyPressed(keyCode);

View File

@@ -65,7 +65,7 @@ static std::string ViewDistanceStr(int dist)
void OptionsScreen::UpdateTexts()
{
Options& o = m_pMinecraft->m_options;
Options& o = *(m_pMinecraft->getOptions());
m_AOButton.m_text = "Smooth lighting: " + BoolOptionStr(o.m_bAmbientOcclusion);
m_invertYButton.m_text = "Invert Y-axis: " + BoolOptionStr(o.m_bInvertMouse);
@@ -159,16 +159,13 @@ void OptionsScreen::render(int a, int b, float c)
void OptionsScreen::removed()
{
#ifdef ORIGINAL_CODE // Reloading options will reload the options.txt we introduced. Don't do this
m_pMinecraft->reloadOptions();
#endif
}
#ifndef ORIGINAL_CODE
void OptionsScreen::buttonClicked(Button* pButton)
{
Options& o = m_pMinecraft->m_options;
Options& o = *(m_pMinecraft->getOptions());
bool* pOption = nullptr;
switch (pButton->m_buttonId)

View File

@@ -59,7 +59,7 @@ bool SelectWorldScreen::isInGameScreen()
void SelectWorldScreen::keyPressed(int code)
{
#ifndef ORIGINAL_CODE
if (m_pMinecraft->m_options.getKey(KM_MENU_OK) == code)
if (m_pMinecraft->getOptions()->getKey(KM_MENU_OK) == code)
m_pWorldSelectionList->selectItem(m_pWorldSelectionList->getItemAtPosition(m_width / 2, m_height / 2), false);
m_btnUnknown.field_36 = true;
@@ -67,10 +67,10 @@ void SelectWorldScreen::keyPressed(int code)
if (m_btnUnknown.field_36)
{
if (m_pMinecraft->m_options.getKey(KM_LEFT) == code)
if (m_pMinecraft->getOptions()->getKey(KM_LEFT) == code)
m_pWorldSelectionList->stepLeft();
if (m_pMinecraft->m_options.getKey(KM_RIGHT) == code)
if (m_pMinecraft->getOptions()->getKey(KM_RIGHT) == code)
m_pWorldSelectionList->stepRight();
}

View File

@@ -84,12 +84,12 @@ void GameRenderer::unZoomRegion()
void GameRenderer::setupCamera(float f, int i)
{
field_8 = float(256 >> m_pMinecraft->m_options.m_iViewDistance);
field_8 = float(256 >> m_pMinecraft->getOptions()->m_iViewDistance);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (m_pMinecraft->m_options.m_bAnaglyphs)
if (m_pMinecraft->getOptions()->m_bAnaglyphs)
{
glTranslatef(float(1 - 2 * i) * 0.07f, 0.0f, 0.0f);
}
@@ -106,13 +106,13 @@ void GameRenderer::setupCamera(float f, int i)
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
if (m_pMinecraft->m_options.m_bAnaglyphs)
if (m_pMinecraft->getOptions()->m_bAnaglyphs)
{
glTranslatef(float(2 * i - 1) * 0.1f, 0.0f, 0.0f);
}
bobHurt(f);
if (m_pMinecraft->m_options.m_bViewBobbing)
if (m_pMinecraft->getOptions()->m_bViewBobbing)
bobView(f);
moveCameraToPlayer(f);
@@ -130,10 +130,10 @@ void GameRenderer::moveCameraToPlayer(float f)
glRotatef(field_5C + f * (field_58 - field_5C), 0.0f, 0.0f, 1.0f);
if (m_pMinecraft->m_options.m_bThirdPerson)
if (m_pMinecraft->getOptions()->m_bThirdPerson)
{
float v11 = field_30 + (field_2C - field_30) * f;
if (m_pMinecraft->m_options.field_241)
if (m_pMinecraft->getOptions()->field_241)
{
glTranslatef(0.0f, 0.0f, -v11);
glRotatef(field_38 + (field_34 - field_38) * f, 1.0f, 0.0f, 0.0f);
@@ -185,7 +185,7 @@ void GameRenderer::moveCameraToPlayer(float f)
glTranslatef(0.0f, 0.0f, -0.1f);
}
if (!m_pMinecraft->m_options.field_241)
if (!m_pMinecraft->getOptions()->field_241)
{
glRotatef(pMob->field_60 + f * (pMob->m_pitch - pMob->field_60), 1.0f, 0.0f, 0.0f);
glRotatef(pMob->field_5C + f * (pMob->m_yaw - pMob->field_5C) + 180.0f, 0.0f, 1.0f, 0.0f);
@@ -256,7 +256,7 @@ void GameRenderer::setupClearColor(float f)
Level* pLevel = pMC->m_pLevel;
Mob* pMob = pMC->m_pMobPersp;
float x1 = 1.0f - powf(1.0f / float(4 - pMC->m_options.m_iViewDistance), 0.25f);
float x1 = 1.0f - powf(1.0f / float(4 - pMC->getOptions()->m_iViewDistance), 0.25f);
Vec3 skyColor = pLevel->getSkyColor(pMob, f), fogColor = pLevel->getFogColor(f);
@@ -287,7 +287,7 @@ void GameRenderer::setupClearColor(float f)
field_64 *= x2;
field_68 *= x2;
if (pMC->m_options.m_bAnaglyphs)
if (pMC->getOptions()->m_bAnaglyphs)
{
float r = (field_60 * 30.0f + field_64 * 59.0f + field_68 * 11.0f) / 100.0f;
float g = (field_60 * 30.0f + field_64 * 70.0f) / 100.0f;
@@ -407,7 +407,7 @@ void GameRenderer::renderLevel(float f)
fCamPos.y = pMob->field_98.y + (pMob->m_pos.y - pMob->field_98.y) * f;
fCamPos.z = pMob->field_98.z + (pMob->m_pos.z - pMob->field_98.z) * f;
bool bAnaglyph = m_pMinecraft->m_options.m_bAnaglyphs;
bool bAnaglyph = m_pMinecraft->getOptions()->m_bAnaglyphs;
LevelRenderer* pLR = m_pMinecraft->m_pLevelRenderer;
ParticleEngine* pPE = m_pMinecraft->m_pParticleEngine;
@@ -431,7 +431,7 @@ void GameRenderer::renderLevel(float f)
saveMatrices();
/*
if (m_pMinecraft->m_options.m_iViewDistance <= 1)
if (m_pMinecraft->getOptions()->m_iViewDistance <= 1)
{
#ifndef ORIGINAL_CODE
// @NOTE: For whatever reason, Minecraft doesn't enable GL_FOG right away.
@@ -446,7 +446,7 @@ void GameRenderer::renderLevel(float f)
glEnable(GL_FOG);
setupFog(1);
if (m_pMinecraft->m_options.m_bAmbientOcclusion)
if (m_pMinecraft->getOptions()->m_bAmbientOcclusion)
glShadeModel(GL_SMOOTH);
Frustum& frust = Frustum::frustum;
@@ -537,7 +537,7 @@ void GameRenderer::render(float f)
#ifndef ENH_DISABLE_TURN_ACCEL
float multPitch = -1.0f;
float mult1 = 2.0f * (0.2f + pMC->m_options.field_8 * 0.6f);
float mult1 = 2.0f * (0.2f + pMC->getOptions()->field_8 * 0.6f);
mult1 = mult1 * mult1 * mult1;
float xd = 4.0f * mult1 * pMC->field_D20;
@@ -552,10 +552,10 @@ void GameRenderer::render(float f)
if (diff_field_84 > 3.0f)
diff_field_84 = 3.0f;
if (pMC->m_options.m_bInvertMouse)
if (pMC->getOptions()->m_bInvertMouse)
multPitch = 1.0f;
if (!pMC->m_options.field_240)
if (!pMC->getOptions()->field_240)
{
// @TODO: untangle this code
float v17 = xd + m_rotZ;
@@ -580,7 +580,7 @@ void GameRenderer::render(float f)
}
#else
float multPitch = -1.0f;
if (pMC->m_options.m_bInvertMouse)
if (pMC->getOptions()->m_bInvertMouse)
multPitch = 1.0f;
float diff_field_84 = 1.0f;
@@ -601,7 +601,7 @@ void GameRenderer::render(float f)
if (t_keepPic < 0)
{
renderLevel(f);
if (m_pMinecraft->m_options.m_bDontRenderGui)
if (m_pMinecraft->getOptions()->m_bDontRenderGui)
{
if (!m_pMinecraft->m_pScreen)
return;
@@ -638,7 +638,7 @@ void GameRenderer::render(float f)
debugText << "ReMinecraftPE " << m_pMinecraft->getVersionString();
debugText << "\n" << m_shownFPS << " fps, " << m_shownChunkUpdates << " chunk updates";
if (m_pMinecraft->m_options.m_bDebugText)
if (m_pMinecraft->getOptions()->m_bDebugText)
{
if (m_pMinecraft->m_pLocalPlayer)
{
@@ -701,7 +701,7 @@ void GameRenderer::tick()
}
float bright = m_pMinecraft->m_pLevel->getBrightness(Mth::floor(pMob->m_pos.x), Mth::floor(pMob->m_pos.y), Mth::floor(pMob->m_pos.z));
float x3 = float(3 - m_pMinecraft->m_options.m_iViewDistance);
float x3 = float(3 - m_pMinecraft->getOptions()->m_iViewDistance);
field_C++;
@@ -718,27 +718,27 @@ void GameRenderer::renderItemInHand(float f, int i)
{
glLoadIdentity();
if (m_pMinecraft->m_options.m_bAnaglyphs)
if (m_pMinecraft->getOptions()->m_bAnaglyphs)
glTranslatef(float(2 * i - 1) * 0.1f, 0.0f, 0.0f);
glPushMatrix();
bobHurt(f);
if (m_pMinecraft->m_options.m_bViewBobbing)
if (m_pMinecraft->getOptions()->m_bViewBobbing)
bobView(f);
if (!m_pMinecraft->m_options.m_bThirdPerson && !m_pMinecraft->m_options.m_bDontRenderGui)
if (!m_pMinecraft->getOptions()->m_bThirdPerson && !m_pMinecraft->getOptions()->m_bDontRenderGui)
m_pItemInHandRenderer->render(f);
glPopMatrix();
if (!m_pMinecraft->m_options.m_bThirdPerson)
if (!m_pMinecraft->getOptions()->m_bThirdPerson)
{
m_pItemInHandRenderer->renderScreenEffect(f);
bobHurt(f);
}
if (m_pMinecraft->m_options.m_bViewBobbing)
if (m_pMinecraft->getOptions()->m_bViewBobbing)
bobView(f);
}

View File

@@ -327,7 +327,7 @@ void ItemInHandRenderer::renderScreenEffect(float f)
renderFire(f);
}
if (m_pMinecraft->m_pLocalPlayer->isInWall() && !m_pMinecraft->m_options.m_bFlyCheat)
if (m_pMinecraft->m_pLocalPlayer->isInWall() && !m_pMinecraft->getOptions()->m_bFlyCheat)
{
int fx = Mth::floor(m_pMinecraft->m_pLocalPlayer->m_pos.x);
int fy = Mth::floor(m_pMinecraft->m_pLocalPlayer->m_pos.y);

View File

@@ -132,10 +132,10 @@ void LevelRenderer::allChanged()
LeafTile* pLeaves = (LeafTile*)Tile::leaves;
pLeaves->m_bTransparent = m_pMinecraft->m_options.m_bFancyGraphics;
pLeaves->m_bTransparent = m_pMinecraft->getOptions()->m_bFancyGraphics;
pLeaves->m_TextureFrame = !pLeaves->m_bTransparent + pLeaves->field_74;
field_BC = m_pMinecraft->m_options.m_iViewDistance;
field_BC = m_pMinecraft->getOptions()->m_iViewDistance;
int x1 = 64 << (3 - field_BC);
if (x1 >= 400)
@@ -491,7 +491,7 @@ void LevelRenderer::render(Mob* pMob, int a, float b)
field_88.push_back(pChunk);
}
if (m_pMinecraft->m_options.m_iViewDistance != field_BC)
if (m_pMinecraft->getOptions()->m_iViewDistance != field_BC)
allChanged();
if (!a)
@@ -519,7 +519,7 @@ void LevelRenderer::render(Mob* pMob, int a, float b)
// @TODO: Fix goto hell
// @NOTE: Field_B8 doesn't appear to be used??
if (field_B8 && !a && !m_pMinecraft->m_options.m_bAnaglyphs)
if (field_B8 && !a && !m_pMinecraft->getOptions()->m_bAnaglyphs)
{
checkQueryResults(0, 16);
@@ -1089,7 +1089,7 @@ void LevelRenderer::renderEntities(Vec3 pos, Culler* culler, float f)
Mob* mob = m_pMinecraft->m_pMobPersp;
EntityRenderDispatcher::getInstance()->prepare(m_pLevel, m_pMinecraft->m_pTextures, m_pMinecraft->m_pFont, mob, &m_pMinecraft->m_options, f);
EntityRenderDispatcher::getInstance()->prepare(m_pLevel, m_pMinecraft->m_pTextures, m_pMinecraft->m_pFont, mob, m_pMinecraft->getOptions(), f);
field_18 = 0;
field_1C = 0;
@@ -1111,7 +1111,7 @@ void LevelRenderer::renderEntities(Vec3 pos, Culler* culler, float f)
if (!culler->isVisible(pEnt->m_hitbox))
continue;
if (m_pMinecraft->m_pMobPersp == pEnt && !m_pMinecraft->m_options.m_bThirdPerson)
if (m_pMinecraft->m_pMobPersp == pEnt && !m_pMinecraft->getOptions()->m_bThirdPerson)
continue;
if (m_pLevel->hasChunkAt(Mth::floor(pEnt->m_pos.x), Mth::floor(pEnt->m_pos.y), Mth::floor(pEnt->m_pos.z)))
@@ -1127,8 +1127,8 @@ extern int t_keepPic;
void LevelRenderer::takePicture(TripodCamera* pCamera, Entity* pOwner)
{
Mob* pOldMob = m_pMinecraft->m_pMobPersp;
bool bOldDontRenderGui = m_pMinecraft->m_options.m_bDontRenderGui;
bool bOldThirdPerson = m_pMinecraft->m_options.m_bThirdPerson;
bool bOldDontRenderGui = m_pMinecraft->getOptions()->m_bDontRenderGui;
bool bOldThirdPerson = m_pMinecraft->getOptions()->m_bThirdPerson;
#ifdef ENH_CAMERA_NO_PARTICLES
extern bool g_bDisableParticles;
@@ -1136,12 +1136,12 @@ void LevelRenderer::takePicture(TripodCamera* pCamera, Entity* pOwner)
#endif
m_pMinecraft->m_pMobPersp = pCamera;
m_pMinecraft->m_options.m_bDontRenderGui = true;
m_pMinecraft->m_options.m_bThirdPerson = false; // really from the perspective of the camera
m_pMinecraft->getOptions()->m_bDontRenderGui = true;
m_pMinecraft->getOptions()->m_bThirdPerson = false; // really from the perspective of the camera
m_pMinecraft->m_pGameRenderer->render(0.0f);
m_pMinecraft->m_pMobPersp = pOldMob;
m_pMinecraft->m_options.m_bDontRenderGui = bOldDontRenderGui;
m_pMinecraft->m_options.m_bThirdPerson = bOldThirdPerson;
m_pMinecraft->getOptions()->m_bDontRenderGui = bOldDontRenderGui;
m_pMinecraft->getOptions()->m_bThirdPerson = bOldThirdPerson;
#ifdef ENH_CAMERA_NO_PARTICLES
g_bDisableParticles = false;
@@ -1229,7 +1229,7 @@ void LevelRenderer::renderSky(float f)
glDisable(GL_TEXTURE_2D);
Vec3 skyColor = m_pLevel->getSkyColor(m_pMinecraft->m_pMobPersp, f);
if (m_pMinecraft->m_options.m_bAnaglyphs)
if (m_pMinecraft->getOptions()->m_bAnaglyphs)
{
skyColor.x = (((skyColor.x * 30.0f) + (skyColor.y * 59.0f)) + (skyColor.z * 11.0f)) / 100.0f;
skyColor.y = ((skyColor.x * 30.0f) + (skyColor.y * 70.0f)) / 100.0f;

View File

@@ -6,6 +6,8 @@
SPDX-License-Identifier: BSD-1-Clause
********************************************************************/
#include <fstream>
#include "Options.hpp"
#include "Util.hpp"
#include "compat/KeyCodes.hpp"
@@ -25,7 +27,7 @@ Options::Option
Options::Option::AMBIENT_OCCLUSION(10, "options.ao", false, true),
Options::Option::GUI_SCALE (11, "options.guiScale", false, false);
void Options::initDefaultValues()
void Options::_initDefaultValues()
{
field_238 = 2;
field_244 = 1.0f;
@@ -201,7 +203,14 @@ void Options::initDefaultValues()
Options::Options()
{
initDefaultValues();
_initDefaultValues();
}
Options::Options(const std::string& folderPath)
{
m_filePath = folderPath + "/options.txt";
_initDefaultValues();
_load();
}
std::string getMessage(const Options::Option& option)
@@ -209,14 +218,34 @@ std::string getMessage(const Options::Option& option)
return "Options::getMessage - Not implemented";
}
void Options::load()
void Options::_load()
{
// stub
std::vector<std::string> strings = readPropertiesFromFile(m_filePath);
for (int i = 0; i < strings.size(); i += 2)
{
std::string key = strings[i], value = strings[i + 1];
if (key == "mp_username")
m_playerName = value;
else if (key == "ctrl_invertmouse")
m_bInvertMouse = readBool(value);
else if (key == "ctrl_autojump")
m_bAutoJump = readBool(value);
else if (key == "gfx_fancygraphics")
m_bFancyGraphics = readBool(value);
else if (key == "mp_server_visible_default")
m_bServerVisibleDefault = readBool(value);
else if (key == "gfx_smoothlighting")
Minecraft::useAmbientOcclusion = m_bAmbientOcclusion = readBool(value);
else if (key == "gfx_viewdistance")
m_iViewDistance = readInt(value);
}
}
void Options::save()
{
// stub
savePropertiesToFile(m_filePath, getOptionStrings());
}
std::string Options::getMessage(const Options::Option& option)
@@ -257,27 +286,59 @@ std::string Options::saveInt(int i)
return ss.str();
}
void Options::update(const std::vector<std::string>& strings)
std::vector<std::string> Options::readPropertiesFromFile(const std::string& filePath)
{
for (int i = 0; i<int(strings.size()); i += 2)
{
std::string key = strings[i], value = strings[i + 1];
std::vector<std::string> o;
if (key == "mp_username")
m_playerName = value;
else if (key == "ctrl_invertmouse")
m_bInvertMouse = readBool(value);
else if (key == "ctrl_autojump")
m_bAutoJump = readBool(value);
else if (key == "gfx_fancygraphics")
m_bFancyGraphics = readBool(value);
else if (key == "mp_server_visible_default")
m_bServerVisibleDefault = readBool(value);
else if (key == "gfx_smoothlighting")
Minecraft::useAmbientOcclusion = m_bAmbientOcclusion = readBool(value);
else if (key == "gfx_viewdistance")
m_iViewDistance = readInt(value);
const char* const path = filePath.c_str();
LOG_I("Loading options from %s", path);
std::ifstream ifs(path);
if (!ifs.is_open())
{
LOG_W("%s doesn't exist, resetting to defaults", path);
return o;
}
std::string str;
while (true)
{
if (!std::getline(ifs, str, '\n'))
break;
if (str.empty() || str[0] == '#')
continue;
std::stringstream ss;
ss << str;
std::string key, value;
if (std::getline(ss, key, ':') && std::getline(ss, value))
{
o.push_back(key);
o.push_back(value);
}
}
return o;
}
void Options::savePropertiesToFile(const std::string& filePath, std::vector<std::string> properties)
{
assert(properties.size() % 2 == 0);
std::ofstream os;
os.open(filePath.c_str());
if (!os.is_open())
{
LOG_E("Failed to read %s", filePath);
return;
}
os << "#Config file for Minecraft PE. The # at the start denotes a comment, removing it makes it a command.\n\n";
for (int i = 0; i < properties.size(); i += 2)
os << properties[i] << ':' << properties[i + 1] << '\n';
}
std::vector<std::string> Options::getOptionStrings()

View File

@@ -67,44 +67,23 @@ class Options
public:
struct Option;
struct KeyBind;
public:
Options();
void initDefaultValues();
void load();
void save();
std::string getMessage(const Options::Option&);
void update(const std::vector<std::string>& string);
std::vector<std::string> getOptionStrings();
public:
private:
static bool readBool(const std::string& str);
static int readInt(const std::string& str);
static std::string saveBool(bool b);
static std::string saveInt(int i);
static std::vector<std::string> readPropertiesFromFile(const std::string& filePath);
static void savePropertiesToFile(const std::string& filePath, std::vector<std::string> properties);
private:
void _initDefaultValues();
void _load();
public:
struct Option
{
bool field_0;
bool field_1;
std::string str;
int field_1C;
Option(int i, const std::string& str, bool b1, bool b2) : field_0(b1), field_1(b2), str(str), field_1C(i) {}
static Option MUSIC;
static Option SOUND;
static Option INVERT_MOUSE;
static Option SENSITIVITY;
static Option RENDER_DISTANCE;
static Option VIEW_BOBBING;
static Option ANAGLYPH;
static Option LIMIT_FRAMERATE;
static Option DIFFICULTY;
static Option GRAPHICS;
static Option AMBIENT_OCCLUSION;
static Option GUI_SCALE;
};
Options();
Options(const std::string& folderPath);
void save();
std::string getMessage(const Options::Option&);
std::vector<std::string> getOptionStrings();
int getKey(eKeyMappingIndex idx)
{
@@ -115,6 +94,9 @@ public:
return getKey(idx) == keyCode;
}
private:
std::string m_filePath;
public:
float field_0;
float m_fMasterVolume;
@@ -143,5 +125,29 @@ public:
bool m_bServerVisibleDefault;
bool m_bAutoJump;
bool m_bDebugText;
public:
struct Option
{
bool field_0;
bool field_1;
std::string str;
int field_1C;
Option(int i, const std::string& str, bool b1, bool b2) : field_0(b1), field_1(b2), str(str), field_1C(i) {}
static Option MUSIC;
static Option SOUND;
static Option INVERT_MOUSE;
static Option SENSITIVITY;
static Option RENDER_DISTANCE;
static Option VIEW_BOBBING;
static Option ANAGLYPH;
static Option LIMIT_FRAMERATE;
static Option DIFFICULTY;
static Option GRAPHICS;
static Option AMBIENT_OCCLUSION;
static Option GUI_SCALE;
};
};

View File

@@ -0,0 +1,46 @@
#include <iostream>
#include <stdarg.h>
#ifdef _WIN32
#include <windows.h>
#endif
#include "StandardOut.hpp"
#include "Util.hpp"
StandardOut* const StandardOut::singleton()
{
// This is automatically allocated when accessed for the first time,
// and automatically deallocated when runtime concludes.
static StandardOut standardOut = StandardOut();
return &standardOut;
}
void StandardOut::print(const char* const str)
{
std::cout << str << std::endl;
#ifdef _WIN32
OutputDebugStringA(str);
OutputDebugStringA("\n");
#endif
}
void StandardOut::print(std::string str)
{
print(str.c_str());
}
void StandardOut::vprintf(const char* const fmt, va_list argPtr)
{
print(Util::vformat(fmt, argPtr));
}
void StandardOut::printf(const char* const fmt, ...)
{
va_list argList;
va_start(argList, fmt);
vprintf(fmt, argList);
va_end(argList);
}

View File

@@ -0,0 +1,37 @@
#pragma once
#include <string>
class StandardOut
{
public:
static StandardOut* const singleton();
void print(const char* const str);
void print(std::string str);
void vprintf(const char* const fmt, va_list argPtr);
void printf(const char* const fmt, ...);
};
#ifdef _DEBUG
#define LOG(...) StandardOut::singleton()->printf(__VA_ARGS__)
#ifdef PLATFORM_ANDROID
#define LOG_I(...) __android_log_print(ANDROID_LOG_INFO, "MinecraftPE", __VA_ARGS__)
#define LOG_W(...) __android_log_print(ANDROID_LOG_WARN, "MinecraftPE", __VA_ARGS__)
#define LOG_E(...) __android_log_print(ANDROID_LOG_ERROR, "MinecraftPE", __VA_ARGS__)
#else
#define LOG_I(...) LOG("[Info]: " __VA_ARGS__)
#define LOG_W(...) LOG("[WARN]: " __VA_ARGS__)
#define LOG_E(...) LOG("[ERROR]: " __VA_ARGS__)
#endif
#else
#define LOG(...)
#define LOG_I(...)
#define LOG_W(...)
#define LOG_E(...)
#endif

View File

@@ -46,7 +46,7 @@ std::string Util::stringTrim(const std::string& str)
std::string Util::vformat(const char *fmt, va_list argPtr)
{
char str[8192];
char str[1024];
vsnprintf(str, sizeof(str), fmt, argPtr);

View File

@@ -54,7 +54,7 @@ void ServerSideNetworkHandler::levelGenerated(Level* level)
level->addListener(this);
allowIncomingConnections(m_pMinecraft->m_options.m_bServerVisibleDefault);
allowIncomingConnections(m_pMinecraft->getOptions()->m_bServerVisibleDefault);
m_onlinePlayers[m_pMinecraft->m_pLocalPlayer->m_guid] = new OnlinePlayer(m_pMinecraft->m_pLocalPlayer, m_pMinecraft->m_pLocalPlayer->m_guid);
}
@@ -345,7 +345,7 @@ void ServerSideNetworkHandler::allowIncomingConnections(bool b)
{
if (b)
{
m_pRakNetInstance->announceServer(m_pMinecraft->m_options.m_playerName);
m_pRakNetInstance->announceServer(m_pMinecraft->getOptions()->m_playerName);
}
else
{

View File

@@ -68,18 +68,18 @@ void LocalPlayer::animateRespawn()
void LocalPlayer::calculateFlight(float x, float y, float z)
{
float f1 = m_pMinecraft->m_options.field_244;
float f1 = m_pMinecraft->getOptions()->field_244;
float x1 = f1 * x;
float z1 = f1 * z;
float y1 = 0.0f;
if (Keyboard::isKeyDown(m_pMinecraft->m_options.getKey(KM_FLY_UP)))
if (Keyboard::isKeyDown(m_pMinecraft->getOptions()->getKey(KM_FLY_UP)))
y1 = f1 * 0.2f;
if (Keyboard::isKeyDown(m_pMinecraft->m_options.getKey(KM_FLY_DOWN)))
if (Keyboard::isKeyDown(m_pMinecraft->getOptions()->getKey(KM_FLY_DOWN)))
y1 = f1 * -0.2f;
field_BFC += x1;
float f2 = m_pMinecraft->m_options.field_8 * 0.35f;
float f2 = m_pMinecraft->getOptions()->field_8 * 0.35f;
float f3 = f2 * (field_BFC - field_C00);
float f4 = field_C04 + 0.5f * (f3 - field_C04);
field_C04 = f4;
@@ -128,7 +128,7 @@ int LocalPlayer::move(float x, float y, float z)
int result = 0;
LocalPlayer* pLP = m_pMinecraft->m_pLocalPlayer;
if (Minecraft::DEADMAU5_CAMERA_CHEATS && pLP == this && m_pMinecraft->m_options.m_bFlyCheat)
if (Minecraft::DEADMAU5_CAMERA_CHEATS && pLP == this && m_pMinecraft->getOptions()->m_bFlyCheat)
{
//@HUH: Using m_pMinecraft->m_pLocalPlayer instead of this, even though they're the same
pLP->m_bNoCollision = true;
@@ -194,7 +194,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 && m_pMinecraft->m_options.m_bAutoJump)
if (tileOnTop != Tile::stairs_stone->m_ID && tileOnTop != Tile::stairs_wood->m_ID && tileOnTop != Tile::stoneSlabHalf->m_ID && m_pMinecraft->getOptions()->m_bAutoJump)
// Nope, we're walking towards a full block. Trigger an auto jump.
m_nAutoJumpFrames = 1;
}