From 08e5d21d4b288995102b04f085ccadf85625049e Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 10 Jun 2024 08:41:00 +1000 Subject: [PATCH] Classic mode should only show players up to 64 blocks away --- .github/workflows/build_mac32.yml | 2 +- src/Entity.c | 3 +++ src/Graphics_GL1.c | 9 ++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_mac32.yml b/.github/workflows/build_mac32.yml index bdb9af9fb..5a6703888 100644 --- a/.github/workflows/build_mac32.yml +++ b/.github/workflows/build_mac32.yml @@ -15,7 +15,7 @@ jobs: build: env: GHCR_ACCESS_KEY: ${{ secrets.GHCR_ACCESS_KEY }} - if: env.GHCR_ACCESS_KEY + if: ${{ env.GHCR_ACCESS_KEY != '' }} runs-on: ubuntu-latest container: image: ghcr.io/classicube/minimal-osxcross:latest diff --git a/src/Entity.c b/src/Entity.c index 97a642556..569a24182 100644 --- a/src/Entity.c +++ b/src/Entity.c @@ -1028,6 +1028,9 @@ static void NetPlayer_RenderModel(struct Entity* e, float delta, float t) { AnimatedComp_GetCurrent(e, t); e->ShouldRender = Model_ShouldRender(e); + /* Original classic only shows players up to 64 blocks away */ + if (Game_ClassicMode) e->ShouldRender &= Model_RenderDistance(e) <= 64 * 64; + if (e->ShouldRender) Model_Render(e->Model, e); } diff --git a/src/Graphics_GL1.c b/src/Graphics_GL1.c index 26fb6740e..9ad323335 100644 --- a/src/Graphics_GL1.c +++ b/src/Graphics_GL1.c @@ -7,6 +7,9 @@ #include "_GraphicsBase.h" #include "Errors.h" #include "Window.h" +#ifdef CC_BUILD_WIN + #define CC_BUILD_GL11_FALLBACK +#endif /* The OpenGL backend is a bit of a mess, since it's really 2 backends in one: * - OpenGL 1.1 (completely lacking GPU, fallbacks to say Windows built-in software rasteriser) @@ -41,7 +44,7 @@ static void GLContext_GetAll(const struct DynamicLibSym* syms, int count) { } -#if defined CC_BUILD_WIN && !defined CC_BUILD_GL11 +#if defined CC_BUILD_GL11_FALLBACK && !defined CC_BUILD_GL11 /* Note the following about calling OpenGL functions on Windows */ /* 1) wglGetProcAddress returns a context specific address */ /* 2) dllimport functions are implemented using indirect function pointers */ @@ -506,7 +509,7 @@ cc_bool Gfx_WarnIfNecessary(void) { static void GLBackend_Init(void) { MakeIndices(gl_indices, GFX_MAX_INDICES, NULL); } #else -#if defined CC_BUILD_WIN +#ifdef CC_BUILD_GL11_FALLBACK static FP_glDrawElements _realDrawElements; static FP_glColorPointer _realColorPointer; static FP_glTexCoordPointer _realTexCoordPointer; @@ -670,7 +673,7 @@ static void GLBackend_Init(void) { /* Version string is always: x.y. (and whatever afterwards) */ int major = ver[0] - '0', minor = ver[2] - '0'; -#ifdef CC_BUILD_WIN +#ifdef CC_BUILD_GL11_FALLBACK LoadCoreFuncs(); #endif customMipmapsLevels = true;