From 6b71793b4f0b430c9624af04eab59e490c8b7993 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Thu, 21 Nov 2024 20:20:37 -0600 Subject: [PATCH] Fix clang compiler issues --- include/objects.h | 8 +++++ src/actors/blue_and_red_shells/update.inc.c | 1 + src/actors/green_shell/update.inc.c | 1 + src/animation.c | 1 + src/code_800029B0.c | 2 +- src/code_80057C60.c | 1 + src/data/some_data.h | 8 +++++ src/ending/code_80280000.c | 1 + src/engine/Matrix.h | 2 ++ src/main.c | 1 + src/math_util_2.c | 1 + src/player_controller.c | 1 + src/port/Game.h | 37 +++++++++++++++++++++ src/racing/actors.c | 2 +- src/racing/actors_extended.c | 1 + src/racing/math_util.c | 1 + src/racing/render_courses.h | 1 + src/render_player.c | 1 + 18 files changed, 69 insertions(+), 2 deletions(-) diff --git a/include/objects.h b/include/objects.h index c3ee37a1b..d4da8cd95 100644 --- a/include/objects.h +++ b/include/objects.h @@ -4,6 +4,10 @@ #include "spline.h" #include +#ifdef __cplusplus +extern "C" { +#endif + #define OBJECT_LIST_SIZE 0x226 #define SOME_OBJECT_INDEX_LIST_SIZE 32 @@ -451,4 +455,8 @@ extern s8 D_8018D230; //! Some sort of limiter on how many of some object type can spawn extern s32 D_8018D3C4; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/actors/blue_and_red_shells/update.inc.c b/src/actors/blue_and_red_shells/update.inc.c index 861433446..c09d30d64 100644 --- a/src/actors/blue_and_red_shells/update.inc.c +++ b/src/actors/blue_and_red_shells/update.inc.c @@ -4,6 +4,7 @@ #include #include #include +#include "port/Game.h" void func_802B3B44(struct ShellActor* shell) { u16 currentWaypoint; diff --git a/src/actors/green_shell/update.inc.c b/src/actors/green_shell/update.inc.c index 546baee89..4e4c8f9e8 100644 --- a/src/actors/green_shell/update.inc.c +++ b/src/actors/green_shell/update.inc.c @@ -3,6 +3,7 @@ #include #include #include "collision.h" +#include "port/Game.h" /** * @brief Updates the green shell actor. diff --git a/src/animation.c b/src/animation.c index 6ccab044a..ee758a8ae 100644 --- a/src/animation.c +++ b/src/animation.c @@ -7,6 +7,7 @@ #include #include #include "code_80057C60.h" +#include "engine/Matrix.h" Vec3s sOriginalPosAnimation; s16 isNotTheFirst; diff --git a/src/code_800029B0.c b/src/code_800029B0.c index b6f5b1820..d6a806430 100644 --- a/src/code_800029B0.c +++ b/src/code_800029B0.c @@ -179,7 +179,7 @@ void setup_race(void) { struct Controller* controller; int i; - printf("Setup Race!\n"); + LUSLOG_DEBUG("Setup Race!", 0); gPlayerCountSelection1 = gPlayerCount; if (gGamestate != RACING) { diff --git a/src/code_80057C60.c b/src/code_80057C60.c index 11a1d436e..5450f9d93 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -38,6 +38,7 @@ #include "data/some_data.h" #include #include "port/Game.h" +#include "engine/Matrix.h" //! @warning this macro is undef'd at the end of this file #define MAKE_RGB(r, g, b) (((r) << 0x10) | ((g) << 0x08) | (b << 0x00)) diff --git a/src/data/some_data.h b/src/data/some_data.h index 35f044113..7c9667e7f 100644 --- a/src/data/some_data.h +++ b/src/data/some_data.h @@ -7,6 +7,10 @@ #include #include "objects.h" +#ifdef __cplusplus +extern "C" { +#endif + extern Vtx D_800E49C0[]; extern Vtx D_800E4AC0[]; extern Vtx D_800E4BC0[]; @@ -87,4 +91,8 @@ extern StarData gWarioStadiumStars[]; extern u8 D_800E6F30[][3]; extern u8 D_800E6F48[][3]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/ending/code_80280000.c b/src/ending/code_80280000.c index 9c2f654c9..848cd3e1a 100644 --- a/src/ending/code_80280000.c +++ b/src/ending/code_80280000.c @@ -28,6 +28,7 @@ #include "engine/Engine.h" #include "engine/courses/Course.h" #include "engine/Matrix.h" +#include "port/Game.h" s32 D_802874A0; // s32 D_802874A4[5]; diff --git a/src/engine/Matrix.h b/src/engine/Matrix.h index b0be2bf87..cff3f22ac 100644 --- a/src/engine/Matrix.h +++ b/src/engine/Matrix.h @@ -19,6 +19,8 @@ Mtx* GetEffectMatrix(void); void ClearHudMatrixPool(void); void ClearEffectsMatrixPool(void); void ClearObjectsMatrixPool(void); +void AddKartMatrix(Mat4 mtx, s32 flags); +void AddShadowMatrix(Mat4 mtx, s32 flags); #ifdef __cplusplus } diff --git a/src/main.c b/src/main.c index 01857b6f5..cdbc4115d 100644 --- a/src/main.c +++ b/src/main.c @@ -46,6 +46,7 @@ #include "enhancements/freecam/freecam.h" #include "engine/wasm.h" #include "port/Game.h" +#include "engine/Matrix.h" // Declarations (not in this file) void func_80091B78(void); diff --git a/src/math_util_2.c b/src/math_util_2.c index 1eeaecaef..f2b85daeb 100644 --- a/src/math_util_2.c +++ b/src/math_util_2.c @@ -14,6 +14,7 @@ #include "camera.h" #include "port/Engine.h" +#include "engine/Matrix.h" #pragma intrinsic(sqrtf) diff --git a/src/player_controller.c b/src/player_controller.c index 180a62290..6c72935d1 100644 --- a/src/player_controller.c +++ b/src/player_controller.c @@ -22,6 +22,7 @@ #include "sounds.h" #include "port/Game.h" #include "src/enhancements/moon_jump.h" +#include "engine/Matrix.h" extern s32 D_8018D168; diff --git a/src/port/Game.h b/src/port/Game.h index 1dbaaa519..3faf2bc82 100644 --- a/src/port/Game.h +++ b/src/port/Game.h @@ -82,6 +82,36 @@ void CourseManager_BombKartsWaypoint(s32 cameraId); void CourseManager_ScrollingTextures(); +s32 CourseManager_GetCrossingOnTriggered(uintptr_t* crossing); + +void CourseManager_VehiclesSpawn(); + +void CourseManager_DrawWater(struct UnkStruct_800DC5EC* screen, uint16_t pathCounter, uint16_t cameraRot, uint16_t playerDirection); + +void CourseManager_AICrossingBehaviour(s32 playerId); + +void CourseManager_ClearVehicles(void); + +void CourseManager_DrawVehicles(s32 playerId); + +void CourseManager_CrossingTrigger(); + +void CourseManager_VehiclesCollision(s32 playerId, Player* player); + +void CourseManager_VehiclesTick(); + +void CourseManager_TickBombKarts(); + +void CourseManager_TickActors(); + +void CourseManager_TrainSmokeTick(void); + +void CourseManager_DrawBattleBombKarts(s32 cameraId); + +void CourseManager_DrawBombKarts(s32 cameraId); + +void CourseManager_TrainSmokeDraw(s32 cameraId); + size_t GetCupCursorPosition(); void SetCupCursorPosition(size_t position); @@ -92,12 +122,17 @@ void SetCourseFromCup(); void* GetCourse(void); +void SetCourseById(s32 course); + void SetCourseByClass(void* course); struct Actor* m_GetActor(size_t index); void m_DeleteActor(size_t index); struct Actor* m_AddBaseActor(void); size_t m_GetActorSize(); +size_t m_FindActorIndex(struct Actor* actor); +void m_ActorCollision(Player* player, struct Actor* actor); +void m_ClearActors(void); void* GetMarioRaceway(void); @@ -151,6 +186,8 @@ void* GetSpecialCup(void); void* GetBattleCup(void); +void* GetCup(); + #ifdef __cplusplus } #endif diff --git a/src/racing/actors.c b/src/racing/actors.c index 7ebdfd5f1..d7b1168a0 100644 --- a/src/racing/actors.c +++ b/src/racing/actors.c @@ -850,7 +850,7 @@ void spawn_piranha_plants(struct ActorSpawnData* spawnData) { } } -void spawn_palm_trees(const char* spawnData) { +void spawn_palm_trees(struct ActorSpawnData* spawnData) { struct ActorSpawnData* temp_s0 = spawnData; struct PalmTree* temp_v1; Vec3f startingPos; diff --git a/src/racing/actors_extended.c b/src/racing/actors_extended.c index b13609ef1..0e11b2961 100644 --- a/src/racing/actors_extended.c +++ b/src/racing/actors_extended.c @@ -15,6 +15,7 @@ #include "update_objects.h" #include "effects.h" #include "sounds.h" +#include "port/Game.h" void copy_collision(Collision* src, Collision* dest) { dest->unk30 = src->unk30; diff --git a/src/racing/math_util.c b/src/racing/math_util.c index a892066bc..4204e8670 100644 --- a/src/racing/math_util.c +++ b/src/racing/math_util.c @@ -7,6 +7,7 @@ #include "buffers/trig_tables.h" #include "math.h" #include "memory.h" +#include "engine/Matrix.h" #pragma intrinsic(sqrtf, fabs) diff --git a/src/racing/render_courses.h b/src/racing/render_courses.h index e1e87fcc9..dc9a26f63 100644 --- a/src/racing/render_courses.h +++ b/src/racing/render_courses.h @@ -36,6 +36,7 @@ void render_double_deck(struct UnkStruct_800DC5EC*); void render_dks_jungle_parkway(struct UnkStruct_800DC5EC*); void render_big_donut(struct UnkStruct_800DC5EC*); void func_8029569C(void); +void course_init(void); void render_course(struct UnkStruct_800DC5EC*); void func_80295BF8(s32); void func_80295C6C(void); diff --git a/src/render_player.c b/src/render_player.c index 6020eb546..501ffebcc 100644 --- a/src/render_player.c +++ b/src/render_player.c @@ -31,6 +31,7 @@ #include #include #include "port/Game.h" +#include "engine/Matrix.h" s8 gRenderingFramebufferByPlayer[] = { 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02 };