mirror of
https://github.com/GearsProgress/Poke_Transporter_GB.git
synced 2026-03-21 17:34:42 -05:00
Finalizing Red/Blue Payload
This commit is contained in:
parent
a27f1c2c37
commit
301ccf602b
3
graphics/button_cancel_left.grit
Normal file
3
graphics/button_cancel_left.grit
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#
|
||||
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
|
||||
-gB4 -ps32 -pe48
|
||||
BIN
graphics/button_cancel_left.png
Normal file
BIN
graphics/button_cancel_left.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 258 B |
3
graphics/button_confirm_left.grit
Normal file
3
graphics/button_confirm_left.grit
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#
|
||||
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
|
||||
-gB4 -ps32 -pe48
|
||||
BIN
graphics/button_confirm_left.png
Normal file
BIN
graphics/button_confirm_left.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 267 B |
|
|
@ -8,6 +8,7 @@
|
|||
#include "pokemon.h"
|
||||
#include "string_view"
|
||||
#include "pokemon_party.h"
|
||||
#include "button_handler.h"
|
||||
|
||||
class Box_Menu
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
class Button
|
||||
{
|
||||
public:
|
||||
Button();
|
||||
Button(OBJ_ATTR *L, OBJ_ATTR *R, int nLeft_button_width); // wide buttons
|
||||
Button(OBJ_ATTR *B); // short button
|
||||
bool isWide;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef DEBUG_MODE_H
|
||||
#define DEBUG_MODE_H
|
||||
|
||||
#define DEBUG_MODE false
|
||||
#define DEBUG_MODE true
|
||||
#define IGNORE_GAME_PAK true
|
||||
#define IGNORE_LINK_CABLE true
|
||||
#define IGNORE_LINK_CABLE false
|
||||
#define IGNORE_MG_E4_FLAGS true
|
||||
|
||||
#define DEBUG_GAME RUBY_ID
|
||||
|
|
|
|||
|
|
@ -32,12 +32,10 @@
|
|||
#define SLOW_SPEED 1000
|
||||
|
||||
void setup();
|
||||
byte handleIncomingByte(byte in, byte *box_data_storage, PAYLOAD *curr_payload);
|
||||
int transferBit(byte *party_data);
|
||||
int loop(byte *box_data_storage, PAYLOAD *curr_payload);
|
||||
std::string outHexStr(vu8 inputNum);
|
||||
void updateFrames();
|
||||
byte handleIncomingByte(byte in, byte *box_data_storage, PAYLOAD *curr_payload, Simplified_Pokemon *curr_simple_array);
|
||||
int loop(byte *box_data_storage, PAYLOAD *curr_payload, Simplified_Pokemon *curr_simple_array);
|
||||
byte exchange_parties(byte curr_in, PAYLOAD *curr_payload);
|
||||
byte exchange_boxes(byte curr_in, byte *party_data);
|
||||
byte exchange_remove_array(byte curr_in, Simplified_Pokemon *curr_simple_array);
|
||||
|
||||
#endif /* GAMEBOY_COLOUR_H_ */
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ const struct PAYLOAD ENG_RED_BLUE = {
|
|||
.language = ENG_ID,
|
||||
.version = RED_BLUE_ID,
|
||||
.payload_array = {
|
||||
|
||||
// RNG Seed
|
||||
0, 0, 0, 0, 0, 0xCD, 0x87, 0xD8, 184, 165,
|
||||
|
||||
|
|
@ -29,21 +30,12 @@ const struct PAYLOAD ENG_RED_BLUE = {
|
|||
// Patchlist (code storage)
|
||||
// Test string: 62, 99, 245, 33, 160, 195, 1, 136, 1, 205, 224, 54, 17, 255, 197, 33, 87, 196, 205, 85, 25, 118, 118, 118, 118, 118, 118, 118, 241, 60, 14, 108, 185, 194, 216, 197, 62, 99, 195, 216, 197, 127, 0x8E, 0x8C, 0x86, 127, 0x92, 0x8E, 0x91, 0x80, 0xE6, 0xE7, 0xE6, 0xE7, 127, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
|
||||
// Write transferring message to screen
|
||||
// call ClearScreen
|
||||
0xCD, 0x0F, 0x19,
|
||||
// hlcoord 2, 7
|
||||
// ld hl, $C42E
|
||||
0x21, 0x2E, 0xC4,
|
||||
// ld b, 3 [height]
|
||||
0x06, 0x03,
|
||||
|
|
@ -51,13 +43,14 @@ const struct PAYLOAD ENG_RED_BLUE = {
|
|||
0x0E, 0x0E,
|
||||
// call CableClub_TextBoxBoarder
|
||||
0xCD, 0xB3, 0x5A,
|
||||
// hlcoord 3, 8
|
||||
// ld hl, $C443
|
||||
0x21, 0x43, 0xC4,
|
||||
// ld de, TransferWaitString
|
||||
0x11, 0x7A, 0xC6,
|
||||
// call PlaceString
|
||||
0xCD, 0x55, 0x19,
|
||||
|
||||
// Transfer box data
|
||||
// ld hl, hSerialConnectionStatus
|
||||
0x21, 0xAA, 0xFF,
|
||||
// ld [hl], 0x01 [Make sure GB is the slave]
|
||||
|
|
@ -70,27 +63,94 @@ const struct PAYLOAD ENG_RED_BLUE = {
|
|||
0x11, 0x7D, 0xDA,
|
||||
// ld bc, (wBoxDataEnd - wBoxDataStart) + 2
|
||||
0x01, 0x64, 0x04,
|
||||
// call Serial_ExchangeBytes
|
||||
// call Serial_ExchangeBytes [Send the box data]
|
||||
0xCD, 0x6F, 0x21,
|
||||
|
||||
// Recieve the Pokemon to remove
|
||||
// ld hl, hSerialConnectionStatus
|
||||
0x21, 0xAA, 0xFF,
|
||||
// ld [hl], 0x01 [Make sure GB is the slave]
|
||||
0x36, 0x01,
|
||||
// ld hl, 0xC613 [data to send, garbage data]
|
||||
0x21, 0x16, 0x03,
|
||||
// ld de, 0xC652 [data to recieve]
|
||||
0x11, 0x52, 0xC6,
|
||||
// ld bc, 0x001E [size of data]
|
||||
0x01, 0x27, 0x00,
|
||||
// call Serial_ExchangeBytes [Recieve the removal array]
|
||||
0xCD, 0x6F, 0x21,
|
||||
//0x00, 0x00, 0x00,
|
||||
|
||||
// Remove the transfered Pokemon
|
||||
// ld hl, wRemoveMonFromBox
|
||||
0x21, 0x95, 0xCF,
|
||||
// ld [hl], [!= 0x00 specifies the current box]
|
||||
0x36, 0x01,
|
||||
// ld a, [arrayCounter]
|
||||
0xFA, 0x51, 0xC6,
|
||||
// ld e, a
|
||||
0x5F,
|
||||
// ld d, 0x00
|
||||
0x16, 0x00,
|
||||
// ld hl, [removalArray]
|
||||
0x21, 0x52, 0xC6,
|
||||
// add hl, de
|
||||
0x19,
|
||||
// inc a
|
||||
0x3C,
|
||||
// ld [arrayCounter], a
|
||||
0xEA, 0x51, 0xC6,
|
||||
// ld a, [wBoxCount]
|
||||
0xFA, 0x80, 0xDA,
|
||||
// ld b, a
|
||||
0x47,
|
||||
// ld a, [hl]
|
||||
0x2A,
|
||||
// cp a, 0xFF
|
||||
0xFE, 0xFF,
|
||||
// jr z, 12
|
||||
0x28, 0x0C,
|
||||
// cp a, b
|
||||
0xB8,
|
||||
// jr nc, -26
|
||||
0x30, 0xE6,
|
||||
// ld hl, wWhichPokemon
|
||||
0x21, 0x92, 0xCF,
|
||||
// ld [hl], a
|
||||
0x77,
|
||||
// call _RemovePokemon
|
||||
0xCD, 0x68, 0x7B,
|
||||
// jr, -35
|
||||
0x18, 0xDD,
|
||||
|
||||
// Save the current box
|
||||
// ld hl, SaveSAVtoSRAM1
|
||||
0x21, 0xE2, 0x77,
|
||||
// ld b, 0x1C [memory bank of SaveSAVtoSRAM1]
|
||||
0x06, 0x1C,
|
||||
// call Bankswitch
|
||||
// call Bankswitch [which will jump to what's loaded in HL]
|
||||
0xCD, 0xD6, 0x35,
|
||||
// jp SoftReset
|
||||
0xC3, 0x49, 0x1F,
|
||||
|
||||
// TransferWaitString 0xC67A
|
||||
// 1 byte to store the current array counter
|
||||
// $C651
|
||||
0x00,
|
||||
|
||||
// 40 byte storage for list of Pokemon to remove
|
||||
// $C652
|
||||
0xFD, 0xFD, 0xFD, 0xFD, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
|
||||
0x13, 0x12, 0x11, 0x10, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A,
|
||||
0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
|
||||
// TransferWaitString
|
||||
// $C67A
|
||||
// TRANSFERRING..\n
|
||||
// PLEASE WAIT!
|
||||
|
||||
0x93, 0x91, 0x80, 0x8D, 0x92, 0x85, 0x84, 0x91, 0x91, 0x88, 0x8D, 0x86, 0xF2, 0xF2, 0x4E,
|
||||
0x7F, 0x8F, 0x8B, 0x84, 0x80, 0x92, 0x84, 0x7F, 0x96, 0x80, 0x88, 0x93, 0xE7, 0x7F, 0x50,
|
||||
|
||||
// 0x00, 0x00 // The last two bites are not used
|
||||
|
||||
// This payload works by placing Pokemon ID 0xFC's name in the stack, and causing a return to CD8E,
|
||||
// which is part of the RNG seed. From there we can jump anywhere- and we choose to jump to D887,
|
||||
// which is the rival's name. This code fixes the stack and jumps to the patchlist, which is where
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ struct Simplified_Pokemon{
|
|||
byte met_level;
|
||||
byte nickname[10];
|
||||
bool is_valid;
|
||||
bool is_transferred;
|
||||
};
|
||||
|
||||
class Pokemon
|
||||
|
|
|
|||
|
|
@ -52,12 +52,10 @@
|
|||
#define CMD_LANG_MENU DIA_END + 9
|
||||
#define CMD_SLIDE_PROF_LEFT DIA_END + 10
|
||||
#define CMD_SLIDE_PROF_RIGHT DIA_END + 11
|
||||
#define CMD_SHOW_LARGE_TEXTBOX DIA_END + 12
|
||||
#define CMD_HIDE_LARGE_TEXTBOX DIA_END + 13
|
||||
#define CMD_CONTINUE_LINK DIA_END + 14
|
||||
#define CMD_BOX_MENU DIA_END + 15
|
||||
#define CMD_CONTINUE_LINK DIA_END + 12
|
||||
#define CMD_BOX_MENU DIA_END + 13
|
||||
|
||||
#define CMD_SIZE 16
|
||||
#define CMD_SIZE 14
|
||||
#define CMDS_END DIA_END + CMD_SIZE
|
||||
|
||||
// Conditionals
|
||||
|
|
|
|||
|
|
@ -83,6 +83,12 @@ extern const unsigned short frame_one_pal[16];
|
|||
extern const unsigned short frame_two_pal[16];
|
||||
#include "box_select.h"
|
||||
extern OBJ_ATTR *box_select;
|
||||
#include "button_cancel_left.h"
|
||||
extern OBJ_ATTR *button_cancel_left;
|
||||
extern OBJ_ATTR *button_cancel_right;
|
||||
#include "button_confirm_left.h"
|
||||
extern OBJ_ATTR *button_confirm_left;
|
||||
extern OBJ_ATTR *button_confirm_right;
|
||||
|
||||
#define BG2VOF_SMALL_TEXTBOX 96
|
||||
#define BG2VOF_LARGE_TEXTBOX 0
|
||||
|
|
|
|||
|
|
@ -8,39 +8,109 @@
|
|||
#include "box_menu.h"
|
||||
#include "pokemon_data.h"
|
||||
|
||||
#define CANCEL_BUTTON 1
|
||||
#define CONFIRM_BUTTON 2
|
||||
|
||||
Box_Menu::Box_Menu(){};
|
||||
|
||||
int Box_Menu::box_main(Pokemon_Party party_data)
|
||||
{
|
||||
REG_BG0CNT = (REG_BG0CNT & ~BG_PRIO_MASK) | BG_PRIO(3);
|
||||
REG_BG2CNT = (REG_BG2CNT & ~BG_PRIO_MASK) | BG_PRIO(2);
|
||||
tte_erase_screen();
|
||||
obj_hide(prof);
|
||||
REG_BG2VOFS = BG2VOF_LARGE_TEXTBOX;
|
||||
REG_BG2VOFS = 0;
|
||||
load_temp_box_sprites(party_data);
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
obj_unhide(party_sprites[i], 0);
|
||||
}
|
||||
Button cancel_button(button_cancel_left, button_cancel_right, 64);
|
||||
Button confirm_button(button_confirm_left, button_confirm_right, 64);
|
||||
cancel_button.set_location(32, 112);
|
||||
confirm_button.set_location(136, 112);
|
||||
cancel_button.show();
|
||||
confirm_button.show();
|
||||
int curr_button = 0;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
bool update_pos = true;
|
||||
obj_unhide(box_select, 0);
|
||||
while (true)
|
||||
{
|
||||
if (key_hit(KEY_LEFT) && (x > 0))
|
||||
if (curr_button == 0)
|
||||
{
|
||||
x--;
|
||||
update_pos = true;
|
||||
if (key_hit(KEY_LEFT) && (x > 0))
|
||||
{
|
||||
x--;
|
||||
update_pos = true;
|
||||
}
|
||||
else if (key_hit(KEY_RIGHT) && (x < 9))
|
||||
{
|
||||
x++;
|
||||
update_pos = true;
|
||||
}
|
||||
else if (key_hit(KEY_UP) && y > 0)
|
||||
{
|
||||
y--;
|
||||
update_pos = true;
|
||||
}
|
||||
else if (key_hit(KEY_DOWN) && (y < 2))
|
||||
{
|
||||
y++;
|
||||
update_pos = true;
|
||||
}
|
||||
else if (key_hit(KEY_DOWN) && (y == 2))
|
||||
{
|
||||
obj_hide(box_select);
|
||||
if (x < 5)
|
||||
{
|
||||
cancel_button.set_highlight(true);
|
||||
curr_button = CANCEL_BUTTON;
|
||||
}
|
||||
else
|
||||
{
|
||||
confirm_button.set_highlight(true);
|
||||
curr_button = CONFIRM_BUTTON;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (key_hit(KEY_RIGHT) && (x < 9))
|
||||
else
|
||||
{
|
||||
x++;
|
||||
update_pos = true;
|
||||
}
|
||||
else if (key_hit(KEY_UP) && y > 0)
|
||||
{
|
||||
y--;
|
||||
update_pos = true;
|
||||
}
|
||||
else if (key_hit(KEY_DOWN) && (y < 2))
|
||||
{
|
||||
y++;
|
||||
update_pos = true;
|
||||
if (key_hit(KEY_LEFT) && (curr_button == CONFIRM_BUTTON))
|
||||
{
|
||||
curr_button = CANCEL_BUTTON;
|
||||
cancel_button.set_highlight(true);
|
||||
confirm_button.set_highlight(false);
|
||||
x -= 5;
|
||||
}
|
||||
else if (key_hit(KEY_RIGHT) && (curr_button == CANCEL_BUTTON))
|
||||
{
|
||||
curr_button = CONFIRM_BUTTON;
|
||||
cancel_button.set_highlight(false);
|
||||
confirm_button.set_highlight(true);
|
||||
x += 5;
|
||||
}
|
||||
else if (key_hit(KEY_UP))
|
||||
{
|
||||
curr_button = 0;
|
||||
cancel_button.set_highlight(false);
|
||||
confirm_button.set_highlight(false);
|
||||
obj_unhide(box_select, 0);
|
||||
update_pos = true;
|
||||
}
|
||||
else if (key_hit(KEY_A))
|
||||
{
|
||||
cancel_button.hide();
|
||||
confirm_button.hide();
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
obj_hide(party_sprites[i]);
|
||||
}
|
||||
tte_erase_screen();
|
||||
obj_unhide(prof, 0);
|
||||
REG_BG2VOFS = BG2VOF_SMALL_TEXTBOX;
|
||||
return curr_button;
|
||||
}
|
||||
}
|
||||
if (update_pos)
|
||||
{
|
||||
|
|
@ -49,14 +119,14 @@ int Box_Menu::box_main(Pokemon_Party party_data)
|
|||
tte_erase_rect(40, 72, 220, 88);
|
||||
if (party_data.get_simple_pkmn(index).is_valid)
|
||||
{
|
||||
char nickname[10] = {'t', 'e', 's', 't', 'i', 'n', 'g'};
|
||||
char nickname[10] = {};
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
nickname[i] = gen_3_Intern_char_array[party_data.get_simple_pkmn(index).nickname[i]];
|
||||
}
|
||||
tte_set_pos(40, 72);
|
||||
tte_write(nickname);
|
||||
tte_set_pos(56, 80);
|
||||
tte_set_pos(48, 80);
|
||||
tte_write(NAMES[party_data.get_simple_pkmn(index).dex_number].data());
|
||||
tte_set_pos(146, 80);
|
||||
tte_write("Lv: ");
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
#include "button_handler.h"
|
||||
|
||||
Button::Button() {}
|
||||
|
||||
Button::Button(OBJ_ATTR *L, OBJ_ATTR *R, int nLeft_button_width)
|
||||
{
|
||||
button_L = L;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,11 @@
|
|||
#define trade_data 7
|
||||
#define box_preamble 8
|
||||
#define box_data 9
|
||||
#define end 10
|
||||
#define end1 10
|
||||
#define reboot 11
|
||||
#define remove_array_preamble 12
|
||||
#define send_remove_array 13
|
||||
#define end2 14
|
||||
|
||||
const int MODE = 1; // mode=0 will transfer pokemon data from pokemon.h
|
||||
// mode=1 will copy pokemon party data being received
|
||||
|
|
@ -104,8 +108,9 @@ void setup()
|
|||
}
|
||||
}
|
||||
|
||||
byte handleIncomingByte(byte in, byte *box_data_storage, PAYLOAD *curr_payload)
|
||||
byte handleIncomingByte(byte in, byte *box_data_storage, PAYLOAD *curr_payload, Simplified_Pokemon *curr_simple_array)
|
||||
{
|
||||
// TODO: Change to a switch statement
|
||||
if (state == hs)
|
||||
{
|
||||
if (in == 0x00)
|
||||
|
|
@ -141,6 +146,7 @@ byte handleIncomingByte(byte in, byte *box_data_storage, PAYLOAD *curr_payload)
|
|||
{
|
||||
if (in == 0xfd)
|
||||
{
|
||||
mosi_delay = 1;
|
||||
state = party_preamble;
|
||||
}
|
||||
return in;
|
||||
|
|
@ -171,7 +177,6 @@ byte handleIncomingByte(byte in, byte *box_data_storage, PAYLOAD *curr_payload)
|
|||
{
|
||||
state = box_data;
|
||||
data_counter = 0;
|
||||
mosi_delay = 1;
|
||||
return exchange_boxes(in, box_data_storage);
|
||||
}
|
||||
return in;
|
||||
|
|
@ -181,15 +186,43 @@ byte handleIncomingByte(byte in, byte *box_data_storage, PAYLOAD *curr_payload)
|
|||
{
|
||||
if (data_counter >= BOX_DATA_ARRAY_SIZE)
|
||||
{
|
||||
state = end;
|
||||
state = end1;
|
||||
}
|
||||
return exchange_boxes(in, box_data_storage);
|
||||
}
|
||||
|
||||
else if (state == reboot)
|
||||
{
|
||||
data_counter = 0;
|
||||
mosi_delay = 16;
|
||||
state = remove_array_preamble;
|
||||
return 0xFD;
|
||||
}
|
||||
|
||||
else if (state == remove_array_preamble)
|
||||
{
|
||||
if (in != 0xFD)
|
||||
{
|
||||
state = send_remove_array;
|
||||
return exchange_remove_array(in, curr_simple_array);
|
||||
}
|
||||
return in;
|
||||
}
|
||||
|
||||
else if (state == send_remove_array)
|
||||
{
|
||||
if (data_counter >= 39)
|
||||
{
|
||||
state = end2;
|
||||
}
|
||||
data_counter++;
|
||||
return exchange_remove_array(in, curr_simple_array);
|
||||
}
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
int loop(byte *box_data_storage, PAYLOAD *curr_payload)
|
||||
int loop(byte *box_data_storage, PAYLOAD *curr_payload, Simplified_Pokemon *curr_simple_array)
|
||||
{
|
||||
int counter = 0;
|
||||
while (true)
|
||||
|
|
@ -206,7 +239,7 @@ int loop(byte *box_data_storage, PAYLOAD *curr_payload)
|
|||
std::to_string(in_data) + "][" +
|
||||
std::to_string(out_data) + "]\n");
|
||||
}
|
||||
out_data = handleIncomingByte(in_data, box_data_storage, curr_payload);
|
||||
out_data = handleIncomingByte(in_data, box_data_storage, curr_payload, curr_simple_array);
|
||||
|
||||
if (FF_count > 25)
|
||||
{
|
||||
|
|
@ -221,12 +254,19 @@ int loop(byte *box_data_storage, PAYLOAD *curr_payload)
|
|||
return COND_ERROR_COLOSSEUM;
|
||||
}
|
||||
|
||||
if (state == end)
|
||||
if (state == end1)
|
||||
{
|
||||
state = reboot;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (state == end2)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (DEBUG_MODE && key_hit(KEY_SELECT)){
|
||||
if (DEBUG_MODE && key_hit(KEY_SELECT))
|
||||
{
|
||||
return COND_ERROR_DISCONNECT;
|
||||
}
|
||||
|
||||
|
|
@ -255,4 +295,17 @@ byte exchange_boxes(byte curr_in, byte *box_data_storage)
|
|||
box_data_storage[data_counter] = curr_in;
|
||||
data_counter += 1;
|
||||
return curr_in;
|
||||
};
|
||||
};
|
||||
|
||||
byte exchange_remove_array(byte curr_in, Simplified_Pokemon *curr_simple_array)
|
||||
{
|
||||
for (int i = 29; i >= 0; i--)
|
||||
{
|
||||
if (curr_simple_array[i].is_valid && !curr_simple_array[i].is_transferred)
|
||||
{
|
||||
curr_simple_array[i].is_transferred = true;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0xFF;
|
||||
}
|
||||
|
|
@ -655,7 +655,6 @@ bool Pokemon::get_is_new()
|
|||
|
||||
Simplified_Pokemon Pokemon::get_simple_pkmn()
|
||||
{
|
||||
//
|
||||
Simplified_Pokemon curr_pkmn;
|
||||
curr_pkmn.dex_number = get_dex_number();
|
||||
curr_pkmn.met_level = met_level;
|
||||
|
|
@ -664,5 +663,6 @@ Simplified_Pokemon Pokemon::get_simple_pkmn()
|
|||
curr_pkmn.nickname[i] = nickname[i];
|
||||
}
|
||||
curr_pkmn.is_valid = get_validity();
|
||||
curr_pkmn.is_transferred = false;
|
||||
return curr_pkmn;
|
||||
}
|
||||
|
|
@ -97,12 +97,12 @@ void Pokemon_Party::start_link()
|
|||
else
|
||||
{
|
||||
setup();
|
||||
last_error = loop(&box_data_array[0], &curr_payload);
|
||||
last_error = loop(&box_data_array[0], &curr_payload, simple_pkmn_array);
|
||||
}
|
||||
}
|
||||
|
||||
void Pokemon_Party::continue_link(){
|
||||
last_error = loop(&box_data_array[0], &curr_payload);
|
||||
last_error = loop(&box_data_array[0], &curr_payload, simple_pkmn_array);
|
||||
}
|
||||
|
||||
int Pokemon_Party::get_last_error()
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ void populate_dialogue()
|
|||
dialogue[DIA_WHAT_GAME] = "And which Game Boy Pok@mon\ngame are you transferring\nfrom?";
|
||||
dialogue[DIA_WHAT_LANG] = "What language is the Game\nBoy Pok@mon game that you're\ntransferring from?";
|
||||
dialogue[DIA_NO_PAYLOAD] = "I'm sorry, but that version\nin that language is not\ncurrently supported.";
|
||||
dialogue[DIA_IN_BOX] = "Great! Let's take a look at\nthe Pok@mon that will be\ntransfered.|Please remember, once a\nPok@mon is transfered, it\nCANNOT be returned to the\nGame Boy Game Pak.|Select transfer once you're\nready, or select cancel if\nyou want to keep the Pok@mon\non your Game Boy Game Pak.";
|
||||
dialogue[DIA_IN_BOX] = "Great! Let's take a look at\nthe Pok@mon that will be\ntransfered.|Please remember, once a\nPok@mon is transfered, it\nCANNOT be returned to the\nGame Boy Game Pak.|Select confirm once you're\nready, or select cancel if\nyou want to keep the Pok@mon\non your Game Boy Game Pak.";
|
||||
|
||||
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!";
|
||||
|
|
@ -98,10 +98,9 @@ void populate_script()
|
|||
script[DIA_ERROR_DISCONNECT] = script_obj(dialogue[DIA_ERROR_DISCONNECT], DIA_START);
|
||||
|
||||
// Pause the transfer and show the user their box data
|
||||
script[DIA_IN_BOX] = script_obj(dialogue[DIA_IN_BOX], CMD_SHOW_LARGE_TEXTBOX);
|
||||
script[CMD_SHOW_LARGE_TEXTBOX] = script_obj(CMD_SHOW_LARGE_TEXTBOX, CMD_BOX_MENU);
|
||||
script[CMD_BOX_MENU] = script_obj(CMD_BOX_MENU, CMD_HIDE_LARGE_TEXTBOX);
|
||||
script[CMD_HIDE_LARGE_TEXTBOX] = script_obj(CMD_HIDE_LARGE_TEXTBOX, DIA_LETS_START);
|
||||
script[DIA_IN_BOX] = script_obj(dialogue[DIA_IN_BOX], CMD_BOX_MENU);
|
||||
script[CMD_BOX_MENU] = script_obj(CMD_BOX_MENU, CMD_CONTINUE_LINK);
|
||||
script[CMD_CONTINUE_LINK] = script_obj(CMD_CONTINUE_LINK, CMD_IMPORT_POKEMON);
|
||||
|
||||
// Complete the transfer and give messages based on the transfered Pokemon
|
||||
script[CMD_IMPORT_POKEMON] = script_obj(CMD_IMPORT_POKEMON, DIA_TRANS_GOOD, DIA_NO_VALID_PKMN);
|
||||
|
|
@ -210,9 +209,6 @@ bool run_conditional(int index)
|
|||
return true;
|
||||
|
||||
case CMD_IMPORT_POKEMON:
|
||||
// party_data.set_lang(ENG_ID);
|
||||
// party_data.set_game(RED_ID);
|
||||
// REMOVE ME ^
|
||||
return inject_mystery(party_data);
|
||||
|
||||
case CMD_BACK_TO_MENU:
|
||||
|
|
@ -268,7 +264,10 @@ bool run_conditional(int index)
|
|||
for (int i = 0; i < 48; i++)
|
||||
{
|
||||
obj_set_pos(prof, (prof->attr1 & ATTR1_X_MASK) - 2, prof->attr0 & ATTR0_Y_MASK);
|
||||
global_next_frame();
|
||||
if (!DEBUG_MODE)
|
||||
{
|
||||
global_next_frame();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
|
|
@ -276,22 +275,13 @@ bool run_conditional(int index)
|
|||
for (int i = 0; i < 48; i++)
|
||||
{
|
||||
obj_set_pos(prof, (prof->attr1 & ATTR1_X_MASK) + 2, prof->attr0 & ATTR0_Y_MASK);
|
||||
global_next_frame();
|
||||
if (!DEBUG_MODE)
|
||||
{
|
||||
global_next_frame();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
case CMD_SHOW_LARGE_TEXTBOX:
|
||||
tte_erase_screen();
|
||||
obj_hide(prof);
|
||||
REG_BG2VOFS = BG2VOF_LARGE_TEXTBOX;
|
||||
return true;
|
||||
|
||||
case CMD_HIDE_LARGE_TEXTBOX:
|
||||
tte_erase_screen();
|
||||
obj_unhide(prof, 0);
|
||||
REG_BG2VOFS = BG2VOF_SMALL_TEXTBOX;
|
||||
return true;
|
||||
|
||||
case CMD_CONTINUE_LINK:
|
||||
party_data.continue_link();
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -132,6 +132,11 @@ OBJ_ATTR *party_sprites[30] = {
|
|||
&obj_buffer[num_sprites++], &obj_buffer[num_sprites++], &obj_buffer[num_sprites++], &obj_buffer[num_sprites++], &obj_buffer[num_sprites++],
|
||||
};
|
||||
|
||||
OBJ_ATTR *button_cancel_left = &obj_buffer[num_sprites++];
|
||||
OBJ_ATTR *button_cancel_right = &obj_buffer[num_sprites++];
|
||||
OBJ_ATTR *button_confirm_left = &obj_buffer[num_sprites++];
|
||||
OBJ_ATTR *button_confirm_right = &obj_buffer[num_sprites++];
|
||||
|
||||
u32 global_tile_id_end = 0;
|
||||
|
||||
void load_eternal_sprites()
|
||||
|
|
@ -199,13 +204,16 @@ void load_temp_box_sprites(Pokemon_Party party_data){
|
|||
u32 curr_tile_id = global_tile_id_end;
|
||||
for (int i = 0; i < 30; i++){
|
||||
if (party_data.get_simple_pkmn(i).is_valid){
|
||||
load_sprite(party_sprites[i], &duel_frame_menu_spritesTiles[(MENU_SPRITES[party_data.get_simple_pkmn(i).dex_number] - 1) * 32], 256, curr_tile_id, MENU_SPRITE_PAL, ATTR0_SQUARE, ATTR1_SIZE_16x16, 2);
|
||||
load_sprite(party_sprites[i], &duel_frame_menu_spritesTiles[(MENU_SPRITES[party_data.get_simple_pkmn(i).dex_number] - 1) * 32], 256, curr_tile_id, MENU_SPRITE_PAL, ATTR0_SQUARE, ATTR1_SIZE_16x16, 1);
|
||||
obj_set_pos(party_sprites[i], (16 * (i % 10)) + 40, (16 * (i / 10)) + 24);
|
||||
obj_unhide(party_sprites[i], 0);
|
||||
}
|
||||
curr_tile_id += 4;
|
||||
}
|
||||
load_sprite(box_select, box_selectTiles, box_selectTilesLen, curr_tile_id, BTN_PAL, ATTR0_SQUARE, ATTR1_SIZE_16x16, 1);
|
||||
load_sprite(box_select, box_selectTiles, box_selectTilesLen, curr_tile_id, BTN_PAL, ATTR0_SQUARE, ATTR1_SIZE_16x16, 0);
|
||||
load_sprite(button_cancel_left, button_cancel_leftTiles, button_cancel_leftTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
|
||||
load_sprite(button_cancel_right, button_game_select_edgeTiles, button_game_select_edgeTilesLen, curr_tile_id, BTN_PAL, ATTR0_TALL, ATTR1_SIZE_8x32, 1);
|
||||
load_sprite(button_confirm_left, button_confirm_leftTiles, button_confirm_leftTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
|
||||
load_sprite(button_confirm_right, button_game_select_edgeTiles, button_game_select_edgeTilesLen, curr_tile_id, BTN_PAL, ATTR0_TALL, ATTR1_SIZE_8x32, 1);
|
||||
}
|
||||
|
||||
void load_sprite(OBJ_ATTR *sprite, const unsigned int objTiles[], int objTilesLen,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user