30 #include "common/str.h" 37 #define kDMIgnoreObjectModifiers 0x4000 // @ MASK0x4000_IGNORE_OBJECT_MODIFIERS 38 #define kDMIgnoreTemporaryExperience 0x8000 // @ MASK0x8000_IGNORE_TEMPORARY_EXPERIENCE 43 explicit Scent(uint16 scent = 0): _scent(scent) {}
45 uint16 getMapX() {
return _scent & 0x1F; }
46 uint16 getMapY() {
return (_scent >> 5) & 0x1F; }
47 uint16 getMapIndex() {
return (_scent >> 10) & 0x3F; }
49 void setMapX(uint16 val) { _scent = (_scent & ~0x1F) | (val & 0x1F); }
50 void setMapY(uint16 val) { _scent = (_scent & ~(0x1F << 5)) | (val & 0x1F); }
51 void setMapIndex(uint16 val) { _scent = (_scent & ~(0x1F << 10)) | (val & 0x3F); }
52 void setVal(uint16 val) { _scent = val; }
54 uint16 toUint16() {
return _scent; }
62 int16 _magicalLightAmount;
63 byte _event73Count_ThievesEye;
64 byte _event79Count_Footprints;
67 int16 _fireShieldDefense;
68 int16 _spellShieldDefense;
70 byte _freezeLifeTicks;
71 byte _firstScentIndex;
75 byte _scentStrengths[24];
76 byte _event71Count_Invisibility;
78 _magicalLightAmount = 0;
79 _event73Count_ThievesEye = 0;
80 _event79Count_Footprints = 0;
83 _fireShieldDefense = 0;
84 _spellShieldDefense = 0;
90 for (int16 i = 0; i < 24; ++i) {
92 _scentStrengths[i] = 0;
94 _event71Count_Invisibility = 0;
99 kDMIconIndiceNone = -1,
100 kDMIconIndiceJunkCompassNorth = 0,
101 kDMIconIndiceJunkCompassWest = 3,
102 kDMIconIndiceWeaponTorchUnlit = 4,
103 kDMIconIndiceWeaponTorchLit = 7,
104 kDMIconIndiceJunkWater = 8,
105 kDMIconIndiceJunkWaterSkin = 9,
106 kDMIconIndiceJunkJewelSymalUnequipped = 10,
107 kDMIconIndiceJunkJewelSymalEquipped = 11,
108 kDMIconIndiceJunkIllumuletUnequipped = 12,
109 kDMIconIndiceJunkIllumuletEquipped = 13,
110 kDMIconIndiceWeaponFlamittEmpty = 14,
111 kDMIconIndiceWeaponEyeOfTimeEmpty = 16,
112 kDMIconIndiceWeaponStormringEmpty = 18,
113 kDMIconIndiceWeaponStaffOfClawsEmpty = 20,
114 kDMIconIndiceWeaponStaffOfClawsFull = 22,
115 kDMIconIndiceWeaponBoltBladeStormEmpty = 23,
116 kDMIconIndiceWeaponFuryRaBladeEmpty = 25,
117 kDMIconIndiceWeaponTheFirestaff = 27,
118 kDMIconIndiceWeaponTheFirestaffComplete = 28,
119 kDMIconIndiceScrollOpen = 30,
120 kDMIconIndiceScrollClosed = 31,
121 kDMIconIndiceWeaponDagger = 32,
122 kDMIconIndiceWeaponDeltaSideSplitter = 38,
123 kDMIconIndiceWeaponDiamondEdge = 39,
124 kDMIconIndiceWeaponVorpalBlade = 40,
125 kDMIconIndiceWeaponTheInquisitorDragonFang = 41,
126 kDMIconIndiceWeaponHardcleaveExecutioner = 43,
127 kDMIconIndiceWeaponMaceOfOrder = 45,
128 kDMIconIndiceWeaponArrow = 51,
129 kDMIconIndiceWeaponSlayer = 52,
130 kDMIconIndiceWeaponRock = 54,
131 kDMIconIndiceWeaponPoisonDart = 55,
132 kDMIconIndiceWeaponThrowingStar = 56,
133 kDMIconIndiceWeaponStaff = 58,
134 kDMIconIndiceWeaponWand = 59,
135 kDMIconIndiceWeaponTeowand = 60,
136 kDMIconIndiceWeaponYewStaff = 61,
137 kDMIconIndiceWeaponStaffOfManarStaffOfIrra = 62,
138 kDMIconIndiceWeaponSnakeStaffCrossOfNeta = 63,
139 kDMIconIndiceWeaponTheConduitSerpentStaff = 64,
140 kDMIconIndiceWeaponDragonSpit = 65,
141 kDMIconIndiceWeaponSceptreOfLyf = 66,
142 kDMIconIndiceArmourCloakOfNight = 81,
143 kDMIconIndiceArmourCrownOfNerra = 104,
144 kDMIconIndiceArmourElvenBoots = 119,
145 kDMIconIndiceJunkGemOfAges = 120,
146 kDMIconIndiceJunkEkkhardCross = 121,
147 kDMIconIndiceJunkMoonstone = 122,
148 kDMIconIndiceJunkPendantFeral = 124,
149 kDMIconIndiceJunkBoulder = 128,
150 kDMIconIndiceJunkRabbitsFoot = 137,
151 kDMIconIndiceArmourDexhelm = 140,
152 kDMIconIndiceArmourFlamebain = 141,
153 kDMIconIndiceArmourPowertowers = 142,
154 kDMIconIndiceContainerChestClosed = 144,
155 kDMIconIndiceContainerChestOpen = 145,
156 kDMIconIndiceJunkChampionBones = 147,
157 kDMIconIndicePotionMaPotionMonPotion = 148,
158 kDMIconIndicePotionWaterFlask = 163,
159 kDMIconIndiceJunkApple = 168,
160 kDMIconIndiceJunkIronKey = 176,
161 kDMIconIndiceJunkMasterKey = 191,
162 kDMIconIndiceArmourBootOfSpeed = 194,
163 kDMIconIndicePotionEmptyFlask = 195,
164 kDMIconIndiceJunkZokathra = 197,
165 kDMIconIndiceActionEmptyHand = 201,
166 kDMIconIndiceEyeNotLooking = 202,
167 kDMIconIndiceEyeLooking = 203,
168 kDMIconIndiceEmptyBox = 204,
169 kDMIconIndiceMouthOpen = 205,
170 kDMIconIndiceNeck = 208,
171 kDMIconIndiceReadyHand = 212
175 kDMChampionNone = -1,
176 kDMChampionFirst = 0,
177 kDMChampionSecond = 1,
178 kDMChampionThird = 2,
179 kDMChampionFourth = 3,
180 kDMChampionCloseInventory = 4,
181 kDMChampionSpecialInventory = 5
184 enum ChampionAttribute {
185 kDMAttributNone = 0x0000,
186 kDMAttributeDisableAction = 0x0008,
187 kDMAttributeMale = 0x0010,
188 kDMAttributeNameTitle = 0x0080,
189 kDMAttributeStatistics = 0x0100,
190 kDMAttributeLoad = 0x0200,
191 kDMAttributeIcon = 0x0400,
192 kDMAttributePanel = 0x0800,
193 kDMAttributeStatusBox = 0x1000,
194 kDMAttributeWounds = 0x2000,
195 kDMAttributeViewport = 0x4000,
196 kDMAttributeActionHand = 0x8000
200 kDMWoundNone = 0x0000,
201 kDMWoundReadHand = 0x0001,
202 kDMWoundActionHand = 0x0002,
203 kDMWoundHead = 0x0004,
204 kDMWoundTorso = 0x0008,
205 kDMWoundLegs = 0x0010,
206 kDMWoundFeet = 0x0020
209 enum ChampionStatType {
212 kDMStatDexterity = 2,
215 kDMStatAntimagic = 5,
220 enum ChampionStatValue {
239 kDMSkillIdentify = 12,
241 kDMSkillInfluence = 14,
250 kDMSlotLeaderHand = -1,
251 kDMSlotReadyHand = 0,
252 kDMSlotActionHand = 1,
258 kDMSlotQuiverLine2_1 = 7,
259 kDMSlotQuiverLine1_2 = 8,
260 kDMSlotQuiverLine2_2 = 9,
263 kDMSlotQuiverLine1_1 = 12,
264 kDMSlotBackpackLine1_1 = 13,
265 kDMSlotBackpackLine2_2 = 14,
266 kDMSlotBackpackLine2_3 = 15,
267 kDMSlotBackpackLine2_4 = 16,
268 kDMSlotBackpackLine2_5 = 17,
269 kDMSlotBackpackLine2_6 = 18,
270 kDMSlotBackpackLine2_7 = 19,
271 kDMSlotBackpackLine2_8 = 20,
272 kDMSlotBackpackLine2_9 = 21,
273 kDMSlotBackpackLine1_2 = 22,
274 kDMSlotBackpackLine1_3 = 23,
275 kDMSlotBackpackLine1_4 = 24,
276 kDMSlotBackpackLine1_5 = 25,
277 kDMSlotBackpackLine1_6 = 26,
278 kDMSlotBackpackLine1_7 = 27,
279 kDMSlotBackpackLine1_8 = 28,
280 kDMSlotBackpackLine1_9 = 29,
291 enum ChampionAction {
296 kDMActionBlowHorn = 4,
302 kDMActionClimbDown = 10,
303 kDMActionFreezeLife = 11,
306 kDMActionStab14 = 14,
307 kDMActionThrust = 15,
311 kDMActionBerzerk = 19,
312 kDMActionFireball = 20,
313 kDMActionDispel = 21,
314 kDMActionConfuse = 22,
315 kDMActionLightning = 23,
316 kDMActionDisrupt = 24,
318 kDMActionX_C026 = 26,
319 kDMActionInvoke = 27,
321 kDMActionCleave = 29,
325 kDMActionSpellshield = 33,
326 kDMActionFireshield = 34,
327 kDMActionFluxcage = 35,
331 kDMActionWindow = 39,
333 kDMActionBrandish = 41,
340 kDMAttackTypeNormal = 0,
341 kDMAttackTypeFire = 1,
342 kDMAttackTypeSelf = 2,
343 kDMAttackTypeBlunt = 3,
344 kDMAttackTypeSharp = 4,
345 kDMAttackTypeMagic = 5,
346 kDMAttackTypePsychic = 6,
347 kDMAttackTypeLightning = 7
350 enum SpellCastResult {
351 kDMSpellCastFailure = 0,
352 kDMSpellCastSuccess = 1,
353 kDMSpellCastFailureNeedsFlask = 3
357 kDMFailureNeedsMorePractice = 0,
358 kDMFailureMeaninglessSpell = 1,
359 kDMFailureNeedsFlaskInHand = 10,
360 kDMFailureNeedsMagicMapInHand = 11
364 kDMSpellKindPotion = 1,
365 kDMSpellKindProjectile = 2,
366 kDMSpellKindOther = 3,
367 kDMSpellKindMagicMap = 4
371 kDMSpellTypeProjectileOpenDoor = 4,
372 kDMSpellTypeOtherLight = 0,
373 kDMSpellTypeOtherDarkness = 1,
374 kDMSpellTypeOtherThievesEye = 2,
375 kDMSpellTypeOtherInvisibility = 3,
376 kDMSpellTypeOtherPartyShield = 4,
377 kDMSpellTypeOtherMagicTorch = 5,
378 kDMSpellTypeOtherFootprints = 6,
379 kDMSpellTypeOtherZokathra = 7,
380 kDMSpellTypeOtherFireshield = 8,
381 kDMSpellTypeMagicMap0 = 0,
382 kDMSpellTypeMagicMap1 = 1,
383 kDMSpellTypeMagicMap2 = 2,
384 kDMSpellTypeMagicMap3 = 3
387 #define kDMMaskNoSharpDefense 0x0000 // @ MASK0x0000_DO_NOT_USE_SHARP_DEFENSE 388 #define kDMMaskSharpDefense 0x8000 // @ MASK0x8000_USE_SHARP_DEFENSE 392 int16 _temporaryExperience;
395 Skill() : _temporaryExperience(0), _experience(0) {}
396 void resetToZero() { _temporaryExperience = _experience = 0; }
406 byte _statistics[7][3];
413 ChampionAction _actionIndex;
416 uint16 _directionMaximumDamageReceived;
417 uint16 _maximumDamageReceived;
418 uint16 _poisonEventCount;
419 int16 _enableActionEventIndex;
420 int16 _hideDamageReceivedIndex;
427 int16 _actionDefense;
431 int16 _shieldDefense;
434 Champion() : _vm(
nullptr), _attributes(0), _wounds(0), _dir(kDMDirNorth), _cell(kDMViewCellFronLeft),
435 _actionIndex(kDMActionN), _symbolStep(0), _directionMaximumDamageReceived(0),
436 _maximumDamageReceived(0), _poisonEventCount(0), _enableActionEventIndex(0),
437 _hideDamageReceivedIndex(0), _currHealth(0), _maxHealth(0), _currStamina(0),
438 _maxStamina(0), _currMana(0), _maxMana(0), _actionDefense(0), _food(0), _water(0),
439 _load(0), _shieldDefense(0) {
440 memset(_statistics, 0,
sizeof(_statistics));
441 memset(_name,
'\0',
sizeof(_name));
442 memset(_title,
'\0',
sizeof(_title));
443 memset(_symbols,
'\0',
sizeof(_symbols));
444 memset(_portrait, 0,
sizeof(_portrait));
446 void setVm(
DMEngine *vm) { _vm = vm; }
448 Thing &getSlot(ChampionSlot slot) {
return _slots[slot]; }
449 void setSlot(ChampionSlot slot,
Thing val) { _slots[slot] = val; }
451 Skill &getSkill(ChampionSkill skill) {
return _skills[skill]; }
452 void setSkillExp(ChampionSkill skill, int32 val) { _skills[skill]._experience = val; }
453 void setSkillTempExp(ChampionSkill skill, int16 val) { _skills[skill]._temporaryExperience= val; }
455 byte& getStatistic(ChampionStatType type, ChampionStatValue valType) {
return _statistics[type][valType]; }
456 void setStatistic(ChampionStatType type, ChampionStatValue valType, byte newVal) { _statistics[type][valType] = newVal; }
458 uint16 getAttributes() {
return _attributes; }
459 uint16 getAttributes(ChampionAttribute flag) {
return _attributes & flag; }
460 void setAttributeFlag(ChampionAttribute flag,
bool value);
461 void clearAttributes(ChampionAttribute attribute = kDMAttributNone) { _attributes = attribute; }
463 uint16 getWounds() {
return _wounds; }
464 void setWoundsFlag(ChampionWound flag,
bool value);
465 uint16 getWoundsFlag(ChampionWound wound) {
return _wounds & wound; }
466 void clearWounds() { _wounds = kDMWoundNone; }
467 void resetSkillsToZero() {
468 for (int16 i = 0; i < 20; ++i)
469 _skills[i].resetToZero();
477 Spell() : _symbols(0), _baseRequiredSkillLevel(0), _skillIndex(0), _attributes(0) {}
478 Spell(int32 symbols, byte baseSkillReq, byte skillIndex, uint16 attributes)
479 : _symbols(symbols), _baseRequiredSkillLevel(baseSkillReq), _skillIndex(skillIndex), _attributes(attributes) {}
482 byte _baseRequiredSkillLevel;
486 uint16 getKind() {
return _attributes & 0xF; }
487 uint16 getType() {
return (_attributes >> 4) & 0x3F; }
488 uint16 getDuration() {
return (_attributes >> 10) & 0x3F; }
494 uint16 getChampionPortraitX(uint16 index);
495 uint16 getChampionPortraitY(uint16 index);
497 int16 getDecodedValue(
char *
string, uint16 characterCount);
498 void drawHealthOrStaminaOrManaValue(int16 posy, int16 currVal, int16 maxVal);
499 uint16 getHandSlotIndex(uint16 slotBoxIndex);
500 int16 _championPendingWounds[4];
501 int16 _championPendingDamage[4];
503 void initConstants();
508 uint16 _partyChampionCount;
510 Thing _leaderHandObject;
511 ChampionIndex _leaderIndex;
512 uint16 _candidateChampionOrdinal;
513 bool _partyIsSleeping;
514 uint16 _actingChampionOrdinal;
515 IconIndice _leaderHandObjectIconIndex;
516 bool _leaderEmptyHanded;
518 ChampionIndex _magicCasterChampionIndex;
519 bool _mousePointerHiddenToDrawChangedObjIconOnScreen;
524 ChampionIndex getIndexInCell(int16 cell);
525 bool isLeaderHandObjectThrown(int16 side);
526 bool isObjectThrown(uint16 champIndex, int16 slotIndex, int16 side);
527 void resetDataToStartGame();
528 void addCandidateChampionToParty(uint16 championPortraitIndex);
529 void drawChampionBarGraphs(ChampionIndex champIndex);
530 uint16 getStaminaAdjustedValue(
Champion *champ, int16 val);
531 uint16 getMaximumLoad(
Champion *champ);
532 void drawChampionState(ChampionIndex champIndex);
533 uint16 getChampionIconIndex(int16 val, Direction dir);
534 void drawHealthStaminaManaValues(
Champion *champ);
535 void drawSlot(uint16 champIndex, int16 slotIndex);
536 void renameChampion(
Champion *champ);
537 uint16 getSkillLevel(int16 champIndex, uint16 skillIndex);
538 Common::String getStringFromInteger(uint16 val,
bool padding, uint16 paddingCharCount);
539 void applyModifiersToStatistics(
Champion *champ, int16 slotIndex, int16 iconIndex,
540 int16 modifierFactor,
Thing thing);
541 bool hasObjectIconInSlotBoxChanged(int16 slotBoxIndex,
Thing thing);
542 void drawChangedObjectIcons();
543 void addObjectInSlot(ChampionIndex champIndex,
Thing thing, ChampionSlot slotIndex);
544 int16 getScentOrdinal(int16 mapX, int16 mapY);
545 Thing getObjectRemovedFromLeaderHand();
546 uint16 getStrength(int16 champIndex, int16 slotIndex);
547 Thing getObjectRemovedFromSlot(uint16 champIndex, uint16 slotIndex);
548 void decrementStamina(int16 championIndex, int16 decrement);
549 int16 addPendingDamageAndWounds_getDamage(int16 champIndex, int16 attack, int16 allowedWounds,
551 int16 getWoundDefense(int16 champIndex, uint16 woundIndex);
552 uint16 getStatisticAdjustedAttack(
Champion *champ, uint16 statIndex, uint16 attack);
554 int16 getThrowingStaminaCost(
Thing thing);
555 void disableAction(uint16 champIndex, uint16 ticks);
556 void addSkillExperience(uint16 champIndex, uint16 skillIndex, uint16 exp);
557 int16 getDamagedChampionCount(uint16 attack, int16 wounds,
559 int16 getTargetChampionIndex(int16 mapX, int16 mapY, uint16 cell);
560 int16 getDexterity(
Champion *champ);
561 bool isLucky(
Champion *champ, uint16 percentage);
562 void championPoison(int16 championIndex, uint16 attack);
563 void setPartyDirection(int16 dir);
564 void deleteScent(uint16 scentIndex);
565 void addScentStrength(int16 mapX, int16 mapY, int32 cycleCount);
566 void putObjectInLeaderHand(
Thing thing,
bool setMousePointer);
567 int16 getMovementTicks(
Champion *champ);
568 bool isAmmunitionCompatibleWithWeapon(uint16 champIndex, uint16 weaponSlotIndex,
569 uint16 ammunitionSlotIndex);
570 void drawAllChampionStates();
571 void viAltarRebirth(uint16 champIndex);
572 void clickOnSlotBox(uint16 slotBoxIndex);
573 bool isProjectileSpellCast(uint16 champIndex,
Thing thing, int16 kineticEnergy, uint16 requiredManaAmount);
574 void championShootProjectile(
Champion *champ,
Thing thing, int16 kineticEnergy,
575 int16 attack, int16 stepEnergy);
576 void applyAndDrawPendingDamageAndWounds();
577 void championKill(uint16 champIndex);
578 void dropAllObjects(uint16 champIndex);
579 void unpoison(int16 champIndex);
580 void applyTimeEffects();
584 Box _boxChampionIcons[4];
585 Color _championColor[4];
586 int16 _lightPowerToLightAmount[16];
587 Box _boxChampionPortrait;
588 uint16 _slotMasks[38];
589 const char *_baseSkillName[4];
Definition: champion.h:40
Definition: champion.h:475
Definition: champion.h:390
Definition: champion.h:57
Definition: champion.h:35
Definition: champion.h:491
Definition: champion.h:399