diff --git a/include/defines.h b/include/defines.h index f62a07186..e47050553 100644 --- a/include/defines.h +++ b/include/defines.h @@ -76,8 +76,10 @@ #ifdef VERSION_EU #define COURSE_TIMER_ITER 0.020041665999999999 // 1 / 50 +#define COURSE_TIMER_ITER_f 0.020041665999999999f // 1 / 50 #else #define COURSE_TIMER_ITER 0.01666666 // 1 / 60 +#define COURSE_TIMER_ITER_f 0.01666666f // 1 / 60 #endif #define V_BlANK_TIMER_ITER 0.01666666 diff --git a/src/camera.h b/src/camera.h index 12e4c4409..7085785a3 100644 --- a/src/camera.h +++ b/src/camera.h @@ -1,7 +1,7 @@ #ifndef CAMERA_H #define CAMERA_H -#include "common_structs.h" +#include /** * @todo put this define in types.h or similar. diff --git a/src/code_80004740.c b/src/code_80004740.c index a863eac74..afcb00717 100644 --- a/src/code_80004740.c +++ b/src/code_80004740.c @@ -91,7 +91,7 @@ void func_80004A1C(animation_type_1 *arg0, s16 *arg1, animation_type_3_triplet a } sp8C[someIndex] = arg1[arg2[someIndex].some_offset + some_offset]; } - + mtxf_translate_rotate2(sp4C, sp94, sp8C); func_80004740(&gGfxPool->mtxHud[gMatrixHudCount], sp4C); D_80162D7A += 1; @@ -172,6 +172,6 @@ s16 func_80004DFC(animation_type_1 *arg0, animation_type_2 **arg1, s16 arg2, s16 s16 func_80004EAC(void *addr, s16 offset) { uintptr_t *item = segmented_to_virtual(addr); struct stru_80004EAC *temp = (struct stru_80004EAC *) segmented_to_virtual((void *) item[offset]); - + return temp->unk8 - 1; } diff --git a/src/code_80004740.h b/src/code_80004740.h index efafdd122..57afe535b 100644 --- a/src/code_80004740.h +++ b/src/code_80004740.h @@ -1,7 +1,7 @@ #ifndef CODE_80004740_H #define CODE_80004740_H -#include "common_structs.h" +#include /* What I know about animation stuff so far diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c index 5df08509d..43b86bec1 100644 --- a/src/code_80005FD0.c +++ b/src/code_80005FD0.c @@ -21,7 +21,7 @@ #include "bomb_kart.h" #include "courses/all_course_data.h" #include -#include "common_structs.h" +#include #include "main.h" #include "menus.h" #include "code_80091750.h" @@ -1406,8 +1406,7 @@ void func_800090F0(s32 playerId, Player *player) { f32 func_80009258(UNUSED s32 playerId, f32 arg1, f32 arg2) { f32 temp_f2 = D_8016344C - arg2; f32 temp_f12 = arg1 - D_8016344C; - - return gCourseTimer - ( (0.01666666f * temp_f2) / (temp_f2 + temp_f12) ); + return gCourseTimer - ( (COURSE_TIMER_ITER_f * temp_f2) / (temp_f2 + temp_f12) ); } #ifdef NON_MATCHING @@ -1473,10 +1472,10 @@ void func_8000929C(s32 playerId, Player *player) { someTemp0 = D_80163450[playerId]; if ((var_v1 != 0) && (tempPos2 <= D_8016344C)) { if (D_8016344C < someTemp0) { - gLapCountByPlayerId[playerId]++; + gLapCountByPlayerId[playerId]++; if ((gModeSelection == 0) && (gLapCountByPlayerId[playerId] == 5)) { if (D_80164408[playerId] == 7) { - for (var_v0 = 0; var_v0 < 8; var_v0++) { gLapCountByPlayerId[var_v0]--; } + for (var_v0 = 0; var_v0 < 8; var_v0++) { gLapCountByPlayerId[var_v0]--; } } } D_80163240[playerId] = 1; @@ -1495,10 +1494,10 @@ void func_8000929C(s32 playerId, Player *player) { } D_80163450[playerId] = tempPos2; if ((gCurrentCourseId == COURSE_YOSHI_VALLEY) && (D_801630E2 == 1)) { - func_80009000(playerId); - if (((player->type & 0x4000) == 0) || (player->type & 0x1000)) { - func_800090F0(playerId, player); - } + func_80009000(playerId); + if (((player->type & 0x4000) == 0) || (player->type & 0x1000)) { + func_800090F0(playerId, player); + } } if ((player->type & 0x4000) && !(player->type & 0x1000)) { func_800065D0(playerId, player); @@ -1563,9 +1562,9 @@ void func_800098FC(s32 arg0, Player *player) { } if (D_801633B0[arg0] >= 0xB) { if ((player->soundEffects & 0x400000) || (player->soundEffects & 0x01000000) || (player->soundEffects & 2) || (player->soundEffects & 4) || (player->effects & HIT_EFFECT)) { - func_800C92CC(arg0, 0x2900800BU); - D_801633B0[arg0] = 0; - } + func_800C92CC(arg0, 0x2900800BU); + D_801633B0[arg0] = 0; + } } } @@ -2212,22 +2211,22 @@ void func_8000BBD8(u16 waypointIndex, f32 arg1, s16 pathIndex) { path1 = &D_80164560[pathIndex][waypointIndex]; path2 = &D_80164570[pathIndex][waypointIndex]; - + x1 = (f32) path1->posX; z1 = (f32) path1->posZ; - + x2 = (f32) path2->posX; z2 = (f32) path2->posZ; - + waypointIndex += 1; waypointIndex = waypointIndex % gWaypointCountByPathIndex[pathIndex]; - + path1 = &D_80164560[pathIndex][waypointIndex]; path2 = &D_80164570[pathIndex][waypointIndex]; - + x3 = (f32) path1->posX; z3 = (f32) path1->posZ; - + x4 = (f32) path2->posX; z4 = (f32) path2->posZ; @@ -2552,7 +2551,7 @@ s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 waypointIndex, Player *playe } } func_8000CBA4(posX, posY, posZ, &sp5E, pathIndex); - } + } func_8000CBF8(posX, posY, posZ, &sp5E, pathIndex); return sp5E; } @@ -3010,13 +3009,13 @@ void func_8000DF8C(s32 bombKartId) { Player *var_v0; bombKart = &gBombKarts[bombKartId]; - + sp7E = bombKart->state; if (sp7E == 0) { return; } - + if (((bombKart->unk_4A != 1) || (gCurrentCourseId == COURSE_AWARD_CEREMONY))) { var_f22 = bombKart->bombPos[0]; var_f20 = bombKart->bombPos[1]; @@ -3287,7 +3286,7 @@ void func_8000EEDC(void) { s32 i; for (i = 0; i < NUM_PLAYERS; i++) { - phi = &gUnexpiredActorsList[i]; + phi = &gUnexpiredActorsList[i]; phi->unkC = 0; phi->actorIndex = 1000; // out of bounds } @@ -3352,10 +3351,10 @@ void func_8000F124(void) { for (j = 0; j < 2; j++) { D_80163348[j] = 0; } - + if (gDemoMode == 1) { return; } if (gModeSelection != GRAND_PRIX) { return; } - + for (i = 0; i < 2; i++) { while(1) { @@ -3365,7 +3364,7 @@ void func_8000F124(void) { if (gPlayerCount < 1) { break; } var_a1 = 0; - + for (j = 0; j < gPlayerCount; j++) { if (gCharacterSelections[j] == D_80163348[i]) { var_a1 = 1; @@ -3400,7 +3399,7 @@ void func_8000F2DC(void) { D_80163368[1] = (s32) ptr->unk2; D_80163368[2] = (s32) ptr->unk4; D_80163368[3] = (s32) ptr->unk6; - + temp = ptr->unk8; D_80163598 = get_next_available_memory_addr(temp * 4); @@ -3475,7 +3474,7 @@ void func_8000F628(void) { for (i = 0; i < NUM_PLAYERS; i++) { Player *player = &gPlayerOne[i]; - + D_80163050[i] = 0; D_80162FF8[i] = 0; D_80163010[i] = 0; @@ -3529,7 +3528,7 @@ void func_8000F628(void) { D_80163380[i] = 6; if (gPlayers[i].type & PLAYER_HUMAN) { D_80163330[i] = 3; - + } else { D_80163330[i] = 0; } @@ -3560,7 +3559,7 @@ void func_8000F628(void) { D_80163344[i] = D_80164478[D_80163348[i]]; D_80163330[ D_80163344[i] ] = 1; D_8016334C[ D_80163344[i] ] = i; - } + } } } if ((D_8018EE08 == 1) && (gCurrentCourseId != COURSE_AWARD_CEREMONY)) { @@ -3572,12 +3571,12 @@ void func_8000F628(void) { D_80163344[0] = cameras->playerId; D_80163330[D_80163344[0]] = 1; D_8016334C[D_80163344[0]] = 0; - + for (i = 1; i < 2; i++) { D_80163344[i] = cameras[i].playerId; D_80163330[D_80163344[i]] = 1; D_8016334C[D_80163344[i]] = i; - + } } } @@ -3953,21 +3952,21 @@ s32 func_80011014(TrackWaypoint *pathDest, TrackWaypoint *path, s32 numPathPoint z3 = (f32) point3->posZ; temp = 0.05 / (sqrtf(((x2 - x1) * (x2 - x1)) + ((z2 - z1) * (z2 - z1))) + (sqrtf(((x3 - x2) * (x3 - x2)) + ((z3 - z2) * (z3 - z2))))); - + for (j = 0.0f; j <= 1.0 ; j += temp) { temp_f2_3 = (f32) ((1.0 - j) * 0.5 * (1.0 - j)); z1_3 = (f32) (((1.0 - j) * j) + 0.5); temp_f16 = (f32) (j * 0.5 * j); - + temp_f24_2 = (temp_f2_3 * x1) + (z1_3 * x2) + (temp_f16 * x3); x1_2 = (temp_f2_3 * z1) + (z1_3 * z2) + (temp_f16 * z3); - + var_f30 += sqrtf(((temp_f24_2 - temp_f20) * (temp_f24_2 - temp_f20)) + ((x1_2 - temp_f22) * (x1_2 - temp_f22))); - + temp_f20 = temp_f24_2; temp_f22 = x1_2; - + if ((var_f30 > 20.0f) || ((i == 0) && (j == 0.0))) { if (gIsMirrorMode) { //temp_f12 = -temp_f24_2; @@ -3985,7 +3984,7 @@ s32 func_80011014(TrackWaypoint *pathDest, TrackWaypoint *path, s32 numPathPoint if (var_f20_2 < -500.0) { var_f20_2 = var_f28; } else { - + switch (gCurrentCourseId) { case 13: if (var_f20_2 < (var_f28 - 15.0)) { @@ -4074,11 +4073,11 @@ s32 func_8001168C(PathNoY *pathDest, TrackWaypoint *pathSrc, s32 numWaypoints) { UNUSED s32 pad2; f32 temp_f24; - + f32 spA8; f32 temp_f26; f32 spA0; - + f32 temp_f2_3; TrackWaypoint *point1; @@ -4493,29 +4492,29 @@ void func_800127E0(void) { ptr1 = &gTrainList[i].tender; ptr2 = &D_80163598[waypointOffset]; func_80012780(ptr1, ptr2, waypointOffset); - + waypointOffset += 4; ptr1 = &gTrainList[i].locomotive; ptr2 = &D_80163598[waypointOffset]; func_80012780(ptr1, ptr2, waypointOffset); - + // Only use locomotive unless overwritten below. gTrainList[i].numCars = LOCOMOTIVE_ONLY; } - + // Spawn all rolling stock in single player mode. switch (gScreenModeSelection) { case SCREEN_MODE_1P: // single player for (i = 0; i < NUM_TRAINS; i++) { gTrainList[i].tender.isActive = 1; - + // Same line required for matching... for (j = 0; j < NUM_PASSENGER_CAR_ENTRIES; j++) { gTrainList[i].passengerCars[j].isActive = 1; } - + gTrainList[i].numCars = NUM_TENDERS + NUM_PASSENGER_CAR_ENTRIES; } break; - + // Spawn locomotive, tender, and one passenger car in versus 2/3 player mode. case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL: // multiplayer fall-through case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL: @@ -4527,9 +4526,9 @@ void func_800127E0(void) { } } break; - + } - + D_80162FCC = 0; } @@ -4686,12 +4685,12 @@ void func_80013054(void) { temp_f18 = 0.72017354f; temp_f12 = 0.42299348f; - if (((temp_f12 - 0.1) < temp_f16) + if (((temp_f12 - 0.1) < temp_f16) && (temp_f16 < ((((f64) gTrainList[i].numCars) * 0.01) + (temp_f12 + 0.01)))) { isCrossingTriggeredByIndex[0] = 1; } - if (((temp_f18 - 0.1) < temp_f16) + if (((temp_f18 - 0.1) < temp_f16) && (temp_f16 < ((((f64) gTrainList[i].numCars) * 0.01) + (temp_f18 + 0.01)))) { isCrossingTriggeredByIndex[1] = 1; @@ -4743,7 +4742,7 @@ void func_800132F4(void) { var_a1->position[2] = temp_a2->z; var_a1->waypointIndex = i * 0xB4; var_a1->actorIndex = -1; - + if (gPlayerCount >= 3) { var_a1->isActive = 0; } else { @@ -5034,7 +5033,7 @@ void func_80013F7C(s32 playerId, Player *player, VehicleStuff *vehicle, f32 arg3 f32 temp_f12; f32 temp_f14; f32 temp_f22; - + s32 i; f32 spC4; @@ -5043,7 +5042,7 @@ void func_80013F7C(s32 playerId, Player *player, VehicleStuff *vehicle, f32 arg3 if (((D_801631E0[playerId] != 1) || (( ((player->type & PLAYER_HUMAN) != 0)) && !(player->type & PLAYER_KART_AI))) && !(player->effects & 0x01000000)) { - + spC4 = player->pos[0]; spC0 = player->pos[1]; spBC = player->pos[2]; @@ -5055,7 +5054,7 @@ void func_80013F7C(s32 playerId, Player *player, VehicleStuff *vehicle, f32 arg3 if (((temp_f12) > -100.0) && ((temp_f12) < 100.0)) { if ((temp_f22 > -20.0) && (temp_f22 < 20.0)) { - + if (((temp_f14) > -100.0) && ((temp_f14) < 100.0)) { if (func_80006018(vehicle->position[0], vehicle->position[2], vehicle->velocity[0], vehicle->velocity[2], arg3, arg4, spC4, spBC) == (s32) 1) { player->soundEffects |= REVERSE_SOUND_EFFECT; @@ -5086,7 +5085,7 @@ void func_80013F7C(s32 playerId, Player *player, VehicleStuff *vehicle, f32 arg3 if (!(vehicle->someFlagsTheSequel & ((1 << playerId)))) { s32 var_s1 = 0; - u16 path = gWaypointCountByPathIndex[0]; + u16 path = gWaypointCountByPathIndex[0]; s32 t1; s32 t2; @@ -5118,9 +5117,9 @@ void func_80013F7C(s32 playerId, Player *player, VehicleStuff *vehicle, f32 arg3 break; } if (var_s1 == 1) { - + u32 soundBits2 = SOUND_ARG_LOAD(0x19, 0x01, 0x70, 0x3B); - + switch (soundBits) { case SOUND_ARG_LOAD(0x51, 0x01, 0x80, 0x05): soundBits2 = SOUND_ARG_LOAD(0x19, 0x01, 0x70, 0x3B); @@ -6501,7 +6500,7 @@ void func_80019890(s32 playerId, s32 cameraId) { Camera *camera = camera1; camera += cameraId; camera->playerId = playerId; - + D_801646C0[cameraId] = 0; pathIndex = gPathIndexByPlayerId[playerId]; @@ -6864,7 +6863,7 @@ void func_8001A588(UNUSED u16 *localD_80152300, Camera *camera, Player *player, func_8001A518((s32) playerId, gGPCurrentRaceRankByPlayerId[playerId], 0); } if ((gModeSelection != TIME_TRIALS) && (cameraIndex == 1) && (((D_801646C8 == 260)) || (D_801646C8 == 261))) { - + var_v1 = 0; if (gPlayerCount == 2) { func_8001A518((s32) playerId, gGPCurrentRaceRankByPlayerId[playerId], 1); @@ -6987,7 +6986,7 @@ void kart_ai_decisions_branch_item(UNUSED s32 arg0, s16 *arg1, s32 arg2) { case ITEM_MUSHROOM: value = 0x1D; break; - case ITEM_DOUBLE_MUSHROOM: + case ITEM_DOUBLE_MUSHROOM: break; case ITEM_TRIPLE_MUSHROOM: break; diff --git a/src/code_80005FD0.h b/src/code_80005FD0.h index 09eafbb34..4b091cf97 100644 --- a/src/code_80005FD0.h +++ b/src/code_80005FD0.h @@ -413,6 +413,6 @@ extern s32 D_8016448C; extern u16 D_801637BE; extern u16 D_80163E2A; -extern Gfx D_0D0076F8[]; +// extern Gfx D_0D0076F8[]; #endif diff --git a/src/code_8003DC40.c b/src/code_8003DC40.c index bf8f43dda..61ab5b7f7 100644 --- a/src/code_8003DC40.c +++ b/src/code_8003DC40.c @@ -2,7 +2,7 @@ #include #include #include "math_util.h" -#include "common_structs.h" +#include #include "player_controller.h" #include "effects.h" #include "code_8003DC40.h" diff --git a/src/code_8003DC40.h b/src/code_8003DC40.h index ad009c61d..1f402bda6 100644 --- a/src/code_8003DC40.h +++ b/src/code_8003DC40.h @@ -1,7 +1,7 @@ #ifndef CODE_8003DC40_H #define CODE_8003DC40_H -#include "common_structs.h" +#include /* Function Prototypes */ diff --git a/src/code_80057C60.c b/src/code_80057C60.c index 34e50a789..acab18c60 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -113,7 +113,7 @@ s32 D_80165754; ThwompSpawn *gThowmpSpawnList; Vec4s D_80165760; -UNUSED s16 D_80165768; +UNUSED s16 D_80165768; s8 D_8016576A; Vec4s D_80165770; UNUSED s32 D_80165778; @@ -1233,7 +1233,7 @@ void func_8005995C(void) { for (i = 0; i < 4; i++) { if ((D_80165890 != 0) && (player->type & PLAYER_INVISIBLE_OR_BOMB)) { player->currentItemCopy = ITEM_MUSHROOM; - + playerHUD[i].unk_75 = 2; } if ((player->type & PLAYER_INVISIBLE_OR_BOMB) && (player->currentItemCopy == ITEM_NONE)) { @@ -1311,13 +1311,13 @@ void func_80059C50(void) { } void func_80059D00(void) { - + func_8005A99C(); func_8005A3C0(); func_8005A380(); if (D_801657AE == 0) { - switch (gScreenModeSelection) { + switch (gScreenModeSelection) { case SCREEN_MODE_1P: randomize_seed_from_controller(PLAYER_ONE); if (D_8018D214 == false) { @@ -2862,7 +2862,7 @@ void func_8005D898(Player* player, s16 arg1, UNUSED s32 arg2, UNUSED s8 arg3, UN if (player->unk_22A == 1) { func_8005D800(&player->unk_258[10 + arg1], 0xFFFF00, 0x70); - + } if (player->unk_22A >= 2) { @@ -4197,7 +4197,7 @@ void func_80062C74(Player *player, s16 arg1, UNUSED s32 arg2, UNUSED s32 arg3) { void func_80062F98(Player* player, s16 arg1, s8 arg2, UNUSED s8 arg3) { f32 temp_f0; - + temp_f0 = player->unk_258[10 + arg1].unk_018 / 10.0f; ++player->unk_258[10 + arg1].unk_01E; player->unk_258[10 + arg1].unk_000[1] += temp_f0; @@ -4443,7 +4443,7 @@ void func_80063D58(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { } else { player->unk_258[10 + arg1].unk_000[1] += 0.4; } - + if (player->unk_258[10 + arg1].unk_03E <= 0) { player->unk_258[10 + arg1].unk_03E = 0; } @@ -4513,7 +4513,7 @@ void func_800643A8(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { player->unk_258[10 + arg1].unk_01E = 0; player->unk_258[10 + arg1].unk_012 = 0; } - + player->unk_258[10 + arg1].unk_00C += 0.2; player->unk_258[10 + arg1].unk_03E -= 8; if (player->unk_258[10 + arg1].unk_03E <= 0) { @@ -4598,11 +4598,11 @@ void func_800648E4(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { player->unk_258[30 + arg1].unk_00C -= 0.06; player->unk_258[30 + arg1].unk_000[1] += 0.1; player->unk_258[30 + arg1].unk_03E -= 12; - + if (player->unk_258[30 + arg1].unk_03E <= 0) { player->unk_258[30 + arg1].unk_03E = 0; } - + if (player->unk_258[30 + arg1].unk_01E == 10) { player->unk_258[30 + arg1].unk_01C = 0; player->unk_258[30 + arg1].unk_01E = 0; @@ -4624,7 +4624,7 @@ void func_80064988(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { void func_800649F4(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { f32 temp; temp = player->unk_258[30 + arg1].unk_018; - + player->unk_258[30 + arg1].unk_000[2] = player->unk_21C + (((-temp) * player->unk_258[30 + arg1].unk_01E) * coss(player->unk_258[30 + arg1].unk_020)); player->unk_258[30 + arg1].unk_000[0] = player->unk_218 + (((-temp) * player->unk_258[30 + arg1].unk_01E) * sins(player->unk_258[30 + arg1].unk_020)); player->unk_258[30 + arg1].unk_000[1] = player->pos[1] + player->unk_258[30 + arg1].unk_014; @@ -4636,7 +4636,7 @@ void func_800649F4(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { player->unk_258[30 + arg1].unk_01C = 0; player->unk_258[30 + arg1].unk_012 = 0; } - + if (player->unk_258[30 + arg1].unk_01E >= 9) { player->unk_258[30 + arg1].unk_03E -= 0x10; if (player->unk_258[30 + arg1].unk_03E <= 0) { @@ -4659,7 +4659,7 @@ void func_80064B30(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { player->unk_258[30 + arg1].unk_01C = 0; player->unk_258[30 + arg1].unk_012 = 0; } - + player->unk_258[30 + arg1].unk_038 += 1820; if (player->unk_258[30 + arg1].unk_01E >= 6) { player->unk_258[30 + arg1].unk_03E -= 16; @@ -4676,7 +4676,7 @@ void func_80064C74(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { } else { player->unk_258[30 + arg1].unk_020 -= 2184; } - + player->unk_258[30 + arg1].unk_000[2] = player->pos[2] + (coss(player->unk_258[30 + arg1].unk_020 - player->rotation[1] - player->unk_0C0) * 5.0f); player->unk_258[30 + arg1].unk_000[0] = player->pos[0] + (sins(player->unk_258[30 + arg1].unk_020 - player->rotation[1] - player->unk_0C0) * 5.0f); player->unk_258[30 + arg1].unk_000[1] = player->pos[1] - 1.0f; @@ -4700,14 +4700,14 @@ void func_80064DEC(Player* player, UNUSED s8 arg1, UNUSED s8 arg2, s8 arg3) { player->unk_258[20 + arg3].unk_000[1] = player->pos[1]; ++player->unk_258[20 + arg3].unk_01E; - + if (player->unk_258[20 + arg3].unk_01E == 9) { player->unk_0B6 &= ~0x0040; player->unk_258[20 + arg3].unk_01C = 0; player->unk_258[20 + arg3].unk_01E = 0; player->unk_258[20 + arg3].unk_012 = 0; } - + player->unk_258[20 + arg3].unk_00C += 0.8; if (player->unk_258[20 + arg3].unk_00C >= (f64) 2.5) { player->unk_258[20 + arg3].unk_00C = 2.5f; @@ -4735,7 +4735,7 @@ void func_80064EA4(Player* player, UNUSED s8 arg1, UNUSED s8 arg2, s8 arg3) { void func_80064F88(Player* player, UNUSED s8 arg1, UNUSED s8 arg2, s8 arg3) { ++player->unk_258[20 + arg3].unk_01E; player->unk_258[20 + arg3].unk_00C += 0.15; - + if (1.2 <= player->unk_258[20 + arg3].unk_00C) { player->unk_258[20 + arg3].unk_00C = 1.2f; } @@ -4755,7 +4755,7 @@ void func_80065030(Player* player, UNUSED s8 arg1, UNUSED s8 arg2, s8 arg3) { if (player->unk_258[20 + arg3].unk_00C >= (f64) 1.5) { player->unk_258[20 + arg3].unk_00C = 1.5f; } - + if (player->unk_258[20 + arg3].unk_01E >= 12) { player->unk_0B6 &= ~0x0100; player->unk_258[20 + arg3].unk_01C = 0; @@ -5106,6 +5106,7 @@ void func_80066BAC(Player *player, UNUSED s8 arg1, s16 arg2, s8 arg3) { UNUSED s32 stackPadding; if ((player->unk_258[arg2].unk_01C == 1) && (player->unk_258[arg2].unk_038 != 0x00FF)) { + if (player->collision.surfaceDistance[2] >= 300.0f) { spDC[1] = player->pos[1] + 5.0f; } else { @@ -5790,7 +5791,7 @@ void render_battle_balloon(Player *player, s8 arg1, s16 arg2, s8 arg3) { gDPSetTextureLUT(gDisplayListHead++, G_TT_RGBA16); func_8004B614(primRed, primGreen, primBlue, envRed, envGreen, envBlue, 0x000000D8); - + gDPSetRenderMode(gDisplayListHead++, AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL | GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA), AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL | GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)); gDPLoadTextureBlock(gDisplayListHead++, D_8018D4BC, G_IM_FMT_CI, G_IM_SIZ_8b, 64, 32, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSPVertex(gDisplayListHead++, gBalloonVertexPlane1, 4, 0); @@ -6056,39 +6057,39 @@ void func_8006C9B8(Player *player, s16 arg1, s8 arg2, s8 arg3) { case 1: func_800644E8(player, arg1, arg2, arg3); break; - + case 2: func_800649F4(player, arg1, arg2, arg3); break; - + case 3: func_80064C74(player, arg1, arg2, arg3); break; - + case 4: func_800647C8(player, arg1, arg2, arg3); break; - + case 5: func_80064B30(player, arg1, arg2, arg3); break; - + case 6: func_800648E4(player, arg1, arg2, arg3); break; - + case 7: func_80064988(player, arg1, arg2, arg3); break; - + case 8: func_80064C74(player, arg1, arg2, arg3); break; - + case 9: func_80064664(player, arg1, arg2, arg3); break; - + default: break; } @@ -6175,7 +6176,7 @@ void func_8006CEC0(Player *arg0, s16 arg1, s8 arg2, s8 arg3) { } else if (((arg0->effects & 0x40000000) == 0x40000000) && (arg0->unk_0B0 < 0x32)) { func_80061094(arg0, arg1, sp20, arg2, arg3); return; - } else if ((arg0->type & 0x4000) == 0x4000) { + } else if ((arg0->type & 0x4000) == 0x4000) { if ((arg0->unk_0DE & 8) == 8) { func_80060F50(arg0, arg1, sp20, arg2, arg3); return; @@ -6450,7 +6451,7 @@ void func_8006DD3C(Player* arg0, s8 arg1, s8 arg2) { } void func_8006E058(void) { - switch (gActiveScreenMode) { + switch (gActiveScreenMode) { case SCREEN_MODE_1P: switch (gModeSelection) { case GRAND_PRIX: @@ -6470,7 +6471,7 @@ void func_8006E058(void) { if ((gPlayerTwo->type & 0x100) == 0x100) { func_8006E420(gPlayerTwo, 1, 0); } - + if ((gPlayerThree->type & 0x100) == 0x100) { func_8006E420(gPlayerThree, 2, 0); break; @@ -6481,7 +6482,7 @@ void func_8006E058(void) { case BATTLE: func_8006E420(gPlayerOne, 0, 0); func_8006E420(gPlayerTwo, 1, 0); - + if (gPlayerCountSelection1 >= 3) { func_8006E420(gPlayerThree, 2, 0); } @@ -6497,7 +6498,7 @@ void func_8006E058(void) { break; case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL: case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL: - switch (gModeSelection) { + switch (gModeSelection) { case GRAND_PRIX: func_8006E420(gPlayerOne, 0, 0); func_8006E420(gPlayerTwo, 1, 0); @@ -6509,7 +6510,7 @@ void func_8006E058(void) { func_8006E420(gPlayerEight, 7, 0); break; - case VERSUS: + case VERSUS: case BATTLE: func_8006E420(gPlayerOne, 0, 0); func_8006E420(gPlayerTwo, 1, 0); @@ -6517,7 +6518,7 @@ void func_8006E058(void) { break; case TIME_TRIALS: func_8006E420(gPlayerOne, 0, 0); - + if ((gPlayerTwo->type & 0x8000) == 0x8000) { func_8006E420(gPlayerTwo, 1, 0); break; @@ -6549,7 +6550,7 @@ void func_8006E420(Player* player, s8 arg1, s8 arg2) { if ((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) { func_8006D194(player, arg1, arg2); } - + for (temp_s0 = 0; temp_s0 < 10; ++temp_s0) { func_8006CEC0(player, temp_s0, arg1, arg2); if (((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) || (gGamestate == ENDING)) { diff --git a/src/code_80057C60.h b/src/code_80057C60.h index 1b65497fc..725dbc02e 100644 --- a/src/code_80057C60.h +++ b/src/code_80057C60.h @@ -1,7 +1,7 @@ #ifndef CODE_80057C60_H #define CODE_80057C60_H -#include "common_structs.h" +#include #include "objects.h" #include "camera.h" diff --git a/src/code_80057C60_var.c b/src/code_80057C60_var.c index 04393db96..44b257ab8 100644 --- a/src/code_80057C60_var.c +++ b/src/code_80057C60_var.c @@ -152,13 +152,13 @@ s32 D_8018D3D4; s32 D_8018D3D8; s32 D_8018D3DC; //! some alpha -s32 D_8018D3E0; +s32 D_8018D3E0; //! some red -s32 D_8018D3E4; +s32 D_8018D3E4; //! some green -s32 D_8018D3E8; +s32 D_8018D3E8; //! some blue -s32 D_8018D3EC; +s32 D_8018D3EC; s32 D_8018D3F0; s32 D_8018D3F4; s32 D_8018D3F8; diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c index c07028230..bc17517bf 100644 --- a/src/code_8006E9C0.c +++ b/src/code_8006E9C0.c @@ -67,7 +67,7 @@ void reset_object_variable(void) { void func_8006EB10(void) { s32 i; - + for (i = 0; i < gObjectParticle1_SIZE; i++) { gObjectParticle1[i] = NULL_OBJECT_ID; } @@ -571,7 +571,7 @@ void func_8006FA94(void) { D_8018D17C = D_8018D18C; D_8018D174 = D_8018D18C; player = gPlayerOne; - for (var_a0 = 0; var_a0 < 8; var_a0++) { + for (var_a0 = 0; var_a0 < NUM_PLAYERS; var_a0++) { D_8018D0F0[var_a0] = D_8018D050[var_a0] = -32.0f; D_8018CE10[var_a0].unk_04[0] = D_8018CE10[var_a0].unk_04[1] = D_8018CE10[var_a0].unk_04[2] = 0.0f; D_8018CF50[var_a0] = var_a0; @@ -638,10 +638,10 @@ void init_clouds(CloudData *cloudList) { /** * This function is part of the spawning for the "stars" in some stages - * + * * arg2 is a pointer to some type of spawn data for the stars, although it not super clear * what types each element is. It seems like its a bunch of u16's, so maybe a Vec4su? - * + * * The stars in Wario's Stadium, Toad's Turnpike, and Rainbow Road are not part of the skybox. * They are instead objects that seemingly hover in the air around the player * They have no true x/y/z position, instead they seem to be kept in a position relative to the @@ -694,7 +694,7 @@ void func_8007055C(void) { if (gPlayerCount == 1) { var_s4 = 0x32; } else { - var_s4 = 0x19; + var_s4 = 0x19; } for (var_s0 = 0; var_s0 < var_s4; var_s0++) { find_unused_obj_index(&D_8018CC80[D_8018D1F8 + var_s0]); @@ -1278,7 +1278,7 @@ void init_hud_three_four_player(void) { playerHUD[PLAYER_TWO].lapY = 0x60; playerHUD[PLAYER_TWO].unk_6C = 0xC8; playerHUD[PLAYER_TWO].unk_6E = 0xC8; - + playerHUD[PLAYER_THREE].itemBoxX = -0x36; playerHUD[PLAYER_THREE].itemBoxY = 0x2D; playerHUD[PLAYER_THREE].slideItemBoxX = 0; @@ -1293,7 +1293,7 @@ void init_hud_three_four_player(void) { playerHUD[PLAYER_THREE].lapY = 0xD4; playerHUD[PLAYER_THREE].unk_6C = 0xDE; playerHUD[PLAYER_THREE].unk_6E = 0xC0; - + playerHUD[PLAYER_FOUR].itemBoxX = 0x175; playerHUD[PLAYER_FOUR].itemBoxY = 0x2D; playerHUD[PLAYER_FOUR].slideItemBoxX = 0; diff --git a/src/code_8006E9C0.h b/src/code_8006E9C0.h index 175cf7792..9ebee2484 100644 --- a/src/code_8006E9C0.h +++ b/src/code_8006E9C0.h @@ -1,7 +1,7 @@ #ifndef CODE_8006E9C0_H #define CODE_8006E9C0_H -#include "common_structs.h" +#include #include "update_objects.h" void init_hud(void); diff --git a/src/code_80086E70.c b/src/code_80086E70.c index b2c94fe5b..13818b6c5 100644 --- a/src/code_80086E70.c +++ b/src/code_80086E70.c @@ -585,10 +585,10 @@ void func_800887C0(s32 objectIndex) { /** * @brief Returns the distance between the object and the player. - * - * @param objectIndex - * @param player - * @return UNUSED + * + * @param objectIndex + * @param player + * @return UNUSED */ UNUSED s32 get_horizontal_distance_to_player(s32 objectIndex, Player *player) { s32 x; @@ -601,10 +601,10 @@ UNUSED s32 get_horizontal_distance_to_player(s32 objectIndex, Player *player) { /** * @brief Returns the distance between the object and the player. - * - * @param objectIndex - * @param player - * @return UNUSED + * + * @param objectIndex + * @param player + * @return UNUSED */ UNUSED s32 get_distance_to_player(s32 objectIndex, Player *player) { s32 x; @@ -619,10 +619,10 @@ UNUSED s32 get_distance_to_player(s32 objectIndex, Player *player) { /** * @brief Returns the distance between the object and the camera. - * - * @param objectIndex - * @param camera - * @return UNUSED + * + * @param objectIndex + * @param camera + * @return UNUSED */ u32 get_horizontal_distance_to_camera(s32 objectIndex, Camera *camera) { s32 x; @@ -635,10 +635,10 @@ u32 get_horizontal_distance_to_camera(s32 objectIndex, Camera *camera) { /** * @brief Returns the distance between the object and the camera. - * - * @param objectIndex - * @param camera - * @return UNUSED + * + * @param objectIndex + * @param camera + * @return UNUSED */ UNUSED s32 get_distance_to_camera(s32 objectIndex, Camera *camera) { s32 x; @@ -653,12 +653,12 @@ UNUSED s32 get_distance_to_camera(s32 objectIndex, Camera *camera) { /** * @brief Returns if the object is closer than the distance to the player. - * - * @param objectIndex - * @param player + * + * @param objectIndex + * @param player * @param distance - * @return true - * @return false + * @return true + * @return false */ bool is_within_horizontal_distance_of_player(s32 objectIndex, Player *player, f32 distance) { f32 x; @@ -676,13 +676,13 @@ bool is_within_horizontal_distance_of_player(s32 objectIndex, Player *player, f3 /** * @brief Returns if the object is between the distance_min and distance_max to the player. - * - * @param objectIndex - * @param player - * @param distance_min - * @param distance_max - * @return true - * @return false + * + * @param objectIndex + * @param player + * @param distance_min + * @param distance_max + * @return true + * @return false */ bool is_in_bounds_to_player(s32 objectIndex, Player *player, f32 distance_min, f32 distance_max) { f32 x; @@ -702,12 +702,12 @@ bool is_in_bounds_to_player(s32 objectIndex, Player *player, f32 distance_min, f /** * @brief Returns if the object is closer than the distance to the player. - * - * @param objectIndex - * @param player - * @param distance - * @return true - * @return false + * + * @param objectIndex + * @param player + * @param distance + * @return true + * @return false */ bool is_within_distance_to_player(s32 objectIndex, Player *player, f32 distance) { f32 x; @@ -727,12 +727,12 @@ bool is_within_distance_to_player(s32 objectIndex, Player *player, f32 distance) /** * @brief Returns if the object is between the distance_min and distance_max to the camera. - * - * @param objectIndex - * @param camera - * @param distance - * @return true - * @return false + * + * @param objectIndex + * @param camera + * @param distance + * @return true + * @return false */ bool is_within_horizontal_distance_to_camera(s32 objectIndex, Camera *camera, f32 distance) { f32 x; @@ -750,12 +750,12 @@ bool is_within_horizontal_distance_to_camera(s32 objectIndex, Camera *camera, f3 /** * @brief Returns if the object is between the distance_min and distance_max to the camera. - * - * @param objectIndex - * @param camera - * @param distance_min - * @param distance_max - * @return UNUSED + * + * @param objectIndex + * @param camera + * @param distance_min + * @param distance_max + * @return UNUSED */ UNUSED bool is_within_bounds_to_camera(s32 objectIndex, Camera *camera, f32 distance_min, f32 distance_max) { f32 x; @@ -775,11 +775,11 @@ UNUSED bool is_within_bounds_to_camera(s32 objectIndex, Camera *camera, f32 dist /** * @brief Returns if the object is closer than the distance to the camera. - * - * @param objectIndex - * @param camera - * @param distance - * @return UNUSED + * + * @param objectIndex + * @param camera + * @param distance + * @return UNUSED */ UNUSED bool is_within_distance_to_camera(s32 objectIndex, Camera *camera, f32 distance) { f32 x; @@ -799,11 +799,11 @@ UNUSED bool is_within_distance_to_camera(s32 objectIndex, Camera *camera, f32 di /** * @brief Returns if the object collided with the player. - * - * @param objectIndex - * @param player - * @return true - * @return false + * + * @param objectIndex + * @param player + * @return true + * @return false */ bool has_collided_horizontally_with_player(s32 objectIndex, Player *player) { f32 x; @@ -823,11 +823,11 @@ bool has_collided_horizontally_with_player(s32 objectIndex, Player *player) { /** * @brief Returns if the object collided with the player. - * - * @param objectIndex - * @param player - * @return true - * @return false + * + * @param objectIndex + * @param player + * @return true + * @return false */ bool has_collided_with_player(s32 objectIndex, Player *player) { f32 x; @@ -849,11 +849,11 @@ bool has_collided_with_player(s32 objectIndex, Player *player) { /** * @brief Returns if the object collided with the player. - * - * @param objectIndex - * @param player - * @param distance - * @return UNUSED + * + * @param objectIndex + * @param player + * @param distance + * @return UNUSED */ UNUSED bool has_collided_with_player_1d(s32 objectIndex, Player *player, f32 distance) { f32 x; @@ -869,12 +869,12 @@ UNUSED bool has_collided_with_player_1d(s32 objectIndex, Player *player, f32 dis /** * @brief Returns if the object collided with the player and is closer than the distance in the y axis. - * - * @param objectIndex - * @param player - * @param distance_y - * @return true - * @return false + * + * @param objectIndex + * @param player + * @param distance_y + * @return true + * @return false */ bool has_collided_with_player_and_within_height(s32 objectIndex, Player *player, f32 distance_y) { f32 x; @@ -1238,7 +1238,7 @@ s32 func_8008A060(s32 objectIndex, Camera *camera, u16 arg2) { var_v1 = 0; temp_t3 = (((u16)camera->rot[1] - gObjectList[objectIndex].direction_angle[1]) + (arg2 >> 1)); - + //! @warning Always true if ((temp_t3 >= 0) && (arg2 >= temp_t3)) { var_v1 = 1; diff --git a/src/code_80086E70.h b/src/code_80086E70.h index a68e01797..25d1a2e66 100644 --- a/src/code_80086E70.h +++ b/src/code_80086E70.h @@ -1,7 +1,7 @@ #ifndef CODE_80086E70_H #define CODE_80086E70_H -#include "common_structs.h" +#include #include "camera.h" #include "objects.h" @@ -10,7 +10,7 @@ void func_80086EAC(s32, s32, s16); void func_80086EF0(s32); void func_80086F10(s32, s32, SplineData*); void func_80086F60(s32); -s32 func_80086FA4(s32); +bool func_80086FA4(s32); void func_80086FD4(s32); void func_8008701C(s32, s32); s32 func_80087060(s32, s32); @@ -40,11 +40,11 @@ void func_80087844(s32); f32 func_8008786C(f32, f32, f32, f32, f32); s32 func_8008789C(s32, s32); s32 func_80087954(s32, s32); -s32 func_80087A0C(s32, s16, s16, s16, s16); +bool func_80087A0C(s32, s16, s16, s16, s16); s32 func_80087B84(s32, f32, f32); s32 func_80087C48(s32, f32, f32, s32); s32 func_80087D24(s32, f32, f32, f32); -s32 func_80087E08(s32, f32, f32, f32, s16, s32); +bool func_80087E08(s32, f32, f32, f32, s16, s32); s32 func_80087F14(s32, f32, f32, f32, s16, s32); void func_80088038(s32, f32, u16); void func_800880DC(void); @@ -68,14 +68,14 @@ bool is_within_horizontal_distance_of_player(s32, Player*, f32); s32 are_between_distance_2d(s32, Player*, f32, f32); bool is_within_distance_to_player(s32, Player*, f32); bool is_within_horizontal_distance_to_camera(s32, Camera*, f32); -s32 is_within_bounds_to_camera(s32, Camera*, f32, f32); +UNUSED bool is_within_bounds_to_camera(s32, Camera*, f32, f32); bool is_within_distance_to_camera(s32, Camera*, f32); bool has_collided_horizontally_with_player(s32, Player*); bool has_collided_with_player(s32, Player*); bool has_collided_with_player_1d(s32, Player*, f32); bool has_collided_with_player_and_within_height(s32, Player*, f32); f32 func_80088F54(s32, Player*); -s32 func_80088F94(s32, Player*, f32); +UNUSED bool func_80088F94(s32, Player*, f32); void func_80088FF0(Player*); void func_8008900C(Player*); void func_80089020(s32, f32*); @@ -93,7 +93,7 @@ s32 func_80089E18(s32); s32 func_80089F24(s32); s32 func_8008A060(s32, Camera*, u16); s32 func_8008A0B4(s32, Player*, Camera*, u16); -s32 is_object_visible_on_camera(s32, Camera*, u16); +bool is_object_visible_on_camera(s32, Camera*, u16); void func_8008A1D0(s32, s32, s32, s32); void func_8008A2CC(s32, s32, u16); s32 func_8008A364(s32, s32, u16, s32); diff --git a/src/code_80091440.c b/src/code_80091440.c index 9a1cc0d13..c8270d445 100644 --- a/src/code_80091440.c +++ b/src/code_80091440.c @@ -31,7 +31,7 @@ UNUSED void func_800914E0(void) { camera->up[0] = 0; camera->up[1] = 1; camera->up[2] = 0; - + if(1) {} // waa? temp = temp2 - temp3; diff --git a/src/code_80091440.h b/src/code_80091440.h index eaef6ea33..26cb888f0 100644 --- a/src/code_80091440.h +++ b/src/code_80091440.h @@ -1,7 +1,7 @@ #ifndef CODE_80091440_H #define CODE_80091440_H -#include "ultra64.h" +#include void func_80091440(s8); void func_800914A0(void); diff --git a/src/code_80091750.c b/src/code_80091750.c index b33d79b72..9eca584f8 100644 --- a/src/code_80091750.c +++ b/src/code_80091750.c @@ -1496,7 +1496,7 @@ void func_80091EE4(void) { if ((D_8018EDFB != 0) && (tmp == 0)) { temp_s2 = (gCupSelection * 4) + gCupCourseSelection; func_800B6708(); - + for (temp_s0 = 0; temp_s0 < 2; ++temp_s0) { if ((D_8018EE10[temp_s0].ghostDataSaved != 0) && (temp_s2 == D_8018EE10[temp_s0].courseIndex)) { func_800B64EC(temp_s0); @@ -1512,7 +1512,7 @@ void func_80091FA4(void) { //! @todo These sizes need to be sizeof() for shiftability if possible D_8018D9B4 = (u8 *) get_next_available_memory_addr(0x00002800); - D_8018D9B0 = get_next_available_memory_addr(0x000124F8); + D_8018D9B0 = (u16 *)get_next_available_memory_addr(0x000124F8); D_8018D9B8 = (u8 *) get_next_available_memory_addr(0x00001000); D_8018D9BC = get_next_available_memory_addr(4); @@ -1610,7 +1610,7 @@ void func_80092290(s32 arg0, s32 *arg1, s32 *arg2) { if ((arg0 < 4) || (arg0 >= 6)) { return; } idx = (((arg0 * 4) + ((gGlobalTimer % 2) * 2)) - 6); - + *arg2 += 16; if (*arg2 >= 256) { *arg2 = 0; @@ -2304,7 +2304,7 @@ void func_80093C98(s32 arg0) { guOrtho(&gGfxPool->mtxEffect[gMatrixEffectCount], 0.0f, 319.0f, 239.0f, 0.0f, -100.0f, 100.0f, 1.0f); gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount++]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gSPDisplayList(gDisplayListHead++, D_02007F18); - gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, 320, 240); + gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); func_800A8250(); if (arg0 == 0) { func_800A54EC(); @@ -2326,7 +2326,7 @@ void func_80093E60(void) { s32 i; D_8018D9B4 = get_next_available_memory_addr(0x00002800); - D_8018D9B0 = get_next_available_memory_addr(0x000124F8); + D_8018D9B0 = (u16 *) get_next_available_memory_addr(0x000124F8); D_8018D9B8 = get_next_available_memory_addr(0x00001000); D_8018D9BC = get_next_available_memory_addr(4U); @@ -2366,7 +2366,7 @@ void func_80093F10(void) { void func_800940EC(s32 arg0) { gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(D_802B8880)); - gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, 320, 240); + gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); guOrtho(&gGfxPool->mtxEffect[gMatrixEffectCount], 0.0f, 319.0f, 239.0f, 0.0f, -100.0f, 100.0f, 1.0f); gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount++]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gSPDisplayList(gDisplayListHead++, D_02007F18); @@ -2461,7 +2461,7 @@ void func_80094A64(struct GfxPool *pool) { gMatrixHudCount = 0; gMatrixEffectCount = 0; gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&D_802B8880)); - gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, 320, 240); + gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); guOrtho(&pool->mtxScreen, 0.0f, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, 0.0f, -100.0f, 100.0f, 1.0f); gSPMatrix(gDisplayListHead++, &pool->mtxScreen, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gSPDisplayList(gDisplayListHead++, D_02007650); @@ -5606,7 +5606,7 @@ void add_8018D9E0_entry(s32 type, s32 column, s32 row, s8 priority) { func_800996BC(D_800E7D4C[func_800B555C()], 0); func_800996BC(D_02004B74, 0); func_8009B0A4(0, 0x00000019); - func_8009B538(0, 0x00012C00, D_800E74E8[type - 0x23].red, D_800E74E8[type - 0x23].green, D_800E74E8[type - 0x23].blue); + func_8009B538(0, SCREEN_WIDTH * SCREEN_HEIGHT, D_800E74E8[type - 0x23].red, D_800E74E8[type - 0x23].green, D_800E74E8[type - 0x23].blue); break; case 0xF: var_ra->unk1C = 0x00000020; @@ -6433,7 +6433,7 @@ void func_800A08D8(u8 arg0, s32 column, s32 row) { s32 func_800A095C(char *someString, s32 len, s32 column, s32 row) { s32 tempColumn; s32 nonTerminatorCount; - + nonTerminatorCount = 0; tempColumn = column; for (; len != 0; len--, tempColumn += 8) { @@ -6450,7 +6450,7 @@ s32 func_800A095C(char *someString, s32 len, s32 column, s32 row) { // Same functionality, but doesn't match byte for byte :/ void func_800A09E0(struct_8018D9E0_entry *arg0) { s32 table_row, x = 0x20, y; - gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, 319, 194); + gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH - 1, 194); for(table_row = 0; table_row < 9; table_row++) { if ((D_800E86D0[0] != 0) || ((table_row != 0) && (table_row != 8))) { y = (table_row * 0xA) + arg0->row; @@ -6512,7 +6512,7 @@ void func_800A0B80(struct_8018D9E0_entry *arg0) { } while (var_s0 != 0); } } - gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, 319, 239); + gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); } void func_800A0DFC(void) { @@ -10034,7 +10034,7 @@ escape: * search for. If no entry with that "type" is found, this * function will enter a `while(1)` loop, hard-locking the * game. - * + * * In practice this never appears to happen, but that is * probably as much a matter of luck as it is good * reasoning on the original author(s) part. diff --git a/src/code_80091750.h b/src/code_80091750.h index 00c80003b..15a9b16d1 100644 --- a/src/code_80091750.h +++ b/src/code_80091750.h @@ -1,7 +1,7 @@ #ifndef CODE_80091750_H #define CODE_80091750_H -#include "common_structs.h" +#include #include "textures.h" #include "main.h" diff --git a/src/code_800AF9B0.c b/src/code_800AF9B0.c index 07c2222ff..284962fcc 100644 --- a/src/code_800AF9B0.c +++ b/src/code_800AF9B0.c @@ -91,7 +91,7 @@ void func_800AFC54(Vtx *arg0, s32 arg1, s32 arg2, s32 arg3, s16 arg4[3]) { a1 = &arg0[arg1]; a2 = &arg0[arg2]; - a3 = &arg0[arg3]; + a3 = &arg0[arg3]; saved1 = a2->v.ob[0]; saved2 = a2->v.ob[1]; @@ -154,7 +154,7 @@ void func_800AFF58(Vtx *arg0) { UNUSED u32 pad88[26]; s32 i, j; s16 sp40[12][3]; - + for (i = 0, j = 0; i < ARRAY_COUNT(sp40); i++, j += 4) { func_800AFC54(&arg0[j], 1, 2, 0, sp40[i]); } diff --git a/src/code_800AF9B0.h b/src/code_800AF9B0.h index 0bd894550..94a00493d 100644 --- a/src/code_800AF9B0.h +++ b/src/code_800AF9B0.h @@ -1,7 +1,7 @@ #ifndef CODE_800AF9B0_H #define CODE_800AF9B0_H -#include "common_structs.h" +#include /* Function Prototypes */ void func_800AF9B0(void); diff --git a/src/effects.c b/src/effects.c index 124642a4c..8818f4df7 100644 --- a/src/effects.c +++ b/src/effects.c @@ -186,14 +186,14 @@ void clean_effect(Player *player, s8 arg1) { if ((player->effects & 0x400) == 0x400) { func_8008C6D0(player, arg1); } - + if (((player->effects & 0x80) == 0x80) || (player->effects & 0x40) == 0x40) { func_8008C8C4(player, arg1); } if ((player->effects & 0x800) == 0x800) { func_8008D0E4(player, arg1); } - if ((player->unk_044 & 0x4000) != 0) { + if ((player->unk_044 & 0x4000) != 0) { func_8008D3B0(player, arg1); } if ((player->effects & BOOST_EFFECT) == BOOST_EFFECT) { @@ -410,7 +410,7 @@ void func_8008CDC0(Player* player, s8 arg1) { player->unk_0B8 = 3.0f; player->unk_0AC = 1; player->effects &= ~0x10; - + if (((player->unk_07C >> 0x10) >= 0x14) || ((player->unk_07C >> 0x10) < -0x13) || (((player->unk_094 / 18.0f) * 216.0f) <= 30.0f) || ((player->effects & 8) != 0) || (((player->type & PLAYER_HUMAN) == 0) && ((player->effects & 0x1000) == 0))) { func_8008C73C(player, arg1); } @@ -548,7 +548,7 @@ void apply_boost_sound_effect(Player* player, s8 arg1) { player->soundEffects &= ~BOOST_SOUND_EFFECT; player->unk_DB4.unk0 = 0; player->unk_DB4.unk8 = 8.0f; - + if (D_8015F890 != 1) { if (((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) && ((player->type & PLAYER_INVISIBLE_OR_BOMB) != PLAYER_INVISIBLE_OR_BOMB)) { func_800C9250(arg1); @@ -575,7 +575,7 @@ void apply_boost_effect(Player* player) { } else { move_f32_towards(&player->boostPower, 0.0f, 0.1f); } - + if (player->boostPower <= 1.0f) { player->effects &= ~BOOST_EFFECT; } @@ -613,7 +613,7 @@ void func_8008D570(Player *player, s8 arg1) { void func_8008D698(Player* player, s8 arg1) { s16 temp; - + if (player->unk_0B2 == 0) { player->rotation[1] = player->unk_0AE; temp = 0; @@ -758,7 +758,7 @@ void apply_hit_effect(Player* player, s8 arg1) { player->currentSpeed = 0.0f; if ((player->collision.surfaceDistance[2] >= 600.0f) || ((player->effects & 0x1000) != 0)) { D_8018D990[arg1] = 3; } // placed block on same line to match - switch (D_8018D990[arg1]) { + switch (D_8018D990[arg1]) { case 0: player->unk_DB4.unk10 = 4.5f; if (player->unk_238 < 0x3D) { @@ -792,7 +792,7 @@ void apply_hit_effect(Player* player, s8 arg1) { player->unk_DB4.unk10 = 4.5f; player->pos[1] += 0.13; ++player->unk_238; - + if ((player->unk_046 & 0x80) != 0) { if (player->unk_238 >= 0x32) { D_8018D990[arg1] = 2; @@ -868,9 +868,9 @@ void apply_hit_rotating_sound_effect(Player* player, s8 arg1) { player->unk_0AE = player->rotation[1]; player->unk_0B2 = 2; player->unk_0C0 = 0; - player->unk_07C = 0; + player->unk_07C = 0; player->unk_078 = 0; - + D_80165190[0][arg1] = 1; D_80165190[1][arg1] = 1; D_80165190[2][arg1] = 1; @@ -942,18 +942,18 @@ void apply_lightning_effect(Player *player, s8 arg1) { void remove_lightning_effect(Player* player, UNUSED s8 arg1) { move_f32_towards(&player->size, 1.0f, 0.1f); move_f32_towards(&player->boundingBoxSize, gKartBoundingBoxSizeTable[player->characterId], 0.1f); - + player->effects &= ~LIGHTNING_EFFECT; player->size = 1.0f; player->boundingBoxSize = gKartBoundingBoxSizeTable[player->characterId]; player->unk_DB4.unk10 = 3.0f; player->unk_DB4.unk2 = 0; player->effects |= 0x08000000; - + if ((player->effects & 0x20000) == 0x20000) { player->rotation[1] = player->unk_0AE; } - + player->effects &= ~0x20000; } @@ -1142,14 +1142,14 @@ void apply_hit_by_item_sound_effect(Player* player, s8 arg1) { player->unk_236 = 4; player->unk_042 = 0; player->unk_0E0 = 0; - + if (((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) && ((player->type & PLAYER_INVISIBLE_OR_BOMB) != PLAYER_INVISIBLE_OR_BOMB)) { func_800C90F4(arg1, (player->characterId * 0x10) + 0x29008005); func_800C9060(arg1, SOUND_ACTION_EXPLOSION); } else { func_800098FC(arg1, player); } - + player->effects |= HIT_BY_ITEM_EFFECT; player->unk_0B6 |= 0x40; player->soundEffects &= ~0x01000002; @@ -1247,7 +1247,7 @@ void apply_boost_ramp_wood_effect(Player* player) { } else { move_f32_towards(&player->boostPower, 300.0f, 0.1f); } - + if (player->boostPower <= 1.0f) { player->effects &= ~BOOST_RAMP_WOOD_EFFECT; player->boostPower = 0.0f; @@ -1268,10 +1268,10 @@ void func_8008F104(Player* player, s8 arg1) { player->unk_0B2 = 2; player->unk_0C0 = 0; player->unk_07C = 0; - player->effects |= 0x4000; + player->effects |= 0x4000; player->unk_078 = 0; D_8018D920[arg1] = -0x8000; - + if (((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) && ((player->type & PLAYER_INVISIBLE_OR_BOMB) != PLAYER_INVISIBLE_OR_BOMB)) { func_800C90F4(arg1, (player->characterId * 0x10) + 0x29008003); } @@ -1358,13 +1358,13 @@ void func_8008F494(Player* player, s8 arg1) { clean_effect(player, arg1); func_8008F86C(player, arg1); - + player->unk_0A8 = 0; player->effects |= 0x10000; player->effects &= ~0x10; player->unk_236 = 0x1E; player->unk_042 = 0; - + if (((player->type & PLAYER_HUMAN) != 0) && ((player->type & PLAYER_INVISIBLE_OR_BOMB) == 0) && ((player->unk_0CA & 2) == 0) && @@ -1380,7 +1380,7 @@ void func_8008F5A4(Player* player, s8 arg1) { func_8006B8B4(player, arg1); player->unk_044 &= ~0x8000; } - + player->unk_206 = 0; player->slopeAccel = 0; player->effects &= ~0x10000; @@ -1453,7 +1453,7 @@ void apply_boo_effect(Player* arg0, s8 arg1) { tmp = ((s32) gCourseTimer) - D_8018D950[arg1]; if (tmp < 7) { arg0->unk_0C6 -= 2; - + if (arg0->unk_0C6 < 0x61) { arg0->unk_0C6 = 0x60; } @@ -1489,7 +1489,7 @@ void apply_boo_sound_effect(Player* player, s8 arg1) { if ((player->type & PLAYER_HUMAN) != 0) { player->unk_044 |= 0x200; - + for (temp_v1 = 0; temp_v1 < 10; ++temp_v1) { player->unk_258[temp_v1].unk_01C = 0; player->unk_258[temp_v1].unk_01E = 0; @@ -1549,7 +1549,7 @@ void func_8008FC64(Player* player, s8 arg1) { player->soundEffects &= 0xFBFFFFFF; player->soundEffects |= 0x08000000; player->type |= PLAYER_UNKNOWN_0x40; - + func_8008FDA8(player, arg1); func_800569F4(arg1); } @@ -1567,7 +1567,7 @@ void func_8008FCDC(Player* player, s8 arg1) { void func_8008FD4C(Player* player, UNUSED s8 arg1) { s16 temp_v0; - + player->soundEffects |= 0x04000000; player->unk_044 |= 0x200; @@ -1590,7 +1590,7 @@ void func_8008FDA8(Player* player, UNUSED s8 arg1) { void func_8008FDF4(Player* player, UNUSED s8 arg1) { clean_effect(player, arg1); - + player->effects &= ~0x10; player->kartHopJerk = D_800E37F0[player->characterId]; player->kartHopAcceleration = 0.0f; @@ -1649,9 +1649,9 @@ void func_8008FF08(Player *player, s8 playerId) { case COURSE_FRAPPE_SNOWLAND: waypoint = gNearestWaypointByPlayerId[playerId]; #ifdef VERSION_EU - if (((waypoint >= 0xF0) && (waypoint < 0x11E)) || + if (((waypoint >= 0xF0) && (waypoint < 0x11E)) || ((gCopyNearestWaypointByPlayerId[playerId] >= 0xF0) && (gCopyNearestWaypointByPlayerId[playerId] < 0x11E))) -#else +#else if ((waypoint >= 0xF0) && (waypoint < 0x105)) #endif { @@ -1791,7 +1791,7 @@ void func_80090778(Player* player) { clean_effect(player, playerIndex); func_8008F86C(player, playerIndex); - + player->unk_DB4.unk0 = 0; player->unk_0C2 = 0; player->unk_DB4.unk8 = 0.0f; diff --git a/src/effects.h b/src/effects.h index bf114cc17..2533daede 100644 --- a/src/effects.h +++ b/src/effects.h @@ -1,7 +1,7 @@ #ifndef EFFECTS_H #define EFFECTS_H -#include "common_structs.h" +#include /* Function Prototypes */ @@ -111,7 +111,7 @@ void func_80090178(Player*, s8, Vec3f, Vec3f); void func_80090778(Player*); void func_80090868(Player*); void func_80090970(Player*, s8, s8); -s32 prevent_item_use(Player*); +bool prevent_item_use(Player*); void func_800911B4(Player*, s8); void func_80091298(Player*, s8); diff --git a/src/gbiMacro.c b/src/gbiMacro.c index 18f131dce..f1985df36 100644 --- a/src/gbiMacro.c +++ b/src/gbiMacro.c @@ -1,6 +1,6 @@ #include #include -#include "PR/gu.h" +#include #include "main.h" #include diff --git a/src/kart_dma.c b/src/kart_dma.c index 5bcf726f6..4a536dd6d 100644 --- a/src/kart_dma.c +++ b/src/kart_dma.c @@ -2,7 +2,7 @@ #include #include "main.h" #include "buffers.h" -#include "common_structs.h" +#include #include "kart_dma.h" #include "defines.h" @@ -1689,9 +1689,9 @@ u8 *gKartPalettes[] = { * * @param player * @param playerId Player ID. - * @param arg2 Rom buffer index appears to always be 0-3. Sometimes subtracted by 2. - * @param arg3 Second buffer index appears to always be 0-3. - * @param arg4 First buffer index always zero. + * @param screenId Rom buffer index appears to always be 0-3. Sometimes subtracted by 2. + * @param screenId2 Second buffer index appears to always be 0-3. + * @param index First buffer index always zero. **/ void load_kart_texture(Player *player, s8 playerId, s8 screenId, s8 screenId2, s8 index) { s32 temp = player->effects; diff --git a/src/kart_dma.h b/src/kart_dma.h index 0c8fc07ae..55cb90223 100644 --- a/src/kart_dma.h +++ b/src/kart_dma.h @@ -2,7 +2,7 @@ #define KART_DMA_H #include "macros.h" -#include "common_structs.h" +#include /* Function Prototypes */ diff --git a/src/main.c b/src/main.c index b4b002a21..b060afb47 100644 --- a/src/main.c +++ b/src/main.c @@ -873,7 +873,7 @@ void game_state_handler(void) { (gControllerOne->button & Z_TRIG) && (gControllerOne->button & A_BUTTON)) { gGamestateNext = CREDITS_SEQUENCE; - } else if ((gControllerOne->button & L_TRIG) && + } else if ((gControllerOne->button & L_TRIG) && (gControllerOne->button & R_TRIG) && (gControllerOne->button & Z_TRIG) && (gControllerOne->button & B_BUTTON)) { @@ -1148,7 +1148,7 @@ void update_gamestate(void) { gCurrentlyLoadedCourseId = COURSE_NULL; break; case RACING: - /** + /** * @bug Reloading this segment makes random_u16() deterministic for player spawn order. * In laymens terms, random_u16() outputs the same value every time. */ diff --git a/src/math_util_2.c b/src/math_util_2.c index c2b788d86..5dee72012 100644 --- a/src/math_util_2.c +++ b/src/math_util_2.c @@ -502,7 +502,7 @@ void mtfx_translation_x_y(Mat4 arg0, s32 x, s32 y) { * 1 0 0 x * 0 1 0 y * 0 0 1 0 - * 0 0 0 1 + * 0 0 0 1 */ } @@ -944,10 +944,10 @@ void vec3f_rotate_x_y(Vec3f dest, Vec3f pos, Vec3s rot) { /** * @brief set the matrix to a transformation matrix - * + * * @param translate or position - * @param orientation - * @param scale + * @param orientation + * @param scale */ void rsp_set_matrix_transformation(Vec3f translate, Vec3su orientation, f32 scale) { Mat4 matrix; diff --git a/src/math_util_2.h b/src/math_util_2.h index e43a0df8d..871390c5d 100644 --- a/src/math_util_2.h +++ b/src/math_util_2.h @@ -1,7 +1,7 @@ #ifndef MATH_UTIL_2_H #define MATH_UTIL_2_H -#include "common_structs.h" +#include #include "camera.h" /* Function Prototypes */ @@ -10,7 +10,7 @@ void operator_or(s32*, s32); void operator_and_not(s32*,s32); void operator_xor(s32*, s32); -s32 func_80040E84(s32*, s32); +UNUSED bool func_80040E84(s32*, s32); s32 func_80040EA4(s32*, s32); s32 f32_step_up_towards_alternate(f32*, f32, f32*); s32 f32_step_down_towards_alternate(f32*, f32, f32*); @@ -59,7 +59,7 @@ u16 func_800417B4(u16, u16); s32 func_800418AC(f32, f32, Vec3f); s32 func_800418E8(f32, f32, Vec3f); s32 func_80041924(Collision*, Vec3f); -s32 is_particle_on_screen(Vec3f, Camera*, u16); +bool is_particle_on_screen(Vec3f, Camera*, u16); void func_800419F8(void); void mtfx_translation_x_y(Mat4, s32, s32); void mtxf_u16_rotate_z(Mat4, u16); diff --git a/src/menus.c b/src/menus.c index 7b888a85f..cfffd88e6 100644 --- a/src/menus.c +++ b/src/menus.c @@ -1523,7 +1523,7 @@ void player_select_menu_act(struct Controller *controller, u16 arg1) { if (!func_800B4520()) { switch (D_8018EDEE) { - case 1: + case 1: { saved_selection = gCharacterGridSelections[arg1]; if (saved_selection == 0) { @@ -1537,7 +1537,7 @@ void player_select_menu_act(struct Controller *controller, u16 arg1) { if (btnAndStick & B_BUTTON) { if (D_8018EDE8[arg1]) { D_8018EDE8[arg1] = false; - play_sound2(0x49008002); + play_sound2(SOUND_MENU_GO_BACK); } else { func_8009E208(); play_sound2(0x49008002); @@ -1564,7 +1564,7 @@ void player_select_menu_act(struct Controller *controller, u16 arg1) { func_800B44AC(); gMenuTimingCounter = 0; } - + // L800B3768 if (D_8018EDE8[arg1] == 0) { if ((btnAndStick & CONT_RIGHT) && (btnAndStick & CONT_DOWN)) { @@ -1670,7 +1670,7 @@ void player_select_menu_act(struct Controller *controller, u16 arg1) { if (btnAndStick & B_BUTTON) { D_8018EDEE = 1; D_8018EDE8[arg1] = false; - play_sound2(0x49008002); + play_sound2(SOUND_MENU_GO_BACK); break; } if (btnAndStick & A_BUTTON) { diff --git a/src/menus.h b/src/menus.h index 487697564..8c8d508f8 100644 --- a/src/menus.h +++ b/src/menus.h @@ -1,8 +1,8 @@ #ifndef MENUS_H #define MENUS_H -#include "PR/os.h" -#include "common_structs.h" +#include +#include #include // D_8018EDEC is position on options screen? @@ -30,13 +30,13 @@ void controller_pak_menu_act(struct Controller *, u16); void splash_menu_act(struct Controller *, u16); void func_800B28C8(void); void main_menu_act(struct Controller *, u16); -s32 is_character_spot_free(s32); +bool is_character_spot_free(s32); void player_select_menu_act(struct Controller *, u16); void course_select_menu_act(struct Controller *, u16); void func_800B3F74(s32); void func_800B44AC(void); void func_800B44BC(void); -s32 func_800B4520(void); +bool func_800B4520(void); /* data */ extern s32 D_8018EDC0; diff --git a/src/player_controller.c b/src/player_controller.c index 740006128..2590b1f31 100644 --- a/src/player_controller.c +++ b/src/player_controller.c @@ -620,7 +620,7 @@ void func_80027EDC(Player *player, s8 playerId) { void func_80028864(Player *player, Camera *camera, s8 playerId, s8 screenId) { u16 sp1E; - + if (!(player->type & PLAYER_START_SEQUENCE)) { switch (gActiveScreenMode) { case SCREEN_MODE_1P: @@ -633,32 +633,32 @@ void func_80028864(Player *player, Camera *camera, s8 playerId, s8 screenId) { sp1E = check_player_camera_collision(player, camera2, (f32) D_8016557C, 0.0f); break; case SCREEN_MODE_3P_4P_SPLITSCREEN: - sp1E = check_player_camera_collision(player, camera1, (f32) D_8016557C, 0.0f); + sp1E = check_player_camera_collision(player, camera1, (f32) D_8016557C, 0.0f); + if (sp1E == 1) break; + sp1E = check_player_camera_collision(player, camera2, (f32) D_8016557C, 0.0f); + if (sp1E == 1) break; + sp1E = check_player_camera_collision(player, camera3, (f32) D_8016557C, 0.0f); if (sp1E == 1) break; - sp1E = check_player_camera_collision(player, camera2, (f32) D_8016557C, 0.0f); - if (sp1E == 1) break; - sp1E = check_player_camera_collision(player, camera3, (f32) D_8016557C, 0.0f); - if (sp1E == 1) break; sp1E = check_player_camera_collision(player, camera4, (f32) D_8016557C, 0.0f); - break; + break; } - if ((sp1E == 1) || - ((player->type & PLAYER_INVISIBLE_OR_BOMB) == PLAYER_INVISIBLE_OR_BOMB) || - (gModeSelection == BATTLE) || - ((player->unk_0CA & 2) != 0) || - (player->unk_0CA & 8) || + if ((sp1E == 1) || + ((player->type & PLAYER_INVISIBLE_OR_BOMB) == PLAYER_INVISIBLE_OR_BOMB) || + (gModeSelection == BATTLE) || + ((player->unk_0CA & 2) != 0) || + (player->unk_0CA & 8) || //! @todo make a proper match ((*(D_801633F8 + (playerId))) == ((s16) 1U))) { player->effects &= ~0x1000; - if (((player->effects & 0x80) == 0x80) || - ((player->effects & 0x40) == 0x40) || - ((player->effects & 0x400) == 0x400) || - ((player->effects & 0x4000) == 0x4000) || - ((player->effects & 0x80000) == 0x80000) || - ((player->effects & 0x800000) == 0x800000) || - ((player->effects & 0x01000000) == 0x01000000) || - ((player->effects & HIT_BY_ITEM_EFFECT) == HIT_BY_ITEM_EFFECT) || - ((player->effects & 0x20000) == 0x20000) || + if (((player->effects & 0x80) == 0x80) || + ((player->effects & 0x40) == 0x40) || + ((player->effects & 0x400) == 0x400) || + ((player->effects & 0x4000) == 0x4000) || + ((player->effects & 0x80000) == 0x80000) || + ((player->effects & 0x800000) == 0x800000) || + ((player->effects & 0x01000000) == 0x01000000) || + ((player->effects & HIT_BY_ITEM_EFFECT) == HIT_BY_ITEM_EFFECT) || + ((player->effects & 0x20000) == 0x20000) || (player->unk_044 & 0x800)) { func_8002E594(player, camera, screenId, playerId); } else { @@ -680,18 +680,18 @@ void func_80028864(Player *player, Camera *camera, s8 playerId, s8 screenId) { } } -void func_80028C44(Player *player, Camera *camera, s8 playerId, s8 screenId) { +void func_80028C44(Player *player, Camera *camera, s8 playerId, s8 screenId) { if ((player->type & PLAYER_START_SEQUENCE) == 0) { player->effects &= ~0x1000; - if (((player->effects & 0x80) == 0x80) || - ((player->effects & 0x40) == 0x40) || - ((player->effects & 0x400) == 0x400) || - ((player->effects & 0x4000) == 0x4000) || - ((player->effects & 0x80000) == 0x80000) || - ((player->effects & 0x800000) == 0x800000) || - ((player->effects & 0x1000000) == 0x1000000) || - ((player->effects & HIT_BY_ITEM_EFFECT) == HIT_BY_ITEM_EFFECT) || - ((player->effects & 0x20000) == 0x20000) || + if (((player->effects & 0x80) == 0x80) || + ((player->effects & 0x40) == 0x40) || + ((player->effects & 0x400) == 0x400) || + ((player->effects & 0x4000) == 0x4000) || + ((player->effects & 0x80000) == 0x80000) || + ((player->effects & 0x800000) == 0x800000) || + ((player->effects & 0x1000000) == 0x1000000) || + ((player->effects & HIT_BY_ITEM_EFFECT) == HIT_BY_ITEM_EFFECT) || + ((player->effects & 0x20000) == 0x20000) || ((player->unk_044 & 0x800) != 0)) { func_8002E594(player, camera, screenId, playerId); } else { @@ -709,16 +709,16 @@ void func_80028D3C(Player *player, Camera *camera, s8 playerId, s8 screenId) { || (player->unk_0CA & 8) != 0 || (player->effects & 0x4F010CC0) != 0) { player->effects &= ~0x1000; - - if (((player->effects & 0x80) == 0x80) || - ((player->effects & 0x40) == 0x40) || - ((player->effects & 0x400) == 0x400) || - ((player->effects & 0x4000) == 0x4000) || - ((player->effects & 0x80000) == 0x80000) || - ((player->effects & 0x800000) == 0x800000) || - ((player->effects & 0x1000000) == 0x1000000) || - ((player->effects & HIT_BY_ITEM_EFFECT) == HIT_BY_ITEM_EFFECT) || - ((player->effects & 0x20000) == 0x20000) || + + if (((player->effects & 0x80) == 0x80) || + ((player->effects & 0x40) == 0x40) || + ((player->effects & 0x400) == 0x400) || + ((player->effects & 0x4000) == 0x4000) || + ((player->effects & 0x80000) == 0x80000) || + ((player->effects & 0x800000) == 0x800000) || + ((player->effects & 0x1000000) == 0x1000000) || + ((player->effects & HIT_BY_ITEM_EFFECT) == HIT_BY_ITEM_EFFECT) || + ((player->effects & 0x20000) == 0x20000) || ((player->unk_044 & 0x800) != 0)) { func_8002E594(player, camera, screenId, playerId); } else { @@ -737,9 +737,9 @@ void func_80028E70(Player *player, Camera *camera, s8 playerId, s8 screenId) { func_80038C6C(player, camera, screenId, playerId); } else { player->effects &= ~8; - } + } break; - default: + default: func_80027DA8(player, playerId); switch (gModeSelection) { case TIME_TRIALS: @@ -752,7 +752,7 @@ void func_80028E70(Player *player, Camera *camera, s8 playerId, s8 screenId) { default: func_80028864(player, camera, playerId, screenId); break; - } + } break; } } @@ -915,7 +915,7 @@ void func_8002934C(Player *player, Camera *camera, s8 screenId, s8 playerId) { || (player->unk_044 & 0x800)) { player->unk_050[screenId] = 0; } - if (((player->effects & 8) == 8) + if (((player->effects & 8) == 8) && ((player->unk_0CA & 2) == 2)) { player->unk_050[screenId] = 0; } @@ -951,7 +951,7 @@ void func_8002934C(Player *player, Camera *camera, s8 screenId, s8 playerId) { || (player->effects & 0x800000) || (player->effects & 0x20000) || (player->unk_044 & 0x800)) { - + if ((player->animFrameSelector[screenId]) >= 0x14) { player->animFrameSelector[screenId] = 0; } @@ -971,10 +971,10 @@ void func_8002934C(Player *player, Camera *camera, s8 screenId, s8 playerId) { || (player->effects & 0x10000) || (player->effects & 0x80) || (player->effects & 0x40)) { - + player->unk_002 |= 1 << (screenId * 4); D_80165190[screenId][playerId] = 1; - + if ((player->effects & 0x80) || (player->effects & 0x40)) { if ((player->animFrameSelector[screenId] == D_801650D0[screenId][playerId]) && (player->animGroupSelector[screenId] == D_80165110[screenId][playerId])) { @@ -1016,7 +1016,7 @@ void func_80029B4C(Player *player, UNUSED f32 arg1, f32 arg2, UNUSED f32 arg3) { else { var_f12 = 18.0f * (gCharacterSize[player->characterId] / 2); } - + calculate_orientation_matrix(sp5C, 0.0f, 1.0f, 0.0f, (player->rotation[1] + player->unk_0C0)); sp8C[0] = var_f12 - 3.6; sp8C[1] = -player->boundingBoxSize; @@ -1029,7 +1029,7 @@ void func_80029B4C(Player *player, UNUSED f32 arg1, f32 arg2, UNUSED f32 arg3) { player->tyres[FRONT_LEFT].pos[1] = player->pos[1] + sp8C[1]; player->tyres[FRONT_LEFT].pos[2] = player->pos[2] + sp8C[2]; process_collision(player, &player->tyres[FRONT_LEFT], sp80[0], sp80[1], sp80[2]); - + sp8C[0] = (-var_f12) + 3.6; sp8C[1] = -player->boundingBoxSize; sp8C[2] = var_f12 - 2.0f; @@ -1052,7 +1052,7 @@ void func_80029B4C(Player *player, UNUSED f32 arg1, f32 arg2, UNUSED f32 arg3) { player->tyres[BACK_LEFT].pos[1] = player->pos[1] + sp8C[1]; player->tyres[BACK_LEFT].pos[2] = player->pos[2] + sp8C[2]; process_collision(player, &player->tyres[BACK_LEFT], sp80[0], sp80[1], sp80[2]); - + sp8C[0] = (-var_f12) + 2.6; sp8C[1] = -player->boundingBoxSize; sp8C[2] = (-var_f12) + 4.0f; @@ -1064,7 +1064,7 @@ void func_80029B4C(Player *player, UNUSED f32 arg1, f32 arg2, UNUSED f32 arg3) { player->tyres[BACK_RIGHT].pos[1] = player->pos[1] + sp8C[1]; player->tyres[BACK_RIGHT].pos[2] = player->pos[2] + sp8C[2]; process_collision(player, &player->tyres[BACK_RIGHT], sp80[0], sp80[1], sp80[2]); - + if (!(player->effects & 8)) { a = (player->tyres[BACK_LEFT].baseHeight + player->tyres[FRONT_LEFT].baseHeight) / 2; move_f32_towards(&player->unk_230, a, 0.5f); @@ -1711,59 +1711,59 @@ void func_8002BB9C(Player *player, f32 *arg1, f32 *arg2, UNUSED s8 arg3, UNUSED s16 t0; UNUSED s32 pad; s16 sp30[10] = {0x0000, 0x00b6, 0x016c, 0x0222, 0x02d8, 0x038e, 0x0444, 0x04fa, 0x05b0, 0x0666}; - + if (((u16) player->unk_256) <= 0) { - return; + return; } if (((u16) player->unk_256) > 2) { return; } - + if (!(player->unk_046 & 0x20)) { - return; + return; } - + calculate_orientation_matrix(sp64, 0, 1, 0, (s16) 0); - + sp58[0] = *arg1; sp58[1] = 0; sp58[2] = *arg2; - + mtxf_translate_vec3f_mat3(sp58, sp64); - + sp4C[0] = player->copy_rotation_x; sp4C[1] = 0; sp4C[2] = player->copy_rotation_z; - + mtxf_translate_vec3f_mat3(sp4C, sp64); var_v0 = -(s16)get_angle_between_two_vectors(sp58, sp4C); t0 = player->rotation[1]; var_v0 = 0x10000 + (t0 - var_v0); var_v0 /= 182; - + if (var_v0 < 0x97 && (var_v0 > -0x97)) { return; } - + var_v0 = (player->unk_07C >> 0x10) / 6; - + if (var_v0 < 0) { var_v0 *= -1; } - + if (var_v0 >= 8) { var_v0 = 8; } - + if ((player->unk_07C >> 0x10) < 0) { player->rotation[1] -= sp30[var_v0]; } else { player->rotation[1] += sp30[var_v0]; } } - + void func_8002BD58(Player *player) { s32 sp2C[7] = { 0x002f0000, 0x00300000, 0x00310000, 0x00320000, 0x00320000, 0x00320000, 0x00320000 }; s32 spC[8] = { 0x00280000, 0x002c0000, 0x00300000, 0x00320000, 0x00320000, 0x00320000, 0x00320000, 0x00320000 }; @@ -1793,16 +1793,16 @@ void func_8002BD58(Player *player) { } } -void func_8002BF4C(Player *player, s8 arg1) { +void func_8002BF4C(Player *player, s8 arg1) { UNUSED s32 pad[3]; UNUSED s32 uselessAssignment; s32 i; s32 var_a2; Player *playerBorrow; Player *players = gPlayerOne; - + var_a2 = 0; - + if (((player->unk_094 / 18.0f) * 216.0f) < 50.0f) { player->unk_0E2 = 0; player->effects &= 0xFFDFFFFF; @@ -1816,9 +1816,9 @@ void func_8002BF4C(Player *player, s8 arg1) { } else { for (i = 0; i < NUM_PLAYERS; i++) { playerBorrow = &players[i]; - if (((player != playerBorrow) && - ((playerBorrow->type & 0x100) == 0) && - (playerBorrow->type & 0x8000)) && + if (((player != playerBorrow) && + ((playerBorrow->type & 0x100) == 0) && + (playerBorrow->type & 0x8000)) && ((var_a2 = func_8001FD78(player, playerBorrow->pos[0], playerBorrow->pos[1], playerBorrow->pos[2]), var_a2 == 1))) { player->unk_0E2 += 1; if (player->unk_0E2 >= 0x3D) { @@ -1835,7 +1835,7 @@ void func_8002BF4C(Player *player, s8 arg1) { break; } } - + if (var_a2 == 0) { player->unk_0E2 = 0; } @@ -1969,7 +1969,7 @@ void func_8002C4F8(Player *player, s8 arg1) { func_8002C17C(player, arg1); } -void func_8002C7E4(Player *player, s8 arg1, s8 arg2) { +void func_8002C7E4(Player *player, s8 arg1, s8 arg2) { if ((player->unk_046 & 1) != 1) { if ((player->effects & 0x8000) == 0x8000) { if ((player->effects & BOOST_EFFECT) != BOOST_EFFECT) { @@ -2016,6 +2016,7 @@ void func_8002C954(Player *player, s8 playerId, Vec3f arg2) { f32 zdist; temp_f0 = player->pos[1] - player->unk_074; + if (((((player->effects & 0x10000) != 0x10000) && ((player->effects & BOOST_RAMP_ASPHALT_EFFECT) == BOOST_RAMP_ASPHALT_EFFECT)) || ((((temp_f0 >= 20.0f) || @@ -2050,17 +2051,17 @@ void func_8002C954(Player *player, s8 playerId, Vec3f arg2) { var_f14 = D_80165070[playerId][1] - arg2[1]; ydist = var_f14; // okay zdist = D_80165070[playerId][2] - arg2[2]; - var_f14 = sqrtf((xdist * xdist) + (ydist * ydist) + (zdist * zdist)) / 3; + var_f14 = sqrtf((xdist * xdist) + (ydist * ydist) + (zdist * zdist)) / 3; if (var_f14 >= 1.0) { var_f14 = 1.0f; } - if ((var_f14 <= 0.6) && - (((player->unk_094 / 18.0f) * 216.0f) >= 40.0f) && + if ((var_f14 <= 0.6) && + (((player->unk_094 / 18.0f) * 216.0f) >= 40.0f) && (!(player->type & PLAYER_INVISIBLE_OR_BOMB))) { func_800CAEC4(playerId, 0.6F); } else if (!(player->type & PLAYER_INVISIBLE_OR_BOMB)) { - if ((var_f14 <= 0.6) && - (((player->unk_094 / 18.0f) * 216.0f) < 40.0f) && + if ((var_f14 <= 0.6) && + (((player->unk_094 / 18.0f) * 216.0f) < 40.0f) && (((player->unk_094 / 18.0f) * 216.0f) >= 10.0f)) { func_800CAEC4(playerId, 0.3F); } else { @@ -2165,7 +2166,7 @@ void func_8002D028(Player *player, s8 arg1) { thing0 = 8; - + if (temp > ((s16) (thing0 * 182))) { temp = (thing0 * 182); } @@ -2323,7 +2324,7 @@ void func_8002D268(Player *player, UNUSED Camera *camera, s8 screenId, s8 player posX = player->pos[0]; posY = player->pos[1]; posZ = player->pos[2]; - + player->copy_rotation_x = player->pos[0]; player->copy_rotation_z = player->pos[2]; player->copy_rotation_y = player->pos[1]; @@ -2361,10 +2362,10 @@ void func_8002D268(Player *player, UNUSED Camera *camera, s8 screenId, s8 player player->unk_DB4.unkC = 3.0f; player->unk_DB4.unk18 = 0; player->unk_0B6 |= 0x100; - if ((((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) - && ((player->effects & BOOST_RAMP_ASPHALT_EFFECT) == BOOST_RAMP_ASPHALT_EFFECT)) - && ((player->type & PLAYER_INVISIBLE_OR_BOMB) != PLAYER_INVISIBLE_OR_BOMB)) - + if ((((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) + && ((player->effects & BOOST_RAMP_ASPHALT_EFFECT) == BOOST_RAMP_ASPHALT_EFFECT)) + && ((player->type & PLAYER_INVISIBLE_OR_BOMB) != PLAYER_INVISIBLE_OR_BOMB)) + func_800C9060(playerId, 0x1900A60AU); else if (((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) && ((player->type & PLAYER_INVISIBLE_OR_BOMB) != PLAYER_INVISIBLE_OR_BOMB)) { @@ -2378,7 +2379,7 @@ void func_8002D268(Player *player, UNUSED Camera *camera, s8 screenId, s8 player if (((player->unk_0C2 < 0x23) && (player->unk_0C2 >= 0x1C)) && (((player->unk_094 / 18.0f) * 216.0f) >= 20.0f)) { player->unk_DB4.unkC = 2.8f; player->unk_DB4.unk18 = 0; - if (((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) + if (((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) && ((player->type & PLAYER_INVISIBLE_OR_BOMB) != PLAYER_INVISIBLE_OR_BOMB)) { func_800CADD0((u8) playerId, ((f32) player->unk_0C2) / 35.0f); } @@ -2448,7 +2449,7 @@ void func_8002D268(Player *player, UNUSED Camera *camera, s8 screenId, s8 player player->unk_22C = player->unk_094; player->unk_094 = sqrtf(temp2); - if ((player->unk_08C <= 0.0f) + if ((player->unk_08C <= 0.0f) && (player->unk_094 <= 0.08) && (D_8018CE10[playerId].unk_04[0] == 0.0f) && (D_8018CE10[playerId].unk_04[2] == 0.0f)) { @@ -2582,7 +2583,7 @@ void func_8002E594(Player *player, UNUSED Camera *camera, s8 screenId, s8 player } else { sp54[0] += ((((f64) (spEC[0] + sp80 + spD4[0]) - (sp54[0] * (0.2 * (f64) player->kartFriction))) / 6000) * 0.08); sp54[2] += ((((f64) (spEC[2] + sp78 + spD4[2]) - (sp54[2] * (0.2 * (f64) player->kartFriction))) / 6000) * 0.08); - + } sp54[1] += ((( ((spEC[1] + sp7C) + spD4[1])) - (sp54[1] * (0.12 * player->kartFriction))) / 6000) / player->unk_DAC; @@ -2594,11 +2595,11 @@ void func_8002E594(Player *player, UNUSED Camera *camera, s8 screenId, s8 player posX = player->pos[0]; posY = player->pos[1]; posZ = player->pos[2]; - + player->copy_rotation_x = player->pos[0]; player->copy_rotation_y = player->pos[1]; player->copy_rotation_z = player->pos[2]; - + spD0 = posX + player->velocity[0] + D_8018CE10[playerId].unk_04[0]; spCC = posY + player->velocity[1]; spC8 = posZ + player->velocity[2] + D_8018CE10[playerId].unk_04[2]; @@ -2916,7 +2917,7 @@ void func_8002F730(Player *player, UNUSED Camera *camera, UNUSED s8 screenId, s8 player->velocity[0] = sp68[0]; player->velocity[1] = sp68[1]; player->velocity[2] = sp68[2]; - + D_80165070[playerId][0] = sp68[0]; D_80165070[playerId][1] = sp68[1]; D_80165070[playerId][2] = sp68[2]; @@ -2986,7 +2987,7 @@ void func_8002FE84(Player *player, f32 arg1) { player->unk_098 = ((player->currentSpeed * player->currentSpeed) / 25.0f) * 1.1; return; } - + // Huh? if (((player->effects & 0xFFFFFFFF) & 8) == 8) { player->unk_098 = ((player->currentSpeed * player->currentSpeed) / 25.0f) * 1.1; @@ -3806,9 +3807,9 @@ void func_80033850(Player *arg0, f32 arg1) { void func_80033884(Player *player, s32 *arg1, s32 *arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6) { s32 temp_v1; - if ((*arg1 >= arg4) || (-arg4 >= *arg1)) { + if ((*arg1 >= arg4) || (-arg4 >= *arg1)) { temp_v1 = player->unk_200; - player->unk_200 -= 0x800; + player->unk_200 -= 0x800; if (player->unk_200 >= 0xF0000000) { player->unk_200 = temp_v1; } @@ -3826,7 +3827,7 @@ void func_80033884(Player *player, s32 *arg1, s32 *arg2, s32 arg3, s32 arg4, s32 UNUSED void func_80033940(Player *player, s32 *arg1, s32 arg2, s32 arg3, f32 arg4) { u32 temp_v1; - + temp_v1 = player->unk_200; player->unk_200 -= 0x800; if (!(player->unk_200 < 0xF0000000)) { @@ -3845,7 +3846,7 @@ UNUSED void func_80033940(Player *player, s32 *arg1, s32 arg2, s32 arg3, f32 arg void func_800339C4(Player *player, s32 *arg1, s32 arg2, s32 arg3, f32 arg4) { s32 temp_v0; - + temp_v0 = player->unk_200; player->unk_200 -= 0x800; if (player->unk_200 >= 0xF0000000) { @@ -3854,18 +3855,18 @@ void func_800339C4(Player *player, s32 *arg1, s32 arg2, s32 arg3, f32 arg4) { if (arg3 >= (s32)player->unk_200) { player->unk_200 = arg3; } - + *arg1 = (arg2 < *arg1) ? *arg1 - player->unk_200 : *arg1 + player->unk_200; - + func_80033850(player, arg4); } void func_80033A40(Player *player, s32 *arg1, s32 *arg2, s32 arg3, s32 arg4, s32 arg5, f32 arg6) { s32 temp_v1; - if ((*arg1 >= arg4) || (-arg4 >= *arg1)) { + if ((*arg1 >= arg4) || (-arg4 >= *arg1)) { temp_v1 = player->unk_200; - player->unk_200 -= 0x800; + player->unk_200 -= 0x800; if (player->unk_200 >= 0xF0000000) { player->unk_200 = temp_v1; } @@ -4630,17 +4631,17 @@ void func_80037BB4(Player *player, Vec3f arg1) { } void func_80037CFC(Player *player, struct Controller *controller, s8 arg2) { - if (((player->effects & 0x80) != 0x80) && - ((player->effects & 0x40) != 0x40) && - ((player->effects & 0x400) != 0x400) && - ((player->effects & 0x4000) != 0x4000) && - ((player->effects & 0x01000000) != 0x01000000) && - ((player->effects & HIT_BY_ITEM_EFFECT) != HIT_BY_ITEM_EFFECT) && ((player->effects & 0x10000) != 0x10000) && + if (((player->effects & 0x80) != 0x80) && + ((player->effects & 0x40) != 0x40) && + ((player->effects & 0x400) != 0x400) && + ((player->effects & 0x4000) != 0x4000) && + ((player->effects & 0x01000000) != 0x01000000) && + ((player->effects & HIT_BY_ITEM_EFFECT) != HIT_BY_ITEM_EFFECT) && ((player->effects & 0x10000) != 0x10000) && ((player->effects & 0x20000) != 0x20000)) { - if (((player->effects & HIT_EFFECT) != HIT_EFFECT) && - ((player->effects & 8) != 8) && - ((player->effects & 2) != 2) && - ((player->effects & 0x10) != 0x10) && + if (((player->effects & HIT_EFFECT) != HIT_EFFECT) && + ((player->effects & 8) != 8) && + ((player->effects & 2) != 2) && + ((player->effects & 0x10) != 0x10) && (controller->buttonPressed & R_TRIG)) { kart_hop(player); if (((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) && ((player->type & PLAYER_INVISIBLE_OR_BOMB) != PLAYER_INVISIBLE_OR_BOMB)) { @@ -4664,8 +4665,8 @@ void func_80037CFC(Player *player, struct Controller *controller, s8 arg2) { } } } - if (((player->effects & 0x20) == 0x20) && - (((controller->button & B_BUTTON) == 0) || + if (((player->effects & 0x20) == 0x20) && + (((controller->button & B_BUTTON) == 0) || (!(controller->button & A_BUTTON)))) { player->effects &= ~0x20; } @@ -4694,8 +4695,8 @@ void func_80037CFC(Player *player, struct Controller *controller, s8 arg2) { } } if ((!(player->effects & BOOST_RAMP_ASPHALT_EFFECT)) && (!(player->effects & 4))) { - if (((func_800388B0(controller) < (-0x31)) && - (((player->unk_094 / 18.0f) * 216.0f) <= 5.0f)) && + if (((func_800388B0(controller) < (-0x31)) && + (((player->unk_094 / 18.0f) * 216.0f) <= 5.0f)) && (controller->button & B_BUTTON)) { player->currentSpeed = 140.0f; player->unk_044 |= 1; @@ -4717,9 +4718,9 @@ void func_80037CFC(Player *player, struct Controller *controller, s8 arg2) { decelerate_ai_player(player, 5.0f); } } - if (((((player->effects & 0x80) == 0x80) || - ((player->effects & 0x40) == 0x40)) || - ((player->effects & 0x01000000) == 0x01000000)) || + if (((((player->effects & 0x80) == 0x80) || + ((player->effects & 0x40) == 0x40)) || + ((player->effects & 0x01000000) == 0x01000000)) || ((player->effects & HIT_BY_ITEM_EFFECT) == HIT_BY_ITEM_EFFECT)) { if (controller->button & A_BUTTON) { detect_triple_a_combo_a_pressed(player); @@ -4733,8 +4734,8 @@ void func_80037CFC(Player *player, struct Controller *controller, s8 arg2) { } void func_800381AC(Player *player, struct Controller *controller, s8 arg2) { - if (((player->type & PLAYER_EXISTS) == PLAYER_EXISTS) && - ((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) && + if (((player->type & PLAYER_EXISTS) == PLAYER_EXISTS) && + ((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) && ((player->type & PLAYER_KART_AI) != PLAYER_KART_AI)) { if ((player->type & PLAYER_START_SEQUENCE) != PLAYER_START_SEQUENCE) { if (((player->unk_0CA & 2) == 2) || ((player->unk_0CA & 8) == 8)) { @@ -4801,7 +4802,7 @@ void func_800382DC(void) { } return; } - + break; } break; @@ -4963,7 +4964,7 @@ void func_80038C6C(Player *player, UNUSED Camera *camera, s8 arg2, s8 playerId) Vec3f sp88; Vec3f sp7C; UNUSED s32 pad[10]; - + player->unk_084 = -10.0f; player->unk_088 = 28.0f; player->topSpeed = 250.0f; @@ -4984,12 +4985,12 @@ void func_80038C6C(Player *player, UNUSED Camera *camera, s8 arg2, s8 playerId) spA4 += sp108[0]; sp9C += sp108[2]; sp114[2] = player->unk_08C; - mtxf_translate_vec3f_mat3(sp114, player->orientationMatrix); - + mtxf_translate_vec3f_mat3(sp114, player->orientationMatrix); + sp88[0] = player->velocity[0]; sp88[1] = player->velocity[1]; sp88[2] = player->velocity[2]; - + sp88[0] += ((((((sp114[0] + spA4) + spF0[0])) - (sp88[0] * (0.12 * (player->kartFriction)))) / 6000.0) / 1); sp88[2] += ((((((sp114[2] + sp9C) + spF0[2])) - (sp88[2] * (0.12 * (player->kartFriction)))) / 6000.0) / 1); sp88[1] += ((((((sp114[1] + spA0) + spF0[1])) - (sp88[1] * (0.12 * (player->kartFriction)))) / 6000.0) / 1); @@ -5067,7 +5068,7 @@ void func_80038C6C(Player *player, UNUSED Camera *camera, s8 arg2, s8 playerId) D_80165070[playerId][0] = sp88[0]; D_80165070[playerId][1] = sp88[1]; D_80165070[playerId][2] = sp88[2]; - + if ((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) { if (gKartTopSpeedTable[player->characterId] < player->unk_094) { divOptimize = gKartTopSpeedTable[player->characterId] / player->unk_094; diff --git a/src/player_controller.h b/src/player_controller.h index d04024610..064202646 100644 --- a/src/player_controller.h +++ b/src/player_controller.h @@ -1,7 +1,7 @@ #ifndef player_controller_H #define player_controller_H -#include "common_structs.h" +#include #include "camera.h" /* Function Prototypes */ diff --git a/src/render_objects.c b/src/render_objects.c index b56ab0c59..670f5d483 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -153,7 +153,7 @@ UNUSED void func_8004398C(s32 arg0, s32 arg1, u16 arg2, f32 arg3, Vtx *vtx, s32 gSPVertex(gDisplayListHead++, vtx, 4, 0); gSPDisplayList(gDisplayListHead++, common_rectangle_display); } - + s32 func_80043A54(s32 arg0) { s32 temp_a1; s32 phi_v0; @@ -225,7 +225,7 @@ void load_texture_block_i8_nomirror(u8 *texture, s32 width, s32 height) { void func_80044924(u8 *texture, s32 width, s32 height) { // This macro ought to be equivalent to the block of macros below but it doesn't match // See comment above the `gDPLoadBlock` macro - // gDPLoadTextureBlock_4b(gDisplayListHead++, texture, G_IM_FMT_I, width, height, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + //gDPLoadTextureBlock_4b(gDisplayListHead++, texture, G_IM_FMT_I, width, height, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, texture); gDPSetTile(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, G_TX_RENDERTILE, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOLOD); @@ -252,7 +252,7 @@ void func_80044DA0(u8 *image, s32 width, s32 height) { // This macro ought to be equivalent to the block of macros below but it doesn't match // See comment above the `gDPLoadBlock` macro // gDPLoadTextureBlock_4b(gDisplayListHead++, image, G_IM_FMT_I, width, height, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - + gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_I, G_IM_SIZ_16b, 1, image); gDPSetTile(gDisplayListHead++, G_IM_FMT_I, G_IM_SIZ_16b, 0, G_TX_RENDERTILE, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOLOD); gDPLoadSync(gDisplayListHead++); @@ -268,7 +268,7 @@ void func_80044F34(u8 *image, s32 width, s32 height) { // This macro ought to be equivalent to the block of macros below but it doesn't match // See comment above the `gDPLoadBlock` macro // gDPLoadTextureBlock_4b(gDisplayListHead++, image, G_IM_FMT_I, width, height, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - + gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_I, G_IM_SIZ_16b, 1, image); gDPSetTile(gDisplayListHead++, G_IM_FMT_I, G_IM_SIZ_16b, 0, G_TX_RENDERTILE, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOLOD); gDPLoadSync(gDisplayListHead++); @@ -831,7 +831,7 @@ void func_800485C4(Vec3f arg0, Vec3su arg1, f32 arg2, s32 arg3, u8 *tlut, u8 *te set_transparency(arg3); draw_rectangle_texture_overlap(tlut, texture, arg6, arg7, arg8, arg9, argA); - + gDPSetAlphaCompare(gDisplayListHead++, G_AC_NONE); } @@ -1683,7 +1683,7 @@ void func_8004C6FC(s16 arg0, s16 arg1, u8 *texture, u32 width, u32 arg4) { athing += var_s4 * 0; var_s4 += heigth; } - + gSPDisplayList(gDisplayListHead++, D_0D007EB8); } #else @@ -2074,7 +2074,7 @@ void func_8004DF5C(s32 arg0, s32 arg1, u8 *texture, s32 width, s32 arg4, s32 hei s32 var_s0 = var_s0 = arg1 - (arg4 / 2); u8 *img = texture; s32 i; - + for (i = 0; i < arg4 / height; i++) { rsp_load_texture(img, width, height); func_8004B97C(arg0 - (width / 2), var_s0, width, height, 1); @@ -2277,7 +2277,7 @@ void func_8004EB38(s32 playerId) { } void func_8004ED40(s32 arg0) { - func_8004A2F4(playerHUD[arg0].speedometerX, playerHUD[arg0].speedometerY, 0U, 1.0f, D_8018D300, D_8018D308, D_8018D310, 0xFF, common_texture_speedometer, D_0D0064B0, 0x40, 0x60, 0x40, 0x30); + func_8004A2F4(playerHUD[arg0].speedometerX, playerHUD[arg0].speedometerY, 0U, 1.0f, D_8018D300, D_8018D308, D_8018D310, 0xFF, common_texture_speedometer, D_0D0064B0, 64, 96, 64, 48); func_8004A258(D_8018CFEC, D_8018CFF4, D_8016579E, 1.0f, common_texture_speedometer_needle, D_0D005FF0, 0x40, 0x20, 0x40, 0x20); } @@ -2531,6 +2531,7 @@ void draw_lap_count(s16 lapX, s16 lapY, s8 lap) { gDPSetAlphaCompare(gDisplayListHead++, G_AC_THRESHOLD); load_texture_block_rgba16_mirror((u8*) common_texture_hud_123, 32, 8); // Display current lap. Ex. 1/3 + func_8004BA98(lapX , lapY, 8, 8, lap * 8, 0, 0); // display the digit func_8004BA98(lapX + 8 , lapY, 8, 8, 24, 0, 0); // display the / func_8004BA98(lapX + 16, lapY, 8, 8, 16, 0, 0); // display the 3 @@ -3081,6 +3082,7 @@ void func_80052080(void) { func_80051C60(240 - D_800DC5F0->cameraHeight, D_8018D1F0); } + void func_800520C0(s32 arg0) { if (gObjectList[arg0].unk_0D5 == 0) { D_800E45C0[0].l[0].l.dir[0] = D_800E45C0[1].l[0].l.dir[0] = D_800E45C0[2].l[0].l.dir[0] = D_800E45C0[3].l[0].l.dir[0] = 0; @@ -3543,7 +3545,7 @@ void func_80053E6C(s32 arg0) { func_8004B614(0, 0, 0, 0, 0, 0, 0); D_80183E80[0] = 0; D_80183E80[1] = 0x8000; - rsp_load_texture(D_8018D4BC, 0x40, 0x20); + rsp_load_texture(D_8018D4BC, 64, 32); for (var_s1 = 0; var_s1 < D_80165738; var_s1++) { objectIndex = gObjectParticle3[var_s1]; if ((objectIndex != NULL_OBJECT_ID) && (gObjectList[objectIndex].state >= 2)) { @@ -3633,7 +3635,7 @@ void render_object_paddle_boat_smoke_particles(s32 cameraId) { UNUSED s32 pad[2]; Camera *camera; s32 i; - + camera = &camera1[cameraId]; gSPDisplayList(gDisplayListHead++, D_0D007AE0); @@ -4420,18 +4422,18 @@ UNUSED void func_800573BC(void) { } UNUSED void func_800573C4(void) { - + } UNUSED void func_800573CC(void) { - + } UNUSED void func_800573D4(void) { - + } UNUSED void func_800573DC(void) { - + } @@ -4473,7 +4475,7 @@ void debug_print_number(s32 *x, s32 *y, s32 number, u32 numDigits) debug_wrap_text(x, y); n = -number; } - + *D_801657B8 = -1; ptr = D_801657B8; if (n != 0) { @@ -4485,7 +4487,7 @@ void debug_print_number(s32 *x, s32 *y, s32 number, u32 numDigits) } else { *++ptr = 0; } - + do { func_800573E4(*x, *y, *ptr--); debug_wrap_text(x, y); @@ -4502,7 +4504,7 @@ void func_8005762C(s32 *x, s32 *y, s32 pathCount, u32 numDigits) { s8 *ptr; s32 count; s8 remainder; - + debug_wrap_text(x, y); *D_801657B8 = -1; ptr = D_801657B8; @@ -4518,7 +4520,7 @@ void func_8005762C(s32 *x, s32 *y, s32 pathCount, u32 numDigits) { } else { *++ptr = 0; } - + do { func_800573E4(*x, *y, *ptr--); debug_wrap_text(x, y); diff --git a/src/render_objects.h b/src/render_objects.h index b2eeb3ffb..e0c3c9471 100644 --- a/src/render_objects.h +++ b/src/render_objects.h @@ -1,7 +1,7 @@ #ifndef RENDER_OBJECTS_H #define RENDER_OBJECTS_H -#include "common_structs.h" +#include #include "main.h" void func_80045738(u8*, u8*, s32, s32); diff --git a/src/render_player.c b/src/render_player.c index fc530fdc8..28cde59dc 100644 --- a/src/render_player.c +++ b/src/render_player.c @@ -710,7 +710,7 @@ void mtxf_scale2(Mat4 arg0, f32 scale) { * This function writes a fixed-point value to each Mtx entry. This is not how the Mtx struct works. * The first half of Mtx only holds s16 whole numbers and the second half holds the s16 decimal (fractional) parts. * See convert_to_fixed_point_matrix() for correct calculations. Note that each Mtx entry is the size of s32. - * This means each Mtx entry holds two s16 values. + * This means each Mtx entry holds two s16 values. * The first sixteen entries contain only the integer parts and the second sixteen entries hold only the decimal (fractional) parts. */ UNUSED void failed_fixed_point_matrix_conversion(Mtx *dest, Mat4 src) { @@ -1296,7 +1296,7 @@ void render_player_shadow(Player *player, s8 playerId, s8 screenId) { convert_to_fixed_point_matrix(&gGfxPool->mtxShadow[playerId + (screenId * 8)], sp118); gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxShadow[playerId + (screenId * 8)]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - + gSPDisplayList(gDisplayListHead++, D_0D008D58); gDPSetTextureLUT(gDisplayListHead++, G_TT_NONE); gDPLoadTextureBlock(gDisplayListHead++, D_8018D474, G_IM_FMT_I, G_IM_SIZ_8b, 64, 32, 0, G_TX_NOMIRROR @@ -1304,14 +1304,14 @@ void render_player_shadow(Player *player, s8 playerId, s8 screenId) { func_8004B414(0, 0, 0, 0xFF); gDPSetRenderMode(gDisplayListHead++, G_RM_ZB_CLD_SURF, G_RM_ZB_CLD_SURF2); gSPVertex(gDisplayListHead++, &D_800E51D0[0], 4, 0); - + gSPDisplayList(gDisplayListHead++, common_square_plain_render); gDPLoadTextureBlock(gDisplayListHead++, (D_8018D474 + SOME_TEXTURE_POINTER_MATH), G_IM_FMT_I, G_IM_SIZ_8b, 64, 32, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); func_8004B414(0, 0, 0, 0xFF); gDPSetRenderMode(gDisplayListHead++, G_RM_ZB_CLD_SURF, G_RM_ZB_CLD_SURF2); gSPVertex(gDisplayListHead++, &D_800E5210[0], 4, 0); - + gSPDisplayList(gDisplayListHead++, common_square_plain_render); gSPTexture(gDisplayListHead++, 1, 1, 0, G_TX_RENDERTILE, G_OFF); } @@ -1346,9 +1346,9 @@ void render_player_shadow_credits(Player *player, s8 playerId, s8 arg2) { mtxf_translate_rotate(sp118, spCC, spC4); mtxf_scale2(sp118, gCharacterSize[player->characterId] * player->size); convert_to_fixed_point_matrix(&gGfxPool->mtxShadow[playerId + (arg2 * 8)], sp118); - + gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxShadow[playerId + (arg2 * 8)]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - + gSPDisplayList(gDisplayListHead++, D_0D008D58); gDPSetTextureLUT(gDisplayListHead++, G_TT_NONE); gDPLoadTextureBlock(gDisplayListHead++, D_8018D474, G_IM_FMT_I, G_IM_SIZ_8b, 64, 32, 0, @@ -1356,14 +1356,14 @@ void render_player_shadow_credits(Player *player, s8 playerId, s8 arg2) { func_8004B414(0, 0, 0, 0x000000D0); gDPSetRenderMode(gDisplayListHead++, G_RM_ZB_CLD_SURF, G_RM_ZB_CLD_SURF2); gSPVertex(gDisplayListHead++, &D_800E51D0[0], 4, 0); - + gSPDisplayList(gDisplayListHead++, common_square_plain_render); gDPLoadTextureBlock(gDisplayListHead++, (D_8018D474 + SOME_TEXTURE_POINTER_MATH), G_IM_FMT_I, G_IM_SIZ_8b, 64, 32, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); func_8004B414(0, 0, 0, 0x000000D0); gDPSetRenderMode(gDisplayListHead++, G_RM_ZB_CLD_SURF, G_RM_ZB_CLD_SURF2); gSPVertex(gDisplayListHead++, &D_800E5210[0], 4, 0); - + gSPDisplayList(gDisplayListHead++, common_square_plain_render); gSPTexture(gDisplayListHead++, 1, 1, 0, G_TX_RENDERTILE, G_OFF); } diff --git a/src/render_player.h b/src/render_player.h index c1ab0c777..504e6911f 100644 --- a/src/render_player.h +++ b/src/render_player.h @@ -32,7 +32,7 @@ void func_80021F50(Mat4, Vec3f); void mtxf_scale2(Mat4, f32); void failed_fixed_point_matrix_conversion(Mtx*, Mat4); void convert_to_fixed_point_matrix(Mtx*, Mat4); -s32 adjust_angle(s16*, s16, s16); +bool adjust_angle(s16*, s16, s16); void move_s32_towards(s32*, s32, f32); void move_f32_towards(f32*, f32, f32); void move_s16_towards(s16*, s16, f32); @@ -48,7 +48,7 @@ void func_80022DB4(Player*, s8); void func_80022E84(Player*, s8, s8, s8); void change_player_color_effect_rgb(Player*, s8, s32, f32); void change_player_color_effect_cmy(Player*, s8, s32, f32); -s32 is_player_under_light_luigi_raceway(Player*, s8); +bool is_player_under_light_luigi_raceway(Player*, s8); void render_light_environment_on_player(Player*, s8); void func_800235AC(Player*, s8); void func_80023BF0(Player*, s8, s8, s8); diff --git a/src/save.c b/src/save.c index 754dc2e7f..fcea25270 100644 --- a/src/save.c +++ b/src/save.c @@ -144,7 +144,7 @@ void load_save_data(void) { for (i = 0; i < 16; i++) { func_800B4A9C(i); } - + validate_save_data(); gSoundMode = gSaveData.main.soundMode; @@ -165,7 +165,7 @@ void func_800B4A9C(s32 course) { .unknownBytes[0] = 1; } sp24 = &gSaveData.allCourseTimeTrialRecords.cupRecords[course / 4].courseRecords[course % 4]; - + func_800B4FB0(course); if(sp24) {} @@ -209,7 +209,7 @@ void validate_save_data(void) { Stuff *backup = &gSaveData.backup; if (main->checksum[1] != (compute_save_data_checksum_1()) || (main->checksum[2] != compute_save_data_checksum_2())) { reset_save_data_grand_prix_points_and_sound_mode(); - + if (validate_save_data_checksum_backup() == 0) { for (cup_index = 0; cup_index < 4; cup_index++) { main->grandPrixPoints[cup_index] = backup->grandPrixPoints[cup_index]; @@ -385,7 +385,7 @@ void func_800B536C(s32 arg0) { if (arg0 >= 0) { points = &gSaveData.main.grandPrixPoints[gCCSelection]; - + tmp = func_800B54EC(gCupSelection, *points); tmp2 = 3 - arg0; if ((arg0 < 3) && (tmp < (3-arg0))) { @@ -411,7 +411,7 @@ void func_800B5404(s32 arg0, s32 arg1) if ((arg0 < 3) && (temp < (temp_a0 = 3 - arg0))) { *points = func_800B5508(temp2, *points, temp_a0); - + write_save_data_grand_prix_points_and_sound_mode(); update_save_data_backup(); } @@ -499,7 +499,7 @@ void func_800B559C(s32 arg0) { * odd. It calculates a checksum for 51 bytes in 17 byte chunks, but that doesn't line * up with anything in the save data cleanly. At that byte count it would get the 48 bytes * for the records plus 3 of the unknown bytes. -* +* * But only unknown bytes 7 and 8 ever get set, so why the extra 3, and why in chunks of 17? **/ s32 func_800B578C(s32 arg0) { @@ -595,7 +595,7 @@ s32 check_for_controller_pak(s32 controller) { } osPfsIsPlug(&gSIEventMesgQueue, &controllerBitpattern); - + if ((controllerBitpattern & (1 << controller)) != 0) { return PAK; } @@ -618,8 +618,8 @@ s32 controller_pak_1_status(void) { gControllerPak1State = BAD; break; } - } - + } + if (!gControllerPak1State) { s32 errorCode; if (check_for_controller_pak(CONTROLLER_1) == NO_PAK) { @@ -639,7 +639,7 @@ s32 controller_pak_1_status(void) { return PFS_PAK_BAD_READ; } } - + gControllerPak1State = OK; if (osPfsFindFile(&gControllerPak1FileHandle, gCompanyCode, gGameCode, (u8 *) gGameName, (u8 *) gExtCode, &gControllerPak1FileNote) == PFS_NO_ERROR) { return PFS_NO_ERROR; @@ -663,13 +663,13 @@ s32 controller_pak_1_status(void) { } // gives status info about controller pak insterted in controller 2 -s32 controller_pak_2_status(void) { +s32 controller_pak_2_status(void) { s32 stateBorrow = sControllerPak2State; - + if (stateBorrow) { switch (osPfsFindFile(&gControllerPak2FileHandle, gCompanyCode, gGameCode, (u8 *) gGameName, (u8 *) gExtCode, &gControllerPak2FileNote)) { case PFS_NO_ERROR: - return PFS_NO_ERROR; + return PFS_NO_ERROR; case PFS_ERR_INVALID: return PFS_INVALID_DATA; default: @@ -683,7 +683,7 @@ s32 controller_pak_2_status(void) { if (check_for_controller_pak(CONTROLLER_2) == NO_PAK) { return PFS_NO_PAK_INSERTED; } - + errorCode = osPfsInit(&gSIEventMesgQueue, &gControllerPak2FileHandle, CONTROLLER_2); if (errorCode) { switch (errorCode) { @@ -699,7 +699,7 @@ s32 controller_pak_2_status(void) { } sControllerPak2State = OK; - + switch (osPfsFindFile(&gControllerPak2FileHandle, gCompanyCode, gGameCode, (u8 *) gGameName, (u8 *) gExtCode, &gControllerPak2FileNote)) { case PFS_NO_ERROR: return PFS_NO_ERROR; @@ -765,7 +765,7 @@ u8 func_800B60E8(s32 page) { s32 i; u32 checksum = 0; u8 *addr; - + for (i = 0, addr = (u8*) &((u8*)D_800DC714)[page * 256]; i < 256; i++) { checksum += (*addr++ * (page + 1) + i); } @@ -847,7 +847,7 @@ s32 func_800B63F0(s32 arg0) { func_800051C4(); D_80162DD6 = 1; func_80005AE8(gPlayerThree); - + phi_s3 = 0; if (((gCupSelection * 4) + gCupCourseSelection) != D_8018EE10[arg0].courseIndex) { phi_s3 = 2; @@ -859,14 +859,14 @@ s32 func_800B63F0(s32 arg0) { } else { temp_s0 = 0; phi_s1 = (u8*) &D_8018EE10[arg0]; - + while (temp_s0 < 0x3C) { if (phi_s1[7] != func_800B60E8(temp_s0)) { phi_s3 = 1; break; } - + ++phi_s1; ++temp_s0; } @@ -943,7 +943,7 @@ void func_800B6708(void) { s32 temp_s0; osPfsReadWriteFile(&gControllerPak1FileHandle, gControllerPak1FileNote, PFS_READ, 0, 0x100 /* 2*sizeof(struct_8018EE10_entry) ? */, (u8*) &D_8018EE10); - + for (temp_s0 = 0; temp_s0 < 2; ++temp_s0) { if (D_8018EE10[temp_s0].checksum != func_800B6828(temp_s0)) { D_8018EE10[temp_s0].ghostDataSaved = 0; @@ -954,7 +954,7 @@ void func_800B6708(void) { void func_800B6798(void) { s32 temp_s0; u8* tmp; - + tmp = (u8*) D_8018D9C0; osPfsReadWriteFile(&gControllerPak2FileHandle, gControllerPak2FileNote, PFS_READ, 0, 0x100 /* 2*sizeof(struct_8018EE10_entry) ? */, tmp); @@ -1006,7 +1006,7 @@ s32 func_800B69BC(s32 arg0) { plz->unk_07[i] = i; } plz->checksum = func_800B6828(arg0); - + return osPfsReadWriteFile(&gControllerPak1FileHandle, gControllerPak1FileNote, PFS_WRITE, (s32) sizeof(struct_8018EE10_entry) * arg0, sizeof(struct_8018EE10_entry), (u8 *)plz); } diff --git a/src/save.h b/src/save.h index 81c93d340..a429bc4d8 100644 --- a/src/save.h +++ b/src/save.h @@ -1,8 +1,8 @@ #ifndef SAVE_H #define SAVE_H -#include "PR/os.h" -#include "common_structs.h" +#include +#include /* define symbols */ diff --git a/src/spawn_players.c b/src/spawn_players.c index ce3281fa2..6e35c884e 100644 --- a/src/spawn_players.c +++ b/src/spawn_players.c @@ -456,7 +456,7 @@ void func_80039AE4(void) { void func_80039DA4(void) { s32 i; - + s32 sp2C[] = { 7, 6, 5, 4, 3, 2, 1, 0, diff --git a/src/spawn_players.h b/src/spawn_players.h index 504e2b057..baec17a9a 100644 --- a/src/spawn_players.h +++ b/src/spawn_players.h @@ -2,7 +2,7 @@ #define SPAWN_PLAYERS_H #include "camera.h" -#include "common_structs.h" +#include /* Function Prototypes */ /** @cond */ @@ -38,17 +38,17 @@ extern s16 gCopyNearestWaypointByPlayerId[]; extern s16 D_80165330[]; extern s16 D_80165340; extern Player *D_801653C0[]; -extern s32 gPlayerIsThrottleActive[]; +extern bool gPlayerIsThrottleActive[]; extern s32 D_80165400[]; extern s32 gFrameSinceLastACombo[]; extern s32 gCountASwitch[]; extern bool gIsPlayerTripleAButtonCombo[]; extern s32 gTimerBoostTripleACombo[]; -extern s32 gPlayerIsBrakeActive[]; +extern bool gPlayerIsBrakeActive[]; extern s32 D_801654C0[]; extern s32 gFrameSinceLastBCombo[]; extern s32 gCountBChangement[]; -extern s32 gIsPlayerTripleBButtonCombo[]; +extern bool gIsPlayerTripleBButtonCombo[]; extern s32 gTimerBoostTripleBCombo[]; extern s16 chooseKartAIPlayers[]; extern s16 D_8016556E; diff --git a/src/staff_ghosts.c b/src/staff_ghosts.c index 97142e717..08f478a41 100644 --- a/src/staff_ghosts.c +++ b/src/staff_ghosts.c @@ -412,8 +412,8 @@ void func_8000599C(void) { u32 temp_t0; u32 temp_a0_2; - if (((D_80162DB8 >= 0x1000) || - ((gPlayerOne->unk_0CA & 2) != 0)) || + if (((D_80162DB8 >= 0x1000) || + ((gPlayerOne->unk_0CA & 2) != 0)) || ((gPlayerOne->unk_0CA & 8) != 0)) { D_80162DF8 = 1; return; @@ -458,7 +458,7 @@ void func_8000599C(void) { temp_t0 += 0x10000; D_80162DBC[D_80162DB8] = temp_t0; - + } } else { D_80162DB8++; D_80162DBC[D_80162DB8] = phi_a3; diff --git a/src/staff_ghosts.h b/src/staff_ghosts.h index 5444caa8b..c48e28563 100644 --- a/src/staff_ghosts.h +++ b/src/staff_ghosts.h @@ -1,8 +1,8 @@ #ifndef STAFF_GHOSTS_H #define STAFF_GHOSTS_H -#include "PR/os.h" -#include "common_structs.h" +#include +#include void func_80005B18(void); void func_80004EF0(void); diff --git a/src/textures.h b/src/textures.h index 079c8703e..5c02dcbd3 100644 --- a/src/textures.h +++ b/src/textures.h @@ -1,7 +1,7 @@ #ifndef TEXTURES_H #define TEXTURES_H -#include "PR/ultratypes.h" +#include /** * @brief struct for a texture use in menu mainly diff --git a/src/update_objects.c b/src/update_objects.c index a56798797..9e9b363f4 100644 --- a/src/update_objects.c +++ b/src/update_objects.c @@ -37,7 +37,7 @@ #include "memory.h" //! @todo unused? -f32 D_800E43B0[] = { +f32 D_800E43B0[] = { 65536.0, 0.0, 1.0, 0.0, 0.0, 65536.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, @@ -102,16 +102,14 @@ s32 find_unused_obj_index(s32* arg0) { s32 temp_v1; temp_v1 = objectListSize; - temp_v0 = 0; do - { + temp_v0 = 0; do { // this two SHOULD be on the same line ++temp_v1; ++temp_v0; - if (temp_v1 == 0x226) { + if (temp_v1 == OBJECT_LIST_SIZE) { temp_v1 = 0; } - - } while ((gObjectList[temp_v1].unk_0CA != 0) && (temp_v0 != 0x226)); + } while ((gObjectList[temp_v1].unk_0CA != 0) && (temp_v0 != OBJECT_LIST_SIZE)); gObjectList[temp_v1].unk_0CA = 1; @@ -363,7 +361,7 @@ s32 func_8007278C(s32 objectIndex, s32 arg1) { func_80072488(objectIndex); phi_v1 = 1; } - + return phi_v1; } @@ -382,7 +380,7 @@ UNUSED s32 func_8007281C(s32 objectIndex, s32 arg1) { func_80072488(objectIndex); phi_a2 = 1; } - + return phi_a2; } @@ -401,7 +399,7 @@ UNUSED s32 func_800728B0(s32 objectIndex, s32 arg1, s32 arg2) { func_80072488(objectIndex); phi_a3 = 1; } - + return phi_a3; } @@ -430,7 +428,7 @@ void set_type_object(s32 objectIndex, s32 arg1) { } void func_800729EC(s32 objectIndex) { - u32 temp_v1 = 1; + u32 temp_v1 = 1; s32 i; start_race(); @@ -547,7 +545,7 @@ void func_80072D3C(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { } else { gObjectList[objectIndex].itemDisplay = arg2; } - + if (gObjectList[objectIndex].unk_0D4 < 0) { gObjectList[objectIndex].unk_0D4 = 1; if (gObjectList[objectIndex].unk_0CC > 0) { @@ -775,7 +773,7 @@ UNUSED void func_80073570(s32 objectIndex) { D_8018D1EC = 0; } (*test)++; -} +} void func_800735BC(s32 objectIndex, Gfx *arg1, f32 arg2) { gObjectList[objectIndex].status = 0; @@ -1022,7 +1020,7 @@ bool func_80073E18(s32 objectIndex, u16* arg1, u16 arg2, s32 arg3) { *arg1 += arg2; gObjectList[objectIndex].unk_048 = temp_v1; } - + return phi_t0; } @@ -1094,7 +1092,7 @@ bool func_8007401C(s32 objectIndex, f32* arg1, f32 arg2, f32 arg3, f32 arg4, s32 } } } - + return phi_a3; } @@ -1133,7 +1131,7 @@ s32 func_800741B4(s32 objectIndex, f32* arg1, f32 arg2, f32 arg3, f32 arg4, s32 } } } - + return 0; } @@ -1211,7 +1209,7 @@ void func_80074574(u8 *arg0, void *arg1, u16 arg2, u16 arg3) { } //! @todo arg1 should likely be a u8 * -void func_800745C8(s32 objectIndex, s32 arg1) { +void func_800745C8(s32 objectIndex, uintptr_t arg1) { s32 phi_a1; if ((gObjectList[objectIndex].status & 1) != 0) { @@ -1224,13 +1222,13 @@ void func_800745C8(s32 objectIndex, s32 arg1) { if ((gObjectList[objectIndex].status & 2) != 0) { phi_a1 = 1; } - + gObjectList[objectIndex].activeTexture = (u8 *) (gObjectList[objectIndex].textureWidth * gObjectList[objectIndex].textureHeight * phi_a1) + arg1; func_800744A0(objectIndex); } } -void func_8007466C(s32 objectIndex, s32 arg1) { +void func_8007466C(s32 objectIndex, uintptr_t arg1) { s32 phi_a1; if ((gObjectList[objectIndex].status & 1) != 0) { @@ -1246,9 +1244,9 @@ void func_8007466C(s32 objectIndex, s32 arg1) { } } -void func_80074704(s32 objectIndex, s32 arg1) { +void func_80074704(s32 objectIndex, uintptr_t arg1) { s32 phi_a1; - + if ((gObjectList[objectIndex].status & 1) != 0) { gObjectList[objectIndex].activeTLUT = gObjectList[objectIndex].tlutList; gObjectList[objectIndex].status ^= 2; @@ -1284,17 +1282,17 @@ void func_800747F0(s32 objectIndex, u8 *arg1) { void func_80074894(s32 objectIndex, u8 *arg1) { func_800747F0(objectIndex, arg1); - func_800745C8(objectIndex, (s32)arg1); + func_800745C8(objectIndex, (uintptr_t)arg1); } void func_800748C4(s32 objectIndex, u8 *arg1) { func_800747F0(objectIndex, arg1); - func_8007466C(objectIndex, (s32)arg1); + func_8007466C(objectIndex, (uintptr_t)arg1); } void func_800748F4(s32 objectIndex, u8 *arg1) { func_800747F0(objectIndex, arg1); - func_80074704(objectIndex, (s32)arg1); + func_80074704(objectIndex, (uintptr_t)arg1); } void func_80074924(s32 objectIndex) { @@ -1581,7 +1579,7 @@ void func_80075714(s32 objectIndex) { case 0: break; } - + object_calculate_new_pos_offset(objectIndex); } @@ -1664,7 +1662,7 @@ s32 func_80075A6C(s32 arg0, Vec3f arg1, f32 arg2) { func_800759EC(objectIndex, arg1, arg2); } } - + return objectIndex; } @@ -3642,6 +3640,7 @@ u8 gen_random_item(s16 rank, s16 isCpu) } randomItem = *((rank * 100) + curve + sRandomItemIndex); } + return randomItem; } @@ -3658,7 +3657,7 @@ s16 func_8007AFB0(s32 objectIndex, s32 arg1) { s16 randomItem; randomItem = gen_random_item_human(gLapCountByPlayerId[arg1], gGPCurrentRaceRankByPlayerId[arg1]); - + if (playerHUD[arg1].itemOverride != 0) { randomItem = (s16) playerHUD[arg1].itemOverride; playerHUD[arg1].itemOverride = 0; @@ -6112,7 +6111,7 @@ void func_8008153C(s32 objectIndex) { } void func_80081790(s32 objectIndex) { - switch (gObjectList[objectIndex].state) { + switch (gObjectList[objectIndex].state) { case 0: break; /* irregular */ case 1: diff --git a/src/update_objects.h b/src/update_objects.h index a0fac60b5..ab648eaaa 100644 --- a/src/update_objects.h +++ b/src/update_objects.h @@ -2,7 +2,7 @@ #define UPDATE_OBJECTS_H #include "code_80004740.h" -#include "common_structs.h" +#include #include "camera.h" #include "objects.h" @@ -19,13 +19,13 @@ void func_80072180(void); void set_object_flag_status_true(s32, s32); void set_object_flag_status_false(s32, s32); void func_80072214(s32, s32); -s32 is_obj_flag_status_active(s32, s32); +bool is_obj_flag_status_active(s32, s32); s32 is_obj_index_flag_status_inactive(s32, s32); void func_800722A4(s32, s32); void func_800722CC(s32, s32); void func_800722F8(s32, s32); -s32 func_80072320(s32, s32); -s32 func_80072354(s32, s32); +bool func_80072320(s32, s32); +bool func_80072354(s32, s32); void set_object_unk_0CB(s32, s32); void init_object(s32, s32); void func_80072408(s32); @@ -55,8 +55,8 @@ s32 func_80072B48(s32, s32); void func_80072C00(s32, s32, s32, s32); void func_80072D3C(s32, s32, s32, s32, s32); s32 func_80072E54(s32, s32, s32, s32, s32, s32); -s32 func_80072F88(s32, s32, s32, s32, s32, s32); -s32 func_800730BC(s32, s32, s32, s32, s32, s32); +bool func_80072F88(s32, s32, s32, s32, s32, s32); +bool func_800730BC(s32, s32, s32, s32, s32, s32); s32 func_8007326C(s32, s32, s32, s32, s32, s32); void func_80073404(s32, u8, u8, Vtx*); void init_texture_object(s32, u8*, u8*, u8, u16); @@ -71,7 +71,7 @@ void func_80073654(s32); void func_8007369C(s32, s32); void func_800736E0(s32); void func_80073720(s32); -s32 func_8007375C(s32, s32); +bool func_8007375C(s32, s32); void func_80073800(s32, s32); void func_8007381C(s32); void func_80073844(s32); @@ -79,21 +79,21 @@ void func_80073884(s32); s32 func_800738A8(s32, s16*, s32, s32, s32, s32, s32); void func_80073998(s32, s16*, s32, s32, s32, s32, s32); void func_800739CC(s32, s16*, s32, s32, s32, s32, s32); -s32 func_80073A10(s32, s16*, s32, s32, s32, s32, s32); +bool func_80073A10(s32, s16*, s32, s32, s32, s32, s32); s32 func_80073B00(s32, s16*, s32, s32, s32, s32, s32); s32 func_80073B34(s32, s16*, s32, s32, s32, s32, s32); -s32 func_80073B78(s32, s32, s16*, s32, s32, s32, s32, s32); +bool func_80073B78(s32, s32, s16*, s32, s32, s32, s32, s32); bool func_80073CB0(s32, s16*, s32, s32, s32, s32, s32); bool func_80073D0C(s32, s16*, s32, s32, s32, s32, s32); void func_80073D68(s32, s16*, s16, s32); void func_80073DC0(s32, s16*, s16, s32); -s32 func_80073E18(s32, u16*, u16, s32); -s32 func_80073ED4(s32, u16*, u16, s32); +bool func_80073E18(s32, u16*, u16, s32); +UNUSED bool func_80073ED4(s32, u16*, u16, s32); void func_80073F90(s32, s32); void func_80073FAC(s32); void func_80073FD4(s32); void func_80074014(void); -s32 func_8007401C(s32, f32*, f32, f32, f32, s32, s32); +bool func_8007401C(s32, f32*, f32, f32, f32, s32, s32); s32 func_80074118(s32, f32*, f32, f32, f32, s32, s32); s32 func_8007415C(s32, f32*, f32, f32, f32, s32, s32); s32 func_800741B4(s32, f32*, f32, f32, f32, s32, s32); @@ -104,9 +104,9 @@ void func_80074478(s32); void func_800744A0(s32); void func_800744CC(void); void func_80074510(uintptr_t, void*, size_t); -void func_800745C8(s32, s32); -void func_8007466C(s32, s32); -void func_80074704(s32, s32); +void func_800745C8(s32, uintptr_t); +void func_8007466C(s32, uintptr_t); +void func_80074704(s32, uintptr_t); u8 *func_80074790(s32, u8*); void func_800747F0(s32, u8*); void func_80074894(s32, u8*); @@ -200,7 +200,7 @@ void func_8007A88C(s32); void func_8007A910(s32); void update_object_lakitu(s32); void func_8007AA44(s32); -void func_8007ABFC(s32, s32); +void func_8007ABFC(s32, bool); void consume_item(s32); u8 gen_random_item(s16, s16); u8 gen_random_item_human(s16, s16);