Add ability and move names

This commit is contained in:
Lorenzo Carletti 2022-12-20 10:32:48 +01:00
parent 616ce2eb53
commit e069c1cf90
7 changed files with 31 additions and 3 deletions

BIN
data/ability_names.bin Normal file

Binary file not shown.

BIN
data/move_names.bin Normal file

Binary file not shown.

BIN
data/pokemon_abilities.bin Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -30,6 +30,8 @@ u8 sprite_counter;
#define UNOWN_EX_LETTER 26
#define UNOWN_I_LETTER 8
#define UNOWN_V_LETTER 21
const u8 pokemon_moves_pp_gen1_bin[];
const u8 pokemon_moves_pp_gen2_bin[];
const u8 pokemon_gender_bin[];
const u8 pokemon_names_bin[];
const u8 sprites_cmp_bin[];
@ -143,7 +145,7 @@ u8 gen3_to_gen2(struct gen2_mon* dst, struct gen3_mon* src) {
struct gen3_mon_misc* misc = (struct gen3_mon_misc*)&(decryption[3*((positions[index] >> 6)&3)]);
// Validity checks
if(growth->species > LAST_VALID_GEN_2)
if(growth->species > LAST_VALID_GEN_2_MON)
return 0;
// Get shinyness for checks
@ -170,6 +172,30 @@ u8 gen3_to_gen2(struct gen2_mon* dst, struct gen3_mon* src) {
return 0;
}
// Start converting moves
u8 used_slots = 0;
for(int i = 0; i < 4; i++)
{
dst->moves[i] = 0;
dst->pps[i] = 0;
}
for(int i = 0; i < 4; i++)
if(attacks->moves[i] > 0 && attacks->moves[i] <= LAST_VALID_GEN_2_MOVE) {
u8 base_pp = pokemon_moves_pp_gen2_bin[attacks->moves[i]];
u8 bonus_pp = (growth->pp_bonuses >> (2*i)) & 3;
u8 base_increase_pp = Div(base_pp, 5);
base_pp += (base_increase_pp * bonus_pp);
if(base_pp >= 61)
base_pp = 61;
base_pp |= (bonus_pp << 6);
dst->pps[used_slots] = base_pp;
dst->moves[used_slots++] = attacks->moves[i];
}
// No valid moves were found
if(used_slots == 0)
return 0;
iprintf("Species: %s\n", get_pokemon_name(growth->species, src->pid, misc->ivs & EGG_FLAG));
load_pokemon_sprite(growth->species, src->pid, misc->ivs & EGG_FLAG);

View File

@ -1,8 +1,10 @@
#ifndef PARTY_HANDLER__
#define PARTY_HANDLER__
#define LAST_VALID_GEN_2 251
#define LAST_VALID_GEN_1 151
#define LAST_VALID_GEN_2_MON 251
#define LAST_VALID_GEN_1_MON 151
#define LAST_VALID_GEN_2_MOVE 251
#define LAST_VALID_GEN_1_MOVE 165
#define ENC_DATA_SIZE 48
struct gen3_mon_growth {