ScummVM API documentation
location_map.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 ULTIMA3_VIEWS_LOCATION_MAP_H
23#define ULTIMA3_VIEWS_LOCATION_MAP_H
24
25#include "ultima/ultima3/logic/creature_logic.h"
26#include "ultima/ultima3/logic/location_logic.h"
27#include "ultima/ultima3/views/game.h"
28#include "common/array.h"
29
30namespace Ultima {
31namespace Ultima3 {
32namespace Views {
33
34constexpr int VIEWPORT_TILES = 11;
35
40class LocationMap : public Game {
41private:
42 LocationLogic _logic;
43 CreatureLogic _creatures;
44
45 // Set while a step is being taken, as opposed to some other command
46 bool _moved = false;
47
48 // Set when a fight has just begun, and when one has finished and the
49 // turn it interrupted needs completing
50 bool _fightStarted = false;
51 bool _fightOver = false;
52
53 // How long since the whirlpool last moved
54 int _whirlpoolFrames = 0;
55
56 // The fire breathed at the party during the last turn, shown one after
57 // the other before the turn is over
58 struct BreathPath {
60 bool _hits;
61 };
63 int _breathStep = 0;
64 int _breathFrames = 0;
65 int _pendingCreature = -1;
66
70 void startBreaths(const Common::Array<CreatureLogic::Breath> &breaths, bool exodusBolt);
71
75 void checkBreathHit();
76
80 void finishTurn(int creature);
81
85 void startFight(int creature);
86
91 void buildViewport(byte *tiles) const;
92
93 void doMove(Direction dir, const char *label);
94 void doPass();
95 void doInvalid();
96 void doBoard();
97 void doEnter();
98 void doQuitSave();
99 void doAttack();
100 void doFire();
101 void doExitVehicle();
102
103protected:
104 void drawViewport(GfxSurface &s) override;
105 void idleTimeout() override;
106 void endTurn() override;
107 void processFrame() override;
108 bool handleCommand(const KeypressMessage &msg) override;
109
110 bool isWaiting() const override {
111 return _breaths.empty();
112 }
113
114public:
115 LocationMap() : Game("LocationMap") {}
116 ~LocationMap() override {}
117
118 bool msgFocus(const FocusMessage &msg) override;
119
123 void attackDirection(Direction dir);
124
128 void fireCannon(Direction dir);
129};
130
131} // namespace Views
132} // namespace Ultima3
133} // namespace Ultima
134
135#endif
bool empty() const
Definition: array.h:352
Definition: gfx_surface.h:34
Definition: creature_logic.h:35
Definition: location_logic.h:40
Definition: game.h:43
Definition: location_map.h:40
bool handleCommand(const KeypressMessage &msg) override
void attackDirection(Direction dir)
void drawViewport(GfxSurface &s) override
bool isWaiting() const override
Definition: location_map.h:110
Definition: messages.h:54