Unit smallGrid

Description

Generates a grid based dungeon with wide spaces between rooms, this is then processed to apply bitmasked walls

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Record coordinates  

Functions and Procedures

procedure prettify;
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;

Variables

c: smallint;
centreList: array of coordinates;
dungeonArray: array[1..globalutils.MAXROWS, 1..globalutils.MAXCOLUMNS] of char;
filename: shortstring;
firstHalf: smallint;
i: smallint;
lastHalf: smallint;
listLength: smallint;
myfile: Text;
p: smallint;
processed_dungeon: array[1..globalutils.MAXROWS, 1..globalutils.MAXCOLUMNS] of char;
r: smallint;
roomCounter: smallint;
roomSquare: smallint;
stairX: smallint;
stairY: smallint;
startX: smallint;
startY: smallint;
t: smallint;
totalRooms: smallint;

Description

Functions and Procedures

procedure prettify;

Process generated dungeon to add shaped walls

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

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;
 
filename: shortstring;

TESTING - Write dungeon to text file

firstHalf: smallint;
 
i: smallint;
 
lastHalf: smallint;
 
listLength: smallint;
 
myfile: Text;
 
p: smallint;
 
processed_dungeon: array[1..globalutils.MAXROWS, 1..globalutils.MAXCOLUMNS] of char;
 
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.