Field file - section 8
========================
Gatways - thats how I call areas on which you step and you are transffered to another location.
Every every offset is here relative, 00 is at the start of section 8 (after lenght indicator).
Gateways and related data are stored in section 8 of field files. Section 8 is always 740 bytes long, maximum of gatways for one location is 12.
Stucture of section>
* header
* gateways
* triggers
* singles
* triangles
Code: [Select]
Code:
typedef struct { S16 x; S16 z; S16 y;} vector3S16;typedef struct { S16 left; S16 bottom; // maybe top, I dont know/care Its nearly always centred S16 right; S16 top; // maybe bottom.} range;
header
======
Code: [Select]
Code:
typedef { char name_of-location[8]; U32 movement; range picture; U32 blank; range range1; U32 blank1[6];} sec8header`
movement - what direction will character go if you push up, down,left,m right. 128 (0x80) is key-direction (up-up, right-right, down-down, left-left), for 64 (up-right,right-down,down-left,left-up), 32 (up-leftup,right-leftdown,down-rightdown,left-topright)....i dont know how these directions are called.
range picture - you have noticed that your character stays in the center of screen, unless you are near of borders of picture(if you are there, character wont be in the middle, but can move to the very border of image ... well if you define range of picture smaller than is walkmesh, you character can walk out of screen and you wont see it at all). This is what define these borders. Values are in pixels, range if defined from the center of background image (bg image is 300*200 and you define left = - 145, right = 145, top = 98, bottom = -98).
range 1 - well, I dont know if it really is range, just unknown values, probably not, but better than writing four unknown values, every is 1024.
blank,blank1 - seem to be zero, have to run statistical test.
Thats all about header.
Gateways
========
gateways starts on offset 0x38 from the start of section.
Code: [Select]
Code:
struct { vector3S16 corner1; vector3S16 corner1; vector3S16 pos; // place where char will apear after transfer. S16 destindex; // index in maplist U32 unknownl; // 0x84848484 ot zero ?}gateways;
corner 1 and corner2 defines two corner of 3D area in which if you go, you will trigger the gateway and will be transferred do destination. pos is position in destination (x,y,z) where you will appear. Just look at walkmesh value and choose some number so you are ON walkmesh and not BELOW. also you have to snad on some polygon of walkmesh (obviously).
destindex is index destination. Every location has its index defined in maplist (or something like that). In maplist are first 64 +-1 destinations on worldmap. If you swap two destinations in maplist, nothing happens, it is probably only for referrence and doesnt actually determine index of location. As every part of sectio 8 has 12 structures. If destination is 7FFF {maximum positive number for S16} then gateway is not active.
Triggers
===================
from offset 0x158 till 0x218 - size of 1 item is 16
Code: [Select]
Code:
struct { vector3S16 corner1 ; // 6 vector3S16 corner2 ; // 6 12 U8 enterstate; // I have more or less faith into defaultstate, but not these two U8 leavestate; // names are probably wrong U8 defaultstate; // U8 sound; // index zvuku, ale v jake databazi? } triggers
if you step in/out area between corner1 and corner2, you will
* hear sound with id sound (dont know where is table for indexes)
* there will be chage in background (mostly used for opening/closing doors)
enterstate - what sprite show if you enter into area
leavestate - what sprite show if you leave area
defaultstate - what sprite show at the start
These three values are somehow connected to background, at first I thought they define what part of script shoud be called if stepper into/out, but it doesnt seems so (nearly sure, I changed script and changes of background stayed). Still not toos sure about WHAT they are indexing. Have to research section 9 properly.
Singles
======
from offset 0x218 till 0x224
one byte for one item. Dont know what these are for. Values 1 or 0
triangles
==========
from 0x224, lenght of setion 192 -> 16 bytes per item.
This part determines where the red triangles showing where is gateway in the game appear on the screen.
Code: [Select]
Code:
struct { S32 pos.x; S32 pos.z; S32 pos.y; S32 visible; // is it visible? 01 true 00 false} triangles;
pos - position in walkmap. No sign changes necessary.
visible - 0 - trinagle is not visible
1 - triangle is red
2 - trinagle is green
>2 - trinagle is red
- I am not really sure if all bytes from U32 are used only for visibility - >run statistical correction
TODO:
triggers[].*state
triangles[].unknown
rest of header
statistical correction for visible
spelling&grammar check
Now we can sum it all.
Field files - we know how sections are defined.
Every section stores specifical data.
section purpose
1 Dialogs and game scripts
2 Camera,its direction and position, FieldOfView
3 Names of files for loading 3d models - meshes, skeletons, animations
4 Palette
5 walkmesh
6 Junk data
7 random enemies
8 Gateways
9 Background images and sprites
Section 1 scripts ect. are not decoded enough, I dont think we can make our own.
Section 2 - meaning of values decoded from 90%, interpretation from 70%. atribut size somehow define viewvolume, unfortuantelly not enough for practical use.
Section 3 - enough for practical use. 95%
Section 4 pallete - compleatly decoded
Section 5 walkmesh - decoded.
Section 6 - trash, just copy from another field file
I checked section 6 and it really is pure trash. More correctly, I replaced 25 000 bytes long section 6 in wutai with 2 500 bytes long from condor1 and hadnt see any difference in behaviour of filed. Maybe I just didnt pay enough attention, but for now, lets call it junk, trash....
Section 7 random enemies - I have seen it decoded somwhere, but dont know where
Section 8 enought for practical use.
Section 9 - havent looked enought into this, but I dont think document ficedula&qhimm wrote is enough (I would like to see sources of 7mimic),
I think I did good job in decoding. But still not enough for good field file editor.