From c9c42fb3319151221f317b3cbc255f6d117af5b9 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 18 Aug 2017 17:36:59 -0400 Subject: Removed dependency on ROM-internal arrays I looked at the base stats array and determined that, especially if I limited it to just the data I needed, that it wouldn't be too bad a thing to just include it and the other two arrays I need in my multiboot image rather than reference the ones already located in the game ROM. This way, we get back compatibility with all previously-compatible ROMs, and not just ones that I have dumped. New issue: Deoxys's base stats are actually different per-game, though, so a special case will have to be written for that. --- gba/source/serialize.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gba/source/serialize.c') diff --git a/gba/source/serialize.c b/gba/source/serialize.c index 72afe2f..086e751 100644 --- a/gba/source/serialize.c +++ b/gba/source/serialize.c @@ -7,6 +7,9 @@ #include "serialize.h" #include "gamedata.h" #include "link.h" +#include "basestats.h" +#include "exptables.h" +#include "dexorder.h" #define UNOWN_SPECIES_INDEX 201 #define SHEDINJA_SPECIES_INDEX 303 @@ -60,7 +63,7 @@ void PokemonIntermediateInit( struct PokemonSubstruct2* sub2 = GetBoxPokemonSubstruct2(bpkm); struct PokemonSubstruct3* sub3 = GetBoxPokemonSubstruct3(bpkm); - struct BaseStats* baseStats = &gameData->baseStats[sub0->species]; + const struct SmallBaseStats* baseStats = &gSmallBaseStats[sub0->species]; for (int i=0; iotId = bpkm->otId; pki->otGender = sub3->otGender; - pki->species = gameData->natOrder[sub0->species - 1]; + pki->species = gSpeciesToNationalPokedexNum[sub0->species - 1]; pki->heldItem = sub0->heldItem; pki->experience = sub0->experience; @@ -141,7 +144,7 @@ void PokemonIntermediateInit( // Calculate level from experience. pki->level = 1; - const u32* expTable = gameData->expTables[baseStats->growthRate]; + const u32* expTable = gExperienceTables[baseStats->growthRate]; while ((pki->level <= 100) && (expTable[pki->level] <= sub0->experience)) { pki->level++; -- cgit 1.4.1