The FE8 research topic

There’s actually two prologue scenes for the world map, for the other chapters. One of the pointers points to stuff that happens when you’re done with a chapter and loads the world map (so stuff like “load where Ide is, put a waving flag, and make it so you can access Ide”) and the other tells you the stuff that happens when you actually make your character go there (stuff like “display Hayden’s portrait, talk about how he can’t spare many soldiers, and put flashy dots on Grado’s capital”).
some miscellaneous documentation

Yeah, the post-chapter world map scenes are already included in Event Assembler’s script folder; it’s just the pre-chapter scenes that weren’t documented before. Not to mention 99% of the names for these commands are misleading or nonexistent.

Your notes on the world map locations will be a nice time-saver, so thanks for those!

Hey.

I’ve managed to make the game automatically move you to the next chapter. You don’t even have to see the world map if you don’t want to. It’s very hackily implemented at the moment, but I expect I’ll get it to be more natural as I progress.

Moving the world map locations to different coordinates causes weird bug where character will travel all the way across the map and then all the way back to where they’re supposed to go to.
2064C0 data for these things
change the coordinates there (it’s the corners of the lines on the map) (i.e. 78 00 68 00 is the corner of the line leading from frelia to ide) and it’s fixed
hmm testing on fresh fe8 rom now
yep it works. the graphical lines are hardcoded to be drawn in the same place though so if you’re changing the locations, take those out

Nice work! Looks like for scripted movements to locations, you don’t need the lines to be present.

You do need to have executed the _0x9720 command, which unlocks the location, first, or else the game will lock up after the pre-chapter world map cutscene.

Edit: After some further investigation, I’ve determined that the coordinates for actual locations on the map (Mulan, Ide, Za’ha Woods, etc) are located at $2060C8. They’re stored as coordinate pairs every 0x20 bytes, and I’m sure the other bytes in that region are useful too. Changing these coordinates is reflected graphically, making the sprites for these locations move around on the map!

I’ve got https://docs.google.com/file/d/0B_FpsXWx8aCGNTN0VVBLQW9DNm8/edit (it’s an .nmm file, so no preview) for that area of memory. It contains the icons for the locations, shop pointers (armory, shop, secret), the text for the location, the coords, and some more unknown stuff.
Keep in mind that to move the sprites of the locations around without causing very weird movement when the character travels there will require you to change the corner things in my previous post as well.

…I can’t believe I overlooked that. Didn’t mean to ignore your work, sorry.

I took a look at the values with the help of your module, and I think that the "Unknown 1’ parameter controls which path and path graphic that world map location uses (or rather, which ones that chapter unlocks); “Unknown 2” seems to control what world map events that chapter uses - setting Ide’s to Renvall’s values takes you directly to chapter 8, for instance.

For instance, Castle Frelia’s Unknown 1 parameter is 0088 3838. Changing it to 0089 3838 unlocks the Tower of Valni and port Kiris instead of Ide; probably because you’re still in Eirika mode. I imagine Ephraim mode would unlock Fort Rigwald instead of Kiris.

Hmm, this seems very useful. I wonder if I can go to Rigwald as Eirika…

I’ve found the data that determines which paths connect to what; with this data, now you can make any path connect to any two locations on the world map and customize the path’s speed, number of corners and whether or not ship travel is enabled by pointing to whatever path data you want.

I’ve also updated the world map location editor to provide some clarity on more of the values; three locations (Castle Frelia, Serafew and Border Mulan) will execute new events depending on the state of a permanent Event ID, for instance; and each chapter has two bytes denoting its chapter ID on Eirika and Ephraim mode, used for things such as skirmishes.

Nightmare modules for both of these things are here.

1 Like

So, I’ve figured out how FE8 draws its paths on the world map; it’s really a neat system. The paths graphics aren’t stored as whole graphics, but as little pieces which you can put together to draw any of the paths on the world map.
The path graphics data, which is pointed to by the path connections data at $8206674, starts at $8A97FC4 - that’s the graphics data for the Border Mulan - Castle Frelia path.

Each path is drawn in horizontal strips; for each strip, you can define their X and Y coordinates and how many tiles will be in that strip. For instance, let’s look at the Border Mulan data:

0C 08 03 01 

These four bytes start off a horizontal strip for any path. The first two bytes are the X and Y coordinates of the top-left edge of the strip. The next byte indicates how many tiles this strip will contain. I’m not certain what the fourth byte is, but it appears to always be 0x1, and changing it causes crashing or garbage tiles to be drawn.

After this comes defining the tiles this strip will use, with two bytes per tile. Here are the three tiles the top strip of this path uses:

01 00  01 00  07 00 

The first byte of the tile indicates what graphic to use. 0x1 gives a horizontal section of path at the bottom of the tile, ad 0x7 gives a tiny bit of corner rounding at the bottom-left of the tile.

The second byte is a sort of modifier to the tile graphic; it can affect the graphic’s position and orientation, and is used by corners and diagonal lines. For instance, while 0x7 0x0 gives a corner at the bottom left, 0x7 0xC gives a corner at the top-right of the tile.

Here’s the rest of the graphical data for the Mulan-Frelia path:

0C 09 04 01 02 00 02 00 06 00 07 00

0E 0A 05 01 07 0C 06 00 01 00 01 00 01 00

0F 0B 04 01 07 0C 02 00 02 00 02 00 FF 00 00 00

So, this first path has four horizontal strips; to end the list of strips, write out 0xFF000000 at the end of the last strip.

Lastly, this graphics data must be word-aligned, so don’t put the start of any lists at an offset that isn’t a multiple of 4.

2 Likes

I’ve encountered a serious problem with expanding the maximum number of paths for the world map.

The game stores the IDs of all the paths you’ve unlocked, one after the other, at $03005324; and there’s only space there for 31 entries, equal to the number of path IDs used in vanilla. After that, it gets bit-packed into a region near the start of the stack; and there there’s only 4 bytes = 32 bits allocated for the path IDs. From there, the data gets stored to the SRAM along with a couple dozen other bytes.

I’m…not sure how to work around this issue, and I’d rather be able to straight-up expand the number of IDs available than make up some hacky solution. If anybody has advice on this, I’d be glad to hear it.

This is really interesting. It seems we’ll be able to hack the world map finally!
While I was away these few weeks, I tried to figure out what most of the codes do. But it seems that everything I discovered has already been documented by you, Venno, lol.
Hit me on skype, I’ll do my best to help

Was reading old FEU’s docs, and, well

“Indeed, back when it was asked, it wasn’t known. It is now, I have some very few info on it. Only thing I couldn’t change yet is the walking “Grid”, like roads and stuff. But if we try enough it will be found soon enough. And then someone could code a very simple app to work as a “World Map Maker”.” - Ryrumeli - 17th November 2010 01:10:35

–4 years later-- :wink:

It’s a damn shame Ryru’s girlfriend destroyed his computer and all his notes.

Which is why nowadays, the FEcommunity’s notes are on the cloud in dropbox!

Hopefully.

If not, WHAT IS WRONG WITH YOU.

edit: or on forums like this. idk most of my docs are scattered here somewhere. I swear, someday I’ll compile them into comprehensible, well-ordered notes.

you should just have a public database of hacking notes like i do

I’ve updated my event/world map code listings.
Chapter Codes
World Map Codes

Here’s an example of one of the newly documented codes:

$08010110 - _0x332X commands, one parameter
Generally these check something about a character of the given ID
-Loads last digit of command to r4
-Loads parameter to r5 and signed version parameter to r0
-Branches to $0800BC50(finds unit deployment data of unit to check):
    -If param was 0xFFFF: checks active unit (currently selected for moving/attacking at $03004E50;used for AREA, village events)
    -If param was 0xFFFE: checks unit that's somewhere on the map?? (loads from 030004E6,0202E4D8...)
        -May just return 0x0, however... this is unused in the normal game
    -If param was 0xFFFD: checks unit with ID stored in memory slot 2

-With the offset of the unit data to check, filter out by r4's value
    _0x3320: Always return True (store 0x1 to slot 0xC)
    _0x3321: Loads byte 0x30 (Unknown) from the unit's character data and stores to slot 0xC
    _0x3322: Check if unit is alive (has bit 3 set in state bitfield - return 0x1 if it does not)
    _0x3323: Check if unit is deployed
    _0x3324: Check if unit's character number = signed version of parameter. Store 0x0 if not. (wut)
    _0x3325: Checks unit's allegiance; in mem.slot 0xC, store 0x2 if enemy, 0x0 if Player, 0x1 otherwise
    _0x3326: Stores unit's coordinates (XXXXYYYY) to memory slot C
    _0x3327: Stores unit's class number to memory slot C

And for those that are interested, here are some more general notes on the workings of the world map:
Notes
Coordinate Notes

Random note on FE8: The 8 pointers located at D77BC determine which minimug to load for the generic soldier characters (with the next 8 pointers being which palette to use for the minimug). Playing around with those, you get things like

_0x0228 0x7// (aka the "terminate events" code, used before ENDA or ENDB)

Please note that this code is absolutely necessary before ENDA, otherwise you'll get a random fade in/out effect.
Also note that this should be used ONLY before the LAST ENDA in your current event. For example, if you've something
like this:

BeginningScene:
CALL PuledraNaked
STAL 0x20
_0x0228 0x7
ENDA

PuledraNaked:
Text(0x0A60)//lewdstuff
ENDA

As you can see, I didn't put _0x0228 0x7 in the event I CALLed, because that wasn't supposed
to be the last event in the BeginningScene. Why is this important? Well, when you press
"Start" and skip the events, the game executes a fade in/out effect and automatically goes
to the ENDA with _0x0228 0x7 before it. If there's more than one _0x0228 0x7, the game doesn't
understand where it should go, and it'll just speed up the events instead of skipping them. (see: it looks like shit)

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-

ENDB// (aka the "you shall not pass, bitch!" code)

This code is boss. It's like ENDA, but it instantly ends your events.
What does this mean? Well, if you CALL an event that ends with ENDA,
you'll return to the previous event after the CALLed one is resolved.
But if you end the CALLed event with ENDB, it'll stop there.
It's particularly useful with conditional events.

For example, if you want to repeat an event until a certain condition is met, you could do this:

MiscBasedEvents:
AREA 0x10 control [22,16] [24,19]
AFEV

control:
_0x3322 0x4C// is unit 0x4C alive?
 _SETCONDITION 0x2C 0xC 0x0// set a condition with condition ID 0x2C
CALL notyet// calls the notyet event if it's alive
ELSE 0x2D// sets the alternate conditional ID 0x2D in case it is NOT alive
ENIF 0x2C// reads till this point if it's alive
Text(0x09DE)// shows text 0x09DE if unit 0x4C is dead
ENIF 0x2D// reads till this point if it's not alive
Text(0x09DF)//shows text 0x09DF
_0x0228 0x7
ENDA

notyet:
_0x0221 0x10//marks event ID 0x10 as unused
_0x0228 0x7
ENDB

How does this stuff work?
Say that I want to show a specific dialogue if a unit steps in an area when the character 0x4C is dead.
Firstly, you activate the "control" event with event ID 0x10 if you step in the area included between [22,16] (top left corner)
and [24,19] (bottom right corner).
Then you check if the unit 0x4C is alive or not. If it is alive, then the designed text shouldn't be displayed yet. This is
when the "notyet" event is called, which basically marks the AREA event ID as unused (so that you can activate it
again by stepping there). Then it instantly ends the events with ENDB. What if there was ENDA there?
Well, you'd have returned to the "control" events, and proceeded after the conditionals, displaying Text 0x09DF.
This way, we display 0x09DF only when we don't call "notyet", meaning when 0x4C is dead.
This was just a lame example to show how ENDB works.

----------------------------------------------------------------------

_0x2720 triggers tile changes manually.
It can be written in two ways:

_SETVAL 0xB 0xYY00XX// [XX,YY] coordinates of top left corner
_0x2720 0xFFFF// trigger tile changes

or

_0x2720 0xID

where "ID" is your tile changes ID, which you can set in Tiled.

---

Similarly, _0x2721 cancels the tile changes.

Just some very random documentation about some codes.

3 Likes

Link’s broken :confused: