sub_80A671C

This commit is contained in:
DizzyEggg
2025-05-14 11:56:46 +02:00
parent 2e724efa76
commit eda1ebec35
2 changed files with 85 additions and 216 deletions

View File

@@ -5,224 +5,8 @@
.text
thumb_func_start sub_80A65F0
sub_80A65F0:
push {r4-r6,lr}
adds r3, r0, 0
lsls r1, 16
lsrs r1, 16
adds r0, 0x50
strh r1, [r0]
movs r0, 0x4
ands r0, r1
lsls r0, 16
lsrs r0, 16
negs r0, r0
asrs r2, r0, 31
movs r0, 0x40
ands r2, r0
movs r0, 0x2
ands r0, r1
cmp r0, 0
beq _080A6616
subs r2, 0x40
_080A6616:
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _080A6624
adds r1, r2, 0
adds r1, 0x48
b _080A6628
_080A6624:
adds r1, r2, 0
adds r1, 0x40
_080A6628:
adds r0, r3, 0
adds r0, 0x6A
strh r1, [r0]
adds r2, r3, 0
adds r2, 0x50
ldrh r1, [r2]
movs r0, 0x8
ands r0, r1
cmp r0, 0
beq _080A6648
adds r1, r3, 0
adds r1, 0x3C
ldr r0, _080A6644
b _080A664E
.align 2, 0
_080A6644: .4byte gUnknown_2039DC0
_080A6648:
adds r1, r3, 0
adds r1, 0x3C
ldr r0, _080A6680
_080A664E:
ldm r0!, {r4-r6}
stm r1!, {r4-r6}
ldrh r1, [r2]
movs r0, 0x20
ands r0, r1
cmp r0, 0
beq _080A6678
ldrh r2, [r3, 0x3C]
ldr r1, _080A6684
adds r0, r1, 0
ands r0, r2
strh r0, [r3, 0x3C]
adds r2, r3, 0
adds r2, 0x42
ldrh r0, [r2]
ands r1, r0
movs r3, 0x80
lsls r3, 3
adds r0, r3, 0
orrs r1, r0
strh r1, [r2]
_080A6678:
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_080A6680: .4byte gUnknown_2039DB0
_080A6684: .4byte 0x0000f3ff
thumb_func_end sub_80A65F0
thumb_func_start sub_80A6688
sub_80A6688:
push {r4,lr}
adds r4, r0, 0
adds r0, r1, 0
bl sub_80A65E0
adds r1, r0, 0
lsls r1, 16
lsrs r1, 16
adds r0, r4, 0
bl sub_80A65F0
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_80A6688
thumb_func_start SpriteHasPokemonSize_80A66A4
SpriteHasPokemonSize_80A66A4:
push {lr}
movs r1, 0
adds r0, 0x48
movs r2, 0
ldrsh r0, [r0, r2]
cmp r0, 0
ble _080A66B4
movs r1, 0x1
_080A66B4:
adds r0, r1, 0
pop {r1}
bx r1
thumb_func_end SpriteHasPokemonSize_80A66A4
thumb_func_start sub_80A66BC
sub_80A66BC:
push {lr}
adds r0, 0x52
movs r1, 0
ldrsh r0, [r0, r1]
cmp r0, 0
bge _080A66CC
movs r0, 0
b _080A66CE
_080A66CC:
movs r0, 0x1
_080A66CE:
pop {r1}
bx r1
thumb_func_end sub_80A66BC
thumb_func_start sub_80A66D4
sub_80A66D4:
push {lr}
adds r1, r0, 0
adds r0, 0x52
movs r2, 0
ldrsh r0, [r0, r2]
cmp r0, 0
bge _080A66F2
adds r0, r1, 0
adds r0, 0x48
movs r1, 0
ldrsh r0, [r0, r1]
cmp r0, 0
ble _080A66F2
movs r0, 0x1
b _080A66F4
_080A66F2:
movs r0, 0
_080A66F4:
pop {r1}
bx r1
thumb_func_end sub_80A66D4
thumb_func_start sub_80A66F8
sub_80A66F8:
push {lr}
adds r1, r0, 0
adds r0, 0x52
movs r2, 0
ldrsh r0, [r0, r2]
cmp r0, 0
blt _080A6716
ldrh r1, [r1]
movs r0, 0x80
lsls r0, 6
ands r0, r1
cmp r0, 0
bne _080A6716
lsrs r0, r1, 15
b _080A6718
_080A6716:
movs r0, 0
_080A6718:
pop {r1}
bx r1
thumb_func_end sub_80A66F8
thumb_func_start sub_80A671C
sub_80A671C:
push {r4-r6,lr}
adds r4, r0, 0
adds r6, r4, 0
adds r6, 0x58
movs r0, 0
ldrsh r1, [r6, r0]
cmp r1, 0
beq _080A6752
movs r0, 0xE0
lsls r0, 1
cmp r1, r0
beq _080A674A
ldr r0, [r4, 0x5C]
movs r5, 0x1
negs r5, r5
cmp r0, r5
beq _080A674A
bl sub_800E9E4
lsls r0, 24
lsrs r0, 24
cmp r0, 0
beq _080A674E
_080A674A:
movs r0, 0x1
b _080A6754
_080A674E:
str r5, [r4, 0x5C]
strh r0, [r6]
_080A6752:
movs r0, 0
_080A6754:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_80A671C
thumb_func_start IsOnscreen_80A675C
IsOnscreen_80A675C:

View File

@@ -205,3 +205,88 @@ u16 sub_80A65E0(u32 a0)
{
return (a0 >> 16) & 0x337F;
}
// TODO: This struct should probable be merged with an already existing one? Or
struct UnkGroundSpriteStruct
{
u16 unk0;
u8 fill2[0x3a];
unkStruct_2039DB0 unk3C;
s16 unk48;
u8 fill4A[6];
u16 unk50;
s16 unk52;
u8 fill54[4];
s16 unk58;
u32 unk5C;
u8 fill60[0x6a-0x60];
u16 unk6A;
};
void sub_80A65F0(struct UnkGroundSpriteStruct *ptr, u16 a1)
{
ptr->unk50 = a1;
ptr->unk6A = ((a1 & 4) ? 0x40 : 0) - ((a1 & 2) ? 0x40 : 0) + ((a1 & 1) ? 0x8 : 0) + 0x40;
if (ptr->unk50 & 0x8) {
ptr->unk3C = gUnknown_2039DC0;
}
else {
ptr->unk3C = gUnknown_2039DB0;
}
if (ptr->unk50 & 0x20) {
ptr->unk3C.unk0 &= 0xF3FF;
ptr->unk3C.unk6 &= 0xF3FF;
ptr->unk3C.unk6 |= 0x400;
}
}
void sub_80A6688(struct UnkGroundSpriteStruct *ptr, s32 a0)
{
sub_80A65F0(ptr, sub_80A65E0(a0));
}
bool8 SpriteHasPokemonSize_80A66A4(struct UnkGroundSpriteStruct *ptr)
{
return (ptr->unk48 > 0);
}
UNUSED static bool8 sub_80A66BC(struct UnkGroundSpriteStruct *ptr)
{
if (ptr->unk52 >= 0)
return TRUE;
else
return FALSE;
}
bool8 sub_80A66D4(struct UnkGroundSpriteStruct *ptr)
{
if (ptr->unk52 < 0 && ptr->unk48 > 0)
return TRUE;
else
return FALSE;
}
bool8 sub_80A66F8(struct UnkGroundSpriteStruct *ptr)
{
if (ptr->unk52 >= 0 && !(ptr->unk0 & 0x2000)) {
return (ptr->unk0 & 0x8000) != 0;
}
return FALSE;
}
bool8 sub_80A671C(struct UnkGroundSpriteStruct *ptr)
{
if (ptr->unk58 != 0) {
if (ptr->unk58 == 0x1C0)
return TRUE;
if (ptr->unk5C == -1)
return TRUE;
if (sub_800E9E4(ptr->unk5C))
return TRUE;
ptr->unk5C = -1;
ptr->unk58 = 0;
}
return FALSE;
}