ScummVM API documentation
overworld_logic.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 ULTIMA2_LOGIC_OVERWORLD_LOGIC_H
23#define ULTIMA2_LOGIC_OVERWORLD_LOGIC_H
24
25#include "ultima/ultima2/logic/logic.h"
26#include "ultima/ultima2/data/tiles.h"
27
28namespace Ultima {
29namespace Ultima2 {
30namespace Logic {
31
35class OverworldLogic : public Logic {
36private:
41 void trySpawnMonster();
42
47 void enterLocalMap(int mapType);
48
53 void enterDungeon(int mapType);
54
59 void updatePatrolMarker();
60
64 void enterMoongate(int x, int y);
65
70 void minaxFlees(int slot);
71
75 void minaxDeathSequence();
76
81 void legParalysisTrap();
82
87 void armParalysisTrap();
88
92 void magicMissileTrap();
93
97 void sleepTrap();
98
99protected:
105
106 // STEP_BLOCKED prints no message of its own - the caller shows a
107 // generic "--INVALID MOVE!". STEP_PARALYZED already printed its own
108 // complete message, so the caller adds nothing further
109 enum StepResult { STEP_OK, STEP_BLOCKED, STEP_PARALYZED, STEP_DIED, STEP_MOONGATE };
110
115 StepResult stepOnto(int x, int y);
116
121 bool mountCanEnter(Data::TileId dest) const;
122
127 int signByte(int v) const;
128
132 int findTargetMonster(int x, int y) const;
133
137 bool isOccupied(int x, int y) const;
138
144 bool monsterCanEnter(Data::TileId monsterTile, Data::TileId destTile, int x, int y) const;
145
149 bool tryMoveMonster(int slot, int dx, int dy);
150
155 void killMonster(int slot);
156
157 void updateCreatures() override;
158
159public:
160 ~OverworldLogic() override {}
161
165 bool isWalkable(Data::TileId tile) const;
166
167 bool move(Data::Direction dir) override;
168 bool attack(Data::Direction dir) override;
169 bool fire(Data::Direction dir) override;
170 bool enter() override;
171};
172
173} // namespace Logic
174} // namespace Ultima2
175} // namespace Ultima
176
177#endif
Definition: logic.h:38
Definition: overworld_logic.h:35
int findTargetMonster(int x, int y) const
StepResult stepOnto(int x, int y)
bool monsterCanEnter(Data::TileId monsterTile, Data::TileId destTile, int x, int y) const
bool mountCanEnter(Data::TileId dest) const
bool tryMoveMonster(int slot, int dx, int dy)
bool isOccupied(int x, int y) const
bool isWalkable(Data::TileId tile) const