Anonymous

Changes

From Final Fantasy Inside

FF7/WorldMap Module/Script

1,715 bytes added, 11:15, 8 February 2022
m
Entities & Models
The Worldmap module operates on a fixed set of models, each having a specific model ID.
{| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse"|+ Type = 1, Model function|-! style="background:rgb(204,204,204)" align="center" | Model ID! style="background:rgb(204,204,204)" align="center" | Name|-| 0| Cloud|-| 1| Tifa|-| 2| Cid|-| 3| Highwind|-| 4| Wild Chocobo|-| 5| Tiny Bronco|-| 6| Buggy|-| 7| Junon Canon|-| 8| Cargo Ship|-| 9| Highwind's propellers|-| 10| Diamond Weapon|-| 11| Ultimate Weapon|-| 12| Fort Condor's Condor|-| 13| Submarine|-| 14| Gold Saucer|-| 15| Rocket Town's Rocket|-| 16| Rocket Town Launch Pad|-| 17| Sunken Gelnika|-| 18| Underwater Reactor|-| 19| Chocobo|-| 20| Midgar Canon|-| 21| Unknown|-| 22| Unknown|-| 23| Unknown|-| 24| North Crater barrier|-| 25| Ancient Forest|-| 26| Key of the Ancients|-| 27| Unknown|-| 28| Red Submarine|-| 29| Ruby Weapon|-| 30| Emerald Weapon|}
Each model that is currently loaded into the map also has an entity associated with it, this is the state of the model and holds information such as its position, rotation, current animation etc. Most instructions operate on the current active entity, which can be changed with the [[FF7/WorldMap_Module/Script/Opcodes/330|330]] opcode. The current active entity can also change as a side effect of certain instructions, all known cases are documented in the opcode descriptions but the list is not complete. The variable holding the current active entity is a global variable that resets every frame, if a script enters a wait state the current active entity is undefined when executing resumes.
|-
| 4
| UnknownAction| Called when player interacts with the model
|-
| 5
This table is probably not complete.
There is also a set of 32 system functions that are executed in response to certain events which . First 10 are called by the game's executable (subroutine at address 0x7640BC in the PC version), while the remaining ones are not related called by the WM scripts using the "[[FF7/WorldMap Module/Script/Opcodes/204|run function]]" opcode with Model ID parameter set to a certain model;0xFFFF.
{| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse"
| 2
| Tick
| Called each frame(only does a check if Zolom should be reset)
|-
| 3
| UnknownDummy function (copy of Function ID 2)
|
|-
| 4
| UnknownDummy function (copy of Function ID 2)
|
|-
| 5
| UnknownDummy function (copy of Function ID 2)
|
|-
| 6
| Unknown
| Enter highwind interior?
|-
| 7
| Midgar Zolom
| Called when the player touches the midgar zolom in the swamp.
|-
| 8
| Dummy function (copy of Function ID 2)
|
|-
| 9
| Northern Cave landing
| Checks if Highwind can land in the crater switches to Highwind Deck map
|}
And finally there is a set of functions which are called when the player enters an area of the steps on a walkmesh triangle that is designated to trigger a script (it is not clear exactly which walkmesh types can trigger this event). Which function is executed depends on the mesh coordinates of the player (0-35, 0-27) as well as the exact walkmesh type that triggered function ID [[FF7/WorldMap_Module#Triangle|from the eventMAP file]]. Each mesh can trigger up to 5 different functions with ids from 0 to 4. In theory there can be more than 2000 unique combinations so no list will be given for these functions :) Fortunately, not all functions need to be implemented, as will become apparent in the next section, functions that do nothing do not need to be implementedat all. Most of the mesh functions handle entering field levels from the world map.
== .ev Format ==
=== Call Table ===
The first 0x400 bytes of an .ev file is the call table, a mapping between functions and entry points. Each entry is 4 bytes, 2 bytes of function identifier and 2 bytes instruction pointer. Instruction pointers are in 2-byte increments from the start of the code section. The last first two bits (most significant) of the function identifier defines the format of the remaining 14 bits;
{| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse; width: 200px250px"
|+ Type = 0, System function
|-
! style="background:rgb(204,204,204)" align="center" | size
! style="background:rgb(204,204,204)" align="center" | description
|-
| 8 bits
| Function #
|-
| 6 bits
| Padding
|-
| 8 bits (least significant)
| Function #
|}
{| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse; width: 200px250px"
|+ Type = 1, Model function
|-
! style="background:rgb(204,204,204)" align="center" | size
! style="background:rgb(204,204,204)" align="center" | description
|-
| 8 bits
| Function #
|-
| 6 bits
| Model ID
|-
| 8 bits (least significant)
| Function #
|}
{| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse; width: 200px300px"
|+ Type = 2, Mesh function
|-
! style="background:rgb(204,204,204)" align="center" | description
|-
| 10 bits| MeshX + MeshZ * 36|-| 4 bits(least significant)
| Walkmesh type
|-
| 10 bits
| MeshX + MeshY * 36
|}
49
edits