PDA

View Full Version : Research: (Eventual) complete map of the Script area and beyond of Leaf Green.


Nerketur
January 27th, 2011, 05:24 PM
Changes (As of 4/13//2011)

Added an observation and theory, and a note

Well, I haven't updated this in a while, but I wanted to mention an update is coming by the end of this week. School has severely limited my time for this, but now that school is nearing completion, I'm getting more and more free time. While most of it will be for playing Pokémon Black, I will start updating this more regularly, once a month at minimum. I apologize for inactivity. I'm not going to let this die.

I've been thinking a lot about how I should post this, and I decided to just give an outline of what I've found so far, and then give my theories.

As a note, this is all for Leaf Green, English, not sure what version.
What I've found:
The scripts are organized in pretty much a standard way,. all the scripts are organized by where they are in the map for that bank. I haven't found any real correlation between the position of the OW sprite, and the script... but all scripts for a particular map are generally together. All (basic) text is found after all the (basic) scripts.

The spoiler contains an outline of what I've found so far, including offsets at the breaks, and labels of how I think it's organized. (I could have gone deeper, but haven't been able to because of school)


Offset: 0x160458


CELEDON DEPT.(0, 4)

Level:
Person:
Unknown (I think it's a last person that just isn't used):


Viridian Forest(1,0)

Level:
Person:
Sign:
Trainer:


Mt. Moon(1,1)

Level:
Signpost:
Trainers:


Mt. Moon(1,3)

Level:
Script:
Trainer (Fossil):

Fossil 1:

Movements:


Fossil 2:

Movements:




Person-trainer:


S. S. ANNE(1, 4)

Level:

Movements:




S.S. ANNE(1, 5)

Level:
Person:


S.S. ANNE (1, 6)

Level:
Script:

Movements:


Person:


S.S. ANNE(1,7)

Level:
Person:


S.S. ANNE(1,8)

Level:


S.S. ANNE(1,9)

Level:
Person:
Trainer:


S.S. ANNE(1, 10)

Level:
Person:



...
Offset: 0x172231


Strings:

Viridian Forest(1, 0)

Person:
Trainer:
Signs:


Mt. Moon(1,1)
Mt. Moon(1, 3)
S.S. ANNE(1, 4)
S.S. ANNE(1, 6)
S.S. ANNE(1,7)
S.S. ANNE(1,9)
S.S. ANNE(1, 10)



...
Offset: 0x1A4E8B

Pokecenter?:

Shared?: (unknown order)

...
Offset: 0x1A55F6

Strings?:

...
Offset: 0x1A636F

More Strings?:

...
Offset: 0x1A6651

Unknown scripts:


Movements - shared:

Mt. Moon(1,3)#org 0x1A75C7
#raw 0x30 'Face Right (Delayed)
#raw 0xFE 'End of Movements
S.S. ANNE (1, 4&6)#org 0x1A75C9
#raw 0x2D 'Face Down (Delayed)
#raw 0xFE 'End of Movements



...
Offset: 0x1A7ABC

Scripts:

Shared release/end:



...
Offset: 0x1A8CD2

Pokecenter:

Person:



...
Offset: 0x1ACDDF


Extra (people connected to Gym Leaders):

Person:

Mt. Moon(1,1)





...
Offset: 0x1BB1AE

Pokemon Center:

Scripts:



...
Offset: 0x1BB426



Movements:



...
Offset: 0x1BB89F


Wifi:

Script:

Celedon Dept.(0,0)
Celedon Dept.(0,3)
Celedon Dept.(0,1)
Celedon Dept.(0,2)


Person:

CELEDON DEPT.(0, 0)
Celedon Dept.(0, 1)
Celedon Dept.(0, 2)


Strings:

Celedon Dept.(0, *)


Unknown:

Link rooms?:
Unknown:
Pokemon Center (Wifi Area):



...

Offset: 0x1BC2ED

Strings:

Pokemon Center Wifi:
Link rooms:
Celedon Dept.(0, *):
Wifi (Continued):



...
Offset: 0x1BE584
Items:

Viridian Forest(1, 0)
Mt. Moon(1,1)
Mt. Moon(1, 3)
Mt. Moon(1,1)
Mt. Moon(1, 3)
S.S. ANNE(1, 10)





All of these gave me a general idea of how the data is organized. First of all, for each map, the scripts generally come in the order:


Level script (Should be "map" script, in my opinion)
Person (ANYTHING non-trainer)
Sign/Script (Not sure of the order of these just yet)
Trainer (All trainers)

Those random Pokéballs are found somewhere else, as are all the "special" people (the ones that ask about Gym Leaders, and possibly others) Anything that goes with a certain script is compiled after that script. (See Mt. Moon (1, 3) for an example.)

This gives me a few theories, and a few observations.

Observations (Last Update: 4/13/2011):


All Wifi items, scripts, and maps are compiled individually.
Strings are compiled separate from game code
Shared movements are compiled in a separate location.
Wifi portion isn't as "organized" as the rest of the game. The scripts are not quite made in order of map numbers.
Seems to have three separate sections: "Main", "Wifi", and "Items"
It's almost as if the Wifi portion was compiled in "sections", but these sections are hard to figure out. Wifi is certainly the most convoluted.
After playing through and beating Pokémon Black, I'm starting to realize a few things. GameFreak LOVES to re-use code.


Theories (Last Update: 4/13/2011):


They added all the random items after making the basic story and main game.
Wifi was added at the last minute, whereas, the main game was pre-organized.

This makes sense, if you consider the fact it's a remake of the RBY era, just with added stuff


The added items (Items after the main scripts, but before the Wifi area) were added also at the last minute.
They didn't care for optimization, just ease of coding. Which leads me to believe they, too, used a compiler, but not with "Pokéscript". I believe GameFreak actually had a compiler for all the scripts. One they made themselves, perhaps. I may attempt to make one.
I am now CERTAIN they use a compiler. If there is anyone willing to help me create one, please contact me.

TheDarkShark
January 28th, 2011, 07:16 AM
Seems to be useful. What about giving offsets (where exactly is the Script Area)? I wanna port the offsets to a German Rom, but just by looking on the events tab it is hard to locate the script area. (Sounds odd? I know, but porting offsets is easy when you know how to do it in a hex-editor.)

Nerketur
January 31st, 2011, 04:55 PM
Seems to be useful. What about giving offsets (where exactly is the Script Area)? I wanna port the offsets to a German Rom, but just by looking on the events tab it is hard to locate the script area. (Sounds odd? I know, but porting offsets is easy when you know how to do it in a hex-editor.)

I can only give what I have. I added offsets and new findings in the first post, but I make no guarantee that it is comprehensive and exhaustive. There may be scrips earlier than the first offset I give, and there are certainly offsets after the last one I gave.

As for why there are breaks? Those are areas I'm not sure of, yet. I'm pretty dang sure all of "Pokécenter" is together, though I haven't found every single thing yet. I wanted to post what I had, I'll update again shortly. As for organizing? I'll do that later. For right now, those parts that are convoluted I'm leaving convoluted, until I have a basic map of everything.

Now, a little note for all of you hackers out there. I recall a few things in the script Help thread that came up in the Pokécenter Scripts. "executeram" shows up for Mystery Gift, and that unknown Special 0x187 and 0x188. I'm almost certain that these specials do something special, and give results based on a few things, and I'm sure one of them allows for "loadmessage" and "preparemessage" to work properly. I'm not sure how, though. Also, the "special 0x1F/special 0x199" combo seems to close the connection over Wifi. It happens whenever an error is detected, so that would make sense.