Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2011-10-20 08:26:38

swampert22
Member
From: Switzerland
Registered: 2010-10-16
Post 3/26
Website

[R/B/Y] Question about the Game Corner Prizes

Hello everyone!

I've got a question regarding what controls the level of the Pokémon you receive as a Prize in the Game Corner Prize room.

What I've already found is:

For each 'window' in the prize room, the data can be found as

50XXYYZZ50AAAABBBBCCCC50

whereby:

XX is the first Pokémon in the list
YY is the second
ZZ is the third

and

AAAA is the price of the first Pokémon (in decimal)
BBBB is the price of the second
CCCC is the price of the third

However, on changing XX for example say from Abra to Charizard, the level of the Pokémon you then receive goes crazy! So I was wondering what links the Byte for the Pokémon to it's level when you receive it!

The offset for the start of the first 'window' is $52859 in R/B and $527BA in Yellow. Thanks for any information on this mystery!

Regards,

swampert 22


For Pokémon ROM hacking tools, please visit my site www.swamperttools.co.nr!

Check out my latest tool release, a trainer editor for Pokémon Red and Blue!

Offline

#2 2011-10-20 14:48:51

Sawakita
Administrator
Registered: 2010-10-16
Post 216/364

Re: [R/B/Y] Question about the Game Corner Prizes

Hi there,

swampert22 wrote:

For each 'window' in the prize room, the data can be found as

50XXYYZZ50AAAABBBBCCCC50

I'm just nit-picking but the actual data is XXYYZZ50AAAABBBBCCCC50, without the initial $50 (which in fact is a marker for the end of an array of bytes).

swampert22 wrote:

However, on changing XX for example say from Abra to Charizard, the level of the Pokémon you then receive goes crazy! So I was wondering what links the Byte for the Pokémon to it's level when you receive it!

That's because you're missing another piece of data (I'm guessing that you used just a hex editor, right? Without debugging the routine, there are many chances you miss important information!). In fact there's another data structure, similar to a dictionary:

;Red/Blue [$5298a]
94 06 
04 0C
A7 11
1D 14
58 18
AA 12

;Yellow [$528ea]
94 0F
52 12
65 16
1A 1E
1D 1E
AA 1A

First byte is pokemon_ID, 2nd byte is the level.

When the program obtains the pokemon_ID from the first table (Red/Blue = $52859,  Yellow = $527BA), it searches through the second table for a match, until it finds it, and then takes the corresponding byte (pokemon's level).
If you modify only one table, the incompatibility between the two tables will cause flaws, as you have experienced.

Offline

#3 2011-10-20 17:03:40

swampert22
Member
From: Switzerland
Registered: 2010-10-16
Post 4/26
Website

Re: [R/B/Y] Question about the Game Corner Prizes

Ah! I see, you're right in that I simply searched the data in a hex editor. The question I have is why does the game have the data repeated twice? And, on changing only the values at the location you showed, it has the desired effect, rendering the first table of values apparantly useless! Or does it form some part of error checking?

Another question, (sorry) what do you use to debug the routine? I'd really like to be able to find these kind of things myself, without having to bother people like you for example ;)

Thanks very much!!


For Pokémon ROM hacking tools, please visit my site www.swamperttools.co.nr!

Check out my latest tool release, a trainer editor for Pokémon Red and Blue!

Offline

#4 2011-10-21 14:28:08

Sawakita
Administrator
Registered: 2010-10-16
Post 217/364

Re: [R/B/Y] Question about the Game Corner Prizes

swampert22 wrote:

Ah! I see, you're right in that I simply searched the data in a hex editor. The question I have is why does the game have the data repeated twice? And, on changing only the values at the location you showed, it has the desired effect, rendering the first table of values apparantly useless! Or does it form some part of error checking?

The two tables are both required. The first one is used to display the menu and to define what pokemon you'll actually be able to receive. My guess about why the programmers used the two tables (instead of just one without repetitions) is that the code to write in order to handle this kind of data arrangement is simpler and shorter to write. So, basically, and this is just my opinion, they could save more space and code cycles this way, rather than building a single table without repetition (because it would require more processing, to obtain the correct offset of a certain byte).

swampert22 wrote:

Another question, (sorry) what do you use to debug the routine? I'd really like to be able to find these kind of things myself, without having to bother people like you for example ;)

I use BGB. Actually you could just use a hex editor, but I think it's very unhandy, often (it's not so nice when you have to "read" the code in machine language).
Following the code process step-by-step using a debugger is nicer, at least for me. With BGB you can view and manipulate, at the same time, the status of RAM and of registers, and consequently of the code process itself.

swampert22 wrote:

Thanks very much!!

No problem, man. Have fun.

Offline

Board footer

Powered by FluxBB