Users browsing this thread: 1 Guest(s)
Breaking Ragnarok - Esper Graphic Swapping

#1
Posts: 377
Threads: 34
Thanks Received: 10
Thanks Given: 7
Joined: Dec 2018
Reputation: 18
Status
Moog
So you're working on your hack.  You've changed spells.  You've changed graphics.  Now you've come to the Esper that is a sword, and you're stuck.

How the heck do you change this thing to look like something else?  It's just a sword!  You can't use an editor like FF3SE to change it, because the graphics aren't pulled from there.  They're 3bpp graphics, but you can't just use a hex graphic editor like YYCHR either, because the tiles are repeated.  You can change it to something else, but it will always be sword-like.

What's a modder to do?

Well, the answer lies in the Byte10 value.

Here's a little snippet of vanilla code:
Code:
; [ Battle Animation Init $6A: Metamorph ]

C2/EC1C: A2 90 01     LDX #$0190      ; ragnarok
C2/EC1F: 22 52 24 C1  JSL $C12452     ; load esper graphics (bg1)
C2/EC23: 20 70 FA     JSR $FA70            [Put Esper palette in BG1]
C2/EC26: 4C 09 F8     JMP $F809
This is from Everything's extended notes on the C2 bank.  Byte10 dictates how an animation handles its threads (the individual moving pieces of an animation) as well as what might be loaded as graphic data for an Esper.  Here we see that the graphic information for monster/esper slot 0x190 is being loaded.  This is a special case that is used explicitly with Metamorph's (Ragnarok's) animation script sprite layer to draw the sword.
That's the thing that goes in IDX 0 and IDX 3 of a summon graphic in USME's animation editor.  For Ragnarok, spell 70, that's $81ED.

The Ragnarok spell consists of three components: the sprite layer which draws the sword, the background 1 layer which fades out the party and changes the background color, and the background 3 layer which animates the flickering runic asterix behind the sword.

The trouble is, we don't want the esper graphics to be on the background 1 layer.  This is because while Background 1 has the heap of the animation components, the actual Esper moving graphic is handled by the sprite layer.
So, first thing's first, we're going to change the code of Ragnarok's Byte10 value, 0x6A, so that it will draw the Esper graphic on the sprite layer.
Code:
; [ Battle Animation Init $6A: Metamorph ] - Move the graphic to the sprite layer

C2/EC1C: A2 90 01     LDX #$0190      ; Hex ID of the monster sprite to use.
                                     ; Summons start at 0x0180 and follow the spell-list
C2/EC1F: 22 80 24 C1  JSL $C12480     ; load esper graphics (sprite)  ***NOT BG1***
C2/EC23: 20 87 FA     JSR $FA87       ;     [Put Esper palette in Sprite layer]  ***NOT BG1***
C2/EC26: 4C 09 F8     JMP $F809
We can make this adjustment with a hex editor like HxD.  Remember that the file offset is different from the hirom address.  In an unheadered ROM, the address C2/EC1C will be found at offset 0x02EC1C [We subtract 0xC00000 from the hirom address].  This change--by itself--will simply make the sword disappear.  Now we have an animation with NO esper graphic that makes the party disappear, shows a flickering asterix, and turns the background red.  Well, that's no fun, but at least the sword is gone!

Before we move away from the hex editor, we're going to make a small adjustment to C2/EC1C.  See the comment to the right of it?  The number we are loading into X is actually the Monster ID that will be used to load graphics and palette into the animation.  Right now it's set to ID 0x0190, which is the default ID for Ragnarok.  If we change it to 0x0191, it'll use Kirin instead (Kirin is the next Esper after Ragnarok).  If we change it to a number like 0x0019 (decimal 25), it'll use the graphic for the monster Lobo.  We can use any monster ID we please here, including those for monsters that are not normally drawn.  For instance, monsters near the end of the list which are used for scripting events, such as Cyan's "Character Acting as Monster" script, still have graphical data... data that is not normally used.  These monster slots can be changed to whatever graphic you desire for your Ragnarok animation replacement, and then referenced by converting their ID from decimal to hexadecimal and setting it as the value for X.  Note that this X value is 16-bits and is stored little-endian.  That means the value is two bytes, and the smaller byte comes FIRST.  If you want to change the id to 0x0019, you need to use the hex editor to change C2/EC1C to A2 19 00 [NOT A2 00 19!]. OS used monster 380 (0x017C) as the swap graphic without encountering issues.

Okay, so now we've picked an actual monster graphic, but the animation still isn't showing anything!  That's because Ragnarok's IDX 0 (its sprite layer) isn't set up to handle an actual Esper sprite.  Rather than reprogram that animation, which could get messy, we're going to piggy-back the Esper draw onto another animation's script code.

Open spell animation 70 in FF3USME and click on the IDX 0 box.  Change this value to 8111.  Now do the same for IDX 3, using the same value of 8111.  Save and summon Ragnarok.  Your Esper will draw in place of the sword, statically, on the player side of the screen or in the center during a pincer.  It will stay there briefly before flashing yellow and vanishing.  Hurray!  The sword has been replaced!

Still, there are some niggling details.  If you picked a monster sprite, you probably noticed that the graphic was facing the wrong way.  This is because Espers are pre-drawn to face the opposite direction of monsters, so that they will bear the same orientation as the party.  If you have enough graphics space to add a new monster graphic, this shouldn't be a problem.  If you don't and you're instead using an existing monster ID as your Esper replacement, you have some alternatives.  OS did some experimenting in Discord and found that using Kirin's IDX 0 of 810B will flip the selected graphic and place it at the center of the screen [So long as the monster is 64x64 or smaller].  Combining this with the IDX 3's of other Esper animations can have some interesting results... several are viable but some will have lingering effects on the battle (like a background color change).  Try IDX 3 values of 8101 (Siren) or 80F7 (Bismark).

Experiment and have fun!
Special thanks to Everything for the Byte10 information and OS for experimenting.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite