summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2018-01-15 20:34:56 -0500
committerPikalaxALT <pikalaxalt@gmail.com>2018-01-15 20:34:56 -0500
commit7a2eef97c35e4672bd17bfca86a6ea19d22a3eba (patch)
tree7e805b0687e1033c955b408532349445aae61a6b /src
parent7b45766d0765d42d7326a7f6cdb21a54d386117e (diff)
sub_809B960
Diffstat (limited to 'src')
-rw-r--r--src/pokemon/pokemon_storage_system_4.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/pokemon/pokemon_storage_system_4.c b/src/pokemon/pokemon_storage_system_4.c
index a0a6fa145..2469d42b1 100644
--- a/src/pokemon/pokemon_storage_system_4.c
+++ b/src/pokemon/pokemon_storage_system_4.c
@@ -1721,3 +1721,68 @@ void sub_809B7D4(void)
}
gPokemonStorageSystemPtr->unk_2684 = 0;
}
+
+s8 sub_809B960(void)
+{
+ u16 i;
+ u16 knownMoves;
+
+ if (gPokemonStorageSystemPtr->unk_267d)
+ return gPokemonStorageSystemPtr->unk_267c;
+ switch (gPokemonStorageSystemPtr->unk_2684)
+ {
+ case 0:
+ for (i = 0; i < PARTY_SIZE; i++)
+ {
+ if (gPokemonStorageSystemPtr->unk_2682 != 14 || gPokemonStorageSystemPtr->unk_2683 != i)
+ {
+ knownMoves = GetMonData(gPlayerParty + i, MON_DATA_KNOWN_MOVES, gPokemonStorageSystemPtr->unk_2686);
+ if (knownMoves & 1)
+ gPokemonStorageSystemPtr->unk_267e = 0;
+ if (knownMoves & 2)
+ gPokemonStorageSystemPtr->unk_267f = 0;
+ }
+ }
+ if (gPokemonStorageSystemPtr->unk_267e == 0 && gPokemonStorageSystemPtr->unk_267f == 0)
+ {
+ gPokemonStorageSystemPtr->unk_267d = 1;
+ gPokemonStorageSystemPtr->unk_267c = 1;
+ }
+ else
+ {
+ gPokemonStorageSystemPtr->unk_2680 = 0;
+ gPokemonStorageSystemPtr->unk_2681 = 0;
+ gPokemonStorageSystemPtr->unk_2684++;
+ }
+ break;
+ case 1:
+ for (i = 0; i < 5; i++)
+ {
+ knownMoves = GetBoxMonData(gPokemonStorage.boxes[gPokemonStorageSystemPtr->unk_2680] + gPokemonStorageSystemPtr->unk_2681, MON_DATA_KNOWN_MOVES, gPokemonStorageSystemPtr->unk_2686);
+ if (knownMoves && (gPokemonStorageSystemPtr->unk_2682 != gPokemonStorageSystemPtr->unk_2680 || gPokemonStorageSystemPtr->unk_2683 != gPokemonStorageSystemPtr->unk_2681))
+ {
+ if (knownMoves & 1)
+ gPokemonStorageSystemPtr->unk_267e = 0;
+ if (knownMoves & 2)
+ gPokemonStorageSystemPtr->unk_267f = 0;
+ }
+ if (++gPokemonStorageSystemPtr->unk_2681 >= 30)
+ {
+ gPokemonStorageSystemPtr->unk_2681 = 0;
+ if (++gPokemonStorageSystemPtr->unk_2680 >= 14)
+ {
+ gPokemonStorageSystemPtr->unk_267d = 1;
+ gPokemonStorageSystemPtr->unk_267c = 0;
+ break;
+ }
+ }
+ }
+ if (gPokemonStorageSystemPtr->unk_267e == 0 && gPokemonStorageSystemPtr->unk_267f == 0)
+ {
+ gPokemonStorageSystemPtr->unk_267d = 1;
+ gPokemonStorageSystemPtr->unk_267c = 1;
+ }
+ break;
+ }
+ return -1;
+}