Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions Data/rooms.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ mesh path=GFX\map\173bright_opt.rmesh
shape = 1
commonness = 0
disabledecals = true
disableoverlapcheck = true
[start]
descr=SCP-173's chamber, after the breach. Placed automatically in all maps.
Expand Down Expand Up @@ -739,10 +740,12 @@ descr=SCP-106's pocket dimension. Placed automatically in all maps.
mesh path=GFX\map\pocketdimension1_opt.rmesh
shape = 1
commonness = 0
disableoverlapcheck = true

[dimension1499]
descr=SCP-1499's dimension. Placed automatically in all maps.
mesh path=GFX\map\dimension1499\1499object0_opt.rmesh
shape=1
commonness = 0
disabledecals = true
disableoverlapcheck = true
103 changes: 49 additions & 54 deletions MapSystem.bb
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,7 @@ LoadRoomTemplates("Data\rooms.ini")

Global RoomScale# = 8.0 / 2048.0
Const ZONEAMOUNT = 3
Global MapWidth% = GetINIInt("options.ini", "options", "map size"), MapHeight% = GetINIInt("options.ini", "options", "map size")
Global MapWidth% = GetINIInt("options.ini", "options", "map width"), MapHeight% = GetINIInt("options.ini", "options", "map height")
Dim MapTemp%(MapWidth+1, MapHeight+1)
Dim MapFound%(MapWidth+1, MapHeight+1)

Expand Down Expand Up @@ -7020,8 +7020,8 @@ End Function
Function CreateMap()
DebugLog ("Generating a map using the seed "+RandomSeed)

I_Zone\Transition[0] = 13
I_Zone\Transition[1] = 7
I_Zone\Transition[0] = Floor(MapHeight * (2.0 / 3.0)) + 1
I_Zone\Transition[1] = Floor(MapHeight * (1.0 / 3.0)) + 1
I_Zone\HasCustomForest = False
I_Zone\HasCustomMT = False

Expand All @@ -7045,7 +7045,7 @@ Function CreateMap()
Next

Repeat
width = Rand(10, 15)
width = Rand(Floor(MapWidth*0.6), Floor(MapWidth*0.85))

If x > MapWidth*0.6 Then
width = -width
Expand Down Expand Up @@ -7110,7 +7110,6 @@ Function CreateMap()
Until y < 2


Local ZoneAmount=3
Local Room1Amount%[3], Room2Amount%[3],Room2CAmount%[3],Room3Amount%[3],Room4Amount%[3]

;count the amount of rooms
Expand Down Expand Up @@ -7142,16 +7141,22 @@ Function CreateMap()
Next
Next

Local y_min%, y_max%, x_min%, x_max%

;force more room1s (if needed)
For i = 0 To 2
;need more rooms if there are less than 5 of them
temp = -Room1Amount[i]+5

If temp > 0 Then

For y = (MapHeight/ZoneAmount)*(2-i)+1 To ((MapHeight/ZoneAmount) * ((2-i)+1.0))-2

For x = 2 To MapWidth - 2
If i = 2 Then y_min = 1 Else y_min = I_Zone\Transition[i]
If i = 0 Then y_max = MapHeight - 2 Else y_max = I_Zone\Transition[i - 1] - 1
x_min = 1
x_max = MapWidth - 2

For y = y_min To y_max
For x = x_min To x_max
If MapTemp(x, y) = 0 Then

If (Min(MapTemp(x + 1, y),1) + Min(MapTemp(x - 1, y),1) + Min(MapTemp(x, y + 1),1) + Min(MapTemp(x, y - 1),1)) = 1 Then
Expand All @@ -7168,7 +7173,7 @@ Function CreateMap()
EndIf

placed = False
If MapTemp(x2,y2)>1 And MapTemp(x2,y2)<4 Then
If MapTemp(x2,y2)>1 And MapTemp(x2,y2)<4 And (y<y_max Or y2<y Or i=0) Then
Select MapTemp(x2,y2)
Case 2
If Min(MapTemp(x2 + 1, y2),1) + Min(MapTemp(x2 - 1, y2),1)= 2 Then
Expand Down Expand Up @@ -7205,43 +7210,32 @@ Function CreateMap()
EndIf
Next





;force more room4s and room2Cs
For i = 0 To 2

Select i
Case 2
zone=2
temp2=MapHeight/3;-1
Case 1
zone=MapHeight/3+1
temp2=MapHeight*(2.0/3.0)-1
Case 0
zone=MapHeight*(2.0/3.0)+1
temp2=MapHeight-2
End Select
If i = 2 Then y_min = 2 Else y_min = I_Zone\Transition[i]
If i = 0 Then y_max = MapHeight - 2 Else y_max = I_Zone\Transition[i - 1] - 2
x_min = 1
x_max = MapWidth - 2

If Room4Amount[i]<1 Then ;we want at least 1 ROOM4
DebugLog "forcing a ROOM4 into zone "+i
temp=0

For y = zone To temp2
For x = 2 To MapWidth - 2
For y = y_min To y_max
For x = x_min To x_max
If MapTemp(x,y)=3 Then
Select 0 ;see if adding a ROOM1 is possible
Case (MapTemp(x+1,y) Or MapTemp(x+1,y+1) Or MapTemp(x+1,y-1) Or MapTemp(x+2,y))
Case (MapTemp(x+1,y) Or MapTemp(x+1,y+1) Or MapTemp(x+1,y-1) Or MapTemp(x+2,y) Or x=x_max)
MapTemp(x+1,y)=1
temp=1
Case (MapTemp(x-1,y) Or MapTemp(x-1,y+1) Or MapTemp(x-1,y-1) Or MapTemp(x-2,y))
Case (MapTemp(x-1,y) Or MapTemp(x-1,y+1) Or MapTemp(x-1,y-1) Or MapTemp(x-2,y) Or x=x_min)
MapTemp(x-1,y)=1
temp=1
Case (MapTemp(x,y+1) Or MapTemp(x+1,y+1) Or MapTemp(x-1,y+1) Or MapTemp(x,y+2))
Case (MapTemp(x,y+1) Or MapTemp(x+1,y+1) Or MapTemp(x-1,y+1) Or MapTemp(x,y+2) Or (i=0 And y=y_max))
MapTemp(x,y+1)=1
temp=1
Case (MapTemp(x,y-1) Or MapTemp(x+1,y-1) Or MapTemp(x-1,y-1) Or MapTemp(x,y-2))
Case (MapTemp(x,y-1) Or MapTemp(x+1,y-1) Or MapTemp(x-1,y-1) Or MapTemp(x,y-2) Or (i<2 And y=y_min))
MapTemp(x,y-1)=1
temp=1
End Select
Expand All @@ -7265,22 +7259,19 @@ Function CreateMap()
DebugLog "forcing a ROOM2C into zone "+i
temp=0

zone=zone+1
temp2=temp2-1

For y = zone To temp2
For x = 3 To MapWidth - 3
For y = y_max To y_min Step -1
For x = x_min To x_max
If MapTemp(x,y)=1 Then
Select True ;see if adding some rooms is possible
Case MapTemp(x-1,y)>0
If (MapTemp(x,y-1)+MapTemp(x,y+1)+MapTemp(x+2,y))=0 Then
If (MapTemp(x+1,y-2)+MapTemp(x+2,y-1)+MapTemp(x+1,y-1))=0 Then
If (MapTemp(x+1,y-1)+MapTemp(x+1,y+1)+MapTemp(x+2,y))=0 And x<x_max Then
If (MapTemp(x+1,y-2)+MapTemp(x+2,y-1))=0 And (y>y_min Or i=2) Then
MapTemp(x,y)=2
MapTemp(x+1,y)=2
DebugLog "ROOM2C forced into slot ("+(x+1)+", "+(y)+")"
MapTemp(x+1,y-1)=1
temp=1
Else If (MapTemp(x+1,y+2)+MapTemp(x+2,y+1)+MapTemp(x+1,y+1))=0 Then
Else If (MapTemp(x+1,y+2)+MapTemp(x+2,y+1))=0 And (y<y_max Or i>0) Then
MapTemp(x,y)=2
MapTemp(x+1,y)=2
DebugLog "ROOM2C forced into slot ("+(x+1)+", "+(y)+")"
Expand All @@ -7289,14 +7280,14 @@ Function CreateMap()
EndIf
EndIf
Case MapTemp(x+1,y)>0
If (MapTemp(x,y-1)+MapTemp(x,y+1)+MapTemp(x-2,y))=0 Then
If (MapTemp(x-1,y-2)+MapTemp(x-2,y-1)+MapTemp(x-1,y-1))=0 Then
If (MapTemp(x-1,y-1)+MapTemp(x-1,y+1)+MapTemp(x-2,y))=0 And x>x_min Then
If (MapTemp(x-1,y-2)+MapTemp(x-2,y-1))=0 And (y>y_min Or i=2) Then
MapTemp(x,y)=2
MapTemp(x-1,y)=2
DebugLog "ROOM2C forced into slot ("+(x-1)+", "+(y)+")"
MapTemp(x-1,y-1)=1
temp=1
Else If (MapTemp(x-1,y+2)+MapTemp(x-2,y+1)+MapTemp(x-1,y+1))=0 Then
Else If (MapTemp(x-1,y+2)+MapTemp(x-2,y+1))=0 And (y<y_max Or i>0) Then
MapTemp(x,y)=2
MapTemp(x-1,y)=2
DebugLog "ROOM2C forced into slot ("+(x-1)+", "+(y)+")"
Expand All @@ -7305,14 +7296,14 @@ Function CreateMap()
EndIf
EndIf
Case MapTemp(x,y-1)>0
If (MapTemp(x-1,y)+MapTemp(x+1,y)+MapTemp(x,y+2))=0 Then
If (MapTemp(x-2,y+1)+MapTemp(x-1,y+2)+MapTemp(x-1,y+1))=0 Then
If (MapTemp(x-1,y+1)+MapTemp(x+1,y+1)+MapTemp(x,y+2))=0 And (y<y_max Or i>0) Then
If (MapTemp(x-2,y+1)+MapTemp(x-1,y+2))=0 And x>x_min Then
MapTemp(x,y)=2
MapTemp(x,y+1)=2
DebugLog "ROOM2C forced into slot ("+(x)+", "+(y+1)+")"
MapTemp(x-1,y+1)=1
temp=1
Else If (MapTemp(x+2,y+1)+MapTemp(x+1,y+2)+MapTemp(x+1,y+1))=0 Then
Else If (MapTemp(x+2,y+1)+MapTemp(x+1,y+2))=0 And x<x_max Then
MapTemp(x,y)=2
MapTemp(x,y+1)=2
DebugLog "ROOM2C forced into slot ("+(x)+", "+(y+1)+")"
Expand All @@ -7321,14 +7312,14 @@ Function CreateMap()
EndIf
EndIf
Case MapTemp(x,y+1)>0
If (MapTemp(x-1,y)+MapTemp(x+1,y)+MapTemp(x,y-2))=0 Then
If (MapTemp(x-2,y-1)+MapTemp(x-1,y-2)+MapTemp(x-1,y-1))=0 Then
If (MapTemp(x-1,y-1)+MapTemp(x+1,y-1)+MapTemp(x,y-2))=0 And (y>y_min Or i=2) Then
If (MapTemp(x-2,y-1)+MapTemp(x-1,y-2))=0 And x>x_min Then
MapTemp(x,y)=2
MapTemp(x,y-1)=2
DebugLog "ROOM2C forced into slot ("+(x)+", "+(y-1)+")"
MapTemp(x-1,y-1)=1
temp=1
Else If (MapTemp(x+2,y-1)+MapTemp(x+1,y-2)+MapTemp(x+1,y-1))=0 Then
Else If (MapTemp(x+2,y-1)+MapTemp(x+1,y-2))=0 And x<x_max Then
MapTemp(x,y)=2
MapTemp(x,y-1)=2
DebugLog "ROOM2C forced into slot ("+(x)+", "+(y-1)+")"
Expand Down Expand Up @@ -7797,7 +7788,7 @@ Function SetRoom(room_name$,room_type%,pos%,min_pos%,max_pos%) ;place a room wit
End Function

Function GetZone(y%)
Return Min(Floor((Float(MapWidth-y)/MapWidth*ZONEAMOUNT)),ZONEAMOUNT-1)
Return Min(Floor((Float(MapHeight-y)/MapHeight*ZONEAMOUNT)),ZONEAMOUNT-1)
End Function

;-------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -8564,15 +8555,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\x
r\MinY = TFormedY()
r\MinZ = TFormedZ() + r\z

;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\x
r\MaxY = TFormedY()
r\MaxZ = TFormedZ() + r\z

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

r\MinX = r\MinX + shrinkAmount : r\MaxX = r\MaxX - shrinkAmount
r\MinY = r\MinY + shrinkAmount : r\MaxY = r\MaxY - shrinkAmount
r\MinZ = r\MinZ + shrinkAmount : r\MaxZ = r\MaxZ - shrinkAmount

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

Expand Down
3 changes: 2 additions & 1 deletion options.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ camera fog far = 6.0
fog r = 0
fog g = 0
fog b = 0
map size = 18
map width = 18
map height = 18
achievement popup enabled = 1
bump mapping enabled = 1
anisotropy = 0
Expand Down