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