Adding check for other events

This commit is contained in:
Remnants of Forgotten Disney 2023-11-18 12:58:48 -06:00
parent 29f4baaf3b
commit fde2cfe68f
14 changed files with 150 additions and 130 deletions

View File

@ -1,7 +1,7 @@
#ifndef DEBUG_MODE_H
#define DEBUG_MODE_H
#define DEBUG_MODE false
#define DEBUG_MODE true
#define IGNORE_LINK_CABLE true
#define DEBUG_GAME LEAFGREEN_ID
#define DEBUG_VERS VERS_1_1

View File

@ -23,7 +23,7 @@ void initalize_memory_locations();
//bool insert_pokemon(Pokemon party_array[], int num);
void reverse_endian(u8 *data, size_t size);
void update_memory_buffer_checksum();
bool get_flag(u16 flag_id);
bool read_flag(u16 flag_id);
bool compare_map_and_npc_data(int map_bank, int map_id, int npc_id);
#endif

View File

@ -127,9 +127,6 @@ public:
u8 get_script_value_at(int index);
u32 calc_checksum32();
u16 calc_crc16();
int get_offset_wondercard();
int get_offset_script();
int get_offset_flags();
private:
void add_command(int len);

View File

@ -41,6 +41,10 @@ public:
u8 map_bank;
u8 map_id;
u8 npc_id;
u8 def_map_bank;
u8 def_map_id;
u8 def_npc_id;
};
#endif

View File

@ -2,6 +2,7 @@
#define SAVE_DATA_MANAGER_H
#include <tonc.h>
#include "rom_data.h"
#define HALL_OF_FAME 0x01C000
#define HOF_SECTION 2032
@ -16,6 +17,8 @@
#define DEFAULT_LANGUAGE 0x21 // | 0x22 | 1 | Default international language
#define SAVE_DATA_SIZE 0x22
extern rom_data curr_rom;
void load_custom_save_data();
void write_custom_save_data();
bool is_caught(int dex_num);

View File

@ -27,8 +27,10 @@
#define DIA_ERROR_DISCONNECT 18
#define DIA_ERROR_COM_ENDED 19
#define DIA_ERROR_COLOSSEUM 20
#define DIA_MG_OTHER_EVENT 21
#define DIA_PKMN_TO_COLLECT 22
#define DIA_SIZE 21
#define DIA_SIZE 23
#define DIA_END DIA_SIZE
// Commands
@ -55,8 +57,10 @@
#define COND_NEW_POKEMON CMDS_END + 8
#define COND_IS_HOENN 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
#define COND_SIZE 11
#define COND_SIZE 13
#define COND_END CMDS_END + COND_SIZE
// Ends

View File

@ -136,7 +136,17 @@ void update_memory_buffer_checksum()
global_memory_buffer[0x0FF7] = (small_checksum & 0xFF00) >> 8;
}
bool get_flag(u16 flag_id)
bool read_flag(u16 flag_id)
{
return true;
flash_read(memory_section_array[1 + ((curr_rom.offset_flags + (flag_id / 8)) / 0xF80)], &global_memory_buffer[0], 0x1000);
u8 flags = global_memory_buffer[(curr_rom.offset_flags + (flag_id / 8)) % 0xF80];
return (flags >> (flag_id % 8)) & 0b1;
}
bool compare_map_and_npc_data(int map_bank, int map_id, int npc_id)
{
flash_read(memory_section_array[4], &global_memory_buffer[0], 0x1000);
return (global_memory_buffer[curr_rom.offset_script + 5] == map_bank &&
global_memory_buffer[curr_rom.offset_script + 6] == map_id &&
global_memory_buffer[curr_rom.offset_script + 7] == npc_id);
}

View File

@ -31,29 +31,21 @@
#include "mystery_gift_builder.h"
#include "rom_data.h"
/*TODO:
--------
RESEARCH:
- See if shiny Pokemon from gen 2 can be square shinies or if they're all normal
LINK CABLE:
- Confirm JP Gen 2
INJECTION:
/*
TODO:
- Add in check for no valid Pokemon
- Combine the gen 3 data pointers into one class
GENERAL:
- Finish conditionals
- Add in custom wonder card
- Confirm JP Gen 2
- Restart the program after a transfer? Transfering twice without restarting corrupts the data (level included?)
- Finalize Graphics
- Simplify the sprite initalization
- Fade in and out
- Add in sound effects for pressing buttons
- Music
- Credits (List all programs, people, and code- plus TPCI)
FUTURE:
Post Beta:
- Determine if transfered Shiny Pokemon are square/star sparkles
- Music and Sound Effects
- Simplify the sprite initalization
- Smoother Transitions
- Minigame
- Wii Channel
- Ditto Gift (Ignore Mew/Celebi?)

View File

@ -145,71 +145,70 @@ void mystery_gift_script::build_script(Pokemon incoming_party_array[])
waitmsg(); // Wait for the message
waitkeypress(); // Wait for the player to press A/B
release(); // Release the player
// end(); // End the script
killscript(); // Erase RAMscript
/**/ set_jump_destination(JUMP_BOX_FULL); // Set the destination for if the box is full
virtualmsgbox(TEXT_FULL); // Display the full box message
waitmsg(); // Wait for the message
waitkeypress(); // Wait for the player to presse A/B
release(); // Release the player
end(); // End the script
//
insert_textboxes(); // Insert textbox data
four_align(); // Align the code so that it is byte aligned
//
/**/ set_ptr_destination(REL_PTR_ASM_START); // Set the memory pointer location for ASM start
push(rlist_lr); // save the load register to the stack
ldr3(r3, asm_offset_distance(ASM_OFFSET_PKMN_OFFSET)); // set r3 to the pointer to the pokemon offset variable
ldr1(r3, r3, 0); // set r3 to the value in memory r3 points to
add5(r0, asm_offset_distance(ASM_OFFSET_PKMN_STRUCT)); // set r0 to a pointer 28 bytes ahead, which is the start of the Pokemon struct.
add3(r0, r0, r3); // add r3 to r0, giving it the correct offset for the current index
ldr3(r1, asm_offset_distance(ASM_OFFSET_SENDMON_PTR)); // set r1 to the location of "SendMonToPC" plus one, since it is thumb code
mov3(r2, r15); // move r15 (the program counter) to r2
add2(r2, 5); // add 5 to r2 to compensate for the four following bytes, plus to tell the system to read as thumb code
mov3(r14, r2); // move r2 into r14 (the load register)
bx(r1); // jump to the pointer stored in r1 (SendMonToPC)
ldr3(r2, asm_offset_distance(ASM_OFFSET_BOX_SUC_PTR)); // load variable 0x8006's pointer into r2
str1(r0, r2, 0); // put the value of r0 into the memory location pointed at by r2, plus 0
pop(rlist_r0); // remove r0 from the stack and put it into r0
bx(r0); // jump to r0 (return to where the function was called)
//
/*set_ptr_destination(REL_PTR_DEX_START);*/ // This stays commented out since the offset is not used.
push(rlist_lr); // save the load register to the stack
ldr3(r0, asm_offset_distance(ASM_OFFSET_INDEX)); // load the pointer to the index variable into r0
ldr1(r0, r0, 0); // load the value at r0's pointer
mov1(r3, 0xFF); // load 0xFF into r3
and1(r0, r3); // AND r0 and r3, which will give us just the least significant byte
add5(r1, asm_offset_distance(ASM_OFFSET_DEX_STRUCT)); // set r1 to the value stored X bytes ahead
add3(r0, r0, r1); // add r0 and r1, which is the current index and dex_struct respectivly
ldr1(r0, r0, 0); // load the value at the memory location stored in r0
and1(r0, r3); // truncate to just the least significant byte, which is the current dex number
ldr3(r1, asm_offset_distance(ASM_OFFSET_DEX_SEEN_CAUGHT)); // load the dex_seen_caught variable's pointer into r1
ldr1(r1, r1, 0); // load the value of memory pointed at by r1
and1(r1, r3); // AND r1 and r3, which will keep only the least significant byte
ldr3(r2, asm_offset_distance(ASM_OFFSET_DEX_ASM_PTR_1)); // load the GetSetPokedexFlag function location into r2
mov3(r3, r15); // move r15 (the program counter) to r3
add2(r3, 5); // add 5 to r3 to compensate for the four following bytes, as well as to tell it to read as THUMB code
mov3(r14, r3); // move r3 into r14 (the load register)
//
bx(r2); // jump to the pointer stored in r2 (GetSetPokedexFlag)
pop(rlist_r0); // remove r0 from the stack and put it into r0
bx(r0); // jump to r0 (return to where the function was called)
//
add_padding(); // add padding so that we are byte aligned again
set_asm_offset_destination(ASM_OFFSET_SENDMON_PTR); // set the SENDMON ptr offset
add_word(curr_rom.loc_sendMonToPC + READ_AS_THUMB); // the location of "SendMonToPC", plus one (so it is interpreted as thumb code)
set_asm_offset_destination(ASM_OFFSET_BOX_SUC_PTR); // set the BOX_SUCCESS ptr offset
add_word(ptr_box_return); // the location of variable "0x8006" (the return value)
set_asm_offset_destination(ASM_OFFSET_PKMN_OFFSET); // set the PKMN_OFFSET ptr offset
add_word(ptr_pkmn_offset); // the location of variable "0x8008" (the pokemon offset)
set_asm_offset_destination(ASM_OFFSET_DEX_ASM_PTR_1); // set the DEX_ASM_PTR offset
add_word(curr_rom.loc_setPokedexFlag + READ_AS_THUMB); // the location of GetSetPokedexFlag, plus one (so it is interpreted as thumb code)
set_asm_offset_destination(ASM_OFFSET_DEX_SEEN_CAUGHT); // set the DEX_SEEN_CAUGHT offset
add_word(ptr_dex_seen_caught); // the location of the DEX_SEEN_CAUGHT variable
set_asm_offset_destination(ASM_OFFSET_INDEX); // set the INDEX variable offset
add_word(ptr_index); // the location of the INDEX variable
//
set_asm_offset_destination(ASM_OFFSET_DEX_STRUCT); // set the DEX_STRUCT offset
killscript(); // Erase RAMscript
/**/ set_jump_destination(JUMP_BOX_FULL); // Set the destination for if the box is full
virtualmsgbox(TEXT_FULL); // Display the full box message
waitmsg(); // Wait for the message
waitkeypress(); // Wait for the player to presse A/B
release(); // Release the player
end(); // End the script
//
insert_textboxes(); // Insert textbox data
four_align(); // Align the code so that it is byte aligned
//
/**/ set_ptr_destination(REL_PTR_ASM_START); // Set the memory pointer location for ASM start
push(rlist_lr); // save the load register to the stack
ldr3(r3, asm_offset_distance(ASM_OFFSET_PKMN_OFFSET)); // set r3 to the pointer to the pokemon offset variable
ldr1(r3, r3, 0); // set r3 to the value in memory r3 points to
add5(r0, asm_offset_distance(ASM_OFFSET_PKMN_STRUCT)); // set r0 to a pointer 28 bytes ahead, which is the start of the Pokemon struct.
add3(r0, r0, r3); // add r3 to r0, giving it the correct offset for the current index
ldr3(r1, asm_offset_distance(ASM_OFFSET_SENDMON_PTR)); // set r1 to the location of "SendMonToPC" plus one, since it is thumb code
mov3(r2, r15); // move r15 (the program counter) to r2
add2(r2, 5); // add 5 to r2 to compensate for the four following bytes, plus to tell the system to read as thumb code
mov3(r14, r2); // move r2 into r14 (the load register)
bx(r1); // jump to the pointer stored in r1 (SendMonToPC)
ldr3(r2, asm_offset_distance(ASM_OFFSET_BOX_SUC_PTR)); // load variable 0x8006's pointer into r2
str1(r0, r2, 0); // put the value of r0 into the memory location pointed at by r2, plus 0
pop(rlist_r0); // remove r0 from the stack and put it into r0
bx(r0); // jump to r0 (return to where the function was called)
//
/*set_ptr_destination(REL_PTR_DEX_START);*/ // This stays commented out since the offset is not used.
push(rlist_lr); // save the load register to the stack
ldr3(r0, asm_offset_distance(ASM_OFFSET_INDEX)); // load the pointer to the index variable into r0
ldr1(r0, r0, 0); // load the value at r0's pointer
mov1(r3, 0xFF); // load 0xFF into r3
and1(r0, r3); // AND r0 and r3, which will give us just the least significant byte
add5(r1, asm_offset_distance(ASM_OFFSET_DEX_STRUCT)); // set r1 to the value stored X bytes ahead
add3(r0, r0, r1); // add r0 and r1, which is the current index and dex_struct respectivly
ldr1(r0, r0, 0); // load the value at the memory location stored in r0
and1(r0, r3); // truncate to just the least significant byte, which is the current dex number
ldr3(r1, asm_offset_distance(ASM_OFFSET_DEX_SEEN_CAUGHT)); // load the dex_seen_caught variable's pointer into r1
ldr1(r1, r1, 0); // load the value of memory pointed at by r1
and1(r1, r3); // AND r1 and r3, which will keep only the least significant byte
ldr3(r2, asm_offset_distance(ASM_OFFSET_DEX_ASM_PTR_1)); // load the GetSetPokedexFlag function location into r2
mov3(r3, r15); // move r15 (the program counter) to r3
add2(r3, 5); // add 5 to r3 to compensate for the four following bytes, as well as to tell it to read as THUMB code
mov3(r14, r3); // move r3 into r14 (the load register)
//
bx(r2); // jump to the pointer stored in r2 (GetSetPokedexFlag)
pop(rlist_r0); // remove r0 from the stack and put it into r0
bx(r0); // jump to r0 (return to where the function was called)
//
add_padding(); // add padding so that we are byte aligned again
set_asm_offset_destination(ASM_OFFSET_SENDMON_PTR); // set the SENDMON ptr offset
add_word(curr_rom.loc_sendMonToPC + READ_AS_THUMB); // the location of "SendMonToPC", plus one (so it is interpreted as thumb code)
set_asm_offset_destination(ASM_OFFSET_BOX_SUC_PTR); // set the BOX_SUCCESS ptr offset
add_word(ptr_box_return); // the location of variable "0x8006" (the return value)
set_asm_offset_destination(ASM_OFFSET_PKMN_OFFSET); // set the PKMN_OFFSET ptr offset
add_word(ptr_pkmn_offset); // the location of variable "0x8008" (the pokemon offset)
set_asm_offset_destination(ASM_OFFSET_DEX_ASM_PTR_1); // set the DEX_ASM_PTR offset
add_word(curr_rom.loc_setPokedexFlag + READ_AS_THUMB); // the location of GetSetPokedexFlag, plus one (so it is interpreted as thumb code)
set_asm_offset_destination(ASM_OFFSET_DEX_SEEN_CAUGHT); // set the DEX_SEEN_CAUGHT offset
add_word(ptr_dex_seen_caught); // the location of the DEX_SEEN_CAUGHT variable
set_asm_offset_destination(ASM_OFFSET_INDEX); // set the INDEX variable offset
add_word(ptr_index); // the location of the INDEX variable
//
set_asm_offset_destination(ASM_OFFSET_DEX_STRUCT); // set the DEX_STRUCT offset
for (int i = 0; i < 6; i++) // Add in the dex numbers
{
@ -266,21 +265,6 @@ void mystery_gift_script::add_command(int len)
}
}
int mystery_gift_script::get_offset_wondercard()
{
return curr_rom.offset_wondercard;
}
int mystery_gift_script::get_offset_script()
{
return curr_rom.offset_script;
}
int mystery_gift_script::get_offset_flags()
{
return curr_rom.offset_flags;
}
void mystery_gift_script::fill_jumppoint_pointers()
{
for (int i = 0; i < NUM_JUMPS; i++) // Parse through the script and replace any jump points

View File

@ -26,36 +26,36 @@ void inject_mystery(Pokemon incoming_party_aray[])
flash_read(memory_section_array[4], &global_memory_buffer[0], 0x1000);
for (int i = 0; i < 0x14E; i++)
{
global_memory_buffer[script.get_offset_wondercard() + i] = wonder_card[i];
global_memory_buffer[curr_rom.offset_wondercard + i] = wonder_card[i];
}
// Set checksum and padding
global_memory_buffer[script.get_offset_script()] = checksum >> 0;
global_memory_buffer[script.get_offset_script() + 1] = checksum >> 8;
global_memory_buffer[script.get_offset_script() + 2] = checksum >> 16;
global_memory_buffer[script.get_offset_script() + 3] = checksum >> 24;
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[script.get_offset_script() + 4 + i] = script.get_script_value_at(i);
global_memory_buffer[curr_rom.offset_script + 4 + i] = script.get_script_value_at(i);
}
update_memory_buffer_checksum();
flash_write(memory_section_array[4], &global_memory_buffer[0], 0x1000);
// Set flags
flash_read(memory_section_array[1 + ((script.get_offset_flags() + (FLAG_ID_START / 8)) / 0xF80)], &global_memory_buffer[0], 0x1000);
global_memory_buffer[(script.get_offset_flags() + (FLAG_ID_START / 8)) % 0xF80] &= (~0b01111111 << (FLAG_ID_START % 8)); // Set "collected all" flag to 0 and reset the "to obtain" flags
flash_read(memory_section_array[1 + ((curr_rom.offset_flags + (FLAG_ID_START / 8)) / 0xF80)], &global_memory_buffer[0], 0x1000);
global_memory_buffer[(curr_rom.offset_flags + (FLAG_ID_START / 8)) % 0xF80] &= (~0b01111111 << (FLAG_ID_START % 8)); // Set "collected all" flag to 0 and reset the "to obtain" flags
for (int i = 0; i < 6; i++)
{
if (incoming_party_aray[i].get_validity())
{
global_memory_buffer[(script.get_offset_flags() + (FLAG_ID_START / 8)) % 0xF80] |= ((1 << i) << (FLAG_ID_START % 8)); // Set "to obtain" flags accordingly
global_memory_buffer[(curr_rom.offset_flags + (FLAG_ID_START / 8)) % 0xF80] |= ((1 << i) << (FLAG_ID_START % 8)); // Set "to obtain" flags accordingly
}
}
update_memory_buffer_checksum();
flash_write(memory_section_array[1 + ((script.get_offset_flags() + (FLAG_ID_START / 8)) / 0xF80)], &global_memory_buffer[0], 0x1000);
flash_write(memory_section_array[1 + ((curr_rom.offset_flags + (FLAG_ID_START / 8)) / 0xF80)], &global_memory_buffer[0], 0x1000);
// Update and save custom save data
for (int i = 0; i < 6; i++)

View File

@ -32,20 +32,18 @@ void Pokemon::load_data(int index, byte *party_data)
nickname_size = 11;
language = INTERNATIONAL;
}
/*
else if (party_data[GEN2_JPN_SIZE + 0] == 0xFD &&
party_data[GEN2_JPN_SIZE + 1] == 0xFD &&
party_data[GEN2_JPN_SIZE + 2] == 0xFD &&
party_data[GEN2_JPN_SIZE + 3] == 0xFD)
{
// DOUBLE CHECK THIS
gen = 2;
pkmn_size = 48;
ot_and_party = 17;
ot_size = 6;
nickname_size = 6;
language = JPN_ID;
}*/
}
else if (party_data[GEN2_INT_SIZE + 0] == 0xFD &&
party_data[GEN2_INT_SIZE + 1] == 0xFD &&
party_data[GEN2_INT_SIZE + 2] == 0xFD &&
@ -299,11 +297,11 @@ void Pokemon::convert_to_gen_three()
data_section_G[1] = 0x00; // Species Index, check for glitch Pokemon
if (!is_caught(species_index_struct))
{
data_section_G[2] = 0x44;
data_section_G[2] = 0x44; // Rare Candy
}
else
{
data_section_G[2] = 0x00;
data_section_G[2] = 0x00; // No item
}
data_section_G[3] = 0x00;
copy_from_to(&exp[0], &data_section_G[4], 3, false);

View File

@ -39,6 +39,11 @@ bool rom_data::load_rom()
map_bank = 0;
map_id = 10;
npc_id = 1;
def_map_bank = 8;
def_map_id = 1;
def_npc_id = 1;
text_region = TEXT_HOENN;
offset_wondercard = 0;
offset_script = 0x0810;
@ -78,6 +83,11 @@ bool rom_data::load_rom()
map_bank = 30;
map_id = 0;
npc_id = 1;
def_map_bank = 0xFF;
def_map_id = 0xFF;
def_npc_id = 0xFF;
text_region = TEXT_KANTO;
offset_wondercard = 0x0460;
offset_script = 0x079C;
@ -107,6 +117,11 @@ bool rom_data::load_rom()
map_bank = 20;
map_id = 2;
npc_id = 1;
def_map_bank = 0xFF;
def_map_id = 0xFF;
def_npc_id = 0xFF;
text_region = TEXT_HOENN;
offset_wondercard = 0x056C;
offset_script = 0x08A8;
@ -127,6 +142,7 @@ bool rom_data::is_hoenn()
return (gamecode == RUBY_ID || gamecode == SAPPHIRE_ID || gamecode == EMERALD_ID);
}
bool rom_data::is_ruby_sapphire(){
bool rom_data::is_ruby_sapphire()
{
return (gamecode == RUBY_ID || gamecode == SAPPHIRE_ID);
}
}

View File

@ -86,4 +86,4 @@ void initalize_save_data()
save_data_array[i] = 0;
}
write_custom_save_data();
}
}

View File

@ -3,6 +3,7 @@
#include "text_engine.h"
#include "mystery_gift_injector.h"
#include "sprite_data.h"
#include "flash_mem.h"
#include <tonc.h>
int last_error;
@ -26,6 +27,8 @@ void populate_dialogue()
dialogue[DIA_INDEX_SEND_FRIEND_HOENN] = "I'm going to send these\nPokemon to my friend LANNETE so\nthat you can pick them up.\nThey 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_INDEX_THANK] = "Thank you so much for your\nhelp! Whenever you want to\ntransfer more Pokemon, just\nlet me know!|See you around!";
dialogue[DIA_INDEX_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-";
dialogue[DIA_PKMN_TO_COLLECT] = "Hi Trainer! It looks like\nyou still have Pok@mon to\npick up...|I can send in new ones, but do know that the Pok@mon you\nhaven't picked up yet will\nbe replaced.|Turn off the system now if\nyou want to recieve those\nmPok@mon, but otherwise-";
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!";
@ -44,9 +47,13 @@ void populate_script()
script[COND_IS_FRLGE] = script_obj(COND_IS_FRLGE, DIA_INDEX_MG_FRLGE, DIA_INDEX_MG_RS);
script[DIA_INDEX_MG_FRLGE] = script_obj(dialogue[DIA_INDEX_MG_FRLGE], CMD_HIDE_PROF);
script[DIA_INDEX_MG_RS] = script_obj(dialogue[DIA_INDEX_MG_RS], CMD_HIDE_PROF);
script[COND_TUTORIAL_COMPLETE] = script_obj(COND_TUTORIAL_COMPLETE, DIA_INDEX_LETS_START, DIA_INDEX_OPEN);
script[COND_TUTORIAL_COMPLETE] = script_obj(COND_TUTORIAL_COMPLETE, COND_MG_OTHER_EVENT, DIA_INDEX_OPEN);
script[DIA_INDEX_OPEN] = script_obj(dialogue[DIA_INDEX_OPEN], CMD_SET_TUTOR_TRUE);
script[CMD_SET_TUTOR_TRUE] = script_obj(CMD_SET_TUTOR_TRUE, CMD_HIDE_PROF);
script[COND_MG_OTHER_EVENT] = script_obj(COND_MG_OTHER_EVENT, DIA_MG_OTHER_EVENT, COND_PKMN_TO_COLLECT);
script[COND_PKMN_TO_COLLECT] = script_obj(COND_PKMN_TO_COLLECT, DIA_PKMN_TO_COLLECT, DIA_INDEX_LETS_START);
script[DIA_MG_OTHER_EVENT] = script_obj(dialogue[DIA_MG_OTHER_EVENT], DIA_INDEX_LETS_START);
script[DIA_PKMN_TO_COLLECT] = script_obj(dialogue[DIA_PKMN_TO_COLLECT], DIA_INDEX_LETS_START);
script[DIA_INDEX_LETS_START] = script_obj(dialogue[DIA_INDEX_LETS_START], DIA_INDEX_START);
script[DIA_INDEX_START] = script_obj(dialogue[DIA_INDEX_START], CMD_START_LINK);
script[CMD_START_LINK] = script_obj(CMD_START_LINK, COND_ERROR_TIMEOUT_ONE);
@ -106,13 +113,12 @@ bool run_conditional(int index)
return party_data.get_last_error() != COND_ERROR_COLOSSEUM;
case COND_BEAT_E4:
return read_flag(0x800 + 0x39);
// Emerald Flag ID 0x860 + 0x1F
return true;
case COND_MG_ENABLED:
// Emerald flag ID (SYSTEM_FLAGS + 0x7B)
return true;
return read_flag(0x800 + 0x39);
// Emerald flag ID (0x860 + 0x7B)
case COND_TUTORIAL_COMPLETE:
return get_tutorial_flag();
@ -126,6 +132,12 @@ bool run_conditional(int index)
case COND_IS_FRLGE:
return !curr_rom.is_ruby_sapphire();
case COND_MG_OTHER_EVENT:
return compare_map_and_npc_data(curr_rom.def_map_bank, curr_rom.def_map_id, curr_rom.def_npc_id);
case COND_PKMN_TO_COLLECT:
return compare_map_and_npc_data(curr_rom.map_bank, curr_rom.map_id, curr_rom.npc_id) && !read_flag(FLAG_ID_START + 0x06);
case CMD_START_LINK:
party_data.start_link();
return true;