Add tilemap floors to rooms

This commit is contained in:
2021-06-15 14:56:32 +02:00
parent 73bd407c49
commit da631e3b37
31 changed files with 181 additions and 66 deletions
+14 -5
View File
@@ -11,6 +11,7 @@ import Dodge.Data
import Dodge.Room.Data
import Dodge.Room.Placement
import Dodge.Room.Link
import Dodge.Default.Room
import Dodge.Item.Consumable
import Dodge.Item.Equipment
import Dodge.Item.Weapon
@@ -21,6 +22,7 @@ import Dodge.Creature
--import Dodge.Default
import Geometry
import Picture
import Data.Tile
import Data.List
import Data.Function (on)
@@ -40,12 +42,19 @@ roomRect
-> Int -- ^ Number of links on vertical walls
-> Int -- ^ Number of links on horizontal walls
-> Room
roomRect x y xn yn = Room
roomRect x y xn yn = defaultRoom
{ _rmPolys = [rectNSWE y 0 0 x ]
, _rmLinks = lnks
, _rmPath = concatMap doublePair pth
, _rmPS = [sPS (x/2,y/2) 0 putLamp]
, _rmBound = [rectNSWE (y+5) (-5) (-5) (x+5)]
, _rmFloor = [Tile
{ _tilePoly = rectNSWE y 0 0 x
, _tileCenter = (0,0)
, _tileX = (50,0)
, _tileY = (0,50)
, _tileZ = 16
} ]
}
where
yd = (y - 40) / fromIntegral yn
@@ -88,7 +97,7 @@ linksAndPath lnks subpth = subpth ++ concatMap linkClosest lnks
{- Combines two rooms into one room.
Combines into one big bound, concatenates the rest. -}
combineRooms :: Room -> Room -> Room
combineRooms r r' = Room
combineRooms r r' = defaultRoom
{ _rmPolys = _rmPolys r ++ _rmPolys r'
, _rmLinks = _rmLinks r ++ _rmLinks r'
, _rmPath = _rmPath r ++ _rmPath r'
@@ -130,7 +139,7 @@ fourthWall w = do
, blockLine (-29,w) (0,w/2)
]
]
pure $ Room
pure $ defaultRoom
{ _rmPolys = [ [(0,0),(w,w),(-w,w)] ]
, _rmLinks = [((0,w), 0)]
, _rmPath = [((0,w),(0,0)),((0,0),(0,w))]
@@ -175,7 +184,7 @@ fourthCornerWall w = do
, blockLine (0,w) (0,w*2)
]
]
pure $ Room
pure $ defaultRoom
{ _rmPolys = [ [(0,0),(w,w),(0,2*w),(-w,w)] ]
, _rmLinks =
[((w/2,3*w/2), negate $ pi/4)
@@ -233,7 +242,7 @@ centerVaultRoom n w h d = do
weDoors = rectNSWE 20 (-20) (d + 20) (negate (d +20))
centerPoly = rectWdthHght (d - 20) (d - 20)
polys = centerPoly : nsDoors : weDoors : take 4 (iterate (map vNormal) northPoly)
return $ Room
return $ defaultRoom
{ _rmPolys = polys
, _rmLinks =
[((0,h),0)