FF7/Field/Walkmesh

From Final Fantasy Inside
< FF7‎ | Field
Revision as of 22:00, 20 March 2005 by my_wiki>Synergy Blades
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Section 5: Walkmesh (Kero)

Every every offset is here relative, 00 is at the start of section 5 (after length indicator).

Section 5 of field files is a stored walkmesh. A walkmesh is a mesh of polygons on which characters move, telling the engine for example how high it is, and using this the character can, for example, cross bridges with the real feeling that in the middle he is at a higher place than on the sides. It has very simple structure.

Section 5 Header

Startofs 0x00 Length 0x04

Walkmesh doesn't have header, it is only one 4 bytes long unsigned int, called NoS (Number of sectors).

Sector pool

Startofs 0x04 Length NoS*24

typedef struct {
   short x,z,y,res;		// short is 2 bytes long integer
} vertex_3s;			// 3 short
typedef struct {
   vertex_3d v[3];
} sect_t; 

In sector pool are sectors, in fact just triangles and its position. For each sector you have three vertex_3s. Just store them. It seems that res and z are very often same, but not always, I don't know why. It seems that all polygons are clockwise. I didnt check it, but it is probably in order to know wheather point is in triangle. If you give it in other direction, point will be detected outside if it is inside and vice versa.

Access pool

Startofs 0x04 + NoS*24 Length NoS*6

typedef {
   short acces1,acces2,acces3;
}

In access pool you have ID of poly, you should go into if you cross line.

acces1 is for line from vertex 0 to 1 acces2 is for line from vertex 1 to 2 acces3 is for line from vertex 2 to 0

If acces1/2/3 is FFFF then you are not allowed to cross this line. Acces pool and sector pool are same size (NoT), so you will just use same index for both pools. If access don't translate you, it just says, you should be here, if you are not, then there is a problem. If you design polymesh where you cross line and access tells you that you should be in poly 12, but you are god know where then FF7 stops.