ScummVM API documentation
main_actor.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 WORLD_ACTORS_MAINACTOR_H
23#define WORLD_ACTORS_MAINACTOR_H
24
25#include "ultima/ultima8/world/actors/actor.h"
26
27namespace Ultima {
28namespace Ultima8 {
29
30class Debugger;
31struct WeaponOverlayFrame;
32
33class MainActor : public Actor {
34 friend class Debugger;
35 friend class Ultima8Engine;
36public:
37 enum CruBatteryType {
38 NoBattery = 0,
39 ChemicalBattery = 1,
40 FissionBattery = 2,
41 FusionBattery = 3
42 };
43
44 MainActor();
45 ~MainActor() override;
46
47 bool CanAddItem(Item *item, bool checkwghtvol = false) override;
48 bool addItem(Item *item, bool checkwghtvol = false) override;
49
52 const ShapeInfo *getShapeInfoFromGameInstance() const override;
53
54 void move(int32 X, int32 Y, int32 Z) override;
55
58 int16 addItemCru(Item *item, bool showtoast);
59
61 bool removeItemCru(Item *item);
62
64 void teleport(int mapNum, int32 x, int32 y, int32 z) override;
65
69 void teleport(int mapNum, int teleport_id); // to teleportegg
70
71 bool hasJustTeleported() const {
72 return _justTeleported;
73 }
74 void setJustTeleported(bool t) {
75 _justTeleported = t;
76 }
77
80 void accumulateStr(int n);
81
84 void accumulateDex(int n);
85
88 void accumulateInt(int n);
89
92
93 uint32 getArmourClass() const override;
94 uint16 getDefenseType() const override;
95 int16 getAttackingDex() const override;
96 int16 getDefendingDex() const override;
97
98 uint16 getDamageType() const override;
99 int getDamageAmount() const override;
100
101 void toggleInCombat() {
102 if (isInCombat())
103 clearInCombat();
104 else
105 setInCombat(0);
106 }
107
108 // Note: activity num parameter is ignored for Avatar.
109 void setInCombat(int activity) override;
110 void clearInCombat() override;
111
112 ProcId die(uint16 damageType, uint16 damagePts, Direction srcDir) override;
113
114 const Common::String &getName() const {
115 return _name;
116 }
117 void setName(const Common::String &name) {
118 _name = name;
119 }
120
121 int16 getMaxEnergy();
122
123 CruBatteryType getBatteryType() const {
124 return _cruBatteryType;
125 }
126 void setBatteryType(CruBatteryType newbattery) {
127 _cruBatteryType = newbattery;
128 setMana(getMaxEnergy());
129 }
130
131 void setShieldType(uint16 shieldtype) {
132 _shieldType = shieldtype;
133 }
134
135 uint16 getShieldType() {
136 return _shieldType;
137 }
138
139 bool hasKeycard(int num) const;
140 void addKeycard(int bitno);
141
142 void clrKeycards() {
143 _keycards = 0;
144 }
145
146 uint16 getActiveInvItem() const {
147 return _activeInvItem;
148 }
149
152
155
158
160 int receiveShieldHit(int damage, uint16 damage_type) override;
161
164
165 bool loadData(Common::ReadStream *rs, uint32 version);
166 void saveData(Common::WriteStream *ws) override;
167
168 ENABLE_RUNTIME_CLASSTYPE()
169
170 INTRINSIC(I_teleportToEgg);
171 INTRINSIC(I_accumulateStrength);
172 INTRINSIC(I_accumulateDexterity);
173 INTRINSIC(I_accumulateIntelligence);
174 INTRINSIC(I_clrAvatarInCombat);
175 INTRINSIC(I_setAvatarInCombat);
176 INTRINSIC(I_isAvatarInCombat);
177 INTRINSIC(I_getMaxEnergy);
178 INTRINSIC(I_hasKeycard);
179 INTRINSIC(I_clrKeycards);
180 INTRINSIC(I_addItemCru);
181 INTRINSIC(I_getNumberOfCredits);
182 INTRINSIC(I_switchMap);
183 INTRINSIC(I_removeItemCru);
184
185 void getWeaponOverlay(const WeaponOverlayFrame *&frame, uint32 &shape);
186
187
188protected:
189 void useInventoryItem(uint32 shapenum);
190 void useInventoryItem(Item *item);
191
192 bool _justTeleported;
193
194 int _accumStr;
195 int _accumDex;
196 int _accumInt;
197
198 uint32 _keycards;
199 CruBatteryType _cruBatteryType;
200 uint16 _activeInvItem;
201
202 Common::String _name;
203
208
209 static ShapeInfo *_kneelingShapeInfo;
210
211};
212
213} // End of namespace Ultima8
214} // End of namespace Ultima
215
216#endif
Definition: stream.h:385
Definition: str.h:59
Definition: stream.h:77
Definition: str.h:38
Definition: actor.h:37
Definition: debugger.h:33
Definition: gravity_process.h:33
Definition: item.h:42
Definition: main_actor.h:33
const ShapeInfo * getShapeInfoFromGameInstance() const override
void nextInvItem()
Swap to the next inventory item (Crusader)
void teleport(int mapNum, int teleport_id)
void move(int32 X, int32 Y, int32 Z) override
void teleport(int mapNum, int32 x, int32 y, int32 z) override
teleport to the given location on the given map
void nextWeapon()
Swap to the next active weapon (Crusader)
uint16 getDamageType() const override
get the damage type this object does when hitting something
uint16 _shieldSpriteProc
Process for a shield zap animation sprite.
Definition: main_actor.h:205
bool CanAddItem(Item *item, bool checkwghtvol=false) override
bool addItem(Item *item, bool checkwghtvol=false) override
void detonateBomb()
Detonate used bomb (Crusader)
uint16 _shieldType
Type of shield (only used in Crusader)
Definition: main_actor.h:207
int receiveShieldHit(int damage, uint16 damage_type) override
Check if we can absorb a hit with the shield. Returns the modified damage value.
int16 addItemCru(Item *item, bool showtoast)
GravityProcess * ensureGravityProcess() override
Get the GravityProcess of this Item, creating it if necessary.
bool removeItemCru(Item *item)
Remove a single item - only called from an intrinsic.
void dropWeapon()
Drop the current weapon (Crusader)
ProcId die(uint16 damageType, uint16 damagePts, Direction srcDir) override
Definition: shape_info.h:33
Definition: ultima8.h:64
Definition: algorithm.h:29
Definition: weapon_overlay.h:30