From 453fb48cad7b89ea15ebe4584df13415151ce11c Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 25 Apr 2019 09:26:47 +1000 Subject: [PATCH] less compile errors with metroworks --- src/Bitmap.c | 2 +- src/Core.h | 8 ++++++++ src/Input.c | 4 ++-- src/Menus.c | 2 +- src/Physics.c | 2 +- src/Vectors.c | 2 +- src/Vectors.h | 2 +- 7 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Bitmap.c b/src/Bitmap.c index 13347d843..23111781f 100644 --- a/src/Bitmap.c +++ b/src/Bitmap.c @@ -255,7 +255,7 @@ static void Png_Expand_RGB_A_16(int width, BitmapCol* palette, uint8_t* src, Bit } } -Png_RowExpander Png_GetExpander(uint8_t col, uint8_t bitsPerSample) { +static Png_RowExpander Png_GetExpander(uint8_t col, uint8_t bitsPerSample) { switch (col) { case PNG_COL_GRAYSCALE: switch (bitsPerSample) { diff --git a/src/Core.h b/src/Core.h index 1406eeb86..3b854d325 100644 --- a/src/Core.h +++ b/src/Core.h @@ -40,6 +40,14 @@ typedef signed __int64 int64_t; #define CC_VAR __attribute__((visibility("default"))) #endif #endif +#elif __MWERKS__ +/* TODO: Is there actual attribute support for these somewhere? */ +#include +#define CC_INLINE inline +#define CC_NOINLINE +#define CC_ALIGN_HINT(x) +#define CC_API +#define CC_VAR #else #error "Unknown compiler. You'll need to add required definitions in Core.h!" #endif diff --git a/src/Input.c b/src/Input.c index 9ffa82cec..ce88abe08 100644 --- a/src/Input.c +++ b/src/Input.c @@ -146,7 +146,7 @@ const char* KeyBind_Names[KEYBIND_COUNT] = { bool KeyBind_IsPressed(KeyBind binding) { return Key_Pressed[KeyBinds[binding]]; } -void KeyBind_Load(void) { +static void KeyBind_Load(void) { String name; char nameBuffer[STRING_SIZE + 1]; Key mapping; int i; @@ -162,7 +162,7 @@ void KeyBind_Load(void) { } } -void KeyBind_Save(void) { +static void KeyBind_Save(void) { String name; char nameBuffer[STRING_SIZE]; String value; int i; diff --git a/src/Menus.c b/src/Menus.c index ec0a2127b..ceb39f4f0 100644 --- a/src/Menus.c +++ b/src/Menus.c @@ -364,7 +364,7 @@ static void Menu_SwitchFont(void* a, void* b) { Menu_ReplaceActive(Fo static struct ListScreen ListScreen_Instance; #define LIST_SCREEN_EMPTY "-----" -STRING_REF String ListScreen_UNSAFE_Get(struct ListScreen* s, int index) { +static STRING_REF String ListScreen_UNSAFE_Get(struct ListScreen* s, int index) { const static String str = String_FromConst(LIST_SCREEN_EMPTY); if (index >= 0 && index < s->Entries.Count) { diff --git a/src/Physics.c b/src/Physics.c index 16c1d2b9d..347632652 100644 --- a/src/Physics.c +++ b/src/Physics.c @@ -50,7 +50,7 @@ bool AABB_ContainsPoint(const struct AABB* parent, const Vector3* P) { /*########################################################################################################################* *------------------------------------------------------Intersection-------------------------------------------------------* *#########################################################################################################################*/ -Vector3 Intersection_InverseRotate(Vector3 pos, struct Entity* target) { +static Vector3 Intersection_InverseRotate(Vector3 pos, struct Entity* target) { pos = Vector3_RotateY(pos, -target->RotY * MATH_DEG2RAD); pos = Vector3_RotateZ(pos, -target->RotZ * MATH_DEG2RAD); pos = Vector3_RotateX(pos, -target->RotX * MATH_DEG2RAD); diff --git a/src/Vectors.c b/src/Vectors.c index df53f1f4b..7bd6d9a60 100644 --- a/src/Vectors.c +++ b/src/Vectors.c @@ -220,7 +220,7 @@ frustum20, frustum21, frustum22, frustum23, frustum30, frustum31, frustum32, frustum33, frustum40, frustum41, frustum42, frustum43; -void FrustumCulling_Normalise(float* plane0, float* plane1, float* plane2, float* plane3) { +static void FrustumCulling_Normalise(float* plane0, float* plane1, float* plane2, float* plane3) { float val1 = *plane0, val2 = *plane1, val3 = *plane2; float t = Math_SqrtF(val1 * val1 + val2 * val2 + val3 * val3); *plane0 /= t; *plane1 /= t; *plane2 /= t; *plane3 /= t; diff --git a/src/Vectors.h b/src/Vectors.h index c06eef604..0fa506c48 100644 --- a/src/Vectors.h +++ b/src/Vectors.h @@ -100,7 +100,7 @@ static CC_INLINE bool Vector3_Equals(const Vector3* a, const Vector3* 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 Vector3_NotEquals(const Vector3* a, const Vector3* b) { +static CC_INLINE bool Vector3_NotEquals(const Vector3* a, const Vector3* 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. */