Re: A compilation of a few bugfixes (for version 1.0.4)

#21
OK thank you! I've been successful at recompiling SCP:CB on Blitz3D 1.106 with the source code and dlls! Blitz3D really is quite an old engine but it's still quite cool :D
SCP: Eric Breach nanomod maker (if anyone wants to revamp it be my guest, as it is now defunct)
Fan of Doctor Who, Dirk Gently's Holistic Detective Agency, Sleepy Hollow, Person of Interest, Happy (2017) and Silicon Valley. And also MCU films.

Re: A compilation of a few bugfixes (for version 1.0.4)

#23
risingstar64 wrote:Because people are still experiencing the MAV while loading scp 939's resources I have decided to add juanjpro's fix to my bugfix compilation. Of course, all credit for this, and for the guard / MTF view clipping goes to juanjpro who wrote the fixed code :)
Oh goodee :D So this means bump mapping can be enabled with no problems now with the elevator to 939? Because bump mapping disabled causes 173 to fall through the floor at times :| Anyways, will test soon as well :D What parts of the code for the MTFs, guards and 939 have exactly been changed tho, out of curiosity? Is it a bit of a major change or something?
SCP: Eric Breach nanomod maker (if anyone wants to revamp it be my guest, as it is now defunct)
Fan of Doctor Who, Dirk Gently's Holistic Detective Agency, Sleepy Hollow, Person of Interest, Happy (2017) and Silicon Valley. And also MCU films.

Re: A compilation of a few bugfixes (for version 1.0.4)

#24
autotroph wrote:
risingstar64 wrote:Because people are still experiencing the MAV while loading scp 939's resources I have decided to add juanjpro's fix to my bugfix compilation. Of course, all credit for this, and for the guard / MTF view clipping goes to juanjpro who wrote the fixed code :)
Oh goodee :D So this means bump mapping can be enabled with no problems now with the elevator to 939? Because bump mapping disabled causes 173 to fall through the floor at times :| Anyways, will test soon as well :D What parts of the code for the MTFs, guards and 939 have exactly been changed tho, out of curiosity? Is it a bit of a major change or something?
I have not personally encountered the elevator MAVs so I can't say for sure, but this should at least fix the MAV encountered due to FreeBrush, which is the one that is linked to bumpmapping.

For Guards:
juanjpro wrote:To fix the guards not rendering, add:

Code: Select all

MeshCullBox (n\obj, -MeshWidth(GuardObj), -MeshHeight(GuardObj), -MeshDepth(GuardObj), MeshWidth(GuardObj)*2, MeshHeight(GuardObj)*2, MeshDepth(GuardObj)*2)
In NPCs.bb, CreateNPC function after the entity is copied.
For MTFS:
same as above but wherever it says GuardObj replace that with MTFObj


For 939 Loading:
juanjpro wrote:
aaro4130 wrote:Bump mapping is still broken when going down elevators or on any quick loading screen it will cause a MAV.
That's a bug with SCP-939, where the game does FreeBrush twice, the second time crashes the game.
To fix that, change 939's bump mapping code to this:

Code: Select all

If BumpEnabled Then
	bump1 = LoadTexture_Strict("GFX\npcs\scp-939_licker_normal.png")
	TextureBlend bump1, FE_BUMP
	
	For i = 2 To CountSurfaces(n\obj)
		sf = GetSurface(n\obj,i)
		b = GetSurfaceBrush( sf )
		If b<>0 Then
			t1 = GetBrushTexture(b,0)
			If t1<>0 Then
				Select Lower(StripPath(TextureName(t1)))
					Case "scp-939-licker_diffusetest01.png"
						
						BrushTexture b, bump1, 0, 0
						BrushTexture b, t1, 0, 1
						PaintSurface sf,b
						
						;If StripPath(TextureName(t1)) <> "" Then FreeTexture t1
						;FreeBrush b	
				End Select
				FreeTexture t1
			EndIf
			FreeBrush b
		EndIf
	Next
	FreeTexture bump1
EndIf

Re: A compilation of a few bugfixes (for version 1.0.4)

#25
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.

Re: A compilation of a few bugfixes (for version 1.0.4)

#26
Great job juanjpro! After implementing your code and changing the PlayerZone line that you mentioned I was able to successfully load up and play the intro sequence of a custom map several times in a row without any errors. I added your fix and the modified source code to the current executable :173:

EDIT: to be clear, in addition to the 3 pieces of code that juanjpro described above, an additional line was changed in the source.
juanjpro wrote:find this in MapSystem.bb (around line 3735):

Code: Select all

PlayerZone=GetZone(EntityZ(Collider)/8.0)
And replace it with:

Code: Select all

PlayerZone=Min(Max(GetZone(EntityZ(Collider)/8.0),0),ZONEAMOUNT-1)
Last edited by risingstar64 on Sun Aug 31, 2014 5:36 am, edited 1 time in total.

Re: A compilation of a few bugfixes (for version 1.0.4)

#27
risingstar64 wrote:Great job juanjpro! After implementing your code and changing the PlayerZone line that you mentioned I was able to successfully load up and play the intro sequence of a custom map several times in a row without any errors. I added your fix and the modified source code to the current executable :173:
NEAT! :D And unfortunately this means I have to delay Eric Breach 0.1.3 to put these bugfixes on as well. At least I can play custom maps now :D

EDIT: I uploaded 0.1.3 anyway. But there's still a problem with the bugfix though. I can play custom maps now, but room2storage doesn't loop properly. Instead I get a door to a void if I cross through a storage room twice. And the doors at both ends of the hallway don't line up to the adjacent rooms whn you go through any of the storage rooms at least once. Also, I made a map on MapCreator once, played it, skipped the intro, saved it at room2storage, and got a MAV upon reloading the game at 100%. It also freezes on loading at 45%. Weird.
SCP: Eric Breach nanomod maker (if anyone wants to revamp it be my guest, as it is now defunct)
Fan of Doctor Who, Dirk Gently's Holistic Detective Agency, Sleepy Hollow, Person of Interest, Happy (2017) and Silicon Valley. And also MCU films.

Re: A compilation of a few bugfixes (for version 1.0.4)

#28
This reminds me of SCP CB 0.8.2 where there we're MAV's everywhere! and bugs everywhere to!
autotroph wrote: EDIT: I uploaded 0.1.3 anyway. But there's still a problem with the bugfix though. I can play custom maps now, but room2storage doesn't loop properly. Instead I get a door to a void if I cross through a storage room twice. And the doors at both ends of the hallway don't line up to the adjacent rooms whn you go through any of the storage rooms at least once. Also, I made a map on MapCreator once, played it, skipped the intro, saved it at room2storage, and got a MAV upon reloading the game at 100%. It also freezes on loading at 45%. Weird.
I have the same problem with room2storage, only It occurs on v1.0.4 but instead of void, the buttons don't work, instead this text appears: 'You press the button but nothing happened.' However this only occurs when I use a custom map. I wonder why...

Edit: I used No-Clip and it appears that it loops properly, but the doors don't open to loop it round again. I No-Clipped on top of the rooms and held down the D key to keep going right. I came across the corpse you find in the room. So it does work, but the doors don't open.
I'm a brony, got a problem, then please go away. -->

Re: A compilation of a few bugfixes (for version 1.0.4)

#30
autotroph wrote:room2storage doesn't loop properly
Did you activate the event for it in the Map Creator?

Also, new fix for misplaced checkpoint rooms:
juanjpro wrote:In MapSystem.bb:

Around line 4650, find this:

Code: Select all

If ((y-height) Mod (MapWidth/ZoneAmount))=0 Then height = height - 1
Replace it with:

Code: Select all

If GetZone(y-height)<>GetZone(y-height+1) Then height=height-1
Around line 4670, find this:

Code: Select all

If (y2 Mod (MapWidth/ZoneAmount))=0 And y2>y-tempheight Then ;a room leading from zone to another
Replace it with:

Code: Select all

If GetZone(y2)<>GetZone(y2+1) Then ;a room leading from zone to another