summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2018-01-09 22:08:11 -0500
committerPikalaxALT <pikalaxalt@gmail.com>2018-01-09 22:08:11 -0500
commit7cdd2b2a42a96135949e399d1fa3a00c5f56ae67 (patch)
tree26b1cf46bcf39aaa50e38bb941d57f2118ed1fa7 /src
parentc4244f5bec27741c18a12611f245df5572b11d8b (diff)
through sub_8098E68
Diffstat (limited to 'src')
-rw-r--r--src/pokemon/pokemon_storage_system_2.c4
-rw-r--r--src/pokemon/pokemon_storage_system_3.c89
2 files changed, 86 insertions, 7 deletions
diff --git a/src/pokemon/pokemon_storage_system_2.c b/src/pokemon/pokemon_storage_system_2.c
index 2947562d0..dbb1cf992 100644
--- a/src/pokemon/pokemon_storage_system_2.c
+++ b/src/pokemon/pokemon_storage_system_2.c
@@ -217,7 +217,7 @@ void sub_8096884(void)
gMain.state++;
break;
case 4:
- sub_8098B48();
+ ResetPSSMonIconSprites();
sub_809AA24();
gMain.state++;
break;
@@ -280,7 +280,7 @@ void sub_80969A0(void)
gMain.state++;
break;
case 4:
- sub_8098B48();
+ ResetPSSMonIconSprites();
sub_809AA98();
gMain.state++;
break;
diff --git a/src/pokemon/pokemon_storage_system_3.c b/src/pokemon/pokemon_storage_system_3.c
index eff542756..e1ccd107f 100644
--- a/src/pokemon/pokemon_storage_system_3.c
+++ b/src/pokemon/pokemon_storage_system_3.c
@@ -1,6 +1,7 @@
// Includes
#include "global.h"
+#include "constants/species.h"
#include "sprite.h"
#include "pokemon_icon.h"
#include "pokemon_storage_system.h"
@@ -11,8 +12,9 @@
// Static ROM declarations
+void sub_8098E68(struct Sprite *sprite);
void sub_80999C4(struct Sprite *sprite);
-struct Sprite *sub_8099AFC(u16 species, u32 personality, u16 a2, u16 a3, u8 a4, u8 a5);
+struct Sprite *PSS_SpawnMonIconSprite(u16 species, u32 personality, s16 a2, s16 a3, u8 a4, u8 a5);
// .rodata
@@ -39,7 +41,7 @@ u8 get_preferred_box(void)
return gPokemonStorage.currentBox;
}
-void sub_8098B48(void)
+void ResetPSSMonIconSprites(void)
{
u16 i;
@@ -49,9 +51,9 @@ void sub_8098B48(void)
for (i = 0; i < 40; i++)
gPokemonStorageSystemPtr->unk_1120[i] = 0;
for (i = 0; i < 6; i++)
- gPokemonStorageSystemPtr->unk_1038[i] = 0;
+ gPokemonStorageSystemPtr->unk_1038[i] = NULL;
for (i = 0; i < 30; i++)
- gPokemonStorageSystemPtr->unk_1050[i] = 0;
+ gPokemonStorageSystemPtr->unk_1050[i] = NULL;
gPokemonStorageSystemPtr->unk_1034 = NULL;
gPokemonStorageSystemPtr->unk_0d5c = 0;
}
@@ -59,6 +61,83 @@ void sub_8098B48(void)
void sub_8098BF0(void)
{
u32 personality = GetMonData(&gPokemonStorageSystemPtr->unk_25b4, MON_DATA_PERSONALITY);
- gPokemonStorageSystemPtr->unk_1034 = sub_8099AFC(GetMonData(&gPokemonStorageSystemPtr->unk_25b4, MON_DATA_SPECIES2), personality, 0, 0, 1, 7);
+ gPokemonStorageSystemPtr->unk_1034 = PSS_SpawnMonIconSprite(GetMonData(&gPokemonStorageSystemPtr->unk_25b4, MON_DATA_SPECIES2), personality, 0, 0, 1, 7);
gPokemonStorageSystemPtr->unk_1034->callback = sub_80999C4;
}
+
+void SpawnBoxIconSprites(u8 boxId)
+{
+ struct BoxPokemon *box = gPokemonStorage.boxes[boxId];
+ u16 i;
+ u16 k = 0;
+ for (i = 0; i < 5; i++)
+ {
+ u16 j;
+ for (j = 0; j < 6; j++)
+ {
+ u16 species = GetBoxMonData(box, MON_DATA_SPECIES2);
+ if (species != SPECIES_NONE)
+ gPokemonStorageSystemPtr->unk_1050[k] = PSS_SpawnMonIconSprite(species, GetBoxMonData(box, MON_DATA_PERSONALITY), 24 * j + 0x64, 24 * i + 0x2c, 2, 18 - j);
+ else
+ gPokemonStorageSystemPtr->unk_1050[k] = NULL;
+ box++;
+ k++;
+ }
+ }
+}
+
+void sub_8098D20(u8 monId)
+{
+ struct BoxPokemon *mon = gPokemonStorage.boxes[get_preferred_box()] + monId;
+ u16 species = GetBoxMonData(mon, MON_DATA_SPECIES2);
+ if (species != SPECIES_NONE)
+ {
+ s16 x = 24 * (monId % 6) + 0x64;
+ s16 y = 24 * (monId / 6) + 0x2c;
+ gPokemonStorageSystemPtr->unk_1050[monId] = PSS_SpawnMonIconSprite(species, GetBoxMonData(mon, MON_DATA_PERSONALITY), x, y, 2, 18 - (monId % 6));
+ }
+}
+
+void sub_8098DE0(s16 a0)
+{
+ u16 monId;
+ for (monId = 0; monId < 30; monId++)
+ {
+ if (gPokemonStorageSystemPtr->unk_1050[monId])
+ {
+ gPokemonStorageSystemPtr->unk_1050[monId]->data[2] = a0;
+ gPokemonStorageSystemPtr->unk_1050[monId]->data[4] = 1;
+ gPokemonStorageSystemPtr->unk_1050[monId]->callback = sub_8098E68;
+ }
+ }
+}
+
+void sub_8098E24(struct Sprite *sprite)
+{
+ if (sprite->data[1] != 0)
+ {
+ sprite->data[1]--;
+ sprite->pos1.x += sprite->data[2];
+ }
+ else
+ {
+ gPokemonStorageSystemPtr->unk_1178--;
+ sprite->pos1.x = sprite->data[3];
+ sprite->callback = SpriteCallbackDummy;
+ }
+}
+
+void sub_8098E68(struct Sprite *sprite)
+{
+ if (sprite->data[4] != 0)
+ {
+ sprite->data[4]--;
+ }
+ else
+ {
+ sprite->pos1.x += sprite->data[2];
+ sprite->data[5] = sprite->pos1.x + sprite->pos2.x;
+ if (sprite->data[5] < 0x45 || sprite->data[5] > 0xfb)
+ sprite->callback = SpriteCallbackDummy;
+ }
+}