mirror of https://github.com/zeldaret/tmc.git
Put const data in npc23 and match sub_0806650C
This commit is contained in:
parent
09d2e2c80c
commit
972b6c4a6d
|
@ -1,57 +0,0 @@
|
|||
.syntax unified
|
||||
push {r4, r5, r6, r7, lr}
|
||||
adds r3, r0, #0
|
||||
movs r4, #0
|
||||
ldr r1, _0806652C @ =gPlayerEntity
|
||||
ldrh r5, [r1, #0x2e]
|
||||
adds r7, r5, #0
|
||||
ldrh r2, [r1, #0x32]
|
||||
adds r0, #0x80
|
||||
ldrh r0, [r0]
|
||||
adds r0, #0x10
|
||||
adds r6, r1, #0
|
||||
cmp r2, r0
|
||||
bge _08066530
|
||||
movs r4, #4
|
||||
b _0806654C
|
||||
.align 2, 0
|
||||
_0806652C: .4byte gPlayerEntity
|
||||
_08066530:
|
||||
adds r0, r3, #0
|
||||
adds r0, #0x7e
|
||||
ldrh r1, [r0]
|
||||
adds r0, r1, #2
|
||||
cmp r5, r0
|
||||
bge _0806653E
|
||||
movs r4, #2
|
||||
_0806653E:
|
||||
adds r0, r1, #6
|
||||
cmp r7, r0
|
||||
ble _08066546
|
||||
movs r4, #6
|
||||
_08066546:
|
||||
cmp r4, #0
|
||||
bne _0806654C
|
||||
strh r4, [r6, #0x24]
|
||||
_0806654C:
|
||||
ldrb r0, [r6, #0xc]
|
||||
cmp r0, #0xf
|
||||
beq _0806656A
|
||||
cmp r4, #0
|
||||
bne _0806655A
|
||||
movs r0, #0
|
||||
b _0806656C
|
||||
_0806655A:
|
||||
movs r0, #8
|
||||
movs r1, #0
|
||||
movs r2, #0
|
||||
bl sub_08078AC0
|
||||
strb r4, [r6, #0x14]
|
||||
lsls r0, r4, #2
|
||||
strb r0, [r6, #0x15]
|
||||
_0806656A:
|
||||
movs r0, #1
|
||||
_0806656C:
|
||||
pop {r4, r5, r6, r7, pc}
|
||||
.align 2, 0
|
||||
.syntax divided
|
|
@ -1,13 +0,0 @@
|
|||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.section .rodata
|
||||
.align 2
|
||||
|
||||
gUnk_081104C8:: @ 081104C8
|
||||
.4byte sub_080662F8
|
||||
.4byte sub_08066358
|
||||
.4byte nullsub_110
|
||||
.4byte sub_080663D4
|
||||
.4byte sub_0806643C
|
||||
.4byte sub_08066474
|
|
@ -1211,7 +1211,7 @@ SECTIONS {
|
|||
data/animations/npc/ghostBrothers.o(.rodata);
|
||||
data/const/npc/smith.o(.rodata);
|
||||
data/animations/npc/smith.o(.rodata);
|
||||
data/const/npc/npc23.o(.rodata);
|
||||
src/npc/npc23.o(.rodata);
|
||||
data/const/npc/kingDaltus.o(.rodata);
|
||||
data/animations/npc/kingDaltus.o(.rodata);
|
||||
data/const/npc/ministerPotho.o(.rodata);
|
||||
|
|
|
@ -5,16 +5,23 @@
|
|||
#include "message.h"
|
||||
#include "npc.h"
|
||||
|
||||
extern void (*const gUnk_081104C8[])(Entity*);
|
||||
|
||||
bool32 sub_0806650C(Entity*);
|
||||
|
||||
void sub_08066490(Entity*, Entity*);
|
||||
|
||||
void sub_08066570(Entity* this);
|
||||
void sub_080662F8(Entity* this);
|
||||
void sub_08066358(Entity* this);
|
||||
void nullsub_110(Entity* this);
|
||||
void sub_080663D4(Entity* this);
|
||||
void sub_0806643C(Entity* this);
|
||||
void sub_08066474(Entity* this);
|
||||
|
||||
void NPC23(Entity* this) {
|
||||
gUnk_081104C8[this->action](this);
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
sub_080662F8, sub_08066358, nullsub_110, sub_080663D4, sub_0806643C, sub_08066474,
|
||||
};
|
||||
actionFuncs[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
|
||||
|
@ -58,7 +65,7 @@ void sub_08066358(Entity* this) {
|
|||
sub_08066570(this);
|
||||
}
|
||||
|
||||
void nullsub_110(void) {
|
||||
void nullsub_110(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_080663D4(Entity* this) {
|
||||
|
@ -93,7 +100,7 @@ void sub_0806643C(Entity* this) {
|
|||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_08066474(void) {
|
||||
void sub_08066474(Entity* this) {
|
||||
if (gPlayerEntity.action != PLAYER_ROOM_EXIT) {
|
||||
gPauseMenuOptions.disabled = 0;
|
||||
}
|
||||
|
@ -101,10 +108,10 @@ void sub_08066474(void) {
|
|||
|
||||
ASM_FUNC("asm/non_matching/npc23/sub_08066490.inc", void sub_08066490(Entity* this, Entity* entity))
|
||||
|
||||
// px needs to be used in both r5 and r7
|
||||
NONMATCH("asm/non_matching/npc23/sub_0806650C.inc", bool32 sub_0806650C(Entity* this)) {
|
||||
bool32 sub_0806650C(Entity* this) {
|
||||
u32 dir = 0;
|
||||
s32 px = gPlayerEntity.x.HALF_U.HI;
|
||||
s32 px2 = px;
|
||||
s32 py = gPlayerEntity.y.HALF_U.HI;
|
||||
|
||||
if (py < this->field_0x80.HWORD + 16) {
|
||||
|
@ -113,7 +120,7 @@ NONMATCH("asm/non_matching/npc23/sub_0806650C.inc", bool32 sub_0806650C(Entity*
|
|||
if (px < this->field_0x7c.HALF_U.HI + 2) {
|
||||
dir = 2;
|
||||
}
|
||||
if (px > this->field_0x7c.HALF_U.HI + 6) {
|
||||
if (px2 > this->field_0x7c.HALF_U.HI + 6) {
|
||||
dir = 6;
|
||||
}
|
||||
if (dir == 0) {
|
||||
|
@ -131,21 +138,37 @@ NONMATCH("asm/non_matching/npc23/sub_0806650C.inc", bool32 sub_0806650C(Entity*
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
NONMATCH("asm/non_matching/npc23/sub_08066570.inc", void sub_08066570(Entity* this)) {
|
||||
if (this->frame & ANIM_DONE) {
|
||||
u32 direction;
|
||||
u32 dir1, dir2;
|
||||
bool32 cond;
|
||||
if ((this->frame & ANIM_DONE) == 0) {
|
||||
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);
|
||||
if (this->action == 3 || !sub_0806FC80(this, &gPlayerEntity, 0x50)) {
|
||||
return;
|
||||
}
|
||||
|
||||
direction = GetFacingDirection(this, &gPlayerEntity);
|
||||
cond = TRUE;
|
||||
|
||||
dir2 = (direction & 0x18);
|
||||
dir1 = (this->direction & 0x18);
|
||||
if (dir1 == dir2) {
|
||||
dir1 = (direction + 5) & 7;
|
||||
dir2 = (this->direction + 5) & 7;
|
||||
if (dir2 < 3 && dir1 < 3) {
|
||||
cond = FALSE;
|
||||
}
|
||||
}
|
||||
if (cond) {
|
||||
this->direction = direction;
|
||||
direction += 4;
|
||||
direction &= 0x18;
|
||||
direction >>= 3;
|
||||
InitializeAnimation(this, direction);
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
|
Loading…
Reference in New Issue