]>
Commit | Line | Data |
---|---|---|
83ffe9cd | 1 | (* Copyright (C) 2005-2023 Free Software Foundation, Inc. *) |
1eee94d3 GM |
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 | ||
18 | DEFINITION MODULE AdvMap ; | |
19 | ||
20 | ||
21 | EXPORT QUALIFIED Rooms, Line, DoorStatus, Door, Room, Treasure, | |
22 | ActualNoOfRooms, MaxNoOfTreasures, MaxNoOfRooms, | |
23 | NoOfRoomsToHidePlayers, NoOfRoomsToSpring, | |
24 | NoOfRoomsToHideCoal, NoOfRoomsToHideGrenade, | |
25 | ReadAdvMap, Adjacent, IncPosition, | |
26 | FileName, MaxLengthOfFileName ; | |
27 | ||
28 | ||
29 | CONST | |
30 | MaxNoOfRooms = 350 ; | |
31 | MaxWallsPerRoom = 8 ; | |
32 | MaxDoorsPerRoom = 6 ; | |
33 | MaxNoOfTreasures = 15 ; | |
34 | MaxLengthOfFileName = 11 ; | |
35 | NoOfRoomsToHidePlayers = 50 ; | |
36 | NoOfRoomsToSpring = 50 ; | |
37 | NoOfRoomsToHideCoal = 50 ; | |
38 | NoOfRoomsToHideGrenade = 50 ; | |
39 | ||
40 | ||
41 | TYPE | |
42 | ||
43 | Line = RECORD | |
44 | X1 : CARDINAL ; | |
45 | Y1 : CARDINAL ; | |
46 | X2 : CARDINAL ; | |
47 | Y2 : CARDINAL | |
48 | END ; | |
49 | ||
50 | DoorStatus = (Open, Closed, Secret) ; | |
51 | ||
52 | Door = RECORD | |
53 | Position : Line ; | |
54 | StateOfDoor : DoorStatus ; | |
55 | LeadsTo : CARDINAL | |
56 | END ; | |
57 | ||
58 | TreasureInfo = RECORD | |
59 | Xpos : CARDINAL ; | |
60 | Ypos : CARDINAL ; | |
61 | Rm : CARDINAL ; | |
62 | Tweight : CARDINAL ; | |
63 | TreasureName : ARRAY [0..12] OF CHAR | |
64 | END ; | |
65 | ||
66 | Room = RECORD | |
67 | RoomNo : CARDINAL ; | |
68 | NoOfWalls : CARDINAL ; | |
69 | NoOfDoors : CARDINAL ; | |
70 | Walls : ARRAY [1..MaxWallsPerRoom] OF Line ; | |
71 | Doors : ARRAY [1..MaxDoorsPerRoom] OF Door ; | |
72 | Treasures : BITSET ; | |
73 | END ; | |
74 | ||
75 | ||
76 | VAR | |
77 | ActualNoOfRooms : CARDINAL ; | |
78 | Treasure : ARRAY [1..MaxNoOfTreasures] OF TreasureInfo ; | |
79 | Rooms : ARRAY [1..MaxNoOfRooms] OF Room ; | |
80 | ||
81 | FileName : ARRAY [0..MaxLengthOfFileName] OF CHAR ; | |
82 | ||
83 | ||
84 | (* | |
85 | ReadAdvMap - read map, Name, into memory. | |
86 | TRUE is returned if the operation was successful. | |
87 | *) | |
88 | ||
89 | PROCEDURE ReadAdvMap (Name: ARRAY OF CHAR) : BOOLEAN ; | |
90 | ||
91 | ||
92 | (* | |
93 | Adjacent - tests to see if two rooms are Adjacent to each other. | |
94 | *) | |
95 | ||
96 | PROCEDURE Adjacent (R1, R2: CARDINAL) : BOOLEAN ; | |
97 | ||
98 | ||
99 | (* | |
100 | IncPosition - increments the position of x, y by the direction that are facing. | |
101 | *) | |
102 | ||
103 | PROCEDURE IncPosition (VAR x, y: CARDINAL ; Dir: CARDINAL) ; | |
104 | ||
105 | ||
106 | END AdvMap. |