From a178ce5d9733abfbf13f1d9e8ae5557915e3afa6 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 27 Aug 2020 17:18:23 -0400 Subject: Resolve warnings in scrcmd_18_c and script_pokemon_util --- arm9/src/scrcmd_18_c.c | 3 ++- arm9/src/script_pokemon_util.c | 8 +++++--- include/constants/script_pokemon_util.h | 6 +++--- include/scrcmd.h | 6 ++++++ include/script_pokemon_util.h | 17 +++++++++++++++++ 5 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 include/scrcmd.h create mode 100644 include/script_pokemon_util.h diff --git a/arm9/src/scrcmd_18_c.c b/arm9/src/scrcmd_18_c.c index d2753587..b8bbbcdd 100644 --- a/arm9/src/scrcmd_18_c.c +++ b/arm9/src/scrcmd_18_c.c @@ -4,6 +4,7 @@ #include "save_block_2.h" #include "unk_0204639C.h" #include "map_header.h" +#include "scrcmd.h" extern u16 VarGet(struct UnkStruct_0204639C* arg, u16 wk); extern u16 *GetVarPointer(struct UnkStruct_0204639C* arg, u16); @@ -18,6 +19,6 @@ THUMB_FUNC BOOL ScrCmd_givemon(struct ScriptContext* ctx) u16 item = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u16 * varPtr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); struct PlayerParty * party = SavArray_PlayerParty_get((struct SaveBlock2 *) savePtr->unkC); - *varPtr = GiveMon(11, (struct SaveBlock2 *) savePtr->unkC, species, level, item, mapSec, 12); + *varPtr = (u16)GiveMon(11, (struct SaveBlock2 *) savePtr->unkC, species, (u8)level, item, mapSec, 12); return FALSE; } diff --git a/arm9/src/script_pokemon_util.c b/arm9/src/script_pokemon_util.c index fccdb15e..a3518bf4 100644 --- a/arm9/src/script_pokemon_util.c +++ b/arm9/src/script_pokemon_util.c @@ -7,6 +7,7 @@ #include "unk_02015CC0.h" #include "unk_0202C144.h" #include "module_05.h" +#include "script_pokemon_util.h" #include "constants/items.h" #include "constants/script_pokemon_util.h" @@ -44,6 +45,7 @@ BOOL GiveMon(u32 heap_id, struct SaveBlock2 * sav2, u16 species, u8 level, u16 i /* Seems to have something to do with Manaphy Egg*/ BOOL GiveEgg(u32 heapId, struct SaveBlock2 * sav2, u16 species, int level, int metLocIndex, int a3) { +#pragma unused(heapId) struct PlayerData * data = Sav2_PlayerData_GetProfileAddr(sav2); struct PlayerParty * party = SavArray_PlayerParty_get(sav2); struct Pokemon * mon = AllocMonZeroed(32); @@ -57,7 +59,7 @@ BOOL GiveEgg(u32 heapId, struct SaveBlock2 * sav2, u16 species, int level, int m void PartyMonSetMoveInSlot(struct PlayerParty * party, int partySlot, int moveSlot, u16 move) { struct Pokemon * mon = GetPartyMonByIndex(party, partySlot); - MonSetMoveInSlot(mon, move, moveSlot); + MonSetMoveInSlot(mon, move, (u8)moveSlot); } int GetIdxOfFirstPartyMonWithMove(struct PlayerParty * party, int move) @@ -114,7 +116,7 @@ struct Pokemon * GetFirstAliveMonInParty_CrashIfNone(struct PlayerParty * party) struct Pokemon * GetFirstNonEggInParty(struct PlayerParty * party) { u16 i; - u16 partyCount = GetPartyCount(party); + u16 partyCount = (u16)GetPartyCount(party); for (i = 0; i < partyCount; i++) { @@ -172,7 +174,7 @@ int ApplyPoisonStep(struct PlayerParty * party, int location) if (hp == 1) { numHealed++; - MonApplyFriendshipMod(mon, FRIENDSHIP_EVENT_HEAL_FIELD_PSN, location); + MonApplyFriendshipMod(mon, FRIENDSHIP_EVENT_HEAL_FIELD_PSN, (u32)location); } numPoisoned++; } diff --git a/include/constants/script_pokemon_util.h b/include/constants/script_pokemon_util.h index afd70eeb..4c7a01e6 100644 --- a/include/constants/script_pokemon_util.h +++ b/include/constants/script_pokemon_util.h @@ -1,8 +1,8 @@ -#ifndef POKEDIAMOND_SCRIPT_POKEMON_UTIL_H -#define POKEDIAMOND_SCRIPT_POKEMON_UTIL_H +#ifndef POKEDIAMOND_CONSTANTS_SCRIPT_POKEMON_UTIL_H +#define POKEDIAMOND_CONSTANTS_SCRIPT_POKEMON_UTIL_H #define FLDPSN_NONE 0 #define FLDPSN_PSN 1 #define FLDPSN_HEAL 2 -#endif //POKEDIAMOND_SCRIPT_POKEMON_UTIL_H +#endif //POKEDIAMOND_CONSTANTS_SCRIPT_POKEMON_UTIL_H diff --git a/include/scrcmd.h b/include/scrcmd.h new file mode 100644 index 00000000..5ebec947 --- /dev/null +++ b/include/scrcmd.h @@ -0,0 +1,6 @@ +#ifndef POKEDIAMOND_SCRCMD_H +#define POKEDIAMOND_SCRCMD_H + +BOOL ScrCmd_givemon(struct ScriptContext* ctx); + +#endif //POKEDIAMOND_SCRCMD_H diff --git a/include/script_pokemon_util.h b/include/script_pokemon_util.h new file mode 100644 index 00000000..472e5d77 --- /dev/null +++ b/include/script_pokemon_util.h @@ -0,0 +1,17 @@ +#ifndef POKEDIAMOND_SCRIPT_POKEMON_UTIL_H +#define POKEDIAMOND_SCRIPT_POKEMON_UTIL_H + +BOOL MonNotFaintedOrEgg(struct Pokemon * pokemon); +BOOL GiveMon(u32 heap_id, struct SaveBlock2 * sav2, u16 species, u8 level, u16 item, u32 mapSec, u32 encounterType); +BOOL GiveEgg(u32 heapId, struct SaveBlock2 * sav2, u16 species, int level, int metLocIndex, int a3); +void PartyMonSetMoveInSlot(struct PlayerParty * party, int partySlot, int moveSlot, u16 move); +int GetIdxOfFirstPartyMonWithMove(struct PlayerParty * party, int move); +int CountAlivePokemon(struct PlayerParty * party); +struct Pokemon * GetFirstAliveMonInParty_CrashIfNone(struct PlayerParty * party); +struct Pokemon * GetFirstNonEggInParty(struct PlayerParty * party); +BOOL HasEnoughAlivePokemonForDoubleBattle(struct PlayerParty * party); +void GiveAllMonsTheSinnohChampRibbon(struct PlayerParty * party); +int ApplyPoisonStep(struct PlayerParty * party, int location); +BOOL SurvivePoisoning(struct Pokemon * mon); + +#endif //POKEDIAMOND_SCRIPT_POKEMON_UTIL_H -- cgit v1.2.3