|
16 | 16 |
|
17 | 17 | #define TIME_RECORDS_PER_COURSE 3 |
18 | 18 |
|
| 19 | +#if (GAME == GAME_SA1) |
| 20 | +typedef u8 PlayerNameChar; |
| 21 | +typedef u32 TimeRecord; |
| 22 | +#elif (GAME == GAME_SA2) |
| 23 | +typedef u16 PlayerNameChar; |
| 24 | +typedef u16 TimeRecord; |
| 25 | +#endif |
| 26 | + |
| 27 | +#if (GAME == GAME_SA1) |
| 28 | +struct TimeRecords { |
| 29 | + TimeRecord table[NUM_CHARACTERS][NUM_LEVEL_IDS][TIME_RECORDS_PER_COURSE]; |
| 30 | +}; |
| 31 | + |
19 | 32 | struct MultiplayerScore { |
20 | 33 | u32 playerId; |
21 | | - u16 playerName[MAX_PLAYER_NAME_LENGTH]; |
22 | | - |
23 | | - bool8 slotFilled; |
| 34 | + // TODO/NOTE: Only 6 chars are displayed, but the string is treated 8-char wide |
| 35 | + PlayerNameChar playerName[MAX_PLAYER_NAME_LENGTH + 2]; |
24 | 36 |
|
25 | 37 | u8 wins; |
26 | 38 | u8 losses; |
27 | 39 | u8 draws; |
28 | 40 | }; |
29 | 41 |
|
| 42 | +#define NUM_TIME_RECORD_ROWS (NUM_CHARACTERS * NUM_LEVEL_IDS * TIME_RECORDS_PER_COURSE) |
| 43 | + |
| 44 | +typedef struct SaveGame { |
| 45 | + /* 0x000 */ u8 filler0[0x4]; |
| 46 | + /* 0x004 */ s32 unk4; |
| 47 | + /* 0x008 */ u16 unk8[4]; |
| 48 | + /* 0x010 */ PlayerNameChar playerName[MAX_PLAYER_NAME_LENGTH]; |
| 49 | + /* 0x016 */ u8 unk16; |
| 50 | + /* 0x017 */ u8 unk17; |
| 51 | + /* 0x018 */ u8 unk18; |
| 52 | + /* 0x019 */ u8 unk19; |
| 53 | + /* 0x01A */ u8 language; |
| 54 | + /* 0x01B */ u8 unk1B; |
| 55 | + /* 0x01C */ u8 unk1C; |
| 56 | + /* 0x020 */ struct TimeRecords timeRecords; |
| 57 | + /* 0x2AC */ struct MultiplayerScore multiplayerScores[NUM_MULTIPLAYER_SCORES]; |
| 58 | + /* 0x420 */ u32 unk420; |
| 59 | + /* 0x424 */ u8 filler424[0x4]; |
| 60 | + /* 0x428 */ u32 score; |
| 61 | + /* 0x42C */ u8 filler42C[0x4]; |
| 62 | +} SaveGame; /* 0x430 */ |
| 63 | + |
| 64 | +// NOTE: Not a pointer in SA1! |
| 65 | +extern struct SaveGame gLoadedSaveGame; |
| 66 | +#elif (GAME == GAME_SA2) |
30 | 67 | struct TimeRecords { |
31 | | - // TODO: s16? |
32 | | - u16 table[NUM_CHARACTERS][NUM_COURSE_ZONES][ACTS_PER_ZONE][TIME_RECORDS_PER_COURSE]; |
| 68 | + TimeRecord table[NUM_CHARACTERS][NUM_TIME_ATTACK_ZONES][ACTS_PER_ZONE][TIME_RECORDS_PER_COURSE]; |
33 | 69 | }; |
34 | 70 |
|
35 | | -#define NUM_TIME_RECORD_ROWS (NUM_COURSE_ZONES * ACTS_PER_ZONE * NUM_CHARACTERS * TIME_RECORDS_PER_COURSE) |
| 71 | +#define NUM_TIME_RECORD_ROWS (NUM_TIME_ATTACK_ZONES * ACTS_PER_ZONE * NUM_CHARACTERS * TIME_RECORDS_PER_COURSE) |
36 | 72 |
|
37 | | -#if (GAME == GAME_SA1) |
38 | | -struct SaveGame { |
39 | | - /* 0x10 */ u16 playerName[MAX_PLAYER_NAME_LENGTH]; |
40 | | - /* 0x1A */ u8 language; |
| 73 | +struct MultiplayerScore { |
| 74 | + u32 playerId; |
| 75 | + PlayerNameChar playerName[MAX_PLAYER_NAME_LENGTH]; |
41 | 76 |
|
42 | | - /* 0x428 */ u32 score; |
43 | | -} |
| 77 | + bool8 slotFilled; |
44 | 78 |
|
45 | | -// NOTE: Not a pointer in SA1! |
46 | | -extern struct SaveGame gLoadedSaveGame; |
47 | | -#elif (GAME == GAME_SA2) |
48 | | -struct SaveGame { |
| 79 | + u8 wins; |
| 80 | + u8 losses; |
| 81 | + u8 draws; |
| 82 | +}; |
| 83 | + |
| 84 | +typedef struct SaveGame { |
49 | 85 | /* 0x000 */ u32 id; |
50 | 86 |
|
51 | 87 | /* 0x004 */ u8 difficultyLevel; |
@@ -76,7 +112,7 @@ struct SaveGame { |
76 | 112 | /* 0x034 */ struct TimeRecords timeRecords; |
77 | 113 | /* 0x2AC */ struct MultiplayerScore multiplayerScores[NUM_MULTIPLAYER_SCORES]; |
78 | 114 | /* 0x374 */ u32 score; |
79 | | -}; |
| 115 | +} SaveGame; |
80 | 116 |
|
81 | 117 | extern struct SaveGame *gLoadedSaveGame; |
82 | 118 | #endif |
|
0 commit comments