
Well now I know how to reads vertices. Too bad faces aren't as easy...

Since this is the file research topic, I will post a snippet of code that may or may not serve a purpose to anyone who sees it.
Code: Select all
UPVH > MDPC Offset: 543000
-Offset-|-- MDPC PART DEF --|-- HEXADECIMAL ----|-- WORD ---|
0x56F00C| UNK_LIST_OFFSET | 80 00 00 00 | 80 |
0x56F014| UNK_LIST2_OFFSET | 80 28 00 00 | 2880 |
0x56F028| DDS_TEX_START | 00 60 08 00 | 86000 |
0x56F02C| PCMP_OFFSET | 00 50 08 00 | 85000 |
0x56F034| FACES_LENGTH | F8 6B 00 00 | 6BF8 |
0x56F038| FACES_OFFSET | 9C 53 00 00 | 539C |
0x56F040| UNK_HEADER01 | 80 53 00 00 | 5380 |
Vertex List begin: 57AF94
Vertex list end: 5F35D7
Vertex list length: 78644 (44 86 07 00)
Faces List begin: 57439C (9C 43 57 00)
Faces List end: 57AF93 (93 AF 57 00)
Faces List length: 6BF8 (F8 6B 00 00)
INTERIOR
Vertices Offset: 57AF94 (94 AF 57 00)
Vertices End: 58C453 (53 C4 58 00)
Vertices Length: 114C0 (C0 14 01 00)
Faces Offset: ???
Faces End: ???
BF94
Minimum Start: 57B000
Maximum Start: 5DCAD0
Minimum End: 57C67F
Maximum End: 5E1683
-- INTERIOR ---------------|--MAX.--|
57B000 - 585ED7 (MESH_0640)| 57C67F |
57B564 - 585DE7 (MESH_0646)| 57FCDF |
57BEC4 - 57FCDF (MESH_0634)| 584AEB |
57C2C0 - 57C67F (MESH_0657)| 5852E3 |
57C771 - 585E9B (MESH_0662)| 585DE7 |
57E0FC - 584AEB (MESH_2970)| 585E9B |
581DEC - 5852E3 (MESH_0669)| 585ED7 |
------------------------------------|
Real length: 57B000 - 58C453 (11454)
------------------------------------|
-- LOD MODEL --------------|--------|
58C454 - 59152F (MESH_0678)| 5914F3 |
58C9B8 - 592CDB (MESH_0668)| 59152F |
58D9A8 - 5914F3 (MESH_2972)| 59242F |
58E86C - 592B37 (MESH_0639)| 59273B |
58FA00 - 59273B (MESH_0645)| 592B37 |
58FAB4 - 59336B (MESH_0650)| 592CDB |
591698 - 59242F (MESH_0683)| 59336B |
-- REAR CLIP --------------|--------|
595FF4 - 5A0CAF (MESH_0638)| 59C0BF |
596FA8 - 59F17F (MESH_0666)| 59F17F |
598A60 - 5A1597 (MESH_0675)| 5A0CAF |
5994EC - 59C0BF (MESH_0643)| 5A10AB |
5A0CEC - 5A10AB (MESH_2971)| 5A1597 |
-- TRUNK ------------------|--------|
5A92FC - 5A9DC3 (MESH_0667)| 5A9DC3 |
5A9680 - 5A9EB3 (MESH_0677)| 5A9EB3 |
5A9EF0 - 5AA4CB (MESH_0644)| 5AA4CB |
-- BUMPER -----------------|--------|
5AAB20 - 5ABFFB (MESH_0676)| 5ABFFB |
-- RIGHT DOOR -------------|--------|
5AEE64 - 5B1B9F (MESH_0674)| 5B082B |
5AEF90 - 5B082B (MESH_0665)| 5B0E07 |
5B0868 - 5B0E07 (MESH_0637)| 5B1203 |
5B0E44 - 5B1203 (MESH_0649)| 5B1B9F |
-- LEFT DOOR --------------|--------|
5B4198 - 5B6FFF (MESH_0673)| 5B62DF |
5B42C4 - 5B62DF (MESH_0664)| 5B6717 |
5B613C - 5B6717 (MESH_0636)| 5B6AD7 |
5B6754 - 5B6AD7 (MESH_0648)| 5B6FFF |
-- ENGINE BAY -------------|--------|
5B9670 - 5BF4E3 (MESH_0635)| 5BC54F |
5BC118 - 5BC54F (MESH_0641)| 5BF4E3 |
-- FRONT CLIP -------------|--------|
5C55B0 - 5C758F (MESH_0672)| 5C758F |
5C9354 - 5CB3AB (MESH_0671)| 5CB3AB |
5CCFCC - 5D22C3 (MESH_0670)| 5D22C3 |
-- HOOD -------------------|--------|
5D521C - 5D7A6B (MESH_0663)| 5D7A6B |
5D7A6C - 5D946F (MESH_0642)| 5D946F |
-- STEERING WHEEL ---------|--------|
5DB270 - 5DC1E7 (MESH_0647)| 5DC1E7 |
-- WHEEL MODEL ------------|--------|
5DC788 - 5E1683 (3D WHEEL) | 5DD33F |
5DCAD0 - 5DD33F (WHL TREAD)| 5E1683 |
---------------------------|--------|
Code: Select all
clearlistener()
if (heapSize < 200000) do (
heapSize = 2000000
)
--vF = GetOpenFileName caption:"Choose VVS File:" \
--types:"DRIV3R Vehicles (*.VVS)|*.VVS|"
vF = "C:\Program Files (x86)\Atari\DRIV3R\Vehicles\miami.vvs"
f = fopen vF "rb"
readFaces = true
readVerts = true
face_array = #()
if readFaces == true do (
fseek f 5718940 #seek_set
format "Faces begin: 0x%\n" ((bit.intAsHex(ftell f)) as string)
--format "%\n" "---------------------------------"
for k = 1 to 304 do (
--format "%\n" ("Indice Idx: "+k as string)
i0 = ReadShort f #unsigned+1
i1 = ReadShort f #unsigned+1
i2 = ReadShort f #unsigned+1
append Face_array[i0,i1,i2]
--format "indicies: [%,%,%]\n"\
--((i0+1) as string)\
--((i1+1) as string)\
--((i2+1) as string)
--format "%\n" ("---------------------------------")
windows.processPostedMessages()
)
format "Faces end: 0x%\n" ((bit.intAsHex(ftell f)) as string)
)
if readVerts == true do (
fseek f 5750468 #seek_set
vx = 0.0
vy = 0.0
vz = 0.0
nx = 0.0
ny = 0.0
nz = 0.0
tu = 0.0
tv = 0.0
vert_array = #()
norm_array = #()
uv_array = #()
debugStuff = 0
format "Vertices Begin: 0x%\n" ((bit.intAsHex(ftell f)) as string)
for i = 1 to 6910 do (
if debugStuff == 1 do format "Current Position: 0x%\n" ((bit.intAsHex(ftell f)) as string)
vx = ReadFloat f
vy = ReadFloat f
vz = ReadFloat f
nx = ReadFloat f
ny = ReadFloat f
nz = ReadFloat f
tu = ReadFloat f
tv = ReadFloat f
junk1 = ReadLong f #unsigned
junk2 = ReadLong f #unsigned
junk3 = ReadLong f #unsigned
junk4 = ReadLong f #unsigned
junk5 = ReadLong f #unsigned
junk6 = ReadLong f #unsigned
junk7 = ReadLong f #unsigned
--The format is vx, vy, vz, nx, ny, nz, tu, tv, junk1, junk2, junk3, junk4, junk5, junk6, junk7...
append vert_array[vx*100,-vz*100,vy*100]
append norm_array[nx,ny,nz]
append uv_array[tu,tv,0]
if debugStuff == 1 do (
format "\nvx: %\nvy:\t%\nvz:\t%\nnx:\t%\nny:\t%\nnz:\t%\ntu:\t%\ntv:\t%"\
(vx as string)\
(vy as string)\
(vz as string)\
(nx as string)\
(ny as string)\
(nz as string)\
(tu as string)\
(tu as string)
format "\n----------------------------------------------------------------------\n"
)
windows.processPostedMessages()
)
format "Vertices End: 0x%\n" ((bit.intAsHex(ftell f)) as string)
msh = mesh vertices:vert_array faces:face_array
setNumTVerts msh uv_array.count
for i = 1 to uv_array.count do (setTVert msh i uv_array[i])
buildTVFaces msh false
for i = 1 to face_array.count do (setTVFace msh i face_array[i])
select msh
)
fclose f





























