Sample_Object:
	dd	.mesh
	dd	.points
	dd	8	; unknown
	dd	.unknown
	dd	10	; unknown
	dd	11	; unknown
	dd	0	; unknown
	dd	0x54	; unknown
	dd	0x16	; unknown
	db	0x6, 0x6, 0x6, 0x0 ; unknown
	dd	13	; unknown
	dd	0x543a	; unknown
	dd	0	; unknown
	dd	.unknown
	dd	.specs	; specs like, mass, guns, price, etc...
	dd	0	; unknown
	dd	0	; animation key-points?
.mesh:
	dw	x,y	; unknown, normal?
	db	a,b	; texture settings
	db	p1,p2,p3,p4 ; make surface between these points
	...
.points:
	;	constant 1?, X-offset, Width, Y-offset, Z-offset, ?
	db	1, x, w, y, z, 0
	...


Hmm. I did some work on the Shuttle model and came up with this:

ObjectStruct:
    dd DATA_002558      ; Mesh data				; 0x0
    dd DATA_002560      ; Vertices
    dd 32               ; Number of vertices
    dd DATA_002561      ; Face normals
    dd 22				; Number of normals		; 0x10
    dd 6				; scale related
    dd 0				; scale factor, exponent
    dd 75       		; radius - Half object length?
    dd 17       		; Vanishing 'size'		; 0x20 
    db 6,6,6,0			; 'star' colour
    dd 8				; 'star' 'size'
    dd 75*256			; copied to 0x138
    dd 30*256			; copied to 0x140		; 0x30
    dd DATA_002559      ; Collision data?
    dd DATA_002562      ; Specs
    dd 0
    dd 0										; 0x40

The vertices and normals lists contain structures of the form:

VectorStruct:
    db [1|0], 0
    db x, y, z
    db 0

For a ship object, z is forward, y is up and x is left. For referencing,
both vector lists are interleaved with a set that is identical except
for a reflection in the YZ plane, ie. x becomes -x.

The mesh structure is more complicated. It appears to contain a list of
primitives of varying sizes. The ones I have identified follow:

TexQuadPrimitive:
    dw 4        ; ID value
    dw 0x5009   ; ? Always the same for the shuttle
    db p1, p2, p3, p4   
                ; Four vertex indices
    dw n        ; Face normal index, possibly db n, 0

TexQuadPairPrimitive:
    dw 8        ; ID value
    dw 0x5009   ; See above
    db p1, p2, p3, p4
                ; Four vertex indices, always even
    dw n        ; Face normal index, always even

I'd think that the 0x5009 was a texture index, but it's too big and is
also used for some non-textured parts. Doesn't look much like an RGB
colour either. Also, if you change it, FFE segfaults. Possibly I chose
bad values :-)

The TexQuadPair version also renders the YZ-axis reflected pair of the
primitive, ie. the one with all indices n+1.

PlainLinePrimitive:
    dw 2        ; ID value
    dw 0x5009   ; That bloody thing again
    db p1, p2   ; Two vertex indices

Draws a plain coloured line between the two vertices. Probably only used
in medium/low detail modes.

DirectionalLinePrimitive:
    dw 17       ; ID value
    dw 0x5009   ; Die motherfucker, die
    db p1, p2   ; Two vertex indices
    db n        ; Normal index, probably
    db 2, 0, 2, 0, 0, 0, 0
                ; Unknown, possible min/max sizes

Draws plain coloured line between the two vertices in a different way,
probably with variable line width over distance and angle. Probably only
used in high/very high detail modes

FlatQuadPrimitive:
    dw 4        ; ID, same as TexQuad
    dw 0        ; Woohoo...
    db p1, p2, p3, p4
                ; Four vertex indices
    dw n        ; Normal index

Note that this one may start four bytes earlier. Other than that it's
straightforward, bar the bizarre lack of the 0x5009...

Apart from these there's also a number of four-byte sequences
(colour/tex info?), usually placed between sets of similar primitives, a
starting sequence and an end sequence. I haven't identified any of these
in a useful manner. There are also a pair of text objects which I can
only identify one vertex byte from.

I chose the starts and ends of primitives on rather shaky evidence, so
they may be wrong in some cases.

Finally, Stone-D did some work on the specs section:

DATA_002568: ; StowMaster Fighter
            [F.Thrust]    [R.Thrust]   [GM]   [SM]     [Mass]
        db [0xef, 0x1f], [0xb6, 0xea], [0x1], [0x0], [0xe, 0x0]
           [Int.Cap.]    [Price]      [ZoomF]    [ID]
        db [0xc, 0x0], [0x19, 0x0], [0x2d, 0x0], [0xc], 0x40
           [Crew]      [Mis]      [Drive] [IntegralDrive]
        db [0x1], 0x0, [0x0], 0x0, [0x2],      [0x80], 0x0, 0x1

        db 0xc0, 0x3, 0x0, 0x0, 0x80, 0x2, 0x0, 0x0
			[gun mounting positions]
        db 0x60, 0x3, 0xa0, 0xff, 0x5c, 0x0, 0x1e, 0x0
        db 0xc0, 0x2, 0x4a, 0x0, 0x14, 0x0, 0x7, 0x0

struct ShipSpecs {
	word fthrust;
	word rthrust;
	word gunmount;
	word mass;
	word intcap;		; 0x8
	word price;
	word zoomf;
	word ID;
	word crew;			; 0x10
	word missiles;
	word drive;			; top byte potentially upgrade-drive
	word elitepoints;
	word view_zoff;		; 0x18
	word view_yoff;
	word unknown;
	word unknown;
	word fgun_zoff;		; 0x20
	word fgun_yoff;
	word rgun_zoff;
	word rgun_yoff;
	word ttgun_zoff;	; 0x24
	word ttgun_yoff;
	word btgun_zoff;
	word btgun_yoff;
};

>The thing I havent figure out yet is how the mesh list ends.
>There seems to be some counter that I havent sorted out yet.
>Or something. The above stuff is just extremely trivial
>polygon stuff. Then there is inclusion of other objects (gears,
>wings, metalworks, beacons, antennas, ...) which I havent
>looked at yet.

Likewise, there are still many things missing from this. Comparison with
other ship models along with some Softice work might eventually allow a
complete breakdown, but I suspect that some details will remain vague
without a code-reading solution.


>Anyways... this is probably a bit too technical for alt.fan.elite =)

On the other hand, anybody who would be interested is here.


;dw, dw, db, db, db (top bit texcol), db texcol,
;db, db, db texcol, db texcol, db, db, db, db,
;db, db, db, db, db, db
DATA_002558:
	db 0xe6, 0xff, 0x1a, 0x0	; -26/26
	
	db 0x44, 0x24, 0x0, 0x82
	db 0x1, 0x24, 0x40, 0x24, 0x20, 0x24, 0x42, 0x20
	db 0x3, 0x21, 0x42, 0x22, 0x23, 0x21, 

;bottom face
	db 0x4, 0x0, 0x9, 0x50, 0xa, 0x9, 0x8, 0xb, 0x10, 0x0

	db 0xb, 0x8, 0xe8, 0x3, 
	db 0x4b, 0x5, 0xf4, 0x1

;skids
	db 0x11, 0x0, 0x9, 0x50, 0x14, 0x16, 0x14, 0x2
	db 0x0, 0x2, 0x0, 0x0, 0x0, 0x0
	db 0x11, 0x0, 0x9, 0x50, 0x18, 0x1a, 0x14, 0x2
	db 0x0, 0x2, 0x0, 0x0, 0x0, 0x0
	db 0x11, 0x0, 0x9, 0x50, 0x1c, 0x1e, 0x12, 0x2
	db 0x0, 0x2, 0x0, 0x0, 0x0, 0x0
	db 0x11, 0x0, 0x9, 0x50, 0x15, 0x17, 0x15, 0x2
	db 0x0, 0x2, 0x0, 0x0, 0x0, 0x0
	db 0x11, 0x0, 0x9, 0x50, 0x19, 0x1b, 0x15, 0x2
	db 0x0, 0x2, 0x0, 0x0, 0x0, 0x0
	db 0x11, 0x0, 0x9, 0x50, 0x1d, 0x1f, 0x13, 0x2
	db 0x0, 0x2, 0x0, 0x0, 0x0, 0x0

;format: 0x11 (unused-0x0) (unused-tex1) (unused-tex2) 
;(p1) (p2) (unused-normal?) short(size1) short(size2)

struct {
	UCHAR 0x11;
	UCHAR 0x0; 		// unused
	UCHAR tex1; 	// unused
	UCHAR tex2;		// unused
	UCHAR p1;
	UCHAR p2;
	UCHAR norm;		// unused
	USHORT size1; 	// size at p1
	USHORT size2;	// size at p2
	UCHAR stuff[3];	// unused
};

 0x4c, 0x2, 0xf4, 0x1

;Reverse side of skids
	db 0x2, 0x0, 0x9, 0x50, 0x16, 0x14
	db 0x2, 0x0, 0x9, 0x50, 0x1a, 0x18
	db 0x2, 0x0, 0x9, 0x50, 0x1e, 0x1c
	db 0x2, 0x0, 0x9, 0x50, 0x17, 0x15
	db 0x2, 0x0, 0x9, 0x50, 0x1b, 0x19
	db 0x2, 0x0, 0x9, 0x50, 0x1f, 0x1d

;top face
	db 0x4, 0x0, 0x9, 0x50, 0x2, 0x1, 0x0, 0x3, 0x2, 0x0
;top front face
	db 0x4, 0x0, 0x9, 0x50, 0x4, 0x1, 0x0, 0x5, 0x4, 0x0

;flat window poly
	db 0xab, 0x0, 0xdc, 0x5

    db 0x4, 0x0, 0x0, 0x0, 0xe, 0xd, 0xc, 0xf, 0x4, 0x0

;top left face
	db 0x8, 0x0, 0x9, 0x50, 0x2, 0x4, 0x0, 0x6, 0x6, 0x0

	db 0x4b, 0x2, 0x6a, 0x3

;message left
	db 0x1c, 0x19, 0x0, 0x0
	db 0x3c, 0x83, 0x44, 0xfd, 
	db 0xa, 0x0, 0x0, 0x0, 0x6, 0x6, 0x10, 0x46, 0x16, 0x30

;message right
	db 0x1c, 0x19, 0x40, 0x0
	db 0x3c, 0x83, 0x44, 0xfd, 
	db 0xa, 0x0, 0x0, 0x0, 0x7, 0x6, 0x12, 0x46, 0x16, 0x30

;top back face
	db 0x4, 0x0, 0x9, 0x50, 0x6, 0x3, 0x2, 0x7, 0x8, 0x0
;bottom front face
	db 0x4, 0x0, 0x9, 0x50, 0x8, 0x5, 0x4, 0x9, 0xa, 0x0
;bottom left face
	db 0x8, 0x0, 0x9, 0x50, 0x6, 0x8, 0x4, 0xa, 0xc, 0x0
;bottom back face
	db 0x4, 0x0, 0x9, 0x50, 0xa, 0x7, 0x6, 0xb, 0xe, 0x0

	db 0x0, 0x0, 0x84, 0xc, 0x80, 0x3e

DATA_002559:
	db 0x10, 0x80, 0x2, 0x4, 0x6, 0x7, 0x8, 0xa
	db 0xc, 0xd, 0xe, 0x10, 0x0, 0x0

DATA_002560:
	db 0x1, 0x0, 0x1f, 0x19, 0x32, 0x0
	db 0x1, 0x0, 0x1f, 0x19, 0xbc, 0x0
	db 0x1, 0x0, 0x25, 0x0, 0x4b, 0x0
	db 0x1, 0x0, 0x25, 0x0, 0xb5, 0x0
	db 0x1, 0x0, 0x1f, 0xf4, 0x44, 0x0
	db 0x1, 0x0, 0x1f, 0xf4, 0xbc, 0x0
	db 0x1, 0x0, 0x1c, 0x17, 0x33, 0x0
	db 0x1, 0x0, 0x20, 0x8, 0x42, 0x0
	db 0x1, 0x0, 0x22, 0xc, 0xbf, 0x0
	db 0x1, 0x0, 0xde, 0xc, 0x34, 0x0
	db 0x1, 0x0, 0x12, 0xf4, 0x19, 0x0
	db 0x1, 0x0, 0x1f, 0xe7, 0x19, 0x0
	db 0x1, 0x0, 0x12, 0xf4, 0xe7, 0x0
	db 0x1, 0x0, 0x1f, 0xe7, 0xe7, 0x0
	db 0x1, 0x0, 0x1f, 0xe7, 0x32, 0x0
	db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