| 1 |
(* Copyright (C) 2005-2025 Free Software Foundation, Inc. *) |
| 2 |
(* This file is part of Chisel. |
| 3 |
|
| 4 |
Chisel is free software; you can redistribute it and/or modify it under |
| 5 |
the terms of the GNU General Public License as published by the Free |
| 6 |
Software Foundation; either version 3, or (at your option) any later |
| 7 |
version. |
| 8 |
|
| 9 |
Chisel is distributed in the hope that it will be useful, but WITHOUT ANY |
| 10 |
WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 12 |
for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU General Public License along |
| 15 |
with gm2; see the file COPYING. If not, write to the Free Software |
| 16 |
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *) |
| 17 |
DEFINITION MODULE BoxMap ; |
| 18 |
|
| 19 |
(* |
| 20 |
Title : BoxMap |
| 21 |
Author : Gaius Mulley |
| 22 |
Date : 18/7/88 |
| 23 |
System : LOGITECH MODULA-2/86 |
| 24 |
Description: Generates a simple random map full of boxes. |
| 25 |
Box corridors and box rooms. |
| 26 |
All boxes are contained in the array Boxes and |
| 27 |
1..NoOfCorridorBoxes are the corridor boxes and |
| 28 |
NoOfCorridorBoxes..NoOfBoxes are the room boxes. |
| 29 |
*) |
| 30 |
|
| 31 |
EXPORT QUALIFIED MaxBoxes, MaxX, MaxY, |
| 32 |
MaxDoorLength, MinDoorLength, |
| 33 |
CorridorWidth, CorridorDoorLength, |
| 34 |
TotalCorridorLength, MinDistanceBetweenCorridors, |
| 35 |
MaxCorridorLength, MinCorridorLength, |
| 36 |
MaxRoomLength, MinRoomLength, |
| 37 |
Box, |
| 38 |
Boxes, |
| 39 |
NoOfBoxes, NoOfCorridorBoxes, |
| 40 |
CreateBoxMap ; |
| 41 |
|
| 42 |
CONST |
| 43 |
MaxBoxes = 500 ; |
| 44 |
MaxX = 120 ; (* 38 ; *) |
| 45 |
MaxY = 80 ; (* 24 ; *) |
| 46 |
|
| 47 |
MaxDoorLength = 3 ; |
| 48 |
MinDoorLength = 2 ; |
| 49 |
CorridorWidth = 7 ; (* 4 ; *) |
| 50 |
CorridorDoorLength = CorridorWidth-2 ; |
| 51 |
TotalCorridorLength = (MaxX*3+MaxY*3) DIV 2 ; |
| 52 |
MinDistanceBetweenCorridors = CorridorWidth ; |
| 53 |
MaxCorridorLength = 70 ; (* 70 ; *) |
| 54 |
MinCorridorLength = 15 ; (* 8 ; *) |
| 55 |
MaxRoomLength = 13 ; |
| 56 |
MinRoomLength = 6 ; (* 4 ; *) |
| 57 |
|
| 58 |
|
| 59 |
TYPE |
| 60 |
Box = RECORD |
| 61 |
x1, y1, |
| 62 |
x2, y2 : CARDINAL ; |
| 63 |
RoomOfBox: CARDINAL ; |
| 64 |
END ; |
| 65 |
|
| 66 |
VAR |
| 67 |
(* Box 0 is the boarder of the map. *) |
| 68 |
Boxes : ARRAY [0..MaxBoxes] OF Box ; |
| 69 |
NoOfCorridorBoxes: CARDINAL ; |
| 70 |
NoOfBoxes : CARDINAL ; |
| 71 |
|
| 72 |
|
| 73 |
(* |
| 74 |
CreateBoxMap - builds a map with central corridors and ajoining rooms. |
| 75 |
*) |
| 76 |
|
| 77 |
PROCEDURE CreateBoxMap ; |
| 78 |
|
| 79 |
|
| 80 |
END BoxMap. |