mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-03-22 16:03:31 +00:00
FIX: Rewrite options
This commit is contained in:
@@ -72,22 +72,24 @@ LocalPlayer::~LocalPlayer() {
|
||||
|
||||
/*private*/
|
||||
void LocalPlayer::calculateFlight(float xa, float ya, float za) {
|
||||
float flySpeed = minecraft->options.getProgressValue(OPTIONS_FLY_SPEED);
|
||||
float sensivity = minecraft->options.getProgressValue(OPTIONS_SENSITIVITY);
|
||||
|
||||
xa = xa * minecraft->options.flySpeed;
|
||||
xa = xa * flySpeed;
|
||||
ya = 0;
|
||||
za = za * minecraft->options.flySpeed;
|
||||
za = za * flySpeed;
|
||||
|
||||
#ifdef ANDROID
|
||||
if (Keyboard::isKeyDown(103)) ya = .2f * minecraft->options.flySpeed;
|
||||
if (Keyboard::isKeyDown(102)) ya = -.2f * minecraft->options.flySpeed;
|
||||
#else
|
||||
if (Keyboard::isKeyDown(Keyboard::KEY_E)) ya = .2f * minecraft->options.flySpeed;
|
||||
if (Keyboard::isKeyDown(Keyboard::KEY_Q)) ya = -.2f * minecraft->options.flySpeed;
|
||||
if (Keyboard::isKeyDown(Keyboard::KEY_E)) ya = .2f * flySpeed;
|
||||
if (Keyboard::isKeyDown(Keyboard::KEY_Q)) ya = -.2f * flySpeed;
|
||||
#endif
|
||||
|
||||
flyX = 10 * smoothFlyX.getNewDeltaValue(xa, .35f * minecraft->options.sensitivity);
|
||||
flyY = 10 * smoothFlyY.getNewDeltaValue(ya, .35f * minecraft->options.sensitivity);
|
||||
flyZ = 10 * smoothFlyZ.getNewDeltaValue(za, .35f * minecraft->options.sensitivity);
|
||||
flyX = 10 * smoothFlyX.getNewDeltaValue(xa, .35f * sensivity);
|
||||
flyY = 10 * smoothFlyY.getNewDeltaValue(ya, .35f * sensivity);
|
||||
flyZ = 10 * smoothFlyZ.getNewDeltaValue(za, .35f * sensivity);
|
||||
}
|
||||
|
||||
bool LocalPlayer::isSolidTile(int x, int y, int z) {
|
||||
@@ -152,7 +154,7 @@ void LocalPlayer::tick() {
|
||||
|
||||
printf("armor %d: %d\n", i, a->getAuxValue());
|
||||
}
|
||||
/**/
|
||||
*/
|
||||
|
||||
updateArmorTypeHash();
|
||||
#ifndef STANDALONE_SERVER
|
||||
@@ -251,7 +253,7 @@ void LocalPlayer::closeContainer() {
|
||||
//@Override
|
||||
void LocalPlayer::move(float xa, float ya, float za) {
|
||||
//@note: why is this == minecraft->player needed?
|
||||
if (this == minecraft->player && minecraft->options.isFlying) {
|
||||
if (this == minecraft->player && minecraft->options.getBooleanValue(OPTIONS_IS_FLYING)) {
|
||||
noPhysics = true;
|
||||
float tmp = walkDist; // update
|
||||
calculateFlight((float) xa, (float) ya, (float) za);
|
||||
|
||||
@@ -12,14 +12,12 @@ KeyboardInput::KeyboardInput( Options* options )
|
||||
void KeyboardInput::setKey( int key, bool state )
|
||||
{
|
||||
int id = -1;
|
||||
if (key == options->keyUp.key) id = KEY_UP;
|
||||
if (key == options->keyDown.key) id = KEY_DOWN;
|
||||
if (key == options->keyLeft.key) id = KEY_LEFT;
|
||||
if (key == options->keyRight.key) id = KEY_RIGHT;
|
||||
if (key == options->keyJump.key) id = KEY_JUMP;
|
||||
if (key == options->keySneak.key) id = KEY_SNEAK;
|
||||
if (key == options->keyCraft.key) id = KEY_CRAFT;
|
||||
//printf("key: %d\n", id);
|
||||
if (key == options->getIntValue(OPTIONS_KEY_FORWARD)) id = KEY_UP;
|
||||
if (key == options->getIntValue(OPTIONS_KEY_BACK)) id = KEY_DOWN;
|
||||
if (key == options->getIntValue(OPTIONS_KEY_LEFT)) id = KEY_LEFT;
|
||||
if (key == options->getIntValue(OPTIONS_KEY_RIGHT)) id = KEY_RIGHT;
|
||||
if (key == options->getIntValue(OPTIONS_KEY_JUMP)) id = KEY_JUMP;
|
||||
if (key == options->getIntValue(OPTIONS_KEY_SNEAK)) id = KEY_SNEAK;
|
||||
if (id >= 0) {
|
||||
keys[id] = state;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
}
|
||||
|
||||
virtual void onConfigChanged(const Config& c) {
|
||||
if (false && _options->isJoyTouchArea) {
|
||||
if (false && _options->getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA)) {
|
||||
int touchWidth = c.width - (int)inventoryArea._x1;
|
||||
if (touchWidth > (int)c.minecraft->pixelCalc.millimetersToPixels(60))
|
||||
touchWidth = (int)c.minecraft->pixelCalc.millimetersToPixels(60);
|
||||
@@ -293,7 +293,7 @@ public:
|
||||
}
|
||||
|
||||
void render(float alpha) {
|
||||
if (_options->isJoyTouchArea) {
|
||||
if (_options->getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA)) {
|
||||
fill( (int) (Gui::InvGuiScale * joyTouchArea._x0),
|
||||
(int) (Gui::InvGuiScale * joyTouchArea._y0),
|
||||
(int) (Gui::InvGuiScale * joyTouchArea._x1),
|
||||
@@ -429,8 +429,8 @@ public:
|
||||
#ifdef __APPLE__
|
||||
_turnBuild.pauseArea = _move.getPauseRectangleArea();
|
||||
#endif
|
||||
_turnBuild.inventoryArea = _mc->gui.getRectangleArea( _mc->options.isLeftHanded? 1 : -1 );
|
||||
_turnBuild.setSensitivity(c.options->isJoyTouchArea? 1.8f : 1.0f);
|
||||
_turnBuild.inventoryArea = _mc->gui.getRectangleArea( _mc->options.getBooleanValue(OPTIONS_IS_LEFT_HANDED)? 1 : -1 );
|
||||
_turnBuild.setSensitivity(c.options->getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA)? 1.8f : 1.0f);
|
||||
((ITurnInput*)&_turnBuild)->onConfigChanged(c);
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ void TouchscreenInput_TestFps::onConfigChanged(const Config& c) {
|
||||
float yy;
|
||||
|
||||
const float BaseY = -8 + h - 3.0f * Bh;
|
||||
const float BaseX = _options->isLeftHanded? -8 + w - 3 * Bw
|
||||
const float BaseX = _options->getBooleanValue(OPTIONS_IS_LEFT_HANDED)? -8 + w - 3 * Bw
|
||||
: 8 + 0;
|
||||
// Setup the bounding rectangle
|
||||
_boundingRectangle = RectangleArea(BaseX, BaseY, BaseX + 3 * Bw, BaseY + 3 * Bh);
|
||||
@@ -418,7 +418,7 @@ const RectangleArea& TouchscreenInput_TestFps::getPauseRectangleArea()
|
||||
}
|
||||
|
||||
void TouchscreenInput_TestFps::rebuild() {
|
||||
if (_options->hideGui)
|
||||
if (_options->getBooleanValue(OPTIONS_HIDEGUI))
|
||||
return;
|
||||
|
||||
Tesselator& t = Tesselator::instance;
|
||||
|
||||
Reference in New Issue
Block a user