sub_818D5B0

This commit is contained in:
PikalaxALT 2017-09-19 08:13:53 -04:00
parent 7e157f2027
commit 6ef3f9dd50
2 changed files with 31 additions and 83 deletions

View file

@ -5,88 +5,6 @@
.text
thumb_func_start sub_818D5B0
sub_818D5B0: @ 818D5B0
push {r4-r7,lr}
mov r7, r8
push {r7}
lsls r0, 16
lsrs r4, r0, 16
movs r2, 0
ldr r0, =gUnknown_0203CD04
ldrb r1, [r0, 0xA]
adds r3, r0, 0
cmp r1, r4
beq _0818D5E0
adds r1, r3, 0
_0818D5C8:
adds r0, r2, 0x1
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0x7
bhi _0818D5E0
lsls r0, r2, 1
adds r0, r2
lsls r0, 2
adds r0, r1
ldrb r0, [r0, 0xA]
cmp r0, r4
bne _0818D5C8
_0818D5E0:
cmp r2, 0x8
bne _0818D5F0
ldr r0, =0x0000ffff
b _0818D646
.pool
_0818D5F0:
lsls r0, r2, 1
adds r0, r2
lsls r0, 2
adds r5, r0, r3
ldr r1, [r5]
mov r8, r1
adds r1, r3, 0x4
adds r0, r1
ldr r7, [r0]
ldrh r1, [r5, 0x8]
ldr r0, =0x0000ffff
lsls r6, r4, 4
cmp r1, r0
beq _0818D624
ldr r1, =gSprites
adds r0, r6, r4
lsls r0, 2
adds r0, r1
ldrb r0, [r0, 0x5]
lsrs r0, 4
bl GetSpritePaletteTagByPaletteNum
lsls r0, 16
lsrs r0, 16
bl FreeSpritePaletteByTag
_0818D624:
adds r0, r6, r4
lsls r0, 2
ldr r1, =gSprites
adds r0, r1
bl DestroySprite
mov r0, r8
bl Free
adds r0, r7, 0
bl Free
adds r1, r5, 0
ldr r0, =gUnknown_0860B058
ldm r0!, {r2-r4}
stm r1!, {r2-r4}
movs r0, 0
_0818D646:
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r1}
bx r1
.pool
thumb_func_end sub_818D5B0
thumb_func_start sub_818D65C
sub_818D65C: @ 818D65C
push {r4-r7,lr}

View file

@ -24,7 +24,7 @@ extern const struct OamData gUnknown_0860B06C;
struct BattleDomeCard {
u8 *frames;
const struct SpriteFrameImage *images;
struct SpriteFrameImage *images;
u16 paletteTag;
u8 spriteId;
u8 active;
@ -306,3 +306,33 @@ u16 sub_818D3E4(u16 species, u32 otId, u32 personality, u8 flags, s16 x, s16 y,
gUnknown_0203CD04[i].active = TRUE;
return spriteId;
}
u16 sub_818D5B0(u16 spriteId)
{
u8 i;
u8 *framePics;
struct SpriteFrameImage *images;
for (i = 0; i < 8; i ++)
{
if (gUnknown_0203CD04[i].spriteId == spriteId)
{
break;
}
}
if (i == 8)
{
return 0xFFFF;
}
framePics = gUnknown_0203CD04[i].frames;
images = gUnknown_0203CD04[i].images;
if (gUnknown_0203CD04[i].paletteTag != 0xFFFF)
{
FreeSpritePaletteByTag(GetSpritePaletteTagByPaletteNum(gSprites[spriteId].oam.paletteNum));
}
DestroySprite(&gSprites[spriteId]);
Free(framePics);
Free(images);
gUnknown_0203CD04[i] = gUnknown_0860B058;
return 0;
}