mirror of
https://github.com/pret/pmd-red.git
synced 2026-09-08 09:05:59 -05:00
Merge pull request #111 from AnonymousRandomPerson/master
Movement AI decomp
This commit is contained in:
@@ -160,522 +160,4 @@ _08070458:
|
||||
bx r1
|
||||
thumb_func_end sub_80703A0
|
||||
|
||||
thumb_func_start CanCrossWalls
|
||||
CanCrossWalls:
|
||||
push {r4,lr}
|
||||
adds r1, r0, 0
|
||||
ldr r0, [r1, 0x70]
|
||||
adds r4, r0, 0
|
||||
adds r0, 0xE4
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x3
|
||||
beq _08070492
|
||||
adds r0, r1, 0
|
||||
movs r1, 0x9
|
||||
bl HasItem
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08070492
|
||||
movs r1, 0x2
|
||||
ldrsh r0, [r4, r1]
|
||||
bl GetCrossableTerrain
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x3
|
||||
beq _08070492
|
||||
movs r0, 0
|
||||
b _08070494
|
||||
_08070492:
|
||||
movs r0, 0x1
|
||||
_08070494:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end CanCrossWalls
|
||||
|
||||
thumb_func_start sub_807049C
|
||||
sub_807049C:
|
||||
push {r4-r7,lr}
|
||||
adds r6, r0, 0
|
||||
adds r4, r1, 0
|
||||
ldr r7, [r6, 0x70]
|
||||
movs r1, 0
|
||||
ldrsh r0, [r4, r1]
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r4, r2]
|
||||
bl GetMapTile_1
|
||||
adds r5, r0, 0
|
||||
movs r1, 0
|
||||
ldrsh r0, [r4, r1]
|
||||
cmp r0, 0
|
||||
blt _0807055A
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r4, r2]
|
||||
cmp r1, 0
|
||||
blt _0807055A
|
||||
cmp r0, 0x37
|
||||
bgt _0807055A
|
||||
cmp r1, 0x1F
|
||||
bgt _0807055A
|
||||
ldrh r1, [r5]
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0807055A
|
||||
ldr r0, [r5, 0x10]
|
||||
cmp r0, 0
|
||||
beq _080704E2
|
||||
bl GetEntityType
|
||||
cmp r0, 0x1
|
||||
bne _0807055A
|
||||
_080704E2:
|
||||
bl IsFixedDungeon
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08070504
|
||||
adds r0, r7, 0
|
||||
adds r0, 0xE4
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x3
|
||||
beq _08070552
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x9
|
||||
bl HasItem
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08070552
|
||||
_08070504:
|
||||
movs r1, 0x2
|
||||
ldrsh r0, [r7, r1]
|
||||
bl GetCrossableTerrain
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
ldrh r0, [r5]
|
||||
movs r5, 0x3
|
||||
ands r5, r0
|
||||
adds r0, r6, 0
|
||||
movs r1, 0xC
|
||||
bl HasIQSkill
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08070526
|
||||
movs r4, 0x2
|
||||
_08070526:
|
||||
adds r0, r6, 0
|
||||
movs r1, 0xD
|
||||
bl HasIQSkill
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08070536
|
||||
movs r4, 0x3
|
||||
_08070536:
|
||||
cmp r4, 0x1
|
||||
beq _0807054A
|
||||
cmp r4, 0x1
|
||||
bgt _08070544
|
||||
cmp r4, 0
|
||||
beq _0807054E
|
||||
b _08070552
|
||||
_08070544:
|
||||
cmp r4, 0x2
|
||||
beq _08070556
|
||||
b _08070552
|
||||
_0807054A:
|
||||
cmp r5, 0x2
|
||||
beq _08070552
|
||||
_0807054E:
|
||||
cmp r5, 0x1
|
||||
bne _0807055A
|
||||
_08070552:
|
||||
movs r0, 0
|
||||
b _0807055C
|
||||
_08070556:
|
||||
cmp r5, 0
|
||||
bne _08070552
|
||||
_0807055A:
|
||||
movs r0, 0x1
|
||||
_0807055C:
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_807049C
|
||||
|
||||
thumb_func_start sub_8070564
|
||||
sub_8070564:
|
||||
push {r4-r6,lr}
|
||||
adds r4, r1, 0
|
||||
ldr r6, [r0, 0x70]
|
||||
movs r1, 0
|
||||
ldrsh r0, [r4, r1]
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r4, r2]
|
||||
bl GetMapTile_1
|
||||
adds r5, r0, 0
|
||||
movs r1, 0
|
||||
ldrsh r0, [r4, r1]
|
||||
cmp r0, 0
|
||||
blt _080705E6
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r4, r2]
|
||||
cmp r1, 0
|
||||
blt _080705E6
|
||||
cmp r0, 0x37
|
||||
bgt _080705E6
|
||||
cmp r1, 0x1F
|
||||
bgt _080705E6
|
||||
ldrh r1, [r5]
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _080705E6
|
||||
ldr r0, [r5, 0x10]
|
||||
cmp r0, 0
|
||||
beq _080705A8
|
||||
bl GetEntityType
|
||||
cmp r0, 0x1
|
||||
bne _080705E6
|
||||
_080705A8:
|
||||
movs r1, 0x2
|
||||
ldrsh r0, [r6, r1]
|
||||
bl GetCrossableTerrain
|
||||
lsls r0, 24
|
||||
lsrs r2, r0, 24
|
||||
adds r3, r2, 0
|
||||
ldrh r0, [r5]
|
||||
movs r1, 0x3
|
||||
ands r1, r0
|
||||
adds r0, r1, 0
|
||||
cmp r2, 0x1
|
||||
beq _080705DE
|
||||
cmp r2, 0x1
|
||||
bgt _080705CC
|
||||
cmp r2, 0
|
||||
beq _080705D8
|
||||
b _080705D4
|
||||
_080705CC:
|
||||
cmp r3, 0x3
|
||||
bgt _080705D4
|
||||
cmp r1, 0
|
||||
beq _080705E6
|
||||
_080705D4:
|
||||
movs r0, 0
|
||||
b _080705E8
|
||||
_080705D8:
|
||||
cmp r1, 0x1
|
||||
bne _080705E6
|
||||
b _080705D4
|
||||
_080705DE:
|
||||
cmp r1, 0x2
|
||||
beq _080705D4
|
||||
cmp r0, 0x1
|
||||
beq _080705D4
|
||||
_080705E6:
|
||||
movs r0, 0x1
|
||||
_080705E8:
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8070564
|
||||
|
||||
thumb_func_start sub_80705F0
|
||||
sub_80705F0:
|
||||
push {r4-r7,lr}
|
||||
adds r6, r0, 0
|
||||
adds r4, r1, 0
|
||||
ldr r7, [r6, 0x70]
|
||||
movs r1, 0
|
||||
ldrsh r0, [r4, r1]
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r4, r2]
|
||||
bl GetMapTile_1
|
||||
adds r5, r0, 0
|
||||
movs r1, 0
|
||||
ldrsh r0, [r4, r1]
|
||||
cmp r0, 0
|
||||
blt _0807069A
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r4, r2]
|
||||
cmp r1, 0
|
||||
blt _0807069A
|
||||
cmp r0, 0x37
|
||||
bgt _0807069A
|
||||
cmp r1, 0x1F
|
||||
bgt _0807069A
|
||||
ldrh r1, [r5]
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0807069A
|
||||
ldr r0, [r5, 0x10]
|
||||
cmp r0, 0
|
||||
beq _08070636
|
||||
bl GetEntityType
|
||||
cmp r0, 0x1
|
||||
bne _0807069A
|
||||
_08070636:
|
||||
bl IsFixedDungeon
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08070658
|
||||
adds r0, r7, 0
|
||||
adds r0, 0xE4
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x3
|
||||
beq _08070696
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x9
|
||||
bl HasItem
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08070696
|
||||
_08070658:
|
||||
movs r1, 0x2
|
||||
ldrsh r0, [r7, r1]
|
||||
bl GetCrossableTerrain
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
ldrh r0, [r5]
|
||||
movs r5, 0x3
|
||||
ands r5, r0
|
||||
adds r0, r6, 0
|
||||
movs r1, 0xC
|
||||
bl HasIQSkill
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0807067A
|
||||
movs r4, 0x2
|
||||
_0807067A:
|
||||
adds r0, r6, 0
|
||||
movs r1, 0xD
|
||||
bl HasIQSkill
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0807068A
|
||||
movs r4, 0x3
|
||||
_0807068A:
|
||||
cmp r4, 0
|
||||
blt _08070696
|
||||
cmp r4, 0x2
|
||||
bgt _08070696
|
||||
cmp r5, 0
|
||||
beq _0807069A
|
||||
_08070696:
|
||||
movs r0, 0
|
||||
b _0807069C
|
||||
_0807069A:
|
||||
movs r0, 0x1
|
||||
_0807069C:
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_80705F0
|
||||
|
||||
thumb_func_start sub_80706A4
|
||||
sub_80706A4:
|
||||
push {r4-r7,lr}
|
||||
adds r7, r0, 0
|
||||
adds r4, r1, 0
|
||||
ldr r6, [r7, 0x70]
|
||||
movs r1, 0
|
||||
ldrsh r0, [r4, r1]
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r4, r2]
|
||||
bl GetMapTile_1
|
||||
adds r5, r0, 0
|
||||
movs r1, 0
|
||||
ldrsh r0, [r4, r1]
|
||||
cmp r0, 0
|
||||
blt _0807076A
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r4, r2]
|
||||
cmp r1, 0
|
||||
blt _0807076A
|
||||
cmp r0, 0x37
|
||||
bgt _0807076A
|
||||
cmp r1, 0x1F
|
||||
bgt _0807076A
|
||||
ldrh r1, [r5]
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0807076A
|
||||
ldr r0, [r5, 0x10]
|
||||
cmp r0, 0
|
||||
beq _080706F2
|
||||
bl GetEntityType
|
||||
cmp r0, 0x1
|
||||
bne _0807076A
|
||||
ldr r0, [r5, 0x10]
|
||||
ldr r0, [r0, 0x70]
|
||||
cmp r0, r6
|
||||
bne _0807076A
|
||||
_080706F2:
|
||||
bl IsFixedDungeon
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08070714
|
||||
adds r0, r6, 0
|
||||
adds r0, 0xE4
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x3
|
||||
beq _08070762
|
||||
adds r0, r7, 0
|
||||
movs r1, 0x9
|
||||
bl HasItem
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08070762
|
||||
_08070714:
|
||||
movs r1, 0x2
|
||||
ldrsh r0, [r6, r1]
|
||||
bl GetCrossableTerrain
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
ldrh r0, [r5]
|
||||
movs r5, 0x3
|
||||
ands r5, r0
|
||||
adds r0, r7, 0
|
||||
movs r1, 0xC
|
||||
bl HasIQSkill
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08070736
|
||||
movs r4, 0x2
|
||||
_08070736:
|
||||
adds r0, r7, 0
|
||||
movs r1, 0xD
|
||||
bl HasIQSkill
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08070746
|
||||
movs r4, 0x3
|
||||
_08070746:
|
||||
cmp r4, 0x1
|
||||
beq _0807075A
|
||||
cmp r4, 0x1
|
||||
bgt _08070754
|
||||
cmp r4, 0
|
||||
beq _0807075E
|
||||
b _08070762
|
||||
_08070754:
|
||||
cmp r4, 0x2
|
||||
beq _08070766
|
||||
b _08070762
|
||||
_0807075A:
|
||||
cmp r5, 0x2
|
||||
beq _08070762
|
||||
_0807075E:
|
||||
cmp r5, 0x1
|
||||
bne _0807076A
|
||||
_08070762:
|
||||
movs r0, 0
|
||||
b _0807076C
|
||||
_08070766:
|
||||
cmp r5, 0
|
||||
bne _08070762
|
||||
_0807076A:
|
||||
movs r0, 0x1
|
||||
_0807076C:
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_80706A4
|
||||
|
||||
thumb_func_start GetMovementSpeed
|
||||
GetMovementSpeed:
|
||||
push {r4-r6,lr}
|
||||
adds r6, r0, 0
|
||||
ldr r5, [r6, 0x70]
|
||||
movs r4, 0
|
||||
movs r0, 0x84
|
||||
lsls r0, 1
|
||||
adds r1, r5, r0
|
||||
movs r2, 0x4
|
||||
_08070784:
|
||||
ldrb r0, [r1, 0x5]
|
||||
cmp r0, 0
|
||||
beq _0807078C
|
||||
subs r4, 0x1
|
||||
_0807078C:
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0
|
||||
beq _08070794
|
||||
adds r4, 0x1
|
||||
_08070794:
|
||||
adds r1, 0x1
|
||||
subs r2, 0x1
|
||||
cmp r2, 0
|
||||
bge _08070784
|
||||
adds r0, r5, 0
|
||||
adds r0, 0xAC
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x4
|
||||
bne _080707A8
|
||||
subs r4, 0x1
|
||||
_080707A8:
|
||||
movs r1, 0x2
|
||||
ldrsh r0, [r5, r1]
|
||||
bl GetMoveSpeed
|
||||
adds r4, r0
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x6
|
||||
bl HasType
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080707D0
|
||||
adds r0, r6, 0
|
||||
bl GetWeather
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x7
|
||||
bne _080707D0
|
||||
adds r4, 0x1
|
||||
_080707D0:
|
||||
movs r0, 0x4
|
||||
ldrsh r1, [r5, r0]
|
||||
ldr r0, _0807081C
|
||||
cmp r1, r0
|
||||
bne _080707DC
|
||||
adds r4, 0x1
|
||||
_080707DC:
|
||||
movs r0, 0x2
|
||||
ldrsh r1, [r5, r0]
|
||||
movs r0, 0xBE
|
||||
lsls r0, 1
|
||||
cmp r1, r0
|
||||
bne _080707FE
|
||||
ldrb r0, [r5, 0x6]
|
||||
cmp r0, 0
|
||||
beq _080707FE
|
||||
ldr r0, _08070820
|
||||
ldr r0, [r0]
|
||||
ldr r1, _08070824
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _080707FE
|
||||
adds r4, 0x1
|
||||
_080707FE:
|
||||
cmp r4, 0
|
||||
bge _08070804
|
||||
movs r4, 0
|
||||
_08070804:
|
||||
cmp r4, 0x4
|
||||
ble _0807080A
|
||||
movs r4, 0x4
|
||||
_0807080A:
|
||||
movs r1, 0x82
|
||||
lsls r1, 1
|
||||
adds r0, r5, r1
|
||||
str r4, [r0]
|
||||
adds r0, r4, 0
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_0807081C: .4byte 0x000001a3
|
||||
_08070820: .4byte gDungeonGlobalData
|
||||
_08070824: .4byte 0x0000066e
|
||||
thumb_func_end GetMovementSpeed
|
||||
|
||||
.align 2, 0
|
||||
.align 2, 0
|
||||
493
asm/code_807049C.s
Normal file
493
asm/code_807049C.s
Normal file
@@ -0,0 +1,493 @@
|
||||
#include "asm/constants/gba_constants.inc"
|
||||
#include "asm/macros.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_807049C
|
||||
sub_807049C:
|
||||
push {r4-r7,lr}
|
||||
adds r6, r0, 0
|
||||
adds r4, r1, 0
|
||||
ldr r7, [r6, 0x70]
|
||||
movs r1, 0
|
||||
ldrsh r0, [r4, r1]
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r4, r2]
|
||||
bl GetMapTile_1
|
||||
adds r5, r0, 0
|
||||
movs r1, 0
|
||||
ldrsh r0, [r4, r1]
|
||||
cmp r0, 0
|
||||
blt _0807055A
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r4, r2]
|
||||
cmp r1, 0
|
||||
blt _0807055A
|
||||
cmp r0, 0x37
|
||||
bgt _0807055A
|
||||
cmp r1, 0x1F
|
||||
bgt _0807055A
|
||||
ldrh r1, [r5]
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0807055A
|
||||
ldr r0, [r5, 0x10]
|
||||
cmp r0, 0
|
||||
beq _080704E2
|
||||
bl GetEntityType
|
||||
cmp r0, 0x1
|
||||
bne _0807055A
|
||||
_080704E2:
|
||||
bl IsFixedDungeon
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08070504
|
||||
adds r0, r7, 0
|
||||
adds r0, 0xE4
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x3
|
||||
beq _08070552
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x9
|
||||
bl HasItem
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08070552
|
||||
_08070504:
|
||||
movs r1, 0x2
|
||||
ldrsh r0, [r7, r1]
|
||||
bl GetCrossableTerrain
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
ldrh r0, [r5]
|
||||
movs r5, 0x3
|
||||
ands r5, r0
|
||||
adds r0, r6, 0
|
||||
movs r1, 0xC
|
||||
bl HasIQSkill
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08070526
|
||||
movs r4, 0x2
|
||||
_08070526:
|
||||
adds r0, r6, 0
|
||||
movs r1, 0xD
|
||||
bl HasIQSkill
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08070536
|
||||
movs r4, 0x3
|
||||
_08070536:
|
||||
cmp r4, 0x1
|
||||
beq _0807054A
|
||||
cmp r4, 0x1
|
||||
bgt _08070544
|
||||
cmp r4, 0
|
||||
beq _0807054E
|
||||
b _08070552
|
||||
_08070544:
|
||||
cmp r4, 0x2
|
||||
beq _08070556
|
||||
b _08070552
|
||||
_0807054A:
|
||||
cmp r5, 0x2
|
||||
beq _08070552
|
||||
_0807054E:
|
||||
cmp r5, 0x1
|
||||
bne _0807055A
|
||||
_08070552:
|
||||
movs r0, 0
|
||||
b _0807055C
|
||||
_08070556:
|
||||
cmp r5, 0
|
||||
bne _08070552
|
||||
_0807055A:
|
||||
movs r0, 0x1
|
||||
_0807055C:
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_807049C
|
||||
|
||||
thumb_func_start sub_8070564
|
||||
sub_8070564:
|
||||
push {r4-r6,lr}
|
||||
adds r4, r1, 0
|
||||
ldr r6, [r0, 0x70]
|
||||
movs r1, 0
|
||||
ldrsh r0, [r4, r1]
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r4, r2]
|
||||
bl GetMapTile_1
|
||||
adds r5, r0, 0
|
||||
movs r1, 0
|
||||
ldrsh r0, [r4, r1]
|
||||
cmp r0, 0
|
||||
blt _080705E6
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r4, r2]
|
||||
cmp r1, 0
|
||||
blt _080705E6
|
||||
cmp r0, 0x37
|
||||
bgt _080705E6
|
||||
cmp r1, 0x1F
|
||||
bgt _080705E6
|
||||
ldrh r1, [r5]
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _080705E6
|
||||
ldr r0, [r5, 0x10]
|
||||
cmp r0, 0
|
||||
beq _080705A8
|
||||
bl GetEntityType
|
||||
cmp r0, 0x1
|
||||
bne _080705E6
|
||||
_080705A8:
|
||||
movs r1, 0x2
|
||||
ldrsh r0, [r6, r1]
|
||||
bl GetCrossableTerrain
|
||||
lsls r0, 24
|
||||
lsrs r2, r0, 24
|
||||
adds r3, r2, 0
|
||||
ldrh r0, [r5]
|
||||
movs r1, 0x3
|
||||
ands r1, r0
|
||||
adds r0, r1, 0
|
||||
cmp r2, 0x1
|
||||
beq _080705DE
|
||||
cmp r2, 0x1
|
||||
bgt _080705CC
|
||||
cmp r2, 0
|
||||
beq _080705D8
|
||||
b _080705D4
|
||||
_080705CC:
|
||||
cmp r3, 0x3
|
||||
bgt _080705D4
|
||||
cmp r1, 0
|
||||
beq _080705E6
|
||||
_080705D4:
|
||||
movs r0, 0
|
||||
b _080705E8
|
||||
_080705D8:
|
||||
cmp r1, 0x1
|
||||
bne _080705E6
|
||||
b _080705D4
|
||||
_080705DE:
|
||||
cmp r1, 0x2
|
||||
beq _080705D4
|
||||
cmp r0, 0x1
|
||||
beq _080705D4
|
||||
_080705E6:
|
||||
movs r0, 0x1
|
||||
_080705E8:
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8070564
|
||||
|
||||
thumb_func_start sub_80705F0
|
||||
sub_80705F0:
|
||||
push {r4-r7,lr}
|
||||
adds r6, r0, 0
|
||||
adds r4, r1, 0
|
||||
ldr r7, [r6, 0x70]
|
||||
movs r1, 0
|
||||
ldrsh r0, [r4, r1]
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r4, r2]
|
||||
bl GetMapTile_1
|
||||
adds r5, r0, 0
|
||||
movs r1, 0
|
||||
ldrsh r0, [r4, r1]
|
||||
cmp r0, 0
|
||||
blt _0807069A
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r4, r2]
|
||||
cmp r1, 0
|
||||
blt _0807069A
|
||||
cmp r0, 0x37
|
||||
bgt _0807069A
|
||||
cmp r1, 0x1F
|
||||
bgt _0807069A
|
||||
ldrh r1, [r5]
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0807069A
|
||||
ldr r0, [r5, 0x10]
|
||||
cmp r0, 0
|
||||
beq _08070636
|
||||
bl GetEntityType
|
||||
cmp r0, 0x1
|
||||
bne _0807069A
|
||||
_08070636:
|
||||
bl IsFixedDungeon
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08070658
|
||||
adds r0, r7, 0
|
||||
adds r0, 0xE4
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x3
|
||||
beq _08070696
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x9
|
||||
bl HasItem
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08070696
|
||||
_08070658:
|
||||
movs r1, 0x2
|
||||
ldrsh r0, [r7, r1]
|
||||
bl GetCrossableTerrain
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
ldrh r0, [r5]
|
||||
movs r5, 0x3
|
||||
ands r5, r0
|
||||
adds r0, r6, 0
|
||||
movs r1, 0xC
|
||||
bl HasIQSkill
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0807067A
|
||||
movs r4, 0x2
|
||||
_0807067A:
|
||||
adds r0, r6, 0
|
||||
movs r1, 0xD
|
||||
bl HasIQSkill
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0807068A
|
||||
movs r4, 0x3
|
||||
_0807068A:
|
||||
cmp r4, 0
|
||||
blt _08070696
|
||||
cmp r4, 0x2
|
||||
bgt _08070696
|
||||
cmp r5, 0
|
||||
beq _0807069A
|
||||
_08070696:
|
||||
movs r0, 0
|
||||
b _0807069C
|
||||
_0807069A:
|
||||
movs r0, 0x1
|
||||
_0807069C:
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_80705F0
|
||||
|
||||
thumb_func_start sub_80706A4
|
||||
sub_80706A4:
|
||||
push {r4-r7,lr}
|
||||
adds r7, r0, 0
|
||||
adds r4, r1, 0
|
||||
ldr r6, [r7, 0x70]
|
||||
movs r1, 0
|
||||
ldrsh r0, [r4, r1]
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r4, r2]
|
||||
bl GetMapTile_1
|
||||
adds r5, r0, 0
|
||||
movs r1, 0
|
||||
ldrsh r0, [r4, r1]
|
||||
cmp r0, 0
|
||||
blt _0807076A
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r4, r2]
|
||||
cmp r1, 0
|
||||
blt _0807076A
|
||||
cmp r0, 0x37
|
||||
bgt _0807076A
|
||||
cmp r1, 0x1F
|
||||
bgt _0807076A
|
||||
ldrh r1, [r5]
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0807076A
|
||||
ldr r0, [r5, 0x10]
|
||||
cmp r0, 0
|
||||
beq _080706F2
|
||||
bl GetEntityType
|
||||
cmp r0, 0x1
|
||||
bne _0807076A
|
||||
ldr r0, [r5, 0x10]
|
||||
ldr r0, [r0, 0x70]
|
||||
cmp r0, r6
|
||||
bne _0807076A
|
||||
_080706F2:
|
||||
bl IsFixedDungeon
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08070714
|
||||
adds r0, r6, 0
|
||||
adds r0, 0xE4
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x3
|
||||
beq _08070762
|
||||
adds r0, r7, 0
|
||||
movs r1, 0x9
|
||||
bl HasItem
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08070762
|
||||
_08070714:
|
||||
movs r1, 0x2
|
||||
ldrsh r0, [r6, r1]
|
||||
bl GetCrossableTerrain
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
ldrh r0, [r5]
|
||||
movs r5, 0x3
|
||||
ands r5, r0
|
||||
adds r0, r7, 0
|
||||
movs r1, 0xC
|
||||
bl HasIQSkill
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08070736
|
||||
movs r4, 0x2
|
||||
_08070736:
|
||||
adds r0, r7, 0
|
||||
movs r1, 0xD
|
||||
bl HasIQSkill
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08070746
|
||||
movs r4, 0x3
|
||||
_08070746:
|
||||
cmp r4, 0x1
|
||||
beq _0807075A
|
||||
cmp r4, 0x1
|
||||
bgt _08070754
|
||||
cmp r4, 0
|
||||
beq _0807075E
|
||||
b _08070762
|
||||
_08070754:
|
||||
cmp r4, 0x2
|
||||
beq _08070766
|
||||
b _08070762
|
||||
_0807075A:
|
||||
cmp r5, 0x2
|
||||
beq _08070762
|
||||
_0807075E:
|
||||
cmp r5, 0x1
|
||||
bne _0807076A
|
||||
_08070762:
|
||||
movs r0, 0
|
||||
b _0807076C
|
||||
_08070766:
|
||||
cmp r5, 0
|
||||
bne _08070762
|
||||
_0807076A:
|
||||
movs r0, 0x1
|
||||
_0807076C:
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_80706A4
|
||||
|
||||
thumb_func_start GetMovementSpeed
|
||||
GetMovementSpeed:
|
||||
push {r4-r6,lr}
|
||||
adds r6, r0, 0
|
||||
ldr r5, [r6, 0x70]
|
||||
movs r4, 0
|
||||
movs r0, 0x84
|
||||
lsls r0, 1
|
||||
adds r1, r5, r0
|
||||
movs r2, 0x4
|
||||
_08070784:
|
||||
ldrb r0, [r1, 0x5]
|
||||
cmp r0, 0
|
||||
beq _0807078C
|
||||
subs r4, 0x1
|
||||
_0807078C:
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0
|
||||
beq _08070794
|
||||
adds r4, 0x1
|
||||
_08070794:
|
||||
adds r1, 0x1
|
||||
subs r2, 0x1
|
||||
cmp r2, 0
|
||||
bge _08070784
|
||||
adds r0, r5, 0
|
||||
adds r0, 0xAC
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x4
|
||||
bne _080707A8
|
||||
subs r4, 0x1
|
||||
_080707A8:
|
||||
movs r1, 0x2
|
||||
ldrsh r0, [r5, r1]
|
||||
bl GetMoveSpeed
|
||||
adds r4, r0
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x6
|
||||
bl HasType
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080707D0
|
||||
adds r0, r6, 0
|
||||
bl GetWeather
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x7
|
||||
bne _080707D0
|
||||
adds r4, 0x1
|
||||
_080707D0:
|
||||
movs r0, 0x4
|
||||
ldrsh r1, [r5, r0]
|
||||
ldr r0, _0807081C
|
||||
cmp r1, r0
|
||||
bne _080707DC
|
||||
adds r4, 0x1
|
||||
_080707DC:
|
||||
movs r0, 0x2
|
||||
ldrsh r1, [r5, r0]
|
||||
movs r0, 0xBE
|
||||
lsls r0, 1
|
||||
cmp r1, r0
|
||||
bne _080707FE
|
||||
ldrb r0, [r5, 0x6]
|
||||
cmp r0, 0
|
||||
beq _080707FE
|
||||
ldr r0, _08070820
|
||||
ldr r0, [r0]
|
||||
ldr r1, _08070824
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _080707FE
|
||||
adds r4, 0x1
|
||||
_080707FE:
|
||||
cmp r4, 0
|
||||
bge _08070804
|
||||
movs r4, 0
|
||||
_08070804:
|
||||
cmp r4, 0x4
|
||||
ble _0807080A
|
||||
movs r4, 0x4
|
||||
_0807080A:
|
||||
movs r1, 0x82
|
||||
lsls r1, 1
|
||||
adds r0, r5, r1
|
||||
str r4, [r0]
|
||||
adds r0, r4, 0
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_0807081C: .4byte 0x000001a3
|
||||
_08070820: .4byte gDungeonGlobalData
|
||||
_08070824: .4byte 0x0000066e
|
||||
thumb_func_end GetMovementSpeed
|
||||
|
||||
.align 2, 0
|
||||
1157
asm/code_80718D8.s
1157
asm/code_80718D8.s
File diff suppressed because it is too large
Load Diff
1101
asm/code_8072CF4.s
Normal file
1101
asm/code_8072CF4.s
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,871 +0,0 @@
|
||||
#include "asm/constants/gba_constants.inc"
|
||||
#include "asm/macros.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start ChooseTargetPosition
|
||||
ChooseTargetPosition:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0xC
|
||||
mov r8, r0
|
||||
ldr r7, [r0, 0x70]
|
||||
bl TargetLeader
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0807AF74
|
||||
b _0807B12C
|
||||
_0807AF74:
|
||||
ldr r0, _0807AF8C
|
||||
ldr r1, [r0]
|
||||
ldr r2, _0807AF90
|
||||
adds r0, r1, r2
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _0807AF98
|
||||
ldr r3, _0807AF94
|
||||
adds r6, r1, r3
|
||||
movs r4, 0x14
|
||||
mov r10, r4
|
||||
b _0807AFB4
|
||||
.align 2, 0
|
||||
_0807AF8C: .4byte gDungeonGlobalData
|
||||
_0807AF90: .4byte 0x000037fc
|
||||
_0807AF94: .4byte 0x000135cc
|
||||
_0807AF98:
|
||||
ldrb r0, [r7, 0x6]
|
||||
cmp r0, 0
|
||||
beq _0807AFAC
|
||||
ldr r0, _0807AFA8
|
||||
adds r6, r1, r0
|
||||
movs r1, 0x4
|
||||
mov r10, r1
|
||||
b _0807AFB4
|
||||
.align 2, 0
|
||||
_0807AFA8: .4byte 0x0001357c
|
||||
_0807AFAC:
|
||||
ldr r2, _0807B01C
|
||||
adds r6, r1, r2
|
||||
movs r3, 0x10
|
||||
mov r10, r3
|
||||
_0807AFB4:
|
||||
mov r0, r8
|
||||
bl CanCrossWalls
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
str r0, [sp, 0x4]
|
||||
movs r4, 0x1
|
||||
negs r4, r4
|
||||
str r4, [sp]
|
||||
ldr r0, _0807B020
|
||||
mov r9, r0
|
||||
movs r5, 0
|
||||
adds r1, r7, 0
|
||||
adds r1, 0x78
|
||||
str r1, [sp, 0x8]
|
||||
cmp r5, r10
|
||||
bge _0807B09E
|
||||
_0807AFD6:
|
||||
lsls r0, r5, 2
|
||||
adds r0, r6
|
||||
ldr r4, [r0]
|
||||
adds r0, r4, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0807B098
|
||||
ldr r0, [r4, 0x70]
|
||||
adds r1, r0, 0
|
||||
adds r1, 0xA4
|
||||
ldrb r1, [r1]
|
||||
adds r2, r0, 0
|
||||
cmp r1, 0
|
||||
bne _0807B098
|
||||
ldr r0, _0807B024
|
||||
ldr r0, [r0]
|
||||
ldr r3, _0807B028
|
||||
adds r0, r3
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _0807B02C
|
||||
mov r0, r8
|
||||
adds r1, r4, 0
|
||||
movs r2, 0
|
||||
movs r3, 0x1
|
||||
bl CanTarget
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
bne _0807B098
|
||||
ldr r2, [r4, 0x70]
|
||||
b _0807B03C
|
||||
.align 2, 0
|
||||
_0807B01C: .4byte 0x0001358c
|
||||
_0807B020: .4byte 0x000003e7
|
||||
_0807B024: .4byte gDungeonGlobalData
|
||||
_0807B028: .4byte 0x000037fc
|
||||
_0807B02C:
|
||||
ldrb r0, [r7, 0x6]
|
||||
cmp r0, 0
|
||||
bne _0807B03C
|
||||
adds r0, r2, 0
|
||||
adds r0, 0xB0
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x6
|
||||
beq _0807B098
|
||||
_0807B03C:
|
||||
ldrb r0, [r2, 0x8]
|
||||
cmp r0, 0x1
|
||||
beq _0807B098
|
||||
ldr r0, [sp, 0x4]
|
||||
cmp r0, 0
|
||||
beq _0807B074
|
||||
mov r2, r8
|
||||
movs r3, 0x4
|
||||
ldrsh r1, [r2, r3]
|
||||
movs r2, 0x4
|
||||
ldrsh r0, [r4, r2]
|
||||
subs r1, r0
|
||||
cmp r1, 0
|
||||
bge _0807B05A
|
||||
negs r1, r1
|
||||
_0807B05A:
|
||||
cmp r1, 0x5
|
||||
bgt _0807B074
|
||||
mov r3, r8
|
||||
movs r0, 0x6
|
||||
ldrsh r1, [r3, r0]
|
||||
movs r2, 0x6
|
||||
ldrsh r0, [r4, r2]
|
||||
subs r1, r0
|
||||
cmp r1, 0
|
||||
bge _0807B070
|
||||
negs r1, r1
|
||||
_0807B070:
|
||||
cmp r1, 0x5
|
||||
ble _0807B082
|
||||
_0807B074:
|
||||
mov r0, r8
|
||||
adds r1, r4, 0
|
||||
bl CanSee_2
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0807B098
|
||||
_0807B082:
|
||||
adds r1, r4, 0x4
|
||||
mov r0, r8
|
||||
adds r0, 0x4
|
||||
bl GetDistance
|
||||
cmp r9, r0
|
||||
ble _0807B098
|
||||
mov r9, r0
|
||||
str r5, [sp]
|
||||
cmp r0, 0x1
|
||||
ble _0807B09E
|
||||
_0807B098:
|
||||
adds r5, 0x1
|
||||
cmp r5, r10
|
||||
blt _0807AFD6
|
||||
_0807B09E:
|
||||
ldr r3, [sp]
|
||||
cmp r3, 0
|
||||
blt _0807B12C
|
||||
movs r2, 0
|
||||
movs r5, 0x1
|
||||
ldr r4, [sp, 0x8]
|
||||
strb r5, [r4]
|
||||
adds r1, r7, 0
|
||||
adds r1, 0x88
|
||||
lsls r0, r3, 2
|
||||
adds r4, r0, r6
|
||||
ldr r0, [r4]
|
||||
ldr r0, [r0, 0x4]
|
||||
str r0, [r1]
|
||||
subs r1, 0x8
|
||||
ldr r0, [r4]
|
||||
str r0, [r1]
|
||||
ldrh r1, [r0, 0x26]
|
||||
adds r0, r7, 0
|
||||
adds r0, 0x7C
|
||||
strh r1, [r0]
|
||||
subs r0, 0x2
|
||||
strb r5, [r0]
|
||||
movs r1, 0x8A
|
||||
lsls r1, 1
|
||||
adds r0, r7, r1
|
||||
str r2, [r0]
|
||||
mov r0, r8
|
||||
movs r1, 0x8
|
||||
bl HasTactic
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0807B0E4
|
||||
b _0807B2C6
|
||||
_0807B0E4:
|
||||
mov r0, r8
|
||||
bl CanSeeTeammate
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0807B0F2
|
||||
b _0807B2C6
|
||||
_0807B0F2:
|
||||
mov r2, r8
|
||||
movs r3, 0x4
|
||||
ldrsh r1, [r2, r3]
|
||||
ldr r2, [r4]
|
||||
movs r4, 0x4
|
||||
ldrsh r0, [r2, r4]
|
||||
subs r1, r0
|
||||
cmp r1, 0
|
||||
bge _0807B106
|
||||
negs r1, r1
|
||||
_0807B106:
|
||||
cmp r1, 0x1
|
||||
ble _0807B10C
|
||||
b _0807B2C6
|
||||
_0807B10C:
|
||||
mov r0, r8
|
||||
movs r3, 0x6
|
||||
ldrsh r1, [r0, r3]
|
||||
movs r4, 0x6
|
||||
ldrsh r0, [r2, r4]
|
||||
subs r0, r1, r0
|
||||
cmp r0, 0
|
||||
bge _0807B11E
|
||||
negs r0, r0
|
||||
_0807B11E:
|
||||
cmp r0, 0x1
|
||||
ble _0807B124
|
||||
b _0807B2C6
|
||||
_0807B124:
|
||||
adds r0, r7, 0
|
||||
adds r0, 0x7B
|
||||
strb r5, [r0]
|
||||
b _0807B2C6
|
||||
_0807B12C:
|
||||
mov r0, r8
|
||||
movs r1, 0x1
|
||||
bl HasTactic
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0807B17C
|
||||
ldrb r5, [r7, 0x6]
|
||||
adds r0, r7, 0
|
||||
adds r0, 0x78
|
||||
str r0, [sp, 0x8]
|
||||
cmp r5, 0
|
||||
bne _0807B222
|
||||
mov r0, r8
|
||||
bl GetLeaderEntityIfVisible
|
||||
adds r4, r0, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0807B222
|
||||
movs r0, 0x1
|
||||
ldr r1, [sp, 0x8]
|
||||
strb r0, [r1]
|
||||
adds r1, r7, 0
|
||||
adds r1, 0x88
|
||||
ldr r0, [r4, 0x4]
|
||||
str r0, [r1]
|
||||
adds r0, r7, 0
|
||||
adds r0, 0x80
|
||||
str r4, [r0]
|
||||
ldrh r1, [r4, 0x26]
|
||||
subs r0, 0x4
|
||||
strh r1, [r0]
|
||||
movs r2, 0x8A
|
||||
lsls r2, 1
|
||||
adds r0, r7, r2
|
||||
str r5, [r0]
|
||||
b _0807B2C6
|
||||
_0807B17C:
|
||||
ldrb r0, [r7, 0x7]
|
||||
adds r3, r7, 0
|
||||
adds r3, 0x78
|
||||
str r3, [sp, 0x8]
|
||||
cmp r0, 0
|
||||
beq _0807B222
|
||||
ldr r4, _0807B1BC
|
||||
ldr r0, [r4]
|
||||
ldr r1, _0807B1C0
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
mov r2, r8
|
||||
movs r3, 0x4
|
||||
ldrsh r0, [r2, r3]
|
||||
movs r3, 0x6
|
||||
ldrsh r1, [r2, r3]
|
||||
bl GetMapTile_1
|
||||
ldrb r1, [r0, 0x9]
|
||||
cmp r1, 0xFF
|
||||
bne _0807B1C4
|
||||
mov r4, r8
|
||||
movs r0, 0x4
|
||||
ldrsh r1, [r4, r0]
|
||||
subs r2, r1, 0x2
|
||||
mov r10, r2
|
||||
movs r3, 0x6
|
||||
ldrsh r0, [r4, r3]
|
||||
subs r2, r0, 0x2
|
||||
adds r6, r1, 0x2
|
||||
adds r0, 0x2
|
||||
b _0807B1EC
|
||||
.align 2, 0
|
||||
_0807B1BC: .4byte gDungeonGlobalData
|
||||
_0807B1C0: .4byte 0x00018209
|
||||
_0807B1C4:
|
||||
lsls r0, r1, 3
|
||||
subs r0, r1
|
||||
lsls r0, 2
|
||||
ldr r1, _0807B26C
|
||||
adds r0, r1
|
||||
ldr r1, [r4]
|
||||
adds r1, r0
|
||||
movs r2, 0x2
|
||||
ldrsh r0, [r1, r2]
|
||||
subs r0, 0x1
|
||||
mov r10, r0
|
||||
movs r3, 0x4
|
||||
ldrsh r0, [r1, r3]
|
||||
subs r2, r0, 0x1
|
||||
movs r4, 0x6
|
||||
ldrsh r0, [r1, r4]
|
||||
adds r6, r0, 0x1
|
||||
movs r3, 0x8
|
||||
ldrsh r0, [r1, r3]
|
||||
adds r0, 0x1
|
||||
_0807B1EC:
|
||||
mov r9, r0
|
||||
adds r5, r2, 0
|
||||
adds r4, r7, 0
|
||||
adds r4, 0x78
|
||||
str r4, [sp, 0x8]
|
||||
cmp r5, r9
|
||||
bgt _0807B222
|
||||
_0807B1FA:
|
||||
mov r4, r10
|
||||
cmp r4, r6
|
||||
bgt _0807B21C
|
||||
_0807B200:
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl GetMapTile_2
|
||||
ldr r0, [r0, 0x14]
|
||||
cmp r0, 0
|
||||
beq _0807B216
|
||||
bl GetEntityType
|
||||
cmp r0, 0x3
|
||||
beq _0807B270
|
||||
_0807B216:
|
||||
adds r4, 0x1
|
||||
cmp r4, r6
|
||||
ble _0807B200
|
||||
_0807B21C:
|
||||
adds r5, 0x1
|
||||
cmp r5, r9
|
||||
ble _0807B1FA
|
||||
_0807B222:
|
||||
ldr r1, [sp, 0x8]
|
||||
ldrb r0, [r1]
|
||||
subs r0, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
bhi _0807B2C0
|
||||
adds r3, r7, 0
|
||||
adds r3, 0x80
|
||||
ldr r1, [r3]
|
||||
cmp r1, 0
|
||||
beq _0807B2C0
|
||||
adds r2, r7, 0
|
||||
adds r2, 0x7C
|
||||
ldrh r0, [r1, 0x26]
|
||||
ldrh r4, [r2]
|
||||
cmp r0, r4
|
||||
bne _0807B2B4
|
||||
ldr r1, [r1, 0x70]
|
||||
mov r9, r1
|
||||
movs r5, 0
|
||||
mov r4, r9
|
||||
adds r4, 0x68
|
||||
_0807B250:
|
||||
lsls r6, r5, 2
|
||||
mov r0, r8
|
||||
adds r1, r4, 0
|
||||
bl InSameRoom
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0807B294
|
||||
adds r4, 0x4
|
||||
adds r5, 0x1
|
||||
cmp r5, 0x3
|
||||
ble _0807B250
|
||||
b _0807B2C0
|
||||
.align 2, 0
|
||||
_0807B26C: .4byte 0x000104c4
|
||||
_0807B270:
|
||||
movs r1, 0
|
||||
movs r0, 0x7
|
||||
ldr r2, [sp, 0x8]
|
||||
strb r0, [r2]
|
||||
adds r0, r7, 0
|
||||
adds r0, 0x88
|
||||
strh r4, [r0]
|
||||
adds r0, 0x2
|
||||
strh r5, [r0]
|
||||
subs r0, 0xA
|
||||
str r1, [r0]
|
||||
subs r0, 0x4
|
||||
strh r1, [r0]
|
||||
movs r3, 0x8A
|
||||
lsls r3, 1
|
||||
adds r0, r7, r3
|
||||
str r1, [r0]
|
||||
b _0807B2C6
|
||||
_0807B294:
|
||||
movs r2, 0
|
||||
movs r0, 0x2
|
||||
ldr r4, [sp, 0x8]
|
||||
strb r0, [r4]
|
||||
adds r1, r7, 0
|
||||
adds r1, 0x88
|
||||
mov r0, r9
|
||||
adds r0, 0x68
|
||||
adds r0, r6
|
||||
ldr r0, [r0]
|
||||
str r0, [r1]
|
||||
movs r1, 0x8A
|
||||
lsls r1, 1
|
||||
adds r0, r7, r1
|
||||
str r2, [r0]
|
||||
b _0807B2C6
|
||||
_0807B2B4:
|
||||
movs r1, 0
|
||||
movs r0, 0x6
|
||||
ldr r4, [sp, 0x8]
|
||||
strb r0, [r4]
|
||||
str r1, [r3]
|
||||
strh r1, [r2]
|
||||
_0807B2C0:
|
||||
mov r0, r8
|
||||
bl Wander
|
||||
_0807B2C6:
|
||||
movs r0, 0x1
|
||||
add sp, 0xC
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end ChooseTargetPosition
|
||||
|
||||
thumb_func_start DecideMovement
|
||||
DecideMovement:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x3C
|
||||
mov r9, r0
|
||||
lsls r1, 24
|
||||
lsrs r7, r1, 24
|
||||
ldr r5, [r0, 0x70]
|
||||
movs r0, 0xB6
|
||||
lsls r0, 1
|
||||
adds r1, r5, r0
|
||||
adds r4, r5, 0
|
||||
adds r4, 0x88
|
||||
ldr r0, [r4]
|
||||
str r0, [r1]
|
||||
mov r2, r9
|
||||
ldr r1, [r2, 0x4]
|
||||
ldr r0, [r4]
|
||||
cmp r1, r0
|
||||
beq _0807B348
|
||||
mov r6, r9
|
||||
adds r6, 0x4
|
||||
adds r0, r6, 0
|
||||
adds r1, r4, 0
|
||||
bl CalculateFacingDir
|
||||
mov r8, r0
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x7A
|
||||
ldrb r1, [r0]
|
||||
mov r0, r9
|
||||
bl ShouldAvoidFirstHit
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0807B366
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x78
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x1
|
||||
bne _0807B37C
|
||||
adds r0, r6, 0
|
||||
adds r1, r4, 0
|
||||
bl IsTargetTwoTilesAway
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0807B37C
|
||||
adds r0, r6, 0
|
||||
adds r1, r4, 0
|
||||
bl GetDistance
|
||||
cmp r0, 0x2
|
||||
bne _0807B354
|
||||
_0807B348:
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x44
|
||||
movs r1, 0x1
|
||||
bl SetAction
|
||||
b _0807B5CE
|
||||
_0807B354:
|
||||
cmp r0, 0x1
|
||||
bgt _0807B37C
|
||||
movs r3, 0x4
|
||||
add r8, r3
|
||||
movs r0, 0x7
|
||||
mov r1, r8
|
||||
ands r1, r0
|
||||
mov r8, r1
|
||||
b _0807B37C
|
||||
_0807B366:
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x7B
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _0807B37C
|
||||
movs r2, 0x4
|
||||
add r8, r2
|
||||
movs r0, 0x7
|
||||
mov r3, r8
|
||||
ands r3, r0
|
||||
mov r8, r3
|
||||
_0807B37C:
|
||||
add r4, sp, 0x30
|
||||
mov r0, r9
|
||||
mov r1, r8
|
||||
adds r2, r4, 0
|
||||
bl CanMoveForward
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0807B3A8
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x44
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r5, r2]
|
||||
bl SetWalkAction
|
||||
movs r0, 0x7
|
||||
mov r3, r8
|
||||
ands r3, r0
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x46
|
||||
strb r3, [r0]
|
||||
b _0807B5CE
|
||||
_0807B3A8:
|
||||
ldrb r0, [r4]
|
||||
cmp r0, 0
|
||||
beq _0807B444
|
||||
ldrb r0, [r5, 0x6]
|
||||
cmp r0, 0
|
||||
bne _0807B3E8
|
||||
ldr r1, _0807B3E0
|
||||
adds r0, r5, r1
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
bne _0807B3E8
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x79
|
||||
movs r4, 0x1
|
||||
strb r4, [r0]
|
||||
movs r2, 0xA2
|
||||
lsls r2, 1
|
||||
adds r0, r5, r2
|
||||
strb r4, [r0]
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x44
|
||||
movs r1, 0x1
|
||||
bl SetAction
|
||||
ldr r3, _0807B3E4
|
||||
adds r0, r5, r3
|
||||
strb r4, [r0]
|
||||
b _0807B5CE
|
||||
.align 2, 0
|
||||
_0807B3E0: .4byte 0x00000145
|
||||
_0807B3E4: .4byte 0x00000147
|
||||
_0807B3E8:
|
||||
mov r0, r9
|
||||
movs r2, 0x4
|
||||
ldrsh r1, [r0, r2]
|
||||
ldr r2, _0807B434
|
||||
mov r3, r8
|
||||
lsls r0, r3, 2
|
||||
adds r2, r0, r2
|
||||
movs r3, 0
|
||||
ldrsh r0, [r2, r3]
|
||||
adds r1, r0
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x88
|
||||
movs r3, 0
|
||||
ldrsh r0, [r0, r3]
|
||||
cmp r1, r0
|
||||
bne _0807B43C
|
||||
mov r1, r9
|
||||
movs r3, 0x6
|
||||
ldrsh r0, [r1, r3]
|
||||
movs r3, 0x2
|
||||
ldrsh r1, [r2, r3]
|
||||
adds r0, r1
|
||||
adds r1, r5, 0
|
||||
adds r1, 0x8A
|
||||
movs r2, 0
|
||||
ldrsh r1, [r1, r2]
|
||||
cmp r0, r1
|
||||
bne _0807B43C
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x44
|
||||
movs r1, 0x1
|
||||
bl SetAction
|
||||
ldr r3, _0807B438
|
||||
adds r1, r5, r3
|
||||
movs r0, 0x1
|
||||
strb r0, [r1]
|
||||
b _0807B5CE
|
||||
.align 2, 0
|
||||
_0807B434: .4byte gAdjacentTileOffsets
|
||||
_0807B438: .4byte 0x00000147
|
||||
_0807B43C:
|
||||
adds r1, r5, 0
|
||||
adds r1, 0x79
|
||||
movs r0, 0x1
|
||||
strb r0, [r1]
|
||||
_0807B444:
|
||||
mov r3, sp
|
||||
mov r2, sp
|
||||
mov r1, sp
|
||||
add r0, sp, 0x28
|
||||
movs r4, 0x1
|
||||
strb r4, [r0]
|
||||
add r0, sp, 0x20
|
||||
strb r4, [r0]
|
||||
strb r4, [r1, 0x18]
|
||||
strb r4, [r2, 0x10]
|
||||
strb r4, [r3, 0x8]
|
||||
ldrb r6, [r5, 0x6]
|
||||
cmp r6, 0
|
||||
bne _0807B4C8
|
||||
mov r0, r8
|
||||
ands r0, r4
|
||||
cmp r0, 0
|
||||
beq _0807B4C8
|
||||
mov r1, r9
|
||||
movs r2, 0x4
|
||||
ldrsh r0, [r1, r2]
|
||||
adds r1, r5, 0
|
||||
adds r1, 0x88
|
||||
movs r3, 0
|
||||
ldrsh r1, [r1, r3]
|
||||
subs r2, r0, r1
|
||||
cmp r2, 0
|
||||
bge _0807B47E
|
||||
negs r2, r2
|
||||
_0807B47E:
|
||||
mov r0, r9
|
||||
movs r3, 0x6
|
||||
ldrsh r1, [r0, r3]
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x8A
|
||||
movs r3, 0
|
||||
ldrsh r0, [r0, r3]
|
||||
subs r1, r0
|
||||
cmp r1, 0
|
||||
bge _0807B494
|
||||
negs r1, r1
|
||||
_0807B494:
|
||||
cmp r2, 0x2
|
||||
bgt _0807B4C8
|
||||
cmp r1, 0x2
|
||||
bgt _0807B4C8
|
||||
cmp r2, r1
|
||||
beq _0807B4C8
|
||||
movs r3, 0x2
|
||||
mov r0, r8
|
||||
ands r3, r0
|
||||
cmp r3, 0
|
||||
beq _0807B4BA
|
||||
cmp r2, r1
|
||||
bge _0807B4B4
|
||||
mov r0, sp
|
||||
strb r6, [r0, 0x10]
|
||||
b _0807B4C8
|
||||
_0807B4B4:
|
||||
mov r0, sp
|
||||
strb r6, [r0, 0x8]
|
||||
b _0807B4C8
|
||||
_0807B4BA:
|
||||
cmp r2, r1
|
||||
bge _0807B4C4
|
||||
mov r0, sp
|
||||
strb r3, [r0, 0x8]
|
||||
b _0807B4C8
|
||||
_0807B4C4:
|
||||
mov r0, sp
|
||||
strb r3, [r0, 0x10]
|
||||
_0807B4C8:
|
||||
movs r1, 0x3
|
||||
mov r10, r1
|
||||
mov r0, r9
|
||||
adds r1, r7, 0
|
||||
bl ShouldAvoidEnemiesAndShowEffect
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0807B4E4
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x7B
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _0807B4E8
|
||||
_0807B4E4:
|
||||
movs r2, 0x5
|
||||
mov r10, r2
|
||||
_0807B4E8:
|
||||
movs r6, 0x1
|
||||
adds r3, r5, 0
|
||||
adds r3, 0x44
|
||||
str r3, [sp, 0x34]
|
||||
cmp r6, r10
|
||||
bge _0807B53C
|
||||
mov r3, sp
|
||||
mov r4, sp
|
||||
adds r4, 0xA
|
||||
add r7, sp, 0x8
|
||||
_0807B4FC:
|
||||
lsls r0, r6, 3
|
||||
add r2, sp, 0x4
|
||||
adds r2, r0
|
||||
ldr r1, _0807B598
|
||||
lsls r0, r6, 2
|
||||
adds r0, r1
|
||||
ldr r1, [r0]
|
||||
add r1, r8
|
||||
movs r0, 0x7
|
||||
ands r1, r0
|
||||
str r1, [r2]
|
||||
mov r0, r9
|
||||
adds r2, r4, 0
|
||||
str r3, [sp, 0x38]
|
||||
bl CanMoveForward
|
||||
strb r0, [r7, 0x1]
|
||||
lsls r0, 24
|
||||
ldr r3, [sp, 0x38]
|
||||
cmp r0, 0
|
||||
bne _0807B532
|
||||
ldrb r0, [r4]
|
||||
cmp r0, 0
|
||||
bne _0807B532
|
||||
movs r0, 0x1
|
||||
strb r0, [r3, 0x10]
|
||||
strb r0, [r3, 0x8]
|
||||
_0807B532:
|
||||
adds r4, 0x8
|
||||
adds r7, 0x8
|
||||
adds r6, 0x1
|
||||
cmp r6, r10
|
||||
blt _0807B4FC
|
||||
_0807B53C:
|
||||
movs r6, 0x1
|
||||
cmp r6, r10
|
||||
bge _0807B56E
|
||||
adds r3, r5, 0
|
||||
adds r3, 0x79
|
||||
add r1, sp, 0x8
|
||||
movs r4, 0x8
|
||||
movs r7, 0x1
|
||||
_0807B54C:
|
||||
adds r2, r4, 0
|
||||
ldrb r0, [r1, 0x1]
|
||||
cmp r0, 0
|
||||
beq _0807B55A
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0
|
||||
bne _0807B5A0
|
||||
_0807B55A:
|
||||
ldrb r0, [r1, 0x2]
|
||||
cmp r0, 0
|
||||
beq _0807B562
|
||||
strb r7, [r3]
|
||||
_0807B562:
|
||||
adds r1, 0x8
|
||||
adds r4, r2, 0
|
||||
adds r4, 0x8
|
||||
adds r6, 0x1
|
||||
cmp r6, r10
|
||||
blt _0807B54C
|
||||
_0807B56E:
|
||||
ldr r0, [sp, 0x34]
|
||||
movs r1, 0x1
|
||||
bl SetAction
|
||||
ldr r1, _0807B59C
|
||||
adds r0, r5, r1
|
||||
movs r1, 0
|
||||
movs r2, 0x1
|
||||
strb r2, [r0]
|
||||
ldrb r0, [r5, 0x7]
|
||||
cmp r0, 0
|
||||
beq _0807B5BC
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x79
|
||||
strb r1, [r0]
|
||||
movs r2, 0xA2
|
||||
lsls r2, 1
|
||||
adds r0, r5, r2
|
||||
strb r1, [r0]
|
||||
b _0807B5CE
|
||||
.align 2, 0
|
||||
_0807B598: .4byte gFaceDirectionIncrements
|
||||
_0807B59C: .4byte 0x00000147
|
||||
_0807B5A0:
|
||||
movs r3, 0x2
|
||||
ldrsh r1, [r5, r3]
|
||||
ldr r0, [sp, 0x34]
|
||||
bl SetWalkAction
|
||||
add r0, sp, 0x4
|
||||
adds r0, r4
|
||||
ldr r0, [r0]
|
||||
movs r1, 0x7
|
||||
ands r0, r1
|
||||
adds r1, r5, 0
|
||||
adds r1, 0x46
|
||||
strb r0, [r1]
|
||||
b _0807B5CE
|
||||
_0807B5BC:
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x79
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _0807B5CE
|
||||
movs r1, 0xA2
|
||||
lsls r1, 1
|
||||
adds r0, r5, r1
|
||||
strb r2, [r0]
|
||||
_0807B5CE:
|
||||
add sp, 0x3C
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end DecideMovement
|
||||
|
||||
.align 2, 0
|
||||
408
asm/code_807B2D8.s
Normal file
408
asm/code_807B2D8.s
Normal file
@@ -0,0 +1,408 @@
|
||||
#include "asm/constants/gba_constants.inc"
|
||||
#include "asm/macros.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start DecideMovement
|
||||
DecideMovement:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x3C
|
||||
mov r9, r0
|
||||
lsls r1, 24
|
||||
lsrs r7, r1, 24
|
||||
ldr r5, [r0, 0x70]
|
||||
movs r0, 0xB6
|
||||
lsls r0, 1
|
||||
adds r1, r5, r0
|
||||
adds r4, r5, 0
|
||||
adds r4, 0x88
|
||||
ldr r0, [r4]
|
||||
str r0, [r1]
|
||||
mov r2, r9
|
||||
ldr r1, [r2, 0x4]
|
||||
ldr r0, [r4]
|
||||
cmp r1, r0
|
||||
beq _0807B348
|
||||
mov r6, r9
|
||||
adds r6, 0x4
|
||||
adds r0, r6, 0
|
||||
adds r1, r4, 0
|
||||
bl CalculateFacingDir
|
||||
mov r8, r0
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x7A
|
||||
ldrb r1, [r0]
|
||||
mov r0, r9
|
||||
bl ShouldAvoidFirstHit
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0807B366
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x78
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x1
|
||||
bne _0807B37C
|
||||
adds r0, r6, 0
|
||||
adds r1, r4, 0
|
||||
bl IsTargetTwoTilesAway
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0807B37C
|
||||
adds r0, r6, 0
|
||||
adds r1, r4, 0
|
||||
bl GetDistance
|
||||
cmp r0, 0x2
|
||||
bne _0807B354
|
||||
_0807B348:
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x44
|
||||
movs r1, 0x1
|
||||
bl SetAction
|
||||
b _0807B5CE
|
||||
_0807B354:
|
||||
cmp r0, 0x1
|
||||
bgt _0807B37C
|
||||
movs r3, 0x4
|
||||
add r8, r3
|
||||
movs r0, 0x7
|
||||
mov r1, r8
|
||||
ands r1, r0
|
||||
mov r8, r1
|
||||
b _0807B37C
|
||||
_0807B366:
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x7B
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _0807B37C
|
||||
movs r2, 0x4
|
||||
add r8, r2
|
||||
movs r0, 0x7
|
||||
mov r3, r8
|
||||
ands r3, r0
|
||||
mov r8, r3
|
||||
_0807B37C:
|
||||
add r4, sp, 0x30
|
||||
mov r0, r9
|
||||
mov r1, r8
|
||||
adds r2, r4, 0
|
||||
bl CanMoveForward
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0807B3A8
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x44
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r5, r2]
|
||||
bl SetWalkAction
|
||||
movs r0, 0x7
|
||||
mov r3, r8
|
||||
ands r3, r0
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x46
|
||||
strb r3, [r0]
|
||||
b _0807B5CE
|
||||
_0807B3A8:
|
||||
ldrb r0, [r4]
|
||||
cmp r0, 0
|
||||
beq _0807B444
|
||||
ldrb r0, [r5, 0x6]
|
||||
cmp r0, 0
|
||||
bne _0807B3E8
|
||||
ldr r1, _0807B3E0
|
||||
adds r0, r5, r1
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
bne _0807B3E8
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x79
|
||||
movs r4, 0x1
|
||||
strb r4, [r0]
|
||||
movs r2, 0xA2
|
||||
lsls r2, 1
|
||||
adds r0, r5, r2
|
||||
strb r4, [r0]
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x44
|
||||
movs r1, 0x1
|
||||
bl SetAction
|
||||
ldr r3, _0807B3E4
|
||||
adds r0, r5, r3
|
||||
strb r4, [r0]
|
||||
b _0807B5CE
|
||||
.align 2, 0
|
||||
_0807B3E0: .4byte 0x00000145
|
||||
_0807B3E4: .4byte 0x00000147
|
||||
_0807B3E8:
|
||||
mov r0, r9
|
||||
movs r2, 0x4
|
||||
ldrsh r1, [r0, r2]
|
||||
ldr r2, _0807B434
|
||||
mov r3, r8
|
||||
lsls r0, r3, 2
|
||||
adds r2, r0, r2
|
||||
movs r3, 0
|
||||
ldrsh r0, [r2, r3]
|
||||
adds r1, r0
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x88
|
||||
movs r3, 0
|
||||
ldrsh r0, [r0, r3]
|
||||
cmp r1, r0
|
||||
bne _0807B43C
|
||||
mov r1, r9
|
||||
movs r3, 0x6
|
||||
ldrsh r0, [r1, r3]
|
||||
movs r3, 0x2
|
||||
ldrsh r1, [r2, r3]
|
||||
adds r0, r1
|
||||
adds r1, r5, 0
|
||||
adds r1, 0x8A
|
||||
movs r2, 0
|
||||
ldrsh r1, [r1, r2]
|
||||
cmp r0, r1
|
||||
bne _0807B43C
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x44
|
||||
movs r1, 0x1
|
||||
bl SetAction
|
||||
ldr r3, _0807B438
|
||||
adds r1, r5, r3
|
||||
movs r0, 0x1
|
||||
strb r0, [r1]
|
||||
b _0807B5CE
|
||||
.align 2, 0
|
||||
_0807B434: .4byte gAdjacentTileOffsets
|
||||
_0807B438: .4byte 0x00000147
|
||||
_0807B43C:
|
||||
adds r1, r5, 0
|
||||
adds r1, 0x79
|
||||
movs r0, 0x1
|
||||
strb r0, [r1]
|
||||
_0807B444:
|
||||
mov r3, sp
|
||||
mov r2, sp
|
||||
mov r1, sp
|
||||
add r0, sp, 0x28
|
||||
movs r4, 0x1
|
||||
strb r4, [r0]
|
||||
add r0, sp, 0x20
|
||||
strb r4, [r0]
|
||||
strb r4, [r1, 0x18]
|
||||
strb r4, [r2, 0x10]
|
||||
strb r4, [r3, 0x8]
|
||||
ldrb r6, [r5, 0x6]
|
||||
cmp r6, 0
|
||||
bne _0807B4C8
|
||||
mov r0, r8
|
||||
ands r0, r4
|
||||
cmp r0, 0
|
||||
beq _0807B4C8
|
||||
mov r1, r9
|
||||
movs r2, 0x4
|
||||
ldrsh r0, [r1, r2]
|
||||
adds r1, r5, 0
|
||||
adds r1, 0x88
|
||||
movs r3, 0
|
||||
ldrsh r1, [r1, r3]
|
||||
subs r2, r0, r1
|
||||
cmp r2, 0
|
||||
bge _0807B47E
|
||||
negs r2, r2
|
||||
_0807B47E:
|
||||
mov r0, r9
|
||||
movs r3, 0x6
|
||||
ldrsh r1, [r0, r3]
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x8A
|
||||
movs r3, 0
|
||||
ldrsh r0, [r0, r3]
|
||||
subs r1, r0
|
||||
cmp r1, 0
|
||||
bge _0807B494
|
||||
negs r1, r1
|
||||
_0807B494:
|
||||
cmp r2, 0x2
|
||||
bgt _0807B4C8
|
||||
cmp r1, 0x2
|
||||
bgt _0807B4C8
|
||||
cmp r2, r1
|
||||
beq _0807B4C8
|
||||
movs r3, 0x2
|
||||
mov r0, r8
|
||||
ands r3, r0
|
||||
cmp r3, 0
|
||||
beq _0807B4BA
|
||||
cmp r2, r1
|
||||
bge _0807B4B4
|
||||
mov r0, sp
|
||||
strb r6, [r0, 0x10]
|
||||
b _0807B4C8
|
||||
_0807B4B4:
|
||||
mov r0, sp
|
||||
strb r6, [r0, 0x8]
|
||||
b _0807B4C8
|
||||
_0807B4BA:
|
||||
cmp r2, r1
|
||||
bge _0807B4C4
|
||||
mov r0, sp
|
||||
strb r3, [r0, 0x8]
|
||||
b _0807B4C8
|
||||
_0807B4C4:
|
||||
mov r0, sp
|
||||
strb r3, [r0, 0x10]
|
||||
_0807B4C8:
|
||||
movs r1, 0x3
|
||||
mov r10, r1
|
||||
mov r0, r9
|
||||
adds r1, r7, 0
|
||||
bl ShouldAvoidEnemiesAndShowEffect
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0807B4E4
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x7B
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _0807B4E8
|
||||
_0807B4E4:
|
||||
movs r2, 0x5
|
||||
mov r10, r2
|
||||
_0807B4E8:
|
||||
movs r6, 0x1
|
||||
adds r3, r5, 0
|
||||
adds r3, 0x44
|
||||
str r3, [sp, 0x34]
|
||||
cmp r6, r10
|
||||
bge _0807B53C
|
||||
mov r3, sp
|
||||
mov r4, sp
|
||||
adds r4, 0xA
|
||||
add r7, sp, 0x8
|
||||
_0807B4FC:
|
||||
lsls r0, r6, 3
|
||||
add r2, sp, 0x4
|
||||
adds r2, r0
|
||||
ldr r1, _0807B598
|
||||
lsls r0, r6, 2
|
||||
adds r0, r1
|
||||
ldr r1, [r0]
|
||||
add r1, r8
|
||||
movs r0, 0x7
|
||||
ands r1, r0
|
||||
str r1, [r2]
|
||||
mov r0, r9
|
||||
adds r2, r4, 0
|
||||
str r3, [sp, 0x38]
|
||||
bl CanMoveForward
|
||||
strb r0, [r7, 0x1]
|
||||
lsls r0, 24
|
||||
ldr r3, [sp, 0x38]
|
||||
cmp r0, 0
|
||||
bne _0807B532
|
||||
ldrb r0, [r4]
|
||||
cmp r0, 0
|
||||
bne _0807B532
|
||||
movs r0, 0x1
|
||||
strb r0, [r3, 0x10]
|
||||
strb r0, [r3, 0x8]
|
||||
_0807B532:
|
||||
adds r4, 0x8
|
||||
adds r7, 0x8
|
||||
adds r6, 0x1
|
||||
cmp r6, r10
|
||||
blt _0807B4FC
|
||||
_0807B53C:
|
||||
movs r6, 0x1
|
||||
cmp r6, r10
|
||||
bge _0807B56E
|
||||
adds r3, r5, 0
|
||||
adds r3, 0x79
|
||||
add r1, sp, 0x8
|
||||
movs r4, 0x8
|
||||
movs r7, 0x1
|
||||
_0807B54C:
|
||||
adds r2, r4, 0
|
||||
ldrb r0, [r1, 0x1]
|
||||
cmp r0, 0
|
||||
beq _0807B55A
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0
|
||||
bne _0807B5A0
|
||||
_0807B55A:
|
||||
ldrb r0, [r1, 0x2]
|
||||
cmp r0, 0
|
||||
beq _0807B562
|
||||
strb r7, [r3]
|
||||
_0807B562:
|
||||
adds r1, 0x8
|
||||
adds r4, r2, 0
|
||||
adds r4, 0x8
|
||||
adds r6, 0x1
|
||||
cmp r6, r10
|
||||
blt _0807B54C
|
||||
_0807B56E:
|
||||
ldr r0, [sp, 0x34]
|
||||
movs r1, 0x1
|
||||
bl SetAction
|
||||
ldr r1, _0807B59C
|
||||
adds r0, r5, r1
|
||||
movs r1, 0
|
||||
movs r2, 0x1
|
||||
strb r2, [r0]
|
||||
ldrb r0, [r5, 0x7]
|
||||
cmp r0, 0
|
||||
beq _0807B5BC
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x79
|
||||
strb r1, [r0]
|
||||
movs r2, 0xA2
|
||||
lsls r2, 1
|
||||
adds r0, r5, r2
|
||||
strb r1, [r0]
|
||||
b _0807B5CE
|
||||
.align 2, 0
|
||||
_0807B598: .4byte gFaceDirectionIncrements
|
||||
_0807B59C: .4byte 0x00000147
|
||||
_0807B5A0:
|
||||
movs r3, 0x2
|
||||
ldrsh r1, [r5, r3]
|
||||
ldr r0, [sp, 0x34]
|
||||
bl SetWalkAction
|
||||
add r0, sp, 0x4
|
||||
adds r0, r4
|
||||
ldr r0, [r0]
|
||||
movs r1, 0x7
|
||||
ands r0, r1
|
||||
adds r1, r5, 0
|
||||
adds r1, 0x46
|
||||
strb r0, [r1]
|
||||
b _0807B5CE
|
||||
_0807B5BC:
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x79
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _0807B5CE
|
||||
movs r1, 0xA2
|
||||
lsls r1, 1
|
||||
adds r0, r5, r1
|
||||
strb r2, [r0]
|
||||
_0807B5CE:
|
||||
add sp, 0x3C
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end DecideMovement
|
||||
|
||||
.align 2, 0
|
||||
1478
asm/code_808333C.s
1478
asm/code_808333C.s
File diff suppressed because it is too large
Load Diff
1437
asm/code_8083654.s
Normal file
1437
asm/code_8083654.s
Normal file
File diff suppressed because it is too large
Load Diff
9
include/dungeon_ai_leader.h
Normal file
9
include/dungeon_ai_leader.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef GUARD_DUNGEON_AI_LEADER_H
|
||||
#define GUARD_DUNGEON_AI_LEADER_H
|
||||
|
||||
#include "dungeon_entity.h"
|
||||
|
||||
bool8 TargetLeader(struct DungeonEntity *pokemon);
|
||||
struct DungeonEntity* GetLeaderEntityIfVisible(struct DungeonEntity *pokemon);
|
||||
|
||||
#endif
|
||||
@@ -5,5 +5,6 @@
|
||||
|
||||
void MoveIfPossible(struct DungeonEntity *pokemon, bool8 showRunAwayEffect);
|
||||
bool8 CanTakeItem(struct DungeonEntity *pokemon);
|
||||
bool8 ChooseTargetPosition(struct DungeonEntity *pokemon);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define MAX_MOVEMENT_SPEED 4
|
||||
#define MAX_STOCKPILE_COUNT 3
|
||||
#define NUM_SPEED_TURN_COUNTERS 5
|
||||
#define NUM_PREVIOUS_POSITIONS 4
|
||||
|
||||
#define STAT_STAGE_ATTACK 0
|
||||
#define STAT_STAGE_SPECIAL_ATTACK 1
|
||||
@@ -85,16 +86,13 @@ struct DungeonEntityData
|
||||
/* 0x5E */ u8 abilities[2];
|
||||
/* 0x60 */ struct ItemSlot heldItem;
|
||||
u8 fill64[0x68 - 0x64];
|
||||
/* 0x68 */ struct Position previousPosition1;
|
||||
/* 0x6C */ struct Position previousPosition2;
|
||||
/* 0x70 */ struct Position previousPosition3;
|
||||
/* 0x74 */ struct Position previousPosition4;
|
||||
/* 0x68 */ struct Position previousPositions[NUM_PREVIOUS_POSITIONS];
|
||||
/* 0x78 */ u8 movementAction;
|
||||
/* 0x79 */ bool8 notAdjacentToTarget;
|
||||
/* 0x7A */ bool8 hasTarget;
|
||||
/* 0x7B */ bool8 turnAround;
|
||||
/* 0x7C */ u16 targetPokemonSpawnIndex;
|
||||
/* 0x80 */ u32 targetPokemon;
|
||||
/* 0x80 */ struct DungeonEntity *targetPokemon;
|
||||
u8 fill84[0x88 - 0x84];
|
||||
/* 0x88 */ struct Position targetMovePosition;
|
||||
// Bitwise flags corresponding to selected IQ skills.
|
||||
@@ -183,9 +181,9 @@ struct DungeonEntityData
|
||||
/* 0x10D */ u8 slowTurnsLeft[NUM_SPEED_TURN_COUNTERS];
|
||||
/* 0x112 */ u8 stockpileCount;
|
||||
u8 fill113;
|
||||
// When true, an AI Pokémon will move in a random direction every turn.
|
||||
// When non-zero, an AI Pokémon will move in a random direction every turn.
|
||||
// Unclear where this is set in-game; it is not set by statuses (e.g., confusion) or mission clients.
|
||||
/* 0x114 */ bool8 moveRandomly;
|
||||
/* 0x114 */ u32 moveRandomly;
|
||||
/* 0x118 */ struct PokemonMove moves[MAX_MON_MOVES];
|
||||
/* 0x138 */ u8 struggleMoveFlags;
|
||||
/* 0x13C */ u32 belly;
|
||||
@@ -291,7 +289,9 @@ enum EntityType
|
||||
ENTITY_NONE,
|
||||
ENTITY_POKEMON,
|
||||
ENTITY_TRAP,
|
||||
ENTITY_ITEM
|
||||
ENTITY_ITEM,
|
||||
ENTITY_UNK_4,
|
||||
ENTITY_UNK_5,
|
||||
};
|
||||
|
||||
enum MovementFlag
|
||||
|
||||
6
include/dungeon_leader.h
Normal file
6
include/dungeon_leader.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef GUARD_DUNGEON_LEADER_H
|
||||
#define GUARD_DUNGEON_LEADER_H
|
||||
|
||||
struct DungeonEntity* GetLeaderEntity();
|
||||
|
||||
#endif
|
||||
8
include/dungeon_movement_1.h
Normal file
8
include/dungeon_movement_1.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef GUARD_DUNGEON_MOVEMENT_1_H
|
||||
#define GUARD_DUNGEON_MOVEMENT_1_H
|
||||
|
||||
#include "dungeon_entity.h"
|
||||
|
||||
bool8 CanCrossWalls(struct DungeonEntity *pokemon);
|
||||
|
||||
#endif
|
||||
@@ -102,13 +102,13 @@ u16 GetItemMove(u8 index);
|
||||
bool8 CanSellItem(u32 id);
|
||||
bool8 IsGummiItem(u8);
|
||||
void xxx_init_unk230_substruct(u8);
|
||||
bool8 xxx_insert_unk230_80919FC(u8);
|
||||
bool8 AddGreenKecleonShopItem(u8);
|
||||
struct HeldItem *xxx_get_inv_unk230_at_809185C(u8);
|
||||
void xxx_fill_unk230_gaps();
|
||||
struct HeldItem* xxx_get_unk250_at_8091A90(u8);
|
||||
s32 xxx_count_inv_unk230();
|
||||
u32 xxx_count_non_empty_inv_unk250_8091A48();
|
||||
void sub_8091BB4(u8);
|
||||
void ChoosePurpleKecleonShopInventory(u8);
|
||||
void sub_8090F58(void*, u8 *, struct ItemSlot *, struct unkStruct_8090F58*);
|
||||
void ShiftItemsDownFrom(s32 start);
|
||||
void ClearItemSlotAt(u32 index);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef GUARD_POKEMON_3_H
|
||||
#define GUARD_POKEMON_3_H
|
||||
|
||||
bool8 TacticsTargetLeader(u8 tactic);
|
||||
bool8 HasIQForSkill(s32 pokeIQ, u8 IQSkillIndex);
|
||||
void SetIQSkill(u8 *param_1, u32 skillIndex);
|
||||
bool8 IsIQSkillSet(u8 *IQSkillsEnabled, u32 IQSkill);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
bool8 HasNegativeStatus(struct DungeonEntity *pokemon);
|
||||
bool8 IsSleeping(struct DungeonEntity *pokemon);
|
||||
bool8 HasQuarterHPOrLess(struct DungeonEntity* pokemon);
|
||||
bool8 HasQuarterHPOrLess(struct DungeonEntity *pokemon);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
|
||||
#include "dungeon_entity.h"
|
||||
|
||||
u8 GetWeather(struct DungeonEntity* pokemon);
|
||||
u8 GetWeather(struct DungeonEntity *pokemon);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -232,6 +232,8 @@ SECTIONS {
|
||||
asm/code_80701A4.o(.text);
|
||||
src/dungeon_movement.o(.text);
|
||||
asm/code_807034C.o(.text);
|
||||
src/dungeon_movement_1.o(.text);
|
||||
asm/code_807049C.o(.text);
|
||||
src/status_checks_1.o(.text);
|
||||
src/dungeon_capabilities.o(.text);
|
||||
asm/code_8070BC0.o(.text);
|
||||
@@ -240,6 +242,8 @@ SECTIONS {
|
||||
src/dungeon_ai_targeting.o(.text);
|
||||
src/dungeon_pokemon_attributes.o(.text);
|
||||
asm/code_80718D8.o(.text);
|
||||
src/dungeon_ai_leader.o(.text);
|
||||
asm/code_8072CF4.o(.text);
|
||||
src/dungeon_ai_items.o(.text);
|
||||
src/code_8073CF0.o(.text);
|
||||
asm/code_8073CF0.o(.text);
|
||||
@@ -250,7 +254,7 @@ SECTIONS {
|
||||
src/code_8077274_1.o(.text);
|
||||
asm/code_8077274_1.o(.text);
|
||||
src/dungeon_ai_movement.o(.text);
|
||||
asm/code_807AEBC.o(.text);
|
||||
asm/code_807B2D8.o(.text);
|
||||
src/dungeon_ai_movement_1.o(.text);
|
||||
src/dungeon_ai_attack.o(.text);
|
||||
asm/code_807CABC.o(.text);
|
||||
@@ -264,6 +268,8 @@ SECTIONS {
|
||||
src/code_8083288.o(.text);
|
||||
src/dungeon_range.o(.text);
|
||||
asm/code_808333C.o(.text);
|
||||
src/dungeon_leader.o(.text);
|
||||
asm/code_8083654.o(.text);
|
||||
src/dungeon_random.o(.text);
|
||||
src/code_808417C.o(.text);
|
||||
asm/code_808417C.o(.text);
|
||||
|
||||
@@ -70,7 +70,7 @@ extern void sub_80961B4();
|
||||
extern void ClearAllItems_8091FB4();
|
||||
extern const char *sub_80A2B18(s16);
|
||||
extern u8 sub_8001CC4(u8, u8, u8);
|
||||
extern void xxx_inv_unk250_random_8091980(u32);
|
||||
extern void ChooseKecleonShopInventory(u32);
|
||||
extern u8 sub_80023E4(u32);
|
||||
extern void FadeOutAllMusic(u16);
|
||||
extern u8 sub_809C730();
|
||||
@@ -175,7 +175,7 @@ void sub_8098CC8(void)
|
||||
{
|
||||
temp = 3;
|
||||
}
|
||||
xxx_inv_unk250_random_8091980(temp);
|
||||
ChooseKecleonShopInventory(temp);
|
||||
sub_809674C();
|
||||
sub_80961B4();
|
||||
ClearAllItems_8091FB4();
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "dungeon_ai_movement.h"
|
||||
#include "dungeon_capabilities_1.h"
|
||||
#include "dungeon_global_data.h"
|
||||
#include "dungeon_leader.h"
|
||||
#include "dungeon_pokemon_attributes.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "dungeon_util.h"
|
||||
@@ -41,7 +42,6 @@ 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();
|
||||
extern u8 sub_8075CFC(struct DungeonEntity *, struct DungeonEntity *, u32, u32);
|
||||
extern void sub_8041AF4(struct DungeonEntity *);
|
||||
extern void sub_80522F4(struct DungeonEntity *r1, struct DungeonEntity *r2, u8 *);
|
||||
@@ -70,8 +70,8 @@ u32 sub_8075818(struct DungeonEntity *entity)
|
||||
{
|
||||
case ENTITY_NONE:
|
||||
case ENTITY_POKEMON:
|
||||
case 4:
|
||||
case 5:
|
||||
case ENTITY_UNK_4:
|
||||
case ENTITY_UNK_5:
|
||||
break;
|
||||
case ENTITY_TRAP:
|
||||
trapData = (u8*) GetTrapData(subEntity);
|
||||
@@ -300,7 +300,7 @@ u8 sub_8075BF4(struct DungeonEntity * pokemon, s32 sleepTurns)
|
||||
{
|
||||
struct DungeonEntityData *entityData;
|
||||
u32 uVar4;
|
||||
|
||||
|
||||
uVar4 = 0;
|
||||
if (!EntityExists(pokemon)){
|
||||
return uVar4;
|
||||
@@ -331,7 +331,7 @@ void sub_8075C58(struct DungeonEntity * pokemon, struct DungeonEntity * target,
|
||||
{
|
||||
u8 sleepStatus;
|
||||
u8 cVar2;
|
||||
|
||||
|
||||
|
||||
if (sub_8075CFC(pokemon,target,1,param_4) == '\0') {
|
||||
sleepStatus = target->entityData->sleepStatus;
|
||||
|
||||
@@ -280,7 +280,7 @@ void FindStraightThrowableTargets(struct DungeonEntity *pokemon, s32 thrownAIFla
|
||||
}
|
||||
for (i = 0; i < DUNGEON_MAX_POKEMON; i++)
|
||||
{
|
||||
struct DungeonEntity* targetPokemon = gDungeonGlobalData->allPokemon[i];
|
||||
struct DungeonEntity *targetPokemon = gDungeonGlobalData->allPokemon[i];
|
||||
if (EntityExists(targetPokemon) && pokemon != targetPokemon)
|
||||
{
|
||||
s32 targetingFlags;
|
||||
@@ -317,7 +317,7 @@ void FindRockItemTargets(struct DungeonEntity *pokemon, struct ItemSlot *item, s
|
||||
gNumPotentialTargets = 0;
|
||||
for (i = 0; i < DUNGEON_MAX_POKEMON; i++)
|
||||
{
|
||||
struct DungeonEntity* targetPokemon = gDungeonGlobalData->allPokemon[i];
|
||||
struct DungeonEntity *targetPokemon = gDungeonGlobalData->allPokemon[i];
|
||||
if (EntityExists(targetPokemon) && pokemon != targetPokemon &&
|
||||
CanSee(pokemon, targetPokemon) && CanTarget(pokemon, targetPokemon, FALSE, TRUE) == TARGET_CAPABILITY_CAN_TARGET)
|
||||
{
|
||||
|
||||
34
src/dungeon_ai_leader.c
Normal file
34
src/dungeon_ai_leader.c
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "global.h"
|
||||
#include "dungeon_ai_leader.h"
|
||||
|
||||
#include "constants/status.h"
|
||||
#include "constants/targeting.h"
|
||||
#include "dungeon_ai_targeting.h"
|
||||
#include "dungeon_leader.h"
|
||||
#include "dungeon_visibility.h"
|
||||
#include "pokemon_3.h"
|
||||
|
||||
bool8 TargetLeader(struct DungeonEntity *pokemon)
|
||||
{
|
||||
if (pokemon->entityData->isEnemy)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return TacticsTargetLeader(pokemon->entityData->tactic);
|
||||
}
|
||||
|
||||
struct DungeonEntity* GetLeaderEntityIfVisible(struct DungeonEntity *pokemon)
|
||||
{
|
||||
if (!pokemon->entityData->isEnemy)
|
||||
{
|
||||
struct DungeonEntity *leader = GetLeaderEntity();
|
||||
if (leader &&
|
||||
leader->entityData->waitingStatus != WAITING_STATUS_DECOY &&
|
||||
CanTarget(pokemon, leader, FALSE, FALSE) == TARGET_CAPABILITY_CANNOT_ATTACK &&
|
||||
CanSee_2(pokemon, leader))
|
||||
{
|
||||
return leader;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -3,19 +3,29 @@
|
||||
|
||||
#include "constants/direction.h"
|
||||
#include "constants/dungeon_action.h"
|
||||
#include "constants/status.h"
|
||||
#include "constants/targeting.h"
|
||||
#include "constants/tactic.h"
|
||||
#include "dungeon_action.h"
|
||||
#include "dungeon_capabilities_1.h"
|
||||
#include "dungeon_pokemon_attributes.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "dungeon_ai_leader.h"
|
||||
#include "dungeon_ai_movement_1.h"
|
||||
#include "dungeon_ai_targeting.h"
|
||||
#include "dungeon_capabilities_1.h"
|
||||
#include "dungeon_global_data.h"
|
||||
#include "dungeon_map_access.h"
|
||||
#include "dungeon_movement_1.h"
|
||||
#include "dungeon_pokemon_attributes.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "item.h"
|
||||
#include "number_util.h"
|
||||
#include "dungeon_visibility.h"
|
||||
#include "map.h"
|
||||
#include "number_util.h"
|
||||
#include "position_util.h"
|
||||
|
||||
#define INFINITY 999
|
||||
#define CHECK_VISIBILITY_DISTANCE 5
|
||||
#define CORRIDOR_VISIBILITY 2
|
||||
|
||||
extern bool8 ChooseTargetPosition(struct DungeonEntity *pokemon);
|
||||
extern void DecideMovement(struct DungeonEntity *pokemon, bool8 showRunAwayEffect);
|
||||
|
||||
void MoveIfPossible(struct DungeonEntity *pokemon, bool8 showRunAwayEffect)
|
||||
@@ -78,31 +88,254 @@ void MoveIfPossible(struct DungeonEntity *pokemon, bool8 showRunAwayEffect)
|
||||
|
||||
bool8 CanTakeItem(struct DungeonEntity *pokemon)
|
||||
{
|
||||
struct MapTile *mapTile;
|
||||
struct ItemSlot *item;
|
||||
struct DungeonEntity *mapEntity;
|
||||
struct DungeonEntityData *entityData;
|
||||
|
||||
entityData = pokemon->entityData;
|
||||
if (EntityExists(pokemon) && !CannotUseItems(pokemon)) {
|
||||
struct DungeonEntityData *pokemonData = pokemon->entityData;
|
||||
struct MapTile *mapTile;
|
||||
struct DungeonEntity *mapObject;
|
||||
if (!EntityExists(pokemon) || CannotUseItems(pokemon))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
mapTile = GetMapTileForDungeonEntity_2(pokemon);
|
||||
mapEntity = mapTile->mapObject;
|
||||
if (mapEntity != NULL) {
|
||||
switch(GetEntityType(mapEntity)) {
|
||||
mapObject = mapTile->mapObject;
|
||||
if (mapObject == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
switch (GetEntityType(mapObject))
|
||||
{
|
||||
case ENTITY_NONE:
|
||||
case ENTITY_POKEMON:
|
||||
case ENTITY_TRAP:
|
||||
case 4:
|
||||
case 5:
|
||||
case ENTITY_UNK_4:
|
||||
case ENTITY_UNK_5:
|
||||
break;
|
||||
case ENTITY_ITEM:
|
||||
if ((!entityData->isLeader && !(entityData->heldItem.itemFlags & ITEM_FLAG_EXISTS) &&
|
||||
((mapTile->tileType & (TILE_TYPE_FLOOR | TILE_TYPE_LIQUID)) || !entityData->isEnemy)) &&
|
||||
(item = GetItemData(mapEntity), !(item->itemFlags & ITEM_FLAG_FOR_SALE))) {
|
||||
if (!pokemonData->isLeader &&
|
||||
!(pokemonData->heldItem.itemFlags & ITEM_FLAG_EXISTS) &&
|
||||
((mapTile->tileType & (TILE_TYPE_FLOOR | TILE_TYPE_LIQUID)) || !pokemonData->isEnemy) &&
|
||||
!(GetItemData(mapObject)->itemFlags & ITEM_FLAG_FOR_SALE))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 ChooseTargetPosition(struct DungeonEntity *pokemon)
|
||||
{
|
||||
struct DungeonEntityData *pokemonData = pokemon->entityData;
|
||||
if (!TargetLeader(pokemon))
|
||||
{
|
||||
struct DungeonEntity **possibleTargets;
|
||||
s32 maxPossibleTargets;
|
||||
s32 targetIndex;
|
||||
bool8 canCrossWalls;
|
||||
s32 targetDistance;
|
||||
s32 i;
|
||||
if (gDungeonGlobalData->decoyActive)
|
||||
{
|
||||
possibleTargets = gDungeonGlobalData->allPokemon;
|
||||
maxPossibleTargets = DUNGEON_MAX_POKEMON;
|
||||
}
|
||||
else if (pokemonData->isEnemy)
|
||||
{
|
||||
possibleTargets = gDungeonGlobalData->teamPokemon;
|
||||
maxPossibleTargets = MAX_TEAM_MEMBERS;
|
||||
}
|
||||
else
|
||||
{
|
||||
possibleTargets = gDungeonGlobalData->wildPokemon;
|
||||
maxPossibleTargets = DUNGEON_MAX_WILD_POKEMON;
|
||||
}
|
||||
canCrossWalls = CanCrossWalls(pokemon);
|
||||
targetIndex = -1;
|
||||
targetDistance = INFINITY;
|
||||
for (i = 0; i < maxPossibleTargets; i++)
|
||||
{
|
||||
struct DungeonEntity *target = possibleTargets[i];
|
||||
if (EntityExists(target) && target->entityData->clientType == CLIENT_TYPE_NONE)
|
||||
{
|
||||
if (gDungeonGlobalData->decoyActive)
|
||||
{
|
||||
if (CanTarget(pokemon, target, FALSE, TRUE) != TARGET_CAPABILITY_CAN_TARGET)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (!pokemonData->isEnemy && target->entityData->immobilizeStatus == IMMOBILIZE_STATUS_PETRIFIED)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (target->entityData->shopkeeperMode != SHOPKEEPER_FRIENDLY)
|
||||
{
|
||||
s32 currentDistance;
|
||||
if (canCrossWalls)
|
||||
{
|
||||
s32 distance = pokemon->posWorld.x - target->posWorld.x;
|
||||
if (distance < 0)
|
||||
{
|
||||
distance = -distance;
|
||||
}
|
||||
if (distance > CHECK_VISIBILITY_DISTANCE)
|
||||
{
|
||||
goto checkCanSee;
|
||||
}
|
||||
distance = pokemon->posWorld.y - target->posWorld.y;
|
||||
if (distance < 0)
|
||||
{
|
||||
distance = -distance;
|
||||
}
|
||||
if (distance > CHECK_VISIBILITY_DISTANCE)
|
||||
{
|
||||
goto checkCanSee;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
checkCanSee:
|
||||
if (!CanSee_2(pokemon, target))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
currentDistance = GetDistance(&pokemon->posWorld, &target->posWorld);
|
||||
if (targetDistance > currentDistance)
|
||||
{
|
||||
targetDistance = currentDistance;
|
||||
targetIndex = i;
|
||||
if (targetDistance < 2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (targetIndex > -1)
|
||||
{
|
||||
pokemonData->movementAction = MOVEMENT_ACTION_FOLLOW;
|
||||
pokemonData->targetMovePosition = possibleTargets[targetIndex]->posWorld;
|
||||
pokemonData->targetPokemon = possibleTargets[targetIndex];
|
||||
pokemonData->targetPokemonSpawnIndex = pokemonData->targetPokemon->spawnIndex;
|
||||
pokemonData->hasTarget = TRUE;
|
||||
pokemonData->moveRandomly = FALSE;
|
||||
if (HasTactic(pokemon, TACTIC_KEEP_YOUR_DISTANCE) && !CanSeeTeammate(pokemon))
|
||||
{
|
||||
s32 distanceX = pokemon->posWorld.x - possibleTargets[targetIndex]->posWorld.x;
|
||||
if (distanceX < 0)
|
||||
{
|
||||
distanceX = -distanceX;
|
||||
}
|
||||
if (distanceX < 2)
|
||||
{
|
||||
s32 distanceY = pokemon->posWorld.y - possibleTargets[targetIndex]->posWorld.y;
|
||||
if (distanceY < 0)
|
||||
{
|
||||
distanceY = -distanceY;
|
||||
}
|
||||
if (distanceY < 2)
|
||||
{
|
||||
pokemonData->turnAround = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
if (!HasTactic(pokemon, TACTIC_GO_THE_OTHER_WAY))
|
||||
{
|
||||
do
|
||||
{
|
||||
if (!pokemonData->isEnemy)
|
||||
{
|
||||
struct DungeonEntity *leader = GetLeaderEntityIfVisible(pokemon);
|
||||
if (EntityExists(leader))
|
||||
{
|
||||
pokemonData->movementAction = MOVEMENT_ACTION_FOLLOW;
|
||||
pokemonData->targetMovePosition = leader->posWorld;
|
||||
pokemonData->targetPokemon = leader;
|
||||
pokemonData->targetPokemonSpawnIndex = leader->spawnIndex;
|
||||
pokemonData->moveRandomly = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
}
|
||||
else if (pokemonData->isLeader)
|
||||
{
|
||||
// This item targeting code is never reached because the leader is never AI-controlled.
|
||||
u8 roomIndex;
|
||||
s32 minX, minY, maxX, maxY, x, y, maxY2;
|
||||
if (gDungeonGlobalData->visibility) {
|
||||
// Dead code.
|
||||
u8 a = -a;
|
||||
}
|
||||
roomIndex = GetMapTile_1(pokemon->posWorld.x, pokemon->posWorld.y)->roomIndex;
|
||||
if (roomIndex == CORRIDOR_ROOM_INDEX)
|
||||
{
|
||||
do
|
||||
{
|
||||
minX = pokemon->posWorld.x - CORRIDOR_VISIBILITY;
|
||||
minY = pokemon->posWorld.y - CORRIDOR_VISIBILITY;
|
||||
maxX = pokemon->posWorld.x + CORRIDOR_VISIBILITY;
|
||||
maxY = pokemon->posWorld.y + CORRIDOR_VISIBILITY;
|
||||
} while (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
struct MapRoom *room = &gDungeonGlobalData->roomData[roomIndex];
|
||||
minX = room->startX - 1;
|
||||
minY = room->startY - 1;
|
||||
maxX = room->endX + 1;
|
||||
maxY = room->endY + 1;
|
||||
}
|
||||
maxY2 = maxY;
|
||||
for (y = minY; y <= maxY2; y++)
|
||||
{
|
||||
for (x = minX; x <= maxX; x++)
|
||||
{
|
||||
struct DungeonEntity *mapObject = GetMapTile_2(x, y)->mapObject;
|
||||
if (mapObject && GetEntityType(mapObject) == ENTITY_ITEM)
|
||||
{
|
||||
pokemonData->movementAction = MOVEMENT_ACTION_TAKE_ITEM;
|
||||
pokemonData->targetMovePosition.x = x;
|
||||
pokemonData->targetMovePosition.y = y;
|
||||
pokemonData->targetPokemon = NULL;
|
||||
pokemonData->targetPokemonSpawnIndex = 0;
|
||||
pokemonData->moveRandomly = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((u8) (pokemonData->movementAction - 1) <= 1)
|
||||
{
|
||||
if (pokemonData->targetPokemon)
|
||||
{
|
||||
if (pokemonData->targetPokemon->spawnIndex == pokemonData->targetPokemonSpawnIndex)
|
||||
{
|
||||
struct DungeonEntityData *targetData = pokemonData->targetPokemon->entityData;
|
||||
s32 i;
|
||||
for (i = 0; i < NUM_PREVIOUS_POSITIONS; i++)
|
||||
{
|
||||
if (InSameRoom(pokemon, &targetData->previousPositions[i]))
|
||||
{
|
||||
pokemonData->movementAction = MOVEMENT_ACTION_WANDER;
|
||||
pokemonData->targetMovePosition = targetData->previousPositions[i];
|
||||
pokemonData->moveRandomly = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pokemonData->movementAction = MOVEMENT_ACTION_FACE_RANDOM_DIRECTION;
|
||||
pokemonData->targetPokemon = NULL;
|
||||
pokemonData->targetPokemonSpawnIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Wander(pokemon);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -177,42 +177,61 @@ bool8 CanMoveForward(struct DungeonEntity *pokemon, s32 direction, bool8 *pokemo
|
||||
|
||||
bool8 IsAtJunction(struct DungeonEntity *pokemon)
|
||||
{
|
||||
char cVar2;
|
||||
u32 crossableTerrain;
|
||||
struct MapTile *mapTile;
|
||||
struct DungeonEntityData *iVar7;
|
||||
|
||||
crossableTerrain = GetCrossableTerrain(pokemon->entityData->entityID);
|
||||
if (!IsFixedDungeon()) {
|
||||
if ((pokemon->entityData->transformStatus == TRANSFORM_STATUS_MOBILE) || (HasItem(pokemon, ITEM_ID_MOBILE_SCARF))) {
|
||||
crossableTerrain = CROSSABLE_TERRAIN_WALL;
|
||||
u32 crossableTerrain = GetCrossableTerrain(pokemon->entityData->entityID);
|
||||
if (!IsFixedDungeon())
|
||||
{
|
||||
if (pokemon->entityData->transformStatus == TRANSFORM_STATUS_MOBILE || HasItem(pokemon, ITEM_ID_MOBILE_SCARF))
|
||||
{
|
||||
crossableTerrain = CROSSABLE_TERRAIN_WALL;
|
||||
}
|
||||
else if (HasIQSkill(pokemon, IQ_SKILL_ALL_TERRAIN_HIKER))
|
||||
{
|
||||
crossableTerrain = CROSSABLE_TERRAIN_CREVICE;
|
||||
}
|
||||
else if (HasIQSkill(pokemon, IQ_SKILL_SUPER_MOBILE))
|
||||
{
|
||||
crossableTerrain = CROSSABLE_TERRAIN_WALL;
|
||||
}
|
||||
}
|
||||
else if (HasIQSkill(pokemon, IQ_SKILL_ALL_TERRAIN_HIKER)) {
|
||||
crossableTerrain = CROSSABLE_TERRAIN_CREVICE;
|
||||
}
|
||||
else if (HasIQSkill(pokemon, IQ_SKILL_SUPER_MOBILE)) {
|
||||
crossableTerrain = CROSSABLE_TERRAIN_WALL;
|
||||
}
|
||||
}
|
||||
if (crossableTerrain == CROSSABLE_TERRAIN_WALL) {
|
||||
iVar7 = pokemon->entityData;
|
||||
iVar7->mobileTurnTimer += DungeonRandomCapped(100);
|
||||
if (iVar7->mobileTurnTimer < 200) {
|
||||
return FALSE;
|
||||
if (crossableTerrain == CROSSABLE_TERRAIN_WALL)
|
||||
{
|
||||
struct DungeonEntityData *pokemonData = pokemon->entityData;
|
||||
pokemonData->mobileTurnTimer += DungeonRandomCapped(100);
|
||||
if (pokemonData->mobileTurnTimer < 200)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
pokemonData->mobileTurnTimer = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
iVar7->mobileTurnTimer = 0;
|
||||
}
|
||||
else {
|
||||
if ((gDungeonWaterType[gDungeonGlobalData->tileset] == DUNGEON_WATER_TYPE_LAVA)
|
||||
&& (crossableTerrain == CROSSABLE_TERRAIN_LIQUID)
|
||||
&& (HasIQSkill(pokemon, IQ_SKILL_LAVA_EVADER))) {
|
||||
crossableTerrain = CROSSABLE_TERRAIN_REGULAR;
|
||||
{
|
||||
struct MapTile *mapTile;
|
||||
char canMoveAdjacent;
|
||||
if (gDungeonWaterType[gDungeonGlobalData->tileset] == DUNGEON_WATER_TYPE_LAVA
|
||||
&& crossableTerrain == CROSSABLE_TERRAIN_LIQUID
|
||||
&& HasIQSkill(pokemon, IQ_SKILL_LAVA_EVADER))
|
||||
{
|
||||
crossableTerrain = CROSSABLE_TERRAIN_REGULAR;
|
||||
}
|
||||
mapTile = GetMapTile_1(pokemon->posWorld.x, pokemon->posWorld.y);
|
||||
canMoveAdjacent = mapTile->canMoveAdjacent[crossableTerrain];
|
||||
/*
|
||||
Check for configurations of open tiles that are considered junctions; i.e., shaped like a 'T' or '+'.
|
||||
X=Wall, O=Open
|
||||
|
||||
0x54 0x51 0x45 0x15 0x55
|
||||
XOX XOX XXX XOX XOX
|
||||
OOO OOX OOO XOO OOO
|
||||
XXX XOX XOX XOX XOX
|
||||
*/
|
||||
if (canMoveAdjacent != 0x54 && canMoveAdjacent != 0x51 && canMoveAdjacent != 0x45 && canMoveAdjacent != 0x15 && canMoveAdjacent != 0x55)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
mapTile = GetMapTile_1(pokemon->posWorld.x, pokemon->posWorld.y);
|
||||
cVar2 = mapTile->canMoveAdjacent[crossableTerrain];
|
||||
if ((cVar2 != 0x54) && (cVar2 != 0x51) && (cVar2 != 0x45) && (cVar2 != 0x15) && (cVar2 != 0x55)) return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
#include "dungeon_items.h"
|
||||
|
||||
#include "dungeon_capabilities.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "dungeon_global_data.h"
|
||||
#include "dungeon_leader.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "team_inventory.h"
|
||||
#include "pokemon.h"
|
||||
@@ -18,7 +19,6 @@ extern u8 *gUnknown_8105434[];
|
||||
|
||||
extern u8 sub_8046D70(void);
|
||||
extern s32 sub_8052B8C(u32, u8 *, u32);
|
||||
extern struct DungeonEntity *GetLeaderEntity(void);
|
||||
extern void sub_80861A8(void);
|
||||
extern void PrintFieldMessage(u32, u8 *, u32);
|
||||
extern void sub_803E708(u32, u32);
|
||||
@@ -103,7 +103,7 @@ void MusicBoxCreation(void)
|
||||
struct DungeonEntity *entity;
|
||||
|
||||
s32 indexes[3];
|
||||
|
||||
|
||||
createMusicBox = FALSE;
|
||||
do {
|
||||
musicBoxOnce = FALSE;
|
||||
|
||||
27
src/dungeon_leader.c
Normal file
27
src/dungeon_leader.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "global.h"
|
||||
#include "dungeon_leader.h"
|
||||
|
||||
#include "dungeon_global_data.h"
|
||||
#include "dungeon_util.h"
|
||||
|
||||
extern struct DungeonEntity *gLeaderPokemon;
|
||||
|
||||
struct DungeonEntity* GetLeaderEntity()
|
||||
{
|
||||
struct DungeonEntity *leader = gLeaderPokemon;
|
||||
if (leader == NULL)
|
||||
{
|
||||
s32 i;
|
||||
for (i = 0; i < MAX_TEAM_MEMBERS; i++)
|
||||
{
|
||||
struct DungeonEntity *currentPokemon = gDungeonGlobalData->teamPokemon[i];
|
||||
if (EntityExists(currentPokemon) && currentPokemon->entityData->isLeader)
|
||||
{
|
||||
gLeaderPokemon = currentPokemon;
|
||||
return currentPokemon;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return leader;
|
||||
}
|
||||
27
src/dungeon_movement_1.c
Normal file
27
src/dungeon_movement_1.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "global.h"
|
||||
#include "dungeon_movement_1.h"
|
||||
|
||||
#include "constants/item.h"
|
||||
#include "constants/status.h"
|
||||
#include "dungeon_items.h"
|
||||
#include "dungeon_movement.h"
|
||||
#include "map.h"
|
||||
|
||||
bool8 CanCrossWalls(struct DungeonEntity *pokemon)
|
||||
{
|
||||
struct DungeonEntityData *pokemonData = pokemon->entityData;
|
||||
struct DungeonEntityData *pokemonData2 = pokemonData;
|
||||
if (pokemonData2->transformStatus == TRANSFORM_STATUS_MOBILE)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
if (HasItem(pokemon, ITEM_ID_MOBILE_SCARF))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
if (GetCrossableTerrain(pokemonData2->entityID) == CROSSABLE_TERRAIN_WALL)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
37
src/items.c
37
src/items.c
@@ -13,6 +13,9 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#define GREEN_KECLEON_SHOP_SIZE 8
|
||||
#define PURPLE_KECLEON_SHOP_SIZE 4
|
||||
|
||||
extern struct TeamInventory *gTeamInventory_203B460;
|
||||
extern struct TeamInventory gUnknown_20389A8;
|
||||
extern struct FileArchive gSystemFileArchive;
|
||||
@@ -46,8 +49,8 @@ extern void sub_80078A4(u32, u32, u32, u32, u32);
|
||||
extern void sub_80073E0(u32);
|
||||
extern void xxx_format_and_draw(u32, u32, const u8 *, u32, u32);
|
||||
extern s32 sub_8091E94(s32 a1, s32 a2, s32 a3);
|
||||
extern void xxx_sort_inv_unk230_80918EC();
|
||||
bool8 xxx_insert_unk250_8091C1C(u8);
|
||||
extern void SortGreenKecleonShopInventory();
|
||||
bool8 AddPurpleKecleonShopItem(u8);
|
||||
|
||||
void LoadItemParameters(void)
|
||||
{
|
||||
@@ -1014,7 +1017,7 @@ void xxx_fill_unk230_gaps()
|
||||
}
|
||||
}
|
||||
|
||||
void xxx_sort_inv_unk230_80918EC() {
|
||||
void SortGreenKecleonShopInventory() {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 7; i++) {
|
||||
@@ -1031,24 +1034,24 @@ void xxx_sort_inv_unk230_80918EC() {
|
||||
}
|
||||
}
|
||||
|
||||
void xxx_inv_unk250_random_8091980(u8 a1) {
|
||||
void ChooseKecleonShopInventory(u8 a1) {
|
||||
u32 data[4];
|
||||
s32 i;
|
||||
|
||||
memcpy(data, gUnknown_81097E8, 4 * sizeof(u32));
|
||||
for (i = 0; i < 8; i++) {
|
||||
for (i = 0; i < GREEN_KECLEON_SHOP_SIZE; i++) {
|
||||
xxx_init_unk230_substruct(i);
|
||||
}
|
||||
for (i = 0; i < 8; i++) {
|
||||
for (i = 0; i < GREEN_KECLEON_SHOP_SIZE; i++) {
|
||||
s32 rand_1 = RandomCapped(9999);
|
||||
s32 rand_2 = RandomCapped(9999);
|
||||
xxx_insert_unk230_80919FC(sub_8091E94(data[a1], rand_1, rand_2));
|
||||
AddGreenKecleonShopItem(sub_8091E94(data[a1], rand_1, rand_2));
|
||||
}
|
||||
xxx_sort_inv_unk230_80918EC();
|
||||
sub_8091BB4(a1);
|
||||
SortGreenKecleonShopInventory();
|
||||
ChoosePurpleKecleonShopInventory(a1);
|
||||
}
|
||||
|
||||
bool8 xxx_insert_unk230_80919FC(u8 itemIndex) {
|
||||
bool8 AddGreenKecleonShopItem(u8 itemIndex) {
|
||||
struct HeldItem held;
|
||||
s32 i;
|
||||
|
||||
@@ -1113,7 +1116,7 @@ void xxx_fill_inv_unk250_gaps_8091AA8(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void xxx_sort_inv_unk250_8091B20() {
|
||||
void SortPurpleKecleonShopInventory() {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
@@ -1130,23 +1133,23 @@ void xxx_sort_inv_unk250_8091B20() {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_8091BB4(u8 index) {
|
||||
void ChoosePurpleKecleonShopInventory(u8 index) {
|
||||
u32 data[4];
|
||||
s32 i;
|
||||
|
||||
memcpy(data, gUnknown_81097F8, 4 * sizeof(u32));
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < PURPLE_KECLEON_SHOP_SIZE; i++) {
|
||||
xxx_init_inv_unk250_at_8091A74(i);
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < PURPLE_KECLEON_SHOP_SIZE; i++) {
|
||||
s32 rand_1 = RandomCapped(9999);
|
||||
s32 rand_2 = RandomCapped(9999);
|
||||
xxx_insert_unk250_8091C1C(sub_8091E94(data[index], rand_1, rand_2));
|
||||
AddPurpleKecleonShopItem(sub_8091E94(data[index], rand_1, rand_2));
|
||||
}
|
||||
xxx_sort_inv_unk250_8091B20();
|
||||
SortPurpleKecleonShopInventory();
|
||||
}
|
||||
|
||||
bool8 xxx_insert_unk250_8091C1C(u8 itemIndex) {
|
||||
bool8 AddPurpleKecleonShopItem(u8 itemIndex) {
|
||||
struct HeldItem held;
|
||||
s32 i;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ extern u32 gIQSkillNames[];
|
||||
extern u32 gIQSkillDescriptions[];
|
||||
extern u32 gTacticsDescriptions[];
|
||||
extern u8 *gTactics[];
|
||||
extern u8 gTacticsTargetLeader[];
|
||||
extern bool8 gTacticsTargetLeader[];
|
||||
|
||||
extern s16 gReqTacticLvls[];
|
||||
extern s32 gReqIQSkillPts[];
|
||||
@@ -481,9 +481,9 @@ u32 GetTacticsDescription(u8 r0)
|
||||
return gTacticsDescriptions[r0];
|
||||
}
|
||||
|
||||
u8 TacticsTargetLeader(u8 r0)
|
||||
bool8 TacticsTargetLeader(u8 tactic)
|
||||
{
|
||||
return gTacticsTargetLeader[r0];
|
||||
return gTacticsTargetLeader[tactic];
|
||||
}
|
||||
|
||||
void GetAvailTacticsforLvl(u8 *tacticsBuffer, s32 pokeLevel)
|
||||
|
||||
@@ -171,7 +171,7 @@ bool8 IsSleeping(struct DungeonEntity *pokemon)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 HasQuarterHPOrLess(struct DungeonEntity* pokemon)
|
||||
bool8 HasQuarterHPOrLess(struct DungeonEntity *pokemon)
|
||||
{
|
||||
struct DungeonEntityData *pokemonData = pokemon->entityData;
|
||||
struct DungeonEntityData *pokemonData2 = pokemon->entityData;
|
||||
|
||||
@@ -11,7 +11,7 @@ extern void TriggerWeatherAbilities(void);
|
||||
extern void sub_807EAA0(u32, u32);
|
||||
void sub_807E5E4(u8);
|
||||
|
||||
u8 GetWeather(struct DungeonEntity* pokemon)
|
||||
u8 GetWeather(struct DungeonEntity *pokemon)
|
||||
{
|
||||
if (pokemon != NULL && HasItem(pokemon, ITEM_ID_WEATHER_BAND))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user