1 (* Copyright (C) 2005-2024 Free Software Foundation, Inc. *)
2 (* This file is part of GNU Modula-2.
4 GNU Modula-2 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
9 GNU Modula-2 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
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 AdvMap ;
20 EXPORT QUALIFIED Rooms, Line, DoorStatus, Door, Room, Treasure,
21 ActualNoOfRooms, MaxNoOfTreasures, MaxNoOfRooms,
22 NoOfRoomsToHidePlayers, NoOfRoomsToSpring,
23 NoOfRoomsToHideCoal, NoOfRoomsToHideGrenade,
24 ReadAdvMap, Adjacent, IncPosition,
25 FileName, MaxLengthOfFileName ;
29 MaxNoOfRooms = 350 ; (* An upper limit *)
30 WallsPerRoom = 8 ; (* An upper limit *)
31 DoorsPerRoom = 6 ; (* An upper limit *)
32 MaxNoOfTreasures = 15 ; (* An upper limit *)
33 MaxLengthOfFileName = 11 ;
34 NoOfRoomsToHidePlayers = 50 ;
35 NoOfRoomsToSpring = 50 ;
36 NoOfRoomsToHideCoal = 50 ;
37 NoOfRoomsToHideGrenade = 50 ;
49 DoorStatus = (Open, Closed, Secret) ;
53 StateOfDoor : DoorStatus ;
62 TreasureName : ARRAY [0..12] OF CHAR
67 NoOfWalls : CARDINAL ;
68 NoOfDoors : CARDINAL ;
69 Walls : ARRAY [1..WallsPerRoom] OF Line ;
70 Doors : ARRAY [1..DoorsPerRoom] OF Door ;
77 ActualNoOfRooms : CARDINAL ;
78 Treasure : ARRAY [1..MaxNoOfTreasures] OF TreasureInfo ;
79 Rooms : ARRAY [1..MaxNoOfRooms] OF Room ;
81 FileName : ARRAY [0..MaxLengthOfFileName] OF CHAR ;
85 ReadAdvMap - read map, Name, into memory.
86 TRUE is returned if the operation was successful.
89 PROCEDURE ReadAdvMap (Name: ARRAY OF CHAR) : BOOLEAN ;
93 Adjacent - tests to see if two rooms are Adjacent to each other.
96 PROCEDURE Adjacent (R1, R2: CARDINAL) : BOOLEAN ;
100 IncPosition - increments the position of x, y by the direction that are facing.
103 PROCEDURE IncPosition (VAR x, y: CARDINAL ; Dir: CARDINAL) ;