From eeaa6c5fd4957b6719fcb9f76cef5f9931237891 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 23 Sep 2017 09:21:55 -0400 Subject: Expanded gender field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rather than representing it as a binary, the data structure now uses two bits for gender, in order to represent genderless Pokémon. --- gba/source/serialize.c | 5 ++++- include/pokemon.h | 7 ++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gba/source/serialize.c b/gba/source/serialize.c index 069418d..d08dfc2 100644 --- a/gba/source/serialize.c +++ b/gba/source/serialize.c @@ -99,7 +99,10 @@ void PokemonIntermediateInit( // Derive gender from the personality value. int genderThreshold = baseStats->genderRatio; - if ((genderThreshold == 0) || (genderThreshold == 255)) + if (genderThreshold == 255) + { + pki->gender = 2; + } else if (genderThreshold == 0) { pki->gender = 0; } else if (genderThreshold == 254) diff --git a/include/pokemon.h b/include/pokemon.h index 072386f..04ecfa0 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -63,12 +63,9 @@ struct __attribute__((aligned(4))) PokemonIntermediate { u8 language:3; u8 altAbility:1; u8 orre:1; - u8 filler:3; // waste of space but nothing to pack it with - - // the following values are generated from the personality value. - u8 nature:6; - u8 gender:1; + u8 gender:2; u8 shiny:1; + u8 nature; u8 unownLetter; // the level is calculated from the species and experience. this is mostly -- cgit 1.4.1