Skip to content

Commit

Permalink
Set pokemon name to act like no nickname
Browse files Browse the repository at this point in the history
  • Loading branch information
R4g3D committed Sep 2, 2023
1 parent 6f54ca2 commit a712da6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,14 @@ For each image, the color `#aaa` was transformed to `#fff` so that Flipper Zero
<a href="https://github.com/R4g3D/Flipper-Zero-Game-Boy-Pokemon-Trading/">R4g3D</a>

## TODO
- [ ] Change the default traded Pokemon's naming to be no nickname (current nickname is the Pokemon's name)
- [x] Change the default traded Pokemon's naming to be no nickname
- [x] Add view to allow the traded Pokemon's level to be chosen between 3 and 100
- [x] Add view to allow the traded Pokemon's hidden stats to be chosen (IV and EV) from some options
- [x] Add view to allow the traded Pokemon's moveset to be chosen (all 4 moves) allowing no move as an option
- [ ] Debug traded Pokemon level issue where after a battle the Pokemon's level drops (doesn't affect all traded Pokemon)
- [ ] Add images for the level selection screen, stats selection screen, and move selection screens as per the original README
- [ ] Optimise the level selection screen to be a number slider input instead of the current slideshow still selector
- [ ] Add a view to allow for a custom Pokemon nickname
- [ ] Optimise the level selection screen to be a number slider input instead of the current slideshow style selector
- [ ] Add a view to allow for a custom Pokemon nickname (11 chars, 10 chars max used, fill and terminate with TERM_)

## Links

Expand Down
27 changes: 13 additions & 14 deletions pokemon_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct __attribute__((__packed__)) trade_data_block {
};

struct trade_data_block DATA_BLOCK2 =
{.trainer_name = {F_, l_, i_, p_, p_, e_, r_, TERM_, 0x00, 0x00, 0x00},
{.trainer_name = {F_, l_, i_, p_, p_, e_, r_, TERM_, TERM_, TERM_, TERM_},
.party_cnt = 1,
.party_members = {0x15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
.party =
Expand Down Expand Up @@ -281,23 +281,22 @@ struct trade_data_block DATA_BLOCK2 =
.spd = 0x9800,
.special = 0x9900},
},
/* NOTE: I think this shouldn't exceed 7 chars */
.ot_name =
{
{.str = {F_, l_, i_, p_, p_, e_, r_, TERM_, 0x00, 0x00}},
{.str = {F_, l_, i_, p_, p_, e_, r_, TERM_, 0x00, 0x00}},
{.str = {F_, l_, i_, p_, p_, e_, r_, TERM_, 0x00, 0x00}},
{.str = {F_, l_, i_, p_, p_, e_, r_, TERM_, 0x00, 0x00}},
{.str = {F_, l_, i_, p_, p_, e_, r_, TERM_, 0x00, 0x00}},
{.str = {F_, l_, i_, p_, p_, e_, r_, TERM_, 0x00, 0x00}},
{.str = {F_, l_, i_, p_, p_, e_, r_, TERM_, TERM_, TERM_, TERM_}},
{.str = {F_, l_, i_, p_, p_, e_, r_, TERM_, TERM_, TERM_, TERM_}},
{.str = {F_, l_, i_, p_, p_, e_, r_, TERM_, TERM_, TERM_, TERM_}},
{.str = {F_, l_, i_, p_, p_, e_, r_, TERM_, TERM_, TERM_, TERM_}},
{.str = {F_, l_, i_, p_, p_, e_, r_, TERM_, TERM_, TERM_, TERM_}},
{.str = {F_, l_, i_, p_, p_, e_, r_, TERM_, TERM_, TERM_, TERM_}},
},
.nickname = {
{.str = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
{.str = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
{.str = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
{.str = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
{.str = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
{.str = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
{.str = {F_, l_, i_, p_, p_, e_, r_, TERM_, TERM_, TERM_, TERM_}},
{.str = {F_, l_, i_, p_, p_, e_, r_, TERM_, TERM_, TERM_, TERM_}},
{.str = {F_, l_, i_, p_, p_, e_, r_, TERM_, TERM_, TERM_, TERM_}},
{.str = {F_, l_, i_, p_, p_, e_, r_, TERM_, TERM_, TERM_, TERM_}},
{.str = {F_, l_, i_, p_, p_, e_, r_, TERM_, TERM_, TERM_, TERM_}},
{.str = {F_, l_, i_, p_, p_, e_, r_, TERM_, TERM_, TERM_, TERM_}},
}};

unsigned char INPUT_BLOCK[405];
Expand Down
21 changes: 10 additions & 11 deletions views/trade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,21 +391,15 @@ void trade_enter_callback(void* context) {

unsigned char nickname[11];
for (size_t i = 0; i < 11; ++i) {
nickname[i] = 0x00;
nickname[i] = 0x50;
}
for (size_t i = 0; i < strlen(pokemon_table[trade->app->current_pokemon].name); ++i) {
nickname[i] = convertCharToTagHex(pokemon_table[trade->app->current_pokemon].name[i]);
}
for (size_t i = 0; i < 11; ++i) {
if(nickname[i] == 0x00) {
nickname[i] = 0x50;
}
break;
}

memcpy(DATA_BLOCK2.nickname[0].str, nickname, sizeof(nickname));

FURI_LOG_D(TAG, "[Trade] Pokemon Name: %s", nickname);
FURI_LOG_D(TAG, "[Trade] Pokemon Name: %s", pokemon_table[trade->app->current_pokemon].name);

// Set the Pokemon hex code

Expand All @@ -417,15 +411,15 @@ void trade_enter_callback(void* context) {

FURI_LOG_D(TAG, "[Trade] Current Level: %d", trade->app->current_level);

int level = trade->app->current_level;
uint8_t level = trade->app->current_level;
DATA_BLOCK2.party[0].level = level & 0xFF;
DATA_BLOCK2.party[0].level_again = level & 0xFF;

FURI_LOG_D(TAG, "[Trade] Level Hex Code: %x", DATA_BLOCK2.party[0].level);

// Set the Pokemon experience

int exp = 0;
int32_t exp = 0;
if(pokemon_table[trade->app->current_pokemon].xp_group == 0) {
exp = 1.25 * level * level * level;
} else if(pokemon_table[trade->app->current_pokemon].xp_group == 1) {
Expand All @@ -435,6 +429,7 @@ void trade_enter_callback(void* context) {
} else if(pokemon_table[trade->app->current_pokemon].xp_group == 3) {
exp = 0.8 * level * level * level;
}

DATA_BLOCK2.party[0].exp[0] = (exp >> 16) & 0xFF;
DATA_BLOCK2.party[0].exp[1] = (exp >> 8) & 0xFF;
DATA_BLOCK2.party[0].exp[2] = exp & 0xFF;
Expand Down Expand Up @@ -509,7 +504,11 @@ void trade_enter_callback(void* context) {
// Set the Pokemon types

DATA_BLOCK2.party[0].type[0] = pokemon_table[trade->app->current_pokemon].type1;
DATA_BLOCK2.party[0].type[1] = pokemon_table[trade->app->current_pokemon].type2;
if(pokemon_table[trade->app->current_pokemon].type2 == 0xFF) {
DATA_BLOCK2.party[0].type[1] = pokemon_table[trade->app->current_pokemon].type1;
} else {
DATA_BLOCK2.party[0].type[1] = pokemon_table[trade->app->current_pokemon].type2;
}

FURI_LOG_D(TAG, "[Trade] Type 1: %x", DATA_BLOCK2.party[0].type[0]);
FURI_LOG_D(TAG, "[Trade] Type 2: %x", DATA_BLOCK2.party[0].type[1]);
Expand Down

0 comments on commit a712da6

Please sign in to comment.