revert all code back except platform

This commit is contained in:
Kolyah35
2026-03-03 01:22:26 +03:00
parent a86d333478
commit 13010f10fa
16 changed files with 90 additions and 98 deletions

View File

@@ -4,7 +4,7 @@
#define NO_NETWORK
#endif
#ifdef PLATFORM_DESKTOP
#if defined(RPI)
#define CREATORMODE
#endif
@@ -574,7 +574,7 @@ void Minecraft::tick(int nTick, int maxTick) {
#ifndef STANDALONE_SERVER
textures->loadAndBindTexture("terrain.png");
if (!pause && !(screen && !screen->renderGameBehind())) {
#ifndef PLATFORM_DESKTOP
#if !defined(RPI)
#ifdef __APPLE__
if (isSuperFast())
#endif
@@ -691,7 +691,7 @@ void Minecraft::tickInput() {
if (isPressed) {
gui.handleKeyPressed(key);
#ifdef PLATFORM_DESKTOP //|| defined(_DEBUG) || defined(DEBUG)
#if defined(WIN32) || defined(RPI)//|| defined(_DEBUG) || defined(DEBUG)
if (key >= '0' && key <= '9') {
int digit = key - '0';
int slot = digit - 1;
@@ -714,14 +714,16 @@ void Minecraft::tickInput() {
}
#endif
}
#endif
#if defined(RPI)
if (key == Keyboard::KEY_E) {
screenChooser.setScreen(SCREEN_BLOCKSELECTION);
}
if (!screen && key == Keyboard::KEY_O || key == 250) {
releaseMouse();
}
#endif
#if defined(WIN32)
if (key == Keyboard::KEY_F) {
options.isFlying = !options.isFlying;
player->noPhysics = options.isFlying;
@@ -829,7 +831,7 @@ void Minecraft::tickInput() {
}
#endif
#ifndef PLATFORM_DESKTOP
#ifndef RPI
if (key == 82)
pauseGame(false);
#else
@@ -846,7 +848,7 @@ void Minecraft::tickInput() {
}
#endif
}
#ifdef PLATFORM_DESKTOP
#ifdef WIN32
if (key == Keyboard::KEY_M) {
for (int i = 0; i < 5 * SharedConstants::TicksPerSecond; ++i)
level->tick();
@@ -890,7 +892,7 @@ void Minecraft::tickInput() {
|| (buildHandled && bai.isRemove());
TIMER_POP_PUSH("handlemouse");
#ifdef PLATFORM_DESKTOP
#ifdef RPI
handleMouseDown(MouseAction::ACTION_LEFT, isTryingToDestroyBlock);
handleMouseClick(buildHandled && bai.isInteract()
|| options.useMouseForDigging && Mouse::isButtonDown(MouseAction::ACTION_RIGHT));
@@ -1121,7 +1123,7 @@ void Minecraft::releaseMouse()
}
bool Minecraft::useTouchscreen() {
#ifdef PLATFORM_DESKTOP
#ifdef RPI
return false;
#endif
return options.useTouchScreen || !_supportsNonTouchscreen;
@@ -1311,7 +1313,10 @@ void Minecraft::hostMultiplayer(int port) {
//
// Level generation
//
/*static*/ void* Minecraft::prepareLevel_tspawn(void *p_param) {
/*static*/
void* Minecraft::prepareLevel_tspawn(void *p_param)
{
Minecraft* mc = (Minecraft*) p_param;
mc->generateLevel("Currently not used", mc->level);
return 0;
@@ -1364,7 +1369,7 @@ void Minecraft::_levelGenerated()
netCallback->levelGenerated(level);
}
#ifdef PLATFORM_DESKTOP
#if defined(WIN32) || defined(RPI)
if (_commandServer) {
delete _commandServer;
}

View File

@@ -5,10 +5,6 @@
#include <SDL/SDL.h>
#endif
#ifdef PLATFORM_GLFW
#include <GLFW/glfw3.h>
#endif
MouseHandler::MouseHandler( ITurnInput* turnInput )
: _turnInput(turnInput)
{}
@@ -33,10 +29,6 @@ void MouseHandler::grab() {
SDL_WM_GrabInput(SDL_GRAB_ON);
SDL_ShowCursor(0);
#endif
#ifdef PLATFORM_GLFW
glfwSetInputMode(glfwGetCurrentContext(), GLFW_CURSOR, GLFW_CURSOR_DISABLED);
#endif
}
void MouseHandler::release() {
@@ -45,10 +37,6 @@ void MouseHandler::release() {
SDL_WM_GrabInput(SDL_GRAB_OFF);
SDL_ShowCursor(1);
#endif
#ifdef PLATFORM_GLFW
glfwSetInputMode(glfwGetCurrentContext(), GLFW_CURSOR, GLFW_CURSOR_NORMAL);
#endif
}
void MouseHandler::poll() {

View File

@@ -54,7 +54,7 @@ void Options::initDefaultValues() {
keyJump = KeyMapping("key.jump", Keyboard::KEY_SPACE);
keyBuild = KeyMapping("key.inventory", Keyboard::KEY_E);
keySneak = KeyMapping("key.sneak", Keyboard::KEY_LSHIFT);
#ifdef PLATFORM_DESKTOP
#ifndef RPI
keyCraft = KeyMapping("key.crafting", Keyboard::KEY_Q);
keyDrop = KeyMapping("key.drop", Keyboard::KEY_Q);
keyChat = KeyMapping("key.chat", Keyboard::KEY_T);

View File

@@ -112,10 +112,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
unsigned int max = 10;
bool isChatting = false;
renderChatMessages(screenHeight, max, isChatting, font);
#ifndef PLATFORM_DESKTOP
#if !defined(RPI)
renderOnSelectItemNameText(screenWidth, font, ySlot);
#endif
#ifdef PLATFORM_DESKTOP
#if defined(RPI)
renderDebugInfo();
#endif
@@ -614,27 +614,27 @@ void Gui::renderBubbles() {
}
}
static OffsetPosTranslator posTranslator;
void Gui::onLevelGenerated() {
if (Level* level = minecraft->level) {
Pos p = level->getSharedSpawnPos();
posTranslator = OffsetPosTranslator((float)-p.x, (float)-p.y, (float)-p.z);
}
}
static OffsetPosTranslator posTranslator;
void Gui::onLevelGenerated() {
if (Level* level = minecraft->level) {
Pos p = level->getSharedSpawnPos();
posTranslator = OffsetPosTranslator((float)-p.x, (float)-p.y, (float)-p.z);
}
}
void Gui::renderDebugInfo() {
static char buf[256];
float xx = minecraft->player->x;
float yy = minecraft->player->y - minecraft->player->heightOffset;
float zz = minecraft->player->z;
posTranslator.to(xx, yy, zz);
sprintf(buf, "pos: %3.1f, %3.1f, %3.1f\n", xx, yy, zz);
Tesselator& t = Tesselator::instance;
t.beginOverride();
t.scale2d(InvGuiScale, InvGuiScale);
minecraft->font->draw(buf, 2, 2, 0xffffff);
t.resetScale();
t.endOverrideAndDraw();
static char buf[256];
float xx = minecraft->player->x;
float yy = minecraft->player->y - minecraft->player->heightOffset;
float zz = minecraft->player->z;
posTranslator.to(xx, yy, zz);
sprintf(buf, "pos: %3.1f, %3.1f, %3.1f\n", xx, yy, zz);
Tesselator& t = Tesselator::instance;
t.beginOverride();
t.scale2d(InvGuiScale, InvGuiScale);
minecraft->font->draw(buf, 2, 2, 0xffffff);
t.resetScale();
t.endOverrideAndDraw();
}
void Gui::renderSleepAnimation( const int screenWidth, const int screenHeight ) {

View File

@@ -295,7 +295,7 @@ static char ILLEGAL_FILE_CHARACTERS[] = {
void SelectWorldScreen::tick()
{
if (_state == _STATE_CREATEWORLD) {
#if defined(PLATFORM_DESKTOP)
#if defined(RPI)
std::string levelId = getUniqueLevelName("world");
LevelSettings settings(getEpochTimeS(), GameType::Creative);
minecraft->selectLevel(levelId, levelId, settings);

View File

@@ -393,7 +393,7 @@ static char ILLEGAL_FILE_CHARACTERS[] = {
void SelectWorldScreen::tick()
{
if (_state == _STATE_CREATEWORLD) {
#ifdef PLATFORM_DESKTOP
#if defined(RPI)
std::string levelId = getUniqueLevelName("perf");
//int seed = Util::hashCode("/r/Minecraft");
LevelSettings settings(getEpochTimeS(), GameType::Creative);

View File

@@ -52,7 +52,7 @@ void KeyboardInput::tick( Player* player )
ya *= 0.3f;
}
#ifdef PLATFORM_DESKTOP
#ifdef RPI
wantUp = jumping;
wantDown = sneaking;
#endif

View File

@@ -8,7 +8,7 @@
/*static*/ int Textures::textureChanges = 0;
/*static*/ bool Textures::MIPMAP = false;
const TextureId Textures::InvalidId = -1;
/*static*/ const TextureId Textures::InvalidId = -1;
Textures::Textures( Options* options_, AppPlatform* platform_ )
: clamp(false),

View File

@@ -23,18 +23,18 @@
/*public*/ static const int C = 2; // The Z value of the plane's normal
/*public*/ static const int D = 3; // The distance the plane is from the origin
/*public*/ float** m_Frustum; // = /*new*/ float[16][16];
/*public*/ float* proj; // = /*new*/ float[16];
/*public*/ float* modl; // = /*new*/ float[16];
/*public*/ float* clip; // = /*new*/ float[16];
/*public*/ float[][] m_Frustum = /*new*/ float[16][16];
/*public*/ float[] proj = /*new*/ float[16];
/*public*/ float[] modl = /*new*/ float[16];
/*public*/ float[] clip = /*new*/ float[16];
/*
/*public*/ FrustumData(float** mFrustum, float* proj, float* modl, float* clip)
/*public*/ FrustumData(float[][] mFrustum, float[] proj, float[] modl, float[] clip)
{
m_Frustum = mFrustum;
this->proj = proj;
this->modl = modl;
this->clip = clip;
}
}*/
/*public*/ bool pointInFrustum(float x, float y, float z)
{
for (int i = 0; i < 6; i++)

View File

@@ -5,7 +5,7 @@
#include "../Options.h"
// Android should always run OPENGL_ES
#if defined(ANDROID) || defined(__APPLE__) || defined(PLATFORM_DESKTOP)
#if defined(ANDROID) || defined(__APPLE__) || defined(RPI)
#define OPENGL_ES
#endif
@@ -17,9 +17,7 @@
#import <OpenGLES/ES1/gl.height>
#import <OpenGLES/ES1/glext.height>
#else
// #include <GLES/gl.h>
#include <glad/glad.h>
#include <glad/glad.h>
#if defined(ANDROID)
#include<GLES/glext.h>
#endif
@@ -30,13 +28,14 @@
#include <WinSock2.h>
#include <Windows.h>
#endif
// #include <gl/glew.h>
// #include <gl/GL.h>
#include <gl/glew.h>
#include <gl/GL.h>
#define glFogx(a,b) glFogi(a,b)
#define glOrthof(a,b,c,d,e,f) glOrtho(a,b,c,d,e,f)
#endif
#define GLERRDEBUG 1
#if GLERRDEBUG
//#define GLERR(x) if((x) != 0) { LOGI("GLError: " #x "(%d)\n", __LINE__) }