sub_818D3E4
This commit is contained in:
parent
c593b51dc5
commit
52dc68aa89
2 changed files with 92 additions and 269 deletions
|
@ -5,275 +5,6 @@
|
|||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_818D384
|
||||
sub_818D384: @ 818D384
|
||||
push {r4-r7,lr}
|
||||
mov r7, r9
|
||||
mov r6, r8
|
||||
push {r6,r7}
|
||||
sub sp, 0x18
|
||||
ldr r4, [sp, 0x34]
|
||||
ldr r5, [sp, 0x38]
|
||||
ldr r6, [sp, 0x3C]
|
||||
ldr r7, [sp, 0x40]
|
||||
mov r8, r7
|
||||
ldr r7, [sp, 0x44]
|
||||
mov r9, r7
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
lsls r3, 24
|
||||
lsrs r3, 24
|
||||
lsls r6, 24
|
||||
lsrs r6, 24
|
||||
mov r7, r8
|
||||
lsls r7, 16
|
||||
lsrs r7, 16
|
||||
mov r8, r7
|
||||
mov r7, r9
|
||||
lsls r7, 24
|
||||
lsrs r7, 24
|
||||
lsls r4, 16
|
||||
asrs r4, 16
|
||||
str r4, [sp]
|
||||
lsls r5, 16
|
||||
asrs r5, 16
|
||||
str r5, [sp, 0x4]
|
||||
str r6, [sp, 0x8]
|
||||
mov r4, r8
|
||||
str r4, [sp, 0xC]
|
||||
str r7, [sp, 0x10]
|
||||
movs r4, 0
|
||||
str r4, [sp, 0x14]
|
||||
bl oamt_spawn_poke_or_trainer_picture
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
add sp, 0x18
|
||||
pop {r3,r4}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_818D384
|
||||
|
||||
thumb_func_start sub_818D3E4
|
||||
sub_818D3E4: @ 818D3E4
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x2C
|
||||
str r1, [sp, 0x8]
|
||||
str r2, [sp, 0xC]
|
||||
ldr r1, [sp, 0x4C]
|
||||
ldr r2, [sp, 0x50]
|
||||
ldr r4, [sp, 0x54]
|
||||
ldr r5, [sp, 0x58]
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
mov r10, r0
|
||||
lsls r3, 24
|
||||
lsrs r6, r3, 24
|
||||
lsls r1, 16
|
||||
lsrs r1, 16
|
||||
str r1, [sp, 0x10]
|
||||
lsls r2, 16
|
||||
lsrs r2, 16
|
||||
str r2, [sp, 0x14]
|
||||
lsls r4, 24
|
||||
lsrs r4, 24
|
||||
str r4, [sp, 0x18]
|
||||
lsls r5, 16
|
||||
lsrs r5, 16
|
||||
str r5, [sp, 0x1C]
|
||||
movs r5, 0
|
||||
ldr r1, =gUnknown_0203CD04
|
||||
ldrb r0, [r1, 0xB]
|
||||
cmp r0, 0
|
||||
beq _0818D440
|
||||
_0818D428:
|
||||
adds r0, r5, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
cmp r5, 0x7
|
||||
bhi _0818D440
|
||||
lsls r0, r5, 1
|
||||
adds r0, r5
|
||||
lsls r0, 2
|
||||
adds r0, r1
|
||||
ldrb r0, [r0, 0xB]
|
||||
cmp r0, 0
|
||||
bne _0818D428
|
||||
_0818D440:
|
||||
cmp r5, 0x8
|
||||
beq _0818D47C
|
||||
movs r0, 0x80
|
||||
lsls r0, 6
|
||||
bl Alloc
|
||||
adds r7, r0, 0
|
||||
cmp r7, 0
|
||||
beq _0818D47C
|
||||
movs r0, 0x80
|
||||
ands r0, r6
|
||||
cmp r0, 0
|
||||
beq _0818D468
|
||||
movs r0, 0x7F
|
||||
ands r6, r0
|
||||
movs r0, 0x3
|
||||
mov r9, r0
|
||||
b _0818D46A
|
||||
.pool
|
||||
_0818D468:
|
||||
mov r9, r6
|
||||
_0818D46A:
|
||||
movs r0, 0x20
|
||||
bl Alloc
|
||||
mov r8, r0
|
||||
cmp r0, 0
|
||||
bne _0818D484
|
||||
adds r0, r7, 0
|
||||
bl Free
|
||||
_0818D47C:
|
||||
ldr r0, =0x0000ffff
|
||||
b _0818D588
|
||||
.pool
|
||||
_0818D484:
|
||||
movs r0, 0
|
||||
str r0, [sp]
|
||||
str r0, [sp, 0x4]
|
||||
mov r0, r10
|
||||
ldr r1, [sp, 0xC]
|
||||
adds r2, r6, 0
|
||||
adds r3, r7, 0
|
||||
bl load_pokemon_image_TODO
|
||||
lsls r0, 16
|
||||
cmp r0, 0
|
||||
bne _0818D47C
|
||||
lsls r1, r5, 1
|
||||
str r1, [sp, 0x28]
|
||||
ldr r4, =gUnknown_0203CCEC
|
||||
mov r2, r10
|
||||
lsls r2, 2
|
||||
mov r12, r2
|
||||
ldr r0, [sp, 0x10]
|
||||
lsls r0, 16
|
||||
str r0, [sp, 0x20]
|
||||
ldr r1, [sp, 0x14]
|
||||
lsls r1, 16
|
||||
str r1, [sp, 0x24]
|
||||
movs r3, 0x80
|
||||
lsls r3, 4
|
||||
mov r0, r8
|
||||
adds r1, r7, 0
|
||||
adds r6, r3, 0
|
||||
movs r2, 0x3
|
||||
_0818D4C0:
|
||||
str r1, [r0]
|
||||
strh r3, [r0, 0x4]
|
||||
adds r0, 0x8
|
||||
adds r1, r6
|
||||
subs r2, 0x1
|
||||
cmp r2, 0
|
||||
bge _0818D4C0
|
||||
ldr r0, =0x0000ffff
|
||||
strh r0, [r4]
|
||||
ldr r0, =gUnknown_08309AAC
|
||||
add r0, r12
|
||||
ldr r0, [r0]
|
||||
str r0, [r4, 0x8]
|
||||
mov r2, r8
|
||||
str r2, [r4, 0xC]
|
||||
mov r0, r9
|
||||
cmp r0, 0x1
|
||||
bne _0818D4F8
|
||||
ldr r0, =gUnknown_082FF694
|
||||
b _0818D500
|
||||
.pool
|
||||
_0818D4F8:
|
||||
mov r1, r9
|
||||
cmp r1, 0
|
||||
bne _0818D510
|
||||
ldr r0, =gUnknown_082FF618
|
||||
_0818D500:
|
||||
str r0, [r4, 0x10]
|
||||
ldr r0, =gUnknown_0860B06C
|
||||
str r0, [r4, 0x4]
|
||||
b _0818D518
|
||||
.pool
|
||||
_0818D510:
|
||||
ldr r0, =gUnknown_0860B064
|
||||
str r0, [r4, 0x4]
|
||||
ldr r0, =gDummySpriteAffineAnimTable
|
||||
str r0, [r4, 0x10]
|
||||
_0818D518:
|
||||
ldr r2, =nullsub_122
|
||||
str r2, [r4, 0x14]
|
||||
ldr r0, [sp, 0x1C]
|
||||
str r0, [sp]
|
||||
movs r0, 0
|
||||
str r0, [sp, 0x4]
|
||||
mov r0, r10
|
||||
ldr r1, [sp, 0x8]
|
||||
ldr r2, [sp, 0xC]
|
||||
ldr r3, [sp, 0x18]
|
||||
bl sub_818D0C4
|
||||
ldr r2, [sp, 0x20]
|
||||
asrs r1, r2, 16
|
||||
ldr r0, [sp, 0x24]
|
||||
asrs r2, r0, 16
|
||||
adds r0, r4, 0
|
||||
movs r3, 0
|
||||
bl CreateSprite
|
||||
lsls r0, 24
|
||||
lsrs r2, r0, 24
|
||||
adds r6, r2, 0
|
||||
ldr r0, =0x0000ffff
|
||||
ldr r1, [sp, 0x1C]
|
||||
cmp r1, r0
|
||||
bne _0818D566
|
||||
ldr r0, =gSprites
|
||||
lsls r1, r2, 4
|
||||
adds r1, r2
|
||||
lsls r1, 2
|
||||
adds r1, r0
|
||||
ldr r2, [sp, 0x18]
|
||||
lsls r3, r2, 4
|
||||
ldrb r2, [r1, 0x5]
|
||||
movs r0, 0xF
|
||||
ands r0, r2
|
||||
orrs r0, r3
|
||||
strb r0, [r1, 0x5]
|
||||
_0818D566:
|
||||
ldr r1, =gUnknown_0203CD04
|
||||
ldr r2, [sp, 0x28]
|
||||
adds r0, r2, r5
|
||||
lsls r0, 2
|
||||
adds r2, r0, r1
|
||||
str r7, [r2]
|
||||
adds r1, 0x4
|
||||
adds r0, r1
|
||||
mov r1, r8
|
||||
str r1, [r0]
|
||||
mov r0, sp
|
||||
ldrh r0, [r0, 0x1C]
|
||||
strh r0, [r2, 0x8]
|
||||
strb r6, [r2, 0xA]
|
||||
movs r0, 0x1
|
||||
strb r0, [r2, 0xB]
|
||||
adds r0, r6, 0
|
||||
_0818D588:
|
||||
add sp, 0x2C
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_818D3E4
|
||||
|
||||
thumb_func_start sub_818D5B0
|
||||
sub_818D5B0: @ 818D5B0
|
||||
push {r4-r7,lr}
|
||||
|
|
|
@ -15,6 +15,10 @@ extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
|||
extern const union AnimCmd *const gUnknown_082FF70C[];
|
||||
extern const union AnimCmd *const *const gUnknown_0830536C[];
|
||||
extern const struct OamData gUnknown_0860B064;
|
||||
extern const struct OamData gUnknown_0860B06C;
|
||||
extern const union AnimCmd *const *const gUnknown_08309AAC[NUM_SPECIES];
|
||||
extern const union AffineAnimCmd *const gUnknown_082FF694[];
|
||||
extern const union AffineAnimCmd *const gUnknown_082FF618[];
|
||||
|
||||
// Static type declarations
|
||||
|
||||
|
@ -214,3 +218,91 @@ u16 oamt_spawn_poke_or_trainer_picture(u16 species, u32 otId, u32 personality, b
|
|||
gUnknown_0203CD04[i].active = TRUE;
|
||||
return spriteId;
|
||||
}
|
||||
|
||||
u16 sub_818D384(u16 species, u32 otId, u32 personality, bool8 isFrontPic, s16 x, s16 y, u8 paletteSlot, u16 paletteTag, bool8 isTrainer)
|
||||
{
|
||||
return oamt_spawn_poke_or_trainer_picture(species, otId, personality, isFrontPic, x, y, paletteSlot, paletteTag, isTrainer, FALSE);
|
||||
}
|
||||
|
||||
u16 sub_818D3E4(u16 species, u32 otId, u32 personality, u8 flags, s16 x, s16 y, u8 paletteSlot, u16 paletteTag)
|
||||
{
|
||||
u8 *framePics;
|
||||
struct SpriteFrameImage *images;
|
||||
int j;
|
||||
u8 i;
|
||||
u8 spriteId;
|
||||
u8 flags2;
|
||||
|
||||
for (i = 0; i < 8; i ++)
|
||||
{
|
||||
if (!gUnknown_0203CD04[i].active)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == 8)
|
||||
{
|
||||
return 0xFFFF;
|
||||
}
|
||||
framePics = Alloc(4 * 0x800);
|
||||
if (!framePics)
|
||||
{
|
||||
return 0xFFFF;
|
||||
}
|
||||
if (flags & 0x80)
|
||||
{
|
||||
flags &= 0x7F;
|
||||
flags2 = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags2 = flags;
|
||||
}
|
||||
images = Alloc(4 * sizeof(struct SpriteFrameImage));
|
||||
if (!images)
|
||||
{
|
||||
Free(framePics);
|
||||
return 0xFFFF;
|
||||
}
|
||||
if (load_pokemon_image_TODO(species, personality, flags, framePics, FALSE, FALSE))
|
||||
{
|
||||
// debug trap?
|
||||
return 0xFFFF;
|
||||
}
|
||||
for (j = 0; j < 4; j ++)
|
||||
{
|
||||
images[j].data = framePics + 0x800 * j;
|
||||
images[j].size = 0x800;
|
||||
}
|
||||
gUnknown_0203CCEC.tileTag = 0xFFFF;
|
||||
gUnknown_0203CCEC.anims = gUnknown_08309AAC[species];
|
||||
gUnknown_0203CCEC.images = images;
|
||||
if (flags2 == 0x01)
|
||||
{
|
||||
gUnknown_0203CCEC.affineAnims = gUnknown_082FF694;
|
||||
gUnknown_0203CCEC.oam = &gUnknown_0860B06C;
|
||||
}
|
||||
else if (flags2 == 0x00)
|
||||
{
|
||||
gUnknown_0203CCEC.affineAnims = gUnknown_082FF618;
|
||||
gUnknown_0203CCEC.oam = &gUnknown_0860B06C;
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_0203CCEC.oam = &gUnknown_0860B064;
|
||||
gUnknown_0203CCEC.affineAnims = gDummySpriteAffineAnimTable;
|
||||
}
|
||||
gUnknown_0203CCEC.callback = nullsub_122;
|
||||
sub_818D0C4(species, otId, personality, paletteSlot, paletteTag, FALSE);
|
||||
spriteId = CreateSprite(&gUnknown_0203CCEC, x, y, 0);
|
||||
if (paletteTag == 0xFFFF)
|
||||
{
|
||||
gSprites[spriteId].oam.paletteNum = paletteSlot;
|
||||
}
|
||||
gUnknown_0203CD04[i].frames = framePics;
|
||||
gUnknown_0203CD04[i].images = images;
|
||||
gUnknown_0203CD04[i].paletteTag = paletteTag;
|
||||
gUnknown_0203CD04[i].spriteId = spriteId;
|
||||
gUnknown_0203CD04[i].active = TRUE;
|
||||
return spriteId;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue