-
Notifications
You must be signed in to change notification settings - Fork 0
/
game_input.asm
187 lines (169 loc) · 3.44 KB
/
game_input.asm
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
;Airaki! - FSE 2014
;Released under the GPL V3, see LICENSE.TXT
game_input:
ld a,(PAUSE_FLAG) ;Only allow going out of pause if we're already in pause
or a
jp nz,++++
ld a,(JOYP_ACTIVE)
bit 2,a
jr z,+ ;Select button: Special attack
ld a,(HAS_SPECIAL)
or a
jr z,+
ld a,(MCURSOR_SSEL)
ld hl,ssaction_lut
rst $30
call drawsskill
+:
ld a,(JOYP_ACTIVE)
bit 0,a
jr z,+ ;Button A: flip
ld a,(FLIP_FLAGS)
ld b,a
ld a,(NEED_CHECKMATCH)
or b
jr nz,+ ;Can't flip while flipping or animating panel
ld a,(ANIM_SHAKE)
or a
jr nz,+ ;Can't flip either if the panel is getting shaked up (regen)
ld a,1
ld (FLIP_TOSET),a ;User-initiated flip
call makeflip
+:
ld a,(JOYP_ACTIVE)
bit 1,a
jr z,+ ;Button B: Short=Change cursor, Long=Use shield
xor a
ld (B_COUNTER),a
+:
ld a,(JOYP_CURRENT)
bit 1,a
jr z,++
ld a,(B_COUNTER)
inc a
cp $FF
jr z,+++
ld (B_COUNTER),a
+++:
cp SHIELD_UP_DELAY
jr nz,+
ld a,(PLAYER_SH1)
or a
jr z,++
ld a,1
ld (SHIELD_UP),a
call loadplayer
++:
ld a,(JOYP_LAST)
ld b,a
ld a,(JOYP_CURRENT)
xor b
and b
bit 1,a ;Button B release
jr z,+
xor a
ld (SHIELD_UP),a
call loadplayer
ld a,(B_COUNTER)
cp SHIELD_UP_DELAY-1
jr nc,+
ld a,(FLIP_FLAGS)
dec a
jr z,+
dec a
jr z,+ ;Can't change cursor while flipping (1 or 2)
cp 4
jr z,+ ;Can't change cursor while reflip
call changecursor
+:
ld a,(FLIP_FLAGS) ;Can only move cursor if flags=0 (nothing) or >2 (moving), not flipping
or a
jr z,+
cp 2+1
jr nc,+
jp ++++
+:
ld a,(JOYP_ACTIVE)
bit 4,a ;Right
jr z,++
ld a,(CURSOR_MODE)
or a
jr nz,+
;H
ld a,(CURSOR_X)
cp 5
jr z,++
inc a
ld (CURSOR_X),a
ld hl,sfxdata_move
call sfx_play
jr ++
+:
;V
ld a,(CURSOR_X)
cp 6
jr z,++
inc a
ld (CURSOR_X),a
ld hl,sfxdata_move
call sfx_play
++:
ld a,(JOYP_ACTIVE)
bit 5,a ;Left
jr z,+
ld a,(CURSOR_X)
or a
jr z,+
dec a
ld (CURSOR_X),a
ld hl,sfxdata_move
call sfx_play
+:
ld a,(JOYP_ACTIVE)
bit 6,a ;Up
jr z,+
ld a,(CURSOR_Y)
or a
jr z,+
dec a
ld (CURSOR_Y),a
ld hl,sfxdata_move
call sfx_play
+:
ld a,(JOYP_ACTIVE)
bit 7,a ;Down
jr z,++
ld a,(CURSOR_MODE)
or a
jr nz,+
;H
ld a,(CURSOR_Y)
cp 8
jr z,++
inc a
ld (CURSOR_Y),a
ld hl,sfxdata_move
call sfx_play
jr ++
+:
;V
ld a,(CURSOR_Y)
cp 7
jr z,++
inc a
ld (CURSOR_Y),a
ld hl,sfxdata_move
call sfx_play
++:
++++:
ld a,(JOYP_ACTIVE)
bit 3,a
jr z,+ ;Start button
ld a,(PAUSE_FLAG)
or a
jp nz,exitpause
jp enterpause
+:
ret
text_pause:
.db "PAUSED",$FF