From 5e9e52e3a95f4d7301565ad86084907f2d8a94e6 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Sat, 9 Sep 2017 22:04:01 -0500 Subject: more renaming/refactoring --- src/script_pokemon_util_80C4BF0.c | 40 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 21 deletions(-) (limited to 'src/script_pokemon_util_80C4BF0.c') diff --git a/src/script_pokemon_util_80C4BF0.c b/src/script_pokemon_util_80C4BF0.c index cbca07011..6a60a5402 100644 --- a/src/script_pokemon_util_80C4BF0.c +++ b/src/script_pokemon_util_80C4BF0.c @@ -542,41 +542,39 @@ void HealPlayerParty(void) } } -u8 ScriptGiveMon(u16 species, u8 var, u16 item, u32 var3, u32 var4, u8 var5) +u8 ScriptGiveMon(u16 species, u8 level, u16 item, u32 unused1, u32 unused2, u8 unused3) { - u16 nationalSpecies; + u16 nationalDexNum; int sentToPc; - u8 array[2]; + u8 heldItem[2]; struct Pokemon mon; - CreateMon(&mon, species, var, 32, 0, 0, 0, 0); - array[0] = item; - array[1] = item >> 8; - SetMonData(&mon, MON_DATA_HELD_ITEM, array); + CreateMon(&mon, species, level, 32, 0, 0, 0, 0); + heldItem[0] = item; + heldItem[1] = item >> 8; + SetMonData(&mon, MON_DATA_HELD_ITEM, heldItem); sentToPc = GiveMonToPlayer(&mon); - nationalSpecies = SpeciesToNationalPokedexNum(species); + nationalDexNum = SpeciesToNationalPokedexNum(species); - // nested if check to fool compiler switch(sentToPc) { - case 0: - case 1: - GetNationalPokedexFlag(nationalSpecies, 2); - GetNationalPokedexFlag(nationalSpecies, 3); - return sentToPc; - default: - return sentToPc; + case 0: + case 1: + GetNationalPokedexFlag(nationalDexNum, 2); + GetNationalPokedexFlag(nationalDexNum, 3); + break; } + return sentToPc; } -u8 ScriptGiveEgg(u16 value) +u8 ScriptGiveEgg(u16 species) { struct Pokemon mon; - u8 data; + u8 isEgg; - sub_8042044(&mon, value, 1); - data = 1; - SetMonData(&mon, MON_DATA_IS_EGG, &data); + sub_8042044(&mon, species, 1); + isEgg = TRUE; + SetMonData(&mon, MON_DATA_IS_EGG, &isEgg); return GiveMonToPlayer(&mon); } -- cgit v1.2.3