Merge pull request #481 from notyourav/nonmaa

some non matches
This commit is contained in:
notyourav 2022-03-30 21:24:34 -07:00 committed by GitHub
commit 76ca88de8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 164 additions and 160 deletions

View File

@ -1,65 +0,0 @@
.syntax unified
push {r4, r5, r6, lr}
adds r4, r0, #0
bl sub_080387F0
adds r0, r4, #0
movs r1, #0x60
bl sub_0803872C
cmp r0, #0
beq _08038604
movs r0, #3
strb r0, [r4, #0xc]
movs r0, #0xc
strb r0, [r4, #0xf]
movs r0, #0x80
strh r0, [r4, #0x24]
ldr r1, [r4, #0x54]
adds r0, r4, #0
bl sub_0806FCAC
strb r0, [r4, #0x14]
lsls r0, r0, #2
strb r0, [r4, #0x15]
ldrb r1, [r4, #0x14]
adds r0, r4, #0
bl InitializeAnimation
b _08038648
_08038604:
ldrb r0, [r4, #0xf]
subs r0, #1
strb r0, [r4, #0xf]
lsls r0, r0, #0x18
cmp r0, #0
bne _08038648
movs r6, #0x10
strb r6, [r4, #0xf]
ldr r1, [r4, #0x54]
cmp r1, #0
beq _08038622
adds r0, r4, #0
bl sub_0806FCAC
b _08038638
_08038622:
ldrb r5, [r4, #0x14]
bl Random
ands r0, r6
cmp r0, #0
beq _08038632
adds r1, r5, #2
b _08038634
_08038632:
adds r1, r5, #6
_08038634:
movs r0, #7
ands r0, r1
_08038638:
strb r0, [r4, #0x14]
ldrb r0, [r4, #0x14]
lsls r0, r0, #2
strb r0, [r4, #0x15]
ldrb r1, [r4, #0x14]
adds r0, r4, #0
bl InitializeAnimation
_08038648:
pop {r4, r5, r6, pc}
.align 2, 0
.syntax divided

View File

@ -1,83 +0,0 @@
.syntax unified
push {r4, r5, lr}
adds r4, r0, #0
adds r5, r4, #0
adds r5, #0x39
movs r0, #0
ldrsb r0, [r5, r0]
cmp r0, #1
beq _08064BFA
cmp r0, #1
bgt _08064BA2
cmp r0, #0
beq _08064BA8
b _08064BFA
_08064BA2:
cmp r0, #2
beq _08064BCE
b _08064BFA
_08064BA8:
adds r0, r4, #0
bl sub_0806EE20
adds r2, r0, #0
adds r0, r4, #0
adds r0, #0x3e
ldrb r0, [r0]
strb r0, [r4, #0x14]
cmp r2, #0
beq _08064BC6
movs r1, #0x7f
ands r1, r2
adds r0, r4, #0
bl InitializeAnimation
_08064BC6:
adds r0, r4, #0
bl GetNextFrame
b _08064C28
_08064BCE:
movs r0, #3
strb r0, [r4, #0xc]
adds r0, r4, #0
bl GetAnimationState
adds r1, r0, #0
cmp r1, #0
bge _08064BE0
ldrb r1, [r4, #0x14]
_08064BE0:
adds r0, r4, #0
adds r0, #0x58
ldrb r0, [r0]
strb r0, [r4, #0xf]
adds r0, r4, #0
bl InitializeAnimation
movs r0, #0
strb r0, [r5]
adds r0, r4, #0
bl sub_0806F118
b _08064C28
_08064BFA:
movs r0, #2
strb r0, [r4, #0xc]
adds r0, r4, #0
bl GetAnimationState
adds r1, r0, #0
cmp r1, #0
bge _08064C0C
ldrb r1, [r4, #0x14]
_08064C0C:
adds r0, r4, #0
adds r0, #0x58
ldrb r0, [r0]
strb r0, [r4, #0xf]
adds r0, r4, #0
bl InitializeAnimation
adds r1, r4, #0
adds r1, #0x39
movs r0, #0
strb r0, [r1]
adds r0, r4, #0
bl sub_08064CD8
_08064C28:
pop {r4, r5, pc}
.align 2, 0
.syntax divided

View File

@ -128,7 +128,7 @@ void CloudPiranha_Action1(CloudPiranhaEntity* this) {
}
}
NONMATCH("asm/non_matching/cloudPiranha/sub_080385CC.inc", void sub_080385CC(CloudPiranhaEntity* this)) {
void sub_080385CC(CloudPiranhaEntity* this) {
u32 tmp;
sub_080387F0(this);
if (sub_0803872C(this, 0x60)) {
@ -145,18 +145,13 @@ NONMATCH("asm/non_matching/cloudPiranha/sub_080385CC.inc", void sub_080385CC(Clo
super->animationState = sub_0806FCAC(super, super->child);
} else {
tmp = super->animationState;
if ((Random() & 0x10) != 0) {
super->animationState = (tmp + 2) & 7;
} else {
super->animationState = (tmp + 6) & 7;
}
super->animationState = (Random() & 0x10) ? ((tmp + 2) & 7) : ((tmp + 6) & 7);
}
super->direction = super->animationState << 2;
InitializeAnimation(super, super->animationState);
}
}
}
END_NONMATCH
void CloudPiranha_Action3(CloudPiranhaEntity* this) {
s32 tmp;

View File

@ -101,6 +101,51 @@ void sub_08066474(void) {
ASM_FUNC("asm/non_matching/npc23/sub_08066490.inc", void sub_08066490(Entity* this, Entity* entity))
ASM_FUNC("asm/non_matching/npc23/sub_0806650C.inc", bool32 sub_0806650C(Entity* this))
// px needs to be used in both r5 and r7
NONMATCH("asm/non_matching/npc23/sub_0806650C.inc", bool32 sub_0806650C(Entity* this)) {
u32 dir = 0;
s32 px = gPlayerEntity.x.HALF_U.HI;
s32 py = gPlayerEntity.y.HALF_U.HI;
ASM_FUNC("asm/non_matching/npc23/sub_08066570.inc", void sub_08066570(Entity* this))
if (py < this->field_0x80.HWORD + 16) {
dir = 4;
} else {
if (px < this->field_0x7c.HALF_U.HI + 2) {
dir = 2;
}
if (px > this->field_0x7c.HALF_U.HI + 6) {
dir = 6;
}
if (dir == 0) {
gPlayerEntity.speed = 0;
}
}
if (gPlayerEntity.action != PLAYER_ROOM_EXIT) {
if (dir == 0) {
return 0;
}
sub_08078AC0(8, 0, 0);
gPlayerEntity.animationState = dir;
gPlayerEntity.direction = Direction8FromAnimationState(dir);
}
return 1;
}
END_NONMATCH
NONMATCH("asm/non_matching/npc23/sub_08066570.inc", void sub_08066570(Entity* this)) {
if (this->frame & ANIM_DONE) {
return;
}
if (this->action == 3 && sub_0806FC80(this, &gPlayerEntity, 0x50)) {
u32 direction = GetFacingDirection(this, &gPlayerEntity);
bool32 cond = (this->direction & 0x18) == (direction & 0x18) && ((this->direction + 5) & 7) < 3 &&
((direction + 5) & 7) < 3;
if (!cond) {
this->direction = direction;
InitializeAnimation(this, ((u32)(this->direction + 4) & 0x18) >> 3);
}
}
}
END_NONMATCH

View File

@ -9,6 +9,8 @@ extern void sub_080604DC(Entity*);
extern void sub_080606D8(Entity*);
extern void sub_080606C0(Entity*);
extern const s8 gUnk_0810AA70[];
typedef struct {
s16 x;
s16 y;
@ -192,9 +194,81 @@ void sub_0806075C(Entity* this) {
this->field_0x68.HALF.HI = 0xff;
}
ASM_FUNC("asm/non_matching/postman/sub_0806076C.inc", void sub_0806076C(Entity* this, ScriptExecutionContext* context))
NONMATCH("asm/non_matching/postman/sub_0806076C.inc",
void sub_0806076C(Entity* this, ScriptExecutionContext* context)) {
s8* p;
u32 tmp, size;
int i;
ASM_FUNC("asm/non_matching/postman/sub_080608E4.inc", void sub_080608E4(Entity* this, ScriptExecutionContext* context))
if (this->z.WORD < 0) {
gActiveScriptInfo.commandSize = 0;
return;
}
this->field_0x68.HALF.HI++;
this->collisionLayer = 1;
sub_080606C0(this);
p = &gUnk_0810A918[this->field_0x68.HALF.LO][this->field_0x68.HALF.HI];
do {
switch (p[0] + 5) {
case 5:
this->field_0x68.HALF.LO = p[(s32)Random() % p[1] + 2];
this->field_0x68.HALF.HI = 0;
return;
case 4:
this->field_0x6a.HWORD = 300;
break;
case 3:
this->collisionLayer = 1;
break;
case 2:
this->collisionLayer = 2;
break;
case 1:
context->wait = 30;
this->spriteSettings.draw = 0;
break;
case 0:
size = p[1];
tmp = Random() % size;
for (i = 0; i < size; ++i) {
this->field_0x68.HALF.HI = p[i + 2];
this->x.HALF.HI =
gUnk_0810A66C[gUnk_0810A918[this->field_0x68.HALF.LO][0]].x + gRoomControls.origin_x;
this->y.HALF.HI =
gUnk_0810A66C[gUnk_0810A918[this->field_0x68.HALF.LO][0]].y + gRoomControls.origin_y;
if (!CheckOnScreen(this)) {
break;
}
tmp = (tmp + 1) % size;
}
this->field_0x68.HALF.LO = 0;
return;
default:
return;
}
this->field_0x68.HALF.LO++;
p++;
} while (1);
}
END_NONMATCH
NONMATCH("asm/non_matching/postman/sub_080608E4.inc",
void sub_080608E4(Entity* this, ScriptExecutionContext* context)) {
context->condition = 0;
if (this->z.WORD >= 0) {
if ((this->collisionLayer != 1 || gPlayerEntity.collisionLayer != 2) &&
(this->collisionLayer != 2 || gPlayerEntity.collisionLayer != 1)) {
const s8* ptr = &gUnk_0810AA70[context->intVariable * 16 + (this->animationState >> 1) * 4];
if (ptr[0] + gPlayerEntity.x.HALF.HI + ptr[2] - this->x.HALF.HI < ptr[2] * 2 &&
ptr[1] + gPlayerEntity.y.HALF.HI + ptr[3] - this->y.HALF.HI < ptr[3] * 2) {
context->condition = 1;
this->field_0x6a.HWORD += 2;
}
}
}
}
END_NONMATCH
void Postman_Fusion(Entity* this) {
if (this->action == 0) {

View File

@ -14,6 +14,8 @@ void sub_08064CC0(Entity* this);
extern void (*const gUnk_0810FA44[])(Entity*);
void sub_08064C9C(Entity* this);
void sub_08064CD8(Entity* this);
void Sturgeon(Entity* this) {
if ((this->flags & ENT_SCRIPTED) == 0) {
gUnk_0810FA44[this->action](this);
@ -57,7 +59,43 @@ void sub_08064B44(Entity* this) {
}
}
ASM_FUNC("asm/non_matching/sturgeon/sub_08064B88.inc", void sub_08064B88(Entity* this))
void sub_08064B88(Entity* this) {
s32 temp;
s32 temp2;
switch (this->interactType) {
case 0:
temp = sub_0806EE20(this);
this->animationState = this->knockbackDirection;
if (temp != 0) {
InitializeAnimation(this, temp & 0x7f);
}
GetNextFrame(this);
break;
case 2:
this->action = 3;
temp2 = GetAnimationState(this);
if (temp2 < 0) {
temp2 = this->animationState;
}
this->subtimer = this->animIndex;
InitializeAnimation(this, temp2);
this->interactType = 0;
sub_0806F118(this);
break;
case 1:
default:
this->action = 2;
temp2 = GetAnimationState(this);
if (temp2 < 0) {
temp2 = this->animationState;
}
this->subtimer = this->animIndex;
InitializeAnimation(this, temp2);
this->interactType = 0;
sub_08064CD8(this);
}
}
void sub_08064C2C(Entity* this) {
if ((gMessage.doTextBox & 0x7f) == 0) {