NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_mj2d_data.hpp
1#pragma once
2#include <types.h>
6class dSaveMng_c;
7
8/**
9 * @brief Represents the header of the game's save file.
10 * @ingroup bases
11 * @details
12 * The save file header contains data that is not related to a specific save slot, along with basic
13 * information required to identify the data and preserve its integrity. For the slot-specific save data,
14 * refer to dMj2dGame_c.
15 *
16 * ## Contents
17 * The header is composed by the following fields:
18 * - A region-dependent @ref mMagic "magic value". A mismatch (for example, by importing a savefile from
19 * another region) will cause the save to be marked as corrupted.
20 * - A @ref mRevision "major and minor revision number":
21 * - A different major revision number will cause the version to be updated silently
22 * (see ::versionUpdate for details).
23 * - A different minor revision number will not trigger any action.
24 * - The @ref mLastSelectedFile "last selected file". It is updated automatically when loading a save slot.
25 * - The play count for each level in both @ref mPlayCountFreeMode "free mode" and
26 * @ref mPlayCountCoinBattle "coin battle". The values are incremented by 100 every time a level is played,
27 * up to a maximum of 10000. It is unknown why this specific convention was chosen.
28 * - The @ref mMultiWorldOpenFlag "unlocked worlds" in Extra Modes. This bitfield is determined by checking
29 * if each world is unlocked in at least one of the story mode files.
30 * - A @ref mChecksum "CRC32 checksum" of all the above data, minus the magic. A mismatch (for example, by
31 * hex editing the save file and forgetting to update this value) will cause the save to be marked as
32 * corrupted.
33 * @hint{User changes to the above structure must preserve the 32 byte alignment boundary. This is a
34 * NAND level restriction.}
35 *
36 * ### Modifying the Contents
37 * Read/write access to the fields related to Extra Modes is provided through dedicated functions. All other
38 * fields are handled automatically by the game, therefore developer interaction is not required.
39 * @note Changes to data stored in this class are temporary, unless the save is flushed to NAND. This can be
40 * achieved through the dSaveMng_c class.
41 *
42 * ### Resetting the Contents
43 * To reset the contents of the header, call the ::initialize function.
44 */
46public:
47 dMj2dHeader_c(); ///< Constructs the holder.
48
49 void initialize(); ///< Initializes the header data.
50
51 /// @brief Gets the Free Mode play count for the given world/level. See ::mPlayCountFreeMode.
52 u16 getPlayCountFreeMode(int world, int level) const;
53
54 /// @brief Sets the Free Mode play count for the given world/level. See ::mPlayCountFreeMode.
55 void setPlayCountFreeMode(int world, int level, int count);
56
57 /// @brief Gets the Coin Battle play count for the given world/level. See ::mPlayCountCoinBattle.
58 u16 getPlayCountCoinBattle(int world, int level) const;
59
60 /// @brief Sets the Coin Battle play count for the given world/level. See ::mPlayCountCoinBattle.
61 void setPlayCountCoinBattle(int world, int level, int count);
62
63 void onMultiWorldOpenFlag(int world); ///< Unlocks the given world in extra modes.
64 bool isMultiWorldOpenFlag(int world); ///< Checks if the given world is unlocked in extra modes.
65
66private:
67 /// @brief Ensures that the save's major revision number matches the current one.
68 /// @details If the revision number does not match, the header data is reset.
69 void versionUpdate();
70 void setSelectFileNo(s8 file); ///< Sets the last used save data slot.
71
72 char mMagic[4]; ///< The savegame magic. See ::SAVE_MAGIC.
73 u8 mRevision[2]; ///< The save revision numbers. See ::SAVE_REVISION_MAJOR and ::SAVE_REVISION_MINOR.
74
75 u8 mLastSelectedFile; ///< The last selected save data slot.
76 u8 mUnknown7; ///< @unused Padding.
77 u16 mPlayCountFreeMode[WORLD_COUNT][STAGE_COUNT]; ///< The play count of each level in Free Mode.
78 u16 mPlayCountCoinBattle[WORLD_COUNT][STAGE_COUNT]; ///< The play count of each level in Coin Battle.
79 u16 mMultiWorldOpenFlag; ///< The worlds unlocked in Extra Modes.
80 u16 mUnknown69A; ///< @unused Padding.
81
82 u32 mChecksum; ///< The CRC32 checksum of the above data (excluding ::mMagic).
83
84 friend class dSaveMng_c;
85};
86
87/// @brief Save slot data holder.
88/// @details The data stored here is temporary, as it is discarded unless the game is saved.
89/// Size must be 32-byte aligned.
90/// @ingroup bases
92public:
93
94 /// @brief The completion status of each level.
96 COIN1_COLLECTED = BIT_FLAG(0), ///< The first Star Coin was obtained.
97 COIN2_COLLECTED = BIT_FLAG(1), ///< The second Star Coin was obtained.
98 COIN3_COLLECTED = BIT_FLAG(2), ///< The third Star Coin was obtained.
100 GOAL_NORMAL = BIT_FLAG(4), ///< The regular exit was cleared.
101 GOAL_SECRET = BIT_FLAG(5), ///< The secret exit was cleared.
102 GOAL_MASK = GOAL_NORMAL | GOAL_SECRET,
103 SUPER_GUIDE_GOAL_NORMAL = BIT_FLAG(7), ///< The regular exit was cleared with the Super Guide.
104 SUPER_GUIDE_GOAL_SECRET = BIT_FLAG(8), ///< The secret exit was cleared with the Super Guide.
105 SUPER_GUIDE_GOAL_MASK = SUPER_GUIDE_GOAL_NORMAL | SUPER_GUIDE_GOAL_SECRET
106 };
107
108 /// @brief The completion status of each world.
110 WORLD_UNLOCKED = BIT_FLAG(0)
111 };
112
113 /// @brief The overall completion status of the save slot.
115 SAVE_EMPTY = BIT_FLAG(0), ///< The slot is empty.
116 FINAL_BOSS_BEATEN = BIT_FLAG(1), ///< The final boss was beaten.
117 GOAL_ALL = BIT_FLAG(2), ///< All levels were completed.
118 COIN_ALL = BIT_FLAG(3), ///< All the Star Coins in the regular worlds were obtained.
119 COIN_ALL_SPECIAL = BIT_FLAG(4), ///< All the Star Coins in the special worlds were obtained.
120 GAME_COMPLETED = BIT_FLAG(5), ///< All the above objectives were completed.
121 SUPER_GUIDE_TRIGGERED = BIT_FLAG(6) ///< The player died at least ::SUPER_GUIDE_DEATH_COUNT times in a single stage.
122 };
123
124 /// @brief The Toad House types at the start node of each world.
125 /// @details Values marked with R are used for houses that spawn after a successful Toad Rescue mission.
127 TOAD_HOUSE_NONE,
128 TOAD_HOUSE_YELLOW,
129 TOAD_HOUSE_RED,
130 TOAD_HOUSE_GREEN,
131 TOAD_HOUSE_YELLOW_R,
132 TOAD_HOUSE_RED_R,
133 TOAD_HOUSE_GREEN_R
134 };
135
136 /// @brief Constructs the holder.
137 dMj2dGame_c();
138
139 /// @brief Deletes the holder.
141
142 void initialize(); ///< Initializes the slot data.
143
144 void setPlrID(int player, int character); ///< Sets @p player 's character. See ::PLAYER_CHARACTER_e.
145 int getPlrID(int player) const; ///< Gets @p player 's character. See ::PLAYER_CHARACTER_e.
146
147 void setPlrMode(int player, u8 powerup); ///< Sets @p player 's powerup. See ::PLAYER_POWERUP_e.
148 int getPlrMode(int player) const; ///< Gets @p player 's powerup. See ::PLAYER_POWERUP_e.
149
150 void setRest(int player, u8 lives); ///< Sets @p player 's life count.
151 int getRest(int player) const; ///< Gets @p player 's life count.
152
153 /// @brief Sets @p player 's createItem flag. See ::PLAYER_CREATE_ITEM_e.
154 /// @details Flags other than ::CREATE_ITEM_STAR_POWER are ignored.
155 void setCreateItem(int player, u8 flag);
156
157 /// @brief Gets @p player 's createItem flag. See ::PLAYER_CREATE_ITEM_e.
158 /// @details Flags other than ::CREATE_ITEM_STAR_POWER are ignored.
159 int getCreateItem(int player) const;
160
161 void setCoin(int player, s8 coins); ///< Sets @p player 's coin count.
162 s8 getCoin(int player) const; ///< Gets @p player 's coin count.
163
164 void setScore(ulong score); ///< Sets the score.
165 int getScore() const; ///< Gets the score.
166
167 void setStaffCreditHighScore(u16 score); ///< Sets the staff credit high score.
168 int getStaffCreditHighScore() const; ///< Gets the staff credit high score.
169
170 /// @brief Sets the given hint movie as bought.
171 void onOtehonMenuOpenFlag(int movie);
172
173 /// @brief Checks if the given hint movie was bought.
174 bool isOtehonMenuOpenFlag(int movie) const;
175
176 /// @brief Sets the obtained Star Coin(s) for the given world/level. See ::COURSE_COMPLETION_e.
177 /// @details Other flags are discarded.
178 void setCollectCoin(int world, int level, u8 coins);
179
180 /// @brief Gets the obtainable Star Coin count for the given world.
181 int getTotalWorldCollectCoin(int world);
182
183 /// @brief Checks if the given Star Coin has been obtained in the given world/level.
184 u8 isCollectCoin(int world, int level, int coin) const;
185
186 /// @brief Sets the starting Toad House type in the given world. See ::START_KINOKO_KIND_e.
187 void setStartKinokoKind(int world, u8 type);
188
189 /// @brief Gets the starting Toad House type in the given world. See ::START_KINOKO_KIND_e.
190 int getStartKinokoKind(int world) const;
191
192 /**
193 * @brief Sets the death count in a specific stage.
194 * @param world The world.
195 * @param level The level.
196 * @param isSwitchPressed If the worldmap switch was activated [only used for level 3-4].
197 * @param count The death count.
198 */
199 void setDeathCount(int world, int level, bool isSwitchPressed, u8 count);
200
201 /**
202 * @brief Gets the death count in a specific stage.
203 * @param world The world.
204 * @param level The level.
205 * @param isSwitchPressed If the worldmap switch was activated [only used for level 3-4].
206 * @return The death count.
207 */
208 int getDeathCount(int world, int level, bool isSwitchPressed) const;
209
210 void setContinue(int player, s8 continues); ///< Sets @p player 's continue count.
211 s8 getContinue(int player) const; ///< Gets @p player 's continue count.
212
213 void setStockItem(int item, s8 count); ///< Sets the inventory amount for the given item.
214 inline s8 getStockItem(int item) { return mStockItemCount[item]; } // [why was this inlined?]
215
216 /// @brief Checks if the completion flag(s) for the given world is set. See ::WORLD_COMPLETION_e.
217 u8 isWorldDataFlag(int world, u8 flag) const;
218
219 /// @brief Sets the specified flag(s) for the given world. See ::WORLD_COMPLETION_e.
220 void onWorldDataFlag(int world, u8 flag);
221
222 /// @brief Unsets the specified flag(s) for the given world. See ::WORLD_COMPLETION_e.
223 void offWorldDataFlag(int world, u8 flag);
224
225 /// @brief Checks if the completion flag for the given world/level is set. See ::COURSE_COMPLETION_e.
226 bool isCourseDataFlag(int world, int level, ulong flag) const;
227
228 /// @brief Sets the completion flag(s) for the given world/level. See ::COURSE_COMPLETION_e.
229 void onCourseDataFlag(int world, int level, ulong flag);
230
231 /// @brief Unsets the completion flag(s) for the given world/level. See ::COURSE_COMPLETION_e.
232 void offCourseDataFlag(int world, int level, ulong flag);
233
234 /// @brief Gets all the completion flags for the given world/level. See ::COURSE_COMPLETION_e.
235 int getCourseDataFlag(int world, int level) const;
236
237 /// @brief Sets the revival counter for the given map enemy.
238 void setCSEnemyRevivalCnt(int world, int enemy, int count);
239
240 /// @brief Gets the revival counter for the given map enemy.
241 u8 getCSEnemyRevivalCnt(int world, int enemy) const;
242
243 /// @brief Sets the subworld number for the given map enemy.
244 void setCSEnemySceneNo(int world, int enemy, u8 subworld);
245
246 /// @brief Gets the subworld number for the given map enemy.
247 u8 getCSEnemySceneNo(int world, int enemy) const;
248
249 /// @brief Sets the path node for the given map enemy.
250 void setCSEnemyPosIndex(int world, int enemy, u8 node);
251
252 /// @brief Gets the path node for the given map enemy.
253 u8 getCSEnemyPosIndex(int world, int enemy) const;
254
255 /// @brief Sets the path direction for the given map enemy.
256 /// @details Values are: 0 (forwards), 1 (backwards) and 2 (initial value).
257 /// @todo Turn the value list into an enum and move it to the appropriate section once decompiled.
258 void setCSEnemyWalkDir(int world, int enemy, u8 direction);
259
260 /// @brief Gets the path direction for the given map enemy.
261 u8 getCSEnemyWalkDir(int world, int enemy) const;
262
263 /// @brief Sets the Toad rescue level for the given world.
264 void setKinopioCourseNo(int world, int level);
265 u8 getKinopioCourseNo(int world) const; ///< Gets the Toad rescue level for the given world.
266
267 void setIbaraNow(int ibaraNow); ///< Sets the worldmap vine reshuffle counter.
268 u8 getIbaraNow() const; ///< Gets the worldmap vine reshuffle counter.
269
270private:
271 /// @brief Checks that the save data version matches the current one and clears the slot if not.
272 void versionUpdate();
273
274 /// @brief Sets the death count for World 3-4 for the worldmap switch-enabled variant.
275 void setSwitchDeathCount(u8 count);
276
277 /// @brief Gets the death count for World 3-4 for the worldmap switch-enabled variant.
278 int getSwitchDeathCount() const;
279
280 u8 mRevision[2]; ///< The save data version and subversion. See ::SAVE_REVISION_MAJOR and ::SAVE_REVISION_MINOR.
281
282 u8 mGameCompletion; ///< The overall completion of the save slot. See ::GAME_COMPLETION_e.
283
284 u8 mCurrentWorld; ///< The world the player is currently in.
285 u8 mCurrentSubWorld; ///< The subworld the player is currently in.
286 u8 mCurrentPathNode; ///< The path node the player is currently on. @todo [Verify].
287
288 /// @brief The worldmap vine reshuffle counter.
289 /// @details [Value decreases every time a level is played. If it reaches zero, the vines are moved].
291
292 u8 mSwitchOn; ///< The status of the worldmap switch.
293 u8 mUnknown8; ///< @unused
294
295 u8 mStockItemCount[POWERUP_COUNT]; ///< The inventory amount for each item.
296
297 /// @brief The starting Toad House type for each world. See ::START_KINOKO_KIND_e.
298 u8 mStartKinokoType[WORLD_COUNT];
299
300 u8 mPlayerContinue[PLAYER_COUNT]; ///< The continue count for each player.
301 s8 mPlayerCoin[PLAYER_COUNT]; ///< The coin count for each player.
302 u8 mPlayerLife[PLAYER_COUNT]; ///< The life count for each player.
303 u8 mPlayerCreateItem[PLAYER_COUNT]; ///< The Star Power flag for each player. See ::PLAYER_CREATE_ITEM_e.
304 u8 mPlayerCharacter[PLAYER_COUNT]; ///< The character for each player. See ::PLAYER_CHARACTER_e.
305 u8 mPlayerPowerup[PLAYER_COUNT]; ///< The powerup for each player. See ::PLAYER_POWERUP_e.
306
307 u8 mWorldCompletion[WORLD_COUNT]; ///< The completion flags for each world. See ::WORLD_COMPLETION_e.
308 u8 mEnemyRevivalCount[WORLD_COUNT][AMBUSH_ENEMY_COUNT]; ///< The revival counter for each map enemy.
309
310 u16 mUnknown64; ///< @unused
311 u16 mStaffRollHighScore; ///< The staff credits high score.
312 u32 mScore; ///< The regular score.
313
314 /// @brief The completion flags for each level. See ::COURSE_COMPLETION_e.
315 u32 mStageCompletion[WORLD_COUNT][STAGE_COUNT];
316 bool mOtehonMenuOpen[HINT_MOVIE_COUNT]; ///< The hint movie bought status for each movie.
317 u8 mKinopioCourseNo[WORLD_COUNT]; ///< The Toad Rescue level for each world.
318
319 u8 mEnemySceneNo[WORLD_COUNT][AMBUSH_ENEMY_COUNT]; ///< The subworld number for each map enemy.
320 u8 mEnemyPosIndex[WORLD_COUNT][AMBUSH_ENEMY_COUNT]; ///< The path node for each map enemy.
321 u8 mEnemyWalkDir[WORLD_COUNT][AMBUSH_ENEMY_COUNT]; ///< The movement direction for each map enemy.
322
323 /// @brief The death count for each level.
324 /// @details The value is cumulative, and not reset after clearing the level.
325 u8 mDeathCount[WORLD_COUNT][STAGE_COUNT];
326 u8 mDeathCountSwitch; ///< The death count for the worldmap switch variant of World 3-4. See ::mDeathCount.
327
328 u8 pad[0x13]; // [Aligns the data to 32]
329 u32 mChecksum; ///< The CRC32 checksum of the above data.
330
331 /// @brief The default character for each player.
332 /// @unofficial
333 static const u32 sDefaultCharacters[4];
334
335 friend class dSaveMng_c;
336};
u8 getCSEnemyPosIndex(int world, int enemy) const
Gets the path node for the given map enemy.
GAME_COMPLETION_e
The overall completion status of the save slot.
@ FINAL_BOSS_BEATEN
The final boss was beaten.
@ COIN_ALL
All the Star Coins in the regular worlds were obtained.
@ GAME_COMPLETED
All the above objectives were completed.
@ SUPER_GUIDE_TRIGGERED
The player died at least SUPER_GUIDE_DEATH_COUNT times in a single stage.
@ GOAL_ALL
All levels were completed.
@ COIN_ALL_SPECIAL
All the Star Coins in the special worlds were obtained.
@ SAVE_EMPTY
The slot is empty.
int getSwitchDeathCount() const
Gets the death count for World 3-4 for the worldmap switch-enabled variant.
s8 getContinue(int player) const
Gets player 's continue count.
u8 mIbaraNow
The worldmap vine reshuffle counter.
u32 mStageCompletion[WORLD_COUNT][STAGE_COUNT]
The completion flags for each level. See COURSE_COMPLETION_e.
WORLD_COMPLETION_e
The completion status of each world.
int getStartKinokoKind(int world) const
Gets the starting Toad House type in the given world. See START_KINOKO_KIND_e.
void offCourseDataFlag(int world, int level, ulong flag)
Unsets the completion flag(s) for the given world/level. See COURSE_COMPLETION_e.
u16 mUnknown64
[Unused].
u8 mSwitchOn
The status of the worldmap switch.
void setScore(ulong score)
Sets the score.
u8 mEnemySceneNo[WORLD_COUNT][AMBUSH_ENEMY_COUNT]
The subworld number for each map enemy.
void setSwitchDeathCount(u8 count)
Sets the death count for World 3-4 for the worldmap switch-enabled variant.
void setStockItem(int item, s8 count)
Sets the inventory amount for the given item.
u8 mPlayerContinue[PLAYER_COUNT]
The continue count for each player.
void setCSEnemySceneNo(int world, int enemy, u8 subworld)
Sets the subworld number for the given map enemy.
bool mOtehonMenuOpen[HINT_MOVIE_COUNT]
The hint movie bought status for each movie.
u8 getCSEnemySceneNo(int world, int enemy) const
Gets the subworld number for the given map enemy.
u16 mStaffRollHighScore
The staff credits high score.
u8 mPlayerCreateItem[PLAYER_COUNT]
The Star Power flag for each player. See PLAYER_CREATE_ITEM_e.
u8 getCSEnemyWalkDir(int world, int enemy) const
Gets the path direction for the given map enemy.
void setContinue(int player, s8 continues)
Sets player 's continue count.
void setPlrID(int player, int character)
Sets player 's character. See PLAYER_CHARACTER_e.
u8 mEnemyRevivalCount[WORLD_COUNT][AMBUSH_ENEMY_COUNT]
The revival counter for each map enemy.
void initialize()
Initializes the slot data.
u8 mPlayerPowerup[PLAYER_COUNT]
The powerup for each player. See PLAYER_POWERUP_e.
void onCourseDataFlag(int world, int level, ulong flag)
Sets the completion flag(s) for the given world/level. See COURSE_COMPLETION_e.
START_KINOKO_KIND_e
The Toad House types at the start node of each world.
u8 getCSEnemyRevivalCnt(int world, int enemy) const
Gets the revival counter for the given map enemy.
void setRest(int player, u8 lives)
Sets player 's life count.
int getRest(int player) const
Gets player 's life count.
void setStaffCreditHighScore(u16 score)
Sets the staff credit high score.
u32 mScore
The regular score.
u8 isWorldDataFlag(int world, u8 flag) const
Checks if the completion flag(s) for the given world is set. See WORLD_COMPLETION_e.
void setDeathCount(int world, int level, bool isSwitchPressed, u8 count)
Sets the death count in a specific stage.
u8 mStockItemCount[POWERUP_COUNT]
The inventory amount for each item.
u8 mDeathCount[WORLD_COUNT][STAGE_COUNT]
The death count for each level.
void setIbaraNow(int ibaraNow)
Sets the worldmap vine reshuffle counter.
void setCSEnemyPosIndex(int world, int enemy, u8 node)
Sets the path node for the given map enemy.
void setStartKinokoKind(int world, u8 type)
Sets the starting Toad House type in the given world. See START_KINOKO_KIND_e.
u8 mCurrentPathNode
The path node the player is currently on.
u8 mGameCompletion
The overall completion of the save slot. See GAME_COMPLETION_e.
u8 mEnemyWalkDir[WORLD_COUNT][AMBUSH_ENEMY_COUNT]
The movement direction for each map enemy.
int getCourseDataFlag(int world, int level) const
Gets all the completion flags for the given world/level. See COURSE_COMPLETION_e.
COURSE_COMPLETION_e
The completion status of each level.
@ SUPER_GUIDE_GOAL_NORMAL
The regular exit was cleared with the Super Guide.
@ GOAL_NORMAL
The regular exit was cleared.
@ GOAL_SECRET
The secret exit was cleared.
@ COIN1_COLLECTED
The first Star Coin was obtained.
@ COIN3_COLLECTED
The third Star Coin was obtained.
@ SUPER_GUIDE_GOAL_SECRET
The secret exit was cleared with the Super Guide.
@ COIN2_COLLECTED
The second Star Coin was obtained.
int getDeathCount(int world, int level, bool isSwitchPressed) const
Gets the death count in a specific stage.
void setPlrMode(int player, u8 powerup)
Sets player 's powerup. See PLAYER_POWERUP_e.
void setCSEnemyRevivalCnt(int world, int enemy, int count)
Sets the revival counter for the given map enemy.
int getScore() const
Gets the score.
u8 isCollectCoin(int world, int level, int coin) const
Checks if the given Star Coin has been obtained in the given world/level.
u32 mChecksum
The CRC32 checksum of the above data.
int getPlrID(int player) const
Gets player 's character. See PLAYER_CHARACTER_e.
void setCreateItem(int player, u8 flag)
Sets player 's createItem flag. See PLAYER_CREATE_ITEM_e.
u8 mPlayerCharacter[PLAYER_COUNT]
The character for each player. See PLAYER_CHARACTER_e.
void setCollectCoin(int world, int level, u8 coins)
Sets the obtained Star Coin(s) for the given world/level. See COURSE_COMPLETION_e.
u8 mPlayerLife[PLAYER_COUNT]
The life count for each player.
void versionUpdate()
Checks that the save data version matches the current one and clears the slot if not.
bool isCourseDataFlag(int world, int level, ulong flag) const
Checks if the completion flag for the given world/level is set. See COURSE_COMPLETION_e.
void offWorldDataFlag(int world, u8 flag)
Unsets the specified flag(s) for the given world. See WORLD_COMPLETION_e.
int getPlrMode(int player) const
Gets player 's powerup. See PLAYER_POWERUP_e.
u8 mUnknown8
[Unused].
u8 mDeathCountSwitch
The death count for the worldmap switch variant of World 3-4. See mDeathCount.
u8 mCurrentSubWorld
The subworld the player is currently in.
void onOtehonMenuOpenFlag(int movie)
Sets the given hint movie as bought.
u8 mRevision[2]
The save data version and subversion. See SAVE_REVISION_MAJOR and SAVE_REVISION_MINOR.
bool isOtehonMenuOpenFlag(int movie) const
Checks if the given hint movie was bought.
~dMj2dGame_c()
Deletes the holder.
void onWorldDataFlag(int world, u8 flag)
Sets the specified flag(s) for the given world. See WORLD_COMPLETION_e.
void setKinopioCourseNo(int world, int level)
Sets the Toad rescue level for the given world.
u8 mCurrentWorld
The world the player is currently in.
u8 mEnemyPosIndex[WORLD_COUNT][AMBUSH_ENEMY_COUNT]
The path node for each map enemy.
u8 mKinopioCourseNo[WORLD_COUNT]
The Toad Rescue level for each world.
u8 mWorldCompletion[WORLD_COUNT]
The completion flags for each world. See WORLD_COMPLETION_e.
s8 mPlayerCoin[PLAYER_COUNT]
The coin count for each player.
void setCoin(int player, s8 coins)
Sets player 's coin count.
dMj2dGame_c()
Constructs the holder.
u8 mStartKinokoType[WORLD_COUNT]
The starting Toad House type for each world. See START_KINOKO_KIND_e.
int getTotalWorldCollectCoin(int world)
Gets the obtainable Star Coin count for the given world.
int getCreateItem(int player) const
Gets player 's createItem flag. See PLAYER_CREATE_ITEM_e.
u8 getKinopioCourseNo(int world) const
Gets the Toad rescue level for the given world.
static const u32 sDefaultCharacters[4]
The default character for each player.
s8 getCoin(int player) const
Gets player 's coin count.
void setCSEnemyWalkDir(int world, int enemy, u8 direction)
Sets the path direction for the given map enemy.
int getStaffCreditHighScore() const
Gets the staff credit high score.
u8 getIbaraNow() const
Gets the worldmap vine reshuffle counter.
void setPlayCountFreeMode(int world, int level, int count)
Sets the Free Mode play count for the given world/level. See mPlayCountFreeMode.
u16 mPlayCountFreeMode[WORLD_COUNT][STAGE_COUNT]
The play count of each level in Free Mode.
u8 mUnknown7
[Unused]. Padding.
bool isMultiWorldOpenFlag(int world)
Checks if the given world is unlocked in extra modes.
char mMagic[4]
The savegame magic. See SAVE_MAGIC.
u16 mPlayCountCoinBattle[WORLD_COUNT][STAGE_COUNT]
The play count of each level in Coin Battle.
void initialize()
Initializes the header data.
dMj2dHeader_c()
Constructs the holder.
void versionUpdate()
Ensures that the save's major revision number matches the current one.
void setPlayCountCoinBattle(int world, int level, int count)
Sets the Coin Battle play count for the given world/level. See mPlayCountCoinBattle.
u16 getPlayCountFreeMode(int world, int level) const
Gets the Free Mode play count for the given world/level. See mPlayCountFreeMode.
void setSelectFileNo(s8 file)
Sets the last used save data slot.
u8 mRevision[2]
The save revision numbers. See SAVE_REVISION_MAJOR and SAVE_REVISION_MINOR.
u16 mMultiWorldOpenFlag
The worlds unlocked in Extra Modes.
u32 mChecksum
The CRC32 checksum of the above data (excluding mMagic).
void onMultiWorldOpenFlag(int world)
Unlocks the given world in extra modes.
u8 mLastSelectedFile
The last selected save data slot.
u16 mUnknown69A
[Unused]. Padding.
u16 getPlayCountCoinBattle(int world, int level) const
Gets the Coin Battle play count for the given world/level. See mPlayCountCoinBattle.
#define HINT_MOVIE_COUNT
The total hint movie count.
#define AMBUSH_ENEMY_COUNT
The maximum amount of ambush enemies per world map.