summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/graphics.s62
-rw-r--r--data/pokeblock_feed.s27
-rw-r--r--graphics/pokeblock/black.pal19
-rw-r--r--graphics/pokeblock/blue.pal19
-rw-r--r--graphics/pokeblock/brown.pal19
-rw-r--r--graphics/pokeblock/gold.pal19
-rw-r--r--graphics/pokeblock/gray.pal19
-rw-r--r--graphics/pokeblock/green.pal19
-rw-r--r--graphics/pokeblock/indigo.pal19
-rw-r--r--graphics/pokeblock/liteblue.pal19
-rw-r--r--graphics/pokeblock/olive.pal19
-rw-r--r--graphics/pokeblock/pink.pal19
-rw-r--r--graphics/pokeblock/pokeblock.pngbin0 -> 147 bytes
-rw-r--r--graphics/pokeblock/purple.pal19
-rw-r--r--graphics/pokeblock/red.pal19
-rw-r--r--graphics/pokeblock/white.pal19
-rw-r--r--graphics/pokeblock/yellow.pal19
-rw-r--r--include/graphics.h22
-rw-r--r--include/pokeblock.h3
-rw-r--r--ld_script.txt1
-rw-r--r--src/pokeblock_feed.c192
-rw-r--r--src/use_pokeblock.c17
-rw-r--r--sym_ewram.txt27
23 files changed, 527 insertions, 90 deletions
diff --git a/data/graphics.s b/data/graphics.s
index a68240d64..60787a2c5 100644
--- a/data/graphics.s
+++ b/data/graphics.s
@@ -887,7 +887,67 @@ gMenuPokeblock_Pal:: @ 8D9B470
.incbin "baserom.gba", 0xd9b470, 0x358
gMenuPokeblockDevice_Gfx:: @ 8D9B7C8
- .incbin "baserom.gba", 0xd9b7c8, 0x27c
+ .incbin "baserom.gba", 0xd9b7c8, 0x148
+
+ .align 2
+gPokeblock_Gfx::
+ .incbin "graphics/pokeblock/pokeblock.4bpp.lz"
+
+ .align 2
+gPokeblockRed_Pal::
+ .incbin "graphics/pokeblock/red.gbapal.lz"
+
+ .align 2
+gPokeblockBlue_Pal::
+ .incbin "graphics/pokeblock/blue.gbapal.lz"
+
+ .align 2
+gPokeblockPink_Pal::
+ .incbin "graphics/pokeblock/pink.gbapal.lz"
+
+ .align 2
+gPokeblockGreen_Pal::
+ .incbin "graphics/pokeblock/green.gbapal.lz"
+
+ .align 2
+gPokeblockYellow_Pal::
+ .incbin "graphics/pokeblock/yellow.gbapal.lz"
+
+ .align 2
+gPokeblockPurple_Pal::
+ .incbin "graphics/pokeblock/purple.gbapal.lz"
+
+ .align 2
+gPokeblockIndigo_Pal::
+ .incbin "graphics/pokeblock/indigo.gbapal.lz"
+
+ .align 2
+gPokeblockBrown_Pal::
+ .incbin "graphics/pokeblock/brown.gbapal.lz"
+
+ .align 2
+gPokeblockLiteBlue_Pal::
+ .incbin "graphics/pokeblock/liteblue.gbapal.lz"
+
+ .align 2
+gPokeblockOlive_Pal::
+ .incbin "graphics/pokeblock/olive.gbapal.lz"
+
+ .align 2
+gPokeblockGray_Pal::
+ .incbin "graphics/pokeblock/gray.gbapal.lz"
+
+ .align 2
+gPokeblockBlack_Pal::
+ .incbin "graphics/pokeblock/black.gbapal.lz"
+
+ .align 2
+gPokeblockWhite_Pal::
+ .incbin "graphics/pokeblock/white.gbapal.lz"
+
+ .align 2
+gPokeblockGold_Pal::
+ .incbin "graphics/pokeblock/gold.gbapal.lz"
gUnknown_08D9BA44:: @ 8D9BA44
.incbin "baserom.gba", 0xd9ba44, 0x100
diff --git a/data/pokeblock_feed.s b/data/pokeblock_feed.s
deleted file mode 100644
index 72c0f72a3..000000000
--- a/data/pokeblock_feed.s
+++ /dev/null
@@ -1,27 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .section .rodata
-
- .align 2
-
-sPokeblocksPals:: @ 85F0568
- .incbin "baserom.gba", 0x5f0568, 0x48
-
-sSpriteAffineAnimTable_85F05B0:: @ 85F05B0
- .incbin "baserom.gba", 0x5f05b0, 0xb4
-
-sSpriteAffineAnimTable_85F0664:: @ 85F0664
- .incbin "baserom.gba", 0x5f0664, 0x4
-
-sSpriteAffineAnimTable_85F0668:: @ 85F0668
- .incbin "baserom.gba", 0x5f0668, 0x4
-
-sSpriteAffineAnimTable_85F066C:: @ 85F066C
- .incbin "baserom.gba", 0x5f066c, 0x34
-
-gPokeblock_SpriteSheet:: @ 85F06A0
- .incbin "baserom.gba", 0x5f06a0, 0x8
-
-sThrownPokeblockSpriteTemplate:: @ 85F06A8
- .incbin "baserom.gba", 0x5f06a8, 0x18
diff --git a/graphics/pokeblock/black.pal b/graphics/pokeblock/black.pal
new file mode 100644
index 000000000..2cb591a70
--- /dev/null
+++ b/graphics/pokeblock/black.pal
@@ -0,0 +1,19 @@
+JASC-PAL
+0100
+16
+213 131 74
+41 41 41
+98 98 98
+148 148 148
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
diff --git a/graphics/pokeblock/blue.pal b/graphics/pokeblock/blue.pal
new file mode 100644
index 000000000..8295c79e8
--- /dev/null
+++ b/graphics/pokeblock/blue.pal
@@ -0,0 +1,19 @@
+JASC-PAL
+0100
+16
+0 0 0
+106 106 189
+148 148 255
+180 180 255
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
diff --git a/graphics/pokeblock/brown.pal b/graphics/pokeblock/brown.pal
new file mode 100644
index 000000000..c936322bb
--- /dev/null
+++ b/graphics/pokeblock/brown.pal
@@ -0,0 +1,19 @@
+JASC-PAL
+0100
+16
+0 0 0
+106 0 0
+172 65 65
+197 123 123
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
diff --git a/graphics/pokeblock/gold.pal b/graphics/pokeblock/gold.pal
new file mode 100644
index 000000000..c975554d1
--- /dev/null
+++ b/graphics/pokeblock/gold.pal
@@ -0,0 +1,19 @@
+JASC-PAL
+0100
+16
+0 0 0
+222 197 49
+246 230 164
+255 238 197
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
diff --git a/graphics/pokeblock/gray.pal b/graphics/pokeblock/gray.pal
new file mode 100644
index 000000000..0bd5c4d7c
--- /dev/null
+++ b/graphics/pokeblock/gray.pal
@@ -0,0 +1,19 @@
+JASC-PAL
+0100
+16
+0 0 0
+148 148 148
+189 189 189
+205 205 205
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
diff --git a/graphics/pokeblock/green.pal b/graphics/pokeblock/green.pal
new file mode 100644
index 000000000..984ba41ea
--- /dev/null
+++ b/graphics/pokeblock/green.pal
@@ -0,0 +1,19 @@
+JASC-PAL
+0100
+16
+0 0 0
+0 106 0
+49 164 49
+90 230 90
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
diff --git a/graphics/pokeblock/indigo.pal b/graphics/pokeblock/indigo.pal
new file mode 100644
index 000000000..4a57b8bde
--- /dev/null
+++ b/graphics/pokeblock/indigo.pal
@@ -0,0 +1,19 @@
+JASC-PAL
+0100
+16
+139 205 74
+0 0 106
+65 65 172
+123 123 255
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
diff --git a/graphics/pokeblock/liteblue.pal b/graphics/pokeblock/liteblue.pal
new file mode 100644
index 000000000..e3a70c8be
--- /dev/null
+++ b/graphics/pokeblock/liteblue.pal
@@ -0,0 +1,19 @@
+JASC-PAL
+0100
+16
+0 0 0
+106 139 189
+148 213 255
+180 238 255
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
diff --git a/graphics/pokeblock/olive.pal b/graphics/pokeblock/olive.pal
new file mode 100644
index 000000000..e7599fc1e
--- /dev/null
+++ b/graphics/pokeblock/olive.pal
@@ -0,0 +1,19 @@
+JASC-PAL
+0100
+16
+0 0 0
+115 180 106
+148 246 98
+205 255 139
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
diff --git a/graphics/pokeblock/pink.pal b/graphics/pokeblock/pink.pal
new file mode 100644
index 000000000..7eb09a598
--- /dev/null
+++ b/graphics/pokeblock/pink.pal
@@ -0,0 +1,19 @@
+JASC-PAL
+0100
+16
+0 0 0
+205 90 172
+255 156 197
+255 197 213
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
diff --git a/graphics/pokeblock/pokeblock.png b/graphics/pokeblock/pokeblock.png
new file mode 100644
index 000000000..fd24e0621
--- /dev/null
+++ b/graphics/pokeblock/pokeblock.png
Binary files differ
diff --git a/graphics/pokeblock/purple.pal b/graphics/pokeblock/purple.pal
new file mode 100644
index 000000000..2b6f8ad43
--- /dev/null
+++ b/graphics/pokeblock/purple.pal
@@ -0,0 +1,19 @@
+JASC-PAL
+0100
+16
+0 0 0
+164 0 164
+197 41 197
+255 131 255
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
diff --git a/graphics/pokeblock/red.pal b/graphics/pokeblock/red.pal
new file mode 100644
index 000000000..a347854a9
--- /dev/null
+++ b/graphics/pokeblock/red.pal
@@ -0,0 +1,19 @@
+JASC-PAL
+0100
+16
+0 0 0
+205 65 24
+255 123 90
+255 180 148
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
diff --git a/graphics/pokeblock/white.pal b/graphics/pokeblock/white.pal
new file mode 100644
index 000000000..c1d00b93a
--- /dev/null
+++ b/graphics/pokeblock/white.pal
@@ -0,0 +1,19 @@
+JASC-PAL
+0100
+16
+0 0 0
+222 222 222
+238 238 238
+255 255 255
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
diff --git a/graphics/pokeblock/yellow.pal b/graphics/pokeblock/yellow.pal
new file mode 100644
index 000000000..518042d9f
--- /dev/null
+++ b/graphics/pokeblock/yellow.pal
@@ -0,0 +1,19 @@
+JASC-PAL
+0100
+16
+0 0 0
+180 180 49
+246 230 49
+255 255 148
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
diff --git a/include/graphics.h b/include/graphics.h
index 4a522a429..ed0bfb108 100644
--- a/include/graphics.h
+++ b/include/graphics.h
@@ -1,10 +1,7 @@
-//
-// Created by scott on 10/21/2017.
-//
-
#ifndef GUARD_GRAPHICS_H
#define GUARD_GRAPHICS_H
+// interface pokeballs
extern const u8 gInterfaceGfx_PokeBall[];
extern const u8 gInterfacePal_PokeBall[];
extern const u8 gInterfaceGfx_GreatBall[];
@@ -31,6 +28,23 @@ extern const u8 gInterfaceGfx_PremierBall[];
extern const u8 gInterfacePal_PremierBall[];
extern const u8 gOpenPokeballGfx[];
+// pokeblock
+extern const u8 gPokeblockRed_Pal[];
+extern const u8 gPokeblockBlue_Pal[];
+extern const u8 gPokeblockPink_Pal[];
+extern const u8 gPokeblockGreen_Pal[];
+extern const u8 gPokeblockYellow_Pal[];
+extern const u8 gPokeblockPurple_Pal[];
+extern const u8 gPokeblockIndigo_Pal[];
+extern const u8 gPokeblockBrown_Pal[];
+extern const u8 gPokeblockLiteBlue_Pal[];
+extern const u8 gPokeblockOlive_Pal[];
+extern const u8 gPokeblockGray_Pal[];
+extern const u8 gPokeblockBlack_Pal[];
+extern const u8 gPokeblockWhite_Pal[];
+extern const u8 gPokeblockGold_Pal[];
+extern const u8 gPokeblock_Gfx[];
+
extern const u8 gItemIcon_QuestionMark[];
extern const u8 gItemIconPalette_QuestionMark[];
extern const u8 gUnknown_08DB7AA0[];
diff --git a/include/pokeblock.h b/include/pokeblock.h
index 4d869df86..058c0815e 100644
--- a/include/pokeblock.h
+++ b/include/pokeblock.h
@@ -25,6 +25,9 @@ enum
};
// use pokeblock
+extern u8 gPokeblockMonId;
+extern s16 gPokeblockGain;
+
void ChooseMonToGivePokeblock(struct Pokeblock *pokeblock, void (*callback)(void));
// pokeblock feed
diff --git a/ld_script.txt b/ld_script.txt
index bb7b1365f..ba8885d81 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -451,7 +451,6 @@ SECTIONS {
src/save_failed_screen.o(.rodata);
data/braille_puzzles.o(.rodata);
src/pokeblock_feed.o(.rodata);
- data/pokeblock_feed.o(.rodata);
src/clear_save_data_screen.o(.rodata);
data/intro_credits_graphics.o(.rodata);
src/evolution_graphics.o(.rodata);
diff --git a/src/pokeblock_feed.c b/src/pokeblock_feed.c
index 1659e4d77..58a8667fd 100644
--- a/src/pokeblock_feed.c
+++ b/src/pokeblock_feed.c
@@ -21,6 +21,7 @@
#include "m4a.h"
#include "sound.h"
#include "trig.h"
+#include "graphics.h"
#include "battle.h" // to get rid of once gMonSpritesGfxPtr is put elsewhere
struct PokeblockFeedStruct
@@ -45,12 +46,10 @@ struct PokeblockFeedStruct
u8 pokeblockSpriteId;
s16 field_1060[15];
s16 loadGfxState;
- u8 somefield[2];
+ u8 unused;
};
-extern u8 gPokeblockMonId;
extern u16 gSpecialVar_ItemId;
-extern s16 gPokeblockGain;
extern struct MusicPlayerInfo gMPlay_BGM;
extern struct SpriteTemplate gUnknown_0202499C;
@@ -58,16 +57,9 @@ extern const u8 gBattleTerrainPalette_Frontier[];
extern const u8 gBattleTerrainTiles_Building[];
extern const u8 gUnknown_08D9BA44[];
extern const struct CompressedSpriteSheet gPokeblockCase_SpriteSheet;
-extern const struct CompressedSpriteSheet gPokeblock_SpriteSheet;
extern const struct CompressedSpritePalette gPokeblockCase_SpritePal;
extern const struct CompressedSpriteSheet gMonFrontPicTable[];
extern const u16 gUnknown_0860F074[];
-extern const u8 *sPokeblocksPals[];
-extern const union AffineAnimCmd * const sSpriteAffineAnimTable_85F05B0[];
-extern const union AffineAnimCmd * const sSpriteAffineAnimTable_85F0664[];
-extern const union AffineAnimCmd * const sSpriteAffineAnimTable_85F0668[];
-extern const union AffineAnimCmd * const sSpriteAffineAnimTable_85F066C[];
-extern const struct SpriteTemplate sThrownPokeblockSpriteTemplate;
extern bool8 sub_81221EC(void);
extern void sub_806A068(u16, u8);
@@ -95,6 +87,7 @@ static bool8 LoadMonAndSceneGfx(struct Pokemon *mon);
static u8 CreatePokeblockSprite(void);
static u8 CreatePokeblockCaseSpriteForFeeding(void);
static u8 CreateMonSprite(struct Pokemon *mon);
+static void SpriteCB_ThrownPokeblock(struct Sprite* sprite);
// ram variables
EWRAM_DATA static struct PokeblockFeedStruct *sPokeblockFeed = NULL;
@@ -399,6 +392,136 @@ static const struct WindowTemplate sWindowTemplates[] =
DUMMY_WIN_TEMPLATE
};
+static const u8* const sPokeblocksPals[] =
+{
+ gPokeblockRed_Pal,
+ gPokeblockBlue_Pal,
+ gPokeblockPink_Pal,
+ gPokeblockGreen_Pal,
+ gPokeblockYellow_Pal,
+ gPokeblockPurple_Pal,
+ gPokeblockIndigo_Pal,
+ gPokeblockBrown_Pal,
+ gPokeblockLiteBlue_Pal,
+ gPokeblockOlive_Pal,
+ gPokeblockGray_Pal,
+ gPokeblockBlack_Pal,
+ gPokeblockWhite_Pal,
+ gPokeblockGold_Pal
+};
+
+static const union AffineAnimCmd sSpriteAffineAnim_84120DC[] =
+{
+ AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0),
+ AFFINEANIMCMD_END
+};
+
+static const union AffineAnimCmd *const sSpriteAffineAnimTable_MonNoFlip[] =
+{
+ sSpriteAffineAnim_84120DC
+};
+
+static const union AffineAnimCmd sSpriteAffineAnim_84120F0[] =
+{
+ AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0),
+ AFFINEANIMCMD_FRAME(0x0, 0x0, -8, 1),
+ AFFINEANIMCMD_FRAME(0x0, 0x0, -8, 1),
+ AFFINEANIMCMD_FRAME(0x0, 0x0, -8, 1),
+ AFFINEANIMCMD_FRAME(0x0, 0x0, -8, 1),
+ AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 8),
+ AFFINEANIMCMD_FRAME(0x0, 0x0, 16, 1),
+ AFFINEANIMCMD_FRAME(0x0, 0x0, 16, 1),
+ AFFINEANIMCMD_FRAME(0x0, 0x0, 16, 1),
+ AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0),
+ AFFINEANIMCMD_END
+};
+
+static const union AffineAnimCmd sSpriteAffineAnim_8412148[] =
+{
+ AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0),
+ AFFINEANIMCMD_FRAME(0x0, 0x0, 8, 1),
+ AFFINEANIMCMD_FRAME(0x0, 0x0, 8, 1),
+ AFFINEANIMCMD_FRAME(0x0, 0x0, 8, 1),
+ AFFINEANIMCMD_FRAME(0x0, 0x0, 8, 1),
+ AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 8),
+ AFFINEANIMCMD_FRAME(0x0, 0x0, -16, 1),
+ AFFINEANIMCMD_FRAME(0x0, 0x0, -16, 1),
+ AFFINEANIMCMD_FRAME(0x0, 0x0, -16, 1),
+ AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0),
+ AFFINEANIMCMD_END
+};
+
+static const union AffineAnimCmd *const sSpriteAffineAnimTable_85F0664[] =
+{
+ sSpriteAffineAnim_84120DC
+};
+
+static const union AffineAnimCmd *const sSpriteAffineAnimTable_85F0668[] =
+{
+ sSpriteAffineAnim_84120F0
+};
+
+static const union AffineAnimCmd *const sSpriteAffineAnimTable_85F066C[] =
+{
+ sSpriteAffineAnim_8412148
+};
+
+static const struct OamData sThrownPokeblockOamData =
+{
+ .y = 0,
+ .affineMode = 3,
+ .objMode = 0,
+ .mosaic = 0,
+ .bpp = 0,
+ .shape = 0,
+ .x = 0,
+ .matrixNum = 0,
+ .size = 0,
+ .tileNum = 0,
+ .priority = 1,
+ .paletteNum = 0,
+ .affineParam = 0,
+};
+
+static const union AnimCmd sThrownPokeblockSpriteAnim[] =
+{
+ ANIMCMD_FRAME(0, 0),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const sThrownPokeblockAnimTable[] =
+{
+ sThrownPokeblockSpriteAnim,
+};
+
+static const union AffineAnimCmd sSpriteAffineAnim_84121C0[] =
+{
+ AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
+ AFFINEANIMCMD_FRAME(-8, -8, 0, 1),
+ AFFINEANIMCMD_JUMP(1)
+};
+
+static const union AffineAnimCmd *const sThrownPokeblockAffineAnimTable[] =
+{
+ sSpriteAffineAnim_84121C0
+};
+
+static const struct CompressedSpriteSheet sPokeblock_SpriteSheet =
+{
+ gPokeblock_Gfx, 0x20, TAG_POKEBLOCK_GFX
+};
+
+static const struct SpriteTemplate sThrownPokeblockSpriteTemplate =
+{
+ .tileTag = TAG_POKEBLOCK_GFX,
+ .paletteTag = TAG_POKEBLOCK_GFX,
+ .oam = &sThrownPokeblockOamData,
+ .anims = sThrownPokeblockAnimTable,
+ .images = NULL,
+ .affineAnims = sThrownPokeblockAffineAnimTable,
+ .callback = SpriteCB_ThrownPokeblock
+};
+
// code
static void CB2_PokeblockFeed(void)
{
@@ -554,7 +677,7 @@ static bool8 LoadMonAndSceneGfx(struct Pokemon *mon)
sPokeblockFeed->loadGfxState++;
break;
case 4:
- LoadCompressedObjectPic(&gPokeblock_SpriteSheet);
+ LoadCompressedObjectPic(&sPokeblock_SpriteSheet);
sPokeblockFeed->loadGfxState++;
break;
case 5:
@@ -601,6 +724,8 @@ static void SetPokeblockSpritePal(u8 pokeblockCaseId)
sPokeblockSpritePal.tag = TAG_POKEBLOCK_GFX;
}
+// defines for task data fields
+
#define tFrames data[0]
#define tData1 data[1]
@@ -697,6 +822,12 @@ static void Task_PaletteFadeToReturn(u8 taskId)
#undef tFrames
#undef tData1
+// defines for mon sprite data fields
+
+#define tDelta data[0]
+#define tDeltaMod data[1]
+#define tSpecies data[2]
+
static u8 CreateMonSprite(struct Pokemon* mon)
{
u16 species = GetMonData(mon, MON_DATA_SPECIES2);
@@ -705,13 +836,13 @@ static u8 CreateMonSprite(struct Pokemon* mon)
sPokeblockFeed->species = species;
sPokeblockFeed->monSpriteId_ = spriteId;
sPokeblockFeed->nature = GetNature(mon);
- gSprites[spriteId].data[2] = species;
+ gSprites[spriteId].tSpecies = species;
gSprites[spriteId].callback = SpriteCallbackDummy;
sPokeblockFeed->noMonFlip = TRUE;
if (!IsPokeSpriteNotFlipped(species))
{
- gSprites[spriteId].affineAnims = sSpriteAffineAnimTable_85F05B0;
+ gSprites[spriteId].affineAnims = sSpriteAffineAnimTable_MonNoFlip;
gSprites[spriteId].oam.affineMode = 3;
CalcCenterToCornerVec(&gSprites[spriteId], gSprites[spriteId].oam.shape, gSprites[spriteId].oam.size, gSprites[spriteId].oam.affineMode);
sPokeblockFeed->noMonFlip = FALSE;
@@ -724,23 +855,27 @@ static void PrepareMonToMoveToPokeblock(u8 spriteId)
{
gSprites[spriteId].pos1.x = 48;
gSprites[spriteId].pos1.y = 80;
- gSprites[spriteId].data[0] = -8;
- gSprites[spriteId].data[1] = 1;
+ gSprites[spriteId].tDelta = -8;
+ gSprites[spriteId].tDeltaMod = 1;
gSprites[spriteId].callback = sub_817A468;
}
static void sub_817A468(struct Sprite* sprite)
{
sprite->pos1.x += 4;
- sprite->pos1.y += sprite->data[0];
- sprite->data[0] += sprite->data[1];
+ sprite->pos1.y += sprite->tDelta;
+ sprite->tDelta += sprite->tDeltaMod;
- if (sprite->data[0] == 0)
- PlayCry1(sprite->data[2], 0);
- if (sprite->data[0] == 9)
+ if (sprite->tDelta == 0)
+ PlayCry1(sprite->tSpecies, 0);
+ if (sprite->tDelta == 9)
sprite->callback = SpriteCallbackDummy;
}
+#undef tDelta
+#undef tDeltaMod
+#undef tSpecies
+
static u8 CreatePokeblockCaseSpriteForFeeding(void)
{
u8 spriteId = CreatePokeblockCaseSprite(188, 100, 2);
@@ -764,23 +899,30 @@ static void DoPokeblockCaseThrowEffect(u8 spriteId, bool8 a1)
InitSpriteAffineAnim(&gSprites[spriteId]);
}
+// defines for the pokeblock sprite data fields
+#define tDelta data[0]
+#define tDeltaMod data[1]
+
static u8 CreatePokeblockSprite(void)
{
u8 spriteId = CreateSprite(&sThrownPokeblockSpriteTemplate, 174, 84, 1);
- gSprites[spriteId].data[0] = -12;
- gSprites[spriteId].data[1] = 1;
+ gSprites[spriteId].tDelta = -12;
+ gSprites[spriteId].tDeltaMod = 1;
return spriteId;
}
static void SpriteCB_ThrownPokeblock(struct Sprite* sprite)
{
sprite->pos1.x -= 4;
- sprite->pos1.y += sprite->data[0];
- sprite->data[0] += sprite->data[1];
- if (sprite->data[0] == 10)
+ sprite->pos1.y += sprite->tDelta;
+ sprite->tDelta += sprite->tDeltaMod;
+ if (sprite->tDelta == 10)
DestroySprite(sprite);
}
+#undef tDelta
+#undef tDeltaMod
+
static void sub_817A5CC(void)
{
u8 animId, i;
diff --git a/src/use_pokeblock.c b/src/use_pokeblock.c
index 64d1cb4a5..1a210b101 100644
--- a/src/use_pokeblock.c
+++ b/src/use_pokeblock.c
@@ -37,12 +37,6 @@ struct UsePokeblockStruct
struct UsePokeblockSubStruct info;
};
-extern struct UsePokeblockStruct *gUnknown_0203BCAC;
-extern struct UsePokeblockSubStruct *gUnknown_0203BC90;
-extern struct Pokeblock *gUnknown_0203BC98;
-extern void (*gUnknown_0203BC94)(void);
-extern u8 gPokeblockMonId;
-
extern u16 gKeyRepeatStartDelay;
// this file's functions
@@ -64,6 +58,17 @@ void sub_8167BA0(u16 arg0, u8 copyToVramMode);
extern const struct BgTemplate gUnknown_085DFCCC[4];
extern const struct WindowTemplate gUnknown_085DFCDC[];
+// ram variables
+EWRAM_DATA struct UsePokeblockSubStruct *gUnknown_0203BC90 = NULL;
+EWRAM_DATA void (*gUnknown_0203BC94)(void) = NULL;
+EWRAM_DATA struct Pokeblock *gUnknown_0203BC98 = NULL;
+EWRAM_DATA u8 gPokeblockMonId = 0;
+EWRAM_DATA s16 gPokeblockGain = 0;
+EWRAM_DATA void *gUnknown_0203BCA0 = NULL;
+EWRAM_DATA void *gUnknown_0203BCA4 = NULL;
+EWRAM_DATA void *gUnknown_0203BCA8 = NULL;
+EWRAM_DATA struct UsePokeblockStruct *gUnknown_0203BCAC = NULL;
+
void ChooseMonToGivePokeblock(struct Pokeblock *pokeblock, void (*callback)(void))
{
gUnknown_0203BCAC = AllocZeroed(0x806C);
diff --git a/sym_ewram.txt b/sym_ewram.txt
index b33bdfa00..2e4295a03 100644
--- a/sym_ewram.txt
+++ b/sym_ewram.txt
@@ -1306,32 +1306,7 @@ gUnknown_0203BC88: @ 203BC88
gUnknown_0203BC8C: @ 203BC8C
.space 0x4
-gUnknown_0203BC90: @ 203BC90
- .space 0x4
-
-gUnknown_0203BC94: @ 203BC94
- .space 0x4
-
-gUnknown_0203BC98: @ 203BC98
- .space 0x4
-
-gPokeblockMonId: @ 203BC9C
- .space 0x2
-
-gPokeblockGain: @ 203BC9E
- .space 0x2
-
-gUnknown_0203BCA0: @ 203BCA0
- .space 0x4
-
-gUnknown_0203BCA4: @ 203BCA4
- .space 0x4
-
-gUnknown_0203BCA8: @ 203BCA8
- .space 0x4
-
-gUnknown_0203BCAC: @ 203BCAC
- .space 0x4
+ .include "src/use_pokeblock.o"
gUnknown_0203BCB0: @ 203BCB0
.space 0x4