summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/code_80428A0.s612
-rw-r--r--asm/code_804ACA0.s609
-rw-r--r--asm/code_8073AA0.s (renamed from asm/code_80739DC.s)98
-rw-r--r--include/dungeon_action.h9
-rw-r--r--include/dungeon_ai_items.h2
-rw-r--r--include/dungeon_entity.h26
-rw-r--r--include/dungeon_pokemon_attributes_1.h2
-rw-r--r--include/dungeon_util.h7
-rw-r--r--include/map.h19
-rwxr-xr-xld_script.txt4
-rw-r--r--src/code_80521D0_1.c16
-rw-r--r--src/code_8057824_1.c2
-rw-r--r--src/code_806CD90.c9
-rw-r--r--src/code_80869E4.c2
-rw-r--r--src/dungeon_action.c10
-rw-r--r--src/dungeon_ai_items.c120
-rw-r--r--src/dungeon_capabilities_1.c32
-rw-r--r--src/dungeon_movement.c50
-rw-r--r--src/dungeon_util.c2
-rw-r--r--src/dungeon_util_1.c17
20 files changed, 813 insertions, 835 deletions
diff --git a/asm/code_80428A0.s b/asm/code_80428A0.s
index bb8af3b..3146edd 100644
--- a/asm/code_80428A0.s
+++ b/asm/code_80428A0.s
@@ -4197,614 +4197,4 @@ ResetAction:
bx lr
thumb_func_end ResetAction
- thumb_func_start SetAction
-SetAction:
- movs r2, 0
- strh r1, [r0]
- strb r2, [r0, 0x4]
- strb r2, [r0, 0xC]
- bx lr
- thumb_func_end SetAction
-
- thumb_func_start SetWalkAction
-SetWalkAction:
- push {r4,lr}
- adds r4, r0, 0
- lsls r0, r1, 16
- asrs r0, 16
- bl GetIsMoving
- lsls r0, 24
- cmp r0, 0
- beq _08044CB6
- movs r0, 0x2
- b _08044CB8
-_08044CB6:
- movs r0, 0x1
-_08044CB8:
- strh r0, [r4]
- movs r0, 0
- strb r0, [r4, 0x4]
- strb r0, [r4, 0xC]
- pop {r4}
- pop {r0}
- bx r0
- thumb_func_end SetWalkAction
-
- thumb_func_start sub_8044CC8
-sub_8044CC8:
- push {lr}
- adds r3, r0, 0
- adds r2, r1, 0
- ldrb r1, [r2]
- subs r0, r1, 0x1
- lsls r0, 24
- lsrs r0, 24
- cmp r0, 0x13
- bhi _08044CEC
- ldr r0, _08044CE8
- ldrb r1, [r2]
- lsls r1, 2
- subs r1, 0x4
- ldr r0, [r0]
- adds r0, r1
- b _08044D34
- .align 2, 0
-_08044CE8: .4byte gTeamInventory_203B460
-_08044CEC:
- adds r0, r1, 0
- cmp r0, 0x80
- bne _08044D06
- movs r1, 0x4
- ldrsh r0, [r2, r1]
- movs r3, 0x6
- ldrsh r1, [r2, r3]
- bl GetMapTileAtPosition
- ldr r0, [r0, 0x14]
- bl GetItemData
- b _08044D34
-_08044D06:
- cmp r0, 0x81
- bne _08044D0E
- ldr r0, [r3, 0x70]
- b _08044D32
-_08044D0E:
- adds r0, r1, 0
- adds r0, 0x70
- lsls r0, 24
- lsrs r0, 24
- cmp r0, 0x3
- bls _08044D1E
- movs r0, 0
- b _08044D34
-_08044D1E:
- ldr r0, _08044D38
- ldr r1, [r0]
- ldrb r0, [r2]
- subs r0, 0x90
- lsls r0, 2
- ldr r2, _08044D3C
- adds r1, r2
- adds r1, r0
- ldr r0, [r1]
- ldr r0, [r0, 0x70]
-_08044D32:
- adds r0, 0x60
-_08044D34:
- pop {r1}
- bx r1
- .align 2, 0
-_08044D38: .4byte gDungeonGlobalData
-_08044D3C: .4byte 0x0001357c
- thumb_func_end sub_8044CC8
-
- thumb_func_start sub_8044D40
-sub_8044D40:
- push {lr}
- lsls r1, 3
- adds r1, 0x4
- adds r2, r0, r1
- ldrb r1, [r2]
- subs r0, r1, 0x1
- lsls r0, 24
- lsrs r0, 24
- cmp r0, 0x13
- bhi _08044D74
- ldr r1, _08044D70
- ldrb r0, [r2]
- lsls r0, 2
- subs r0, 0x4
- ldr r1, [r1]
- adds r1, r0
- movs r0, 0
- strb r0, [r1, 0x2]
- strb r0, [r1, 0x1]
- strb r0, [r1]
- bl FillInventoryGaps
- b _08044D88
- .align 2, 0
-_08044D70: .4byte gTeamInventory_203B460
-_08044D74:
- lsls r0, r1, 24
- lsrs r0, 24
- cmp r0, 0x80
- beq _08044D80
- movs r0, 0
- b _08044D8A
-_08044D80:
- adds r0, r2, 0x4
- movs r1, 0x1
- bl sub_80461C8
-_08044D88:
- movs r0, 0x1
-_08044D8A:
- pop {r1}
- bx r1
- thumb_func_end sub_8044D40
-
- thumb_func_start sub_8044D90
-sub_8044D90:
- push {lr}
- ldr r3, [r0, 0x70]
- lsls r1, 3
- adds r1, 0x48
- adds r3, r1
- adds r1, r3, 0
- bl sub_8044CC8
- pop {r1}
- bx r1
- thumb_func_end sub_8044D90
-
- thumb_func_start sub_8044DA4
-sub_8044DA4:
- ldr r0, [r0, 0x70]
- ldr r2, _08044DC0
- ldr r2, [r2]
- lsls r1, 3
- adds r0, r1
- adds r0, 0x48
- ldrb r0, [r0]
- lsls r0, 2
- ldr r1, _08044DC4
- adds r2, r1
- adds r2, r0
- ldr r0, [r2]
- bx lr
- .align 2, 0
-_08044DC0: .4byte gDungeonGlobalData
-_08044DC4: .4byte 0x0001357c
- thumb_func_end sub_8044DA4
-
- thumb_func_start sub_8044DC8
-sub_8044DC8:
- push {r4,lr}
- adds r1, r0, 0
- ldrb r0, [r1, 0x2]
- cmp r0, 0xE9
- beq _08044DE8
- ldr r4, _08044DE4
- bl GetItemType
- lsls r0, 24
- lsrs r0, 23
- adds r0, r4
- ldrh r0, [r0]
- b _08044DEA
- .align 2, 0
-_08044DE4: .4byte gUnknown_80F6964
-_08044DE8:
- movs r0, 0x35
-_08044DEA:
- pop {r4}
- pop {r1}
- bx r1
- thumb_func_end sub_8044DC8
-
- thumb_func_start sub_8044DF0
-sub_8044DF0:
- push {r4,lr}
- ldr r4, [r0, 0x70]
- bl sub_8044D90
- adds r1, r0, 0
- adds r0, r4, 0
- adds r0, 0x48
- ldrb r0, [r0]
- cmp r0, 0x80
- bne _08044E10
- adds r0, r4, 0
- adds r0, 0x4C
- movs r1, 0x1
- bl sub_80461C8
- b _08044E1C
-_08044E10:
- movs r0, 0
- strb r0, [r1, 0x2]
- strb r0, [r1, 0x1]
- strb r0, [r1]
- bl FillInventoryGaps
-_08044E1C:
- pop {r4}
- pop {r0}
- bx r0
- thumb_func_end sub_8044DF0
-
- thumb_func_start sub_8044E24
-sub_8044E24:
- push {r4-r7,lr}
- mov r7, r8
- push {r7}
- sub sp, 0x4
- adds r4, r0, 0
- adds r6, r1, 0
- adds r7, r2, 0
- bl sub_8044D90
- adds r5, r0, 0
- ldr r0, [r4, 0x70]
- mov r8, r0
- ldrb r0, [r5, 0x2]
- bl IsHMItem
- lsls r0, 24
- cmp r0, 0
- bne _08044EBA
- ldrb r0, [r5, 0x2]
- bl GetItemType
- lsls r0, 24
- lsrs r0, 24
- cmp r0, 0x5
- bne _08044EB0
- lsls r1, r6, 3
- mov r2, r8
- adds r0, r2, r1
- adds r0, 0x48
- ldrb r0, [r0]
- cmp r0, 0x80
- bne _08044EA4
- ldr r0, [r5]
- str r0, [sp]
- adds r4, r1, r2
- adds r4, 0x4C
- adds r0, r4, 0
- movs r1, 0x1
- bl sub_80461C8
- ldrb r1, [r5, 0x2]
- subs r1, 0x7D
- lsls r1, 24
- lsrs r1, 16
- ldr r2, _08044E9C
- ldr r0, [sp]
- ands r0, r2
- orrs r0, r1
- ldr r1, _08044EA0
- ands r0, r1
- movs r1, 0xF8
- lsls r1, 15
- orrs r0, r1
- str r0, [sp]
- adds r0, r4, 0
- mov r1, sp
- movs r2, 0x1
- bl sub_80460F8
- b _08044EBA
- .align 2, 0
-_08044E9C: .4byte 0xffff00ff
-_08044EA0: .4byte 0xff00ffff
-_08044EA4:
- ldrb r0, [r5, 0x2]
- subs r0, 0x7D
- strb r0, [r5, 0x1]
- movs r0, 0x7C
- strb r0, [r5, 0x2]
- b _08044EBA
-_08044EB0:
- adds r0, r4, 0
- adds r1, r6, 0
- adds r2, r7, 0
- bl sub_8044DF0
-_08044EBA:
- add sp, 0x4
- pop {r3}
- mov r8, r3
- pop {r4-r7}
- pop {r0}
- bx r0
- thumb_func_end sub_8044E24
-
- thumb_func_start sub_8044EC8
-sub_8044EC8:
- push {r4,r5,lr}
- adds r5, r0, 0
- ldr r1, _08044EE8
- lsls r0, r5, 2
- adds r0, r1
- ldrh r4, [r0]
- cmp r4, 0x26
- bne _08044EF0
- bl sub_8043D10
- lsls r0, 24
- lsrs r0, 24
- cmp r0, 0x2
- bne _08044EF0
- ldr r0, _08044EEC
- b _08044F2C
- .align 2, 0
-_08044EE8: .4byte gUnknown_202EE44
-_08044EEC: .4byte gUnknown_80F91EC
-_08044EF0:
- ldr r1, _08044F10
- lsls r0, r4, 3
- adds r4, r0, r1
- ldr r0, [r4]
- ldr r1, _08044F14
- bl strcmp
- cmp r0, 0
- beq _08044F04
- movs r0, 0x1
-_08044F04:
- lsls r0, 24
- cmp r0, 0
- beq _08044F18
- ldr r0, [r4]
- b _08044F2E
- .align 2, 0
-_08044F10: .4byte gUnknown_80F7C50
-_08044F14: .4byte gUnknown_80F697C
-_08044F18:
- ldr r4, _08044F34
- ldr r1, _08044F38
- lsls r0, r5, 2
- adds r0, r1
- ldrb r0, [r0, 0x2]
- bl GetItemCategory
- lsls r0, 3
- adds r4, 0x4
- adds r0, r4
-_08044F2C:
- ldr r0, [r0]
-_08044F2E:
- pop {r4,r5}
- pop {r1}
- bx r1
- .align 2, 0
-_08044F34: .4byte gActions
-_08044F38: .4byte gUnknown_202EE44
- thumb_func_end sub_8044EC8
-
- thumb_func_start sub_8044F3C
-sub_8044F3C:
- push {lr}
- adds r1, r0, 0
- cmp r1, 0
- blt _08044F54
- ldr r0, _08044F50
- lsls r1, 2
- adds r1, r0
- ldrb r0, [r1, 0x3]
- b _08044F56
- .align 2, 0
-_08044F50: .4byte gUnknown_202EE44
-_08044F54:
- movs r0, 0
-_08044F56:
- pop {r1}
- bx r1
- thumb_func_end sub_8044F3C
-
- thumb_func_start sub_8044F5C
-sub_8044F5C:
- push {r4-r7,lr}
- lsls r0, 16
- lsrs r4, r0, 16
- lsls r1, 24
- lsrs r7, r1, 24
- ldr r0, _08044FAC
- ldr r2, [r0]
- adds r6, r0, 0
- cmp r2, 0x9
- bgt _08044FA4
- movs r3, 0
- ldr r5, _08044FB0
- cmp r3, r2
- bge _08044F8A
- adds r1, r2, 0
- adds r2, r5, 0
-_08044F7C:
- ldrh r0, [r2]
- cmp r0, r4
- beq _08044FA4
- adds r2, 0x4
- adds r3, 0x1
- cmp r3, r1
- blt _08044F7C
-_08044F8A:
- ldr r0, [r6]
- lsls r0, 2
- adds r0, r5
- strh r4, [r0]
- strb r7, [r0, 0x2]
- ldr r0, [r6]
- lsls r0, 2
- adds r0, r5
- movs r1, 0x1
- strb r1, [r0, 0x3]
- ldr r0, [r6]
- adds r0, 0x1
- str r0, [r6]
-_08044FA4:
- pop {r4-r7}
- pop {r0}
- bx r0
- .align 2, 0
-_08044FAC: .4byte gUnknown_202EE6C
-_08044FB0: .4byte gUnknown_202EE44
- thumb_func_end sub_8044F5C
-
- thumb_func_start sub_8044FB4
-sub_8044FB4:
- push {r4,lr}
- lsls r0, 16
- lsrs r4, r0, 16
- movs r1, 0
- ldr r0, _08044FD4
- ldr r0, [r0]
- cmp r1, r0
- bge _08044FE4
- adds r3, r0, 0
- ldr r2, _08044FD8
-_08044FC8:
- ldrh r0, [r2]
- cmp r0, r4
- bne _08044FDC
- adds r0, r1, 0
- b _08044FE8
- .align 2, 0
-_08044FD4: .4byte gUnknown_202EE6C
-_08044FD8: .4byte gUnknown_202EE44
-_08044FDC:
- adds r2, 0x4
- adds r1, 0x1
- cmp r1, r3
- blt _08044FC8
-_08044FE4:
- movs r0, 0x1
- negs r0, r0
-_08044FE8:
- pop {r4}
- pop {r1}
- bx r1
- thumb_func_end sub_8044FB4
-
- thumb_func_start sub_8044FF0
-sub_8044FF0:
- push {r4,r5,lr}
- lsls r0, 16
- lsrs r3, r0, 16
- movs r2, 0
- ldr r1, _08045010
- ldr r0, [r1]
- cmp r2, r0
- bge _08045022
- movs r5, 0
- adds r4, r1, 0
- ldr r1, _08045014
-_08045006:
- ldrh r0, [r1]
- cmp r0, r3
- bne _08045018
- strb r5, [r1, 0x3]
- b _08045022
- .align 2, 0
-_08045010: .4byte gUnknown_202EE6C
-_08045014: .4byte gUnknown_202EE44
-_08045018:
- adds r1, 0x4
- adds r2, 0x1
- ldr r0, [r4]
- cmp r2, r0
- blt _08045006
-_08045022:
- pop {r4,r5}
- pop {r0}
- bx r0
- thumb_func_end sub_8044FF0
-
- thumb_func_start IsNotAttacking
-IsNotAttacking:
- push {r4,lr}
- adds r2, r0, 0
- lsls r1, 24
- ldr r0, [r2, 0x70]
- adds r4, r0, 0
- adds r4, 0x44
- cmp r1, 0
- beq _08045044
- adds r0, r2, 0
- bl sub_8045888
- lsls r0, 24
- cmp r0, 0
- beq _0804505A
-_08045044:
- ldrh r0, [r4]
- cmp r0, 0
- beq _0804505A
- cmp r0, 0x2
- beq _0804505A
- cmp r0, 0x1
- beq _0804505A
- cmp r0, 0x5
- beq _0804505A
- movs r0, 0
- b _0804505C
-_0804505A:
- movs r0, 0x1
-_0804505C:
- pop {r4}
- pop {r1}
- bx r1
- thumb_func_end IsNotAttacking
-
- thumb_func_start sub_8045064
-sub_8045064:
- push {r4-r7,lr}
- mov r7, r9
- mov r6, r8
- push {r6,r7}
- movs r1, 0
- ldr r0, _080450D4
- mov r8, r0
- ldr r0, [r0]
- cmp r1, r0
- bge _080450C8
- mov r7, r8
- ldr r2, _080450D8
- mov r9, r2
- ldr r0, _080450DC
- mov r12, r0
-_08045082:
- adds r4, r1, 0x1
- ldr r0, [r7]
- adds r5, r4, 0
- cmp r5, r0
- bge _080450BE
- lsls r0, r1, 2
- mov r1, r12
- adds r3, r0, r1
- mov r6, r9
- lsls r0, r5, 2
- adds r2, r0, r1
-_08045098:
- ldrh r1, [r3]
- lsls r1, 3
- adds r1, r6
- ldrh r0, [r2]
- lsls r0, 3
- adds r0, r6
- ldr r1, [r1]
- ldr r0, [r0]
- cmp r1, r0
- ble _080450B4
- ldr r1, [r3]
- ldr r0, [r2]
- str r0, [r3]
- str r1, [r2]
-_080450B4:
- adds r2, 0x4
- adds r4, 0x1
- ldr r0, [r7]
- cmp r4, r0
- blt _08045098
-_080450BE:
- adds r1, r5, 0
- mov r2, r8
- ldr r0, [r2]
- cmp r1, r0
- blt _08045082
-_080450C8:
- pop {r3,r4}
- mov r8, r3
- mov r9, r4
- pop {r4-r7}
- pop {r0}
- bx r0
- .align 2, 0
-_080450D4: .4byte gUnknown_202EE6C
-_080450D8: .4byte gUnknown_80F7C54
-_080450DC: .4byte gUnknown_202EE44
- thumb_func_end sub_8045064
+ .align 2, 0 \ No newline at end of file
diff --git a/asm/code_804ACA0.s b/asm/code_804ACA0.s
new file mode 100644
index 0000000..f5172dc
--- /dev/null
+++ b/asm/code_804ACA0.s
@@ -0,0 +1,609 @@
+ .include "constants/gba_constants.inc"
+ .include "asm/macros.inc"
+
+ .syntax unified
+
+ .text
+
+ thumb_func_start SetWalkAction
+SetWalkAction:
+ push {r4,lr}
+ adds r4, r0, 0
+ lsls r0, r1, 16
+ asrs r0, 16
+ bl GetIsMoving
+ lsls r0, 24
+ cmp r0, 0
+ beq _08044CB6
+ movs r0, 0x2
+ b _08044CB8
+_08044CB6:
+ movs r0, 0x1
+_08044CB8:
+ strh r0, [r4]
+ movs r0, 0
+ strb r0, [r4, 0x4]
+ strb r0, [r4, 0xC]
+ pop {r4}
+ pop {r0}
+ bx r0
+ thumb_func_end SetWalkAction
+
+ thumb_func_start sub_8044CC8
+sub_8044CC8:
+ push {lr}
+ adds r3, r0, 0
+ adds r2, r1, 0
+ ldrb r1, [r2]
+ subs r0, r1, 0x1
+ lsls r0, 24
+ lsrs r0, 24
+ cmp r0, 0x13
+ bhi _08044CEC
+ ldr r0, _08044CE8
+ ldrb r1, [r2]
+ lsls r1, 2
+ subs r1, 0x4
+ ldr r0, [r0]
+ adds r0, r1
+ b _08044D34
+ .align 2, 0
+_08044CE8: .4byte gTeamInventory_203B460
+_08044CEC:
+ adds r0, r1, 0
+ cmp r0, 0x80
+ bne _08044D06
+ movs r1, 0x4
+ ldrsh r0, [r2, r1]
+ movs r3, 0x6
+ ldrsh r1, [r2, r3]
+ bl GetMapTileAtPosition
+ ldr r0, [r0, 0x14]
+ bl GetItemData
+ b _08044D34
+_08044D06:
+ cmp r0, 0x81
+ bne _08044D0E
+ ldr r0, [r3, 0x70]
+ b _08044D32
+_08044D0E:
+ adds r0, r1, 0
+ adds r0, 0x70
+ lsls r0, 24
+ lsrs r0, 24
+ cmp r0, 0x3
+ bls _08044D1E
+ movs r0, 0
+ b _08044D34
+_08044D1E:
+ ldr r0, _08044D38
+ ldr r1, [r0]
+ ldrb r0, [r2]
+ subs r0, 0x90
+ lsls r0, 2
+ ldr r2, _08044D3C
+ adds r1, r2
+ adds r1, r0
+ ldr r0, [r1]
+ ldr r0, [r0, 0x70]
+_08044D32:
+ adds r0, 0x60
+_08044D34:
+ pop {r1}
+ bx r1
+ .align 2, 0
+_08044D38: .4byte gDungeonGlobalData
+_08044D3C: .4byte 0x0001357c
+ thumb_func_end sub_8044CC8
+
+ thumb_func_start sub_8044D40
+sub_8044D40:
+ push {lr}
+ lsls r1, 3
+ adds r1, 0x4
+ adds r2, r0, r1
+ ldrb r1, [r2]
+ subs r0, r1, 0x1
+ lsls r0, 24
+ lsrs r0, 24
+ cmp r0, 0x13
+ bhi _08044D74
+ ldr r1, _08044D70
+ ldrb r0, [r2]
+ lsls r0, 2
+ subs r0, 0x4
+ ldr r1, [r1]
+ adds r1, r0
+ movs r0, 0
+ strb r0, [r1, 0x2]
+ strb r0, [r1, 0x1]
+ strb r0, [r1]
+ bl FillInventoryGaps
+ b _08044D88
+ .align 2, 0
+_08044D70: .4byte gTeamInventory_203B460
+_08044D74:
+ lsls r0, r1, 24
+ lsrs r0, 24
+ cmp r0, 0x80
+ beq _08044D80
+ movs r0, 0
+ b _08044D8A
+_08044D80:
+ adds r0, r2, 0x4
+ movs r1, 0x1
+ bl sub_80461C8
+_08044D88:
+ movs r0, 0x1
+_08044D8A:
+ pop {r1}
+ bx r1
+ thumb_func_end sub_8044D40
+
+ thumb_func_start sub_8044D90
+sub_8044D90:
+ push {lr}
+ ldr r3, [r0, 0x70]
+ lsls r1, 3
+ adds r1, 0x48
+ adds r3, r1
+ adds r1, r3, 0
+ bl sub_8044CC8
+ pop {r1}
+ bx r1
+ thumb_func_end sub_8044D90
+
+ thumb_func_start sub_8044DA4
+sub_8044DA4:
+ ldr r0, [r0, 0x70]
+ ldr r2, _08044DC0
+ ldr r2, [r2]
+ lsls r1, 3
+ adds r0, r1
+ adds r0, 0x48
+ ldrb r0, [r0]
+ lsls r0, 2
+ ldr r1, _08044DC4
+ adds r2, r1
+ adds r2, r0
+ ldr r0, [r2]
+ bx lr
+ .align 2, 0
+_08044DC0: .4byte gDungeonGlobalData
+_08044DC4: .4byte 0x0001357c
+ thumb_func_end sub_8044DA4
+
+ thumb_func_start sub_8044DC8
+sub_8044DC8:
+ push {r4,lr}
+ adds r1, r0, 0
+ ldrb r0, [r1, 0x2]
+ cmp r0, 0xE9
+ beq _08044DE8
+ ldr r4, _08044DE4
+ bl GetItemType
+ lsls r0, 24
+ lsrs r0, 23
+ adds r0, r4
+ ldrh r0, [r0]
+ b _08044DEA
+ .align 2, 0
+_08044DE4: .4byte gUnknown_80F6964
+_08044DE8:
+ movs r0, 0x35
+_08044DEA:
+ pop {r4}
+ pop {r1}
+ bx r1
+ thumb_func_end sub_8044DC8
+
+ thumb_func_start sub_8044DF0
+sub_8044DF0:
+ push {r4,lr}
+ ldr r4, [r0, 0x70]
+ bl sub_8044D90
+ adds r1, r0, 0
+ adds r0, r4, 0
+ adds r0, 0x48
+ ldrb r0, [r0]
+ cmp r0, 0x80
+ bne _08044E10
+ adds r0, r4, 0
+ adds r0, 0x4C
+ movs r1, 0x1
+ bl sub_80461C8
+ b _08044E1C
+_08044E10:
+ movs r0, 0
+ strb r0, [r1, 0x2]
+ strb r0, [r1, 0x1]
+ strb r0, [r1]
+ bl FillInventoryGaps
+_08044E1C:
+ pop {r4}
+ pop {r0}
+ bx r0
+ thumb_func_end sub_8044DF0
+
+ thumb_func_start sub_8044E24
+sub_8044E24:
+ push {r4-r7,lr}
+ mov r7, r8
+ push {r7}
+ sub sp, 0x4
+ adds r4, r0, 0
+ adds r6, r1, 0
+ adds r7, r2, 0
+ bl sub_8044D90
+ adds r5, r0, 0
+ ldr r0, [r4, 0x70]
+ mov r8, r0
+ ldrb r0, [r5, 0x2]
+ bl IsHMItem
+ lsls r0, 24
+ cmp r0, 0
+ bne _08044EBA
+ ldrb r0, [r5, 0x2]
+ bl GetItemType
+ lsls r0, 24
+ lsrs r0, 24
+ cmp r0, 0x5
+ bne _08044EB0
+ lsls r1, r6, 3
+ mov r2, r8
+ adds r0, r2, r1
+ adds r0, 0x48
+ ldrb r0, [r0]
+ cmp r0, 0x80
+ bne _08044EA4
+ ldr r0, [r5]
+ str r0, [sp]
+ adds r4, r1, r2
+ adds r4, 0x4C
+ adds r0, r4, 0
+ movs r1, 0x1
+ bl sub_80461C8
+ ldrb r1, [r5, 0x2]
+ subs r1, 0x7D
+ lsls r1, 24
+ lsrs r1, 16
+ ldr r2, _08044E9C
+ ldr r0, [sp]
+ ands r0, r2
+ orrs r0, r1
+ ldr r1, _08044EA0
+ ands r0, r1
+ movs r1, 0xF8
+ lsls r1, 15
+ orrs r0, r1
+ str r0, [sp]
+ adds r0, r4, 0
+ mov r1, sp
+ movs r2, 0x1
+ bl sub_80460F8
+ b _08044EBA
+ .align 2, 0
+_08044E9C: .4byte 0xffff00ff
+_08044EA0: .4byte 0xff00ffff
+_08044EA4:
+ ldrb r0, [r5, 0x2]
+ subs r0, 0x7D
+ strb r0, [r5, 0x1]
+ movs r0, 0x7C
+ strb r0, [r5, 0x2]
+ b _08044EBA
+_08044EB0:
+ adds r0, r4, 0
+ adds r1, r6, 0
+ adds r2, r7, 0
+ bl sub_8044DF0
+_08044EBA:
+ add sp, 0x4
+ pop {r3}
+ mov r8, r3
+ pop {r4-r7}
+ pop {r0}
+ bx r0
+ thumb_func_end sub_8044E24
+
+ thumb_func_start sub_8044EC8
+sub_8044EC8:
+ push {r4,r5,lr}
+ adds r5, r0, 0
+ ldr r1, _08044EE8
+ lsls r0, r5, 2
+ adds r0, r1
+ ldrh r4, [r0]
+ cmp r4, 0x26
+ bne _08044EF0
+ bl sub_8043D10
+ lsls r0, 24
+ lsrs r0, 24
+ cmp r0, 0x2
+ bne _08044EF0
+ ldr r0, _08044EEC
+ b _08044F2C
+ .align 2, 0
+_08044EE8: .4byte gUnknown_202EE44
+_08044EEC: .4byte gUnknown_80F91EC
+_08044EF0:
+ ldr r1, _08044F10
+ lsls r0, r4, 3
+ adds r4, r0, r1
+ ldr r0, [r4]
+ ldr r1, _08044F14
+ bl strcmp
+ cmp r0, 0
+ beq _08044F04
+ movs r0, 0x1
+_08044F04:
+ lsls r0, 24
+ cmp r0, 0
+ beq _08044F18
+ ldr r0, [r4]
+ b _08044F2E
+ .align 2, 0
+_08044F10: .4byte gUnknown_80F7C50
+_08044F14: .4byte gUnknown_80F697C
+_08044F18:
+ ldr r4, _08044F34
+ ldr r1, _08044F38
+ lsls r0, r5, 2
+ adds r0, r1
+ ldrb r0, [r0, 0x2]
+ bl GetItemCategory
+ lsls r0, 3
+ adds r4, 0x4
+ adds r0, r4
+_08044F2C:
+ ldr r0, [r0]
+_08044F2E:
+ pop {r4,r5}
+ pop {r1}
+ bx r1
+ .align 2, 0
+_08044F34: .4byte gActions
+_08044F38: .4byte gUnknown_202EE44
+ thumb_func_end sub_8044EC8
+
+ thumb_func_start sub_8044F3C
+sub_8044F3C:
+ push {lr}
+ adds r1, r0, 0
+ cmp r1, 0
+ blt _08044F54
+ ldr r0, _08044F50
+ lsls r1, 2
+ adds r1, r0
+ ldrb r0, [r1, 0x3]
+ b _08044F56
+ .align 2, 0
+_08044F50: .4byte gUnknown_202EE44
+_08044F54:
+ movs r0, 0
+_08044F56:
+ pop {r1}
+ bx r1
+ thumb_func_end sub_8044F3C
+
+ thumb_func_start sub_8044F5C
+sub_8044F5C:
+ push {r4-r7,lr}
+ lsls r0, 16
+ lsrs r4, r0, 16
+ lsls r1, 24
+ lsrs r7, r1, 24
+ ldr r0, _08044FAC
+ ldr r2, [r0]
+ adds r6, r0, 0
+ cmp r2, 0x9
+ bgt _08044FA4
+ movs r3, 0
+ ldr r5, _08044FB0
+ cmp r3, r2
+ bge _08044F8A
+ adds r1, r2, 0
+ adds r2, r5, 0
+_08044F7C:
+ ldrh r0, [r2]
+ cmp r0, r4
+ beq _08044FA4
+ adds r2, 0x4
+ adds r3, 0x1
+ cmp r3, r1
+ blt _08044F7C
+_08044F8A:
+ ldr r0, [r6]
+ lsls r0, 2
+ adds r0, r5
+ strh r4, [r0]
+ strb r7, [r0, 0x2]
+ ldr r0, [r6]
+ lsls r0, 2
+ adds r0, r5
+ movs r1, 0x1
+ strb r1, [r0, 0x3]
+ ldr r0, [r6]
+ adds r0, 0x1
+ str r0, [r6]
+_08044FA4:
+ pop {r4-r7}
+ pop {r0}
+ bx r0
+ .align 2, 0
+_08044FAC: .4byte gUnknown_202EE6C
+_08044FB0: .4byte gUnknown_202EE44
+ thumb_func_end sub_8044F5C
+
+ thumb_func_start sub_8044FB4
+sub_8044FB4:
+ push {r4,lr}
+ lsls r0, 16
+ lsrs r4, r0, 16
+ movs r1, 0
+ ldr r0, _08044FD4
+ ldr r0, [r0]
+ cmp r1, r0
+ bge _08044FE4
+ adds r3, r0, 0
+ ldr r2, _08044FD8
+_08044FC8:
+ ldrh r0, [r2]
+ cmp r0, r4
+ bne _08044FDC
+ adds r0, r1, 0
+ b _08044FE8
+ .align 2, 0
+_08044FD4: .4byte gUnknown_202EE6C
+_08044FD8: .4byte gUnknown_202EE44
+_08044FDC:
+ adds r2, 0x4
+ adds r1, 0x1
+ cmp r1, r3
+ blt _08044FC8
+_08044FE4:
+ movs r0, 0x1
+ negs r0, r0
+_08044FE8:
+ pop {r4}
+ pop {r1}
+ bx r1
+ thumb_func_end sub_8044FB4
+
+ thumb_func_start sub_8044FF0
+sub_8044FF0:
+ push {r4,r5,lr}
+ lsls r0, 16
+ lsrs r3, r0, 16
+ movs r2, 0
+ ldr r1, _08045010
+ ldr r0, [r1]
+ cmp r2, r0
+ bge _08045022
+ movs r5, 0
+ adds r4, r1, 0
+ ldr r1, _08045014
+_08045006:
+ ldrh r0, [r1]
+ cmp r0, r3
+ bne _08045018
+ strb r5, [r1, 0x3]
+ b _08045022
+ .align 2, 0
+_08045010: .4byte gUnknown_202EE6C
+_08045014: .4byte gUnknown_202EE44
+_08045018:
+ adds r1, 0x4
+ adds r2, 0x1
+ ldr r0, [r4]
+ cmp r2, r0
+ blt _08045006
+_08045022:
+ pop {r4,r5}
+ pop {r0}
+ bx r0
+ thumb_func_end sub_8044FF0
+
+ thumb_func_start IsNotAttacking
+IsNotAttacking:
+ push {r4,lr}
+ adds r2, r0, 0
+ lsls r1, 24
+ ldr r0, [r2, 0x70]
+ adds r4, r0, 0
+ adds r4, 0x44
+ cmp r1, 0
+ beq _08045044
+ adds r0, r2, 0
+ bl sub_8045888
+ lsls r0, 24
+ cmp r0, 0
+ beq _0804505A
+_08045044:
+ ldrh r0, [r4]
+ cmp r0, 0
+ beq _0804505A
+ cmp r0, 0x2
+ beq _0804505A
+ cmp r0, 0x1
+ beq _0804505A
+ cmp r0, 0x5
+ beq _0804505A
+ movs r0, 0
+ b _0804505C
+_0804505A:
+ movs r0, 0x1
+_0804505C:
+ pop {r4}
+ pop {r1}
+ bx r1
+ thumb_func_end IsNotAttacking
+
+ thumb_func_start sub_8045064
+sub_8045064:
+ push {r4-r7,lr}
+ mov r7, r9
+ mov r6, r8
+ push {r6,r7}
+ movs r1, 0
+ ldr r0, _080450D4
+ mov r8, r0
+ ldr r0, [r0]
+ cmp r1, r0
+ bge _080450C8
+ mov r7, r8
+ ldr r2, _080450D8
+ mov r9, r2
+ ldr r0, _080450DC
+ mov r12, r0
+_08045082:
+ adds r4, r1, 0x1
+ ldr r0, [r7]
+ adds r5, r4, 0
+ cmp r5, r0
+ bge _080450BE
+ lsls r0, r1, 2
+ mov r1, r12
+ adds r3, r0, r1
+ mov r6, r9
+ lsls r0, r5, 2
+ adds r2, r0, r1
+_08045098:
+ ldrh r1, [r3]
+ lsls r1, 3
+ adds r1, r6
+ ldrh r0, [r2]
+ lsls r0, 3
+ adds r0, r6
+ ldr r1, [r1]
+ ldr r0, [r0]
+ cmp r1, r0
+ ble _080450B4
+ ldr r1, [r3]
+ ldr r0, [r2]
+ str r0, [r3]
+ str r1, [r2]
+_080450B4:
+ adds r2, 0x4
+ adds r4, 0x1
+ ldr r0, [r7]
+ cmp r4, r0
+ blt _08045098
+_080450BE:
+ adds r1, r5, 0
+ mov r2, r8
+ ldr r0, [r2]
+ cmp r1, r0
+ blt _08045082
+_080450C8:
+ pop {r3,r4}
+ mov r8, r3
+ mov r9, r4
+ pop {r4-r7}
+ pop {r0}
+ bx r0
+ .align 2, 0
+_080450D4: .4byte gUnknown_202EE6C
+_080450D8: .4byte gUnknown_80F7C54
+_080450DC: .4byte gUnknown_202EE44
+ thumb_func_end sub_8045064
diff --git a/asm/code_80739DC.s b/asm/code_8073AA0.s
index cfee489..c7c06de 100644
--- a/asm/code_80739DC.s
+++ b/asm/code_8073AA0.s
@@ -5,104 +5,6 @@
.text
- thumb_func_start FindStraightThrowableTargets
-FindStraightThrowableTargets:
- push {r4-r7,lr}
- mov r7, r10
- mov r6, r9
- mov r5, r8
- push {r5-r7}
- sub sp, 0x4
- adds r5, r0, 0
- mov r10, r1
- mov r9, r2
- lsls r3, 24
- lsrs r3, 24
- mov r8, r3
- ldr r1, _08073A44
- movs r0, 0
- str r0, [r1]
- ldr r1, _08073A48
- movs r2, 0
- adds r0, r1, 0x7
-_08073A00:
- strb r2, [r0]
- subs r0, 0x1
- cmp r0, r1
- bge _08073A00
- movs r7, 0
-_08073A0A:
- ldr r0, _08073A4C
- ldr r0, [r0]
- lsls r1, r7, 2
- ldr r2, _08073A50
- adds r0, r2
- adds r0, r1
- ldr r4, [r0]
- adds r0, r4, 0
- bl EntityExists
- lsls r0, 24
- cmp r0, 0
- beq _08073A88
- cmp r5, r4
- beq _08073A88
- mov r0, r10
- cmp r0, 0x1
- bne _08073A54
- adds r0, r5, 0
- adds r1, r4, 0
- movs r2, 0
- movs r3, 0
- bl CanTarget
- lsls r0, 24
- cmp r0, 0
- bne _08073A88
- movs r6, 0x3
- b _08073A6A
- .align 2, 0
-_08073A44: .4byte gNumPotentialTargets
-_08073A48: .4byte gTargetAhead
-_08073A4C: .4byte gDungeonGlobalData
-_08073A50: .4byte 0x000135cc
-_08073A54:
- adds r0, r5, 0
- adds r1, r4, 0
- movs r2, 0
- movs r3, 0x1
- bl CanTarget
- lsls r0, 24
- lsrs r0, 24
- cmp r0, 0x1
- bne _08073A88
- movs r6, 0x1
-_08073A6A:
- adds r0, r5, 0
- adds r1, r4, 0
- bl CanSee
- lsls r0, 24
- cmp r0, 0
- beq _08073A88
- mov r2, r8
- str r2, [sp]
- adds r0, r5, 0
- adds r1, r4, 0
- mov r2, r9
- adds r3, r6, 0
- bl TargetThrownItem
-_08073A88:
- adds r7, 0x1
- cmp r7, 0x13
- ble _08073A0A
- add sp, 0x4
- pop {r3-r5}
- mov r8, r3
- mov r9, r4
- mov r10, r5
- pop {r4-r7}
- pop {r0}
- bx r0
- thumb_func_end FindStraightThrowableTargets
-
thumb_func_start FindRockItemTargets
FindRockItemTargets:
push {r4-r7,lr}
diff --git a/include/dungeon_action.h b/include/dungeon_action.h
new file mode 100644
index 0000000..c3631f7
--- /dev/null
+++ b/include/dungeon_action.h
@@ -0,0 +1,9 @@
+#ifndef GUARD_DUNGEON_ACTION_H
+#define GUARD_DUNGEON_ACTION_H
+
+#include "dungeon_entity.h"
+
+// 0x44C94
+void SetAction(struct DungeonActionContainer *actionPointer, u16 action);
+
+#endif
diff --git a/include/dungeon_ai_items.h b/include/dungeon_ai_items.h
index e7d9f4f..b9e7625 100644
--- a/include/dungeon_ai_items.h
+++ b/include/dungeon_ai_items.h
@@ -5,5 +5,7 @@
// 0x73658
void DecideUseItem(struct DungeonEntity *pokemon);
+// 0x739DC
+void FindStraightThrowableTargets(struct DungeonEntity* pokemon, s32 thrownAIFlag, struct ItemSlot* item, bool8 ignoreRollChance);
#endif
diff --git a/include/dungeon_entity.h b/include/dungeon_entity.h
index 63c85d6..ef18c67 100644
--- a/include/dungeon_entity.h
+++ b/include/dungeon_entity.h
@@ -4,6 +4,20 @@
#include "item.h"
#include "constants/move.h"
+struct DungeonActionContainer
+{
+ /* 0x0 */ u16 action;
+ /* 0x2 */ s8 facingDir;
+ u8 fill3;
+ // Additional parameter alongside actionIndex. Used for things like indicating which move a Pokémon should use from its moveset.
+ /* 0x4 */ u8 actionUseIndex;
+ u8 fill5[0x8 - 0x5];
+ // Position of the Pokémon the last time it threw an item.
+ /* 0x8 */ s16 lastItemThrowPositionX;
+ /* 0xA */ s16 lastItemThrowPositionY;
+ u8 unkC;
+};
+
struct DungeonEntityData
{
// This has different purposes for Pokémon, items, and traps.
@@ -51,16 +65,8 @@ struct DungeonEntityData
u8 fill3F;
/* 0x40 */ u8 joinLocation; // Uses the dungeon index in dungeon.h.
u8 fill41[0x44 - 0x41];
- /* 0x44 */ u16 action;
- /* 0x46 */ s8 facingDir;
- u8 fill47;
- // Additional parameter alongside actionIndex. Used for things like indiciating which move a Pokémon should use from its moveset.
- /* 0x48 */ u8 actionUseIndex;
- u8 fill49[0x4C - 0x49];
- // Position of the Pokémon the last time it threw an item.
- /* 0x4C */ s16 lastItemThrowPositionX;
- /* 0x4E */ s16 lastItemThrowPositionY;
- u8 fill50[0x58 - 0x50];
+ /* 0x44 */ struct DungeonActionContainer action;
+ u8 fill55[0x58 - 0x55];
// Position of the target that the Pokémon wants throw an item at.
/* 0x58 */ s16 *itemTargetPosition;
/* 0x5C */ u8 type1;
diff --git a/include/dungeon_pokemon_attributes_1.h b/include/dungeon_pokemon_attributes_1.h
index 51788d2..0c8037b 100644
--- a/include/dungeon_pokemon_attributes_1.h
+++ b/include/dungeon_pokemon_attributes_1.h
@@ -5,5 +5,7 @@
// 0x718AC
bool8 HasTactic(struct DungeonEntity *pokemon, u8 tactic);
+// 0x718D8
+bool8 HasIQSkill(struct DungeonEntity* pokemon, u8 IQSkill);
#endif
diff --git a/include/dungeon_util.h b/include/dungeon_util.h
index f3059b0..ca62184 100644
--- a/include/dungeon_util.h
+++ b/include/dungeon_util.h
@@ -5,5 +5,12 @@
// 0x450E0
bool8 EntityExists(struct DungeonEntity *pokemon);
+// 0x450F8
+u32 GetEntityType(struct DungeonEntity *entity);
+// 0x45104
+struct DungeonEntityData *GetTrapData(struct DungeonEntity *entity);
+// 0x45108
+struct ItemSlot *GetItemData(struct DungeonEntity *entity);
+struct MapTile *sub_8045128(struct DungeonEntity *entity);
#endif
diff --git a/include/map.h b/include/map.h
index a0a5660..38fe68a 100644
--- a/include/map.h
+++ b/include/map.h
@@ -5,21 +5,11 @@
#define MAX_ROOM_COUNT 24 // Empirical max, not sure if the code supports any more.
-
-struct MapTileBitFlagStair
-{
- /* 0x0 */ u8 tileFlags;
- /* 0x1 */ bool8 stairs;
-};
-
struct MapTile
{
- // TODO: can we get rid of the union... is tileFlags a u16 only?
- union MapTileUnion
- {
- struct MapTileBitFlagStair unk0;
- u16 tileFlags_u16;
- } MapTileUnion;
+ // Uses the TileType bit flags.
+ /* 0x0 */ u16 tileType;
+ u8 fill2[0x4 - 0x2];
u16 unk4;
u16 unk6;
u8 unk8;
@@ -52,9 +42,10 @@ struct RoomExit
s16 y;
};
-enum TileFlag
+enum TileType
{
TILE_TYPE_FLOOR = 1 << 0,
+ TILE_TYPE_UNK_1 = 1 << 1,
TILE_TYPE_LIQUID = 1 << 2, // Water or lava depending on the dungeon.
TILE_TYPE_ROOM_EXIT = 1 << 3,
TILE_TYPE_MAP_EDGE = 1 << 4,
diff --git a/ld_script.txt b/ld_script.txt
index b913da1..8d0cb11 100755
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -186,6 +186,8 @@ SECTIONS {
asm/code_8041AD0.o(.text);
src/code_80428A0.o(.text);
asm/code_80428A0.o(.text);
+ src/dungeon_action.o(.text);
+ asm/code_804ACA0.o(.text);
src/dungeon_util.o(.text);
asm/code_80450F8.o(.text);
src/code_8048480.o(.text);
@@ -210,7 +212,7 @@ SECTIONS {
src/dungeon_pokemon_attributes_1.o(.text);
asm/code_80718D8.o(.text);
src/dungeon_ai_items.o(.text);
- asm/code_80739DC.o(.text);
+ asm/code_8073AA0.o(.text);
src/dungeon_movement.o(.text);
asm/code_8075BA4.o(.text);
src/code_80848F0.o(.text);
diff --git a/src/code_80521D0_1.c b/src/code_80521D0_1.c
index 0ed02f1..433194d 100644
--- a/src/code_80521D0_1.c
+++ b/src/code_80521D0_1.c
@@ -209,9 +209,9 @@ void sub_808BCE4(void)
struct MapTile *puVar1;
puVar1 = GetMapEntity(gDungeonGlobalData->unkE23C, gDungeonGlobalData->unkE23E);
- puVar1->MapTileUnion.tileFlags_u16 &= 0xfffc;
- puVar1->MapTileUnion.tileFlags_u16 |= TILE_TYPE_MAP_EDGE;
- puVar1->MapTileUnion.tileFlags_u16 &= 0xfdff;
+ puVar1->tileType &= ~(TILE_TYPE_FLOOR | TILE_TYPE_UNK_1);
+ puVar1->tileType |= TILE_TYPE_MAP_EDGE;
+ puVar1->tileType &= ~TILE_TYPE_STAIRS;
sub_8049884();
sub_8049B8C();
sub_8049ED4();
@@ -223,10 +223,10 @@ void sub_808BD38(void)
struct MapTile *puVar1;
puVar1 = GetMapEntity(gDungeonGlobalData->unkE23C, gDungeonGlobalData->unkE23E);
- puVar1->MapTileUnion.tileFlags_u16 &= 0xfffc;
- puVar1->MapTileUnion.tileFlags_u16 |= TILE_TYPE_FLOOR;
- puVar1->MapTileUnion.tileFlags_u16 &= 0xffef;
- puVar1->MapTileUnion.tileFlags_u16 |= TILE_TYPE_STAIRS;
+ puVar1->tileType &= ~(TILE_TYPE_FLOOR | TILE_TYPE_UNK_1);
+ puVar1->tileType |= TILE_TYPE_FLOOR;
+ puVar1->tileType &= ~TILE_TYPE_MAP_EDGE;
+ puVar1->tileType |= TILE_TYPE_STAIRS;
puVar1->unk8 = 1;
sub_8049884();
sub_8049B8C();
@@ -1114,7 +1114,7 @@ void sub_808C998(void)
void sub_808C9B0(struct DungeonEntity *param_1)
{
- param_1->entityData->facingDir = DIRECTION_NORTH;
+ param_1->entityData->action.facingDir = DIRECTION_NORTH;
sub_806CE68(param_1, DIRECTION_NORTH);
}
diff --git a/src/code_8057824_1.c b/src/code_8057824_1.c
index f79299a..5409061 100644
--- a/src/code_8057824_1.c
+++ b/src/code_8057824_1.c
@@ -3364,7 +3364,7 @@ void sub_808B1CC(u8 r0)
void SetupRegiFacingDirection(struct DungeonEntity *r0)
{
- r0->entityData->facingDir = DIRECTION_NORTH;
+ r0->entityData->action.facingDir = DIRECTION_NORTH;
sub_806CE68(r0, DIRECTION_NORTH);
}
diff --git a/src/code_806CD90.c b/src/code_806CD90.c
index 30ca41d..e11f253 100644
--- a/src/code_806CD90.c
+++ b/src/code_806CD90.c
@@ -1,14 +1,13 @@
#include "global.h"
-#include "dungeon_global_data.h"
-#include "dungeon_entity.h"
#include "constants/direction.h"
+#include "dungeon_entity.h"
+#include "dungeon_global_data.h"
+#include "dungeon_util.h"
extern struct DungeonGlobalData *gDungeonGlobalData;
extern u8 sub_806CEBC(struct DungeonEntity *);
-extern bool8 EntityExists(struct DungeonEntity *);
extern void sub_806CCB4(struct DungeonEntity *, u8);
-extern u32 GetEntityType(struct DungeonEntity *);
void sub_806CD90(void)
{
@@ -57,7 +56,7 @@ void sub_806CE34(struct DungeonEntity *r0, u32 newDir)
r0->unk6A = sub_806CEBC(r0);
if(newDir < NUM_DIRECTIONS)
{
- r0->entityData->facingDir = newDir & DIRECTION_MASK;
+ r0->entityData->action.facingDir = newDir & DIRECTION_MASK;
r0->facingDir = newDir & DIRECTION_MASK;
}
}
diff --git a/src/code_80869E4.c b/src/code_80869E4.c
index d7ebaf5..30bae49 100644
--- a/src/code_80869E4.c
+++ b/src/code_80869E4.c
@@ -479,7 +479,7 @@ void SpriteLookAroundEffect(struct DungeonEntity *r0)
s8 r4;
s8 r3;
- r4 = sub_8002984(r0->entityData->facingDir, 4);
+ r4 = sub_8002984(r0->entityData->action.facingDir, 4);
sub_80869E4(r0, 4, 2, r4);
diff --git a/src/dungeon_action.c b/src/dungeon_action.c
new file mode 100644
index 0000000..6d8fcb3
--- /dev/null
+++ b/src/dungeon_action.c
@@ -0,0 +1,10 @@
+#include "global.h"
+#include "dungeon_action.h"
+#include "dungeon_entity.h"
+
+void SetAction(struct DungeonActionContainer *actionPointer, u16 action)
+{
+ actionPointer->action = action;
+ actionPointer->actionUseIndex = 0;
+ actionPointer->unkC = 0;
+}
diff --git a/src/dungeon_ai_items.c b/src/dungeon_ai_items.c
index 7a348f1..48b675a 100644
--- a/src/dungeon_ai_items.c
+++ b/src/dungeon_ai_items.c
@@ -1,40 +1,53 @@
#include "global.h"
-#include "dungeon_ai_items.h"
#include "constants/direction.h"
#include "constants/dungeon_action.h"
#include "constants/iq_skill.h"
+#include "dungeon_action.h"
+#include "dungeon_ai_items.h"
#include "dungeon_capabilities.h"
#include "dungeon_capabilities_1.h"
+#include "dungeon_entity.h"
#include "dungeon_global_data.h"
+#include "dungeon_pokemon_attributes_1.h"
+#include "dungeon_util.h"
#include "item.h"
#include "team_inventory.h"
#define NUM_POTENTIAL_ROCK_TARGETS 20
#define GROUND_ITEM_TOOLBOX_INDEX 0x80
#define HELD_ITEM_TOOLBOX_INDEX 0x81
-#define ITEM_TARGET_ALLY 1 << 1
-extern void SetAction(u16*, u16);
-extern void FindStraightThrowableTargets(struct DungeonEntity*, s32 thrownAIFlag, struct ItemSlot*, bool8 ignoreRollChance);
+enum ItemTargetFlag
+{
+ ITEM_TARGET_OTHER = 1 << 0,
+ ITEM_TARGET_ALLY = 1 << 1
+};
+
+enum TargetCapability
+{
+ TARGET_CAPABILITY_CANNOT_ATTACK,
+ TARGET_CAPABILITY_CAN_TARGET,
+ TARGET_CAPABILITY_CAN_ATTACK_NOT_TARGET
+};
+
extern bool8 RollPercentChance(u32);
-extern void FindRockItemTargets(struct DungeonEntity*, struct ItemSlot*, s16*[], bool8 ignoreRollChance);
+extern void FindRockItemTargets(struct DungeonEntity*, struct ItemSlot*, s16*[], bool8);
extern s32 DungeonRandomCapped(s32);
extern s32 CalculateFacingDir(s16*, s16*);
-extern bool8 HasIQSkill(struct DungeonEntity*, u8);
extern struct MapTile* GetMapTileAtPosition(s16, s16);
-extern u32 GetEntityType(struct DungeonEntity*);
-extern struct ItemSlot* GetItemData(struct DungeonEntity*);
extern u32 EvaluateItem(struct DungeonEntity*, struct ItemSlot*, u8);
extern bool8 ToolboxEnabled(struct DungeonEntityData*);
extern void sub_8077274(struct DungeonEntity *, struct DungeonEntity *);
-extern bool8 EntityExists(struct DungeonEntity *);
+extern bool8 CanTarget(struct DungeonEntity*, struct DungeonEntity*, bool8, bool8);
+extern bool8 CanSee(struct DungeonEntity*, struct DungeonEntity*);
+extern void TargetThrownItem(struct DungeonEntity*, struct DungeonEntity*, struct ItemSlot*, u8, bool8);
extern s32 gNumPotentialTargets;
extern u32 gPotentialTargetWeights[NUM_DIRECTIONS];
extern u32 gPotentialTargetDirections[NUM_DIRECTIONS];
+extern bool8 gTargetAhead[NUM_DIRECTIONS];
extern struct TeamInventory *gTeamInventory_203B460;
-
extern struct DungeonGlobalData *gDungeonGlobalData;
void sub_807360C(struct DungeonEntity *pokemon)
@@ -49,7 +62,7 @@ void sub_807360C(struct DungeonEntity *pokemon)
{
if(entity->entityData->unk152 != 0)
{
- entity->entityData->unk152 = 0;
+ entity->entityData->unk152 = 0;
sub_8077274(entity, entity);
}
}
@@ -91,10 +104,10 @@ void DecideUseItem(struct DungeonEntity *pokemon)
if (RollPercentChance(gPotentialTargetWeights[targetIndex]))
{
SetAction(&pokemonData->action, DUNGEON_ACTION_THROW_ITEM_AI);
- pokemonData->actionUseIndex = selectedToolboxIndex;
- pokemonData->lastItemThrowPositionX = pokemon->posWorldX;
- pokemonData->lastItemThrowPositionY = pokemon->posWorldY;
- pokemonData->facingDir = gPotentialTargetDirections[targetIndex] & DIRECTION_MASK;
+ pokemonData->action.actionUseIndex = selectedToolboxIndex;
+ pokemonData->action.lastItemThrowPositionX = pokemon->posWorldX;
+ pokemonData->action.lastItemThrowPositionY = pokemon->posWorldY;
+ pokemonData->action.facingDir = gPotentialTargetDirections[targetIndex] & DIRECTION_MASK;
break;
}
}
@@ -115,10 +128,10 @@ void DecideUseItem(struct DungeonEntity *pokemon)
{
u32 chosenTargetIndex = DungeonRandomCapped(gNumPotentialTargets);
SetAction(&pokemonData->action, DUNGEON_ACTION_THROW_ITEM_AI);
- pokemonData->actionUseIndex = selectedToolboxIndex;
- pokemonData->lastItemThrowPositionX = pokemon->posWorldX;
- pokemonData->lastItemThrowPositionY = pokemon->posWorldY;
- pokemonData->facingDir = CalculateFacingDir(&pokemon->posWorldX, (s16 *) (&potentialTargetPositions[chosenTargetIndex])) & DIRECTION_MASK;
+ pokemonData->action.actionUseIndex = selectedToolboxIndex;
+ pokemonData->action.lastItemThrowPositionX = pokemon->posWorldX;
+ pokemonData->action.lastItemThrowPositionY = pokemon->posWorldY;
+ pokemonData->action.facingDir = CalculateFacingDir(&pokemon->posWorldX, (s16 *) (&potentialTargetPositions[chosenTargetIndex])) & DIRECTION_MASK;
pokemonData->itemTargetPosition = potentialTargetPositions[chosenTargetIndex];
}
}
@@ -128,9 +141,9 @@ void DecideUseItem(struct DungeonEntity *pokemon)
if (itemTypeCompare < ITEM_TYPE_HOLD_ITEM - 2)
{
SetAction(&pokemonData->action, DUNGEON_ACTION_CONSUME_ITEM_AI);
- pokemonData->actionUseIndex = selectedToolboxIndex;
- pokemonData->lastItemThrowPositionX = pokemon->posWorldX;
- pokemonData->lastItemThrowPositionY = pokemon->posWorldY;
+ pokemonData->action.actionUseIndex = selectedToolboxIndex;
+ pokemonData->action.lastItemThrowPositionX = pokemon->posWorldX;
+ pokemonData->action.lastItemThrowPositionY = pokemon->posWorldY;
}
else
{
@@ -200,9 +213,9 @@ void DecideUseItem(struct DungeonEntity *pokemon)
{
SetAction(&pokemonData->action, DUNGEON_ACTION_CONSUME_ITEM_AI);
}
- pokemonData->actionUseIndex = selectedToolboxIndex;
- pokemonData->lastItemThrowPositionX = pokemon->posWorldX;
- pokemonData->lastItemThrowPositionY = pokemon->posWorldY;
+ pokemonData->action.actionUseIndex = selectedToolboxIndex;
+ pokemonData->action.lastItemThrowPositionX = pokemon->posWorldX;
+ pokemonData->action.lastItemThrowPositionY = pokemon->posWorldY;
return;
}
}
@@ -234,10 +247,10 @@ void DecideUseItem(struct DungeonEntity *pokemon)
{
u32 chosenTargetIndex = DungeonRandomCapped(gNumPotentialTargets);
SetAction(&pokemonData->action, DUNGEON_ACTION_THROW_ITEM_AI);
- pokemonData->actionUseIndex = selectedToolboxIndex;
- pokemonData->lastItemThrowPositionX = pokemon->posWorldX;
- pokemonData->lastItemThrowPositionY = pokemon->posWorldY;
- pokemonData->facingDir = CalculateFacingDir(&pokemon->posWorldX, (s16 *) (&potentialTargetPositions[chosenTargetIndex])) & DIRECTION_MASK;
+ pokemonData->action.actionUseIndex = selectedToolboxIndex;
+ pokemonData->action.lastItemThrowPositionX = pokemon->posWorldX;
+ pokemonData->action.lastItemThrowPositionY = pokemon->posWorldY;
+ pokemonData->action.facingDir = CalculateFacingDir(&pokemon->posWorldX, (s16 *) (&potentialTargetPositions[chosenTargetIndex])) & DIRECTION_MASK;
pokemonData->itemTargetPosition = potentialTargetPositions[chosenTargetIndex];
return;
}
@@ -251,10 +264,10 @@ void DecideUseItem(struct DungeonEntity *pokemon)
if (RollPercentChance(potentialTargetWeights[targetIndex]))
{
SetAction(&pokemonData->action, DUNGEON_ACTION_THROW_ITEM_AI);
- pokemonData->actionUseIndex = selectedToolboxIndex;
- pokemonData->lastItemThrowPositionX = pokemon->posWorldX;
- pokemonData->lastItemThrowPositionY = pokemon->posWorldY;
- pokemonData->facingDir = gPotentialTargetDirections[targetIndex] & DIRECTION_MASK;
+ pokemonData->action.actionUseIndex = selectedToolboxIndex;
+ pokemonData->action.lastItemThrowPositionX = pokemon->posWorldX;
+ pokemonData->action.lastItemThrowPositionY = pokemon->posWorldY;
+ pokemonData->action.facingDir = gPotentialTargetDirections[targetIndex] & DIRECTION_MASK;
return;
}
}
@@ -265,3 +278,44 @@ void DecideUseItem(struct DungeonEntity *pokemon)
}
}
}
+
+void FindStraightThrowableTargets(struct DungeonEntity* pokemon, s32 thrownAIFlag, struct ItemSlot* item, bool8 ignoreRollChance)
+{
+ s32 i;
+ gNumPotentialTargets = 0;
+ for (i = 0; i < NUM_DIRECTIONS; i++)
+ {
+ gTargetAhead[i] = FALSE;
+ }
+ for (i = 0; i < DUNGEON_MAX_POKEMON; i++)
+ {
+ struct DungeonEntity* targetPokemon = gDungeonGlobalData->allPokemon[i];
+ if (EntityExists(targetPokemon) && pokemon != targetPokemon)
+ {
+ u8 targetingFlags;
+ if (thrownAIFlag == ITEM_AI_FLAG_TARGET_ALLY)
+ {
+ if (CanTarget(pokemon, targetPokemon, FALSE, FALSE) == TARGET_CAPABILITY_CANNOT_ATTACK)
+ {
+ targetingFlags = ITEM_TARGET_OTHER | ITEM_TARGET_ALLY;
+ }
+ else
+ {
+ continue;
+ }
+ }
+ else if (CanTarget(pokemon, targetPokemon, FALSE, TRUE) == TARGET_CAPABILITY_CAN_TARGET)
+ {
+ targetingFlags = ITEM_TARGET_OTHER;
+ }
+ else
+ {
+ continue;
+ }
+ if (CanSee(pokemon, targetPokemon))
+ {
+ TargetThrownItem(pokemon, targetPokemon, item, targetingFlags, ignoreRollChance);
+ }
+ }
+ }
+}
diff --git a/src/dungeon_capabilities_1.c b/src/dungeon_capabilities_1.c
index 869e2f3..721bdcb 100644
--- a/src/dungeon_capabilities_1.c
+++ b/src/dungeon_capabilities_1.c
@@ -55,24 +55,22 @@ bool8 CannotAct(struct DungeonEntity *pokemon)
return FALSE;
}
-bool8 CannotAttack(struct DungeonEntity *pokemon, u8 param_2)
+bool8 CannotAttack(struct DungeonEntity *pokemon, bool8 skipSleep)
{
- struct DungeonEntityData *iVar3;
-
- iVar3 = pokemon->entityData;
- if ((((((param_2 != '\0') ||
- (iVar3->sleepStatus == SLEEP_STATUS_SLEEPLESS)) ||
- (iVar3->sleepStatus == SLEEP_STATUS_YAWNING)) ||
- (iVar3->sleepStatus == SLEEP_STATUS_NONE)) &&
- ((((iVar3->immobilizeStatus != IMMOBILIZE_STATUS_FROZEN &&
- (iVar3->immobilizeStatus != IMMOBILIZE_STATUS_WRAPPED_AROUND_FOE)) &&
- ((iVar3->immobilizeStatus != IMMOBILIZE_STATUS_WRAPPED_BY_FOE &&
- ((iVar3->immobilizeStatus != IMMOBILIZE_STATUS_PETRIFIED &&
- (iVar3->volatileStatus != VOLATILE_STATUS_CRINGING)))))) &&
- (iVar3->volatileStatus != VOLATILE_STATUS_PAUSED)))) &&
- (((iVar3->volatileStatus != VOLATILE_STATUS_INFATUATED &&
- iVar3->nonVolatileStatus != NON_VOLATILE_STATUS_PARALYZED)) &&
- !ShouldAvoidEnemies(pokemon))) {
+ struct DungeonEntityData *pokemonData = pokemon->entityData;
+ if ((skipSleep ||
+ pokemonData->sleepStatus == SLEEP_STATUS_SLEEPLESS ||
+ pokemonData->sleepStatus == SLEEP_STATUS_YAWNING ||
+ pokemonData->sleepStatus == SLEEP_STATUS_NONE) &&
+ pokemonData->immobilizeStatus != IMMOBILIZE_STATUS_FROZEN &&
+ pokemonData->immobilizeStatus != IMMOBILIZE_STATUS_WRAPPED_AROUND_FOE &&
+ pokemonData->immobilizeStatus != IMMOBILIZE_STATUS_WRAPPED_BY_FOE &&
+ pokemonData->immobilizeStatus != IMMOBILIZE_STATUS_PETRIFIED &&
+ pokemonData->volatileStatus != VOLATILE_STATUS_CRINGING &&
+ pokemonData->volatileStatus != VOLATILE_STATUS_PAUSED &&
+ pokemonData->volatileStatus != VOLATILE_STATUS_INFATUATED &&
+ pokemonData->nonVolatileStatus != NON_VOLATILE_STATUS_PARALYZED &&
+ !ShouldAvoidEnemies(pokemon)) {
return FALSE;
}
return TRUE;
diff --git a/src/dungeon_movement.c b/src/dungeon_movement.c
index 5525f28..6bb225e 100644
--- a/src/dungeon_movement.c
+++ b/src/dungeon_movement.c
@@ -5,9 +5,14 @@
#include "constants/direction.h"
#include "constants/iq_skill.h"
#include "constants/status.h"
-#include "dungeon_global_data.h"
+#include "dungeon_ai_items.h"
#include "dungeon_capabilities_1.h"
+#include "dungeon_global_data.h"
+#include "dungeon_pokemon_attributes_1.h"
+#include "dungeon_util.h"
+#include "dungeon_util_1.h"
#include "map.h"
+#include "pokemon.h"
extern char gAvailablePokemonNames[];
extern char *gPtrCouldntBeUsedMessage;
@@ -15,30 +20,21 @@ extern char *gPtrItsaMonsterHouseMessage;
extern struct DungeonGlobalData *gDungeonGlobalData;
extern void SendImmobilizeEndMessage(struct DungeonEntity*, struct DungeonEntity*);
-extern bool8 IsMovingClient(struct DungeonEntity*);
extern void SetMessageArgument(char[], struct DungeonEntity*, u32);
extern void SendMessage(struct DungeonEntity*, char*);
-extern void DecideUseItem(struct DungeonEntity*);
extern bool8 HasStatusAffectingActions(struct DungeonEntity*);
-extern bool8 EntityExists(struct DungeonEntity*);
extern bool8 CanSee(struct DungeonEntity*, struct DungeonEntity*);
extern void ResetAction(u16*);
extern void SetWalkAction(u16*, s16);
extern s32 DungeonRandomCapped(s32);
-extern bool8 HasIQSkill(struct DungeonEntity*, u8);
extern void DecideAttack(struct DungeonEntity*);
-extern bool8 GetIsMoving(s16);
extern void MoveIfPossible(struct DungeonEntity*, bool8);
extern u8 sub_8044B28(void);
-struct MapTile *sub_8045128(struct DungeonEntity *entity);
extern void sub_807AB38(struct DungeonEntity *, u32);
extern void sub_8041888(u32);
extern u8 sub_803F428(s16 *);
extern void sub_803E708(u32, u32);
extern struct DungeonEntity *GetLeaderEntity();
-struct ItemSlot *GetItemData(struct DungeonEntity *entity);
-u8 *GetTrapData(struct DungeonEntity *entity);
-u32 GetEntityType(struct DungeonEntity *entity);
extern void TargetTileInFront(struct DungeonEntity *);
u32 sub_8075818(struct DungeonEntity *entity)
@@ -55,7 +51,7 @@ u32 sub_8075818(struct DungeonEntity *entity)
{
tile = sub_8045128(entity);
if(HasIQSkill(entity, IQ_SKILL_SUPER_MOBILE))
- if(!(tile->MapTileUnion.tileFlags_u16 & 3))
+ if(!(tile->tileType & (TILE_TYPE_FLOOR | TILE_TYPE_UNK_1)))
return 1;
subEntity = tile->mapObject;
if(subEntity != NULL)
@@ -68,7 +64,7 @@ u32 sub_8075818(struct DungeonEntity *entity)
case 5:
break;
case ENTITY_TRAP:
- trapData = GetTrapData(subEntity);
+ trapData = (u8*) GetTrapData(subEntity);
r1 = 0;
if(trapData[1] == 0)
{
@@ -99,7 +95,7 @@ flag_check:
{
if(!(entityData->heldItem.itemFlags & ITEM_FLAG_EXISTS))
{
- if(!(tile->MapTileUnion.tileFlags_u16 & 3))
+ if(!(tile->tileType & (TILE_TYPE_FLOOR | TILE_TYPE_UNK_1)))
{
if(entityData->isEnemy)
break;
@@ -140,7 +136,7 @@ void sub_8075900(struct DungeonEntity *pokemon, u8 r1)
{
if(!gDungeonGlobalData->monsterHouseActive)
{
- if((sub_8045128(pokemon)->MapTileUnion.tileFlags_u16 & TILE_TYPE_MONSTER_HOUSE))
+ if((sub_8045128(pokemon)->tileType & TILE_TYPE_MONSTER_HOUSE))
{
// It's a monster house!
SendMessage(GetLeaderEntity(), gPtrItsaMonsterHouseMessage);
@@ -163,7 +159,7 @@ void DecideAction(struct DungeonEntity *pokemon)
{
if (pokemonData->immobilizeStatus == IMMOBILIZE_STATUS_PETRIFIED)
{
- SendImmobilizeEndMessage(pokemon, pokemon);
+ SendImmobilizeEndMessage(pokemon, pokemon);
}
}
else
@@ -181,7 +177,7 @@ void DecideAction(struct DungeonEntity *pokemon)
return;
}
DecideUseItem(pokemon);
- if (pokemonData->action != DUNGEON_ACTION_NONE)
+ if (pokemonData->action.action != DUNGEON_ACTION_NONE)
{
return;
}
@@ -210,29 +206,29 @@ void DecideAction(struct DungeonEntity *pokemon)
}
}
}
- ResetAction(&pokemonData->action);
+ ResetAction(&pokemonData->action.action);
if (pokemonData->clientType == CLIENT_TYPE_CLIENT)
{
- SetWalkAction(&pokemonData->action, pokemonData->entityID);
- pokemonData->facingDir = DungeonRandomCapped(8);
+ SetWalkAction(&pokemonData->action.action, pokemonData->entityID);
+ pokemonData->action.facingDir = DungeonRandomCapped(8);
pokemonData->targetPositionX = pokemon->posWorldX;
pokemonData->targetPositionY = pokemon->posWorldY - 1;
}
else
{
DecideUseItem(pokemon);
- if (pokemonData->action == DUNGEON_ACTION_NONE)
+ if (pokemonData->action.action == DUNGEON_ACTION_NONE)
{
if (!HasIQSkill(pokemon, IQ_SKILL_DEDICATED_TRAVELER))
{
DecideAttack(pokemon);
- if (pokemonData->action != DUNGEON_ACTION_NONE)
+ if (pokemonData->action.action != DUNGEON_ACTION_NONE)
{
return;
}
if (pokemonData->volatileStatus == VOLATILE_STATUS_CONFUSED)
{
- SetWalkAction(&pokemonData->action, pokemonData->entityID);
+ SetWalkAction(&pokemonData->action.action, pokemonData->entityID);
}
else
{
@@ -247,7 +243,7 @@ void DecideAction(struct DungeonEntity *pokemon)
{
if (pokemonData->volatileStatus == VOLATILE_STATUS_CONFUSED)
{
- SetWalkAction(&pokemonData->action, pokemonData->entityID);
+ SetWalkAction(&pokemonData->action.action, pokemonData->entityID);
}
else
{
@@ -255,12 +251,12 @@ void DecideAction(struct DungeonEntity *pokemon)
{
MoveIfPossible(pokemon, TRUE);
}
- if (pokemonData->action > DUNGEON_ACTION_WAIT)
+ if (pokemonData->action.action > DUNGEON_ACTION_WAIT)
{
return;
}
DecideAttack(pokemon);
- if (pokemonData->action <= DUNGEON_ACTION_WAIT)
+ if (pokemonData->action.action <= DUNGEON_ACTION_WAIT)
{
return;
}
@@ -281,11 +277,11 @@ void sub_8075BA4(struct DungeonEntity *param_1,char param_2)
struct DungeonEntityData * iVar2 = param_1->entityData;
if ((param_2 != '\0') && (iVar2->volatileStatus == VOLATILE_STATUS_COWERING)) {
- iVar2->facingDir = (iVar2->facingDir + 4) & DIRECTION_MASK;
+ iVar2->action.facingDir = (iVar2->action.facingDir + 4) & DIRECTION_MASK;
TargetTileInFront(param_1);
}
else if (iVar2->volatileStatus == VOLATILE_STATUS_CONFUSED) {
- iVar2->facingDir = DungeonRandomCapped(NUM_DIRECTIONS);
+ iVar2->action.facingDir = DungeonRandomCapped(NUM_DIRECTIONS);
TargetTileInFront(param_1);
}
}
diff --git a/src/dungeon_util.c b/src/dungeon_util.c
index f717212..5943d4b 100644
--- a/src/dungeon_util.c
+++ b/src/dungeon_util.c
@@ -2,7 +2,7 @@
#include "dungeon_util.h"
extern struct MapTile* GetMapTileAtPosition(s16, s16);
-extern struct MapTile *GetMapEntity(s16, s16);
+extern struct MapTile* GetMapEntity(s16, s16);
bool8 EntityExists(struct DungeonEntity *entity)
{
diff --git a/src/dungeon_util_1.c b/src/dungeon_util_1.c
index 51ec765..32cc3ff 100644
--- a/src/dungeon_util_1.c
+++ b/src/dungeon_util_1.c
@@ -1,11 +1,12 @@
#include "global.h"
-#include "constants/direction.h"
#include "dungeon_util_1.h"
+
+#include "constants/direction.h"
#include "dungeon_global_data.h"
+#include "dungeon_util.h"
#include "random.h"
extern struct DungeonGlobalData *gDungeonGlobalData;
-extern bool8 EntityExists(struct DungeonEntity *);
extern void sub_806CE68(struct DungeonEntity *, s32);
extern s32 sub_803F994(void);
@@ -16,7 +17,7 @@ extern void sub_803E46C(u32);
void sub_8085860(s32 x, s32 y)
{
-
+
sub_803F4A0(0);
sub_803F878(x * 0x1800 + 0xc00, y * 0x1800 + 0x1000);
}
@@ -33,7 +34,7 @@ void sub_80858AC(s32 *param_1, s32 param_2)
s32 iVar2;
s32 iVar3;
s32 iVar4;
-
+
iVar1 = sub_803F994();
iVar2 = sub_803F9B0();
iVar3 = (param_1[0] - iVar1) / param_2;
@@ -54,7 +55,7 @@ void sub_80858AC(s32 *param_1, s32 param_2)
void SetFacingDirection(struct DungeonEntity *pokemon, s32 direction)
{
- pokemon->entityData->facingDir = direction & DIRECTION_MASK;
+ pokemon->entityData->action.facingDir = direction & DIRECTION_MASK;
sub_806CE68(pokemon, direction);
}
@@ -73,7 +74,7 @@ void sub_8085930(s32 direction)
}
else
{
- entity->entityData->facingDir = direction & DIRECTION_MASK;
+ entity->entityData->action.facingDir = direction & DIRECTION_MASK;
sub_806CE68(entity, direction);
}
}
@@ -91,7 +92,7 @@ void sub_8085930(s32 direction)
}
else
{
- entity->entityData->facingDir = direction & DIRECTION_MASK;
+ entity->entityData->action.facingDir = direction & DIRECTION_MASK;
sub_806CE68(entity, direction);
}
}
@@ -114,7 +115,7 @@ void sub_80859F0(s32 direction)
}
else
{
- entity->entityData->facingDir = direction & DIRECTION_MASK;
+ entity->entityData->action.facingDir = direction & DIRECTION_MASK;
sub_806CE68(entity, direction);
}
}