mirror of
https://github.com/celisej567/mcpe.git
synced 2026-01-05 18:10:09 +03:00
* WIP Android Port Android port. Still needs touch controls and mouse turning (if that's even possible on android) and file saving and SoundSystemSL You control the camera and movement with your controller for now. You can navigate the gui using touch. Options.cpp,LocalPlayer.cpp,Minecraft.cpp is configured to use controller. Blocked out some code in ControllerTurnInput.cpp,Controller.cpp that didn't make sense. * Fix glClear glClear is supossed to use GL_DEPTH_BUFFER_BIT (thx TheBrokenRail) * * Fix build. * * Ignore assets. * * More stuff * * Fix more build errors. * * It finally built What I needed to do is rebuild the debug keystore because apparently android studio created it with sha1 digest alg which isn't supported by ant * * Clean up filters. * * Add cramped mode to the pause screen. * * Fix a bug with the hotbar * * In NinecraftApp::handleBack, pause the game if there is no screen. * * AppPlatform_android: Add placeholder SoundSystem instance till we get SoundSystemSL working * * Add properly working touch code. * * Oh, remove some testing things * * Fix state resetting when going in background and back in foreground * Fix bug where the sky isn't being regenerated on graphics reset * Fix bug where the m_currBoundTex isn't reset in Textures::clear potentially leaving a texture with that ID unassigned and corrupted * Fix bug in CThread where the thread is detached and then also joined. * Don't log anything if the program isn't in debug mode. * * Add virtual keyboard support. The screen instance slides so that the focused text box is kept visible. * Rename from com.minecraftcpp to com.reminecraftpe --------- Co-authored-by: iProgramInCpp <iprogramincpp@gmail.com>
151 lines
3.5 KiB
C++
151 lines
3.5 KiB
C++
/********************************************************************
|
|
Minecraft: Pocket Edition - Decompilation Project
|
|
Copyright (C) 2023 iProgramInCpp
|
|
|
|
The following code is licensed under the BSD 1 clause license.
|
|
SPDX-License-Identifier: BSD-1-Clause
|
|
********************************************************************/
|
|
|
|
#pragma once
|
|
|
|
#include <algorithm>
|
|
#include <sstream>
|
|
#include "thirdparty/GL/GL.hpp"
|
|
#include "world/level/LevelListener.hpp"
|
|
#include "Textures.hpp"
|
|
#include "RenderList.hpp"
|
|
#include "TileRenderer.hpp"
|
|
|
|
class Minecraft;
|
|
|
|
class DistanceChunkSorter
|
|
{
|
|
Mob* m_pMob;
|
|
|
|
public:
|
|
DistanceChunkSorter(Mob* pMob)
|
|
{
|
|
m_pMob = pMob;
|
|
}
|
|
|
|
bool operator()(const Chunk* a, const Chunk* b)
|
|
{
|
|
float d1 = a->distanceToSqr(m_pMob);
|
|
float d2 = b->distanceToSqr(m_pMob);
|
|
|
|
if (d1 > 1024.0f && a->m_pos.y <= 63) d1 *= 10.0f;
|
|
if (d2 > 1024.0f && b->m_pos.y <= 63) d2 *= 10.0f;
|
|
|
|
return d1 < d2;
|
|
}
|
|
};
|
|
|
|
class DirtyChunkSorter
|
|
{
|
|
Mob* m_pMob;
|
|
|
|
public:
|
|
DirtyChunkSorter(Mob* pMob)
|
|
{
|
|
m_pMob = pMob;
|
|
}
|
|
|
|
bool operator()(const Chunk* a, const Chunk* b)
|
|
{
|
|
if (a->m_bVisible && !b->m_bVisible)
|
|
return false;
|
|
if (!a->m_bVisible && b->m_bVisible)
|
|
return true;
|
|
|
|
float d1 = a->distanceToSqr(m_pMob);
|
|
float d2 = b->distanceToSqr(m_pMob);
|
|
|
|
if (d1 < d2) return false;
|
|
if (d1 > d2) return true;
|
|
|
|
return a->field_48 > b->field_48;
|
|
}
|
|
};
|
|
|
|
class LevelRenderer : public LevelListener
|
|
{
|
|
public:
|
|
LevelRenderer(Minecraft*, Textures*);
|
|
|
|
void allChanged() override;
|
|
void entityAdded(Entity*) override;
|
|
void tileChanged(int, int, int) override;
|
|
void setTilesDirty(int, int, int, int, int, int) override;
|
|
void takePicture(TripodCamera*, Entity*) override;
|
|
void addParticle(const std::string&, float, float, float, float, float, float) override;
|
|
void playSound(const std::string& a, float b, float c, float d, float e, float f) override;
|
|
void skyColorChanged() override;
|
|
void generateSky();
|
|
void cull(Culler*, float);
|
|
void deleteChunks();
|
|
void resortChunks(int x, int y, int z);
|
|
std::string gatherStats1();
|
|
void onGraphicsReset();
|
|
void render(const AABB& aabb) const;
|
|
void render(Mob* pMob, int a, float b);
|
|
void renderEntities(Vec3 pos, Culler*, float f);
|
|
void renderSky(float);
|
|
void renderClouds(float);
|
|
void checkQueryResults(int, int);
|
|
void renderSameAsLast(int, float);
|
|
int renderChunks(int start, int end, int a, float b);
|
|
void setLevel(Level*);
|
|
void setDirty(int, int, int, int, int, int);
|
|
void tick();
|
|
bool updateDirtyChunks(Mob* pMob, bool b);
|
|
void renderHit(Player* pPlayer, const HitResult& hr, int, void*, float);
|
|
void renderHitSelect(Player* pPlayer, const HitResult& hr, int, void*, float);
|
|
void renderHitOutline(Player* pPlayer, const HitResult& hr, int, void*, float);
|
|
|
|
public:
|
|
float field_4;
|
|
float field_8;
|
|
float field_C;
|
|
float field_10;
|
|
int field_14;
|
|
int field_18;
|
|
int field_1C;
|
|
int field_20;
|
|
std::vector<Chunk*> field_24;
|
|
int field_30;
|
|
RenderList m_renderList;
|
|
int field_54;
|
|
int field_58;
|
|
int field_5C;
|
|
int field_60;
|
|
int field_64;
|
|
int field_68;
|
|
int field_6C;
|
|
int field_70;
|
|
int field_74;
|
|
int field_78;
|
|
int field_7C;
|
|
int field_80;
|
|
Level* m_pLevel;
|
|
std::vector<Chunk*> field_88;
|
|
Chunk** m_chunks;
|
|
Chunk** field_98;
|
|
int m_chunksLength;
|
|
TileRenderer* m_pTileRenderer;
|
|
int field_A4;
|
|
int field_A8;
|
|
int field_AC;
|
|
int field_B0;
|
|
Minecraft* m_pMinecraft;
|
|
bool field_B8;
|
|
int field_BC;
|
|
int m_ticksSinceStart;
|
|
//...
|
|
int m_nBuffers;
|
|
GLuint* m_pBuffers;
|
|
GLuint m_skyBuffer;
|
|
int m_skyBufferCount;
|
|
//...
|
|
Textures* m_pTextures;
|
|
};
|