Working in RS, as well as correct text

This commit is contained in:
Remnants of Forgotten Disney
2023-11-08 15:06:23 -06:00
parent f71d2c22c9
commit 5874fb2b92
11 changed files with 291 additions and 190 deletions

View File

@@ -32,8 +32,9 @@
/*TODO:
--------
ACCURACY:
RESEARCH:
- See if shiny Pokemon from gen 2 can be square shinies or if they're all normal
- Determine how tossing wonder cards works, and if we need to trash the script after it is finished
LINK CABLE:
- Figure out JP Gen 2
@@ -42,28 +43,50 @@ CONVERSION:
- Add Korean conversion
INJECTION:
- Add Pokemon to internal Pokedex
- Randomize base seed
- Set flags for the number of Pokemon injected
- Check what happens when the PC is full, but the last Pokemon doesn't exist (is zero)
- Set text color for FRLG for when a Pokemon is sent (what happens if you set it in RSE?)
- Check text overflow for the "recieved" text. What happens if the name is too long?
Maybe use the standard function for that? https://www.pokecommunity.com/showthread.php?t=201077
- Figure out how to shrink the size of the mystery gift script. Especially with padding? idk, there's a lot of
multiple FFs and 00s
I think we can combine some of the ldr and add functions.
- Hall of Fame / Mystery Gift confirmation
- Korean GS Conversion
- Add in Rare Candies for new Pokemon
- Wonder Card
- Kill script?
SAVE DATA:
- Add warning
- Add ability to erase
- Add check for Hall of Fame
- Clear the empty data as part of the initalization
- Fix default language selection
TESTING:
- Test all the aspects of a Pokemon (Shiny, Pokerus, etc.)
- Make sure hall of fame data isn't corrupted
- Test all 14 different memory locations
DEBUG:
- Remove number from "game didn't load" text
GENERAL:
- Music
- Finalize Graphics
- Fade in and out
- Generalize graphics implementation? Load them only when needed and have one standard function?
- Add in sound effects for pressing buttons
- Credits (List all programs, people, and code- plus TPCI)
FUTURE:
- Minigame
- Wii Channel
- Ditto Gift (Ignore Mew/Celebi?)
- MissingNo/Enigma Berry
- Text Translations
- Add support for other languages
--------
*/
Pokemon_Party party = Pokemon_Party();
int delay_counter = 0;
bool skip = true;
/*
int test_main(void)
@@ -94,122 +117,132 @@ int test_main(void)
}
}
*/
void initalization_script(void)
{
// Initalizations
linkGPIO->reset();
REG_DISPCNT = DCNT_MODE0 | DCNT_BG0 | DCNT_BG1 | DCNT_BG2 | DCNT_BG3 | DCNT_OBJ | DCNT_OBJ_1D;
irq_init(NULL);
irq_enable(II_VBLANK);
flash_init(FLASH_SIZE_128KB);
rand_set_seed(0x1216);
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
irq_enable(II_VBLANK);
// mmInitDefault((mm_addr)soundbank_bin, 8); //Music
// mmStart(MOD_FLATOUTLIES, MM_PLAY_LOOP); //Music
// Graphics init
oam_init(obj_buffer, 128);
// Load opening background first so it hides everything else
load_opening_background();
load_background();
load_textbox_background();
load_testroid();
load_professor();
load_btn_t_l();
load_btn_t_r();
load_btn_p_l();
load_btn_p_r();
load_btn_c_l();
load_btn_c_r();
load_dex_l();
load_dex_m();
load_dex_r();
load_btn_d_l();
load_btn_d_r();
load_btn_lang_eng();
load_btn_lang_fre();
load_btn_lang_ita();
load_btn_lang_ger();
load_btn_lang_spa();
load_btn_lang_kor();
load_lang_arrow();
main_menu_btn_init(Button(btn_t_l, btn_t_r, 128, 160), BTN_TRANSFER);
main_menu_btn_init(Button(btn_p_l, btn_p_r, 192, 224), BTN_POKEDEX);
main_menu_btn_init(Button(btn_c_l, btn_c_r, 256, 288), BTN_CREDITS);
main_menu_btn_init(Button(btn_d_l, btn_d_r, 416, 448), BTN_LANGUAGE);
main_menu_btn_init(Button(btn_lang_eng, 480), BTN_ENG);
main_menu_btn_init(Button(btn_lang_fre, 512), BTN_FRE);
main_menu_btn_init(Button(btn_lang_ita, 544), BTN_ITA);
main_menu_btn_init(Button(btn_lang_ger, 576), BTN_GER);
main_menu_btn_init(Button(btn_lang_spa, 608), BTN_SPA);
main_menu_btn_init(Button(btn_lang_kor, 640), BTN_KOR);
main_menu_btn_init(Button(lang_arrow, 672), LANG_ARROW);
pokedex_init(); // Why does this cause the music to stop playing? Also the loop doesn't work
// main_menu_init(transfer_btn, pokedex_btn, credits_btn, language_btn);
text_disable();
};
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);
REG_BG2CNT = (REG_BG2CNT & ~BG_PRIO_MASK) | BG_PRIO(1);
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() >> 8).c_str());
key_poll();
while (!key_hit(KEY_A))
{
key_poll();
VBlankIntrWait();
}
tte_erase_screen();
delay_counter = 0;
while (delay_counter < 60)
{
delay_counter++;
VBlankIntrWait();
}
}
int main(void)
{
int delay_counter = 0;
bool skip = true;
do
{ // Do not run on the first loop
if (!skip)
{
REG_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);
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() >> 8).c_str());
key_poll();
while (!key_hit(KEY_A))
{
key_poll();
VBlankIntrWait();
}
tte_erase_screen();
delay_counter = 0;
while (delay_counter < 60)
{
delay_counter++;
VBlankIntrWait();
}
game_load_error();
}
skip = false;
// Initalizations
linkGPIO->reset();
REG_DISPCNT = DCNT_MODE0 | DCNT_BG0 | DCNT_BG1 | DCNT_BG2 | DCNT_BG3 | DCNT_OBJ | DCNT_OBJ_1D;
irq_init(NULL);
irq_enable(II_VBLANK);
flash_init(FLASH_SIZE_128KB);
rand_set_seed(0x12162001);
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
irq_enable(II_VBLANK);
// mmInitDefault((mm_addr)soundbank_bin, 8); //Music
// mmStart(MOD_FLATOUTLIES, MM_PLAY_LOOP); //Music
// Graphics init
oam_init(obj_buffer, 128);
// Load opening background first so it hides everything else
load_opening_background();
load_background();
load_textbox_background();
load_testroid();
load_professor();
load_btn_t_l();
load_btn_t_r();
load_btn_p_l();
load_btn_p_r();
load_btn_c_l();
load_btn_c_r();
load_dex_l();
load_dex_m();
load_dex_r();
load_btn_d_l();
load_btn_d_r();
load_btn_lang_eng();
load_btn_lang_fre();
load_btn_lang_ita();
load_btn_lang_ger();
load_btn_lang_spa();
load_btn_lang_kor();
load_lang_arrow();
main_menu_btn_init(Button(btn_t_l, btn_t_r, 128, 160), BTN_TRANSFER);
main_menu_btn_init(Button(btn_p_l, btn_p_r, 192, 224), BTN_POKEDEX);
main_menu_btn_init(Button(btn_c_l, btn_c_r, 256, 288), BTN_CREDITS);
main_menu_btn_init(Button(btn_d_l, btn_d_r, 416, 448), BTN_LANGUAGE);
main_menu_btn_init(Button(btn_lang_eng, 480), BTN_ENG);
main_menu_btn_init(Button(btn_lang_fre, 512), BTN_FRE);
main_menu_btn_init(Button(btn_lang_ita, 544), BTN_ITA);
main_menu_btn_init(Button(btn_lang_ger, 576), BTN_GER);
main_menu_btn_init(Button(btn_lang_spa, 608), BTN_SPA);
main_menu_btn_init(Button(btn_lang_kor, 640), BTN_KOR);
main_menu_btn_init(Button(lang_arrow, 672), LANG_ARROW);
pokedex_init(); // Why does this cause the music to stop playing? Also the loop doesn't work
// main_menu_init(transfer_btn, pokedex_btn, credits_btn, language_btn);
text_disable();
initalization_script();
// Check if the game has been loaded correctly.
load_gamecode();
} while (!((get_gamecode() == RUBY_ID) ||
(get_gamecode() == SAPPHIRE_ID) ||
(get_gamecode() == FIRERED_ID) ||
(get_gamecode() == LEAFGREEN_ID) ||
(get_gamecode() == EMERALD_ID)));
} while (
!(((get_gamecode() == RUBY_ID) ||
(get_gamecode() == SAPPHIRE_ID) ||
(get_gamecode() == FIRERED_ID) ||
(get_gamecode() == LEAFGREEN_ID) ||
(get_gamecode() == EMERALD_ID)) &&
(get_language() == LANG_ENG))); // Prevents non-English games from loading
// Reinitalize the flash memory
// flash_init(FLASH_SIZE_128KB);
// Initalize memory and save data after loading the game
initalize_memory_locations();
load_save_data();
load_custom_save_data();
// Legal mumbo jumbo
tte_set_pos(8, 0);
@@ -226,6 +259,7 @@ int main(void)
VBlankIntrWait();
}
key_poll();
// Gears of Progress
tte_erase_rect(0, 0, 240, 160);
REG_BG1VOFS = 0;
@@ -246,10 +280,6 @@ int main(void)
// Set up blend to fade to white/black
set_caught(3);
set_caught(15);
set_caught(5);
int curr_lang_btn_num = 3;
int old_lang_btn_num = -1;
set_arrow_point(curr_lang_btn_num);
@@ -324,6 +354,8 @@ int main(void)
key_poll();
rand_next_frame();
tte_set_pos(0, 0);
// tte_write(std::to_string(get_rand_u32()).c_str());
background_frame();
text_next_frame();
oam_copy(oam_mem, obj_buffer, 35);