It isn't a commit without a linux compilation fail

This commit is contained in:
Shredder
2026-05-11 05:07:07 +05:00
parent 890604256b
commit 8f34fbc1ec

View File

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