News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Final Fantasy 1 WIP - Saving Indoors  (Read 825 times)

essellejaye

  • Jr. Member
  • **
  • Posts: 28
    • View Profile
Final Fantasy 1 WIP - Saving Indoors
« on: May 20, 2018, 08:56:10 am »
Here's a video of a WIP patch to save indoors.
https://youtu.be/eUxJ2RzYjkI

I modified the Tent to allow it to be used indoors. This works on any standard map, though it does introduce the quirk that saving in the Inn will return you to the front door of the Inn instead of outside of town.

Disch

  • Hero Member
  • *****
  • Posts: 2710
  • NES Junkie
    • View Profile
Re: Final Fantasy 1 WIP - Saving Indoors
« Reply #1 on: May 20, 2018, 10:08:49 am »
Nice.   :thumbsup:

So... is this saving the whole call stack?  I'd imagine that'd be necessary in order for warp staircases to work properly.

Jeville

  • Sr. Member
  • ****
  • Posts: 350
    • View Profile
Re: Final Fantasy 1 WIP - Saving Indoors
« Reply #2 on: May 20, 2018, 02:49:30 pm »
This is cool, but for dungeon areas it can be abused to stay out of random encounters. So for those areas they should send you back to the entrance after resetting, as it does in the original.

essellejaye

  • Jr. Member
  • **
  • Posts: 28
    • View Profile
Re: Final Fantasy 1 WIP - Saving Indoors
« Reply #3 on: May 20, 2018, 05:09:27 pm »
@Jeville
That's true if the battlestep and battlestep_sign values aren't saved and restored.
If they are, then the next call to BattleStepRNG would work as it did before.
e.g. if battlestep_sign is a negative value and battlestep is 1 when you save, then after loading the save, the next call to BattleStepRNG (i.e. your next step) would set battlestep to 0 and trigger a random encounter.
If btlformation is also saved, then the encounter would be the preserved as well.

Also, this is a WIP, the final implementation would actually be one of two things:
a) a save point, which is the only place where the Tent (and potentially Cabin and House) could be used, a la later FFs;
b) a sprite that triggers the save instead of a Tent/Cabin/House (and doesn't restore HP) that could be put in specific places in any dungeon.

My friend who inquired about this was interested in option b more so than a.

May 20, 2018, 06:25:16 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
@Disch
For this WIP, I changed use of the stack to use of a warp list that's stored in UNSRAM (and saved in SRAM).

Disclaimer:
I've only played this as far as the Earth Cave, so I don't know yet if the game can be completed without error.

Details:
I took advantage of the slack space in ch_stats and ch_magicdata to rearrange things to free the upper half of ch_magicdata.
I adjusted various routines to compensate for that.
Then I replaced the stack usage with a warp list and list index using most of that space.

To save and load, I store a handful of SM-related variables in a small window of apparently unused space between item_stop and ch_stats. DoStandardMap uses these when loading to figure everything out.
« Last Edit: May 20, 2018, 06:25:16 pm by essellejaye »