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.