diff --git a/include/button_menu.h b/include/button_menu.h index b517660..41867b3 100644 --- a/include/button_menu.h +++ b/include/button_menu.h @@ -12,8 +12,7 @@ #define BTN_EVENTS 3 #define BTN_CREDITS 4 #define BTN_OPENING 5 -#define BTN_TEXT_DEBUG 6 -#define BTN_DEBUG_MENU 7 +#define BTN_DEBUG_MENU 6 #define BUTTON_CANCEL UINT8_MAX diff --git a/include/dbg/debug_menu.h b/include/dbg/debug_menu.h index 51e5989..ae69289 100644 --- a/include/dbg/debug_menu.h +++ b/include/dbg/debug_menu.h @@ -3,7 +3,7 @@ #include "vertical_menu.h" -typedef void (*on_execute_callback)(void *context, unsigned user_param); +typedef void (*on_execute_callback)(unsigned user_param); /** * @brief This struct represents the metadata associated to a single option of a single row in the debug menu. diff --git a/include/dbg/debug_menu_functions.h b/include/dbg/debug_menu_functions.h index fff444f..bdf0df7 100644 --- a/include/dbg/debug_menu_functions.h +++ b/include/dbg/debug_menu_functions.h @@ -2,6 +2,9 @@ #define _DEBUG_MENU_FUNCTIONS_H -void dbg_menu_print_number(void *context, unsigned user_param); +void dbg_menu_print_number(unsigned user_param); + +void show_text_debug_screen(unsigned user_param); +void show_debug_info_screen(unsigned user_param); #endif \ No newline at end of file diff --git a/include/dbg/debug_mode.h b/include/dbg/debug_mode.h index 56e1d17..d737908 100644 --- a/include/dbg/debug_mode.h +++ b/include/dbg/debug_mode.h @@ -13,35 +13,48 @@ #define DEBUG_MODE 0 #endif -#define PRINT_LINK_DATA (false && DEBUG_MODE) -#define INSTANT_TEXT_SPEED (false && DEBUG_MODE) -#define IGNORE_GAME_PAK (true && DEBUG_MODE) -#define IGNORE_GAME_PAK_SPRITES (false && DEBUG_MODE) -#define IGNORE_LINK_CABLE (false && DEBUG_MODE) -#define IGNORE_MG_E4_FLAGS (true && DEBUG_MODE) -#define IGNORE_UNRECEIVED_PKMN (false && DEBUG_MODE) -#define FORCE_TUTORIAL (false && DEBUG_MODE) -#define DONT_REMOVE_PKMN (false && DEBUG_MODE) -#define DONT_HIDE_INVALID_PKMN (false && DEBUG_MODE) -#define IGNORE_DEX_COMPLETION (false && DEBUG_MODE) -#define FORCE_ALL_CAUGHT (true && DEBUG_MODE) -#define WRITE_CABLE_DATA_TO_SAVE (false && DEBUG_MODE) +/** + * @brief This structs contains debug options + * that can be influenced through the debug menu. + */ +typedef struct debug_options +{ + bool print_link_data; + bool instant_text_speed; + bool ignore_game_pak; + bool ignore_game_pak_sprites; + bool ignore_link_cable; + bool ignore_mg_e4_flags; + bool ignore_unreceived_pkmn; + bool force_tutorial; + bool dont_hide_invalid_pkmn; + bool ignore_dex_completion; + bool force_all_caught; + bool write_cable_data_to_save; + bool display_control_char; +} debug_options; + +extern debug_options g_debug_options; + + +// Options that affect and require payload_builder +// (and therefore can't be put in the debug menu) #define SHOW_DATA_PACKETS (false && DEBUG_MODE) -#define DISPLAY_CONTROL_CHAR (false && DEBUG_MODE) #define PAYLOAD_EXPORT_TEST (false && DEBUG_MODE) +#define DEBUG_PAYLOADS (false && DEBUG_MODE) +#define DONT_REMOVE_PKMN (false && DEBUG_MODE) + +// impractical to add to debug menu. #define DONT_TRANSFER_POKEMON_AT_INDEX_X (false && DEBUG_MODE) #define POKEMON_INDEX_TO_SKIP 5 -#define ENABLE_TEXT_DEBUG_SCREEN (true && DEBUG_MODE) -#define DEBUG_PAYLOADS (false && DEBUG_MODE) - +// not sure if we want these in the debug menu. #define DEBUG_GAME EMERALD_ID #define DEBUG_VERS VERS_1_0 #define DEBUG_LANG LANG_ENG -#define ENABLE_MATCH_PID true -#define ENABLE_DEBUG_SCREEN true - +// Compile time options +#define ENABLE_DEBUG_MENU true #define USE_CUSTOM_MALLOC 1 // needs to be a value divisible by 4 #define CUSTOM_MALLOC_POOL_SIZE 8192 diff --git a/source/dbg/debug_menu.cpp b/source/dbg/debug_menu.cpp index 69fd559..cad3906 100644 --- a/source/dbg/debug_menu.cpp +++ b/source/dbg/debug_menu.cpp @@ -7,6 +7,9 @@ #include +static on_execute_callback delayed_execute_callback = nullptr; +static unsigned delayed_execute_user_param = 0; + void show_debug_menu() { u16 charset[256]; @@ -48,6 +51,16 @@ void show_debug_menu() hide_text_box(); tte_erase_rect(0, 0, H_MAX, V_MAX); + + // execute any callback that was delayed by pressing the A button on an executable row. + // This is done to make sure the debug menu is fully hidden before executing the callback, + // to avoid rendering issues. + if(delayed_execute_callback) + { + delayed_execute_callback(delayed_execute_user_param); + delayed_execute_callback = nullptr; + delayed_execute_user_param = 0; + } } debug_menu_row_widget::debug_menu_row_widget(const debug_menu_row_data &data) @@ -122,7 +135,7 @@ MenuInputHandleState debug_menu_row_widget::handle_input() if(handled && data_.option_section.on_option_activate) { - data_.option_section.on_option_activate(this, data_.option_section.options[data_.option_section.selected_option_index].value); + data_.option_section.on_option_activate(data_.option_section.options[data_.option_section.selected_option_index].value); } if(handled) @@ -133,8 +146,9 @@ MenuInputHandleState debug_menu_row_widget::handle_input() if(key_hit(KEY_A) && data_.on_execute) { - data_.on_execute(this, data_.user_param); - return MenuInputHandleState::HANDLED; + delayed_execute_callback = data_.on_execute; + delayed_execute_user_param = data_.user_param; + return MenuInputHandleState::CHOICE_MADE; } return MenuInputHandleState::NOT_HANDLED; diff --git a/source/dbg/debug_menu_entries.cpp b/source/dbg/debug_menu_entries.cpp index d890f5c..d41a268 100644 --- a/source/dbg/debug_menu_entries.cpp +++ b/source/dbg/debug_menu_entries.cpp @@ -84,13 +84,15 @@ void fill_debug_menu_with_entries(vertical_menu &menu, u16 *charset) debug_menu_row_widget row_widget_default_off = define_toggle_row(charset, "Def_Off", dbg_menu_print_number, false); debug_menu_row_widget row_widget_default_on = define_toggle_row(charset, "Def_On", dbg_menu_print_number, true); debug_menu_row_widget row_widget_custom_options = define_debug_choice_row(charset, "Custom", dbg_menu_print_number, custom_options, 3, false, 1); - debug_menu_row_widget row_widget_executable = define_executable_row(charset, "Exec", dbg_menu_print_number, 128); + debug_menu_row_widget txt_dbg_screen = define_executable_row(charset, "Text Debug Screen", show_text_debug_screen, 0); + debug_menu_row_widget dbg_info_screen = define_executable_row(charset, "Debug Info Screen", show_debug_info_screen, 0); i_item_widget* item_widgets[] = { &row_widget_default_off, &row_widget_default_on, &row_widget_custom_options, - &row_widget_executable + &txt_dbg_screen, + &dbg_info_screen }; menu.add_item_widgets(item_widgets, sizeof(item_widgets) / sizeof(item_widgets[0])); diff --git a/source/dbg/debug_menu_functions.cpp b/source/dbg/debug_menu_functions.cpp index 63c92bd..d495e63 100644 --- a/source/dbg/debug_menu_functions.cpp +++ b/source/dbg/debug_menu_functions.cpp @@ -2,10 +2,15 @@ #include "libraries/nanoprintf/nanoprintf.h" #include "text_engine.h" #include "pokemon_data.h" +#include "sprite_data.h" +#include "global_frame_controller.h" +#include "flash_mem.h" +#include "save_data_manager.h" +#include "background_engine.h" +#include "libstd_replacements.h" -void dbg_menu_print_number(void *context, unsigned user_param) +void dbg_menu_print_number(unsigned user_param) { - (void)context; char buf[64]; npf_snprintf(buf, sizeof(buf), "%u", user_param); uint16_t charset[256]; @@ -14,4 +19,92 @@ void dbg_menu_print_number(void *context, unsigned user_param) tte_erase_rect(0, 0, 100, 12); tte_set_pos(0, 0); ptgb_write_debug(charset, buf, true); +} + +void show_text_debug_screen(unsigned user_param) +{ + (void)user_param; + + tte_set_ink(INK_DARK_GREY); + REG_BG1CNT = (REG_BG1CNT & ~BG_PRIO_MASK) | BG_PRIO(3); + obj_hide_multi(ptgb_logo_l, 2); + text_loop(SCRIPT_DEBUG); +} + +void show_debug_info_screen(unsigned user_param) +{ + char hexBuffer[16]; + uint16_t charset[256]; + load_localized_charset(charset, 3, ENGLISH); + if (key_held(KEY_UP) && key_held(KEY_L) && key_held(KEY_R)) + { + set_treecko(true); + } + u32 pkmn_flags = 0; + bool e4_flag = read_flag(curr_GBA_rom.e4_flag); + bool mg_flag = read_flag(curr_GBA_rom.mg_flag); + bool all_collected_flag = read_flag(curr_GBA_rom.all_collected_flag); + for (int i = 0; i < 30; i++) + { + pkmn_flags |= (read_flag(curr_GBA_rom.pkmn_collected_flag_start + i) << i); + } + + bool tutorial = get_tutorial_flag(); + int def_lang = get_def_lang_num(); + + create_textbox(4, 1, 160, 80, true); + show_text_box(); + ptgb_write_debug(charset, "Debug info:\n\nG: ", true); + ptgb_write_debug(charset, ptgb::to_string(curr_GBA_rom.language), true); + switch (curr_GBA_rom.gamecode) + { + case RUBY_ID: + ptgb_write_debug(charset, "-R-", true); + break; + case SAPPHIRE_ID: + ptgb_write_debug(charset, "-S-", true); + break; + case FIRERED_ID: + ptgb_write_debug(charset, "-F-", true); + break; + case LEAFGREEN_ID: + ptgb_write_debug(charset, "-L-", true); + break; + case EMERALD_ID: + ptgb_write_debug(charset, "-E-", true); + break; + } + + ptgb_write_debug(charset, ptgb::to_string(curr_GBA_rom.version), true); + + ptgb_write_debug(charset, "\nF: ", true); + ptgb_write_debug(charset, ptgb::to_string(e4_flag), true); + ptgb_write_debug(charset, ptgb::to_string(mg_flag), true); + ptgb_write_debug(charset, ptgb::to_string(all_collected_flag), true); + ptgb_write_debug(charset, "-", true); + + n2hexstr(hexBuffer, pkmn_flags); + ptgb_write_debug(charset, hexBuffer, true); + ptgb_write_debug(charset, "\nS: ", true); + ptgb_write_debug(charset, ptgb::to_string(tutorial), true); + ptgb_write_debug(charset, "-", true); + n2hexstr(hexBuffer, def_lang); + ptgb_write_debug(charset, hexBuffer, true); + + ptgb_write_debug(charset, "\n", true); + ptgb_write_debug(charset, BUILD_INFO, true); + if (get_treecko_enabled()) + { + ptgb_write_debug(charset, ".T", true); + } + while (true) + { + if (key_hit(KEY_B)) + { + hide_text_box(); + reset_textbox(); + return; + } + global_next_frame(); + } } \ No newline at end of file diff --git a/source/dbg/debug_mode.cpp b/source/dbg/debug_mode.cpp new file mode 100644 index 0000000..4b6a95f --- /dev/null +++ b/source/dbg/debug_mode.cpp @@ -0,0 +1,18 @@ +#include "dbg/debug_mode.h" + +debug_options g_debug_options = +{ + .print_link_data = (false && DEBUG_MODE), + .instant_text_speed = (false && DEBUG_MODE), + .ignore_game_pak = (true && DEBUG_MODE), + .ignore_game_pak_sprites = (false && DEBUG_MODE), + .ignore_link_cable = (false && DEBUG_MODE), + .ignore_mg_e4_flags = (true && DEBUG_MODE), + .ignore_unreceived_pkmn = (false && DEBUG_MODE), + .force_tutorial = (false && DEBUG_MODE), + .dont_hide_invalid_pkmn = (false && DEBUG_MODE), + .ignore_dex_completion = (false && DEBUG_MODE), + .force_all_caught = (true && DEBUG_MODE), + .write_cable_data_to_save = (false && DEBUG_MODE), + .display_control_char = (false && DEBUG_MODE) +}; \ No newline at end of file diff --git a/source/gameboy_colour.cpp b/source/gameboy_colour.cpp index 70711e1..37dd135 100644 --- a/source/gameboy_colour.cpp +++ b/source/gameboy_colour.cpp @@ -372,7 +372,7 @@ int loop(byte *box_data_storage, byte *curr_payload, GB_ROM *curr_gb_rom, PokeBo while (true) { - if (PRINT_LINK_DATA && key_held(KEY_L)) + if (g_debug_options.print_link_data && key_held(KEY_L)) { while (!key_hit(KEY_R)) { @@ -383,7 +383,7 @@ int loop(byte *box_data_storage, byte *curr_payload, GB_ROM *curr_gb_rom, PokeBo // TODO: Restore Errors in_data = linkSPI->transfer(out_data); - if (PRINT_LINK_DATA && !key_held(KEY_DOWN)) + if (g_debug_options.print_link_data && !key_held(KEY_DOWN)) { // tte_set_margins(0, 0, H_MAX, V_MAX); // print("%d: [%d][%d][%" PRIu8 "][%" PRIu8 "]\n\n", counter, data_counter, state, in_data, out_data); @@ -410,7 +410,7 @@ int loop(byte *box_data_storage, byte *curr_payload, GB_ROM *curr_gb_rom, PokeBo create_textbox(0, 0, 125, 80, false); ptgb_write_debug(debug_charset, *stuff, true); } - else if (WRITE_CABLE_DATA_TO_SAVE) + else if (g_debug_options.write_cable_data_to_save) { global_memory_buffer[link_cable_array_index] = in_data; link_cable_array_index++; @@ -442,7 +442,7 @@ int loop(byte *box_data_storage, byte *curr_payload, GB_ROM *curr_gb_rom, PokeBo if (state == end1) { state = reboot; - if (WRITE_CABLE_DATA_TO_SAVE) + if (g_debug_options.write_cable_data_to_save) { for (int i = 0; i < 16; i++) { diff --git a/source/main.cpp b/source/main.cpp index 7682e1c..4525723 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -203,82 +203,6 @@ int credits() curr_credits_num++; update = true; } - if (ENABLE_DEBUG_SCREEN && key_hit(KEY_SELECT)) - { - char hexBuffer[16]; - uint16_t charset[256]; - load_localized_charset(charset, 3, ENGLISH); - if (key_held(KEY_UP) && key_held(KEY_L) && key_held(KEY_R)) - { - set_treecko(true); - } - u32 pkmn_flags = 0; - bool e4_flag = read_flag(curr_GBA_rom.e4_flag); - bool mg_flag = read_flag(curr_GBA_rom.mg_flag); - bool all_collected_flag = read_flag(curr_GBA_rom.all_collected_flag); - for (int i = 0; i < 30; i++) - { - pkmn_flags |= (read_flag(curr_GBA_rom.pkmn_collected_flag_start + i) << i); - } - - bool tutorial = get_tutorial_flag(); - int def_lang = get_def_lang_num(); - - create_textbox(4, 1, 160, 80, true); - ptgb_write_debug(charset, "Debug info:\n\nG: ", true); - ptgb_write_debug(charset, ptgb::to_string(curr_GBA_rom.language), true); - switch (curr_GBA_rom.gamecode) - { - case RUBY_ID: - ptgb_write_debug(charset, "-R-", true); - break; - case SAPPHIRE_ID: - ptgb_write_debug(charset, "-S-", true); - break; - case FIRERED_ID: - ptgb_write_debug(charset, "-F-", true); - break; - case LEAFGREEN_ID: - ptgb_write_debug(charset, "-L-", true); - break; - case EMERALD_ID: - ptgb_write_debug(charset, "-E-", true); - break; - } - - ptgb_write_debug(charset, ptgb::to_string(curr_GBA_rom.version), true); - - ptgb_write_debug(charset, "\nF: ", true); - ptgb_write_debug(charset, ptgb::to_string(e4_flag), true); - ptgb_write_debug(charset, ptgb::to_string(mg_flag), true); - ptgb_write_debug(charset, ptgb::to_string(all_collected_flag), true); - ptgb_write_debug(charset, "-", true); - - n2hexstr(hexBuffer, pkmn_flags); - ptgb_write_debug(charset, hexBuffer, true); - ptgb_write_debug(charset, "\nS: ", true); - ptgb_write_debug(charset, ptgb::to_string(tutorial), true); - ptgb_write_debug(charset, "-", true); - n2hexstr(hexBuffer, def_lang); - ptgb_write_debug(charset, hexBuffer, true); - - ptgb_write_debug(charset, "\n", true); - ptgb_write_debug(charset, BUILD_INFO, true); - if (get_treecko_enabled()) - { - ptgb_write_debug(charset, ".T", true); - } - while (true) - { - if (key_hit(KEY_B)) - { - hide_text_box(); - reset_textbox(); - return 0; - } - global_next_frame(); - } - } global_next_frame(); } @@ -286,15 +210,9 @@ int credits() int main_menu_loop() { -#if ENABLE_TEXT_DEBUG_SCREEN -#define NUM_MENU_OPTIONS 4 - const uint8_t menu_options[NUM_MENU_OPTIONS] = {GENERAL_option_transfer, GENERAL_option_dreamdex, GENERAL_option_credits, GENERAL_option_text_debug}; - int return_values[NUM_MENU_OPTIONS] = {BTN_TRANSFER, BTN_POKEDEX, BTN_CREDITS, BTN_TEXT_DEBUG}; -#else #define NUM_MENU_OPTIONS 3 const uint8_t menu_options[NUM_MENU_OPTIONS] = {GENERAL_option_transfer, GENERAL_option_dreamdex, GENERAL_option_credits}; int return_values[NUM_MENU_OPTIONS] = {BTN_TRANSFER, BTN_POKEDEX, BTN_CREDITS}; -#endif uint8_t general_text_table_buffer[2048]; text_data_table general_text(general_text_table_buffer); @@ -478,7 +396,7 @@ int main(void) bool debug = false; while (!curr_GBA_rom.load_rom(debug)) { - if (IGNORE_GAME_PAK) + if (g_debug_options.ignore_game_pak) { debug = true; } @@ -500,7 +418,7 @@ int main(void) set_background_pal(curr_GBA_rom.gamecode, false, true); - if (!IGNORE_MG_E4_FLAGS && (!get_tutorial_flag() || FORCE_TUTORIAL)) + if (!g_debug_options.ignore_mg_e4_flags && (!get_tutorial_flag() || g_debug_options.force_tutorial)) { obj_hide_multi(ptgb_logo_l, 2); text_loop(BTN_TRANSFER); @@ -557,12 +475,6 @@ int main(void) obj_hide_multi(ptgb_logo_l, 2); text_loop(SCRIPT_EVENT); break; - case (BTN_TEXT_DEBUG): - tte_set_ink(INK_DARK_GREY); - REG_BG1CNT = (REG_BG1CNT & ~BG_PRIO_MASK) | BG_PRIO(3); - obj_hide_multi(ptgb_logo_l, 2); - text_loop(SCRIPT_DEBUG); - break; case (BTN_DEBUG_MENU): obj_hide_multi(ptgb_logo_l, 2); show_debug_menu(); diff --git a/source/pokemon_party.cpp b/source/pokemon_party.cpp index c4b7373..e84d26a 100644 --- a/source/pokemon_party.cpp +++ b/source/pokemon_party.cpp @@ -160,7 +160,7 @@ Pokemon_Party::Pokemon_Party() void Pokemon_Party::start_link() { - if (IGNORE_LINK_CABLE) + if (g_debug_options.ignore_link_cable) { if (curr_gb_rom.generation == 1 && curr_gb_rom.version) { @@ -186,7 +186,7 @@ void Pokemon_Party::start_link() last_error = loop(&box_data_array[0], current_payload, &curr_gb_rom, &box, debug_charset, false); box.loadData(curr_gb_rom.generation, (Language)curr_gb_rom.language, box_data_array); - if (WRITE_CABLE_DATA_TO_SAVE) + if (g_debug_options.write_cable_data_to_save) { for (int i = 0; i < 1122; i++) { @@ -203,7 +203,7 @@ void Pokemon_Party::start_link() void Pokemon_Party::continue_link(bool cancel_connection) { - if (!IGNORE_LINK_CABLE) + if (!g_debug_options.ignore_link_cable) { u16 debug_charset[256]; diff --git a/source/rom_data.cpp b/source/rom_data.cpp index 8788373..668f5c5 100644 --- a/source/rom_data.cpp +++ b/source/rom_data.cpp @@ -187,7 +187,7 @@ void rom_data::print_rom_info() bool rom_data::verify_rom() { return !rom_loaded || - IGNORE_GAME_PAK || + g_debug_options.ignore_game_pak || ((gamecode == ((*(vu8 *)(0x80000AC)) << 0x10 | (*(vu8 *)(0x80000AD)) << 0x08 | (*(vu8 *)(0x80000AE)) << 0x00)) && (language == (*(vu8 *)(0x80000AF))) && (version == (*(vu8 *)(0x80000BC)))); diff --git a/source/save_data_manager.cpp b/source/save_data_manager.cpp index 0d780d7..977a448 100644 --- a/source/save_data_manager.cpp +++ b/source/save_data_manager.cpp @@ -31,7 +31,7 @@ void write_custom_save_data() bool is_caught(int dex_num) { - return (((save_data_array[CAUGHT_DATA + (dex_num / 8)]) >> dex_num % 8) & 1) || FORCE_ALL_CAUGHT; + return (((save_data_array[CAUGHT_DATA + (dex_num / 8)]) >> dex_num % 8) & 1) || g_debug_options.force_all_caught; } void set_caught(int dex_num) diff --git a/source/script_array.cpp b/source/script_array.cpp index aad1827..da01338 100644 --- a/source/script_array.cpp +++ b/source/script_array.cpp @@ -756,13 +756,13 @@ bool run_conditional(int index) return party_data.get_last_error() != COND_ERROR_COLOSSEUM; case COND_BEAT_E4: - return read_flag(curr_GBA_rom.e4_flag) || IGNORE_MG_E4_FLAGS; + return read_flag(curr_GBA_rom.e4_flag) || g_debug_options.ignore_mg_e4_flags; case COND_MG_ENABLED: - return read_flag(curr_GBA_rom.mg_flag) || IGNORE_MG_E4_FLAGS; + return read_flag(curr_GBA_rom.mg_flag) || g_debug_options.ignore_mg_e4_flags; case COND_TUTORIAL_COMPLETE: - return get_tutorial_flag() && !FORCE_TUTORIAL; + return get_tutorial_flag() && !g_debug_options.force_tutorial; case COND_NEW_POKEMON: return party_data.get_has_new_pkmn(); @@ -774,10 +774,10 @@ bool run_conditional(int index) return !curr_GBA_rom.is_ruby_sapphire(); case COND_MG_OTHER_EVENT: - return compare_map_and_npc_data(curr_GBA_rom.def_map_bank, curr_GBA_rom.def_map_id, curr_GBA_rom.def_npc_id) && !IGNORE_MG_E4_FLAGS; + return compare_map_and_npc_data(curr_GBA_rom.def_map_bank, curr_GBA_rom.def_map_id, curr_GBA_rom.def_npc_id) && !g_debug_options.ignore_mg_e4_flags; case COND_PKMN_TO_COLLECT: - return compare_map_and_npc_data(curr_GBA_rom.map_bank, curr_GBA_rom.map_id, curr_GBA_rom.npc_id) && !read_flag(curr_GBA_rom.all_collected_flag) && !IGNORE_UNRECEIVED_PKMN; + return compare_map_and_npc_data(curr_GBA_rom.map_bank, curr_GBA_rom.map_id, curr_GBA_rom.npc_id) && !read_flag(curr_GBA_rom.all_collected_flag) && !g_debug_options.ignore_unreceived_pkmn; case COND_GB_ROM_EXISTS: return party_data.load_gb_rom(); @@ -788,11 +788,11 @@ bool run_conditional(int index) case COND_CHECK_DEX: if (party_data.get_game_gen() == 1) { - return (get_dex_completion(1, false) == 150) || IGNORE_DEX_COMPLETION; + return (get_dex_completion(1, false) == 150) || g_debug_options.ignore_dex_completion; } else { - return (get_dex_completion(1, false) == 99) || IGNORE_DEX_COMPLETION; + return (get_dex_completion(1, false) == 99) || g_debug_options.ignore_dex_completion; } case COND_CHECK_KANTO: @@ -879,7 +879,7 @@ bool run_conditional(int index) for (int i = 0; i <= (8 * 7); i += 2) { REG_BG1HOFS = i + FENNEL_SHIFT; - if (!INSTANT_TEXT_SPEED) + if (!g_debug_options.instant_text_speed) { global_next_frame(); } @@ -890,7 +890,7 @@ bool run_conditional(int index) for (int i = (8 * 7); i >= 0; i -= 2) { REG_BG1HOFS = i + FENNEL_SHIFT; - if (!INSTANT_TEXT_SPEED) + if (!g_debug_options.instant_text_speed) { global_next_frame(); } @@ -912,7 +912,7 @@ bool run_conditional(int index) return true; case CMD_IS_A_VALID_PKMN: - return party_data.box.getNumValid() > 0 || DONT_HIDE_INVALID_PKMN; + return party_data.box.getNumValid() > 0 || g_debug_options.dont_hide_invalid_pkmn; case CMD_CANCEL_LINK: party_data.continue_link(true); diff --git a/source/sprite_data.cpp b/source/sprite_data.cpp index d6ce1f9..d6b7d03 100644 --- a/source/sprite_data.cpp +++ b/source/sprite_data.cpp @@ -473,12 +473,12 @@ void load_temp_box_sprites(PokeBox *box) { u32 curr_tile_id = global_tile_id_end; - if (!(IGNORE_GAME_PAK || IGNORE_GAME_PAK_SPRITES)) + if (!(g_debug_options.ignore_game_pak || g_debug_options.ignore_game_pak_sprites)) { for (int i = 0; i < 30; i++) { GBPokemon *curr_pkmn = box->getGBPokemon(i); - if (curr_pkmn->isValid || DONT_HIDE_INVALID_PKMN) + if (curr_pkmn->isValid || g_debug_options.dont_hide_invalid_pkmn) { int dex_num = curr_pkmn->getSpeciesIndexNumber(); if (dex_num == 201) @@ -859,7 +859,7 @@ void update_y_offset() void update_front_box_sprite(GBPokemon *curr_pkmn) { - if (IGNORE_GAME_PAK || IGNORE_GAME_PAK_SPRITES) + if (g_debug_options.ignore_game_pak || g_debug_options.ignore_game_pak_sprites) { return; // We don't want to look into garbage data, get out of here. } @@ -904,7 +904,7 @@ void update_front_box_sprite(GBPokemon *curr_pkmn) void update_menu_sprite(PokeBox *box, int index, int frame) { - if (IGNORE_GAME_PAK || IGNORE_GAME_PAK_SPRITES) + if (g_debug_options.ignore_game_pak || g_debug_options.ignore_game_pak_sprites) { return; // We don't want to look into garbage data, get out of here. } diff --git a/source/text_engine.cpp b/source/text_engine.cpp index 2d546c6..0b20c73 100644 --- a/source/text_engine.cpp +++ b/source/text_engine.cpp @@ -297,7 +297,7 @@ int ptgb_write(const byte *text, bool instant) // Re-implementing TTE's "tte_write" to use the gen 3 character encoding chart int ptgb_write(const byte *text, bool instant, int length) { - instant = instant || INSTANT_TEXT_SPEED; + instant = instant || g_debug_options.instant_text_speed; if (text == NULL) return 0; @@ -324,7 +324,7 @@ int ptgb_write(const byte *text, bool instant, int length) switch (ch) { case 0xFA: - if (DISPLAY_CONTROL_CHAR) + if (g_debug_options.display_control_char) { tc->drawgProc(0x79); } @@ -334,7 +334,7 @@ int ptgb_write(const byte *text, bool instant, int length) tc->cursorX = tc->marginLeft; break; case 0xFB: - if (DISPLAY_CONTROL_CHAR) + if (g_debug_options.display_control_char) { tc->drawgProc(0xB9); } @@ -344,7 +344,7 @@ int ptgb_write(const byte *text, bool instant, int length) ch = *str; str++; num += 1; - if (DISPLAY_CONTROL_CHAR) + if (g_debug_options.display_control_char) { for (uint i = 0; i < ch; i++){ tc->drawgProc(0xB9); @@ -356,7 +356,7 @@ int ptgb_write(const byte *text, bool instant, int length) } break; case 0xFE: - if (DISPLAY_CONTROL_CHAR) + if (g_debug_options.display_control_char) { tc->drawgProc(0xEF); }