| 1 |
DEFINITION MODULE AdvMap ; |
| 2 |
|
| 3 |
FROM AdvMath IMPORT MaxNoOfTreasures ; |
| 4 |
|
| 5 |
EXPORT QUALIFIED Rooms, Line, DoorStatus, Door, Room, Treasure, |
| 6 |
ActualNoOfRooms, MaxNoOfRooms, |
| 7 |
WallsPerRoom, DoorsPerRoom, |
| 8 |
NoOfRoomsToHidePlayers, NoOfRoomsToSpring, |
| 9 |
NoOfRoomsToHideCoal, NoOfRoomsToHideGrenade, |
| 10 |
TreasureKind, |
| 11 |
Adjacent, IncPosition, |
| 12 |
FileName, MaxLengthOfFileName ; |
| 13 |
|
| 14 |
|
| 15 |
CONST |
| 16 |
MaxNoOfRooms = 350 ; (* An upper limit *) |
| 17 |
WallsPerRoom = 12 ; (* An upper limit *) |
| 18 |
DoorsPerRoom = 8 ; (* An upper limit *) |
| 19 |
|
| 20 |
MaxLengthOfFileName = 11 ; |
| 21 |
NoOfRoomsToHidePlayers = 50 ; |
| 22 |
NoOfRoomsToSpring = 50 ; |
| 23 |
NoOfRoomsToHideCoal = 50 ; |
| 24 |
NoOfRoomsToHideGrenade = 50 ; |
| 25 |
|
| 26 |
|
| 27 |
TYPE |
| 28 |
Line = RECORD |
| 29 |
X1 : CARDINAL ; |
| 30 |
Y1 : CARDINAL ; |
| 31 |
X2 : CARDINAL ; |
| 32 |
Y2 : CARDINAL |
| 33 |
END ; |
| 34 |
|
| 35 |
DoorStatus = (Open, Closed, Secret) ; |
| 36 |
|
| 37 |
Door = RECORD |
| 38 |
Position : Line ; |
| 39 |
StateOfDoor : DoorStatus ; |
| 40 |
LeadsTo : CARDINAL |
| 41 |
END ; |
| 42 |
|
| 43 |
TreasureKind = (unused, respawnnormal, respawnmagic, |
| 44 |
onperson, onfloor, normal, magic) ; |
| 45 |
|
| 46 |
TreasureInfo = RECORD |
| 47 |
Xpos : CARDINAL ; |
| 48 |
Ypos : CARDINAL ; |
| 49 |
Rm : CARDINAL ; |
| 50 |
Tweight : CARDINAL ; |
| 51 |
TreasureName : ARRAY [0..12] OF CHAR ; |
| 52 |
kind : TreasureKind ; |
| 53 |
amount : CARDINAL ; (* number of arrows. *) |
| 54 |
END ; |
| 55 |
|
| 56 |
Room = RECORD |
| 57 |
NoOfWalls : CARDINAL ; |
| 58 |
NoOfDoors : CARDINAL ; |
| 59 |
Walls : ARRAY [1..WallsPerRoom] OF Line ; |
| 60 |
Doors : ARRAY [1..DoorsPerRoom] OF Door ; |
| 61 |
Treasures : BITSET ; |
| 62 |
END ; |
| 63 |
|
| 64 |
|
| 65 |
VAR |
| 66 |
ActualNoOfRooms : CARDINAL ; |
| 67 |
Treasure : ARRAY [1..MaxNoOfTreasures] OF TreasureInfo ; |
| 68 |
Rooms : ARRAY [1..MaxNoOfRooms] OF Room ; |
| 69 |
FileName : ARRAY [0..MaxLengthOfFileName] OF CHAR ; |
| 70 |
|
| 71 |
|
| 72 |
(* Tests to see if two rooms are Adjacent to each other. *) |
| 73 |
|
| 74 |
PROCEDURE Adjacent (R1, R2: CARDINAL) : BOOLEAN ; |
| 75 |
|
| 76 |
|
| 77 |
(* Increments the position of x, y by the direction that are facing *) |
| 78 |
|
| 79 |
PROCEDURE IncPosition (VAR x, y: CARDINAL ; Dir: CARDINAL) ; |
| 80 |
|
| 81 |
|
| 82 |
END AdvMap. |