You are not logged in.
Lost Password?


Register To Post



 Bottom   Previous Topic   Next Topic

#11
Re: Spectre VR Dev Thread
Posted on: 5/15 4:52
VB Gamer
Joined 2/16
35 Posts
Ok, so here's some detail on the shap resource found in Spectre VR

First of all there is a res edit template (TMPL resource) called shap which defines the structure of every shap resource used by spectre VR. The data is organized in words (2 bytes). The structure is as follows according to the template.

Number of verticies: ZCNT
**V**: LSTC
X (left & right) whole: DWRD
X (left & right) fraction: HWRD
Y (altitude) whole: DWRD
Y (altitude) fraction: HWRD
Z (distance from camera) whole: DWRD
Z (distance from camera) fraction: HWRD
**V**LSTE

Number of planes: ZCNT
**P**LSTC

Verticies in this plane: ZCNT
*V*P*: LSTC
Vertex number:DWRD
*V*P*:LSTE

Plane ColorDWRD
**P**:LSTE

Number of points (Top View): ZCNT
*P*T*:LSTC
X (left & right) whole: DWRD
X (left & right) fraction: HWRD
Y (altitude) whole: DWRD
Y (altitude) fraction: HWRD
Z (distance from camera) whole: DWRD
Z (distance from camera) fraction: HWRD
*P*T*:LSTE

Number of lines (Top View):ZCNT
*L*T*:LSTC
starting point:DWRD
ending point:DWRD
*L*T*LSTE:

Plane SidesDWRD

Thats really all you need to parse the shap resource. DWRD means "Decimal Word" HWRD means "Hexadecimal word" ZCNT, LSTC, and LSTE are used to loop a list of feilds, with ZCNT indicating the number of times the list is looped. In other words, if ZCNT had a value of 2 in the number of verticies secion at the top, it would look for LSTC in the template, then repeat though everything between LSTC and LSTE 3 times.

Here's an actual example. This is the "acid" shap. In the game its just a triangle on the gound that damages your tank when you run over it.

0002FFEE 00000000 0000FFEE 0000FFEE
00000000 00000012 00000012 00000000
0000FFF7 00000000 00020001 00020003
17750002 FFEE0000 00000000 FFEE0000
FFEE0000 00000000 00120000 00120000
00000000 FFF70000 00020001 00020002
00030003 00010000

Now lets chop it up into words

0002 FFEE 0000 0000 0000 FFEE 0000 FFEE
0000 0000 0000 0012 0000 0012 0000 0000
0000 FFF7 0000 0000 0002 0001 0002 0003
1775 0002 FFEE 0000 0000 0000 FFEE 0000
FFEE 0000 0000 0000 0012 0000 0012 0000
0000 0000 FFF7 0000 0002 0001 0002 0002
0003 0003 0001 0000

Next lets change the formatting a bit to divide up the relevent data. LSTC and LSTE data types don't actually contain any data, so if you're following along in the template, just use those as a reminder to go back through the template list.

0002

FFEE 0000 0000 0000 FFEE 0000
FFEE 0000 0000 0000 0012 0000
0012 0000 0000 0000 FFF7 0000

0000

0002

0001 0002 0003

1775

0002

FFEE 0000 0000 0000 FFEE 0000
FFEE 0000 0000 0000 0012 0000
0012 0000 0000 0000 FFF7 0000

0002

0001 0002
0002 0003
0003 0001

0000

That should be perfectly clear, but if it isn't lets add some labels

Number of Verticies: 0002

//Verticies
1) Xint:FFEE Xfrac:0000 Yint:0000 Yfrac:0000 Zint:FFEE Zfrac:0000
2) Xint:FFEE Xfrac:0000 Yint:0000 Yfrac:0000 Zint:0012 Zfrac:0000
3) Xint:0012 Xfrac:0000 Yint:0000 Yfrac:0000 Zint:FFF7 Zfrac:0000

Number of Planes: 0000

Verticies in this plane: 0002

Vertex Numbers in this plane: 0001 0002 0003

Plane Color:1775

Number of points (Top View) 0002

1) Xint:FFEE Xfrac:0000 Yint:0000 Yfrac:0000 Zint:FFEE Zfrac:0000
2) Xint:FFEE Xfrac:0000 Yint:0000 Yfrac:0000 Zint:0012 Zfrac:0000
3) Xint:0012 Xfrac:0000 Yint:0000 Yfrac:0000 Zint:FFF7 Zfrac:0000

Number of Lines: 0002
1) starting point: 0001 ending point: 0002
1) starting point: 0002 ending point: 0003
1) starting point: 0003 ending point: 0001

Plane Sides: 0000

Of course all of these figures are in hexidecimal. This is what res edit shows for the same data

Number of Verticies: 0002

//Verticies
1) Xint:-18 Xfrac:$0000 Yint:0 Yfrac:$0000 Zint:-18 Zfrac:$0000
2) Xint:-18 Xfrac:$0000 Yint:0 Yfrac:$0000 Zint:18 Zfrac:$0000
3) Xint: 18 Xfrac:$0000 Yint:0 Yfrac:$0000 Zint:-9 Zfrac:$0000

Number of Planes: 0

Verticies in this plane: 2

Vertex Numbers in this plane: 1, 2, 3

Plane Color: 6005

Number of points (Top View) 2

1) Xint:-18 Xfrac:$0000 Yint:0 Yfrac:$0000 Zint:-18 Zfrac:$0000
2) Xint:-18 Xfrac:$0000 Yint:0 Yfrac:$0000 Zint:18 Zfrac:$0000
3) Xint: 18 Xfrac:$0000 Yint:0 Yfrac:$0000 Zint:-9 Zfrac:$0000

Number of Lines: 0002
1) starting point: 1 ending point: 2
1) starting point: 2 ending point: 3
1) starting point: 3 ending point: 1

Plane Sides: 0
Top

 Top   Previous Topic   Next Topic


Register To Post