mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-03-20 06:53:30 +00:00
FEAT: Tweaks in options
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "Minecraft.h"
|
||||
#include "client/player/input/IBuildInput.h"
|
||||
#include "world/item/Item.h"
|
||||
#include "world/item/ItemInstance.h"
|
||||
#include <string>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -728,13 +730,24 @@ void Minecraft::tickInput() {
|
||||
if (key == Keyboard::KEY_E) {
|
||||
screenChooser.setScreen(SCREEN_BLOCKSELECTION);
|
||||
}
|
||||
|
||||
if (!screen && key == Keyboard::KEY_T && level) {
|
||||
setScreen(new ConsoleScreen());
|
||||
}
|
||||
|
||||
if (!screen && key == Keyboard::KEY_O || key == 250) {
|
||||
releaseMouse();
|
||||
}
|
||||
|
||||
if (key == Keyboard::KEY_F)
|
||||
options.viewDistance = (options.viewDistance + 1) % 4;
|
||||
|
||||
if (key == Keyboard::KEY_F3) {
|
||||
options.renderDebug = !options.renderDebug;
|
||||
}
|
||||
if (key == Keyboard::KEY_F4) {
|
||||
player->inventory->add(new ItemInstance(Tile::ironBlock));
|
||||
}
|
||||
if (key == Keyboard::KEY_F5) {
|
||||
options.thirdPersonView = !options.thirdPersonView;
|
||||
/*
|
||||
@@ -743,6 +756,7 @@ void Minecraft::tickInput() {
|
||||
printf("%d\t%f\n", i, noise.grad2(i, 3, 8));
|
||||
*/
|
||||
}
|
||||
|
||||
#endif
|
||||
#if defined(WIN32)
|
||||
if (key == Keyboard::KEY_F) {
|
||||
@@ -822,9 +836,6 @@ void Minecraft::tickInput() {
|
||||
if (player->inventory->getItem(i))
|
||||
player->inventory->dropSlot(i, false);
|
||||
}
|
||||
if (key == Keyboard::KEY_F3) {
|
||||
options.renderDebug = !options.renderDebug;
|
||||
}
|
||||
if (key == Keyboard::KEY_M) {
|
||||
options.difficulty = (options.difficulty == Difficulty::PEACEFUL)?
|
||||
Difficulty::NORMAL : Difficulty::PEACEFUL;
|
||||
|
||||
@@ -18,9 +18,12 @@ const char* OptionStrings::Controls_UseTouchJoypad = "ctrl_usetouchjoypad";
|
||||
const char* OptionStrings::Controls_IsLefthanded = "ctrl_islefthanded";
|
||||
// why it isnt ctrl_feedback_vibration? i dont want touch it because compatibility with older versions
|
||||
const char* OptionStrings::Controls_FeedbackVibration = "feedback_vibration";
|
||||
const char* OptionStrings::Controls_AutoJump = "ctrl_autojump";
|
||||
|
||||
const char* OptionStrings::Audio_Music = "audio_music";
|
||||
const char* OptionStrings::Audio_Sound = "audio_sound";
|
||||
const char* OptionStrings::Audio_Music = "audio_music";
|
||||
const char* OptionStrings::Audio_Sound = "audio_sound";
|
||||
|
||||
const char* OptionStrings::Game_DifficultyLevel = "game_difficulty";
|
||||
|
||||
const char* OptionStrings::Tweaks_Sprint = "tweaks_sprint";
|
||||
const char* OptionStrings::Tweaks_BarOnTop = "tweaks_barontop";
|
||||
@@ -20,6 +20,7 @@ public:
|
||||
static const char* Controls_UseTouchJoypad;
|
||||
static const char* Controls_IsLefthanded;
|
||||
static const char* Controls_FeedbackVibration;
|
||||
static const char* Controls_AutoJump;
|
||||
|
||||
static const char* Audio_Music;
|
||||
static const char* Audio_Sound;
|
||||
@@ -27,6 +28,9 @@ public:
|
||||
|
||||
static const char* Game_DifficultyLevel;
|
||||
|
||||
static const char* Tweaks_Sprint;
|
||||
static const char* Tweaks_BarOnTop;
|
||||
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT__OptionsStrings_H__*/
|
||||
|
||||
@@ -23,9 +23,13 @@ void Options::initDefaultValues() {
|
||||
useMouseForDigging = false;
|
||||
destroyVibration = true;
|
||||
isLeftHanded = false;
|
||||
autoJump = true;
|
||||
|
||||
isJoyTouchArea = false;
|
||||
|
||||
useSprinting = true;
|
||||
barOnTop = false;
|
||||
|
||||
music = 1;
|
||||
sound = 1;
|
||||
sensitivity = 0.5f;
|
||||
@@ -126,27 +130,30 @@ void Options::initDefaultValues() {
|
||||
}
|
||||
|
||||
const Options::Option
|
||||
Options::Option::MUSIC (0, "options.music", true, false),
|
||||
Options::Option::SOUND (1, "options.sound", true, false),
|
||||
Options::Option::INVERT_MOUSE (2, "options.invertMouse", false, true),
|
||||
Options::Option::SENSITIVITY (3, "options.sensitivity", true, false),
|
||||
Options::Option::RENDER_DISTANCE (4, "options.renderDistance",false, false),
|
||||
Options::Option::VIEW_BOBBING (5, "options.viewBobbing", false, true),
|
||||
Options::Option::ANAGLYPH (6, "options.anaglyph", false, true),
|
||||
Options::Option::LIMIT_FRAMERATE (7, "options.limitFramerate",false, true),
|
||||
Options::Option::DIFFICULTY (8, "options.difficulty", false, false),
|
||||
Options::Option::GRAPHICS (9, "options.graphics", false, true),
|
||||
Options::Option::AMBIENT_OCCLUSION (10, "options.ao", false, true),
|
||||
Options::Option::GUI_SCALE (11, "options.guiScale", false, false),
|
||||
Options::Option::THIRD_PERSON (12, "options.thirdperson", false, true),
|
||||
Options::Option::HIDE_GUI (13, "options.hidegui", false, true),
|
||||
Options::Option::SERVER_VISIBLE (14, "options.servervisible", false, true),
|
||||
Options::Option::LEFT_HANDED (15, "options.lefthanded", false, true),
|
||||
Options::Option::USE_TOUCHSCREEN (16, "options.usetouchscreen", false, true),
|
||||
Options::Option::USE_TOUCH_JOYPAD (17, "options.usetouchpad", false, true),
|
||||
Options::Option::DESTROY_VIBRATION (18, "options.destroyvibration", false, true),
|
||||
Options::Option::MUSIC (0, "options.music", true, false),
|
||||
Options::Option::SOUND (1, "options.sound", true, false),
|
||||
Options::Option::INVERT_MOUSE (2, "options.invertMouse", false, true),
|
||||
Options::Option::SENSITIVITY (3, "options.sensitivity", true, false),
|
||||
Options::Option::RENDER_DISTANCE (4, "options.renderDistance",false, false),
|
||||
Options::Option::VIEW_BOBBING (5, "options.viewBobbing", false, true),
|
||||
Options::Option::ANAGLYPH (6, "options.anaglyph", false, true),
|
||||
Options::Option::LIMIT_FRAMERATE (7, "options.limitFramerate",false, true),
|
||||
Options::Option::DIFFICULTY (8, "options.difficulty", false, false),
|
||||
Options::Option::GRAPHICS (9, "options.graphics", false, true),
|
||||
Options::Option::AMBIENT_OCCLUSION (10, "options.ao", false, true),
|
||||
Options::Option::GUI_SCALE (11, "options.guiScale", false, false),
|
||||
Options::Option::THIRD_PERSON (12, "options.thirdperson", false, true),
|
||||
Options::Option::HIDE_GUI (13, "options.hidegui", false, true),
|
||||
Options::Option::SERVER_VISIBLE (14, "options.servervisible", false, true),
|
||||
Options::Option::LEFT_HANDED (15, "options.lefthanded", false, true),
|
||||
Options::Option::USE_TOUCHSCREEN (16, "options.usetouchscreen", false, true),
|
||||
Options::Option::USE_TOUCH_JOYPAD (17, "options.usetouchpad", false, true),
|
||||
Options::Option::DESTROY_VIBRATION (18, "options.destroyvibration", false, true),
|
||||
Options::Option::PIXELS_PER_MILLIMETER(19, "options.pixelspermilimeter", true, false),
|
||||
Options::Option::VSYNC (20, "options.vsync", false, true);
|
||||
Options::Option::VSYNC (20, "options.vsync", false, true),
|
||||
Options::Option::SPRINTING (21, "options.sprint", false, true),
|
||||
Options::Option::BARONTOP (22, "options.barontop", false, true),
|
||||
Options::Option::AUTOJUMP (23, "options.autojump", false, true);
|
||||
|
||||
/* private */
|
||||
const float Options::SOUND_MIN_VALUE = 0.0f;
|
||||
@@ -216,6 +223,9 @@ void Options::update()
|
||||
if (key == OptionStrings::Controls_IsLefthanded) {
|
||||
readBool(value, isLeftHanded);
|
||||
}
|
||||
if (key == OptionStrings::Controls_AutoJump) {
|
||||
readBool(value, autoJump);
|
||||
}
|
||||
if (key == OptionStrings::Controls_UseTouchJoypad) {
|
||||
readBool(value, isJoyTouchArea);
|
||||
if (!minecraft->useTouchscreen())
|
||||
@@ -268,6 +278,14 @@ void Options::update()
|
||||
if (difficulty != Difficulty::PEACEFUL && difficulty != Difficulty::NORMAL)
|
||||
difficulty = Difficulty::NORMAL;
|
||||
}
|
||||
|
||||
// Enchancements
|
||||
if (key == OptionStrings::Tweaks_Sprint) {
|
||||
readBool(value, useSprinting);
|
||||
}
|
||||
if (key == OptionStrings::Tweaks_BarOnTop) {
|
||||
readBool(value, barOnTop);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
@@ -323,9 +341,11 @@ void Options::save()
|
||||
|
||||
// Login
|
||||
addOptionToSaveOutput(stringVec, OptionStrings::Multiplayer_Username, username);
|
||||
|
||||
// Game
|
||||
addOptionToSaveOutput(stringVec, OptionStrings::Multiplayer_ServerVisible, serverVisible);
|
||||
addOptionToSaveOutput(stringVec, OptionStrings::Game_DifficultyLevel, difficulty);
|
||||
|
||||
// Input
|
||||
addOptionToSaveOutput(stringVec, OptionStrings::Controls_InvertMouse, invertYMouse);
|
||||
addOptionToSaveOutput(stringVec, OptionStrings::Controls_Sensitivity, sensitivity);
|
||||
@@ -333,6 +353,8 @@ void Options::save()
|
||||
addOptionToSaveOutput(stringVec, OptionStrings::Controls_UseTouchScreen, useTouchScreen);
|
||||
addOptionToSaveOutput(stringVec, OptionStrings::Controls_UseTouchJoypad, isJoyTouchArea);
|
||||
addOptionToSaveOutput(stringVec, OptionStrings::Controls_FeedbackVibration, destroyVibration);
|
||||
addOptionToSaveOutput(stringVec, OptionStrings::Controls_AutoJump, autoJump);
|
||||
|
||||
// Graphics
|
||||
addOptionToSaveOutput(stringVec, OptionStrings::Graphics_Vsync, vsync);
|
||||
addOptionToSaveOutput(stringVec, OptionStrings::Graphics_GUIScale, guiScale);
|
||||
@@ -342,11 +364,13 @@ void Options::save()
|
||||
addOptionToSaveOutput(stringVec, OptionStrings::Graphics_Anaglyph, anaglyph3d);
|
||||
addOptionToSaveOutput(stringVec, OptionStrings::Graphics_ViewBobbing, bobView);
|
||||
|
||||
//addOptionToSaveOutput(stringVec, OptionStrings::VIEW_BOBBING, fancyGraphics);
|
||||
// Audio
|
||||
addOptionToSaveOutput(stringVec, OptionStrings::Audio_Music, music);
|
||||
addOptionToSaveOutput(stringVec, OptionStrings::Audio_Sound, sound);
|
||||
|
||||
// Tweaks
|
||||
addOptionToSaveOutput(stringVec, OptionStrings::Tweaks_Sprint, useSprinting);
|
||||
addOptionToSaveOutput(stringVec, OptionStrings::Tweaks_BarOnTop, barOnTop);
|
||||
//
|
||||
// static const Option MUSIC;
|
||||
// static const Option SOUND;
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
static const Option SOUND;
|
||||
static const Option INVERT_MOUSE;
|
||||
static const Option SENSITIVITY;
|
||||
static const Option AUTOJUMP;
|
||||
static const Option RENDER_DISTANCE;
|
||||
static const Option VIEW_BOBBING;
|
||||
static const Option ANAGLYPH;
|
||||
@@ -49,6 +50,8 @@ public:
|
||||
|
||||
static const Option PIXELS_PER_MILLIMETER;
|
||||
static const Option VSYNC;
|
||||
static const Option SPRINTING;
|
||||
static const Option BARONTOP;
|
||||
|
||||
/*
|
||||
static Option* getItem(int id) {
|
||||
@@ -120,6 +123,7 @@ public:
|
||||
bool useMouseForDigging;
|
||||
bool isLeftHanded;
|
||||
bool destroyVibration;
|
||||
bool autoJump;
|
||||
//std::string skin;
|
||||
|
||||
KeyMapping keyUp;
|
||||
@@ -163,6 +167,10 @@ public:
|
||||
bool isJoyTouchArea;
|
||||
bool useTouchScreen;
|
||||
float pixelsPerMillimeter;
|
||||
|
||||
bool useSprinting;
|
||||
bool barOnTop;
|
||||
|
||||
Options(Minecraft* minecraft, const std::string& workingDirectory)
|
||||
: minecraft(minecraft)
|
||||
{
|
||||
@@ -246,6 +254,10 @@ public:
|
||||
ambientOcclusion = !ambientOcclusion;
|
||||
//minecraft->levelRenderer.allChanged();
|
||||
}
|
||||
if (option == &Option::SPRINTING) useSprinting = !useSprinting;
|
||||
if (option == &Option::BARONTOP) barOnTop = !barOnTop;
|
||||
if (option == &Option::AUTOJUMP) autoJump = !autoJump;
|
||||
|
||||
notifyOptionUpdate(option, getBooleanValue(option));
|
||||
save();
|
||||
}
|
||||
@@ -289,12 +301,18 @@ public:
|
||||
return serverVisible;
|
||||
if (item == &Option::LEFT_HANDED)
|
||||
return isLeftHanded;
|
||||
if (item == &Option::AUTOJUMP)
|
||||
return autoJump;
|
||||
if (item == &Option::USE_TOUCHSCREEN)
|
||||
return useTouchScreen;
|
||||
if (item == &Option::USE_TOUCH_JOYPAD)
|
||||
return isJoyTouchArea;
|
||||
if (item == &Option::DESTROY_VIBRATION)
|
||||
return destroyVibration;
|
||||
if (item == &Option::SPRINTING)
|
||||
return useSprinting;
|
||||
if (item == &Option::BARONTOP)
|
||||
return barOnTop;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -585,11 +585,14 @@ void Gui::renderHearts() {
|
||||
int oh = minecraft->player->lastHealth;
|
||||
random.setSeed(tickCount * 312871);
|
||||
|
||||
int xx = 2;//screenWidth / 2 - getNumSlots() * 10;
|
||||
int screenWidth = (int)(minecraft->width * InvGuiScale);
|
||||
int screenHeight = (int)(minecraft->height * InvGuiScale);
|
||||
|
||||
int xx = (minecraft->options.barOnTop) ? screenWidth / 2 - getNumSlots() * 10 - 1 : 2;
|
||||
|
||||
int armor = minecraft->player->getArmorValue();
|
||||
for (int i = 0; i < Player::MAX_HEALTH / 2; i++) {
|
||||
int yo = 2;
|
||||
int yo = (minecraft->options.barOnTop) ? screenHeight - 32 : 2;
|
||||
int ip2 = i + i + 1;
|
||||
|
||||
if (armor > 0) {
|
||||
@@ -617,11 +620,15 @@ void Gui::renderHearts() {
|
||||
|
||||
void Gui::renderBubbles() {
|
||||
if (minecraft->player->isUnderLiquid(Material::water)) {
|
||||
int yo = 12;
|
||||
int screenWidth = (int)(minecraft->width * InvGuiScale);
|
||||
int screenHeight = (int)(minecraft->height * InvGuiScale);
|
||||
|
||||
int xx = (minecraft->options.barOnTop) ? screenWidth / 2 - getNumSlots() * 10 - 1 : 2;
|
||||
int yo = (minecraft->options.barOnTop) ? screenHeight - 42 : 12;
|
||||
int count = (int) std::ceil((minecraft->player->airSupply - 2) * 10.0f / Player::TOTAL_AIR_SUPPLY);
|
||||
int extra = (int) std::ceil((minecraft->player->airSupply) * 10.0f / Player::TOTAL_AIR_SUPPLY) - count;
|
||||
for (int i = 0; i < count + extra; i++) {
|
||||
int xo = i * 8 + 2;
|
||||
int xo = i * 8 + xx;
|
||||
if (i < count) blit(xo, yo, 16, 9 * 2, 9, 9);
|
||||
else blit(xo, yo, 16 + 9, 9 * 2, 9, 9);
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ void OptionsScreen::init() {
|
||||
categoryButtons.push_back(new Touch::TButton(3, "Game"));
|
||||
categoryButtons.push_back(new Touch::TButton(4, "Controls"));
|
||||
categoryButtons.push_back(new Touch::TButton(5, "Graphics"));
|
||||
categoryButtons.push_back(new Touch::TButton(6, "Tweaks"));
|
||||
|
||||
btnChangeUsername = new Touch::TButton(10, "Username");
|
||||
btnCredits = new Touch::TButton(11, "Credits");
|
||||
@@ -221,6 +222,7 @@ void OptionsScreen::generateOptionScreens() {
|
||||
optionPanes.push_back(new OptionsPane());
|
||||
optionPanes.push_back(new OptionsPane());
|
||||
optionPanes.push_back(new OptionsPane());
|
||||
optionPanes.push_back(new OptionsPane());
|
||||
|
||||
// Login Pane
|
||||
optionPanes[0]->createOptionsGroup("options.group.mojang")
|
||||
@@ -235,7 +237,8 @@ void OptionsScreen::generateOptionScreens() {
|
||||
|
||||
// Controls Pane
|
||||
optionPanes[2]->createOptionsGroup("options.group.controls")
|
||||
.addOptionItem(&Options::Option::INVERT_MOUSE, minecraft);
|
||||
.addOptionItem(&Options::Option::INVERT_MOUSE, minecraft)
|
||||
.addOptionItem(&Options::Option::AUTOJUMP, minecraft);
|
||||
|
||||
// Graphics Pane
|
||||
optionPanes[3]->createOptionsGroup("options.group.graphics")
|
||||
@@ -246,6 +249,11 @@ void OptionsScreen::generateOptionScreens() {
|
||||
.addOptionItem(&Options::Option::VSYNC, minecraft)
|
||||
.addOptionItem(&Options::Option::MUSIC, minecraft)
|
||||
.addOptionItem(&Options::Option::SOUND, minecraft);
|
||||
|
||||
// Tweaks Pane
|
||||
optionPanes[4]->createOptionsGroup("options.group.tweaks")
|
||||
.addOptionItem(&Options::Option::SPRINTING, minecraft)
|
||||
.addOptionItem(&Options::Option::BARONTOP, minecraft);
|
||||
}
|
||||
|
||||
void OptionsScreen::mouseClicked(int x, int y, int buttonNum) {
|
||||
|
||||
@@ -182,7 +182,7 @@ void LocalPlayer::aiStep() {
|
||||
// Sprint: detect W double-tap
|
||||
{
|
||||
bool forwardHeld = (input->ya > 0);
|
||||
if (forwardHeld && !prevForwardHeld) {
|
||||
if (forwardHeld && !prevForwardHeld && minecraft->options.useSprinting) {
|
||||
// leading edge of W press
|
||||
if (sprintDoubleTapTimer > 0)
|
||||
sprinting = true;
|
||||
@@ -271,7 +271,7 @@ void LocalPlayer::move(float xa, float ya, float za) {
|
||||
|
||||
float newX = x, newZ = z;
|
||||
|
||||
if (autoJumpTime <= 0 && autoJumpEnabled)
|
||||
if (autoJumpTime <= 0 && minecraft->options.autoJump)
|
||||
{
|
||||
// auto-jump when crossing the middle of a tile, and the tile in the front is blocked
|
||||
bool jump = false;
|
||||
|
||||
Reference in New Issue
Block a user