Changes

Jump to navigation Jump to search

FF7/Field/Walkmesh

648 bytes added, 02:41, 13 July 2019
no edit summary
=== Section 5: Walkmesh ([[User:Kero|Kero]]) ===
<div class="thumb tright"><div class="thumbinner" style="width: 182px">[[File:Field_Wutai.jpg|180px|[[Image:180px-Field_Wutai.jpg]]]]<div class="thumbcaption"><div class="magnify">[[File:Field Wutai.jpg|thumb|]]</div>Wutai Walkmesh]]</div></div></div>
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.
{| class="wikitable"! Offset! Name! Data Type! Length! Description|-| 0x0000| NoS| DWORD| 0x04| Number of Sectors|-| 0x0004| Sector Pool (SP)| DWORD| 24 * NoS| The data pool of Secots|-| 0x0004 + 24 * NoS| Sector Access Pool (SAP)| WORD[3]| 6 * NoS| ID of triangle of each Edge|} === = Section 5 Header ====
Startofs 0x00 Length 0x04
Walkmesh doesn't have header, it The walkmesh information is only one preceeded by a DWORD (4 bytes long ) unsigned int, called named '''NoS (''', short for the Number of sectors)Sectors in the walkmesh.
==== Sector pool ====
Startofs 0x04 Length NoS*24
typedef struct {
short x,y,z,y,res; // short is a 2 bytes long byte signed integer } vertex_3s; // 3s == 3 shortalthough there are 4 this is for 32 bit data alignment in PSX
typedef struct {
vertex_3d vertex_3s v[3]; // a triangle has 3 vertices } sect_t; // Sector Type
In sector The pool are consists of sectors, which are in fact just triangles and its , each with their vertices position. For each sector you have three there are 3 vertices (3 vertex_3s). Just store themRes is always equal to v[0]. It seems that res and z are very often same, but not always, I don't know why(it is just a padding value). It seems that all The polygons are 'wound' clockwise. I didnt check it, but it is probably in order to know wheather this makes determining if a point is in within a triangle. If you give it in other direction, point will be detected outside if it is inside and vice versaeasier.
==== Access pool ====
Startofs 0x04 + NoS*24 Length NoS*6
}
In The access pool you have is an array of access data (ID 's of polytriangles in the Mesh) in the mesh, the ID is the triangle you should go into be in if you cross linethat edge.
acces1 is for line from vertex 0 to 1acces2 is for line from vertex 1 to 2acces3 is for line from vertex 2 to 0
If acces1/2/3 the edge value is FFFF then you are not allowed to cross 0xFFFF, than this lineedge cannot be crossed (it's blocked). Acces The access pool and sector pool are have the same size (NoT)number of entries, so thus you will just use the same index value for both poolsof data to access the data for the same triangle. If The access don't translate you, it just says, you data merely informs one that if the PC object crosses this line the object should be here, in the indentified triangle. FF7 will halt running if you are not, then there is a problem. If you design polymesh where you cross line and in the '''access tells you that you should be in poly 12, but you are god know where then FF7 stops''' specified triangle.

Navigation menu