Qhimm.com Forums

Final Fantasy Forums => Scripting and Reverse Engineering => Topic started by: DLPB on 2018-01-05 15:41:44

Title: World Map Functions
Post by: DLPB on 2018-01-05 15:41:44
Jump Location Var: E045E4.

Set to 02 and you'll have menu access while submerged in the sub.  I needed to find this so I can fix the bug that causes Emerald Weapon battle music when resurfacing. [although I already had it in Ochu.  Whoops! ]

Event loader: 76420A

Events are loaded from here.  There are certain types. Special events, like Emerald Weapon's movement and battle are initiated from 7642D1. For example, when your sub comes into contact with Emerald, certain new functions are called from the parameter placed into the function (0x300 is deducted inside the function, so below are actual jump IDs):

This chain is in  order:

4A, 7659DF (sonic boom effect)
07, 7650d2
1D, 7657C4 Electric sound effect
36, 7650E7 Sub pushed away
28, 765184
3B, 7655F1
34, 765BF2
48, 7655CC Battle swirl - battle intro
55, 765808
17, 7657E1 Initiates Emerald Weapon battle

The World Map simply has opcodes like Field, it seems.  So you could call for a sonic boom effect around a model at any time.

03 is Emerald Weapon movement
04 is involved in Emerald Weapon's movement.  May be the direction change operations (the movement path).
05 Emerald Weapon collision detection.  If this isn't called, the sub will not interact with Weapon - but the battle can still happen if you touch a certain part of Weapon. Issues will arise.  Seems to also depend... I can't always make the collision disable.  May be the return value I am messing up.
06 is Emerald Weapon movement.

21 Unknown

It is likely that Ultima Weapon shares some or all of these functions.


[00E39BC0] is used for the collision and movement.  When it's set to 1, there is no movement and all collision is off.  It's used by 05.
Title: Re: World Map Functions
Post by: Grimmy on 2018-01-09 22:42:23
Taking a wild stab in the dark here, but with your new opcode 1A would I be able to write to the Jump Location Var: E045E4 and set the exit for a town to a new location on the world map?
Title: Re: World Map Functions
Post by: DLPB on 2018-01-10 15:36:36
1A wouldn't, because for safety reasons I have limited it to the parts the game expects to be written to.  It's quite possible to even edit executable code within ff7 to make a text box appear and say "hi!"  - but that isn't a proper use of programming.

As for exit towns and stuff...  The E---- range, as far as I am aware, is the data that has been placed there from files. It's being read from the .ev files in world_us - among other things.  So you'd then have to disable parts that write the data...  and it gets messy.  So short answer is yes and long answer is - it's not a good idea.  Assuming it isn't hardcoded, we will need a world map script editor.

But the var above is not the jump place ID anyway... it's the jump-to module var - in part.  The Town ID etc I noted somewhere else.  I haven't looked into it, but the var above probably when set to a specific value (like 3) - THEN USES the town place ID.
Title: Re: World Map Functions
Post by: DLPB on 2018-01-11 07:43:00
Actually, yeah....  I traced the wm exit points to a table file in world_us.  I posted about it somewhere.
Title: Re: World Map Functions
Post by: Grimmy on 2018-01-14 15:24:14
I had read this recently about how you changed the jump from the world map to field from gonjun2 to gonjun1.

writes direction from 0076716C

E37EB0 = 56 01 E0 FD 05 00 03 02 9C 9C 9C 9C

From file "field.tbl" in world_us.lgp

03 02 is 515 decimal (gonjun2)

So, I change to

53 02 44 FD 3B 00 02 02 A8 A8 A8 A8

So the field.tbl contains the WM exit points. I wonder which file contains the WM entry points and if the XYZ location is somehow editable? MakouReactor has settings for this but other than changing the exits from say wm2 to wm3 etc. changing the XYZ has no effect.
Title: Re: World Map Functions
Post by: DLPB on 2018-01-14 15:40:05
It will likely be in that same table.
Title: Re: World Map Functions
Post by: DLPB on 2018-01-16 23:27:07
I've fixed the bug with Emerald by skipping most of the functions it needs for the collision and battle to take place if sub is ascending back to overworld.