From 368b0f9ee8500c5f15d511c827d8b59795fab82b Mon Sep 17 00:00:00 2001 From: scnorton Date: Wed, 6 Sep 2017 09:38:38 -0400 Subject: [PATCH] sub_808D450 --- asm/field_map_obj.s | 77 ----------------------------------------- include/field_map_obj.h | 4 +++ src/field_map_obj.c | 19 +++++++++- 3 files changed, 22 insertions(+), 78 deletions(-) diff --git a/asm/field_map_obj.s b/asm/field_map_obj.s index 321f556f11..ccd56427c5 100644 --- a/asm/field_map_obj.s +++ b/asm/field_map_obj.s @@ -5,83 +5,6 @@ .text - thumb_func_start sub_808D450 -sub_808D450: @ 808D450 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x54] - mov r9, r0 - movs r1, 0 - movs r2, 0 - movs r3, 0x1F - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSprites - mov r10, r1 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - add r4, r10 - ldrb r1, [r4, 0x1] - movs r5, 0x4 - negs r5, r5 - adds r0, r5, 0 - ands r0, r1 - movs r1, 0x1 - mov r8, r1 - mov r1, r8 - orrs r0, r1 - strb r0, [r4, 0x1] - adds r0, r4, 0 - bl InitSpriteAffineAnim - adds r0, r4, 0 - movs r1, 0 - bl StartSpriteAffineAnim - adds r4, 0x3E - ldrb r0, [r4] - movs r6, 0x4 - orrs r0, r6 - strb r0, [r4] - mov r0, r9 - movs r1, 0 - movs r2, 0 - movs r3, 0x1F - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - add r4, r10 - ldrb r0, [r4, 0x1] - ands r5, r0 - mov r0, r8 - orrs r5, r0 - strb r5, [r4, 0x1] - adds r0, r4, 0 - bl InitSpriteAffineAnim - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAffineAnim - adds r4, 0x3E - ldrb r0, [r4] - orrs r0, r6 - strb r0, [r4] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808D450 - thumb_func_start sub_808D4F4 sub_808D4F4: @ 808D4F4 push {lr} diff --git a/include/field_map_obj.h b/include/field_map_obj.h index 30490d4c60..d92b28f8c5 100644 --- a/include/field_map_obj.h +++ b/include/field_map_obj.h @@ -11,4 +11,8 @@ extern struct MapObject gUnknown_02037350[16]; void sub_808D438(void); +// Exported data declarations + +extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[]; + #endif //POKEEMERALD_FIELD_MAP_OBJ_H diff --git a/src/field_map_obj.c b/src/field_map_obj.c index fd4a19397a..7b5731e687 100644 --- a/src/field_map_obj.c +++ b/src/field_map_obj.c @@ -12,7 +12,7 @@ // Static ROM declarations -void sub_808D450(void); +/*static*/ void sub_808D450(void); // ROM data @@ -43,3 +43,20 @@ void sub_808D438(void) ClearPlayerAvatarInfo(); sub_808D450(); } + +/*static*/ void sub_808D450(void) +{ + u8 spriteIdx; + + spriteIdx = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[21], 0, 0, 31); + gSprites[spriteIdx].oam.affineMode = 1; + InitSpriteAffineAnim(&gSprites[spriteIdx]); + StartSpriteAffineAnim(&gSprites[spriteIdx], 0); + gSprites[spriteIdx].invisible = TRUE; + + spriteIdx = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[21], 0, 0, 31); + gSprites[spriteIdx].oam.affineMode = 1; + InitSpriteAffineAnim(&gSprites[spriteIdx]); + StartSpriteAffineAnim(&gSprites[spriteIdx], 1); + gSprites[spriteIdx].invisible = TRUE; +}