mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-04 19:36:43 +03:00
* WIP C++03 + Xbox 360 Support * math.h & _USE_MATH_DEFINES on Level.hpp Updated Xenon vcxproj file for new file structure. * * Fix bad GUI scale setup. * * Gui: Use ratios instead of hardcoded sub-1 floating point values, to make the mechanism more clear. * Add Direct Connect Button and Screen (#30) * Add Direct Connect Button and Screen * Remove accidental extra build directories for wasm * Add DirectConnectScreen.cpp to the CMake * Use Hungarian coding style notation * * Fix errors caused by #30 * * Improve the Chat Screen * * Improve the DirectConnectScreen, among other things. * * Update the game title once again. * * Add build-wasm.bat. * * Add info about compiling for wasm * * Fix send to specific GUID actually broadcasting to everyone * * Add command manager. * * Add writeable configuration. * * Allow dynamic screen size change on windows * * Allow the same thing on the emscripten version. * WIP C++03 + Xbox 360 Support * Fixed a possible merging issue that broke RakNet? * Additional Xbox 360 compatability fixes --------- Co-authored-by: Brent Da Mage <BrentDaMage@users.noreply.github.com> Co-authored-by: iProgramInCpp <iprogramincpp@gmail.com> Co-authored-by: ts <124226059+uniformization@users.noreply.github.com>
148 lines
3.2 KiB
C++
148 lines
3.2 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 "compat/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 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 renderHitSelect(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 field_C0;
|
|
//...
|
|
int m_nBuffers;
|
|
GLuint* m_pBuffers;
|
|
GLuint field_D8;
|
|
int field_DC;
|
|
//...
|
|
Textures* m_pTextures;
|
|
};
|