Author Topic: What is known about vehicles?  (Read 6115 times)

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: What is known about vehicles?
« Reply #30 on: September 04, 2013, 09:28:24 AM »
Ok, I got something here.
Travel between the Over- and Underworlds in an airship is preceded by a check of the x,y position. This is how the game determines whether you will change worlds. I haven't found the coordinates in the Overworld yet, but the check when you're in the underworld is at the subroutine at $9C28 (SNES address, that's 1E28 in ROM).
At 9C6F (1E6F), you have:
Code: [Select]
$00/9C6F C9 70       CMP #$70               
$00/9C71 90 14       BCC $14    [$9C87]     
$00/9C73 C9 73       CMP #$73
That C9 70 is determining the first acceptable x value to warp up, and that C9 73 is the first unacceptable x value.
Likewise, at 9C7A (1E7A), you have:
Code: [Select]
$00/9C7A C9 0F       CMP #$0F               
$00/9C7C 90 09       BCC $09    [$9C87]     
$00/9C7E C9 12       CMP #$12
0F is the first acceptable y value, and 12 is the first unacceptable y value.

I've only tried this with the Falcon so far, and of course I've only found the coordinates for the underworld, but now I know the process to get the rest of the necessary information. Gotta stop now, but I'll have the rest soon.

 :edit: Forgot to mention - the x,y coordinates of where you come up in the Overworld are also in this subroutine, so that can be modified as well. I'll post the exact address this evening.
« Last Edit: September 04, 2013, 10:16:19 AM by chillyfeez »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: What is known about vehicles?
« Reply #31 on: September 04, 2013, 12:59:44 PM »
I expected these to be ordinary entrances and exits, rather naive of me. Great work finding these though! To change where you can land and surface in the Underworld/Overworld will allow the modder the chance to change the landscape to a greater extent!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: What is known about vehicles?
« Reply #32 on: September 05, 2013, 12:31:10 PM »
Alright, here's the skinny on Overworld <--> Underworld travel...

In order to determine whether to initiate interworld travel, the game runs the subroutine at 9C28 (SNES, that's 1E28 in ROM).
It checks to see if you are in the Enterprise at 9C40 (1E40) - 04 by default.
It checks to see if you are in the Falcon at 9C44 (1E44) - 05 by default.
I say "by default," because it is possible to change which vehicles are able to travel between worlds... however, there are a few problems with doing so.
- If you change one airship to the Whale (06), then instead of decreasing/increasing height in the animation sequence, it simply disappears. It will reappear when it arrives in the new location. Also, the Overworld ocean flashes purple for a split second during the animation.
- If you change one airship to one of the chocobos (01 or 02) (in addition to the fact that you would necessarily have to change which terrains these vehicles can travel over), they are still invisible in the Underworld (I haven't figured out how, if at all possible, to change this).
- There shouldn't be much of an issue making the hovercraft (03) able to interworld travel, although you would of course have to change its travelable terrains.

After the vehicle check, the game checks for x,y coordinates.
First, a check to see if you are in the Overworld at 9C47 (you can't change this). If you are, then it checks your x location. The x min (first valid x value for interworld travel) is at 9C50 (1E50), 69 by default. The x max (first invalid value) is at 9C54 (1E54), 6C by default. If you are within this range, then it checks your y value. The y min is at 9C5B (1E5B), D3 by default. The y max is at 9C5F (1E5F), D6 by default. If you are within this range, then the game initiates the "travel down" routine. More on this later.

If you are not in the Overworld, then the game checks to see if you are in the Underworld at 9C69 (1E69). The 01 here represents the Underworld. You can change this to 02 for the Moon, in theory, but I haven't been able to successfully initiate travel to the Moon by altering this routine, so it's kind of pointless to do so. If you are in the Underworld, then your x,y is checked. x min is at 9C70 (1E70), 70 by default. x max is at 9C74 (1E74), 73 by default. y min is at 9C7B (1E7B), 0F by default. y max is at 9C7F (1E7F), 12 by default. If you are within this range, then the game initiates the "travel up" routine (read on).

The "travel down" routine is at 9315 (1515) Most of this (and it's a long routine), I believe, is graphical instruction that I don't really understand. The important part here is the instruction on the x,y location upon arrival. The arrival x value is at 9381 (1581), 71 by default. The arrival y value is at 9386 (1586), 10 by default. You probably want to set your Underworld x,y arrival values within the range of your x,y travel up values, but hey, it's your hack.
The routine also contains instructions to set 1700 and 1701 to "01." These are identifiers for the Underworld map, but they seem to not be the only ones, because changing these to 00 00 for the Overworld or 02 02 for the Moon results in a glitch world. I'm not sure I'm properly motivated to delve into this any deeper.

The "travel up" routine is at 9472 (1672). Again, we're really only concerned with arrival x,y values here. Arrival x is at 9473 (1673), 6A by default. Arrival y is at 9478 (1678), D4 by default.

In Summation:
(only ROM addresses will be used here)
Code: [Select]
Overworld -> Underworld
x min: 1E50
x max: 1E54
y min: 1E5B
y max: 1E5F
Come down at x: 1581
Come down at y: 1586

Underworld -> Overworld
x min: 1E70
x max: 1E74
y min: 1E7B
y max: 1E7F
Come up at x: 1673
Come up at y: 1678

To change which vehicles can travel:
1E40 (04)
1E44 (05)
change one of these values to 01 (Yellow Choc), 02 (Black Choc), 03 (Hovercraft) or 06 (Lunar Whale)

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: What is known about vehicles?
« Reply #33 on: September 06, 2013, 10:29:26 AM »
Quite a detailed synopsis. I did not think that there would be something so special in going between the two worlds. That you can take a Chocobo down there is quite intriguing. What happens though when you go with a Chocobo? Do you have to Press A in order to dismount or does it automatically go through the warping cycle when you step on the black tiles?

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: What is known about vehicles?
« Reply #34 on: September 06, 2013, 04:33:46 PM »
To be honest, I hadn't tried it til you asked.
You press A as though you're dismounting, but the game checks for interworld travel conditions. As they are met, you warp down instead of dismounting. The warp animation is slightly glitched in the same way that it is in the Whale (ocean flashes purple for a second), plus the chocobo is invisible in the Underworld. By default, the invisible chocobo can run pretty much anywhere in the Underworld, since the hot lava bit is the same as the chocobo travel bit.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: What is known about vehicles?
« Reply #35 on: September 06, 2013, 08:35:55 PM »
I've been looking into whether it's possible to:
- Make a different vehicle carry the hovercraft
- Make the Enterprise carry a different vehicle

Mixed results.
The hovercraft pickup is part of the Enterprise's landing routine. It checks to see if the current x,y matches the stored x,y of the Hovercraft, then checks to see if the proper event flag is set. If so, then the crane lowers and the Hovercraft is grappled.
Now, this whole subroutine is preceded by a routine that essentially doles out instructions for what to do if you press A while in a world map, which looks like this:
Code: [Select]
$00/9C87 AD 04 17    LDA $1704  [$00:1704];Look at 1704 in RAM (mode of transport)
$00/9C8A F0 2B       BEQ $2B    [$9CB7]   ;If Zero, return
$00/9C8C C9 01       CMP #$01      ;compare with 01 (Yellow Choc)
$00/9C8E D0 03       BNE $03    [$9C93]   ;If not equal, skip to next check
$00/9C90 4C 5D 9E    JMP $9E5D  [$00:9E5D];If equal, run Yellow Choc dismount routine
$00/9C93 C9 02       CMP #$02   ;compare with 02 (Black Choc)
$00/9C95 D0 03       BNE $03    [$9C9A]   ;If not equal, skip to next check
$00/9C97 4C 02 9F    JMP $9F02  [$00:9F02];If equal, run Black Choc dismount routine
$00/9C9A C9 03       CMP #$03   ;compare with 03 (Hovercraft)
$00/9C9C D0 03       BNE $03    [$9CA1]   ;If not equal, skip to next check
$00/9C9E 4C C0 9F    JMP $9FC0  [$00:9FC0];If equal, run Hovercraft landing routine
$00/9CA1 C9 04       CMP #$04   ;compare with 04 (Enterprise)
$00/9CA3 D0 03       BNE $03    [$9CA8]   ;If not equal, skip to next check
$00/9CA5 4C ED A3    JMP $A3ED  [$00:A3ED];If equal, run Enterprise landing routine
$00/9CA8 C9 05       CMP #$05   ;compare with 05 (Falcon)
$00/9CAA D0 03       BNE $03    [$9CAF]   ;If not equal, skip to next check
$00/9CAC 4C 3C A5    JMP $A53C  [$00:A53C];If equal, run Falcon landing routine
$00/9CAF C9 06       CMP #$06   ;compare with 06 (Lunar Whale)
$00/9CB1 D0 03       BNE $03    [$9CB6]   ;If not equal, skip to end
$00/9CB3 4C C4 A5    JMP $A5C4  [$00:A5C4];If equal, run Lunar Whale landing routine
$00/9CB6 60          RTS
Now it is possible, in theory, to make the Falcon pick up the Hovercraft instead of the Enterprise by changing the 04 at 9CA2 to 05 and the 05 at 9CA9 to 04, but then you would have to switch all of the vehicle specific ram references in each landing routine to represent the correct vehicle. That would include vehicle height, stored world location, stored x position, stored y position (I think that's it). You'd have to do this both for the Falcon's and the Enterprise's landing routine, or else you'd have some crazy glitching when you try to land. You could probably do this with the Whale, too, but then you'd have to change a lot more coding.
Seems like a lot of work for not a lot of payoff...

As for the other side of the coin, carrying a different vehicle:
I can change which vehicle's location is checked from Hovercraft to anything else (except Yellow Choc - because it always runs away, the game does not store its location). This is done by changing the 19 17 at A407-8 to any other vehicle's stored x,y (15 17 for Black Choc, 21 17 for Falcon, 25 17 for Lunar Whale). Likewise, the stored location of the Hovercraft when releasing it can be changed to the stored location of any other vehicle by changing the 19 17 at A506 in the same fashion. There are still problems with these changes, though. The Hovercraft still disappears instead of whichever vehicle you are trying to pick up, and the carried vehicle still looks like the hovercraft. I haven't been able to figure out how (if possible) to "fix" these issues.

Honestly, I'm kind of running out of steam on my vehicle research. I've figured out how to change pretty much everything I really wanted to be able to edit, and it seems like everything else I find can't be edited without significant glitches. So... I think I'm gonna put vehicles to bed for now.
 :sleep:

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: What is known about vehicles?
« Reply #36 on: September 08, 2013, 09:26:38 AM »
You have done amazing work with this Chillyfeez, I somewhat expect the Hovercraft combined with the Airship to be a separate graphic but that's for another time I suppose. Your work with Vehicles will be of immense value down the line. Keep up the great work!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: What is known about vehicles?
« Reply #37 on: April 12, 2014, 10:26:11 PM »
Discovered a new little tidbit, just thought I'd link to it from here for the sake of organization.
http://slickproductions.org/forum/index.php?topic=1930.msg20765#msg20765

Bahamut ZERO

  • Cagnazzo
  • *
  • Posts: 347
  • Gender: Male
  • If ye're takin a beatin, hop in de back row!
    • View Profile
Re: What is known about vehicles?
« Reply #38 on: September 09, 2016, 04:43:04 PM »
Since I didn't see it mentioned earlier in the thread; graphics for things like The hook, carried hovercraft, and the drill are their own separate graphics.

* The hook, once the correct flag is set, is always loaded behind the Enterprise.  I found this out the hard way while editing the graphics for the Enterprise. As long as you keep the hook short enough to stay hidden behind the airship, and long enough to not look wonky while lower to pick up/drop the hovercraft, you can edit the graphic to be whatever, like a tractor beam! Or something.

* Falcon Drill, once the correct flag is set, is always in front of the Falcon. Unlike the hook, the drill has animation frames like the airships have for their propellors. The frames can edited easily in YYCHR, only thing you have to keep in mind is having it a position to where it looks attached to the vehicle.
I update my graphics thread on almost a daily basis, so keep an eye out for new stuff!