ScummVM API documentation
monsters.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 MM1_DATA_MONSTERS_H
23 #define MM1_DATA_MONSTERS_H
24 
25 #include "mm/mm1/gfx/dta.h"
26 #include "mm/mm1/data/text_parser.h"
27 #include "common/str.h"
28 #include "graphics/managed_surface.h"
29 
30 namespace MM {
31 namespace MM1 {
32 
33 #define MONSTERS_COUNT 195
34 
35 enum MonsterStatus {
36  MON_PARALYZED = 0, MON_WEBBED = 1, MON_HELD = 2,
37  MON_ASLEEP = 3, MON_MINDLESS = 4, MON_SILENCED = 5,
38  MON_BLINDED = 6, MON_AFRAID = 7, MON_DEAD = 8
39 };
40 enum MonsterStatusFlag {
41  MONFLAG_AFRAID = 1, MONFLAG_BLIND = 2, MONFLAG_SILENCED = 4,
42  MONFLAG_MINDLESS = 8, MONFLAG_ASLEEP = 0x10,
43  MONFLAG_HELD = 0x20, MONFLAG_WEBBED = 0x40,
44  MONFLAG_PARALYZED = 0x80, MONFLAG_DEAD = 0xff
45 };
46 
47 enum MonsterLoot {
48  DROPS_GEMS = 0x1, // if 1 - a monster can drop gems
49  GOLD_DROP = 0xfe>>1 // _loot>>1 - gold value that a monster drops
50 };
51 
52 enum MonsterResistUndead {
53  MAGIC_RESISTANCE = 0x7f,
54  IS_UNDEAD = 0x80
55 };
56 
57 enum MonsterBonusOnTouch {
58  TOUCH_BONUS_VALUE = 0x7f,
59  HAS_BONUS = 0x80
60 };
61 
62 enum MonsterResistances {
63  MONRES_ASLEEP = 1, MONRES_FEAR = 2, MONRES_PARALYSIS = 4,
64  MONRES_ENERGY = 8, MONRES_COLD = 0x10,
65  MONRES_ELECTRICITY = 0x20, MONRES_FIRE = 0x40,
66  MONRES_PHYSICAL_ATTACK = 0x80,
67 };
68 
69 enum MonsterSpecialAbility {
70  HAS_RANGED_ATTACK = 0x80, // 1 if has ranged attack, 0 if has special attack
71  ATTACK_VALUE = 0x7f // damage for ranged attack. Special attack id for special attack
72 };
73 
74 enum MonsterCounter {
75  COUNTER_BITS = 0xf,
76  COUNTER_THRESHOLD1 = 0x10, COUNTER_THRESHOLD2 = 0x20,
77  COUNTER_REGENERATE = 0x40, COUNTER_ADVANCES = 0x80
78 };
79 
80 struct Monster {
81  Common::String _name; // char _name[15];
82  byte _count;
83  byte _fleeThreshold;
84  byte _defaultHP;
85  byte _defaultAC;
86  byte _maxDamage;
87  byte _numberOfAttacks;
88  byte _speed;
89  uint16 _experience;
90  byte _loot;
91  byte _resistUndead;
92  byte _resistances;
93  byte _bonusOnTouch;
94  byte _specialAbility;
95  byte _specialThreshold; // % of luck of special attack
96  byte _counterFlags;
97  byte _imgNum;
98 
99  // Runtime combat fields
100  byte _level = 0;
101  bool _checked = false;
102  byte _status = 0;
103  byte _hp = 0;
104  byte _ac = 0;
105 
106  Common::String getDisplayName() const {
107  return _name;
108  }
109 };
110 
111 class Monsters : public TextParser {
112 private:
113  Monster _monsters[MONSTERS_COUNT];
114  Gfx::DTA _monPix;
115 public:
116  Monsters();
117 
121  bool load();
122 
126  const Monster &operator[](uint i) {
127  assert(i >= 1 && i <= MONSTERS_COUNT);
128  return _monsters[i - 1];
129  }
130 
134  Graphics::ManagedSurface getMonsterImage(int imgNum);
135 };
136 
137 } // namespace MM1
138 } // namespace MM
139 
140 #endif
Definition: managed_surface.h:51
Definition: str.h:59
Definition: text_parser.h:33
const Monster & operator[](uint i)
Definition: monsters.h:126
Definition: monsters.h:111
Definition: dta.h:34
Definition: detection.h:27
Definition: monsters.h:80