I've upgraded to XP and running the game in the Blitz IDE I get the MAV that lots of others have been getting.
It's caused by the game loading a B3D file that the game editor produces, using the public B3D code (that I believe is either in the archives or comes in a demo program from Mark) that is shown below.
If I use a B3D exported from 3DSMax then it all works just fine, so the B3D code must be the cause of this problem.
Now, it works on Win2000, BUT I can get win2000 to MAV also if I move the .B3D file from the SCR folder root into a subfolder, but by messing with the lines that write the texture paths I can sometimes get it to work, but I don't understand *WHY* it works or doesn't work - I think it's looking for the textures relative to the B3D, but creating an identical directory structure in a different place still causes a MAV.
So, I think the MAV is being caused by some difference between XP and 2000 that means when Blitz loads the B3D file, for some reason it can't locate the textures.
Anyone got any ideas how I can fix this by modifying the .B3D saving code shown below?
It's caused by the game loading a B3D file that the game editor produces, using the public B3D code (that I believe is either in the archives or comes in a demo program from Mark) that is shown below.
If I use a B3D exported from 3DSMax then it all works just fine, so the B3D code must be the cause of this problem.
Now, it works on Win2000, BUT I can get win2000 to MAV also if I move the .B3D file from the SCR folder root into a subfolder, but by messing with the lines that write the texture paths I can sometimes get it to work, but I don't understand *WHY* it works or doesn't work - I think it's looking for the textures relative to the B3D, but creating an identical directory structure in a different place still causes a MAV.
So, I think the MAV is being caused by some difference between XP and 2000 that means when Blitz loads the B3D file, for some reason it can't locate the textures.
Anyone got any ideas how I can fix this by modifying the .B3D saving code shown below?
Function FUNC_Export_Single_Mesh() FlushKeys ;save world data first FUNC_Save(True) ;create a single mesh singlemesh = CreateMesh() For s.TYPE_segment = Each TYPE_segment x# = EntityX#(s\mesh,1) y# = EntityY#(s\mesh,1) z# = EntityZ#(s\mesh,1) yaw# = EntityYaw#(s\mesh,1) PositionEntity s\mesh,0,0,0 RotateEntity s\mesh,0,0,0 RotateMesh s\mesh,0,yaw#,0 PositionMesh s\mesh,x#,y#,z# AddMesh s\mesh , singlemesh Next PositionEntity singlemesh,0,20,0 EntityColor singlemesh,255,0,0 ScaleMesh singlemesh,10,10,10 ;compile a list of used textures DebugLog "Compiling texture list..." numsurfs = CountSurfaces(singlemesh) DebugLog " "+numsurfs+" surfaces present in mesh." For i=1 To numsurfs c_surf(i)= GetSurface(singlemesh,i) c_brush(i)=GetSurfaceBrush( c_surf(i) ) c_tex(i)=GetBrushTexture( c_brush(i) ) c_tex_name$(i)=Lower$(TextureName$( c_tex(i))) ; Full (!) Texture Path curdir$=Lower$(CurrentDir$()) c_tex_name$(i)= Replace$(c_tex_name$(i),curdir$,"") ;<<<<<<<<<<<<<<<<<<< ;set texture path to the TEXTURES directory c_tex_name$(i)=Replace$(c_tex_name$(i),"track editor\segments","textures") DebugLog " Texture used : "+c_tex_name$(i) If c_tex_name$(i)="" Then DebugLog "Error: Surface No."+i+" has no Texture" If FileType(c_tex_name$(i))<>1 Then DebugLog "Warning: Surface No."+i+" uses nonexistant Texture ("+c_tex_name$(i)+")." Next FUNC_WriteBB3D( "exported_track.b3d",singlemesh) FreeEntity singlemesh ;clear and reload FUNC_Clear_World(False) FUNC_Load(True) End Function Function FUNC_WriteBB3D( f_name$,mesh ) file=WriteFile( f_name$ ) b3dSetFile( file ) b3dBeginChunk( "BB3D" ) b3dWriteInt( 1 ) ;version b3dBeginChunk( "TEXS" ) ; list all textures used by the mesh For i=1 To c_surfs b3dWriteString( c_tex_name$(i) ) ;texture file b3dWriteInt( 1 ) ;flags b3dWriteInt( 2 ) ;blend b3dWriteFloat( 0 ) ;x in tex 0 (hu?) b3dWriteFloat( 0 ) ;y in tex 0 b3dWriteFloat( 1 ) ;x scale 1 b3dWriteFloat( 1 ) ;y scale 1 b3dWriteFloat( 0 ) ;rotation 0 Next b3dEndChunk() ;end of TEXS chunk For i=1 To c_surfs b3dBeginChunk( "BRUS" ) ; describe all brushes used by the mesh b3dWriteInt( 1 ) ;number of textures per brush ; (eg 2 with lightmap) b3dWriteString( "brush"+(i-1) ) ;brushname b3dWriteFloat( 1 ) ;red b3dWriteFloat( 1 ) ;green b3dWriteFloat( 1 ) ;blue b3dWriteFloat( 1 ) ;alpha b3dWriteFloat( 0 ) ;shininess b3dWriteInt( 1 ) ;blendmode b3dWriteInt( 0 ) ;FX b3dWriteInt( i-1 ) ;used texture index ; b3dWriteInt( ? ) ;additional texture index (eg lightmap), but here we only use 1 (see above) b3dEndChunk() ;end of BRUS chunk Next b3dBeginChunk( "NODE" ) b3dWriteString( "entity_name_here!" ) b3dWriteFloat( 0 ) ;x_pos b3dWriteFloat( 0 ) ;y_pos b3dWriteFloat( 0 ) ;z_pos b3dWriteFloat( 1 ) ;x_scale b3dWriteFloat( 1 ) ;y_scale b3dWriteFloat( 1 ) ;z_scale b3dWriteFloat( 1 ) ;rot_w b3dWriteFloat( 0 ) ;rot_x b3dWriteFloat( 0 ) ;rot_y b3dWriteFloat( 0 ) ;rot_z FUNC_WriteMESH( mesh ) b3dEndChunk() ;end of NODE chunk b3dEndChunk() ;end of BB3D chunk CloseFile file End Function Function FUNC_WriteMESH( mesh ) n_surfs=CountSurfaces( mesh ) b3dBeginChunk( "MESH" ) b3dWriteInt( -1 ) ;no 'entity' brush -1 b3dBeginChunk( "VRTS" ) b3dWriteInt( 2 ) ;flags - 0=no normal/color b3dWriteInt( 2 ) ;number of tex_coord sets (eg: 2 with lightmap) b3dWriteInt( 2 ) ;coords per set (u,v,w?) 2 with uv, 3 with uvw For k=1 To n_surfs surf=GetSurface( mesh,k ) n_verts=CountVertices( surf )-1 For j=0 To n_verts b3dWriteFloat( VertexX( surf,j ) ) b3dWriteFloat( VertexY( surf,j ) ) b3dWriteFloat( VertexZ( surf,j ) ) b3dWriteFloat( VertexRed#( surf,j ) / 255.0 ) b3dWriteFloat( VertexGreen#( surf,j ) / 255.0 ) b3dWriteFloat( VertexBlue#( surf,j ) / 255.0 ) b3dWriteFloat( VertexAlpha#( surf,j ) ) b3dWriteFloat( VertexU#( surf,j,0 ) ) b3dWriteFloat( VertexV#( surf,j,0 ) ) ; b3dWriteFloat( VertexW#( surf,j,0 ) ) b3dWriteFloat( VertexU#( surf,j,1 ) ) ; lightmap uv b3dWriteFloat( VertexV#( surf,j,1 ) ) ; lightmap uv ; b3dWriteFloat( VertexW#( surf,j,1 ) ) Next Next b3dEndChunk() ;end of VRTS chunk first_vert=0 For k=1 To n_surfs surf=GetSurface( mesh,k ) n_tris=CountTriangles( surf )-1 b3dBeginChunk( "TRIS" ) b3dWriteInt( k-1 ) ;brush for these triangles (surf -1 !!!) For j=0 To n_tris b3dWriteInt( first_vert+TriangleVertex( surf,j,0 ) ) b3dWriteInt( first_vert+TriangleVertex( surf,j,1 ) ) b3dWriteInt( first_vert+TriangleVertex( surf,j,2 ) ) Next b3dEndChunk() ;end of TRIS chunk first_vert=first_vert+CountVertices( surf ) Next b3dEndChunk() ;end of MESH chunk End Function