; ID: 791 ; Author: Noel - Banned ; Date: 2003-09-09 00:27:45 ; Title: "Automated" Map Loader ; Description: This is pretty self explanatory, but this will take a specified file that points to a bunch of pieces of your map, and load them all with specific FX settings. ;=======================================================================================================| ;loadEnvironMesh(map$,ct%) | ; parameters: | ; map$: a Text file containing the names of the map mesh(s) | ; ct%: the collision type you'd like to assign to loaded meshes | ;=======================================================================================================| ;requirement to use this: give me credit in your project(i'd do the same for you, trust me) ; ;limitation: BSP and B3D format only ; ;Made by Noel R. Cower ("Wildcard") Type environ Field mesh End Type Function loadEnvironMesh(map$,ct%) ;load a map, or a bunch of them ^_^ loadFile = ReadFile(map$) ;open the filestream While Not Eof(loadFile) ;do this while you're not at the end of the file newmesh$ = ReadLine(loadFile) Lower(Newmesh$) Trim(Newmesh$) If FileType(newmesh$) Then;load mesh m.environ = New environ ;create a new type for the next mesh If Right(Newmesh$,3) = "b3d" Then ;if this isn't a format i use for mapping, don't load it m\mesh = LoadMesh(newmesh$) ;load the new mesh to the new type ElseIf Right(Newmesh$,3) = "bsp" Then ;if this happens to be a .BSP we're loading, then we need to switch to LoadBSP m\mesh = LoadBSP(Newmesh$,0.05) ;just my personal preference when using the latter parameter.. EndIf EntityType m\mesh,ct% ;can't forget to set the collision type EntityPickMode m\mesh,2 ;set the pick mode in the case that you use a pickmode for shooting (or with an editor, like me) EndIf ;in the case that this isn't a map but a setting for the map, then use the setting on the last loaded mesh Select Newmesh$ ;fairly self explanatory Case "vertex colors" ;EntityFX m\mesh,2 sfx=sfx+2 Case "full bright" ;EntityFX m\mesh,1 sfx=sfx+1 Case "flat shaded" ;EntityFX m\mesh,4 sfx=sfx+4 Case "no fog" ;EntityFX m\mesh,8 sfx=sfx+8 Case "2 sided" ;EntityFX m\mesh,16 sfx=sfx+16 Case "force alpha" ;EntityFX m\mesh,32 sfx=sfx+32 Case "shine" EntityShininess m\mesh,Float(ReadLine(loadFile)) End Select EntityFX m\mesh,sfx Wend CloseFile(loadFile) ;no reason to have it open anymore End Function