diff --git a/include/debug_mode.h b/include/debug_mode.h index 7341585..efbef62 100644 --- a/include/debug_mode.h +++ b/include/debug_mode.h @@ -2,8 +2,8 @@ #define DEBUG_MODE_H #define DEBUG_MODE true -#define DEBUG_GAME EMERALD_ID -#define DEBUG_VERS VERS_1_0 +#define DEBUG_GAME LEAFGREEN_ID +#define DEBUG_VERS VERS_1_1 // This is literally it. Yay. #endif \ No newline at end of file diff --git a/include/script_array.h b/include/script_array.h index a42fd5c..1cc5d5b 100644 --- a/include/script_array.h +++ b/include/script_array.h @@ -4,7 +4,7 @@ #include "script_obj.h" #include "pokemon_party.h" -extern script_obj script[17]; +extern script_obj script[]; void add_script_party_var(Pokemon_Party var); bool run_conditional(int index); diff --git a/include/script_obj.h b/include/script_obj.h index 303597f..85e6ff3 100644 --- a/include/script_obj.h +++ b/include/script_obj.h @@ -12,6 +12,9 @@ #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 { diff --git a/source/main.cpp b/source/main.cpp index ce85efe..2ff8643 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -59,6 +59,8 @@ INJECTION: - Add Pokemon to Pokedex - Randomize base seed - Enable ribbon viewing +- Set flags for the number of Pokemon injected +- Set Pokedex flags SAVE DATA: - Add warning @@ -157,8 +159,8 @@ int main(void) text_disable(); - load_gamecode(); // Check if the game has been loaded correctly. + load_gamecode(); while (!((get_gamecode() == RUBY_ID) || (get_gamecode() == SAPPHIRE_ID) || (get_gamecode() == FIRERED_ID) || @@ -171,8 +173,7 @@ int main(void) REG_BG2VOFS = 0; tte_set_pos(40, 24); tte_set_margins(40, 24, 206, 104); - //tte_write("The Pokemon save\nfile was not loaded successfully. Please\nrestart the console,\nload the Pokemon\ngame normally, and\nthen upload the\nprogram again."); - tte_write(std::to_string(get_gamecode()).c_str()); + tte_write("The Pokemon save\nfile was not loaded successfully. Please\nrestart the console,\nload the Pokemon\ngame normally, and\nthen upload the\nprogram again."); key_poll(); while (!key_hit(KEY_A)) { diff --git a/source/pokemon.cpp b/source/pokemon.cpp index 8e8ce86..977030c 100644 --- a/source/pokemon.cpp +++ b/source/pokemon.cpp @@ -90,6 +90,7 @@ void Pokemon::convert_to_gen_three() moves[0] = get_earliest_move(species_index); } +/* // Bubble valid moves to the top int i, j; bool swapped; @@ -107,7 +108,7 @@ void Pokemon::convert_to_gen_three() // by inner loop, then break if (swapped == false) break; - } + }*/ // Convert and set IVs int hp_iv = 0; diff --git a/source/pokemon_data.cpp b/source/pokemon_data.cpp index 80b94f9..c12315b 100644 --- a/source/pokemon_data.cpp +++ b/source/pokemon_data.cpp @@ -30,7 +30,7 @@ bool get_num_abilities(int index_num) bool can_learn_move(int pkmn_index, int move_index) { byte data_byte = MOVESETS[pkmn_index - 1][move_index / 8]; - return (data_byte >> (move_index % 8)) & 0x1; + return (data_byte >> (7 - (move_index % 8))) & 0x1; } byte get_earliest_move(int index_num) @@ -1254,6 +1254,7 @@ const bool NUM_ABILITIES[251] = { }; const byte MOVESETS[251][32] = { // This data is stored as 32 bytes of binary data per Pokemon, depending on if they can learn the move. Data obtained through PokeAPI + // 0(unused) 8 16 24 32 40 48 56 64 72 80 88 96 104 112 120 128 136 144 152 160 168 176 184 192 200 208 216 224 232 240 248 {0b00000000, 0b00000011, 0b00000010, 0b00000000, 0b01100010, 0b00000100, 0b00000000, 0b00000000, 0b00000010, 0b01111101, 0b10000000, 0b00001000, 0b00000010, 0b10000001, 0b01000000, 0b00000000, 0b00100000, 0b00000000, 0b00001000, 0b00001000, 0b00001000, 0b00000110, 0b00000010, 0b00001100, 0b00000000, 0b00111001, 0b00100110, 0b10110000, 0b00000010, 0b00010100, 0b01000000, 0b01000000}, // Bulbasaur {0b00000000, 0b00000011, 0b00000010, 0b00000000, 0b01100010, 0b00000100, 0b00000000, 0b00000000, 0b00000010, 0b01111101, 0b00000000, 0b00001000, 0b00000010, 0b10000001, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00001000, 0b00001000, 0b00001000, 0b00000100, 0b00000010, 0b00001100, 0b00000000, 0b00110001, 0b00100110, 0b10100000, 0b00000010, 0b00010100, 0b01000000, 0b01000000}, // Ivysaur {0b00000000, 0b00000011, 0b00000010, 0b00000000, 0b01100010, 0b00000110, 0b00000000, 0b00000001, 0b00000010, 0b01111101, 0b00000000, 0b01001000, 0b00000010, 0b10000001, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00001000, 0b00001000, 0b00001000, 0b00000100, 0b00000010, 0b00001100, 0b00000000, 0b00110001, 0b00100110, 0b10100000, 0b00000010, 0b00010100, 0b01000000, 0b01000000}, // Venusaur @@ -1760,7 +1761,6 @@ const byte FIRST_MOVES[251] = { 0x12, // Ho-oh (whirlwind) 0x49, // Celebi (leech-seed) }; - const std::string_view NAMES[251]{ "Bulbasaur", "Ivysaur", @@ -2013,4 +2013,7 @@ const std::string_view NAMES[251]{ "Lugia", "Ho-Oh", "Celebi", -}; \ No newline at end of file +}; +//const u8 EVOLUTIONS[251][2] +//const u8 POWER_POINTS[253] + diff --git a/source/script.cpp b/source/script.cpp index 37f8758..530985a 100644 --- a/source/script.cpp +++ b/source/script.cpp @@ -41,29 +41,4 @@ void inject_mystery(Pokemon incoming_party_aray[]) global_memory_buffer[(script.get_offset_flags() + (FLAG_ID_START / 8)) % 0xF80] &= (~0b01000000 << (FLAG_ID_START % 8)); // Set "collected all" flag to 0 update_memory_buffer_checksum(); flash_write(memory_section_array[1 + ((script.get_offset_flags() + (FLAG_ID_START / 8)) / 0xF80)], &global_memory_buffer[0], 0x1000); -} - -/* - -- 00 B5 -- 08 4B -- 1B 68 -- 08 A0 -- C0 18 -- 04 49 -- 7A 46 -- 07 32 -- 96 46 -- 08 47 -- 02 4A -- 10 60 -01 BC -00 47 -91 B4 -06 08 -E4 75 -03 02 -E8 75 -03 02 - -*/ \ No newline at end of file +} \ No newline at end of file diff --git a/source/script_array.cpp b/source/script_array.cpp index d25e9d1..25dd3ab 100644 --- a/source/script_array.cpp +++ b/source/script_array.cpp @@ -2,31 +2,36 @@ #include "main_menu.h" #include "text_engine.h" #include "script.h" - +#include "sprite_data.h" #include int last_error; Pokemon_Party party_data; -script_obj script[17] = +script_obj script[] = { - script_obj("", 2), // 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!", 0, BACK_TO_MENU), // 16 + 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 }; void add_script_party_var(Pokemon_Party var) @@ -61,7 +66,6 @@ bool run_conditional(int index) case IMPORT_POKEMON: party_data.load_pokemon(); - //party_data.inject_pokemon(); inject_mystery(party_data.get_full_pokemon_array()); return true; @@ -70,6 +74,16 @@ bool run_conditional(int index) main_menu_exit(); return true; + case BEAT_E4: + return false; + + case SHOW_PROF: + obj_unhide(prof, 0); + return true; + + case HIDE_PROF: + obj_hide(prof); + return true; default: tte_set_pos(0, 0); diff --git a/source/sprite_data.cpp b/source/sprite_data.cpp index 047d5ca..0ecd8a8 100644 --- a/source/sprite_data.cpp +++ b/source/sprite_data.cpp @@ -80,16 +80,16 @@ void load_professor() memcpy(&tile_mem[4][64], profTiles, profTilesLen); memcpy(pal_obj_mem + 16, profPal, profPalLen); - int x = 96, y = 64; + int x = 96, y = 56; u32 tid = 64, pb = 1; // tile id, pal-bank obj_set_attr(prof, ATTR0_SQUARE, ATTR1_SIZE_64x64, - ATTR2_PALBANK(pb) | tid | ATTR2_PRIO(3)); + ATTR2_PALBANK(pb) | tid | ATTR2_PRIO(2)); obj_set_pos(prof, x, y); obj_hide(prof); - // obj_unhide(prof, 0); + //obj_unhide(prof, 0); } #include "btn_t_l.h"