øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=2120.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexdb35.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&board=8.40e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexdb35.html.zxx$h^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈà•¤OÌOKtext/htmlISO-8859-1gzip8:ÖOÌÿÿÿÿÿÿÿÿTue, 10 Mar 2020 23:52:48 GMT0ó°° ®0®P®€§²ð®w$h^ÿÿÿÿÿÿÿÿ˜ OÌ Fancy Walking patch issue

Author Topic: Fancy Walking patch issue  (Read 1644 times)

TheNattak

  • Garula
  • *
  • Posts: 203
  • Gender: Male
  • Mike
    • View Profile
    • Return of the Dark Sorcerer
Fancy Walking patch issue
« on: September 14, 2015, 06:50:40 PM »
There seems to be a weird bug with Fancy Walking that can occur if you talk to an NPC that has an event loop that occurs on stairs, for instance the kid who slides down the banister in Tzen (which may be the only case of this bug happening in the original) where it makes the screen scroll and scroll after talking with the NPC.

Here's someone's video of the bug in action:
https://www.youtube.com/watch?v=4BaY8C_4TJM

Thought I'd bring this to the author's attention in hopes of an update.

assassin

  • Bane of Retards
  • *
  • Posts: 1,033
  • space bears are not gentle!
    • View Profile
    • My Barren Webpage
Re: Fancy Walking patch issue
« Reply #1 on: September 14, 2015, 11:13:29 PM »
thanks.

maybe we need to shrink the patch down to just adding Poison and Tintinabar, then add one thing from Function C0/4A03 at a time from there.

if the patch indeed causes $7E77, $7E08, and $C8A5 to be called twice on diagonal steps and not others, maybe we need to get rid of dupes on the diags.

why does the original game call $C8A5 before $4B60 on diags, but after it (and JSL $C04A3F) on normal steps?  does the order even matter?

i don't know what most of the called functions do, nor what most of the variables are.

Xenovant

  • Tunnel Armor
  • *
  • Posts: 154
  • (ಠ_ಠ)
    • View Profile
Re: Fancy Walking patch issue
« Reply #2 on: September 15, 2015, 09:47:29 AM »
I think the culprit is this one:

Code: [Select]
C0/4A30: 20F446  JSR $46F4
I have been trying to reproduce the bug for a while, with this function removed, but I haven't seen it. Maybe someone should confirm this. Maybe it has been just a coincidence, and the bug is still there.

If removing this, doesn't add a new bug (it needs further testing), we could simply recreate the C0/4A03 routine (without it), and use this one for the stairs. It's a quick and dirty fix, but it should work, and there are "enough" free bytes on the C0 bank :P

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Fancy Walking patch issue
« Reply #3 on: September 15, 2015, 02:09:10 PM »
So I have to fix my patch, huh? Figures.  :isuck:

119 bugs fixed and counting.

13375K31C43R

  • Ultros
  • *
  • Posts: 675
  • Gender: Male
    • View Profile
    • Leet Sketcher's Final Fantasy III Patches
Re: Fancy Walking patch issue
« Reply #4 on: November 10, 2015, 06:54:32 PM »
I was able to reproduce the problem too, until I noticed this in the ASM file:
Code: [Select]
C0496A: JSR $4A03  ; add to step count, deal with poison damage, save point use, etc
C0496D: ; JSR $4AEC  ; now a redundant call
C04970: LDA #$01
C04972: STA $57
C04974: STZ $078E
C04977: RTS

What I noticed in particular is, the three instructions that follow the JSR also appear at the end of the function at C0/4A03. So you could replace that JSR with a JMP and get the same effect. I tried that in my ROM and haven't been able to reproduce the problem since.
"Do not meddle in the affairs of wizards, for they are subtle and quick to anger." -Gildor from The Lord of the Rings

13375K31C43R

  • Ultros
  • *
  • Posts: 675
  • Gender: Male
    • View Profile
    • Leet Sketcher's Final Fantasy III Patches
Re: Fancy Walking patch issue
« Reply #5 on: November 10, 2015, 08:08:15 PM »
OK, never mind, I can still reproduce it. But you can still optimize a bit using my suggestion.
"Do not meddle in the affairs of wizards, for they are subtle and quick to anger." -Gildor from The Lord of the Rings

13375K31C43R

  • Ultros
  • *
  • Posts: 675
  • Gender: Male
    • View Profile
    • Leet Sketcher's Final Fantasy III Patches
Re: Fancy Walking patch issue
« Reply #6 on: April 01, 2017, 02:57:33 PM »
OK, after some digging, I found that C0/2BD0 is a function that updates the camera based on a movement vector, which seems to be why the camera moves endlessly, because that movement vector never gets reset. During movement while the camera is free-moving, the camera's movement vector is set to match the player's movement, located in RAM at $0871-$0874 (index $0803), and stored in DP $73-$76 (this function is located at C0/7E20). There are places where those values are zeroed out, but for some reason it doesn't happen during stair movement.
"Do not meddle in the affairs of wizards, for they are subtle and quick to anger." -Gildor from The Lord of the Rings

13375K31C43R

  • Ultros
  • *
  • Posts: 675
  • Gender: Male
    • View Profile
    • Leet Sketcher's Final Fantasy III Patches
Re: Fancy Walking patch issue
« Reply #7 on: April 01, 2017, 08:13:07 PM »
I think the culprit is this one:

Code: [Select]
C0/4A30: 20F446  JSR $46F4

I can confirm this function call is the problem. What this function does is check to see if you're engaging an NPC for an event/dialogue. The way to pull it off with the kid in Tzen is to be pushing left to climb up the stairs, then press A with good timing; if he's on your left, you'll engage him, but the camera will keep moving. The reason it only works on stairs seems to be because you can't engage NPCs on flat ground unless they are in your movement path, so the camera stops moving, whereas with the kid you're not moving straight left, you're moving up and left.

After further testing, I found that what makes this possible is the fact that you're allowed to move before the dialogue/event check. If you're not pressing left at the time of engagement, the camera doesn't move; however, if you are, your player will actually take a step past the kid, causing the camera to move, and then the camera will continue moving.

If the function call to C0/46F4 is removed, then the only way to talk to an NPC on stairs is to stop moving. If we still want the ability to talk while moving, we'll have to add a "talking to an NPC" check before the movement. Personally, I'd rather remove it, or rather, create a new function identical to C0/4A03 but with the call to C0/46F4 removed.
« Last Edit: April 01, 2017, 11:04:17 PM by 13375K31C43R »
"Do not meddle in the affairs of wizards, for they are subtle and quick to anger." -Gildor from The Lord of the Rings

assassin

  • Bane of Retards
  • *
  • Posts: 1,033
  • space bears are not gentle!
    • View Profile
    • My Barren Webpage
Re: Fancy Walking patch issue
« Reply #8 on: April 05, 2017, 04:20:05 PM »
thank you for your research and diagnostics on this, and Xenovant for his initial debugging.  it will prove useful/central in updating the patch.

Quote
If we still want the ability to talk while moving, we'll have to add a "talking to an NPC" check before the movement.

besides taking space, are there any suspected side effects or issues with this?

13375K31C43R

  • Ultros
  • *
  • Posts: 675
  • Gender: Male
    • View Profile
    • Leet Sketcher's Final Fantasy III Patches
Re: Fancy Walking patch issue
« Reply #9 on: April 06, 2017, 10:49:07 AM »
Quote
If we still want the ability to talk while moving, we'll have to add a "talking to an NPC" check before the movement.

besides taking space, are there any suspected side effects or issues with this?

It would probably depend on the implementation. I've tried just adding an extra call to C0/46F4 and it broke the game, so there'll be a bit more finessing required.
"Do not meddle in the affairs of wizards, for they are subtle and quick to anger." -Gildor from The Lord of the Rings