summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/pokemon_special_anim.s161
-rw-r--r--data/pokemon_special_anim.s63
-rw-r--r--include/pokemon_special_anim_internal.h13
-rw-r--r--include/strings.h6
-rw-r--r--ld_script.txt2
-rw-r--r--src/pokemon_special_anim.c12
-rw-r--r--src/pokemon_special_anim_scene.c116
7 files changed, 141 insertions, 232 deletions
diff --git a/asm/pokemon_special_anim.s b/asm/pokemon_special_anim.s
index 6eed303ea..620689927 100644
--- a/asm/pokemon_special_anim.s
+++ b/asm/pokemon_special_anim.s
@@ -5,167 +5,6 @@
.text
- thumb_func_start sub_811D184
-sub_811D184: @ 811D184
- push {r4,r5,lr}
- sub sp, 0x8
- adds r4, r0, 0
- lsls r5, r1, 16
- lsrs r5, 16
- bl FreeAllWindowBuffers
- bl ResetTempTileDataBuffers
- movs r0, 0
- movs r1, 0
- bl SetGpuReg
- movs r0, 0
- bl ResetBgsAndClearDma3BusyFlags
- ldr r1, _0811D270 @ =gUnknown_8459980
- movs r0, 0
- movs r2, 0x2
- bl InitBgsFromTemplates
- ldr r0, _0811D274 @ =gUnknown_8459988
- bl InitWindows
- movs r0, 0
- movs r1, 0
- movs r2, 0
- bl ChangeBgX
- movs r0, 0
- movs r1, 0
- movs r2, 0
- bl ChangeBgY
- movs r0, 0x3
- movs r1, 0
- movs r2, 0
- bl ChangeBgX
- movs r0, 0x3
- movs r1, 0
- movs r2, 0
- bl ChangeBgY
- ldr r0, _0811D278 @ =0x00000914
- adds r1, r4, r0
- movs r0, 0
- bl SetBgTilemapBuffer
- ldr r0, _0811D27C @ =0x00001914
- adds r4, r0
- movs r0, 0x3
- adds r1, r4, 0
- bl SetBgTilemapBuffer
- movs r1, 0xC0
- lsls r1, 19
- movs r0, 0
- movs r2, 0x20
- movs r3, 0x1
- bl RequestDma3Fill
- movs r0, 0x20
- str r0, [sp]
- str r0, [sp, 0x4]
- movs r0, 0
- movs r1, 0
- movs r2, 0
- movs r3, 0
- bl FillBgTilemapBufferRect_Palette0
- adds r0, r5, 0
- bl sub_811D7D4
- movs r0, 0
- movs r1, 0
- bl FillWindowPixelBuffer
- movs r0, 0
- movs r1, 0
- movs r2, 0xE0
- bl TextWindow_SetUserSelectedFrame
- movs r0, 0
- movs r1, 0x3
- bl CopyWindowToVram
- movs r0, 0
- bl ShowBg
- movs r0, 0x3
- bl ShowBg
- movs r0, 0x1
- bl HideBg
- movs r0, 0x2
- bl HideBg
- movs r0, 0
- bl CopyBgTilemapBufferToVram
- movs r0, 0x3
- bl CopyBgTilemapBufferToVram
- movs r1, 0x82
- lsls r1, 5
- movs r0, 0
- bl SetGpuRegBits
- movs r0, 0x50
- movs r1, 0
- bl SetGpuReg
- add sp, 0x8
- pop {r4,r5}
- pop {r0}
- bx r0
- .align 2, 0
-_0811D270: .4byte gUnknown_8459980
-_0811D274: .4byte gUnknown_8459988
-_0811D278: .4byte 0x00000914
-_0811D27C: .4byte 0x00001914
- thumb_func_end sub_811D184
-
- thumb_func_start sub_811D280
-sub_811D280: @ 811D280
- push {lr}
- bl FreeTempTileDataBuffersIfPossible
- lsls r0, 24
- cmp r0, 0
- beq _0811D290
- movs r0, 0x1
- b _0811D298
-_0811D290:
- bl IsDma3ManagerBusyWithBgCopy
- lsls r0, 24
- lsrs r0, 24
-_0811D298:
- pop {r1}
- bx r1
- thumb_func_end sub_811D280
-
- thumb_func_start sub_811D29C
-sub_811D29C: @ 811D29C
- push {lr}
- bl FreeAllWindowBuffers
- pop {r0}
- bx r0
- thumb_func_end sub_811D29C
-
- thumb_func_start sub_811D2A8
-sub_811D2A8: @ 811D2A8
- push {lr}
- movs r0, 0
- bl PutWindowTilemap
- movs r0, 0
- movs r1, 0x11
- bl FillWindowPixelBuffer
- movs r0, 0
- movs r1, 0x1
- movs r2, 0xE
- bl DrawTextBorderOuter
- movs r0, 0
- movs r1, 0x3
- bl CopyWindowToVram
- pop {r0}
- bx r0
- thumb_func_end sub_811D2A8
-
- thumb_func_start sub_811D2D0
-sub_811D2D0: @ 811D2D0
- push {lr}
- movs r0, 0
- bl ClearWindowTilemap
- movs r0, 0
- movs r1, 0
- bl ClearStdWindowAndFrameToTransparent
- movs r0, 0
- movs r1, 0x1
- bl CopyWindowToVram
- pop {r0}
- bx r0
- thumb_func_end sub_811D2D0
-
thumb_func_start sub_811D2EC
sub_811D2EC: @ 811D2EC
push {r4-r7,lr}
diff --git a/data/pokemon_special_anim.s b/data/pokemon_special_anim.s
index b18f01ef9..b944a4aed 100644
--- a/data/pokemon_special_anim.s
+++ b/data/pokemon_special_anim.s
@@ -6,69 +6,6 @@
.section .rodata
.align 2
-gUnknown_845963C:: @ 845963C gbapal
- .incbin "graphics/pokemon_special_anim/unk_845963C.gbapal"
-
-gUnknown_845965C:: @ 845965C gbapal
- .incbin "graphics/pokemon_special_anim/unk_845965C.gbapal"
-
-gUnknown_845967C:: @ 845967C 4bpp.lz
- .incbin "graphics/pokemon_special_anim/unk_845967C.4bpp.lz"
-
-gUnknown_845973C:: @ 845973C bin.lz
- .incbin "graphics/pokemon_special_anim/unk_845973C.bin.lz"
-
-gUnknown_8459868:: @ 8459868 gbapal
- .incbin "graphics/pokemon_special_anim/unk_8459868.gbapal"
-
-gUnknown_8459888:: @ 8459888 4bpp.lz
- .incbin "graphics/pokemon_special_anim/unk_8459888.4bpp.lz"
-
-gUnknown_84598A4:: @ 84598A4 gbapal
- .incbin "graphics/pokemon_special_anim/unk_84598A4.gbapal"
-
-gUnknown_84598C4:: @ 84598C4 4bpp.lz
- .incbin "graphics/pokemon_special_anim/unk_84598C4.4bpp.lz"
-
-gUnknown_8459940:: @ 8459940 gbapal
- .incbin "graphics/pokemon_special_anim/unk_8459940.gbapal"
-
-gUnknown_8459960:: @ 8459960 4bpp.lz
- .incbin "graphics/pokemon_special_anim/unk_8459960.4bpp.lz"
-
-gUnknown_8459980:: @ 8459980 bg_template
- .4byte 0x000041f0
- @ {
- @ .bg = 0,
- @ .charBaseIndex = 0,
- @ .mapBaseIndex = 31,
- @ .screenSize = 0,
- @ .paletteMode = 0,
- @ .priority = 0,
- @ .baseTile = 0x0001
- @ }
- .4byte 0x000031cf
- @ {
- @ .bg = 3,
- @ .charBaseIndex = 3,
- @ .mapBaseIndex = 28,
- @ .screenSize = 0,
- @ .paletteMode = 0,
- @ .priority = 3,
- @ .baseTile = 0x0000
- @ }
-
-gUnknown_8459988:: @ 8459988 window_template
- .byte 0, 1, 15, 28, 4, 15
- .2byte 0x000a
- .byte 255, 0, 0, 0, 0, 0
- .2byte 0x0000
-
-gUnknown_8459998:: @ 8459998 dataptr
- .4byte gUnknown_841B2ED @ 1,
- .4byte gUnknown_841B2F1 @ 2, and ‥ ‥ ‥
- .4byte gUnknown_841B2FF @ Poof!
-
gUnknown_84599A4:: @ 84599A4
.2byte 0x0000, 0x0010
diff --git a/include/pokemon_special_anim_internal.h b/include/pokemon_special_anim_internal.h
index 276168aa6..048738ebe 100644
--- a/include/pokemon_special_anim_internal.h
+++ b/include/pokemon_special_anim_internal.h
@@ -3,6 +3,15 @@
#include "pokemon_special_anim.h"
+struct PokemonSpecialAnimScene
+{
+ u8 filler_0000[0x914];
+ u8 field_0914[BG_SCREEN_SIZE];
+ u8 field_1114[BG_SCREEN_SIZE];
+ u8 field_1914[BG_SCREEN_SIZE];
+ u8 field_2114[0x720];
+}; // size=0x2834
+
struct PokemonSpecialAnim
{
/*0x0000*/ u8 filler_0000[0x4];
@@ -21,10 +30,10 @@ struct PokemonSpecialAnim
/*0x009e*/ u16 field_009e;
/*0x00a0*/ u32 personality;
/*0x00a4*/ u32 field_00a4;
- /*0x00a8*/ u8 field_00a8[0x2834];
+ /*0x00a8*/ struct PokemonSpecialAnimScene field_00a8;
}; // size=0x28dc
-void sub_811D184(u8 *buffer, u16 animType);
+void sub_811D184(struct PokemonSpecialAnimScene * buffer, u16 animType);
bool8 sub_811D280(void);
void sub_811D29C(void);
void sub_811D2A8(void);
diff --git a/include/strings.h b/include/strings.h
index 6016dc3e3..82c35d552 100644
--- a/include/strings.h
+++ b/include/strings.h
@@ -1441,4 +1441,10 @@ extern const u8 gPCText_Pokecenter[];
extern const u8 gPCText_Machine[];
extern const u8 gPCText_Simple[];
+// pokemon_special_anim
+
+extern const u8 gUnknown_841B2ED[];
+extern const u8 gUnknown_841B2F1[];
+extern const u8 gUnknown_841B2FF[];
+
#endif //GUARD_STRINGS_H
diff --git a/ld_script.txt b/ld_script.txt
index b9de60577..bd57e8664 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -252,6 +252,7 @@ SECTIONS {
src/rfu_union_tool.o(.text);
src/union_room_battle.o(.text);
src/pokemon_special_anim.o(.text);
+ src/pokemon_special_anim_scene.o(.text);
asm/pokemon_special_anim.o(.text);
src/party_menu.o(.text);
src/union_room_chat.o(.text);
@@ -555,6 +556,7 @@ SECTIONS {
src/union_room_battle.o(.rodata);
src/union_room_message.o(.rodata);
src/pokemon_special_anim.o(.rodata);
+ src/pokemon_special_anim_scene.o(.rodata);
data/pokemon_special_anim.o(.rodata);
src/party_menu.o(.rodata);
src/union_room_chat.o(.rodata);
diff --git a/src/pokemon_special_anim.c b/src/pokemon_special_anim.c
index 46d1251df..b743d65a3 100644
--- a/src/pokemon_special_anim.c
+++ b/src/pokemon_special_anim.c
@@ -172,7 +172,7 @@ void sub_811C834(u8 taskId)
{
case 0:
SetVBlankCallback(NULL);
- sub_811D184(ptr->field_00a8, ptr->animType);
+ sub_811D184(&ptr->field_00a8, ptr->animType);
sub_811D830(0);
ptr->state++;
break;
@@ -282,7 +282,7 @@ void sub_811CA20(u8 taskId)
{
case 0:
SetVBlankCallback(NULL);
- sub_811D184(ptr->field_00a8, ptr->animType);
+ sub_811D184(&ptr->field_00a8, ptr->animType);
sub_811D830(3);
ptr->state++;
break;
@@ -391,7 +391,7 @@ void sub_811CBE4(u8 taskId)
{
case 0:
SetVBlankCallback(NULL);
- sub_811D184(ptr->field_00a8, ptr->animType);
+ sub_811D184(&ptr->field_00a8, ptr->animType);
sub_811D830(0);
ptr->state++;
break;
@@ -468,7 +468,7 @@ void sub_811CD68(u8 taskId)
{
case 0:
SetVBlankCallback(NULL);
- sub_811D184(ptr->field_00a8, ptr->animType);
+ sub_811D184(&ptr->field_00a8, ptr->animType);
sub_811D830(3);
ptr->state++;
break;
@@ -647,9 +647,9 @@ struct Pokemon * sub_811D094(void)
return &gUnknown_203B098->pokemon;
}
-u8 *sub_811D0A8(void)
+struct PokemonSpecialAnimScene * sub_811D0A8(void)
{
- return sub_811D080()->field_00a8;
+ return &sub_811D080()->field_00a8;
}
u16 sub_811D0B4(void)
diff --git a/src/pokemon_special_anim_scene.c b/src/pokemon_special_anim_scene.c
new file mode 100644
index 000000000..760ad2635
--- /dev/null
+++ b/src/pokemon_special_anim_scene.c
@@ -0,0 +1,116 @@
+#include "global.h"
+#include "gflib.h"
+#include "menu.h"
+#include "new_menu_helpers.h"
+#include "pokemon_special_anim_internal.h"
+#include "strings.h"
+#include "text_window.h"
+
+void sub_811D7D4(u16 animType);
+
+const u16 gUnknown_845963C[] = INCBIN_U16("graphics/pokemon_special_anim/unk_845963C.gbapal");
+const u16 gUnknown_845965C[] = INCBIN_U16("graphics/pokemon_special_anim/unk_845965C.gbapal");
+const u32 gUnknown_845967C[] = INCBIN_U32("graphics/pokemon_special_anim/unk_845967C.4bpp.lz");
+const u32 gUnknown_845973C[] = INCBIN_U32("graphics/pokemon_special_anim/unk_845973C.bin.lz");
+const u16 gUnknown_8459868[] = INCBIN_U16("graphics/pokemon_special_anim/unk_8459868.gbapal");
+const u32 gUnknown_8459888[] = INCBIN_U32("graphics/pokemon_special_anim/unk_8459888.4bpp.lz");
+const u16 gUnknown_84598A4[] = INCBIN_U16("graphics/pokemon_special_anim/unk_84598A4.gbapal");
+const u32 gUnknown_84598C4[] = INCBIN_U32("graphics/pokemon_special_anim/unk_84598C4.4bpp.lz");
+const u16 gUnknown_8459940[] = INCBIN_U16("graphics/pokemon_special_anim/unk_8459940.gbapal");
+const u32 gUnknown_8459960[] = INCBIN_U32("graphics/pokemon_special_anim/unk_8459960.4bpp.lz");
+
+const struct BgTemplate gUnknown_8459980[] = {
+ {
+ .bg = 0,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 31,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 0,
+ .baseTile = 0x001
+ }, {
+ .bg = 3,
+ .charBaseIndex = 3,
+ .mapBaseIndex = 28,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 3,
+ .baseTile = 0x000
+ }
+};
+
+const struct WindowTemplate gUnknown_8459988[] = {
+ {
+ .bg = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 15,
+ .width = 28,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 0x00a
+ }, DUMMY_WIN_TEMPLATE
+};
+
+const u8 *const gUnknown_8459998[] = {
+ gUnknown_841B2ED, // 1,
+ gUnknown_841B2F1, // 2, and ‥ ‥ ‥
+ gUnknown_841B2FF, // Poof!
+};
+
+void sub_811D184(struct PokemonSpecialAnimScene * buffer, u16 animType)
+{
+ FreeAllWindowBuffers();
+ ResetTempTileDataBuffers();
+ SetGpuReg(REG_OFFSET_DISPCNT, 0);
+ ResetBgsAndClearDma3BusyFlags(FALSE);
+ InitBgsFromTemplates(0, gUnknown_8459980, NELEMS(gUnknown_8459980));
+ InitWindows(gUnknown_8459988);
+ ChangeBgX(0, 0, 0);
+ ChangeBgY(0, 0, 0);
+ ChangeBgX(3, 0, 0);
+ ChangeBgY(3, 0, 0);
+ SetBgTilemapBuffer(0, buffer->field_0914);
+ SetBgTilemapBuffer(3, buffer->field_1914);
+ RequestDma3Fill(0, (void *)BG_VRAM, 0x20, TRUE);
+ FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 32, 32);
+ sub_811D7D4(animType);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
+ TextWindow_SetUserSelectedFrame(0, 0x000, 0xe0);
+ CopyWindowToVram(0, 3);
+ ShowBg(0);
+ ShowBg(3);
+ HideBg(1);
+ HideBg(2);
+ CopyBgTilemapBufferToVram(0);
+ CopyBgTilemapBufferToVram(3);
+ SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON);
+ SetGpuReg(REG_OFFSET_BLDCNT, 0);
+}
+
+bool8 sub_811D280(void)
+{
+ if (!FreeTempTileDataBuffersIfPossible())
+ return IsDma3ManagerBusyWithBgCopy();
+ else
+ return TRUE;
+}
+
+void sub_811D29C(void)
+{
+ FreeAllWindowBuffers();
+}
+
+void sub_811D2A8(void)
+{
+ PutWindowTilemap(0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
+ DrawTextBorderOuter(0, 0x001, 0xE);
+ CopyWindowToVram(0, 3);
+}
+
+void sub_811D2D0(void)
+{
+ ClearWindowTilemap(0);
+ ClearStdWindowAndFrameToTransparent(0, FALSE);
+ CopyWindowToVram(0, 1);
+}