summaryrefslogtreecommitdiff
path: root/event/photo.asm
blob: fea57a3689f48e683cc87e0814062e736f395fc9 (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
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
UnownPrinter: ; 16be4
	ld a, [UnownDex]
	and a
	ret z

	ld a, [hInMenu]
	push af
	ld a, $1
	ld [hInMenu], a
	ld a, [Options]
	push af
	set NO_TEXT_SCROLL, a
	ld [Options], a
	call ClearBGPalettes
	call ClearTileMap

	ld de, UnownDexATile
	ld hl, VTiles1 tile $6f
	lb bc, BANK(UnownDexBTile), 1
	call Request1bpp

	ld de, UnownDexBTile
	ld hl, VTiles1 tile $75
	lb bc, BANK(UnownDexBTile), 1
	call Request1bpp

	hlcoord 0, 0
	lb bc, 3, 18
	call TextBox

	hlcoord 0, 5
	lb bc, 7, 7
	call TextBox

	hlcoord 0, 14
	lb bc, 2, 18
	call TextBox

	hlcoord 1, 2
	ld de, AlphRuinsStampString
	call PlaceString

	hlcoord 1, 16
	ld de, UnownDexDoWhatString
	call PlaceString

	hlcoord 10, 6
	ld de, UnownDexMenuString
	call PlaceString

	xor a
	ld [wJumptableIndex], a
	call .UpdateUnownFrontpic
	call WaitBGMap

	ld a, UNOWN
	ld [CurPartySpecies], a
	xor a
	ld [TempMonDVs], a
	ld [TempMonDVs + 1], a

	ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
	call GetSGBLayout
	call SetPalettes

.joy_loop
	call JoyTextDelay

	ld a, [hJoyPressed]
	and B_BUTTON
	jr nz, .pressed_b

	ld a, [hJoyPressed]
	and A_BUTTON
	jr nz, .pressed_a

	call .LeftRight
	call DelayFrame
	jr .joy_loop

.pressed_a
	ld a, [wJumptableIndex]
	push af
	callba PrintUnownStamp
	call RestartMapMusic
	pop af
	ld [wJumptableIndex], a
	jr .joy_loop

.pressed_b
	pop af
	ld [Options], a
	pop af
	ld [hInMenu], a
	call ReturnToMapFromSubmenu
	ret
; 16ca0

.LeftRight: ; 16ca0
	ld a, [hJoyLast]
	and D_RIGHT
	jr nz, .press_right
	ld a, [hJoyLast]
	and D_LEFT
	jr nz, .press_left
	ret

.press_left
	ld hl, wJumptableIndex
	ld a, [hl]
	and a
	jr nz, .wrap_around_left
	ld [hl], 26 + 1
.wrap_around_left
	dec [hl]
	jr .return

.press_right
	ld hl, wJumptableIndex
	ld a, [hl]
	cp 26
	jr c, .wrap_around_right
	ld [hl], -1
.wrap_around_right
	inc [hl]

.return
	call .UpdateUnownFrontpic
	ret
; 16cc8

.UpdateUnownFrontpic: ; 16cc8
	ld a, [wJumptableIndex]
	cp 26
	jr z, .vacant
	inc a
	ld [UnownLetter], a
	ld a, UNOWN
	ld [CurPartySpecies], a
	xor a
	ld [wBoxAlignment], a
	ld de, VTiles2
	predef GetFrontpic
	call .Load2bppToSRAM
	hlcoord 1, 6
	xor a
	ld [hGraphicStartTile], a
	lb bc, 7, 7
	predef PlaceGraphic
	ld de, VTiles2 tile $31
	callba RotateUnownFrontpic
	ret

.Load2bppToSRAM: ; 16cff
	ld a, [rSVBK]
	push af
	ld a, $6
	ld [rSVBK], a

	ld a, BANK(sScratch)
	call GetSRAMBank
	ld de, wDecompressScratch
	ld hl, sScratch
	ld a, [hROMBank]
	ld b, a
	ld c, $31
	call Get2bpp
	call CloseSRAM

	pop af
	ld [rSVBK], a
	ret

.vacant
	hlcoord 1, 6
	lb bc, 7, 7
	call ClearBox
	hlcoord 1, 9
	ld de, UnownDexVacantString
	call PlaceString
	xor a
	call GetSRAMBank
	ld hl, sScratch
	ld bc, $31 tiles
	xor a
	call ByteFill
	ld hl, VTiles2 tile $31
	ld de, sScratch
	ld c, $31
	ld a, [hROMBank]
	ld b, a
	call Get2bpp
	call CloseSRAM
	ld c, 20
	call DelayFrames
	ret
; 16d57

AlphRuinsStampString:
	db " ALPH RUINS STAMP@"

UnownDexDoWhatString:
	db "Do what?@"

UnownDexMenuString:
	db   "♂ PRINT"
	next "♀ CANCEL"
	next "← PREVIOUS"
	next "→ NEXT"
	db   "@"

UnownDexVacantString:
	db "VACANT@"
; 16d9c

UnownDexATile: ; 16d9c
INCBIN "gfx/unknown/bold_a.1bpp"
UnownDexBTile: ; 16da4
INCBIN "gfx/unknown/bold_b.1bpp"
; 16dac

PlaceUnownPrinterFrontpic: ; 16dac
	hlcoord 0, 0
	ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
	ld a, " "
	call ByteFill
	hlcoord 7, 11
	ld a, $31
	ld [hGraphicStartTile], a
	lb bc, 7, 7
	predef PlaceGraphic
	ret
; 16dc7

PhotoStudio: ; 16dc7
	ld hl, .Text_AskWhichMon
	call PrintText
	callba SelectMonFromParty
	jr c, .cancel
	ld a, [CurPartySpecies]
	cp EGG
	jr z, .egg

	ld hl, .Text_HoldStill
	call PrintText
	call DisableSpriteUpdates
	callba PrintPartymon
	call ReturnToMapWithSpeechTextbox
	ld a, [hPrinter]
	and a
	jr nz, .cancel
	ld hl, .Text_Presto
	jr .print_text

.cancel
	ld hl, .Text_NoPicture
	jr .print_text

.egg
	ld hl, .Text_Egg

.print_text
	call PrintText
	ret
; 16e04

.Text_AskWhichMon: ; 0x16e04
	; Which #MON should I photo- graph?
	text_jump UnknownText_0x1be024
	db "@"
; 0x16e09

.Text_HoldStill: ; 0x16e09
	; All righty. Hold still for a bit.
	text_jump UnknownText_0x1be047
	db "@"
; 0x16e0e

.Text_Presto: ; 0x16e0e
	; Presto! All done. Come again, OK?
	text_jump UnknownText_0x1be06a
	db "@"
; 0x16e13

.Text_NoPicture: ; 0x16e13
	; Oh, no picture? Come again, OK?
	text_jump UnknownText_0x1c0000
	db "@"
; 0x16e18

.Text_Egg: ; 0x16e18
	; An EGG? My talent is worth more…
	text_jump UnknownText_0x1c0021
	db "@"
; 0x16e1d