mirror of
https://github.com/GearsProgress/Poke_Transporter_GB.git
synced 2026-03-21 17:34:42 -05:00
Beginning langauge selection menu and char arrays
This commit is contained in:
parent
91268c2b35
commit
18b9815327
3
graphics/btn_d_l.grit
Normal file
3
graphics/btn_d_l.grit
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#
|
||||
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
|
||||
-gB4 -ps32 -pe48
|
||||
BIN
graphics/btn_d_l.png
Normal file
BIN
graphics/btn_d_l.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 932 B |
3
graphics/btn_d_r.grit
Normal file
3
graphics/btn_d_r.grit
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#
|
||||
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
|
||||
-gB4 -ps32 -pe48
|
||||
BIN
graphics/btn_d_r.png
Normal file
BIN
graphics/btn_d_r.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 927 B |
|
|
@ -2,8 +2,8 @@
|
|||
#define DEBUG_MODE_H
|
||||
|
||||
#define DEBUG_MODE true
|
||||
#define DEBUG_GAME LEAFGREEN_ID
|
||||
#define DEBUG_VERS VERS_1_1
|
||||
#define DEBUG_GAME EMERALD_ID
|
||||
#define DEBUG_VERS VERS_1_0
|
||||
// This is literally it. Yay.
|
||||
|
||||
#endif
|
||||
|
|
@ -8,14 +8,17 @@
|
|||
#define MAIN_MENU 0
|
||||
#define TRANSFER 1
|
||||
#define POKEDEX 2
|
||||
#define CREDITS 3
|
||||
#define LANGUAGE 3
|
||||
#define CREDITS 4
|
||||
|
||||
#define BUTTON_ARRAY_SIZE 5
|
||||
|
||||
#define NO_ANI 0
|
||||
#define ENTERING -1
|
||||
#define EXITING -2
|
||||
#define DISABLE -3
|
||||
|
||||
void main_menu_init(Button transfer, Button pokedex, Button credits);
|
||||
void main_menu_init(Button transfer, Button pokedex, Button credits, Button language);
|
||||
int main_menu_loop();
|
||||
void main_menu_enter();
|
||||
void main_menu_exit();
|
||||
|
|
|
|||
|
|
@ -6,9 +6,20 @@
|
|||
|
||||
#define POKEMON_SIZE 80
|
||||
|
||||
// How much trade data is sent for each langauge and generation,
|
||||
// sarts at OT name and ends after the 3 buffer bytes
|
||||
#define GEN1_JPN_SIZE 353
|
||||
#define GEN1_INT_SIZE 418
|
||||
#define GEN2_JPN_SIZE 0
|
||||
#define GEN2_INT_SIZE 444
|
||||
|
||||
class Pokemon
|
||||
{
|
||||
public:
|
||||
int pkmn_size = 0;
|
||||
int ot_and_party = 0;
|
||||
int ot_size = 0;
|
||||
int nickname_size = 0;
|
||||
Pokemon();
|
||||
void load_data(int index, byte *party_data);
|
||||
void convert_to_gen_three();
|
||||
|
|
@ -16,16 +27,18 @@ public:
|
|||
void alocate_data_chunks(byte *G, byte *A, byte *E, byte *M);
|
||||
void insert_data(byte *first, byte *second, byte *third, byte *fourth);
|
||||
byte get_gen_3_data(int index);
|
||||
byte* get_full_gen_3_array();
|
||||
byte *get_full_gen_3_array();
|
||||
byte get_unencrypted_data(int index);
|
||||
byte* convert_text(byte *text_array, int size, int gen);
|
||||
byte *convert_text(byte *text_array, int size, int gen);
|
||||
u32 generate_pid(byte pid_species_index, byte nature, byte *pid_ivs);
|
||||
byte rand_reverse_mod(byte modulo_divisor, byte target_mod);
|
||||
byte get_rand_gender_byte(byte index_num, byte attack_DVs);
|
||||
|
||||
|
||||
private:
|
||||
byte gen = 2;
|
||||
byte species_index;
|
||||
byte species_index_party; // The species ID stored in the party. Really only used for egg detection
|
||||
byte species_index_struct; // The species ID stored in the pkmn strucutre. The main one to use.
|
||||
byte moves[4];
|
||||
byte trainer_id[2];
|
||||
byte secret_id[2];
|
||||
|
|
@ -36,8 +49,8 @@ private:
|
|||
byte caught_data[2];
|
||||
byte level;
|
||||
byte gen_3_pkmn[80];
|
||||
byte unencrypted_data[49]; // Contains the 48 GAEM bytes, along with the modulo int
|
||||
byte pid[4] = {0b00000001, 0b10101010, 0b11111111, 0b10011001}; //Little Endian, reverse of Bulbapedia
|
||||
byte unencrypted_data[49]; // Contains the 48 GAEM bytes, along with the modulo int
|
||||
byte pid[4] = {0b00000001, 0b10101010, 0b11111111, 0b10011001}; // Little Endian, reverse of Bulbapedia
|
||||
byte blank_word[4] = {0};
|
||||
byte data_section_G[12];
|
||||
byte data_section_A[12];
|
||||
|
|
@ -48,7 +61,7 @@ private:
|
|||
hword origin_info = 0;
|
||||
bool is_shiny = false;
|
||||
byte pp_values[4];
|
||||
byte pp_bonus;
|
||||
byte pp_bonus[4];
|
||||
byte pure_pp_values[4];
|
||||
byte dvs[2];
|
||||
byte ivs[6];
|
||||
|
|
|
|||
|
|
@ -12,15 +12,16 @@
|
|||
#define flux_max 1640000
|
||||
|
||||
|
||||
|
||||
extern const u8 EXP_MAX[251];
|
||||
extern const u8 EXP_MAX[252];
|
||||
extern const u32 EXP_TYPES[6];
|
||||
extern const int GENDER_THRESHOLDS[2][8];
|
||||
extern const u8 GENDER_RATIO[251];
|
||||
extern const bool NUM_ABILITIES[251];
|
||||
extern const byte MOVESETS[251][32];
|
||||
extern const byte FIRST_MOVES[251];
|
||||
extern const std::string_view NAMES[251];
|
||||
extern const u8 GENDER_RATIO[252];
|
||||
extern const bool NUM_ABILITIES[252];
|
||||
extern const byte MOVESETS[252][32];
|
||||
extern const byte FIRST_MOVES[252];
|
||||
extern const std::string_view NAMES[252];
|
||||
extern const u8 EVOLUTIONS[252];
|
||||
extern const u8 POWER_POINTS[252];
|
||||
extern const byte gen_1_index_array[191];
|
||||
extern const byte gen_1_char_array[0x80];
|
||||
extern const byte gen_2_char_array[0x80];
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public:
|
|||
|
||||
private:
|
||||
Pokemon party[6];
|
||||
byte party_data_array[444];
|
||||
byte party_data_array[GEN2_INT_SIZE + 4];
|
||||
int last_error;
|
||||
int party_size;
|
||||
int gen;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ extern OBJ_ATTR *btn_c_r;
|
|||
extern OBJ_ATTR *dex_l[];
|
||||
extern OBJ_ATTR *dex_m[];
|
||||
extern OBJ_ATTR *dex_r[];
|
||||
extern OBJ_ATTR *btn_d_l;
|
||||
extern OBJ_ATTR *btn_d_r;
|
||||
|
||||
void load_background();
|
||||
void load_textbox_background();
|
||||
|
|
@ -28,4 +30,6 @@ void load_btn_c_l();
|
|||
void load_btn_c_r();
|
||||
void load_dex_l();
|
||||
void load_dex_m();
|
||||
void load_dex_r();
|
||||
void load_dex_r();
|
||||
void load_btn_d_l();
|
||||
void load_btn_d_r();
|
||||
|
|
@ -34,25 +34,17 @@
|
|||
--------
|
||||
ACCURACY:
|
||||
- See if shiny Pokemon from gen 2 can be square shinies or if they're all normal
|
||||
- See what happens with hybrid Pokemon
|
||||
|
||||
LINK CABLE:
|
||||
- Figure out JP Green
|
||||
- Figure out JP Gen 2
|
||||
|
||||
CONVERSION:
|
||||
- Fix fateful encounter so Mew and Celebi work
|
||||
- Fix unown sometimes not being right (J becomes N)
|
||||
- Add in check for glitch Pokemon
|
||||
- Add in check for egg
|
||||
- Restrict illegal moves
|
||||
- Set full default PP points for ALL moves (and PP ups)
|
||||
- Check for duplicate moves?
|
||||
- What happens with Smeargle?
|
||||
- Check Pokerus
|
||||
- Fix egg moves only being on the baby Pokemon. TLDR anything Horsea can learn Seadra can too
|
||||
- Combine gen 1/2 intern char arrays. No reason why they should be different tbh. Make them based on char input
|
||||
- Find automatic detection for languages. Japanese is longer, while other languages only use certian characters
|
||||
- Korean is not possible, I don't think. Unless it just ignores the names, which we could do? How is the trade data different?
|
||||
|
||||
INJECTION:
|
||||
- Switch the gen 3 text conversion to the new array
|
||||
- Redo injection to be picked up like a Mystery Gift
|
||||
- Double check that returns false when PC is full BEFORE injecting
|
||||
- Fix coruption and Pokemon injection
|
||||
|
|
@ -61,6 +53,8 @@ INJECTION:
|
|||
- Enable ribbon viewing
|
||||
- Set flags for the number of Pokemon injected
|
||||
- Set Pokedex flags
|
||||
- Check what happens when the PC is full, but the last Pokemon doesn't exist (is zero)
|
||||
- Set text color for FRLG (what happens if you set it in RSE?)
|
||||
|
||||
SAVE DATA:
|
||||
- Add warning
|
||||
|
|
@ -69,8 +63,6 @@ SAVE DATA:
|
|||
|
||||
TESTING:
|
||||
- Test all the aspects of a Pokemon (Shiny, Pokerus, etc.)
|
||||
- Test invalid moves
|
||||
- Test move bubbling
|
||||
--------
|
||||
*/
|
||||
|
||||
|
|
@ -147,15 +139,18 @@ int main(void)
|
|||
load_dex_l();
|
||||
load_dex_m();
|
||||
load_dex_r();
|
||||
load_btn_d_l();
|
||||
load_btn_d_r();
|
||||
|
||||
Button transfer_btn = Button(btn_t_l, btn_t_r, 128, 160);
|
||||
Button pokedex_btn = Button(btn_p_l, btn_p_r, 192, 224);
|
||||
Button credits_btn = Button(btn_c_l, btn_c_r, 256, 288);
|
||||
Button language_btn = Button(btn_d_l, btn_d_r, 416, 448);
|
||||
|
||||
pokedex_init(); // Why does this cause the music to stop playing? Also the loop doesn't work
|
||||
|
||||
load_save_data();
|
||||
main_menu_init(transfer_btn, pokedex_btn, credits_btn);
|
||||
main_menu_init(transfer_btn, pokedex_btn, credits_btn, language_btn);
|
||||
|
||||
text_disable();
|
||||
|
||||
|
|
@ -245,6 +240,9 @@ int main(void)
|
|||
main_menu_exit();
|
||||
}
|
||||
break;
|
||||
case (LANGUAGE):
|
||||
main_menu_exit();
|
||||
break;
|
||||
case (CREDITS):
|
||||
tte_set_pos(0, 0);
|
||||
tte_write("wow cool credits man");
|
||||
|
|
@ -260,7 +258,7 @@ int main(void)
|
|||
rand_next_frame();
|
||||
background_frame();
|
||||
text_next_frame();
|
||||
oam_copy(oam_mem, obj_buffer, 26);
|
||||
oam_copy(oam_mem, obj_buffer, 28);
|
||||
|
||||
VBlankIntrWait();
|
||||
//mmFrame(); //Music
|
||||
|
|
|
|||
|
|
@ -8,18 +8,21 @@ int menu_mode = MAIN_MENU;
|
|||
int ani_mode = 0;
|
||||
int menu_x_cord = 128;
|
||||
|
||||
Button button_array[4];
|
||||
Button button_array[BUTTON_ARRAY_SIZE];
|
||||
|
||||
void main_menu_init(Button nTransfer, Button nPokedex, Button nCredits)
|
||||
void main_menu_init(Button nTransfer, Button nPokedex, Button nCredits, Button nLanguage)
|
||||
{
|
||||
button_array[TRANSFER] = nTransfer;
|
||||
button_array[POKEDEX] = nPokedex;
|
||||
button_array[LANGUAGE] = nLanguage;
|
||||
button_array[CREDITS] = nCredits;
|
||||
button_array[TRANSFER].set_location(128, 16);
|
||||
button_array[POKEDEX].set_location(128, 64);
|
||||
button_array[CREDITS].set_location(128, 112);
|
||||
button_array[TRANSFER].set_location(128, 7 + (38 * (TRANSFER - 1)));
|
||||
button_array[POKEDEX].set_location(128, 7 + (38 * (POKEDEX - 1)));
|
||||
button_array[LANGUAGE].set_location(128, 7 + (38 * (LANGUAGE - 1)));
|
||||
button_array[CREDITS].set_location(128, 7 + (38 * (CREDITS - 1)));
|
||||
button_array[TRANSFER].show();
|
||||
button_array[POKEDEX].show();
|
||||
button_array[LANGUAGE].show();
|
||||
button_array[CREDITS].show();
|
||||
}
|
||||
|
||||
|
|
@ -30,9 +33,9 @@ int main_menu_loop()
|
|||
case ENTERING:
|
||||
{
|
||||
menu_x_cord = menu_x_cord + 4;
|
||||
for (int i = 1; i < 4; i++)
|
||||
for (int i = 1; i < (BUTTON_ARRAY_SIZE + 1); i++)
|
||||
{
|
||||
button_array[i].set_location(menu_x_cord, 16 + (48 * (i - 1)));
|
||||
button_array[i].set_location(menu_x_cord, 7 + (38 * (i - 1)));
|
||||
}
|
||||
if (menu_x_cord > 240)
|
||||
{
|
||||
|
|
@ -43,9 +46,9 @@ int main_menu_loop()
|
|||
case EXITING:
|
||||
{
|
||||
menu_x_cord = menu_x_cord - 4;
|
||||
for (int i = 1; i < 4; i++)
|
||||
for (int i = 1; i < (BUTTON_ARRAY_SIZE + 1); i++)
|
||||
{
|
||||
button_array[i].set_location(menu_x_cord, 16 + (48 * (i - 1)));
|
||||
button_array[i].set_location(menu_x_cord, 7 + (38 * (i - 1)));
|
||||
}
|
||||
if (menu_x_cord <= 128)
|
||||
{
|
||||
|
|
@ -57,7 +60,7 @@ int main_menu_loop()
|
|||
{
|
||||
if (key_hit(KEY_DOWN))
|
||||
{
|
||||
if (menu_slot != CREDITS)
|
||||
if (menu_slot != (BUTTON_ARRAY_SIZE - 1))
|
||||
{
|
||||
menu_slot++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,35 +3,78 @@
|
|||
#include "pokemon_data.h"
|
||||
#include "random.h"
|
||||
|
||||
#define name_size 11
|
||||
|
||||
Pokemon::Pokemon(){};
|
||||
|
||||
void Pokemon::load_data(int index, byte *party_data)
|
||||
{
|
||||
int pkmn_size;
|
||||
int ot_and_party;
|
||||
if (party_data[418] == 0xFD && party_data[419] == 0xFD && party_data[420] == 0xFD && party_data[421] == 0xFD){
|
||||
if (party_data[GEN1_JPN_SIZE + 0] == 0xFD &&
|
||||
party_data[GEN1_JPN_SIZE + 1] == 0xFD &&
|
||||
party_data[GEN1_JPN_SIZE + 2] == 0xFD &&
|
||||
party_data[GEN1_JPN_SIZE + 3] == 0xFD)
|
||||
{
|
||||
gen = 1;
|
||||
pkmn_size = 44;
|
||||
ot_and_party = 14;
|
||||
ot_size = 6;
|
||||
nickname_size = 6;
|
||||
}
|
||||
else if (party_data[GEN1_INT_SIZE + 0] == 0xFD &&
|
||||
party_data[GEN1_INT_SIZE + 1] == 0xFD &&
|
||||
party_data[GEN1_INT_SIZE + 2] == 0xFD &&
|
||||
party_data[GEN1_INT_SIZE + 3] == 0xFD)
|
||||
{
|
||||
gen = 1;
|
||||
pkmn_size = 44;
|
||||
ot_and_party = 19;
|
||||
} else {
|
||||
ot_size = 11;
|
||||
nickname_size = 11;
|
||||
}
|
||||
/*
|
||||
else if (party_data[GEN2_JPN_SIZE + 0] == 0xFD &&
|
||||
party_data[GEN2_JPN_SIZE + 1] == 0xFD &&
|
||||
party_data[GEN2_JPN_SIZE + 2] == 0xFD &&
|
||||
party_data[GEN2_JPN_SIZE + 3] == 0xFD)
|
||||
{
|
||||
// DOUBLE CHECK THIS
|
||||
gen = 2;
|
||||
pkmn_size = 48;
|
||||
ot_and_party = 17;
|
||||
ot_size = 6;
|
||||
nickname_size = 6;
|
||||
}*/
|
||||
else if (party_data[GEN2_INT_SIZE + 0] == 0xFD &&
|
||||
party_data[GEN2_INT_SIZE + 1] == 0xFD &&
|
||||
party_data[GEN2_INT_SIZE + 2] == 0xFD &&
|
||||
party_data[GEN2_INT_SIZE + 3] == 0xFD)
|
||||
{
|
||||
gen = 2;
|
||||
pkmn_size = 48;
|
||||
ot_and_party = 21;
|
||||
ot_size = 11;
|
||||
nickname_size = 11;
|
||||
}
|
||||
else
|
||||
{
|
||||
tte_erase_screen();
|
||||
tte_write("An unexpected error has occured. Please contact the developer");
|
||||
while (true)
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
int party_offset = ot_and_party + (index * pkmn_size);
|
||||
int ot_offset = ot_and_party + (6 * pkmn_size) + (index * name_size);
|
||||
int name_offset = ot_and_party + (6 * pkmn_size) + (6 * name_size) + (index * name_size);
|
||||
int ot_offset = ot_and_party + (6 * pkmn_size) + (index * ot_size);
|
||||
int nickname_offset = ot_and_party + (6 * pkmn_size) + (6 * ot_size) + (index * nickname_size);
|
||||
|
||||
switch (gen)
|
||||
{
|
||||
case 1:
|
||||
species_index = gen_1_index_array[party_data[party_offset + 0x00]];
|
||||
species_index_party = gen_1_index_array[party_data[ot_size + 1 + index]];
|
||||
species_index_struct = gen_1_index_array[party_data[party_offset + 0x00]];
|
||||
copy_from_to(&party_data[party_offset + 0x08], &moves[0], 4, false);
|
||||
copy_from_to(&party_data[party_offset + 0x0C], &trainer_id[0], 2, false);
|
||||
copy_from_to(&party_data[party_offset + 0x0E], &exp[0], 3, true);
|
||||
copy_from_to(&party_data[name_offset], &nickname[0], 10, false);
|
||||
copy_from_to(&party_data[nickname_offset], &nickname[0], 10, false);
|
||||
copy_from_to(&party_data[ot_offset + 0x00], &trainer_name[0], 7, false);
|
||||
copy_from_to(&party_data[party_offset + 0x1B], &dvs[0], 2, false);
|
||||
copy_from_to(&party_data[party_offset + 0x1D], &pp_values[0], 4, false);
|
||||
|
|
@ -41,11 +84,12 @@ void Pokemon::load_data(int index, byte *party_data)
|
|||
level = party_data[party_offset + 0x21];
|
||||
break;
|
||||
case 2:
|
||||
species_index = party_data[party_offset + 0x00];
|
||||
species_index_party = party_data[ot_size + 1 + index];
|
||||
species_index_struct = party_data[party_offset + 0x00];
|
||||
copy_from_to(&party_data[party_offset + 0x02], &moves[0], 4, false);
|
||||
copy_from_to(&party_data[party_offset + 0x06], &trainer_id[0], 2, false);
|
||||
copy_from_to(&party_data[party_offset + 0x08], &exp[0], 3, true);
|
||||
copy_from_to(&party_data[name_offset], &nickname[0], 10, false);
|
||||
copy_from_to(&party_data[nickname_offset], &nickname[0], 10, false);
|
||||
copy_from_to(&party_data[ot_offset + 0x00], &trainer_name[0], 7, false);
|
||||
copy_from_to(&party_data[party_offset + 0x15], &dvs[0], 2, false);
|
||||
copy_from_to(&party_data[party_offset + 0x17], &pp_values[0], 4, false);
|
||||
|
|
@ -58,57 +102,81 @@ void Pokemon::load_data(int index, byte *party_data)
|
|||
|
||||
void Pokemon::convert_to_gen_three()
|
||||
{
|
||||
if (species_index_struct > 251 || // Checks if the Pokemon is beyond Celebi
|
||||
species_index_struct == 0 || // Checks that the Pokemon isn't a blank party space
|
||||
species_index_struct != species_index_party) // Checks that the Pokemon isn't a hybrid or an egg
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Generate PID
|
||||
u32 n_pid = generate_pid(species_index, *(vu32 *)exp % 25, &dvs[0]);
|
||||
u32 n_pid = generate_pid(species_index_struct, *(vu32 *)exp % 25, &dvs[0]);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
pid[i] = (n_pid >> (i * 8)) & 0xFF;
|
||||
}
|
||||
|
||||
// Make sure Level is not over 100 based on EXP
|
||||
if (*(vu32 *)exp > get_max_exp(species_index))
|
||||
if (*(vu32 *)exp > get_max_exp(species_index_struct))
|
||||
{
|
||||
*(vu32 *)exp = get_max_exp(species_index);
|
||||
*(vu32 *)exp = get_max_exp(species_index_struct);
|
||||
}
|
||||
|
||||
// Separate the PP Up values from the Move PP values
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
pure_pp_values[i] = (pp_values[i] & 0b00111111);
|
||||
pp_bonus |= (pp_values[i] & 0b11000000) >> (6 - i * 2);
|
||||
pure_pp_values[i] = (pp_values[i] & 0b00111111); // Take only the bottom six bits
|
||||
pp_bonus[i] = (pp_values[i] >> 6); // Take only the top two bits
|
||||
}
|
||||
|
||||
// Check that the moves are valid
|
||||
for (int i = 0; i < 4; i++){
|
||||
if((!can_learn_move(species_index, moves[i])) && (moves[i] != 0)){
|
||||
moves[i] = 12;
|
||||
if (species_index_struct != 0xEB) // Ignore Smeargle due to Sketch
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if ((!can_learn_move(species_index_struct, moves[i])) && (moves[i] != 0))
|
||||
{
|
||||
moves[i] = 0; // Remove the move
|
||||
pp_bonus[i] = 0; // Remove the PP bonus
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure it has at least one move
|
||||
if (moves[0] + moves[1] + moves[2] + moves[3] == 0){
|
||||
moves[0] = get_earliest_move(species_index);
|
||||
if (moves[0] + moves[1] + moves[2] + moves[3] == 0)
|
||||
{
|
||||
moves[0] = get_earliest_move(species_index_struct);
|
||||
}
|
||||
|
||||
/*
|
||||
// Bubble valid moves to the top
|
||||
int i, j;
|
||||
bool swapped;
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
swapped = false;
|
||||
for (j = 0; j < 3 - i; j++) {
|
||||
if ((moves[j] < moves[j + 1]) && moves[j] == 0) {
|
||||
for (j = 0; j < 3 - i; j++)
|
||||
{
|
||||
if ((moves[j] < moves[j + 1]) && moves[j] == 0)
|
||||
{
|
||||
// Move the move *and* PP bonus up if there is a blank space
|
||||
moves[j] = moves[j + 1];
|
||||
pp_bonus[j] = pp_bonus[j + 1];
|
||||
moves[j + 1] = 0;
|
||||
pp_bonus[j + 1] = 0;
|
||||
swapped = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If no two elements were swapped
|
||||
// by inner loop, then break
|
||||
if (swapped == false)
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
|
||||
// Restore the PP values
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
pure_pp_values[i] = POWER_POINTS[moves[i]] + ((POWER_POINTS[moves[i]] / 5) * pp_bonus[i]);
|
||||
}
|
||||
|
||||
// Convert and set IVs
|
||||
int hp_iv = 0;
|
||||
|
|
@ -127,7 +195,7 @@ void Pokemon::convert_to_gen_three()
|
|||
}
|
||||
|
||||
// Determine and set Ability
|
||||
iv_egg_ability |= ((pid[0] & 0x1) ? get_num_abilities(species_index) : 0) << 31;
|
||||
iv_egg_ability |= ((pid[0] & 0x1) ? get_num_abilities(species_index_struct) : 0) << 31;
|
||||
|
||||
// Origin info
|
||||
origin_info |= ((caught_data[0] & 0b10000000) << 8); // OT gender - We would shift left 15 bits, but the bit is already shifted over 7
|
||||
|
|
@ -136,19 +204,17 @@ void Pokemon::convert_to_gen_three()
|
|||
origin_info |= level; // Level met
|
||||
|
||||
// Ribbons and Obedience
|
||||
ribbons[2] |= 0b00000100; // Artist Ribbon
|
||||
if (species_index == 151 || species_index == 251) // Checks for Mew or Celebi
|
||||
ribbons[3] |= 0x10000000; // Fateful Encounter flag
|
||||
|
||||
// ribbons[2] |= 0b00000100; // Artist Ribbon
|
||||
ribbons[3] |= 0b10000000; // Fateful Encounter flag
|
||||
// Personality Value
|
||||
copy_from_to(&pid[0], &gen_3_pkmn[0], 4, false);
|
||||
// Trainer ID
|
||||
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
|
||||
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] & 0b11000000) >> 6) | (((dvs[0] & 0b00110000) >> 2) > 7))) // Reorganizes the Attack DV bits so that they will be >7 if the Pokemon is shiny
|
||||
{
|
||||
secret_id[0] = trainer_id[0] ^ pid[0] ^ pid[2] ^ 0xFF;
|
||||
|
|
@ -174,10 +240,10 @@ void Pokemon::convert_to_gen_three()
|
|||
// ???
|
||||
|
||||
// Data:
|
||||
data_section_G[0] = species_index;
|
||||
data_section_G[0] = species_index_struct;
|
||||
data_section_G[1] = 0x00; // Species Index, check for glitch Pokemon
|
||||
copy_from_to(&exp[0], &data_section_G[4], 3, false);
|
||||
data_section_G[8] = pp_bonus;
|
||||
data_section_G[8] = (pp_bonus[0] << 0 | pp_bonus[1] << 2 | pp_bonus[2] << 4 | pp_bonus[3] << 6);
|
||||
|
||||
data_section_A[0] = moves[0]; // Move 1
|
||||
data_section_A[2] = moves[1]; // Move 2
|
||||
|
|
@ -424,7 +490,9 @@ u32 Pokemon::generate_pid(byte pid_species_index, byte nature, byte *pid_dvs)
|
|||
// Set Nature
|
||||
while ((new_pid % 25) != nature)
|
||||
{
|
||||
new_pid = (new_pid & 0xFFFFFF00) | ((new_pid & 0xFF) + 4);
|
||||
// Keep adding 0b100 to the PID until the nature matches
|
||||
// 0b100 ensures that the 2 LSBs are maintained, as they determine the letter
|
||||
new_pid = (new_pid & 0xFFFFFF00) | ((new_pid + 0b100) & 0xFF);
|
||||
}
|
||||
return new_pid;
|
||||
}
|
||||
|
|
@ -465,4 +533,4 @@ byte Pokemon::get_rand_gender_byte(byte index_num, byte attack_DVs)
|
|||
{
|
||||
return get_rand_range(gen3_threshold, 256);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -5,15 +5,50 @@
|
|||
#include "debug_mode.h"
|
||||
#include "script.h"
|
||||
|
||||
byte debug_party_data[444] = {
|
||||
0x8A, 0x91, 0x88, 0x92, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x06, 0x9B, 0x13, 0xA1, 0xA1, 0xA1, 0xA1, 0xFF, 0x25, 0xDA,
|
||||
|
||||
0x8B, 0x00, 0x37, 0x35, 0x21, 0x2B, 0x25, 0xDA, 0x00, 0x00, 0xA7, 0x00, 0x46, 0x00, 0x5C, 0x00, 0x44, 0x00, 0x28, 0x00, 0x46, 0xFA, 0xAA, 0x1F, 0x1E, 0x00, 0x00, 0x45, 0x00, 0x85, 0x81, 0x05, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x13, 0x00, 0x0A, 0x00, 0x09, 0x00, 0x0B, 0x00, 0x0B, 0x00, 0x0A,
|
||||
byte debug_party_data[GEN2_INT_SIZE + 4] = { // Japanese Gen 1
|
||||
0x07, 0xD8, 0xE3, 0xAB, 0x50, 0x8B,
|
||||
0x06,
|
||||
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
|
||||
0xFF,
|
||||
0x01, 0x00, 0x14, 0x00, 0x00, 0x15, 0x15, 0x2D, 0x21, 0x27, 0x00, 0x00, 0x2E, 0x75, 0x00, 0x00, 0xCA, 0x00, 0x2D, 0x00, 0x31, 0x00, 0x31, 0x00, 0x2D, 0x00, 0x41, 0x59, 0x19, 0x23, 0x1D, 0x00, 0x00, 0x06, 0x00, 0x17, 0x00, 0x0B, 0x00, 0x0D, 0x00, 0x0A, 0x00, 0x0C,
|
||||
0x02, 0x00, 0x17, 0x06, 0x00, 0x15, 0x15, 0x2D, 0x21, 0x27, 0x00, 0x00, 0x2E, 0x75, 0x00, 0x00, 0xCA, 0x00, 0x2D, 0x00, 0x31, 0x00, 0x31, 0x00, 0x2D, 0x00, 0x41, 0x59, 0x19, 0x23, 0x1D, 0x00, 0x00, 0x06, 0x00, 0x17, 0x00, 0x0B, 0x00, 0x0D, 0x00, 0x0A, 0x00, 0x0C,
|
||||
0x03, 0x00, 0x17, 0x06, 0x00, 0x15, 0x15, 0x2D, 0x21, 0x27, 0x00, 0x00, 0x2E, 0x75, 0x00, 0x00, 0xCA, 0x00, 0x2D, 0x00, 0x31, 0x00, 0x31, 0x00, 0x2D, 0x00, 0x41, 0x59, 0x19, 0x23, 0x1D, 0x00, 0x00, 0x06, 0x00, 0x17, 0x00, 0x0B, 0x00, 0x0D, 0x00, 0x0A, 0x00, 0x0C,
|
||||
0x04, 0x00, 0x17, 0x06, 0x00, 0x15, 0x15, 0x2D, 0x21, 0x27, 0x00, 0x00, 0x2E, 0x75, 0x00, 0x00, 0xCA, 0x00, 0x2D, 0x00, 0x31, 0x00, 0x31, 0x00, 0x2D, 0x00, 0x41, 0x59, 0x19, 0x23, 0x1D, 0x00, 0x00, 0x06, 0x00, 0x17, 0x00, 0x0B, 0x00, 0x0D, 0x00, 0x0A, 0x00, 0x0C,
|
||||
0x05, 0x00, 0x17, 0x06, 0x00, 0x15, 0x15, 0x2D, 0x21, 0x27, 0x00, 0x00, 0x2E, 0x75, 0x00, 0x00, 0xCA, 0x00, 0x2D, 0x00, 0x31, 0x00, 0x31, 0x00, 0x2D, 0x00, 0x41, 0x59, 0x19, 0x23, 0x1D, 0x00, 0x00, 0x06, 0x00, 0x17, 0x00, 0x0B, 0x00, 0x0D, 0x00, 0x0A, 0x00, 0x0C,
|
||||
0x06, 0x00, 0x17, 0x06, 0x00, 0x15, 0x15, 0x2D, 0x21, 0x27, 0x00, 0x00, 0x2E, 0x75, 0x00, 0x00, 0xCA, 0x00, 0x2D, 0x00, 0x31, 0x00, 0x31, 0x00, 0x2D, 0x00, 0x41, 0x59, 0x19, 0x23, 0x1D, 0x00, 0x00, 0x06, 0x00, 0x17, 0x00, 0x0B, 0x00, 0x0D, 0x00, 0x0A, 0x00, 0x0C,
|
||||
|
||||
0x07, 0xD8, 0xE3, 0xAB, 0x50, 0x8B,
|
||||
0x07, 0xD8, 0xE3, 0xAB, 0x50, 0x8B,
|
||||
0x07, 0xD8, 0xE3, 0xAB, 0x50, 0x8B,
|
||||
0x07, 0xD8, 0xE3, 0xAB, 0x50, 0x8B,
|
||||
0x07, 0xD8, 0xE3, 0xAB, 0x50, 0x8B,
|
||||
0x07, 0xD8, 0xE3, 0xAB, 0x50, 0x8B,
|
||||
|
||||
0x80, 0x50, 0x00, 0x00, 0x00, 0x00,
|
||||
0x80, 0x50, 0x00, 0x00, 0x00, 0x00,
|
||||
0x80, 0x50, 0x00, 0x00, 0x00, 0x00,
|
||||
0x80, 0x50, 0x00, 0x00, 0x00, 0x00,
|
||||
0x80, 0x50, 0x00, 0x00, 0x00, 0x00,
|
||||
0x80, 0x50, 0x00, 0x00, 0x00, 0x00,
|
||||
|
||||
0x40, 0x00, 0x00,
|
||||
0xFD, 0xFD, 0xFD, 0xFD};
|
||||
|
||||
/*
|
||||
byte debug_party_data[GEN2_INT_SIZE + 4] = { // International Gen 2
|
||||
0x8A, 0x91, 0x88, 0x92, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50,
|
||||
0x06,
|
||||
0x8B, 0xC9, 0xA1, 0x97, 0xFB, 0x24,
|
||||
0xFF,
|
||||
0x25, 0xDA,
|
||||
|
||||
0x8B, 0x00, 0x37, 0x21, 0x2C, 0x2B, 0x25, 0xDA, 0x00, 0x00, 0xA7, 0x00, 0x46, 0x00, 0x5C, 0x00, 0x44, 0x00, 0x28, 0x00, 0x46, 0xFA, 0xAA, 0x1F, 0x1E, 0xC0, 0x00, 0x45, 0xF2, 0x85, 0x81, 0x05, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x13, 0x00, 0x0A, 0x00, 0x09, 0x00, 0x0B, 0x00, 0x0B, 0x00, 0x0A,
|
||||
0xC9, 0x00, 0x21, 0x27, 0xED, 0x00, 0x25, 0xDA, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2D, 0x11, 0x23, 0x1E, 0x00, 0x00, 0x46, 0x00, 0x82, 0x82, 0x02, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x0D, 0x00, 0x07, 0x00, 0x06, 0x00, 0x07, 0x00, 0x06, 0x00, 0x06,
|
||||
0xA1, 0x00, 0x21, 0x00, 0x00, 0x00, 0x25, 0xDA, 0x00, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x8B, 0x23, 0x00, 0x00, 0x00, 0x46, 0x00, 0x83, 0x82, 0x03, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x0F, 0x00, 0x08, 0x00, 0x07, 0x00, 0x06, 0x00, 0x07, 0x00, 0x08,
|
||||
0x97, 0x00, 0x21, 0x00, 0x00, 0x00, 0x25, 0xDA, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDB, 0x87, 0x21, 0x00, 0x00, 0x00, 0x46, 0x00, 0x82, 0x82, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0D, 0x00, 0x07, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x07,
|
||||
0xFB, 0x00, 0x21, 0x00, 0x00, 0x00, 0x25, 0xDA, 0x00, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x34, 0x21, 0x00, 0x00, 0x00, 0x46, 0x00, 0x83, 0x82, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0F, 0x00, 0x07, 0x00, 0x07, 0x00, 0x06, 0x00, 0x07, 0x00, 0x07,
|
||||
0xA1, 0x00, 0x21, 0x00, 0x00, 0x00, 0x25, 0xDA, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x23, 0x00, 0x00, 0x00, 0x46, 0x00, 0x82, 0x82, 0x02, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x0D, 0x00, 0x07, 0x00, 0x06, 0x00, 0x05, 0x00, 0x06, 0x00, 0x06,
|
||||
0x24, 0x00, 0x01, 0x2F, 0x21, 0x00, 0x25, 0xDA, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x23, 0x00, 0x00, 0x00, 0x46, 0x00, 0x82, 0x82, 0x02, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x0D, 0x00, 0x07, 0x00, 0x06, 0x00, 0x05, 0x00, 0x06, 0x00, 0x06,
|
||||
|
||||
0x8A, 0x91, 0x88, 0x92, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50,
|
||||
0x8A, 0x91, 0x88, 0x92, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50,
|
||||
|
|
@ -29,14 +64,15 @@ byte debug_party_data[444] = {
|
|||
0x92, 0x84, 0x8D, 0x93, 0x91, 0x84, 0x93, 0x50, 0x50, 0x50, 0x50,
|
||||
0xE3, 0xE6, 0xE7, 0xF3, 0xF2, 0xF4, 0x7F, 0x50, 0x50, 0x50, 0x50,
|
||||
|
||||
0x00, 0x00, 0x00};
|
||||
|
||||
0x00, 0x00, 0x00,
|
||||
0xFD, 0xFD, 0xFD, 0xFD};
|
||||
*/
|
||||
Pokemon_Party::Pokemon_Party(){};
|
||||
void Pokemon_Party::start_link()
|
||||
{
|
||||
if (DEBUG_MODE)
|
||||
{
|
||||
for (int i = 0; i < 444; i++)
|
||||
for (int i = 0; i < GEN2_INT_SIZE + 4; i++)
|
||||
{
|
||||
party_data_array[i] = debug_party_data[i];
|
||||
}
|
||||
|
|
@ -55,8 +91,7 @@ int Pokemon_Party::get_last_error()
|
|||
|
||||
void Pokemon_Party::load_pokemon()
|
||||
{
|
||||
party_size = party_data_array[11];
|
||||
for (int i = 0; i < party_size; i++)
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
party[i].load_data(i, &party_data_array[0]);
|
||||
rand_next_frame();
|
||||
|
|
@ -66,11 +101,12 @@ void Pokemon_Party::load_pokemon()
|
|||
|
||||
void Pokemon_Party::inject_pokemon()
|
||||
{
|
||||
//tte_write(std::to_string(party_size).c_str());
|
||||
//insert_pokemon(party, party_size);
|
||||
//inject_mystery();
|
||||
// tte_write(std::to_string(party_size).c_str());
|
||||
// insert_pokemon(party, party_size);
|
||||
// inject_mystery();
|
||||
}
|
||||
|
||||
Pokemon* Pokemon_Party::get_full_pokemon_array(){
|
||||
Pokemon *Pokemon_Party::get_full_pokemon_array()
|
||||
{
|
||||
return party;
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ bool run_conditional(int index)
|
|||
return true;
|
||||
|
||||
case BEAT_E4:
|
||||
return false;
|
||||
return true;
|
||||
|
||||
case SHOW_PROF:
|
||||
obj_unhide(prof, 0);
|
||||
|
|
|
|||
|
|
@ -295,4 +295,43 @@ void load_dex_r()
|
|||
}
|
||||
}
|
||||
|
||||
#include "btn_d_l.h"
|
||||
OBJ_ATTR *btn_d_l = &obj_buffer[26];
|
||||
void load_btn_d_l()
|
||||
{
|
||||
memcpy(&tile_mem[4][416], btn_d_lTiles, btn_d_lTilesLen);
|
||||
memcpy(pal_obj_mem + 32, btn_d_lPal, btn_d_lPalLen);
|
||||
|
||||
int x = 0, y = 0;
|
||||
u32 tid = 416, pb = 2; // tile id, pal-bank
|
||||
|
||||
obj_set_attr(btn_d_l,
|
||||
ATTR0_WIDE,
|
||||
ATTR1_SIZE_64x32,
|
||||
ATTR2_PALBANK(pb) | tid | ATTR2_PRIO(1));
|
||||
obj_set_pos(btn_d_l, x, y);
|
||||
obj_hide(btn_d_l);
|
||||
// obj_unhide(btn_d_l, 0);
|
||||
}
|
||||
|
||||
#include "btn_d_r.h"
|
||||
OBJ_ATTR *btn_d_r = &obj_buffer[27];
|
||||
void load_btn_d_r()
|
||||
{
|
||||
memcpy(&tile_mem[4][448], btn_d_rTiles, btn_d_rTilesLen);
|
||||
memcpy(pal_obj_mem + 48, btn_d_rPal, btn_d_rPalLen);
|
||||
|
||||
int x = 0, y = 0;
|
||||
u32 tid = 448, pb = 2; // tile id, pal-bank
|
||||
|
||||
obj_set_attr(btn_d_r,
|
||||
ATTR0_WIDE,
|
||||
ATTR1_SIZE_64x32,
|
||||
ATTR2_PALBANK(pb) | tid | ATTR2_PRIO(1));
|
||||
|
||||
obj_set_pos(btn_d_r, x, y);
|
||||
obj_hide(btn_d_r);
|
||||
// obj_unhide(btn_d_r, 0);
|
||||
}
|
||||
|
||||
// Don't forget to increase the number of sprites loaded in main!!
|
||||
Loading…
Reference in New Issue
Block a user