Skip to content

Commit

Permalink
Merge branch 'master' into vtx_extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaMech authored Sep 27, 2023
2 parents 62209d7 + 26923a3 commit d08ae79
Show file tree
Hide file tree
Showing 29 changed files with 2,945 additions and 325 deletions.
2,658 changes: 2,658 additions & 0 deletions Doxyfile

Large diffs are not rendered by default.

19 changes: 0 additions & 19 deletions include/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,11 @@
#include "common_structs.h"

extern s8 gCharacterIdByGPOverallRank[8]; // D_8018D9D0
extern s8 gCharacterGridSelections[4]; // D_8018EDE4
extern s8 gCharacterSelections[4]; // D_800E86A8
extern s8 gControllerPakMenuSelection; // D_8018EDF0
extern s8 gControllerPakSelectedTableRow; // D_800E86C0
extern f32 gCourseCompletionPercentByPlayerId[8]; // D_801644D0
extern f32 gCourseCompletionPercentByRank[8]; // D_80162FD8
extern s8 gCourseRecordsMenuSelection; // D_8018EDF8
extern const s16 gCupCourseOrder[NUM_CUPS][NUM_COURSES_PER_CUP]; // D_800F2BB4
extern s8 gCupCourseSelection; // D_8018EE0B
extern char *gCupNames[]; // D_800E7500
extern s8 gCupSelection; // D_8018EE09
extern s16 gCurrentCourseId; // D_800DC5A0

extern s8 gDebugMenuSelection; // D_8018EDEF

extern s8 gGPPointsByCharacterId[8]; // D_8018D9C8
extern s16 gGPCurrentRacePlayerIdByRank[8]; // D_80164360

Expand All @@ -31,22 +21,15 @@ extern s32 gIsMirrorMode; // D_800DC604
extern f32 gLapCompletionPercentByPlayerId[8]; // D_801644A8
extern s32 gLapCountByPlayerId[8]; // D_80164390

extern s32 gMenuTimingCounter; // D_8018EE00
extern s32 gMenuSelection; // D_800E86A0

// Indicates the ID of the next title screen demo that will be played
extern s8 gNextDemoId; // D_800E86BC

// Maps course IDs (as defined in the COURSES enum) to an index in a given cup's track order
extern const u8 gPerCupIndexByCourseId[]; // D_800EFD50
extern s32 gPlayerIsThrottleActive[]; // D_801653E0
extern s32 gGPCurrentRaceRankByPlayerId[]; // D_801643B8

extern u8 gSoundMode; // D_8018EDF2
extern char *gSoundModeNames[NUM_SOUND_MODES]; // D_800E7710

extern s8 gTimeTrialDataCourseIndex; // D_8018EDF7

extern struct_8018CA70_entry D_8018CA70[];

extern Mtx D_80183D60[];
Expand Down Expand Up @@ -120,6 +103,4 @@ extern s8 D_801658FE;
extern s32 gMatrixHudCount;
extern s32 D_8018D900[];

extern s8 D_8018EDEC;

#endif
38 changes: 19 additions & 19 deletions src/camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,16 @@ void func_8001CCEC(Player *player, Camera *camera, Vec3f arg2, f32 *arg3, f32 *a
move_f32_towards(&D_80164A38[index], 20.0f, 0.1f);
move_f32_towards(&D_80164A48[index], 1.5f, 0.1f);
D_80164A78[index] += 0.1;
if (D_80164A78[index] >= 1)
if (D_80164A78[index] >= 1)
D_80164A78[index] = 1;

} else {
move_f32_towards(&D_80164A38[index], 0, 0.1f);
move_f32_towards(&D_80164A48[index], 0, 0.1f);
D_80164A78[index] -= 0.1;
if (D_800DDB30[gActiveScreenMode] >= D_80164A78[index])
if (D_800DDB30[gActiveScreenMode] >= D_80164A78[index])
D_80164A78[index] = D_800DDB30[gActiveScreenMode];

}
if ((player->unk_0CA & 0x100) == 0x100) {
switch(gActiveScreenMode) {
Expand Down Expand Up @@ -364,7 +364,7 @@ void func_8001CCEC(Player *player, Camera *camera, Vec3f arg2, f32 *arg3, f32 *a

arg2[0] += (x - camera->lookAt[0]) * D_80164A78[index];
arg2[2] += ((z - camera->lookAt[2]) * D_80164A78[index]);

if ((((player->unk_094 / 18) * 216) <= 5.0f) && ((player->unk_0BC & 2) == 2)) {
arg2[1] += ((y - camera->lookAt[1]) * 0.02);
} else {
Expand All @@ -383,7 +383,7 @@ void func_8001CCEC(Player *player, Camera *camera, Vec3f arg2, f32 *arg3, f32 *a

*arg3 = camera->pos[0] + ((x - camera->pos[0]) * D_80164A78[index]);
*arg5 = camera->pos[2] + ((z - camera->pos[2]) * D_80164A78[index]);

if ((((player->unk_094 / 18) * 216) <= 5.0f) && ((player->unk_0BC & 2) == 2)) {
*arg4 = camera->pos[1] + (((y - camera->pos[1]) * 0.01));
} else {
Expand Down Expand Up @@ -541,19 +541,19 @@ void func_8001D944(Player *player, Camera *camera, Vec3f arg2, f32 *arg3, f32 *a
move_f32_towards(&D_80164A38[index], 20.0f, 0.1f);
move_f32_towards(&D_80164A48[index], 1.5f, 0.1f);
D_80164A78[index] += 0.1;
if (D_80164A78[index] >= 1)
if (D_80164A78[index] >= 1)
D_80164A78[index] = 1;

} else {
move_f32_towards(&D_80164A38[index], 0, 0.1f);
move_f32_towards(&D_80164A48[index], 0, 0.1f);
D_80164A78[index] -= 0.1;
if (D_800DDB30[gActiveScreenMode] >= D_80164A78[index])
if (D_800DDB30[gActiveScreenMode] >= D_80164A78[index])
D_80164A78[index] = D_800DDB30[gActiveScreenMode];

}
if ((player->unk_0CA & 0x100) == 0x100) {

move_f32_towards(&D_80164A90[index], 15, 0.02f);
move_f32_towards(&D_80164AA0[index], 20, 0.02f);
} else {
Expand Down Expand Up @@ -581,7 +581,7 @@ void func_8001D944(Player *player, Camera *camera, Vec3f arg2, f32 *arg3, f32 *a

arg2[0] += (x - camera->lookAt[0]) * D_80164A78[index];
arg2[2] += ((z - camera->lookAt[2]) * D_80164A78[index]);

if ((((player->unk_094 / 18) * 216) <= 5.0f) && ((player->unk_0BC & 2) == 2)) {
arg2[1] += ((y - camera->lookAt[1]) * 0.02);
} else {
Expand All @@ -600,7 +600,7 @@ void func_8001D944(Player *player, Camera *camera, Vec3f arg2, f32 *arg3, f32 *a

*arg3 = camera->pos[0] + ((x - camera->pos[0]) * D_80164A78[index]);
*arg5 = camera->pos[2] + ((z - camera->pos[2]) * D_80164A78[index]);

if ((((player->unk_094 / 18) * 216) <= 5.0f) && ((player->unk_0BC & 2) == 2)) {
*arg4 = camera->pos[1] + (((y - camera->pos[1]) * 0.01));
} else {
Expand Down Expand Up @@ -733,9 +733,9 @@ void func_8001E45C(Camera *camera, Player *player, s8 arg2) {
var_a3 = (player->unk_078 / 2) + 0xA5;
}
}
if (((player->unk_0BC & 0x80) == 0x80) || ((player->unk_0BC & 0x40) == 0x40) ||
((player->unk_0BC & 0x4000) == 0x4000) || ((player->unk_0BC & 0x80000) == 0x80000) ||
((player->unk_0BC & 0x800000) == 0x800000) || (((player->unk_0BC & 0x20) == 0x20) && (player->unk_078 != 0)) ||
if (((player->unk_0BC & 0x80) == 0x80) || ((player->unk_0BC & 0x40) == 0x40) ||
((player->unk_0BC & 0x4000) == 0x4000) || ((player->unk_0BC & 0x80000) == 0x80000) ||
((player->unk_0BC & 0x800000) == 0x800000) || (((player->unk_0BC & 0x20) == 0x20) && (player->unk_078 != 0)) ||
(player->unk_110.unk3C[0] <= 0.0f) || (player->unk_110.unk3C[1] <= 0.0f) || ((player->unk_0BC & 0x20000) == 0x20000)) {
func_8001CCEC(player, camera, sp64, &sp84, &sp80, &sp7C, &sp58, (s32) camera->unk_2C, (s32) arg2);
} else {
Expand Down Expand Up @@ -862,9 +862,9 @@ void func_8001EA0C(Camera *camera, Player *player, s8 arg2) {
var_a3 = (player->unk_078 / 2) + 0xA5;
}
}
if (((player->unk_0BC & 0x80) == 0x80) || ((player->unk_0BC & 0x40) == 0x40) ||
((player->unk_0BC & 0x4000) == 0x4000) || ((player->unk_0BC & 0x80000) == 0x80000) ||
((player->unk_0BC & 0x800000) == 0x800000) || (((player->unk_0BC & 0x20) == 0x20) && (player->unk_078 != 0)) ||
if (((player->unk_0BC & 0x80) == 0x80) || ((player->unk_0BC & 0x40) == 0x40) ||
((player->unk_0BC & 0x4000) == 0x4000) || ((player->unk_0BC & 0x80000) == 0x80000) ||
((player->unk_0BC & 0x800000) == 0x800000) || (((player->unk_0BC & 0x20) == 0x20) && (player->unk_078 != 0)) ||
(player->unk_110.unk3C[0] <= 0.0f) || (player->unk_110.unk3C[1] <= 0.0f) || ((player->unk_0BC & 0x20000) == 0x20000)) {
func_8001D944(player, camera, sp64, &sp84, &sp80, &sp7C, &sp58, (s32) camera->unk_2C, (s32) arg2);
} else {
Expand Down
19 changes: 11 additions & 8 deletions src/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,19 @@ void func_8001E0C4(Camera*, Player*, s8);
void func_8001E45C(Camera*, Player*, s8);
void func_8001E8E8(Camera*, Player*, s8);
void func_8001EA0C(Camera*, Player*, s8);
void func_8001F87C(s32);
void func_8001EE98(Player*, Camera*, s8);
void func_8001F394(Player*, f32*);
void func_8001F87C(s32);

extern f32 D_800DDB30[];

extern Camera cameras[];
extern Camera *camera1;
extern Camera *camera2;
extern Camera *camera3;
extern Camera *camera4;

// end of camera.c variables

extern s8 D_80164A89;

Expand All @@ -81,12 +91,5 @@ extern f32 D_80164A30;
extern f32 D_80164A90[];
extern f32 D_80164AA0[];

extern f32 D_800DDB30[];

extern Camera cameras[];
extern Camera *camera1;
extern Camera *camera2;
extern Camera *camera3;
extern Camera *camera4;

#endif
7 changes: 1 addition & 6 deletions src/code_800029B0.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "render_courses.h"
#include "main.h"
#include "courses/all_course_data.h"
#include "menus.h"

extern u16 D_800DC5A8;

Expand All @@ -29,12 +30,6 @@ extern s16 D_802BA048;

extern s16 gCurrentlyLoadedCourseId;

extern s8 D_8018EDF3;

extern s8 gCupSelection;

extern Vec3f D_802B91C8;

extern struct ActorSpawnData d_course_moo_moo_farm_tree_spawn[];


Expand Down
2 changes: 1 addition & 1 deletion src/code_80005FD0.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "common_textures.h"
#include "common_structs.h"
#include "main.h"

#include "menus.h"

extern UnkCommonTextureStruct0 *D_800DC720[];

Expand Down
2 changes: 0 additions & 2 deletions src/code_80005FD0.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@ void func_8001C42C(void);
/* This is where I'd put my static data, if I had any */
// 0 or 1, only 1 when when in extra (mirror) mode
extern s16 D_8016347A;
// Might belong in menus.h?
extern s8 D_8018EDF3;

// Suspected to be the "width" of each wayPoint. See data_0DD0A0_1.s
extern f32 D_800DCA4C[];
Expand Down
1 change: 1 addition & 0 deletions src/code_80057C60.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "audio/external.h"
#include "objects.h"
#include "bomb_kart.h"
#include "menus.h"


// WARNING: this macro is undef'd at the end of this file
Expand Down
1 change: 0 additions & 1 deletion src/code_80057C60.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ void func_8006E940(Player*, s8, s8);
extern s8 D_801657B2;
extern s8 D_801657C8;
extern s32 D_8018D22C;
extern s8 D_8018EDF3;
extern s8 D_80165898;
extern Gfx D_0D0076F8[];
extern s8 D_801657E4;
Expand Down
1 change: 1 addition & 0 deletions src/code_8006E9C0.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "audio/external.h"
#include "courses/all_course_data.h"
#include "main.h"
#include "menus.h"

void func_8006E9C0(void) {

Expand Down
1 change: 0 additions & 1 deletion src/code_8006E9C0.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ extern s16 D_80165730;
extern s16 D_80165740;
extern s16 D_80165748;
extern s32 D_80183D5C;
extern s8 D_8018EDF3;
extern u8 *D_8018D1E0;
extern intptr_t D_8018D9B0;

Expand Down
1 change: 1 addition & 0 deletions src/code_80071F00.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "code_80091750.h"
#include "podium_ceremony_actors.h"
#include "courses/all_course_data.h"
#include "menus.h"

// TODO: unused?
f32 D_800E43B0[] = {
Expand Down
2 changes: 0 additions & 2 deletions src/code_80071F00.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,6 @@ void func_80086D80(void);
s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQueue *mq);
s32 osRecvMesg(OSMesgQueue*, OSMesg*, s32);

extern s8 D_8018EDF3;

// from other_textures.s
extern u8 D_0F0D0E50[]; // gTextureGhosts

Expand Down
10 changes: 0 additions & 10 deletions src/code_80091750.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ extern s32 D_800DDB24;
extern s16 D_80164478[];
extern u8 *D_8018D9BC;

extern s8 D_800E86D0[];
extern s32 D_80165754;
extern intptr_t D_8018D9B0;
extern s8 D_8018D9D8;
Expand All @@ -370,15 +369,6 @@ extern s32 D_8018E850[];
extern s32 D_8018E854;
extern s32 D_8018E858[];
extern s32 D_8018E85C;
extern s32 D_8018EDC0;
extern f32 D_8018EDC4;
extern f32 D_8018EDC8;
extern f32 D_8018EDCC;
extern f32 D_8018EDD0;
extern f32 D_8018EDD4;
extern f32 D_8018EDD8;
extern f32 D_8018EDDC;
extern s8 D_8018EE08;

extern s32 D_8018E7B8[];
extern s32 D_8018E7E0;
Expand Down
1 change: 0 additions & 1 deletion src/code_800AF9B0.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ void func_800B0004(void);

extern s16 gCurrentCourseId; // D_800DC5A0
extern s32 gIsMirrorMode; // D_800DC5F4
extern s32 D_800E86A4;

#endif /* CODE_800AF9B0_H */
7 changes: 0 additions & 7 deletions src/code_800B45E0.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ extern u32* D_800DC714;
extern u16 gCompanyCode;
extern u32 gGameCode; // osPfs gamecode
extern s8 gControllerPak1State; // Current state of Controller Pak 1
extern struct_8018EE10_entry D_8018EE10[];
extern struct_8018EE10_entry *D_8018D9C0;

extern s8 sControllerPak2State; // Current state of the Controller Pak 2
Expand All @@ -111,12 +110,6 @@ extern s32 gControllerPak1MaxWriteableFiles;
extern s8 D_8018EDE5;
extern s8 D_8018EDE6;
extern s8 D_8018EDE7;
extern u8 gSoundMode; // D_8018EDF2
extern s8 gTimeTrialDataCourseIndex; // D_8018EDF7
extern s8 gCourseRecordsMenuSelection; // D_8018EDF8
extern s32 gMenuTimingCounter; // D_8018EE00
extern s8 gCupSelection; // D_8018EE09
extern s8 gCupCourseSelection; // D_8018EE0B


#endif /* CODE_800B045E0_H */
1 change: 1 addition & 0 deletions src/ending/code_80281780.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "code_80281C40.h"
#include "code_800029B0.h"
#include "main.h"
#include "menus.h"

u8 defaultCharacterIds[] = {
1, 2, 3, 4, 5, 6, 7, 0
Expand Down
3 changes: 0 additions & 3 deletions src/ending/code_80281780.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,8 @@ extern s32 D_00825800;
extern s32 D_00831DC0;
extern s32 D_00835BA0;

extern s8 gCharacterSelections[];

extern u8 defaultCharacterIds[];
extern s8 gGPOverallRanks[8];
extern s8 D_8018EDF3;

extern u8 *_data_821D10SegmentRomStart;
extern u8 *_data_825800SegmentRomStart;
Expand Down
6 changes: 3 additions & 3 deletions src/kart_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1684,9 +1684,9 @@ u8 *gKartPalettes[] = {
/**
* @brief Place DMA mio0 compressed character textures in a buffer.
* Later, this data becomes decompressed.
*
*
* The player struct tracks the texture indices to load.
*
*
* @param player
* @param arg1 Appears to be character index; 0-7.
* @param arg2 Rom buffer index appears to always be 0-3. Sometimes subtracted by 2.
Expand Down Expand Up @@ -1730,7 +1730,7 @@ void func_80027560(Player *player, s8 arg1, s8 arg2, s8 arg3, s8 arg4) {
osInvalDCache(&D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId]);
osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId], &gDmaMesgQueue);
}
} else if (((temp & 0x400) == 0x400) || ((temp & 0x01000000) == 0x01000000) ||
} else if (((temp & 0x400) == 0x400) || ((temp & 0x01000000) == 0x01000000) ||
((temp & 0x02000000) == 0x02000000) || ((temp & 0x10000) == 0x10000))
{
osInvalDCache(&D_802DFB80[arg4][arg3][arg1], 0x780);
Expand Down
Loading

0 comments on commit d08ae79

Please sign in to comment.