Author Topic: Question about Cover command  (Read 1024 times)

fedorajoe

  • Mom Bomb
  • *
  • Posts: 123
  • Gender: Male
  • "G...Golbez!"
    • View Profile
Question about Cover command
« on: October 28, 2016, 07:23:12 PM »
It was recently discovered that the Cover command editor in FF4kster is bugged and makes the editor crash. So... does anyone know where in the ROM the values for "covering character" and "can't cover if this character is present" are located?  I'd like to change them up in my hex editor.

I searched for this but did not find it on the boards.

Thanks and Happy Friday!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Question about Cover command
« Reply #1 on: October 30, 2016, 02:35:17 PM »
I looked into it, and I think the problem with the functionality in FF4kster is that we never actually figured out how this works (and thus FF4kster tries to change an "unknown" value and crashes).
It's tough to zero in on, for a few reasons:
1) I don't know when the check for DK Cecil is performed (that is, when the command is selected, when the command is executed, or when the covered character is attacked)
2) I don't know exactly what in RAM is being read to perform the check. I mean during a battle, the characters' IDs are stored in 7e:2000, 2080, 2100, 2180 and 2200, and each of those values is read several times per second throughout the course of a battle. I figured, no matter, I'll set a breakpoint to the first character's ID and despite the slowness of the process note each part of ROM that reads it and see if I can find any differences between what happens when DK Cecil is in or not in the party. Found none. Which leads me to believe that somehow the game is using an entirely different method to determine whether or not to disable the cover command. Furthermore, if I begin a battle without DK Cecil and then hack him in mid-battle, the Cover command still works. So... maybe there's a check at the beginning of the battle for DK Cecil that allows or prevents Cover for the duration of the battle?
I think I'll look into that a bit...

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Question about Cover command
« Reply #2 on: October 30, 2016, 04:31:46 PM »
I doubt that would cause the editor to crash. It's probably some kind of array out of bounds error or something like that. The code relevant to your question though is in the section that saves the data:

Code: [Select]
  case 20 'Cover
   WriteByte(&h18F62, disable_actor)
   WriteByte(&h18F66, cover_actor)
   if cover_by_job then WriteByte(&h38D5D, 1) else WriteByte(&h38D5D, 0)
   WriteByte(&h149F3, action_stance)

18F62: Disable if this actor is present
18F66: Actor that auto-covers
38D5D: Has value 1 if covering is done by Job, 0 if it is done by actor (so if it's 1, the byte at 18F66 is the Job index, not Actor index)
149F3: Action stance (probably the pose he's in when he "jumps in the way")

I can't remember where I got this information originally though.
Let's dance!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Question about Cover command
« Reply #3 on: October 30, 2016, 05:53:55 PM »
Well look at that, there you go.

Those Offsets are ROM with header, btw, so if your ROM has no header, subtract 200.

An interesting thing that I discovered in all this, in case anyone's interested (and who knows, maybe it was already documented wherever the info Pinkpuff supplied was documented) - If the coverer happens to occupy a party slot earlier than the disabler, then the disabling doesn't happen at all. For instance, if you don't change those values at all, but create a party with P Cecil in the middle and DK Cecil anywhere else, the P Cecil can still cover, but if DK Cecil is in the middle and P Cecil is anywhere else, then covering won't work. This is because when the game is running the code that uses those "coverer" and "disabler" values (which is at the beginning of the battle, btw, so I was on to something there), it stops looking once it finds the coverer or the disabler - so whoever comes first gets their routine run.
BTW, if you wanted nobody to disable Cover, you could set the value at 18F62 (or 18D62 w/o header) to 17, because that is higher than any character's ID (so when the game is checking for the disabler, there would never be one).

Thanks for chiming in, Pinkpuff!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Question about Cover command
« Reply #4 on: October 30, 2016, 06:11:57 PM »
Indeed, I supplied the info. to you PinkPuff long ago, it took me some time but I relocated the post.

http://slickproductions.org/forum/index.php?topic=1754.msg18778#msg18778

I wouldn't know why changing it's crashing the game though. I still find that to be one of the weirdest quirks to FFIV's design, it may be a remnant of a much earlier system though.

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Question about Cover command
« Reply #5 on: October 31, 2016, 06:31:55 AM »
It crashes the editor not the game
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Question about Cover command
« Reply #6 on: October 31, 2016, 10:05:02 AM »
Oh...  great reading comprehension on my part, well that's a slight relief.

Well I tested it myself and it looks to work as I had originally surmised. I changed the Coverer to Yang, used Cover as Paladin Cecil, and Yang would cover whoever was the target of Cover. The program did crash once when I went to try and re-access the Cover changer portion, but only once. When I reloaded it there wasn't any issue and I was able to set it back to normal without any further difficulties.

fedorajoe

  • Mom Bomb
  • *
  • Posts: 123
  • Gender: Male
  • "G...Golbez!"
    • View Profile
Re: Question about Cover command
« Reply #7 on: November 03, 2016, 04:52:57 PM »
Interesting read...  Thanks for your help again, team!