Chrono Compendium

Kajar Laboratories - Fan Works and Submissions => Chrono Trigger Modification => Topic started by: Fauntleroy on March 06, 2018, 09:41:43 pm

Title: Sprite Insertion
Post by: Fauntleroy on March 06, 2018, 09:41:43 pm
This is what I've been dreading.

I've tried reading the old discussions here, as well as Geiger's documents, but I'm not putting this together right in my head.

I want to add three special poses for Schala. Is there "room" to add three poses to Schala's existing sprite, or do I need to make these three poses separate sprites, and then switch between the sprites as needed?

What offsets are available for inserting additional sprite graphics? Once inserted into the ROM, can I manipulate them in Temporal Flux in the normal way?

Does Chrono Trigger compress its sprites? If so, what's the best way to access them?

Thanks.
Title: Re: Sprite Insertion
Post by: Mauron on March 06, 2018, 11:27:26 pm
You'll need to edit both Schala's sprites and sprite assembly. Any new tiles will need to be added to her compressed sprite packet, and sprite assembly will need to be modified to put them together.

You'll probably have to move both the compressed sprite packet and the sprite assembly in order to add more.

Compressed packets can be handled through Temporal Flux's compression menu, and reinserted in any free space. Make sure you reserve the free space in Temporal Flux's Custom Data option to protect your new data.
Title: Re: Sprite Insertion
Post by: Boo the Gentleman Caller on March 07, 2018, 11:47:42 am
Dude, sprite insertion is a pain.

TheMage is good at it and may have created some documentation for it two or three years ago.
Title: Re: Sprite Insertion
Post by: Mauron on March 07, 2018, 03:11:49 pm
I gave TheMage some notes on overworld backgrounds ages ago. I'll have to update them for sprites.
Title: Re: Sprite Insertion
Post by: Boo the Gentleman Caller on March 07, 2018, 05:40:09 pm
I should have known you created them. :)
Title: Re: Sprite Insertion
Post by: Mauron on March 07, 2018, 05:47:22 pm
I might have done some sprite tutorials back then, but the site they'd be on is behaving inconsistently for me right now.
Title: Re: Sprite Insertion
Post by: Boo the Gentleman Caller on March 07, 2018, 10:38:40 pm
If you're referring to the forums we frequent for other stuff, I've had the same issue. It must be a hosting issue. It was down for a week or so recently and I thought for sure someone pulled the site down or something.
Title: Re: Sprite Insertion
Post by: Fauntleroy on March 08, 2018, 09:22:50 pm
Hey, there's the only wrinkle.

I'll just tell you, these additional poses are for the campfire scene. I need one for Schala by the fire and one for her asleep. She won't move at all during the scene. So wouldn't it be easier to create these as new, separate sprites, rather than edit the main Schala sprite? Then I could just add these to empty space without having to move any other stuff.

Or is there a reason this is impractical or just wouldn't work?

Just trying to make this as easy as possible for myself!
Title: Re: Sprite Insertion
Post by: Mauron on March 09, 2018, 02:12:42 pm
The process is pretty much the same either way, but there are some unused packets you can use.

1) Locate the graphics packet you want to modify. This is displayed in NPCustom and Fiendcrafter.
2) Find the address of that packet with a hex editor. 0x242000 + graphics packet * 3 will have a 3-byte pointer to the address of the packet. It will be little endian, so the bytes are reversed. 00 56 C4 would be 0xC45600. Subtract 0xC00000 from this, so 0x045600 for this example.
3) Decompress the packet from Temporal Flux's compression menu, using the address from above. Make a note of the compressed size.
4) Add tiles to your decompressed packet using Tile Molester/YY-Char/something along those lines.
5) Attempt to compress the modified packet back into the original space. If the compressed size is less than or equal to the previous compressed size, save it and skip to step 9. If it's larger, you'll need to find free space.
6) Check Geiger's Offsets, NA.txt for space at least equal to the new compressed size. Try adding this to the Custom Data section with Overrride Free Space set to true. If the status bar at the bottom says Warning - Free Space in Use (or something like that), try a different address.
7) Compress the modified packet at the new address and save.
8) Change the pointer from step 2 to the new address. If it's less than 0x400000, add 0xC00000 to it.
9) Locate the sprite assembly you need. The packet can be found in NPCustom or Fiendcrafter. 0x242300 + sprite assembly packet * 3. The same steps are needed. This can be skipped if you're overwriting an empty packet.
10) Check Geiger's Offsets, NA to see where the packet ends. It will be listed as (xx) Sprite Assembly, with xx being the packet number.
11) If adding, you'll need to move the sprite assembly to free space, with 40 bytes (decimal) per additional frame. The same principles for reserving space and adjusting the pointer apply.
12) Put together the frames using a sprite assembly tutorial. There are a couple floating around.
13) If you made a new packet, using NPCustom or Fiendcrafter, put together a sprite using the correct graphics.

That should cover everything. The unused graphics packets are 47, 4A, CC, and E5. The unused assembly packets are 08, 09, 0A, 8C, C5, and D8.
Title: Re: Sprite Insertion
Post by: Fauntleroy on March 10, 2018, 01:29:54 am
This is crazy helpful, Mauron. Thank you!!!
Title: Re: Sprite Insertion
Post by: Mauron on March 10, 2018, 01:33:44 am
Let me know if you have any issues.
Title: Re: Sprite Insertion
Post by: Fauntleroy on March 11, 2018, 07:16:40 pm
Finally getting to play with this.  I always get tripped up on hex math.

I want to use graphics packets E0 and E1, as these two enemies are fully deprecated in my hack.

242000 + E0 * 03 brings me to A0626C, which is not a large enough value to subtract C00000 from. What am I missing?
Title: Re: Sprite Insertion
Post by: Mauron on March 12, 2018, 01:13:57 am
1) Follow order of operations. Multiplication before addition. The result should be 0x2422A0.
2) Navigate to that address in a hex editor. There you'll find 33 E5 DA, which becomes 0xDAE533
Title: Re: Sprite Insertion
Post by: Fauntleroy on March 12, 2018, 08:17:46 pm
Thank you.  I flunked math repeatedly.

EDITED TO ADD: Worked like a charm! And careful placement of tiles meant no tiresome fuckery with sprite assembly.

(http://www.bwass.org/bucket/031218sample.png)

And in the wild...

(http://www.bwass.org/bucket/031218sample3.png)

(http://www.bwass.org/bucket/031218sample2.png)

Feels SO GOOD to accomplish this. THANKS AGAIN, MAURON!
Title: Re: Sprite Insertion
Post by: skylark on March 15, 2018, 04:09:48 pm
O_O!!!

What project was this?

That Schala, doe... :oops:
Title: Re: Sprite Insertion
Post by: Mauron on March 15, 2018, 04:13:56 pm
Excellent work!
Title: Re: Sprite Insertion
Post by: Fauntleroy on March 16, 2018, 09:32:55 pm
Thanks!

Skylark, this is my upcoming hack. It adds a new chapter (Back from the Brink) where the party rescues Schala.  Magus is no longer an optional character, and like the other characters, this is his time to be a mandatory party member and get some development time.

Schala isn't playable, but since she survives and is important to the party, she pops up here and a few other times that obviously weren't in the original game.
Title: Re: Sprite Insertion
Post by: Acacia Sgt on March 16, 2018, 10:21:23 pm
Oh, that is an interesting idea. That will be something to see.
Title: Re: Sprite Insertion
Post by: Fauntleroy on March 17, 2018, 12:38:50 am
Thanks!

Allow me to pimp my other Square hacks that used a similar concept.

FFIV Playable Golbez Edition http://www.romhacking.net/hacks/850/ (http://www.romhacking.net/hacks/850/)
FFVI General Leo Edition http://www.romhacking.net/hacks/1619/ (http://www.romhacking.net/hacks/1619/)
Title: Re: Sprite Insertion
Post by: Boo the Gentleman Caller on March 18, 2018, 02:05:31 pm
I can vouch for the amazing-ness of Fauntleroy's FF mods. The last two times I've played FFVI on PC I've played with the General Leo patch. :)

Just make sure you aren't too attached to Shadow before you install! :D

Leo>Shadow
Title: Re: Sprite Insertion
Post by: Fauntleroy on March 18, 2018, 04:38:36 pm
Hee hee, thanks Boo!

I have nothing against ninjas, I swear!
Title: Re: Sprite Insertion
Post by: Fauntleroy on May 02, 2018, 11:17:57 pm
Forgive a totally self-indulgent post, but... I finished my "more similar to the PSX ending cutscene" human Glenn.

(http://www.bwass.org/bucket/050218_glenn1.png)

(http://www.bwass.org/bucket/050218_glenn2.png)

(http://www.bwass.org/bucket/050218_glenn3.png)

(http://www.bwass.org/bucket/050218_glenn4.png)

(http://www.bwass.org/bucket/050218_glenn5.png)

Thanks again to Mauron for showing me how to edit sprite packets!
Title: Re: Sprite Insertion
Post by: Mauron on May 02, 2018, 11:19:17 pm
Nice job!
Title: Re: Sprite Insertion
Post by: Boo the Gentleman Caller on May 02, 2018, 11:30:31 pm
Looks stellar!

You know, this may end up being just in time for Dream Splash. Boy, wouldn't that be a motivational factor for future Dream Splashes!

Either way, I can't wait, Fauntleroy!
Title: Re: Sprite Insertion
Post by: Fauntleroy on May 03, 2018, 11:52:32 am
Oh, thank you!

I think I'm gonna go one better and change the palette to a more emerald green.

As for timing, it will probably be a few weeks. I only have one big "thing" left to do but then there has to be more testing before a release happens.
Title: Re: Sprite Insertion
Post by: PrincessNadia78 on May 03, 2018, 06:02:49 pm
OMG I can't wait to play this. I absolutely love this idea!!
Title: Re: Sprite Insertion
Post by: Fauntleroy on May 03, 2018, 08:27:23 pm
Thanks, everyone! :D

I did end up changing the palette and I think it's a big improvement.

(http://www.bwass.org/bucket/050318_glenn.png)
Title: Re: Sprite Insertion
Post by: ZeaLitY on May 06, 2018, 12:24:25 am
Can't wait for this hack either. Will definitely be a headliner.
Title: Re: Sprite Insertion
Post by: Fauntleroy on May 06, 2018, 04:51:08 pm
Can't wait for this hack either. Will definitely be a headliner.

:shock:

Coming from you, this is the highest form of compliment.
Title: Re: Sprite Insertion
Post by: TheMage on May 11, 2018, 06:26:36 pm
Mauron is my hacking guru man! Mauron taught me everything - I've successfully replaced NPCS, map graphics, but not a playable characters -yet. I CAN its just sprite assembly makes me want to chew my arm off.

My hard drive crashed and I need to re-dig out all my old tools like tilemolester and whatever one it was I used for sprite assembly HRM.

Ahh those pictures of your hack give me life and look great! I am much excited for this hack! If you need some help making sprites let me know!