It isn't a commit without a linux compilation fail
This commit is contained in:
@@ -10,11 +10,11 @@
|
||||
|
||||
|
||||
#if defined(APPLE_DEMO_PROMOTION)
|
||||
#define NO_NETWORK
|
||||
#define NO_NETWORK
|
||||
#endif
|
||||
|
||||
#if defined(RPI)
|
||||
#define CREATORMODE
|
||||
#define CREATORMODE
|
||||
#endif
|
||||
#include "../network/RakNetInstance.h"
|
||||
#include "../network/ClientSideNetworkHandler.h"
|
||||
@@ -117,7 +117,7 @@ const char* Minecraft::progressMessages[] = {
|
||||
int Minecraft::customDebugId = Minecraft::CDI_NONE;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( disable : 4355 ) // 'this' pointer in initialization list which is perfectly legal
|
||||
#pragma warning( disable : 4355 ) // 'this' pointer in initialization list which is perfectly legal
|
||||
#endif
|
||||
|
||||
bool Minecraft::useAmbientOcclusion = false;
|
||||
@@ -182,7 +182,7 @@ Minecraft::Minecraft() :
|
||||
reserved_d1(0),reserved_d2(0),
|
||||
reserved_f1(0),reserved_f2(0), options(this)
|
||||
{
|
||||
//#ifdef ANDROID
|
||||
//#ifdef ANDROID
|
||||
|
||||
#if defined(NO_NETWORK)
|
||||
raknetInstance = new IRakNetInstance();
|
||||
@@ -466,16 +466,16 @@ void Minecraft::update() {
|
||||
}
|
||||
TIMER_POP();
|
||||
|
||||
#ifndef STANDALONE_SERVER
|
||||
#ifndef STANDALONE_SERVER
|
||||
if (gameMode != NULL) gameMode->render(timer.a);
|
||||
TIMER_PUSH("sound");
|
||||
soundEngine->update(player, timer.a);
|
||||
TIMER_POP_PUSH("render");
|
||||
gameRenderer->render(timer.a);
|
||||
TIMER_POP();
|
||||
#else
|
||||
#else
|
||||
CThread::sleep(1);
|
||||
#endif
|
||||
#endif
|
||||
#ifndef STANDALONE_SERVER
|
||||
Multitouch::resetThisUpdate();
|
||||
#endif
|
||||
@@ -485,14 +485,14 @@ void Minecraft::update() {
|
||||
checkGlError("Update finished");
|
||||
|
||||
if (options.getBooleanValue(OPTIONS_RENDER_DEBUG)) {
|
||||
//#ifndef PLATFORM_DESKTOP
|
||||
//#ifndef PLATFORM_DESKTOP
|
||||
if (!PerfTimer::enabled) {
|
||||
PerfTimer::reset();
|
||||
PerfTimer::enabled = true;
|
||||
}
|
||||
_perfRenderer->renderFpsMeter(1);
|
||||
checkGlError("render debug");
|
||||
//#endif
|
||||
//#endif
|
||||
} else {
|
||||
PerfTimer::enabled = false;
|
||||
}
|
||||
@@ -569,17 +569,17 @@ void Minecraft::tick(int nTick, int maxTick) {
|
||||
#ifndef STANDALONE_SERVER
|
||||
textures->loadAndBindTexture("terrain.png");
|
||||
if (!pause && !(screen && !screen->renderGameBehind())) {
|
||||
#if !defined(RPI)
|
||||
#ifdef __APPLE__
|
||||
#if !defined(RPI)
|
||||
#ifdef __APPLE__
|
||||
if (isSuperFast())
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
if (nTick == maxTick) {
|
||||
TIMER_POP_PUSH("textures");
|
||||
textures->tick(true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
TIMER_POP_PUSH("particles");
|
||||
if (!pause) {
|
||||
@@ -701,7 +701,7 @@ void Minecraft::tickInput() {
|
||||
if (slot >= 0 && slot < gui.getNumSlots())
|
||||
player->inventory->selectSlot(slot);
|
||||
|
||||
#if defined(WIN32)
|
||||
#if defined(WIN32)
|
||||
if (digit >= 1 && GetAsyncKeyState(VK_CONTROL) < 0) {
|
||||
// Set adventure settings here!
|
||||
AdventureSettingsPacket p(level->adventureSettings);
|
||||
@@ -714,7 +714,7 @@ void Minecraft::tickInput() {
|
||||
SetSpawnPositionPacket p(pos);
|
||||
raknetInstance->send(p);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
if (key == Keyboard::KEY_LEFT_CTRL) {
|
||||
@@ -751,7 +751,7 @@ void Minecraft::tickInput() {
|
||||
options.set(OPTIONS_VIEW_DISTANCE, (dst + 1) % 4);
|
||||
}
|
||||
|
||||
#ifdef CHEATS
|
||||
#ifdef CHEATS
|
||||
if (key == Keyboard::KEY_U) {
|
||||
onGraphicsReset();
|
||||
player->heal(100);
|
||||
@@ -832,7 +832,7 @@ void Minecraft::tickInput() {
|
||||
_perfRenderer->debugFpsMeterKeyPress(key - '0');
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (options.getBooleanValue(OPTIONS_RENDER_DEBUG)) {
|
||||
if (key >= '0' && key <= '9') {
|
||||
@@ -843,21 +843,21 @@ void Minecraft::tickInput() {
|
||||
if (key == Keyboard::KEY_ESCAPE)
|
||||
pauseGame(false);
|
||||
|
||||
#ifdef PLATFORM_DESKTOP
|
||||
#ifdef PLATFORM_DESKTOP
|
||||
if (key == Keyboard::KEY_P) {
|
||||
static bool isWireFrame = false;
|
||||
isWireFrame = !isWireFrame;
|
||||
glPolygonMode(GL_FRONT, isWireFrame? GL_LINE : GL_FILL);
|
||||
//glPolygonMode(GL_BACK, isWireFrame? GL_LINE : GL_FILL);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32
|
||||
if (key == Keyboard::KEY_M) {
|
||||
for (int i = 0; i < 5 * SharedConstants::TicksPerSecond; ++i)
|
||||
level->tick();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
TIMER_POP_PUSH("handlemouse");
|
||||
@@ -987,10 +987,10 @@ void Minecraft::handleBuildAction(BuildActionIntention* action) {
|
||||
if (gameMode->useItemOn(player, level, item, x, y, z, face, hitResult.pos)) {
|
||||
mayUse = false;
|
||||
player->swing();
|
||||
#ifdef RPI
|
||||
#ifdef RPI
|
||||
} else if (item && item->id == ((Item*)Item::sword_iron)->id) {
|
||||
player->swing();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
if (item && item->count <= 0) {
|
||||
player->inventory->clearSlot(player->inventory->selected);
|
||||
@@ -1153,7 +1153,7 @@ void Minecraft::init()
|
||||
particleEngine = new ParticleEngine(level, textures);
|
||||
|
||||
// 4j's code for reference
|
||||
// FoliageColor::init(textures->loadTexturePixels(L"misc/foliagecolor.png"));
|
||||
// FoliageColor::init(textures->loadTexturePixels(L"misc/foliagecolor.png"));
|
||||
|
||||
|
||||
// my code
|
||||
@@ -1196,8 +1196,8 @@ void Minecraft::setSize(int w, int h) {
|
||||
height = h;
|
||||
int screenWidth;
|
||||
int screenHeight;
|
||||
//#ifdef PLATFORM_DESKTOP
|
||||
if (options.getBooleanValue(OPTIONS_WINDOW_SCALE)){ // scales with resolution using a formula instead of having hardcoded if checks
|
||||
//#ifdef PLATFORM_DESKTOP
|
||||
if (options.getBooleanValue(OPTIONS_WINDOW_SCALE)){ // scales with resolution using a formula instead of having hardcoded if checks
|
||||
int guiScale = options.getIntValue(OPTIONS_GUI_SCALE);
|
||||
if (guiScale == 0) {
|
||||
guiScale = 1000;
|
||||
@@ -1208,12 +1208,9 @@ if (options.getBooleanValue(OPTIONS_WINDOW_SCALE)){ // scales with resolution us
|
||||
|
||||
Gui::GuiScale = (float)Mth::Min(guiScale, Mth::Max(1, Mth::Min(width / 320, height / 240)));
|
||||
|
||||
// 2. Calculate the Inverse based on the NEW scale
|
||||
Gui::InvGuiScale = 1.0f / Gui::GuiScale;
|
||||
screenWidth = (int)(width * Gui::InvGuiScale);
|
||||
screenHeight = (int)(height * Gui::InvGuiScale);
|
||||
|
||||
} else {
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
int guiScale = options.getIntValue(OPTIONS_GUI_SCALE);
|
||||
@@ -1232,11 +1229,11 @@ if (options.getBooleanValue(OPTIONS_WINDOW_SCALE)){ // scales with resolution us
|
||||
} else {
|
||||
// auto compute from resolution
|
||||
if (width >= 1000) {
|
||||
#ifdef __APPLE__
|
||||
#ifdef __APPLE__
|
||||
Gui::GuiScale = (width > 2000)? 8.0f : 4.0f;
|
||||
#else
|
||||
#else
|
||||
Gui::GuiScale = 4.0f;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else if (width >= 800) {
|
||||
#ifdef __APPLE__
|
||||
@@ -1251,9 +1248,7 @@ if (options.getBooleanValue(OPTIONS_WINDOW_SCALE)){ // scales with resolution us
|
||||
Gui::GuiScale = 1.0f;
|
||||
}
|
||||
|
||||
Gui::InvGuiScale = 1.0f / Gui::GuiScale;
|
||||
screenWidth = (int)(width * Gui::InvGuiScale);
|
||||
screenHeight = (int)(height * Gui::InvGuiScale);
|
||||
|
||||
|
||||
// if (platform()) {
|
||||
// float pixelsPerMillimeter = options.getProgressValue(&Option::PIXELS_PER_MILLIMETER);
|
||||
@@ -1261,8 +1256,13 @@ if (options.getBooleanValue(OPTIONS_WINDOW_SCALE)){ // scales with resolution us
|
||||
// pixelCalcUi.setPixelsPerMillimeter(pixelsPerMillimeter * Gui::InvGuiScale);
|
||||
// }
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Gui::InvGuiScale = 1.0f / Gui::GuiScale;
|
||||
screenWidth = (int)(width * Gui::InvGuiScale);
|
||||
screenHeight = (int)(height * Gui::InvGuiScale);
|
||||
|
||||
Config config = createConfig(this);
|
||||
gui.onConfigChanged(config);
|
||||
|
||||
@@ -1277,7 +1277,7 @@ if (options.getBooleanValue(OPTIONS_WINDOW_SCALE)){ // scales with resolution us
|
||||
char resbuf[128];
|
||||
sprintf(resbuf, " %d x %d @ scale %.2f", width, height, Gui::GuiScale);
|
||||
//gui.addMessage(resbuf);
|
||||
|
||||
#endif
|
||||
#endif /* STANDALONE_SERVER */
|
||||
}
|
||||
|
||||
@@ -1307,17 +1307,17 @@ void Minecraft::_reloadInput() {
|
||||
if (useTouchHolder) {
|
||||
inputHolder = new TouchInputHolder(this, &options);
|
||||
} else {
|
||||
#if defined(ANDROID) || defined(__APPLE__)
|
||||
#if defined(ANDROID) || defined(__APPLE__)
|
||||
inputHolder = new CustomInputHolder(
|
||||
new XperiaPlayInput(&options),
|
||||
new ControllerTurnInput(2, ControllerTurnInput::MODE_DELTA),
|
||||
new IBuildInput());
|
||||
#else
|
||||
#else
|
||||
inputHolder = new CustomInputHolder(
|
||||
new KeyboardInput(&options),
|
||||
new MouseTurnInput(MouseTurnInput::MODE_DELTA, width/2, height/2),
|
||||
new MouseBuildInput());
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
mouseHandler.setTurnInput(inputHolder->getTurnInput());
|
||||
@@ -1389,11 +1389,11 @@ void Minecraft::hostMultiplayer(int port) {
|
||||
|
||||
#if !defined(NO_NETWORK)
|
||||
netCallback = new ServerSideNetworkHandler(this, raknetInstance);
|
||||
#ifdef STANDALONE_SERVER
|
||||
#ifdef STANDALONE_SERVER
|
||||
raknetInstance->host("Server", port, 16);
|
||||
#else
|
||||
#else
|
||||
raknetInstance->host(options.getStringValue(OPTIONS_USERNAME), port);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1668,12 +1668,12 @@ void Minecraft::optionUpdated(OptionId option, bool value ) {
|
||||
}
|
||||
|
||||
void Minecraft::optionUpdated(OptionId option, float value ) {
|
||||
// #ifndef STANDALONE_SERVER
|
||||
// if(option == OPTIONS_PIXELS_PER_MILLIMETER) {
|
||||
// pixelCalcUi.setPixelsPerMillimeter(value * Gui::InvGuiScale);
|
||||
// pixelCalc.setPixelsPerMillimeter(value);
|
||||
// }
|
||||
// #endif
|
||||
// #ifndef STANDALONE_SERVER
|
||||
// if(option == OPTIONS_PIXELS_PER_MILLIMETER) {
|
||||
// pixelCalcUi.setPixelsPerMillimeter(value * Gui::InvGuiScale);
|
||||
// pixelCalc.setPixelsPerMillimeter(value);
|
||||
// }
|
||||
// #endif
|
||||
}
|
||||
|
||||
void Minecraft::optionUpdated(OptionId option, int value ) {
|
||||
|
||||
Reference in New Issue
Block a user