diff --git a/Poke_Transporter_GB_mb-0.png b/Poke_Transporter_GB_mb-0.png new file mode 100644 index 0000000..9f18d5b Binary files /dev/null and b/Poke_Transporter_GB_mb-0.png differ diff --git a/include/debug_mode.h b/include/debug_mode.h index 7314bf5..caf44d0 100644 --- a/include/debug_mode.h +++ b/include/debug_mode.h @@ -3,17 +3,17 @@ #define VERSION "v1.0.3 D" -#define DEBUG_MODE true // This is currently broken... not sure why -#define IGNORE_GAME_PAK true +#define DEBUG_MODE false // This is currently broken... not sure why +#define IGNORE_GAME_PAK false #define IGNORE_LINK_CABLE false -#define IGNORE_MG_E4_FLAGS true -#define IGNORE_UNRECEIVED_PKMN true +#define IGNORE_MG_E4_FLAGS false +#define IGNORE_UNRECEIVED_PKMN false #define FORCE_TUTORIAL false #define DONT_REMOVE_PKMN false #define NO_INVALID_PKMN false #define IGNORE_DEX_COMPLETION false #define WRITE_CABLE_DATA_TO_SAVE false -#define SHOW_DATA_PACKETS true +#define SHOW_DATA_PACKETS false #define DEBUG_GAME EMERALD_ID #define DEBUG_VERS VERS_1_0 diff --git a/include/gb_rom_values/base_gb_rom_struct.h b/include/gb_rom_values/base_gb_rom_struct.h index 296e42a..52f25c6 100644 --- a/include/gb_rom_values/base_gb_rom_struct.h +++ b/include/gb_rom_values/base_gb_rom_struct.h @@ -8,7 +8,7 @@ typedef unsigned int u32, word, uint, eint; typedef unsigned long long u64; #define PAYLOAD_SIZE 672 -#define NUM_GB_ROMS 6 +#define NUM_GB_ROMS 5 #define GB_TILE_WIDTH 20 diff --git a/include/gba_rom_values/jpn_gba_rom_values.h b/include/gba_rom_values/jpn_gba_rom_values.h index 66acf43..9e5f35a 100644 --- a/include/gba_rom_values/jpn_gba_rom_values.h +++ b/include/gba_rom_values/jpn_gba_rom_values.h @@ -4,7 +4,7 @@ #include "gba_rom_values/base_gba_rom_struct.h" const struct ROM_DATA JPN_RUBY_v0 = { - .is_valid = true, + .is_valid = false, .gamecode = RUBY_ID, .version = VERS_1_0, @@ -54,7 +54,7 @@ const struct ROM_DATA JPN_RUBY_v0 = { .old_npc_id = 1, }; const struct ROM_DATA JPN_SAPPHIRE_v0 = { - .is_valid = true, + .is_valid = false, .gamecode = SAPPHIRE_ID, .version = VERS_1_0, @@ -104,7 +104,7 @@ const struct ROM_DATA JPN_SAPPHIRE_v0 = { .old_npc_id = 1, }; const struct ROM_DATA JPN_RUBY_v1 = { - .is_valid = true, + .is_valid = false, .gamecode = RUBY_ID, .version = VERS_1_1, @@ -154,7 +154,7 @@ const struct ROM_DATA JPN_RUBY_v1 = { .old_npc_id = 1, }; const struct ROM_DATA JPN_SAPPHIRE_v1 = { - .is_valid = true, + .is_valid = false, .gamecode = SAPPHIRE_ID, .version = VERS_1_1, @@ -204,7 +204,7 @@ const struct ROM_DATA JPN_SAPPHIRE_v1 = { .old_npc_id = 1, }; const struct ROM_DATA JPN_FIRERED_v0 = { - .is_valid = true, + .is_valid = false, .gamecode = FIRERED_ID, .version = VERS_1_0, @@ -257,7 +257,7 @@ const struct ROM_DATA JPN_FIRERED_v0 = { .loc_gSaveBlock1PTR = 0x03005008, // TODO: Only used for old script, can be removed later }; const struct ROM_DATA JPN_LEAFGREEN_v0 = { - .is_valid = true, + .is_valid = false, .gamecode = LEAFGREEN_ID, .version = VERS_1_0, @@ -310,7 +310,7 @@ const struct ROM_DATA JPN_LEAFGREEN_v0 = { .loc_gSaveBlock1PTR = 0x03005008, // TODO: Only used for old script, can be removed later }; const struct ROM_DATA JPN_FIRERED_v1 = { - .is_valid = true, + .is_valid = false, .gamecode = FIRERED_ID, .version = VERS_1_1, @@ -363,7 +363,7 @@ const struct ROM_DATA JPN_FIRERED_v1 = { .loc_gSaveBlock1PTR = 0x03005008, // TODO: Only used for old script, can be removed later }; const struct ROM_DATA JPN_LEAFGREEN_v1 = { - .is_valid = true, + .is_valid = false, .gamecode = LEAFGREEN_ID, .version = VERS_1_1, @@ -416,7 +416,7 @@ const struct ROM_DATA JPN_LEAFGREEN_v1 = { .loc_gSaveBlock1PTR = 0x03005008, // TODO: Only used for old script, can be removed later }; const struct ROM_DATA JPN_EMERALD_v0 = { - .is_valid = true, + .is_valid = false, .gamecode = EMERALD_ID, .version = VERS_1_0, diff --git a/include/global_frame_controller.h b/include/global_frame_controller.h index b8ad9ee..a180cab 100644 --- a/include/global_frame_controller.h +++ b/include/global_frame_controller.h @@ -11,5 +11,7 @@ void set_menu_sprite_pal(int frame); void run_link_cable_animation(int frame); void link_animation_state(int state); void determine_fennel_blink(); +void set_missingno(bool val); +bool get_missingno_enabled(); #endif diff --git a/include/pokemon.h b/include/pokemon.h index b5bfc34..1d266c8 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -23,6 +23,7 @@ struct Simplified_Pokemon bool is_transferred; bool is_shiny; int unown_letter; + bool is_missingno; }; class Pokemon @@ -59,6 +60,7 @@ public: void set_to_event(byte nature); int num_in_box; int index_in_box; + bool is_missingno = false; private: byte gen = 2; diff --git a/include/pokemon_party.h b/include/pokemon_party.h index 8f68550..38a8930 100644 --- a/include/pokemon_party.h +++ b/include/pokemon_party.h @@ -30,6 +30,7 @@ public: int get_game_gen(); int get_num_pkmn(); bool get_contains_invalid(); + bool get_contains_missingno(); byte box_data_array[0x462]; private: @@ -37,6 +38,7 @@ private: bool has_new_pkmn = false; bool contains_mythical = false; bool stabilize_mythic = false; + bool contains_missingno = false; int game; char lang; }; diff --git a/include/script_array.h b/include/script_array.h index 2a18922..559b027 100644 --- a/include/script_array.h +++ b/include/script_array.h @@ -44,8 +44,9 @@ #define DIA_SOME_INVALID_PKMN 35 #define DIA_MENU_BACK 36 #define DIA_SEND_FRIEND_HOENN_E 37 +#define DIA_IS_MISSINGNO 38 -#define DIA_SIZE 38 +#define DIA_SIZE 39 #define DIA_END DIA_SIZE // Commands @@ -67,8 +68,9 @@ #define CMD_MYTHIC_MENU DIA_END + 15 #define CMD_LOAD_SIMP DIA_END + 16 #define CMD_CANCEL_LINK DIA_END + 17 +#define CMD_END_MISSINGNO DIA_END + 18 -#define CMD_SIZE 18 +#define CMD_SIZE 19 #define CMDS_END DIA_END + CMD_SIZE // Conditionals @@ -91,8 +93,9 @@ #define COND_CHECK_KANTO CMDS_END + 16 #define COND_SOME_INVALID_PKMN CMDS_END + 17 #define COND_IS_HOENN_E CMDS_END + 18 +#define COND_CHECK_MISSINGNO CMDS_END + 19 -#define COND_SIZE 19 +#define COND_SIZE 20 #define COND_END CMDS_END + COND_SIZE // Ends diff --git a/source/background_engine.cpp b/source/background_engine.cpp index 696d112..a91525f 100644 --- a/source/background_engine.cpp +++ b/source/background_engine.cpp @@ -9,11 +9,14 @@ int x, y; void background_frame(int global_frame_count) { + if (!get_missingno_enabled()) + { x++; y++; REG_BG0HOFS = x; REG_BG0VOFS = y; + } } void set_textbox_large() diff --git a/source/box_menu.cpp b/source/box_menu.cpp index 231d01c..cb57e05 100644 --- a/source/box_menu.cpp +++ b/source/box_menu.cpp @@ -118,7 +118,8 @@ int Box_Menu::box_main(Pokemon_Party party_data) for (int i = 0; i < 10; i++) { nickname[i] = gen_3_Intern_char_array[curr_pkmn.nickname[i]]; - if (curr_pkmn.nickname[i] == 0xFF){ + if (curr_pkmn.nickname[i] == 0xFF) + { i = 10; } } @@ -130,7 +131,7 @@ int Box_Menu::box_main(Pokemon_Party party_data) tte_write("*"); } tte_set_pos(48, 80); - tte_write(NAMES[curr_pkmn.dex_number].data()); + tte_write(curr_pkmn.is_missingno ? "MissingNo" : NAMES[curr_pkmn.dex_number].data()); tte_set_pos(146, 80); tte_write("Lv: "); tte_write(std::to_string(curr_pkmn.met_level).c_str()); diff --git a/source/global_frame_controller.cpp b/source/global_frame_controller.cpp index 4d06a05..9faf17c 100644 --- a/source/global_frame_controller.cpp +++ b/source/global_frame_controller.cpp @@ -13,6 +13,7 @@ int cable_frame = 0; int curr_link_animation_state = 0; int fennel_blink_timer = 0; int fennel_blink_state = 0; +bool missingno_enabled = false; void global_next_frame() { @@ -22,6 +23,10 @@ void global_next_frame() // tte_write(std::to_string(get_rand_u32()).c_str()); background_frame(global_frame_count); determine_fennel_blink(); + if (missingno_enabled) + { + set_background_pal(0xFF, false, false); + } oam_copy(oam_mem, obj_buffer, num_sprites); VBlankIntrWait(); // mmFrame(); //Music @@ -219,4 +224,18 @@ void determine_fennel_blink() { fennel_blink_timer = get_rand_range(4 * 60, 8 * 60); } +} + +void set_missingno(bool val) +{ + missingno_enabled = val; + if (val == false){ + set_background_pal(curr_rom.gamecode, false, false); + fennel_blink_timer = 0; + } +} + +bool get_missingno_enabled() +{ + return missingno_enabled; } \ No newline at end of file diff --git a/source/pokemon.cpp b/source/pokemon.cpp index f4bfc0f..303678c 100644 --- a/source/pokemon.cpp +++ b/source/pokemon.cpp @@ -154,11 +154,23 @@ void Pokemon::convert_to_gen_three(bool simplified, bool stabilize_mythical) // Convert the species indexes if (gen == 1) { - species_index_party = gen_1_index_array[species_index_party]; - species_index_struct = gen_1_index_array[species_index_struct]; + if (species_index_struct > 190) + { + species_index_struct = 0; + } + else + { + species_index_struct = gen_1_index_array[species_index_struct]; + if (species_index_struct == 0xFF) + { + is_missingno = true; + species_index_struct = 0x89; // Porygon + } + } + species_index_party = species_index_struct; } - if (index_in_box % 4 == 0 || + if ( // index_in_box % 4 == 0 || species_index_struct > 251 || // Checks if the Pokemon is beyond Celebi species_index_struct == 0 || // Checks that the Pokemon isn't a blank party space species_index_struct != species_index_party || // Checks that the Pokemon isn't a hybrid or an egg @@ -274,7 +286,18 @@ void Pokemon::convert_to_gen_three(bool simplified, bool stabilize_mythical) } // Check that the moves are valid - if (species_index_struct != 0xEB) // Ignore Smeargle due to Sketch + if (is_missingno) + { + moves[0] = 55; // Water Gun + moves[1] = 143; // Sky Attack + moves[2] = 6; // Pay Day + moves[3] = 20; // Bind + for (int i = 0; i < 4; i++) + { + pp_bonus[i] = 0; + } + } + else if (species_index_struct != 0xEB) // Ignore Smeargle due to Sketch { for (int i = 0; i < 4; i++) { @@ -382,9 +405,16 @@ void Pokemon::convert_to_gen_three(bool simplified, bool stabilize_mythical) // Origin info origin_info |= ((caught_data[1] & 0b10000000) << 8); // OT gender - We would shift left 15 bits, but the bit is already shifted over 7 - origin_info |= (4 << 11); // Ball - origin_info |= (((gen == 1) ? 4 : 7) << 7); // Game - origin_info |= met_level; // Level met + if (is_missingno) + { + origin_info |= (1 << 11); // Master Ball + } + else + { + origin_info |= (4 << 11); // Ball + } + origin_info |= (((gen == 1) ? 4 : 7) << 7); // Game + origin_info |= met_level; // Level met // Ribbons and Obedience // ribbons[2] |= 0b00000100; // Artist Ribbon @@ -392,6 +422,11 @@ void Pokemon::convert_to_gen_three(bool simplified, bool stabilize_mythical) { ribbons[3] |= 0b10000000; // Fateful Encounter flag } + else if (is_missingno) + { + ribbons[3] |= 0b10000000; // Fateful Encounter flag + // ribbons[3] |= 0b00000100; // World Ribbon + } // Personality Value copy_from_to(&pid[0], &gen_3_pkmn[0], 4, false); // Trainer ID @@ -808,6 +843,7 @@ Simplified_Pokemon Pokemon::get_simple_pkmn() curr_pkmn.is_transferred = false; curr_pkmn.is_shiny = get_is_shiny(); curr_pkmn.unown_letter = unown_letter; + curr_pkmn.is_missingno = is_missingno; return curr_pkmn; } diff --git a/source/pokemon_party.cpp b/source/pokemon_party.cpp index 06ead53..eb75449 100644 --- a/source/pokemon_party.cpp +++ b/source/pokemon_party.cpp @@ -12,7 +12,7 @@ const GB_ROM *list_of_gb_roms[NUM_GB_ROMS] = { &ENG_RED, &ENG_BLUE, - &ENG_YELLOW, + //&ENG_YELLOW, &ENG_GOLD, &ENG_SILVER, &ENG_CRYSTAL, @@ -22,10 +22,10 @@ byte gen1_debug_box_data[0x462] = { // Num of Pokemon 0x14, // Pokemon 1-20 - 0x02, 0x70, 0x70, 0x70, 0x71, 0x71, 0x70, 0x71, 0x7B, 0x71, 0x71, 0x7C, 0x71, 0x71, 0x71, 0x94, 0x24, 0x24, 0xA5, 0x15, 0xFF, + 0x02, 0x1F, 0x70, 0x70, 0x71, 0x71, 0x70, 0x71, 0x7B, 0x71, 0x71, 0x7C, 0x71, 0x71, 0x71, 0x94, 0x24, 0x24, 0xA5, 0x15, 0xFF, // Pokemon list 0x02, 0x00, 0x11, 0x64, 0x00, 0x07, 0x03, 0xFF, 0x28, 0x51, 0x00, 0x00, 0x6F, 0xC6, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE6, 0xDE, 0x23, 0x28, 0x00, 0x00, - 0x70, 0x00, 0x12, 0x04, 0x00, 0x07, 0x03, 0xFF, 0x28, 0x51, 0x00, 0x00, 0x6F, 0xC6, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5D, 0xD8, 0x23, 0x28, 0x00, 0x00, + 0x1F, 0x00, 0x12, 0x04, 0x00, 0x07, 0x03, 0xFF, 0x28, 0x51, 0x00, 0x00, 0x6F, 0xC6, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5D, 0xD8, 0x23, 0x28, 0x00, 0x00, 0x70, 0x00, 0x12, 0x04, 0x00, 0x07, 0x03, 0xFF, 0x28, 0x51, 0x00, 0x00, 0x6F, 0xC6, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x13, 0x23, 0x28, 0x00, 0x00, 0x70, 0x00, 0x0F, 0x03, 0x00, 0x07, 0x03, 0xFF, 0x28, 0x51, 0x00, 0x00, 0x6F, 0xC6, 0x00, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDA, 0x81, 0x23, 0x28, 0x00, 0x00, 0x71, 0x00, 0x14, 0x05, 0x00, 0x07, 0x03, 0x78, 0x6A, 0x00, 0x00, 0x00, 0x6F, 0xC6, 0x00, 0x00, 0x7D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD6, 0x80, 0x1E, 0x00, 0x00, 0x00, @@ -292,6 +292,7 @@ bool Pokemon_Party::fill_simple_pkmn_array() simple_pkmn_array[index] = converted_mon.get_simple_pkmn(); contains_valid |= converted_mon.get_validity(); contains_invalid |= !converted_mon.get_validity(); + contains_missingno |= converted_mon.is_missingno; } return contains_valid; } @@ -304,4 +305,8 @@ int Pokemon_Party::get_num_pkmn() bool Pokemon_Party::get_contains_invalid() { return contains_invalid; +} + +bool Pokemon_Party::get_contains_missingno(){ + return contains_missingno; } \ No newline at end of file diff --git a/source/script_array.cpp b/source/script_array.cpp index 6e61619..fab4602 100644 --- a/source/script_array.cpp +++ b/source/script_array.cpp @@ -51,6 +51,7 @@ void populate_dialogue() dialogue[DIA_CANCEL] = "No worries! Feel free to\ncome back if you change your\nmind!|See you around!"; dialogue[DIA_SOME_INVALID_PKMN] = "I see there is at least one\nPok@mon that cannot be\ntransferred from your\ncurrent box.|Pok@mon holding items or\nmodified incorrectly through\nunintended means cannot\nbe transferred.|The other Pok@mon will\ntransfer just fine though!"; dialogue[DIA_MENU_BACK] = "No worries! Feel free to\ncome back any time!"; + dialogue[DIA_IS_MISSINGNO] = "...It seems like one of your Pok@mon is messing with the machine...|It looks to only be graphical though, so we can continue!"; dialogue[DIA_ERROR_COLOSSEUM] = "It looks like you went to\nthe colosseum instead of the\ntrading room!|Let's try that again!"; dialogue[DIA_ERROR_COM_ENDED] = "Communication with the other\ndevice was terminated.|Let's try that again!"; @@ -115,15 +116,18 @@ void populate_script() transfer_script[DIA_NO_VALID_PKMN] = script_obj(dialogue[DIA_NO_VALID_PKMN], CMD_CANCEL_LINK); transfer_script[COND_SOME_INVALID_PKMN] = script_obj(COND_SOME_INVALID_PKMN, DIA_SOME_INVALID_PKMN, COND_CHECK_MYTHIC); transfer_script[DIA_SOME_INVALID_PKMN] = script_obj(dialogue[DIA_SOME_INVALID_PKMN], COND_CHECK_MYTHIC); - transfer_script[COND_CHECK_MYTHIC] = script_obj(COND_CHECK_MYTHIC, DIA_MYTHIC_CONVERT, DIA_IN_BOX); + transfer_script[COND_CHECK_MYTHIC] = script_obj(COND_CHECK_MYTHIC, DIA_MYTHIC_CONVERT, COND_CHECK_MISSINGNO); transfer_script[DIA_MYTHIC_CONVERT] = script_obj(dialogue[DIA_MYTHIC_CONVERT], CMD_MYTHIC_MENU); - transfer_script[CMD_MYTHIC_MENU] = script_obj(CMD_MYTHIC_MENU, DIA_IN_BOX); + transfer_script[CMD_MYTHIC_MENU] = script_obj(CMD_MYTHIC_MENU, COND_CHECK_MISSINGNO); + transfer_script[COND_CHECK_MISSINGNO] = script_obj(COND_CHECK_MISSINGNO, DIA_IS_MISSINGNO, DIA_IN_BOX); + transfer_script[DIA_IS_MISSINGNO] = script_obj(dialogue[DIA_IS_MISSINGNO], DIA_IN_BOX); transfer_script[DIA_IN_BOX] = script_obj(dialogue[DIA_IN_BOX], CMD_BOX_MENU); transfer_script[CMD_BOX_MENU] = script_obj(CMD_BOX_MENU, CMD_IMPORT_POKEMON, DIA_CANCEL); transfer_script[DIA_CANCEL] = script_obj(dialogue[DIA_CANCEL], CMD_CANCEL_LINK); transfer_script[CMD_IMPORT_POKEMON] = script_obj(CMD_IMPORT_POKEMON, CMD_CONTINUE_LINK); - transfer_script[CMD_CONTINUE_LINK] = script_obj(CMD_CONTINUE_LINK, DIA_TRANS_GOOD); + transfer_script[CMD_CONTINUE_LINK] = script_obj(CMD_CONTINUE_LINK, CMD_END_MISSINGNO); transfer_script[CMD_CANCEL_LINK] = script_obj(CMD_CANCEL_LINK, CMD_END_SCRIPT); + transfer_script[CMD_END_MISSINGNO] = script_obj(CMD_END_MISSINGNO, DIA_TRANS_GOOD); // Complete the transfer and give messages based on the transfered Pokemon transfer_script[DIA_TRANS_GOOD] = script_obj(dialogue[DIA_TRANS_GOOD], COND_NEW_POKEMON); @@ -285,6 +289,14 @@ bool run_conditional(int index) case COND_IS_HOENN_E: return curr_rom.gamecode == EMERALD_ID; + case COND_CHECK_MISSINGNO: + if (party_data.get_contains_missingno()) + { + set_missingno(true); + return true; + } + return false; + case CMD_START_LINK: load_flex_background(BG_FENNEL, 3); link_animation_state(STATE_CONNECTION); @@ -317,6 +329,10 @@ bool run_conditional(int index) return true; case CMD_END_SCRIPT: + if (get_missingno_enabled()) + { + set_missingno(false); + } return true; case CMD_LANG_MENU: @@ -380,6 +396,13 @@ bool run_conditional(int index) party_data.continue_link(true); return true; + case CMD_END_MISSINGNO: + if (get_missingno_enabled()) + { + set_missingno(false); + } + return true; + default: tte_set_pos(0, 0); tte_write("ERROR! No conditional found."); diff --git a/source/sprite_data.cpp b/source/sprite_data.cpp index e837e14..3c187b7 100644 --- a/source/sprite_data.cpp +++ b/source/sprite_data.cpp @@ -65,6 +65,12 @@ void set_background_pal(int curr_rom_id, bool dark, bool fade) new_pal_bg[3] = (!dark ? RGB15(11, 22, 13) : RGB15(7, 14, 8)); new_pal_bg[4] = (!dark ? RGB15(20, 26, 20) : RGB15(12, 16, 13)); break; + case 0xFF: // MissingNo + new_pal_bg[1] = RGB15(3, 2, 2); + new_pal_bg[2] = RGB15(31, 31, 30); + new_pal_bg[3] = RGB15(29, 22, 17); + new_pal_bg[4] = RGB15(15, 14, 18); + break; default: new_pal_bg[1] = (!dark ? RGB15(7, 7, 11) : RGB15(0, 0, 0)); new_pal_bg[2] = (!dark ? RGB15(13, 13, 16) : RGB15(0, 0, 0)); @@ -358,6 +364,10 @@ void load_temp_box_sprites(Pokemon_Party party_data) { dex_num = 252 + curr_pkmn.unown_letter; } + else if (curr_pkmn.is_missingno) + { + dex_num = 0; + } load_sprite(party_sprites[i], &unique_duel_frame_menu_spritesTiles[dex_num * 32], 256, curr_tile_id, MENU_SPRITE_PALS[dex_num][curr_pkmn.is_shiny] + MENU_PAL_START, ATTR0_SQUARE, ATTR1_SIZE_16x16, 1); obj_set_pos(party_sprites[i], (16 * (i % 10)) + 40, (16 * (i / 10)) + 24); obj_unhide(party_sprites[i], 0); @@ -607,29 +617,7 @@ void load_select_sprites(int game_id, int lang) #define FEN_BLI_R0 (37 | (0b00 << 0xA) | (2 << 0xC)) #define FEN_BLI_R1 (142 | (0b00 << 0xA) | (2 << 0xC)) #define FEN_BLI_R2 (145 | (0b00 << 0xA) | (2 << 0xC)) -void fennel_blink(int frame) -{ - int SBB = 15; // SSB is the array of which tile goes where - switch (frame) - { - case 0: - se_mem[SBB][12 + (5 * 32)] = FEN_BLI_L20; - se_mem[SBB][13 + (5 * 32)] = FEN_BLI_L21; - se_mem[SBB][15 + (5 * 32)] = FEN_BLI_R2; - break; - case 1: - case 3: - se_mem[SBB][12 + (5 * 32)] = FEN_BLI_L10; - se_mem[SBB][13 + (5 * 32)] = FEN_BLI_L11; - se_mem[SBB][15 + (5 * 32)] = FEN_BLI_R1; - break; - case 2: - se_mem[SBB][12 + (5 * 32)] = FEN_BLI_L00; - se_mem[SBB][13 + (5 * 32)] = FEN_BLI_L01; - se_mem[SBB][15 + (5 * 32)] = FEN_BLI_R0; - break; - } -} + // tile ID, VH Flip, Palette Bank #define FEN_SPE_00 (46 | (0b00 << 0xA) | (2 << 0xC)) #define FEN_SPE_01 (56 | (0b00 << 0xA) | (2 << 0xC)) @@ -640,27 +628,53 @@ void fennel_blink(int frame) #define FEN_SPE_30 (148 | (0b00 << 0xA) | (2 << 0xC)) #define FEN_SPE_31 (150 | (0b00 << 0xA) | (2 << 0xC)) -void fennel_speak(int frame) +void fennel_blink(int frame) { + bool missingno = get_missingno_enabled(); int SBB = 15; // SSB is the array of which tile goes where switch (frame) { case 0: - se_mem[SBB][14 + (6 * 32)] = FEN_SPE_00; - se_mem[SBB][14 + (7 * 32)] = FEN_SPE_01; + se_mem[SBB][12 + (5 * 32)] = missingno ? FEN_SPE_00 | FEN_BLI_L20 : FEN_BLI_L20; + se_mem[SBB][13 + (5 * 32)] = missingno ? FEN_SPE_01 | FEN_BLI_L21 : FEN_BLI_L21; + se_mem[SBB][15 + (5 * 32)] = missingno ? FEN_SPE_10 | FEN_BLI_R2 : FEN_BLI_R2; break; case 1: - se_mem[SBB][14 + (6 * 32)] = FEN_SPE_10; - se_mem[SBB][14 + (7 * 32)] = FEN_SPE_11; + case 3: + se_mem[SBB][12 + (5 * 32)] = missingno ? FEN_SPE_11 | FEN_BLI_L10 : FEN_BLI_L10; + se_mem[SBB][13 + (5 * 32)] = missingno ? FEN_SPE_20 | FEN_BLI_L11 : FEN_BLI_L11; + se_mem[SBB][15 + (5 * 32)] = missingno ? FEN_SPE_21 | FEN_BLI_R1 : FEN_BLI_R1; + break; + case 2: + se_mem[SBB][12 + (5 * 32)] = missingno ? FEN_SPE_30 | FEN_BLI_L00 : FEN_BLI_L00; + se_mem[SBB][13 + (5 * 32)] = missingno ? FEN_SPE_31 | FEN_BLI_L01 : FEN_BLI_L01; + se_mem[SBB][15 + (5 * 32)] = missingno ? FEN_SPE_00 | FEN_BLI_R0 : FEN_BLI_R0; + break; + } +} + +void fennel_speak(int frame) +{ + bool missingno = get_missingno_enabled(); + int SBB = 15; // SSB is the array of which tile goes where + switch (frame) + { + case 0: + se_mem[SBB][14 + (6 * 32)] = missingno ? FEN_SPE_00 | FEN_BLI_L20 : FEN_SPE_00; + se_mem[SBB][14 + (7 * 32)] = missingno ? FEN_SPE_01 | FEN_BLI_L21 : FEN_SPE_01; + break; + case 1: + se_mem[SBB][14 + (6 * 32)] = missingno ? FEN_SPE_10 | FEN_BLI_R2 : FEN_SPE_10; + se_mem[SBB][14 + (7 * 32)] = missingno ? FEN_SPE_11 | FEN_BLI_L10 : FEN_SPE_11; break; case 2: case 4: - se_mem[SBB][14 + (6 * 32)] = FEN_SPE_20; - se_mem[SBB][14 + (7 * 32)] = FEN_SPE_21; + se_mem[SBB][14 + (6 * 32)] = missingno ? FEN_SPE_01 | FEN_BLI_L21 : FEN_SPE_20; + se_mem[SBB][14 + (7 * 32)] = missingno ? FEN_SPE_01 | FEN_BLI_L21 : FEN_SPE_21; break; case 3: - se_mem[SBB][14 + (6 * 32)] = FEN_SPE_30; - se_mem[SBB][14 + (7 * 32)] = FEN_SPE_31; + se_mem[SBB][14 + (6 * 32)] = missingno ? FEN_SPE_30 | FEN_BLI_L00 : FEN_SPE_30; + se_mem[SBB][14 + (7 * 32)] = missingno ? FEN_SPE_31 | FEN_BLI_L01 : FEN_SPE_31; break; } } diff --git a/source/text_engine.cpp b/source/text_engine.cpp index 10bff54..416a119 100644 --- a/source/text_engine.cpp +++ b/source/text_engine.cpp @@ -105,7 +105,15 @@ int text_loop(int script) } if (get_curr_flex_background() == BG_FENNEL) { - fennel_speak(0); + if (get_missingno_enabled()) + { + fennel_speak(0); + fennel_blink(4); + } + else + { + fennel_speak(0); + } } } if (text_exit)