npc9.c OK

This commit is contained in:
theo3 2020-07-13 19:57:32 -07:00
parent 94b6040d7d
commit ed5c6d08dd
3 changed files with 54 additions and 111 deletions

View File

@ -1,110 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start NPC9
NPC9: @ 0x08062AD8
push {lr}
ldr r2, _08062AEC @ =gUnk_0810C290
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_08062AEC: .4byte gUnk_0810C290
thumb_func_start sub_08062AF0
sub_08062AF0: @ 0x08062AF0
push {r4, lr}
adds r4, r0, #0
movs r2, #1
movs r0, #1
strb r0, [r4, #0xc]
ldrb r1, [r4, #0x18]
subs r0, #5
ands r0, r1
orrs r0, r2
strb r0, [r4, #0x18]
adds r0, r4, #0
movs r1, #0
bl InitializeAnimation
adds r0, r4, #0
bl sub_08078778
pop {r4, pc}
thumb_func_start sub_08062B14
sub_08062B14: @ 0x08062B14
push {r4, lr}
adds r4, r0, #0
bl GetNextFrame
adds r1, r4, #0
adds r1, #0x39
movs r0, #0
ldrsb r0, [r1, r0]
cmp r0, #0
beq _08062B40
movs r0, #0
strb r0, [r1]
ldrb r0, [r4, #0xc]
adds r0, #1
strb r0, [r4, #0xc]
adds r0, r4, #0
movs r1, #1
bl InitializeAnimation
adds r0, r4, #0
bl sub_0805E47C
_08062B40:
adds r0, r4, #0
bl sub_0806ED78
pop {r4, pc}
thumb_func_start sub_08062B48
sub_08062B48: @ 0x08062B48
push {r4, lr}
adds r4, r0, #0
bl GetNextFrame
adds r0, r4, #0
adds r0, #0x5a
ldrb r1, [r0]
movs r0, #0x80
ands r0, r1
cmp r0, #0
beq _08062B6A
ldr r0, _08062B6C @ =0x00000A01
bl TextboxNoOverlapFollow
ldrb r0, [r4, #0xc]
adds r0, #1
strb r0, [r4, #0xc]
_08062B6A:
pop {r4, pc}
.align 2, 0
_08062B6C: .4byte 0x00000A01
thumb_func_start sub_08062B70
sub_08062B70: @ 0x08062B70
push {r4, lr}
adds r4, r0, #0
ldr r0, _08062B94 @ =gTextBox
ldrb r1, [r0]
movs r0, #0x7f
ands r0, r1
cmp r0, #0
bne _08062B92
adds r0, r4, #0
movs r1, #2
bl InitializeAnimation
movs r0, #1
strb r0, [r4, #0xc]
adds r0, r4, #0
bl sub_0805E584
_08062B92:
pop {r4, pc}
.align 2, 0
_08062B94: .4byte gTextBox

View File

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

53
src/npc/npc9.c Normal file
View File

@ -0,0 +1,53 @@
#include "global.h"
#include "entity.h"
#include "textbox.h"
extern void sub_08078778(Entity*);
extern void sub_0805E47C(Entity*);
extern void sub_0806ED78(Entity*);
extern void sub_0805E584(Entity*);
extern void (*const gUnk_0810C290[])(Entity*);
void NPC9(Entity *this)
{
gUnk_0810C290[this->action](this);
}
void sub_08062AF0(Entity *this)
{
this->action = 1;
this->spriteSettings.b.draw = TRUE;
InitializeAnimation(this, 0);
sub_08078778(this);
}
void sub_08062B14(Entity *this)
{
GetNextFrame(this);
if (this->interactType != 0) {
this->interactType = 0;
this->action++;
InitializeAnimation(this, 1);
sub_0805E47C(this);
}
sub_0806ED78(this);
}
void sub_08062B48(Entity *this)
{
GetNextFrame(this);
if ((this->frames.b.f3) != 0) {
TextboxNoOverlapFollow(0xa01);
this->action++;
}
}
void sub_08062B70(Entity *this)
{
if ((gTextBox.doTextBox & 0x7f) == 0) {
InitializeAnimation(this, 2);
this->action = 1;
sub_0805E584(this);
}
}