Merge branch 'main' into TU43
This commit is contained in:
@@ -62,7 +62,7 @@ body:
|
|||||||
- type: input
|
- type: input
|
||||||
id: itsrevela
|
id: itsrevela
|
||||||
attributes:
|
attributes:
|
||||||
label: Is this reproducable in itsRevela/LCE-Revelations? (https://github.com/itsRevela/LCE-Revelations)
|
label: Is this reproducable in itsRevela/LCE-Revelations? (https://git.revela.dev/itsRevela/LCE-Revelations)
|
||||||
description: If this was a "no idea" or similar, it will be rejected.
|
description: If this was a "no idea" or similar, it will be rejected.
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
@@ -56,8 +56,7 @@ enum EGameHostOptionWorldSize
|
|||||||
e_worldSize_Classic,
|
e_worldSize_Classic,
|
||||||
e_worldSize_Small,
|
e_worldSize_Small,
|
||||||
e_worldSize_Medium,
|
e_worldSize_Medium,
|
||||||
e_worldSize_Large,
|
e_worldSize_Large
|
||||||
e_worldSize_Expanded
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,15 @@ GuiParticles::GuiParticles(Minecraft *mc)
|
|||||||
this->mc = mc;
|
this->mc = mc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GuiParticles::~GuiParticles()
|
||||||
|
{
|
||||||
|
for (GuiParticle *gp : particles)
|
||||||
|
{
|
||||||
|
delete gp;
|
||||||
|
}
|
||||||
|
particles.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void GuiParticles::tick()
|
void GuiParticles::tick()
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < particles.size(); i++)
|
for (unsigned int i = 0; i < particles.size(); i++)
|
||||||
@@ -19,6 +28,7 @@ void GuiParticles::tick()
|
|||||||
|
|
||||||
if (gp->removed)
|
if (gp->removed)
|
||||||
{
|
{
|
||||||
|
delete gp;
|
||||||
particles.erase(particles.begin()+i);
|
particles.erase(particles.begin()+i);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
GuiParticles(Minecraft *mc);
|
GuiParticles(Minecraft *mc);
|
||||||
|
~GuiParticles();
|
||||||
void tick();
|
void tick();
|
||||||
void add(GuiParticle *guiParticle);
|
void add(GuiParticle *guiParticle);
|
||||||
void render(float a);
|
void render(float a);
|
||||||
|
|||||||
@@ -10,7 +10,14 @@ public:
|
|||||||
int id;
|
int id;
|
||||||
bool isLoaded;
|
bool isLoaded;
|
||||||
int ticksSinceLastUse;
|
int ticksSinceLastUse;
|
||||||
static const int UNUSED_TICKS_TO_FREE = 20;
|
// @CDevJoud
|
||||||
|
// changing the lifetime of the texture from 20 ticks(1 sec) to 200 ticks (10 sec)
|
||||||
|
// as it helps the texture to have longer lifetime and reducing the usage of loadTexture for every second/frame
|
||||||
|
// note that we dont remove the code that removes the textures from `tick()` as it is required in memory limited environment such as older Consoles(PS3/XBOX360)
|
||||||
|
static const int UNUSED_TICKS_TO_FREE = 200;
|
||||||
|
|
||||||
|
//default ctor for int Texture::getHeight(const wstring& url, int backup)
|
||||||
|
MemTexture() = default;
|
||||||
|
|
||||||
MemTexture(const wstring& _name, PBYTE pbData, DWORD dwBytes, MemTextureProcessor *processor);
|
MemTexture(const wstring& _name, PBYTE pbData, DWORD dwBytes, MemTextureProcessor *processor);
|
||||||
~MemTexture();
|
~MemTexture();
|
||||||
|
|||||||
@@ -526,9 +526,10 @@ LevelStorageSource *Minecraft::getLevelSource()
|
|||||||
|
|
||||||
void Minecraft::setScreen(Screen *screen)
|
void Minecraft::setScreen(Screen *screen)
|
||||||
{
|
{
|
||||||
if (this->screen != nullptr)
|
Screen *oldScreen = this->screen;
|
||||||
|
if (oldScreen != nullptr)
|
||||||
{
|
{
|
||||||
this->screen->removed();
|
oldScreen->removed();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WINDOWS64
|
#ifdef _WINDOWS64
|
||||||
@@ -4438,6 +4439,8 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt
|
|||||||
// 4J If we are setting the level to nullptr then we are exiting, so delete the levels
|
// 4J If we are setting the level to nullptr then we are exiting, so delete the levels
|
||||||
if( level == nullptr )
|
if( level == nullptr )
|
||||||
{
|
{
|
||||||
|
if (soundEngine) soundEngine->stopElytraSound();
|
||||||
|
|
||||||
if(levels[0]!=nullptr)
|
if(levels[0]!=nullptr)
|
||||||
{
|
{
|
||||||
delete levels[0];
|
delete levels[0];
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ MultiPlayerChunkCache::MultiPlayerChunkCache(Level *level)
|
|||||||
this->level = level;
|
this->level = level;
|
||||||
|
|
||||||
this->cache = new LevelChunk *[XZSIZE * XZSIZE];
|
this->cache = new LevelChunk *[XZSIZE * XZSIZE];
|
||||||
memset(this->cache, 0, sizeof(LevelChunk*) * XZSIZE * XZSIZE);
|
memset(this->cache, 0, XZSIZE * XZSIZE * sizeof(LevelChunk *));
|
||||||
InitializeCriticalSectionAndSpinCount(&m_csLoadCreate,4000);
|
InitializeCriticalSectionAndSpinCount(&m_csLoadCreate,4000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ bool MultiPlayerChunkCache::reallyHasChunk(int x, int z)
|
|||||||
int idx = ix * XZSIZE + iz;
|
int idx = ix * XZSIZE + iz;
|
||||||
|
|
||||||
LevelChunk *chunk = cache[idx];
|
LevelChunk *chunk = cache[idx];
|
||||||
if (chunk == nullptr)
|
if( chunk == nullptr )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -145,8 +145,7 @@ void MultiPlayerChunkCache::drop(const int x, const int z)
|
|||||||
const int iz = z + XZOFFSET;
|
const int iz = z + XZOFFSET;
|
||||||
if ((ix < 0) || (ix >= XZSIZE)) return;
|
if ((ix < 0) || (ix >= XZSIZE)) return;
|
||||||
if ((iz < 0) || (iz >= XZSIZE)) return;
|
if ((iz < 0) || (iz >= XZSIZE)) return;
|
||||||
|
const int idx = ix * XZSIZE + iz;
|
||||||
int idx = ix * XZSIZE + iz;
|
|
||||||
LevelChunk* chunk = cache[idx];
|
LevelChunk* chunk = cache[idx];
|
||||||
|
|
||||||
if (chunk != nullptr && !chunk->isEmpty())
|
if (chunk != nullptr && !chunk->isEmpty())
|
||||||
@@ -170,7 +169,6 @@ LevelChunk *MultiPlayerChunkCache::create(int x, int z)
|
|||||||
if( ( ix < 0 ) || ( ix >= XZSIZE ) ) return ( waterChunk ? waterChunk : emptyChunk );
|
if( ( ix < 0 ) || ( ix >= XZSIZE ) ) return ( waterChunk ? waterChunk : emptyChunk );
|
||||||
if( ( iz < 0 ) || ( iz >= XZSIZE ) ) return ( waterChunk ? waterChunk : emptyChunk );
|
if( ( iz < 0 ) || ( iz >= XZSIZE ) ) return ( waterChunk ? waterChunk : emptyChunk );
|
||||||
int idx = ix * XZSIZE + iz;
|
int idx = ix * XZSIZE + iz;
|
||||||
|
|
||||||
LevelChunk *chunk = cache[idx];
|
LevelChunk *chunk = cache[idx];
|
||||||
LevelChunk *lastChunk = chunk;
|
LevelChunk *lastChunk = chunk;
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,18 @@ Screen::Screen() // 4J added
|
|||||||
clickedButton = nullptr;
|
clickedButton = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Screen::~Screen()
|
||||||
|
{
|
||||||
|
delete particles;
|
||||||
|
particles = nullptr;
|
||||||
|
|
||||||
|
for (Button *button : buttons)
|
||||||
|
{
|
||||||
|
delete button;
|
||||||
|
}
|
||||||
|
buttons.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void Screen::render(int xm, int ym, float a)
|
void Screen::render(int xm, int ym, float a)
|
||||||
{
|
{
|
||||||
for (Button* button : buttons)
|
for (Button* button : buttons)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public:
|
|||||||
GuiParticles *particles;
|
GuiParticles *particles;
|
||||||
|
|
||||||
Screen(); // 4J added
|
Screen(); // 4J added
|
||||||
|
virtual ~Screen();
|
||||||
virtual void render(int xm, int ym, float a);
|
virtual void render(int xm, int ym, float a);
|
||||||
protected:
|
protected:
|
||||||
virtual void keyPressed(wchar_t eventCharacter, int eventKey);
|
virtual void keyPressed(wchar_t eventCharacter, int eventKey);
|
||||||
|
|||||||
@@ -1256,8 +1256,14 @@ int Textures::getHeight(const wstring& url, int backup)
|
|||||||
|
|
||||||
if (img)
|
if (img)
|
||||||
{
|
{
|
||||||
|
MemTexture* _texture = new MemTexture();
|
||||||
|
_texture->loadedImage = img;
|
||||||
|
_texture->isLoaded = true;
|
||||||
|
_texture->id = getTexture(_texture->loadedImage, C4JRender::TEXTURE_FORMAT_RxGyBzAw, MIPMAP);
|
||||||
|
|
||||||
int h = img->getHeight();
|
int h = img->getHeight();
|
||||||
delete img;
|
//delete img; // commenting this out and inserting the loaded texture to memTextures unordered_map
|
||||||
|
this->memTextures[url] = _texture;
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -824,8 +824,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowWindow(g_hWnd, (nCmdShow != SW_HIDE) ? SW_SHOWMAXIMIZED : nCmdShow);
|
|
||||||
UpdateWindow(g_hWnd);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -1456,8 +1455,9 @@ void CleanupDevice()
|
|||||||
static Minecraft* InitialiseMinecraftRuntime()
|
static Minecraft* InitialiseMinecraftRuntime()
|
||||||
{
|
{
|
||||||
app.loadMediaArchive();
|
app.loadMediaArchive();
|
||||||
|
// @CDevJoud: No need to call this method as it gets called once in `InitDevice()`
|
||||||
RenderManager.Initialise(g_pd3dDevice, g_pSwapChain);
|
// Calling it again and it results of 20MB of memory leak!
|
||||||
|
//RenderManager.Initialise(g_pd3dDevice, g_pSwapChain);
|
||||||
|
|
||||||
app.loadStringTable();
|
app.loadStringTable();
|
||||||
ui.init(g_pd3dDevice, g_pImmediateContext, g_pRenderTargetView, g_pDepthStencilView, g_rScreenWidth, g_rScreenHeight);
|
ui.init(g_pd3dDevice, g_pImmediateContext, g_pRenderTargetView, g_pDepthStencilView, g_rScreenWidth, g_rScreenHeight);
|
||||||
@@ -1791,6 +1791,20 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
hr = XuiTimersRun();
|
hr = XuiTimersRun();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// @CDevJoud The window should only be shown after the engine/game
|
||||||
|
// initialization has fully completed.
|
||||||
|
//
|
||||||
|
// Showing the window too early especially on low end devices,
|
||||||
|
// may cause windows to display a "Not Responding" state while
|
||||||
|
// initialization is still in progress.
|
||||||
|
//
|
||||||
|
// This creates an unprofessional first impression for the player.
|
||||||
|
// Instead, initialize all engine systems first, then display the
|
||||||
|
// window once everything is ready.
|
||||||
|
ShowWindow(g_hWnd, (nCmdShow != SW_HIDE) ? SW_SHOWMAXIMIZED : nCmdShow);
|
||||||
|
UpdateWindow(g_hWnd);
|
||||||
|
|
||||||
MSG msg = {0};
|
MSG msg = {0};
|
||||||
while( WM_QUIT != msg.message && !app.m_bShutdown)
|
while( WM_QUIT != msg.message && !app.m_bShutdown)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -628,8 +628,6 @@ static std::string WorldSizeToPropertyValue(int worldSize)
|
|||||||
return "medium";
|
return "medium";
|
||||||
case e_worldSize_Large:
|
case e_worldSize_Large:
|
||||||
return "large";
|
return "large";
|
||||||
case e_worldSize_Expanded:
|
|
||||||
return "expanded";
|
|
||||||
case e_worldSize_Classic:
|
case e_worldSize_Classic:
|
||||||
default:
|
default:
|
||||||
return "classic";
|
return "classic";
|
||||||
@@ -646,8 +644,6 @@ static int WorldSizeToXzChunks(int worldSize)
|
|||||||
return LEVEL_WIDTH_MEDIUM;
|
return LEVEL_WIDTH_MEDIUM;
|
||||||
case e_worldSize_Large:
|
case e_worldSize_Large:
|
||||||
return LEVEL_WIDTH_LARGE;
|
return LEVEL_WIDTH_LARGE;
|
||||||
case e_worldSize_Expanded:
|
|
||||||
return LEVEL_WIDTH_EXPANDED;
|
|
||||||
case e_worldSize_Classic:
|
case e_worldSize_Classic:
|
||||||
default:
|
default:
|
||||||
return LEVEL_WIDTH_CLASSIC;
|
return LEVEL_WIDTH_CLASSIC;
|
||||||
@@ -663,7 +659,6 @@ static int WorldSizeToHellScale(int worldSize)
|
|||||||
case e_worldSize_Medium:
|
case e_worldSize_Medium:
|
||||||
return HELL_LEVEL_SCALE_MEDIUM;
|
return HELL_LEVEL_SCALE_MEDIUM;
|
||||||
case e_worldSize_Large:
|
case e_worldSize_Large:
|
||||||
case e_worldSize_Expanded:
|
|
||||||
return HELL_LEVEL_SCALE_LARGE;
|
return HELL_LEVEL_SCALE_LARGE;
|
||||||
case e_worldSize_Classic:
|
case e_worldSize_Classic:
|
||||||
default:
|
default:
|
||||||
@@ -699,12 +694,6 @@ static bool TryParseWorldSize(const std::string &lowered, int *outWorldSize)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lowered == "expanded" || lowered == "344" || lowered == "8")
|
|
||||||
{
|
|
||||||
*outWorldSize = e_worldSize_Expanded;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,10 +54,16 @@ AABB *AABB::newPermanent(double x0, double y0, double z0, double x1, double y1,
|
|||||||
|
|
||||||
void AABB::clearPool()
|
void AABB::clearPool()
|
||||||
{
|
{
|
||||||
|
ThreadStorage *tls = static_cast<ThreadStorage *>(TlsGetValue(tlsIdx));
|
||||||
|
if (tls != nullptr)
|
||||||
|
{
|
||||||
|
tls->poolPointer = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AABB::resetPool()
|
void AABB::resetPool()
|
||||||
{
|
{
|
||||||
|
clearPool();
|
||||||
}
|
}
|
||||||
|
|
||||||
AABB *AABB::newTemp(double x0, double y0, double z0, double x1, double y1, double z1)
|
AABB *AABB::newTemp(double x0, double y0, double z0, double x1, double y1, double z1)
|
||||||
|
|||||||
@@ -7,14 +7,12 @@ class TilePos;
|
|||||||
// The maximum number of chunks that we can store
|
// The maximum number of chunks that we can store
|
||||||
#ifdef _LARGE_WORLDS
|
#ifdef _LARGE_WORLDS
|
||||||
// 4J Stu - Our default map (at zoom level 3) is 1024x1024 blocks (or 64 chunks)
|
// 4J Stu - Our default map (at zoom level 3) is 1024x1024 blocks (or 64 chunks)
|
||||||
|
#define LEVEL_MAX_WIDTH (5*64) //(6*54)
|
||||||
|
|
||||||
#define LEVEL_WIDTH_CLASSIC 54
|
#define LEVEL_WIDTH_CLASSIC 54
|
||||||
#define LEVEL_WIDTH_SMALL 64
|
#define LEVEL_WIDTH_SMALL 64
|
||||||
#define LEVEL_WIDTH_MEDIUM (3*64)
|
#define LEVEL_WIDTH_MEDIUM (3*64)
|
||||||
#define LEVEL_WIDTH_LARGE (5*64)
|
#define LEVEL_WIDTH_LARGE (5*64)
|
||||||
#define LEVEL_WIDTH_EXPANDED (5*64) + 24
|
|
||||||
|
|
||||||
|
|
||||||
#define LEVEL_MAX_WIDTH LEVEL_WIDTH_EXPANDED
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define LEVEL_MAX_WIDTH 54
|
#define LEVEL_MAX_WIDTH 54
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ DWORD Level::tlsIdxLightCache = TlsAlloc();
|
|||||||
|
|
||||||
// 4J : WESTY : Added for time played stats.
|
// 4J : WESTY : Added for time played stats.
|
||||||
#include "net.minecraft.stats.h"
|
#include "net.minecraft.stats.h"
|
||||||
#include "../Minecraft.Client/MultiPlayerChunkCache.h"
|
|
||||||
|
|
||||||
// 4J - Caching of lighting data added. This is implemented as a 16x16x16 cache of ints (ie 16K storage in total). The index of the element to be used in the array is determined by the lower
|
// 4J - Caching of lighting data added. This is implemented as a 16x16x16 cache of ints (ie 16K storage in total). The index of the element to be used in the array is determined by the lower
|
||||||
// four bits of each x/y/z position, and the upper 7/4/7 bits of the x/y/z positions are stored within the element itself along with the cached values etc. The cache can be enabled per thread by
|
// four bits of each x/y/z position, and the upper 7/4/7 bits of the x/y/z positions are stored within the element itself along with the cached values etc. The cache can be enabled per thread by
|
||||||
@@ -1338,7 +1337,7 @@ int Level::getBrightness(LightLayer::variety layer, int x, int y, int z)
|
|||||||
int idx = ix * chunkSourceXZSize + iz;
|
int idx = ix * chunkSourceXZSize + iz;
|
||||||
LevelChunk *c = chunkSourceCache[idx];
|
LevelChunk *c = chunkSourceCache[idx];
|
||||||
|
|
||||||
if( c == nullptr) return (int)layer;
|
if( c == nullptr ) return (int)layer;
|
||||||
|
|
||||||
if (y < 0) y = 0;
|
if (y < 0) y = 0;
|
||||||
if (y >= maxBuildHeight) y = maxBuildHeight - 1;
|
if (y >= maxBuildHeight) y = maxBuildHeight - 1;
|
||||||
|
|||||||
@@ -185,7 +185,6 @@ LevelData::LevelData(CompoundTag *tag)
|
|||||||
case LEVEL_WIDTH_SMALL: hostOptionworldSize = e_worldSize_Small; break;
|
case LEVEL_WIDTH_SMALL: hostOptionworldSize = e_worldSize_Small; break;
|
||||||
case LEVEL_WIDTH_MEDIUM: hostOptionworldSize = e_worldSize_Medium; break;
|
case LEVEL_WIDTH_MEDIUM: hostOptionworldSize = e_worldSize_Medium; break;
|
||||||
case LEVEL_WIDTH_LARGE: hostOptionworldSize = e_worldSize_Large; break;
|
case LEVEL_WIDTH_LARGE: hostOptionworldSize = e_worldSize_Large; break;
|
||||||
case LEVEL_WIDTH_EXPANDED: hostOptionworldSize = e_worldSize_Expanded; break;
|
|
||||||
default: assert(0); break;
|
default: assert(0); break;
|
||||||
}
|
}
|
||||||
app.SetGameHostOption(eGameHostOption_WorldSize, hostOptionworldSize );
|
app.SetGameHostOption(eGameHostOption_WorldSize, hostOptionworldSize );
|
||||||
|
|||||||
@@ -49,10 +49,16 @@ Vec3 *Vec3::newPermanent(double x, double y, double z)
|
|||||||
|
|
||||||
void Vec3::clearPool()
|
void Vec3::clearPool()
|
||||||
{
|
{
|
||||||
|
ThreadStorage *tls = static_cast<ThreadStorage *>(TlsGetValue(tlsIdx));
|
||||||
|
if (tls != nullptr)
|
||||||
|
{
|
||||||
|
tls->poolPointer = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Vec3::resetPool()
|
void Vec3::resetPool()
|
||||||
{
|
{
|
||||||
|
clearPool();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3 *Vec3::newTemp(double x, double y, double z)
|
Vec3 *Vec3::newTemp(double x, double y, double z)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# neoLegacy v1.0.5b
|
# neoLegacy v1.0.7b
|
||||||
|
|
||||||
### Bug Fixes
|
- Reverted "Expanded" world size due to it causing crashing and lighting issues.
|
||||||
- Fixed crashing, lagging, and lighting issues caused by expanded world generation.
|
|
||||||
|
|
||||||
<img width="784" height="410" alt="roadmap" src="https://github.com/user-attachments/assets/134856ae-b151-4003-aa97-7ecf19ccd278" />
|
<img width="784" height="410" alt="roadmap" src="https://github.com/user-attachments/assets/134856ae-b151-4003-aa97-7ecf19ccd278" />
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user