Decompile npc26

This commit is contained in:
octorock 2021-04-30 18:04:29 +02:00
parent fce8ef7f9b
commit 5ad4559642
4 changed files with 68 additions and 153 deletions

View File

@ -1,137 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start NPC26
NPC26: @ 0x08066978
push {r4, lr}
adds r4, r0, #0
ldrb r1, [r4, #0x10]
movs r0, #2
ands r0, r1
cmp r0, #0
beq _0806699C
ldr r0, _08066998 @ =gUnk_081106E0
ldrb r1, [r4, #0xc]
lsls r1, r1, #2
adds r1, r1, r0
ldr r1, [r1]
adds r0, r4, #0
bl _call_via_r1
b _080669B2
.align 2, 0
_08066998: .4byte gUnk_081106E0
_0806699C:
ldr r0, _080669B4 @ =gUnk_081106D4
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
_080669B2:
pop {r4, pc}
.align 2, 0
_080669B4: .4byte gUnk_081106D4
thumb_func_start sub_080669B8
sub_080669B8: @ 0x080669B8
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, #2
bl InitAnimationForceUpdate
adds r0, r4, #0
bl sub_08078778
pop {r4, pc}
thumb_func_start sub_080669DC
sub_080669DC: @ 0x080669DC
push {r4, lr}
adds r4, r0, #0
movs r1, #0x28
movs r2, #0x28
bl sub_0806ED9C
adds r1, r0, #0
cmp r1, #0
bge _080669F2
movs r1, #2
b _08066A08
_080669F2:
ldrb r0, [r4, #0xf]
cmp r0, #0
bne _080669FE
movs r0, #0x10
strb r0, [r4, #0xf]
b _08066A08
_080669FE:
subs r0, #1
strb r0, [r4, #0xf]
adds r0, r4, #0
adds r0, #0x58
ldrb r1, [r0]
_08066A08:
adds r0, r4, #0
bl sub_0806F078
cmp r0, #0
bne _08066A18
adds r0, r4, #0
bl UpdateAnimationSingleFrame
_08066A18:
adds r2, r4, #0
adds r2, #0x39
movs r0, #0
ldrsb r0, [r2, r0]
cmp r0, #0
beq _08066A2C
movs r1, #0
movs r0, #2
strb r0, [r4, #0xc]
strb r1, [r2]
_08066A2C:
pop {r4, pc}
.align 2, 0
thumb_func_start sub_08066A30
sub_08066A30: @ 0x08066A30
movs r1, #1
strb r1, [r0, #0xc]
bx lr
.align 2, 0
thumb_func_start sub_08066A38
sub_08066A38: @ 0x08066A38
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_08066A50
sub_08066A50: @ 0x08066A50
push {lr}
movs r1, #0
bl sub_0807DD94
pop {pc}
.align 2, 0

View File

@ -1,14 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_081106D4:: @ 081106D4
.4byte sub_080669B8
.4byte sub_080669DC
.4byte sub_08066A30
gUnk_081106E0:: @ 081106E0
.4byte sub_08066A38
.4byte sub_08066A50

View File

@ -588,7 +588,7 @@ SECTIONS {
asm/npc23.o(.text);
asm/kingDaltus.o(.text);
asm/ministerPotho.o(.text);
asm/npc26.o(.text);
src/npc/npc26.o(.text);
asm/vaati.o(.text);
src/npc/zelda.o(.text);
src/npc/mutoh.o(.text);
@ -1296,7 +1296,7 @@ SECTIONS {
data/animations/npc/kingDaltus.o(.rodata);
data/const/npc/ministerPotho.o(.rodata);
data/animations/npc/ministerPotho.o(.rodata);
data/const/npc/npc26.o(.rodata);
src/npc/npc26.o(.rodata);
data/animations/npc/npc26.o(.rodata);
data/const/npc/vaati.o(.rodata);
data/animations/npc/vaati.o(.rodata);

66
src/npc/npc26.c Normal file
View File

@ -0,0 +1,66 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
#include "script.h"
static void (*const gUnk_081106D4[])(Entity*);
static void (*const gUnk_081106E0[])(Entity*);
void NPC26(Entity* this) {
if ((this->flags & 2) != 0) {
gUnk_081106E0[this->action](this);
} else {
gUnk_081106D4[this->action](this);
sub_0806ED78(this);
}
}
static void sub_080669B8(Entity* this) {
this->action = 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 2);
sub_08078778(this);
}
static void sub_080669DC(Entity* this) {
s32 sVar1;
s32 sVar2;
sVar1 = sub_0806ED9C(this, 0x28, 0x28);
if (sVar1 < 0) {
sVar1 = 2;
} else {
if (this->field_0xf == 0) {
this->field_0xf = 0x10;
} else {
this->field_0xf = this->field_0xf - 1;
sVar1 = this->animIndex;
}
}
sVar2 = sub_0806F078(this, sVar1);
if (sVar2 == 0) {
UpdateAnimationSingleFrame(this);
}
if (this->interactType != 0) {
this->action = 2;
this->interactType = 0;
}
}
static void sub_08066A30(Entity* this) {
this->action = 1;
}
static void sub_08066A38(Entity* this) {
this->action = 1;
this->spriteSettings.b.draw = 1;
sub_0807DD50(this);
}
static void sub_08066A50(Entity* this) {
sub_0807DD94(this, NULL);
}
static void (*const gUnk_081106D4[])(Entity*) = { sub_080669B8, sub_080669DC, sub_08066A30 };
static void (*const gUnk_081106E0[])(Entity*) = { sub_08066A38, sub_08066A50 };