summaryrefslogtreecommitdiff
path: root/src/pokemon_storage_system.c
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2018-02-11 20:12:40 -0500
committerPikalaxALT <pikalaxalt@gmail.com>2018-02-11 20:12:40 -0500
commit590c4b500b9dd37d372a935865aa4df0ab0bf43c (patch)
tree5572d76c91e106e74e1401076f130fb902f6b67b /src/pokemon_storage_system.c
parentbc063b45d05716d1eab283f6d474bcdc601cafde (diff)
parent14a76793e596d612efd273169c4172922c270f13 (diff)
Merge branch 'master' into record_mixing
Diffstat (limited to 'src/pokemon_storage_system.c')
-rw-r--r--src/pokemon_storage_system.c190
1 files changed, 182 insertions, 8 deletions
diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c
index 3e409244c..7f8c24ab7 100644
--- a/src/pokemon_storage_system.c
+++ b/src/pokemon_storage_system.c
@@ -1,15 +1,189 @@
-
-// Includes
#include "global.h"
+#include "pokemon_storage_system.h"
+#include "pokemon.h"
+#include "constants/species.h"
+#include "event_data.h"
+#include "string_util.h"
+#include "text.h"
+#include "strings.h"
+#include "window.h"
+
+IWRAM_DATA u8 gUnknown_03000F78[0x188];
-// Static type declarations
+struct OptionAndDescription
+{
+ const u8 *optionTxt;
+ const u8 *descriptionTxt;
+};
-// Static RAM declarations
+// const rom data
+const struct OptionAndDescription gUnknown_085716C0[] =
+{
+ {gText_WithdrawPokemon, gText_WithdrawMonDescription},
+ {gText_DepositPokemon, gText_DepositMonDescription},
+ {gText_MovePokemon, gText_MoveMonDescription},
+ {gText_MoveItems, gText_MoveItemsDescription},
+ {gText_SeeYa, gText_SeeYaDescription}
+};
-IWRAM_DATA u8 gUnknown_03000F78[0x188];
+const struct WindowTemplate gUnknown_085716E8 = {0, 1, 1, 0x11, 0xA, 0xF, 1};
+
+static const union AnimCmd sSpriteAnim_85716F0[] =
+{
+ ANIMCMD_FRAME(0, 5),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_85716F8[] =
+{
+ ANIMCMD_FRAME(4, 5),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_8571700[] =
+{
+ ANIMCMD_FRAME(6, 5),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_8571708[] =
+{
+ ANIMCMD_FRAME(10, 5),
+ ANIMCMD_END
+};
+
+const union AnimCmd *const sSpriteAnimTable_8571710[] =
+{
+ sSpriteAnim_85716F0,
+ sSpriteAnim_85716F8,
+ sSpriteAnim_8571700,
+ sSpriteAnim_8571708
+};
+
+static const union AffineAnimCmd sSpriteAffineAnim_8571720[] =
+{
+ AFFINEANIMCMD_FRAME(0xE0, 0xE0, 0, 0),
+ AFFINEANIMCMD_END
+};
+
+static const union AffineAnimCmd *const sSpriteAffineAnimTable_8571730[] =
+{
+ sSpriteAffineAnim_8571720
+};
+
+const u8 gUnknown_08571734[] = {4, 0xF, 0xE};
+const u8 gUnknown_08571737[] = _("/30");
+
+// code
+u8 CountMonsInBox(u8 boxId)
+{
+ u16 i, count;
+
+ for (i = 0, count = 0; i < IN_BOX_COUNT; i++)
+ {
+ if (GetBoxMonDataFromAnyBox(boxId, i, MON_DATA_SPECIES) != SPECIES_NONE)
+ count++;
+ }
+
+ return count;
+}
+
+s16 GetFirstFreeBoxSpot(u8 boxId)
+{
+ u16 i;
+
+ for (i = 0; i < IN_BOX_COUNT; i++)
+ {
+ if (GetBoxMonDataFromAnyBox(boxId, i, MON_DATA_SPECIES) == SPECIES_NONE)
+ return i;
+ }
+
+ return -1; // all spots are taken
+}
+
+u8 CountPartyNonEggMons(void)
+{
+ u16 i, count;
+
+ for (i = 0, count = 0; i < PARTY_SIZE; i++)
+ {
+ if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) != SPECIES_NONE
+ && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG))
+ {
+ count++;
+ }
+ }
+
+ return count;
+}
+
+u8 CountPartyAliveNonEggMonsExcept(u8 slotToIgnore)
+{
+ u16 i, count;
+
+ for (i = 0, count = 0; i < PARTY_SIZE; i++)
+ {
+ if (i != slotToIgnore
+ && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) != SPECIES_NONE
+ && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)
+ && GetMonData(&gPlayerParty[i], MON_DATA_HP) != 0)
+ {
+ count++;
+ }
+ }
+
+ return count;
+}
+
+u16 CountPartyAliveNonEggMons_IgnoreVar0x8004Slot(void)
+{
+ return CountPartyAliveNonEggMonsExcept(gSpecialVar_0x8004);
+}
+
+u8 CountPartyMons(void)
+{
+ u16 i, count;
+
+ for (i = 0, count = 0; i < PARTY_SIZE; i++)
+ {
+ if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) != SPECIES_NONE)
+ {
+ count++;
+ }
+ }
+
+ return count;
+}
+
+static u8 *StringCopyAndFillWithSpaces(u8 *dst, const u8 *src, u16 n)
+{
+ u8 *str;
+
+ for (str = StringCopy(dst, src); str < dst + n; str++)
+ *str = CHAR_SPACE;
+
+ *str = EOS;
+ return str;
+}
-// Static ROM declarations
+/* can't match
+static void sub_80C7128(u16 *dst, u16 dstToAdd, u16 dstToMul, const u16 *src, u16 srcToAdd, u16 srcToMul, u32 size, u16 count, u16 srcBy)
+{
+ u16 i;
-// .rodata
+ size <<= 0x11;
+ dst += (dstToMul * 32) + dstToAdd;
+ src += (srcToMul * srcBy) + srcToAdd;
-// .text
+ i = 0;
+ if (i < count)
+ {
+ size >>= 1;
+ for (i = 0; i < count; i++)
+ {
+ CpuSet(src, dst, size >> 0x10);
+ dst += 0x20;
+ src += srcBy;
+ }
+ }
+}*/