summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arm9/src/scrcmd_18_c.c3
-rw-r--r--arm9/src/script_pokemon_util.c8
-rw-r--r--include/constants/script_pokemon_util.h6
-rw-r--r--include/scrcmd.h6
-rw-r--r--include/script_pokemon_util.h17
5 files changed, 33 insertions, 7 deletions
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