ScummVM API documentation
map_city_castle.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ULTIMA_ULTIMA1_MAP_MAP_CITY_CASTLE_H
23 #define ULTIMA_ULTIMA1_MAP_MAP_CITY_CASTLE_H
24 
25 #include "ultima/ultima1/maps/map_base.h"
26 
27 namespace Ultima {
28 namespace Ultima1 {
29 namespace Widgets {
30  class Person;
31  class Merchant;
32 }
33 
34 namespace Maps {
35 
36 enum CityTile {
37  CTILE_GROUND = 1, CTILE_POND_EDGE1 = 51, CTILE_POND_EDGE2 = 52, CTILE_POND_EDGE3 = 53,
38  CTILE_GATE = 11, CTILE_LOCK1 = 60, CTILE_LOCK2 = 61, CTILE_63 = 63
39 };
40 
44 class MapCityCastle : public MapBase {
45 protected:
49  void loadWidgets();
50 
54  void loadTownCastleData();
55 
59  Widgets::Merchant *getStealMerchant();
60 
64  Widgets::Person *getTalkPerson();
65 public:
66  bool _guardsHostile; // Flag for whether guards are hostile
67  uint _tipCounter; // Tip counter for taverns
68 public:
72  MapCityCastle(Ultima1Game *game, Ultima1Map *map) : MapBase(game, map),
73  _guardsHostile(false), _tipCounter(0) {}
74 
78  void load(Shared::Maps::MapId mapId) override;
79 
83  void getTileAt(const Point &pt, Shared::Maps::MapTile *tile, bool includePlayer = true) override;
84 
88  void clear() override;
89 
93  Point getViewportPosition(const Point &viewportSize) override;
94 
98  void cast() override;
99 
103  void drop() override;
104 
108  void inform() override;
109 
113  void steal() override;
114 
124  void attack(int direction, int effectId, uint maxDistance, uint amount, uint agility, const Common::String &hitWidget) override;
125 
129  bool isWenchNearby() const;
130 };
131 
135 class MapCity : public MapCityCastle {
136 public:
140  MapCity(Ultima1Game *game, Ultima1Map *map) : MapCityCastle(game, map) {}
141 
145  ~MapCity() override {}
146 
150  void load(Shared::Maps::MapId mapId) override;
151 
155  void dropCoins(uint coins) override;
156 
160  void get() override;
161 
165  void talk() override;
166 
170  void unlock() override;
171 };
172 
176 class MapCastle : public MapCityCastle {
177 public:
178  uint _castleKey; // Key for castle map lock
179  int _getCounter; // Counter for allowed gets without stealing check
180  bool _freeingPrincess; // Set when freeing the princess is in progress
181 public:
185  MapCastle(Ultima1Game *game, Ultima1Map *map) : MapCityCastle(game, map), _castleKey(0),
186  _getCounter(0), _freeingPrincess(false) {}
187 
191  void load(Shared::Maps::MapId mapId) override;
192 
196  void synchronize(Common::Serializer &s) override;
197 
201  void dropCoins(uint coins) override;
202 
206  void get() override;
207 
211  void talk() override;
212 
216  void unlock() override;
217 
218 
222  bool isLordBritishCastle() const;
223 };
224 
225 } // End of namespace Maps
226 } // End of namespace Ultima1
227 } // End of namespace Ultima
228 
229 #endif
Definition: map_tile.h:36
Definition: str.h:59
MapCastle(Ultima1Game *game, Ultima1Map *map)
Definition: map_city_castle.h:185
MapCityCastle(Ultima1Game *game, Ultima1Map *map)
Definition: map_city_castle.h:72
Definition: merchant.h:34
~MapCity() override
Definition: map_city_castle.h:145
Definition: map_city_castle.h:135
Definition: serializer.h:79
Definition: map_base.h:39
Definition: person.h:38
Definition: detection.h:27
Definition: map_city_castle.h:176
Definition: rect.h:45
Definition: game.h:42
Definition: map_city_castle.h:44
MapCity(Ultima1Game *game, Ultima1Map *map)
Definition: map_city_castle.h:140