Updating tons of graphics

This commit is contained in:
The Gears of Progress 2024-08-19 14:47:29 -04:00
parent 22f7aaac26
commit 1ec09842ad
100 changed files with 4667 additions and 1578 deletions

View File

@ -40,14 +40,14 @@ ARCH := -mthumb -mthumb-interwork
CFLAGS := -g -Wall -O2\
-mcpu=arm7tdmi -mtune=arm7tdmi -masm-syntax-unified\
$(ARCH)
$(ARCH)
CFLAGS += $(INCLUDE)
CFLAGS += $(INCLUDE) -ffunction-sections -fdata-sections
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=c++20 -Wno-volatile -D_GLIBCXX_USE_CXX20_ABI=0
ASFLAGS := -g $(ARCH)
LDFLAGS = -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LDFLAGS = -g $(ARCH) -Wl,-Map,$(notdir $*.map) -Wl,--gc-sections
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
@ -85,10 +85,10 @@ SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
ifneq ($(strip $(MUSIC)),)
export AUDIOFILES := $(foreach dir,$(notdir $(wildcard $(MUSIC)/*.*)),$(CURDIR)/$(MUSIC)/$(dir))
BINFILES += soundbank.bin
endif
#ifneq ($(strip $(MUSIC)),)
# export AUDIOFILES := $(foreach dir,$(notdir $(wildcard $(MUSIC)/*.*)),$(CURDIR)/$(MUSIC)/$(dir))
# BINFILES += soundbank.bin
#endif
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
@ -154,9 +154,9 @@ $(OFILES_SOURCES) : $(HFILES)
#---------------------------------------------------------------------------------
# rule to build soundbank from music files
#---------------------------------------------------------------------------------
soundbank.bin soundbank.h : $(AUDIOFILES)
#soundbank.bin soundbank.h : $(AUDIOFILES)
#---------------------------------------------------------------------------------
@mmutil $^ -osoundbank.bin -hsoundbank.h
# @mmutil $^ -osoundbank.bin -hsoundbank.h
#---------------------------------------------------------------------------------
# This rule links in binary data with the .bin extension

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1020 B

After

Width:  |  Height:  |  Size: 1020 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 879 B

After

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 967 B

View File

@ -1,3 +0,0 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48

Binary file not shown.

Before

Width:  |  Height:  |  Size: 962 B

View File

@ -1,3 +0,0 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1011 B

View File

@ -1,3 +0,0 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48

Binary file not shown.

Before

Width:  |  Height:  |  Size: 998 B

View File

@ -1,3 +0,0 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1002 B

View File

@ -1,3 +0,0 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48

Binary file not shown.

Before

Width:  |  Height:  |  Size: 997 B

View File

@ -1,3 +0,0 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1011 B

View File

@ -1,3 +0,0 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1019 B

View File

@ -1,3 +1,3 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48
-gB4

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 277 B

View File

@ -1,3 +1,3 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48
-gB4

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 B

After

Width:  |  Height:  |  Size: 292 B

BIN
graphics/button_edge.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

View File

@ -1,3 +0,0 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48

Binary file not shown.

Before

Width:  |  Height:  |  Size: 898 B

View File

@ -1,3 +1,3 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48
-gB4 -ps0 -pe16

Binary file not shown.

Before

Width:  |  Height:  |  Size: 235 B

After

Width:  |  Height:  |  Size: 254 B

View File

@ -1,3 +1,3 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48
# Button : 4bpp, not compressed.
-gB4 -ps0 -pe16

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 B

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -0,0 +1,5 @@
#
# 64x64t, 4bpp, SBB-layout, not compressed.
# Pallet bank 1
#
-gB4 -ps0 -pe16

BIN
graphics/emerald_cart.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

5
graphics/fr_cart.grit Normal file
View File

@ -0,0 +1,5 @@
#
# 64x64t, 4bpp, SBB-layout, not compressed.
# Pallet bank 1
#
-gB4 -ps0 -pe16

BIN
graphics/fr_cart.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

5
graphics/lg_cart.grit Normal file
View File

@ -0,0 +1,5 @@
#
# 64x64t, 4bpp, SBB-layout, not compressed.
# Pallet bank 1
#
-gB4 -ps0 -pe16

BIN
graphics/lg_cart.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

5
graphics/link_blobs.grit Normal file
View File

@ -0,0 +1,5 @@
#
# 64x64t, 4bpp, SBB-layout, not compressed.
# Pallet bank 1
#
-gB4 -ps0 -pe16

BIN
graphics/link_blobs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

View File

@ -0,0 +1,5 @@
#
# 64x64t, 4bpp, SBB-layout, not compressed.
# Pallet bank 1
#
-gB4 -ps0 -pe16

BIN
graphics/link_frame1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

View File

@ -0,0 +1,5 @@
#
# 64x64t, 4bpp, SBB-layout, not compressed.
# Pallet bank 1
#
-gB4 -ps0 -pe16

BIN
graphics/link_frame2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

View File

@ -0,0 +1,5 @@
#
# 64x64t, 4bpp, SBB-layout, not compressed.
# Pallet bank 1
#
-gB4 -ps0 -pe16

BIN
graphics/link_frame3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

6
graphics/menu_bars.grit Normal file
View File

@ -0,0 +1,6 @@
#
# Text Box (Background) : 64x64t, 4bpp, SBB-layout, not compressed.
# Pallet bank 2, copy from 32 to 48.
#
-gt -gB4 -mR4 -mLs -mp2 -ps0 -pe16

BIN
graphics/menu_bars.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

5
graphics/ruby_cart.grit Normal file
View File

@ -0,0 +1,5 @@
#
# 64x64t, 4bpp, SBB-layout, not compressed.
# Pallet bank 1
#
-gB4 -ps0 -pe16

BIN
graphics/ruby_cart.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

View File

@ -0,0 +1,5 @@
#
# 64x64t, 4bpp, SBB-layout, not compressed.
# Pallet bank 1
#
-gB4 -ps0 -pe16

BIN
graphics/sapphire_cart.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -1,14 +0,0 @@
//{{BLOCK(pkmn_font)
#ifndef __PKMN_FONT__
#define __PKMN_FONT__
extern const TFont pkmn_fontFont;
#define pkmn_fontGlyphsLen 2048
extern const unsigned int pkmn_fontGlyphs[512];
#endif // __PKMN_FONT__
//}}BLOCK(pkmn_font)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 784 B

After

Width:  |  Height:  |  Size: 796 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

View File

@ -2,17 +2,17 @@
#define DEBUG_MODE_H
#define DEBUG_MODE false
#define IGNORE_GAME_PAK false
#define IGNORE_LINK_CABLE true
#define IGNORE_MG_E4_FLAGS false
#define IGNORE_UNRECEIVED_PKMN false
#define IGNORE_GAME_PAK true
#define IGNORE_LINK_CABLE false
#define IGNORE_MG_E4_FLAGS true
#define IGNORE_UNRECEIVED_PKMN true
#define FORCE_TUTORIAL false
#define DONT_REMOVE_PKMN false
#define DONT_REMOVE_PKMN true
#define SHOW_INVALID_PKMN false
#define IGNORE_DEX_COMPLETION false
#define DEBUG_GAME FIRERED_ID
#define DEBUG_VERS VERS_1_1
#define DEBUG_GAME LEAFGREEN_ID
#define DEBUG_VERS VERS_1_0
#define DEBUG_LANG LANG_ENG
#define ENABLE_MATCH_PID true

View File

@ -1,8 +1,15 @@
#ifndef GLOBAL_FRAME_CONTROLLER_H
#define GLOBAL_FRAME_CONTROLLER_H
#define STATE_CONNECTION 1
#define STATE_TRANSFER 2
#define STATE_NO_ANIM 3
void global_next_frame();
int get_frame_count();
void set_menu_sprite_pal(int frame);
void run_link_cable_animation(int frame);
void link_animation_state(int state);
void determine_fennel_blink();
#endif

View File

@ -266,7 +266,7 @@ class mystery_gift_script
public:
mystery_gift_script();
void build_script(Pokemon_Party &incoming_box_data);
void build_script_old(Pokemon_Party &incoming_box_data);
//void build_script_old(Pokemon_Party &incoming_box_data);
u8 get_script_value_at(int index);
u8 get_section30_value_at(int index);
u32 calc_checksum32();

View File

@ -21,6 +21,8 @@ struct Simplified_Pokemon
byte nickname[10];
bool is_valid;
bool is_transferred;
bool is_shiny;
int unown_letter;
};
class Pokemon
@ -31,7 +33,7 @@ public:
int ot_size = 0;
int nickname_size = 0;
int nature_mod = 0;
byte unown_letter = -1;
int unown_letter = -1;
Pokemon();
void load_data(int index, byte *party_data, int game, int lang);
void convert_to_gen_three(bool simplified, bool stabilize_mythical);
@ -49,6 +51,7 @@ public:
byte get_dex_number();
bool get_validity();
bool get_is_new();
bool get_is_shiny();
Simplified_Pokemon get_simple_pkmn();
u8 get_letter_from_pid(u32 pid);
u8 get_nature_from_pid(u32 pid);

View File

@ -49,7 +49,7 @@ extern const std::string_view NAMES[252];
extern const u16 JPN_NAMES[252][6];
extern const u8 EVOLUTIONS[252];
extern const u8 POWER_POINTS[252];
extern const u8 MENU_SPRITES[252];
extern const u8 MENU_SPRITE_PALS[252 + 26][2];
extern const byte gen_1_index_array[191];
extern const u16 gen_1_Jpn_char_array[256];
extern const u16 gen_1_Eng_char_array[256];

View File

@ -48,12 +48,12 @@ class textbox_var : public xse_var
{
public:
using xse_var::xse_var;
void set_text(std::u16string_view nText);
void set_text(std::u8string_view nText);
void insert_text(u8 mg_array[]);
void set_start();
void insert_virtual_text(u8 mg_array[]);
void set_virtual_start();
std::u16string_view text;
std::u8string_view text;
};
class movement_var : public xse_var

View File

@ -5,34 +5,19 @@
#include "pokemon.h"
#include "pokemon_data.h"
#include "pokemon_party.h"
#include "rom_data.h"
#define FENNEL_SHIFT 4
extern OBJ_ATTR obj_buffer[128];
extern OBJ_AFFINE *obj_aff_buffer;
extern int num_sprites;
// #include "metr.h"
// extern OBJ_ATTR *testroid;
#include "btn_t_l.h"
extern OBJ_ATTR *btn_t_l;
#include "btn_t_r.h"
extern OBJ_ATTR *btn_t_r;
#include "btn_p_l.h"
extern OBJ_ATTR *btn_p_l;
#include "btn_p_r.h"
extern OBJ_ATTR *btn_p_r;
#include "btn_c_l.h"
extern OBJ_ATTR *btn_c_l;
#include "btn_c_r.h"
extern OBJ_ATTR *btn_c_r;
#include "btn_d_l.h"
extern OBJ_ATTR *btn_d_l;
#include "btn_d_r.h"
extern OBJ_ATTR *btn_d_r;
#include "button_yes.h"
extern OBJ_ATTR *button_yes;
#include "button_no.h"
extern OBJ_ATTR *button_no;
#include "button_game_select_edge.h"
#include "button_edge.h"
#include "types.h"
extern OBJ_ATTR *type_sprites[14];
@ -64,7 +49,7 @@ extern OBJ_ATTR *up_arrow;
extern OBJ_ATTR *down_arrow;
extern OBJ_ATTR *point_arrow;
#include "duel_frame_menu_sprites.h"
#include "unique_duel_frame_menu_sprites.h"
extern OBJ_ATTR *party_sprites[30];
#include "box_select.h"
extern OBJ_ATTR *box_select;
@ -80,28 +65,54 @@ extern OBJ_ATTR *ptgb_logo_l;
#include "ptgb_logo_r.h"
extern OBJ_ATTR *ptgb_logo_r;
#include "ruby_cart.h"
#include "sapphire_cart.h"
#include "fr_cart.h"
#include "lg_cart.h"
#include "emerald_cart.h"
extern OBJ_ATTR *gba_cart;
#include "link_frame1.h"
extern OBJ_ATTR *link_frame1;
#include "link_frame2.h"
extern OBJ_ATTR *link_frame2;
#include "link_frame3.h"
extern OBJ_ATTR *link_frame3;
#include "link_blobs.h"
extern OBJ_ATTR *link_blob1;
extern OBJ_ATTR *link_blob2;
extern OBJ_ATTR *link_blob3;
#define BG2VOF_SMALL_TEXTBOX 96
#define BG2VOF_LARGE_TEXTBOX 0
#define METR_PAL 0
#define PROF_PAL 1
#define BTN_PAL 2
#define BTN_LIT_PAL 3
#define MENU_SPRITE_PAL 4
#define LOGO_PAL 5
#define TYPES_PAL1 6
#define TYPES_PAL2 7
#define CART_PAL 8
#define FLAG_PAL 9
#define BTN_PAL 0
#define BTN_LIT_PAL 1
#define LOGO_PAL 2
#define TYPES_PAL1 3
#define TYPES_PAL2 4
#define GB_CART_PAL 5
#define FLAG_PAL 6
#define MENU_PAL_RED 7
#define MENU_PAL_BLU 8
#define MENU_PAL_GRN 9
#define MENU_PAL_BRN 10
#define MENU_PAL_PNK 11
#define MENU_PAL_START MENU_PAL_RED
#define GBA_CART_PAL 12
#define LINK_CABLE_PAL 13
#define BG_OPENING 0
#define BG_FENNEL 1
#define BG_DEX 2
#define BG_MAIN_MENU 3
extern rom_data curr_rom;
void load_sprite(OBJ_ATTR *sprite, const unsigned int objTiles[], int objTilesLen,
u32 &tile_id, u32 pal_bank, int attr0, int attr1, u32 priority);
void load_background();
void modify_background_pal(bool dark);
void set_background_pal(int curr_rom_id, bool dark);
void load_textbox_background();
void load_flex_background(int background_id, int layer);
void load_eternal_sprites();
@ -109,7 +120,9 @@ void load_temp_box_sprites(Pokemon_Party party_data);
void load_type_sprites(int pkmn_index, int dex_offset, bool is_caught);
void add_menu_box(int options);
void reload_textbox_background();
void load_cart(int game_id, int lang);
void load_flag(int lang_id);
void load_select_sprites(int game_id, int lang);
void fennel_blink(int frame);
void fennel_speak(int frame);
int get_curr_flex_background();
void update_y_offset();
#endif

View File

@ -1,5 +1,5 @@
#include <tonc.h>
#include "main_menu.h"
#include "button_menu.h"
#include "button_handler.h"
#include "save_data_manager.h"
#include "global_frame_controller.h"
@ -8,7 +8,7 @@
#include "box_menu.h"
#include "pokemon_data.h"
Box_Menu::Box_Menu(){};
Box_Menu::Box_Menu() {};
int Box_Menu::box_main(Pokemon_Party party_data)
{
@ -17,10 +17,6 @@ int Box_Menu::box_main(Pokemon_Party party_data)
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);
@ -115,20 +111,26 @@ int Box_Menu::box_main(Pokemon_Party party_data)
int index = x + (y * 10);
obj_set_pos(box_select, 40 + (x * 16), 24 + (y * 16));
tte_erase_rect(40, 72, 220, 88);
if (party_data.get_simple_pkmn(index).is_valid)
Simplified_Pokemon curr_pkmn = party_data.get_simple_pkmn(index);
if (curr_pkmn.is_valid)
{
char nickname[10] = {};
char nickname[11] = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '\0'};
for (int i = 0; i < 10; i++)
{
nickname[i] = gen_3_Intern_char_array[party_data.get_simple_pkmn(index).nickname[i]];
nickname[i] = gen_3_Intern_char_array[curr_pkmn.nickname[i]];
}
tte_set_pos(40, 72);
tte_write(nickname);
if (curr_pkmn.is_shiny)
{
tte_set_pos(40, 80);
tte_write("*");
}
tte_set_pos(48, 80);
tte_write(NAMES[party_data.get_simple_pkmn(index).dex_number].data());
tte_write(NAMES[curr_pkmn.dex_number].data());
tte_set_pos(146, 80);
tte_write("Lv: ");
tte_write(std::to_string(party_data.get_simple_pkmn(index).met_level).c_str());
tte_write(std::to_string(curr_pkmn.met_level).c_str());
update_pos = false;
}
}

View File

@ -1,4 +1,5 @@
#include "button_handler.h"
#include "sprite_data.h"
Button::Button(){
@ -33,12 +34,12 @@ void Button::set_location(int nx, int ny)
void Button::set_highlight(bool highlight)
{
button_L->attr2 &= ~ATTR2_PALBANK_MASK;
button_L->attr2 |= ATTR2_PALBANK(highlight ? 3 : 2);
button_L->attr2 |= ATTR2_PALBANK(highlight ? BTN_LIT_PAL : BTN_PAL);
if (isWide)
{
button_R->attr2 &= ~ATTR2_PALBANK_MASK;
button_R->attr2 |= ATTR2_PALBANK(highlight ? 3 : 2);
button_R->attr2 |= ATTR2_PALBANK(highlight ? BTN_LIT_PAL : BTN_PAL);
}
}
void Button::hide()

View File

@ -1,5 +1,5 @@
#include <tonc.h>
#include "main_menu.h"
#include "button_menu.h"
#include "button_handler.h"
#include "save_data_manager.h"
#include "global_frame_controller.h"

View File

@ -60,22 +60,22 @@ int zero_count;
int state;
int mosi_delay = 4; // inital delay, speeds up once sending PKMN
std::string out_array[10];
std::string spi_text_out_array[10];
void print(std::string str)
{
for (int i = 10; i > 0; i--)
{
out_array[i] = out_array[i - 1];
spi_text_out_array[i] = spi_text_out_array[i - 1];
}
out_array[0] = str + "\n";
spi_text_out_array[0] = str + "\n";
tte_erase_rect(LEFT, TOP, RIGHT, BOTTOM);
tte_set_pos(LEFT, 0);
for (int j = 0; j < 10; j++)
{
tte_write("#{cx:0xE000}");
tte_write(out_array[j].c_str());
tte_write(spi_text_out_array[j].c_str());
}
}
@ -167,6 +167,7 @@ byte handleIncomingByte(byte in, byte *box_data_storage, byte *curr_payload, GB_
tte_erase_screen();
tte_set_pos(40, 24);
tte_write("\n\n\nLink was successful!\n\n Waiting for trade");
link_animation_state(STATE_NO_ANIM);
state = pretrade;
data_counter = 0;
return in;
@ -200,6 +201,7 @@ byte handleIncomingByte(byte in, byte *box_data_storage, byte *curr_payload, GB_
tte_erase_screen();
tte_set_pos(40, 24);
tte_write("\n\n\nTransferring data...\n please wait!");
link_animation_state(STATE_TRANSFER);
mosi_delay = 1;
state = party_preamble;
}
@ -229,6 +231,7 @@ byte handleIncomingByte(byte in, byte *box_data_storage, byte *curr_payload, GB_
tte_erase_screen();
tte_set_pos(40, 24);
tte_write("\n\nPlease press A or B\n twice on the other\n GameBoy system");
link_animation_state(STATE_NO_ANIM);
mosi_delay = 3;
state = wait_to_resend;
}
@ -267,6 +270,7 @@ byte handleIncomingByte(byte in, byte *box_data_storage, byte *curr_payload, GB_
tte_erase_screen();
tte_set_pos(40, 24);
tte_write("\n\n\nTransferring data...\n please wait!");
link_animation_state(STATE_TRANSFER);
state = resend_payload;
data_counter = 0x1B4;
}
@ -334,13 +338,13 @@ int loop(byte *box_data_storage, byte *curr_payload, GB_ROM *curr_gb_rom, Simpli
}
out_data = handleIncomingByte(in_data, box_data_storage, curr_payload, curr_gb_rom, curr_simple_array, cancel_connection);
if (FF_count > (5 * 60))
if (FF_count > (15 * 60))
{
return COND_ERROR_DISCONNECT;
}
if (zero_count > (5 * 60))
{
//return COND_ERROR_COM_ENDED;
// return COND_ERROR_COM_ENDED;
}
if (connection_state == COLOSSEUM)
{

View File

@ -9,6 +9,10 @@
int global_frame_count = 0;
bool rand_enabled = true;
int cable_frame = 0;
int curr_link_animation_state = 0;
int fennel_blink_timer = 0;
int fennel_blink_state = 0;
void global_next_frame()
{
@ -17,11 +21,14 @@ void global_next_frame()
// tte_set_pos(0, 0);
// tte_write(std::to_string(get_rand_u32()).c_str());
background_frame(global_frame_count);
determine_fennel_blink();
update_y_offset();
oam_copy(oam_mem, obj_buffer, num_sprites);
VBlankIntrWait();
// mmFrame(); //Music
if (global_frame_count % 60 == 0)
{
set_menu_sprite_pal(0);
if (!curr_rom.verify_rom())
{
REG_BG0CNT = (REG_BG0CNT & ~BG_PRIO_MASK) | BG_PRIO(3);
@ -32,12 +39,26 @@ void global_next_frame()
tte_set_margins(40, 24, 206, 104);
set_textbox_large();
tte_write("\n\n#{cx:0xF000}The Pok@mon game was\nremoved. Please turn\noff the system and\nrestart the program.");
//obj_hide_multi(testroid, 128);
// obj_hide_multi(testroid, 128);
oam_copy(oam_mem, obj_buffer, num_sprites);
while(true){};
while (true)
{
};
}
}
else if (global_frame_count % 60 == 30)
{
set_menu_sprite_pal(1);
}
if (global_frame_count % (40 / curr_link_animation_state) == 0)
{
cable_frame = (cable_frame + 1) % 12;
if (curr_link_animation_state > 0)
{
run_link_cable_animation(cable_frame);
}
}
global_frame_count++;
};
@ -54,4 +75,149 @@ void enable_auto_random()
void disable_auto_random()
{
rand_enabled = false;
}
const unsigned short MENU_PALS[5][4] = {
{RGB15(31, 31, 31), RGB15(31, 19, 10), RGB15(31, 7, 01), RGB15(00, 00, 00)}, // Red
{RGB15(31, 31, 31), RGB15(31, 19, 10), RGB15(10, 9, 31), RGB15(00, 00, 00)}, // Blue
{RGB15(31, 31, 31), RGB15(31, 19, 10), RGB15(07, 23, 03), RGB15(00, 00, 00)}, // Green
{RGB15(31, 31, 31), RGB15(31, 19, 10), RGB15(15, 10, 03), RGB15(00, 00, 00)}, // Brown
{RGB15(31, 31, 31), RGB15(31, 19, 10), RGB15(29, 5, 13), RGB15(00, 00, 00)}, // Pink
};
void set_menu_sprite_pal(int frame)
{
for (int i = 0; i < 5; i++)
{
unsigned short curr_pal[16] = {
// frame: 1 | 2
MENU_PALS[i][(!frame ? 0 : 0)],
MENU_PALS[i][(!frame ? 0 : 1)],
MENU_PALS[i][(!frame ? 0 : 2)],
MENU_PALS[i][(!frame ? 0 : 3)],
MENU_PALS[i][(!frame ? 1 : 0)],
MENU_PALS[i][(!frame ? 1 : 1)],
MENU_PALS[i][(!frame ? 1 : 2)],
MENU_PALS[i][(!frame ? 1 : 3)],
MENU_PALS[i][(!frame ? 2 : 0)],
MENU_PALS[i][(!frame ? 2 : 1)],
MENU_PALS[i][(!frame ? 2 : 2)],
MENU_PALS[i][(!frame ? 2 : 3)],
MENU_PALS[i][(!frame ? 3 : 0)],
MENU_PALS[i][(!frame ? 3 : 1)],
MENU_PALS[i][(!frame ? 3 : 2)],
MENU_PALS[i][(!frame ? 3 : 3)],
};
memcpy(pal_obj_mem + ((MENU_PAL_START + i) * 16), curr_pal, 32);
}
}
int path[12][2] = {{19, 18}, {19, 19}, {18, 19}, {17, 19}, {16, 19}, {15, 19}, {14, 19}, {13, 19}, {12, 19}, {11, 19}, {10, 19}, {24, 24}};
void run_link_cable_animation(int frame)
{
switch (curr_link_animation_state)
{
case STATE_CONNECTION:
frame %= 4;
obj_hide_multi(link_frame1, 4);
obj_unhide_multi(link_frame1, 0, frame);
break;
case STATE_TRANSFER:
obj_set_pos(link_blob1, path[frame][0] * 8, path[frame][1] * 8);
obj_set_pos(link_blob2, path[frame][0] * 8, path[frame][1] * 8);
obj_set_pos(link_blob3, path[frame][0] * 8, path[frame][1] * 8);
obj_hide_multi(link_blob1, 3);
switch (frame % 3)
{
case 0:
obj_unhide(link_blob1, 0);
break;
case 1:
obj_unhide(link_blob2, 0);
break;
case 2:
obj_unhide(link_blob3, 0);
break;
}
break;
}
}
void link_animation_state(int state)
{
cable_frame = 0;
switch (state)
{
case STATE_CONNECTION:
obj_unhide(gba_cart, 0);
obj_set_pos(gba_cart, 17 * 8, 14 * 8);
obj_unhide(cart_shell, 0);
obj_set_pos(cart_shell, (8 * 8), (11 * 8) + 11);
obj_unhide(cart_label, 0);
obj_set_pos(cart_label, (8 * 8) + 8, (11 * 8) + 11 + 13);
obj_set_pos(link_frame1, 17 * 8, 17 * 8);
obj_set_pos(link_frame2, 13 * 8, 19 * 8);
obj_set_pos(link_frame3, 9 * 8, 18 * 8);
break;
case STATE_TRANSFER:
obj_unhide_multi(link_blob1, 0, 3);
case STATE_NO_ANIM:
obj_unhide(gba_cart, 0);
obj_set_pos(gba_cart, 17 * 8, 14 * 8);
obj_unhide(cart_shell, 0);
obj_set_pos(cart_shell, (8 * 8), (11 * 8) + 11);
obj_unhide(cart_label, 0);
obj_set_pos(cart_label, (8 * 8) + 8, (11 * 8) + 11 + 13);
obj_unhide(link_frame1, 0);
obj_set_pos(link_frame1, 17 * 8, 17 * 8);
obj_unhide(link_frame2, 0);
obj_set_pos(link_frame2, 13 * 8, 19 * 8);
obj_unhide(link_frame3, 0);
obj_set_pos(link_frame3, 9 * 8, 18 * 8);
break;
default:
obj_hide_multi(link_frame1, 3);
obj_hide_multi(link_blob1, 3);
obj_hide(gba_cart);
obj_hide(cart_shell);
obj_hide(cart_label);
break;
}
curr_link_animation_state = state;
}
void determine_fennel_blink()
{
if (get_curr_flex_background() == BG_FENNEL)
{
if (fennel_blink_timer == 0)
{
fennel_blink(fennel_blink_state);
fennel_blink_state = (fennel_blink_state + 1) % 4;
if (fennel_blink_state == 3) // Wait a random amount of time
{
fennel_blink_timer = get_rand_range(4 * 60, 8 * 60);
}
else // Continue with the animation
{
fennel_blink_timer = 4;
}
}
else
{
fennel_blink_timer--;
}
}
else
{
fennel_blink_timer = get_rand_range(4 * 60, 8 * 60);
}
}

View File

@ -15,10 +15,10 @@
#include "script_array.h"
#include "sprite_data.h"
#include "button_handler.h"
#include "main_menu.h"
#include "button_menu.h"
#include "debug_mode.h"
#include "soundbank.h"
#include "soundbank_bin.h"
// #include "soundbank.h"
// #include "soundbank_bin.h"
#include "dex_handler.h"
#include "pokedex.h"
#include "global_frame_controller.h"
@ -46,9 +46,9 @@ TODO:
*/
int delay_counter = 0;
int curr_selection = 0;
bool skip = true;
rom_data curr_rom;
Button_Menu main_menu(2, 2, 96, 32, false);
Button_Menu yes_no_menu(1, 2, 40, 24, false);
/*
@ -81,6 +81,9 @@ int test_main(void) Music
}
*/
// (R + G*32 + B*1024)
#define RGB(r, g, b) (r + (g * 32) + (b * 1024))
template <typename I>
std::string n2hexstr(I w, size_t hex_len = sizeof(I) << 1)
{
@ -100,14 +103,6 @@ void load_graphics()
load_textbox_background();
load_eternal_sprites();
// Set up main menu
main_menu.clear_vector();
main_menu.add_button(Button(btn_t_l, btn_t_r, 48), BTN_TRANSFER);
main_menu.add_button(Button(btn_p_l, btn_p_r, 48), BTN_POKEDEX);
// main_menu.add_button(Button(btn_d_l, btn_d_r, 48), BTN_EVENTS);
main_menu.add_button(Button(btn_c_l, btn_c_r, 48), BTN_CREDITS);
main_menu.set_xy_min_max(0, H_MAX, 48, V_MAX);
// Set up global yes no button
yes_no_menu.clear_vector();
yes_no_menu.add_button(Button(button_yes), true);
@ -143,7 +138,7 @@ void initalization_script(void)
// Set the random seed
rand_set_seed(0x1216);
VBlankIntrWait();
REG_DISPCNT &= ~DCNT_BLANK;
};
@ -177,7 +172,7 @@ void first_load_message(void)
{
tte_set_pos(8, 0);
tte_set_ink(10);
tte_write("#{cx:0xE000}\n\nHello! Thank you for using\nPok@ Transporter GB!\n\nJust as a word of caution- \nPok@ Transporter GB WILL\nmodify both the GameBoy and GameBoy Advance save files.\n\nPlease note that Pok@\nTransporter GB is still in\nbeta, so save file backups\nare HIGHLY recommended\nbefore using. With that all\nbeing said, please enjoy!\n\n -The Gears of Progress");
tte_write("#{cx:0xD000}\n\nHello! Thank you for using\nPok@ Transporter GB!\n\nJust as a word of caution- \nPok@ Transporter GB WILL\nmodify both the GameBoy and GameBoy Advance save files.\n\nPlease note that Pok@\nTransporter GB is still in\nbeta, so save file backups\nare HIGHLY recommended\nbefore using. With that all\nbeing said, please enjoy!\n\n -The Gears of Progress");
while (!key_hit(KEY_A))
{
global_next_frame();
@ -291,6 +286,57 @@ int credits()
}
};
#define NUM_MENU_OPTIONS 3
int main_menu_loop()
{
bool update = true;
std::string_view menu_options[NUM_MENU_OPTIONS] = {"Transfer Pok@mon", "Dream Dex", "Credits"};
int return_values[NUM_MENU_OPTIONS] = {BTN_TRANSFER, BTN_POKEDEX, BTN_CREDITS};
while (true)
{
if (update)
{
for (int i = 0; i < NUM_MENU_OPTIONS; i++)
{
int x = (6 + ((18 - menu_options[i].length()) / 2)) * 8;
tte_set_pos(x, ((i * 2) + 10) * 8);
if (i == curr_selection)
{
tte_write("#{cx:0xD000}");
}
else
{
tte_write("#{cx:0xE000}");
}
tte_write(menu_options[i].data());
}
}
update = true;
if (key_hit(KEY_DOWN))
{
curr_selection = ((curr_selection + 1) % NUM_MENU_OPTIONS);
}
else if (key_hit(KEY_UP))
{
curr_selection = ((curr_selection + (NUM_MENU_OPTIONS - 1)) % NUM_MENU_OPTIONS);
}
else if (key_hit(KEY_A))
{
tte_erase_rect(0, 0, H_MAX, V_MAX);
tte_write("#{cx:0xF000}");
return return_values[curr_selection];
}
else
{
update = false;
}
global_next_frame();
}
}
int main(void)
{
initalization_script();
@ -313,17 +359,21 @@ int main(void)
initalize_save_data();
}
// Set colors based on current ROM
set_background_pal(curr_rom.gamecode, false);
pal_bg_bank[14][15] = pal_bg_mem[3];
// Legal mumbo jumbo
tte_set_pos(8, 0);
tte_write("#{cx:0xE000}\n\nPok@ Transporter GB was made\nout of love and appreciation\nfor the Pokemon franchise\nwith no profit in mind.\nIt will ALWAYS be free.\n\nPlease support the original developers-\nNintendo and GAME FREAK.\n\nAll Pokemon names, sprites, and music are owned by \nNintendo, Creatures Inc, and\nGAME FREAK Inc.");
tte_write("#{cx:0xE000}\n\nPok@ Transporter GB was made\nout of love and appreciation\nfor the Pokemon franchise\nwith no profit in mind.\nIt will ALWAYS be free.\n\nPlease support the original developers-\nNintendo and GAME FREAK.\n\nAll Pokemon names, sprites, and music are owned by \nNintendo, Creatures Inc, and\nGAME FREAK Inc.\n\n\n Press A to continue");
tte_write("#{cx:0xF000}"); // Set the color to grey
while (delay_counter < (15 * 60))
bool wait = true;
while (wait)
{
global_next_frame();
delay_counter++;
if (key_hit(KEY_A))
{
delay_counter = (15 * 60);
wait = false;
}
}
@ -355,7 +405,8 @@ int main(void)
obj_set_pos(ptgb_logo_l, 56, 12);
obj_set_pos(ptgb_logo_r, 56 + 64, 12);
obj_unhide_multi(ptgb_logo_l, 1, 2);
switch (main_menu.button_main())
load_flex_background(BG_MAIN_MENU, 2);
switch (main_menu_loop())
{
case (BTN_TRANSFER):
obj_hide_multi(ptgb_logo_l, 2);
@ -366,11 +417,11 @@ int main(void)
if (IGNORE_MG_E4_FLAGS || read_flag(curr_rom.e4_flag))
{
load_flex_background(BG_DEX, 2);
modify_background_pal(true);
set_background_pal(curr_rom.gamecode, true);
obj_hide_multi(ptgb_logo_l, 2);
pokedex_loop();
load_flex_background(BG_DEX, 3);
modify_background_pal(false);
set_background_pal(curr_rom.gamecode, false);
}
break;
case (BTN_CREDITS):

View File

@ -133,7 +133,7 @@ void mystery_gift_script::build_script(Pokemon_Party &incoming_box_data)
{
if (is_caught(i))
{
// first_time = false;
first_time = false;
break;
}
}
@ -152,35 +152,35 @@ void mystery_gift_script::build_script(Pokemon_Party &incoming_box_data)
switch (curr_rom.gamecode)
{
case RUBY_ID:
textGreet.set_text(u"When I was young, I traveled the worldŇas a POKéMON TRAINER.");
textMoveBox.set_text(u"ȆÀËOh, of course, I have to unlockŇthe door. Silly me!");
textWeHere.set_text(u"ȆÀËLOOKER: I am here in Hoenn to findŇthe leader MAXIE.ȼHowever, in the meantime, I amŇhelping my friend Professor FENNEL.ȼThis is why you are here, no?ȼI shall contact her and tell herŇyou are ready.ŞCome! Allons y!");
textGreet.set_text(u8"When I was young, I traveled the worldŇas a POKéMON TRAINER.");
textMoveBox.set_text(u8"ȆÀËOh, of course, I have to unlockŇthe door. Silly me!");
textWeHere.set_text(u8"ȆÀËLOOKER: I am here in Hoenn to findŇthe leader MAXIE.ȼHowever, in the meantime, I amŇhelping my friend Professor FENNEL.ȼThis is why you are here, no?ȼI shall contact her and tell herŇyou are ready.ŞCome! Allons y!");
break;
case SAPPHIRE_ID:
textGreet.set_text(u"When I was young, I traveled the worldŇas a POKéMON TRAINER.");
textMoveBox.set_text(u"ȆÀËOh, of course, I have to unlockŇthe door. Silly me!");
textWeHere.set_text(u"ȆÀËLOOKER: I am here in Hoenn to findŇthe leader ARCHIE.ȼHowever, in the meantime, I amŇhelping my friend Professor FENNEL.ȼThis is why you are here, no?ȼI shall contact her and tell herŇyou are ready.ŞCome! Allons y!");
textGreet.set_text(u8"When I was young, I traveled the worldŇas a POKéMON TRAINER.");
textMoveBox.set_text(u8"ȆÀËOh, of course, I have to unlockŇthe door. Silly me!");
textWeHere.set_text(u8"ȆÀËLOOKER: I am here in Hoenn to findŇthe leader ARCHIE.ȼHowever, in the meantime, I amŇhelping my friend Professor FENNEL.ȼThis is why you are here, no?ȼI shall contact her and tell herŇyou are ready.ŞCome! Allons y!");
break;
case FIRERED_ID:
case LEAFGREEN_ID:
textGreet.set_text(u"I may not look like much now,Ňbut when I was younger…");
textMoveBox.set_text(u"ȆÀËOh, of course, I have to moveŇthe boxes. Silly me!");
textWeHere.set_text(u"ȆÀËLOOKER: I am here in the Sevii IslandsŇto find the leader GIOVANNI.ȼHowever, in the meantime, I amŇhelping my friend Professor FENNEL.ȼThis is why you are here, no?ȼI shall contact her and tell herŇyou are ready.ŞCome! Allons y!");
textGreet.set_text(u8"I may not look like much now,Ňbut when I was younger…");
textMoveBox.set_text(u8"ȆÀËOh, of course, I have to moveŇthe boxes. Silly me!");
textWeHere.set_text(u8"ȆÀËLOOKER: I am here in the Sevii IslandsŇto find the leader GIOVANNI.ȼHowever, in the meantime, I amŇhelping my friend Professor FENNEL.ȼThis is why you are here, no?ȼI shall contact her and tell herŇyou are ready.ŞCome! Allons y!");
break;
case EMERALD_ID:
textGreet.set_text(u"When I was young, I traveled the worldŇas a POKéMON TRAINER.");
textMoveBox.set_text(u"ȆÀËOh, of course, I have to moveŇthe plants. Silly me!");
textWeHere.set_text(u"ȆÀËLOOKER: I am here in Hoenn to findŇthe leaders MAXIE and ARCHIE.ȼHowever, in the meantime, I amŇhelping my friend Professor FENNEL.ȼThis is why you are here, no?ȼI shall contact her and tell herŇyou are ready.ŞCome! Allons y!");
textGreet.set_text(u8"When I was young, I traveled the worldŇas a POKéMON TRAINER.");
textMoveBox.set_text(u8"ȆÀËOh, of course, I have to moveŇthe plants. Silly me!");
textWeHere.set_text(u8"ȆÀËLOOKER: I am here in Hoenn to findŇthe leaders MAXIE and ARCHIE.ȼHowever, in the meantime, I amŇhelping my friend Professor FENNEL.ȼThis is why you are here, no?ȼI shall contact her and tell herŇyou are ready.ŞCome! Allons y!");
break;
}
textReceived.set_text(u"ȆÀÁƲÀS POKéMON were sent to theŇPC!");
textYouMustBe.set_text(first_time ? u"Ah! You must be ƲÀ!ŇI was told youd be coming.ȼOh! I still wear my disguise! Pardon!ŇOr, rather, let me introduce myself." : u"Ah, ƲÀ! Welcome back!ŇGood to see you again!ȼOh! I still wear my disguise! Pardon!");
textIAm.set_text(first_time ? u"ȆÀËI am a globe-trotting elite of theŇInternational Police.ȼMy name…ŞAh, no, I shall inform you of myŇcode name only.ȼMy code name, it is LOOKER.ŇIt is how I am called!" : u"ȆÀËIt is I, globe-trotting elite of theŇInternational Police.ȼMy code name, it is LOOKER.ŇIt is how I am called!");
textPCConvo.set_text(u"ȆÀÉFENNEL: Ah, LOOKER! Good to hear fromŇyou! I take it ƲÀ has arrived?ȼȆÀËLOOKER: Indeed! Theyre here andŇready to receive their POKéMON!ȼȆÀÉFENNEL: Excellent! Ill be sending themŇover momentarily… stand by!"); // ȼDont worry ƲÀ,Ňyou wont have to do a thing!");
textPCThanks.set_text(u"ȆÀÉFENNEL: It looks like everything wasŇsent to your PC successfully!ȼThanks again for your help ƲÀ!ŇSee you around, LOOKER!");
textThank.set_text(u"ȆÀËThanks for stopping by, ƲÀ!ȼIf youll excuse me, I need toŇreturn to my disguise.ŞUntil our paths cross again!");
textPCFull.set_text(u"ȆÀÉFENNEL: Hm, it seems like the PC is full!ȼGo make some room, and I can sendŇover the rest of your POKéMON.");
textLookerFull.set_text(u"ȆÀËLOOKER: Speak to me again afterŇyouve made room, ƲÀ!ȼIn the meantime, I will return toŇmy disguise.");
textReceived.set_text(u8"ȆÀÁƲÀS POKéMON were sent to theŇPC!");
textYouMustBe.set_text(first_time ? u8"Ah! You must be ƲÀ!ŇI was told youd be coming.ȼOh! I still wear my disguise! Pardon!ŇOr, rather, let me introduce myself." : u8"Ah, ƲÀ! Welcome back!ŇGood to see you again!ȼOh! I still wear my disguise! Pardon!");
textIAm.set_text(first_time ? u8"ȆÀËI am a globe-trotting elite of theŇInternational Police.ȼMy name…ŞAh, no, I shall inform you of myŇcode name only.ȼMy code name, it is LOOKER.ŇIt is how I am called!" : u8"ȆÀËIt is I, globe-trotting elite of theŇInternational Police.ȼMy code name, it is LOOKER.ŇIt is how I am called!");
textPCConvo.set_text(u8"ȆÀÉFENNEL: Ah, LOOKER! Good to hear fromŇyou! I take it ƲÀ has arrived?ȼȆÀËLOOKER: Indeed! Theyre here andŇready to receive their POKéMON!ȼȆÀÉFENNEL: Excellent! Ill be sending themŇover momentarily… stand by!"); // ȼDont worry ƲÀ,Ňyou wont have to do a thing!");
textPCThanks.set_text(u8"ȆÀÉFENNEL: It looks like everything wasŇsent to your PC successfully!ȼThanks again for your help ƲÀ!ŇSee you around, LOOKER!");
textThank.set_text(u8"ȆÀËThanks for stopping by, ƲÀ!ȼIf youll excuse me, I need toŇreturn to my disguise.ŞUntil our paths cross again!");
textPCFull.set_text(u8"ȆÀÉFENNEL: Hm, it seems like the PC is full!ȼGo make some room, and I can sendŇover the rest of your POKéMON.");
textLookerFull.set_text(u8"ȆÀËLOOKER: Speak to me again afterŇyouve made room, ƲÀ!ȼIn the meantime, I will return toŇmy disguise.");
const int movementSlowSpinArray[16] = {
MOVEMENT_ACTION_FACE_LEFT,
@ -782,6 +782,7 @@ void mystery_gift_script::build_script(Pokemon_Party &incoming_box_data)
}
};
/*
void mystery_gift_script::build_script_old(Pokemon_Party &incoming_box_data)
{
std::vector<script_var *> asm_variable_list;
@ -996,7 +997,7 @@ void mystery_gift_script::build_script_old(Pokemon_Party &incoming_box_data)
}
}
};
*/
u8 mystery_gift_script::get_script_value_at(int i)
{
return mg_script[i];
@ -1410,6 +1411,7 @@ void mystery_gift_script::changePaletteMacro(u8 npcId, u8 palNum)
*
* @param register_list Is the list of registers to be stored, separated by commas and surrounded by { and }. The list is encoded in the register_list field of the instruction, by setting bit[i] to 1 if register Ri is included in the list and to 0 otherwise, for each of i=0 to 7. The R bit (bit[8]) is set to 1 if the LR is in the list and to 0 otherwise.
*/
void mystery_gift_script::push(u16 register_list)
{
add_asm((0b1011010 << 9) | register_list);

View File

@ -17,7 +17,7 @@ bool inject_mystery(Pokemon_Party &incoming_box_data)
mystery_gift_script script;
if (ENABLE_OLD_EVENT)
{
script.build_script_old(incoming_box_data);
//script.build_script_old(incoming_box_data);
}
else
{

View File

@ -204,11 +204,11 @@ byte *generate_payload(GB_ROM curr_rom, int type, bool debug)
// our final code is.
// Update all the pointers
for (int i = 0; i < var_vector.size(); i++)
for (unsigned int i = 0; i < var_vector.size(); i++)
{
var_vector.at(i)->update_ptrs();
}
for (int i = 0; i < jump_vector.size(); i++)
for (unsigned int i = 0; i < jump_vector.size(); i++)
{
jump_vector.at(i)->update_jumps();
}
@ -436,11 +436,11 @@ byte *generate_payload(GB_ROM curr_rom, int type, bool debug)
// our final code is.
// Update all the pointers
for (int i = 0; i < var_vector.size(); i++)
for (unsigned int i = 0; i < var_vector.size(); i++)
{
var_vector.at(i)->update_ptrs();
}
for (int i = 0; i < jump_vector.size(); i++)
for (unsigned int i = 0; i < jump_vector.size(); i++)
{
jump_vector.at(i)->update_jumps();
}
@ -719,11 +719,11 @@ byte *generate_payload(GB_ROM curr_rom, int type, bool debug)
// our final code is.
// Update all the pointers
for (int i = 0; i < var_vector.size(); i++)
for (unsigned int i = 0; i < var_vector.size(); i++)
{
var_vector.at(i)->update_ptrs();
}
for (int i = 0; i < jump_vector.size(); i++)
for (unsigned int i = 0; i < jump_vector.size(); i++)
{
jump_vector.at(i)->update_jumps();
}
@ -744,6 +744,7 @@ byte *generate_payload(GB_ROM curr_rom, int type, bool debug)
// which is the rival's name. This code fixes the stack and jumps to the patchlist, which is where
// our final code is.
}
return nullptr;
};
int test_main() // Rename to "main" to send the payload to test_payload.txt

View File

@ -27,7 +27,7 @@ pkmn_fontGlyphs:
.word 0x00000000,0x00000000,0x3C3C3C18,0x18180018,0x00003636,0x00000000,0x00000000,0x00000000
.word 0x043C243C,0x040E040E,0x00000000,0x00000000,0x4C16160C,0x005E335A,0x08101818,0x00000000
.word 0x04040830,0x00300804,0x2020100C,0x000C1020,0x00000000,0x00000000,0x00000000,0x00000000
.word 0x04040830,0x00300804,0x2020100C,0x000C1020,0xE0420702,0x081C0840,0x00000000,0x00000000
.word 0x00000000,0x04080C0C,0x00000000,0x0000007E,0x00000000,0x000C0C00,0x08102040,0x00010204
.word 0x63321C00,0x001C2663,0x0C0E0C00,0x003F0C0C,0x70633E00,0x007F073E,0x1C307E00,0x003E6360
.word 0x363C3800,0x00307F33,0x3F013F00,0x003E6360,0x3F033E00,0x003E6363,0x30637F00,0x000C0C18

View File

@ -5,7 +5,7 @@
#include "save_data_manager.h"
#include "debug_mode.h"
Pokemon::Pokemon(){};
Pokemon::Pokemon() {};
// TODO: Rewrite this with two different classes/structs that have arrays as input/output
// GBpkmn and GBApkmn
@ -212,6 +212,26 @@ void Pokemon::convert_to_gen_three(bool simplified, bool stabilize_mythical)
*(vu32 *)exp = get_max_exp(species_index_struct);
}
// Check if shiny
is_shiny =
((dvs[1] == 0b10101010) && // Checks if the Speed and Special DVs equal 10
((dvs[0] & 0xF) == 0b1010) && // Checks if the Defense DVs equal 10
((dvs[0] & 0b00100000) >> 5)); // Checks if the second bit of the Attack DV is true
if (species_index_struct == 201) // Checks if the Pokemon is Unown
{
unown_letter = 0;
unown_letter |= ((dvs[0] >> 5) & 0b11) << 6;
unown_letter |= ((dvs[0] >> 1) & 0b11) << 4;
unown_letter |= ((dvs[1] >> 5) & 0b11) << 2;
unown_letter |= ((dvs[1] >> 1) & 0b11);
unown_letter = unown_letter / 10;
}
else
{
unown_letter = -1;
}
if (simplified)
{
if ((species_index_struct == 151 || species_index_struct == 251) && *(vu32 *)exp < 560) // Minimum EXP for level 10
@ -353,10 +373,7 @@ void Pokemon::convert_to_gen_three(bool simplified, bool stabilize_mythical)
copy_from_to(&trainer_id[0], &gen_3_pkmn[4], 2, true);
// Check if the Pokemon is shiny
if ( // Is shiny
((dvs[1] == 0b10101010) && // Checks if the Speed and Special DVs equal 10
((dvs[0] & 0xF) == 0b1010) && // Checks if the Defense DVs equal 10
((dvs[0] & 0b00100000) >> 5))) // Checks if the second bit of the Attack DV is true
if (is_shiny)
{
secret_id[0] = trainer_id[1] ^ pid[0] ^ pid[2] ^ 0x0; // This value at the end should be random between 0 - 15, if that is to be implemented
secret_id[1] = trainer_id[0] ^ pid[1] ^ pid[3] ^ 0x0;
@ -628,24 +645,15 @@ byte *Pokemon::convert_text(byte *text_array, int size, int gen, int lang)
u32 Pokemon::generate_pid_iv_match(byte pid_species_index, byte nature, byte *pid_dvs)
{
u32 new_pid = 0;
int letter = -1;
int gen2_gender_threshold = get_gender_threshold(pid_species_index, false);
int gen3_gender_threshold = get_gender_threshold(pid_species_index, true);
bool gender = (((pid_dvs[0] >> 4) & 0b1111) < gen2_gender_threshold);
if (pid_species_index == 0xC9) // Checks if the Pokemon is Unown
{
letter |= ((pid_dvs[0] >> 5) & 0b11) << 6;
letter |= ((pid_dvs[0] >> 1) & 0b11) << 4;
letter |= ((pid_dvs[1] >> 5) & 0b11) << 2;
letter |= ((pid_dvs[1] >> 1) & 0b11);
letter = letter / 10;
}
do
{
new_pid = get_rand_u16() | (get_rand_u16() << 16);
} while (!(
(letter != -1 ? get_letter_from_pid(new_pid) == letter : true) &&
(unown_letter != -1 ? get_letter_from_pid(new_pid) == unown_letter : true) &&
get_nature_from_pid(new_pid) == nature &&
(gen2_gender_threshold != -1
? ((get_gender_from_pid(new_pid) < gen3_gender_threshold) == gender)
@ -677,12 +685,6 @@ u32 Pokemon::generate_pid_save_iv(byte pid_species_index, byte nature, byte *pid
u32 new_pid = 0;
if (pid_species_index == 0xC9) // Checks if the Pokemon is Unown
{
unown_letter |= ((pid_dvs[0] >> 5) & 0b11) << 6;
unown_letter |= ((pid_dvs[0] >> 1) & 0b11) << 4;
unown_letter |= ((pid_dvs[1] >> 5) & 0b11) << 2;
unown_letter |= ((pid_dvs[1] >> 1) & 0b11);
unown_letter = unown_letter / 10;
byte letter_mod = rand_reverse_mod(28, unown_letter);
for (int i = 0; i < 4; i++)
{
@ -751,6 +753,11 @@ bool Pokemon::get_validity()
return is_valid;
}
bool Pokemon::get_is_shiny()
{
return is_shiny;
}
bool Pokemon::get_is_new()
{
return (is_valid ? is_new : false);
@ -767,6 +774,8 @@ Simplified_Pokemon Pokemon::get_simple_pkmn()
}
curr_pkmn.is_valid = get_validity();
curr_pkmn.is_transferred = false;
curr_pkmn.is_shiny = get_is_shiny();
curr_pkmn.unown_letter = unown_letter;
return curr_pkmn;
}
@ -931,4 +940,3 @@ void Pokemon::set_to_event(byte nature)
alocate_data_chunks(data_section_G, data_section_A, data_section_E, data_section_M);
return;
}

View File

@ -5130,259 +5130,291 @@ const u8 POWER_POINTS[252]{
10, // Beat-up
};
const u8 MENU_SPRITES[252] = {
0, // Offset the list to remove "off by one" errors
22, // Bulbasaur
22, // Ivysaur
22, // Venusaur
23, // Charmander
23, // Charmeleon
38, // Charizard
21, // Squirtle
21, // Wartortle
21, // Blastoise
24, // Caterpie
24, // Metapod
30, // Butterfree
24, // Weedle
24, // Kakuna
11, // Beedrill
7, // Pidgey
7, // Pidgeotto
7, // Pidgeot
15, // Rattata
15, // Raticate
7, // Spearow
7, // Fearow
19, // Ekans
19, // Arbok
4, // Pikachu
4, // Raichu
8, // Sandshrew
8, // Sandslash
15, // Nidoran♀
15, // Nidorina
8, // Nidoqueen
15, // Nidoran♂
15, // Nidorino
8, // Nidoking
9, // Clefairy
9, // Clefable
15, // Vulpix
15, // Ninetales
2, // Jigglypuff
2, // Wigglytuff
31, // Zubat
31, // Golbat
10, // Oddish
10, // Gloom
10, // Vileplume
11, // Paras
11, // Parasect
24, // Venonat
30, // Venomoth
3, // Diglett
3, // Dugtrio
15, // Meowth
15, // Persian
8, // Psyduck
8, // Golduck
27, // Mankey
27, // Primeape
15, // Growlithe
15, // Arcanine
1, // Poliwag
1, // Poliwhirl
1, // Poliwrath
14, // Abra
14, // Kadabra
14, // Alakazam
27, // Machop
27, // Machoke
27, // Machamp
10, // Bellsprout
10, // Weepinbell
10, // Victreebel
29, // Tentacool
29, // Tentacruel
26, // Geodude
26, // Graveler
26, // Golem
16, // Ponyta
16, // Rapidash
36, // Slowpoke
36, // Slowbro
20, // Magnemite
20, // Magneton
7, // Farfetch'd
7, // Doduo
7, // Dodrio
13, // Seel
13, // Dewgong
18, // Grimer
18, // Muk
37, // Shellder
37, // Cloyster
12, // Gastly
12, // Haunter
12, // Gengar
19, // Onix
14, // Drowzee
14, // Hypno
17, // Krabby
17, // Kingler
20, // Voltorb
20, // Electrode
10, // Exeggcute
10, // Exeggutor
8, // Cubone
8, // Marowak
27, // Hitmonlee
27, // Hitmonchan
8, // Lickitung
18, // Koffing
18, // Weezing
16, // Rhyhorn
8, // Rhydon
9, // Chansey
10, // Tangela
8, // Kangaskhan
6, // Horsea
6, // Seadra
6, // Goldeen
6, // Seaking
5, // Staryu
5, // Starmie
14, // Mr. Mime
11, // Scyther
14, // Jynx
14, // Electabuzz
14, // Magmar
11, // Pinsir
16, // Tauros
6, // Magikarp
35, // Gyarados
13, // Lapras
18, // Ditto
15, // Eevee
15, // Vaporeon
15, // Jolteon
15, // Flareon
20, // Porygon
17, // Omanyte
17, // Omastar
17, // Kabuto
17, // Kabutops
7, // Aerodactyl
32, // Snorlax
7, // Articuno
7, // Zapdos
7, // Moltres
19, // Dratini
19, // Dragonair
38, // Dragonite
14, // Mewtwo
14, // Mew
10, // Chikorita
10, // Bayleef
10, // Meganium
15, // Cyndaquil
15, // Quilava
15, // Typhlosion
8, // Totodile
8, // Croconaw
8, // Feraligatr
15, // Sentret
15, // Furret
7, // Hoothoot
7, // Noctowl
11, // Ledyba
11, // Ledian
11, // Spinarak
11, // Ariados
31, // Crobat
6, // Chinchou
6, // Lanturn
4, // Pichu
9, // Cleffa
2, // Igglybuff
9, // Togepi
7, // Togetic
7, // Natu
7, // Xatu
15, // Mareep
8, // Flaaffy
8, // Ampharos
10, // Bellossom
2, // Marill
2, // Azumarill
27, // Sudowoodo
1, // Politoed
10, // Hoppip
10, // Skiploom
10, // Jumpluff
8, // Aipom
10, // Sunkern
10, // Sunflora
11, // Yanma
8, // Wooper
8, // Quagsire
15, // Espeon
15, // Umbreon
7, // Murkrow
36, // Slowking
12, // Misdreavus
25, // Unown
12, // Wobbuffet
16, // Girafarig
11, // Pineco
11, // Forretress
19, // Dunsparce
11, // Gligar
19, // Steelix
8, // Snubbull
8, // Granbull
6, // Qwilfish
11, // Scizor
11, // Shuckle
11, // Heracross
15, // Sneasel
8, // Teddiursa
8, // Ursaring
18, // Slugma
18, // Magcargo
16, // Swinub
16, // Piloswine
17, // Corsola
6, // Remoraid
6, // Octillery
8, // Delibird
6, // Mantine
7, // Skarmory
15, // Houndour
15, // Houndoom
38, // Kingdra
16, // Phanpy
16, // Donphan
20, // Porygon2
16, // Stantler
8, // Smeargle
27, // Tyrogue
27, // Hitmontop
14, // Smoochum
14, // Elekid
14, // Magby
16, // Miltank
9, // Blissey
15, // Raikou
15, // Entei
15, // Suicune
8, // Larvitar
8, // Pupitar
8, // Tyranitar
34, // Lugia
33, // Ho-Oh
14, // Celebi
#define ICON_RED 0
#define ICON_BLU 1
#define ICON_GRN 2
#define ICON_BRN 3
#define ICON_PNK 4
const u8 MENU_SPRITE_PALS[252 + 26][2] = {
{ICON_BLU, ICON_RED}, // MISSINGNO
{ICON_GRN, ICON_GRN}, // BULBASAUR
{ICON_GRN, ICON_GRN}, // IVYSAUR
{ICON_GRN, ICON_GRN}, // VENUSAUR
{ICON_RED, ICON_BRN}, // CHARMANDER
{ICON_RED, ICON_PNK}, // CHARMELEON
{ICON_RED, ICON_BLU}, // CHARIZARD
{ICON_BLU, ICON_GRN}, // SQUIRTLE
{ICON_BLU, ICON_GRN}, // WARTORTLE
{ICON_BLU, ICON_GRN}, // BLASTOISE
{ICON_GRN, ICON_BRN}, // CATERPIE
{ICON_GRN, ICON_BRN}, // METAPOD
{ICON_PNK, ICON_GRN}, // BUTTERFREE
{ICON_RED, ICON_PNK}, // WEEDLE
{ICON_BRN, ICON_GRN}, // KAKUNA
{ICON_RED, ICON_GRN}, // BEEDRILL
{ICON_BRN, ICON_GRN}, // PIDGEY
{ICON_BRN, ICON_GRN}, // PIDGEOTTO
{ICON_RED, ICON_GRN}, // PIDGEOT
{ICON_PNK, ICON_GRN}, // RATTATA
{ICON_BRN, ICON_RED}, // RATICATE
{ICON_BRN, ICON_GRN}, // SPEAROW
{ICON_BRN, ICON_GRN}, // FEAROW
{ICON_PNK, ICON_GRN}, // EKANS
{ICON_PNK, ICON_BRN}, // ARBOK
{ICON_RED, ICON_PNK}, // PIKACHU
{ICON_RED, ICON_BRN}, // RAICHU
{ICON_BRN, ICON_GRN}, // SANDSHREW
{ICON_BRN, ICON_RED}, // SANDSLASH
{ICON_BLU, ICON_PNK}, // NIDORAN_F
{ICON_BLU, ICON_PNK}, // NIDORINA
{ICON_BLU, ICON_GRN}, // NIDOQUEEN
{ICON_PNK, ICON_BLU}, // NIDORAN_M
{ICON_PNK, ICON_BLU}, // NIDORINO
{ICON_PNK, ICON_BLU}, // NIDOKING
{ICON_PNK, ICON_GRN}, // CLEFAIRY
{ICON_PNK, ICON_GRN}, // CLEFABLE
{ICON_RED, ICON_BRN}, // VULPIX
{ICON_BRN, ICON_BLU}, // NINETALES
{ICON_PNK, ICON_GRN}, // JIGGLYPUFF
{ICON_PNK, ICON_GRN}, // WIGGLYTUFF
{ICON_BLU, ICON_GRN}, // ZUBAT
{ICON_BLU, ICON_GRN}, // GOLBAT
{ICON_GRN, ICON_BRN}, // ODDISH
{ICON_RED, ICON_BRN}, // GLOOM
{ICON_RED, ICON_BRN}, // VILEPLUME
{ICON_RED, ICON_GRN}, // PARAS
{ICON_RED, ICON_GRN}, // PARASECT
{ICON_PNK, ICON_BLU}, // VENONAT
{ICON_PNK, ICON_BLU}, // VENOMOTH
{ICON_BRN, ICON_BLU}, // DIGLETT
{ICON_BRN, ICON_BLU}, // DUGTRIO
{ICON_BRN, ICON_PNK}, // MEOWTH
{ICON_BRN, ICON_PNK}, // PERSIAN
{ICON_BRN, ICON_BLU}, // PSYDUCK
{ICON_BLU, ICON_BLU}, // GOLDUCK
{ICON_BRN, ICON_GRN}, // MANKEY
{ICON_BRN, ICON_GRN}, // PRIMEAPE
{ICON_RED, ICON_GRN}, // GROWLITHE
{ICON_RED, ICON_GRN}, // ARCANINE
{ICON_BLU, ICON_BLU}, // POLIWAG
{ICON_BLU, ICON_BLU}, // POLIWHIRL
{ICON_BLU, ICON_GRN}, // POLIWRATH
{ICON_BRN, ICON_PNK}, // ABRA
{ICON_BRN, ICON_PNK}, // KADABRA
{ICON_BRN, ICON_PNK}, // ALAKAZAM
{ICON_BLU, ICON_BRN}, // MACHOP
{ICON_BLU, ICON_GRN}, // MACHOKE
{ICON_BLU, ICON_GRN}, // MACHAMP
{ICON_GRN, ICON_BRN}, // BELLSPROUT
{ICON_GRN, ICON_BRN}, // WEEPINBELL
{ICON_GRN, ICON_BRN}, // VICTREEBEL
{ICON_BLU, ICON_GRN}, // TENTACOOL
{ICON_BLU, ICON_GRN}, // TENTACRUEL
{ICON_BRN, ICON_RED}, // GEODUDE
{ICON_BRN, ICON_RED}, // GRAVELER
{ICON_BRN, ICON_RED}, // GOLEM
{ICON_RED, ICON_PNK}, // PONYTA
{ICON_RED, ICON_PNK}, // RAPIDASH
{ICON_PNK, ICON_BLU}, // SLOWPOKE
{ICON_PNK, ICON_BLU}, // SLOWBRO
{ICON_BLU, ICON_BRN}, // MAGNEMITE
{ICON_BLU, ICON_BRN}, // MAGNETON
{ICON_BRN, ICON_GRN}, // FARFETCH_D
{ICON_BRN, ICON_GRN}, // DODUO
{ICON_BRN, ICON_GRN}, // DODRIO
{ICON_RED, ICON_PNK}, // SEEL
{ICON_RED, ICON_PNK}, // DEWGONG
{ICON_PNK, ICON_GRN}, // GRIMER
{ICON_PNK, ICON_GRN}, // MUK
{ICON_PNK, ICON_BRN}, // SHELLDER
{ICON_PNK, ICON_BLU}, // CLOYSTER
{ICON_PNK, ICON_BLU}, // GASTLY
{ICON_PNK, ICON_BLU}, // HAUNTER
{ICON_RED, ICON_BLU}, // GENGAR
{ICON_BRN, ICON_GRN}, // ONIX
{ICON_BRN, ICON_PNK}, // DROWZEE
{ICON_BRN, ICON_PNK}, // HYPNO
{ICON_RED, ICON_GRN}, // KRABBY
{ICON_RED, ICON_GRN}, // KINGLER
{ICON_RED, ICON_BLU}, // VOLTORB
{ICON_RED, ICON_BLU}, // ELECTRODE
{ICON_PNK, ICON_GRN}, // EXEGGCUTE
{ICON_GRN, ICON_BRN}, // EXEGGUTOR
{ICON_BRN, ICON_GRN}, // CUBONE
{ICON_BRN, ICON_GRN}, // MAROWAK
{ICON_BRN, ICON_GRN}, // HITMONLEE
{ICON_BRN, ICON_GRN}, // HITMONCHAN
{ICON_PNK, ICON_GRN}, // LICKITUNG
{ICON_PNK, ICON_BLU}, // KOFFING
{ICON_PNK, ICON_BLU}, // WEEZING
{ICON_BLU, ICON_BRN}, // RHYHORN
{ICON_BLU, ICON_BLU}, // RHYDON
{ICON_PNK, ICON_GRN}, // CHANSEY
{ICON_BLU, ICON_GRN}, // TANGELA
{ICON_BRN, ICON_GRN}, // KANGASKHAN
{ICON_BLU, ICON_PNK}, // HORSEA
{ICON_BLU, ICON_PNK}, // SEADRA
{ICON_RED, ICON_BRN}, // GOLDEEN
{ICON_RED, ICON_BRN}, // SEAKING
{ICON_BRN, ICON_BLU}, // STARYU
{ICON_PNK, ICON_BLU}, // STARMIE
{ICON_PNK, ICON_GRN}, // MR__MIME
{ICON_GRN, ICON_GRN}, // SCYTHER
{ICON_RED, ICON_PNK}, // JYNX
{ICON_BRN, ICON_GRN}, // ELECTABUZZ
{ICON_RED, ICON_PNK}, // MAGMAR
{ICON_BRN, ICON_BLU}, // PINSIR
{ICON_BRN, ICON_GRN}, // TAUROS
{ICON_RED, ICON_GRN}, // MAGIKARP
{ICON_BLU, ICON_RED}, // GYARADOS
{ICON_BLU, ICON_PNK}, // LAPRAS
{ICON_PNK, ICON_BLU}, // DITTO
{ICON_BRN, ICON_BLU}, // EEVEE
{ICON_BLU, ICON_PNK}, // VAPOREON
{ICON_BRN, ICON_GRN}, // JOLTEON
{ICON_RED, ICON_BRN}, // FLAREON
{ICON_PNK, ICON_BLU}, // PORYGON
{ICON_BLU, ICON_BRN}, // OMANYTE
{ICON_BLU, ICON_BRN}, // OMASTAR
{ICON_BRN, ICON_GRN}, // KABUTO
{ICON_BRN, ICON_GRN}, // KABUTOPS
{ICON_PNK, ICON_BLU}, // AERODACTYL
{ICON_RED, ICON_BLU}, // SNORLAX
{ICON_BLU, ICON_BLU}, // ARTICUNO
{ICON_BRN, ICON_RED}, // ZAPDOS
{ICON_RED, ICON_PNK}, // MOLTRES
{ICON_BLU, ICON_PNK}, // DRATINI
{ICON_BLU, ICON_PNK}, // DRAGONAIR
{ICON_RED, ICON_GRN}, // DRAGONITE
{ICON_PNK, ICON_GRN}, // MEWTWO
{ICON_PNK, ICON_BLU}, // MEW
{ICON_GRN, ICON_BRN}, // CHIKORITA
{ICON_GRN, ICON_BRN}, // BAYLEEF
{ICON_GRN, ICON_BRN}, // MEGANIUM
{ICON_RED, ICON_PNK}, // CYNDAQUIL
{ICON_RED, ICON_PNK}, // QUILAVA
{ICON_RED, ICON_PNK}, // TYPHLOSION
{ICON_BLU, ICON_GRN}, // TOTODILE
{ICON_BLU, ICON_GRN}, // CROCONAW
{ICON_BLU, ICON_GRN}, // FERALIGATR
{ICON_BRN, ICON_PNK}, // SENTRET
{ICON_BRN, ICON_PNK}, // FURRET
{ICON_BRN, ICON_GRN}, // HOOTHOOT
{ICON_BRN, ICON_GRN}, // NOCTOWL
{ICON_RED, ICON_BRN}, // LEDYBA
{ICON_RED, ICON_BRN}, // LEDIAN
{ICON_GRN, ICON_PNK}, // SPINARAK
{ICON_RED, ICON_PNK}, // ARIADOS
{ICON_PNK, ICON_PNK}, // CROBAT
{ICON_BLU, ICON_BLU}, // CHINCHOU
{ICON_BLU, ICON_PNK}, // LANTURN
{ICON_RED, ICON_BRN}, // PICHU
{ICON_PNK, ICON_GRN}, // CLEFFA
{ICON_PNK, ICON_GRN}, // IGGLYBUFF
{ICON_RED, ICON_BLU}, // TOGEPI
{ICON_RED, ICON_BLU}, // TOGETIC
{ICON_GRN, ICON_GRN}, // NATU
{ICON_GRN, ICON_GRN}, // XATU
{ICON_BLU, ICON_BLU}, // MAREEP
{ICON_PNK, ICON_PNK}, // FLAAFFY
{ICON_BRN, ICON_BLU}, // AMPHAROS
{ICON_GRN, ICON_BLU}, // BELLOSSOM
{ICON_BLU, ICON_GRN}, // MARILL
{ICON_BLU, ICON_BRN}, // AZUMARILL
{ICON_GRN, ICON_PNK}, // SUDOWOODO
{ICON_GRN, ICON_BLU}, // POLITOED
{ICON_PNK, ICON_GRN}, // HOPPIP
{ICON_GRN, ICON_PNK}, // SKIPLOOM
{ICON_BLU, ICON_PNK}, // JUMPLUFF
{ICON_PNK, ICON_PNK}, // AIPOM
{ICON_GRN, ICON_BRN}, // SUNKERN
{ICON_GRN, ICON_BRN}, // SUNFLORA
{ICON_RED, ICON_BLU}, // YANMA
{ICON_BLU, ICON_PNK}, // WOOPER
{ICON_BLU, ICON_PNK}, // QUAGSIRE
{ICON_PNK, ICON_GRN}, // ESPEON
{ICON_BRN, ICON_BLU}, // UMBREON
{ICON_BLU, ICON_PNK}, // MURKROW
{ICON_PNK, ICON_BLU}, // SLOWKING
{ICON_BLU, ICON_BRN}, // MISDREAVUS
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BLU, ICON_PNK}, // WOBBUFFET
{ICON_PNK, ICON_BLU}, // GIRAFARIG
{ICON_GRN, ICON_RED}, // PINECO
{ICON_RED, ICON_GRN}, // FORRETRESS
{ICON_BLU, ICON_PNK}, // DUNSPARCE
{ICON_PNK, ICON_BLU}, // GLIGAR
{ICON_BLU, ICON_BRN}, // STEELIX
{ICON_PNK, ICON_BLU}, // SNUBBULL
{ICON_PNK, ICON_BLU}, // GRANBULL
{ICON_BLU, ICON_PNK}, // QWILFISH
{ICON_RED, ICON_GRN}, // SCIZOR
{ICON_RED, ICON_BLU}, // SHUCKLE
{ICON_BLU, ICON_PNK}, // HERACROSS
{ICON_BLU, ICON_PNK}, // SNEASEL
{ICON_BRN, ICON_GRN}, // TEDDIURSA
{ICON_BRN, ICON_GRN}, // URSARING
{ICON_RED, ICON_BLU}, // SLUGMA
{ICON_RED, ICON_BLU}, // MAGCARGO
{ICON_BRN, ICON_BLU}, // SWINUB
{ICON_BRN, ICON_GRN}, // PILOSWINE
{ICON_PNK, ICON_BLU}, // CORSOLA
{ICON_BLU, ICON_BLU}, // REMORAID
{ICON_RED, ICON_GRN}, // OCTILLERY
{ICON_RED, ICON_PNK}, // DELIBIRD
{ICON_BLU, ICON_BLU}, // MANTINE
{ICON_RED, ICON_GRN}, // SKARMORY
{ICON_RED, ICON_BLU}, // HOUNDOUR
{ICON_RED, ICON_BLU}, // HOUNDOOM
{ICON_BLU, ICON_PNK}, // KINGDRA
{ICON_BLU, ICON_BLU}, // PHANPY
{ICON_BLU, ICON_RED}, // DONPHAN
{ICON_PNK, ICON_BLU}, // PORYGON2
{ICON_BRN, ICON_GRN}, // STANTLER
{ICON_GRN, ICON_PNK}, // SMEARGLE
{ICON_PNK, ICON_BLU}, // TYROGUE
{ICON_BRN, ICON_BLU}, // HITMONTOP
{ICON_PNK, ICON_PNK}, // SMOOCHUM
{ICON_BRN, ICON_BRN}, // ELEKID
{ICON_RED, ICON_BRN}, // MAGBY
{ICON_PNK, ICON_BLU}, // MILTANK
{ICON_PNK, ICON_PNK}, // BLISSEY
{ICON_BRN, ICON_BRN}, // RAIKOU
{ICON_RED, ICON_RED}, // ENTEI
{ICON_BLU, ICON_BLU}, // SUICUNE
{ICON_GRN, ICON_GRN}, // LARVITAR
{ICON_BLU, ICON_PNK}, // PUPITAR
{ICON_GRN, ICON_PNK}, // TYRANITAR
{ICON_BLU, ICON_PNK}, // LUGIA
{ICON_RED, ICON_BRN}, // HO_OH
{ICON_GRN, ICON_PNK}, // CELEBI
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
{ICON_BRN, ICON_BLU}, // UNOWN
};
extern const byte EVENT_PKMN[8][80]{

View File

@ -91,7 +91,7 @@ byte gen2_debug_box_data[0x44E] = {
// Num of Pokemon
0x14,
// Pokemon 1-20
0xD5, 0x7B, 0xE3, 0x9D, 0xC3, 0xD5, 0xD5, 0xD5, 0xD5, 0xD5, 0xD5, 0xD5, 0xD5, 0xD5, 0xD5, 0xD5, 0xD5, 0xD5, 0xD5, 0xD5, 0xFF,
0xD5, 0x7B, 0xE3, 0x9D, 0xC3, 0xD5, 0xD5, 0xC9, 0xC9, 0xD5, 0xD5, 0xD5, 0xD5, 0xD5, 0xD5, 0xD5, 0xD5, 0xD5, 0xD5, 0xD5, 0xFF,
// Pokemon list
0xD5, 0x00, 0x84, 0x6E, 0x23, 0xE3, 0xBB, 0x4C, 0x00, 0x0A, 0x4E, 0x00, 0x20, 0x00, 0x32, 0x00, 0x23, 0x00, 0x34, 0x00, 0x28, 0x9C, 0x90, 0x23, 0x28, 0x14, 0x05, 0x58, 0x00, 0x00, 0x00, 0x10,
0x7B, 0x00, 0x62, 0x2B, 0x74, 0xE4, 0xBB, 0x4C, 0x00, 0x08, 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBA, 0xF9, 0x1E, 0x1E, 0x1E, 0x14, 0x46, 0x00, 0x00, 0x00, 0x0D,
@ -100,8 +100,8 @@ byte gen2_debug_box_data[0x44E] = {
0xC3, 0x1B, 0xD6, 0x27, 0x15, 0x37, 0xBB, 0x4C, 0x00, 0x1F, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x10, 0x0A, 0x1E, 0x14, 0x19, 0x4C, 0x00, 0x00, 0x00, 0x14,
0xD5, 0x00, 0x84, 0x6E, 0x23, 0xE3, 0xBB, 0x4C, 0x00, 0x0A, 0x4E, 0x00, 0x20, 0x00, 0x32, 0x00, 0x23, 0x00, 0x34, 0x00, 0x28, 0x2A, 0xAA, 0x23, 0x28, 0x14, 0x05, 0x58, 0x00, 0x00, 0x00, 0x10,
0xD5, 0x00, 0x84, 0x6E, 0x23, 0xE3, 0xBB, 0x4C, 0x00, 0x0A, 0x4E, 0x00, 0x20, 0x00, 0x32, 0x00, 0x23, 0x00, 0x34, 0x00, 0x28, 0x9C, 0x90, 0x23, 0x28, 0x14, 0x05, 0x58, 0x00, 0x00, 0x00, 0x10,
0xD5, 0x00, 0x84, 0x6E, 0x23, 0xE3, 0xBB, 0x4C, 0x00, 0x0A, 0x4E, 0x00, 0x20, 0x00, 0x32, 0x00, 0x23, 0x00, 0x34, 0x00, 0x28, 0x9C, 0x90, 0x23, 0x28, 0x14, 0x05, 0x58, 0x00, 0x00, 0x00, 0x10,
0xD5, 0x00, 0x84, 0x6E, 0x23, 0xE3, 0xBB, 0x4C, 0x00, 0x0A, 0x4E, 0x00, 0x20, 0x00, 0x32, 0x00, 0x23, 0x00, 0x34, 0x00, 0x28, 0x9C, 0x90, 0x23, 0x28, 0x14, 0x05, 0x58, 0x00, 0x00, 0x00, 0x10,
0xC9, 0x00, 0x84, 0x6E, 0x23, 0xE3, 0xBB, 0x4C, 0x00, 0x0A, 0x4E, 0x00, 0x20, 0x00, 0x32, 0x00, 0x23, 0x00, 0x34, 0x00, 0x28, 0x22, 0x22, 0x23, 0x28, 0x14, 0x05, 0x58, 0x00, 0x00, 0x00, 0x10,
0xC9, 0x00, 0x84, 0x6E, 0x23, 0xE3, 0xBB, 0x4C, 0x00, 0x0A, 0x4E, 0x00, 0x20, 0x00, 0x32, 0x00, 0x23, 0x00, 0x34, 0x00, 0x28, 0x44, 0x44, 0x23, 0x28, 0x14, 0x05, 0x58, 0x00, 0x00, 0x00, 0x10,
0xD5, 0x00, 0x84, 0x6E, 0x23, 0xE3, 0xBB, 0x4C, 0x00, 0x0A, 0x4E, 0x00, 0x20, 0x00, 0x32, 0x00, 0x23, 0x00, 0x34, 0x00, 0x28, 0x9C, 0x90, 0x23, 0x28, 0x14, 0x05, 0x58, 0x00, 0x00, 0x00, 0x10,
0xD5, 0x00, 0x84, 0x6E, 0x23, 0xE3, 0xBB, 0x4C, 0x00, 0x0A, 0x4E, 0x00, 0x20, 0x00, 0x32, 0x00, 0x23, 0x00, 0x34, 0x00, 0x28, 0x9C, 0x90, 0x23, 0x28, 0x14, 0x05, 0x58, 0x00, 0x00, 0x00, 0x10,
0xD5, 0x00, 0x84, 0x6E, 0x23, 0xE3, 0xBB, 0x4C, 0x00, 0x0A, 0x4E, 0x00, 0x20, 0x00, 0x32, 0x00, 0x23, 0x00, 0x34, 0x00, 0x28, 0x9C, 0x90, 0x23, 0x28, 0x14, 0x05, 0x58, 0x00, 0x00, 0x00, 0x10,

View File

@ -2,7 +2,7 @@
#include "save_data_manager.h"
#include "flash_mem.h"
#include "debug_mode.h"
#include "main_menu.h"
#include "button_menu.h"
#include "pokemon_data.h"
#include "libraries/Pokemon-Gen3-to-Gen-X/include/save.h"

View File

@ -1,5 +1,5 @@
#include "script_array.h"
#include "main_menu.h"
#include "button_menu.h"
#include "text_engine.h"
#include "mystery_gift_injector.h"
#include "sprite_data.h"
@ -279,9 +279,11 @@ bool run_conditional(int index)
case CMD_START_LINK:
load_flex_background(BG_FENNEL, 3);
link_animation_state(STATE_CONNECTION);
party_data.start_link();
set_textbox_small();
load_flex_background(BG_FENNEL, 2);
link_animation_state(0);
return true;
case CMD_IMPORT_POKEMON:
@ -333,7 +335,7 @@ bool run_conditional(int index)
case CMD_SLIDE_PROF_LEFT:
for (int i = 0; i <= (8 * 7); i += 2)
{
REG_BG1HOFS = i;
REG_BG1HOFS = i + FENNEL_SHIFT;
if (!DEBUG_MODE)
{
global_next_frame();
@ -344,7 +346,7 @@ bool run_conditional(int index)
case CMD_SLIDE_PROF_RIGHT:
for (int i = (8 * 7); i >= 0; i -= 2)
{
REG_BG1HOFS = i;
REG_BG1HOFS = i + FENNEL_SHIFT;
if (!DEBUG_MODE)
{
global_next_frame();

View File

@ -136,7 +136,7 @@ u32 xse_var::get_loc_in_sec30()
// TEXTBOX VAR
void textbox_var::set_text(std::u16string_view nText)
void textbox_var::set_text(std::u8string_view nText)
{
text = nText;
}

View File

@ -20,40 +20,48 @@ int Select_Menu::select_menu_main()
key_poll(); // Reset the buttons
bool update = true;
while (true)
{
obj_set_pos(point_arrow, 19 * 8, (2 + curr_selection) * 8);
if (return_values[curr_selection] == -1)
if (update)
{
switch (menu_type)
if (return_values[curr_selection] == -1)
{
case CART_MENU:
obj_hide(cart_shell);
obj_hide(cart_label);
break;
case LANG_MENU:
obj_hide(flag);
break;
switch (menu_type)
{
case CART_MENU:
obj_hide(cart_shell);
obj_hide(cart_label);
break;
case LANG_MENU:
obj_hide(flag);
break;
}
}
}
else
{
switch (menu_type)
else
{
case CART_MENU:
load_cart(return_values[curr_selection], lang);
break;
case LANG_MENU:
load_flag(return_values[curr_selection]);
break;
switch (menu_type)
{
case CART_MENU:
load_select_sprites(return_values[curr_selection], lang);
obj_unhide(cart_shell, 0);
obj_unhide(cart_label, 0);
break;
case LANG_MENU:
load_select_sprites(0, return_values[curr_selection]);
obj_unhide(flag, 0);
break;
}
}
}
update = true;
if (key_hit(KEY_DOWN))
{
curr_selection = ((curr_selection + 1) % menu_options.size());
}
else if (key_hit(KEY_UP))
{
curr_selection = ((curr_selection + (menu_options.size() - 1)) % menu_options.size());
@ -68,6 +76,10 @@ int Select_Menu::select_menu_main()
hide_menu();
return -1;
}
else
{
update = false;
}
global_next_frame();
}

View File

@ -1,46 +1,17 @@
#include <tonc.h>
#include <cstring>
#include <cmath>
#include "sprite_data.h"
#include "debug_mode.h"
#include "gba_rom_values/base_gba_rom_struct.h"
#define SPRITE_CHAR_BLOCK 4
OBJ_ATTR obj_buffer[128];
OBJ_AFFINE *obj_aff_buffer = (OBJ_AFFINE *)obj_buffer;
// These are the two pallets used by the menu sprites,
// it's easier to set them up this way instead of through grit
// (R + G*32 + B*1024)
#define RGB(r, g, b) (r + g * 32 + b * 1024)
#define WHITE RGB(31, 31, 31)
#define YELLOW RGB(31, 19, 10)
#define RED RGB(31, 7, 4)
#define BLACK RGB(0, 0, 0)
const unsigned short frame_one_pal[16] = {
WHITE, WHITE, WHITE, WHITE,
YELLOW, YELLOW, YELLOW, YELLOW,
RED, RED, RED, RED,
BLACK, BLACK, BLACK, BLACK};
const unsigned short frame_two_pal[16] = {
WHITE,
YELLOW,
RED,
BLACK,
WHITE,
YELLOW,
RED,
BLACK,
WHITE,
YELLOW,
RED,
BLACK,
WHITE,
YELLOW,
RED,
BLACK,
};
int curr_flex_background;
int y_offset = 0;
int y_offset_timer = 0;
int y_offset_direction = 1;
// BACKGROUNDS
#include "background.h"
@ -58,21 +29,54 @@ void load_background()
REG_BG0CNT = BG_CBB(CBB) | BG_SBB(SBB) | BG_4BPP | BG_REG_32x32 | BG_PRIO(3);
}
void modify_background_pal(bool dark)
void set_background_pal(int curr_rom_id, bool dark)
{
if (dark)
switch (curr_rom_id)
{
memcpy(pal_bg_mem, &backgroundPal[4], 16);
}
else
{
memcpy(pal_bg_mem, backgroundPal, backgroundPalLen);
case RUBY_ID:
pal_bg_mem[1] = (!dark ? RGB15(12, 3, 9) : RGB15(8, 2, 6));
pal_bg_mem[2] = (!dark ? RGB15(18, 6, 11) : RGB15(12, 4, 7));
pal_bg_mem[3] = (!dark ? RGB15(26, 12, 15) : RGB15(16, 8, 9));
pal_bg_mem[4] = (!dark ? RGB15(28, 19, 21) : RGB15(18, 12, 13));
break;
case SAPPHIRE_ID:
pal_bg_mem[1] = (!dark ? RGB15(7, 6, 13) : RGB15(4, 4, 8));
pal_bg_mem[2] = (!dark ? RGB15(7, 9, 21) : RGB15(4, 6, 13));
pal_bg_mem[3] = (!dark ? RGB15(13, 15, 28) : RGB15(8, 10, 18));
pal_bg_mem[4] = (!dark ? RGB15(20, 21, 28) : RGB15(13, 13, 18));
break;
case FIRERED_ID:
pal_bg_mem[1] = (!dark ? RGB15(15, 4, 4) : RGB15(9, 3, 3));
pal_bg_mem[2] = (!dark ? RGB15(19, 8, 6) : RGB15(12, 5, 4));
pal_bg_mem[3] = (!dark ? RGB15(24, 13, 10) : RGB15(15, 8, 6));
pal_bg_mem[4] = (!dark ? RGB15(28, 23, 21) : RGB15(17, 14, 13));
break;
case LEAFGREEN_ID:
pal_bg_mem[1] = (!dark ? RGB15(5, 11, 5) : RGB15(3, 7, 3));
pal_bg_mem[2] = (!dark ? RGB15(9, 17, 7) : RGB15(6, 11, 4));
pal_bg_mem[3] = (!dark ? RGB15(17, 22, 11) : RGB15(10, 14, 7));
pal_bg_mem[4] = (!dark ? RGB15(24, 26, 19) : RGB15(15, 16, 12));
break;
case EMERALD_ID:
pal_bg_mem[1] = (!dark ? RGB15(5, 10, 10) : RGB15(3, 6, 6));
pal_bg_mem[2] = (!dark ? RGB15(7, 15, 13) : RGB15(5, 9, 8));
pal_bg_mem[3] = (!dark ? RGB15(11, 22, 13) : RGB15(7, 14, 8));
pal_bg_mem[4] = (!dark ? RGB15(20, 26, 20) : RGB15(12, 16, 13));
break;
default:
memcpy(pal_bg_mem, &backgroundPal[dark ? 8 : 0], backgroundPalLen);
break;
}
(pal_obj_mem + (BTN_LIT_PAL * 16))[7] = pal_bg_mem[1];
(pal_obj_mem + (BTN_LIT_PAL * 16))[8] = pal_bg_mem[1];
(pal_obj_mem + (BTN_LIT_PAL * 16))[9] = pal_bg_mem[1];
(pal_obj_mem + (BTN_LIT_PAL * 16))[10] = pal_bg_mem[3];
}
#include "openingBG.h"
#include "fennelBG.h"
#include "dexBG.h"
#include "menu_bars.h"
void load_flex_background(int background_id, int layer)
{
int CBB = 1; // CBB is the tiles that make up the sprite
@ -95,7 +99,7 @@ void load_flex_background(int background_id, int layer)
memcpy(&tile_mem[CBB][0], fennelBGTiles, fennelBGTilesLen);
// Load map into SBB 0
memcpy(&se_mem[SBB][0], fennelBGMap, fennelBGMapLen);
REG_BG1VOFS = 0;
REG_BG1VOFS = FENNEL_SHIFT;
break;
case (BG_DEX):
// Load palette
@ -106,11 +110,19 @@ void load_flex_background(int background_id, int layer)
memcpy(&se_mem[SBB][0], dexBGMap, dexBGMapLen);
REG_BG1VOFS = 0;
break;
case (BG_MAIN_MENU):
// Load palette
memcpy(pal_bg_mem + 32, pal_bg_mem, backgroundPalLen);
// Load tiles into CBB 0
memcpy(&tile_mem[CBB][0], menu_barsTiles, menu_barsTilesLen);
// Load map into SBB 0
memcpy(&se_mem[SBB][0], menu_barsMap, menu_barsMapLen);
REG_BG1VOFS = 0;
break;
}
REG_BG1CNT = BG_CBB(CBB) | BG_SBB(SBB) | BG_4BPP | BG_REG_32x32 | BG_PRIO(layer);
curr_flex_background = background_id;
}
#include "textboxBG.h"
void load_textbox_background()
{
@ -258,35 +270,44 @@ 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++];
OBJ_ATTR *gba_cart = &obj_buffer[num_sprites++];
OBJ_ATTR *link_frame1 = &obj_buffer[num_sprites++];
OBJ_ATTR *link_frame2 = &obj_buffer[num_sprites++];
OBJ_ATTR *link_frame3 = &obj_buffer[num_sprites++];
OBJ_ATTR *link_blob1 = &obj_buffer[num_sprites++];
OBJ_ATTR *link_blob2 = &obj_buffer[num_sprites++];
OBJ_ATTR *link_blob3 = &obj_buffer[num_sprites++];
u32 global_tile_id_end = 0;
void load_eternal_sprites()
{
memcpy(pal_obj_mem + (BTN_PAL * 16), btn_t_lPal, btn_t_lPalLen);
memcpy(pal_obj_mem + (BTN_LIT_PAL * 16), btn_t_rPal, btn_t_rPalLen);
memcpy(pal_obj_mem + (BTN_PAL * 16), button_noPal, button_noPalLen);
memcpy(pal_obj_mem + (BTN_LIT_PAL * 16), button_yesPal, button_yesPalLen);
memcpy(pal_obj_mem + (LOGO_PAL * 16), ptgb_logo_lPal, ptgb_logo_lPalLen);
memcpy(pal_obj_mem + (TYPES_PAL1 * 16), typesPal, typesPalLen);
memcpy(pal_obj_mem + (LINK_CABLE_PAL * 16), link_frame1Pal, link_frame1PalLen);
u32 curr_tile_id = 0;
load_sprite(ptgb_logo_l, ptgb_logo_lTiles, ptgb_logo_lTilesLen, curr_tile_id, LOGO_PAL, ATTR0_SQUARE, ATTR1_SIZE_64x64, 1);
load_sprite(ptgb_logo_r, ptgb_logo_rTiles, ptgb_logo_rTilesLen, curr_tile_id, LOGO_PAL, ATTR0_SQUARE, ATTR1_SIZE_64x64, 1);
load_sprite(btn_t_l, btn_t_lTiles, btn_t_lTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_t_r, btn_t_rTiles, btn_t_rTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_p_l, btn_p_lTiles, btn_p_lTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_p_r, btn_p_rTiles, btn_p_rTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_c_l, btn_c_lTiles, btn_c_lTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_c_r, btn_c_rTiles, btn_c_rTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_d_l, btn_d_lTiles, btn_d_lTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_d_r, btn_d_rTiles, btn_d_rTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(button_yes, button_yesTiles, button_yesTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(button_no, button_noTiles, button_noTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(cart_label, &Label_GreenTiles[8], Label_GreenTilesLen - 32, curr_tile_id, CART_PAL, ATTR0_SQUARE, ATTR1_SIZE_32x32, 1);
load_sprite(cart_label, &Label_GreenTiles[8], Label_GreenTilesLen - 32, curr_tile_id, GB_CART_PAL, ATTR0_SQUARE, ATTR1_SIZE_32x32, 1);
load_sprite(point_arrow, &arrowsTiles[32], 32, curr_tile_id, BTN_PAL, ATTR0_SQUARE, ATTR1_SIZE_8x8, 1);
load_sprite(down_arrow, &arrowsTiles[0], 64, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_16x8, 1);
load_sprite(up_arrow, &arrowsTiles[16], 64, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_16x8, 1);
load_sprite(link_frame1, link_frame1Tiles, link_frame1TilesLen, curr_tile_id, LINK_CABLE_PAL, ATTR0_SQUARE, ATTR1_SIZE_32x32, 1);
load_sprite(link_frame2, link_frame2Tiles, link_frame2TilesLen, curr_tile_id, LINK_CABLE_PAL, ATTR0_WIDE, ATTR1_SIZE_8x32, 1);
load_sprite(link_frame3, link_frame3Tiles, link_frame3TilesLen, curr_tile_id, LINK_CABLE_PAL, ATTR0_WIDE, ATTR1_SIZE_16x32, 1);
load_sprite(link_blob1, &link_blobsTiles[0], 32, curr_tile_id, LINK_CABLE_PAL, ATTR0_SQUARE, ATTR1_SIZE_8x8, 1);
load_sprite(link_blob2, &link_blobsTiles[8], 32, curr_tile_id, LINK_CABLE_PAL, ATTR0_SQUARE, ATTR1_SIZE_8x8, 1);
load_sprite(link_blob3, &link_blobsTiles[16], 32, curr_tile_id, LINK_CABLE_PAL, ATTR0_SQUARE, ATTR1_SIZE_8x8, 1);
global_tile_id_end = curr_tile_id;
obj_set_pos(down_arrow, 14 * 8, 17 * 8);
obj_set_pos(up_arrow, 14 * 8, 3 * 8);
global_tile_id_end = curr_tile_id;
}
void load_temp_box_sprites(Pokemon_Party party_data)
@ -296,16 +317,23 @@ void load_temp_box_sprites(Pokemon_Party party_data)
{
if (party_data.get_simple_pkmn(i).is_valid || SHOW_INVALID_PKMN)
{
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);
Simplified_Pokemon curr_pkmn = party_data.get_simple_pkmn(i);
int dex_num = curr_pkmn.dex_number;
if (dex_num == 201)
{
dex_num = 252 + curr_pkmn.unown_letter;
}
load_sprite(party_sprites[i], &unique_duel_frame_menu_spritesTiles[dex_num * 32], 256, curr_tile_id, MENU_SPRITE_PALS[dex_num][curr_pkmn.is_shiny] + MENU_PAL_START, 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, 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_cancel_right, button_edgeTiles, button_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);
load_sprite(button_confirm_right, button_edgeTiles, button_edgeTilesLen, curr_tile_id, BTN_PAL, ATTR0_TALL, ATTR1_SIZE_8x32, 1);
}
void load_type_sprites(int pkmn_index, int dex_offset, bool is_caught)
@ -345,18 +373,19 @@ void load_sprite(OBJ_ATTR *sprite, const unsigned int objTiles[], int objTilesLe
obj_hide(sprite);
};
void load_cart(int game_id, int lang)
void load_select_sprites(int game_id, int lang)
{
u32 curr_tile_id = global_tile_id_end;
// Alpha Shadow Main Color Grey Black Mid
const unsigned short jpn_gb_pal[6] = {RGB(0, 0, 0), RGB(10, 9, 10), RGB(17, 17, 17), RGB(22, 22, 22), RGB(0, 0, 0), RGB(14, 13, 14)};
const unsigned short eng_red_pal[6] = {RGB(0, 0, 0), RGB(16, 1, 0), RGB(27, 6, 5), RGB(22, 22, 22), RGB(0, 0, 0), RGB(23, 3, 2)};
const unsigned short eng_blue_pal[6] = {RGB(0, 0, 0), RGB(0, 4, 16), RGB(5, 10, 24), RGB(22, 22, 22), RGB(0, 0, 0), RGB(1, 6, 20)};
const unsigned short eng_yellow_pal[6] = {RGB(0, 0, 0), RGB(18, 12, 0), RGB(27, 21, 5), RGB(22, 22, 22), RGB(0, 0, 0), RGB(22, 16, 1)};
const unsigned short eng_gold_pal[6] = {RGB(0, 0, 0), RGB(13, 10, 2), RGB(22, 18, 8), RGB(22, 22, 22), RGB(0, 0, 0), RGB(17, 14, 4)};
const unsigned short eng_silver_pal[6] = {RGB(0, 0, 0), RGB(11, 12, 14), RGB(20, 22, 23), RGB(22, 22, 22), RGB(0, 0, 0), RGB(15, 16, 19)};
const unsigned short crystal_pal[6] = {RGB(0, 0, 0), RGB(9, 13, 17), RGB(16, 21, 25), RGB(22, 22, 22), RGB(0, 0, 0), RGB(12, 17, 22)};
const unsigned short jpn_gold_pal[6] = {RGB(0, 0, 0), RGB(0, 0, 0), RGB(5, 7, 12), RGB(22, 22, 22), RGB(0, 0, 0), RGB(3, 4, 8)};
const unsigned short jpn_silver_pal[6] = {RGB(0, 0, 0), RGB(5, 4, 5), RGB(11, 10, 10), RGB(22, 22, 22), RGB(0, 0, 0), RGB(8, 7, 7)};
const unsigned short jpn_gb_pal[6] = {RGB15(0, 0, 0), RGB15(10, 9, 10), RGB15(17, 17, 17), RGB15(22, 22, 22), RGB15(0, 0, 0), RGB15(14, 13, 14)};
const unsigned short eng_red_pal[6] = {RGB15(0, 0, 0), RGB15(16, 1, 0), RGB15(27, 6, 5), RGB15(22, 22, 22), RGB15(0, 0, 0), RGB15(23, 3, 2)};
const unsigned short eng_blue_pal[6] = {RGB15(0, 0, 0), RGB15(0, 4, 16), RGB15(5, 10, 24), RGB15(22, 22, 22), RGB15(0, 0, 0), RGB15(1, 6, 20)};
const unsigned short eng_yellow_pal[6] = {RGB15(0, 0, 0), RGB15(18, 12, 0), RGB15(27, 21, 5), RGB15(22, 22, 22), RGB15(0, 0, 0), RGB15(22, 16, 1)};
const unsigned short eng_gold_pal[6] = {RGB15(0, 0, 0), RGB15(13, 10, 2), RGB15(22, 18, 8), RGB15(22, 22, 22), RGB15(0, 0, 0), RGB15(17, 14, 4)};
const unsigned short eng_silver_pal[6] = {RGB15(0, 0, 0), RGB15(11, 12, 14), RGB15(20, 22, 23), RGB15(22, 22, 22), RGB15(0, 0, 0), RGB15(15, 16, 19)};
const unsigned short crystal_pal[6] = {RGB15(0, 0, 0), RGB15(9, 13, 17), RGB15(16, 21, 25), RGB15(22, 22, 22), RGB15(0, 0, 0), RGB15(12, 17, 22)};
const unsigned short jpn_gold_pal[6] = {RGB15(0, 0, 0), RGB15(0, 0, 0), RGB15(5, 7, 12), RGB15(22, 22, 22), RGB15(0, 0, 0), RGB15(3, 4, 8)};
const unsigned short jpn_silver_pal[6] = {RGB15(0, 0, 0), RGB15(5, 4, 5), RGB15(11, 10, 10), RGB15(22, 22, 22), RGB15(0, 0, 0), RGB15(8, 7, 7)};
const unsigned int *label_tiles = 0;
const unsigned short *label_palette = 0;
@ -460,26 +489,17 @@ void load_cart(int game_id, int lang)
cart_palette = crystal_pal;
break;
}
u32 curr_tile_id = global_tile_id_end;
memcpy(pal_obj_mem + (CART_PAL * 16), cart_palette, 12);
memcpy(pal_obj_mem + (CART_PAL * 16) + 6, label_palette + 6, 20);
load_sprite(cart_shell, cart_tiles, GB_ShellTilesLen, curr_tile_id, CART_PAL, ATTR0_SQUARE, ATTR1_SIZE_64x64, 1);
load_sprite(cart_label, &label_tiles[8], Label_GreenTilesLen - 32, curr_tile_id, CART_PAL, ATTR0_SQUARE, ATTR1_SIZE_32x32, 1);
int y_offset = sin((get_frame_count() * 4) % 360 * (3.1415 / 180)) * 5;
memcpy(pal_obj_mem + (GB_CART_PAL * 16), cart_palette, 12);
memcpy(pal_obj_mem + (GB_CART_PAL * 16) + 6, label_palette + 6, 20);
load_sprite(cart_shell, cart_tiles, GB_ShellTilesLen, curr_tile_id, GB_CART_PAL, ATTR0_SQUARE, ATTR1_SIZE_64x64, 1);
load_sprite(cart_label, &label_tiles[8], Label_GreenTilesLen - 32, curr_tile_id, GB_CART_PAL, ATTR0_SQUARE, ATTR1_SIZE_32x32, 1);
obj_set_pos(cart_shell, (8 * 12) + 4, (8 * 4) + 11 + y_offset);
obj_set_pos(cart_label, (8 * 12) + 4 + 8, (8 * 4) + 11 + 13 + y_offset);
obj_unhide(cart_shell, 0);
obj_unhide(cart_label, 0);
}
void load_flag(int lang_id)
{
u32 curr_tile_id = global_tile_id_end;
const unsigned int *flag_tiles = 0;
const unsigned short *flag_palette = 0;
switch (lang_id)
switch (lang)
{
case JPN_ID:
flag_tiles = flag_jpnTiles;
@ -513,7 +533,133 @@ void load_flag(int lang_id)
load_sprite(flag, flag_tiles, flag_jpnTilesLen, curr_tile_id, FLAG_PAL, ATTR0_WIDE, ATTR1_SIZE_32x64, 1);
memcpy(pal_obj_mem + (FLAG_PAL * 16), flag_palette, 16); // Grit is being stupid.
int y_offset = sin((get_frame_count() * 4) % 360 * (3.1415 / 180)) * 5;
obj_set_pos(flag, (8 * 12) + 4, (8 * 4) + 19 + y_offset);
obj_unhide(flag, 0);
const unsigned int *gba_cart_tiles = 0;
const unsigned short *gba_cart_palette = 0;
switch (curr_rom.gamecode)
{
case RUBY_ID:
gba_cart_tiles = ruby_cartTiles;
gba_cart_palette = ruby_cartPal;
break;
case SAPPHIRE_ID:
gba_cart_tiles = sapphire_cartTiles;
gba_cart_palette = sapphire_cartPal;
break;
case FIRERED_ID:
gba_cart_tiles = fr_cartTiles;
gba_cart_palette = fr_cartPal;
break;
case LEAFGREEN_ID:
gba_cart_tiles = lg_cartTiles;
gba_cart_palette = lg_cartPal;
break;
case EMERALD_ID:
gba_cart_tiles = lg_cartTiles;
gba_cart_palette = lg_cartPal;
break;
}
load_sprite(gba_cart, gba_cart_tiles, 1024, curr_tile_id, GBA_CART_PAL, ATTR0_WIDE, ATTR1_SIZE_32x64, 1);
memcpy(pal_obj_mem + (GBA_CART_PAL * 16), gba_cart_palette, 32);
}
// tile ID, VH Flip, Palette Bank
#define FEN_BLI_L00 (34 | (0b00 << 0xA) | (2 << 0xC))
#define FEN_BLI_L01 (35 | (0b00 << 0xA) | (2 << 0xC))
#define FEN_BLI_L10 (140 | (0b00 << 0xA) | (2 << 0xC))
#define FEN_BLI_L11 (141 | (0b00 << 0xA) | (2 << 0xC))
#define FEN_BLI_L20 (143 | (0b00 << 0xA) | (2 << 0xC))
#define FEN_BLI_L21 (144 | (0b00 << 0xA) | (2 << 0xC))
#define FEN_BLI_R0 (37 | (0b00 << 0xA) | (2 << 0xC))
#define FEN_BLI_R1 (142 | (0b00 << 0xA) | (2 << 0xC))
#define FEN_BLI_R2 (145 | (0b00 << 0xA) | (2 << 0xC))
void fennel_blink(int frame)
{
int SBB = 15; // SSB is the array of which tile goes where
switch (frame)
{
case 0:
se_mem[SBB][12 + (5 * 32)] = FEN_BLI_L20;
se_mem[SBB][13 + (5 * 32)] = FEN_BLI_L21;
se_mem[SBB][15 + (5 * 32)] = FEN_BLI_R2;
break;
case 1:
case 3:
se_mem[SBB][12 + (5 * 32)] = FEN_BLI_L10;
se_mem[SBB][13 + (5 * 32)] = FEN_BLI_L11;
se_mem[SBB][15 + (5 * 32)] = FEN_BLI_R1;
break;
case 2:
se_mem[SBB][12 + (5 * 32)] = FEN_BLI_L00;
se_mem[SBB][13 + (5 * 32)] = FEN_BLI_L01;
se_mem[SBB][15 + (5 * 32)] = FEN_BLI_R0;
break;
}
}
// tile ID, VH Flip, Palette Bank
#define FEN_SPE_00 (46 | (0b00 << 0xA) | (2 << 0xC))
#define FEN_SPE_01 (56 | (0b00 << 0xA) | (2 << 0xC))
#define FEN_SPE_10 (146 | (0b00 << 0xA) | (2 << 0xC))
#define FEN_SPE_11 (56 | (0b00 << 0xA) | (2 << 0xC))
#define FEN_SPE_20 (147 | (0b00 << 0xA) | (2 << 0xC))
#define FEN_SPE_21 (149 | (0b00 << 0xA) | (2 << 0xC))
#define FEN_SPE_30 (148 | (0b00 << 0xA) | (2 << 0xC))
#define FEN_SPE_31 (150 | (0b00 << 0xA) | (2 << 0xC))
void fennel_speak(int frame)
{
int SBB = 15; // SSB is the array of which tile goes where
switch (frame)
{
case 0:
se_mem[SBB][14 + (6 * 32)] = FEN_SPE_00;
se_mem[SBB][14 + (7 * 32)] = FEN_SPE_01;
break;
case 1:
se_mem[SBB][14 + (6 * 32)] = FEN_SPE_10;
se_mem[SBB][14 + (7 * 32)] = FEN_SPE_11;
break;
case 2:
case 4:
se_mem[SBB][14 + (6 * 32)] = FEN_SPE_20;
se_mem[SBB][14 + (7 * 32)] = FEN_SPE_21;
break;
case 3:
se_mem[SBB][14 + (6 * 32)] = FEN_SPE_30;
se_mem[SBB][14 + (7 * 32)] = FEN_SPE_31;
break;
}
}
int get_curr_flex_background()
{
return curr_flex_background;
}
void update_y_offset()
{
if (y_offset_timer == 0)
{
y_offset += y_offset_direction;
if (y_offset == 6 || y_offset == 2)
{
y_offset_timer = 6;
}
else
{
y_offset_timer = 4;
}
}
if (y_offset == 8 || y_offset == 0)
{
y_offset_direction *= -1;
y_offset += y_offset_direction;
y_offset_timer = 12;
}
y_offset_timer--;
obj_set_pos(cart_shell, (8 * 12) + 4, (8 * 4) + 11 + y_offset);
obj_set_pos(cart_label, (8 * 12) + 4 + 8, (8 * 4) + 11 + 13 + y_offset);
obj_set_pos(flag, (8 * 12) + 4, (8 * 4) + 19 + y_offset);
}

View File

@ -7,7 +7,8 @@
#include "pkmn_font.h"
#include "script_array.h"
#include "debug_mode.h"
#include "main_menu.h"
#include "button_menu.h"
#include "sprite_data.h"
#define TEXT_CBB 3
#define TEXT_SBB 28
@ -26,8 +27,7 @@ void init_text_engine()
tte_set_pos(LEFT, TOP);
pal_bg_bank[13][15] = CLR_WHITE;
pal_bg_bank[14][15] = 0b0000001001111111;
pal_bg_bank[15][15] = 0b0001100011100110;
pal_bg_bank[15][15] = 0b0000110001100010;
// Set default variables
char_index = 0;
@ -71,6 +71,10 @@ int text_loop(int script)
}
tte_erase_rect(LEFT, TOP, RIGHT, BOTTOM);
tte_write(curr_text.substr(0, char_index).c_str());
if (get_curr_flex_background() == BG_FENNEL)
{
fennel_speak(((char_index / 4) % 4) + 1);
}
}
}
else
@ -99,6 +103,10 @@ int text_loop(int script)
}
char_index = 0;
}
if (get_curr_flex_background() == BG_FENNEL)
{
fennel_speak(0);
}
}
if (text_exit)
{

View File

@ -1 +1 @@
nm --size-sort Poke_Transporter_GB_mb.elf > Poke_Transporter_GB_mb.sym
objdump -t Poke_Transporter_GB_mb.elf > Poke_Transporter_GB_mb.sym