From 59b4125a03fe55cf96d0326cc89abba58e9da063 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 1 Aug 2019 08:16:08 +1000 Subject: [PATCH] remove inline functions that were only used once Turns out the web client doesn't actually inline inline functions --- src/EnvRenderer.c | 8 ++++---- src/MapRenderer.c | 2 +- src/Vectors.h | 12 ------------ src/Widgets.c | 4 ++-- 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/EnvRenderer.c b/src/EnvRenderer.c index 6235a59ba..131d3e1aa 100644 --- a/src/EnvRenderer.c +++ b/src/EnvRenderer.c @@ -360,7 +360,7 @@ static void EnvRenderer_UpdateSkybox(void) { int16_t* Weather_Heightmap; static GfxResourceID rain_tex, snow_tex, weather_vb; static double weather_accumulator; -static IVec3 weather_lastPos; +static IVec3 lastPos; #define WEATHER_EXTENT 4 #define WEATHER_VERTS_COUNT 8 * (WEATHER_EXTENT * 2 + 1) * (WEATHER_EXTENT * 2 + 1) @@ -463,8 +463,8 @@ void EnvRenderer_RenderWeather(double deltaTime) { Gfx_BindTexture(weather == WEATHER_RAINY ? rain_tex : snow_tex); IVec3_Floor(&pos, &Camera.CurrentPos); - moved = IVec3_NotEquals(&pos, &weather_lastPos); - weather_lastPos = pos; + moved = pos.X != lastPos.X || pos.Y != lastPos.Y || pos.Z != lastPos.Z; + lastPos = pos; /* Rain should extend up by 64 blocks, or to the top of the world. */ pos.Y += 64; @@ -947,7 +947,7 @@ static void EnvRenderer_Reset(void) { Mem_Free(Weather_Heightmap); Weather_Heightmap = NULL; - weather_lastPos = IVec3_MaxValue(); + lastPos = IVec3_MaxValue(); } static void EnvRenderer_OnNewMapLoaded(void) { diff --git a/src/MapRenderer.c b/src/MapRenderer.c index 4573dec3f..9104adf53 100644 --- a/src/MapRenderer.c +++ b/src/MapRenderer.c @@ -581,7 +581,7 @@ static void MapRenderer_UpdateSortOrder(void) { pos.Z = (pos.Z & ~CHUNK_MASK) + HALF_CHUNK_SIZE; /* If in same chunk, don't need to recalculate sort order */ - if (IVec3_Equals(&pos, &chunkPos)) return; + if (pos.X == chunkPos.X && pos.Y == chunkPos.Y && pos.Z == chunkPos.Z) return; chunkPos = pos; if (!MapRenderer_ChunksCount) return; diff --git a/src/Vectors.h b/src/Vectors.h index 7da9f4939..c5393b6b0 100644 --- a/src/Vectors.h +++ b/src/Vectors.h @@ -99,18 +99,6 @@ Vec3 Vec3_RotateZ(Vec3 v, float angle); static CC_INLINE bool Vec3_Equals(const Vec3* a, const Vec3* b) { return a->X == b->X && a->Y == b->Y && a->Z == b->Z; } -/* Whether any of the components of the two vectors differ. */ -static CC_INLINE bool Vec3_NotEquals(const Vec3* a, const Vec3* b) { - return a->X != b->X || a->Y != b->Y || a->Z != b->Z; -} -/* Whether all of the components of the two vectors are equal. */ -static CC_INLINE bool IVec3_Equals(const IVec3* a, const IVec3* b) { - return a->X == b->X && a->Y == b->Y && a->Z == b->Z; -} -/* Whether any of the components of the two vectors differ. */ -static CC_INLINE bool IVec3_NotEquals(const IVec3* a, const IVec3* b) { - return a->X != b->X || a->Y != b->Y || a->Z != b->Z; -} void IVec3_Floor(IVec3* result, const Vec3* a); void IVec3_ToVec3(Vec3* result, const IVec3* a); diff --git a/src/Widgets.c b/src/Widgets.c index 35df14898..878f33f96 100644 --- a/src/Widgets.c +++ b/src/Widgets.c @@ -2328,8 +2328,8 @@ static void TextGroupWidget_Output(struct Portion bit, int lineBeg, int lineEnd, static int TextGroupWidget_Reduce(struct TextGroupWidget* w, char* chars, int target, struct Portion* portions) { struct Portion* start = portions; - int32_t begs[TEXTGROUPWIDGET_MAX_LINES]; - int32_t ends[TEXTGROUPWIDGET_MAX_LINES]; + int begs[TEXTGROUPWIDGET_MAX_LINES]; + int ends[TEXTGROUPWIDGET_MAX_LINES]; struct Portion bit; String line; int nextStart, i, total = 0, end;