Path Maker

Blitz3D Forums/Blitz3D Programming/Path Maker

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

here's the main file:

 
Include "World Loader.bb"

Graphics3D WB3D_GadgetWidth(WB3D_DeskTop()),WB3D_GadgetHeight(WB3D_DeskTop()),0,3
SetBuffer BackBuffer()
AppTitle "PathMaker Version " + VersionLong
AmbientLight 255,255,255

main_W = WB3D_InitializeGUI(SystemProperty("AppHWND"),0,0,WB3D_GadgetWidth(WB3D_DeskTop()),WB3D_GadgetHeight(WB3D_DeskTop()))
WB3D_MaximizeWindow(main_W)

Global wpindex = 0,mesh,pindex = 0

Dim waypoint(999,999)

Global cam = CreateCamera()
light = CreateLight(cam)
PositionEntity light,0,100,0
RotateEntity light,90,0,0
LightRange light,1000000
PositionEntity cam,0,100,0
RotateEntity cam,90,0,0


.l
Global auto = WB3D_Notify("PathMaker","Use Auto Pivot Creation?",MB_YESNO)
If auto = 6
	auto = 1
	WB3D_Notify("PathMaker","Click the mouse to activate/deactivate",0)
	time = WB3D_CreateWindow("Millisecs between pivots",GraphicsWidth()/2,GraphicsHeight()/2,200,100,main_W,WS_VISIBLE)
	edit = WB3D_CreateEditField("300",50,0,50,30,time,0,0)
	ok = WB3D_CreateButton("Apply",50,40,70,30,time,0)
EndIf
If auto = 7 
	auto = 0
	If time <> 0 Then WB3D_FreeGadget(time)
EndIf
Cls

Global meshpath$ = WB3D_OpenFileRequest("Open File To Make Path(s) on","","x"+Chr(0)+"*.x"+Chr(0)+"3ds"+Chr(0)+"*.3ds"+Chr(0)+"b3d"+Chr(0)+"*.b3d"+Chr(0)+"Blitz World File"+Chr(0)+"*.wld"+Chr(0),"")
If meshpath = ""
	Goto l
Else
	offset=Instr(meshpath,".")
	If offset > 0 Then ext$ = Mid(meshpath,offset+1,3)
	WB3D_Notify("",ext,0)
	Select ext
		Case "x"
			ImportMesh()
		Case "3ds"
			ImportMesh()
		Case "b3d"
			ImportMesh()
		Case "wld"
			w = LoadWorld(meshpath)
			For mo.MapObjs = Each MapObjs
				EntityPickMode mo\Obj,2
				PositionEntity cam,EntityX(mo\Obj),100,EntityZ(mo\Obj)
				;WB3D_Notify("",mo\Obj,0)
			Next
			If w <> 1 Then WB3D_Notify("PathMaker","Error " + w,MB_ICONERROR)
	End Select
	

EndIf



autotimer = MilliSecs()
autoset = 0
timei = 300
Repeat	
	If time <> 0
		event = WB3D_WaitEvent()
		If event = WB3D_EVENT_GADGET	
			If WB3D_EventSource() = ok
				timei = WB3D_GetGadgetText(edit)
			EndIf
		EndIf
	EndIf
	
	If KeyHit(25) Or MouseHit(3)
		pindex = pindex+1
		WB3D_Notify("PathMaker","New Path Created",0)
	EndIf
	

	If MouseX() < 20
		TranslateEntity cam,-3-MouseZ(),0,0
	ElseIf MouseX() > GraphicsWidth()-20
		TranslateEntity cam,3+MouseZ(),0,0
	EndIf
	
	If MouseY() < 20
		TranslateEntity cam,0,0,3+MouseZ()
	ElseIf MouseY() > GraphicsHeight()-20
		TranslateEntity cam,0,0,-3-MouseZ()
	EndIf
	
	If KeyDown(200)
		TranslateEntity cam,0,-3-MouseZ(),0
	ElseIf KeyDown(208)
		TranslateEntity cam,0,3+MouseZ(),0
	EndIf
	
	If MouseHit(1) 
		If auto = 0
			CreateWaypoint()
		ElseIf auto = 1
			If autoset = 1
				autoset = 0
			ElseIf autoset = 0
				autoset = 1
			EndIf
		EndIf
	EndIf
	
	If auto = 1 And MilliSecs() >= autotimer +timei And autoset = 1
		autotimer = MilliSecs()
		CreateWaypoint()
	EndIf
	
	
	If KeyHit(28)
		export = WB3D_Notify("PathMaker","Export?",4)
		If export = 6;y
			file$ = WB3D_SaveFileRequest("Export","C:","PathMaker file(.pathmaker)"+Chr(0)+"*.pathmaker"+Chr(0),"new file.pathmaker")
			If file <> ""
				If FileType(file) = 1
					ov = WB3D_Notify("Export","Overwrite?",4)
					If ov = 6
						Export(file)
						WB3D_Notify("PathMaker","Exported",0)
					ElseIf ov = 7
						WB3D_Notify("PathMaker","Export Canceled",0)
					EndIf
				Else
					Export(file)
					WB3D_Notify("PathMaker","Exported",0)
				EndIf
			EndIf
		ElseIf export = 7;n
			WB3D_Notify("PathMaker","Export Canceled",0)
		EndIf
	EndIf
	
	
	If KeyHit(49)
		For pathindex = 0 To 999
			For waypointindex = 0 To 999
				FreeEntity(waypoint(pathindex,waypointindex))
			Next
			FreeEntity mesh
			wpindex = 0
			pindex = 0
			Goto l
		Next
	EndIf
	
	
	If KeyHit(83) Or MouseHit(2)
		If wpindex > 0
			FreeEntity waypoint(pindex,wpindex-1)
			waypoint(pindex,wpindex-1) = 0
			wpindex = wpindex-1
		EndIf
	EndIf
	
	
	RenderWorld()
	Text 0,0,"Waypoints: " +wpindex+"/999"
	Text 0,12,"Paths: " +pindex+"/999"
	Flip
	Delay 5
	If KeyHit(1) Then Exit
Forever
WB3D_EndGUI()
End

Function ImportMesh()
	mesh = LoadMesh(meshpath)
	RotateEntity mesh,0,90,0
	EntityPickMode mesh,2
End Function

Function CreateWaypoint()
	If pindex < 999 And wpindex < 999
		CameraPick(cam,MouseX(),MouseY())
		waypoint(pindex,wpindex) = CreateSphere()
		PositionEntity waypoint(pindex,wpindex),PickedX(),PickedY(),PickedZ()
		wpindex = wpindex+1
	EndIf
End Function
Function Export(path$)
	efile = WriteFile(path)
	WriteString(efile,meshpath)
	WriteString(efile,VersionLong)
	For indexp = 0 To pindex
		For indexwp = 0 To 999
			If waypoint(indexp,indexwp) <> 0
				WriteInt(efile,indexp)
				WriteFloat(efile,EntityX(waypoint(indexp,indexwp),1))
				WriteFloat(efile,EntityY(waypoint(indexp,indexwp),1))
				WriteFloat(efile,EntityZ(waypoint(indexp,indexwp),1))
			Else
				Exit
			EndIf
		Next
	Next
End Function


here's the world loader:

;------------------------------------------------------------------------------------------------------
;------------------------------------------------------------------------------------------------------
;								-----World Loader Include-----
;										By Luke Hoschke
;
;					Include this program with your game to load .wld files
;							<<<<Modify code to fit game, Free to use>>>>
;------------------------------------------------------------------------------------------------------
;------------------------------------------------------------------------------------------------------

Include "World Loader User Changes.bb"

;--------------------------------
;-----------<<Types>>------------
;--------------------------------

;TempObjs are used to load Meshes for object in load
;Using this stops files from being loaded a second time, wasting time
Type BWA_TempObjs
	Field Obj		;The Mesh
	Field Typ		;See 'Is_WorldObject_Mesh()'
	Field ID		;ID used to link type
End Type

;----------------------------------
;-----------<<Functions>>----------
;----------------------------------


Function o_________Worlds_________()
End Function





Function FreeWorld()
;------Free any temp objects (just to be sure)-----
For BWA_TempObj.BWA_TempObjs=Each BWA_TempObjs
	If BWA_TempObj\Typ=0 Then
	FreeEntity BWA_TempObj\Obj
	ElseIf BWA_TempObj\Typ=3 Then
	;FreeTexture BWA_TempObj\Obj
	End If
	Delete BWA_TempObj
Next

For MapObj.MapObjs=Each MapObjs
FreeEntity MapObj\Obj
Delete MapObj
Next


End Function

Function LoadWorld(Filename$,ObjectsPath$="")

;---Returns---
;1	=Loaded map
;-1	=File error
;-2	=Map error
;-3	=Need newer include

OldDir$=CurrentDir$()
ChangeDir BWA_GetFilePath$(Filename$)


CounterID=1;Reset set Counter ID (Used for meshes)

;------Free any temp objects (just to be sure)-----
For BWA_TempObj.BWA_TempObjs=Each BWA_TempObjs
	If BWA_TempObj\Typ=0 Then
	FreeEntity BWA_TempObj\Obj
	ElseIf BWA_TempObj\Typ=3 Then
	;FreeTexture BWA_TempObj\Obj
	End If
	Delete BWA_TempObj
Next


File=BWA_LoadFileToBank(BWA_GetFileName$(Filename$));Load File

BWA_DecompressBank(File)



If File=0 Then;Not opened
RuntimeError "Not found"
ChangeDir(OldDir$):Return -1;File not found
End If

;---Cheak File---
File_Type$=BWA_Bank_ReadString$(File)
File_version=BWA_Bank_ReadInt(File);version


If File_Type$<>"BWA" Then ChangeDir(OldDir$):Return -1;Not a 'Blitz World Assembler' Map


If File_version>012 Then ChangeDir(OldDir$):Return -3;Not a compatable map




;---Read file---
While BWA_Bank_Eof(File)=0;Not ended

Do=BWA_Bank_ReadByte(File);Get command

Select Do;What to do

	Case 0;>Is Object?
	
		MapObj.MapObjs=New MapObjs
		MapObj\Typ=1
		ID=BWA_Bank_ReadShort(File)
		Found=0
		For BWA_TempObj.BWA_TempObjs=Each BWA_TempObjs
			If Found=0 Then;Only one
				If BWA_TempObj\ID=ID Then;Right ID
					MapObj\Obj=CopyEntity(BWA_TempObj\Obj);Copy Mesh
					Found=1;Yes, found mesh
			End If:End If
		Next
		If Found=0 Then ChangeDir(OldDir$):Return -2;Mesh not found (Error!)
		
		BWA_LoadWorld_Position(File,MapObj,1)
		BWA_LoadWorld_Properties(File,MapObj,0)
		
	Case 2;>Is Shape?
		
		MapObj.MapObjs=New MapObjs
		MapObj\Typ=2
		SubTyp=BWA_Bank_ReadByte(File)
		
		If SubTyp=0 Then;-Cube
			MapObj\Obj=CreateCube()
		ElseIf SubTyp=1 Then;-Sphere
			MapObj\Obj=CreateSphere()
		ElseIf SubTyp=2 Then;-Cylinder (solid)
			MapObj\Obj=CreateCylinder(8,1)
		ElseIf SubTyp=3 Then;-Cylinder (hollow)
			MapObj\Obj=CreateCylinder(8,0)
		ElseIf SubTyp=4 Then;-Cone
			MapObj\Obj=CreateCone()
		ElseIf SubTyp=5 Then;-Plane
			MapObj\Obj=CreatePlane(4)
		ElseIf SubTyp=6 Then;-Rectangle (One sided)
			MapObj\Obj=BWA_CreateRectangle(0)
		ElseIf SubTyp=7 Then;-Rectangle (Double sided)
			MapObj\Obj=BWA_CreateRectangle(1)
		End If
		
		BWA_LoadWorld_Position(File,MapObj,1)
		BWA_LoadWorld_Properties(File,MapObj,0)
		
		
	Case 4;>Is Terrain?
		
		MapObj.MapObjs=New MapObjs
		MapObj\Typ=4

		MapObj\Obj=LoadTerrain(ObjectsPath$+BWA_Bank_ReadString(File))
		
		If MapObj\Obj=0 Then ChangeDir(OldDir$):Return -2;Mesh not found (Error!)
		
		TerrainShading MapObj\Obj,1
		
		BWA_LoadWorld_Position(File,MapObj,1)
		BWA_LoadWorld_Properties(File,MapObj,0)
		
	Case 5;>Is Light?
		
		MapObj.MapObjs=New MapObjs
		MapObj\Typ=5
		SubTyp=BWA_Bank_ReadByte(File)
			
		If SubTyp=1 Then;-Directional Light
			MapObj\Obj=CreateLight(1)
		ElseIf SubTyp=2 Then;-Point Light
			MapObj\Obj=CreateLight(2)
		ElseIf SubTyp=3 Then;-Spot Light
			MapObj\Obj=CreateLight(3)
		End If
		
		BWA_LoadWorld_Position(File,MapObj,0)
		BWA_LoadWorld_Properties(File,MapObj,1)
		
		;Range, and ConeAngles to came...
		
	Case 6;>Is Pivot?
		
		MapObj.MapObjs=New MapObjs
		MapObj\Typ=6
		
		MapObj\Obj=CreatePivot()
		
		BWA_LoadWorld_Position(File,MapObj,0)
		BWA_LoadWorld_Properties(File,MapObj,-1)
		
	Case 100+1;>Is command, load mesh?
	
		MeshName$=BWA_Bank_ReadString$(File);Find File
		BWA_TempObj.BWA_TempObjs=New BWA_TempObjs
		BWA_TempObj\Obj=LoadMesh(ObjectsPath$+MeshName$)
		If BWA_TempObj\Obj=0 Then;Not loaded
		Delete BWA_TempObj
		ChangeDir(OldDir$):Return -1;File not found (Error!)
		End If
		BWA_TempObj\ID=CounterID
		CounterID=CounterID+1






End Select


Wend


FreeBank File;Close File

;------Free any temp objects-----
For BWA_TempObj.BWA_TempObjs=Each BWA_TempObjs
	If BWA_TempObj\Typ=0 Then
	FreeEntity BWA_TempObj\Obj
	ElseIf BWA_TempObj\Typ=3 Then
	;FreeTexture BWA_TempObj\Obj
	End If
	Delete BWA_TempObj
Next

ChangeDir(OldDir$):Return 1;No errors


End Function


Function Is_WorldObject_Mesh%(MapObj.MapObjs)
If MapObj\Typ=0 Then Return 1;Static Object
If MapObj\Typ=1 Then Return 1;Animated Object
If MapObj\Typ=2 Then Return 1;Shape Object
If MapObj\Typ=3 Then Return 0;Not yet Supported
If MapObj\Typ=4 Then Return 1;Terrain Object
If MapObj\Typ=5 Then Return 0;Light Object
If MapObj\Typ=6 Then Return 0;Pivot Object
End Function


Function BWA_LoadWorld_Properties(File,TempMapObj.MapObjs,TempTyp)

BWA_Bank_ReadByte(File);Room for upgrades

Flags=BWA_Bank_ReadByte(File)

;--Get Flags
For adds=0 To 6
If BWA_Get_Flag(Flags,adds) Then BWA_Set_Options(TempMapObj.MapObjs,adds+1)
Next

;--Get Data
If BWA_Get_Flag(Flags,7) Then
BWA_Set_Data(TempMapObj.MapObjs,BWA_Bank_ReadString(File))
End If


If TempTyp=0 Then


	Flags=BWA_Bank_ReadByte(File)
	
	If BWA_Get_Flag(Flags,0) Then
		EntityFX TempMapObj\Obj,BWA_Bank_ReadByte(File)
	End If
	If BWA_Get_Flag(Flags,1) Then
		EntityColor TempMapObj\Obj,BWA_Bank_ReadByte(File),BWA_Bank_ReadByte(File),BWA_Bank_ReadByte(File)
	End If
	If BWA_Get_Flag(Flags,2) Then
		EntityAlpha TempMapObj\Obj,BWA_Bank_ReadFloat(File)
		EntityBlend TempMapObj\Obj,BWA_Bank_ReadByte(File)
		EntityOrder TempMapObj\Obj,BWA_Bank_ReadByte(File)-128
		EntityShininess TempMapObj\Obj,BWA_Bank_ReadFloat(File)
	End If
	If BWA_Get_Flag(Flags,3) Then
		EntityAutoFade TempMapObj\Obj,BWA_Bank_ReadFloat(File),BWA_Bank_ReadFloat(File)
	End If
	If BWA_Get_Flag(Flags,4) Then
		EntityPickMode TempMapObj\Obj,BWA_Bank_ReadByte(File),BWA_Bank_ReadByte(File)
	End If
	
	BWA_Bank_ReadByte(File);Room for upgrades
	
	
	;-------Collision---------
	TempNum=BWA_Bank_ReadByte(File)
	If BWA_GET_Flag(TempNum,0) Then
	
	EntityType TempMapObj\Obj,BWA_Bank_ReadByte(File)

	
	If BWA_GET_Flag(TempNum,1) Then
		X#=BWA_Bank_ReadByte(File)
		Y#=BWA_Bank_ReadByte(File)
		Z#=BWA_Bank_ReadByte(File)
		W#=BWA_Bank_ReadByte(File)
		H#=BWA_Bank_ReadByte(File)
		D#=BWA_Bank_ReadByte(File)
		If W#<>H# Then
			EntityRadius TempMapObj\Obj,W#,H#
		Else
			EntityRadius TempMapObj\Obj,W#
		End If
		
		EntityBox TempMapObj\Obj,X#,Y#,Z#,W#,H#,D#
		
	End If
	
	
	End If
	
	
	BWA_LoadWorld_Texture(File,TempMapObj)

ElseIf TempTyp=1 Then;Light
	

	LightColor TempMapObj\Obj,BWA_Bank_ReadByte(File),BWA_Bank_ReadByte(File),BWA_Bank_ReadByte(File)
	
	LightConeAngles TempMapObj\Obj,BWA_Bank_ReadFloat(File),BWA_Bank_ReadFloat(File);Not done yet
	
	LightRange TempMapObj\Obj,BWA_Bank_ReadFloat(File);Not done yet

	
	BWA_Bank_ReadByte(File);Room for upgrades
	
End If



End Function


Function BWA_LoadWorld_Position(File,TempMapObj.MapObjs,Scale=0)
TempX#=BWA_Bank_ReadFloat(File)
TempY#=BWA_Bank_ReadFloat(File)
TempZ#=BWA_Bank_ReadFloat(File)
TempRX#=BWA_Bank_ReadFloat(File)
TempRY#=BWA_Bank_ReadFloat(File)
TempRZ#=BWA_Bank_ReadFloat(File)
PositionEntity TempMapObj\Obj,TempX#,TempY#,TempZ#,1
RotateEntity TempMapObj\Obj,TempRX#,TempRY#,TempRZ#,1

If Scale=1 Then
TempScaleX#=BWA_Bank_ReadFloat(File)
TempScaleY#=BWA_Bank_ReadFloat(File)
TempScaleZ#=BWA_Bank_ReadFloat(File)
ScaleEntity TempMapObj\Obj,TempScaleX#,TempScaleY#,TempScaleZ#,1
End If

End Function


Function BWA_LoadWorld_Texture(File,TempMapObj.MapObjs)

NumberLayers=BWA_Bank_ReadByte(File)

If NumberLayers<>0 Then

TargetLayer=-1
For Layer=0 To NumberLayers-1;Cheak Textures
If TargetLayer=-1 Then TargetLayer=BWA_Bank_ReadByte(File)
If Layer=TargetLayer Then
TargetLayer=-1

Name$=BWA_Bank_ReadString$(File)

ClearTextureFilters
TextureFilter "",BWA_Bank_ReadByte(File)
Tex=LoadTexture(Name$)

If Tex<>0 Then

ScaleTexture Tex,BWA_Bank_ReadByte(File),BWA_Bank_ReadByte(File)
EntityTexture TempMapObj\Obj,Tex
FreeTexture Tex
End If


End If
Next

End If




End Function




;Has anyone got a beter way, faster? If so, please post it!
Function BWA_Get_Flag(Number,Flag=1)
Temp=Number
TempNum=128
While TempNum=>1
If Temp-TempNum=>0 Then
If TempNum=2^Flag Then Return 1
Temp=Temp-TempNum
Else
End If
TempNum=TempNum/2
Wend
Return 0
End Function






Function BWA_CreateRectangle(Double,parent=0)
Mesh=CreateMesh(parent)
Surface=CreateSurface(Mesh)

VertexTL=AddVertex (Surface	,-0.5	,+0.5	,0	,0,0)
VertexTR=AddVertex (Surface	,+0.5	,+0.5	,0	,1,0)
VertexBL=AddVertex (Surface	,-0.5	,-0.5	,0	,0,1)
VertexBR=AddVertex (Surface	,+0.5	,-0.5	,0	,1,1)

;-----
;|1/ |
;|/ 2|
;-----
Triangle1=AddTriangle(Surface,VertexTL,VertexTR,VertexBL)
Triangle2=AddTriangle(Surface,VertexTR,VertexBR,VertexBL)

If Double Then

Triangle1=AddTriangle(Surface,VertexBL,VertexTR,VertexTL)
Triangle2=AddTriangle(Surface,VertexBL,VertexBR,VertexTR)

End If

UpdateNormals mesh

Return Mesh

End Function



;-----
;	Bank Functions
;-----
Function o_________Banks_________()
End Function



Function BWA_LoadFileToBank(p_filename$)
File=OpenFile(p_filename$)
If File=0 Then Return 0
tmpbank=CreateBank(FileSize(p_filename$)+4)
PokeInt tmpbank,0,0;Pos
n=4;sci
While Not Eof(file) 
PokeByte tmpbank,n,ReadByte(File)
n=n+1
Wend 
CloseFile File
Return tmpbank
End Function




Function BWA_Bank_ReadByte(p_bank)
If PeekInt(p_bank,0)+4>BankSize(p_bank)-1 Then Return 0;Cheak
Tmp=PeekByte(p_bank,PeekInt(p_bank,0)+4)
PokeInt p_bank,0,PeekInt(p_bank,0)+1
Return Tmp
End Function

Function BWA_Bank_ReadShort(p_bank)
If PeekInt(p_bank,0)+4>BankSize(p_bank)-1 Then Return 0;Cheak
Tmp=PeekShort(p_bank,PeekInt(p_bank,0)+4)
PokeInt p_bank,0,PeekInt(p_bank,0)+2
Return Tmp
End Function

Function BWA_Bank_ReadInt(p_bank)
If PeekInt(p_bank,0)+4>BankSize(p_bank)-1 Then Return 0;Cheak
Tmp=PeekInt(p_bank,PeekInt(p_bank,0)+4)
PokeInt p_bank,0,PeekInt(p_bank,0)+4
Return Tmp
End Function

Function BWA_Bank_ReadFloat#(p_bank)
If PeekInt(p_bank,0)+4>BankSize(p_bank)-1 Then Return 0;Cheak
Tmp#=PeekFloat(p_bank,PeekInt(p_bank,0)+4)
PokeInt p_bank,0,PeekInt(p_bank,0)+4
Return Tmp#
End Function

Function BWA_Bank_ReadString$(p_bank)

If PeekInt(p_bank,0)+4>BankSize(p_bank)-1 Then Return "";Cheak
TmpStr$=""
Count=PeekInt(p_bank,PeekInt(p_bank,0)+4)
PokeInt p_bank,0,PeekInt(p_bank,0)+4
For adds=1 To Count
If PeekInt(p_bank,0)+4>BankSize(p_bank)-1 Then Return "";Cheak
TmpStr$=TmpStr$+Chr(PeekByte(p_bank,PeekInt(p_bank,0)+4))
PokeInt p_bank,0,PeekInt(p_bank,0)+1
Next

Return TmpStr$
End Function


Function BWA_Bank_Eof%(p_bank)
	If PeekInt(p_bank,0)+4>BankSize(p_bank)-1 Then Return 1
End Function


Function BWA_PeekString$(p_Bank,p_offset,p_Count=1)
	TmpString$=""
	For TmpOffset=p_offset To p_offset+(p_Count-1)
		TmpString$=TmpString$+Chr$(PeekByte(p_Bank,Tmpoffset))
	Next
	Return TmpString$
End Function

Function BWA_PokeString$(p_Bank,p_offset,p_string$)
	For TmpOffset=p_offset To p_offset+(Len(p_string)-1)
		PokeByte p_Bank,Tmpoffset,Asc(Mid(p_string,TmpOffset+1,1))
	Next
End Function


Function BWA_MakeBankFromString$(p_string$)
	TmpBank=CreateBank(Len(p_string$))
	For TmpOffset=0 To (Len(p_string)-1)
		PokeByte p_Bank,Tmpoffset,Asc(Mid(p_string,TmpOffset+1,1))
	Next
	Return TmpBank
End Function

Function BWA_MakeBankFromXor(BankCode,BankMask)
	TmpBank=CreateBank(BankSize(BankCode))
	n=-1
	maskoffset=-1
	While n<BankSize(BankCode)-1
		n=n+1
		maskoffset=maskoffset+1
		While maskoffset>BankSize(BankMask)-1
			maskoffset=maskoffset-(BankSize(BankMask)-1)
		Wend
		PokeByte TmpBank,n,PeekByte(BankCode,n) Xor PeekByte(BankMask,maskoffset)
	Wend
	Return TmpBank
End Function

Function BWA_Bank_Xor(BankCode,BankMask)
	n=-1
	maskoffset=-1
	While n<BankSize(BankCode)-1
		n=n+1
		maskoffset=maskoffset+1
		While maskoffset>BankSize(BankMask)-1
			maskoffset=maskoffset-(BankSize(BankMask)-1)
		Wend
		PokeByte BankCode,n,PeekByte(BankCode,n) Xor PeekByte(BankMask,maskoffset)
	Wend
End Function



Function o_________Misc_________()
End Function

Function BWA_GetFileName$(path$);From 'AlphaGUI'
For a = Len(path$) To 1 Step -1 
byte$ = Mid(path$,a,1) 
If byte$="" Or byte$="/" Then
Return Right(path$,Len(path$)-a) 
EndIf
Next
Return path$
End Function

Function BWA_GetFilePath$(path$)
For a = Len(path$) To 1 Step -1 
byte$ = Mid(path$,a,1) 
If byte$="" Or byte$="/" Then
Return Left(path$,a) 
EndIf 
Next
Return path$
End Function


and the world loader user changes:

;------------------------------------------------------------------------------------------------------
;------------------------------------------------------------------------------------------------------
;								-----World Loader Include-----
;										By Luke Hoschke
;
;											
;------------------------------------------------------------------------------------------------------
;------------------------------------------------------------------------------------------------------



;--------------------------------
;-----------<<Types>>------------
;--------------------------------

Type MapObjs
	Field Obj			;Mesh
	Field ID			;ID
	Field Typ			;Typ (0-Stat Mesh, ...)
	Field Name$			;User data (Change name to anything (eg: Says$) but change it in "Function Set_Data" as well)
	;...More stuff goes here
	Field ColourChange	;Delete Me!!!
	Field ColourTimer#	;Delete Me Too!
End Type

;----------------------------------
;-----------<<Functions>>----------
;----------------------------------



Function BWA_On_MapObj_Free()


End Function

Function BWA_DecompressBank(Bank)
	;<<--Map decrypt or decompress functions goes here-->>
	
	;---This decrypter is incomplete!---
	
	
	If 0 Then;1 to decrypt map
		
		;Making bitmasks from strings is unsafe because it shows up it the exe
		
		Bitmask=BWA_MakeBankFromString$("I'm_an_unsafe_bitmask")
		
		BWA_Bank_Xor(Bank,Bitmask)
		
	End If
	
	
	If 0 Then;1 to cheak bank for changes
		
		Size=PeekInt(Bank,BankSize(Bank)-1-8)
		Count=PeekInt(Bank,BankSize(Bank)-1-4)
		ResizeBank Bank,BankSize(Bank)-8
		
		Cheak=0
		
		For n=0 To BankSize(Bank)-1
			Cheak=Cheak+PeekByte(Bank,n)
			If Cheak>2147483647 Then Cheak=Cheak-2147483647*2
		Next
		
		If Cheak<>Count Then RuntimeError "The file has been changed"
		If Size<>BankSize(Bank) Then RuntimeError "The file has been changed"
		
	End If
	
	
End Function




Function BWA_Set_Data(MapObj.MapObjs,Tex$)
	MapObj\Name$=Tex$	;Change?
End Function



Function BWA_Set_Options(MapObj.MapObjs,ID)

	Select ID
	
		Case 1	;e.g. Is it's colour Changeable?
			MapObj\ColourChange=1	;Delete Me!!!
		Case 2
			;MapObj\pickup=1 (e.g.)
		Case 3
			;MapObj\blows_up=1 (e.g.)
		Case 4
			
		Case 5
			
		Case 6
			
		Case 7
			
	End Select
	
End Function



And a couple more things: You have to type the extension at the export file name, and all these files go in the same
folder.
Hope you like it.