26 #ifndef SAGA2_OBJPROTO_H 27 #define SAGA2_OBJPROTO_H 29 #include "saga2/idtypes.h" 30 #include "saga2/sprite.h" 31 #include "saga2/spells.h" 32 #include "saga2/effects.h" 33 #include "saga2/tcoords.h" 44 extern const int16 objectCount;
45 extern int16 worldCount;
47 #define Permanent ((uint8)255) 55 inline bool isObject(ObjectID
id) {
56 return (
id < objectCount);
59 inline bool isActor(ObjectID
id) {
60 return (
id >= ActorBaseID &&
id < ActorBaseID + kActorCount);
63 inline bool isWorld(ObjectID
id) {
64 return (
id >= WorldBaseID &&
id < WorldBaseID + worldCount);
67 inline bool isActorOrWorld(ObjectID
id) {
68 return (
id >= ActorBaseID);
74 class IntangibleContainerWindow;
75 class ContainerWindow;
85 struct ObjectSoundFXs;
87 bool isObject(GameObject *);
88 bool isActor(GameObject *);
89 bool isWorld(GameObject *);
100 tile.set(t.u, t.v, t.z);
131 Location(int16 nu, int16 nv, int16 nz, ObjectID con) {
149 _context = l.context;
158 inline bool isFlipped(Direction d) {
159 return (d > kDirDown);
201 uint8 acceptableItems;
213 int8 damageAbsorbtion,
229 kObjPropMergeable = (1 << 0),
230 kObjPropRound = (1 << 1),
231 kObjPropFlammable = (1 << 2),
232 kObjPropWeapon = (1 << 3),
233 kObjPropThrownWpn = (1 << 4),
234 kObjPropMissileWpn = (1 << 5),
235 kObjPropCharges = (1 << 6),
236 kObjPropEdible = (1 << 7),
237 kObjPropFlipped = (1 << 8),
238 kObjPropVisOpen = (1 << 9),
239 kObjPropHidden = (1 << 10),
240 kObjPropGhosted = (1 << 11),
241 kObjPropHardSurface = (1 << 12),
242 kObjPropNoSurface = (1 << 13)
248 int16 heldSpriteBase;
249 int16 appearanceType;
267 for (
int i = 0; i < 4; ++i)
270 mass = bulk = crossSection = height = toughness = breakType = 0;
274 weaponDamage = weaponFireRate = maximumRange = missileType = 0;
276 damageAbsorbtion = damageDivider = defenseBonus = 0;
277 maxCharges = chargeType = 0;
285 for (
int i = 0; i < 7; ++i)
291 classType = proto.classType;
292 script = proto.script;
293 nameIndex = proto.nameIndex;
294 iconSprite = proto.iconSprite;
295 groundSprite = proto.groundSprite;
297 for (
int i = 0; i < 4; ++i)
298 colorMap[i] = proto.colorMap[i];
302 crossSection = proto.crossSection;
303 height = proto.height;
304 toughness = proto.toughness;
305 breakType = proto.breakType;
306 maxCapacity = proto.maxCapacity;
307 lockType = proto.lockType;
308 acceptableItems = proto.acceptableItems;
309 weaponDamage = proto.weaponDamage;
310 weaponFireRate = proto.weaponFireRate;
311 maximumRange = proto.maximumRange;
312 missileType = proto.missileType;
313 whereWearable = proto.whereWearable;
314 damageAbsorbtion = proto.damageAbsorbtion;
315 damageDivider = proto.damageDivider;
316 defenseBonus = proto.defenseBonus;
317 maxCharges = proto.maxCharges;
318 chargeType = proto.chargeType;
321 heldSpriteBase = proto.heldSpriteBase;
322 resistance = proto.resistance;
323 immunity = proto.immunity;
324 soundFXClass = proto.soundFXClass;
326 for (
int i = 0; i < 7; ++i)
327 reserved[i] = proto.reserved[i];
337 for (
int i = 0; i < 4; ++i)
348 acceptableItems = stream->
readByte();
350 weaponFireRate = stream->
readByte();
366 for (
int i = 0; i < 7; ++i)
373 static uint8 *_nextAvailObj;
389 enum containmentType {
390 kIsTangible = (1 << 0),
391 kIsContainer = (1 << 1),
392 kIsBottle = (1 << 2),
394 kIsWearable = (1 << 4),
395 kIsWeapon = (1 << 5),
397 kIsDocument = (1 << 7),
398 kIsIntangible = (1 << 8),
399 kIsConcept = (1 << 9),
400 kIsPsych = (1 << 10),
401 kIsSpell = (1 << 11),
402 kIsSkill = (1 << 12),
403 kIsEnchantment = (1 << 13),
404 kIsTargetable = (1 << 14)
409 #define isTangable kIsTangible 410 #define isIntangable kIsIntangible 426 virtual uint16 containmentSet();
429 virtual bool canContain(ObjectID dObj, ObjectID item);
433 virtual bool canContainAt(
439 virtual bool isTwoHanded(ObjectID actor);
442 virtual bool isMissile();
444 virtual ObjectID placeObject();
450 int16 stdActionScript(
int method,
453 ObjectID indirectObj);
455 int16 stdActionScript(
int method,
458 ObjectID indirectObj,
463 bool use(ObjectID dObj, ObjectID enactor);
464 virtual bool setUseCursor(ObjectID dObj);
465 virtual bool useAction(ObjectID dObj, ObjectID enactor);
468 bool useOn(ObjectID dObj, ObjectID enactor, ObjectID item);
469 virtual bool useOnAction(ObjectID dObj, ObjectID enactor, ObjectID item);
472 bool useOn(ObjectID dObj, ObjectID enactor,
ActiveItem *item);
473 virtual bool useOnAction(ObjectID dObj, ObjectID enactor,
ActiveItem *item);
476 bool useOn(ObjectID dObj, ObjectID enactor,
const Location &loc);
477 virtual bool useOnAction(ObjectID dObj, ObjectID enactor,
const Location &loc);
480 bool open(ObjectID dObj, ObjectID enactor);
481 virtual bool canOpen(ObjectID dObj, ObjectID enactor);
482 virtual bool openAction(ObjectID dObj, ObjectID enactor);
485 bool close(ObjectID dObj, ObjectID enactor);
486 virtual bool closeAction(ObjectID dObj, ObjectID enactor);
489 bool take(ObjectID dObj, ObjectID enactor, int16 num = 1);
490 virtual bool takeAction(ObjectID dObj, ObjectID enactor);
491 virtual bool takeAction(ObjectID dObj, ObjectID enactor, int16 num = 1);
494 bool drop(ObjectID dObj, ObjectID enactor,
const Location &loc, int16 num = 1);
495 virtual bool canDropAt(
499 virtual bool dropAction(
506 bool dropOn(ObjectID dObj, ObjectID enactor, ObjectID target, int16 num = 1);
507 virtual bool dropOnAction(
520 virtual bool dropOnAction(
528 bool strike(ObjectID dObj, ObjectID enactor, ObjectID item);
529 virtual bool strikeAction(
535 bool damage(ObjectID dObj, ObjectID enactor, ObjectID target);
536 virtual bool damageAction(
542 bool eat(ObjectID dObj, ObjectID enactor);
543 virtual bool eatAction(ObjectID dObj, ObjectID enactor);
546 bool insert(ObjectID dObj, ObjectID enactor, ObjectID item);
547 virtual bool insertAction(ObjectID dObj, ObjectID enactor, ObjectID item);
550 bool remove(ObjectID dObj, ObjectID enactor);
551 virtual bool removeAction(ObjectID dObj, ObjectID enactor);
554 bool acceptDrop(ObjectID dObj, ObjectID enactor, ObjectID droppedObj,
int count);
555 virtual bool acceptDropAction(
566 effectDamageTypes dType = kDamageOther,
570 virtual bool acceptDamageAction(
574 effectDamageTypes dType,
586 virtual bool acceptHealingAction(
596 ObjectID strikingObj,
598 virtual bool acceptStrikeAction(
601 ObjectID strikingObj,
605 bool acceptLockToggle(ObjectID dObj, ObjectID enactor, uint8 keyCode);
606 virtual bool canToggleLock(
610 virtual bool acceptLockToggleAction(ObjectID dObj, ObjectID enactor, uint8 keyCode);
613 bool acceptMix(ObjectID dObj, ObjectID enactor, ObjectID mixObj);
614 virtual bool acceptMixAction(
620 bool acceptInsertion(
625 virtual bool acceptInsertionAction(
632 bool acceptInsertionAt(
639 virtual bool acceptInsertionAtAction(
647 virtual void getColorTranslation(ColorTable map);
656 virtual void initiateAttack(ObjectID attacker, ObjectID target);
659 virtual void initiateDefense(
660 ObjectID defensiveObj,
665 virtual GameObject *getProjectile(ObjectID weapon, ObjectID enactor);
671 virtual bool canBlock();
675 virtual uint8 defenseDirMask();
678 virtual uint8 adjustDamage(uint8 damage);
681 virtual int16 fightStanceAction(ObjectID actor);
690 virtual void doBackgroundUpdate(
GameObject *obj);
692 virtual bool resists(effectResistTypes r) {
693 return resistance & (1 << r);
695 virtual bool isImmuneTo(effectImmuneTypes r) {
696 return immunity & (1 << r);
699 virtual bool makeSavingThrow() {
704 virtual bool isObjectBeingUsed(
GameObject *obj);
712 virtual uint8 getSkillValue(ObjectID enactor);
715 virtual void applySkillGrowth(ObjectID enactor, uint8 points = 1);
719 virtual uint16 getViewableRows() {
720 return kViewableRows;
722 virtual uint16 getViewableCols() {
723 return kViewableCols;
725 virtual uint16 getMaxRows() {
728 virtual uint16 getMaxCols() {
733 int16 getChargeType() {
740 virtual uint16 massCapacity(
GameObject *container);
741 virtual uint16 bulkCapacity(
GameObject *container);
756 virtual uint16 containmentSet();
758 virtual bool takeAction(ObjectID dObj, ObjectID enactor, int16 num = 1);
760 virtual bool canDropAt(
764 virtual bool dropAction(
770 virtual bool dropOnAction(
777 virtual bool acceptDropAction(
783 virtual bool acceptStrikeAction(
786 ObjectID strikingObj,
811 virtual uint16 containmentSet();
813 virtual bool canContain(ObjectID dObj, ObjectID item);
814 virtual bool canContainAt(
820 virtual bool useAction(ObjectID dObj, ObjectID enactor);
823 virtual bool canOpen(ObjectID dObj, ObjectID enactor);
824 virtual bool openAction(ObjectID dObj, ObjectID enactor);
827 virtual bool closeAction(ObjectID dObj, ObjectID enactor);
830 virtual bool canToggleLock(
834 virtual bool acceptLockToggleAction(ObjectID dObj, ObjectID enactor, uint8 keyCode);
837 bool acceptInsertionAction(
844 virtual bool acceptInsertionAtAction(
852 virtual uint16 getViewableRows() {
853 return kViewableRows;
855 virtual uint16 getViewableCols() {
856 return kViewableCols;
858 virtual uint16 getMaxRows() {
861 virtual uint16 getMaxCols() {
868 virtual uint16 massCapacity(
GameObject *container);
869 virtual uint16 bulkCapacity(
GameObject *container);
886 virtual bool setUseCursor(ObjectID dObj);
889 virtual bool useOnAction(ObjectID dObj, ObjectID enactor, ObjectID withObj);
892 virtual bool useOnAction(ObjectID dObj, ObjectID enactor,
ActiveItem *withTAI);
907 virtual uint16 containmentSet();
910 virtual bool useAction(ObjectID dObj, ObjectID enactor);
926 virtual uint16 containmentSet();
929 virtual bool useAction(ObjectID dObj, ObjectID enactor);
945 virtual uint16 containmentSet();
959 kInRangeRatingBonus = 4
966 virtual uint16 containmentSet();
970 weaponID getWeaponID();
976 virtual uint8 weaponRating(
979 ObjectID targetID) = 0;
994 virtual bool useAction(ObjectID dObj, ObjectID enactor);
995 virtual bool useOnAction(ObjectID dObj, ObjectID enactor, ObjectID item);
996 virtual bool strikeAction(
1000 virtual bool damageAction(
1004 virtual bool acceptDamageAction(
1008 effectDamageTypes dType,
1015 virtual bool isTwoHanded(ObjectID actor);
1018 virtual void initiateAttack(ObjectID attacker, ObjectID target);
1020 virtual void initiateDefense(
1021 ObjectID defensiveObj,
1025 virtual bool canBlock();
1028 virtual uint8 defenseDirMask();
1035 virtual uint8 weaponRating(
1041 virtual int16 fightStanceAction(ObjectID actor);
1063 virtual uint8 getSkillValue(ObjectID enactor);
1066 virtual void applySkillGrowth(ObjectID enactor, uint8 points = 1);
1084 virtual uint8 getSkillValue(ObjectID enactor);
1087 virtual void applySkillGrowth(ObjectID enactor, uint8 points = 1);
1102 virtual bool useAction(ObjectID dObj, ObjectID enactor);
1105 virtual bool isTwoHanded(ObjectID actor);
1108 virtual void initiateAttack(ObjectID attacker, ObjectID target);
1111 virtual GameObject *getProjectile(ObjectID weapon, ObjectID enactor);
1118 virtual uint8 weaponRating(
1124 virtual int16 fightStanceAction(ObjectID actor);
1139 virtual bool useAction(ObjectID dObj, ObjectID enactor);
1142 virtual bool isTwoHanded(ObjectID actor);
1145 virtual void initiateAttack(ObjectID attacker, ObjectID target);
1152 virtual uint8 weaponRating(
1158 virtual int16 fightStanceAction(ObjectID actor);
1180 virtual bool isMissile();
1183 virtual uint8 weaponRating(
1201 virtual bool useOnAction(ObjectID dObj, ObjectID enactor, ObjectID item);
1202 virtual bool strikeAction(
1206 virtual bool damageAction(
1212 virtual void applySkillGrowth(ObjectID enactor, uint8 points = 1);
1228 virtual uint16 containmentSet();
1230 virtual bool useAction(ObjectID dObj, ObjectID enactor);
1233 virtual uint8 adjustDamage(uint8 damage);
1255 virtual uint16 containmentSet();
1257 virtual bool useAction(ObjectID dObj, ObjectID enactor);
1259 virtual bool acceptDamageAction(
1263 effectDamageTypes dType,
1271 virtual void initiateDefense(
1272 ObjectID defensiveObj,
1275 virtual bool canBlock();
1278 virtual uint8 defenseDirMask();
1289 virtual uint8 getSkillValue(ObjectID enactor);
1292 virtual void applySkillGrowth(ObjectID enactor, uint8 points = 1);
1312 virtual bool setUseCursor(ObjectID dObj);
1315 virtual bool useOnAction(ObjectID dObj, ObjectID enactor, ObjectID withObj);
1330 virtual uint16 containmentSet();
1353 virtual bool useAction(ObjectID dObj, ObjectID enactor);
1370 virtual bool useAction(ObjectID dObj, ObjectID enactor);
1387 virtual bool openAction(ObjectID dObj, ObjectID enactor);
1403 virtual bool useAction(ObjectID dObj, ObjectID enactor);
1405 virtual bool takeAction(ObjectID dObj, ObjectID enactor, int16);
1407 virtual bool canDropAt(
1411 virtual bool dropAction(
1417 virtual bool acceptDropAction(
1420 ObjectID droppedObj,
1423 virtual uint16 containmentSet();
1424 virtual ObjectID placeObject();
1427 virtual void getColorTranslation(ColorTable map);
1446 uint16 containmentSet();
1463 uint16 containmentSet();
1480 uint16 containmentSet();
1499 virtual bool useAction(ObjectID dObj, ObjectID enactor);
1500 virtual bool useOnAction(ObjectID dObj, ObjectID enactor, ObjectID withObj);
1501 virtual bool useOnAction(ObjectID dObj, ObjectID enactor,
ActiveItem *item);
1502 virtual bool useOnAction(ObjectID dObj, ObjectID enactor,
const Location &loc);
1504 virtual bool canDropAt(
1508 virtual bool dropAction(
1513 virtual bool dropOnAction(
1518 virtual bool dropOnAction(
1525 virtual bool implementAction(SpellID dObj, ObjectID enactor, ObjectID withObj);
1526 virtual bool implementAction(SpellID dObj, ObjectID enactor,
ActiveItem *item);
1527 virtual bool implementAction(SpellID dObj, ObjectID enactor,
Location &loc);
1528 uint16 containmentSet();
1529 SpellID getSpellID() {
1530 return (SpellID) lockType;
1547 virtual bool canContain(ObjectID dObj, ObjectID item);
1548 virtual bool useAction(ObjectID dObj, ObjectID enactor);
1549 virtual bool canOpen(ObjectID dObj, ObjectID enactor);
1550 virtual bool openAction(ObjectID dObj, ObjectID enactor);
1551 virtual bool closeAction(ObjectID dObj, ObjectID enactor);
1555 virtual uint16 containmentSet();
1658 virtual uint16 containmentSet();
1675 virtual uint16 containmentSet();
Definition: objproto.h:940
Definition: objproto.h:1381
Definition: objproto.h:1077
Definition: objproto.h:1325
Definition: objproto.h:1599
Definition: objproto.h:1440
Definition: objproto.h:1685
Definition: objproto.h:989
uint16 readUint16LE()
Definition: stream.h:459
Definition: objproto.h:1633
Definition: objproto.h:371
Definition: objproto.h:105
Definition: objproto.h:921
Definition: objproto.h:1616
Definition: objproto.h:1250
Definition: objproto.h:880
Definition: objproto.h:1542
Definition: objproto.h:1223
Definition: objproto.h:95
Definition: tcoords.h:127
Definition: objproto.h:955
Definition: objproto.h:1582
Definition: objproto.h:1668
Definition: objproto.h:1703
Definition: objproto.h:1650
byte readByte()
Definition: stream.h:434
Definition: objproto.h:1721
Definition: objproto.h:1168
Definition: objproto.h:1196
Definition: objproto.h:1398
Definition: objproto.h:1097
Definition: objproto.h:1134
Definition: objproto.h:798
Definition: objects.h:118
Definition: objproto.h:1056
Definition: objproto.h:1565
FORCEINLINE int16 readSint16LE()
Definition: stream.h:543
Definition: objproto.h:751
FORCEINLINE int8 readSByte()
Definition: stream.h:447
Definition: objproto.h:173
Definition: objects.h:1291
Definition: objproto.h:1348
Definition: objproto.h:1493
Definition: objproto.h:1474
Definition: objproto.h:1457
Definition: objproto.h:902