Skip to content

Commit 1f189df

Browse files
authored
Game.cpp and World.cpp Cleanup (#159)
* Remove CProperties and delete dup Properties from World.h * Improvement * Fix compile * Cleanup * Document gRaceState * wip cleanup * compile * Impl PlayerBombKart * Rename CourseManager_ to CM_ * Finish renames m_ to CM_ * cleanup * Remove extra printf --------- Co-authored-by: MegaMech <[email protected]>
1 parent 24ecfc3 commit 1f189df

File tree

115 files changed

+996
-1302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+996
-1302
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,14 +385,14 @@ if(MSVC)
385385
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
386386
target_compile_options(${PROJECT_NAME} PRIVATE
387387
$<$<CONFIG:Debug>:
388-
/w;
388+
/Wall;
389389
/Od;
390390
/MTd
391391
>
392392
$<$<CONFIG:Release>:
393393
/Oi;
394394
/Gy;
395-
/W3;
395+
/Wall;
396396
/MT
397397
>
398398
/permissive-;

include/actor_types.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ enum ActorType {
8383
ACTOR_CAR,
8484
ACTOR_KIWANO_FRUIT
8585
};
86-
size_t m_GetActorSize(void);
87-
#define ACTOR_LIST_SIZE m_GetActorSize()
86+
size_t CM_GetActorSize(void);
87+
#define ACTOR_LIST_SIZE CM_GetActorSize()
8888

89-
struct Actor* m_GetActor(size_t);
90-
#define GET_ACTOR(index) m_GetActor(index)
89+
struct Actor* CM_GetActor(size_t);
90+
#define GET_ACTOR(index) CM_GetActor(index)
9191

9292
// Actor flags
9393
#define ACTOR_IS_NOT_EXPIRED 0xF // The actor possesses some kind of collision and can be removed

include/defines.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,19 @@ enum { COURSE_ONE, COURSE_TWO, COURSE_THREE, COURSE_FOUR };
195195
#define ENDING 5
196196
#define CREDITS_SEQUENCE 9
197197

198+
/**
199+
* @brief Options for gRaceState
200+
*/
201+
#define RACE_INIT 0
202+
#define RACE_SETUP 1
203+
#define RACE_STAGING 2
204+
#define RACE_IN_PROGRESS 3
205+
#define RACE_CALCULATE_RANKS 4
206+
#define RACE_FINISHED 5 // End of race and score screen
207+
#define RACE_UNK 6
208+
#define RACE_EXIT 7
209+
210+
198211
/**
199212
* @brief Options for gScreenModeSelection and gActiveScreenMode
200213
*/

src/actors/blue_and_red_shells/update.inc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,9 @@ void update_actor_red_blue_shell(struct ShellActor* shell) {
294294
func_800C90F4(shell->playerId,
295295
(player->characterId * 0x10) + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x00));
296296
if (pad13 == ACTOR_RED_SHELL) {
297-
add_red_shell_in_unexpired_actor_list(m_FindActorIndex(shell));
297+
add_red_shell_in_unexpired_actor_list(CM_FindActorIndex(shell));
298298
} else {
299-
add_blue_shell_in_unexpired_actor_list(m_FindActorIndex(shell));
299+
add_blue_shell_in_unexpired_actor_list(CM_FindActorIndex(shell));
300300
func_800C9D80(shell->pos, shell->velocity, SOUND_ARG_LOAD(0x51, 0x01, 0x80, 0x08));
301301
}
302302
}
@@ -308,9 +308,9 @@ void update_actor_red_blue_shell(struct ShellActor* shell) {
308308
func_800C90F4(shell->playerId,
309309
(player->characterId * 0x10) + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x00));
310310
if (pad13 == ACTOR_RED_SHELL) {
311-
add_red_shell_in_unexpired_actor_list(m_FindActorIndex(shell));
311+
add_red_shell_in_unexpired_actor_list(CM_FindActorIndex(shell));
312312
} else {
313-
add_blue_shell_in_unexpired_actor_list(m_FindActorIndex(shell));
313+
add_blue_shell_in_unexpired_actor_list(CM_FindActorIndex(shell));
314314
func_800C9D80(shell->pos, shell->velocity, SOUND_ARG_LOAD(0x51, 0x01, 0x80, 0x08));
315315
}
316316
}

src/actors/green_shell/update.inc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void update_actor_green_shell(struct ShellActor* shell) {
7575
func_800C9060(shell->playerId, SOUND_ARG_LOAD(0x19, 0x00, 0x80, 0x04));
7676
func_800C90F4(shell->playerId,
7777
(player->characterId * 0x10) + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x00));
78-
add_green_shell_in_unexpired_actor_list(m_FindActorIndex(shell));
78+
add_green_shell_in_unexpired_actor_list(CM_FindActorIndex(shell));
7979
return;
8080
} else {
8181
shell->state = 1;
@@ -98,7 +98,7 @@ void update_actor_green_shell(struct ShellActor* shell) {
9898
func_800C9060(shell->playerId, SOUND_ARG_LOAD(0x19, 0x00, 0x80, 0x04));
9999
func_800C90F4(shell->playerId,
100100
(player->characterId * 0x10) + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x00));
101-
add_green_shell_in_unexpired_actor_list(m_FindActorIndex(shell));
101+
add_green_shell_in_unexpired_actor_list(CM_FindActorIndex(shell));
102102
}
103103
} else {
104104
shell->rotAngle += 0xE38;
@@ -108,7 +108,7 @@ void update_actor_green_shell(struct ShellActor* shell) {
108108
func_800C9060(shell->playerId, SOUND_ARG_LOAD(0x19, 0x00, 0x80, 0x04));
109109
func_800C90F4(shell->playerId,
110110
(player->characterId * 0x10) + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x00));
111-
add_green_shell_in_unexpired_actor_list(m_FindActorIndex(shell));
111+
add_green_shell_in_unexpired_actor_list(CM_FindActorIndex(shell));
112112
}
113113
}
114114
if (shell->state == 2) {

src/actors/railroad_crossing/render.inc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void render_actor_railroad_crossing(Camera* arg0, struct RailroadCrossing* rr_cr
2727
gSPSetGeometryMode(gDisplayListHead++, G_LIGHTING);
2828
gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK);
2929

30-
if (CourseManager_GetCrossingOnTriggered(rr_crossing->crossingTrigger)) {
30+
if (CM_GetCrossingOnTriggered(rr_crossing->crossingTrigger)) {
3131

3232
if (rr_crossing->someTimer < 20) {
3333
gSPDisplayList(gDisplayListHead++, d_course_kalimari_desert_dl_crossing_right_active);

src/actors/railroad_crossing/update.inc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
void update_actor_railroad_crossing(struct RailroadCrossing* crossing) {
1111
// If train close?
12-
if (CourseManager_GetCrossingOnTriggered(crossing->crossingTrigger)) {
12+
if (CM_GetCrossingOnTriggered(crossing->crossingTrigger)) {
1313
// Timer++
1414
crossing->someTimer++;
1515
// Reset timer

src/camera.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ void camera_init(f32 posX, f32 posY, f32 posZ, UNUSED s16 rot, u32 arg4, s32 cam
5858
Player* player = gPlayerOne;
5959
Camera* camera = &cameras[cameraId];
6060

61+
camera->cameraId = cameraId;
62+
6163
D_80152300[cameraId] = arg4;
6264
switch (arg4) {
6365
case 0:

src/camera.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ typedef struct {
5555
/* 0xB0 */ s16 unk_B0;
5656
/* 0xB2 */ s16 unk_B2;
5757
/* 0xB4 */ f32 unk_B4;
58+
size_t cameraId;
5859
} Camera; /* size = 0xB8 */
5960

6061
void camera_init(f32, f32, f32, s16, u32, s32);

src/code_800029B0.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ void setup_race(void) {
212212
func_80005310();
213213
func_8003D080();
214214
init_hud();
215-
D_800DC510 = 0;
215+
gRaceState = RACE_INIT;
216216
gNumSpawnedShells = 0;
217217
D_800DC5B8 = 0;
218218
D_80152308 = 0;
@@ -254,7 +254,7 @@ void setup_race(void) {
254254

255255
void func_80002DAC(void) {
256256

257-
CourseManager_SomeSounds();
257+
CM_SomeSounds();
258258

259259
// switch (gCurrentCourseId) {
260260
// case COURSE_MARIO_RACEWAY:
@@ -324,7 +324,7 @@ void credits_spawn_actors(void) {
324324
destroy_all_actors();
325325
CM_CleanWorld();
326326

327-
CourseManager_CreditsSpawnActors();
327+
CM_CreditsSpawnActors();
328328

329329
gNumPermanentActors = gNumActors;
330330
}

0 commit comments

Comments
 (0)