Просмотр исходного кода

Revert "Set pokemon name to act like no nickname"

This reverts commit a712da67dba24c3b86b7b561d983185d96e1ddf0.
Kris Bahnsen 2 лет назад
Родитель
Сommit
3de7c24fb8
3 измененных файлов с 28 добавлено и 27 удалено
  1. 3 4
      README.md
  2. 14 13
      pokemon_data.h
  3. 11 10
      views/trade.cpp

+ 3 - 4
README.md

@@ -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>
 <a href="https://github.com/R4g3D/Flipper-Zero-Game-Boy-Pokemon-Trading/">R4g3D</a>
 
 
 ## TODO
 ## 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 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 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
 - [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
 - [ ] 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
 ## Links
 
 

+ 14 - 13
pokemon_data.h

@@ -143,7 +143,7 @@ struct __attribute__((__packed__)) trade_data_block {
 };
 };
 
 
 struct trade_data_block DATA_BLOCK2 =
 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_cnt = 1,
      .party_members = {0x15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
      .party_members = {0x15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
      .party =
      .party =
@@ -281,22 +281,23 @@ struct trade_data_block DATA_BLOCK2 =
               .spd = 0x9800,
               .spd = 0x9800,
               .special = 0x9900},
               .special = 0x9900},
          },
          },
+     /* NOTE: I think this shouldn't exceed 7 chars */
      .ot_name =
      .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 = {
      .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];
 unsigned char INPUT_BLOCK[405];

+ 11 - 10
views/trade.cpp

@@ -391,15 +391,21 @@ void trade_enter_callback(void* context) {
     
     
     unsigned char nickname[11];
     unsigned char nickname[11];
     for (size_t i = 0; i < 11; ++i) {
     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) {
     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]);
         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));
     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
     // Set the Pokemon hex code
 
 
@@ -411,7 +417,7 @@ void trade_enter_callback(void* context) {
 
 
     FURI_LOG_D(TAG, "[Trade] Current Level: %d", trade->app->current_level);
     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 = level & 0xFF;
     DATA_BLOCK2.party[0].level_again = level & 0xFF;
     DATA_BLOCK2.party[0].level_again = level & 0xFF;
 
 
@@ -419,7 +425,7 @@ void trade_enter_callback(void* context) {
 
 
     // Set the Pokemon experience
     // Set the Pokemon experience
 
 
-    int32_t exp = 0;
+    int exp = 0;
     if(pokemon_table[trade->app->current_pokemon].xp_group == 0) {
     if(pokemon_table[trade->app->current_pokemon].xp_group == 0) {
         exp = 1.25 * level * level * level;
         exp = 1.25 * level * level * level;
     } else if(pokemon_table[trade->app->current_pokemon].xp_group == 1) {
     } else if(pokemon_table[trade->app->current_pokemon].xp_group == 1) {
@@ -429,7 +435,6 @@ void trade_enter_callback(void* context) {
     } else if(pokemon_table[trade->app->current_pokemon].xp_group == 3) {
     } else if(pokemon_table[trade->app->current_pokemon].xp_group == 3) {
         exp = 0.8 * level * level * level;
         exp = 0.8 * level * level * level;
     }
     }
-
     DATA_BLOCK2.party[0].exp[0] = (exp >> 16) & 0xFF;
     DATA_BLOCK2.party[0].exp[0] = (exp >> 16) & 0xFF;
     DATA_BLOCK2.party[0].exp[1] = (exp >> 8) & 0xFF;
     DATA_BLOCK2.party[0].exp[1] = (exp >> 8) & 0xFF;
     DATA_BLOCK2.party[0].exp[2] = exp & 0xFF;
     DATA_BLOCK2.party[0].exp[2] = exp & 0xFF;
@@ -504,11 +509,7 @@ void trade_enter_callback(void* context) {
     // Set the Pokemon types
     // Set the Pokemon types
 
 
     DATA_BLOCK2.party[0].type[0] = pokemon_table[trade->app->current_pokemon].type1;
     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 1: %x", DATA_BLOCK2.party[0].type[0]);
     FURI_LOG_D(TAG, "[Trade] Type 2: %x", DATA_BLOCK2.party[0].type[1]);
     FURI_LOG_D(TAG, "[Trade] Type 2: %x", DATA_BLOCK2.party[0].type[1]);