ScummVM API documentation
data.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 ULTIMA0_DATA_H
23#define ULTIMA0_DATA_H
24
25#include "common/array.h"
26#include "common/keyboard.h"
27#include "common/rect.h"
28#include "common/serializer.h"
29#include "ultima/ultima0/data/defines.h"
30
31namespace Ultima {
32namespace Ultima0 {
33
34enum Direction { DIR_NORTH, DIR_EAST, DIR_SOUTH, DIR_WEST };
35
36struct PlayerInfo;
37
38struct ObjectInfo {
39 const char *_name;
40 int _cost;
41 int _maxDamage;
42 int _action;
43};
45 const char *_name;
46 int _level;
47};
48
49extern const ObjectInfo OBJECT_INFO[];
50extern const MonsterInfo MONSTER_INFO[];
51extern const char *ATTRIB_NAMES[];
52extern const char *const DIRECTION_NAMES[];
53
58 Common::Point _loc; // Position
59 int _type = 0; // Monster type
60 int _strength = 0; // Strength
61 bool _alive = false; // Alive flag
62
63 void synchronize(Common::Serializer &s);
64};
65
70private:
71 void addMonster(const PlayerInfo &player, int type);
72 int generateContent(int c);
73
74public:
75 byte _map[DUNGEON_MAP_SIZE][DUNGEON_MAP_SIZE] = {}; // Map information
76 Common::Array<MonsterEntry> _monsters; // Monster records
77
78 void create(const PlayerInfo &player);
79 void synchronize(Common::Serializer &s);
80
84 int findMonster(const Common::Point &c) const;
85
86 void addMonsterAtPos(const PlayerInfo &player, const Common::Point &pt, int type);
87};
88
92struct PlayerInfo {
93 char _name[MAX_NAME + 1] = {}; // Player Name
94 Common::Point _worldPos; // World map position
95 Common::Point _dungeonPos; // Dungeon map position
96 Common::Point _dungeonDir; // Dungeon direction facing
97 byte _class = '?'; // Player class (F or M)
98 int _hpGain = 0; // HPs gained in dungeon
99 int _level = 0; // Dungeon level, 0 = world map
100 int _skill = 0; // Skill level
101 int _task = 0; // Task set (-1 = none)
102 bool _taskCompleted = 0; // Task completed
103 uint32 _luckyNumber = 0; // Value used for seeding
104 int _attr[MAX_ATTR] = {}; // Attribute values
105 double _object[MAX_OBJ] = {}; // Object counts
106
107 void init();
108 void rollAttributes();
109 void synchronize(Common::Serializer &s);
110
114 Direction dungeonDir() const;
115
119 void setDungeonDir(Direction newDir);
120
125
130};
131
136 byte _map[WORLD_MAP_SIZE][WORLD_MAP_SIZE] = {}; // Map information
137
138 void init(PlayerInfo &p);
139 int read(int x, int y) const;
140 void synchronize(Common::Serializer &s);
141};
142
143} // namespace Ultima0
144} // namespace Ultima
145
146#endif
Definition: array.h:52
Definition: serializer.h:80
Definition: rect.h:144
Definition: data.h:69
int findMonster(const Common::Point &c) const
Definition: data.h:57
Definition: data.h:44
Definition: data.h:38
Definition: data.h:92
void setDungeonDir(Direction newDir)
Direction dungeonDir() const
Definition: data.h:135