mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-04 19:36:43 +03:00
* Visual Studio Project Overhaul + Cleanup * SDL2 project for Windows * Re-added game client icon to SDL2 code * Renamed "AppPlatform_windows" to "AppPlatform_win32" (this is the name of the Windows API and is not representative of the architecture type) * Renamed "LoggerWindows" to "LoggerWin32" * Renamed "SoundSystemWindows to "SoundSystemDS" (DirectSound). This may be used for the 360, so it wouldn't really be Windows-specific then. * Moved "ClientSideNetworkHandler" from "network" to "client/network". We don't need it being compiled for the server if the client's the only thing that needs it. * I wonder if this still works on macOS... * Bugfixes & Fixed for macOS * Options::savePropertiesToFile Logging Bugfix * Silence Winsock Deprecation Warnings in RakNet * VS Project Improvements - Replaced 50 billion relative paths with $(MC_ROOT) - Added $(RAKNET_PATH) variable to override RakNet location - Re-added gitignore for .vcxproj.user files - Added debugging config to Directory.Builds.props - Slimmed down project configurations for SDL2 * VS Project Config Bugfixes - Fixed RakNet header path for additional includes * RakNet Target for XCode * XCode Project Config Fixes * Packet logging * Network VS Project Filter Fix * Fix RakNet Packet ID Length We previously didn't have consistency between old and new C++ regarding PacketType enum length. Now we do. This is required or else it completely breaks networking between the versions. * Additional RakNet Error Handling * Disable packet logging * * Fix CMakeLists.txt This reflects the relocation of ClientSideNetworkHandler.cpp. * * Also add renderer/GL/GL.cpp to the CMakeLists.txt * * Replace libpng with stb_image * * Fix buggy water behavior. * * Put the CMakeLists of the SDL project in debug mode * Visual Studio 2010 Support * * Change the SdlIoCallbacks from an array to a single member. This fixes compilation of the sdl2 target on VS. * * Fix missing _error label. * Revert "* Fix missing _error label." This reverts commit 99a057fc84049a16c864bd840fb439a008af5c74. * Revert "* Replace libpng with stb_image" * info_updateGame Tiles --------- Co-authored-by: Brent Da Mage <BrentDaMage@users.noreply.github.com> Co-authored-by: iProgramInCpp <iprogramincpp@gmail.com>
151 lines
3.4 KiB
C++
151 lines
3.4 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 field_D8;
|
|
int field_DC;
|
|
//...
|
|
Textures* m_pTextures;
|
|
};
|