PHO - Pokémon Hackers Online
Go Back   PHO - Pokémon Hackers Online > Generation I/II Hacking > Guides & Documentation

Guides & Documentation Have a tutorial or a document to share? Post it here.

User Tag List

Reply
 
Thread Tools Display Modes
Old 17th September 2014, 07:45 PM   #1
Pia Carrot
Orange Developer
Administrator
 
Pia Carrot's Avatar
 
Join Date: Aug 2010
Location: Valencia Island
Age: 22
Posts: 848
Pia Carrot Pia Carrot Pia Carrot Pia Carrot
Default WIP: PokeRed for Dummies

Additional Tutorials:
How to add Gender Select by Mateo

Ever wanted to make your own Gameboy game from scratch? One that you could play on an emulator, but hacking ended up being way too frustrating for you?

Well now there's pokered, a complete disassembly of Pokemon Red version for the Nintendo Gameboy.

However, as amazing as pokered is there is not much in the way of guides for using it, besides installation and some obvious things like changing graphics. So that's why I'm writing Pokered for Dummies.

I'm learning all about this great hacking alternative myself. Once upon a time I looked for an alternative to hacking and I found RPG Maker XP with the Pokemon Essentials engine. However, the engine is only compatible with Windows and it was very difficult to make something besides a third gen styled game.

pokered is 100% open source and you can do anything within hardware limitations in it. No more decompressing, finding new pointers, repointing, assembly hacking, etc. I literally changed 2 lines of code and replaced an image to get this:



And that is just the scum of the barrel for you. Think of the possibilities with this engine. Diagonal movement? Custom battle interfaces? New animations? Follow me? Use your imagination! And we will be covering all that is available to us in this guide.

Table of Contents
1.---Is pokered for you?
2.---Installing pokered
3.---Finding and Editing text
3A--Labels and text scripting
4.---Editing simple Graphics
5.---Maps
6.---Wild Battles
7.---Trainer Battles
8.---Events


Chapter 1. Is pokered for you?

pokered is a disassembly of Pokemon Red Version by Gamefreak for the Nintendo Gameboy. It's a rather dated game, nearly 20 years old. With that said, the hardware of the Gameboy is very limited compared to, say, a Gameboy Advance or a Nintendo DS. Heck, the game is barely over a Megabyte in size when compiled, while Gameboy Advance ROMs are 16 to 32MB.

With this said, pokered is still very versatile for both newbies and rom hacking veterans. The engine still features Z80 assembly rather heavily but is now labelled and fixed up in places that were previously impossible to deal with, such as Gen 1 sprite editing. Many strings of text are centralized and can be edited in a Text editor like Notepad++. Sprites are now compiled as .png files, easy to edit with no hassle involved.

Now, another problem is the palette limitations. While you can add color to the game, it is not supported by the Gameboy natively. If you want to check out pokered with color, see Danny-E 33's pokered with generation 2 elements here: https://github.com/dannye/pokered-gen-II

This guide does not go over Danny-E 33's version so do not ask me what to do if you come across a problem with it.

Anyway, Pokemon Red uses monochrome colors, as in black, white and grey. You can reference the image in the intro for an example.

So really your limitations here are colors and size. Even with color the Gameboy can only do so much. Tilesets can't be extended although you can make new ones. And remember the gameboy runs off the Z80 Assembly language, which if I'm not mistaken TI calculators still use this language. If you want to add new features you'll need to learn how to use this language.

That concludes this short chapter in the guide. Next we'll get to installing pokered.

Chapter 2. Installing pokered

VIDEO TUTORIAL BY SHANTYTOWN: https://www.youtube.com/watch?v=fYyt...txokM41XAmDahu

This chapter heavily references the Install.md on IImarckus' github, which can be found here: https://github.com/iimarckus/pokered...ter/INSTALL.md
Please use his guide if using Mac OS X or Linux. This guide goes purely on Windows.

First off you'll need to install cygwin 32-bit, which can be found here: https://cygwin.com/install.html

When installing you'll need to select what dependencies you'll need, and you need atleast the following:
  • make
  • git
  • gettext
  • python
  • python-setuptools

You will then need to install Rednex Gameboy Development System, which can be found here:
https://github.com/bentley/rgbds/releases

Since you're using windows, you'll want the latest .zip that says it is for win32. Open the zip, and then open the folder in the zip. Now, take all the .exe files and place them in the following location on your PC.

Code:
C:\cygwin\usr\local\bin
All the .exe files should be in the bin folders. Do not make any additional folders or you will need to mess with your cygwin PATH.

Now open the cygwin terminal which should be in your Programs. Type in each of these lines:
Code:
git clone git://github.com/iimarckus/pokered.git
cd pokered
git submodule init
git submodule update
easy_install git://github.com/drj11/[email protected]#egg=pypng
After this, you should test it to make sure you've done everything right.

Type in the following:
Code:
make red
Bonus: make will create both red and blue roms, make blue will make a blue rom, and make red will simply make a red rom.



Give it a moment, and it should compile the rom in the pokered folder in cygwin. If it spits out an error you will need to fix your PATH. The following code will fix your PATH. Make sure you are in cygwin terminal.

Code:
export "PATH=$PATH:/cygdrive/C/cygwin/usr/local/bin/
Now for this to work make sure the .exe files from rgbds are in the bin folder, not the rgbds folder from the zip!

After that your environment in Cygwin should be ready to go. Now we can start having some fun.

Chapter 3. Finding and editing text

I'm sure the first thing you guys want to do is edit graphics or text, so these next two chapters will be covering those.

If you're looking for a specific string of text that you want to change go to the github repository, at the top of the page is a search bar. Search for a couple words from the text you want to change and it should give you a match. Now just find the same file in your cygwin pokered folder and edit it as you please. I will go into editing text completely and making new text momentarily.

3A. Labels and text scripting



If you crack open oakspeech.asm in the text folder you'll see something like this:
Code:
_OakSpeechText1::
    text "Hiya, there!"
    line "Welcome to the"
    cont "world of #MON!"

    para "My name is PIA!"
    line "I am a humble"
    cont "schoolteacher."
    prompt
Of course this is just my edited version of Oak's speech but it's to show you how easy it is to change. If you have a line already you simply label cont and it will make another line. prompt is used before a sequence and ends the conversation, in this case it transitions from Oak to Nidorino. para is used to start a new paragraph. Don't worry about offsets, the compiler seems to do it for you.

text initiates the conversation, acts as the first para
line is the line after the first in the para
cont is every line afterwards
para begins a paragraph
prompt ends a conversation
done ends the script

When we get to events I will be covering this so much more in depth, this is just a quick reference for editing conversations like Oak's!


Chapter 4. Editing simple graphics

Editing graphics is a simple process, with all images in pokered being in .png format, you can edit them in a program as simple as paint. I recommend Paint XP personally, as Paint 7 or 8 aren't as useful for these kinds of images.

Not much to say about editing them, you can't change the image size unless the corresponding code is edited to support it. This can be a tedious process.

Here is an example from me simply editing red and blue's sprite file in the gfx/sprites folder:


The process took a couple minutes since I had to recolor the originals to monochrome. Which brings up an important reminder.

DO NOT USE ANY COLORS BESIDES THE 2 SHADES OF GREY, THE ONE BLACK AND THE WHITE BACKGROUND!!!

If you do, it will NOT compile as it should.

Chapter 5. Maps

Unfortunately until the map editor is fixed for windows I can not add on to this section. Apparently you can map in a rom and then dump the map files to import into the disassembly, although this sounds complicated on its own.

EDIT: For now, map in a normal Red ROM using Pokemap or Classicmap, open the pokered map .blk for the map you want to edit in a hex editor. Open the modified Red rom in a hex editor, find the offset of the map you edited, and copy the hex from the rom to the .blk.

Map offsets stolen from Koolboyman's Red Map...
Spoiler:
Code:
[Pallet Town]
Start offset=$182FD
X size=10
Y size=9
Comment=No Event support yet
Tileset=1

[Celedon City]
Start offset=$180DF
X size=25
Y size=18
Comment=No Event support yet
Tileset=1

[Viridian City]
Start offset=$183EC
X size=20
Y size=18
Comment=No Event support yet
Tileset=1

[Pewter City]
Start offset=$185E6
X size=20
Y size=18
Comment=No Event support yet
Tileset=1

[Celulean City]
Start offset=$18830
X size=20
Y size=18
Comment=No Event support yet
Tileset=1

[Lavender Town]
Start offset=$44085
X size=10
Y size=9
Comment=No Event support yet
Tileset=1

[Vermilion City]
Start offset=$18A3F
X size=20
Y size=18
Comment=No Event support yet
Tileset=1

[Fuchsia City]
Start offset=$18C86
X size=20
Y size=18
Comment=No Event support yet
Tileset=1

[Cinnabar Island]
Start offset=$1C069
X size=10
Y size=9
Comment=No Event support yet
Tileset=1

[Saffon City]
Start offset=$50A98
X size=20
Y size=18
Comment=No Event support yet
Tileset=1

[Route 1]
Start offset=$1C0FC
X size=10
Y size=18
Comment=No Event support yet
Tileset=1

[Route 2]
Start offset=$5407E
X size=10
Y size=36
Comment=No Event support yet
Tileset=1

[Route 3]
Start offset=$54255
X size=35
Y size=9
Comment=No Event support yet
Tileset=1

[Route 4]
Start offset=$543EC
X size=45
Y size=9
Comment=No Event support yet
Tileset=1

[Route 5]
Start offset=$545D2
X size=10
Y size=18
Comment=No Event support yet
Tileset=1

[Route 6]
Start offset=$58079
X size=10
Y size=18
Comment=No Event support yet
Tileset=1

[Route 7]
Start offset=$48051
X size=10
Y size=9
Comment=No Event support yet
Tileset=1

[Route 8]
Start offset=$581C6
X size=30
Y size=9
Comment=No Event support yet
Tileset=1

[Route 9]
Start offset=$546FE
X size=30
Y size=9
Comment=No Event support yet
Tileset=1

[Route 10]
Start offset=$58356
X size=10
Y size=36
Comment=No Event support yet
Tileset=1

[Route 11]
Start offset=$5855F
X size=30
Y size=9
Comment=No Event support yet
Tileset=1

[Route 12]
Start offset=$58710
X size=10
Y size=54
Comment=No Event support yet
Tileset=1

[Route 13]
Start offset=$5488B
X size=30
Y size=9
Comment=No Event support yet
Tileset=1

[Route 14]
Start offset=$54A12
X size=10
Y size=18
Comment=No Event support yet
Tileset=1

[Route 15]
Start offset=$589CC
X size=30
Y size=9
Comment=No Event support yet
Tileset=1

[Route 16]
Start offset=$58B84
X size=20
Y size=9
Comment=No Event support yet
Tileset=1

[Route 17]
Start offset=$54BA8
X size=10
Y size=72
Comment=No Event support yet
Tileset=1

[Route 18]
Start offset=$58C9C
X size=25
Y size=9
Comment=No Event support yet
Tileset=1

[Route 19]
Start offset=$54EF1
X size=10
Y size=27
Comment=No Event support yet
Tileset=1

[Route 20]
Start offset=$5017D
X size=50
Y size=9
Comment=No Event support yet
Tileset=1

[Route 21]
Start offset=$5506D
X size=10
Y size=45
Comment=No Event support yet
Tileset=1

[Route 22]
Start offset=$5003D
X size=20
Y size=9
Comment=No Event support yet
Tileset=1

[Route 24]
Start offset=$506E7
X size=10
Y size=18
Comment=No Event support yet
Tileset=1

[Route 25]
Start offset=$50810
X size=30
Y size=9
Comment=No Event support yet
Tileset=1

[Viridian GYM]
Start offset=$74C48
X size=10
Y size=9
Comment=No Event support yet
Tileset=2

[Pewter GYM]
Start offset=$5C558
X size=5
Y size=7
Comment=No Event support yet
Tileset=2

[Celulean GYM]
Start offset=$5C866
X size=5
Y size=7
Comment=No Event support yet
Tileset=2

[Celedon GYM]
Start offset=$48B84
X size=5
Y size=9
Comment=No Event support yet
Tileset=2

[Fuchsia GYM]
Start offset=$756AA
X size=5
Y size=9
Comment=No Event support yet
Tileset=2

[Vermilion GYM]
Start offset=$5CC38
X size=5
Y size=9
Comment=No Event support yet
Tileset=2

[Oak's lab]
Start offset=$1C1C0
X size=5
Y size=6
Comment=No Event support yet
Tileset=2

[Fighting Dojo]
Start offset=$5CFE3
X size=5
Y size=6
Comment=No Event support yet
Tileset=2

[Indigo Plateau Lobby]
Start offset=$19CCF
X size=8
Y size=6
Comment=Dont edit the wierd stuff on the top right
Tileset=3

[PokemonCenters1]
Start offset=$440DF
X size=7
Y size=4
Comment=Works fine
Tileset=3

[Hotel]
Start offset=$492A7
X size=7
Y size=4
Comment=Works fine
Tileset=3

[Marts1]
Start offset=$1D530
X size=4
Y size=4
Comment=Works fine
Tileset=3

[Indigo Plateau Gate]
Start offset=$1E74A
X size=5
Y size=4
Comment=Works fine
Tileset=4

[Loreli]
Start offset=$762AC
X size=5
Y size=6
Comment=Works fine
Tileset=2

[Bruno]
Start offset=$76403
X size=5
Y size=6
Comment=Works fine
Tileset=2

[Lance]
Start offset=$5A3E9
X size=13
Y size=13
Comment=Works fine
Tileset=2

[Hall of Fame Room]
Start offset=$5A58B
X size=5
Y size=4
Comment=Works fine
Tileset=2

[Marts2]
Start offset=$1DDC1
X size=4
Y size=4
Comment=Works fine
Tileset=3

[Marts3]
Start offset=$5C000
X size=4
Y size=4
Comment=Works fine
Tileset=3

[Marts4]
Start offset=$74010
X size=4
Y size=4
Comment=Works fine
Tileset=3

[PokemonCenters1]
Start offset=$440DF
X size=7
Y size=4
Comment=Works fine
Tileset=3

[PokeCenters2]
Start offset=$480AB
X size=7
Y size=4
Comment=Works fine
Tileset=3

[PokeCenters3]
Start offset=$58D7D
X size=7
Y size=4
Comment=Works fine
Tileset=3

[PokeCenters4]
Start offset=$5C064
X size=7
Y size=4
Comment=Works fine
Tileset=3

[PokeCenters5]
Start offset=$440DF
X size=7
Y size=4
Comment=Works fine
Tileset=3

[PokeCenters6]
Start offset=$74030
X size=7
Y size=4
Comment=Works fine
Tileset=3

[Cinnibar Mansion(1)]
Start offset=$443FE
End offset=$445C0
X size=15
Y size=14
Comment=Works perfectly 
Tileset=7

[Cinnibar Mansion(2)]
Start offset=$52110
End offset=$53333
X size=15
Y size=14
Comment=Works perfectly 
Tileset=7

[Cinnibar Mansion(3)]
Start offset=$52326
End offset=$53333
X size=15
Y size=9
Comment=Works perfectly 
Tileset=7

[Cinnibar Mansion(4)]
Start offset=$524DD
End offset=$52877
X size=15
Y size=14
Comment=Works perfectly 
Tileset=7

[Team Rocket Hideout(1)]
Start offset=$44D49
End offset=$44FFF
X size=15
Y size=14
Comment=Works perfectly 
Tileset=7

[Route 23]
Start offset=$503B2
End offset=$50690
X size=10
Y size=100
Comment=Works perfectly 
Tileset=8

[Team Rocket Hideout(2)]
Start offset=$45147
X size=15
Y size=14
Comment=Works perfectly 
Tileset=7

[Team Rocket Hideout(3)]
Start offset=$4537F
X size=15
Y size=14
Comment=Works perfectly 
Tileset=7

[Team Rocket Hideout(4)]
Start offset=$45650
X size=15
Y size=12
Comment=Works perfectly 
Tileset=7

[Saffron Gym]
Start offset=$5D3A3
X size=10
Y size=9
Comment=Works perfectly 
Tileset=7

[Silph Co(1)]
Start offset=$5D4A2
X size=15
Y size=9
Comment=Works perfectly 
Tileset=7

[Silph Co(9)]
Start offset=$5D989
X size=13
Y size=9
Comment=Works perfectly 
Tileset=7

[Silph Co(2)]
Start offset=$59EC8
X size=15
Y size=9
Comment=Works perfectly 
Tileset=7

[Silph Co(3)]
Start offset=$5A0A6
X size=15
Y size=9
Comment=Works perfectly 
Tileset=7

[Silph Co(4)]
Start offset=$19EA4
X size=15
Y size=9
Comment=Works perfectly 
Tileset=7

[Silph Co(5)]
Start offset=$1A116
X size=15
Y size=9
Comment=Works perfectly 
Tileset=7

[Silph Co(6)]
Start offset=$1A36B
X size=13
Y size=9
Comment=Works perfectly 
Tileset=7

[Silph Co(7)]
Start offset=$51F57
X size=13
Y size=9
Comment=Works perfectly 
Tileset=7

[Power Plant]
Start offset=$1E446
X size=20
Y size=18
Comment=Works perfectly 
Tileset=7

[Silph Co(10)]
Start offset=$5A25A
X size=7
Y size=9
Comment=Works perfectly 
Tileset=7

[Silph Co(8)]
Start offset=$5666D
X size=13
Y size=9
Comment=Works perfectly 
Tileset=7


[S.S.Anne(8)]
Start offset=$61ADF
X size=12
Y size=8
Comment=Works perfectly 
Tileset=6

[S.S.Anne(7)]
Start offset=$6195E
X size=3
Y size=4
Comment=Works perfectly 
Tileset=6

[S.S.Anne(6)]
Start offset=$61761
X size=10
Y size=7
Comment=Works perfectly 
Tileset=6

[S.S.Anne(5)]
Start offset=$603C0
X size=12
Y size=8
Comment=Works perfectly 
Tileset=6

[S.S.Anne(4)]
Start offset=$61851
X size=7
Y size=8
Comment=Works perfectly 
Tileset=6

[S.S.Anne(3)]
Start offset=$61675
X size=15
Y size=3
Comment=Works perfectly 
Tileset=6

[S.S.Anne(2)]
Start offset=$61582
X size=20
Y size=8
Comment=Works perfectly 
Tileset=6

[S.S.Anne(1)]
Start offset=$612DF
X size=20
Y size=9
Comment=Works perfectly 
Tileset=6

[Cinnibar Gym]
Start offset=$75B26
X size=10
Y size=9
Comment=Works perfectly 
Tileset=7

[Lab(1)]
Start offset=$75BFA
X size=9
Y size=3
Comment=Works perfectly 
Tileset=5

[Lab(2)]
Start offset=$75C6B
X size=4
Y size=4
Comment=Works perfectly 
Tileset=5

[Lab(3)]
Start offset=$75D15
X size=4
Y size=4
Comment=Works perfectly 
Tileset=5

[Lab(4)]
Start offset=$75E10
X size=4
Y size=4
Comment=Works perfectly 
Tileset=5

[Safari Zone Secret House]
Start offset=$4A37F
X size=4
Y size=4
Comment=Works perfectly 
Tileset=5

[Indigo Plateu]
Start offset=$5094A
X size=10
Y size=9
Comment=Works perfectly 
Tileset=8

[Route2Gate]
Start offset=$5C090
X size=5
Y size=4
Comment=Works perfectly 
Tileset=4

[Undeground Path Gates]
Start offset=$5C048
X size=5
Y size=4
Comment=Works perfectly 
Tileset=4

[Museum(1)]
Start offset=$5C020
X size=10
Y size=4
Comment=Works perfectly 
Tileset=4

[Museum(2)]
Start offset=$5C048
X size=7
Y size=4
Comment=Works perfectly 
Tileset=4

[Rock Tunnel(1)]
Start offset=$44675
X size=20
Y size=18
Comment=Works perfectly 
Tileset=9

[Victory Road(3)]
Start offset=$44B37
X size=15
Y size=9
Comment=Works perfectly 
Tileset=9

[Mt.Moon(3)]
Start offset=$4A041
X size=20
Y size=18
Comment=Works perfectly 
Tileset=9

[Mt.Moon(1)]
Start offset=$49B97
X size=20
Y size=18
Comment=Works perfectly 
Tileset=9

[Mt.Moon(2)]
Start offset=$51A92
X size=14
Y size=14
Comment=Works perfectly 
Tileset=9

[Unknown Dungeon(1)]
Start offset=$74D76
X size=15
Y size=10
Comment=Works perfectly 
Tileset=9

[Unknown Dungeon(2)]
Start offset=$45E5D
X size=15
Y size=10
Comment=Works perfectly 
Tileset=9

[Unknown Dungeon(3)]
Start offset=$45F58
X size=15
Y size=9
Comment=Works perfectly 
Tileset=9

[Digletts Cave]
Start offset=$60258
X size=20
Y size=18
Comment=Works perfectly 
Tileset=9

[Digletts Cave Entrances]
Start offset=$1C20E
X size=4
Y size=4
Comment=Works perfectly 
Tileset=9

[Rock Tunnel(2)]
Start offset=$461A1
X size=20
Y size=18
Comment=Works perfectly 
Tileset=9

[Seaform Islands(2)]
Start offset=$468FA
X size=15
Y size=9
Comment=Works perfectly 
Tileset=9

[Seaform Islands(1)]
Start offset=$46706
X size=15
Y size=9
Comment=Works perfectly 
Tileset=9

[Seaform Islands(4)]
Start offset=$464FA
X size=15
Y size=9
Comment=Works perfectly 
Tileset=9

[Seaform Islands(3)]
Start offset=$463BE
X size=15
Y size=9
Comment=Works perfectly 
Tileset=9

[Seaform Islands(5)]
Start offset=$4489F
X size=15
Y size=9
Comment=Works perfectly 
Tileset=9

[Victory Road(1)]
Start offset=$5DB04
X size=10
Y size=9
Comment=Works perfectly 
Tileset=9

[Victory Road(2)]
Start offset=$519AF
X size=15
Y size=9
Comment=Works perfectly 
Tileset=9

[Pokemon Tower(2)]
Start offset=$60666
X size=10
Y size=9
Comment=Works perfectly 
Tileset=12

[Pokemon Tower(3)]
Start offset=$60790
X size=10
Y size=9
Comment=Works perfectly 
Tileset=12

[Pokemon Tower(4)]
Start offset=$608CC
X size=10
Y size=9
Comment=Works perfectly 
Tileset=12

[Pokemon Tower(1)]
Start offset=$6048C
X size=10
Y size=9
Comment=Works perfectly 
Tileset=12

[Pokemon Tower(5)]
Start offset=$60A89
X size=10
Y size=9
Comment=Works perfectly 
Tileset=12

[Pokemon Tower(6)]
Start offset=$60C95
X size=10
Y size=9
Comment=Works perfectly 
Tileset=12

[Pokemon Tower(7)]
Start offset=$60F20
X size=10
Y size=9
Comment=Works perfectly 
Tileset=12

[Port Entrance]
Start offset=$1DCDA
X size=14
Y size=6
Comment=Works perfectly 
Tileset=14

[Celedon Mart(1)]
Start offset=$60FDE
X size=10
Y size=4
Comment=Works perfectly 
Tileset=15

[Celedon Mart(2)]
Start offset=$490BC
X size=10
Y size=4
Comment=Works perfectly 
Tileset=15

[Celedon Mart(3)]
Start offset=$48322
X size=10
Y size=4
Comment=Works perfectly 
Tileset=15

[Celedon Mart(4)]
Start offset=$483A1
X size=10
Y size=4
Comment=Works perfectly 
Tileset=15

[Celedon Mart(5)]
Start offset=$490BC
X size=10
Y size=4
Comment=Works perfectly 
Tileset=15

[Celedon Mart(6)]
Start offset=$485CC
X size=10
Y size=4
Comment=Works perfectly 
Tileset=15

[Celedon Mart(Elevator)]
Start offset=$4585B
X size=2
Y size=2
Comment=Works perfectly 
Tileset=15

[Silph Co (Elevator)]
Start offset=$4585B
X size=2
Y size=2
Comment=Works perfectly 
Tileset=15

[Celedon Prizes]
Start offset=$49131
X size=5
Y size=4
Comment=Works perfectly 
Tileset=15

[Celadon Game Corner]
Start offset=$49017
X size=10
Y size=7
Comment=Works perfectly 
Tileset=15

[Team Rocket Hideout (Elevator)]
Start offset=$457A8
X size=3
Y size=4
Comment=Works perfectly 
Tileset=15

[Underground path west/east]
Start offset=$601F4
X size=25
Y size=4
Comment=Works perfectly 
Tileset=16

[Underground path north/south]
Start offset=$60198
X size=4
Y size=24
Comment=Works perfectly 
Tileset=16

[Restraunt]
Start offset=$491EE
X size=5
Y size=4
Comment=Works perfectly 
Tileset=15

[Celedon Mansion(1)]
Start offset=$48716
X size=4
Y size=6
Comment=Works perfectly 
Tileset=17

[Celedon Mansion(2)]
Start offset=$4876C
X size=4
Y size=6
Comment=Works perfectly 
Tileset=17

[Celedon Mansion(3)]
Start offset=$48847
X size=4
Y size=6
Comment=Works perfectly 
Tileset=17

[Celedon Mansion(4)]
Start offset=$48894
X size=4
Y size=6
Comment=Works perfectly 
Tileset=17

[Celedon Mansion(2)]
Start offset=$4876C
X size=4
Y size=6
Comment=Works perfectly 
Tileset=17

[Viridian Forest]
Start offset=$60001
X size=20
Y size=18
Comment=Works perfectly 
Tileset=10

[Safari Zone(1)]
Start offset=$45C1F
X size=20
Y size=18
Comment=Works perfectly 
Tileset=10

[Ash's House (F2)]
Start offset=$5C010
X size=4
Y size=4
Comment=Works perfectly 
Tileset=11

[Ash's House (F1)]
Start offset=$48209
X size=4
Y size=4
Comment=Works perfectly 
Tileset=11

[House1]
Start offset=$19C3F
X size=4
Y size=4
Comment=Same map as many other houses
Tileset=18

[House2]
Start offset=$1C1DE
X size=4
Y size=4
Comment=Same map as many other houses
Tileset=18

[House3]
Start offset=$5522F
X size=4
Y size=4
Comment=Same map as many other houses
Tileset=18

[House4]
Start offset=$74020
X size=4
Y size=4
Comment=Same map as many other houses
Tileset=18

[Gary's House]
Start offset=$19BF6
X size=4
Y size=4
Tileset=18

[School House]
Start offset=$1C1EE
X size=4
Y size=4
Tileset=18

[Route2Gate]
Start offset=$5C095
X size=5
Y size=4
Tileset=4

[Route5/6/Safari Zone Gate]
Start offset=$1E025
X size=4
Y size=3
Tileset=4

[Route7/8 Gate]
Start offset=$1E1AF
X size=3
Y size=4
Tileset=4

[Underground path gates]
Start offset=$1C1B0
X size=4
Y size=4
Tileset=4

[Route12/11 Gate]
Start offset=$480C7
X size=4
Y size=5
Tileset=4

[Route 16 Gate]
Start offset=$497E3
X size=4
Y size=7
Tileset=4

[Route 18 Gate]
Start offset=$480C7
X size=4
Y size=5
Tileset=4

[Gate Lobbys]
Start offset=$480DB
X size=4
Y size=4
Tileset=4

[Gary]
Start offset=$7615F
X size=4
Y size=4
Comment=Works fine
Tileset=2

[Bike Shop]
Start offset=$1D88C
X size=4
Y size=4
Tileset=13

[Trade Center]
Start offset=$4FD91
X size=5
Y size=4
Tileset=13

[Battle Center]
Start offset=$4FD5D
X size=5
Y size=4
Tileset=13


Chapter 6. Wild Battles

Wild Pokemon are really simple to edit. In your data folder there will be another folder titled "wildPokemon," this contains all wild pokemon data. Study the various .asm files to see how they are done. For our example we'll be looking at the waterpokemon.asm file:

Code:
WaterMons:
    db $00

    db $05
    db 5,TENTACOOL
    db 10,TENTACOOL
    db 15,TENTACOOL
    db 5,TENTACOOL
    db 10,TENTACOOL
    db 15,TENTACOOL
    db 20,TENTACOOL
    db 30,TENTACOOL
    db 35,TENTACOOL
    db 40,TENTACOOL
As you can see it's all Tentacool, at different levels. Really no different from editing wild pokemon in Advance Map or something. You may see some files with "IF Yellow" statements in them, generally just look for the ones under Red version, and if they don't exist edit what is available to you.

Chapter 7. Trainer Battles

This section is a bit messy, since trainers don't have names minus BLUE, PROF. OAK, the gym leaders and elite four members. From what I can tell all data pertaining to trainer battles is in trainer_parties.asm, located in the data folder. As to who is who you'll have to know the game a bit or have a guide ready.

Code:
YoungsterData: ; 39d99 (e:5d99)
    db 11,RATTATA,EKANS,0
    db 14,SPEAROW,0
    db 10,RATTATA,RATTATA,ZUBAT,0
    db 14,RATTATA,EKANS,ZUBAT,0
    db 15,RATTATA,SPEAROW,0
    db 17,SLOWPOKE,0
    db 14,EKANS,SANDSHREW,0
    db 21,NIDORAN_M,0
    db 21,EKANS,0
    db 19,SANDSHREW,ZUBAT,0
    db 17,RATTATA,RATTATA,RATICATE,0
    db 18,NIDORAN_M,NIDORINO,0
    db 17,SPEAROW,RATTATA,RATTATA,SPEAROW,0
if _YELLOW
    db 24,SANDSHREW,0
endc
It seems for normal trainers all their Pokemon are the same level, which tbh doesn't sound right, while Lance for example has individual levels:

Code:
LanceData: ; 3a522 (e:6522)
    db $FF,58,GYARADOS,56,DRAGONAIR,56,DRAGONAIR,60,AERODACTYL,62,DRAGONITE,0
When I get into events I'll try to explain how to designate specific trainers for a battle.

Chapter 8. Events
Chapter x. Credits

Thanks to everyone who contributed to pokered for the awesome engine.
Thank you Mateo, IImarckus, Kanzure for helping with information for this guide.
Gamefreak for the awesome game.
Pokemon Mint Fantasy/Poketto/Island Walker for custom graphics.

Link to the Skeetendo IRC if you'd like to ask the people who made pokered a question or to thank them: irc://nucleus.kafuka.org/#skeetendo
__________________

I'm a boob

Last edited by Mateo; 3rd December 2015 at 05:01 PM. Reason: Update link to RGBDS so people can actually build the project. The one originally linked to was outdated and doesn't work now
Pia Carrot is offline   Reply With Quote
Likes Elsa, Mateo liked this post
Sponsored Links
Old 17th September 2014, 08:41 PM   #2
Mateo
Johto Region Champion
AdministratorPHO VIP
 
Mateo's Avatar
 
Join Date: Jul 2013
Location: Johto
Age: 28
Posts: 813
Mateo Mateo Mateo Mateo Mateo
Default

Back in my day, Pokémon Red and Blue were just called "both versions" because that's all we had. And we LIKED it, by God!

Lol but for real, glad to see someone writing a good tutorial for pokered. Once I have a chance to get the hang of some things I will contribute some tutorials as well. Would you prefer that I post them in here, or as separate threads when I do?
__________________
mateo.





"I'm gonna, uh, demonstrate the hot moves..." - Flannery

Last edited by Mateo; 20th September 2014 at 04:07 PM.
Mateo is offline   Reply With Quote
Likes Pia Carrot liked this post
Old 20th September 2014, 04:20 PM   #3
Pia Carrot
Orange Developer
Administrator
 
Pia Carrot's Avatar
 
Join Date: Aug 2010
Location: Valencia Island
Age: 22
Posts: 848
Pia Carrot Pia Carrot Pia Carrot Pia Carrot
Default

If you post them in here I can leave a Table of contents in the OP for easy access, that way we also don't have a ton of clutter in the Guides section since as of right now the pokered userbase is rather small.
__________________

I'm a boob
Pia Carrot is offline   Reply With Quote
Old 20th September 2014, 04:38 PM   #4
Mateo
Johto Region Champion
AdministratorPHO VIP
 
Mateo's Avatar
 
Join Date: Jul 2013
Location: Johto
Age: 28
Posts: 813
Mateo Mateo Mateo Mateo Mateo
Default

That sounds good. Yeah, my thought was that keeping the information centralized would make it easier to find, but I was worried about new tutorials getting lost in the pages. But if you keep a table of contents linking to the posts then that solves the problem of thread clutter and forum clutter.
__________________
mateo.





"I'm gonna, uh, demonstrate the hot moves..." - Flannery
Mateo is offline   Reply With Quote
Old 22nd September 2014, 01:07 AM   #5
Pia Carrot
Orange Developer
Administrator
 
Pia Carrot's Avatar
 
Join Date: Aug 2010
Location: Valencia Island
Age: 22
Posts: 848
Pia Carrot Pia Carrot Pia Carrot Pia Carrot
Default

Temporary solution to mapping has been added.

Events are in pure asm so that's going to be fun to write a tutorial on.
__________________

I'm a boob
Pia Carrot is offline   Reply With Quote
Likes Mateo liked this post
Old 23rd September 2014, 09:20 PM   #6
Mateo
Johto Region Champion
AdministratorPHO VIP
 
Mateo's Avatar
 
Join Date: Jul 2013
Location: Johto
Age: 28
Posts: 813
Mateo Mateo Mateo Mateo Mateo
Default

Okay guys, I'm going to try my best to explain how to add Gender Selection to Pokered. This will involve editing several files and adding some new ones to your project. I would recommend having some form of backup before attempting this, just in case something gets messed up in the process.

WARNING: This is a really long tutorial, and while it may not be as complicated for you as it was for me to make it up, it is still a lot more complicated than, say, editing the text or which item is in the PC at the start of the game or any of that jazz. But if you follow the tutorial properly (and assuming I haven't accidentally skipped something, since there was a lot to explain) you should be able to get this working in your game.

Step 1: Get the graphics for the girl player.

For the girl player, you will need the following graphics:

-Front sprite
-Back sprite
-Walking sprite
-Cycling sprite
-Fishing tiles

To get the right dimensions for these, you can just copy+paste the ones for Red and edit them. Please note that in my example, I have Danny-E33's larger backsprite routine installed. You can do this without that routine of course, but your backsprite will have to be the normal Red Version size instead of the larger Gold Version size I am using.

Once you have your graphics drawn/found etc. make sure that they use ONLY the colours that other graphics in the project folder use (as Pia explained in the main tutorial) and save them as .png files with names you can remember. In my example, I kept the same naming scheme as the original files, but I substituted the word "Leaf" everywhere the original file name said "Red" and placed them in the same subfolders as the originals. This was just to make it easier for me to remember the file names later, and to make sure they are converted properly at compile.

So I ended up with files named:

/pic/trainer/Leaf.png
/pic/trainer/Leafb.png

/gfx/sprites/Leaf.png
/gfx/sprites/LeafCycling.png

/gfx/leaf_fishing_tile_back.png
/gfx/leaf_fishing_tile_front.png
/gfx/leaf_fishing_tile_side.png


Step 2: Inserting the sprites.

Now that you have the new .png files in the proper subfolders, we have to actually reference them somewhere to get them included. So we will open main.asm in notepad++ and find the references to the player's sprites. Doing a search for RedPicFront will eventually get you to this:

Code:
RedPicFront::  INCBIN "pic/trainer/red.pic"
ShrinkPic1::   INCBIN "pic/trainer/shrink1.pic"
ShrinkPic2::   INCBIN "pic/trainer/shrink2.pic"
Well, let's just add a new line really quick to include our new front sprite for the girl, so we can reference it later. You should have something that looks like this:

Code:
RedPicFront::  INCBIN "pic/trainer/red.pic"
LeafPicFront:: INCBIN "pic/trainer/leaf.pic"
ShrinkPic1::   INCBIN "pic/trainer/shrink1.pic"
ShrinkPic2::   INCBIN "pic/trainer/shrink2.pic"
Now if you scroll down a little from that, you should see the lines that include the overworld sprites. So we will just go to the line that says:

Code:
RedCyclingSprite:     INCBIN "gfx/sprites/cycling.2bpp"
RedSprite:            INCBIN "gfx/sprites/red.2bpp"
and add a couple of lines under it, so it looks like this:

Code:
RedCyclingSprite:     INCBIN "gfx/sprites/cycling.2bpp"
RedSprite:            INCBIN "gfx/sprites/red.2bpp"
LeafSprite:           INCBIN "gfx/sprites/leaf.2bpp"
LeafCyclingSprite:    INCBIN "gfx/sprites/leafcycling.2bpp"
Now, at least in my case, adding thew overworlds to this bank caused errors at compile, because we were trying to add too many sprites in this bank. To make life simpler later, we can just take 2 unrelated sprites and move them to another bank. I decided to cut and paste the lines that said:

Code:
GiovanniSprite:       INCBIN "gfx/sprites/giovanni.2bpp"
RocketSprite:         INCBIN "gfx/sprites/rocket.2bpp"
to the top of the other bank of overworld sprites. You can find that other bank by searching "SECTION "NPC Sprites 1"" or by scrolling up a bit from the banks we were just editing.

Now, the next thing we should come to is the fishing tiles. We won't have room to include these in the same bank as Red's fishing tiles, so we will have to find another bank to include them in. Which bank they are in is not important, since the routine that calls them can find them in any bank. So I added them in the same bank as the player backsprites.

So to finish inserting the graphics, do a search in main.asm for RedPicBack. You will eventually find something that looks like this:

Code:
RedPicBack::  INCBIN "pic/trainer/redb.pic"
OldManPic::  INCBIN "pic/trainer/oldman.pic"
So I just went ahead and added some lines to make it look like this:

Code:
RedPicBack::  INCBIN "pic/trainer/redb.pic"
LeafPicBack::  INCBIN "pic/trainer/leafb.pic"
OldManPic::  INCBIN "pic/trainer/oldman.pic"
LeafFishingTilesFront: INCBIN "gfx/leaf_fishing_tile_front.2bpp"
LeafFishingTilesBack:  INCBIN "gfx/leaf_fishing_tile_back.2bpp"
LeafFishingTilesSide:  INCBIN "gfx/leaf_fishing_tile_side.2bpp"
Now that we have all of the entries for the graphics added, now is a good time to save main.asm and attempt to compile the rom. If all goes well, the rom will compile normally with these extra graphics included (but nothing will call them yet). If you get errors saying that a bank is full, you will have to move something around to make it compile properly. If this happens, the cygwin terminal will tell you which line in main.asm it had a problem with, so you can go right to it and know which bank you need to make room in.


Step 3: Setting up the into.

Ok, so you got everything sorted properly so your rom will compile with the new graphics? Ok, let's start making it so we can use them!

The first thing you will want to do is add the menu that asks if you are a boy or a girl. The way I did this is by making a copy of the YesNoChoice routine, and having it reference the unused "North/West" menu string.

So, let's open up main.asm again and find the menu strings. So go ahead and search for MenuStrings and eventually you will come to:

Code:
MenuStrings: ; 7671 (1:7671)
    db 4,3,0
    dw .YesNoMenu
    db 6,3,0
    dw .NorthWestMenu
    db 6,3,0
    dw .SouthEastMenu
    db 6,3,0
    dw .YesNoMenu
    db 6,3,0
    dw .NorthEastMenu
    db 7,3,0
    dw .TradeCancelMenu
    db 7,4,1
    dw .HealCancelMenu
    db 4,3,0
    dw .NoYesMenu

.NoYesMenu ; 7699 (1:3699)
    db "NO",$4E,"[email protected]"
.YesNoMenu ; 76a0 (1:36a0)
    db "YES",$4E,"[email protected]"
.NorthWestMenu ; 76a7 (1:36a7)
    db "North",$4E,"[email protected]"
.SouthEastMenu ; 76b2 (1:36b2)
    db "SOUTH",$4E,"[email protected]"
.NorthEastMenu ; 76bd (1:36bd)
    db "NORTH",$4E,"[email protected]"
.TradeCancelMenu ; 76c8 (1:36c8)
    db "TRADE",$4E,"[email protected]"
.HealCancelMenu ; 76d5 (1:36d5)
    db "HEAL",$4E,"[email protected]"
The only entries we are interested in right now are the ones with NorthWest. So we'll just edit these really quick so we come up with this:

Code:
MenuStrings: ; 7671 (1:7671)
    db 4,3,0
    dw .YesNoMenu
    db 5,3,0
    dw .BoyGirlMenu
    db 6,3,0
    dw .SouthEastMenu
    db 6,3,0
    dw .YesNoMenu
    db 6,3,0
    dw .NorthEastMenu
    db 7,3,0
    dw .TradeCancelMenu
    db 7,4,1
    dw .HealCancelMenu
    db 4,3,0
    dw .NoYesMenu

.NoYesMenu ; 7699 (1:3699)
    db "NO",$4E,"[email protected]"
.YesNoMenu ; 76a0 (1:36a0)
    db "YES",$4E,"[email protected]"
.BoyGirlMenu ; 76a7 (1:36a7)
    db "BOY",$4E,"[email protected]"
.SouthEastMenu ; 76b2 (1:36b2)
    db "SOUTH",$4E,"[email protected]"
.NorthEastMenu ; 76bd (1:36bd)
    db "NORTH",$4E,"[email protected]"
.TradeCancelMenu ; 76c8 (1:36c8)
    db "TRADE",$4E,"[email protected]"
.HealCancelMenu ; 76d5 (1:36d5)
    db "HEAL",$4E,"[email protected]"
Notice that I changed not only the text and label names, but I changed the numbers above the NorthWest choice. Those determine how large the box around the words will be, and by changing that value from 6 to 5, we make it so there isn't exta space after the Boy/Girl options.


Now that we have these edited, you can save main.asm and move on to the actual intro. If you look in /engine/oak_speech.asm you will see that this is the main code for the intro. Scroll down to the bottom, and paste this:

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
    hlCoord 11, 7 
    ld bc, $80c
    ret
    
DisplayBoyGirlChoice::
    ld a, $14
    ld [wTextBoxID], a
    call DisplayTextBoxID
    jp LoadScreenTilesFromBuffer1
This is a copy of the YesNoChoice routine, but modified to call our new Boy/Girl option instead.

Now that we have this subroutine added, we can scroll back up and write some new code to call it.

If you scroll back up near the top, you'll see some code that looks like this:

Code:
    xor a
    ld [$FFD7],a
    ld a,[wd732]
    bit 1,a ; XXX when is bit 1 set?
    jp nz,Func_61bc ; easter egg: skip the intro
Immediately under that, we'll add our new code for the gender selection. So immediately after the line about skipping the intro, we'll add this:

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, [$cc26]
    and a
    jr z, .AfterSettingGirl ; skip setting the girl and leave that flag alone if you chose the boy
    ld hl, wd798 ; load ram address of Gender
    set 2, [hl]      ; sets you as a girl
.AfterSettingGirl: ; resume main intro, jumps here if you were a guy
    call ClearScreen ; clear the screen before resuming normal intro
The ram address we're using to store the gender is free by default in a red version game, and doesn't require anything fancy to make sure it is saved. The byte we are loading is originally used to store the flag for whether or not you have beaten a single trainer, leaving the other 7 bits unused. So we're just using one of these unused bits to keep track of whether you are a Boy or a Girl. I've tried to comment the code to explain exactly what is going on there. Thanks to ShantyTown for mentioning this byte in RAM we can use, and for explaining what I was doing wrong at first with the boy/girl menu (I was checking the wrong thing and so it always set you as a girl at first. Oops )

Now if you scroll down a bit you will find something that looks like this:

Code:
    ld hl,OakSpeechText2
    call PrintText      ; Prints text box
    call GBFadeOut2
    call ClearScreen
    ld de,RedPicFront
    ld bc,(Bank(RedPicFront) << 8) | $00
    call IntroPredef3B      ; displays player pic?
So we'll need to change this up a bit, so it can show the other pic if you are a girl. Make it look like this:

Code:
    ld hl,OakSpeechText2
    call PrintText      ; Prints text box
    call GBFadeOut2
    call ClearScreen
    ld de,RedPicFront
    ld bc,(Bank(RedPicFront) << 8) | $00
    ld a, [wd798] ; check gender
    bit 2, a      ; check gender
    jr z, .NotLeaf1
    ld de,LeafPicFront
    ld bc,(Bank(LeafPicFront) << 8) | $00
.NotLeaf1:
    call IntroPredef3B      ; displays player pic?
Next, we can scroll down a bit more until we see:

Code:
Func_61bc: ; 61bc (1:61bc)
    call GBFadeOut2
    call ClearScreen
    ld de,RedPicFront
    ld bc,(Bank(RedPicFront) << 8) | $00
    call IntroPredef3B
So we'll just change it to say:

Code:
Func_61bc: ; 61bc (1:61bc)
    call GBFadeOut2
    call ClearScreen
    ld de,RedPicFront
    ld bc,(Bank(RedPicFront) << 8) | $00
    ld a, [wd798] ; check gender
    bit 2, a      ; check gender
    jr z, .NotLeaf2
    ld de,LeafPicFront
    ld bc,(Bank(LeafPicFront) << 8) | $00
.NotLeaf2:
    call IntroPredef3B
You can see where this is going, really. A lot of checking the gender and just making it load the girl's stuff instead, otherwise keep loading the boy's stuff. we're still not done with this file yet though. So scroll down a bit more until you see:

Code:
    call DelayFrames
    ld de,RedSprite ; $4180
    ld bc,(BANK(RedSprite) << 8) | $0C
    ld hl,vSprites
    call CopyVideoData
    ld de,ShrinkPic1
    ld bc,(BANK(ShrinkPic1) << 8) | $00
    call IntroPredef3B
and make it look like this:

Code:
    call DelayFrames
    ld de,RedSprite ; $4180
    ld bc,(BANK(RedSprite) << 8) | $0C
    ld a, [wd798] ; check gender
    bit 2, a      ; check gender
    jr z, .NotLeaf3
    ld de,LeafSprite
    ld bc,(BANK(LeafSprite) << 8) | $0C
.NotLeaf3:
    ld hl,vSprites
    call CopyVideoData
    ld de,ShrinkPic1
    ld bc,(BANK(ShrinkPic1) << 8) | $00
    call IntroPredef3B
Now, we'll scroll down a bit more until we see:

Code:
OakSpeechText3: ; 626c (1:626c)
    TX_FAR _OakSpeechText3
    db "@"
Since we added a text string earlier when asking your gender, we'll need to set this up here so the script can find it. So we'll add:

Code:
BoyGirlText: ; This is new so we had to add a reference to get it to compile
    TX_FAR _BoyGirlText
    db "@"
under the OakSpeechText3 part. That's all we have to do in this file, but we're not quite done with the intro. (The intro is probably the most complicated part in all honesty).

Now we'll go ahead and save that file, and open /engine/oak_speech2.asm to keep working. At the top you will see:

Code:
LoadDefaultNamesPlayer: ; 695d (1:695d)
    call Func_6a12
    ld de, DefaultNamesPlayer ; $6aa8
    call DisplayIntroNameTextBox
    ld a, [wCurrentMenuItem] ; wCurrentMenuItem
    and a
    jr z, .asm_697a
    ld hl, DefaultNamesPlayerList ; $6af2
    call Func_6ad6
    ld de, wPlayerName ; wd158
    call Func_69ec
    jr .asm_6999
and change that to this:

Code:
LoadDefaultNamesPlayer: ; 695d (1:695d)
    call Func_6a12
    ld a, [wd798]   ; Added gender check
    bit 2, a        ; Added gender check
    jr nz, .AreGirl ; Skip to girl names if you are a girl instead
    ld de, DefaultNamesPlayer ; $6aa8
    call DisplayIntroNameTextBox
    ld a, [wCurrentMenuItem] ; wCurrentMenuItem
    and a
    jr z, .asm_697a
    ld hl, DefaultNamesPlayerList ; $6af2
    call Func_6ad6
    ld de, wPlayerName ; wd158
    call Func_69ec
    jr .asm_6999
.AreGirl ; Copy of the boy naming routine, just with girl's names
    ld de, DefaultNamesGirl ; $6aa8
    call DisplayIntroNameTextBox
    ld a, [wCurrentMenuItem] ; wCurrentMenuItem
    and a
    jr z, .asm_697a
    ld hl, DefaultNamesGirlList ; $6af2
    call Func_6ad6
    ld de, wPlayerName ; wd158
    call Func_69ec
    jr .asm_6999 ; End of new Girl Names routine
This adds a copy of the name routine that will instead call the girl's default names, which we will add in a minute. But first, we still have a little more to do.

If you will look at where it says:

Code:
.asm_697a
    ld hl, wPlayerName ; wd158
    xor a
    ld [wd07d], a
    call DisplayNamingScreen
    ld a, [wcf4b]
    cp $50
    jr z, .asm_697a
    call ClearScreen
    call Delay3
    ld de, RedPicFront ; $6ede
    ld b, BANK(RedPicFront)
    call IntroPredef3B
.asm_6999
    ld hl, YourNameIsText
    jp PrintText
we'll need to change this, so that entering a custom name won't make you look like the boy when you get back to the intro. So we'll make the code look like this:

Code:
.asm_697a
    ld hl, wPlayerName ; wd158
    xor a
    ld [wd07d], a
    call DisplayNamingScreen
    ld a, [wcf4b]
    cp $50
    jr z, .asm_697a
    call ClearScreen
    call Delay3
    ld de, RedPicFront ; $6ede
    ld b, BANK(RedPicFront)
    ld a, [wd798] ; Added gender check
    bit 2, a      ; Added gender check
    jr z, .AreBoy3
    ld de, LeafPicFront
    ld b, BANK(LeafPicFront)
.AreBoy3
    call IntroPredef3B
.asm_6999
    ld hl, YourNameIsText
    jp PrintText
Now then, we can get around to adding the name list for the girl player. So scroll down until you see:

Code:
IF _RED
DefaultNamesPlayer: ; 6aa8 (1:6aa8)
    db   "NEW NAME"
    next "RED"
    next "ASH"
    next "JACK"
    db   "@"

DefaultNamesRival: ; 6abe (1:6abe)
    db   "NEW NAME"
    next "BLUE"
    next "GARY"
    next "JOHN"
    db   "@"
ENDC
and add a new entry for your girl names. It will look something like this:

Code:
IF _RED
DefaultNamesPlayer: ; 6aa8 (1:6aa8)
    db   "NEW NAME"
    next "RED"
    next "ASH"
    next "JACK"
    db   "@"
    
DefaultNamesGirl:
    db   "NEW NAME"
    next "SCARLET"
    next "LEAF"
    next "NICOLE"
    db   "@"

DefaultNamesRival: ; 6abe (1:6abe)
    db   "NEW NAME"
    next "BLUE"
    next "GARY"
    next "JOHN"
    db   "@"
ENDC
Obviously, you don't have to use the same names I came up with. Just make sure they aren't too long for a player name and you are fine.

So that sounds like we are done with the intro, right? Not quite. We only added the entries for the name menu. We still need to enter the actual list it will reference, because Red Version was weird. So we'll scroll down a little more until we find:

Code:
IF _RED
DefaultNamesPlayerList: ; 6af2 (1:6af2)
    db "NEW [email protected]@[email protected]@"
DefaultNamesRivalList: ; 6b08 (1:6b08)
    db "NEW [email protected]@[email protected]@"
ENDC
and add the girl list in there. It should look like this:

Code:
IF _RED
DefaultNamesPlayerList: ; 6af2 (1:6af2)
    db "NEW [email protected]@[email protected]@"
DefaultNamesRivalList: ; 6b08 (1:6b08)
    db "NEW [email protected][email protected]@[email protected]"
DefaultNamesGirlList:
    db "NEW [email protected]@[email protected]@"
ENDC
You can also add those entries to the IF_BLUE lists as well, if you plan on compiling as a version other than Red. That is it for the actual ASM on the intro, but we still need to open another file to finish the intro up. Remember that text string we made up to reference earlier in the gender select menu? Yeah, we have to actually put that string into the game.

So let's save that file and open up /text/oakspeech.asm and scroll down to the bottom of the file. There we can add an entry that looks like this:

Code:
_BoyGirlText::
    text "Play as a boy, or"
    line "as a girl?"
    done
Then just save it and you're done with the intro. At this point, I would recommend compiling it again and testing the intro, just to make sure everything worked the way you wanted it to..

Step 4: Setting up the player's overworld sprites.

Ok, so you got the intro working nicely? Great! Time to move on to getting the game to show the proper sprites when you are fishing as the girl.

So let's go ahead and open up /engine/overworld/player_animations.asm and have a look. You'll want to search for Func_707b6: ; 707b6 (1c:47b6) to find what you are looking for. It will look like this:

Code:
Func_707b6: ; 707b6 (1c:47b6)
    ld c, $a
    call DelayFrames
    ld hl, wd736
    set 6, [hl]
    ld de, RedSprite ; $4180
    ld hl, vNPCSprites
    ld bc, (BANK(RedSprite) << 8) + $0c
    call CopyVideoData
    ld a, $4
    ld hl, RedFishingTiles ; $4866
    call Func_71771
You'll want to replace that with this:

Code:
Func_707b6: ; 707b6 (1c:47b6)
    ld c, $a
    call DelayFrames
    ld hl, wd736
    set 6, [hl]
    ld a, [wd798] ; added gender check
    bit 2, a      ; added gender check
    jr z, .BoySpriteLoad
    ld de, LeafSprite
    ld hl, vNPCSprites
    ld bc, (BANK(LeafSprite) << 8) + $0c
    jr .KeepLoadingSpriteStuff
.BoySpriteLoad
    ld de, RedSprite ; $4180
    ld hl, vNPCSprites
    ld bc, (BANK(RedSprite) << 8) + $0c
.KeepLoadingSpriteStuff
    call CopyVideoData
    ld a, [wd798] ; added gender check
    bit 2, a      ; added gender check
    jr z, .BoyTiles ; skip loading Leaf's stuff if you're Red
    ld a, $4
    ld hl, LeafFishingTiles
    jr .ContinueRoutine ; go back to main routine after loading Leaf's stuff
.BoyTiles ; alternately, load Red's stuff
    ld a, $4
    ld hl, RedFishingTiles ; $4866
.ContinueRoutine
    call Func_71771
Now I know, I know. That looks like a mess. But it's really just more of the same stuff we did in the intro. All we've done is copy part of it to make an alternate version it can load to get the girl's sprite and fishing tiles. Speaking of those fishing tiles, we'll need to add that little table it is referencing.

So let's scroll down a bit until we see:

Code:
RedFishingTiles: ; 70866 (1c:4866)
    dw RedFishingTilesFront
    db 2, BANK(RedFishingTilesFront)
    dw vNPCSprites + $20

    dw RedFishingTilesBack
    db 2, BANK(RedFishingTilesBack)
    dw vNPCSprites + $60

    dw RedFishingTilesSide
    db 2, BANK(RedFishingTilesSide)
    dw vNPCSprites + $a0

    dw RedFishingRodTiles
    db 3, BANK(RedFishingRodTiles)
    dw vNPCSprites2 + $7d0
We'll want to add a new table under it, that will look like this:

Code:
LeafFishingTiles: ; newly added table of Leaf's sprites
    dw LeafFishingTilesFront
    db 2, BANK(LeafFishingTilesFront)
    dw vNPCSprites + $20

    dw LeafFishingTilesBack
    db 2, BANK(LeafFishingTilesBack)
    dw vNPCSprites + $60

    dw LeafFishingTilesSide
    db 2, BANK(LeafFishingTilesSide)
    dw vNPCSprites + $a0

    dw RedFishingRodTiles
    db 3, BANK(RedFishingRodTiles)
    dw vNPCSprites2 + $7d0
You'll notice that leaf's table still calls one of the original graphics that Red used. I don't see a point in making an identical copy of the actual fishing pole tiles, only the part that is the actual player, so her table calls the same fishing rod sprite the boy did.

Now to move on to your walking and cycling sprites. You'll open /home/overworld.asm and take a look at it for this part. You'll want to find the routine called LoadWalkingPlayerSpriteGraphics for this part. You'll eventually find a routine that looks like this:

Code:
LoadWalkingPlayerSpriteGraphics:: ; 104d (0:104d)
    ld de,RedSprite ; $4180
    ld hl,vNPCSprites
    jr LoadPlayerSpriteGraphicsCommon

LoadSurfingPlayerSpriteGraphics:: ; 1055 (0:1055)
    ld de,SeelSprite
    ld hl,vNPCSprites
    jr LoadPlayerSpriteGraphicsCommon

LoadBikePlayerSpriteGraphics:: ; 105d (0:105d)
    ld de,RedCyclingSprite
    ld hl,vNPCSprites
And we'll just change this up a little to look like this:

Code:
LoadWalkingPlayerSpriteGraphics:: ; 104d (0:104d)
    ld de,RedSprite ; $4180
    ld a, [wd798]
    bit 2, a
    jr z, .AreGuy1
    ld de,LeafSprite
.AreGuy1
    ld hl,vNPCSprites
    jr LoadPlayerSpriteGraphicsCommon

LoadSurfingPlayerSpriteGraphics:: ; 1055 (0:1055)
    ld de,SeelSprite
    ld hl,vNPCSprites
    jr LoadPlayerSpriteGraphicsCommon

LoadBikePlayerSpriteGraphics:: ; 105d (0:105d)
    ld de,RedCyclingSprite
    ld a, [wd798]
    bit 2, a
    jr z, .AreGuy2
    ld de,LeafCyclingSprite
.AreGuy2
    ld hl,vNPCSprites
Now you can save this file, because that is all we had to do in here. If you were to scroll down a little more, you would see that we didn't mess with the part of the code that loaded which bank these sprites were in. That is why we kept Red and Leaf in the same bank when we inserted their sprites. It just seemed simpler to do it that way to me. As with all of the other sections, you'll probably want to stop and compile the rom again to make sure everything went ok before moving on.

Step 5: Adding The Girl's Backsprite.

This section will be relatively short compared to the others, because there isn't much to do here. We'll open up engine/battle/core.asm for this part.

Search until you find Func_3ec92: ; 3ec92 (f:6c92) and see that it looks like this:

Code:
Func_3ec92: ; 3ec92 (f:6c92)
    ld a, [W_BATTLETYPE] ; wd05a
    dec a
    ld de, RedPicBack ; $7e0a
    jr nz, .asm_3ec9e
    ld de, OldManPic ; $7e9a
.asm_3ec9e
You'll just want to change this to be:

Code:
Func_3ec92: ; 3ec92 (f:6c92)
    ld a, [W_BATTLETYPE] ; wd05a
    dec a
    ld de, OldManPic ; $7e0a
    jr z, .asm_3ec9e
    ld a, [wd798]
    bit 2, a
    jr z, .RedBack
    ld de, LeafPicBack
    jr .asm_3ec9e
.RedBack
    ld de, RedPicBack ; $7e9a
.asm_3ec9e
This just reorganises that a bit and adds in the check for the girl's backsprite. This also assumes that all 3 backpics are stored in the same bank, so make sure you did that unless you want to mess with the routine more on your own to allow them to be in different banks.

As always, you'll probably want to save and compile to test this before going on.

Step 6: Adding The Girl To The Hall Of Fame.

For this step, you'll want to open /engine/hall_of_fame.asm and search for Func_7033e: ; 7033e (1c:433e) to get to the function we need. It should look something like this:

Code:
Func_7033e: ; 7033e (1c:433e)
    ld de, RedPicFront ; $6ede
    ld a, BANK(RedPicFront)
    call UncompressSpriteFromDE
    ld hl, S_SPRITEBUFFER1
    ld de, $a000
    ld bc, $310
    call CopyData
    ld de, vFrontPic
    call InterlaceMergeSpriteBuffers
    ld de, RedPicBack ; $7e0a
    ld a, BANK(RedPicBack)
    call UncompressSpriteFromDE
    ld a, $66
    ld de, vBackPic
    push de
    jp LoadUncompressedBackSprite
    nop
    ld c, $1
We'll want to edit that so it looks like this:

Code:
Func_7033e: ; 7033e (1c:433e)
    ld a, [wd798] ; New gender check
    bit 2, a      ; New gender check
    jr nz, .GirlStuff1
    ld de, RedPicFront ; $6ede
    ld a, BANK(RedPicFront)
    jr .Routine ; skip the girl stuff and go to main routine
.GirlStuff1
    ld de, LeafPicFront
    ld a, BANK(LeafPicFront)
.Routine ; resume original routine
    call UncompressSpriteFromDE
    ld hl, S_SPRITEBUFFER1
    ld de, $a000
    ld bc, $310
    call CopyData
    ld de, vFrontPic
    call InterlaceMergeSpriteBuffers
    ld a, [wd798] ; new gender check
    bit 2, a      ; new gender check
    jr nz, .GirlStuff2
    ld de, RedPicBack ; $7e0a
    ld a, BANK(RedPicBack)
    jr .routine2 ; skip the girl stuff and continue original routine if guy
.GirlStuff2
    ld de, LeafPicBack
    ld a, BANK(LeafPicBack)
.routine2 ; original routine
    call UncompressSpriteFromDE
    ld a, $66
    ld de, vBackPic
    push de
    jp LoadUncompressedBackSprite
    nop
    ld c, $1
This will change it so it shows the girl's front and back sprites when your team is entered in the hall of fame. Save it and you are done with this step.

Step 7: Adding The Girl To The Trainer Card

This is the final step in the tutorial. You'll want to open up /engine/menu/start_sub_menus.asm for this part. Search for the function DrawTrainerInfo: ; 1349a (4:749a) and you should see something like this:

Code:
DrawTrainerInfo: ; 1349a (4:749a)
    ld de,RedPicFront
    ld bc,(BANK(RedPicFront) << 8) | $01
    predef Predef3B
So we'll just change that to:

Code:
DrawTrainerInfo: ; 1349a (4:749a)
    ld de,RedPicFront
    ld bc,(BANK(RedPicFront) << 8) | $01
    ld a, [wd798]
    bit 2, a
    jr z, .AreBoy
    ld de, LeafPicFront
    ld bc,(BANK(LeafPicFront) << 8) | $01
.AreBoy
    predef Predef3B
And you should be all set! Save it, compile it, and give it a test. If everything went as planned (and assuming I didn't accidentally leave anything out when writing this) you should now have a fully functioning gender selection system in place in Pokemon Red. Let me know if you have any problems and I will try my best to help you figure them out.
__________________
mateo.





"I'm gonna, uh, demonstrate the hot moves..." - Flannery

Last edited by Mateo; 5th May 2015 at 05:20 PM.
Mateo is offline   Reply With Quote
Old 4th May 2015, 04:43 PM   #7
Tailor
n00b
 
Join Date: May 2015
Posts: 3
Tailor
Default

I followed the tutorial on how to add a female playable character but when I try to compile the game after editing the intro, cygwin tells me it failed because of the unknown symbol "wd125".
I've followed the tutorial pretty much to the point and started from scratch at least 3 times already only to keep getting that error message.
I changed "Leaf" to "Green" everywhere but I doubt that really matters much.
Am I doing something wrong?
Tailor is offline   Reply With Quote
Old 4th May 2015, 10:25 PM   #8
Mateo
Johto Region Champion
AdministratorPHO VIP
 
Mateo's Avatar
 
Join Date: Jul 2013
Location: Johto
Age: 28
Posts: 813
Mateo Mateo Mateo Mateo Mateo
Default

Pokered has been updated since I made that tutorial, so that address has a different name now. I'll look up the fixed name for the latest versions of Pokered and get back to you.
__________________
mateo.





"I'm gonna, uh, demonstrate the hot moves..." - Flannery
Mateo is offline   Reply With Quote
Old 5th May 2015, 02:36 PM   #9
Tailor
n00b
 
Join Date: May 2015
Posts: 3
Tailor
Default

That would be great, thanks
Tailor is offline   Reply With Quote
Old 5th May 2015, 05:09 PM   #10
Mateo
Johto Region Champion
AdministratorPHO VIP
 
Mateo's Avatar
 
Join Date: Jul 2013
Location: Johto
Age: 28
Posts: 813
Mateo Mateo Mateo Mateo Mateo
Default

Replace it with wTextBoxID instead. I updated the tutorial just now to reflect this. That should take care of the problem. There is another value in that same section that had to be renamed to "wTwoOptionMenuID" I believe. Let me know if you run into anything else!
__________________
mateo.





"I'm gonna, uh, demonstrate the hot moves..." - Flannery

Last edited by Mateo; 5th May 2015 at 05:21 PM.
Mateo is offline   Reply With Quote
Reply

Tags
dummies, pokered, wip, [Guide]

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:06 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc. User Alert System provided by Advanced User Tagging (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Pokémon characters and images belong to Pokémon USA, Inc. and Nintendo.
Pokémon Hackers Online (PHO) is in no way affiliated with or endorsed by Nintendo LLC, Creatures, GAMEFREAK inc,
The Pokémon Company, Pokémon USA, Inc., The Pokémon Company International, or Wizards of the Coast.
All forum/site content (unless noted otherwise) and site designs are © 2006-2013 Pokémon Hackers Online (PHO).
Green Charizard Christos TreeckoLv100

"Black 2" by ARTPOP. Kyurem artwork by XOUS.

no new posts