summaryrefslogtreecommitdiff
path: root/asm/code_80494EC.s
blob: a38b22be3789ebd7e91435074a6003706c73d799 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
	#include "asm/constants/gba_constants.inc"
  	#include "asm/macros.inc"

  	.syntax unified

  	.text
  
	thumb_func_start CanTargetAdjacentPokemon
CanTargetAdjacentPokemon:
	push {r4-r6,lr}
	adds r5, r0, 0
	movs r6, 0
_080494F2:
	movs r1, 0x4
	ldrsh r0, [r5, r1]
	ldr r1, _08049538
	lsls r2, r6, 2
	adds r2, r1
	movs r3, 0
	ldrsh r1, [r2, r3]
	adds r0, r1
	movs r3, 0x6
	ldrsh r1, [r5, r3]
	movs r3, 0x2
	ldrsh r2, [r2, r3]
	adds r1, r2
	bl GetMapTileAtPosition
	ldr r4, [r0, 0x10]
	cmp r4, 0
	beq _0804953C
	adds r0, r4, 0
	bl GetEntityType
	cmp r0, 0
	beq _0804953C
	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 _0804953C
	movs r0, 0x1
	b _08049544
	.align 2, 0
_08049538: .4byte gAdjacentTileOffsets
_0804953C:
	adds r6, 0x1
	cmp r6, 0x7
	ble _080494F2
	movs r0, 0
_08049544:
	pop {r4-r6}
	pop {r1}
	bx r1
	thumb_func_end CanTargetAdjacentPokemon

	.align 2, 0