mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 11:14:15 +01:00
Port smokescreen.s
This commit is contained in:
parent
185cf71842
commit
54922641af
@ -1,214 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_807521C
|
||||
sub_807521C: @ 807521C
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
lsls r0, 16
|
||||
lsrs r6, r0, 16
|
||||
lsls r1, 16
|
||||
lsrs r7, r1, 16
|
||||
lsls r2, 24
|
||||
lsrs r4, r2, 24
|
||||
ldr r5, =gUnknown_0831C620
|
||||
ldrh r0, [r5, 0x6]
|
||||
bl GetSpriteTileStartByTag
|
||||
lsls r0, 16
|
||||
ldr r1, =0xffff0000
|
||||
cmp r0, r1
|
||||
bne _0807524E
|
||||
adds r0, r5, 0
|
||||
bl LoadCompressedObjectPicUsingHeap
|
||||
ldr r0, =gUnknown_0831C628
|
||||
bl LoadCompressedObjectPaletteUsingHeap
|
||||
_0807524E:
|
||||
ldr r0, =sub_8075370
|
||||
bl CreateInvisibleSpriteWithCallback
|
||||
mov r8, r0
|
||||
mov r0, r8
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
mov r8, r0
|
||||
lsls r5, r0, 4
|
||||
add r5, r8
|
||||
lsls r5, 2
|
||||
ldr r0, =gSprites
|
||||
adds r5, r0
|
||||
strh r4, [r5, 0x30]
|
||||
ldr r0, =gUnknown_0831C688
|
||||
mov r9, r0
|
||||
lsls r6, 16
|
||||
asrs r0, r6, 16
|
||||
mov r10, r0
|
||||
ldr r0, =0xfff00000
|
||||
adds r6, r0
|
||||
asrs r6, 16
|
||||
lsls r4, r7, 16
|
||||
asrs r7, r4, 16
|
||||
adds r4, r0
|
||||
asrs r4, 16
|
||||
mov r0, r9
|
||||
adds r1, r6, 0
|
||||
adds r2, r4, 0
|
||||
movs r3, 0x2
|
||||
bl CreateSprite
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
lsls r1, r0, 4
|
||||
adds r1, r0
|
||||
lsls r1, 2
|
||||
ldr r0, =gSprites
|
||||
adds r1, r0
|
||||
mov r0, r8
|
||||
strh r0, [r1, 0x2E]
|
||||
ldrh r0, [r5, 0x2E]
|
||||
adds r0, 0x1
|
||||
strh r0, [r5, 0x2E]
|
||||
adds r0, r1, 0
|
||||
bl AnimateSprite
|
||||
mov r0, r9
|
||||
mov r1, r10
|
||||
adds r2, r4, 0
|
||||
movs r3, 0x2
|
||||
bl CreateSprite
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
lsls r4, r0, 4
|
||||
adds r4, r0
|
||||
lsls r4, 2
|
||||
ldr r0, =gSprites
|
||||
adds r4, r0
|
||||
mov r0, r8
|
||||
strh r0, [r4, 0x2E]
|
||||
ldrh r0, [r5, 0x2E]
|
||||
adds r0, 0x1
|
||||
strh r0, [r5, 0x2E]
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x1
|
||||
bl StartSpriteAnim
|
||||
adds r0, r4, 0
|
||||
bl AnimateSprite
|
||||
mov r0, r9
|
||||
adds r1, r6, 0
|
||||
adds r2, r7, 0
|
||||
movs r3, 0x2
|
||||
bl CreateSprite
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
lsls r4, r0, 4
|
||||
adds r4, r0
|
||||
lsls r4, 2
|
||||
ldr r0, =gSprites
|
||||
adds r4, r0
|
||||
mov r0, r8
|
||||
strh r0, [r4, 0x2E]
|
||||
ldrh r0, [r5, 0x2E]
|
||||
adds r0, 0x1
|
||||
strh r0, [r5, 0x2E]
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x2
|
||||
bl StartSpriteAnim
|
||||
adds r0, r4, 0
|
||||
bl AnimateSprite
|
||||
mov r0, r9
|
||||
mov r1, r10
|
||||
adds r2, r7, 0
|
||||
movs r3, 0x2
|
||||
bl CreateSprite
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
lsls r4, r0, 4
|
||||
adds r4, r0
|
||||
lsls r4, 2
|
||||
ldr r0, =gSprites
|
||||
adds r4, r0
|
||||
mov r0, r8
|
||||
strh r0, [r4, 0x2E]
|
||||
ldrh r0, [r5, 0x2E]
|
||||
adds r0, 0x1
|
||||
strh r0, [r5, 0x2E]
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x3
|
||||
bl StartSpriteAnim
|
||||
adds r0, r4, 0
|
||||
bl AnimateSprite
|
||||
mov r0, r8
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_807521C
|
||||
|
||||
thumb_func_start sub_8075370
|
||||
sub_8075370: @ 8075370
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
movs r1, 0x2E
|
||||
ldrsh r0, [r4, r1]
|
||||
cmp r0, 0
|
||||
bne _080753A8
|
||||
ldr r0, =gUnknown_0831C620
|
||||
ldrh r0, [r0, 0x6]
|
||||
bl FreeSpriteTilesByTag
|
||||
ldr r0, =gUnknown_0831C628
|
||||
ldrh r0, [r0, 0x4]
|
||||
bl FreeSpritePaletteByTag
|
||||
movs r1, 0x30
|
||||
ldrsh r0, [r4, r1]
|
||||
cmp r0, 0
|
||||
bne _080753A4
|
||||
adds r0, r4, 0
|
||||
bl DestroySprite
|
||||
b _080753A8
|
||||
.pool
|
||||
_080753A4:
|
||||
ldr r0, =SpriteCallbackDummy
|
||||
str r0, [r4, 0x1C]
|
||||
_080753A8:
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8075370
|
||||
|
||||
thumb_func_start sub_80753B4
|
||||
sub_80753B4: @ 80753B4
|
||||
push {lr}
|
||||
adds r3, r0, 0
|
||||
adds r0, 0x3F
|
||||
ldrb r1, [r0]
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _080753DE
|
||||
ldr r2, =gSprites
|
||||
movs r0, 0x2E
|
||||
ldrsh r1, [r3, r0]
|
||||
lsls r0, r1, 4
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
adds r0, r2
|
||||
ldrh r1, [r0, 0x2E]
|
||||
subs r1, 0x1
|
||||
strh r1, [r0, 0x2E]
|
||||
adds r0, r3, 0
|
||||
bl DestroySprite
|
||||
_080753DE:
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80753B4
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
@ -16,5 +16,9 @@ extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1];
|
||||
extern const u8 gMoveNames[][13];
|
||||
extern const u8 gAbilityNames[][13];
|
||||
extern const u8 gTypeNames[][7];
|
||||
extern struct CompressedSpriteSheet gUnknown_0831C620;
|
||||
extern struct CompressedSpritePalette gUnknown_0831C628;
|
||||
extern const struct SpriteTemplate gUnknown_0831C688;
|
||||
|
||||
|
||||
#endif // GUARD_DATA2_H
|
||||
|
@ -79,7 +79,7 @@ SECTIONS {
|
||||
src/daycare.o(.text);
|
||||
src/egg_hatch.o(.text);
|
||||
src/battle_interface.o(.text);
|
||||
asm/smokescreen.o(.text);
|
||||
src/smokescreen.o(.text);
|
||||
src/pokeball.o(.text);
|
||||
src/load_save.o(.text);
|
||||
asm/trade.o(.text);
|
||||
|
73
src/smokescreen.c
Normal file
73
src/smokescreen.c
Normal file
@ -0,0 +1,73 @@
|
||||
#include "global.h"
|
||||
#include "data2.h"
|
||||
#include "decompress.h"
|
||||
#include "sprite.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
static void sub_8075370(struct Sprite *);
|
||||
|
||||
|
||||
u8 sub_807521C(s16 x, s16 y, u8 a3)
|
||||
{
|
||||
u8 mainSpriteId;
|
||||
u8 spriteId1, spriteId2, spriteId3, spriteId4;
|
||||
struct Sprite *mainSprite;
|
||||
|
||||
if (GetSpriteTileStartByTag(gUnknown_0831C620.tag) == 0xFFFF)
|
||||
{
|
||||
LoadCompressedObjectPicUsingHeap(&gUnknown_0831C620);
|
||||
LoadCompressedObjectPaletteUsingHeap(&gUnknown_0831C628);
|
||||
}
|
||||
|
||||
mainSpriteId = CreateInvisibleSpriteWithCallback(sub_8075370);
|
||||
mainSprite = &gSprites[mainSpriteId];
|
||||
mainSprite->data[1] = a3;
|
||||
|
||||
spriteId1 = CreateSprite(&gUnknown_0831C688, x - 16, y - 16, 2);
|
||||
gSprites[spriteId1].data[0] = mainSpriteId;
|
||||
mainSprite->data[0]++;
|
||||
AnimateSprite(&gSprites[spriteId1]);
|
||||
|
||||
spriteId2 = CreateSprite(&gUnknown_0831C688, x, y - 16, 2);
|
||||
gSprites[spriteId2].data[0] = mainSpriteId;
|
||||
mainSprite->data[0]++;
|
||||
StartSpriteAnim(&gSprites[spriteId2], 1);
|
||||
AnimateSprite(&gSprites[spriteId2]);
|
||||
|
||||
spriteId3 = CreateSprite(&gUnknown_0831C688, x - 16, y, 2);
|
||||
gSprites[spriteId3].data[0] = mainSpriteId;
|
||||
mainSprite->data[0]++;
|
||||
StartSpriteAnim(&gSprites[spriteId3], 2);
|
||||
AnimateSprite(&gSprites[spriteId3]);
|
||||
|
||||
spriteId4 = CreateSprite(&gUnknown_0831C688, x, y, 2);
|
||||
gSprites[spriteId4].data[0] = mainSpriteId;
|
||||
mainSprite->data[0]++;
|
||||
StartSpriteAnim(&gSprites[spriteId4], 3);
|
||||
AnimateSprite(&gSprites[spriteId4]);
|
||||
|
||||
return mainSpriteId;
|
||||
}
|
||||
|
||||
static void sub_8075370(struct Sprite *sprite)
|
||||
{
|
||||
if (!sprite->data[0])
|
||||
{
|
||||
FreeSpriteTilesByTag(gUnknown_0831C620.tag);
|
||||
FreeSpritePaletteByTag(gUnknown_0831C628.tag);
|
||||
if (!sprite->data[1])
|
||||
DestroySprite(sprite);
|
||||
else
|
||||
sprite->callback = SpriteCallbackDummy;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80753B4(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->animEnded)
|
||||
{
|
||||
gSprites[sprite->data[0]].data[0]--;
|
||||
DestroySprite(sprite);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user