diff --git a/README.md b/README.md index 6ebcff6b8d7..296dc2f4b82 100644 --- a/README.md +++ b/README.md @@ -264,13 +264,14 @@ For each image, the color `#aaa` was transformed to `#fff` so that Flipper Zero R4g3D ## 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 diff --git a/pokemon_data.h b/pokemon_data.h index f53492de4e8..5022a93060c 100644 --- a/pokemon_data.h +++ b/pokemon_data.h @@ -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 = @@ -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]; diff --git a/views/trade.cpp b/views/trade.cpp index d8cbff20147..e17ca779ea2 100644 --- a/views/trade.cpp +++ b/views/trade.cpp @@ -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 @@ -417,7 +411,7 @@ 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; @@ -425,7 +419,7 @@ void trade_enter_callback(void* context) { // 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) { @@ -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; @@ -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]);