summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPheenoh <pheenoh@gmail.com>2021-05-12 21:06:05 -0400
committerPheenoh <pheenoh@gmail.com>2021-05-12 21:06:05 -0400
commite89ded1cc1902cb3602f08a22e82b8d464f127c9 (patch)
treed27c0b6ff679f9e2865a403b6d3e7fd5a1b4e8f8
parentd205963aeff2732016c0d82066ce2aa43c39bb03 (diff)
fix hundo special bug
-rw-r--r--include/save_manager.h4
-rw-r--r--src/commands.cpp2
-rw-r--r--src/save_manager.cpp31
3 files changed, 18 insertions, 19 deletions
diff --git a/include/save_manager.h b/include/save_manager.h
index 295a305..2e1ab91 100644
--- a/include/save_manager.h
+++ b/include/save_manager.h
@@ -137,6 +137,4 @@ struct GZSaveFile {
uint32_t offsets[GZ_SAVE_ENTRIES_AMNT];
uint32_t sizes[GZ_SAVE_ENTRIES_AMNT];
GZSaveLayout data;
-};
-
-extern special HundoSpecials[HND_SPECIALS_AMNT]; \ No newline at end of file
+}; \ No newline at end of file
diff --git a/src/commands.cpp b/src/commands.cpp
index f114bfc..dce0bae 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -90,7 +90,7 @@ void reload_area() {
gSaveManager.mPracticeFileOpts.inject_options_during_load = nullptr;
gSaveManager.mPracticeFileOpts.inject_options_after_load = nullptr;
} else {
- SaveManager::load_save(last_save_index, last_category, HundoSpecials, 0xFF);
+ SaveManager::load_save(last_save_index, last_category, last_special_ptr, 0xFF);
}
} // namespace Commands
diff --git a/src/save_manager.cpp b/src/save_manager.cpp
index 6e922d6..d525bf2 100644
--- a/src/save_manager.cpp
+++ b/src/save_manager.cpp
@@ -85,7 +85,7 @@ void SaveManager::load_save(uint32_t id, char* category, special i_specials[], i
id * sizeof(gSaveManager.mPracticeSaveInfo));
tp_sprintf(currentFileName, "tpgz/save_files/%s/%s.bin", category, gSaveManager.mPracticeSaveInfo.filename);
- // 0xFF is used to identify a call from file reload, which doesn't need to run this function
+ // 0xFF is used to identify a call from file reload, which doesn't need to run the default load
if (size != 0xFF) {
SaveManager::default_load();
} else {
@@ -101,20 +101,21 @@ void SaveManager::load_save(uint32_t id, char* category, special i_specials[], i
tp_bossFlags = 0;
- // if (i_specials) {
- // for (int i = 0; i < size; ++i) {
- // if (id == i_specials[i].idx) {
- // if (i_specials[i].CallbackDuring) {
- // gSaveManager.mPracticeFileOpts.inject_options_during_load = i_specials[i].CallbackDuring;
- // }
- // if (i_specials[i].CallbackAfter) {
- // gSaveManager.mPracticeFileOpts.inject_options_after_load = i_specials[i].CallbackAfter;
- // }
- // }
- // }
- // }
-
- // store all the info in case file reload is used
+ // If the selected file was a special, run the special callbacks
+ if (i_specials) {
+ for (int i = 0; i < size; ++i) {
+ if (id == i_specials[i].idx) {
+ if (i_specials[i].CallbackDuring) {
+ gSaveManager.mPracticeFileOpts.inject_options_during_load = i_specials[i].CallbackDuring;
+ }
+ if (i_specials[i].CallbackAfter) {
+ gSaveManager.mPracticeFileOpts.inject_options_after_load = i_specials[i].CallbackAfter;
+ }
+ }
+ }
+ }
+
+ // Store all the info in case file reload is used
last_save_index = id;
tp_strcpy(last_category, category);
last_special_ptr = i_specials;