Unit crypt
Description
Builds a map of randomly placed rooms with prefab rooms
Uses
- SysUtils
- globalUtils
Overview
Classes, Interfaces, Objects and Records
Name | Description |
---|---|
Record coordinates |
Functions and Procedures
procedure buildLevel(floorNumber: byte); |
procedure createCorridor(fromX, fromY, toX, toY: smallint); |
procedure carveHorizontally(x1, x2, y: smallint); |
procedure carveVertically(y1, y2, x: smallint); |
procedure createRoom(gridNumber: smallint); |
procedure generate(title: string; idNumber: smallint; totalDepth: byte); |
procedure leftToRight; |
Types
TarraySmallint = array of smallint; |
Constants
PREFAB_4X4a: array [0..3, 0..3] of char = (
('#', '.', '.', '#'),
('.', '.', '.', '.'),
('.', '.', '.', '.'),
('#', '.', '.', '#')); |
PREFAB_4X4b: array [0..3, 0..3] of char = (
('.', '.', '.', '.'),
('.', '#', '#', '.'),
('.', '#', '#', '.'),
('.', '.', '.', '.')); |
PREFAB_4X4c: array [0..3, 0..3] of char = (
('.', '.', '.', '.'),
('.', '.', '.', '.'),
('.', '.', '.', '.'),
('.', '.', '.', '.')); |
PREFAB_4X4d: array [0..3, 0..3] of char = (
('.', '.', '.', '.'),
('.', '#', '.', '.'),
('.', '.', '.', '.'),
('.', '.', '.', '.')); |
PREFAB_4X4e: array [0..3, 0..3] of char = (
('.', '.', '.', '.'),
('.', '.', '.', '.'),
('.', '.', '#', '.'),
('.', '.', '.', '.')); |
PREFAB_5x5a: array [0..4, 0..4] of char = (
('#', '.', '.', '.', '#'),
('.', '#', '.', '#', '.'),
('.', '.', '.', '.', '.'),
('.', '#', '.', '#', '.'),
('#', '.', '.', '.', '#')); |
PREFAB_5x5b: array [0..4, 0..4] of char = (
('#', '.', '.', '.', '#'),
('.', '.', '.', '.', '.'),
('.', '.', '#', '.', '.'),
('.', '.', '.', '.', '.'),
('#', '.', '.', '.', '#')); |
PREFAB_5x5c: array [0..4, 0..4] of char = (
('#', '#', '.', '#', '#'),
('#', '.', '.', '.', '#'),
('.', '.', '.', '.', '.'),
('#', '.', '.', '.', '#'),
('#', '#', '.', '#', '#')); |
PREFAB_6x6a: array [0..5, 0..5] of char = (
('#', '#', '.', '.', '#', '#'),
('#', '.', '.', '.', '.', '#'),
('.', '.', '.', '.', '.', '.'),
('.', '.', '.', '.', '.', '.'),
('#', '.', '.', '.', '.', '#'),
('#', '#', '.', '.', '#', '#')); |
PREFAB_6x6b: array [0..5, 0..5] of char = (
('#', '.', '.', '.', '.', '#'),
('.', '.', '#', '#', '.', '.'),
('.', '#', '#', '#', '#', '.'),
('.', '#', '#', '#', '#', '.'),
('.', '.', '#', '#', '.', '.'),
('#', '.', '.', '.', '.', '#')); |
PREFAB_6x6c: array [0..5, 0..5] of char = (
('#', '#', '.', '.', '#', '#'),
('.', '.', '.', '.', '.', '.'),
('.', '.', '#', '#', '.', '.'),
('.', '.', '#', '#', '.', '.'),
('.', '.', '.', '.', '.', '.'),
('#', '#', '.', '.', '#', '#')); |
PREFAB_7x7a: array [0..6, 0..6] of char = (
('#', '#', '.', '.', '.', '#', '#'),
('#', '.', '.', '.', '.', '.', '#'),
('.', '.', '#', '.', '#', '.', '.'),
('.', '.', '.', '.', '.', '.', '.'),
('.', '.', '#', '.', '#', '.', '.'),
('#', '.', '.', '.', '.', '.', '#'),
('#', '#', '.', '.', '.', '#', '#')); |
PREFAB_7x7b: array [0..6, 0..6] of char = (
('#', '#', '#', '.', '#', '#', '#'),
('#', '.', '#', '.', '#', '.', '#'),
('#', '.', '#', '.', '#', '.', '#'),
('.', '.', '.', '.', '.', '.', '.'),
('#', '.', '#', '.', '#', '.', '#'),
('#', '.', '#', '.', '#', '.', '#'),
('#', '#', '#', '.', '#', '#', '#')); |
PREFAB_7x7c: array [0..6, 0..6] of char = (
('#', '#', '#', '.', '#', '#', '#'),
('#', '.', '.', '.', '.', '.', '#'),
('#', '.', '#', '#', '#', '.', '#'),
('.', '.', '#', '.', '#', '.', '.'),
('#', '.', '#', '.', '#', '.', '#'),
('#', '.', '.', '.', '.', '.', '#'),
('#', '#', '#', '.', '#', '#', '#')); |
Variables
c: smallint; |
centreList: array of coordinates; |
dungeonArray: array[1..globalutils.MAXROWS, 1..globalutils.MAXCOLUMNS] of char; |
firstHalf: smallint; |
i: smallint; |
lastHalf: smallint; |
listLength: smallint; |
p: smallint; |
r: smallint; |
roomCounter: smallint; |
roomSquare: smallint; |
stairX: smallint; |
stairY: smallint; |
startX: smallint; |
startY: smallint; |
t: smallint; |
totalRooms: smallint; |
Description
Functions and Procedures
procedure buildLevel(floorNumber: byte); |
Build a level in the dungeon |
procedure createCorridor(fromX, fromY, toX, toY: smallint); |
Create corridors linking the rooms |
procedure carveHorizontally(x1, x2, y: smallint); |
Carve a horizontal tunnel |
procedure carveVertically(y1, y2, x: smallint); |
Carve a vertical tunnel |
procedure createRoom(gridNumber: smallint); |
Create a room |
procedure generate(title: string; idNumber: smallint; totalDepth: byte); |
Generate a dungeon |
procedure leftToRight; |
sort room list in order from left to right |
Types
TarraySmallint = array of smallint; |
Constants
PREFAB_4X4a: array [0..3, 0..3] of char = (
('#', '.', '.', '#'),
('.', '.', '.', '.'),
('.', '.', '.', '.'),
('#', '.', '.', '#')); |
PREFAB_4X4b: array [0..3, 0..3] of char = (
('.', '.', '.', '.'),
('.', '#', '#', '.'),
('.', '#', '#', '.'),
('.', '.', '.', '.')); |
PREFAB_4X4c: array [0..3, 0..3] of char = (
('.', '.', '.', '.'),
('.', '.', '.', '.'),
('.', '.', '.', '.'),
('.', '.', '.', '.')); |
PREFAB_4X4d: array [0..3, 0..3] of char = (
('.', '.', '.', '.'),
('.', '#', '.', '.'),
('.', '.', '.', '.'),
('.', '.', '.', '.')); |
PREFAB_4X4e: array [0..3, 0..3] of char = (
('.', '.', '.', '.'),
('.', '.', '.', '.'),
('.', '.', '#', '.'),
('.', '.', '.', '.')); |
PREFAB_5x5a: array [0..4, 0..4] of char = (
('#', '.', '.', '.', '#'),
('.', '#', '.', '#', '.'),
('.', '.', '.', '.', '.'),
('.', '#', '.', '#', '.'),
('#', '.', '.', '.', '#')); |
PREFAB_5x5b: array [0..4, 0..4] of char = (
('#', '.', '.', '.', '#'),
('.', '.', '.', '.', '.'),
('.', '.', '#', '.', '.'),
('.', '.', '.', '.', '.'),
('#', '.', '.', '.', '#')); |
PREFAB_5x5c: array [0..4, 0..4] of char = (
('#', '#', '.', '#', '#'),
('#', '.', '.', '.', '#'),
('.', '.', '.', '.', '.'),
('#', '.', '.', '.', '#'),
('#', '#', '.', '#', '#')); |
PREFAB_6x6a: array [0..5, 0..5] of char = (
('#', '#', '.', '.', '#', '#'),
('#', '.', '.', '.', '.', '#'),
('.', '.', '.', '.', '.', '.'),
('.', '.', '.', '.', '.', '.'),
('#', '.', '.', '.', '.', '#'),
('#', '#', '.', '.', '#', '#')); |
PREFAB_6x6b: array [0..5, 0..5] of char = (
('#', '.', '.', '.', '.', '#'),
('.', '.', '#', '#', '.', '.'),
('.', '#', '#', '#', '#', '.'),
('.', '#', '#', '#', '#', '.'),
('.', '.', '#', '#', '.', '.'),
('#', '.', '.', '.', '.', '#')); |
PREFAB_6x6c: array [0..5, 0..5] of char = (
('#', '#', '.', '.', '#', '#'),
('.', '.', '.', '.', '.', '.'),
('.', '.', '#', '#', '.', '.'),
('.', '.', '#', '#', '.', '.'),
('.', '.', '.', '.', '.', '.'),
('#', '#', '.', '.', '#', '#')); |
PREFAB_7x7a: array [0..6, 0..6] of char = (
('#', '#', '.', '.', '.', '#', '#'),
('#', '.', '.', '.', '.', '.', '#'),
('.', '.', '#', '.', '#', '.', '.'),
('.', '.', '.', '.', '.', '.', '.'),
('.', '.', '#', '.', '#', '.', '.'),
('#', '.', '.', '.', '.', '.', '#'),
('#', '#', '.', '.', '.', '#', '#')); |
PREFAB_7x7b: array [0..6, 0..6] of char = (
('#', '#', '#', '.', '#', '#', '#'),
('#', '.', '#', '.', '#', '.', '#'),
('#', '.', '#', '.', '#', '.', '#'),
('.', '.', '.', '.', '.', '.', '.'),
('#', '.', '#', '.', '#', '.', '#'),
('#', '.', '#', '.', '#', '.', '#'),
('#', '#', '#', '.', '#', '#', '#')); |
PREFAB_7x7c: array [0..6, 0..6] of char = (
('#', '#', '#', '.', '#', '#', '#'),
('#', '.', '.', '.', '.', '.', '#'),
('#', '.', '#', '#', '#', '.', '#'),
('.', '.', '#', '.', '#', '.', '.'),
('#', '.', '#', '.', '#', '.', '#'),
('#', '.', '.', '.', '.', '.', '#'),
('#', '#', '#', '.', '#', '#', '#')); |
Variables
c: smallint; |
centreList: array of coordinates; |
list of coordinates of centre of each room |
dungeonArray: array[1..globalutils.MAXROWS, 1..globalutils.MAXCOLUMNS] of char; |
firstHalf: smallint; |
i: smallint; |
lastHalf: smallint; |
listLength: smallint; |
p: smallint; |
r: smallint; |
roomCounter: smallint; |
start creating corridors once this rises above 1 |
roomSquare: smallint; |
stairX: smallint; |
stairY: smallint; |
startX: smallint; |
Player starting position |
startY: smallint; |
Player starting position |
t: smallint; |
totalRooms: smallint; |
Generated by PasDoc 0.16.0.