diff --git a/include/pokemon.h b/include/pokemon.h index e576def..11b5faf 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -29,7 +29,7 @@ public: byte get_gen_3_data(int index); byte *get_full_gen_3_array(); byte get_unencrypted_data(int index); - byte *convert_text(byte *text_array, int size, int gen); + byte *convert_text(byte *text_array, int size, int gen, int lang); u32 generate_pid(byte pid_species_index, byte nature, byte *pid_ivs); byte rand_reverse_mod(byte modulo_divisor, byte target_mod); byte get_rand_gender_byte(byte index_num, byte attack_DVs); diff --git a/include/pokemon_data.h b/include/pokemon_data.h index 1ae3543..01f0804 100644 --- a/include/pokemon_data.h +++ b/include/pokemon_data.h @@ -32,13 +32,24 @@ extern const std::string_view NAMES[252]; extern const u8 EVOLUTIONS[252]; extern const u8 POWER_POINTS[252]; extern const byte gen_1_index_array[191]; -extern const byte gen_1_char_array[0x80]; -extern const byte gen_2_char_array[0x80]; +//extern const byte gen_1_char_array[0x80]; +//extern const byte gen_2_char_array[0x80]; +extern const u16 gen_1_Jpn_char_array[256]; +extern const u16 gen_1_Eng_char_array[256]; +extern const u16 gen_1_FreGer_char_array[256]; +extern const u16 gen_1_ItaSpa_char_array[256]; +extern const u16 gen_2_Jpn_char_array[256]; +extern const u16 gen_2_Eng_char_array[256]; +extern const u16 gen_2_FreGer_char_array[256]; +extern const u16 gen_2_ItaSpa_char_array[256]; +extern const u16 gen_3_Jpn_char_array[256]; +extern const u16 gen_3_Intern_char_array[256]; u32 get_max_exp(int index_num); u8 get_gender_threshold(int index_num, bool is_gen_3); bool get_num_abilities(int index_num); bool can_learn_move(int pkmn_index, int move_index); byte get_earliest_move(int index_num); +byte get_gen_3_char(u16 input_char, bool is_jpn); #endif \ No newline at end of file diff --git a/include/script_array.h b/include/script_array.h index 1cc5d5b..bfcec46 100644 --- a/include/script_array.h +++ b/include/script_array.h @@ -4,9 +4,75 @@ #include "script_obj.h" #include "pokemon_party.h" + +// Start! +#define SCRIPT_START 0 +#define START_SIZE 1 + +// Dialouge +#define DIA_INDEX_OPEN 0 +#define DIA_INDEX_E4_1 1 +#define DIA_INDEX_E4_2 2 +#define DIA_INDEX_MG 3 +#define DIA_INDEX_START 4 +#define DIA_INDEX_ERROR_1 5 +#define DIA_INDEX_CONN_GOOD 6 +#define DIA_INDEX_LINK_GOOD 7 +#define DIA_INDEX_TRANS_GOOD 8 +#define DIA_INDEX_NEW_DEX 9 +#define DIA_INDEX_NO_NEW_DEX 10 +#define DIA_INDEX_SEND_FRIEND 11 +#define DIA_INDEX_THANK 12 + +#define DIA_F_OPEN START_SIZE + DIA_INDEX_OPEN +#define DIA_F_E4_1 START_SIZE + DIA_INDEX_E4_1 +#define DIA_F_E4_2 START_SIZE + DIA_INDEX_E4_2 +#define DIA_F_MG START_SIZE + DIA_INDEX_MG +#define DIA_F_START START_SIZE + DIA_INDEX_START +#define DIA_F_ERROR_1 START_SIZE + DIA_INDEX_START +#define DIA_F_CONN_GOOD START_SIZE + DIA_INDEX_CONN_GOOD +#define DIA_F_LINK_GOOD START_SIZE + DIA_INDEX_LINK_GOOD +#define DIA_F_TRANS_GOOD START_SIZE + DIA_INDEX_TRANS_GOOD +#define DIA_F_NEW_DEX START_SIZE + DIA_INDEX_NEW_DEX +#define DIA_F_NO_NEW_DEX START_SIZE + DIA_INDEX_NO_NEW_DEX +#define DIA_F_SEND_FRIEND START_SIZE + DIA_INDEX_SEND_FRIEND +#define DIA_F_THANK START_SIZE + DIA_INDEX_THANK + +#define DIA_SIZE 13 +#define DIA_END DIA_SIZE + START_SIZE + +// Commands +#define CMD_START_LINK DIA_END + 0 +#define CMD_IMPORT_POKEMON DIA_END + 1 +#define CMD_BACK_TO_MENU DIA_END + 2 +#define CMD_SHOW_PROF DIA_END + 3 +#define CMD_HIDE_PROF DIA_END + 4 + +#define CMD_SIZE 5 +#define CMDS_END DIA_END + CMD_SIZE + +// Conditionals +#define COND_ERROR_TIMEOUT_ONE CMDS_END + 0 +#define COND_ERROR_DISCONNECT CMDS_END + 1 +#define COND_ERROR_COM_ENDED CMDS_END + 2 +#define COND_ERROR_TIMEOUT_TWO CMDS_END + 3 +#define COND_ERROR_COLOSSEUM CMDS_END + 4 +#define COND_BEAT_E4 CMDS_END + 5 +#define COND_MG_ENABLED CMDS_END + 6 + +#define COND_SIZE 7 +#define COND_END CMDS_END + COND_SIZE + +// Ends + +#define SCRIPT_SIZE COND_END + extern script_obj script[]; +void populate_script(); +void populate_dialouge(); void add_script_party_var(Pokemon_Party var); bool run_conditional(int index); +std::string_view format_text(std::string_view text); #endif \ No newline at end of file diff --git a/include/script_builder.h b/include/script_builder.h index e7a2f0f..9be1469 100644 --- a/include/script_builder.h +++ b/include/script_builder.h @@ -82,12 +82,19 @@ class mystery_gift_script u8 value_buffer[9]; u32 jumppoint_location[NUM_JUMPS]; u32 jumppoint_destination[NUM_JUMPS]; - std::string_view textboxes[NUM_TEXTBOXES] = + std::u16string_view textboxes[NUM_TEXTBOXES] = + // Ş = Wait for button and scroll text + // ȼ = Wait for button and clear text + // Ȇ = Escape character + // Ʋ = Variable escape sequence + // À = Player name + // Ň = New line + // ƞ = string terminator { - ": Hey /*!-PROFESSOR FENNEL told me that these~were for you!-Don't worry about making room_~I'll send them to the PC!", - ": Thanks for helping out FENNEL!", - ": It looks like the PC is full_-Come back once you have more room!", - "/*'S POK%MON were sent to the PC!", + u": Hey ƲÀ!ȼPROFESSOR FENNEL told me that theseŇwere for you!ȼDon’t worry about making room…ŇI’ll send them to the PC!", + u": Thanks for helping out FENNEL!", + u": It looks like the PC is full…ȼCome back once you have more room!", + u"ƲÀ’S POKÉMON were sent to the PC!", }; u32 textbox_location[NUM_TEXTBOXES]; u32 textbox_destination[NUM_TEXTBOXES]; @@ -97,7 +104,6 @@ class mystery_gift_script u16 relative_offset_destination[NUM_RELATIVE_PTR]; u8 party_data_array[6 * POKEMON_SIZE]; u8 four_align_value = 0; - std::string_view pc_maker = pc_maker; public: mystery_gift_script(); @@ -107,12 +113,12 @@ public: int get_offset_wondercard(); int get_offset_script(); int get_offset_flags(); - + private: void add_command(int len); u16 rev_endian(u16 num); void insert_textboxes(); - u8 convert_char(char convert_char); + // u8 convert_char(char convert_char); void fill_jumppoint_pointers(); void fill_textbox_pointers(); void add_asm(u16 command); diff --git a/include/script_obj.h b/include/script_obj.h index 85e6ff3..bd18249 100644 --- a/include/script_obj.h +++ b/include/script_obj.h @@ -4,25 +4,15 @@ #include #include "pokemon_party.h" -#define START_LINK 1 -#define ERROR_TIMEOUT_ONE 2 -#define ERROR_DISCONNECT 3 -#define ERROR_COM_ENDED 4 -#define ERROR_TIMEOUT_TWO 5 -#define ERROR_COLOSSEUM 6 -#define IMPORT_POKEMON 7 -#define BACK_TO_MENU 8 -#define BEAT_E4 9 -#define SHOW_PROF 10 -#define HIDE_PROF 11 - class script_obj { public: script_obj(); - script_obj(std::string nText, int nNext_index); - script_obj(std::string nText, int nNext_index, int nCond_index); - script_obj(std::string nText, int nNext_index, int nCond_index, int nFalse_index); + script_obj(std::string_view nText, int nNext); + script_obj(std::string_view nText, int nRun, int nNext); + script_obj(int nRun, int nNext); + script_obj(std::string_view nText, int nRun, int nNext_if_true, int nNext_if_false); + script_obj(int nRun, int nNext_if_true, int nNext_if_false); std::string get_text(); int get_true_index(); diff --git a/source/gameboy_colour.cpp b/source/gameboy_colour.cpp index 44bbe15..d0bff1d 100644 --- a/source/gameboy_colour.cpp +++ b/source/gameboy_colour.cpp @@ -4,7 +4,7 @@ #include "pokemon_trade.h" #include "output.h" #include "LinkGPIO.h" -#include "script_obj.h" +#include "script_array.h" #define BYTE_INCOMPLETE 0 #define BYTE_COMPLETE 1 @@ -421,7 +421,7 @@ int loop(byte *party_data) timeout++; if (timeout > TIMEOUT_ONE_LENGTH) { - return ERROR_TIMEOUT_ONE; + return COND_ERROR_TIMEOUT_ONE; } } timeout = 0; @@ -435,19 +435,19 @@ int loop(byte *party_data) else if ( transfer_state == TIMEOUT) { - return ERROR_TIMEOUT_TWO; + return COND_ERROR_TIMEOUT_TWO; } if (FF_count > 25) { - return ERROR_DISCONNECT; + return COND_ERROR_DISCONNECT; } if (zero_count > 25) { - return ERROR_COM_ENDED; + return COND_ERROR_COM_ENDED; } if (connection_state == COLOSSEUM) { - return ERROR_COLOSSEUM; + return COND_ERROR_COLOSSEUM; } if (trade_centre_state_gen_II == SENDING_PATCH_DATA) diff --git a/source/main.cpp b/source/main.cpp index 30ac14b..c5f964b 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -39,14 +39,9 @@ LINK CABLE: - Figure out JP Gen 2 CONVERSION: -- Combine gen 1/2 intern char arrays. No reason why they should be different tbh. Make them based on char input -- Add in conversions from each language, including Korean (Convert to Japanese?) +- Add Korean conversion INJECTION: -- Switch the gen 3 text conversion to the new array -- Redo injection to be picked up like a Mystery Gift -- Double check that returns false when PC is full BEFORE injecting -- Fix coruption and Pokemon injection - Add Pokemon to Pokedex - Randomize base seed - Enable ribbon viewing @@ -114,6 +109,10 @@ int main(void) init_text_engine(); add_script_party_var(party); + // Prepare dialouge + populate_dialouge(); + populate_script(); + // Sound bank init irq_init(NULL); // irq_set(II_VBLANK, mmVBlank, 0); //Music @@ -259,7 +258,7 @@ int main(void) } break; case (BTN_LANGUAGE): - REG_BG2CNT = (REG_BG2CNT & ~BG_PRIO_MASK) | BG_PRIO(1); // Enable text box + REG_BG2CNT = (REG_BG2CNT & ~BG_PRIO_MASK) | BG_PRIO(1); // Enable text box show_lang_btns(); tte_set_pos(LEFT, TOP); tte_write("Choose the default language\nfor transfering from a non\nJapanese game. Setting will\nbe saved after next transfer."); @@ -285,11 +284,13 @@ int main(void) highlight_lang_btn(curr_lang_btn_num, true); old_lang_btn_num = curr_lang_btn_num; } - if (key_hit(KEY_A)){ + if (key_hit(KEY_A)) + { set_arrow_point(curr_lang_btn_num); set_def_lang(curr_lang_btn_num); } - if (key_hit(KEY_B)){ + if (key_hit(KEY_B)) + { hide_lang_btns(); main_menu_exit(); tte_erase_screen(); diff --git a/source/pokemon.cpp b/source/pokemon.cpp index bf51ba7..d2cba53 100644 --- a/source/pokemon.cpp +++ b/source/pokemon.cpp @@ -237,20 +237,16 @@ void Pokemon::convert_to_gen_three() } copy_from_to(&secret_id[0], &gen_3_pkmn[6], 2, false); // Set SID - copy_from_to(convert_text(&nickname[0], 10, 2), &gen_3_pkmn[8], 10, false); // Nickname - - if (language == JPN_ID) // Language, set to the default - { // if not JPN - gen_3_pkmn[18] = JPN_ID; - } - else + if (language != JPN_ID) // If not JPN, figure out what the default language is { - gen_3_pkmn[18] = get_def_lang(); + language = get_def_lang(); } - gen_3_pkmn[19] = 0b00000010; // Egg Name - copy_from_to(convert_text(&trainer_name[0], 7, 2), &gen_3_pkmn[20], 7, false); // OT Name - gen_3_pkmn[27] = 0b00000000; // Markings + gen_3_pkmn[18] = language; // Language + gen_3_pkmn[19] = 0b00000010; // Egg Name + copy_from_to(convert_text(&nickname[0], 10, gen, language), &gen_3_pkmn[8], 10, false); // Nickname + copy_from_to(convert_text(&trainer_name[0], 7, gen, language), &gen_3_pkmn[20], 7, false); // OT Name + gen_3_pkmn[27] = 0b00000000; // Markings // ??? // Data: @@ -436,45 +432,54 @@ byte Pokemon::get_unencrypted_data(int index) return unencrypted_data[index]; } -byte *Pokemon::convert_text(byte *text_array, int size, int gen) +byte *Pokemon::convert_text(byte *text_array, int size, int gen, int lang) { - switch (gen) + for (int i = 0; i < size; i++) { - case 1: - for (int i = 0; i < size; i++) + switch (gen) { - if (text_array[i] == 0x50) + case 1: + switch (lang) { - text_array[i] = 0xFF; + case JPN_ID: + text_array[i] = get_gen_3_char(gen_1_Jpn_char_array[text_array[i]], true); + break; + case ENG_ID: + default: + text_array[i] = get_gen_3_char(gen_1_Eng_char_array[text_array[i]], false); + break; + case FRE_ID: + case GER_ID: + text_array[i] = get_gen_3_char(gen_1_FreGer_char_array[text_array[i]], false); + break; + case SPA_ID: + case ITA_ID: + text_array[i] = get_gen_3_char(gen_1_ItaSpa_char_array[text_array[i]], false); + break; } - else if (text_array[i] >= 0x80) + break; + case 2: + default: + switch (lang) { - text_array[i] = gen_1_char_array[text_array[i] - 0x80]; - } - else - { - text_array[i] = 0x00; + case JPN_ID: + text_array[i] = get_gen_3_char(gen_2_Jpn_char_array[text_array[i]], true); + break; + case ENG_ID: + default: + text_array[i] = get_gen_3_char(gen_2_Eng_char_array[text_array[i]], false); + break; + case FRE_ID: + case GER_ID: + text_array[i] = get_gen_3_char(gen_2_FreGer_char_array[text_array[i]], false); + break; + case SPA_ID: + case ITA_ID: + text_array[i] = get_gen_3_char(gen_2_ItaSpa_char_array[text_array[i]], false); + break; } + break; } - break; - - case 2: - for (int i = 0; i < size; i++) - { - if (text_array[i] == 0x50) - { - text_array[i] = 0xFF; - } - else if (text_array[i] >= 0x80) - { - text_array[i] = gen_2_char_array[text_array[i] - 0x80]; - } - else - { - text_array[i] = 0x00; - } - } - break; } return text_array; } diff --git a/source/pokemon_data.cpp b/source/pokemon_data.cpp index ef17ef9..a31a2f5 100644 --- a/source/pokemon_data.cpp +++ b/source/pokemon_data.cpp @@ -40,6 +40,32 @@ byte get_earliest_move(int index_num) return FIRST_MOVES[index_num]; } +byte get_gen_3_char(u16 input_char, bool is_jpn) +{ + if (is_jpn) + { + for (int i = 0; i < 256; i++) + { + if (gen_3_Jpn_char_array[i] == input_char) + { + return i; + } + } + return 0; + } + else + { + for (int i = 0; i < 256; i++) + { + if (gen_3_Intern_char_array[i] == input_char) + { + return i; + } + } + return 0; + } +} + // All data was obtained using PokeAPI const byte gen_1_index_array[191] = { 0x00, // Offset the list to remove "off by one" errors @@ -652,8 +678,8 @@ const u16 gen_1_Eng_char_array[256]{ 0x29, 0x3A, 0x3B, - 0x5B, - 0x5D, + 0x28, + 0x29, 0x61, 0x62, 0x63, @@ -910,8 +936,8 @@ const u16 gen_1_FreGer_char_array[256]{ 0x29, 0x3A, 0x3B, - 0x5B, - 0x5D, + 0x28, + 0x29, 0x61, 0x62, 0x63, @@ -1168,8 +1194,8 @@ const u16 gen_1_ItaSpa_char_array[256]{ 0x29, 0x3A, 0x3B, - 0x5B, - 0x5D, + 0x28, + 0x29, 0x61, 0x62, 0x63, @@ -1267,273 +1293,1554 @@ const u16 gen_1_ItaSpa_char_array[256]{ 0x38, 0x39, }; -const u16 gen_2_Jpn_char_array[256]{}; -const u16 gen_2_Eng_char_array[256]{}; -const u16 gen_2_FreGer_char_array[256]{}; -const u16 gen_2_ItaSpa_char_array[256]{}; -const byte gen_1_char_array[0x80] = { - // Stores the gen 3 character ID in the gen 1 spot - 0xBB, - 0xBC, - 0xBD, - 0xBE, - 0xBF, - 0xC0, - 0xC1, - 0xC2, - 0xC3, - 0xC4, - 0xC5, - 0xC6, - 0xC7, - 0xC8, - 0xC9, - 0xCA, - 0xCB, - 0xCC, - 0xCD, - 0xCE, - 0xCF, - 0xD0, - 0xD1, - 0xD2, - 0xD3, - 0xD4, - 0x5C, - 0x5D, - 0xF0, - 0x36, - 0x5C, - 0x5D, - 0xD5, - 0xD6, +const u16 gen_2_Jpn_char_array[256]{ + 0x3F, + 0x30A4, + 0x30F4, + 0x30A8, + 0x30AA, + 0x30AC, + 0x30AE, + 0x30B0, + 0x30B2, + 0x30B4, + 0x30B6, + 0x30B8, + 0x30BA, + 0x30BC, + 0x30BE, + 0x30C0, + 0x30C2, + 0x30C5, + 0x30C7, + 0x30C9, + 0x2A, + 0x2A, + 0x2A, + 0x30CD, + 0x30CE, + 0x30D0, + 0x30D3, + 0x30D6, + 0x30DC, + 0x2A, + 0x2A, + 0x2A, + 0x30A3, + 0x3042, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x304C, + 0x304E, + 0x3050, + 0x3052, + 0x3054, + 0x3056, + 0x3058, + 0x305A, + 0x305C, + 0x305E, + 0x3060, + 0x3062, + 0x3065, + 0x3067, + 0x3069, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x3070, + 0x3073, + 0x3076, + 0x3079, + 0x307C, + 0x2A, + 0x30D1, + 0x30D4, + 0x30D7, + 0x30DD, + 0x3071, + 0x3074, + 0x3077, + 0x307A, + 0x307D, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x3082, + 0x2A, + 0x2A, + 0x19E, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x20, + 0x25B2, + 0x20, + 0x44, + 0x45, + 0x46, + 0x47, + 0x48, + 0x49, + 0x56, + 0x53, + 0x4C, + 0x4D, + 0x3A, + 0x3043, + 0x3045, + 0x300C, + 0x300D, + 0x300E, + 0x300F, + 0x30FB, + 0x22EF, + 0x3041, + 0x3047, + 0x3049, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x30A2, + 0x30A4, + 0x30A6, + 0x30A8, + 0x30AA, + 0x30AB, + 0x30AD, + 0x30AF, + 0x30B1, + 0x30B3, + 0x30B5, + 0x30B7, + 0x30B9, + 0x30BB, + 0x30BD, + 0x30BF, + 0x30C1, + 0x30C4, + 0x30C6, + 0x30C8, + 0x30CA, + 0x30CB, + 0x30CC, + 0x30CD, + 0x30CE, + 0x30CF, + 0x30D2, + 0x30D5, + 0x30DB, + 0x30DE, + 0x30DF, + 0x30E0, + 0x30E1, + 0x30E2, + 0x30E4, + 0x30E6, + 0x30E8, + 0x30E9, + 0x30EB, + 0x30EC, + 0x30ED, + 0x30EF, + 0x30F2, + 0x30F3, + 0x30C3, + 0x30E3, + 0x30E5, + 0x30E7, + 0x30A3, + 0x3042, + 0x3044, + 0x3046, + 0x3048, + 0x304A, + 0x304B, + 0x304D, + 0x304F, + 0x3051, + 0x3053, + 0x3055, + 0x3057, + 0x3059, + 0x305B, + 0x305D, + 0x305F, + 0x3061, + 0x3064, + 0x3066, + 0x3068, + 0x306A, + 0x306B, + 0x306C, + 0x306D, + 0x306E, + 0x306F, + 0x3072, + 0x3075, + 0x3078, + 0x307B, + 0x307E, + 0x307F, + 0x3080, + 0x3081, + 0x3082, + 0x3084, + 0x3086, + 0x3088, + 0x3089, + 0x30EA, + 0x308B, + 0x308C, + 0x308D, + 0x308F, + 0x3092, + 0x3093, + 0x3063, + 0x3083, + 0x3085, + 0x3087, + 0x30FC, + 0x309C, + 0x309B, + 0x3F, + 0x21, + 0x3002, + 0x30A1, + 0x30A5, + 0x30A7, + 0x25B7, + 0x25B6, + 0x25BC, + 0x2642, + 0x5186, 0xD7, - 0xD8, - 0xD9, - 0xDA, - 0xDB, - 0xDC, - 0xDD, - 0xDE, - 0xDF, - 0xE0, - 0xE1, - 0xE2, - 0xE3, - 0xE4, - 0xE5, - 0xE6, - 0xE7, - 0xE8, - 0xE9, - 0xEA, - 0xEB, - 0xEC, - 0xED, - 0xEE, - 0x1B, - 0xD8, - 0xE0, - 0xE7, - 0xE8, - 0xEA, - 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, - 0xB4, - 0xCA, - 0xC7, - 0xAE, - 0xE6, - 0xE1, - 0xAC, - 0xAB, - 0xAD, - 0x00, - 0x00, - 0x00, - 0x00, - 0xEF, - 0x00, - 0xB5, - 0xB7, - 0xEC, - 0xAD, - 0xBA, - 0xB8, - 0xB6, - 0xA1, - 0xA2, - 0xA3, - 0xA4, - 0xA5, - 0xA6, - 0xA7, - 0xA8, - 0xA9, - 0xAA, + 0x2E, + 0x2F, + 0x30A9, + 0x2640, + 0x30, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, }; -const byte gen_2_char_array[0x80] = { - // Stores the gen 3 character ID in the gen 2 spot - 0xBB, - 0xBC, - 0xBD, - 0xBE, - 0xBF, +const u16 gen_2_Eng_char_array[256]{ + 0x3F, + 0x42, + 0x43, + 0x44, + 0x45, + 0x46, + 0x47, + 0x48, + 0x49, + 0x4A, + 0x4B, + 0x4C, + 0x4D, + 0x4E, + 0x4F, + 0x50, + 0x51, + 0x52, + 0x53, + 0x54, + 0x20, + 0x20, + 0x20, + 0x58, + 0x59, + 0x5A, + 0x28, + 0x29, + 0x3A, + 0x3B, + 0x28, + 0x20, + 0x71, + 0x72, + 0x20, + 0x20, + 0x20, + 0x20, + 0x77, + 0x78, + 0x79, + 0x7A, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0xC4, + 0xD6, + 0xDC, + 0xE4, + 0xF6, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x5A, + 0x28, + 0x29, + 0x3A, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x72, + 0x20, + 0x20, + 0x19E, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x2588, + 0x25B2, + 0x20, + 0x44, + 0x45, + 0x46, + 0x47, + 0x48, + 0x49, + 0x56, + 0x53, + 0x4C, + 0x4D, + 0x3A, + 0x3043, + 0x3045, + 0x50, + 0x4B, + 0x201C, + 0x201D, + 0x30FB, + 0x2026, + 0x3041, + 0x3047, + 0x3049, + 0x20, + 0x2550, + 0x2557, + 0x2551, + 0x255A, + 0x255D, + 0x2420, + 0x41, + 0x42, + 0x43, + 0x44, + 0x45, + 0x46, + 0x47, + 0x48, + 0x49, + 0x4A, + 0x4B, + 0x4C, + 0x4D, + 0x4E, + 0x4F, + 0x50, + 0x51, + 0x52, + 0x53, + 0x54, + 0x55, + 0x56, + 0x57, + 0x58, + 0x59, + 0x5A, + 0x28, + 0x29, + 0x3A, + 0x3B, + 0x28, + 0x29, + 0x61, + 0x62, + 0x63, + 0x64, + 0x65, + 0x66, + 0x67, + 0x68, + 0x69, + 0x6A, + 0x6B, + 0x6C, + 0x6D, + 0x6E, + 0x6F, + 0x70, + 0x71, + 0x72, + 0x73, + 0x74, + 0x75, + 0x76, + 0x77, + 0x78, + 0x79, + 0x7A, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0xC4, + 0xD6, + 0xDC, + 0xE4, + 0xF6, + 0xFC, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x64, + 0x6C, + 0x6D, + 0x72, + 0x73, + 0x74, + 0x76, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0xD83E, + 0x20, + 0x50, + 0x4D, + 0x2D, + 0x20, + 0x20, + 0x3F, + 0x21, + 0x2E, + 0x26, + 0xE9, + 0xD83E, + 0x25B7, + 0x25B6, + 0x25BC, + 0x2642, + 0x20, + 0xD7, + 0x2E, + 0x2F, + 0x2C, + 0x2640, + 0x30, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, +}; +const u16 gen_2_FreGer_char_array[256]{ + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x19E, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x25B2, + 0x20, + 0x44, + 0x45, + 0x46, + 0x47, + 0x48, + 0x49, + 0x56, + 0x53, + 0x4C, + 0x4D, + 0x3A, + 0x3043, + 0x3045, + 0x50, + 0x4B, + 0x201C, + 0x201D, + 0x30FB, + 0x2026, + 0x3041, + 0x3047, + 0x3049, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x41, + 0x42, + 0x43, + 0x44, + 0x45, + 0x46, + 0x47, + 0x48, + 0x49, + 0x4A, + 0x4B, + 0x4C, + 0x4D, + 0x4E, + 0x4F, + 0x50, + 0x51, + 0x52, + 0x53, + 0x54, + 0x55, + 0x56, + 0x57, + 0x58, + 0x59, + 0x5A, + 0x28, + 0x29, + 0x3A, + 0x3B, + 0x28, + 0x29, + 0x61, + 0x62, + 0x63, + 0x64, + 0x65, + 0x66, + 0x67, + 0x68, + 0x69, + 0x6A, + 0x6B, + 0x6C, + 0x6D, + 0x6E, + 0x6F, + 0x70, + 0x71, + 0x72, + 0x73, + 0x74, + 0x75, + 0x76, + 0x77, + 0x78, + 0x79, + 0x7A, + 0xE0, + 0xE8, + 0xE9, + 0xF9, + 0xDF, + 0xE7, + 0xC4, + 0xD6, + 0xDC, + 0xE4, + 0xF6, + 0xFC, + 0xEB, + 0xEF, + 0xE2, + 0xF4, + 0xFB, + 0xEA, + 0xEE, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x63, + 0x64, + 0x6A, + 0x6C, + 0x6D, + 0x6E, + 0x70, + 0x73, + 0x73, + 0x74, + 0x75, + 0x79, + 0x20, + 0x50, + 0x4D, + 0x2D, + 0x2B, + 0x20, + 0x3F, + 0x21, + 0x2E, + 0x26, + 0xE9, + 0x20, + 0x25B7, + 0x25B6, + 0x25BC, + 0x2642, + 0x20, + 0xD7, + 0x2E, + 0x2F, + 0x2C, + 0x2640, + 0x30, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, +}; +const u16 gen_2_ItaSpa_char_array[256]{ + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x19E, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x25B2, + 0x20, + 0x44, + 0x45, + 0x46, + 0x47, + 0x48, + 0x49, + 0x56, + 0x53, + 0x4C, + 0x4D, + 0x3A, + 0x3043, + 0x3045, + 0x50, + 0x4B, + 0x201C, + 0x201D, + 0x30FB, + 0x2026, + 0x3041, + 0x3047, + 0x3049, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x41, + 0x42, + 0x43, + 0x44, + 0x45, + 0x46, + 0x47, + 0x48, + 0x49, + 0x4A, + 0x4B, + 0x4C, + 0x4D, + 0x4E, + 0x4F, + 0x50, + 0x51, + 0x52, + 0x53, + 0x54, + 0x55, + 0x56, + 0x57, + 0x58, + 0x59, + 0x5A, + 0x28, + 0x29, + 0x3A, + 0x3B, + 0x28, + 0x29, + 0x61, + 0x62, + 0x63, + 0x64, + 0x65, + 0x66, + 0x67, + 0x68, + 0x69, + 0x6A, + 0x6B, + 0x6C, + 0x6D, + 0x6E, + 0x6F, + 0x70, + 0x71, + 0x72, + 0x73, + 0x74, + 0x75, + 0x76, + 0x77, + 0x78, + 0x79, + 0x7A, + 0xE0, + 0xE8, + 0xE9, + 0xF9, 0xC0, 0xC1, - 0xC2, - 0xC3, 0xC4, - 0xC5, - 0xC6, - 0xC7, + 0xD6, + 0xDC, + 0xE4, + 0xF6, + 0xFC, 0xC8, 0xC9, - 0xCA, - 0xCB, 0xCC, 0xCD, - 0xCE, - 0xCF, - 0xD0, 0xD1, 0xD2, 0xD3, - 0xD4, - 0x5C, - 0x5D, - 0xF0, - 0x36, - 0x5C, - 0x5D, - 0xD5, - 0xD6, - 0xD7, - 0xD8, 0xD9, 0xDA, - 0xDB, - 0xDC, - 0xDD, - 0xDE, - 0xDF, - 0xE0, 0xE1, - 0xE2, - 0xE3, - 0xE4, - 0xE5, - 0xE6, - 0xE7, - 0xE8, - 0xE9, - 0xEA, - 0xEB, 0xEC, 0xED, - 0xEE, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, 0xF1, 0xF2, 0xF3, - 0xF4, - 0xF5, + 0xFA, + 0xBA, + 0x26, + 0x64, + 0x6C, + 0x6D, + 0x72, + 0x73, + 0x74, + 0x76, + 0x20, + 0x20, + 0x50, + 0x4D, + 0x2D, + 0xBF, + 0xA1, + 0x3F, + 0x21, + 0x2E, + 0x26, + 0xE9, + 0x20, + 0x25B7, + 0x25B6, + 0x25BC, + 0x2642, + 0x20, + 0xD7, + 0x2E, + 0x2F, + 0x2C, + 0x2640, + 0x30, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, +}; +const u16 gen_3_Jpn_char_array[256]{ + 0x20, + 0x3042, + 0x3044, + 0x3046, + 0x3048, + 0x304A, + 0x304B, + 0x304D, + 0x304F, + 0x3051, + 0x3053, + 0x3055, + 0x3057, + 0x3059, + 0x305B, + 0x305D, + 0x305F, + 0x3061, + 0x3064, + 0x3066, + 0x3068, + 0x306A, + 0x306B, + 0x306C, + 0x306D, + 0x306E, + 0x306F, + 0x3072, + 0x3075, + 0x3078, + 0x307B, + 0x307E, + 0x307F, + 0x3080, + 0x3081, + 0x3082, + 0x3084, + 0x3086, + 0x3088, + 0x3089, + 0x308A, + 0x308B, + 0x308C, + 0x308D, + 0x308F, + 0x3092, + 0x3093, + 0x3041, + 0x3043, + 0x3045, + 0x3047, + 0x3049, + 0x3083, + 0x3085, + 0x3087, + 0x304C, + 0x304E, + 0x3050, + 0x3052, + 0x3054, + 0x3056, + 0x3058, + 0x305A, + 0x305C, + 0x305E, + 0x3060, + 0x3062, + 0x3065, + 0x3067, + 0x3069, + 0x3070, + 0x3073, + 0x3076, + 0x3079, + 0x307C, + 0x3071, + 0x3074, + 0x3077, + 0x307A, + 0x307D, + 0x3063, + 0x30A2, + 0x30A4, + 0x30A6, + 0x30A8, + 0x30AA, + 0x30AB, + 0x30AD, + 0x30AF, + 0x30B1, + 0x30B3, + 0x30B5, + 0x30B7, + 0x30B9, + 0x30BB, + 0x30BD, + 0x30BF, + 0x30C1, + 0x30C4, + 0x30C6, + 0x30C8, + 0x30CA, + 0x30CB, + 0x30CC, + 0x30CD, + 0x30CE, + 0x30CF, + 0x30D2, + 0x30D5, + 0x30D8, + 0x30DB, + 0x30DE, + 0x30DF, + 0x30E0, + 0x30E1, + 0x30E2, + 0x30E4, + 0x30E6, + 0x30E8, + 0x30E9, + 0x30EA, + 0x20, + 0x30EC, + 0x30ED, + 0x30EF, + 0x30F2, + 0x30F3, + 0x30A1, + 0x30A3, + 0x30A5, + 0x30A7, + 0x30A9, + 0x30E3, + 0x30E5, + 0x30E7, + 0x30AC, + 0x30AE, + 0x30B0, + 0x30B2, + 0x30B4, + 0x30B6, + 0x30B8, + 0x30BA, + 0x30BC, + 0x30BE, + 0x30C0, + 0x30C2, + 0x30C5, + 0x30C7, + 0x30C9, + 0x30D0, + 0x30D3, + 0x30D6, + 0x30D9, + 0x30DC, + 0x30D1, + 0x30D4, + 0x30D7, + 0x30DA, + 0x30DD, + 0x30C3, + 0x30, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0xFF01, + 0xFF1F, + 0x3002, + 0x30FC, + 0x30FB, + 0x30FB, + 0x300E, + 0x300F, + 0x300C, + 0x300D, + 0x2642, + 0x2640, + 0x5186, + 0x2E, + 0xD7, + 0x2F, + 0x41, + 0x42, + 0x43, + 0x44, + 0x45, + 0x46, + 0x47, + 0x48, + 0x49, + 0x4A, + 0x4B, + 0x4C, + 0x4D, + 0x4E, + 0x4F, + 0x50, + 0x51, + 0x52, + 0x53, + 0x54, + 0x55, + 0x56, + 0x57, + 0x58, + 0x59, + 0x5A, + 0x61, + 0x62, + 0x63, + 0x64, + 0x65, + 0x66, + 0x67, + 0x68, + 0x69, + 0x6A, + 0x6B, + 0x6C, + 0x6D, + 0x6E, + 0x6F, + 0x70, + 0x71, + 0x72, + 0x73, + 0x74, + 0x75, + 0x76, + 0x77, + 0x78, + 0x79, + 0x7A, + 0x25B6, + 0x3A, + 0xC4, + 0xD6, + 0xDC, + 0xE4, 0xF6, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0xD8, + 0xFC, + 0x2B06, + 0x2B07, + 0x2B05, + 0x15E, + 0x23C, + 0x206, + 0x1B2, + 0x147, + 0x19E, +}; +const u16 gen_3_Intern_char_array[256]{ + 0x20, + 0xC0, + 0xC1, + 0xC2, + 0xC7, + 0xC8, + 0xC9, + 0xCA, + 0xCB, + 0xCC, + 0x20, + 0xCE, + 0xCF, + 0xD2, + 0xD3, + 0xD4, + 0x152, + 0xD9, + 0xDA, + 0xDB, + 0xD1, + 0xDF, 0xE0, 0xE1, - 0xE6, + 0x20, 0xE7, 0xE8, + 0xE9, 0xEA, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x7B, - 0xB4, - 0xCA, - 0xC7, - 0xAE, - 0x00, - 0x00, - 0xAC, - 0xAB, - 0xAD, - 0x2D, - 0x1B, - 0x7C, - 0x00, - 0xEF, - 0x00, - 0xB5, - 0xB7, + 0xEB, 0xEC, - 0xAD, + 0x20, + 0xEE, + 0xEF, + 0xF2, + 0xF3, + 0xF4, + 0x153, + 0xF9, + 0xFA, + 0xFB, + 0xF1, 0xBA, - 0xB8, - 0xB6, - 0xA1, - 0xA2, - 0xA3, - 0xA4, - 0xA5, - 0xA6, - 0xA7, - 0xA8, - 0xA9, 0xAA, + 0x1D49, + 0x26, + 0x2B, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x3D, + 0x3B, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x25AF, + 0xBF, + 0xA1, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0xCD, + 0x25, + 0x28, + 0x29, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0xE2, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0xED, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x2B07, + 0x2B05, + 0x27A1, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x2A, + 0x1D49, + 0x3C, + 0x3E, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x2B3, + 0x30, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x21, + 0x3F, + 0x2E, + 0x2D, + 0x30FB, + 0x2026, + 0x201C, + 0x201D, + 0x2018, + 0x2019, + 0x2642, + 0x2640, + 0x20, + 0x2C, + 0xD7, + 0x2F, + 0x41, + 0x42, + 0x43, + 0x44, + 0x45, + 0x46, + 0x47, + 0x48, + 0x49, + 0x4A, + 0x4B, + 0x4C, + 0x4D, + 0x4E, + 0x4F, + 0x50, + 0x51, + 0x52, + 0x53, + 0x54, + 0x55, + 0x56, + 0x57, + 0x58, + 0x59, + 0x5A, + 0x61, + 0x62, + 0x63, + 0x64, + 0x65, + 0x66, + 0x67, + 0x68, + 0x69, + 0x6A, + 0x6B, + 0x6C, + 0x6D, + 0x6E, + 0x6F, + 0x70, + 0x71, + 0x72, + 0x73, + 0x74, + 0x75, + 0x76, + 0x77, + 0x78, + 0x79, + 0x7A, + 0x25B6, + 0x3A, + 0xC4, + 0xD6, + 0xDC, + 0xE4, + 0xF6, + 0xFC, + 0x20, + 0x20, + 0x20, + 0x15E, + 0x23C, + 0x206, + 0x1B2, + 0x147, + 0x19E, }; - const u8 EXP_MAX[252] = { 0, // Offset the list to remove "off by one" errors 2, // Bulbasaur diff --git a/source/script_array.cpp b/source/script_array.cpp index 4330808..4e03abe 100644 --- a/source/script_array.cpp +++ b/source/script_array.cpp @@ -8,30 +8,63 @@ int last_error; Pokemon_Party party_data; -script_obj script[] = - { - script_obj("", 17, SHOW_PROF), // 0 - script_obj("Game not detected. Please turn off your system and upload the program again.", 2), // 1 - script_obj("Welcome to Pokemon Mirror!", 3), // 2 - script_obj("Please connect your GBA to a GB in the trading room, and press A", 4, START_LINK), // 3 - script_obj("", 6, ERROR_COM_ENDED, 5), // 4 - script_obj("Error: Communication ended.", 3), // 5 - script_obj("", 8, ERROR_DISCONNECT, 7), // 6 - script_obj("Error: Cable disconnected.", 3), // 7 - script_obj("", 10, ERROR_TIMEOUT_ONE, 9), // 8 - script_obj("Error: Timed out (1).", 3), // 9 - script_obj("", 12, ERROR_TIMEOUT_TWO, 11), // 10 - script_obj("Error: Timed out (2)", 3), // 11 - script_obj("", 14, ERROR_COLOSSEUM, 13), // 12 - script_obj("Error: Went into Colosseum", 3), // 13 - script_obj("Connection successful! Transfering in Pokemon now", 15), // 14 - script_obj("", 16, IMPORT_POKEMON), // 15 - script_obj("Bye!", 21), // 16 - script_obj("", 2, BEAT_E4, 18), // 17 - script_obj("Hi trainer! I'm thrilled\nyou've decided to help with our research, but we need\nthe best of the best!", 19), // 18 // 17 - script_obj("Come back once you've taken down the Elite Four!", 20), // 19 - script_obj("", 21, HIDE_PROF), // 20 - script_obj("", 0, BACK_TO_MENU) // 21 +script_obj script[SCRIPT_SIZE]; +std::string_view dialouge[DIA_SIZE]; + +void populate_dialouge() +{ + dialouge[DIA_INDEX_OPEN] = "Hey there! I'm Professor Fennel. As you can see, I'm a scientist. In fact, the subject I'm researching is Trainers! My dream is to collect save files of various trainers, but I haven't had any breakthroughs yet. In the center of the region where I'm from, there's a location that can make a Pokemon's dreams into reality! This means that any other Pokemon they meet in their dreams become real! That's fantastic, but my goal is to do the same- but for a trainer! I've successfully been able send a Pokemon in and out of a trainer's dream, but I've been unsuccessful in pulling out a Pokemon without... catastrophic results. That's when I had a breakthrough- I realized if I sent in a DITTO, it could transform into the Pokemon found within that trainer's dream! That's why you're here today- I want to bring as many Pokemon out of your dreams as possible! There's just over 250 different Pokemon I want to catalogue in my Dream Pokedex- or Dream Dex for short. But I'll let you keep any Pokemon- they're from your dreams after all! I think that's everything... whenever you're ready, just let me know!"; + dialouge[DIA_INDEX_E4_1] = "Hi trainer! I'm thrilled\nyou've decided to help with our research, but we need\nthe best of the best!"; + dialouge[DIA_INDEX_E4_2] = "Come back once you've taken down the Elite Four!"; + dialouge[DIA_INDEX_MG] = "Looks like Mystery gift isn't enabled..."; + dialouge[DIA_INDEX_START] = format_text("Alright then, let's get started! Please connect your Game Boy Advance to a Game Boy family system, using a Game Boy Color link cable. Load the Game Boy Pokemon game you want to transfer Pokemon from. Once both devices have been connected and the Game Boy Pokemon game has been loaded, press A."); + dialouge[DIA_INDEX_ERROR_1] = "Hmm, it looks like something isn't right. Let's try that again!"; + dialouge[DIA_INDEX_CONN_GOOD] = "Great! Now head to the nearest Pokemon Center. Put any Pokemon you wish to bring out of your dreams into your party, and go to the Cable Club attendant. Ask them to perform a Link Trade, and then press A."; + dialouge[DIA_INDEX_LINK_GOOD] = "We're almost set! Once you're ready, talk to the trainer across the table from you to start the process!"; + dialouge[DIA_INDEX_TRANS_GOOD] = "Amazing! Fantastic!! Everything went perfectly!"; + dialouge[DIA_INDEX_NEW_DEX] = "It looks like there's at least one new Pokemon here that isn't in the Dream Dex! I'll give it something extra sweet as a reward for you both."; + dialouge[DIA_INDEX_NO_NEW_DEX] = "It doesn't look like there's anything new for your Dream Dex, but that's okay! Any research is good research!"; + dialouge[DIA_INDEX_SEND_FRIEND] = "I'll send these Pokemon to my friend Bill/Lannette so that you can pick them up. Did you know they developed the Storage System for the Kanto/Hoenn region? My younger sister developed the Storage System where I'm from, so Bill/Lannette is a good friend of ours!"; + dialouge[DIA_INDEX_THANK] = "Thank you so much for assisting with my research! Whenever you want to transfer more Pokemon, just let me know!"; +} + +void populate_script() +{ + script[SCRIPT_START] = script_obj(CMD_SHOW_PROF, COND_BEAT_E4); + script[COND_BEAT_E4] = script_obj(COND_BEAT_E4, COND_MG_ENABLED, DIA_F_E4_1); + script[COND_MG_ENABLED] = script_obj(COND_MG_ENABLED, DIA_F_START, DIA_F_MG); + + script[CMD_BACK_TO_MENU] = script_obj(CMD_BACK_TO_MENU, SCRIPT_START); + + script[DIA_F_START] = script_obj(dialouge[DIA_INDEX_START], CMD_BACK_TO_MENU); + script[DIA_F_E4_1] = script_obj(dialouge[DIA_INDEX_E4_1], DIA_F_E4_2); + script[DIA_F_E4_2] = script_obj(dialouge[DIA_INDEX_E4_2], CMD_HIDE_PROF, CMD_BACK_TO_MENU); + script[DIA_F_MG] = script_obj(dialouge[DIA_INDEX_MG], CMD_HIDE_PROF, CMD_BACK_TO_MENU); + /* + script[0] = script_obj("", 17, CMD_SHOW_PROF); // 0 + script[1] = script_obj("Game not detected. Please turn off your system and upload the program again.", 2); // 1 + script[2] = script_obj("Welcome to Pokemon Mirror!", 3); // 2 + script[3] = script_obj("Please connect your GBA to a GB in the trading room, and press A", 4, CMD_START_LINK); // 3 + script[4] = script_obj("", 6, COND_ERROR_COM_ENDED, 5); // 4 + script[5] = script_obj("Error: Communication ended.", 3); // 5 + script[6] = script_obj("", 8, COND_ERROR_DISCONNECT, 7); // 6 + script[7] = script_obj("Error: Cable disconnected.", 3); // 7 + script[8] = script_obj("", 10, COND_ERROR_TIMEOUT_ONE, 9); // 8 + script[9] = script_obj("Error: Timed out (1).", 3); // 9 + script[10] = script_obj("", 12, COND_ERROR_TIMEOUT_TWO, 11); // 10 + script[11] = script_obj("Error: Timed out (2)", 3); // 11 + script[12] = script_obj("", 14, COND_ERROR_COLOSSEUM, 13); // 12 + script[13] = script_obj("Error: Went into Colosseum", 3); // 13 + script[14] = script_obj("Connection successful! Transfering in Pokemon now", 15); // 14 + script[15] = script_obj("", 16, CMD_IMPORT_POKEMON); // 15 + script[16] = script_obj("Bye!", 21); // 16 + script[17] = script_obj("", 2, COND_BEAT_E4, 18); // 17 + script[18] = script_obj("Hi trainer! I'm thrilled\nyou've decided to help with our research, but we need\nthe best of the best!", 19); // 18 // 17 + script[19] = script_obj("Come back once you've taken down the Elite Four!", 20); // 19 + script[20] = script_obj("", 21, CMD_HIDE_PROF); // 20 + script[21] = script_obj("", 0, CMD_BACK_TO_MENU); + */ + // 21 }; void add_script_party_var(Pokemon_Party var) @@ -45,50 +78,79 @@ bool run_conditional(int index) switch (index) { - case START_LINK: + case CMD_START_LINK: party_data.start_link(); return true; - case ERROR_COM_ENDED: - return party_data.get_last_error() != ERROR_COM_ENDED; + case COND_ERROR_COM_ENDED: + return party_data.get_last_error() != COND_ERROR_COM_ENDED; - case ERROR_DISCONNECT: - return party_data.get_last_error() != ERROR_DISCONNECT; + case COND_ERROR_DISCONNECT: + return party_data.get_last_error() != COND_ERROR_DISCONNECT; - case ERROR_TIMEOUT_ONE: - return party_data.get_last_error() != ERROR_TIMEOUT_ONE; + case COND_ERROR_TIMEOUT_ONE: + return party_data.get_last_error() != COND_ERROR_TIMEOUT_ONE; - case ERROR_TIMEOUT_TWO: - return party_data.get_last_error() != ERROR_TIMEOUT_TWO; + case COND_ERROR_TIMEOUT_TWO: + return party_data.get_last_error() != COND_ERROR_TIMEOUT_TWO; - case ERROR_COLOSSEUM: - return party_data.get_last_error() != ERROR_COLOSSEUM; + case COND_ERROR_COLOSSEUM: + return party_data.get_last_error() != COND_ERROR_COLOSSEUM; - case IMPORT_POKEMON: + case CMD_IMPORT_POKEMON: party_data.load_pokemon(); inject_mystery(party_data.get_full_pokemon_array()); write_save_data(); return true; - case BACK_TO_MENU: + case CMD_BACK_TO_MENU: text_disable(); main_menu_exit(); return true; - case BEAT_E4: + case COND_BEAT_E4: return true; - case SHOW_PROF: + case CMD_SHOW_PROF: obj_unhide(prof, 0); return true; - case HIDE_PROF: + case CMD_HIDE_PROF: obj_hide(prof); return true; + case COND_MG_ENABLED: + return true; + default: tte_set_pos(0, 0); tte_write("ERROR! No conditional found."); return false; } } + +#define BOX_LENGTH 28 + +std::string_view format_text(std::string_view text) +{ + std::string out; + int last_space = 0; + int curr_line_length = 0; + for (unsigned int i = 0; i < text.size(); i++) + { + if (text.at(i) == ' ') + { + last_space = i; + } + if (curr_line_length >= BOX_LENGTH) + { + i = last_space; + out += '\n'; + } + else + { + out += text.at(i); + } + } + return (std::string_view)out; +} \ No newline at end of file diff --git a/source/script_builder.cpp b/source/script_builder.cpp index 4e79c3d..a23a529 100644 --- a/source/script_builder.cpp +++ b/source/script_builder.cpp @@ -1,6 +1,7 @@ #include #include "script_builder.h" #include "pokemon_party.h" +#include "pokemon_data.h" int var_callASM = (VAR_ID_START + 0x00); int var_script_ptr_low = (VAR_ID_START + 0x01); @@ -315,13 +316,13 @@ void mystery_gift_script::insert_textboxes() { for (unsigned int parser = 0; parser < pc_maker.length(); parser++) { - mg_script[curr_index] = convert_char(pc_maker.at(parser)); + mg_script[curr_index] = get_gen_3_char((char16_t)(pc_maker.at(parser)), false); curr_index++; } } for (unsigned int parser = 0; parser < textboxes[i].length(); parser++) { - mg_script[curr_index] = convert_char(textboxes[i].at(parser)); + mg_script[curr_index] = get_gen_3_char((char16_t)(textboxes[i].at(parser)), false); curr_index++; } mg_script[curr_index] = 0xFF; // End string @@ -329,6 +330,7 @@ void mystery_gift_script::insert_textboxes() } } +/* u8 mystery_gift_script::convert_char(char convert_char) { switch (convert_char) @@ -369,7 +371,7 @@ u8 mystery_gift_script::convert_char(char convert_char) return 0x00; } } - +*/ u16 mystery_gift_script::calc_checksum() // Implementation taken from PokeEmerald Decomp { u16 i, j; diff --git a/source/script_obj.cpp b/source/script_obj.cpp index f3abb5f..b84e3fd 100644 --- a/source/script_obj.cpp +++ b/source/script_obj.cpp @@ -7,34 +7,50 @@ script_obj::script_obj() { - text = "null"; + text = ""; next_index = 0; conditional_index = 0; next_false_index = 0; } -script_obj::script_obj(std::string nText, int nNext_index) +script_obj::script_obj(std::string_view nText, int nNext) { text = nText; - next_index = nNext_index; + next_index = nNext; conditional_index = 0; next_false_index = 0; } -script_obj::script_obj(std::string nText, int nNext_index, int nCond_index) +script_obj::script_obj(std::string_view nText, int nRun, int nNext) { text = nText; - next_index = nNext_index; - conditional_index = nCond_index; - next_false_index = nNext_index; + next_index = nNext; + conditional_index = nRun; + next_false_index = nNext; } -script_obj::script_obj(std::string nText, int nNext_index, int nCond_index, int nFalse_index) +script_obj::script_obj(int nRun, int nNext) +{ + text = ""; + next_index = nNext; + conditional_index = nRun; + next_false_index = nNext; +} + +script_obj::script_obj(std::string_view nText, int nRun, int nNext_if_true, int nNext_if_false) { text = nText; - next_index = nNext_index; - conditional_index = nCond_index; - next_false_index = nFalse_index; + next_index = nNext_if_true; + conditional_index = nRun; + next_false_index = nNext_if_false; +} + +script_obj::script_obj(int nRun, int nNext_if_true, int nNext_if_false) +{ + text = ""; + next_index = nNext_if_true; + conditional_index = nRun; + next_false_index = nNext_if_false; }