heres the save() function to save FLE format.
heres the load function. if you want to modify this to load CLE terrains i will gladly throw it in as an option when loading work.
hope its not too sloppy :)
Function savework() ; File Requester ; (for a loader filerequester use:) ; sAFilter$ = "Blitz3D (*.B3D)" + Chr(0) + "*.B3D" + Chr(0) + "3D Studio (*.3DS)" + Chr(0) + "*.3DS" + Chr(0) + "DirectX7 (*.X)" + Chr(0) + "*.X" + Chr(0) + "All Files (*.*)" + Chr(0) + "*.*" + Chr(0) ; sFileName$ = DLLGetOpenFileName$("Please select a Mesh File...","",sAFilter$,OFN_HIDEREADONLY Or OFN_FILEMUSTEXIST) ; for more info about the blitzsys read the blitzsys docs from the original distribution ; sAFilter$ = "F.L.E project (*.FLE)" + Chr(0) + "*.FLE" + Chr(0) + "All Files (*.*)" + Chr(0) + "*.*" + Chr(0) sFileName3$ = DLLGetSaveFileName$("Save F.L.E progress (*.FLE) As...","",sAFilter$,OFN_HIDEREADONLY Or OFN_FILEMUSTEXIST ) ;Or OFN_OVERWRITEPROMPT) If sFileName3$<>"" ; actually we save 2 files, when you enter "test", it will be "test_1.b3d" and "test_2.b3d" ; so the Win-Api-built-in overwriting-prompt isn't useful anyway. If Upper$(Right$(sFileName3$,4))=".FLE" Then sFileName3$=Left$(sFileName3$,Len(sFileName3$)-4) FN$=sFileName3$+".FLE" sfile=WriteFile (fn$) WriteInt sfile, numlayers WriteInt sfile, lsegments For i=1 To numlayers WriteString sfile,use_tex$(i) WriteFloat sfile,layertexscale(i) Next For i=1 To numlayers s=GetSurface(layer(i),1) vc=CountVertices(s)-1 For v=0 To vc WriteFloat sfile, VertexX(s,v) WriteFloat sfile, VertexY(s,v) WriteFloat sfile, VertexZ(s,v) WriteFloat sfile, VertexRed(s,v) WriteFloat sfile, VertexGreen(s,v) WriteFloat sfile, VertexBlue(s,v) WriteFloat sfile, VertexAlpha(s,v) Next Next CloseFile sfile Else Return EndIf End Function
heres the load function. if you want to modify this to load CLE terrains i will gladly throw it in as an option when loading work.
Function loadwork(sf$="") ; File Requester ; (for a loader filerequester use:) ; sAFilter$ = "Blitz3D (*.B3D)" + Chr(0) + "*.B3D" + Chr(0) + "3D Studio (*.3DS)" + Chr(0) + "*.3DS" + Chr(0) + "DirectX7 (*.X)" + Chr(0) + "*.X" + Chr(0) + "All Files (*.*)" + Chr(0) + "*.*" + Chr(0) ; sFileName$ = DLLGetOpenFileName$("Please select a Mesh File...","",sAFilter$,OFN_HIDEREADONLY Or OFN_FILEMUSTEXIST) ; for more info about the blitzsys read the blitzsys docs from the original distribution ; If sf$="" Then sAFilter$ = "Load F.L.E (*.FLE)" + Chr(0) + "*.FLE" + Chr (0) + "All Files (*.*)" + Chr(0) + "*.*" + Chr(0) sFileName3$ = DLLGetopenFileName$("Load F.L.E project (*.FLE).","",sAFilter$,OFN_HIDEREADONLY Or OFN_FILEMUSTEXIST ) ;Or OFN_OVERWRITEPROMPT) Else sfilename3$=sf$ EndIf If sFileName3$<>"" FN$=sFileName3$ For i=1 To numlayers FreeTexture layertexture(i) FreeBrush layerbrush(i) ClearSurface GetSurface(layer(i),1) FreeEntity layer(i) Next If fn$<>"" Then If FileType(fn$)=1 Then ;sets get segment size checkf=ReadFile(fn$) numlayers=ReadInt(checkf) lsegments=ReadInt(checkf) ;RuntimeError numlayers+" "+lsegments For i=1 To numlayers use_tex$(i)=ReadString(checkf) loadscale#(i)=ReadFloat#(checkf) ;strip path ; so strip the path For i2= Len(use_tex$(i)) To 1 Step -1 If Mid$(use_tex$(i),i2,1)="" Then use_tex$(i)=Right$(use_tex$(i),Len(use_tex$(i))-i2) Exit EndIf Next Next CloseFile checkf EndIf EndIf
hope its not too sloppy :)