øAslickproductions.org/forum/index.php?PHPSESSID=b2phq0ehqc7umand281jipqej2&topic=1856.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexfa34.htmlslickproductions.org/forum/index.php?board=13.140e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexfa34.html.zx®2g^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ ,/¹0OKtext/htmlISO-8859-1gzip@øÕ¹0ÿÿÿÿÿÿÿÿTue, 10 Mar 2020 06:41:09 GMT0ó°° ®0®P®€§²ð®­2g^ÿÿÿÿÿÿÿÿC/¹0 Where are the graphics for... well... everything?

Author Topic: Where are the graphics for... well... everything?  (Read 8083 times)

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Where are the graphics for... well... everything?
« on: August 16, 2013, 12:00:05 PM »
USE TILE LAYER! or something yeah I know, but that will only get me so far. Particularly I need to know where the palettes are for these things (and if the offsets for the graphics themselves happen to be known off hand it would also save me some work digging around with a graphic tool trying to find them myself; I'd rather spend my time programming than hunting, though I will if I have to). In addition, some things are animations as opposed to simply static sprites, so I would love to have some details on how those work. Wouldn't it be great to see in FF4kster for example a preview of the currently highlighted spell animation with the currently selected palette, instead of just a bunch of numbers?

So really I need the details for as many different things as humanly possible, but here is a list of the more high-priority things:
  • Spell animations
  • Summon animations
  • Weapon graphics (FF4kster calls these "sprite")
  • Weapon animations (FF4kster calls these "slash")
  • Medicine animations (e.g. Lit-Bolt, Fire Bomb, etc)
  • Character portraits
  • Character battle sprites
  • Character map sprites
  • NPC map sprites
  • Map tiles (the grass, forests, walls, etc, for both overworld and inner maps)
  • Monster sprites
  • Boss sprites (I understand some of these work differently from the regular monster sprites?)
  • Battle backdrops

Also I know some of the things on this list are well known and easy to find but I'm going to keep them here for the sake of organization.
Let's dance!

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Where are the graphics for... well... everything?
« Reply #1 on: August 16, 2013, 12:48:53 PM »
Unheadered binary offsets:

Code: [Select]
0x48000 - 0x4FFDF:  Monster Graphics 1 (3BPP)
0x50000 - 0x56EFF:  Monster Graphics 2 (3BPP)

0x57000 - 0x57FFF: Font (2BPP)

0x58000 - 0x5FD57: Monster Graphics 3 (3BPP)
0x60000 - 0x616F7: Monster Graphics 4 (3BPP)
0x616F8 - 0x632F7: Zeromus Transformed Graphics (4BPP)

0x636C0 - 0x67277: Spell Effect Graphics (3BPP)

0x679C0 - 0x67FEF: Battle Status and Numeral Graphics (3BPP)

0x68818 - 0x6E397: Summoned Monster Graphics (3BPP)

0xACC00 - 0xAD83F: Ending Solar System Graphics (4BPP)

0xADC00 - 0xAFFFF: Airship Tileset (4BPP)

0xD0000 - 0xD7DFF: Battle Character Sprites [800 per char, Golbez/Anna shared] (4BPP)
0xD8000 - 0xDB2FF: Playable Character Field/Overworld Sprites [200 per char] (3BPP)
0xDB300 - 0xDFFDF: NPC Field Sprites (3BPP)
0xE0000 - 0xE27EF: Overworld Sprites (3BPP)

0xE5900 - 0xE637F: Battle Weapon Sprites (3BPP)
0xE6380 - 0xE6DFF: Battle Weapon Slash Sprites (3BPP)

0xED3C0 - 0xEED3F: Character Menu Portraits (3BPP)

0xEED40 - 0xEFFFF: Castle Exterior Tileset (3BPP)
0xF0020 - 0xF1567: Cave Magnes/Sealed Cave Tileset (3BPP)
0xF1568 - 0xFE7F8: Remaining Tilesets [can break these down later] (3BPP)

I lost the document I originally had these in, so dug them up again. Overlooked battle BGs somehow. Had palettes at one point too; hopefully someone still has those.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Where are the graphics for... well... everything?
« Reply #2 on: August 16, 2013, 05:36:04 PM »
"Ending Solar System Graphics..." is that where the moon breaks away from the solar system?

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Where are the graphics for... well... everything?
« Reply #3 on: August 16, 2013, 05:48:09 PM »
I'm not sure if the moon is in there, but yeah, should be those graphics.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Where are the graphics for... well... everything?
« Reply #4 on: August 16, 2013, 09:37:19 PM »
I'm gonna look around and see if I can find the palettes documented. If I (or someone else) don't find them within a few days, I'll use the TLP/SNESPal method to figure them out.

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Where are the graphics for... well... everything?
« Reply #5 on: August 16, 2013, 09:43:23 PM »
Zyrthofar's editor can do the spell/weapon palettes (they're shared, so ff4hackster doesn't currently have all the possible weapon palettes, just the intended ones), so those are easily tracked down via edits in that at least. And I know most of the others are documented somewhere, but finding them again is pretty painless.

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Where are the graphics for... well... everything?
« Reply #6 on: August 22, 2013, 08:53:53 PM »
Here are some palette offsets courtesy of Phoenix and Yousei:

Code: [Select]
D0200-D7E3F Battle Character Graphic Data (4 bitplanes, composite)
D0200-D09FF Dark Knight Cecil
D0A00-D11FF Kain
D1200-D19FF Young Rydia
D1A00-D21FF Tellah
D2200-D29FF Edward
D2A00-D31FF Rosa
D3200-D39FF Yang
D3A00-D41FF Palom
D4200-D49FF Porom
D4A00-D51FF Paladin Cecil
D5200-D59FF Cid
D5A00-D61FF Older Rydia
D6200-D69FF Edge
D6A00-D71FF FuSoYa
D7200-D77FF Pig
D7800-D7B5F Golbez
D7B60-D7D1F Anna
D7D20-D7E3F (blank)
E7F00-E80FF Character Battle Palette Data

Code: [Select]
68200-6823F Overworld Character Palette Data
AB4FA-AB50B Overworld Character Palette Pointers (1 byte per character, values 00-03)
D8200-DB4FF Overworld Character Graphic Data (3 bitplanes, composite)
D8200-D84FF Dark Knight Cecil
D8500-D87FF Kain
D8800-D8AFF Young Rydia
D8B00-D8DFF Tellah
D8E00-D90FF Edward
D9100-D93FF Rosa
D9400-D96FF Yang
D9700-D99FF Palom
D9A00-D9CFF Porom
D9D00-D9FFF Paladin Cecil
DA000-DA2FF Cid
DA300-DA5FF Older Rydia
DA600-DA8FF Edge
DA900-DABFF FuSoYa
DAC00-DAEFF Mini
DAF00-DB1FF Toad
DB200-DB4FF Pig

Code: [Select]
688D0-689CF Character Portrait Palette Data
ED5C0-EEF3F Character Portrait Graphic Data (3 bitplanes, composite, 384 bytes per class id)

Code: [Select]
44200- (08C000-      ) Title Screen Graphic Data

46A00-46AFF (08E800-08E8FF) Title Screen Palette Data

68200-6823F (0D8000-0D803F) Overworld Character Palette Data
68240-6827F (0D8040-0D807F) Overworld Vehicle Palette Data

7D400- (0FD200-      ) Battle Background Palette Data

A0800-A0AFF (148600-1488FF) World Map Tile Palette Pointers
A0B00-A0C7F (148900-148A7F) World Map Palette Data

A6000-A6FFF (14DE00-14EDFF) Town Map Palette Data

E7000-E7E9F (1CEE00-1CFC9F) Enemy Palette Data

If you don't have a copy of Yousei's old FF4.txt, I've attached it.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Where are the graphics for... well... everything?
« Reply #7 on: September 19, 2013, 11:51:09 PM »
The standard monster sizes, 00 - 10 (hex) are defined in a table beginning at 7015E.

Each is two bytes, representing the width and height respectively.
I found them while hunting for the "special" sizes. I imagine those are nearby, but I'll have to play around with some special sized monsters to try to figure it out. I imagine the encoding will be pretty complicated. As I recall, the "size" byte points to a set palette as well (changing the byte in the monster's image data that normally would change the palette has no effect, and most "special" size monsters have a 00 in their palette byte).

Obviously, this would be the exciting part, allowing you to fight against Shiva/Indra/Jinn without messing up other monsters.
I'll figure it out eventually. In the mean time, enjoy making 1x1 and 7x7 enemies (or 1x7, or 5x14, or whatever rectangle you can dream up).

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Where are the graphics for... well... everything?
« Reply #8 on: September 23, 2013, 10:12:24 AM »
New discovery!

I found out where the game stores the palette pointers for the "Special" sizes.
Once the game determines that the monster is a special size, it looks up a set of five corresponding bytes in a table at 7D000 (FCE00 in LoROM).
Byte 02 determines the palette.

So, for D. Mist (Size 80), the five bytes are at 7D000 and are:
35 91 A1 02 00
D. Mist uses Palette A1 (Multiply by 10 hex and add to E7000 = E7A10 for the beginning of the palette data).
If I want D. Mist to use Imp's palette instead, I change the data at 7D000 to read:
35 91 00 02 00

Of course, D. Mist changes into mist and at that time changes to special size 81, so you'd need to change the A1 at 7D007 to the same thing, unless you want the mist to be a different color than the dragon.

So there you have it. Unfortunately (I guess), the palette must stay linked to the size, but by default, each special size is linked to only one monster (and to change that fact would probably be more work than it was worth anyway).  I'm sure the other four bytes per size in this table do fun things as well, but I haven't experimented yet. I'll keep you posted.
 :edit: It seems the other four bytes work together to point to the sprite arrangement.  I don't know why the programmers chose to sprite it the way they did, because these numbers all roll around a bunch then finally end up indicating a two-byte pointer in the table beginning at 75100 (ECF00 in LoROM).
 :edit: 2 The fifth byte in the five byte sequence above indicates which pointer within this table will be used. So, D. Mist's fifth byte is 00 - it will use the first pointer.
Add this pointer to E0000 in LoROM, or 68200 in ROM, to get to... Dat-da-da-daaah the sprite arrangement data!
It doesn't work exactly like it does for summons. Basically, when a monster's image is loaded into the game, the game starts at the pointer and loads a ton of sprites into memory - more than it needs for one image, more on that later.
The game has also, at this point, picked out a size from the table at 7015E, which is larger than we originally thought. More on that some other time - I have to finish up for the day.
 :edit: The size is determined by the second byte of the info at 7D000, but only by bits 0-5 of that byte. bits 6-7 have an entirely separate purpose (don't know).
So, using the example of D. Mist again, byte 01 of its entry in the table is 91 (10010001). Ignoring bits 6-7 (for the moment), we get 11 (--010001). This tells us that D. Mist uses the 11th (hex) size in the table (0Ax08). If we wanted D. Mist to be 2x2 instead, we can change this to 00 (the first entry in the size table). Just be sure to leave bytes 6-7 the same. So to make D. Mist 2x2, change the 91 at 7D001 to 80.

So, we've got a defined x and y size from the size table, all the game needs is to know how to fill that space. In the case of D. Mist, the data (at 75172) reads:
Code: [Select]
-- -- FE 06 00 01 02 FE 06 03 04 05 06 FE 03 07
08 09 0A 0B 0C 0D FE 03 0E 0F 10 11 12 FF 14 FE
03 15 16 17 18 19 FE 05 13 1A 1B 1C 1D 1E 1F FE
02 20 21 22 23 24 25 26 FF 27 2F 2A 2B 29 2A 2B 2C 2D 2E
FE represents a number of blank spaces, defined by the following byte, so D. Mist's image starts out with six blank spaces, then the arrangement data tells the game which of the stored sprites to display - so sprites 00, 01 and 02. Then there are 6 more empty spaces. Now, on the first line, as defined by D. Mist's size, there is only room for one more space (D. Mist's size is 0Ax08), then we go to the next line for the other five empty spaces. Then sprites 03, 04, 05 and 06, then three more empty spaces... and so on in that fashion. FF represents a single empty space (a space saver for when you only need one).

Like I said, I have to go for today, but I wanted to get this all down while it's still fresh. I'll elaborate/clarify later or tomorrow when I have more time.
« Last Edit: October 06, 2013, 08:42:48 PM by chillyfeez »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Where are the graphics for... well... everything?
« Reply #9 on: September 23, 2013, 11:00:22 AM »
I was wondering why those palettes were listed as 00. Another great find Chillyfeez!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Where are the graphics for... well... everything?
« Reply #10 on: September 23, 2013, 11:24:41 AM »
see the large edit above

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Where are the graphics for... well... everything?
« Reply #11 on: September 23, 2013, 11:38:40 AM »
What a strange way to handle it... does this have something to do with transforming sprites by any chance? Like when the Mist Dragon turns into Mist or MomBomb puffs up?

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Where are the graphics for... well... everything?
« Reply #12 on: September 23, 2013, 04:36:50 PM »
Precisely. It allows different forms of the same monster to repeat the same sprites (you don't need eight copies of Octomamm's head).

With this info, we can make shiva, jinn and indra enemy monsters now. I'll put some samples together pretty soon - that'll help illustrate the process. I want to look into the Asura and Bahamut subroutines first, though. I think then I'll be able to comfortably close the book on my monster research (and maybe actually get back to working on my hack).

 :edit: Samples here:
http://slickproductions.org/forum/index.php?topic=1890.0
« Last Edit: October 08, 2013, 10:16:30 PM by chillyfeez »

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Where are the graphics for... well... everything?
« Reply #13 on: December 16, 2013, 05:45:07 AM »
I'm currently trying to get the "inner map" tiles read and displayed correctly. So far, I seem to be getting the palettes without any trouble, as well as the 8x8 graphic tiles.

My questions are these:

1. How does the game determine how to assemble the 8x8 graphic tiles into a 16x16 sprite? Where is this information in the ROM and how is it read?
2. How does it determine which 16x16 map tile uses which 8-color palette?
Let's dance!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Where are the graphics for... well... everything?
« Reply #14 on: December 16, 2013, 11:46:36 AM »
Regarding question 2, that's determined by map info. The sealed cave and cave eblana use the same tileset even though one is yellowish orange amd one is grayish blue.

No idea about question 1. Sorry.