ScummVM API documentation
item.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 ULTIMA8_WORLD_ITEM_H
23 #define ULTIMA8_WORLD_ITEM_H
24 
25 #include "ultima/ultima8/kernel/object.h"
26 #include "ultima/ultima8/gfx/shape_info.h"
27 
28 #include "ultima/ultima8/usecode/intrinsics.h"
29 #include "ultima/ultima8/misc/box.h"
30 #include "ultima/ultima8/misc/point3.h"
31 #include "ultima/ultima8/misc/direction.h"
32 
33 namespace Ultima {
34 namespace Ultima8 {
35 
36 class Container;
37 class ShapeInfo;
38 class Shape;
39 class Gump;
40 class GravityProcess;
41 
42 class Item : public Object {
43  friend class ItemFactory;
44 
45 public:
46  Item();
47  ~Item() override;
48 
49  ENABLE_RUNTIME_CLASSTYPE()
50 
51 
52  ObjId getParent() const {
53  return _parent;
54  }
55 
57  void setParent(ObjId p) {
58  _parent = p;
59  }
60 
63 
65  Container *getRootContainer() const;
66 
69  const Item *getTopItem() const;
70 
73  void setLocation(int32 x, int32 y, int32 z); // this only sets the loc.
74  void setLocation(const Point3 &pt); // this only sets the loc.
75 
78  virtual void move(int32 x, int32 y, int32 z);
79 
81  void move(const Point3 &pt);
82 
87  bool moveToContainer(Container *container, bool checkwghtvol = false);
88 
90  void moveToEtherealVoid();
91 
94 
96  void movedByPlayer();
97 
100  Point3 getLocationAbsolute() const;
101 
104  inline Point3 getLocation() const {
105  return Point3(_x, _y, _z);
106  }
107 
109  int32 getZ() const;
110 
112  void setZ(int32 z) {
113  _z = z;
114  }
115 
118  void getGumpLocation(int32 &x, int32 &y) const;
119 
122  void setGumpLocation(int32 x, int32 y);
123 
127  void randomGumpLocation();
128 
131  Point3 getCentre() const;
132 
134  inline void getFootpadWorld(int32 &x, int32 &y, int32 &z) const;
135 
138  inline void getFootpadData(int32 &x, int32 &y, int32 &z) const;
139 
141  Box getWorldBox() const;
142 
144  inline uint16 getFlags() const {
145  return _flags;
146  }
147 
149  inline bool hasFlags(uint16 flags) const {
150  return (_flags & flags) != 0;
151  }
152 
154  void setFlag(uint32 mask) {
155  _flags |= mask;
156  }
157 
158  virtual void setFlagRecursively(uint32 mask) {
159  setFlag(mask);
160  }
161 
163  void clearFlag(uint32 mask) {
164  _flags &= ~mask;
165  }
166 
168  void setExtFlags(uint32 f) {
169  _extendedFlags = f;
170  }
171 
173  inline uint32 getExtFlags() const {
174  return _extendedFlags;
175  }
176 
178  inline bool hasExtFlags(uint32 flags) const {
179  return (_extendedFlags & flags) != 0;
180  }
181 
183  void setExtFlag(uint32 mask) {
184  _extendedFlags |= mask;
185  }
186 
188  void clearExtFlag(uint32 mask) {
189  _extendedFlags &= ~mask;
190  }
191 
193  uint32 getShape() const {
194  return _shape;
195  }
196 
198  void setShape(uint32 shape);
199 
201  uint32 getFrame() const {
202  return _frame;
203  }
204 
206  void setFrame(uint32 frame) {
207  _frame = frame;
208  }
209 
211  uint16 getQuality() const {
212  return _quality;
213  }
214 
216  void setQuality(uint16 quality) {
217  _quality = quality;
218  }
219 
222  uint16 getNpcNum() const {
223  return _npcNum;
224  }
225 
228  void setNpcNum(uint16 npcnum) {
229  _npcNum = npcnum;
230  }
231 
234  uint16 getMapNum() const {
235  return _mapNum;
236  }
237 
240  void setMapNum(uint16 mapnum) {
241  _mapNum = mapnum;
242  }
243 
245  inline const ShapeInfo *getShapeInfo() const;
246 
248  virtual const ShapeInfo *getShapeInfoFromGameInstance() const;
249 
251  const Shape *getShapeObject() const;
252 
255  uint16 getFamily() const;
256 
258  bool canMergeWith(const Item *other) const;
259 
261  ObjId getGump() const {
262  return _gump;
263  }
265  void clearGump(); // set gump to 0 and clear the GUMP_OPEN flag
267  ObjId openGump(uint32 gumpshape);
269  void closeGump();
270 
271  ProcId bark(const Std::string &msg, ObjId id = 0);
273  void clearBark(); // set bark to 0
275  void closeBark();
276 
278  virtual void destroy(bool delnow = false);
279 
281  bool overlaps(const Item &item2) const;
282 
284  bool overlapsxy(const Item &item2) const;
285 
287  bool isOn(const Item &item2) const;
288 
290  bool isCompletelyOn(const Item &item2) const;
291 
293  bool isCentreOn(const Item &item2) const;
294 
296  bool isOnScreen() const;
297 
299  bool isPartlyOnScreen() const;
300 
302  bool canExistAt(int32 x, int32 y, int32 z, bool needsupport = false) const;
303  bool canExistAt(const Point3 &pt, bool needsupport = false) const;
304 
307  Direction getDirToItemCentre(const Item &item2) const;
308 
310  Direction getDirToItemCentre(const Point3 &pt) const;
311 
314  int getRange(const Item &item2, bool checkz = false) const;
315 
317  int getRangeIfVisible(const Item &item2) const;
318 
325  bool canReach(const Item *other, int range, int32 x = 0, int32 y = 0, int32 z = 0) const;
326 
335  // directions in which movement was blocked (bit 0=x,1=y,2=z)
340  virtual int32 collideMove(int32 x, int32 y, int32 z, bool teleport, bool force,
341  ObjId *hititem = 0, uint8 *dirs = 0);
342 
349  int32 ascend(int delta);
350 
354  void fall();
355 
360  void grab();
361 
363  void hurl(int xs, int ys, int zs, int grav);
364 
366  void setGravityPID(ProcId pid) {
367  assert(_gravityPid == 0 || pid == 0);
368  _gravityPid = pid;
369  }
370 
372  ProcId getGravityPID() const {
373  return _gravityPid;
374  }
375 
378 
380  virtual uint32 getWeight() const;
381 
383  virtual uint32 getTotalWeight() const;
384 
386  virtual uint32 getVolume() const;
387 
390  void explode(int explosion_type, bool destroy_item, bool cause_damage = true);
391 
393  virtual uint16 getDamageType() const;
394 
400  virtual void receiveHit(ObjId other, Direction dir, int damage, uint16 type);
401 
403  uint16 fireWeapon(int32 x, int32 y, int32 z, Direction dir, int firetype, bool findtarget);
404 
407  uint16 fireDistance(const Item *other, Direction dir, int16 xoff, int16 yoff, int16 zoff) const;
408 
410  uint8 getDamagePoints() const {
411  return _damagePoints;
412  }
413 
415  void setDamagePoints(uint8 points) {
416  _damagePoints = points;
417  }
418 
421  int32 getTargetZRelativeToAttackerZ(int32 attackerz) const;
422 
424  unsigned int countNearby(uint32 shape, uint16 range) const;
425 
427  bool canDrag() const;
428 
431  int getThrowRange() const;
432 
437  bool checkLoopScript(const uint8 *script, uint32 scriptsize) const;
438 
439  uint32 callUsecodeEvent_look(); // event 0
440  uint32 callUsecodeEvent_use(); // event 1
441  uint32 callUsecodeEvent_anim(); // event 2
442  uint32 callUsecodeEvent_cachein(); // event 4
443  uint32 callUsecodeEvent_hit(ObjId hitted, int16 hitforce); // event 5
444  uint32 callUsecodeEvent_gotHit(ObjId hitter, int16 hitforce);// event 6
445  uint32 callUsecodeEvent_hatch(); // event 7
446  uint32 callUsecodeEvent_schedule(uint32 time); // event 8
447  uint32 callUsecodeEvent_release(); // event 9
448  uint32 callUsecodeEvent_equip(); // event A
449  uint32 callUsecodeEvent_equipWithParam(ObjId param); // event A
450  uint32 callUsecodeEvent_unequip(); // event B
451  uint32 callUsecodeEvent_unequipWithParam(ObjId param); // event B
452  uint32 callUsecodeEvent_combine(); // event C
453  uint32 callUsecodeEvent_calledFromAnim(); // event E
454  uint32 callUsecodeEvent_enterFastArea(); // event F
455  uint32 callUsecodeEvent_leaveFastArea(); // event 10
456  uint32 callUsecodeEvent_cast(uint16 unk); // event 11
457  uint32 callUsecodeEvent_justMoved(); // event 12
458  uint32 callUsecodeEvent_AvatarStoleSomething(uint16 unk); // event 14
459  uint32 callUsecodeEvent_guardianBark(int16 unk); // event 15 (Ultima)
460  uint32 callUsecodeEvent_unhatch(); // event 15 (Crusader)
461 
462  uint32 use();
463 
465  inline Point3 getLerped() const {
466  return Point3(_ix, _iy, _iz);
467  }
468 
472  inline void doLerp(int32 factor) {
473  // Should be noted that this does indeed limit us to 'only' 24bit coords
474  // not that it matters because on disk they are unsigned 16 bit
475 
476  if (factor == 256) {
477  _ix = _lNext._x;
478  _iy = _lNext._y;
479  _iz = _lNext._z;
480  } else if (factor == 0) {
481  _ix = _lPrev._x;
482  _iy = _lPrev._y;
483  _iz = _lPrev._z;
484  } else {
485 #if 1
486  // This way while possibly slower is more accurate
487  _ix = ((_lPrev._x * (256 - factor) + _lNext._x * factor) >> 8);
488  _iy = ((_lPrev._y * (256 - factor) + _lNext._y * factor) >> 8);
489  _iz = ((_lPrev._z * (256 - factor) + _lNext._z * factor) >> 8);
490 #else
491  _ix = _lPrev.x + (((_lNext.x - _lPrev.x) * factor) >> 8);
492  _iy = _lPrev.y + (((_lNext.y - _lPrev.y) * factor) >> 8);
493  _iz = _lPrev.z + (((_lNext.z - _lPrev.z) * factor) >> 8);
494 #endif
495  }
496  }
497 
499  void setupLerp(int32 gametick);
500 
502  virtual uint32 enterFastArea();
503 
506  virtual void leaveFastArea();
507 
509  Common::String dumpInfo() const override;
510 
511  bool loadData(Common::ReadStream *rs, uint32 version);
512  void saveData(Common::WriteStream *ws) override;
513 
514  // Intrinsics
515  INTRINSIC(I_touch);
516  INTRINSIC(I_getX);
517  INTRINSIC(I_getY);
518  INTRINSIC(I_getZ);
519  INTRINSIC(I_getCX);
520  INTRINSIC(I_getCY);
521  INTRINSIC(I_getCZ);
522  INTRINSIC(I_getPoint);
523  INTRINSIC(I_getShape);
524  INTRINSIC(I_setShape);
525  INTRINSIC(I_getFrame);
526  INTRINSIC(I_setFrame);
527  INTRINSIC(I_getQuality);
528  INTRINSIC(I_getUnkEggType);
529  INTRINSIC(I_setUnkEggType);
530  INTRINSIC(I_getQuantity);
531  INTRINSIC(I_getContainer);
532  INTRINSIC(I_getRootContainer);
533  INTRINSIC(I_getQ);
534  INTRINSIC(I_getQHi);
535  INTRINSIC(I_getQLo);
536  INTRINSIC(I_setQ);
537  INTRINSIC(I_setQHi);
538  INTRINSIC(I_setQLo);
539  INTRINSIC(I_setQuality);
540  INTRINSIC(I_setQuantity);
541  INTRINSIC(I_setQAndCombine);
542  INTRINSIC(I_getFamily);
543  INTRINSIC(I_getTypeFlag);
544  INTRINSIC(I_getStatus);
545  INTRINSIC(I_orStatus);
546  INTRINSIC(I_andStatus);
547  INTRINSIC(I_getFootpadData);
548  INTRINSIC(I_overlaps);
549  INTRINSIC(I_overlapsXY);
550  INTRINSIC(I_isOn);
551  INTRINSIC(I_isCompletelyOn);
552  INTRINSIC(I_isCentreOn);
553  INTRINSIC(I_isInNpc);
554  INTRINSIC(I_ascend);
555  INTRINSIC(I_getWeight);
556  INTRINSIC(I_getWeightIncludingContents);
557  INTRINSIC(I_getVolume);
558  INTRINSIC(I_bark);
559  INTRINSIC(I_getMapArray);
560  INTRINSIC(I_setMapArray);
561  INTRINSIC(I_getNpcNum);
562  INTRINSIC(I_setNpcNum);
563  INTRINSIC(I_getDirToCoords);
564  INTRINSIC(I_getDirFromCoords);
565  INTRINSIC(I_getDirToItem);
566  INTRINSIC(I_getDirFromItem);
567  INTRINSIC(I_getDirFromTo16);
568  INTRINSIC(I_getClosestDirectionInRange);
569  INTRINSIC(I_look);
570  INTRINSIC(I_use);
571  INTRINSIC(I_gotHit);
572  INTRINSIC(I_enterFastArea);
573  INTRINSIC(I_cast);
574  INTRINSIC(I_ask);
575  INTRINSIC(I_getSliderInput);
576  INTRINSIC(I_openGump);
577  INTRINSIC(I_closeGump);
578  INTRINSIC(I_create);
579  INTRINSIC(I_legalCreateAtPoint);
580  INTRINSIC(I_legalCreateAtCoords);
581  INTRINSIC(I_legalCreateInCont);
582  INTRINSIC(I_push);
583  INTRINSIC(I_pop);
584  INTRINSIC(I_popToCoords);
585  INTRINSIC(I_popToContainer);
586  INTRINSIC(I_popToEnd);
587  INTRINSIC(I_destroy);
588  INTRINSIC(I_move);
589  INTRINSIC(I_legalMoveToPoint);
590  INTRINSIC(I_legalMoveToContainer);
591  INTRINSIC(I_hurl);
592  INTRINSIC(I_shoot);
593  INTRINSIC(I_fall);
594  INTRINSIC(I_grab);
595  INTRINSIC(I_igniteChaos);
596  INTRINSIC(I_getFamilyOfType);
597  INTRINSIC(I_getEtherealTop);
598  INTRINSIC(I_guardianBark);
599  INTRINSIC(I_getSurfaceWeight);
600  INTRINSIC(I_isExplosive);
601  INTRINSIC(I_receiveHit);
602  INTRINSIC(I_explode);
603  INTRINSIC(I_canReach);
604  INTRINSIC(I_getRange);
605  INTRINSIC(I_getRangeIfVisible);
606  INTRINSIC(I_isCrusTypeNPC);
607  INTRINSIC(I_setBroken);
608  INTRINSIC(I_inFastArea);
609  INTRINSIC(I_equip);
610  INTRINSIC(I_unequip);
611  INTRINSIC(I_avatarStoleSomething);
612  INTRINSIC(I_isPartlyOnScreen);
613  INTRINSIC(I_fireWeapon);
614  INTRINSIC(I_fireDistance);
615 
616 private:
617  uint32 _shape; // DO NOT modify this directly! Always use setShape()!
618 
619 protected:
620  uint32 _frame;
621 
622  int32 _x, _y, _z; // world coordinates
623  uint16 _flags;
624  uint16 _quality;
625  uint16 _npcNum;
626  uint16 _mapNum;
627 
628  uint32 _extendedFlags; // pentagram's own flags
629 
630  ObjId _parent; // objid container this item is in (or 0 for top-level items)
631 
632  mutable const Shape *_cachedShape;
633  mutable const ShapeInfo *_cachedShapeInfo;
634 
635  // This is stuff that is used for displaying and interpolation
636  struct Lerped {
637  Lerped() : _x(0), _y(0), _z(0), _shape(0), _frame(0) {};
638  int32 _x, _y, _z;
639  uint32 _shape, _frame;
640  };
641 
642  Lerped _lPrev; // Previous state (relative to camera)
643  Lerped _lNext; // Next (current) state (relative to camera)
644  int32 _ix, _iy, _iz; // Interpolated position in camera space
645 
646  ObjId _gump; // Item's container gump
647  ObjId _bark; // Item's bark gump
648  ProcId _gravityPid; // Item's GravityTracker (or 0)
649 
650  uint8 _damagePoints; // Damage points, used for item damage in Crusader
651 
653  bool isRobotCru() const;
654 
657  int scaleReceivedDamageCru(int damage, uint16 type) const;
658 
659 private:
660 
662  uint32 callUsecodeEvent(uint32 event, const uint8 *args = 0, int argsize = 0);
663 
665  int32 _lastSetup;
666 
668  void animateItem();
669 
671  void receiveHitU8(ObjId other, Direction dir, int damage, uint16 type);
672 
674  void receiveHitCru(ObjId other, Direction dir, int damage, uint16 type);
675 
676 public:
677  enum statusflags {
678  FLG_DISPOSABLE = 0x0002,
679  FLG_OWNED = 0x0004,
680  FLG_CONTAINED = 0x0008,
681  FLG_INVISIBLE = 0x0010,
682  FLG_FLIPPED = 0x0020,
683  FLG_IN_NPC_LIST = 0x0040,
684  FLG_FAST_ONLY = 0x0080,
685  FLG_GUMP_OPEN = 0x0100,
686  FLG_EQUIPPED = 0x0200,
687  FLG_BOUNCING = 0x0400,
688  FLG_ETHEREAL = 0x0800,
689  FLG_HANGING = 0x1000,
690  FLG_FASTAREA = 0x2000,
691  FLG_LOW_FRICTION = 0x4000,
692  FLG_BROKEN = 0x8000
693  };
694 
695  enum extflags {
696  EXT_FIXED = 0x0001,
697  EXT_INCURMAP = 0x0002,
698  EXT_LERP_NOPREV = 0x0008,
699  EXT_HIGHLIGHT = 0x0010,
700  EXT_CAMERA = 0x0020,
701  EXT_SPRITE = 0x0040,
702  EXT_TRANSPARENT = 0x0080,
703  EXT_PERMANENT_NPC = 0x0100,
704  EXT_TARGET = 0x0200,
705  EXT_FEMALE = 0x8000
706  };
707 
708  // easter egg as in original: items stack to max quantity of 666
709  static const int MAX_QUANTITY = 666;
710 };
711 
712 inline const ShapeInfo *Item::getShapeInfo() const {
713  if (!_cachedShapeInfo)
714  _cachedShapeInfo = getShapeInfoFromGameInstance();
715  return _cachedShapeInfo;
716 }
717 
718 inline void Item::getFootpadData(int32 &X, int32 &Y, int32 &Z) const {
719  const ShapeInfo *si = getShapeInfo();
720  Z = si->_z;
721 
722  if (_flags & Item::FLG_FLIPPED) {
723  X = si->_y;
724  Y = si->_x;
725  } else {
726  X = si->_x;
727  Y = si->_y;
728  }
729 }
730 
731 // like getFootpadData, but scaled to world coordinates
732 inline void Item::getFootpadWorld(int32 &X, int32 &Y, int32 &Z) const {
733  const ShapeInfo *si = getShapeInfo();
734  si->getFootpadWorld(X, Y, Z, _flags & Item::FLG_FLIPPED);
735 }
736 
737 } // End of namespace Ultima8
738 } // End of namespace Ultima
739 
740 #endif
void setZ(int32 z)
Set this Item&#39;s Z coordinate.
Definition: item.h:112
Box getWorldBox() const
Get the Box this item occupies in the world. Undef if item is contained.
ObjId openGump(uint32 gumpshape)
Open a gump with the given shape for this Item.
int getRangeIfVisible(const Item &item2) const
get &#39;distance&#39; to other item if it&#39;s visible (ie, there&#39;s nothing blocking the path) ...
Point3 getCentre() const
virtual void receiveHit(ObjId other, Direction dir, int damage, uint16 type)
bool isCompletelyOn(const Item &item2) const
Check if this item is on completely on top of another item.
Item is in a container.
Definition: item.h:680
bool canDrag() const
can this item be dragged?
bool isPartlyOnScreen() const
Check if the item is currently partly visible on screen.
void movedByPlayer()
Check if moving this item is stealing; call AvatarStoleSomething if so.
Definition: str.h:59
uint16 getFamily() const
bool overlaps(const Item &item2) const
Check if this item overlaps another item in 3D world-space.
Item is being followed by the camera.
Definition: item.h:700
uint16 fireDistance(const Item *other, Direction dir, int16 xoff, int16 yoff, int16 zoff) const
void clearGump()
Call this to notify the Item&#39;s open Gump has closed.
Item is owned by avatar.
Definition: item.h:679
Definition: stream.h:77
uint16 getQuality() const
Get this Item&#39;s quality (a.k.a. &#39;Q&#39;)
Definition: item.h:211
Item is a NPC.
Definition: item.h:683
Item has bounced.
Definition: item.h:687
Definition: item.h:42
Direction getDirToItemCentre(const Item &item2) const
Item has low friction.
Definition: item.h:691
bool isOnScreen() const
Check if the item is currently entirely visible on screen.
Definition: point3.h:28
void setGumpLocation(int32 x, int32 y)
Item can&#39;t be lerped this frame.
Definition: item.h:698
void setShape(uint32 shape)
Set this Item&#39;s shape number.
bool moveToContainer(Container *container, bool checkwghtvol=false)
virtual uint32 getVolume() const
Get the volume this item takes up in a container.
void closeBark()
Close this Item&#39;s bark, if any.
bool hasFlags(uint16 flags) const
Does this item have any of the given flags mask set.
Definition: item.h:149
Point3 getLocation() const
Definition: item.h:104
bool hasExtFlags(uint32 flags) const
Does item have any of the given extended flags.
Definition: item.h:178
int32 getTargetZRelativeToAttackerZ(int32 attackerz) const
uint32 getExtFlags() const
Get _extendedFlags.
Definition: item.h:173
virtual void move(int32 x, int32 y, int32 z)
void setFrame(uint32 frame)
Set this Item&#39;s frame number.
Definition: item.h:206
uint16 getMapNum() const
Definition: item.h:234
virtual const ShapeInfo * getShapeInfoFromGameInstance() const
Get the ShapeInfo object for this Item from the game instance.
bool checkLoopScript(const uint8 *script, uint32 scriptsize) const
Item is a permanent NPC.
Definition: item.h:703
uint16 getFlags() const
Get all flags.
Definition: item.h:144
virtual GravityProcess * ensureGravityProcess()
Get the GravityProcess of this Item, creating it if necessary.
uint16 getNpcNum() const
Definition: item.h:222
Item is in a CurrentMap display list.
Definition: item.h:697
void setDamagePoints(uint8 points)
set damage points, used in Crusader for item damage.
Definition: item.h:415
int getThrowRange() const
Definition: box.h:36
bool isOn(const Item &item2) const
Check if this item is on top of another item.
Item is equipped.
Definition: item.h:686
bool canReach(const Item *other, int range, int32 x=0, int32 y=0, int32 z=0) const
unsigned int countNearby(uint32 shape, uint16 range) const
count nearby objects of a given shape
Item is in the fast area.
Definition: item.h:690
int scaleReceivedDamageCru(int damage, uint16 type) const
bool overlapsxy(const Item &item2) const
Check if this item overlaps another item in the xy dims in 3D space.
void closeGump()
Close this Item&#39;s gump, if any.
Definition: detection.h:27
void doLerp(int32 factor)
Definition: item.h:472
void getFootpadWorld(int32 &x, int32 &y, int32 &z) const
Get the size of this item&#39;s 3D bounding box, in world coordinates.
Definition: item.h:732
ObjId getParent() const
Get the Container this Item is in, if any. (0 if not in a Container)
Definition: item.h:52
Definition: object.h:39
Point3 getLocationAbsolute() const
Item should be Painted highlighted.
Definition: item.h:699
bool canMergeWith(const Item *other) const
Check if we can merge with another item.
void setGravityPID(ProcId pid)
Set the PID of the GravityProcess for this Item. There should be only one.
Definition: item.h:366
Container * getRootContainer() const
Get the top-most Container this Item is in, if any. (NULL if not in a Container)
uint16 fireWeapon(int32 x, int32 y, int32 z, Direction dir, int firetype, bool findtarget)
fire the given weapon type in the given direction from location x, y, z.
void setupLerp(int32 gametick)
Setup the lerped info for this gametick and animate the item.
Item should be painted transparent.
Definition: item.h:702
void setMapNum(uint16 mapnum)
Definition: item.h:240
Item is suspended in the air.
Definition: item.h:689
Point3 getLerped() const
Get lerped location.
Definition: item.h:465
Item is in the ethereal list - confirmed same meaning in crusader.
Definition: item.h:688
void setQuality(uint16 quality)
Set this Item&#39;s quality (a.k.a &#39;Q&#39;);.
Definition: item.h:216
Item is flipped horizontally.
Definition: item.h:682
void explode(int explosion_type, bool destroy_item, bool cause_damage=true)
Definition: string.h:30
Definition: container.h:36
extflags
Definition: item.h:695
int getRange(const Item &item2, bool checkz=false) const
void setLocation(int32 x, int32 y, int32 z)
virtual uint16 getDamageType() const
get the damage type this object does when hitting something
Item is the current reticle target in Crusader.
Definition: item.h:704
void setNpcNum(uint16 npcnum)
Definition: item.h:228
virtual uint32 getWeight() const
Get the weight of this Item.
void clearFlag(uint32 mask)
Clear the flags set in the given mask.
Definition: item.h:163
void clearBark()
Call this to notify the Item&#39;s open bark has closed.
Definition: shape_info.h:33
void getFootpadData(int32 &x, int32 &y, int32 &z) const
Definition: item.h:718
virtual void leaveFastArea()
void setExtFlag(uint32 mask)
Set the _extendedFlags set in the given mask.
Definition: item.h:183
const Shape * getShapeObject() const
Get the Shape object for this Item. (The pointer will be cached.)
Item is discarded when leaving fast area.
Definition: item.h:684
ProcId getGravityPID() const
Get the PID of the GravityProcess for this Item (or 0)
Definition: item.h:372
Definition: gravity_process.h:33
Definition: stream.h:385
virtual uint32 enterFastArea()
The item has entered the fast area.
Item is Crusader Female NPC (controls sfx)
Definition: item.h:705
Item is discarded on map change.
Definition: item.h:678
void returnFromEtherealVoid()
Move an item out of the Ethereal Void to where it originally was.
int32 ascend(int delta)
void setFlag(uint32 mask)
Set the flags set in the given mask.
Definition: item.h:154
void setExtFlags(uint32 f)
Set _extendedFlags.
Definition: item.h:168
void clearExtFlag(uint32 mask)
Clear the _extendedFlags set in the given mask.
Definition: item.h:188
bool canExistAt(int32 x, int32 y, int32 z, bool needsupport=false) const
Check if this item can exist at the given coordinates.
const ShapeInfo * getShapeInfo() const
Get the ShapeInfo object for this Item. (The pointer will be cached.)
Definition: item.h:712
Definition: shape.h:38
Item is broken - Crusader only - broken items are not targetable.
Definition: item.h:692
void getGumpLocation(int32 &x, int32 &y) const
uint32 getShape() const
Get this Item&#39;s shape number.
Definition: item.h:193
Item is invisible.
Definition: item.h:681
Definition: item.h:636
uint8 getDamagePoints() const
get damage points, used in Crusader for item damage.
Definition: item.h:410
int32 getZ() const
Get this Item&#39;s Z coordinate.
Item came from FIXED.
Definition: item.h:696
const Item * getTopItem() const
ObjId getGump() const
Get the open ContainerGump for this Item, if any. (NULL if not open.)
Definition: item.h:261
void hurl(int xs, int ys, int zs, int grav)
Hurl the item in the given direction.
Common::String dumpInfo() const override
dump some info about this item to a string
uint32 getFrame() const
Get this Item&#39;s frame number.
Definition: item.h:201
Definition: item_factory.h:32
bool isRobotCru() const
True if this is a Robot shape (in a fixed list)
Item has a gump open.
Definition: item.h:685
virtual void destroy(bool delnow=false)
Destroy self.
void moveToEtherealVoid()
Move an item to the Ethereal Void.
void setParent(ObjId p)
Set the parent container of this item.
Definition: item.h:57
statusflags
Definition: item.h:677
bool isCentreOn(const Item &item2) const
Check if the centre of this item is on top of another item.
virtual int32 collideMove(int32 x, int32 y, int32 z, bool teleport, bool force, ObjId *hititem=0, uint8 *dirs=0)
Container * getParentAsContainer() const
Get the Container this Item is in, if any. (NULL if not in a Container)
virtual uint32 getTotalWeight() const
Get the weight of this Item and its contents, if any.
Item is a sprite.
Definition: item.h:701