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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
|
First, I want to say that this tutorial is not mine. This tutorial was originally done by Mateo, I just adapted it to modern Pokered.
First thing you have to do is to add the graphics for the other gender: the front sprite, the back sprite, the walking sprites,the cycling sprites and the fishing sprites.I decided to use the name "Green" for the sprites.
Then insert them in these folders:
```diff
/pic/player/green.png (front sprite)
/pic/player/greenb.png(back sprite)
/gfx/sprites/green.png(walking sprites)
/gfx/sprites/green_bike.png(cycling sprites)
/gfx/overworld/green_fish_back.png
/gfx/overworld/green_fish_front.png
/gfx/overworld/green_fish_side.png
(fishing sprites)
```
Now we have to include the sprites.Open player.asm and add GreenPicFront:: INCBIN "gfx/player/green.pic" after RedPicFront. Then open gfx\pics.asm and add GreenPicBack:: INCBIN "gfx/player/greenb.pic" after VictreebelPicBack,
in order to prevent a bank overflow.
Then, open sprites.asm and add these lines of code:
```diff
RedBikeSprite:: INCBIN "gfx/sprites/red_bike.2bpp"
RedSprite:: INCBIN "gfx/sprites/red.2bpp"
+ GreenBikeSprite:: INCBIN "gfx/sprites/green_bike.2bpp"
+ GreenSprite:: INCBIN "gfx/sprites/green.2bpp"
```
This is done on a fresh install of Pokered so when attempting to compile all this the bank will overflow. Move 2 random sprites, for example, the last 2. So, we'll have this:
```diff
OldAmberSprite:: INCBIN "gfx/sprites/old_amber.2bpp"
GamblerAsleepSprite:: INCBIN "gfx/sprites/gambler_asleep.2bpp"
+ LoreleiSprite:: INCBIN "gfx/sprites/lorelei.2bpp"
+ SeelSprite:: INCBIN "gfx/sprites/seel.2bpp"
[...]
AgathaSprite:: INCBIN "gfx/sprites/agatha.2bpp"
BrunoSprite:: INCBIN "gfx/sprites/bruno.2bpp"
- LoreleiSprite:: INCBIN "gfx/sprites/lorelei.2bpp"
- SeelSprite:: INCBIN "gfx/sprites/seel.2bpp"
```
Open fishing.asm and add:
```diff
RedFishingTilesFront: INCBIN "gfx/overworld/red_fish_front.2bpp"
RedFishingTilesBack: INCBIN "gfx/overworld/red_fish_back.2bpp"
RedFishingTilesSide: INCBIN "gfx/overworld/red_fish_side.2bpp"
RedFishingRodTiles: INCBIN "gfx/overworld/fishing_rod.2bpp"
+ GreenFishingTilesFront: INCBIN "gfx/overworld/green_fish_front.2bpp"
+ GreenFishingTilesBack: INCBIN "gfx/overworld/green_fish_back.2bpp"
+ GreenFishingTilesSide: INCBIN "gfx/overworld/green_fish_side.2bpp"
```
Sadly, bank 1E is too big now, so I moved "engine/items/tm_prices.asm" to bank 1C.
```diff
INCLUDE "engine/gfx/palettes.asm"
INCLUDE "engine/menus/save.asm"
+ INCLUDE "engine/items/tm_prices.asm"
[...]
INCLUDE "engine/movie/evolution.asm"
INCLUDE "engine/overworld/elevator.asm"
- INCLUDE "engine/items/tm_prices.asm"
```
Alright! We included the graphics, but we need to make use of them, to add the option to be a girl.Open yes_no_menu_strings.asm . We'll make use of an unused menu for the Boy/Girl option.
```diff
two_option_menu 4, 3, FALSE, .YesNoMenu
- two_option_menu 6, 3, FALSE, .NorthWestMenu
+ two_option_menu 5, 3, FALSE, .BoyGirlMenu
```
The numbers are the sizes for the menu. So in order for the menu to fit in the screen we decreased the number from 6 to 5. Also let's add the text for the options.
```diff
.YesNoMenu:
db "YES"
next "NO@"
- .NorthWestMenu:
- db "NORTH"
- next "WEST@"
+ .BoyGirlMenu:
+ db "BOY"
+ next "GIRL@"
```
Open wram.asm and edit:
```diff
wGameProgressFlagsEnd::
- ds 56
+ wPlayerGender::
+ ; $00 = male
+ ; $01 = female
+ ds 1
+
+ ; unused
+ ds 55
```
By adding these lines of code we make sure that the gender is stored in the save file.
Open engine\movie\oak_speech\oak_speech.asm . Scroll to the bottom and add these lines of code:
```diff
; displays boy/girl choice
BoyGirlChoice::
call SaveScreenTilesToBuffer1
call InitBoyGirlTextBoxParameters
jr DisplayBoyGirlChoice
InitBoyGirlTextBoxParameters::
ld a, $1 ; loads the value for the unused North/West choice, that was changed to say Boy/Girl
ld [wTwoOptionMenuID], a
coord hl, 13, 7
ld bc, $80e
ret
DisplayBoyGirlChoice::
ld a, $14
ld [wTextBoxID], a
call DisplayTextBoxID
jp LoadScreenTilesFromBuffer1
```
This will load the text box where the options will appear.
Scroll up to the OakSpeech label and find these lines of code:
```diff
xor a
ldh [hTileAnimations], a
ld a, [wd732]
bit 1, a ; possibly a debug mode bit
jp nz, .skipChoosingNames
```
Under these lines of code add these lines of code:
```diff
ld hl,BoyGirlText ; added to the same file as the other oak text
call PrintText ; show this text
call BoyGirlChoice ; added routine at the end of this file
ld a, [wCurrentMenuItem]
ld [wPlayerGender], a ; store player's gender. 00 for boy, 01 for girl
call ClearScreen ; clear the screen before resuming normal intro
```
Search these lines of code, they're under.
```diff
ld hl, OakSpeechText2
call PrintText
call GBFadeOutToWhite
call ClearScreen
ld de, RedPicFront
lb bc, BANK(RedPicFront), $00
call IntroDisplayPicCenteredOrUpperRight
```
Edit them:
```diff
ld hl,OakSpeechText2
call PrintText
call GBFadeOutToWhite
call ClearScreen
ld de,RedPicFront
lb bc, Bank(RedPicFront), $00
- call IntroDisplayPicCenteredOrUpperRight
+ ld a, [wPlayerGender] ; check gender
+ and a ; check gender
+ jr z, .NotGreen1
+ ld de,GreenPicFront
+ lb bc, Bank(GreenPicFront), $00
+ .NotGreen1:
+ call IntroDisplayPicCenteredOrUpperRight
```
Scroll down until you see:
```diff
.skipChoosingNames
call GBFadeOutToWhite
call ClearScreen
ld de, RedPicFront
lb bc, BANK(RedPicFront), $00
call IntroDisplayPicCenteredOrUpperRight
```
Edit these too:
```diff
.skipChoosingNames
call GBFadeOutToWhite
call ClearScreen
ld de,RedPicFront
lb bc, Bank(RedPicFront), $00
- call IntroDisplayPicCenteredOrUpperRight
+ ld a, [wPlayerGender] ; check gender
+ and a ; check gender
+ jr z, .NotGreen2
+ ld de,GreenPicFront
+ lb bc, Bank(GreenPicFront), $00
+ .NotGreen2:
+ call IntroDisplayPicCenteredOrUpperRight
```
Search now these lines of code:
```diff
call DelayFrames
ld de, RedSprite
ld hl, vSprites
lb bc, BANK(RedSprite), $0C
call CopyVideoData
ld de, ShrinkPic1
lb bc, BANK(ShrinkPic1), $00
call IntroDisplayPicCenteredOrUpperRight
```
And modify:
```diff
call DelayFrames
ld de,RedSprite
ld hl, vSprites
lb bc, BANK(RedSprite), $0C
- call CopyVideoData
- ld de, ShrinkPic1
- lb bc, BANK(ShrinkPic1), $00
- call IntroDisplayPicCenteredOrUpperRight
+ ld a, [wPlayerGender] ; check gender
+ and a ; check gender
+ jr z, .NotGreen3
+ ld de,GreenSprite
+ lb bc, BANK(GreenSprite), $0C
+ .NotGreen3:
+ ld hl,vSprites
+ call CopyVideoData
+ ld de,ShrinkPic1
+ lb bc, BANK(ShrinkPic1), $00
+ call IntroDisplayPicCenteredOrUpperRight
```
What we just did is added some gender checking routines, so the game will load the sprites for the other gender if that gender is selected.
Search for OakSpeechText3, and add this at the bottom:
```diff
BoyGirlText: ; This is new so we had to add a reference to get it to compile
text_far _BoyGirlText
text_end
```
We're done with the first oakspeech file. We move onto oakspeech2.asm. We will edit these lines of code at the top.
```diff
ChoosePlayerName:
- call OakSpeechSlidePicRight
- ld de, DefaultNamesPlayer
- call DisplayIntroNameTextBox
+ and a
+ jr nz, .AreGirl ; Skip to girl names if you are a girl instead
+ ld de, DefaultNamesPlayer
+ call DisplayIntroNameTextBox
ld a, [wCurrentMenuItem]
and a
jr z, .customName
ld hl, DefaultNamesPlayerList
call GetDefaultName
ld de, wPlayerName
call OakSpeechSlidePicLeft
jr .done
+ .AreGirl ; Copy of the boy naming routine, just with girl's names
+ ld de, DefaultNamesGirl
+ call DisplayIntroNameTextBox
+ ld a, [wCurrentMenuItem]
+ and a
+ jr z, .customName
+ ld hl, DefaultNamesGirlList
+ call GetDefaultName
+ ld de, wPlayerName
+ call OakSpeechSlidePicLeft
+ jr .done ; End of new Girl Names routine
.customName
ld hl, wPlayerName
xor a ; NAME_PLAYER_SCREEN
ld [wNamingScreenType], a
call DisplayNamingScreen
ld a, [wcf4b]
cp "@"
jr z, .customName
call ClearScreen
call Delay3
ld de, RedPicFront
ld b, BANK(RedPicFront)
- call IntroDisplayPicCenteredOrUpperRight
- .done
- ld hl, YourNameIsText
- jp PrintText
+ ld a, [wPlayerGender] ; Added gender check
+ and a ; Added gender check
+ jr z, .AreBoy3
+ ld de, GreenPicFront
+ ld b, BANK(GreenPicFront)
+ .AreBoy3
+ call IntroDisplayPicCenteredOrUpperRight
+ .done
+ ld hl, YourNameIsText
+ jp PrintText
```
You can see what this is supposed to do. Load the other names. Now let's add some names to be loaded. Open data\player_names.asm and add:
```diff
IF DEF(_RED)
DefaultNamesPlayer:
db "NEW NAME"
next "RED"
next "ASH"
next "JACK"
db "@"
+ DefaultNamesGirl:
+ db "NEW NAME"
+ next "GREEN"
+ next "LEAF"
+ next "AMANDA"
+ db "@"
DefaultNamesRival:
db "NEW NAME"
next "BLUE"
next "GARY"
next "JOHN"
db "@"
ENDC
IF DEF(_BLUE)
DefaultNamesPlayer:
db "NEW NAME"
next "BLUE"
next "GARY"
next "JOHN"
db "@"
+ DefaultNamesGirl:
+ db "NEW NAME"
+ next "GREEN"
+ next "LEAF"
+ next "AMANDA"
+ db "@"
DefaultNamesRival:
db "NEW NAME"
next "RED"
next "ASH"
next "JACK"
db "@"
ENDC
```
We do pretty much the same thing on player_names_list.asm.
```diff
IF DEF(_RED)
DefaultNamesPlayerList:
db "NEW NAME@"
db "RED@"
db "ASH@"
db "JACK@"
+ DefaultNamesGirlList:
+ db "NEW NAME@"
+ db "GREEN@"
+ db "LEAF@"
+ db "AMANDA@"
DefaultNamesRivalList:
db "NEW NAME@"
db "BLUE@"
db "GARY@"
db "JOHN@"
ENDC
IF DEF(_BLUE)
DefaultNamesPlayerList:
db "NEW NAME@"
db "BLUE@"
db "GARY@"
db "JOHN@"
+ DefaultNamesGirlList:
+ db "NEW NAME@"
+ db "GREEN@"
+ db "LEAF@"
+ db "AMANDA@"
DefaultNamesRivalList:
db "NEW NAME@"
db "RED@"
db "ASH@"
db "JACK@"
ENDC
```
We go to data\text\text_2.asm and add these lines of code.
```diff
_BoyGirlText::
text "Play as a boy, or"
line "as a girl?"
done
```
Hurray! We added the option on the intro. Now let's add the girl sprites in the main game. Open engine\overworld\player_animations.asm and look for FishingAnim and add these lines of code.
```diff
FishingAnim:
ld c, 10
call DelayFrames
ld hl, wd736
set 6, [hl] ; reserve the last 4 OAM entries
- ld de, RedSprite
- ld hl, vNPCSprites tile $00
- lb bc, BANK(RedSprite), 12
- call CopyVideoData
- ld a, $4
- ld hl, RedFishingTiles
- call LoadAnimSpriteGfx
+ ld a, [wPlayerGender] ; added gender check
+ and a ; added gender check
+ jr z, .BoySpriteLoad
+ ld de, GreenSprite
+ ld hl, vNPCSprites
+ ld bc, (BANK(GreenSprite) << 8) + $0c
+ jr .KeepLoadingSpriteStuff
+ .BoySpriteLoad
+ ld de, RedSprite
+ ld hl, vNPCSprites
+ lb bc, BANK(RedSprite), $c
+ .KeepLoadingSpriteStuff
+ call CopyVideoData
+ ld a, [wPlayerGender] ; added gender check
+ and a ; added gender check
+ jr z, .BoyTiles ; skip loading Green's stuff if you're Red
+ ld a, $4
+ ld hl, GreenFishingTiles
+ jr .ContinueRoutine ; go back to main routine after loading Green's stuff
+ .BoyTiles ; alternately, load Red's stuff
+ ld a, $4
+ ld hl, RedFishingTiles
+ .ContinueRoutine
+ call LoadAnimSpriteGfx
```
Next, we'll look for this:
```diff
RedFishingTiles:
fishing_gfx RedFishingTilesFront, 2, $02
fishing_gfx RedFishingTilesBack, 2, $06
fishing_gfx RedFishingTilesSide, 2, $0a
fishing_gfx RedFishingRodTiles, 3, $fd
```
Red has his fishing tiles defined so let's give Green some defined tiles.Add these under:
```diff
GreenFishingTiles:
fishing_gfx GreenFishingTilesFront, 2, $02
fishing_gfx GreenFishingTilesBack, 2, $06
fishing_gfx GreenFishingTilesSide, 2, $0a
fishing_gfx RedFishingRodTiles, 3, $fd
```
We only added fishing tiles. Let's add walking and cycling tiles too.Open home/overworld.asm and look for LoadWalkingPlayerSpriteGraphics. Add these lines of code:
```diff
LoadWalkingPlayerSpriteGraphics::
ld de, RedSprite
- ld hl, vNPCSprites
- jr LoadPlayerSpriteGraphicsCommon
+ and a
+ jr z, .AreGuy1
+ ld de,GreenSprite
+ .AreGuy1
+ ld hl,vNPCSprites
+ jr LoadPlayerSpriteGraphicsCommon
LoadSurfingPlayerSpriteGraphics::
ld de, SeelSprite
ld hl, vNPCSprites
jr LoadPlayerSpriteGraphicsCommon
LoadBikePlayerSpriteGraphics::
ld de, RedBikeSprite
- ld hl, vNPCSprites
+ ld a, [wPlayerGender]
+ and a
+ jr z, .AreGuy2
+ ld de,GreenBikeSprite
+ .AreGuy2
+` ld hl,vNPCSprites
```
Now, let's add her backsprite. Open engine\battle\core.asm and look for LoadPlayerBackPic so we can edit it.
```diff
LoadPlayerBackPic:
ld a, [wBattleType]
dec a ; is it the old man tutorial?
- ld de, RedPicBack
- jr nz, .next
- ld de, OldManPicBack
- .next
+ ld de, OldManPic
+ jr z, .next
+ ld a, [wPlayerGender]
+ and a
+ jr z, .RedBack
+ ld de, GreenPicBack
+ jr .next
+ .RedBack
+ ld de, RedPicBack
+ .next
```
Next, Hall of Fame! Open engine\movie\hall_of_fame.asm and go to HoFLoadPlayerPics so we can change some stuff:
```diff
HoFLoadPlayerPics:
- ld de, RedPicFront
- ld a, BANK(RedPicFront)
- call UncompressSpriteFromDE
- ld hl, sSpriteBuffer1
- ld de, sSpriteBuffer0
- ld bc, $310
- call CopyData
- ld de, vFrontPic
- call InterlaceMergeSpriteBuffers
- ld de, RedPicBack
- ld a, BANK(RedPicBack)
- call UncompressSpriteFromDE
+ ld a, [wPlayerGender] ; New gender check
+ and a ; New gender check
+ jr nz, .GirlStuff1
+ ld de, RedPicFront
+ ld a, BANK(RedPicFront)
+ jr .Routine ; skip the girl stuff and go to main routine
+ .GirlStuff1
+ ld de, GreenPicFront
+ ld a, BANK(GreenPicFront)
+ .Routine ; resume original routine
+ call UncompressSpriteFromDE
+ ld hl, sSpriteBuffer1
+ ld de, sSpriteBuffer0
+ ld bc, $310
+ call CopyData
+ ld de, vFrontPic
+ call InterlaceMergeSpriteBuffers
+ ld a, [wPlayerGender] ; new gender check
+ and a ; new gender check
+ jr nz, .GirlStuff2
+ ld de, RedPicBack
+ ld a, BANK(RedPicBack)
+ jr .routine2 ; skip the girl stuff and continue original routine if guy
+ .GirlStuff2
+ ld de, GreenPicBack
+ ld a, BANK(GreenPicBack)
+ .routine2 ; original routine
+ call UncompressSpriteFromDE
```
The last thing we're gonna do is make sure that her sprite shows up on the Trainer Card. Open engine\menus\start_sub_menus.asm and go find DrawTrainerInfo so we can finish this.
```diff
DrawTrainerInfo:
ld de, RedPicFront
lb bc, BANK(RedPicFront), $01
- predef DisplayPicCenteredOrUpperRight
+ ld a, [wPlayerGender]
+ and a
+ jr z, .AreBoy
+ ld de, GreenPicFront
+ lb bc, BANK(GreenPicFront), $01
+ .AreBoy
+ predef DisplayPicCenteredOrUpperRight
```
And there we have it. Another gender in Pokemon Red. Huge thanks to Mateo for writing the tutorial.
|