+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Oracle of ages
Pages: 1 2 [3] 4 5 6
Author Topic: Oracle of ages  (Read 4 times)
Jigglysaint
Guest
« Reply #30 on: March 17, 2009, 09:26:59 pm »

Yup, totally right.  After fixing the town, the areas use bank 01 for data.  I assume that when you mean planes, you are refering to the 8 pointers that refer to the different data tables, right?

How things work is that there are 6 banks.  You have 4 banks for overworlds, and 2 for dungeons.  You may notice that for the dungeon banks, there are extra pointers that lead to the same stuff.  I changed the 7th pointer, which is the same as the first dungeon pointer, and went to a side view area.  Like I said before, these two extra pointers are used for side view areas and changing rooms.  When you go into a side view area, you actually do warp to a different plane that contains the same data(for the most part).  However, I will bet there are some data that is different, and they define those extra things.  What I did was I changed the first dungeon data pointer(for area data), then went into a side view area.  Instead of ending up in the same dungeon bank, I went to the next one.  However, the overhead areas remained the same.  This certain begs more research.
Dwedit
Guest
« Reply #31 on: March 17, 2009, 09:48:31 pm »

I'm calling them planes, you're calling them banks, same thing, except I like to reserve the word "bank" for an actual memory bank.

There are 8 planes.
00 = present overworld
01 = past overworld
02 = present underwater/inside houses/alternative maps
03 = past underwater/inside houses/alternative maps
04 = dungeons 1
05 = dungeons 2
06 = dungeons 1 alt?
07 = dungeons 2 alt?

The planes as noted here do not directly correspond with what you'd expect by looking at the overworld pointer tables at 4:4F6D (10F6D)

CC2D = your plane number
CC30 = room coordinates (upper nibble Y, lower nibble X)

I actually found that the game is really flexible about what plane the game actually tries to load.  It's affected by the CC2D plane number, the RAM flag indicating to OR the plane with 2, then finally, the Area Number for the map has an attribute that selects which plane is actually loaded.
Jigglysaint
Guest
« Reply #32 on: March 17, 2009, 10:21:42 pm »

I've been looking into the data for the tunstile in level 3, and it's interesting that there doesn't seem to be a flag that's triggered nor does there seem to be any alternate maps with the data.  I do know that once time I changed the plane number from 04 to 06 and it did appear, which indicates that the data must somehow be stored on that plane.

Also, yeah banks is not an approprate term.  Especially since it spans multiple banks.  A more correct term would be Dungeon Maps, or Dmaps, a term from Zelda Classic.  When I hear the word "plane", I think of layers.  Of course a plane could mean somthing like multiple dimentions or somthing, so it works in that way as well.  I'm still going to see how side view areas work, and why for some reason they use the alt planes.  One guess is that it has somthing to do with why the map cursor doesn't go right to that screen, but rather stays put.  It could also have somthing to do with how the edge of the screens work as well.
Dwedit
Guest
« Reply #33 on: March 17, 2009, 10:31:57 pm »

The part that loads metatile pieces and attribute data is a total Rube Goldberg device.  First it uses some confusing process to get data from the ROM into a buffer in RAM which stores a series of indexes.
Then it unpacks the indexes into actual data elsewhere in RAM.
I'll go to bed now, work on this tomorrow.

I found out a bit of how the map cursor works, basically Area Classes (yay inventing new terms) can allow the map cursor to update, or can prevent it from updating, can force the map cursor to be at the maku tree, or can be a dungeon map instead of the world map.  Also, the area class indicates whether it uses the Past map or the Present map.
Jigglysaint
Guest
« Reply #34 on: March 17, 2009, 10:36:37 pm »

You mean what I've been calling macros?  Basically lines of pre constructed rows of data?  Anyway, I found out that what's happening is that those rooms stay the same, but tile data is written over top of certain areas to make it look different.  I am pretty sure that the floating islands in level 7 do the same thing.  I bet it's controled by the event data.
Dwedit
Guest
« Reply #35 on: March 18, 2009, 06:35:29 am »

No, I wasn't talking about the dungeon macros.
Jigglysaint
Guest
« Reply #36 on: March 18, 2009, 11:10:51 am »

Quote from: Dwedit on March 18, 2009, 06:35:29 am
No, I wasn't talking about the dungeon macros.

Oh, okay.  Just trying to get on the same page as you.  So Area Classes, as you call them, are basically the data that detemines how the map screen works.  If I remember correctly as well, on top of that, $40 makes the area have water, and $80 changes the graphics of the treasure chests from present to past.
Dwedit
Guest
« Reply #37 on: March 18, 2009, 12:15:31 pm »

Not just the treasure chests, press Select and the map also becomes the past.

$20 makes the area sideview.
Jigglysaint
Guest
« Reply #38 on: March 18, 2009, 09:44:50 pm »

Quote from: Dwedit on March 18, 2009, 12:15:31 pm
Not just the treasure chests, press Select and the map also becomes the past.

$20 makes the area sideview.

I was actually refering to dungeons, but it makes sense for the overworld too.  I bet it's also what allows for the use of the Tune of Currents as well.

Edit:  Nope.  Okay, I found the code that determines if the screen is a small one or a large one.  Planes 04 and 05 are the ones that have enlarged rooms.  Changing it to 00 will make every screen large, but it doesn't actually enlarge the scroll boundries.  A few edits coupled with an overhaul of the map data will allow for larger sized overworlds, but that's foolish because nobody would want to code the overworld using dungeon style macros.  I also found that with the warp data, the last 2 planes are in fact used for sideview areas.  Basically, side view areas are either in plane 06 or 07, and when editing warp data, that must be put into consideration or else some things might not work, like exits and such.

Edit 2:  I was looking at the overworld pointers, and it seems that it's the same relative type as the dungeons, except it seems that the second byte of a pointer seems to have additional properties.  I suspect it has somthing to do with how the data is organized.  Perhaps the extra bits tell the game to use only one control code per line instead of 2.  I need to look into it some more.
« Last Edit: March 24, 2009, 06:47:39 pm by Jigglysaint »
Dwedit
Guest
« Reply #39 on: March 24, 2009, 08:06:12 pm »







I've been working on a "Viewer" program for quite some time now.  This one is done in wxWidgets with no VB code, and no hardcoded image data.
I can currently load the palette, VRAM, and tileset for a given "area class" now.  Just need to throw in the maps.

Where are these "Relative pointers" you keep talking about?  I only see absolute pointers to maps in the pointer table.  You mask off the top 2 bits off the 16-bit address to determine which mode to decode the map in.
« Last Edit: March 24, 2009, 08:19:18 pm by Dwedit »
Jigglysaint
Guest
« Reply #40 on: March 25, 2009, 12:01:46 am »

What I meant by relative pointers, is that the pointers to the map data itself(the rooms), are not done in the usual mode of addressing the ram space, in the GBC's case, $40 to $7F.  Instead it starts from where the map data starts, then uses that pointer to skip that many bytes ahead.  Obviously the first room would be $00 00, but what I found with the overworld is that the first room actually has the pointer of $00 80.  That's odd since the GBC does not work that way.  What I found is that the extra bits on the second byte seem to do somthing.  I am not sure what it is though.  The pointer to the list of pointers is where I showed you before, in that little area before the area class list.  7 bytes for each plane with the first being what compression to use.  The next 3 bytes are a 3 byte pointer to the pointer list, or the macro and pointer list if that first byte is $00.  Next 3 bytes is where the data actually starts.  You take a pointer from the list and convert it into decimal, then count the number of bytes untill you get to the room you want.  The overworld pointers seem to have extra data in them that determines somthing.
Dwedit
Guest
« Reply #41 on: March 25, 2009, 12:39:19 am »

Yep, they are indeed all relative to a fixed base (forgot about that long after I made the VB program, but I looked and there they were.)
There is one base for each "plane"  (planes are not ordered the same way as the game internally processes them, the second and third plane (#1 and #2) are swapped.
Upper 2 bits of the address are the decompression mode, 00=uncompressed, 01=8 common tiles, 11 or 10 = 16 common tiles?
Jigglysaint
Guest
« Reply #42 on: March 25, 2009, 11:37:37 am »

Oh so you mean it basically tells the game how to treat the data at that location.  I wonder if that means there are uncompressed maps in certain places?  Uncompressed maps might be useful when there is enough unique tiles on the screen that compression would be fruitless.  Conversely, using a 16 tile encoding would be great for screens with only one or two types of tiles on the screen, such as sea maps.
Dwedit
Guest
« Reply #43 on: March 25, 2009, 05:50:03 pm »

Two different meanings of plane numbers:
CC2D plane number (the one you request, gets ORed with 2 if the RAM flags say so)
0 = present overworld
1 = past overworld
2 = present alt
3 = past alt
...
CD24 plane number to actually load based on the area class
0 = present overworld
1 = present alt
2 = past overworld
3 = past alt
...

I'm not currently looking at dungeons right now...
Jigglysaint
Guest
« Reply #44 on: March 25, 2009, 10:51:54 pm »

Okay I confermed what the pointers do.  For overworlds, how it works is 4x of the second byte means that there is one control byte, followed by the tile that fills up all the 1's.  If the pointer is 8x, then it uses 2 control codes followed by the tile value of 1.  If however, it is set to 0x, then no control code is used.  This affects the entire screen, so if the first line uses a double control code, then the entire screen will use that.  This means 0x as the second byte is uncompressed tiles.  This will be important when loading the map data.
Pages: 1 2 [3] 4 5 6  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC