øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&action=profile;u=278;area=showposts;start=1110e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index9e1c-2.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&action=profile;area=showposts;u=278e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index9e1c-2.html.zxÙåg^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ0P.ÂOKtext/htmlISO-8859-1gzip0|ÖÂÿÿÿÿÿÿÿÿTue, 10 Mar 2020 19:25:36 GMT0ó°° ®0®P®€§²ð®Ùåg^ÿÿÿÿÿÿÿÿ¶, Show Posts - chillyfeez

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - chillyfeez

1111
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

1112
see the large edit above

1113
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.

1114
Final Fantasy IV Research & Development / Re: How do summons work?
« on: September 22, 2013, 08:32:17 PM »
I think you're right about that. I think the way the game reads sprite arrangement data limits the height of a summoned monster to eight sprites (because everything starting with 8 or higher represents an empty space). That does exclude at least a few other monsters - Octomamm for one.

1115
Final Fantasy IV Research & Development / Re: How do summons work?
« on: September 20, 2013, 04:31:14 PM »
Thanks.
Now, I didn't check - is that big empty block big enough to copy the image of any monster except Zeromus?

1116
Final Fantasy IV Research & Development / Re: How do summons work?
« on: September 20, 2013, 10:10:25 AM »
I'll be looking again at the palettes. I wasn't paying very close attention the first time around, but I'm beginning to wonder if maybe the summons have their own palettes, separate from those used for (enemy) monsters (which, of course, would be ideal)
Well, they do use the same palettes.
The good news is, I found the table that assigns palettes to each summoned monster! It's at 7004C (ROM w/header). One byte per summon, addressed exactly the same way as the palettes for enemy monsters, so Imp is 00, Bomb is 55, Cocktric is 24, etc.

So now, simply by changing one byte, you can summon Dark Imp, or Balloon, Roc Baby, Wyvern.

Also, it's worth mentioning that we now have enough information to completely change the useless Imp spell into something cool like, say, Golbez's Shadow dragon!

1117
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).

1118
Final Fantasy IV Research & Development / Re: How do summons work?
« on: September 18, 2013, 10:25:29 PM »
Yeah, it won't be very easy for Pinkpuff to include this in FF4kster, but it turns out summons are very editable when you know where to look/what to change.

1119
Final Fantasy IV Research & Development / Re: How do summons work?
« on: September 18, 2013, 07:51:56 PM »
OK, this still isn't complete, but I've got a lot more info here.

(in ROM w/header)
689f0-68a11: 2 byte pointers to summoned monster graphics (add pointer value to D0000 in SNES LoROM, or to 60200 in ROM)

6F460-6F481: 2 byte pointers to summoned monster sprite arrangement (add pointer value to D0000 in SNES LoROM, or to 60200 in ROM)

6F482-6F846: Summoned monster sprite arrangement data, each arrangement terminated by FF. Rows of sprites are numbered 0-7 in the tens place, each sprite within the row is numbered in the ones place beginning at 0 until the next row is reached. If a sprite space is left empty, add 80 (Hex) to the value.

So:
Code: [Select]
80 01 02 03 04 05 86 10 11 92 13 94 15 16 20 21
22 23 24 25 26 30 B1 32 33 34 B5 36 40 41 C2 C3
C4 45 46 D0 51 52 53 54 55 D6 FF
Would look like this (where X is a sprite and a space is not):
Code: [Select]
XXXXX
XX X XX
XXXXXXX
X XXX X
XX   XX
 XXXXX
If the summon is animated, the configuration of the alternating sprites follows the first configuration, using numbers in the ones place where the original configuration left off.
So:
Code: [Select]
80 01 02 03 04 05 86 10 11 92 13 94 15 16 20 21
22 23 24 25 26 30 B1 32 33 34 B5 36 40 41 C2 C3
C4 45 46 D0 51 52 53 54 55 D6 37 38 B9 BA BB 3C
3D 47 C8 49 4A 4B CC 4D FF
Would Switch between these two arrangemnets (where O is a sprite that has changed):
Code: [Select]
XXXXX       XXXXX
XX X XX     XX X XX
XXXXXXX AND XXXXXXX
X XXX X     OO   OO
XX   XX     O OOO O
 XXXXX       XXXXX
:edit: those sample arrangements are supposed to look like crude smiley faces, btw. It looks fine on my computer, but my tablet changes the font and it doesn't translate well. Sorry if they look weird.

There is a TON of unused space at 6EA20-6F45F and a sizeable block at 68448-688C7. Both can be pointed to for graphical data or tile arrangements if you want to get creative!

Up next - I'm gonna see if I can figure out how the game actually controls the sprite changes (how does it flutter like sylph, make one change like Shiva, among many others, rotate between three images like Asura?)
 :edit: Ugh. Once the initial image of the summoned monster is displayed, some really complicated stuff starts happening. Not sure I'll be deciphering the animation control process anytime soon.

Also, I'll be looking again at the palettes. I wasn't paying very close attention the first time around, but I'm beginning to wonder if maybe the summons have their own palettes, separate from those used for (enemy) monsters (which, of course, would be ideal)

1120
Final Fantasy IV Research & Development / Re: How do summons work?
« on: September 18, 2013, 04:55:59 AM »
I've been focusing pretty exclusively on the graphics so far, but I know where the Asura subroutine is. Once I'm through with my current pursuit, I'll get into the Asura probabilities. Probably not today, but within the next few days for sure.
I found the size/arrangement pointers AND the actual arrangement data late last night - including the animations (sprite changes, not the x,y movement - yet). I didn't have time to break it all down but I will this evening.
Furthermore, now that I know how the sprite arrangements of summons work, I bet I'm not far from finding the same for monsters. I'll keep you posted.

1121
Final Fantasy IV Research & Development / Re: How do summons work?
« on: September 17, 2013, 09:09:39 PM »
Well, yes, sort of. Technically, that's already known.
The problem is that the graphical data for summoned monsters (that do not already appear as enemies) do not necessarily fit into any of the preset "sizes" for monsters, including the "special" sizes.
I've successfully made enemies out of chocobos and sylphs, because they are 4x4 and 2x2, respectively (this was a while ago, though - I can't quite remember the pointers used, but I found them pretty easily by counting up from Imp).
 :edit: Imp begins at 68A18 (ROM w/header), and each sprite is 18 (hex) bytes long
Shiva, Indra and Jinn (the only other three that do not appear as enemies) require quite a bit of work, and erasing the graphical data for a different monster using a program like tile layer.
I suppose if one could figure out exactly how the game translates size bytes into sprite arrangements, then they could be changed and some of the seemingly useless ones could be better employed for this purpose. Unfortunately, I'm nowhere close to being able to do this.

1122
Final Fantasy IV Research & Development / Re: How do summons work?
« on: September 17, 2013, 07:13:47 PM »
At a certain point, the game checks if the value at 26D2 is between 31 and 3F. If it is, then it checks if it is 3E (Asura) or greater. If not, then it subtracts 31 (I haven't looked into Asura's specific subroutine yet, though I'm sure it involves picking one of her incarnations at random - Bahamut, being after Asura, also has a separate subroutine, but it probably is very similar to what is done with the previous thirteen spells), then adds 4D and stores back into 26D2.
By the way, this is almost certainly why expanding the summon range has not proven successful. Making earlier spells into summons causes glitching when subtracting 31, and the game defaults to assuming later spells are Asura since they're higher than 3E.
BUT, there's space enough for three more pointers after Bahamut, so with enough clever hacking it should be possible to add on at least three more summons pretty easily. I'll go into more detail with this after I've done some more tinkering.

1123
Final Fantasy IV Research & Development / Re: How do summons work?
« on: September 17, 2013, 01:47:18 PM »
I followed your lead, breakpointing last action used... actually breakpointing the next byte, last subaction used. From there it was literally days worth of following bread crumbs.
 :edit: literally days, not literally breadcrumbs.  :blush:
When a spell is cast, its ID is copied into 26D2. At a certain point, the game checks if the value at 26D2 is between 31 and 3F. If it is, then it checks if it is 3E (Asura) or greater. If not, then it subtracts 31 (I haven't looked into Asura's specific subroutine yet, though I'm sure it involves picking one of her incarnations at random - Bahamut, being after Asura, also has a separate subroutine, but it probably is very similar to what is done with the previous thirteen spells), then adds 4D and stores back into 26D2.

26D2 becomes the point of reference for the rest of the casting.
It's copied into 00E5 to determine the spell effect subroutine.
It's copied into 34C8 to determine what spell name is displayed (during casting)
It's copied into 33C5 to determine all audiovisual data - 33C5 then becomes the point of reference for the palette, graphics pointer, sprite arrangement, sound effect, and spell animation (separate from the monster summon image)

1124
Final Fantasy IV Research & Development / Re: How do summons work?
« on: September 17, 2013, 01:05:10 PM »
So this was an EXTREMELY long time coming, but I've found the Holy Grail.

The pointers for summoned monster image data (that is, which images are displayed when a summon spell is cast) are located at (ROM w/header) 689F0-68A11. Each pointer is two bytes long. Adding this value to D0000 gives you the location (in SNES LoROM) of the beginning of the graphic for the summoned monster.  This is one of those things we'll be smacking ourselves about for years. The pointers are in that small block of non-graphical data right in the middle of all of the monster graphic data, immediately preceding the data for summoned monster graphics.  :whoa:

There are still some important pieces to work out here:
- The palette is referenced in a separate subroutine (specifically, it is picked at 029169 in LoROM), and I'm not quite sure how to change which palette is picked (there's a ton of rolling bytes preceding it, and it will take a long while to figure out exactly what needs to be changed in order to get a desired result).
- I have not yet found how the game determines the "size," or more appropriately, the sprite arrangement, so a 4x4 monster can only be replaced by a 4x4 monster (so far).
- Finally, since the pointer references a LoROM value at or above D0000, only image data that begins at 68200 (ROM w/header) can be used - D0000 through D7FFF does not exist in LoROM. The sort-of good news about this is that there is an empty block of code at 682C0 that is long enough to insert replacement images for up to three 4x4 monsters.

So, I've only hit the tip of the iceberg here, but we now know enough to be able to do this:

1125
I would think, then, that the master stat would be copied to some backup location to be referenced later. The game does this a lot in-battle. Specifically I've noticed it using blocks of RAM in the 00s and the 3000s as placeholders but I'm sure there's more. Probably could be found by setting a breakpoint on reading the 1000-level defense and mag defense stats. I'd bet they copy to the 2000-level locations and somewhere else at the beginning of battle, but maybe the placeholding copy isn't set until armor/shell is cast.