Decompile marcy

This commit is contained in:
octorock 2021-05-12 18:49:23 +02:00
parent bbc78fd2d2
commit 8466d7e8e8
8 changed files with 106 additions and 201 deletions

View File

@ -1,158 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start Marcy
Marcy: @ 0x08062CF0
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xc]
cmp r0, #0
bne _08062D0C
adds r0, #1
strb r0, [r4, #0xc]
adds r0, r4, #0
movs r1, #2
bl sub_0805E3A0
adds r0, r4, #0
bl sub_0807DD64
_08062D0C:
adds r0, r4, #0
movs r1, #0
bl sub_0807DD94
pop {r4, pc}
.align 2, 0
thumb_func_start sub_08062D18
sub_08062D18: @ 0x08062D18
push {r4, r5, r6, lr}
adds r5, r0, #0
adds r6, r1, #0
movs r4, #0
movs r0, #0x4f
bl GetInventoryValue
cmp r0, #0
beq _08062D36
movs r0, #0x26
bl CheckLocalFlag
cmp r0, #0
bne _08062D36
movs r4, #7
_08062D36:
movs r0, #0x4e
bl GetInventoryValue
cmp r0, #0
beq _08062D4C
movs r0, #0x25
bl CheckLocalFlag
cmp r0, #0
bne _08062D4C
movs r4, #6
_08062D4C:
movs r0, #0x4d
bl GetInventoryValue
cmp r0, #0
beq _08062D62
movs r0, #0x24
bl CheckLocalFlag
cmp r0, #0
bne _08062D62
movs r4, #5
_08062D62:
movs r0, #0x4c
bl GetInventoryValue
cmp r0, #0
beq _08062D78
movs r0, #0x23
bl CheckLocalFlag
cmp r0, #0
bne _08062D78
movs r4, #4
_08062D78:
movs r0, #0x4b
bl GetInventoryValue
cmp r0, #0
beq _08062D8E
movs r0, #0x22
bl CheckLocalFlag
cmp r0, #0
bne _08062D8E
movs r4, #3
_08062D8E:
movs r0, #0x4a
bl GetInventoryValue
cmp r0, #0
beq _08062DA4
movs r0, #0x21
bl CheckLocalFlag
cmp r0, #0
bne _08062DA4
movs r4, #2
_08062DA4:
movs r0, #0x49
bl GetInventoryValue
cmp r0, #0
beq _08062DBA
movs r0, #0x20
bl CheckLocalFlag
cmp r0, #0
bne _08062DBA
movs r4, #1
_08062DBA:
strb r4, [r5, #0xb]
movs r4, #0
ldr r0, _08062DCC @ =0x00001C1F
bl CheckFlags
cmp r0, #0
beq _08062DD0
movs r4, #1
b _08062DF0
.align 2, 0
_08062DCC: .4byte 0x00001C1F
_08062DD0:
movs r0, #0x8c
bl CheckLocalFlag
cmp r0, #0
beq _08062DE4
movs r4, #2
movs r0, #0x8c
bl ClearLocalFlag
b _08062DF0
_08062DE4:
movs r0, #0x8b
bl CheckLocalFlag
cmp r0, #0
beq _08062DF0
movs r4, #3
_08062DF0:
ldr r0, _08062E08 @ =gUnk_0810C34C
lsls r1, r4, #1
adds r1, r1, r0
ldrh r0, [r1]
adds r1, r5, #0
bl TextboxNoOverlap
cmp r4, #0
bne _08062E0C
movs r0, #1
b _08062E0E
.align 2, 0
_08062E08: .4byte gUnk_0810C34C
_08062E0C:
movs r0, #0
_08062E0E:
str r0, [r6, #0x14]
pop {r4, r5, r6, pc}
.align 2, 0
thumb_func_start sub_08062E14
sub_08062E14: @ 0x08062E14
push {lr}
movs r0, #0x8b
bl SetLocalFlag
pop {pc}
.align 2, 0

View File

@ -559,7 +559,7 @@ SECTIONS {
asm/kid.o(.text);
src/npc/npc9.o(.text);
src/npc/stamp.o(.text);
asm/marcy.o(.text);
src/npc/marcy.o(.text);
src/npc/wheaton.o(.text);
src/npc/pita.o(.text);
asm/pita.o(.text);

View File

@ -8,23 +8,23 @@
extern u32 sub_08002632(Entity*);
void Din(Entity* this) {
switch(this->action) {
switch (this->action) {
case 0:
this->action = 1;
this->spriteSettings.b.draw = 1;
sub_0807DD50(this);
break;
case 1:
if (this->interactType ==2) {
this->action = 2;
this->interactType = 0;
sub_0806F118(this);
this->field_0x68.HALF.LO = this->animIndex;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
sub_0806F118(this);
this->field_0x68.HALF.LO = this->animIndex;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
} else {
sub_0807DD94(this, NULL);
}
break;
break;
case 2:
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;

View File

@ -8,23 +8,23 @@
extern u32 sub_08002632(Entity*);
void Farore(Entity* this) {
switch(this->action) {
switch (this->action) {
case 0:
this->action = 1;
this->spriteSettings.b.draw = 1;
sub_0807DD50(this);
break;
case 1:
if (this->interactType ==2) {
this->action = 2;
this->interactType = 0;
sub_0806F118(this);
this->field_0x68.HALF.LO = this->animIndex;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
sub_0806F118(this);
this->field_0x68.HALF.LO = this->animIndex;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
} else {
sub_0807DD94(this, NULL);
}
break;
break;
case 2:
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;

63
src/npc/marcy.c Normal file
View File

@ -0,0 +1,63 @@
#include "entity.h"
#include "functions.h"
#include "script.h"
#include "flags.h"
#include "textbox.h"
extern u16 gUnk_0810C34C[];
void Marcy(Entity* this) {
if (this->action == 0) {
this->action += 1;
sub_0805E3A0(this, 2);
sub_0807DD64(this);
}
sub_0807DD94(this, NULL);
}
void sub_08062D18(Entity* this, ScriptExecutionContext* context) {
u8 tmp = 0;
if ((GetInventoryValue(0x4f) != 0) && (CheckLocalFlag(0x26) == 0)) {
tmp = 7;
}
if ((GetInventoryValue(0x4e) != 0) && (CheckLocalFlag(0x25) == 0)) {
tmp = 6;
}
if ((GetInventoryValue(0x4d) != 0) && (CheckLocalFlag(0x24) == 0)) {
tmp = 5;
}
if ((GetInventoryValue(0x4c) != 0) && (CheckLocalFlag(0x23) == 0)) {
tmp = 4;
}
if ((GetInventoryValue(0x4b) != 0) && (CheckLocalFlag(0x22) == 0)) {
tmp = 3;
}
if ((GetInventoryValue(0x4a) != 0) && (CheckLocalFlag(0x21) == 0)) {
tmp = 2;
}
if ((GetInventoryValue(0x49) != 0) && (CheckLocalFlag(0x20) == 0)) {
tmp = 1;
}
this->type2 = tmp;
tmp = 0;
if (CheckFlags(0x1c1f) != 0) {
tmp = 1;
} else if (CheckLocalFlag(0x8c) != 0) {
tmp = 2;
ClearLocalFlag(0x8c);
} else if (CheckLocalFlag(0x8b) != 0) {
tmp = 3;
}
TextboxNoOverlap(gUnk_0810C34C[tmp], this);
if (tmp == 0) {
context->condition = TRUE;
} else {
context->condition = FALSE;
}
}
void sub_08062E14(Entity* this, ScriptExecutionContext* context) {
SetLocalFlag(0x8b);
}

View File

@ -8,23 +8,23 @@
extern u32 sub_08002632(Entity*);
void Nayru(Entity* this) {
switch(this->action) {
switch (this->action) {
case 0:
this->action = 1;
this->spriteSettings.b.draw = 1;
sub_0807DD50(this);
break;
case 1:
if (this->interactType ==2) {
this->action = 2;
this->interactType = 0;
sub_0806F118(this);
this->field_0x68.HALF.LO = this->animIndex;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
sub_0806F118(this);
this->field_0x68.HALF.LO = this->animIndex;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
} else {
sub_0807DD94(this, NULL);
}
break;
break;
case 2:
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;

View File

@ -908,25 +908,25 @@ void sub_08061AFC(Entity* this) {
NONMATCH("asm/non_matching/npc5/sub_08061B18.inc", void sub_08061B18(Entity* this)) {
u8 bVar1;
u16* puVar2;
typedef struct {
u16 unk_0;
u16 unk_2;
} Tmp;
switch(this->interactType) {
case 0:
break;
case 1:
this->interactType = 0;
sub_08061AFC(this);
//puVar2 = (u16*)(*(int*)&this->field_0x68 + (((u32)this->actionDelay << 0x18) >> 0x17));
// if puVar2[1] == 0
if ((((Tmp**)&this->field_0x68))[++this->actionDelay]->unk_2 == 0) {
this->actionDelay = 0;
}
TextboxNoOverlap((u32)*puVar2, this);
break;
switch (this->interactType) {
case 0:
break;
case 1:
this->interactType = 0;
sub_08061AFC(this);
// puVar2 = (u16*)(*(int*)&this->field_0x68 + (((u32)this->actionDelay << 0x18) >> 0x17));
// if puVar2[1] == 0
if ((((Tmp**)&this->field_0x68))[++this->actionDelay]->unk_2 == 0) {
this->actionDelay = 0;
}
TextboxNoOverlap((u32)*puVar2, this);
break;
}
}
END_NONMATCH

View File

@ -28,10 +28,10 @@ void Pita(Entity* this) {
}
void sub_08062EB8(void) {
sub_0807CAA0(0x68,0);
sub_0807CAA0(0x69,0);
sub_0807CAA0(0x6a,0);
sub_0807CAA0(0x6b,0);
sub_0807CAA0(0x68, 0);
sub_0807CAA0(0x69, 0);
sub_0807CAA0(0x6a, 0);
sub_0807CAA0(0x6b, 0);
}
bool32 sub_08062EDC(Entity* this, ScriptExecutionContext* context) {