From 2a0cc4cf8c14a34b42b3722e5b95707898d89dc6 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 10 Feb 2020 20:21:50 +1100 Subject: [PATCH] Fix menus not rendering in OpenGL --- src/Graphics.c | 7 ++++--- src/Particle.c | 2 +- src/Particle.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Graphics.c b/src/Graphics.c index f6ee70f77..dac720fc3 100644 --- a/src/Graphics.c +++ b/src/Graphics.c @@ -1072,10 +1072,11 @@ static void* tmpData; static int tmpSize; static void* FastAllocTempMem(int size) { - if (size <= tmpSize) return tmpData; - Mem_Free(tmpData); + if (size > tmpSize) { + Mem_Free(tmpData); + tmpData = Mem_Alloc(size, 1, "Gfx_AllocTempMemory"); + } - tmpData = Mem_Alloc(size, 1, "Gfx_AllocTempMemory"); tmpSize = size; return tmpData; } diff --git a/src/Particle.c b/src/Particle.c index fe9c4fc07..634562e04 100644 --- a/src/Particle.c +++ b/src/Particle.c @@ -20,7 +20,7 @@ static GfxResourceID Particles_TexId, Particles_VB; static RNGState rnd; static cc_bool particle_hitTerrain; -void Particle_DoRender(Vec2* size, Vec3* pos, TextureRec* rec, PackedCol col, VertexP3fT2fC4b* v) { +void Particle_DoRender(const Vec2* size, const Vec3* pos, const TextureRec* rec, PackedCol col, VertexP3fT2fC4b* v) { struct Matrix* view; float sX, sY; Vec3 centre; diff --git a/src/Particle.h b/src/Particle.h index c83304199..26980fcfd 100644 --- a/src/Particle.h +++ b/src/Particle.h @@ -18,7 +18,7 @@ struct Particle { }; /* http://www.opengl-tutorial.org/intermediate-tutorials/billboards-particles/billboards/ */ -void Particle_DoRender(Vec2* size, Vec3* pos, TextureRec* rec, PackedCol col, VertexP3fT2fC4b* vertices); +void Particle_DoRender(const Vec2* size, const Vec3* pos, const TextureRec* rec, PackedCol col, VertexP3fT2fC4b* vertices); void Particles_Render(float t); void Particles_Tick(struct ScheduledTask* task); void Particles_BreakBlockEffect(IVec3 coords, BlockID oldBlock, BlockID block);