3 Commits

15 changed files with 71 additions and 47 deletions

View File

@@ -41,7 +41,6 @@
042A91AE16B17517007ABBC6 /* GuiElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91A316B17517007ABBC6 /* GuiElement.cpp */; }; 042A91AE16B17517007ABBC6 /* GuiElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91A316B17517007ABBC6 /* GuiElement.cpp */; };
042A91AF16B17517007ABBC6 /* NinePatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91A516B17517007ABBC6 /* NinePatch.cpp */; }; 042A91AF16B17517007ABBC6 /* NinePatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91A516B17517007ABBC6 /* NinePatch.cpp */; };
042A91B016B17517007ABBC6 /* OptionsGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91A716B17517007ABBC6 /* OptionsGroup.cpp */; }; 042A91B016B17517007ABBC6 /* OptionsGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91A716B17517007ABBC6 /* OptionsGroup.cpp */; };
042A91B116B17517007ABBC6 /* OptionsPane.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91A916B17517007ABBC6 /* OptionsPane.cpp */; };
042A91B216B17517007ABBC6 /* TextBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91AB16B17517007ABBC6 /* TextBox.cpp */; }; 042A91B216B17517007ABBC6 /* TextBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91AB16B17517007ABBC6 /* TextBox.cpp */; };
044129071682FF9600B70EE6 /* MouseHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 044129061682FF9600B70EE6 /* MouseHandler.cpp */; }; 044129071682FF9600B70EE6 /* MouseHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 044129061682FF9600B70EE6 /* MouseHandler.cpp */; };
9D293CE716071C08000305C8 /* CreateNewWorld_iphone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9D293CE616071C08000305C8 /* CreateNewWorld_iphone.xib */; }; 9D293CE716071C08000305C8 /* CreateNewWorld_iphone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9D293CE616071C08000305C8 /* CreateNewWorld_iphone.xib */; };
@@ -1209,8 +1208,6 @@
042A91A616B17517007ABBC6 /* NinePatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NinePatch.h; sourceTree = "<group>"; }; 042A91A616B17517007ABBC6 /* NinePatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NinePatch.h; sourceTree = "<group>"; };
042A91A716B17517007ABBC6 /* OptionsGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OptionsGroup.cpp; sourceTree = "<group>"; }; 042A91A716B17517007ABBC6 /* OptionsGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OptionsGroup.cpp; sourceTree = "<group>"; };
042A91A816B17517007ABBC6 /* OptionsGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OptionsGroup.h; sourceTree = "<group>"; }; 042A91A816B17517007ABBC6 /* OptionsGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OptionsGroup.h; sourceTree = "<group>"; };
042A91A916B17517007ABBC6 /* OptionsPane.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OptionsPane.cpp; sourceTree = "<group>"; };
042A91AA16B17517007ABBC6 /* OptionsPane.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OptionsPane.h; sourceTree = "<group>"; };
042A91AB16B17517007ABBC6 /* TextBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextBox.cpp; sourceTree = "<group>"; }; 042A91AB16B17517007ABBC6 /* TextBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextBox.cpp; sourceTree = "<group>"; };
042A91AC16B17517007ABBC6 /* TextBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextBox.h; path = ../../src/client/gui/components/TextBox.h; sourceTree = SOURCE_ROOT; }; 042A91AC16B17517007ABBC6 /* TextBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextBox.h; path = ../../src/client/gui/components/TextBox.h; sourceTree = SOURCE_ROOT; };
044129061682FF9600B70EE6 /* MouseHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseHandler.cpp; sourceTree = "<group>"; }; 044129061682FF9600B70EE6 /* MouseHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseHandler.cpp; sourceTree = "<group>"; };
@@ -3227,8 +3224,6 @@
042A91A616B17517007ABBC6 /* NinePatch.h */, 042A91A616B17517007ABBC6 /* NinePatch.h */,
042A91A716B17517007ABBC6 /* OptionsGroup.cpp */, 042A91A716B17517007ABBC6 /* OptionsGroup.cpp */,
042A91A816B17517007ABBC6 /* OptionsGroup.h */, 042A91A816B17517007ABBC6 /* OptionsGroup.h */,
042A91A916B17517007ABBC6 /* OptionsPane.cpp */,
042A91AA16B17517007ABBC6 /* OptionsPane.h */,
042A91AB16B17517007ABBC6 /* TextBox.cpp */, 042A91AB16B17517007ABBC6 /* TextBox.cpp */,
042A91AC16B17517007ABBC6 /* TextBox.h */, 042A91AC16B17517007ABBC6 /* TextBox.h */,
D5B50C2814CFF66F005F7284 /* Button.cpp */, D5B50C2814CFF66F005F7284 /* Button.cpp */,
@@ -5705,7 +5700,6 @@
042A91AE16B17517007ABBC6 /* GuiElement.cpp in Sources */, 042A91AE16B17517007ABBC6 /* GuiElement.cpp in Sources */,
042A91AF16B17517007ABBC6 /* NinePatch.cpp in Sources */, 042A91AF16B17517007ABBC6 /* NinePatch.cpp in Sources */,
042A91B016B17517007ABBC6 /* OptionsGroup.cpp in Sources */, 042A91B016B17517007ABBC6 /* OptionsGroup.cpp in Sources */,
042A91B116B17517007ABBC6 /* OptionsPane.cpp in Sources */,
042A91B216B17517007ABBC6 /* TextBox.cpp in Sources */, 042A91B216B17517007ABBC6 /* TextBox.cpp in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;

View File

@@ -1,9 +1,11 @@
#include "Minecraft.h" #include "Minecraft.h"
#include "client/Options.h" #include "Options.h"
#include "client/player/input/IBuildInput.h" #include "IBuildInput.h"
#include "platform/input/Keyboard.h" #include "Keyboard.h"
#include "world/item/Item.h" #include "Item.h"
#include "world/item/ItemInstance.h" #include "ItemInstance.h"
#include "XperiaPlayInput.h"
#include "ControllerTurnInput.h"
#include <string> #include <string>
#include <cstdlib> #include <cstdlib>
@@ -23,7 +25,7 @@
#include "../world/level/storage/LevelStorageSource.h" #include "../world/level/storage/LevelStorageSource.h"
#include "../world/level/storage/LevelStorage.h" #include "../world/level/storage/LevelStorage.h"
#include "player/input/KeyboardInput.h" #include "player/input/KeyboardInput.h"
#include "world/level/chunk/ChunkSource.h" #include "ChunkSource.h"
#ifndef STANDALONE_SERVER #ifndef STANDALONE_SERVER
#include "player/input/touchscreen/TouchInputHolder.h" #include "player/input/touchscreen/TouchInputHolder.h"

View File

@@ -221,6 +221,7 @@ private:
bool _isCreativeMode; bool _isCreativeMode;
//int _respawnPlayerTicks; //int _respawnPlayerTicks;
Player* _pendingRemovePlayer; // @attn @todo @fix: remove this shait and fix the respawn behaviour Player* _pendingRemovePlayer; // @attn @todo @fix: remove this shait and fix the respawn behaviour
// shit* lmao
PerfRenderer* _perfRenderer; PerfRenderer* _perfRenderer;
CommandServer* _commandServer; CommandServer* _commandServer;

View File

@@ -93,9 +93,6 @@ typedef std::vector<std::string> StringVector;
class Options class Options
{ {
public: public:
// deepfriedwaffles: for iOS, was getting compile errors saying: No member named 'sound' in 'Options' and No member named 'music' in 'Options' so I floated them here. 1.0f means full volume out of the box, but if everything is too loud, you might want to try adjusting this
float sound = 1.0f;
float music = 1.0f;
static bool debugGl; static bool debugGl;
@@ -160,7 +157,9 @@ private:
if (m_options[key] == nullptr) return nullptr; if (m_options[key] == nullptr) return nullptr;
return dynamic_cast<T*>(m_options[key]); return dynamic_cast<T*>(m_options[key]);
} }
// apple stuff
float sound;
float music;
std::array<Option*, OPTIONS_COUNT> m_options; std::array<Option*, OPTIONS_COUNT> m_options;
OptionsFile optionsFile; OptionsFile optionsFile;

View File

@@ -1,7 +1,7 @@
#include "Gui.h" #include "Gui.h"
#include "Font.h" #include "Font.h"
#include "client/Options.h" #include "Options.h"
#include "platform/input/Keyboard.h" #include "Keyboard.h"
#include "screens/IngameBlockSelectionScreen.h" #include "screens/IngameBlockSelectionScreen.h"
#include "screens/ChatScreen.h" #include "screens/ChatScreen.h"
#include "screens/ConsoleScreen.h" #include "screens/ConsoleScreen.h"

View File

@@ -4,7 +4,7 @@
#include "../../../platform/log.h" #include "../../../platform/log.h"
#include "../../../util/Mth.h" #include "../../../util/Mth.h"
#include "../../renderer/Textures.h" #include "../../renderer/Textures.h"
#include <client/Option.h> #include "../../Option.h"
ImageButton::ImageButton(int id, const std::string& msg) ImageButton::ImageButton(int id, const std::string& msg)

View File

@@ -1,6 +1,6 @@
#pragma once #pragma once
#include "Button.h" #include "Button.h"
#include <client/Options.h> #include "Options.h"
class KeyOption : public Touch::TButton { class KeyOption : public Touch::TButton {
public: public:

View File

@@ -65,7 +65,7 @@ void OptionsGroup::createToggle(OptionId optId, Minecraft* minecraft ) {
std::string itemLabel = I18n::get(minecraft->options.getOpt(optId)->getStringId()); std::string itemLabel = I18n::get(minecraft->options.getOpt(optId)->getStringId());
OptionsItem* item = new OptionsItem(itemLabel, element); OptionsItem* item = new OptionsItem(optId, itemLabel, element);
addChild(item); addChild(item);
setupPositions(); setupPositions();
@@ -77,7 +77,7 @@ void OptionsGroup::createProgressSlider(OptionId optId, Minecraft* minecraft ) {
element->height = 20; element->height = 20;
std::string itemLabel = I18n::get(minecraft->options.getOpt(optId)->getStringId()); std::string itemLabel = I18n::get(minecraft->options.getOpt(optId)->getStringId());
OptionsItem* item = new OptionsItem(itemLabel, element); OptionsItem* item = new OptionsItem(optId, itemLabel, element);
addChild(item); addChild(item);
setupPositions(); setupPositions();
} }
@@ -87,7 +87,7 @@ void OptionsGroup::createStepSlider(OptionId optId, Minecraft* minecraft ) {
element->width = 100; element->width = 100;
element->height = 20; element->height = 20;
std::string itemLabel = I18n::get(minecraft->options.getOpt(optId)->getStringId()); std::string itemLabel = I18n::get(minecraft->options.getOpt(optId)->getStringId());
OptionsItem* item = new OptionsItem(itemLabel, element); OptionsItem* item = new OptionsItem(optId, itemLabel, element);
addChild(item); addChild(item);
setupPositions(); setupPositions();
} }
@@ -98,7 +98,7 @@ void OptionsGroup::createTextbox(OptionId optId, Minecraft* minecraft) {
element->height = 20; element->height = 20;
std::string itemLabel = I18n::get(minecraft->options.getOpt(optId)->getStringId()); std::string itemLabel = I18n::get(minecraft->options.getOpt(optId)->getStringId());
OptionsItem* item = new OptionsItem(itemLabel, element); OptionsItem* item = new OptionsItem(optId, itemLabel, element);
addChild(item); addChild(item);
setupPositions(); setupPositions();
} }
@@ -109,7 +109,7 @@ void OptionsGroup::createKey(OptionId optId, Minecraft* minecraft) {
element->height = 20; element->height = 20;
std::string itemLabel = I18n::get(minecraft->options.getOpt(optId)->getStringId()); std::string itemLabel = I18n::get(minecraft->options.getOpt(optId)->getStringId());
OptionsItem* item = new OptionsItem(itemLabel, element); OptionsItem* item = new OptionsItem(optId, itemLabel, element);
addChild(item); addChild(item);
setupPositions(); setupPositions();
} }

View File

@@ -1,9 +1,11 @@
#include "OptionsItem.h" #include "OptionsItem.h"
#include "../../Minecraft.h" #include "../../Minecraft.h"
#include "../../../locale/I18n.h"
#include "../../../util/Mth.h" #include "../../../util/Mth.h"
OptionsItem::OptionsItem( std::string label, GuiElement* element ) OptionsItem::OptionsItem( OptionId optionId, std::string label, GuiElement* element )
: GuiElementContainer(false, true, 0, 0, 24, 12), : GuiElementContainer(false, true, 0, 0, 24, 12),
label(label) { m_optionId(optionId),
m_label(label) {
addChild(element); addChild(element);
} }
@@ -19,6 +21,22 @@ void OptionsItem::setupPositions() {
void OptionsItem::render( Minecraft* minecraft, int xm, int ym ) { void OptionsItem::render( Minecraft* minecraft, int xm, int ym ) {
int yOffset = (height - 8) / 2; int yOffset = (height - 8) / 2;
minecraft->font->draw(label, (float)x, (float)y + yOffset, 0x909090, false); std::string text = m_label;
if (m_optionId == OPTIONS_GUI_SCALE) {
int value = minecraft->options.getIntValue(OPTIONS_GUI_SCALE);
std::string scaleText;
switch (value) {
case 0: scaleText = I18n::get("options.guiScale.auto"); break;
case 1: scaleText = I18n::get("options.guiScale.small"); break;
case 2: scaleText = I18n::get("options.guiScale.medium"); break;
case 3: scaleText = I18n::get("options.guiScale.large"); break;
case 4: scaleText = I18n::get("options.guiScale.larger"); break;
case 5: scaleText = I18n::get("options.guiScale.largest"); break;
default: scaleText = I18n::get("options.guiScale.auto"); break;
}
text += ": " + scaleText;
}
minecraft->font->draw(text, (float)x, (float)y + yOffset, 0x909090, false);
super::render(minecraft, xm, ym); super::render(minecraft, xm, ym);
} }

View File

@@ -15,12 +15,13 @@ class OptionsItem: public GuiElementContainer
{ {
typedef GuiElementContainer super; typedef GuiElementContainer super;
public: public:
OptionsItem(std::string label, GuiElement* element); OptionsItem(OptionId optionId, std::string label, GuiElement* element);
virtual void render(Minecraft* minecraft, int xm, int ym); virtual void render(Minecraft* minecraft, int xm, int ym);
void setupPositions(); void setupPositions();
private: private:
std::string label; OptionId m_optionId;
std::string m_label;
}; };
#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsItem_H__*/ #endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsItem_H__*/

View File

@@ -2,6 +2,7 @@
#include "../../Minecraft.h" #include "../../Minecraft.h"
#include "../../renderer/Textures.h" #include "../../renderer/Textures.h"
#include "../Screen.h" #include "../Screen.h"
#include "../../../locale/I18n.h"
#include "../../../util/Mth.h" #include "../../../util/Mth.h"
#include <algorithm> #include <algorithm>
#include <assert.h> #include <assert.h>
@@ -21,7 +22,7 @@ void Slider::render( Minecraft* minecraft, int xm, int ym ) {
if (m_numSteps > 2) { if (m_numSteps > 2) {
int stepDistance = barWidth / (m_numSteps-1); int stepDistance = barWidth / (m_numSteps-1);
for(int a = 0; a <= m_numSteps; ++a) { for(int a = 0; a < m_numSteps; ++a) {
int renderSliderStepPosX = xSliderStart + a * stepDistance + 1; int renderSliderStepPosX = xSliderStart + a * stepDistance + 1;
fill(renderSliderStepPosX - 1, ySliderStart - 2, renderSliderStepPosX + 1, ySliderEnd + 2, 0xff606060); fill(renderSliderStepPosX - 1, ySliderStart - 2, renderSliderStepPosX + 1, ySliderEnd + 2, 0xff606060);
} }
@@ -64,15 +65,20 @@ SliderFloat::SliderFloat(Minecraft* minecraft, OptionId option)
SliderInt::SliderInt(Minecraft* minecraft, OptionId option) SliderInt::SliderInt(Minecraft* minecraft, OptionId option)
: Slider(option), m_option(dynamic_cast<OptionInt*>(minecraft->options.getOpt(option))) : Slider(option), m_option(dynamic_cast<OptionInt*>(minecraft->options.getOpt(option)))
{ {
m_numSteps = m_option->getMax() - m_option->getMin(); m_numSteps = m_option->getMax() - m_option->getMin() + 1;
m_percentage = float(m_option->get() - m_option->getMin()) / (m_numSteps-1); m_percentage = float(m_option->get() - m_option->getMin()) / (m_numSteps-1);
} }
void SliderInt::render( Minecraft* minecraft, int xm, int ym ) {
Slider::render(minecraft, xm, ym);
}
void SliderInt::mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum ) { void SliderInt::mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum ) {
Slider::mouseReleased(minecraft, x, y, buttonNum); Slider::mouseReleased(minecraft, x, y, buttonNum);
if (pointInside(x, y)) { if (pointInside(x, y)) {
int curStep = Mth::floor(m_percentage * (m_numSteps-1)); int curStep = int(m_percentage * (m_numSteps-1) + 0.5f);
curStep = Mth::clamp(curStep + m_option->getMin(), m_option->getMin(), m_option->getMax());
m_percentage = float(curStep - m_option->getMin()) / (m_numSteps-1); m_percentage = float(curStep - m_option->getMin()) / (m_numSteps-1);
minecraft->options.set(m_optId, curStep); minecraft->options.set(m_optId, curStep);

View File

@@ -3,7 +3,6 @@
#include "GuiElement.h" #include "GuiElement.h"
#include "../../../client/Options.h" #include "../../../client/Options.h"
#include "OptionsPane.h" // was originally Option.h, shouldn't it be this?
class Slider : public GuiElement { class Slider : public GuiElement {
typedef GuiElement super; typedef GuiElement super;
@@ -38,6 +37,7 @@ class SliderInt : public Slider {
public: public:
SliderInt(Minecraft* minecraft, OptionId option); SliderInt(Minecraft* minecraft, OptionId option);
virtual void render( Minecraft* minecraft, int xm, int ym ) override;
virtual void mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum ) override; virtual void mouseReleased( Minecraft* minecraft, int x, int y, int buttonNum ) override;
protected: protected:

View File

@@ -1,6 +1,6 @@
#pragma once #pragma once
#include "TextBox.h" #include "TextBox.h"
#include <client/Options.h> #include "Options.h"
class TextOption : public TextBox { class TextOption : public TextBox {
public: public:

View File

@@ -1,5 +1,7 @@
#ifndef NET_MINECRAFT_CLIENT_PLAYER__XperiaPlayInput_H__ #ifndef NET_MINECRAFT_CLIENT_PLAYER__XperiaPlayInput_H__
#define NET_MINECRAFT_CLIENT_PLAYER__XperiaPlayInput_H__ #define NET_MINECRAFT_CLIENT_PLAYER__XperiaPlayInput_H__
#include "Player.h"
#include "Controller.h"
//package net.minecraft.client.player; //package net.minecraft.client.player;

View File

@@ -6,23 +6,24 @@ NetherReactorPattern::NetherReactorPattern( ) {
const int netherCoreId = Tile::netherReactor->id; const int netherCoreId = Tile::netherReactor->id;
const unsigned int types[3][3][3] = const unsigned int types[3][3][3] =
{ {
// Level 0 // Changing all of these values to be unsigned is needed to get the nether reactor pattern to compile. In the past having them be normal ints was fine but the c++ convention has changed
// Level 0
{ {
{goldId, stoneId, goldId}, {static_cast<unsigned int>(goldId), static_cast<unsigned int>(stoneId), static_cast<unsigned int>(goldId)},
{stoneId, stoneId, stoneId}, {static_cast<unsigned int>(stoneId), static_cast<unsigned int>(stoneId), static_cast<unsigned int>(stoneId)},
{goldId, stoneId, goldId} {static_cast<unsigned int>(goldId), static_cast<unsigned int>(stoneId), static_cast<unsigned int>(goldId)}
}, },
// Level 1 // Level 1
{ {
{stoneId, 0, stoneId}, {static_cast<unsigned int>(stoneId), 0, static_cast<unsigned int>(stoneId)},
{0, netherCoreId, 0}, {0, static_cast<unsigned int>(netherCoreId), 0},
{stoneId, 0, stoneId} {static_cast<unsigned int>(stoneId), 0, static_cast<unsigned int>(stoneId)}
}, },
// Level 2 // Level 2
{ {
{0, stoneId, 0}, {0, static_cast<unsigned int>(stoneId), 0},
{stoneId, stoneId, stoneId}, {static_cast<unsigned int>(stoneId), static_cast<unsigned int>(stoneId), static_cast<unsigned int>(stoneId)},
{0, stoneId, 0} {0, static_cast<unsigned int>(stoneId), 0}
} }
}; };
for(int setLevel = 0; setLevel <= 2; ++setLevel) { for(int setLevel = 0; setLevel <= 2; ++setLevel) {