summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pokemon/pokemon_storage_system.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/pokemon/pokemon_storage_system.c b/src/pokemon/pokemon_storage_system.c
index 5cb61f365..745a27bf6 100644
--- a/src/pokemon/pokemon_storage_system.c
+++ b/src/pokemon/pokemon_storage_system.c
@@ -250,6 +250,37 @@ __attribute__((naked)) void unref_sub_8095D08(u16 *dest, u16 dest_left, u16 dest
}
#endif
+s16 StorageSystemGetNextMonIndex(struct BoxPokemon *box, s8 startIdx, u8 stopIdx, u8 mode)
+{
+ s16 i;
+ s16 direction;
+ if (mode == 0 || mode == 2)
+ {
+ direction = 1;
+ }
+ else
+ {
+ direction = -1;
+ }
+ if (mode == 2 || mode == 3)
+ {
+ for (i = startIdx + direction; i >= 0 && i <= stopIdx; i += direction)
+ {
+ if (GetBoxMonData(box + i, MON_DATA_SPECIES) != 0)
+ return i;
+ }
+ }
+ else
+ {
+ for (i = startIdx + direction; i >= 0 && i <= stopIdx; i += direction)
+ {
+ if (GetBoxMonData(box + i, MON_DATA_SPECIES) != 0 && !GetBoxMonData(box + i, MON_DATA_IS_EGG))
+ return i;
+ }
+ }
+ return -1;
+}
+
asm(".section .text.8098898");
void sub_8098898(u8 index) {