Skip to content

Commit

Permalink
Revert "Set pokemon name to act like no nickname"
Browse files Browse the repository at this point in the history
This reverts commit a712da6.
  • Loading branch information
kbembedded committed Sep 15, 2023
1 parent 6fd5098 commit 3de7c24
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 27 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,13 @@ 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
- [x] Change the default traded Pokemon's naming to be no nickname
- [ ] Change the default traded Pokemon's naming to be no nickname (current nickname is the Pokemon's name)
- [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 style selector
- [ ] Add a view to allow for a custom Pokemon nickname (11 chars, 10 chars max used, fill and terminate with TERM_)
- [ ] 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

## Links

Expand Down
27 changes: 14 additions & 13 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_, TERM_, TERM_, TERM_},
{.trainer_name = {F_, l_, i_, p_, p_, e_, r_, TERM_, 0x00, 0x00, 0x00},
.party_cnt = 1,
.party_members = {0x15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
.party =
Expand Down Expand Up @@ -281,22 +281,23 @@ 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_, 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_}},
{.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}},
},
.nickname = {
{.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_}},
{.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}},
}};

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

unsigned char nickname[11];
for (size_t i = 0; i < 11; ++i) {
nickname[i] = 0x50;
nickname[i] = 0x00;
}
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", pokemon_table[trade->app->current_pokemon].name);
FURI_LOG_D(TAG, "[Trade] Pokemon Name: %s", nickname);

// Set the Pokemon hex code

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

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

uint8_t level = trade->app->current_level;
int 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

int32_t exp = 0;
int 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 @@ -429,7 +435,6 @@ 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 @@ -504,11 +509,7 @@ void trade_enter_callback(void* context) {
// Set the Pokemon types

DATA_BLOCK2.party[0].type[0] = pokemon_table[trade->app->current_pokemon].type1;
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;
}
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 3de7c24

Please sign in to comment.