Author Topic: Developing FF4kster: a comprehensive editor for FF4  (Read 245905 times)

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,682
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #840 on: July 14, 2014, 09:39:22 AM »
Ah right, that reminds me, when you go to change the range of Arrows (or plan on one use weapons) have you also included the Break Bits with it as well? Since that is just part of the Equip Index byte after all. Just checking to see if you've set it up that way.

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #841 on: July 14, 2014, 01:21:22 PM »
Probably??

Here's all the places where it writes something relating to the bow and arrow ranges:

Code: [Select]
WriteByte(&hC1BE, bow_start)
 WriteByte(&hC1BF, arrow_end)
 WriteByte(&hC246, bow_start - 1)
 WriteByte(&hC27B, bow_start)
 WriteByte(&hC27C, arrow_start - 1)
 WriteByte(&hC286, arrow_start)
 WriteByte(&hC287, arrow_end)
 WriteByte(&hC28C, arrow_start)
 WriteByte(&hC28D, arrow_end)
 WriteByte(&hC297, bow_start)
 WriteByte(&hC298, arrow_start - 1)
 WriteByte(&h19128, bow_start)
 WriteByte(&h19142, bow_start)
 WriteByte(&h1F526, arrow_start)
 WriteByte(&h1F55C, arrow_start)
 WriteByte(&h1A24, arrow_start)
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,682
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #842 on: July 14, 2014, 06:20:06 PM »
Hmm, none of those seem to be the "break bit" as far as I can tell. The Break Bit is the 40 Bit in the Equip Index. As a point of curiosity...

20 - Two Handed Weapons
40 - Arrow
80 - Bow


It would likely be much easier for you to add the bit into the normal Weapon menu rather than to set it with the Range because that means you would have to write a 40+ Initial Equip Value to Every single new Arrow that people would choose to make, which could be a bit of headache inducing code.

We know the 40 does something, I'm not sure at all if it is the case with Bows or Two-Handed Equipment though.

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #843 on: July 14, 2014, 07:52:15 PM »
Actually, here it is in the weapon-writing routine:

Code: [Select]
temp = equip_code
if index >= arrow_start and index <= arrow_end then temp += &h40
if index >= bow_start and index < arrow_start then temp += &h80
WriteByte(start + index * 8 + 6, temp)
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,682
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #844 on: July 14, 2014, 08:10:07 PM »
Well, there we go. It looks like that should work ideally then.

Alright, I guess that silences my concerns about the equipment ranges, at least as far as I'm aware.

That part of it might be near completion.

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #845 on: July 15, 2014, 01:43:03 PM »
Update time!~~

  • Shield stats now correctly correspond to modified range
  • Certain things can now have their index "swapped", f.ex. weapons, armors, spells, bank 2 messages. Hold shift and press Enter to highlight an entry, press Enter normally on another one, and voila! The entries will change places. This will only affect the information for that object, not things referring to it (so if you swap, say, the Avenger with the Yoichi Arrow, the Yoichi Arrow will now be auto-berserk and the Avenger will be an arrow, and you'll have to go back and manually update the chests etc).
  • Various other minor fixes and cleanups

Enjoy!  :childish:
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,682
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #846 on: July 15, 2014, 10:14:58 PM »
Yep, looks like these new changes work fantastically! Index changing, the new shields, all of it seemed to work flawlessly. If I may make a suggestion then... is it possible to also include a Copy function as well as a Switch function?

Also, is there any more information you'd like added to the editor that I haven't really explained or explored yet?

What were the minor fixes and cleanups in this update out of curioisyt?

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #847 on: July 16, 2014, 06:12:48 AM »
Yep, looks like these new changes work fantastically! Index changing, the new shields, all of it seemed to work flawlessly. If I may make a suggestion then... is it possible to also include a Copy function as well as a Switch function?

Shouldn't be too difficult. It already has the code there for "highlighting" an index, maybe for "paste" it could just be Insert instead of Enter?

Also, is there any more information you'd like added to the editor that I haven't really explained or explored yet?

Yup, there are a couple things from the wishlist that have yet to be solved. The biggest thing off the top of my head would be getting the tile graphics read dynamically from the rom. I was trying to do this last year and met with mixed success. I can get it to read all the regular tilesets correctly; the only ones that are causing issues are the 4bpp ones (airship, ship). I posted my code in the other thread just to see if anyone could see what I was doing wrong. I can try to pseudocode it down to make it more readable if that would help. In any case, that can be discussed in that thread.

I would also like to make an "arrangement" editor, for editing the monster arrangements (the screen positions of the monsters in a battle, possibly other information related to that?). The wishlist thread on that topic didn't really go anywhere.

There are still several game objects that have "mystery" bits or bytes that we have yet to discover the function of. It's entirely possible that some of them are redundant and actually ignored by the game (the "two-handed" flag comes to mind) but it's also possible that they do have a funciton which we just don't know what it is yet. While working on a test hack (I found this is a good way to test the actual usability/friendliness of the editor for an actual hack) I discovered completely by accident that the spells have a mystery bit (the top bit of the "effect" byte) that was causing a damage spell that had it to deal much less damage than it should. I'm planning on going through all the game objects at some point and making all the "mystery" information editable, if for no other reason than to assist with experimentation.

While not technically part of the editor proper, getting the "complete shadow party" patch working would be such a useful tool for anyone hacking this game, particularly if they're planning on changing the plot in any significant way. That way you wouldn't have to design your plot around the limitation of who can be in the shadow party in what slots at what times.

And finally, on a less technical note, I've been delaying adding the overworld to the map editor, at least in part due to my understanding that it uses at least one multi-tile code (i.e. one of the bytes corresponds to several tiles in a row, f.ex. the snowy mountain tops I think it was). On a technical level this is pretty trivial to implement, but on a user-interface level I've been having problems imagining how to handle the cursor for such a situation.

That's all I can think of off the top of my head but I'll certainly let you know as I think of things  :happy:

What were the minor fixes and cleanups in this update out of curioisyt?

I wouldn't be able to list them systematically... it's just stuff like disappearing or misaligned menu components, labeled a couple more sound effects in the config file, stuff like that.
Let's dance!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,266
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #848 on: July 16, 2014, 09:19:13 AM »
The plot thickens with the snowy mountains in the world map. I think I discovered this when I was researching landscape changes - the bytes that represent four tiles of snowy mountains (00, 10, 20, 30 I think) sometimes just display one tile. I don't know what conditions alter this behavior.

Regarding the shadow party: I'm pretty confident I've learned enough to implement that, but I'm pretty entrenched with my own hack right now. I expect in a week or two I'll be done with the current chapter, at which point I'll likely welcome a change of pace. If nobody's picked up the shadow party hack by then I'll look into it.

I'm pretty sure at least part of the mystery info in monster arrangements is used in enabling proper cursor movement. As Grimoire has noted before (somewhere... ?), creating monster arrangements from scratch often results in weird cursor movement (it may be difficult to move the finger from the monster in front to the one in back), but if you copy all the mystery bytes/bits from an existing arrangement, that seems to clear it up. If we can confirm this, you'd probably want to take out the option to alter the relevant mystery info and instead have it just change automatically with the arrangement.

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #849 on: July 16, 2014, 09:36:40 AM »
I'm pretty sure at least part of the mystery info in monster arrangements is used in enabling proper cursor movement. As Grimoire has noted before (somewhere... ?), creating monster arrangements from scratch often results in weird cursor movement (it may be difficult to move the finger from the monster in front to the one in back), but if you copy all the mystery bytes/bits from an existing arrangement, that seems to clear it up. If we can confirm this, you'd probably want to take out the option to alter the relevant mystery info and instead have it just change automatically with the arrangement.

So, wait... where are we copying bits from? Where is the monster arrangement information and how is it interpreted? Was this information posted somewhere and I missed it?
Let's dance!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,266
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #850 on: July 16, 2014, 09:52:38 AM »
No, sorry.
Well, it must be somewhere because I think Zyrthofar's editor lets you change actual monster position within an arrangement.
But what I was talking about was the formation editor  that already exists in Ff4kster.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,682
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #851 on: July 16, 2014, 12:04:39 PM »
Yep, looks like these new changes work fantastically! Index changing, the new shields, all of it seemed to work flawlessly. If I may make a suggestion then... is it possible to also include a Copy function as well as a Switch function?

Shouldn't be too difficult. It already has the code there for "highlighting" an index, maybe for "paste" it could just be Insert instead of Enter?

That looks like a workable idea.

Yup, there are a couple things from the wishlist that have yet to be solved. The biggest thing off the top of my head would be getting the tile graphics read dynamically from the rom. I was trying to do this last year and met with mixed success. I can get it to read all the regular tilesets correctly; the only ones that are causing issues are the 4bpp ones (airship, ship). I posted my code in the other thread just to see if anyone could see what I was doing wrong. I can try to pseudocode it down to make it more readable if that would help. In any case, that can be discussed in that thread.

Yes... unfortunately graphics are not my strong suit, whether it be GB, SNES, PS or N64 graphic matters have always gone way over my head. I'm afraid I'm no help there.

I would also like to make an "arrangement" editor, for editing the monster arrangements (the screen positions of the monsters in a battle, possibly other information related to that?). The wishlist thread on that topic didn't really go anywhere.

Chillyfeez was 100% correct on his thoughts. It is the "Mystery Byte" that effects the targeting. I just tested this on the Sandhags in the Desert and changed it to 1 and the targeting was rather screwy, but its initial value of 34 is used in several different places and seems to be the code for "straight line targeting", so I guess you can assuredly change that "Mystery Byte" in Formations to Targeting Setup or something like that. In fact, I will go through quickly and mark the kind of targeting each formation uses...

Targeting List (With help from Zyrthofar's Editor)
Code: [Select]
0 - No targeting, only used by single foes.
1 - Diamond  (4 Foes)
2 - Left-Right  (2 Foes)
3 - Upside Down Triangle (3 Foes)
4 -
5 - Adjoining Squares (4-6 Foes)
6 - One Small Square to an Adjoining Sideways Triangle (4-6 Foes)
7 -
8 - Oblong Square (4 Foes)
9 -
10 -
11 - Square with Jutting Triangle at Left (3-5 Foes)
12 -
13 - Double Squares Down (3-6 Foes)
14 - Left Jutting Triangle (3-4 Foes)
15 - Three Sideways Squares (2-8 Foes)
16 -
17 - Full Diamond (4 Foes)
28 - Obtuse Triangle (open) (3 Foes)
34 - Straight Line (4 Foes)
79 - Slightly-off Square.

...Actually a lot of this depends on Arrangement as well. But yes... at looking at Zyrthofar's editor he has it clearly listed where which values correspond to where, but without a visual aid as he has... I imagine it would be difficult to change that on the fly.

They start in ROM at 0x73CC0 starting from Targeting Setup 00. They are all in eight bit basis, meaning that they use only half-bytes for their values.

And the Arrangement's start at...

ROM 0x71200 and it is the same case as above, except they only use 8 Bytes rather than 16 as Positioning seems to take up less space than Targeting.

There are still several game objects that have "mystery" bits or bytes that we have yet to discover the function of. It's entirely possible that some of them are redundant and actually ignored by the game (the "two-handed" flag comes to mind) but it's also possible that they do have a funciton which we just don't know what it is yet. While working on a test hack (I found this is a good way to test the actual usability/friendliness of the editor for an actual hack) I discovered completely by accident that the spells have a mystery bit (the top bit of the "effect" byte) that was causing a damage spell that had it to deal much less damage than it should. I'm planning on going through all the game objects at some point and making all the "mystery" information editable, if for no other reason than to assist with experimentation.

Yes... that was an issue that I was going to have to tackle eventually. Several of Kain's Dragon Spells had this problem, even at Power 255, I thought it was something to do with some unseen index I was going to have to scrounge for, but yes. That Mystery Flag does Exactly what you say it does. It mitigates the damage in a horrendously low fashion when activated. Phew, that actually gets rid of that worry.

While not technically part of the editor proper, getting the "complete shadow party" patch working would be such a useful tool for anyone hacking this game, particularly if they're planning on changing the plot in any significant way. That way you wouldn't have to design your plot around the limitation of who can be in the shadow party in what slots at what times.

A new Shadow Party Patch would need written from scratch unfortunately. What Phoenix did was he shoved all of the data into the normal Shadow Slot area, but he got rid of "useless bytes", unbeknownst to him these bytes were the Critical Hit Chance, Critical Hit Bonus, and "Steal Evade", he also askewed the Exp. Tables with this somehow. The key would be to finding another area in RAM that is saved to with loads of free space that could compensate the space for all 14 characters, that is the tricky part, I'd say.

And finally, on a less technical note, I've been delaying adding the overworld to the map editor, at least in part due to my understanding that it uses at least one multi-tile code (i.e. one of the bytes corresponds to several tiles in a row, f.ex. the snowy mountain tops I think it was). On a technical level this is pretty trivial to implement, but on a user-interface level I've been having problems imagining how to handle the cursor for such a situation.

That's all I can think of off the top of my head but I'll certainly let you know as I think of things  :happy:

Hmm... that does sound tricky to use, I'm sure someone can help you with that part though. Maybe just have the Mountains outline with some color to indicate that anywhere you choose on these four tiles you will be pasting a four-tile mountain top?

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,682
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #852 on: July 22, 2014, 11:00:53 PM »
Hmm, I've noticed that even the older version overwrites some of my code (not a vast amount, mainly only one part of Cry/Coat Hammer (As Far As I Know!!) but it is annoying to change Every single time I start up the editor, so I was wondering how I would go about disabling the editor writing At All to my command innards. Since my commands are for the most part very different in functionality from the original code that was there.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,266
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #853 on: July 23, 2014, 12:07:45 AM »
Grimoire, I have the same problem with my hack, so here's what I did:
1) make a copy of your hack (with the commands all working properly)
2) open one of the two copies in your hex editor and jump to offset $01/8200 (this is where the $03/8000 block begins in LoROM)
3) overwrite $01/8200 through $02/01FF with all FFs (effectively erasing all battle code entirely)
4) create a patch using this messed-up copy as the "unchanged" file, and your properly working ROM as the "changed" file
This will yield a patch that rewrites the entire battle code of the ROM. You can apply this patch every time you're done editing with Ff4kster and it will undo any changes the program made to your custom commands.

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #854 on: July 23, 2014, 03:50:46 AM »
Keep in mind that what you're doing is outside the scope of what FF4kster is designed for. It assumes that it is going to be the only thing modifying your rom, with the possible exception of graphics or something. If you make other changes and they happen to be compatible, that's great. If you can use other editors and they don't interfere, that's great too, but if it does cause a conflict, FF4kster will simply shrug and say "sorry to hear it bro".

Chillyfeez's suggestion seems logical. I'm not certain the "fill with FFs" step is even necessary though, couldn't you just make a patch with your custom battle code and use the rom output by FF4kster as the "base"?
Let's dance!