mirror of
https://github.com/GearsProgress/Poke_Transporter_GB.git
synced 2026-08-25 02:04:26 -05:00
Moving link connection to Pokemon_Party class
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "script_obj.h"
|
||||
#include "gba_flash.h"
|
||||
#include "pokemon.h"
|
||||
#include "pokemon_party.h"
|
||||
|
||||
script_obj::script_obj()
|
||||
{
|
||||
@@ -10,7 +11,6 @@ script_obj::script_obj()
|
||||
next_index = 0;
|
||||
conditional_index = 0;
|
||||
next_false_index = 0;
|
||||
out_code = 0;
|
||||
}
|
||||
|
||||
script_obj::script_obj(std::string nText, int nNext_index)
|
||||
@@ -19,15 +19,26 @@ script_obj::script_obj(std::string nText, int nNext_index)
|
||||
next_index = nNext_index;
|
||||
conditional_index = 0;
|
||||
next_false_index = 0;
|
||||
out_code = 0;
|
||||
}
|
||||
|
||||
script_obj::script_obj(std::string nText, int nNext_index, int nCond_index)
|
||||
{
|
||||
text = nText;
|
||||
next_index = nNext_index;
|
||||
conditional_index = nCond_index;
|
||||
next_false_index = nNext_index;
|
||||
}
|
||||
|
||||
script_obj::script_obj(std::string nText, int nNext_index, int nCond_index, int nFalse_index)
|
||||
{
|
||||
text = nText;
|
||||
next_index = nNext_index;
|
||||
conditional_index = nCond_index;
|
||||
next_false_index = nFalse_index;
|
||||
out_code = 0;
|
||||
}
|
||||
|
||||
void script_obj::link_party_var(Pokemon_Party *var){
|
||||
party_data = var;
|
||||
}
|
||||
|
||||
std::string script_obj::get_text()
|
||||
@@ -50,12 +61,6 @@ int script_obj::get_cond_id()
|
||||
return conditional_index;
|
||||
}
|
||||
|
||||
int script_obj::get_out_code(){
|
||||
int temp = out_code;
|
||||
out_code = 0;
|
||||
return temp;
|
||||
}
|
||||
|
||||
int script_obj::get_next_obj_id()
|
||||
{
|
||||
if (conditional_index == 0)
|
||||
@@ -77,7 +82,7 @@ bool script_obj::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 1:
|
||||
case CHECK_GAME:
|
||||
{
|
||||
u32 game_code = (*(vu32 *)(0x80000AC)) & 0xFFFFFF;
|
||||
return (game_code == 0x565841 || // Ruby
|
||||
@@ -87,9 +92,14 @@ bool script_obj::run_conditional(int index)
|
||||
game_code == 0x455042 // Emerald
|
||||
);
|
||||
}
|
||||
case 2:
|
||||
out_code = 1;
|
||||
case START_LINK:
|
||||
party_data->start_link();
|
||||
return true;
|
||||
|
||||
//case :
|
||||
default:
|
||||
tte_set_pos(0, 0);
|
||||
tte_write("ERROR! No conditional found.");
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user