Working menu!

This commit is contained in:
Starport75
2023-08-11 15:39:52 -05:00
parent ebf4bd142f
commit ce71b400da
17 changed files with 256 additions and 90 deletions

View File

@@ -1,13 +1,15 @@
#include "script_array.h"
#include "main_menu.h"
#include "text_engine.h"
#include <tonc.h>
int last_error;
Pokemon_Party party_data;
script_obj script[16] =
script_obj script[17] =
{
script_obj("", 2, CHECK_GAME, 1), // 0
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
@@ -22,7 +24,8 @@ script_obj script[16] =
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("", 14, IMPORT_POKEMON), // 15
script_obj("", 16, IMPORT_POKEMON), // 15
script_obj("Bye!", 0, BACK_TO_MENU), // 16
};
void add_script_party_var(Pokemon_Party var)
@@ -35,16 +38,7 @@ bool run_conditional(int index)
// Here is most of the logic that drives what lines show up where. It's probably not the best way to code it, but it works
switch (index)
{
case CHECK_GAME:
{
u32 game_code = (*(vu32 *)(0x80000AC)) & 0xFFFFFF;
return (game_code == 0x565841 || // Ruby
game_code == 0x505841 || // Sapphire
game_code == 0x525042 || // FireRed
game_code == 0x475042 || // LeafGreen
game_code == 0x455042 // Emerald
);
}
case START_LINK:
party_data.start_link();
return true;
@@ -69,6 +63,12 @@ bool run_conditional(int index)
party_data.inject_pokemon();
return true;
case BACK_TO_MENU:
text_disable();
main_menu_exit();
return true;
default:
tte_set_pos(0, 0);
tte_write("ERROR! No conditional found.");