Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/engine/events/pewter_guys.asm
1271 views
1
PewterGuys:
2
ld hl, wSimulatedJoypadStatesEnd
3
ld a, [wSimulatedJoypadStatesIndex]
4
dec a ; this decrement causes it to overwrite the last byte before $FF in the list
5
ld [wSimulatedJoypadStatesIndex], a
6
ld d, 0
7
ld e, a
8
add hl, de
9
ld d, h
10
ld e, l
11
ld hl, PewterGuysCoordsTable
12
ld a, [wWhichPewterGuy]
13
add a
14
ld b, 0
15
ld c, a
16
add hl, bc
17
ld a, [hli]
18
ld h, [hl]
19
ld l, a
20
ld a, [wYCoord]
21
ld b, a
22
ld a, [wXCoord]
23
ld c, a
24
.findMatchingCoordsLoop
25
ld a, [hli]
26
cp b
27
jr nz, .nextEntry1
28
ld a, [hli]
29
cp c
30
jr nz, .nextEntry2
31
ld a, [hli]
32
ld h, [hl]
33
ld l, a
34
.copyMovementDataLoop
35
ld a, [hli]
36
cp $ff
37
ret z
38
ld [de], a
39
inc de
40
ld a, [wSimulatedJoypadStatesIndex]
41
inc a
42
ld [wSimulatedJoypadStatesIndex], a
43
jr .copyMovementDataLoop
44
.nextEntry1
45
inc hl
46
.nextEntry2
47
inc hl
48
inc hl
49
jr .findMatchingCoordsLoop
50
51
PewterGuysCoordsTable:
52
dw PewterMuseumGuyCoords
53
dw PewterGymGuyCoords
54
55
; these are the four coordinates of the spaces below, above, to the left and
56
; to the right of the museum guy, and pointers to different movements for
57
; the player to make to get positioned before the main movement.
58
PewterMuseumGuyCoords:
59
db 18, 27
60
dw .down
61
db 16, 27
62
dw .up
63
db 17, 26
64
dw .left
65
db 17, 28
66
dw .right
67
68
.down
69
db PAD_UP, PAD_UP, $ff
70
.up
71
db PAD_RIGHT, PAD_LEFT, $ff
72
.left
73
db PAD_UP, PAD_RIGHT, $ff
74
.right
75
db PAD_UP, PAD_LEFT, $ff
76
77
; these are the five coordinates which trigger the gym guy and pointers to
78
; different movements for the player to make to get positioned before the
79
; main movement
80
; $00 is a pause
81
PewterGymGuyCoords:
82
db 16, 34
83
dw .one
84
db 17, 35
85
dw .two
86
db 18, 37
87
dw .three
88
db 19, 37
89
dw .four
90
db 17, 36
91
dw .five
92
93
.one
94
db PAD_LEFT, PAD_DOWN, PAD_DOWN, PAD_RIGHT, $ff
95
.two
96
db PAD_LEFT, PAD_DOWN, PAD_RIGHT, PAD_LEFT, $ff
97
.three
98
db PAD_LEFT, PAD_LEFT, PAD_LEFT, $00, $00, $00, $00, $00, $00, $00, $00, $ff
99
.four
100
db PAD_LEFT, PAD_LEFT, PAD_UP, PAD_LEFT, $ff
101
.five
102
db PAD_LEFT, PAD_DOWN, PAD_LEFT, $00, $00, $00, $00, $00, $00, $00, $00, $ff
103
104