Fix for the manually-made maps:
In Main.bb:
Find and remove this (around line 1720)
Code: Select all
If e\room\RoomDoors[5]=Null Then
	For do.doors = Each Doors
		If EntityX(do\frameobj,True)=e\room\x Then
			If EntityZ(do\frameobj,True)=e\room\z-4.0 Then
				do\open = True
				e\room\RoomDoors[5]=do
				Exit
			EndIf
		EndIf
	Next
EndIf
Add this after 
Case "alarm" (somewhere around line 1680)
Code: Select all
If e\room\RoomDoors[5]=Null Then
	For i=0 To 3
		If e\room\AdjDoor[i]<>Null Then
			e\room\RoomDoors[5] = e\room\AdjDoor[i]
			e\room\RoomDoors[5]\open = True
			Exit
		EndIf
	Next
EndIf
In Save.bb:
Replace the whole LoadMap function with this:
Code: Select all
Function LoadMap(file$)
	
	Local f%, x%, y%, name$, angle%, prob#
	Local r.Rooms, rt.RoomTemplates, e.Events
	
	f% = ReadFile(file+".cbmap")
	DebugLog file+".cbmap"
	
	While Not Eof(f)
		x = ReadByte(f)
		y = ReadByte(f)
		name$ = ReadString(f)
		
		angle = ReadByte(f)*90.0
		
		DebugLog x+", "+y+": "+name
		DebugLog "angle: "+angle
		
		For rt.RoomTemplates=Each RoomTemplates
			If Lower(rt\Name) = name Then
				
				r.Rooms = CreateRoom(0, rt\Shape, x * 8.0, 0, y * 8.0, name)
				r\angle = angle
				If rt\Shape = ROOM2C Then r\angle = r\angle+90 Else r\angle = r\angle-180
				
				TurnEntity(r\obj, 0, r\angle, 0)
				
				MapTemp(x,y)=1
				
				Exit
			EndIf
		Next
		
		name = ReadString(f)
		prob# = ReadFloat(f)
		
		If r<>Null Then
			If Rnd(0.0,1.0)<prob Or prob=0 Then
				e.Events = New Events
				e\EventName = name
				e\room = r	
			EndIf
		EndIf
		
	Wend
	
	CloseFile f
	
	temp = 0
	Local spacing# = 8.0
	For y = MapHeight - 1 To 1 Step - 1
		
		;DebugLog "y: "+y
		
		If y < MapHeight/3+1 Then
			zone=3
		ElseIf y < MapHeight*(2.0/3.0)-1
			zone=2
		Else
			zone=1
		EndIf
		
		For x = 1 To MapWidth - 2
			If MapTemp(x,y) > 0 Then
				If zone = 2 Then temp = 2 Else temp=0
				
				For r.Rooms = Each Rooms
					If Int(r\x/8.0)=x And Int(r\z/8.0)=y Then
						DebugLog r\roomtemplate\Name
						If MapTemp(x + 1, y) > 0 Then
							d.Doors = CreateDoor(r\level, Float(x) * spacing + spacing / 2.0, 0, Float(y) * spacing, 90, r, Max(Rand(-3, 1), 0), temp)
							r\AdjDoor[0] = d
						EndIf
						
						If MapTemp(x, y + 1) > 0 Then
							d.Doors = CreateDoor(r\level, Float(x) * spacing, 0, Float(y) * spacing + spacing / 2.0, 0, r, Max(Rand(-3, 1), 0), temp)
							r\AdjDoor[3] = d
						EndIf
						
						Exit
					EndIf
				Next
				
			End If
			
		Next
	Next	
	
	r = CreateRoom(0, ROOM1, 8, 0, (MapHeight-1) * 8, "173")
	r = CreateRoom(0, ROOM1, (MapWidth-1) * 8, 0, (MapHeight-1) * 8, "pocketdimension")
	r = CreateRoom(0, ROOM1, 0, 0, 8, "gatea")
	
	CreateEvent("173", "173", 0)
	CreateEvent("pocketdimension", "pocketdimension", 0)	
	CreateEvent("gatea", "gatea", 0)
	
	For r.Rooms = Each Rooms
		r\Adjacent[0]=Null
		r\Adjacent[1]=Null
		r\Adjacent[2]=Null
		r\Adjacent[3]=Null
		For r2.Rooms = Each Rooms
			If r<>r2 Then
				If r2\z=r\z Then
					If (r2\x)=(r\x+8.0) Then
						r\Adjacent[0]=r2
						If r\AdjDoor[0] = Null Then r\AdjDoor[0] = r2\AdjDoor[2]
						If r\AdjDoor[0] = Null DebugLog "asd "+r\roomtemplate\Name : Stop
					ElseIf (r2\x)=(r\x-8.0)
						r\Adjacent[2]=r2
						If r\AdjDoor[2] = Null Then r\AdjDoor[2] = r2\AdjDoor[0]
						If r\AdjDoor[2] = Null DebugLog "asd "+r\roomtemplate\Name : Stop
					EndIf
				ElseIf r2\x=r\x Then
					If (r2\z)=(r\z-8.0) Then
						r\Adjacent[1]=r2
						If r\AdjDoor[1] = Null Then r\AdjDoor[1] = r2\AdjDoor[3]
						If r\AdjDoor[1] = Null DebugLog "asd "+r\roomtemplate\Name : Stop
					ElseIf (r2\z)=(r\z+8.0)
						r\Adjacent[3]=r2
						If r\AdjDoor[3] = Null Then r\AdjDoor[3] = r2\AdjDoor[1]
						If r\AdjDoor[3] = Null DebugLog "asd "+r\roomtemplate\Name : Stop
					EndIf
				EndIf
			EndIf
			If (r\Adjacent[0]<>Null) And (r\Adjacent[1]<>Null) And (r\Adjacent[2]<>Null) And (r\Adjacent[3]<>Null) Then Exit
		Next
	Next
	
End Function
These changes fix the crashes after the intro.
Feel free to add this to your executable.