Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed some PreventRoomOverlap issues #260

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions MapSystem.bb
Original file line number Diff line number Diff line change
Expand Up @@ -2038,7 +2038,6 @@ Function CreateRoom.Rooms(zone%, roomshape%, x#, y#, z#, name$ = "")
AddLightCones(r)
EndIf

CalculateRoomExtents(r)
Return r
EndIf
Next
Expand Down Expand Up @@ -2078,7 +2077,6 @@ Function CreateRoom.Rooms(zone%, roomshape%, x#, y#, z#, name$ = "")
AddLightCones(r)
EndIf

CalculateRoomExtents(r)
Return r
End If
EndIf
Expand Down Expand Up @@ -7558,24 +7556,29 @@ Function CreateMap()
r = CreateRoom(zone, ROOM4, x * 8, 0, y * 8, MapName(x, y))
MapRoomID(ROOM4)=MapRoomID(ROOM4)+1
End Select
CalculateRoomExtents(r)

EndIf

Next
Next

r = CreateRoom(0, ROOM1, (MapWidth-1) * 8, 500, 8, "gatea")
CalculateRoomExtents(r)
MapRoomID(ROOM1)=MapRoomID(ROOM1)+1

r = CreateRoom(0, ROOM1, (MapWidth-1) * 8, 0, (MapHeight-1) * 8, "pocketdimension")
CalculateRoomExtents(r)
MapRoomID(ROOM1)=MapRoomID(ROOM1)+1

If IntroEnabled
r = CreateRoom(0, ROOM1, 8, 0, (MapHeight-1) * 8, "173")
CalculateRoomExtents(r)
MapRoomID(ROOM1)=MapRoomID(ROOM1)+1
EndIf

r = CreateRoom(0, ROOM1, 8, 800, 0, "dimension1499")
CalculateRoomExtents(r)
MapRoomID(ROOM1)=MapRoomID(ROOM1)+1

For r.Rooms = Each Rooms
Expand Down Expand Up @@ -8562,15 +8565,15 @@ Function CalculateRoomExtents(r.Rooms)

;convert from the rooms local space to world space
TFormVector(r\RoomTemplate\MinX, r\RoomTemplate\MinY, r\RoomTemplate\MinZ, r\obj, 0)
r\MinX = TFormedX() + shrinkAmount + r\x
r\MinY = TFormedY() + shrinkAmount
r\MinZ = TFormedZ() + shrinkAmount + r\z
r\MinX = TFormedX()
r\MinY = TFormedY()
r\MinZ = TFormedZ()

;convert from the rooms local space to world space
TFormVector(r\RoomTemplate\MaxX, r\RoomTemplate\MaxY, r\RoomTemplate\MaxZ, r\obj, 0)
r\MaxX = TFormedX() - shrinkAmount + r\x
r\MaxY = TFormedY() - shrinkAmount
r\MaxZ = TFormedZ() - shrinkAmount + r\z
r\MaxX = TFormedX()
r\MaxY = TFormedY()
r\MaxZ = TFormedZ()

If (r\MinX > r\MaxX) Then
Local tempX# = r\MaxX
Expand All @@ -8583,6 +8586,14 @@ Function CalculateRoomExtents(r.Rooms)
r\MinZ = tempZ
EndIf

r\MinX = r\MinX + shrinkAmount + r\x
r\MinY = r\MinY + shrinkAmount
r\MinZ = r\MinZ + shrinkAmount + r\z

r\MaxX = r\MaxX - shrinkAmount + r\x
r\MaxY = r\MaxY - shrinkAmount
r\MaxZ = r\MaxZ - shrinkAmount + r\z

DebugLog("roomextents: "+r\MinX+", "+r\MinY +", "+r\MinZ +", "+r\MaxX +", "+r\MaxY+", "+r\MaxZ)
End Function

Expand Down Expand Up @@ -8713,8 +8724,6 @@ Function PreventRoomOverlap(r.Rooms)
PositionEntity r2\obj,r2\x,r2\y,r2\z
RotateEntity r2\obj,0,r2\angle,0
CalculateRoomExtents(r2)

isIntersecting = False
EndIf
EndIf
EndIf
Expand Down