diff --git a/audio/unused audio/Looker.mid b/audio/unused audio/Looker.mid new file mode 100644 index 0000000..58d3ef1 Binary files /dev/null and b/audio/unused audio/Looker.mid differ diff --git a/audio/unused audio/LookerShort.mid b/audio/unused audio/LookerShort.mid new file mode 100644 index 0000000..ae05be5 Binary files /dev/null and b/audio/unused audio/LookerShort.mid differ diff --git a/graphics/types.png b/graphics/types.png index edaeb0f..3793847 100644 Binary files a/graphics/types.png and b/graphics/types.png differ diff --git a/graphics/unused graphics/types.png b/graphics/unused graphics/types.png index dd36364..339809e 100644 Binary files a/graphics/unused graphics/types.png and b/graphics/unused graphics/types.png differ diff --git a/include/button_menu.h b/include/button_menu.h index 989a011..fe5597d 100644 --- a/include/button_menu.h +++ b/include/button_menu.h @@ -11,6 +11,8 @@ #define BTN_POKEDEX 2 #define BTN_EVENTS 3 #define BTN_CREDITS 4 +#define BTN_OPENING 5 + #define BUTTON_CANCEL -1 class Button_Menu diff --git a/include/debug_mode.h b/include/debug_mode.h index bfc44a8..bcb1e2a 100644 --- a/include/debug_mode.h +++ b/include/debug_mode.h @@ -3,7 +3,7 @@ #define DEBUG_MODE false #define IGNORE_GAME_PAK true -#define IGNORE_LINK_CABLE false +#define IGNORE_LINK_CABLE true #define IGNORE_MG_E4_FLAGS true #define IGNORE_UNRECEIVED_PKMN true #define FORCE_TUTORIAL false @@ -11,7 +11,7 @@ #define SHOW_INVALID_PKMN false #define IGNORE_DEX_COMPLETION false -#define DEBUG_GAME LEAFGREEN_ID +#define DEBUG_GAME SAPPHIRE_ID; #define DEBUG_VERS VERS_1_0 #define DEBUG_LANG LANG_ENG diff --git a/include/gba_rom_values/eng_gba_rom_values.h b/include/gba_rom_values/eng_gba_rom_values.h index a18982c..6915110 100644 --- a/include/gba_rom_values/eng_gba_rom_values.h +++ b/include/gba_rom_values/eng_gba_rom_values.h @@ -26,7 +26,7 @@ const struct ROM_DATA ENG_RUBY_v0 = { .loc_sFanfareCounter = 0x030006DA, .loc_gPlttBufferFaded = 0x0202EEC8, .loc_gSprites = 0x02020004, - .loc_voicegroup = 0x08451F90, + .loc_voicegroup = 0x084401E8, .loc_sPicTable_NPC = 0x0836E788, // The following should be consistant across languages and revisions. @@ -75,7 +75,7 @@ const struct ROM_DATA ENG_SAPPHIRE_v0 = { .loc_sFanfareCounter = 0x030006DA, .loc_gPlttBufferFaded = 0x0202EEC8, .loc_gSprites = 0x02020004, - .loc_voicegroup = 0x08451FEC, + .loc_voicegroup = 0x08445644, .loc_sPicTable_NPC = 0x0836E718, // The following should be consistant across languages and revisions. @@ -124,7 +124,7 @@ const struct ROM_DATA ENG_RUBY_v1 = { .loc_sFanfareCounter = 0x030006DA, .loc_gPlttBufferFaded = 0x0202EEC8, .loc_gSprites = 0x02020004, - .loc_voicegroup = 0x08451FA4, + .loc_voicegroup = 0x084401FC, .loc_sPicTable_NPC = 0x0836E7A0, // The following should be consistant across languages and revisions. @@ -173,7 +173,7 @@ const struct ROM_DATA ENG_SAPPHIRE_v1 = { .loc_sFanfareCounter = 0x030006DA, .loc_gPlttBufferFaded = 0x0202EEC8, .loc_gSprites = 0x02020004, - .loc_voicegroup = 0x08452004, + .loc_voicegroup = 0x0844025C, .loc_sPicTable_NPC = 0x0836E730, // The following should be consistant across languages and revisions. @@ -222,7 +222,7 @@ const struct ROM_DATA ENG_RUBY_v2 = { .loc_sFanfareCounter = 0x030006DA, .loc_gPlttBufferFaded = 0x0202EEC8, .loc_gSprites = 0x02020004, - .loc_voicegroup = 0x08451FA4, + .loc_voicegroup = 0x084401FC, .loc_sPicTable_NPC = 0x0836E7A0, // The following should be consistant across languages and revisions. @@ -271,7 +271,7 @@ const struct ROM_DATA ENG_SAPPHIRE_v2 = { .loc_sFanfareCounter = 0x030006DA, .loc_gPlttBufferFaded = 0x0202EEC8, .loc_gSprites = 0x02020004, - .loc_voicegroup = 0x08452004, + .loc_voicegroup = 0x0844025C, .loc_sPicTable_NPC = 0x0836E730, // The following should be consistant across languages and revisions. @@ -320,7 +320,7 @@ const struct ROM_DATA ENG_FIRERED_v0 = { .loc_sFanfareCounter = 0x03000FC6, .loc_gPlttBufferFaded = 0x020375F8, .loc_gSprites = 0x0202063C, - .loc_voicegroup = 0x084957A0, + .loc_voicegroup = 0x08498878, .loc_sPicTable_NPC = 0x083A0AB8, // The following should be consistant across languages and revisions. @@ -372,7 +372,7 @@ const struct ROM_DATA ENG_LEAFGREEN_v0 = { .loc_sFanfareCounter = 0x03000FC6, .loc_gPlttBufferFaded = 0x020375F8, .loc_gSprites = 0x0202063C, - .loc_voicegroup = 0x0849507C, + .loc_voicegroup = 0x08498154, .loc_sPicTable_NPC = 0x083A0A98, // The following should be consistant across languages and revisions. @@ -424,7 +424,7 @@ const struct ROM_DATA ENG_FIRERED_v1 = { .loc_sFanfareCounter = 0x03000FC6, .loc_gPlttBufferFaded = 0x020375F8, .loc_gSprites = 0x0202063C, - .loc_voicegroup = 0x08495800, + .loc_voicegroup = 0x084988D8, .loc_sPicTable_NPC = 0x083A0B28, // The following should be consistant across languages and revisions. @@ -476,7 +476,7 @@ const struct ROM_DATA ENG_LEAFGREEN_v1 = { .loc_sFanfareCounter = 0x03000FC6, .loc_gPlttBufferFaded = 0x020375F8, .loc_gSprites = 0x0202063C, - .loc_voicegroup = 0x084950EC, + .loc_voicegroup = 0x084981C4, .loc_sPicTable_NPC = 0x083A0B08, // The following should be consistant across languages and revisions. @@ -528,7 +528,7 @@ const struct ROM_DATA ENG_EMERALD_v0 = { .loc_sFanfareCounter = 0x03000F4E, .loc_gPlttBufferFaded = 0x02037B14, .loc_gSprites = 0x02020630, - .loc_voicegroup = 0x086A6DE4, + .loc_voicegroup = 0x08686A74, .loc_sPicTable_NPC = 0x08506404, // The following should be consistant across languages and revisions. diff --git a/include/script_array.h b/include/script_array.h index be5ccc4..2a18922 100644 --- a/include/script_array.h +++ b/include/script_array.h @@ -18,7 +18,7 @@ #define DIA_TRANS_GOOD 9 #define DIA_NEW_DEX 10 #define DIA_NO_NEW_DEX 11 -#define DIA_SEND_FRIEND_HOENN 12 +#define DIA_SEND_FRIEND_HOENN_RS 12 #define DIA_SEND_FRIEND_KANTO 13 #define DIA_THANK 14 #define DIA_GET_MON 15 @@ -42,8 +42,10 @@ #define DIA_K_DEX_NOT_FULL 33 #define DIA_J_DEX_NOT_FULL 34 #define DIA_SOME_INVALID_PKMN 35 +#define DIA_MENU_BACK 36 +#define DIA_SEND_FRIEND_HOENN_E 37 -#define DIA_SIZE 36 +#define DIA_SIZE 38 #define DIA_END DIA_SIZE // Commands @@ -79,7 +81,7 @@ #define COND_MG_ENABLED CMDS_END + 6 #define COND_TUTORIAL_COMPLETE CMDS_END + 7 #define COND_NEW_POKEMON CMDS_END + 8 -#define COND_IS_HOENN CMDS_END + 9 +#define COND_IS_HOENN_RS CMDS_END + 9 #define COND_IS_FRLGE CMDS_END + 10 #define COND_MG_OTHER_EVENT CMDS_END + 11 #define COND_PKMN_TO_COLLECT CMDS_END + 12 @@ -88,8 +90,9 @@ #define COND_CHECK_DEX CMDS_END + 15 #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_SIZE 18 +#define COND_SIZE 19 #define COND_END CMDS_END + COND_SIZE // Ends diff --git a/include/script_var.h b/include/script_var.h index 5bde7bf..5633914 100644 --- a/include/script_var.h +++ b/include/script_var.h @@ -48,12 +48,12 @@ class textbox_var : public xse_var { public: using xse_var::xse_var; - void set_text(std::u8string_view nText); + void set_text(std::u16string_view nText); void insert_text(u8 mg_array[]); void set_start(); void insert_virtual_text(u8 mg_array[]); void set_virtual_start(); - std::u8string_view text; + std::u16string_view text; }; class movement_var : public xse_var diff --git a/include/sprite_data.h b/include/sprite_data.h index 3bc89fb..9d08ca4 100644 --- a/include/sprite_data.h +++ b/include/sprite_data.h @@ -112,7 +112,7 @@ extern rom_data curr_rom; void load_sprite(OBJ_ATTR *sprite, const unsigned int objTiles[], int objTilesLen, u32 &tile_id, u32 pal_bank, int attr0, int attr1, u32 priority); void load_background(); -void set_background_pal(int curr_rom_id, bool dark); +void set_background_pal(int curr_rom_id, bool dark, bool fade); void load_textbox_background(); void load_flex_background(int background_id, int layer); void load_eternal_sprites(); diff --git a/source/main.cpp b/source/main.cpp index d0effb1..c7dd992 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -145,8 +145,8 @@ void initalization_script(void) void game_load_error(void) { - REG_BG0CNT = (REG_BG0CNT & ~BG_PRIO_MASK) | BG_PRIO(3); - REG_BG1CNT = (REG_BG1CNT & ~BG_PRIO_MASK) | BG_PRIO(2); + // EG_BG0CNT = (REG_BG0CNT & ~BG_PRIO_MASK) | BG_PRIO(3); + // REG_BG1CNT = (REG_BG1CNT & ~BG_PRIO_MASK) | BG_PRIO(2); REG_BG2CNT = (REG_BG2CNT & ~BG_PRIO_MASK) | BG_PRIO(1); REG_BG2VOFS = 0; tte_set_pos(40, 24); @@ -182,10 +182,13 @@ void first_load_message(void) int credits() { -#define CREDITS_ARRAY_SIZE 16 +#define CREDITS_ARRAY_SIZE 18 int curr_credits_num = 0; std::string credits_array[CREDITS_ARRAY_SIZE] = { - "Lead developer:\n\nThe Gears of\nProgress\n\nLead graphic design:\n\nJome", + "Lead developer:\n\nThe Gears of\nProgress", + "Logo and co-ideator:\n\n-Jome\n\nSpritework:\n\n-LJ Birdman\n\n", + "Icon Sprites: \n\n-LuigiTKO\n-GuiAbel\n-SourApple\n & the artists from\nPok@mon Showdown and\nCrystal Clear", + "Remote and Arbitrary\nCode Execution\nassistance:\n\n\n-TimoVM", "Development\nassistance:\n\n-im a blisy\n-rileyk64\n-Shao", "Built using:\n\n\n-DevkitPro\n-LibTonc\n-LibGBA", "Inspired by the\nworks of:\n\n-Goppier\n-Lorenzooone\n-im a blisy\n-RETIRE", @@ -196,7 +199,6 @@ int credits() "Pok@mon data\nobtained from:\n\n-Bulbapedia\n-Serebii\n-PokeAPI.com", "Discord community\nassistance:\n\n-Hex Maniac Advance\n Development\n-gbadev\n-pret", "Writing assistance:\n\n\n-Mad", - "Remote and Arbitrary\nCode Execution\nassistance:\n\n\n-TimoVM", "An immense thanks to\nLorenzooone for\ntheir assistance in\nreading/writing save\ndata. Without them,\nthis project would\nnot have been\npossible.", "Special thanks to\nEnn, roku, Sleepy,\nEza, sarahtonin,\nBasabi, Mad, and\neveryone who has\nlistened to me talk\nabout this for\nmonths!", "All Pok@mon names,\nsprites, and names\nof related resources\nare copyright\nNintendo,\nCreatures Inc.,\nand GAME FREAK Inc.", @@ -341,27 +343,8 @@ int main(void) { initalization_script(); - // Check if the game has been loaded correctly. - while (!curr_rom.load_rom()) - { - game_load_error(); - initalization_script(); - } - - // Initalize memory and save data after loading the game - init_bank(); - initalize_memory_locations(); - load_custom_save_data(); - - if (!IGNORE_MG_E4_FLAGS && (!get_tutorial_flag() || !read_flag(curr_rom.e4_flag) || FORCE_TUTORIAL)) - { - first_load_message(); - initalize_save_data(); - } - // Set colors based on current ROM - set_background_pal(curr_rom.gamecode, false); - pal_bg_bank[14][15] = pal_bg_mem[3]; + set_background_pal(0, false, false); // Legal mumbo jumbo tte_set_pos(8, 0); @@ -394,18 +377,63 @@ int main(void) key_poll(); // Reset the keys curr_rom.load_rom(); + + obj_set_pos(ptgb_logo_l, 56, 12); + obj_set_pos(ptgb_logo_r, 56 + 64, 12); + obj_unhide_multi(ptgb_logo_l, 1, 2); + bool start_pressed = false; + REG_BLDCNT = BLD_BUILD(BLD_BG3, BLD_BG0, 1); + tte_set_pos(6 * 8, 12 * 8); + tte_write("#{cx:0xF000}Push Start Button!"); + int fade = 0; + while (!start_pressed) + { + fade = abs(((get_frame_count() / 6) % 24) - 12); + global_next_frame(); + start_pressed = key_hit(KEY_START) | key_hit(KEY_A); + REG_BLDALPHA = BLDA_BUILD(0b10000, fade); + }; + key_poll(); + tte_erase_rect(0, 0, H_MAX, V_MAX); + + // Check if the game has been loaded correctly. + while (!curr_rom.load_rom()) + { + obj_hide_multi(ptgb_logo_l, 2); + game_load_error(); + // initalization_script(); + } + + // Initalize memory and save data after loading the game + init_bank(); + initalize_memory_locations(); + load_custom_save_data(); + + set_background_pal(curr_rom.gamecode, false, true); + + if (!IGNORE_MG_E4_FLAGS && (!get_tutorial_flag() || FORCE_TUTORIAL)) + { + obj_hide_multi(ptgb_logo_l, 2); + text_loop(BTN_TRANSFER); + initalize_save_data(); + } + + obj_unhide_multi(ptgb_logo_l, 1, 2); + // MAIN LOOP - while (1) + while (true) { if (DEBUG_MODE) { print_mem_section(); curr_rom.print_rom_info(); } + load_flex_background(BG_MAIN_MENU, 2); + + obj_unhide_multi(ptgb_logo_l, 1, 2); obj_set_pos(ptgb_logo_l, 56, 12); obj_set_pos(ptgb_logo_r, 56 + 64, 12); - obj_unhide_multi(ptgb_logo_l, 1, 2); - load_flex_background(BG_MAIN_MENU, 2); + switch (main_menu_loop()) { case (BTN_TRANSFER): @@ -414,19 +442,17 @@ int main(void) text_loop(BTN_TRANSFER); break; case (BTN_POKEDEX): - if (IGNORE_MG_E4_FLAGS || read_flag(curr_rom.e4_flag)) - { - load_flex_background(BG_DEX, 2); - set_background_pal(curr_rom.gamecode, true); - obj_hide_multi(ptgb_logo_l, 2); - pokedex_loop(); - load_flex_background(BG_DEX, 3); - set_background_pal(curr_rom.gamecode, false); - } + load_flex_background(BG_DEX, 2); + set_background_pal(curr_rom.gamecode, true, false); + obj_hide_multi(ptgb_logo_l, 2); + pokedex_loop(); + load_flex_background(BG_DEX, 3); + set_background_pal(curr_rom.gamecode, false, false); break; case (BTN_CREDITS): set_textbox_large(); show_text_box(); + REG_BG1CNT = (REG_BG1CNT & ~BG_PRIO_MASK) | BG_PRIO(3); obj_set_pos(ptgb_logo_l, 56, 108); obj_set_pos(ptgb_logo_r, 56 + 64, 108); credits(); diff --git a/source/mystery_gift_builder.cpp b/source/mystery_gift_builder.cpp index ca2d8a9..8b71745 100644 --- a/source/mystery_gift_builder.cpp +++ b/source/mystery_gift_builder.cpp @@ -152,35 +152,35 @@ void mystery_gift_script::build_script(Pokemon_Party &incoming_box_data) switch (curr_rom.gamecode) { case RUBY_ID: - textGreet.set_text(u8"When I was young, I traveled the worldŇas a POKéMON TRAINER."); - textMoveBox.set_text(u8"ȆÀËOh, of course, I have to unlockŇthe door. Silly me!"); - textWeHere.set_text(u8"ȆÀËLOOKER: I am here in Hoenn to findŇthe leader MAXIE.ȼHowever, in the meantime, I amŇhelping my friend Professor FENNEL.ȼThis is why you are here, no?ȼI shall contact her and tell herŇyou are ready.ŞCome! Allons y!"); + textGreet.set_text(u"When I was young, I traveled the worldŇas a POKéMON TRAINER."); + textMoveBox.set_text(u"ȆÀËOh, of course, I have to unlockŇthe door!"); + textWeHere.set_text(u"ȆÀËLOOKER: I am here in Hoenn to findŇthe leader MAXIE.ȼAs well, I am helping my friendŇProfessor FENNEL.ȼThis is why you are here, no?ŇI shall tell her you are ready.ŞCome! Allons y!"); break; case SAPPHIRE_ID: - textGreet.set_text(u8"When I was young, I traveled the worldŇas a POKéMON TRAINER."); - textMoveBox.set_text(u8"ȆÀËOh, of course, I have to unlockŇthe door. Silly me!"); - textWeHere.set_text(u8"ȆÀËLOOKER: I am here in Hoenn to findŇthe leader ARCHIE.ȼHowever, in the meantime, I amŇhelping my friend Professor FENNEL.ȼThis is why you are here, no?ȼI shall contact her and tell herŇyou are ready.ŞCome! Allons y!"); + textGreet.set_text(u"When I was young, I traveled the worldŇas a POKéMON TRAINER."); + textMoveBox.set_text(u"ȆÀËOh, of course, I have to unlockŇthe door!"); + textWeHere.set_text(u"ȆÀËLOOKER: I am here in Hoenn to findŇthe leader ARCHIE.ȼAs well, I am helping my friendŇProfessor FENNEL.ȼThis is why you are here, no?ŇI shall tell her you are ready.ŞCome! Allons y!"); break; case FIRERED_ID: case LEAFGREEN_ID: - textGreet.set_text(u8"I may not look like much now,Ňbut when I was younger…"); - textMoveBox.set_text(u8"ȆÀËOh, of course, I have to moveŇthe boxes. Silly me!"); - textWeHere.set_text(u8"ȆÀËLOOKER: I am here in the Sevii IslandsŇto find the leader GIOVANNI.ȼHowever, in the meantime, I amŇhelping my friend Professor FENNEL.ȼThis is why you are here, no?ȼI shall contact her and tell herŇyou are ready.ŞCome! Allons y!"); + textGreet.set_text(u"I may not look like much now,Ňbut when I was younger…"); + textMoveBox.set_text(u"ȆÀËOh, of course, I have to moveŇthe boxes!"); + textWeHere.set_text(u"ȆÀËLOOKER: I am here in Kanto to findŇthe leader GIOVANNI.ȼAs well, I am helping my friendŇProfessor FENNEL.ȼThis is why you are here, no?ŇI shall tell her you are ready.ŞCome! Allons y!"); break; case EMERALD_ID: - textGreet.set_text(u8"When I was young, I traveled the worldŇas a POKéMON TRAINER."); - textMoveBox.set_text(u8"ȆÀËOh, of course, I have to moveŇthe plants. Silly me!"); - textWeHere.set_text(u8"ȆÀËLOOKER: I am here in Hoenn to findŇthe leaders MAXIE and ARCHIE.ȼHowever, in the meantime, I amŇhelping my friend Professor FENNEL.ȼThis is why you are here, no?ȼI shall contact her and tell herŇyou are ready.ŞCome! Allons y!"); + textGreet.set_text(u"When I was young, I traveled the worldŇas a POKéMON TRAINER."); + textMoveBox.set_text(u"ȆÀËOh, of course, I have to moveŇthe plants!"); + textWeHere.set_text(u"ȆÀËLOOKER: I am here in Hoenn to findŇthe leaders MAXIE and ARCHIE.ȼAs well, I am helping my friendŇProfessor FENNEL.ȼThis is why you are here, no?ŇI shall tell her you are ready.ŞCome! Allons y!"); break; } - textReceived.set_text(u8"ȆÀÁƲÀ’S POKéMON were sent to theŇPC!"); - textYouMustBe.set_text(first_time ? u8"Ah! You must be ƲÀ!ŇI was told you’d be coming.ȼOh! I still wear my disguise! Pardon!ŇOr, rather, let me introduce myself." : u8"Ah, ƲÀ! Welcome back!ŇGood to see you again!ȼOh! I still wear my disguise! Pardon!"); - textIAm.set_text(first_time ? u8"ȆÀËI am a globe-trotting elite of theŇInternational Police.ȼMy name…ŞAh, no, I shall inform you of myŇcode name only.ȼMy code name, it is LOOKER.ŇIt is how I am called!" : u8"ȆÀËIt is I, globe-trotting elite of theŇInternational Police.ȼMy code name, it is LOOKER.ŇIt is how I am called!"); - textPCConvo.set_text(u8"ȆÀÉFENNEL: Ah, LOOKER! Good to hear fromŇyou! I take it ƲÀ has arrived?ȼȆÀËLOOKER: Indeed! They’re here andŇready to receive their POKéMON!ȼȆÀÉFENNEL: Excellent! I’ll be sending themŇover momentarily… stand by!"); // ȼDon’t worry ƲÀ,Ňyou won’t have to do a thing!"); - textPCThanks.set_text(u8"ȆÀÉFENNEL: It looks like everything wasŇsent to your PC successfully!ȼThanks again for your help ƲÀ!ŇSee you around, LOOKER!"); - textThank.set_text(u8"ȆÀËThanks for stopping by, ƲÀ!ȼIf you’ll excuse me, I need toŇreturn to my disguise.ŞUntil our paths cross again!"); - textPCFull.set_text(u8"ȆÀÉFENNEL: Hm, it seems like the PC is full!ȼGo make some room, and I can sendŇover the rest of your POKéMON."); - textLookerFull.set_text(u8"ȆÀËLOOKER: Speak to me again afterŇyou’ve made room, ƲÀ!ȼIn the meantime, I will return toŇmy disguise."); + textReceived.set_text(u"ȆÀÁƲÀ’S POKéMON were sent to theŇPC!"); + textYouMustBe.set_text(first_time ? u"Ah! You must be ƲÀ!ŇI was told you’d be coming.ȼOh! I still wear my disguise! Pardon!ŇOr, rather, let me introduce myself." : u"Ah, ƲÀ! Welcome back!ŇGood to see you again!ȼOh! I still wear my disguise! Pardon!"); + textIAm.set_text(first_time ? u"ȆÀËI am a globe-trotting elite of theŇInternational Police.ȼMy name…ŞAh, no, I shall inform you of myŇcode name only.ȼMy code name, it is LOOKER!" : u"ȆÀËIt is I, globe-trotting elite of theŇInternational Police.ȼMy code name, it is LOOKER!"); + textPCConvo.set_text(u"ȆÀÉFENNEL: Ah, LOOKER! I take itŇƲÀ has arrived?ȼȆÀËLOOKER: Indeed! They’re ready toŇreceive their POKéMON!ȼȆÀÉFENNEL: Excellent! I’ll send themŇover momentarily… stand by!"); // ȼDon’t worry ƲÀ,Ňyou won’t have to do a thing!"); + textPCThanks.set_text(u"ȆÀÉFENNEL: It looks like everything wasŇsent to your PC successfully!ȼThank you both for your help!"); + textThank.set_text(u"ȆÀËThanks for stopping by, ƲÀ!ȼIf you’ll excuse me, I must returnŇto my disguise.ŞUntil our paths cross again!"); + textPCFull.set_text(u"ȆÀÉFENNEL: It seems like the PC is full!ȼGo make some room, and I can sendŇover the rest of your POKéMON."); + textLookerFull.set_text(u"ȆÀËLOOKER: Speak to me again afterŇyou’ve made room, ƲÀ!ȼIn the meantime, I will return toŇmy disguise."); const int movementSlowSpinArray[16] = { MOVEMENT_ACTION_FACE_LEFT, @@ -280,12 +280,32 @@ void mystery_gift_script::build_script(Pokemon_Party &incoming_box_data) const int movementGoDownArray[2] = {MOVEMENT_ACTION_WALK_FAST_DOWN, MOVEMENT_ACTION_FACE_UP}; movementGoDown.set_movement(movementGoDownArray, 2); - // v Instrument - // songLooker.add_track({0xBC, 0x00, 0xBB, 0x38, 0xBD, 0x38, 0xBE, 0x64, 0xBF, 0x30, 0xD4, 0x37, 0x64, 0x86, 0x3C, 0x86, 0x40, 0x86, 0x43, 0x86, 0x48, 0x86, 0x4C, 0x86, 0xE0, 0x4F, 0x92, 0x4C, 0x92, 0xD4, 0x38, 0x86, 0x3C, 0x86, 0x3F, 0x86, 0x44, 0x86, 0x48, 0x86, 0x4B, 0x86, 0xE0, 0x50, 0x92, 0x4B, 0x92, 0xD4, 0x3A, 0x86, 0x3E, 0x86, 0x41, 0x86, 0x46, 0x86, 0x4A, 0x86, 0x4D, 0x86, 0xE0, 0x52, 0x8C, 0x86, 0xD4, 0x86, 0xD4, 0x86, 0xD4, 0x86, 0xF2, 0x54, 0xA8, 0xAF, 0x83, 0xB1}); - // songLooker.add_track({0xBC, 0x00, 0xBD, 0x3C, 0xBE, 0x5A, 0xBF, 0x50, 0x92, 0xD4, 0x24, 0x64, 0x86, 0x28, 0x86, 0x2B, 0x86, 0xE0, 0x28, 0x92, 0x24, 0x9C, 0xD4, 0x86, 0x27, 0x86, 0x2C, 0x86, 0xE0, 0x27, 0x92, 0x24, 0x9C, 0xD4, 0x26, 0x86, 0x29, 0x86, 0x2E, 0x86, 0xE0, 0x35, 0x8C, 0x86, 0xD4, 0x32, 0x86, 0xD4, 0x86, 0xD4, 0x86, 0xF0, 0x30, 0xA8, 0xAF, 0x83, 0xB1}); - // songLooker.add_track({0xBC, 0x00, 0xBD, 0x40, 0xBE, 0x5A, 0xBF, 0x61, 0xD4, 0x28, 0x64, 0x86, 0x2B, 0x86, 0x30, 0x86, 0x34, 0x86, 0x37, 0x86, 0x3C, 0x86, 0xE0, 0x40, 0x93, 0x3C, 0x58, 0x91, 0xD4, 0x27, 0x64, 0x86, 0x2C, 0x86, 0x30, 0x86, 0x33, 0x86, 0x38, 0x86, 0x3C, 0x86, 0xE0, 0x3F, 0x92, 0x3C, 0x92, 0xD4, 0x29, 0x86, 0x2E, 0x86, 0x32, 0x86, 0x35, 0x86, 0x3A, 0x86, 0x3E, 0x86, 0xDA, 0x41, 0x8C, 0x86, 0xD4, 0x86, 0xD4, 0x86, 0xD4, 0x86, 0xF2, 0x40, 0xA8, 0xAF, 0x83, 0xB1}); - // songLooker.add_track({0xBC, 0x00, 0xBD, 0x40, 0xBE, 0x5A, 0xBF, 0x20, 0x86, 0xD4, 0x28, 0x64, 0x86, 0x2B, 0x86, 0x30, 0x86, 0x34, 0x86, 0x37, 0x86, 0xE0, 0x3C, 0x92, 0x3C, 0x58, 0x98, 0xD4, 0x27, 0x64, 0x86, 0x2C, 0x86, 0x30, 0x86, 0x33, 0x86, 0x38, 0x86, 0xE0, 0x3C, 0x92, 0x38, 0x98, 0xD4, 0x29, 0x86, 0x2E, 0x86, 0x32, 0x86, 0x35, 0x86, 0x3A, 0x86, 0xE0, 0x3E, 0x8C, 0x86, 0xE0, 0x92, 0xF2, 0x3C, 0xA8, 0xAF, 0x83, 0xB1}); - // songLooker.add_track({0xBC, 0x00, 0xBD, 0x40, 0xBE, 0x5A, 0xBF, 0x40, 0xD4, 0x2B, 0x64, 0x86, 0x30, 0x86, 0x34, 0x86, 0x37, 0x86, 0x3C, 0x86, 0x40, 0x86, 0xE0, 0x43, 0x92, 0x40, 0x92, 0xD4, 0x2C, 0x86, 0x30, 0x86, 0x33, 0x86, 0x38, 0x86, 0x3C, 0x86, 0x3F, 0x86, 0xE0, 0x44, 0x92, 0x3F, 0x92, 0xD4, 0x2E, 0x86, 0x32, 0x86, 0x35, 0x86, 0x3A, 0x86, 0x3E, 0x86, 0x41, 0x86, 0xE0, 0x46, 0x8C, 0x86, 0xD4, 0x86, 0xD4, 0x86, 0xD4, 0x86, 0xF2, 0x48, 0xA8, 0xAF, 0x83, 0xB1, 0xD7, 0x6B}); + // songLooker.add_track({0xBC, 0x00, 0xBB, 0x38, 0xBD, 0x38, 0xC4, 0x00, 0xBE, 0x60, 0xBF, 0x3D, 0xC0, 0x40, 0xD4, 0x51, 0x70, 0x86, 0xD4, 0x8C, 0x53, 0x86, 0xD4, 0x8C, 0x54, 0x86, 0xD4, 0x92, 0xE8, 0x55, 0x92, 0xBE, 0x64, 0x82, 0x6C, 0x84, 0x74, 0x85, 0xB1}); + songLooker.add_track({0xBC, 0x00, 0xBD, 0x38, 0xC4, 0x00, 0xBE, 0x60, 0xBF, 0x46, 0xC0, 0x40, 0x83, 0xD4, 0x51, 0x3C, 0x86, 0xD4, 0x8C, 0x53, 0x86, 0xD4, 0x8C, 0x54, 0x86, 0xD4, 0x92, 0xE8, 0x55, 0x99, 0x81, 0xB1}); + songLooker.add_track({0xBC, 0x00, 0xBD, 0x38, 0xC4, 0x00, 0xBF, 0x34, 0xBE, 0x6E, 0xC0, 0x40, 0xD4, 0x3C, 0x70, 0x86, 0xD4, 0x8C, 0x3B, 0x86, 0xD4, 0x8C, 0x3C, 0x86, 0xD4, 0x92, 0xEA, 0x3D, 0x9B, 0x83, 0xB1}); + songLooker.add_track({0xBC, 0x00, 0xBD, 0x38, 0xC4, 0x00, 0xBF, 0x34, 0xBE, 0x6E, 0xC0, 0x40, 0xD4, 0x39, 0x70, 0x86, 0xD4, 0x8C, 0x36, 0x86, 0xD4, 0x8C, 0x37, 0x86, 0xD4, 0x92, 0xEA, 0x39, 0x9B, 0x83, 0xB1}); + songLooker.add_track({0xBC, 0x00, 0xBD, 0x38, 0xC4, 0x00, 0xBF, 0x34, 0xBE, 0x6E, 0xC0, 0x40, 0xD4, 0x34, 0x70, 0x86, 0xD4, 0x8C, 0x32, 0x86, 0xD4, 0x8C, 0x34, 0x86, 0xD4, 0x92, 0xEA, 0x37, 0x9B, 0x83, 0xB1}); + // songLooker.add_track({0xBC, 0x00, 0xBD, 0x3C, 0xC4, 0x00, 0xBF, 0x58, 0xBE, 0x3B, 0xC0, 0x40, 0xD4, 0x40, 0x70, 0x86, 0xD4, 0x8C, 0x42, 0x86, 0xD4, 0x8C, 0x43, 0x86, 0xD4, 0x92, 0xE8, 0x99, 0x81, 0xB1}); + // songLooker.add_track({0xBC, 0x00, 0xBD, 0x18, 0xC4, 0x00, 0xBE, 0x48, 0xBF, 0x1E, 0xC0, 0x40, 0xA0, 0xD0, 0x43, 0x70, 0x86, 0x45, 0x8C, 0x46, 0x8C, 0x45, 0x86, 0x47, 0x86, 0x49, 0x81, 0xB1}); + + unsigned char instrument; + switch (curr_rom.gamecode) + { + case RUBY_ID: + case SAPPHIRE_ID: + instrument = 0x24; + break; + case FIRERED_ID: + case LEAFGREEN_ID: + instrument = 0x3E; + break; + case EMERALD_ID: + default: + instrument = 0x26; + break; + }; + songLooker.add_track({0xBC, 0x00, 0xBD, instrument, 0xC4, 0x00, 0xBE, 0x7F, 0xBF, 0x40, 0xC0, 0x40, 0xD4, 0x21, 0x70, 0x86, 0xD4, 0x8C, 0x20, 0x86, 0xD4, 0x8C, 0x1F, 0x86, 0xDA, 0x8C, 0xD4, 0x2D, 0x86, 0x21, 0x8C, 0xD4, 0x86, 0xD4, 0x8C, 0xD4, 0x85, 0xB1}); + // songLooker.add_track({0xBC, 0x00, 0xBD, 0x7E, 0xC4, 0x00, 0xBE, 0x53, 0xBF, 0x40, 0xD4, 0x24, 0x70, 0x8C, 0xD4, 0x98, 0x32, 0x86, 0xD4, 0x86, 0x30, 0x86, 0xD4, 0x86, 0xD4, 0x86, 0xD4, 0x86, 0x2D, 0x86, 0xD4, 0x86, 0xD4, 0x86, 0xD4, 0x85, 0xB1}); int dex_nums[MAX_PKMN_IN_BOX] = {}; @@ -342,7 +362,7 @@ void mystery_gift_script::build_script(Pokemon_Party &incoming_box_data) songLooker.insert_music_data(save_section_30, 0, 0, 0, curr_rom.loc_voicegroup); asm_var customSong(songLooker.get_loc_in_sec30(), sec30_variable_list, &curr_section30_index); - asm_var customSongDuration(388, sec30_variable_list, &curr_section30_index); + asm_var customSongDuration(119, sec30_variable_list, &curr_section30_index); while (curr_section30_index % 4 != 0) { diff --git a/source/mystery_gift_injector.cpp b/source/mystery_gift_injector.cpp index d20b283..641b4d0 100644 --- a/source/mystery_gift_injector.cpp +++ b/source/mystery_gift_injector.cpp @@ -7,61 +7,73 @@ #include "pokemon_data.h" // This will need to be modified for the JP releases -static u8 bill_wonder_card[0x14E] = { - 0x39, 0x2C, 0x00, 0x00, 0xBA, 0xB4, 0xBE, 0xB9, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0xCA, 0xCC, 0xC9, 0xC0, 0xBF, 0xCD, 0xCD, 0xC9, 0xCC, 0x00, 0xC0, 0xBF, 0xC8, 0xC8, 0xBF, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0xE6, 0xD5, 0xE2, 0xE7, 0xDA, 0xD9, 0xE6, 0x00, 0xBD, 0xD9, 0xE6, 0xE8, 0xDD, 0xDA, 0xDD, 0xD7, 0xD5, 0xE8, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC2, 0xD9, 0xD5, 0xD8, 0x00, 0xE8, 0xE3, 0x00, 0xCC, 0xE3, 0xE9, 0xE8, 0xD9, 0x00, 0xA3, 0xA6, 0x00, 0xD5, 0xE2, 0xD8, 0x00, 0xD7, 0xDC, 0xD5, 0xE8, 0x00, 0xEB, 0xDD, 0xE8, 0xDC, 0x00, 0xBC, 0xC3, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE8, 0xE3, 0x00, 0xDB, 0xD9, 0xE8, 0x00, 0xED, 0xE3, 0xE9, 0xE6, 0x00, 0xE8, 0xE6, 0xD5, 0xE2, 0xE7, 0xDA, 0xD9, 0xE6, 0xD9, 0xD8, 0x00, 0xCA, 0xC9, 0xC5, 0x1B, 0xC7, 0xC9, 0xC8, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBE, 0xE3, 0x00, 0xE2, 0xE3, 0xE8, 0x00, 0xE8, 0xE3, 0xE7, 0xE7, 0x00, 0xE8, 0xDC, 0xDD, 0xE7, 0x00, 0xBF, 0xEC, 0xD7, 0xDC, 0xD5, 0xE2, 0xDB, 0xD9, 0x00, 0xBD, 0xD5, 0xE6, 0xD8, 0x00, 0xD6, 0xD9, 0xDA, 0xE3, 0xE6, 0xD9, 0x00, 0x00, 0x00, 0xE6, 0xD9, 0xD7, 0xD9, 0xDD, 0xEA, 0xDD, 0xE2, 0xDB, 0x00, 0xED, 0xE3, 0xE9, 0xE6, 0x00, 0xE8, 0xE6, 0xD5, 0xE2, 0xE7, 0xDA, 0xD9, 0xE6, 0xD9, 0xD8, 0x00, 0xCA, 0xC9, 0xC5, 0x1B, 0xC7, 0xC9, 0xC8, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -static u8 lanette_wonder_card[0x14E] = { - 0x3F, 0x7C, 0x00, 0x00, 0xBA, 0xB4, 0xBE, 0xB9, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0xCA, 0xCC, 0xC9, 0xC0, 0xBF, 0xCD, 0xCD, 0xC9, 0xCC, 0x00, 0xC0, 0xBF, 0xC8, 0xC8, 0xBF, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0xE6, 0xD5, 0xE2, 0xE7, 0xDA, 0xD9, 0xE6, 0x00, 0xBD, 0xD9, 0xE6, 0xE8, 0xDD, 0xDA, 0xDD, 0xD7, 0xD5, 0xE8, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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2, 0xE7, 0xDA, 0xD9, 0xE6, 0xD9, 0xD8, 0x00, 0xCA, 0xC9, 0xC5, 0x1B, 0xC7, 0xC9, 0xC8, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBE, 0xE3, 0x00, 0xE2, 0xE3, 0xE8, 0x00, 0xE8, 0xE3, 0xE7, 0xE7, 0x00, 0xE8, 0xDC, 0xDD, 0xE7, 0x00, 0xBF, 0xEC, 0xD7, 0xDC, 0xD5, 0xE2, 0xDB, 0xD9, 0x00, 0xBD, 0xD5, 0xE6, 0xD8, 0x00, 0xD6, 0xD9, 0xDA, 0xE3, 0xE6, 0xD9, 0x00, 0x00, 0x00, 0xE6, 0xD9, 0xD7, 0xD9, 0xDD, 0xEA, 0xDD, 0xE2, 0xDB, 0x00, 0xED, 0xE3, 0xE9, 0xE6, 0x00, 0xE8, 0xE6, 0xD5, 0xE2, 0xE7, 0xDA, 0xD9, 0xE6, 0xD9, 0xD8, 0x00, 0xCA, 0xC9, 0xC5, 0x1B, 0xC7, 0xC9, 0xC8, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; // checksum +static u8 frlg_wonder_card[0x14E] = { + 0x67, 0x18, 0x00, 0x00, 0xBA, 0xB4, 0xBE, 0xB9, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0xCA, 0xCC, 0xC9, 0xC0, 0xBF, 0xCD, 0xCD, 0xC9, 0xCC, 0x00, 0xC0, 0xBF, 0xC8, 0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 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBE, 0xE3, 0x00, 0xE2, 0xE3, 0xE8, 0x00, 0xE8, 0xE3, 0xE7, 0xE7, 0x00, 0xE8, 0xDC, 0xDD, 0xE7, 0x00, 0xBF, 0xEC, 0xD7, 0xDC, 0xD5, 0xE2, 0xDB, 0xD9, 0x00, 0xBD, 0xD5, 0xE6, 0xD8, 0x00, 0xD6, 0xD9, 0xDA, 0xE3, 0xE6, 0xD9, 0x00, 0x00, 0x00, 0xE6, 0xD9, 0xD7, 0xD9, 0xDD, 0xEA, 0xDD, 0xE2, 0xDB, 0x00, 0xED, 0xE3, 0xE9, 0xE6, 0x00, 0xE8, 0xE6, 0xD5, 0xE2, 0xE7, 0xDA, 0xD9, 0xE6, 0xD9, 0xD8, 0x00, 0xCA, 0xC9, 0xC5, 0x1B, 0xC7, 0xC9, 0xC8, 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; // checksum bool inject_mystery(Pokemon_Party &incoming_box_data) - { - mystery_gift_script script; - if (ENABLE_OLD_EVENT) - { - //script.build_script_old(incoming_box_data); - } - else - { - script.build_script(incoming_box_data); - } - u32 checksum = 0; - if (curr_rom.is_ruby_sapphire()) - { - checksum = script.calc_checksum32(); - } - else - { - checksum = script.calc_crc16(); - } +{ + mystery_gift_script script; + if (ENABLE_OLD_EVENT) + { + // script.build_script_old(incoming_box_data); + } + else + { + script.build_script(incoming_box_data); + } + u32 checksum = 0; + if (curr_rom.is_ruby_sapphire()) + { + checksum = script.calc_checksum32(); + } + else + { + checksum = script.calc_crc16(); + } - // Add in Wonder Card - copy_save_to_ram(memory_section_array[4], &global_memory_buffer[0], 0x1000); - if (curr_rom.is_hoenn()) + // Add in Wonder Card + copy_save_to_ram(memory_section_array[4], &global_memory_buffer[0], 0x1000); + switch (curr_rom.gamecode) + { + case RUBY_ID: + case SAPPHIRE_ID: + for (int i = 0; i < 0x14E; i++) { - for (int i = 0; i < 0x14E; i++) - { - global_memory_buffer[curr_rom.offset_wondercard + i] = lanette_wonder_card[i]; - } + global_memory_buffer[curr_rom.offset_wondercard + i] = rs_wonder_card[i]; } - else + break; + case FIRERED_ID: + case LEAFGREEN_ID: + for (int i = 0; i < 0x14E; i++) { - for (int i = 0; i < 0x14E; i++) - { - global_memory_buffer[curr_rom.offset_wondercard + i] = bill_wonder_card[i]; - } + global_memory_buffer[curr_rom.offset_wondercard + i] = frlg_wonder_card[i]; } + break; + case EMERALD_ID: + default: + for (int i = 0; i < 0x14E; i++) + { + global_memory_buffer[curr_rom.offset_wondercard + i] = em_wonder_card[i]; + } + break; + } - // Set checksum and padding - global_memory_buffer[curr_rom.offset_script] = checksum >> 0; - global_memory_buffer[curr_rom.offset_script + 1] = checksum >> 8; - global_memory_buffer[curr_rom.offset_script + 2] = checksum >> 16; - global_memory_buffer[curr_rom.offset_script + 3] = checksum >> 24; + // Set checksum and padding + global_memory_buffer[curr_rom.offset_script] = checksum >> 0; + global_memory_buffer[curr_rom.offset_script + 1] = checksum >> 8; + global_memory_buffer[curr_rom.offset_script + 2] = checksum >> 16; + global_memory_buffer[curr_rom.offset_script + 3] = checksum >> 24; + + // Add in Mystery Script data + for (int i = 0; i < MG_SCRIPT_SIZE; i++) + { + global_memory_buffer[curr_rom.offset_script + 4 + i] = script.get_script_value_at(i); + } - // Add in Mystery Script data - for (int i = 0; i < MG_SCRIPT_SIZE; i++) - { - global_memory_buffer[curr_rom.offset_script + 4 + i] = script.get_script_value_at(i); - } - update_memory_buffer_checksum(false); erase_sector(memory_section_array[4]); copy_ram_to_save(&global_memory_buffer[0], memory_section_array[4], 0x1000); diff --git a/source/save_data_manager.cpp b/source/save_data_manager.cpp index f241d06..e2410b3 100644 --- a/source/save_data_manager.cpp +++ b/source/save_data_manager.cpp @@ -66,6 +66,7 @@ void initalize_save_data() { save_data_array[i] = 0; } + set_tutorial_flag(true); write_custom_save_data(); } diff --git a/source/script_array.cpp b/source/script_array.cpp index 7dbdec7..6e61619 100644 --- a/source/script_array.cpp +++ b/source/script_array.cpp @@ -25,17 +25,18 @@ std::string_view dialogue[DIA_SIZE]; void populate_dialogue() { - dialogue[DIA_OPEN] = "Hey there! I'm Professor\nFennel. As you can see, I'm\na scientist.|In fact, the subject I'm \nresearching is Trainers!|My dream is to collect save files of various trainers, \nbut I haven't had any \nbreakthroughs yet...|So in the meantime, I've\nbeen working on a different\nproject with one of my old\nfriends!|In my home region, there's a\nlocation that can make a\nPok@mon's dreams into\nreality.|This means that any other\nPok@mon they meet in their\ndreams become real!|That's fantastic, but my\ngoal is to do the same-\njust with a trainer's dream\ninstead!|That's why I need your help!\nI want to bring as many\nPok@mon out of your dreams\nas possible!|There's just over 250\nPok@mon I want to catalogue\nin my Dream Pok@Dex-\nor Dream Dex for short.|But I'll let you keep any\nPok@mon- they're from your\ndreams after all!|I think that's everything...\nwhenever you're ready to\nstart, just let me know!"; + dialogue[DIA_OPEN] = "Hey there! I'm Professor\nFennel. As you can see, I'm\na scientist.|In fact, the subject I'm \nresearching is Trainers!|My dream is to collect save files of various trainers, \nbut I haven't had any \nbreakthroughs yet...|So in the meantime, I've\nbeen working on a different\nproject with one of my old\nfriends!|In my home region, there's a\nlocation that can make a\nPok@mon's dreams into\nreality.|This means that any other\nPok@mon they meet in their\ndreams become real!|That's fantastic, but my\ngoal is to do the same-\njust with a trainer's dream\ninstead!|That's why I need your help!\nI want to bring as many\nPok@mon out of your dreams\nas possible!|There's just over 250\nPok@mon I want to catalogue\nin my Dream Pok@Dex-\nor Dream Dex for short.|But I'll let you keep any\nPok@mon- they're from your\ndreams after all!|One last note, save data\nbackups are recommended-\njust on the off chance that\nsomething goes wrong!|I think that's everything...\nwhenever you're ready to\nstart, just let me know!"; dialogue[DIA_E4] = "Hi trainer! I'm thrilled\nyou've decided to help with our research, but we need\nthe best of the best!|Come back after you've\nbeaten the Elite Four and\nbecome the Champion!"; dialogue[DIA_MG_FRLGE] = "Sorry trainer, one more\nthing to take care of before\nwe can begin- you need to\nenable MYSTERY GIFT!|Head to the nearest Pok@\nMart and fill out the\nquestionnaire as follows:\nLINK TOGETHER WITH ALL|After that, you should be\nall set to go!|See you soon!"; dialogue[DIA_MG_RS] = "Sorry trainer, one more\nthing to take care of before\nwe can begin- you need to\nenable MYSTERY EVENT!|Head to the PETALBURG\nPok@mon Center and tell the\nman next to the PC:\nMYSTERY EVENT IS EXCITING|After that, you should be\nall set to go!|See you soon!"; dialogue[DIA_LETS_START] = "Perfect, that's all the\ninformation I need! Let's\nget started!"; dialogue[DIA_START] = "On a second Game Boy family\nsystem, please load the Game\nBoy Pok@mon game you wish to\ntransfer from.|In your Game Boy Pok@mon\ngame, make your current box\nthe one you want to transfer\nfrom.|Then connect this Game Boy\nAdvance to the other Game\nBoy family system using a\nGame Boy Color link cable.|Once you're ready, press A\non this device, talk to the Cable Club attendant, and\nthen initiate a trade."; - dialogue[DIA_TRANS_GOOD] = "Amazing! Fantastic!\nEverything went perfectly!|You may now turn off your\nother Game Boy family\nsystem."; + dialogue[DIA_TRANS_GOOD] = "Amazing! Fantastic!\nEverything went perfectly!"; dialogue[DIA_NEW_DEX] = "It looks like there's at\nleast one new Pok@mon here\nthat isn't in the Dream Dex!|I'll give them something\nextra sweet as a reward for you both."; dialogue[DIA_NO_NEW_DEX] = "It doesn't look like there's\nanything new for your Dream\nDex, but that's okay!|It's important to confirm\nresearch results with\nmultiple tests!"; - dialogue[DIA_SEND_FRIEND_KANTO] = "I'm going to send these\nPok@mon to my friend BILL so\nthat you can pick them up.\nThey live on Route 25!|Did you know they developed the Storage System for the\nKanto region?|My younger sister developed a version of the Storage\nSystem too, so BILL is a\ngood friend of ours!"; - dialogue[DIA_SEND_FRIEND_HOENN] = "I'm going to send these\nPok@mon to my friend LANNETE\nso that you can pick them\nup. They live on route 114!|Did you know they developed the Storage System for the\nHoenn region?|My younger sister developed a version of the Storage\nSystem too, so LANNETE is a\ngood friend of ours!"; + dialogue[DIA_SEND_FRIEND_KANTO] = "I'm going to send these\nPok@mon to one of my friends\nso that you can pick them\nup!|They live just south of the Pok@mon center on Seven\nIsland!"; + dialogue[DIA_SEND_FRIEND_HOENN_RS] = "I'm going to send these\nPok@mon to one of my friends\nso that you can pick them\nup!|They live just southeast of the Pok@mon center in\nMossdeep City!"; + dialogue[DIA_SEND_FRIEND_HOENN_E] = "I'm going to send these\nPok@mon to one of my friends\nso that you can pick them\nup!|They live just southeast of the Pok@mon center in\nSootopolis City!"; dialogue[DIA_THANK] = "Thank you so much for your\nhelp! Whenever you want to\ntransfer more Pok@mon, just\nlet me know!|See you around!"; dialogue[DIA_GET_MON] = "Let's get started! Please connect Load the Game Boy Pok@mon game you want to transfer from, and put the Pok@mon you want to transfer into your party. "; dialogue[DIA_MG_OTHER_EVENT] = "Hi Trainer! It looks like\nyou have a different event\ncurrently loaded.|That's no problem, but it\nwill be overwritten if you\ncontinue.|Turn off the system now if\nyou want to experience your\ncurrent event,\nbut otherwise-"; @@ -49,6 +50,7 @@ void populate_dialogue() dialogue[DIA_MYTHIC_CONVERT] = "It looks like you have a\nrare Mythical Pok@mon!|Due to their rarity, it\nseems they've overloaded the\nmachine.|I can stablize them if you'd\nlike, but it'll change some\nthings like met location,\nOT, TID, and Shininess.|Otherwise I can leave them\nas is, but there's no\nguarentee that they'll be\ntransferrable in the future.|Do you want me to stablize\nthem? This will apply to\nall of the Mythical Pok@mon\ncurrently in your box."; 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_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!"; @@ -66,16 +68,16 @@ void populate_script() { // -------- TRANSFER SCRIPT -------- // Check that the conditions are set for the transfer - transfer_script[T_SCRIPT_START] = script_obj(CMD_SHOW_PROF, COND_BEAT_E4); + transfer_script[T_SCRIPT_START] = script_obj(CMD_SHOW_PROF, COND_TUTORIAL_COMPLETE); + transfer_script[COND_TUTORIAL_COMPLETE] = script_obj(COND_TUTORIAL_COMPLETE, COND_BEAT_E4, DIA_OPEN); + transfer_script[DIA_OPEN] = script_obj(dialogue[DIA_OPEN], CMD_SET_TUTOR_TRUE); + transfer_script[CMD_SET_TUTOR_TRUE] = script_obj(CMD_SET_TUTOR_TRUE, CMD_END_SCRIPT); transfer_script[COND_BEAT_E4] = script_obj(COND_BEAT_E4, COND_MG_ENABLED, DIA_E4); transfer_script[DIA_E4] = script_obj(dialogue[DIA_E4], CMD_END_SCRIPT); - transfer_script[COND_MG_ENABLED] = script_obj(COND_MG_ENABLED, COND_TUTORIAL_COMPLETE, COND_IS_FRLGE); + transfer_script[COND_MG_ENABLED] = script_obj(COND_MG_ENABLED, COND_MG_OTHER_EVENT, COND_IS_FRLGE); transfer_script[COND_IS_FRLGE] = script_obj(COND_IS_FRLGE, DIA_MG_FRLGE, DIA_MG_RS); transfer_script[DIA_MG_FRLGE] = script_obj(dialogue[DIA_MG_FRLGE], CMD_END_SCRIPT); transfer_script[DIA_MG_RS] = script_obj(dialogue[DIA_MG_RS], CMD_END_SCRIPT); - transfer_script[COND_TUTORIAL_COMPLETE] = script_obj(COND_TUTORIAL_COMPLETE, COND_MG_OTHER_EVENT, DIA_OPEN); - transfer_script[DIA_OPEN] = script_obj(dialogue[DIA_OPEN], CMD_SET_TUTOR_TRUE); - transfer_script[CMD_SET_TUTOR_TRUE] = script_obj(CMD_SET_TUTOR_TRUE, CMD_END_SCRIPT); transfer_script[COND_MG_OTHER_EVENT] = script_obj(COND_MG_OTHER_EVENT, DIA_MG_OTHER_EVENT, COND_PKMN_TO_COLLECT); transfer_script[COND_PKMN_TO_COLLECT] = script_obj(COND_PKMN_TO_COLLECT, DIA_PKMN_TO_COLLECT, DIA_ASK_QUEST); transfer_script[DIA_MG_OTHER_EVENT] = script_obj(dialogue[DIA_MG_OTHER_EVENT], DIA_ASK_QUEST); @@ -85,12 +87,13 @@ void populate_script() transfer_script[DIA_WHAT_GAME_TRANS] = script_obj(dialogue[DIA_WHAT_GAME_TRANS], CMD_GAME_MENU); transfer_script[CMD_GAME_MENU] = script_obj(CMD_GAME_MENU, COND_GB_ROM_EXISTS, DIA_WHAT_LANG_TRANS); transfer_script[DIA_WHAT_LANG_TRANS] = script_obj(dialogue[DIA_WHAT_LANG_TRANS], CMD_LANG_MENU); - transfer_script[CMD_LANG_MENU] = script_obj(CMD_LANG_MENU, DIA_WHAT_GAME_TRANS, DIA_CANCEL); + transfer_script[CMD_LANG_MENU] = script_obj(CMD_LANG_MENU, DIA_WHAT_GAME_TRANS, DIA_MENU_BACK); transfer_script[DIA_ASK_QUEST] = script_obj(dialogue[DIA_ASK_QUEST], CMD_SLIDE_PROF_LEFT); transfer_script[CMD_SLIDE_PROF_LEFT] = script_obj(CMD_SLIDE_PROF_LEFT, DIA_WHAT_LANG_TRANS); transfer_script[CMD_SLIDE_PROF_RIGHT] = script_obj(CMD_SLIDE_PROF_RIGHT, DIA_LETS_START); transfer_script[COND_GB_ROM_EXISTS] = script_obj(COND_GB_ROM_EXISTS, CMD_SLIDE_PROF_RIGHT, DIA_NO_GB_ROM); transfer_script[DIA_NO_GB_ROM] = script_obj(dialogue[DIA_NO_GB_ROM], DIA_WHAT_LANG_TRANS); + transfer_script[DIA_MENU_BACK] = script_obj(dialogue[DIA_MENU_BACK], CMD_END_SCRIPT); // Initiate the transfer and check for errors transfer_script[DIA_LETS_START] = script_obj(dialogue[DIA_LETS_START], DIA_START); @@ -125,10 +128,12 @@ void populate_script() // 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); transfer_script[COND_NEW_POKEMON] = script_obj(COND_NEW_POKEMON, DIA_NEW_DEX, DIA_NO_NEW_DEX); - transfer_script[DIA_NEW_DEX] = script_obj(dialogue[DIA_NEW_DEX], COND_IS_HOENN); - transfer_script[DIA_NO_NEW_DEX] = script_obj(dialogue[DIA_NO_NEW_DEX], COND_IS_HOENN); - transfer_script[COND_IS_HOENN] = script_obj(COND_IS_HOENN, DIA_SEND_FRIEND_HOENN, DIA_SEND_FRIEND_KANTO); - transfer_script[DIA_SEND_FRIEND_HOENN] = script_obj(dialogue[DIA_SEND_FRIEND_HOENN], DIA_THANK); + transfer_script[DIA_NEW_DEX] = script_obj(dialogue[DIA_NEW_DEX], COND_IS_HOENN_RS); + transfer_script[DIA_NO_NEW_DEX] = script_obj(dialogue[DIA_NO_NEW_DEX], COND_IS_HOENN_RS); + transfer_script[COND_IS_HOENN_RS] = script_obj(COND_IS_HOENN_RS, DIA_SEND_FRIEND_HOENN_RS, COND_IS_HOENN_E); + transfer_script[COND_IS_HOENN_E] = script_obj(COND_IS_HOENN_E, DIA_SEND_FRIEND_HOENN_E, DIA_SEND_FRIEND_KANTO); + transfer_script[DIA_SEND_FRIEND_HOENN_RS] = script_obj(dialogue[DIA_SEND_FRIEND_HOENN_RS], DIA_THANK); + transfer_script[DIA_SEND_FRIEND_HOENN_E] = script_obj(dialogue[DIA_SEND_FRIEND_HOENN_E], DIA_THANK); transfer_script[DIA_SEND_FRIEND_KANTO] = script_obj(dialogue[DIA_SEND_FRIEND_KANTO], DIA_THANK); transfer_script[DIA_THANK] = script_obj(dialogue[DIA_THANK], CMD_END_SCRIPT); @@ -243,8 +248,8 @@ bool run_conditional(int index) case COND_NEW_POKEMON: return party_data.get_has_new_pkmn(); - case COND_IS_HOENN: - return curr_rom.is_hoenn(); + case COND_IS_HOENN_RS: + return curr_rom.is_ruby_sapphire(); case COND_IS_FRLGE: return !curr_rom.is_ruby_sapphire(); @@ -277,6 +282,9 @@ bool run_conditional(int index) case COND_SOME_INVALID_PKMN: return party_data.get_contains_invalid(); + case COND_IS_HOENN_E: + return curr_rom.gamecode == EMERALD_ID; + case CMD_START_LINK: load_flex_background(BG_FENNEL, 3); link_animation_state(STATE_CONNECTION); diff --git a/source/script_var.cpp b/source/script_var.cpp index 662bc2d..4e93bf3 100644 --- a/source/script_var.cpp +++ b/source/script_var.cpp @@ -76,7 +76,7 @@ void asm_var::fill_refrences(u8 mg_array[]) { for (int j = 0; j < 4; j++) { - mg_array[location_list[i] + j] += (start_location_in_script + curr_rom.loc_gSaveBlock1 + curr_rom.offset_ramscript + 7) >> (j * 8); + mg_array[location_list[i] + j] += (start_location_in_script + curr_rom.loc_gSaveBlock1 + curr_rom.offset_ramscript + 7) >> (j * 8); } } else @@ -136,7 +136,7 @@ u32 xse_var::get_loc_in_sec30() // TEXTBOX VAR -void textbox_var::set_text(std::u8string_view nText) +void textbox_var::set_text(std::u16string_view nText) { text = nText; } @@ -272,6 +272,10 @@ void music_var::insert_music_data(u8 mg_array[], u8 blockCount, u8 priority, u8 } } + while ((*curr_loc_ptr) % 4 != 0) + { + (*curr_loc_ptr)++; + } set_start(); mg_array[(*curr_loc_ptr)++] = trackArrays.size(); mg_array[(*curr_loc_ptr)++] = blockCount; diff --git a/source/sprite_data.cpp b/source/sprite_data.cpp index 8a66ab9..c5fe4a5 100644 --- a/source/sprite_data.cpp +++ b/source/sprite_data.cpp @@ -29,48 +29,83 @@ void load_background() REG_BG0CNT = BG_CBB(CBB) | BG_SBB(SBB) | BG_4BPP | BG_REG_32x32 | BG_PRIO(3); } -void set_background_pal(int curr_rom_id, bool dark) +void set_background_pal(int curr_rom_id, bool dark, bool fade) { + COLOR new_pal_bg[8]; + new_pal_bg[0] = (!dark ? RGB15(0, 24, 16) : RGB15(0, 24, 16)); switch (curr_rom_id) { case RUBY_ID: - pal_bg_mem[1] = (!dark ? RGB15(12, 3, 9) : RGB15(8, 2, 6)); - pal_bg_mem[2] = (!dark ? RGB15(18, 6, 11) : RGB15(12, 4, 7)); - pal_bg_mem[3] = (!dark ? RGB15(26, 12, 15) : RGB15(16, 8, 9)); - pal_bg_mem[4] = (!dark ? RGB15(28, 19, 21) : RGB15(18, 12, 13)); + new_pal_bg[1] = (!dark ? RGB15(12, 3, 9) : RGB15(8, 2, 6)); + new_pal_bg[2] = (!dark ? RGB15(18, 6, 11) : RGB15(12, 4, 7)); + new_pal_bg[3] = (!dark ? RGB15(26, 12, 15) : RGB15(16, 8, 9)); + new_pal_bg[4] = (!dark ? RGB15(28, 19, 21) : RGB15(18, 12, 13)); break; case SAPPHIRE_ID: - pal_bg_mem[1] = (!dark ? RGB15(7, 6, 13) : RGB15(4, 4, 8)); - pal_bg_mem[2] = (!dark ? RGB15(7, 9, 21) : RGB15(4, 6, 13)); - pal_bg_mem[3] = (!dark ? RGB15(13, 15, 28) : RGB15(8, 10, 18)); - pal_bg_mem[4] = (!dark ? RGB15(20, 21, 28) : RGB15(13, 13, 18)); + new_pal_bg[1] = (!dark ? RGB15(7, 6, 13) : RGB15(4, 4, 8)); + new_pal_bg[2] = (!dark ? RGB15(7, 9, 21) : RGB15(4, 6, 13)); + new_pal_bg[3] = (!dark ? RGB15(13, 15, 28) : RGB15(8, 10, 18)); + new_pal_bg[4] = (!dark ? RGB15(20, 21, 28) : RGB15(13, 13, 18)); break; case FIRERED_ID: - pal_bg_mem[1] = (!dark ? RGB15(15, 4, 4) : RGB15(9, 3, 3)); - pal_bg_mem[2] = (!dark ? RGB15(19, 8, 6) : RGB15(12, 5, 4)); - pal_bg_mem[3] = (!dark ? RGB15(24, 13, 10) : RGB15(15, 8, 6)); - pal_bg_mem[4] = (!dark ? RGB15(28, 23, 21) : RGB15(17, 14, 13)); + new_pal_bg[1] = (!dark ? RGB15(15, 4, 4) : RGB15(9, 3, 3)); + new_pal_bg[2] = (!dark ? RGB15(19, 8, 6) : RGB15(12, 5, 4)); + new_pal_bg[3] = (!dark ? RGB15(24, 13, 10) : RGB15(15, 8, 6)); + new_pal_bg[4] = (!dark ? RGB15(28, 23, 21) : RGB15(17, 14, 13)); break; case LEAFGREEN_ID: - pal_bg_mem[1] = (!dark ? RGB15(5, 11, 5) : RGB15(3, 7, 3)); - pal_bg_mem[2] = (!dark ? RGB15(9, 17, 7) : RGB15(6, 11, 4)); - pal_bg_mem[3] = (!dark ? RGB15(17, 22, 11) : RGB15(10, 14, 7)); - pal_bg_mem[4] = (!dark ? RGB15(24, 26, 19) : RGB15(15, 16, 12)); + new_pal_bg[1] = (!dark ? RGB15(5, 11, 5) : RGB15(3, 7, 3)); + new_pal_bg[2] = (!dark ? RGB15(9, 17, 7) : RGB15(6, 11, 4)); + new_pal_bg[3] = (!dark ? RGB15(17, 22, 11) : RGB15(10, 14, 7)); + new_pal_bg[4] = (!dark ? RGB15(24, 26, 19) : RGB15(15, 16, 12)); break; case EMERALD_ID: - pal_bg_mem[1] = (!dark ? RGB15(5, 10, 10) : RGB15(3, 6, 6)); - pal_bg_mem[2] = (!dark ? RGB15(7, 15, 13) : RGB15(5, 9, 8)); - pal_bg_mem[3] = (!dark ? RGB15(11, 22, 13) : RGB15(7, 14, 8)); - pal_bg_mem[4] = (!dark ? RGB15(20, 26, 20) : RGB15(12, 16, 13)); + new_pal_bg[1] = (!dark ? RGB15(5, 10, 10) : RGB15(3, 6, 6)); + new_pal_bg[2] = (!dark ? RGB15(7, 15, 13) : RGB15(5, 9, 8)); + 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; default: - memcpy(pal_bg_mem, &backgroundPal[dark ? 8 : 0], backgroundPalLen); + 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)); + new_pal_bg[3] = (!dark ? RGB15(18, 18, 20) : RGB15(0, 0, 0)); + new_pal_bg[4] = (!dark ? RGB15(21, 21, 23) : RGB15(0, 0, 0)); break; } + if (fade) + { +#define NUM_CYCLES 30.0 + COLOR curr_pal_bg[8]; + COLOR old_pal[3]; + COLOR new_pal[3]; + memcpy(curr_pal_bg, &pal_bg_mem[0], 16); + for (int n = 0; n <= NUM_CYCLES; n++) + { + for (int i = 1; i < 5; i++) + { + for (int b = 0; b < 3; b++) + { + old_pal[b] = (curr_pal_bg[i] >> (b * 5)) & 0b11111; + new_pal[b] = (new_pal_bg[i] >> (b * 5)) & 0b11111; + } + pal_bg_mem[i] = RGB15( + (((NUM_CYCLES - n) / NUM_CYCLES) * old_pal[0]) + ((n / NUM_CYCLES) * new_pal[0]), + (((NUM_CYCLES - n) / NUM_CYCLES) * old_pal[1]) + ((n / NUM_CYCLES) * new_pal[1]), + (((NUM_CYCLES - n) / NUM_CYCLES) * old_pal[2]) + ((n / NUM_CYCLES) * new_pal[2])); + } + global_next_frame(); + } + } + else + { + memcpy(pal_bg_mem, &new_pal_bg[0], 16); + // memcpy(&pal_bg_mem[4], &new_pal_bg[4], 2); + } (pal_obj_mem + (BTN_LIT_PAL * 16))[7] = pal_bg_mem[1]; (pal_obj_mem + (BTN_LIT_PAL * 16))[8] = pal_bg_mem[1]; (pal_obj_mem + (BTN_LIT_PAL * 16))[9] = pal_bg_mem[1]; (pal_obj_mem + (BTN_LIT_PAL * 16))[10] = pal_bg_mem[3]; + pal_bg_bank[14][15] = pal_bg_mem[3]; } #include "openingBG.h" @@ -494,8 +529,6 @@ void load_select_sprites(int game_id, int lang) memcpy(pal_obj_mem + (GB_CART_PAL * 16) + 6, label_palette + 6, 20); load_sprite(cart_shell, cart_tiles, GB_ShellTilesLen, curr_tile_id, GB_CART_PAL, ATTR0_SQUARE, ATTR1_SIZE_64x64, 1); load_sprite(cart_label, &label_tiles[8], Label_GreenTilesLen - 32, curr_tile_id, GB_CART_PAL, ATTR0_SQUARE, ATTR1_SIZE_32x32, 1); - obj_set_pos(cart_shell, (8 * 12) + 4, (8 * 4) + 11 + y_offset); - obj_set_pos(cart_label, (8 * 12) + 4 + 8, (8 * 4) + 11 + 13 + y_offset); const unsigned int *flag_tiles = 0; const unsigned short *flag_palette = 0; @@ -533,7 +566,6 @@ void load_select_sprites(int game_id, int lang) load_sprite(flag, flag_tiles, flag_jpnTilesLen, curr_tile_id, FLAG_PAL, ATTR0_WIDE, ATTR1_SIZE_32x64, 1); memcpy(pal_obj_mem + (FLAG_PAL * 16), flag_palette, 16); // Grit is being stupid. - obj_set_pos(flag, (8 * 12) + 4, (8 * 4) + 19 + y_offset); const unsigned int *gba_cart_tiles = 0; const unsigned short *gba_cart_palette = 0; @@ -659,7 +691,7 @@ void update_y_offset() y_offset_timer = 12; } y_offset_timer--; - obj_set_pos(cart_shell, (8 * 12) + 4, (8 * 4) + 11 + y_offset); - obj_set_pos(cart_label, (8 * 12) + 4 + 8, (8 * 4) + 11 + 13 + y_offset); - obj_set_pos(flag, (8 * 12) + 4, (8 * 4) + 19 + y_offset); + obj_set_pos(cart_shell, (8 * 11) + 4, (8 * 4) + 11 + y_offset); + obj_set_pos(cart_label, (8 * 11) + 4 + 8, (8 * 4) + 11 + 13 + y_offset); + obj_set_pos(flag, (8 * 11) + 4, (8 * 4) + 19 + y_offset); } \ No newline at end of file