Match sub_080AA9E0

This commit is contained in:
Tal Hayon 2022-02-27 07:35:02 +02:00
parent abe6053a4f
commit d1f00ad83c
2 changed files with 12 additions and 100 deletions

View File

@ -1,74 +0,0 @@
.syntax unified
push {r4, r5, lr}
adds r5, r0, #0
ldrb r1, [r5, #0xa]
movs r0, #1
ands r0, r1
cmp r0, #0
beq _080AAA00
ldr r0, _080AA9FC @ =gPlayerEntity
movs r2, #0x2e
ldrsh r1, [r0, r2]
movs r2, #0x2e
ldrsh r0, [r5, r2]
b _080AAA0A
.align 2, 0
_080AA9FC: .4byte gPlayerEntity
_080AAA00:
ldr r0, _080AAA24 @ =gPlayerEntity
movs r2, #0x32
ldrsh r1, [r0, r2]
movs r2, #0x32
ldrsh r0, [r5, r2]
_080AAA0A:
subs r4, r1, r0
ldrb r2, [r5, #0xa]
lsls r1, r2, #2
ldr r0, _080AAA28 @ =gUnk_0812A074
adds r3, r1, r0
cmp r2, #2
bgt _080AAA2C
cmp r2, #1
bge _080AAA36
cmp r2, #0
beq _080AAA30
b _080AAA40
.align 2, 0
_080AAA24: .4byte gPlayerEntity
_080AAA28: .4byte gUnk_0812A074
_080AAA2C:
cmp r2, #3
bne _080AAA40
_080AAA30:
cmp r4, #4
ble _080AAA40
b _080AAA3E
_080AAA36:
movs r0, #4
rsbs r0, r0, #0
cmp r4, r0
bge _080AAA40
_080AAA3E:
adds r3, #2
_080AAA40:
ldrb r0, [r3]
adds r4, r5, #0
adds r4, #0x29
movs r1, #7
ands r1, r0
ldrb r2, [r4]
movs r0, #8
rsbs r0, r0, #0
ands r0, r2
orrs r0, r1
strb r0, [r4]
ldrb r0, [r3, #1]
strb r0, [r5, #0x15]
ldrb r0, [r3]
cmp r0, #5
bne _080AAA66
adds r0, r5, #0
bl sub_08078930
_080AAA66:
pop {r4, r5, pc}
.syntax divided

View File

@ -167,50 +167,36 @@ void SpiderWeb_Action3(Entity* this) {
}
}
NONMATCH("asm/non_matching/spiderWeb/sub_080AA9E0.inc", void sub_080AA9E0(Entity* this)) {
s32 coord1, coord2, diff;
Struct_0812A074* ptr;
SpritePriority* priorityPtr;
SpritePriority prio;
u8 val1, val2;
if (this->type & 0x1) {
coord2 = gPlayerEntity.x.HALF.HI;
coord1 = this->x.HALF.HI;
} else {
coord2 = gPlayerEntity.y.HALF.HI;
coord1 = this->y.HALF.HI;
}
void sub_080AA9E0(Entity* this) {
s32 diff;
const Struct_0812A074* ptr;
diff = coord2 - coord1;
ptr = (Struct_0812A074*)gUnk_0812A074 + (this->type << 1);
diff =
(this->type & 0x1) ? (gPlayerEntity.x.HALF.HI - this->x.HALF.HI) : (gPlayerEntity.y.HALF.HI - this->y.HALF.HI);
ptr = gUnk_0812A074 + (this->type << 1);
switch (this->type) {
case 3:
case 0: {
case 0:
case 3: {
if (diff > 4) {
ptr++;
ptr += 1;
}
break;
}
case 1:
case 2: {
if (diff < -4) {
ptr++;
ptr += 1;
}
break;
}
}
val1 = ptr->b0;
priorityPtr = (SpritePriority*)&this->spritePriority;
priorityPtr->b0 = val1 & 0x7;
// instruction order problems
// this->spritePriority.b0 = ptr->b0 & 0x7;
this->spritePriority.b0 = ptr->b0;
this->direction = ptr->direction;
if (val1 == 5) {
if (ptr->b0 == 5) {
sub_08078930(this);
}
}
END_NONMATCH
void sub_080AAA68(Entity* this) {
SetTile(gUnk_0812A084[this->type], TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer);