Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#76 2017-11-19 17:34:04

Danny-E 33
Administrator
Registered: 2012-06-09
Post 1,045/1,197

Re: [Pokered] Adding Gender Selection

In this case, ".NotLeaf1" is supposed to be a label.
There are two main possibilities.

Since labels that begin with a period are local labels (they are only valid in between the global label above and below where the local label is defined) it's possible that you are trying to reference the ".NotLeaf1" local label from outside that region that it is valid.

Second, it's possible that you just forgot to include the ".NotLeaf1" label at all.

Double check engine/oak_speech.asm and around line 99 make sure the label is defined in the local scope that it is referenced.

Offline

#77 2017-11-19 20:25:16

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 436/450
Website

Re: [Pokered] Adding Gender Selection

From that error message I think it's just the indentation. Macro and label definitions should not be tabulated or would otherwise be interpreted as macro instantiations (given that they are not assembly instructions). Make sure the ".NotLeaf1" line is aligned to the leftmost of the line, unlike regular code.

Offline

#78 2017-11-19 20:38:39

TRIFORCE89
Member
Registered: 2013-05-20
Post 16/32

Re: [Pokered] Adding Gender Selection

Crystal_ wrote:

From that error message I think it's just the indentation. Macro and label definitions should not be tabulated or would otherwise be interpreted as macro instantiations (given that they are not assembly instructions). Make sure the ".NotLeaf1" line is aligned to the leftmost of the line, unlike regular code.

Yup! You are correct. Thank you! I just de-indented the line for .NotLeaf1 (and .NotLeaf3, same issue) and the make got passed that step.

Output now is:

rgbasm -h -o main.o main.asm
rgbasm -h -o text.o text.asm
rgbasm -h -o wram.o wram.asm
rgblink -n pokeyellow.sym -l pokeyellow.link -o pokeyellow.gbc audio.o main.o text.o wram.o
error: Unable to place 'Main' (ROM0 section) at $150
make: *** [pokeyellow.gbc] Error 1

So, still not quite there yet

Offline

#79 2017-11-19 21:53:58

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 437/450
Website

Re: [Pokered] Adding Gender Selection

If you have anything allocated right after the cartridge header, move it elsewhere in the bank or just don't hardcode the main section. You might also have free space between 0060 and 00FF where you might be able to move things. I just don't know what that gender patch really adds but if it was meant to be for red/blue don't expect it to be as easy as copypasting.

Offline

#80 2017-11-20 00:28:20

TRIFORCE89
Member
Registered: 2013-05-20
Post 17/32

Re: [Pokered] Adding Gender Selection

Crystal_ wrote:

If you have anything allocated right after the cartridge header, move it elsewhere in the bank or just don't hardcode the main section. You might also have free space between 0060 and 00FF where you might be able to move things. I just don't know what that gender patch really adds but if it was meant to be for red/blue don't expect it to be as easy as copypasting.

I went and redid this all paying careful attention to the spaces and indentation. Same error message. If I had to guess, I think (based on nothing, really) that it is do to moving the Giovanni and Rocket sprites around?

How would I know if I have free space between 0060 and 00FF? And how would I utilize it?

It wasn't a straight copy/paste. Some blocks were revised since the original writing, I assume. But I got the gist of it. Didn't do bling pasting, just where it seemed to make sense (where Red sprite was loaded, not necessarily immediately before or after, depending).

Offline

#81 2018-03-07 09:22:07

TheRealLazerBlazer22
Member
From: United States
Registered: 2018-03-02
Post 2/10

Re: [Pokered] Adding Gender Selection

So, I finished the tutorial, and learned a lot along the way. Thank you Mateo. However, I receive this error that I am currently looking for the solution to. I will keep everyone posted the best I can, if I find the solution, as it's probably me just making a simple mistake.

rgbasm -D _RED -h -o main_red.o main.asm
ERROR: main.asm(215):
        Unterminated string
make: *** [Makefile:37: main_red.o] Error 5

I figured I might as well leave this here in case I cannot solve it. Thank you to everyone here at Skeetendo, for without you, learning assembly and some of the more complex algorithms would be much harder to learn. Thank you, and take care.


Currently working on Pokémon Shiro Version.

Pokémon Shiro Version 0.05a Release:
Pokémon Shiro Version 0.05a IPS Download Link

"The human heart and true love obey no timetables."
"I'll create my own Destiny, even if I have to will it into existence."

Offline

#82 2018-03-07 23:16:10

Danny-E 33
Administrator
Registered: 2012-06-09
Post 1,077/1,197

Re: [Pokered] Adding Gender Selection

In the first line of the error "main.asm(215)", that's telling you the exact file and the exact line number that is causing the problem.
And the next line of the error "Unterminated string" is telling you exactly what the problem on that line is.

Offline

#83 2018-08-27 13:54:49

youdontsurf
New member
Registered: 2018-08-27
Post 1/6

Re: [Pokered] Adding Gender Selection

Having a bit of an issue doing this in Yellow, during one of the last steps. When editing home/overworld.asm, I'll get this error when compiling:
error: Unable to place 'Main' (ROM0 section) at $150
make: *** [Makefile:47: pokeyellow.gbc] Error 1

These are both pastebins:
Clean file: https://pastebin.com/raw/fg36p1xz
Edited file: https://pastebin.com/raw/Vf2vRtkb

It seems to be this bit that causes an error when compiling:

LoadBikePlayerSpriteGraphics::
ld de,RedCyclingSprite
    ld a, [wPlayerGender]
    and a
    jr z, .AreGuy2
    ld de,LeafCyclingSprite
.AreGuy2
    ld hl,vNPCSprites

There's no error when this is the code:

LoadBikePlayerSpriteGraphics::
ld b, BANK(RedCyclingSprite)
ld de, RedCyclingSprite

Also following up to this point, both my male and female overworlds show up as a glitched mess. I'm going to backtrack until finding the origin of this as I did above, but any leads are welcome.
Oh and a minor suggestion: To my knowledge, online battles will show the opposite player as a male. The relevant code is in home.asm at:

.linkBattle
ld hl, wTrainerPicPointer
ld de, RedPicFront
ld [hl], e
inc hl
ld [hl], d
ret


Solved:
https://github.com/Mr-Gela/pokecerise-g … 983335074c

Last edited by youdontsurf (2018-09-28 10:23:02)

Offline

#84 2018-10-17 05:18:08

Funny Valentine
New member
Registered: 2018-10-17
Post 1/1

Re: [Pokered] Adding Gender Selection

Hey everyone,
It seems that I can't get past Step 1. I have put the png files in the same places said in the tutorial, and I moved Giovanni and Rocket sprites in SECTION "NPC Sprites 1" as well. When I try to compile, Cygwin keeps telling:
error: Unable to place 'Battle (bank C)' (ROMX section) at $7FF7 in bank $0C
make: *** [Makefile:52: pokered.gbc] Error 1
Does anyone have any idea what the cause may be? Do I have to move something else, or maybe it's because of the updates in pokered? Thanks in advance.

Offline

#85 2018-10-17 16:29:22

Mateo
Member
Registered: 2009-11-25
Post 3,567/3,662

Re: [Pokered] Adding Gender Selection

Probably due to pokered updates. I wrote this tutorial before it used a linker script, so that might be part of the problem. Guess I need to go back in and sort this out again one day when I have time.


I am not very active on this forum. I only pop in from time to time.

Offline

#86 2020-08-25 16:11:49

VL2M
Member
Registered: 2020-05-11
Post 22/29

Re: [Pokered] Adding Gender Selection

Hey Mateo,huge thanks for the tutorial.
I tried adding this to shinpokered-lite(last version)to see if it works.
After I edited wram.asm I encountered this error
Unable to place "Stack" (WRAM0 section) at address $df00: section overlap
s with "OAM Buffer".
Can someone help me?


Pandas sure don't like vegans...

Offline

#87 2020-08-28 22:41:28

jojobear13
Member
Registered: 2019-03-28
Post 10/10

Re: [Pokered] Adding Gender Selection

VL2M wrote:

Hey Mateo,huge thanks for the tutorial.
I tried adding this to shinpokered-lite(last version)to see if it works.
After I edited wram.asm I encountered this error
Unable to place "Stack" (WRAM0 section) at address $df00: section overlap
s with "OAM Buffer".
Can someone help me?

It means exactly what is says. Scroll down to SECTION "Stack", WRAM0[$df00]. This defines a section called "Stack" that starts at address $df00. The stack is what is being used when you use the Push and Pop commands. Pokemon's stack has a size of $ff, starts at address $dfff, and ends at address $df00. However the way you have edited the wram file has caused the space allocated to "OAM Buffer" to overlap with this stack section.

You are working with shinpokered-lite, so Mateo or other Pret contributors would not be familiar with it. I highly suggest you start over and follow the guide linked here.

https://github.com/jojobear13/shinpoker … r%20option

You need to download the raw the diff report and save it as an html file. Then open it with any browser.

Last edited by jojobear13 (2020-08-28 22:42:17)

Offline

#88 2021-04-05 21:01:59

VL2M
Member
Registered: 2020-05-11
Post 29/29

Re: [Pokered] Adding Gender Selection

In case if you want to use this tutorial with modern Pokered I've rewritten it.Here.
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:
/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:

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:

AgathaSprite::           INCBIN "gfx/sprites/agatha.2bpp"
BrunoSprite::            INCBIN "gfx/sprites/bruno.2bpp"
- LoreleiSprite::          INCBIN "gfx/sprites/lorelei.2bpp"
- SeelSprite::             INCBIN "gfx/sprites/seel.2bpp"
[..]
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"

Open fishing.asm and add:

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.

INCLUDE "engine/movie/evolution.asm"
INCLUDE "engine/overworld/elevator.asm"
- INCLUDE "engine/items/tm_prices.asm"

INCLUDE "engine/gfx/palettes.asm"
INCLUDE "engine/menus/save.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.
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 form 6 to 5.

.YesNoMenu:
db   "YES"
next "NO@"

- .NorthWestMenu:
- db   "NORTH"
- next "WEST@"
+ .BoyGirlMenu:
+ db   "BOY"
+ next "GIRL@"

Open wram.asm and edit:

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:

; 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:

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:

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. Edit them:

ld hl, OakSpeechText2
call PrintText
call GBFadeOutToWhite
call ClearScreen
ld de, RedPicFront
lb bc, BANK(RedPicFront), $00
call IntroDisplayPicCenteredOrUpperRight

Edit them:

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:

.skipChoosingNames
call GBFadeOutToWhite
call ClearScreen
ld de, RedPicFront
lb bc, BANK(RedPicFront), $00
call IntroDisplayPicCenteredOrUpperRight

Edit these too:

  .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:

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:

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:

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.

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:

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.

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.

_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 some lines of code.

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:

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:

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:

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.

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:

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.

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 this tutorial.


Pandas sure don't like vegans...

Offline

Board footer

Powered by FluxBB