Really fix invisible offsetmapfloors

This commit is contained in:
JappaWakka 2022-12-19 06:28:02 +01:00
parent 9d9045218c
commit 7468fb38b1

View File

@ -211,7 +211,7 @@
Case TagTypes.Entity Case TagTypes.Entity
AddEntity(Tags, New Size(1, 1), 1, True, New Vector3(1, 1, 1)) AddEntity(Tags, New Size(1, 1), 1, True, New Vector3(1, 1, 1))
Case TagTypes.Floor Case TagTypes.Floor
AddFloor(Tags) AddFloor(Tags, loadOffsetMap)
Case TagTypes.Level Case TagTypes.Level
If loadOffsetMap = False Then If loadOffsetMap = False Then
SetupLevel(Tags) SetupLevel(Tags)
@ -433,9 +433,7 @@
entList.Add(Screen.Level.OffsetmapEntities(i)) entList.Add(Screen.Level.OffsetmapEntities(i))
Next Next
For i = offsetFloorCount To Screen.Level.OffsetmapFloors.Count - 1 For i = offsetFloorCount To Screen.Level.OffsetmapFloors.Count - 1
If Screen.Level.OffsetmapFloors(i).Visible = True Then floorList.Add(Screen.Level.OffsetmapFloors(i))
floorList.Add(Screen.Level.OffsetmapFloors(i))
End If
Next Next
mapList.AddRange({entList, floorList}) mapList.AddRange({entList, floorList})
@ -673,7 +671,7 @@
End If End If
End Sub End Sub
Private Sub AddFloor(ByVal Tags As Dictionary(Of String, Object)) Private Sub AddFloor(ByVal Tags As Dictionary(Of String, Object), Optional IsOffsetFloor As Boolean = False)
Dim sizeList As List(Of Integer) = CType(GetTag(Tags, "Size"), List(Of Integer)) Dim sizeList As List(Of Integer) = CType(GetTag(Tags, "Size"), List(Of Integer))
Dim Size As Size = New Size(sizeList(0), sizeList(1)) Dim Size As Size = New Size(sizeList(0), sizeList(1))
@ -729,63 +727,64 @@
If loadOffsetMap = True Then If loadOffsetMap = True Then
floorList = Screen.Level.OffsetmapFloors floorList = Screen.Level.OffsetmapFloors
End If End If
If IsOffsetFloor = False OrElse IsOffsetFloor = True AndAlso Visible = True Then
If RemoveFloor = False Then
For x = 0 To Size.Width - 1
For z = 0 To Size.Height - 1
Dim exists As Boolean = False
If RemoveFloor = False Then Dim iZ As Integer = z
For x = 0 To Size.Width - 1 Dim iX As Integer = x
For z = 0 To Size.Height - 1
Dim exists As Boolean = False
Dim iZ As Integer = z Dim Ent As Entity = Nothing
Dim iX As Integer = x
Dim Ent As Entity = Nothing If loadOffsetMap = True Then
Ent = Screen.Level.OffsetmapFloors.Find(Function(e As Entity)
Return e.Position = New Vector3(Position.X + iX, Position.Y, Position.Z + iZ)
End Function)
Else
Ent = Screen.Level.Floors.Find(Function(e As Entity)
Return e.Position = New Vector3(Position.X + iX, Position.Y, Position.Z + iZ)
End Function)
End If
If loadOffsetMap = True Then If Not Ent Is Nothing Then
Ent = Screen.Level.OffsetmapFloors.Find(Function(e As Entity) Ent.Textures = {Texture}
Return e.Position = New Vector3(Position.X + iX, Position.Y, Position.Z + iZ) Ent.Visible = Visible
End Function) Ent.SeasonColorTexture = SeasonTexture
Else Ent.LoadSeasonTextures()
Ent = Screen.Level.Floors.Find(Function(e As Entity) CType(Ent, Floor).SetRotation(rotation)
Return e.Position = New Vector3(Position.X + iX, Position.Y, Position.Z + iZ) CType(Ent, Floor).hasSnow = hasSnow
End Function) CType(Ent, Floor).IsIce = hasIce
End If CType(Ent, Floor).hasSand = hasSand
exists = True
End If
If Not Ent Is Nothing Then If exists = False Then
Ent.Textures = {Texture} Dim f As Floor = New Floor(Position.X + x, Position.Y, Position.Z + z, {TextureManager.GetTexture(TexturePath, TextureRectangle)}, {0, 0}, False, rotation, New Vector3(1.0F), BaseModel.FloorModel, 0, "", Visible, Shader, hasSnow, hasIce, hasSand)
Ent.Visible = Visible f.MapOrigin = MapOrigin
Ent.SeasonColorTexture = SeasonTexture f.SeasonColorTexture = SeasonTexture
Ent.LoadSeasonTextures() f.LoadSeasonTextures()
CType(Ent, Floor).SetRotation(rotation) f.IsOffsetMapContent = loadOffsetMap
CType(Ent, Floor).hasSnow = hasSnow floorList.Add(f)
CType(Ent, Floor).IsIce = hasIce
CType(Ent, Floor).hasSand = hasSand
exists = True
End If
If exists = False Then
Dim f As Floor = New Floor(Position.X + x, Position.Y, Position.Z + z, {TextureManager.GetTexture(TexturePath, TextureRectangle)}, {0, 0}, False, rotation, New Vector3(1.0F), BaseModel.FloorModel, 0, "", Visible, Shader, hasSnow, hasIce, hasSand)
f.MapOrigin = MapOrigin
f.SeasonColorTexture = SeasonTexture
f.LoadSeasonTextures()
f.IsOffsetMapContent = loadOffsetMap
floorList.Add(f)
End If
Next
Next
Else
For x = 0 To Size.Width - 1
For z = 0 To Size.Height - 1
For i = 0 To floorList.Count
If i < floorList.Count Then
Dim floor As Entity = floorList(i)
If floor.Position.X = Position.X + x And floor.Position.Y = Position.Y And floor.Position.Z = Position.Z + z Then
floorList.RemoveAt(i)
i -= 1
End If
End If End If
Next Next
Next Next
Next Else
For x = 0 To Size.Width - 1
For z = 0 To Size.Height - 1
For i = 0 To floorList.Count
If i < floorList.Count Then
Dim floor As Entity = floorList(i)
If floor.Position.X = Position.X + x And floor.Position.Y = Position.Y And floor.Position.Z = Position.Z + z Then
floorList.RemoveAt(i)
i -= 1
End If
End If
Next
Next
Next
End If
End If End If
End Sub End Sub