Decompile MoblinSpear_Action1

This commit is contained in:
Tal Hayon 2021-12-27 15:58:45 +02:00
parent 60e74d1ba9
commit f85a48be71
2 changed files with 12 additions and 82 deletions

View File

@ -1,73 +0,0 @@
.syntax unified
push {r4, r5, lr}
adds r4, r0, #0
ldr r5, [r4, #0x50]
cmp r5, #0
bne _080A83C2
bl DeleteThisEntity
_080A83C2:
ldr r0, [r5, #4]
cmp r0, #0
bne _080A83CC
bl DeleteThisEntity
_080A83CC:
adds r0, r5, #0
adds r0, #0x5a
ldrb r0, [r0]
lsls r0, r0, #0x1a
lsrs r0, r0, #0x18
ldr r1, _080A8424 @ =gUnk_0812966C
adds r2, r0, r1
ldr r1, [r4, #0x48]
ldrb r0, [r2]
strb r0, [r1]
adds r2, #1
adds r0, r5, #0
adds r0, #0x5b
ldrb r0, [r0]
cmp r0, #0x40
bne _080A83F4
ldr r1, [r4, #0x48]
ldrb r0, [r1]
rsbs r0, r0, #0
strb r0, [r1]
_080A83F4:
ldr r1, [r4, #0x48]
ldrb r0, [r2]
strb r0, [r1, #1]
adds r2, #1
ldr r1, [r4, #0x48]
ldrb r0, [r2]
strb r0, [r1, #6]
ldr r1, [r4, #0x48]
ldrb r0, [r2, #1]
strb r0, [r1, #7]
adds r0, r5, #0
adds r0, #0x43
ldrb r0, [r0]
cmp r0, #0
beq _080A8428
ldrb r1, [r4, #0x10]
movs r0, #0x80
ands r0, r1
cmp r0, #0
beq _080A8438
movs r0, #0x7f
ands r0, r1
b _080A8436
.align 2, 0
_080A8424: .4byte gUnk_0812966C
_080A8428:
ldrb r1, [r4, #0x10]
movs r0, #0x80
ands r0, r1
cmp r0, #0
bne _080A8438
movs r0, #0x80
orrs r0, r1
_080A8436:
strb r0, [r4, #0x10]
_080A8438:
pop {r4, r5, pc}
.align 2, 0
.syntax divided

View File

@ -49,11 +49,16 @@ void MoblinSpear_Init(Entity* this) {
}
}
NONMATCH("asm/non_matching/moblinSpear/MoblinSpear_Action1.inc", void MoblinSpear_Action1(Entity* this)) {
void MoblinSpear_Action1(Entity* this) {
u8 frames;
Entity* parent;
u32 tmp;
const HitboxChange* a;
//const HitboxChange* a;
// TODO: Copying a members using HitboxChange members addresses them directly using [r2, 0x1]
// while the assembly increases the pointer after every copy.
// Not sure how to make this more readable.
const u8* a;
parent = this->parent;
if (parent == NULL) {
@ -63,15 +68,14 @@ NONMATCH("asm/non_matching/moblinSpear/MoblinSpear_Action1.inc", void MoblinSpea
DeleteThisEntity();
}
frames = parent->frame * 4;
a = &gUnk_0812966C[frames / 4];
this->hitbox->offset_x = a->offsetX;
// TODO offset used to increase a pointer is already increated here?
a = (u8*) &gUnk_0812966C[frames / 4];
this->hitbox->offset_x = *a++;
if (parent->frameSpriteSettings == 0x40) {
this->hitbox->offset_x = -this->hitbox->offset_x;
}
this->hitbox->offset_y = a->offsetY;
this->hitbox->width = a->width;
this->hitbox->height = a->height;
this->hitbox->offset_y = *a++;
this->hitbox->width = *a++;
this->hitbox->height = *a++;
if (parent->field_0x43 != 0) {
if ((this->flags & ENT_COLLIDE) != 0) {
COLLISION_OFF(this);
@ -82,7 +86,6 @@ NONMATCH("asm/non_matching/moblinSpear/MoblinSpear_Action1.inc", void MoblinSpea
}
}
}
END_NONMATCH
void (*const MoblinSpear_Functions[])(Entity*) = {
MoblinSpear_OnTick, sub_080A832C, DeleteEntity, DeleteEntity, DeleteEntity,