mirror of https://github.com/zeldaret/tmc.git
goronMerchant.c
This commit is contained in:
parent
45298f8a96
commit
0d39bb7f11
|
|
@ -6,262 +6,6 @@
|
|||
|
||||
.text
|
||||
|
||||
|
||||
thumb_func_start GoronMerchant
|
||||
GoronMerchant: @ 0x08069544
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
ldrb r1, [r4, #0x10]
|
||||
movs r0, #2
|
||||
ands r0, r1
|
||||
cmp r0, #0
|
||||
beq _08069568
|
||||
ldr r0, _08069564 @ =gUnk_08111B98
|
||||
ldrb r1, [r4, #0xc]
|
||||
lsls r1, r1, #2
|
||||
adds r1, r1, r0
|
||||
ldr r1, [r1]
|
||||
adds r0, r4, #0
|
||||
bl _call_via_r1
|
||||
b _0806957E
|
||||
.align 2, 0
|
||||
_08069564: .4byte gUnk_08111B98
|
||||
_08069568:
|
||||
ldr r0, _08069580 @ =gUnk_08111B88
|
||||
ldrb r1, [r4, #0xc]
|
||||
lsls r1, r1, #2
|
||||
adds r1, r1, r0
|
||||
ldr r1, [r1]
|
||||
adds r0, r4, #0
|
||||
bl _call_via_r1
|
||||
adds r0, r4, #0
|
||||
bl sub_0806ED78
|
||||
_0806957E:
|
||||
pop {r4, pc}
|
||||
.align 2, 0
|
||||
_08069580: .4byte gUnk_08111B88
|
||||
|
||||
thumb_func_start sub_08069584
|
||||
sub_08069584: @ 0x08069584
|
||||
push {lr}
|
||||
adds r1, r0, #0
|
||||
ldr r0, _08069598 @ =gUnk_030010A0
|
||||
adds r0, #0x2c
|
||||
ldrb r0, [r0]
|
||||
cmp r0, #0
|
||||
beq _0806959C
|
||||
movs r0, #3
|
||||
b _0806959E
|
||||
.align 2, 0
|
||||
_08069598: .4byte gUnk_030010A0
|
||||
_0806959C:
|
||||
movs r0, #1
|
||||
_0806959E:
|
||||
strb r0, [r1, #0xc]
|
||||
adds r0, r1, #0
|
||||
movs r1, #2
|
||||
bl InitAnimationForceUpdate
|
||||
pop {pc}
|
||||
.align 2, 0
|
||||
|
||||
thumb_func_start sub_080695AC
|
||||
sub_080695AC: @ 0x080695AC
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
ldrb r0, [r4, #0xf]
|
||||
adds r0, #1
|
||||
strb r0, [r4, #0xf]
|
||||
lsls r0, r0, #0x18
|
||||
lsrs r0, r0, #0x18
|
||||
cmp r0, #0x10
|
||||
bls _080695D2
|
||||
movs r0, #0
|
||||
strb r0, [r4, #0xf]
|
||||
adds r0, r4, #0
|
||||
movs r1, #0x28
|
||||
movs r2, #0x28
|
||||
bl sub_0806ED9C
|
||||
cmp r0, #0
|
||||
blt _080695D2
|
||||
strb r0, [r4, #0x14]
|
||||
_080695D2:
|
||||
adds r0, r4, #0
|
||||
adds r0, #0x58
|
||||
ldrb r0, [r0]
|
||||
ldrb r1, [r4, #0x14]
|
||||
cmp r0, r1
|
||||
beq _080695E6
|
||||
ldrb r1, [r4, #0x14]
|
||||
adds r0, r4, #0
|
||||
bl InitAnimationForceUpdate
|
||||
_080695E6:
|
||||
pop {r4, pc}
|
||||
|
||||
thumb_func_start sub_080695E8
|
||||
sub_080695E8: @ 0x080695E8
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
bl UpdateAnimationSingleFrame
|
||||
ldr r0, _08069618 @ =gTextBox
|
||||
ldrb r0, [r0]
|
||||
movs r1, #0x7f
|
||||
ands r1, r0
|
||||
cmp r1, #0
|
||||
bne _08069614
|
||||
movs r0, #1
|
||||
strb r0, [r4, #0xc]
|
||||
adds r0, r4, #0
|
||||
adds r0, #0x39
|
||||
strb r1, [r0]
|
||||
adds r0, r4, #0
|
||||
bl sub_0805E584
|
||||
ldrb r1, [r4, #0x14]
|
||||
adds r0, r4, #0
|
||||
bl InitAnimationForceUpdate
|
||||
_08069614:
|
||||
pop {r4, pc}
|
||||
.align 2, 0
|
||||
_08069618: .4byte gTextBox
|
||||
|
||||
thumb_func_start sub_0806961C
|
||||
sub_0806961C: @ 0x0806961C
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
ldr r0, _08069638 @ =gUnk_030010A0
|
||||
adds r0, #0x2c
|
||||
ldrb r0, [r0]
|
||||
cmp r0, #2
|
||||
bne _08069630
|
||||
adds r0, r4, #0
|
||||
bl UpdateAnimationSingleFrame
|
||||
_08069630:
|
||||
adds r0, r4, #0
|
||||
bl sub_0806FD3C
|
||||
pop {r4, pc}
|
||||
.align 2, 0
|
||||
_08069638: .4byte gUnk_030010A0
|
||||
|
||||
thumb_func_start sub_0806963C
|
||||
sub_0806963C: @ 0x0806963C
|
||||
push {lr}
|
||||
movs r3, #1
|
||||
movs r1, #1
|
||||
strb r1, [r0, #0xc]
|
||||
ldrb r2, [r0, #0x18]
|
||||
subs r1, #5
|
||||
ands r1, r2
|
||||
orrs r1, r3
|
||||
strb r1, [r0, #0x18]
|
||||
bl sub_0807DD50
|
||||
pop {pc}
|
||||
|
||||
thumb_func_start sub_08069654
|
||||
sub_08069654: @ 0x08069654
|
||||
push {lr}
|
||||
movs r1, #0
|
||||
bl sub_0807DD94
|
||||
pop {pc}
|
||||
.align 2, 0
|
||||
|
||||
thumb_func_start sub_08069660
|
||||
sub_08069660: @ 0x08069660
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
ldr r0, _0806967C @ =0x00002C1C
|
||||
adds r1, r4, #0
|
||||
bl TextboxNoOverlap
|
||||
adds r0, r4, #0
|
||||
bl sub_080696BC
|
||||
ldr r1, _08069680 @ =gTextBox
|
||||
lsls r0, r0, #0x10
|
||||
lsrs r0, r0, #0x10
|
||||
str r0, [r1, #0x10]
|
||||
pop {r4, pc}
|
||||
.align 2, 0
|
||||
_0806967C: .4byte 0x00002C1C
|
||||
_08069680: .4byte gTextBox
|
||||
|
||||
thumb_func_start sub_08069684
|
||||
sub_08069684: @ 0x08069684
|
||||
push {lr}
|
||||
movs r0, #9
|
||||
movs r1, #0x31
|
||||
movs r2, #8
|
||||
bl sub_0805EB00
|
||||
cmp r0, #0
|
||||
bne _080696AE
|
||||
bl sub_0805E8D4
|
||||
adds r1, r0, #0
|
||||
cmp r1, #0
|
||||
beq _080696AE
|
||||
movs r0, #9
|
||||
strb r0, [r1, #8]
|
||||
movs r0, #0x31
|
||||
strb r0, [r1, #9]
|
||||
adds r0, r1, #0
|
||||
movs r1, #8
|
||||
bl sub_0805EA2C
|
||||
_080696AE:
|
||||
pop {pc}
|
||||
|
||||
thumb_func_start sub_080696B0
|
||||
sub_080696B0: @ 0x080696B0
|
||||
ldr r1, _080696B8 @ =gRoomVars
|
||||
movs r0, #0
|
||||
strb r0, [r1, #6]
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_080696B8: .4byte gRoomVars
|
||||
|
||||
thumb_func_start sub_080696BC
|
||||
sub_080696BC: @ 0x080696BC
|
||||
push {r4, r5, lr}
|
||||
ldr r0, _08069710 @ =gRoomVars
|
||||
ldrb r0, [r0, #7]
|
||||
movs r5, #0
|
||||
cmp r0, #0x70
|
||||
ble _080696CA
|
||||
movs r5, #1
|
||||
_080696CA:
|
||||
cmp r0, #0x72
|
||||
ble _080696D0
|
||||
movs r5, #2
|
||||
_080696D0:
|
||||
movs r0, #0x3e
|
||||
bl CheckGlobalFlag
|
||||
rsbs r1, r0, #0
|
||||
orrs r1, r0
|
||||
lsrs r4, r1, #0x1f
|
||||
movs r0, #0x3f
|
||||
bl CheckGlobalFlag
|
||||
cmp r0, #0
|
||||
beq _080696E8
|
||||
movs r4, #2
|
||||
_080696E8:
|
||||
movs r0, #0x40
|
||||
bl CheckGlobalFlag
|
||||
cmp r0, #0
|
||||
beq _080696F4
|
||||
movs r4, #3
|
||||
_080696F4:
|
||||
movs r0, #0x41
|
||||
bl CheckGlobalFlag
|
||||
cmp r0, #0
|
||||
beq _08069700
|
||||
movs r4, #4
|
||||
_08069700:
|
||||
ldr r0, _08069714 @ =gUnk_08111BA0
|
||||
lsls r1, r4, #1
|
||||
adds r1, r1, r4
|
||||
adds r1, r1, r5
|
||||
lsls r1, r1, #1
|
||||
adds r1, r1, r0
|
||||
ldrh r0, [r1]
|
||||
pop {r4, r5, pc}
|
||||
.align 2, 0
|
||||
_08069710: .4byte gRoomVars
|
||||
_08069714: .4byte gUnk_08111BA0
|
||||
|
||||
thumb_func_start sub_08069718
|
||||
sub_08069718: @ 0x08069718
|
||||
push {r4, r5, r6, r7, lr}
|
||||
|
|
|
|||
59
asm/percy.s
59
asm/percy.s
|
|
@ -6,65 +6,6 @@
|
|||
|
||||
.text
|
||||
|
||||
|
||||
thumb_func_start Percy
|
||||
Percy: @ 0x0806B3AC
|
||||
push {lr}
|
||||
adds r2, r0, #0
|
||||
ldrb r1, [r2, #0x10]
|
||||
movs r0, #2
|
||||
ands r0, r1
|
||||
cmp r0, #0
|
||||
beq _0806B3C2
|
||||
adds r0, r2, #0
|
||||
bl sub_0806B41C
|
||||
b _0806B3C8
|
||||
_0806B3C2:
|
||||
adds r0, r2, #0
|
||||
bl sub_0806B3CC
|
||||
_0806B3C8:
|
||||
pop {pc}
|
||||
.align 2, 0
|
||||
|
||||
thumb_func_start sub_0806B3CC
|
||||
sub_0806B3CC: @ 0x0806B3CC
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
ldrb r0, [r4, #0xc]
|
||||
cmp r0, #0
|
||||
bne _0806B3F4
|
||||
ldr r1, _0806B418 @ =gUnk_08112E1C
|
||||
adds r0, r4, #0
|
||||
bl LoadExtraSpriteData
|
||||
cmp r0, #0
|
||||
beq _0806B414
|
||||
movs r0, #1
|
||||
strb r0, [r4, #0xc]
|
||||
adds r0, r4, #0
|
||||
movs r1, #0
|
||||
bl InitializeAnimation
|
||||
adds r0, r4, #0
|
||||
bl sub_08078778
|
||||
_0806B3F4:
|
||||
adds r0, r4, #0
|
||||
bl GetNextFrame
|
||||
adds r1, r4, #0
|
||||
adds r1, #0x39
|
||||
movs r0, #0
|
||||
ldrsb r0, [r1, r0]
|
||||
cmp r0, #0
|
||||
beq _0806B40E
|
||||
movs r0, #0
|
||||
strb r0, [r1]
|
||||
bl TextboxNoOverlapFollow
|
||||
_0806B40E:
|
||||
adds r0, r4, #0
|
||||
bl sub_0806ED78
|
||||
_0806B414:
|
||||
pop {r4, pc}
|
||||
.align 2, 0
|
||||
_0806B418: .4byte gUnk_08112E1C
|
||||
|
||||
thumb_func_start sub_0806B41C
|
||||
sub_0806B41C: @ 0x0806B41C
|
||||
push {r4, lr}
|
||||
|
|
|
|||
|
|
@ -198,4 +198,6 @@ extern u32 sub_0807953C(void);
|
|||
extern void sub_08077B2C(void);
|
||||
extern void sub_080A29BC(Entity*);
|
||||
extern void sub_080AE068(Entity*);
|
||||
extern Entity* sub_0805E8D4(void);
|
||||
extern void sub_0805EA2C(Entity*, u32);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -36,7 +36,9 @@ typedef struct {
|
|||
typedef struct {
|
||||
u8 filler[6];
|
||||
u8 itemForSaleIndex;
|
||||
u16 unk;
|
||||
u8 field_0x7;
|
||||
u8 field_0x8;
|
||||
u8 field_0x9;
|
||||
u8 unk2;
|
||||
u16 filler2[3];
|
||||
u32 roomFlags;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ typedef struct {
|
|||
u8 textWindowPosY;
|
||||
u16 textIndex;
|
||||
u16 unk2; // HI?
|
||||
u16 field_0xc;
|
||||
u16 field_0xe;
|
||||
u32 field_0x10;
|
||||
} TextBox;
|
||||
|
||||
extern TextBox gTextBox;
|
||||
|
|
|
|||
|
|
@ -586,6 +586,7 @@ SECTIONS {
|
|||
src/npc/bladeBrothers.o(.text);
|
||||
src/npc/cow.o(.text);
|
||||
src/npc/goron.o(.text);
|
||||
src/npc/goronMerchant.o(.text);
|
||||
asm/goronMerchant.o(.text);
|
||||
asm/gorman.o(.text);
|
||||
asm/dog.o(.text);
|
||||
|
|
@ -596,6 +597,7 @@ SECTIONS {
|
|||
src/npc/townMinish.o(.text);
|
||||
asm/townMinish.o(.text);
|
||||
src/npc/librari.o(.text);
|
||||
src/npc/percy.o(.text);
|
||||
asm/percy.o(.text);
|
||||
asm/vaatiReborn.o(.text);
|
||||
src/npc/moblinLady.o(.text);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,143 @@
|
|||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "structures.h"
|
||||
#include "textbox.h"
|
||||
#include "room.h"
|
||||
#include "flags.h"
|
||||
|
||||
extern u32 sub_080696BC(Entity*);
|
||||
|
||||
extern void (*const gUnk_08111B88[])(Entity*);
|
||||
extern void (*const gUnk_08111B98[])(Entity*);
|
||||
|
||||
extern u16 gUnk_08111BA0[];
|
||||
|
||||
|
||||
void GoronMerchant(Entity *this)
|
||||
{
|
||||
if ((this->flags & 2) != 0) {
|
||||
gUnk_08111B98[this->action](this);
|
||||
}
|
||||
else {
|
||||
gUnk_08111B88[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08069584(Entity *this)
|
||||
{
|
||||
if (gUnk_030010A0.field_0x24[8] != 0) {
|
||||
this->action = 3;
|
||||
}
|
||||
else {
|
||||
this->action = 1;
|
||||
}
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
}
|
||||
|
||||
void sub_080695AC(Entity *this)
|
||||
{
|
||||
s32 iVar2;
|
||||
|
||||
if (++this->field_0xf > 0x10) {
|
||||
this->field_0xf = 0;
|
||||
iVar2 = sub_0806ED9C(this, 0x28, 0x28);
|
||||
if (iVar2 > -1) {
|
||||
this->animationState = iVar2;
|
||||
}
|
||||
}
|
||||
if (this->animIndex != this->animationState) {
|
||||
InitAnimationForceUpdate(this, this->animationState);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080695E8(Entity *this)
|
||||
{
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if ((gTextBox.doTextBox & 0x7f) == 0) {
|
||||
this->action = 1;
|
||||
this->interactType = gTextBox.doTextBox & 0x7f;
|
||||
sub_0805E584(this);
|
||||
InitAnimationForceUpdate(this, this->animationState);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806961C(Entity *this)
|
||||
{
|
||||
if (gUnk_030010A0.field_0x24[8] == 2) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
sub_0806FD3C(this);
|
||||
}
|
||||
|
||||
void sub_0806963C(Entity *this)
|
||||
{
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
sub_0807DD50(this);
|
||||
}
|
||||
|
||||
void sub_08069654(Entity* this) {
|
||||
sub_0807DD94(this, 0);
|
||||
}
|
||||
|
||||
void sub_08069660(Entity *this)
|
||||
{
|
||||
u32 uVar1;
|
||||
|
||||
TextboxNoOverlap(0x2c1c, this);
|
||||
gTextBox.field_0x10 = (u16)sub_080696BC(this);
|
||||
}
|
||||
|
||||
void sub_08069684(void)
|
||||
{
|
||||
Entity *mgr;
|
||||
|
||||
if (sub_0805EB00(9, 0x31, 8) == NULL) {
|
||||
mgr = sub_0805E8D4();
|
||||
if (mgr != NULL) {
|
||||
mgr->entityType.type = 9;
|
||||
mgr->entityType.subtype = 0x31;
|
||||
sub_0805EA2C(mgr, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080696B0(void)
|
||||
{
|
||||
gRoomVars.itemForSaleIndex = 0;
|
||||
}
|
||||
|
||||
u32 sub_080696BC(Entity* this)
|
||||
{
|
||||
u32 uVar1;
|
||||
u32 temp;
|
||||
u32 iVar3;
|
||||
s32 temp2;
|
||||
|
||||
temp2 = gRoomVars.field_0x7;
|
||||
if (temp2 > 0x70) {
|
||||
iVar3 = 1;
|
||||
}
|
||||
else {
|
||||
iVar3 = 0;
|
||||
}
|
||||
if (temp2 > 0x72) {
|
||||
iVar3 = 2;
|
||||
}
|
||||
|
||||
temp = CheckGlobalFlag(0x3e);
|
||||
uVar1 = (-temp | temp) >> 0x1f;
|
||||
|
||||
if (CheckGlobalFlag(0x3f)) {
|
||||
uVar1 = 2;
|
||||
}
|
||||
if (CheckGlobalFlag(0x40)) {
|
||||
uVar1 = 3;
|
||||
}
|
||||
if (CheckGlobalFlag(0x41)) {
|
||||
uVar1 = 4;
|
||||
}
|
||||
return gUnk_08111BA0[uVar1 * 3 + iVar3];
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
#include "textbox.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_0806B41C(Entity*);
|
||||
void sub_0806B3CC(Entity*);
|
||||
|
||||
extern SpriteLoadData gUnk_08112E1C;
|
||||
|
||||
void Percy(Entity* this) {
|
||||
if ((this->flags & 2) != 0) {
|
||||
sub_0806B41C(this);
|
||||
} else {
|
||||
sub_0806B3CC(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806B3CC(Entity *this)
|
||||
{
|
||||
if (this->action == 0) {
|
||||
if (!LoadExtraSpriteData(this, &gUnk_08112E1C)) {
|
||||
return;
|
||||
}
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, 0);
|
||||
sub_08078778(this);
|
||||
}
|
||||
GetNextFrame(this);
|
||||
if (this->interactType != 0) {
|
||||
this->interactType = 0;
|
||||
TextboxNoOverlapFollow(0);
|
||||
}
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
Loading…
Reference in New Issue