mirror of
https://github.com/zeldaret/tmc
synced 2026-06-23 01:10:12 -04:00
Decompile guardWithSpear
This commit is contained in:
@@ -1,140 +0,0 @@
|
||||
.syntax unified
|
||||
push {r4, r5, r6, lr}
|
||||
adds r4, r0, #0
|
||||
adds r5, r1, #0
|
||||
ldrb r0, [r5, #0x18]
|
||||
cmp r0, #0
|
||||
bne _080640E8
|
||||
adds r0, #1
|
||||
strb r0, [r5, #0x18]
|
||||
bl Random
|
||||
movs r1, #0x3f
|
||||
ands r0, r1
|
||||
adds r0, #0x20
|
||||
strh r0, [r5, #0x12]
|
||||
bl Random
|
||||
adds r1, r0, #0
|
||||
movs r0, #0x18
|
||||
ands r1, r0
|
||||
ldrb r0, [r4, #0x15]
|
||||
cmp r0, #8
|
||||
beq _080640C4
|
||||
cmp r0, #8
|
||||
bgt _080640B2
|
||||
cmp r0, #0
|
||||
beq _080640BC
|
||||
b _080640DA
|
||||
_080640B2:
|
||||
cmp r0, #0x10
|
||||
beq _080640CC
|
||||
cmp r0, #0x18
|
||||
beq _080640D4
|
||||
b _080640DA
|
||||
_080640BC:
|
||||
cmp r1, #0x10
|
||||
bne _080640DA
|
||||
movs r1, #8
|
||||
b _080640DA
|
||||
_080640C4:
|
||||
cmp r1, #0x18
|
||||
bne _080640DA
|
||||
movs r1, #0x10
|
||||
b _080640DA
|
||||
_080640CC:
|
||||
cmp r1, #0
|
||||
bne _080640DA
|
||||
movs r1, #0x18
|
||||
b _080640DA
|
||||
_080640D4:
|
||||
cmp r1, #8
|
||||
bne _080640DA
|
||||
movs r1, #0
|
||||
_080640DA:
|
||||
strb r1, [r4, #0x15]
|
||||
adds r0, r1, #0
|
||||
bl sub_0806F5B0
|
||||
strb r0, [r4, #0x14]
|
||||
movs r0, #0x80
|
||||
strh r0, [r4, #0x24]
|
||||
_080640E8:
|
||||
ldrb r0, [r4, #0x14]
|
||||
lsrs r2, r0, #1
|
||||
adds r1, r2, #4
|
||||
adds r0, r4, #0
|
||||
adds r0, #0x58
|
||||
ldrb r0, [r0]
|
||||
cmp r1, r0
|
||||
beq _0806410A
|
||||
adds r0, r4, #0
|
||||
adds r0, #0x70
|
||||
movs r1, #0
|
||||
ldrsb r1, [r0, r1]
|
||||
adds r1, #4
|
||||
adds r1, r2, r1
|
||||
adds r0, r4, #0
|
||||
bl InitializeAnimation
|
||||
_0806410A:
|
||||
adds r0, r4, #0
|
||||
bl ProcessMovement0
|
||||
movs r0, #0x2e
|
||||
ldrsh r1, [r4, r0]
|
||||
adds r2, r4, #0
|
||||
adds r2, #0x68
|
||||
movs r3, #0
|
||||
ldrsh r0, [r2, r3]
|
||||
subs r1, r1, r0
|
||||
cmp r1, #0x10
|
||||
ble _0806412C
|
||||
ldrh r0, [r2]
|
||||
adds r0, #0x10
|
||||
strh r0, [r4, #0x2e]
|
||||
movs r0, #1
|
||||
strh r0, [r5, #0x12]
|
||||
_0806412C:
|
||||
movs r3, #0x10
|
||||
rsbs r3, r3, #0
|
||||
cmp r1, r3
|
||||
bge _0806413E
|
||||
ldrh r0, [r2]
|
||||
subs r0, #0x10
|
||||
strh r0, [r4, #0x2e]
|
||||
movs r0, #1
|
||||
strh r0, [r5, #0x12]
|
||||
_0806413E:
|
||||
movs r6, #0x32
|
||||
ldrsh r1, [r4, r6]
|
||||
adds r2, r4, #0
|
||||
adds r2, #0x6a
|
||||
movs r6, #0
|
||||
ldrsh r0, [r2, r6]
|
||||
subs r1, r1, r0
|
||||
cmp r1, #0x10
|
||||
ble _0806415A
|
||||
ldrh r0, [r2]
|
||||
adds r0, #0x10
|
||||
strh r0, [r4, #0x32]
|
||||
movs r0, #1
|
||||
strh r0, [r5, #0x12]
|
||||
_0806415A:
|
||||
cmp r1, r3
|
||||
bge _08064168
|
||||
ldrh r0, [r2]
|
||||
subs r0, #0x10
|
||||
strh r0, [r4, #0x32]
|
||||
movs r0, #1
|
||||
strh r0, [r5, #0x12]
|
||||
_08064168:
|
||||
ldrh r0, [r5, #0x12]
|
||||
subs r0, #1
|
||||
strh r0, [r5, #0x12]
|
||||
lsls r0, r0, #0x10
|
||||
cmp r0, #0
|
||||
beq _0806417A
|
||||
ldr r1, _0806417C @ =gActiveScriptInfo
|
||||
movs r0, #0
|
||||
strb r0, [r1, #6]
|
||||
_0806417A:
|
||||
pop {r4, r5, r6, pc}
|
||||
.align 2, 0
|
||||
_0806417C: .4byte gActiveScriptInfo
|
||||
.syntax divided
|
||||
@@ -1,144 +0,0 @@
|
||||
.syntax unified
|
||||
push {r4, r5, r6, lr}
|
||||
adds r5, r0, #0
|
||||
adds r4, r5, #0
|
||||
adds r4, #0x71
|
||||
ldrb r1, [r4]
|
||||
movs r0, #0
|
||||
ldrsb r0, [r4, r0]
|
||||
cmp r0, #0
|
||||
ble _080641AE
|
||||
subs r0, r1, #1
|
||||
strb r0, [r4]
|
||||
_080641AE:
|
||||
ldr r0, _080641D8 @ =gPlayerEntity
|
||||
movs r2, #0x32
|
||||
ldrsh r1, [r0, r2]
|
||||
movs r2, #0x32
|
||||
ldrsh r0, [r5, r2]
|
||||
subs r1, r1, r0
|
||||
cmp r1, #2
|
||||
ble _080641C0
|
||||
movs r1, #2
|
||||
_080641C0:
|
||||
movs r0, #2
|
||||
rsbs r0, r0, #0
|
||||
cmp r1, r0
|
||||
bge _080641CA
|
||||
adds r1, r0, #0
|
||||
_080641CA:
|
||||
adds r6, r4, #0
|
||||
cmp r1, #0
|
||||
beq _08064256
|
||||
cmp r1, #0
|
||||
ble _080641DC
|
||||
movs r0, #0x10
|
||||
b _080641DE
|
||||
.align 2, 0
|
||||
_080641D8: .4byte gPlayerEntity
|
||||
_080641DC:
|
||||
movs r0, #0
|
||||
_080641DE:
|
||||
strb r0, [r5, #0x15]
|
||||
cmp r1, #0
|
||||
bge _080641E6
|
||||
rsbs r1, r1, #0
|
||||
_080641E6:
|
||||
lsls r0, r1, #8
|
||||
strh r0, [r5, #0x24]
|
||||
movs r0, #0x32
|
||||
ldrsh r4, [r5, r0]
|
||||
adds r0, r5, #0
|
||||
bl ProcessMovement0
|
||||
movs r1, #0x32
|
||||
ldrsh r0, [r5, r1]
|
||||
adds r6, r5, #0
|
||||
adds r6, #0x71
|
||||
cmp r4, r0
|
||||
beq _08064256
|
||||
ldr r0, _080642B0 @ =gPlayerEntity
|
||||
movs r2, #0x24
|
||||
ldrsh r1, [r0, r2]
|
||||
movs r0, #0xa0
|
||||
lsls r0, r0, #1
|
||||
cmp r1, r0
|
||||
ble _08064222
|
||||
ldr r0, _080642B4 @ =gRoomTransition
|
||||
ldr r0, [r0]
|
||||
movs r1, #6
|
||||
bl __modsi3
|
||||
cmp r0, #0
|
||||
bne _08064222
|
||||
adds r0, r5, #0
|
||||
bl CreateDustSmall
|
||||
_08064222:
|
||||
adds r4, r5, #0
|
||||
adds r4, #0x71
|
||||
movs r0, #0xa
|
||||
strb r0, [r4]
|
||||
ldrb r0, [r5, #0x15]
|
||||
bl sub_0806F5B0
|
||||
strb r0, [r5, #0x14]
|
||||
lsls r0, r0, #0x18
|
||||
lsrs r0, r0, #0x19
|
||||
adds r1, r5, #0
|
||||
adds r1, #0x70
|
||||
ldrb r1, [r1]
|
||||
lsls r1, r1, #0x18
|
||||
asrs r1, r1, #0x18
|
||||
adds r1, #4
|
||||
adds r1, r0, r1
|
||||
adds r0, r5, #0
|
||||
adds r0, #0x58
|
||||
adds r6, r4, #0
|
||||
ldrb r0, [r0]
|
||||
cmp r1, r0
|
||||
beq _08064256
|
||||
adds r0, r5, #0
|
||||
bl InitializeAnimation
|
||||
_08064256:
|
||||
movs r0, #0
|
||||
ldrsb r0, [r6, r0]
|
||||
cmp r0, #0
|
||||
bne _0806428C
|
||||
ldr r1, _080642B0 @ =gPlayerEntity
|
||||
adds r0, r5, #0
|
||||
bl GetFacingDirection
|
||||
bl sub_0806F5B0
|
||||
strb r0, [r5, #0x14]
|
||||
lsls r0, r0, #0x18
|
||||
lsrs r0, r0, #0x19
|
||||
adds r1, r5, #0
|
||||
adds r1, #0x70
|
||||
ldrb r1, [r1]
|
||||
lsls r1, r1, #0x18
|
||||
asrs r1, r1, #0x18
|
||||
adds r1, r0, r1
|
||||
adds r0, r5, #0
|
||||
adds r0, #0x58
|
||||
ldrb r0, [r0]
|
||||
cmp r1, r0
|
||||
beq _0806428C
|
||||
adds r0, r5, #0
|
||||
bl InitializeAnimation
|
||||
_0806428C:
|
||||
adds r0, r5, #0
|
||||
bl sub_0806ED78
|
||||
movs r0, #0x36
|
||||
ldrsh r4, [r5, r0]
|
||||
ldr r0, _080642B0 @ =gPlayerEntity
|
||||
ldrh r0, [r0, #0x36]
|
||||
strh r0, [r5, #0x36]
|
||||
cmp r4, #0
|
||||
bge _080642AC
|
||||
lsls r0, r0, #0x10
|
||||
cmp r0, #0
|
||||
bne _080642AC
|
||||
adds r0, r5, #0
|
||||
bl CreateDustSmall
|
||||
_080642AC:
|
||||
pop {r4, r5, r6, pc}
|
||||
.align 2, 0
|
||||
_080642B0: .4byte gPlayerEntity
|
||||
_080642B4: .4byte gRoomTransition
|
||||
.syntax divided
|
||||
@@ -1,144 +0,0 @@
|
||||
.syntax unified
|
||||
push {r4, r5, r6, lr}
|
||||
adds r5, r0, #0
|
||||
adds r4, r5, #0
|
||||
adds r4, #0x71
|
||||
ldrb r1, [r4]
|
||||
movs r0, #0
|
||||
ldrsb r0, [r4, r0]
|
||||
cmp r0, #0
|
||||
ble _080642CE
|
||||
subs r0, r1, #1
|
||||
strb r0, [r4]
|
||||
_080642CE:
|
||||
ldr r0, _080642F8 @ =gPlayerEntity
|
||||
movs r2, #0x2e
|
||||
ldrsh r1, [r0, r2]
|
||||
movs r2, #0x2e
|
||||
ldrsh r0, [r5, r2]
|
||||
subs r1, r1, r0
|
||||
cmp r1, #2
|
||||
ble _080642E0
|
||||
movs r1, #2
|
||||
_080642E0:
|
||||
movs r0, #2
|
||||
rsbs r0, r0, #0
|
||||
cmp r1, r0
|
||||
bge _080642EA
|
||||
adds r1, r0, #0
|
||||
_080642EA:
|
||||
adds r6, r4, #0
|
||||
cmp r1, #0
|
||||
beq _08064376
|
||||
cmp r1, #0
|
||||
ble _080642FC
|
||||
movs r0, #8
|
||||
b _080642FE
|
||||
.align 2, 0
|
||||
_080642F8: .4byte gPlayerEntity
|
||||
_080642FC:
|
||||
movs r0, #0x18
|
||||
_080642FE:
|
||||
strb r0, [r5, #0x15]
|
||||
cmp r1, #0
|
||||
bge _08064306
|
||||
rsbs r1, r1, #0
|
||||
_08064306:
|
||||
lsls r0, r1, #8
|
||||
strh r0, [r5, #0x24]
|
||||
movs r0, #0x2e
|
||||
ldrsh r4, [r5, r0]
|
||||
adds r0, r5, #0
|
||||
bl ProcessMovement0
|
||||
movs r1, #0x2e
|
||||
ldrsh r0, [r5, r1]
|
||||
adds r6, r5, #0
|
||||
adds r6, #0x71
|
||||
cmp r4, r0
|
||||
beq _08064376
|
||||
ldr r0, _080643D0 @ =gPlayerEntity
|
||||
movs r2, #0x24
|
||||
ldrsh r1, [r0, r2]
|
||||
movs r0, #0xa0
|
||||
lsls r0, r0, #1
|
||||
cmp r1, r0
|
||||
ble _08064342
|
||||
ldr r0, _080643D4 @ =gRoomTransition
|
||||
ldr r0, [r0]
|
||||
movs r1, #6
|
||||
bl __modsi3
|
||||
cmp r0, #0
|
||||
bne _08064342
|
||||
adds r0, r5, #0
|
||||
bl CreateDustSmall
|
||||
_08064342:
|
||||
adds r4, r5, #0
|
||||
adds r4, #0x71
|
||||
movs r0, #0xa
|
||||
strb r0, [r4]
|
||||
ldrb r0, [r5, #0x15]
|
||||
bl sub_0806F5B0
|
||||
strb r0, [r5, #0x14]
|
||||
lsls r0, r0, #0x18
|
||||
lsrs r0, r0, #0x19
|
||||
adds r1, r5, #0
|
||||
adds r1, #0x70
|
||||
ldrb r1, [r1]
|
||||
lsls r1, r1, #0x18
|
||||
asrs r1, r1, #0x18
|
||||
adds r1, #4
|
||||
adds r1, r0, r1
|
||||
adds r0, r5, #0
|
||||
adds r0, #0x58
|
||||
adds r6, r4, #0
|
||||
ldrb r0, [r0]
|
||||
cmp r1, r0
|
||||
beq _08064376
|
||||
adds r0, r5, #0
|
||||
bl InitializeAnimation
|
||||
_08064376:
|
||||
movs r0, #0
|
||||
ldrsb r0, [r6, r0]
|
||||
cmp r0, #0
|
||||
bne _080643AC
|
||||
ldr r1, _080643D0 @ =gPlayerEntity
|
||||
adds r0, r5, #0
|
||||
bl GetFacingDirection
|
||||
bl sub_0806F5B0
|
||||
strb r0, [r5, #0x14]
|
||||
lsls r0, r0, #0x18
|
||||
lsrs r0, r0, #0x19
|
||||
adds r1, r5, #0
|
||||
adds r1, #0x70
|
||||
ldrb r1, [r1]
|
||||
lsls r1, r1, #0x18
|
||||
asrs r1, r1, #0x18
|
||||
adds r1, r0, r1
|
||||
adds r0, r5, #0
|
||||
adds r0, #0x58
|
||||
ldrb r0, [r0]
|
||||
cmp r1, r0
|
||||
beq _080643AC
|
||||
adds r0, r5, #0
|
||||
bl InitializeAnimation
|
||||
_080643AC:
|
||||
adds r0, r5, #0
|
||||
bl sub_0806ED78
|
||||
movs r0, #0x36
|
||||
ldrsh r4, [r5, r0]
|
||||
ldr r0, _080643D0 @ =gPlayerEntity
|
||||
ldrh r0, [r0, #0x36]
|
||||
strh r0, [r5, #0x36]
|
||||
cmp r4, #0
|
||||
bge _080643CC
|
||||
lsls r0, r0, #0x10
|
||||
cmp r0, #0
|
||||
bne _080643CC
|
||||
adds r0, r5, #0
|
||||
bl CreateDustSmall
|
||||
_080643CC:
|
||||
pop {r4, r5, r6, pc}
|
||||
.align 2, 0
|
||||
_080643D0: .4byte gPlayerEntity
|
||||
_080643D4: .4byte gRoomTransition
|
||||
.syntax divided
|
||||
@@ -1,40 +0,0 @@
|
||||
.syntax unified
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
movs r0, #2
|
||||
bl CheckGlobalFlag
|
||||
cmp r0, #0
|
||||
bne _080643EA
|
||||
movs r3, #0
|
||||
b _08064406
|
||||
_080643EA:
|
||||
movs r0, #2
|
||||
bl GetInventoryValue
|
||||
cmp r0, #0
|
||||
bne _080643F8
|
||||
movs r3, #1
|
||||
b _08064406
|
||||
_080643F8:
|
||||
movs r0, #3
|
||||
bl GetInventoryValue
|
||||
movs r3, #3
|
||||
cmp r0, #0
|
||||
bne _08064406
|
||||
movs r3, #2
|
||||
_08064406:
|
||||
ldrb r1, [r4, #0xb]
|
||||
rsbs r0, r1, #0
|
||||
orrs r0, r1
|
||||
lsrs r0, r0, #0x1f
|
||||
ldr r2, _08064424 @ =gUnk_0810F6D4
|
||||
lsls r1, r3, #1
|
||||
lsls r0, r0, #3
|
||||
adds r1, r1, r0
|
||||
adds r1, r1, r2
|
||||
ldrh r0, [r1]
|
||||
adds r1, r4, #0
|
||||
bl MessageNoOverlap
|
||||
pop {r4, pc}
|
||||
.align 2, 0
|
||||
_08064424: .4byte gUnk_0810F6D4
|
||||
.syntax divided
|
||||
@@ -1,37 +0,0 @@
|
||||
.syntax unified
|
||||
push {lr}
|
||||
adds r3, r0, #0
|
||||
ldr r0, _0806444C @ =gSave
|
||||
ldrb r0, [r0, #8]
|
||||
subs r1, r0, #2
|
||||
cmp r1, #0
|
||||
bge _08064438
|
||||
movs r1, #0
|
||||
_08064438:
|
||||
ldrb r2, [r3, #0xb]
|
||||
movs r0, #0x80
|
||||
ands r0, r2
|
||||
cmp r0, #0
|
||||
bne _08064454
|
||||
ldrb r0, [r3, #0xb]
|
||||
lsls r0, r0, #3
|
||||
ldr r1, _08064450 @ =gUnk_0810CF4C
|
||||
b _08064460
|
||||
.align 2, 0
|
||||
_0806444C: .4byte gSave
|
||||
_08064450: .4byte gUnk_0810CF4C
|
||||
_08064454:
|
||||
movs r0, #0x7f
|
||||
ands r0, r2
|
||||
lsls r0, r0, #6
|
||||
lsls r1, r1, #3
|
||||
ldr r2, _0806446C @ =gUnk_0810D0A4
|
||||
adds r1, r1, r2
|
||||
_08064460:
|
||||
adds r1, r0, r1
|
||||
adds r0, r3, #0
|
||||
bl ShowNPCDialogue
|
||||
pop {pc}
|
||||
.align 2, 0
|
||||
_0806446C: .4byte gUnk_0810D0A4
|
||||
.syntax divided
|
||||
@@ -1,36 +0,0 @@
|
||||
.syntax unified
|
||||
push {r4, lr}
|
||||
adds r2, r0, #0
|
||||
movs r1, #0x2e
|
||||
ldrsh r0, [r2, r1]
|
||||
ldr r3, _08064500 @ =gRoomControls
|
||||
movs r4, #0xa
|
||||
ldrsh r1, [r3, r4]
|
||||
subs r1, r0, r1
|
||||
adds r0, r1, #0
|
||||
adds r0, #8
|
||||
cmp r0, #0
|
||||
blt _08064504
|
||||
adds r0, r1, #0
|
||||
subs r0, #8
|
||||
cmp r0, #0xf0
|
||||
bgt _08064504
|
||||
movs r0, #0x32
|
||||
ldrsh r1, [r2, r0]
|
||||
movs r2, #0xc
|
||||
ldrsh r0, [r3, r2]
|
||||
subs r0, r1, r0
|
||||
cmp r0, #0
|
||||
blt _08064504
|
||||
subs r0, #0x18
|
||||
cmp r0, #0xa0
|
||||
bgt _08064504
|
||||
movs r0, #1
|
||||
b _08064506
|
||||
.align 2, 0
|
||||
_08064500: .4byte gRoomControls
|
||||
_08064504:
|
||||
movs r0, #0
|
||||
_08064506:
|
||||
pop {r4, pc}
|
||||
.syntax divided
|
||||
@@ -36688,11 +36688,6 @@
|
||||
"size": 18,
|
||||
"type": "animation"
|
||||
},
|
||||
{
|
||||
"path": "guardWithSpear/gUnk_0810F6D4.bin",
|
||||
"start": 1111764,
|
||||
"size": 16
|
||||
},
|
||||
{
|
||||
"path": "animations/gSpriteAnimations_Maid_0.bin",
|
||||
"start": 1112292,
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.section .rodata
|
||||
.align 2
|
||||
|
||||
gUnk_0810F6D4:: @ 0810F6D4
|
||||
.incbin "guardWithSpear/gUnk_0810F6D4.bin"
|
||||
@@ -1195,7 +1195,7 @@ SECTIONS {
|
||||
data/const/npc/pina.o(.rodata);
|
||||
data/animations/npc/pina.o(.rodata);
|
||||
data/const/npc/guard.o(.rodata);
|
||||
data/const/npc/guardWithSpear.o(.rodata);
|
||||
src/npc/guardWithSpear.o(.rodata);
|
||||
data/animations/npc/guardWithSpear.o(.rodata);
|
||||
data/const/npc/maid.o(.rodata);
|
||||
data/animations/npc/maid.o(.rodata);
|
||||
|
||||
+247
-7
@@ -1,10 +1,93 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "script.h"
|
||||
#include "player.h"
|
||||
#include "npc.h"
|
||||
#include "functions.h"
|
||||
#include "object.h"
|
||||
#include "item.h"
|
||||
|
||||
ASM_FUNC("asm/non_matching/guardWithSpear/sub_0806407C.inc",
|
||||
void sub_0806407C(Entity* this, ScriptExecutionContext* context))
|
||||
typedef struct {
|
||||
Entity base;
|
||||
s16 unk68;
|
||||
s16 unk6a;
|
||||
s16 unk6c;
|
||||
s16 unk6e;
|
||||
s8 unk70;
|
||||
s8 unk71;
|
||||
} GuardWithSpearEntity;
|
||||
|
||||
extern Dialog gUnk_0810CF4C[];
|
||||
extern Dialog gUnk_0810D0A4[];
|
||||
|
||||
void sub_0806407C(GuardWithSpearEntity* this, ScriptExecutionContext* context) {
|
||||
u32 dir;
|
||||
s32 x, y;
|
||||
u32 uVar7;
|
||||
|
||||
if (context->unk_18 == 0) {
|
||||
context->unk_18++;
|
||||
context->unk_12 = (Random() & 0x3f) + 0x20;
|
||||
dir = Random() & 0x18;
|
||||
switch (super->direction) {
|
||||
case DirectionNorth:
|
||||
if (dir == DirectionSouth) {
|
||||
dir = DirectionEast;
|
||||
}
|
||||
break;
|
||||
case DirectionEast:
|
||||
if (dir == DirectionWest) {
|
||||
dir = DirectionSouth;
|
||||
}
|
||||
break;
|
||||
case DirectionSouth:
|
||||
if (dir == DirectionNorth) {
|
||||
dir = DirectionWest;
|
||||
}
|
||||
break;
|
||||
case DirectionWest:
|
||||
if (dir == DirectionEast) {
|
||||
dir = DirectionNorth;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
super->direction = dir;
|
||||
super->animationState = sub_0806F5B0(dir);
|
||||
super->speed = 0x80;
|
||||
}
|
||||
|
||||
uVar7 = super->animationState >> 1;
|
||||
if (uVar7 + 4 != super->animIndex) {
|
||||
InitializeAnimation(super, uVar7 + 4 + this->unk70);
|
||||
}
|
||||
ProcessMovement0(super);
|
||||
|
||||
x = super->x.HALF.HI - this->unk68;
|
||||
if (0x10 < x) {
|
||||
super->x.HALF.HI = this->unk68 + 0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
if (x < -0x10) {
|
||||
super->x.HALF.HI = this->unk68 + -0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
|
||||
y = super->y.HALF.HI - this->unk6a;
|
||||
if (0x10 < y) {
|
||||
super->y.HALF.HI = this->unk6a + 0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
|
||||
if (y < -0x10) {
|
||||
super->y.HALF.HI = this->unk6a + -0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
|
||||
if (--context->unk_12) {
|
||||
gActiveScriptInfo.commandSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08064180(void) {
|
||||
Entity* entity = FindEntityByID(NPC, GUARD_1, 7);
|
||||
@@ -13,13 +96,160 @@ void sub_08064180(void) {
|
||||
}
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/guardWithSpear/sub_08064198.inc", void sub_08064198(Entity* this))
|
||||
void sub_08064198(GuardWithSpearEntity* this) {
|
||||
s32 sVar1;
|
||||
s32 yDiff;
|
||||
u32 animIndex;
|
||||
u32 animationState;
|
||||
|
||||
ASM_FUNC("asm/non_matching/guardWithSpear/sub_080642B8.inc", void sub_080642B8(Entity* this))
|
||||
if (this->unk71 > 0) {
|
||||
this->unk71--;
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/guardWithSpear/sub_080643D8.inc", void sub_080643D8(Entity* this))
|
||||
yDiff = gPlayerEntity.y.HALF.HI - super->y.HALF.HI;
|
||||
if (2 < yDiff) {
|
||||
yDiff = 2;
|
||||
}
|
||||
if (yDiff < -2) {
|
||||
yDiff = -2;
|
||||
}
|
||||
if (yDiff != 0) {
|
||||
if (yDiff >= 1) {
|
||||
super->direction = 16;
|
||||
} else {
|
||||
super->direction = 0;
|
||||
}
|
||||
if (yDiff < 0) {
|
||||
yDiff = -yDiff;
|
||||
}
|
||||
super->speed = (s16)(yDiff << 8);
|
||||
sVar1 = super->y.HALF.HI;
|
||||
ProcessMovement0(super);
|
||||
if (sVar1 != super->y.HALF.HI) {
|
||||
if (0x140 < gPlayerEntity.speed && gRoomTransition.frameCount % 6 == 0) {
|
||||
CreateDustSmall(super);
|
||||
}
|
||||
this->unk71 = 10;
|
||||
animationState = super->animationState = sub_0806F5B0(super->direction);
|
||||
animIndex = (animationState >> 1) + 4 + this->unk70;
|
||||
if (animIndex != super->animIndex) {
|
||||
InitializeAnimation(super, animIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this->unk71 == 0) {
|
||||
animationState = super->animationState = sub_0806F5B0(GetFacingDirection(super, &gPlayerEntity));
|
||||
animIndex = (animationState >> 1) + this->unk70;
|
||||
if (animIndex != super->animIndex) {
|
||||
InitializeAnimation(super, animIndex);
|
||||
}
|
||||
}
|
||||
sub_0806ED78(super);
|
||||
sVar1 = super->z.HALF.HI;
|
||||
super->z.HALF.HI = gPlayerEntity.z.HALF.HI;
|
||||
if (sVar1 < 0 && gPlayerEntity.z.HALF.HI == 0) {
|
||||
CreateDustSmall(super);
|
||||
}
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/guardWithSpear/sub_08064428.inc", void sub_08064428(Entity* this))
|
||||
void sub_080642B8(GuardWithSpearEntity* this) {
|
||||
s32 sVar1;
|
||||
s32 yDiff;
|
||||
u32 animIndex;
|
||||
u32 animationState;
|
||||
|
||||
if (this->unk71 > 0) {
|
||||
this->unk71--;
|
||||
}
|
||||
|
||||
yDiff = gPlayerEntity.x.HALF.HI - super->x.HALF.HI;
|
||||
if (2 < yDiff) {
|
||||
yDiff = 2;
|
||||
}
|
||||
if (yDiff < -2) {
|
||||
yDiff = -2;
|
||||
}
|
||||
if (yDiff != 0) {
|
||||
if (yDiff >= 1) {
|
||||
super->direction = 8;
|
||||
} else {
|
||||
super->direction = 24;
|
||||
}
|
||||
if (yDiff < 0) {
|
||||
yDiff = -yDiff;
|
||||
}
|
||||
super->speed = (s16)(yDiff << 8);
|
||||
sVar1 = super->x.HALF.HI;
|
||||
ProcessMovement0(super);
|
||||
if (sVar1 != super->x.HALF.HI) {
|
||||
if (0x140 < gPlayerEntity.speed && gRoomTransition.frameCount % 6 == 0) {
|
||||
CreateDustSmall(super);
|
||||
}
|
||||
this->unk71 = 10;
|
||||
animationState = super->animationState = sub_0806F5B0(super->direction);
|
||||
animIndex = (animationState >> 1) + 4 + this->unk70;
|
||||
if (animIndex != super->animIndex) {
|
||||
InitializeAnimation(super, animIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this->unk71 == 0) {
|
||||
animationState = super->animationState = sub_0806F5B0(GetFacingDirection(super, &gPlayerEntity));
|
||||
animIndex = (animationState >> 1) + this->unk70;
|
||||
if (animIndex != super->animIndex) {
|
||||
InitializeAnimation(super, animIndex);
|
||||
}
|
||||
}
|
||||
sub_0806ED78(super);
|
||||
sVar1 = super->z.HALF.HI;
|
||||
super->z.HALF.HI = gPlayerEntity.z.HALF.HI;
|
||||
if (sVar1 < 0 && gPlayerEntity.z.HALF.HI == 0) {
|
||||
CreateDustSmall(super);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080643D8(GuardWithSpearEntity* this) {
|
||||
static const u16 messageIndices[][4] = {
|
||||
{ 0x1062, 0x1328, 0x132b, 0x132b },
|
||||
{ 0x1062, 0x1328, 0x132c, 0x132c },
|
||||
};
|
||||
|
||||
u32 iVar1;
|
||||
int iVar2;
|
||||
|
||||
if (CheckGlobalFlag(2) == 0) {
|
||||
iVar2 = 0;
|
||||
} else {
|
||||
if (GetInventoryValue(ITEM_GREEN_SWORD) == 0) {
|
||||
iVar2 = 1;
|
||||
} else {
|
||||
if (GetInventoryValue(ITEM_RED_SWORD) == 0) {
|
||||
iVar2 = 2;
|
||||
} else {
|
||||
iVar2 = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
iVar1 = super->type2 ? 1 : 0;
|
||||
MessageNoOverlap(messageIndices[iVar1][iVar2], super);
|
||||
}
|
||||
|
||||
void sub_08064428(GuardWithSpearEntity* this) {
|
||||
int iVar2;
|
||||
Dialog* pDialog;
|
||||
|
||||
iVar2 = gSave.global_progress - 2;
|
||||
if (iVar2 < 0) {
|
||||
iVar2 = 0;
|
||||
}
|
||||
if ((super->type2 & 0x80) == 0) {
|
||||
pDialog = gUnk_0810CF4C + super->type2;
|
||||
} else {
|
||||
pDialog = gUnk_0810D0A4 + ((super->type2 & 0x7f) << 3) + iVar2;
|
||||
}
|
||||
ShowNPCDialogue(super, pDialog);
|
||||
}
|
||||
|
||||
void sub_08064470(Entity* this, ScriptExecutionContext* context) {
|
||||
if (gPlayerState.field_0xab == 1) {
|
||||
@@ -43,4 +273,14 @@ void sub_080644B4(Entity* this, ScriptExecutionContext* context) {
|
||||
context->condition = this->animationState == context->intVariable;
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/guardWithSpear/sub_080644C8.inc", void sub_080644C8(Entity* this))
|
||||
u32 sub_080644C8(GuardWithSpearEntity* this) {
|
||||
if (super->x.HALF.HI - gRoomControls.scroll_x + 8 < 0)
|
||||
return 0;
|
||||
if (super->x.HALF.HI - gRoomControls.scroll_x - 8 > 0xf0)
|
||||
return 0;
|
||||
if (super->y.HALF.HI - gRoomControls.scroll_y < 0)
|
||||
return 0;
|
||||
if (super->y.HALF.HI - gRoomControls.scroll_y - 0x18 > 0xa0)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user