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 void resetToZero() { _temporaryExperience = _experience = 0; }
405 byte _statistics[7][3];
412 ChampionAction _actionIndex;
415 uint16 _directionMaximumDamageReceived;
416 uint16 _maximumDamageReceived;
417 uint16 _poisonEventCount;
418 int16 _enableActionEventIndex;
419 int16 _hideDamageReceivedIndex;
426 int16 _actionDefense;
430 int16 _shieldDefense;
434 void setVm(
DMEngine *vm) { _vm = vm; }
436 Thing &getSlot(ChampionSlot slot) {
return _slots[slot]; }
437 void setSlot(ChampionSlot slot,
Thing val) { _slots[slot] = val; }
439 Skill &getSkill(ChampionSkill skill) {
return _skills[skill]; }
440 void setSkillExp(ChampionSkill skill, int32 val) { _skills[skill]._experience = val; }
441 void setSkillTempExp(ChampionSkill skill, int16 val) { _skills[skill]._temporaryExperience= val; }
443 byte& getStatistic(ChampionStatType type, ChampionStatValue valType) {
return _statistics[type][valType]; }
444 void setStatistic(ChampionStatType type, ChampionStatValue valType, byte newVal) { _statistics[type][valType] = newVal; }
446 uint16 getAttributes() {
return _attributes; }
447 uint16 getAttributes(ChampionAttribute flag) {
return _attributes & flag; }
448 void setAttributeFlag(ChampionAttribute flag,
bool value);
449 void clearAttributes(ChampionAttribute attribute = kDMAttributNone) { _attributes = attribute; }
451 uint16 getWounds() {
return _wounds; }
452 void setWoundsFlag(ChampionWound flag,
bool value);
453 uint16 getWoundsFlag(ChampionWound wound) {
return _wounds & wound; }
454 void clearWounds() { _wounds = kDMWoundNone; }
455 void resetSkillsToZero() {
456 for (int16 i = 0; i < 20; ++i)
457 _skills[i].resetToZero();
466 Spell(int32 symbols, byte baseSkillReq, byte skillIndex, uint16 attributes)
467 : _symbols(symbols), _baseRequiredSkillLevel(baseSkillReq), _skillIndex(skillIndex), _attributes(attributes) {}
470 byte _baseRequiredSkillLevel;
474 uint16 getKind() {
return _attributes & 0xF; }
475 uint16 getType() {
return (_attributes >> 4) & 0x3F; }
476 uint16 getDuration() {
return (_attributes >> 10) & 0x3F; }
482 uint16 getChampionPortraitX(uint16 index);
483 uint16 getChampionPortraitY(uint16 index);
485 int16 getDecodedValue(
char *
string, uint16 characterCount);
486 void drawHealthOrStaminaOrManaValue(int16 posy, int16 currVal, int16 maxVal);
487 uint16 getHandSlotIndex(uint16 slotBoxIndex);
488 int16 _championPendingWounds[4];
489 int16 _championPendingDamage[4];
491 void initConstants();
496 uint16 _partyChampionCount;
498 Thing _leaderHandObject;
499 ChampionIndex _leaderIndex;
500 uint16 _candidateChampionOrdinal;
501 bool _partyIsSleeping;
502 uint16 _actingChampionOrdinal;
503 IconIndice _leaderHandObjectIconIndex;
504 bool _leaderEmptyHanded;
506 ChampionIndex _magicCasterChampionIndex;
507 bool _mousePointerHiddenToDrawChangedObjIconOnScreen;
512 ChampionIndex getIndexInCell(int16 cell);
513 bool isLeaderHandObjectThrown(int16 side);
514 bool isObjectThrown(uint16 champIndex, int16 slotIndex, int16 side);
515 void resetDataToStartGame();
516 void addCandidateChampionToParty(uint16 championPortraitIndex);
517 void drawChampionBarGraphs(ChampionIndex champIndex);
518 uint16 getStaminaAdjustedValue(
Champion *champ, int16 val);
519 uint16 getMaximumLoad(
Champion *champ);
520 void drawChampionState(ChampionIndex champIndex);
521 uint16 getChampionIconIndex(int16 val, Direction dir);
522 void drawHealthStaminaManaValues(
Champion *champ);
523 void drawSlot(uint16 champIndex, int16 slotIndex);
524 void renameChampion(
Champion *champ);
525 uint16 getSkillLevel(int16 champIndex, uint16 skillIndex);
526 Common::String getStringFromInteger(uint16 val,
bool padding, uint16 paddingCharCount);
527 void applyModifiersToStatistics(
Champion *champ, int16 slotIndex, int16 iconIndex,
528 int16 modifierFactor,
Thing thing);
529 bool hasObjectIconInSlotBoxChanged(int16 slotBoxIndex,
Thing thing);
530 void drawChangedObjectIcons();
531 void addObjectInSlot(ChampionIndex champIndex,
Thing thing, ChampionSlot slotIndex);
532 int16 getScentOrdinal(int16 mapX, int16 mapY);
533 Thing getObjectRemovedFromLeaderHand();
534 uint16 getStrength(int16 champIndex, int16 slotIndex);
535 Thing getObjectRemovedFromSlot(uint16 champIndex, uint16 slotIndex);
536 void decrementStamina(int16 championIndex, int16 decrement);
537 int16 addPendingDamageAndWounds_getDamage(int16 champIndex, int16 attack, int16 allowedWounds,
539 int16 getWoundDefense(int16 champIndex, uint16 woundIndex);
540 uint16 getStatisticAdjustedAttack(
Champion *champ, uint16 statIndex, uint16 attack);
542 int16 getThrowingStaminaCost(
Thing thing);
543 void disableAction(uint16 champIndex, uint16 ticks);
544 void addSkillExperience(uint16 champIndex, uint16 skillIndex, uint16 exp);
545 int16 getDamagedChampionCount(uint16 attack, int16 wounds,
547 int16 getTargetChampionIndex(int16 mapX, int16 mapY, uint16 cell);
548 int16 getDexterity(
Champion *champ);
549 bool isLucky(
Champion *champ, uint16 percentage);
550 void championPoison(int16 championIndex, uint16 attack);
551 void setPartyDirection(int16 dir);
552 void deleteScent(uint16 scentIndex);
553 void addScentStrength(int16 mapX, int16 mapY, int32 cycleCount);
554 void putObjectInLeaderHand(
Thing thing,
bool setMousePointer);
555 int16 getMovementTicks(
Champion *champ);
556 bool isAmmunitionCompatibleWithWeapon(uint16 champIndex, uint16 weaponSlotIndex,
557 uint16 ammunitionSlotIndex);
558 void drawAllChampionStates();
559 void viAltarRebirth(uint16 champIndex);
560 void clickOnSlotBox(uint16 slotBoxIndex);
561 bool isProjectileSpellCast(uint16 champIndex,
Thing thing, int16 kineticEnergy, uint16 requiredManaAmount);
562 void championShootProjectile(
Champion *champ,
Thing thing, int16 kineticEnergy,
563 int16 attack, int16 stepEnergy);
564 void applyAndDrawPendingDamageAndWounds();
565 void championKill(uint16 champIndex);
566 void dropAllObjects(uint16 champIndex);
567 void unpoison(int16 champIndex);
568 void applyTimeEffects();
572 Box _boxChampionIcons[4];
573 Color _championColor[4];
574 int16 _lightPowerToLightAmount[16];
575 Box _boxChampionPortrait;
576 uint16 _slotMasks[38];
577 const char *_baseSkillName[4];
Definition: savefile.h:54
Definition: champion.h:40
Definition: champion.h:463
Definition: champion.h:390
Definition: champion.h:57
Definition: champion.h:35
Definition: champion.h:479
Definition: champion.h:398