aboutsummaryrefslogtreecommitdiff
path: root/engines/dm
diff options
context:
space:
mode:
authorBendegúz Nagy2016-08-26 22:50:30 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commit9c79d02a1fb7c30cd47a8c0392b05642f2be12a3 (patch)
tree0cabcff0a5a31f9c9d9a5fb4b457ee05ffc87c91 /engines/dm
parent14bef5326a0c9939c3a8d669ffba7e2d86ddf295 (diff)
downloadscummvm-rg350-9c79d02a1fb7c30cd47a8c0392b05642f2be12a3.tar.gz
scummvm-rg350-9c79d02a1fb7c30cd47a8c0392b05642f2be12a3.tar.bz2
scummvm-rg350-9c79d02a1fb7c30cd47a8c0392b05642f2be12a3.zip
DM: Add missing code to command move party
Diffstat (limited to 'engines/dm')
-rw-r--r--engines/dm/champion.cpp363
-rw-r--r--engines/dm/champion.h1
-rw-r--r--engines/dm/dm.cpp4
-rw-r--r--engines/dm/dungeonman.h2
-rw-r--r--engines/dm/eventman.cpp142
-rw-r--r--engines/dm/eventman.h2
6 files changed, 318 insertions, 196 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp
index dc77567daf..6973d0fe73 100644
--- a/engines/dm/champion.cpp
+++ b/engines/dm/champion.cpp
@@ -176,8 +176,8 @@ bool ChampionMan::f328_isObjectThrown(uint16 champIndex, int16 slotIndex, int16
AL0994_i_Attack = f26_getBoundedValue((uint16)40, (uint16)((AL0995_i_SkillLevel << 3) + _vm->_rnd->getRandomNumber(31)), (uint16)200);
AL0995_i_StepEnergy = MAX(5, 11 - AL0995_i_SkillLevel);
_vm->_projexpl->f212_projectileCreate(L0996_T_Thing, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY,
- M21_normalizeModulo4(_vm->_dungeonMan->_g308_partyDir + side),
- _vm->_dungeonMan->_g308_partyDir, L0993_i_KineticEnergy, AL0994_i_Attack, AL0995_i_StepEnergy);
+ M21_normalizeModulo4(_vm->_dungeonMan->_g308_partyDir + side),
+ _vm->_dungeonMan->_g308_partyDir, L0993_i_KineticEnergy, AL0994_i_Attack, AL0995_i_StepEnergy);
_vm->_g311_projectileDisableMovementTicks = 4;
_vm->_g312_lastProjectileDisabledMovementDirection = _vm->_dungeonMan->_g308_partyDir;
f292_drawChampionState((ChampionIndex)champIndex);
@@ -1102,12 +1102,12 @@ void ChampionMan::f317_addScentStrength(int16 mapX, int16 mapY, int32 cycleCount
if (!L0956_B_CycleCountDefined) {
L0956_B_CycleCountDefined = true;
if (L0955_B_Merge) {
- cycleCount = MAX((int32)_vm->_championMan->_g407_party._scentStrengths[L0954_i_ScentIndex], cycleCount);
+ cycleCount = MAX((int32)_g407_party._scentStrengths[L0954_i_ScentIndex], cycleCount);
} else {
- cycleCount = MIN(80, _vm->_championMan->_g407_party._scentStrengths[L0954_i_ScentIndex] + cycleCount);
+ cycleCount = MIN(80, _g407_party._scentStrengths[L0954_i_ScentIndex] + cycleCount);
}
}
- _vm->_championMan->_g407_party._scentStrengths[L0954_i_ScentIndex] = cycleCount;
+ _g407_party._scentStrengths[L0954_i_ScentIndex] = cycleCount;
}
}
}
@@ -1117,8 +1117,10 @@ void ChampionMan::f297_putObjectInLeaderHand(Thing thing, bool setMousePointer)
if (thing == Thing::_none) {
return;
}
- _vm->_championMan->_g415_leaderEmptyHanded = false;
- _vm->_objectMan->f36_extractIconFromBitmap(_vm->_championMan->_g413_leaderHandObjectIconIndex = _vm->_objectMan->f33_getIconIndex(_vm->_championMan->_g414_leaderHandObject = thing), _vm->_objectMan->_g412_objectIconForMousePointer);
+ _g415_leaderEmptyHanded = false;
+ _vm->_objectMan->f36_extractIconFromBitmap(_g413_leaderHandObjectIconIndex = _vm->_objectMan->f33_getIconIndex(_g414_leaderHandObject = thing), _vm->_objectMan->_g412_objectIconForMousePointer);
+
+
_vm->_eventMan->f78_showMouse();
_vm->_objectMan->f34_drawLeaderObjectName(thing);
if (setMousePointer) {
@@ -1127,11 +1129,38 @@ void ChampionMan::f297_putObjectInLeaderHand(Thing thing, bool setMousePointer)
_vm->_eventMan->f68_setPointerToObject(_vm->_objectMan->_g412_objectIconForMousePointer);
}
_vm->_eventMan->f77_hideMouse();
- if (_vm->_championMan->_g411_leaderIndex != kM1_ChampionNone) {
- _vm->_championMan->_gK71_champions[_vm->_championMan->_g411_leaderIndex]._load += _vm->_dungeonMan->f140_getObjectWeight(thing);
- setFlag(_vm->_championMan->_gK71_champions[_vm->_championMan->_g411_leaderIndex]._attributes, k0x0200_ChampionAttributeLoad);
- _vm->_championMan->f292_drawChampionState(_vm->_championMan->_g411_leaderIndex);
+ if (_g411_leaderIndex != kM1_ChampionNone) {
+ _gK71_champions[_g411_leaderIndex]._load += _vm->_dungeonMan->f140_getObjectWeight(thing);
+ setFlag(_gK71_champions[_g411_leaderIndex]._attributes, k0x0200_ChampionAttributeLoad);
+ f292_drawChampionState(_g411_leaderIndex);
+ }
+}
+
+int16 ChampionMan::f310_getMovementTicks(Champion* champ) {
+ uint16 L0931_ui_Multiple;
+#define AL0931_ui_Load L0931_ui_Multiple
+#define AL0931_ui_WoundTicks L0931_ui_Multiple
+ uint16 L0932_ui_MaximumLoad;
+ int16 L0933_i_Ticks;
+
+
+ if ((L0932_ui_MaximumLoad = _vm->_championMan->f309_getMaximumLoad(champ)) > (AL0931_ui_Load = champ->_load)) { /* BUG0_72 The party moves very slowly even though no champion 'Load' value is drawn in red. When the Load of a champion has exactly the maximum value he can carry then the Load is drawn in yellow but the speed is the same as when the champion is overloaded (when the Load is drawn in red). The comparison operator should be >= instead of > */
+ L0933_i_Ticks = 2;
+ if (((int32)AL0931_ui_Load << 3) > ((int32)L0932_ui_MaximumLoad * 5)) {
+ L0933_i_Ticks++;
+ }
+ AL0931_ui_WoundTicks = 1;
+ } else {
+ L0933_i_Ticks = 4 + (((AL0931_ui_Load - L0932_ui_MaximumLoad) << 2) / L0932_ui_MaximumLoad);
+ AL0931_ui_WoundTicks = 2;
}
+ if (getFlag(champ->_wounds, k0x0020_ChampionWoundFeet)) {
+ L0933_i_Ticks += AL0931_ui_WoundTicks;
+ }
+ if (_vm->_objectMan->f33_getIconIndex(champ->_slots[k5_ChampionSlotFeet]) == k194_IconIndiceArmourBootOfSpeed) {
+ L0933_i_Ticks--;
+ }
+ return L0933_i_Ticks;
}
ChampionIndex ChampionMan::f285_getIndexInCell(int16 cell) {
@@ -1156,180 +1185,180 @@ void ChampionMan::f278_resetDataToStartGame() {
void ChampionMan::f280_addCandidateChampionToParty(uint16 championPortraitIndex) {
- DisplayMan &dispMan = *_vm->_displayMan;
- DungeonMan &dunMan = *_vm->_dungeonMan;
-
- if (!_g415_leaderEmptyHanded || _g305_partyChampionCount == 4)
+ Thing L0793_T_Thing;
+ uint16 L0794_ui_Multiple;
+#define AL0794_ui_ViewCell L0794_ui_Multiple
+#define AL0794_ui_SlotIndex L0794_ui_Multiple
+#define AL0794_ui_CharacterIndex L0794_ui_Multiple
+#define AL0794_ui_StatisticIndex L0794_ui_Multiple
+#define AL0794_ui_SkillIndex L0794_ui_Multiple
+ int16 L0795_i_HiddenSkillIndex;
+ uint16 L0796_ui_Multiple;
+#define AL0796_ui_Character L0796_ui_Multiple
+#define AL0796_ui_SkillValue L0796_ui_Multiple
+#define AL0796_ui_ThingType L0796_ui_Multiple
+ Champion* L0797_ps_Champion;
+ char* L0798_pc_Character;
+ uint16 L0799_ui_PreviousPartyChampionCount;
+ uint16 L0800_ui_Multiple;
+#define AL0800_B_ChampionTitleCopied L0800_ui_Multiple
+#define AL0800_ui_HiddenSkillCounter L0800_ui_Multiple
+ uint16 L0801_ui_SlotIndex;
+ int16 L0802_i_MapX;
+ int16 L0803_i_MapY;
+ uint16 L0804_ui_ChampionObjectsCell;
+ int16 L0805_i_ObjectAllowedSlots;
+ int32 L0806_l_BaseSkillExperience;
+ char L0807_ac_DecodedChampionText[77];
+
+ if (!_vm->_championMan->_g415_leaderEmptyHanded) {
return;
-
- uint16 prevChampCount = _g305_partyChampionCount;
- Champion *champ = &_gK71_champions[prevChampCount];
- champ->resetToZero();
- dispMan._g578_useByteBoxCoordinates = true;
- { // limit destBox scope
- Box &destBox = gBoxChampionPortrait;
- dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(k26_ChampionPortraitsIndice), champ->_portrait,
- destBox, M27_getChampionPortraitX(championPortraitIndex), M28_getChampionPortraitY(championPortraitIndex), 128, 16, kM1_ColorNoTransparency);
- }
-
- champ->_actionIndex = k255_ChampionActionNone;
- champ->_enableActionEventIndex = -1;
- champ->_hideDamageReceivedIndex = -1;
- champ->_dir = dunMan._g308_partyDir;
- ViewCell AL_0_viewCell = k0_ViewCellFronLeft;
- while (f285_getIndexInCell((ViewCell)((AL_0_viewCell + dunMan._g308_partyDir) & 3)) != kM1_ChampionNone)
- AL_0_viewCell = (ViewCell)(AL_0_viewCell + 1);
- champ->_cell = (ViewCell)((AL_0_viewCell + dunMan._g308_partyDir) & 3);
- champ->clearAttributes(k0x0400_ChampionAttributeIcon);
- champ->_directionMaximumDamageReceived = dunMan._g308_partyDir;
- champ->_food = 1500 + _vm->_rnd->getRandomNumber(256);
- champ->_water = 1500 + _vm->_rnd->getRandomNumber(256);
- int16 AL_0_slotIndex_Red;
- for (AL_0_slotIndex_Red = k0_ChampionSlotReadyHand; AL_0_slotIndex_Red < k30_ChampionSlotChest_1; ++AL_0_slotIndex_Red) {
- champ->setSlot((ChampionSlot)AL_0_slotIndex_Red, Thing::_none);
- }
- Thing thing = dunMan.f161_getSquareFirstThing(dunMan._g306_partyMapX, dunMan._g307_partyMapY);
- while (thing.getType() != k2_TextstringType) {
- thing = dunMan.f159_getNextThing(thing);
- }
- char decodedChampionText[77];
- char* character_Green = decodedChampionText;
- dunMan.f168_decodeText(character_Green, thing, (TextType)(k2_TextTypeScroll | k0x8000_DecodeEvenIfInvisible));
- int16 AL_0_characterIndex = 0;
- uint16 AL_2_character;
- while ((AL_2_character = *character_Green++) != '\n') {
- champ->_name[AL_0_characterIndex++] = AL_2_character;
- }
- champ->_name[AL_0_characterIndex] = '\0';
- AL_0_characterIndex = 0;
- bool AL_4_champTitleCopied = false;
- for (;;) { // infinite
- AL_2_character = *character_Green++;
- if (AL_2_character == '\n') {
- if (AL_4_champTitleCopied)
- break;
- AL_4_champTitleCopied = true;
- } else {
- champ->_title[AL_0_characterIndex++] = AL_2_character;
- }
- }
- champ->_title[AL_0_characterIndex] = '\0';
- if (*character_Green++ == 'M') {
- champ->setAttributeFlag(k0x0010_ChampionAttributeMale, true);
}
- character_Green++;
- champ->_currHealth = champ->_maxHealth = f279_getDecodedValue(character_Green, 4);
- character_Green += 4;
- champ->_currStamina = champ->_maxStamina = f279_getDecodedValue(character_Green, 4);
- character_Green += 4;
- champ->_currMana = champ->_maxMana = f279_getDecodedValue(character_Green, 4);
- character_Green += 4;
- character_Green++;
-
- int16 AL_0_statisticIndex;
- for (AL_0_statisticIndex = k0_ChampionStatLuck; AL_0_statisticIndex <= k6_ChampionStatAntifire; ++AL_0_statisticIndex) {
- champ->setStatistic((ChampionStatisticType)AL_0_statisticIndex, k2_ChampionStatMinimum, 30);
- uint16 currMaxVal = f279_getDecodedValue(character_Green, 2);
- champ->setStatistic((ChampionStatisticType)AL_0_statisticIndex, k1_ChampionStatCurrent, currMaxVal);
- champ->setStatistic((ChampionStatisticType)AL_0_statisticIndex, k0_ChampionStatMaximum, currMaxVal);
- character_Green += 2;
- }
-
- champ->setStatistic(k0_ChampionStatLuck, k2_ChampionStatMinimum, 10);
- character_Green++;
-
- int16 AL_0_skillIndex;
- int16 AL_2_skillValue;
- for (AL_0_skillIndex = k4_ChampionSkillSwing; AL_0_skillIndex <= k19_ChampionSkillWater; AL_0_skillIndex++) {
- if ((AL_2_skillValue = *character_Green++ - 'A') > 0) {
- champ->setSkillExp((ChampionSkill)AL_0_skillIndex, 125L << AL_2_skillValue);
- }
- }
-
- for (AL_0_skillIndex = k0_ChampionSkillFighter; AL_0_skillIndex <= k3_ChampionSkillWizard; ++AL_0_skillIndex) {
- int32 baseSkillExp = 0;
- int16 hiddenSkillIndex = (AL_0_skillIndex + 1) << 2;
- for (uint16 AL_4_hiddenSkillCounter = 0; AL_4_hiddenSkillCounter < 4; ++AL_4_hiddenSkillCounter) {
- baseSkillExp += champ->getSkill((ChampionSkill)(hiddenSkillIndex + AL_4_hiddenSkillCounter))._experience;
- }
- champ->setSkillExp((ChampionSkill)AL_0_skillIndex, baseSkillExp);
+ if (_vm->_championMan->_g305_partyChampionCount == 4) {
+ return;
}
-
- _g299_candidateChampionOrdinal = prevChampCount + 1;
- if (++_g305_partyChampionCount == 1) {
+ L0797_ps_Champion = &_vm->_championMan->_gK71_champions[L0799_ui_PreviousPartyChampionCount = _vm->_championMan->_g305_partyChampionCount];
+ L0797_ps_Champion->resetToZero();
+ // Strangerke - TODO: Check if the new code is possible to run on the older version (example: the portaits could be missing in the data)
+ _vm->_displayMan->_g578_useByteBoxCoordinates = true;
+ _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k26_ChampionPortraitsIndice), L0797_ps_Champion->_portrait, gBoxChampionPortrait, _vm->_championMan->M27_getChampionPortraitX(championPortraitIndex), _vm->_championMan->M28_getChampionPortraitY(championPortraitIndex), k128_byteWidth, k16_byteWidth, kM1_ColorNoTransparency);
+ L0797_ps_Champion->_actionIndex = k255_ChampionActionNone;
+ L0797_ps_Champion->_enableActionEventIndex = -1;
+ L0797_ps_Champion->_hideDamageReceivedIndex = -1;
+ L0797_ps_Champion->_dir = _vm->_dungeonMan->_g308_partyDir;
+ AL0794_ui_ViewCell = k0_ViewCellFronLeft;
+ while (_vm->_championMan->f285_getIndexInCell(M21_normalizeModulo4(AL0794_ui_ViewCell + _vm->_dungeonMan->_g308_partyDir)) != kM1_ChampionNone) {
+ AL0794_ui_ViewCell++;
+ }
+ L0797_ps_Champion->_cell = (ViewCell)M21_normalizeModulo4(AL0794_ui_ViewCell + _vm->_dungeonMan->_g308_partyDir);
+ L0797_ps_Champion->_attributes = k0x0400_ChampionAttributeIcon;
+ L0797_ps_Champion->_directionMaximumDamageReceived = _vm->_dungeonMan->_g308_partyDir;
+ L0797_ps_Champion->_food = 1500 + _vm->getRandomNumber(256);
+ L0797_ps_Champion->_water = 1500 + _vm->getRandomNumber(256);
+ for (AL0794_ui_SlotIndex = k0_ChampionSlotReadyHand; AL0794_ui_SlotIndex < k30_ChampionSlotChest_1; AL0794_ui_SlotIndex++) {
+ L0797_ps_Champion->_slots[AL0794_ui_SlotIndex] = Thing::_none;
+ }
+ L0793_T_Thing = _vm->_dungeonMan->f161_getSquareFirstThing(_vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY);
+ while ((L0793_T_Thing.getType()) != k2_TextstringType) {
+ L0793_T_Thing = _vm->_dungeonMan->f159_getNextThing(L0793_T_Thing);
+ }
+ _vm->_dungeonMan->f168_decodeText(L0798_pc_Character = L0807_ac_DecodedChampionText, L0793_T_Thing, (TextType)(k2_TextTypeScroll | k0x8000_DecodeEvenIfInvisible));
+ AL0794_ui_CharacterIndex = 0;
+ while ((AL0796_ui_Character = *L0798_pc_Character++) != '\n') { /* New line */
+ L0797_ps_Champion->_name[AL0794_ui_CharacterIndex++] = AL0796_ui_Character;
+ }
+ L0797_ps_Champion->_name[AL0794_ui_CharacterIndex] = '\0';
+ AL0794_ui_CharacterIndex = 0;
+ AL0800_B_ChampionTitleCopied = false;
+ for (;;) { /*_Infinite loop_*/
+ AL0796_ui_Character = *L0798_pc_Character++;
+ if (AL0796_ui_Character == '\n') { /* New line */
+ if (AL0800_B_ChampionTitleCopied)
+ break;
+ AL0800_B_ChampionTitleCopied = true;
+ } else {
+ L0797_ps_Champion->_title[AL0794_ui_CharacterIndex++] = AL0796_ui_Character;
+ }
+ }
+ L0797_ps_Champion->_title[AL0794_ui_CharacterIndex] = '\0';
+ if (*L0798_pc_Character++ == 'M') {
+ setFlag(L0797_ps_Champion->_attributes, k0x0010_ChampionAttributeMale);
+ }
+ L0798_pc_Character++;
+ L0797_ps_Champion->_currHealth = L0797_ps_Champion->_maxHealth = _vm->_championMan->f279_getDecodedValue(L0798_pc_Character, 4);
+ L0798_pc_Character += 4;
+ L0797_ps_Champion->_currStamina = L0797_ps_Champion->_maxStamina = _vm->_championMan->f279_getDecodedValue(L0798_pc_Character, 4);
+ L0798_pc_Character += 4;
+ L0797_ps_Champion->_currMana = L0797_ps_Champion->_maxMana = _vm->_championMan->f279_getDecodedValue(L0798_pc_Character, 4);
+ L0798_pc_Character += 4;
+ L0798_pc_Character++;
+ for (AL0794_ui_StatisticIndex = k0_ChampionStatLuck; AL0794_ui_StatisticIndex <= k6_ChampionStatAntifire; AL0794_ui_StatisticIndex++) {
+ L0797_ps_Champion->_statistics[AL0794_ui_StatisticIndex][k2_ChampionStatMinimum] = 30;
+ L0797_ps_Champion->_statistics[AL0794_ui_StatisticIndex][k1_ChampionStatCurrent] = L0797_ps_Champion->_statistics[AL0794_ui_StatisticIndex][k0_ChampionStatMaximum] = _vm->_championMan->f279_getDecodedValue(L0798_pc_Character, 2);
+ L0798_pc_Character += 2;
+ }
+ L0797_ps_Champion->_statistics[k0_ChampionStatLuck][k2_ChampionStatMinimum] = 10;
+ L0798_pc_Character++;
+ for (AL0794_ui_SkillIndex = k4_ChampionSkillSwing; AL0794_ui_SkillIndex <= k19_ChampionSkillWater; AL0794_ui_SkillIndex++) {
+ if ((AL0796_ui_SkillValue = *L0798_pc_Character++ - 'A') > 0) {
+ L0797_ps_Champion->_skills[AL0794_ui_SkillIndex]._experience = 125L << AL0796_ui_SkillValue;
+ }
+ }
+ for (AL0794_ui_SkillIndex = k0_ChampionSkillFighter; AL0794_ui_SkillIndex <= k3_ChampionSkillWizard; AL0794_ui_SkillIndex++) {
+ L0806_l_BaseSkillExperience = 0;
+ L0795_i_HiddenSkillIndex = (AL0794_ui_SkillIndex + 1) << 2;
+ for (AL0800_ui_HiddenSkillCounter = 0; AL0800_ui_HiddenSkillCounter < 4; AL0800_ui_HiddenSkillCounter++) {
+ L0806_l_BaseSkillExperience += L0797_ps_Champion->_skills[L0795_i_HiddenSkillIndex + AL0800_ui_HiddenSkillCounter]._experience;
+ }
+ L0797_ps_Champion->_skills[AL0794_ui_SkillIndex]._experience = L0806_l_BaseSkillExperience;
+ }
+ _vm->_championMan->_g299_candidateChampionOrdinal = L0799_ui_PreviousPartyChampionCount + 1;
+ if (++_vm->_championMan->_g305_partyChampionCount == 1) {
_vm->_eventMan->f368_commandSetLeader(k0_ChampionFirst);
_vm->_menuMan->_g508_refreshActionArea = true;
} else {
_vm->_menuMan->f388_clearActingChampion();
- _vm->_menuMan->f386_drawActionIcon((ChampionIndex)(_g305_partyChampionCount - 1));
- }
-
- int16 mapX = _vm->_dungeonMan->_g306_partyMapX;
- int16 mapY = _vm->_dungeonMan->_g307_partyMapY;
-
- uint16 championObjectsCell = returnOppositeDir((direction)(dunMan._g308_partyDir));
- mapX += _vm->_dirIntoStepCountEast[dunMan._g308_partyDir];
- mapY += _vm->_dirIntoStepCountNorth[dunMan._g308_partyDir];
- thing = dunMan.f161_getSquareFirstThing(mapX, mapY);
- AL_0_slotIndex_Red = k13_ChampionSlotBackpackLine_1_1;
- uint16 slotIndex_Green;
- while (thing != Thing::_endOfList) {
- ThingType AL_2_thingType = thing.getType();
- if ((AL_2_thingType > k3_SensorThingType) && (thing.getCell() == championObjectsCell)) {
- int16 objectAllowedSlots = g237_ObjectInfo[dunMan.f141_getObjectInfoIndex(thing)].getAllowedSlots();
- switch (AL_2_thingType) {
+ _vm->_menuMan->f386_drawActionIcon((ChampionIndex)(_vm->_championMan->_g305_partyChampionCount - 1));
+ }
+ L0802_i_MapX = _vm->_dungeonMan->_g306_partyMapX;
+ L0803_i_MapY = _vm->_dungeonMan->_g307_partyMapY;
+ L0804_ui_ChampionObjectsCell = returnOppositeDir(_vm->_dungeonMan->_g308_partyDir);
+ L0802_i_MapX += _vm->_dirIntoStepCountEast[_vm->_dungeonMan->_g308_partyDir], L0803_i_MapY += _vm->_dirIntoStepCountNorth[_vm->_dungeonMan->_g308_partyDir];
+ L0793_T_Thing = _vm->_dungeonMan->f161_getSquareFirstThing(L0802_i_MapX, L0803_i_MapY);
+ AL0794_ui_SlotIndex = k13_ChampionSlotBackpackLine_1_1;
+ while (L0793_T_Thing != Thing::_endOfList) {
+ if (((AL0796_ui_ThingType = (L0793_T_Thing.getType())) > k3_SensorThingType) && ((L0793_T_Thing.getCell()) == L0804_ui_ChampionObjectsCell)) {
+ L0805_i_ObjectAllowedSlots = g237_ObjectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(L0793_T_Thing)]._allowedSlots;
+ switch (AL0796_ui_ThingType) {
case k6_ArmourThingType:
- for (slotIndex_Green = k2_ChampionSlotHead; slotIndex_Green <= k5_ChampionSlotFeet; slotIndex_Green++) {
- if (objectAllowedSlots & gSlotMasks[slotIndex_Green])
+ for (L0801_ui_SlotIndex = k2_ChampionSlotHead; L0801_ui_SlotIndex <= k5_ChampionSlotFeet; L0801_ui_SlotIndex++) {
+ if (L0805_i_ObjectAllowedSlots & gSlotMasks[L0801_ui_SlotIndex])
goto T0280048;
}
- if ((objectAllowedSlots & gSlotMasks[k10_ChampionSlotNeck]) && (champ->getSlot(k10_ChampionSlotNeck) == Thing::_none)) {
- slotIndex_Green = k10_ChampionSlotNeck;
+ if ((L0805_i_ObjectAllowedSlots & gSlotMasks[k10_ChampionSlotNeck]) && (L0797_ps_Champion->_slots[k10_ChampionSlotNeck] == Thing::_none)) {
+ L0801_ui_SlotIndex = k10_ChampionSlotNeck;
} else {
goto T0280046;
}
break;
case k5_WeaponThingType:
- if (champ->getSlot(k1_ChampionSlotActionHand) == Thing::_none) {
- slotIndex_Green = k1_ChampionSlotActionHand;
+ if (L0797_ps_Champion->_slots[k1_ChampionSlotActionHand] == Thing::_none) {
+ L0801_ui_SlotIndex = k1_ChampionSlotActionHand;
} else {
goto T0280046;
}
break;
case k7_ScrollThingType:
case k8_PotionThingType:
- if (champ->getSlot(k11_ChampionSlotPouch_1) == Thing::_none) {
- slotIndex_Green = k11_ChampionSlotPouch_1;
- } else if (champ->getSlot(k6_ChampionSlotPouch_2) == Thing::_none) {
- slotIndex_Green = k6_ChampionSlotPouch_2;
+ if (L0797_ps_Champion->_slots[k11_ChampionSlotPouch_1] == Thing::_none) {
+ L0801_ui_SlotIndex = k11_ChampionSlotPouch_1;
} else {
- goto T0280046;
+ if (L0797_ps_Champion->_slots[k6_ChampionSlotPouch_2] == Thing::_none) {
+ L0801_ui_SlotIndex = k6_ChampionSlotPouch_2;
+ } else {
+ goto T0280046;
+ }
}
break;
case k9_ContainerThingType:
case k10_JunkThingType:
T0280046:
- if ((objectAllowedSlots & gSlotMasks[k10_ChampionSlotNeck]) && (champ->getSlot(k10_ChampionSlotNeck) == Thing::_none)) {
- slotIndex_Green = k10_ChampionSlotNeck;
+ if ((L0805_i_ObjectAllowedSlots & gSlotMasks[k10_ChampionSlotNeck]) && (L0797_ps_Champion->_slots[k10_ChampionSlotNeck] == Thing::_none)) {
+ L0801_ui_SlotIndex = k10_ChampionSlotNeck;
} else {
- slotIndex_Green = AL_0_slotIndex_Red++;
+ L0801_ui_SlotIndex = AL0794_ui_SlotIndex++;
}
- break;
-
- default:
- break;
}
T0280048:
- if (champ->getSlot((ChampionSlot)slotIndex_Green) != Thing::_none) {
+ if (L0797_ps_Champion->_slots[L0801_ui_SlotIndex] != Thing::_none) {
goto T0280046;
}
- f301_addObjectInSlot((ChampionIndex)prevChampCount, thing, (ChampionSlot)slotIndex_Green);
+ _vm->_championMan->f301_addObjectInSlot((ChampionIndex)L0799_ui_PreviousPartyChampionCount, L0793_T_Thing, (ChampionSlot)L0801_ui_SlotIndex);
}
- thing = dunMan.f159_getNextThing(thing);
+ L0793_T_Thing = _vm->_dungeonMan->f159_getNextThing(L0793_T_Thing);
}
-
- _vm->_inventoryMan->f355_toggleInventory((ChampionIndex)prevChampCount);
- _vm->_menuMan->f456_drawDisabledMenu();
+ _vm->_inventoryMan->f355_toggleInventory((ChampionIndex)L0799_ui_PreviousPartyChampionCount);
+ _vm->_menuMan->f456_drawDisabledMenu();;
}
void ChampionMan::f287_drawChampionBarGraphs(ChampionIndex champIndex) {
@@ -1446,7 +1475,7 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) {
L0868_i_ChampionStatusBoxX = champIndex * k69_ChampionStatusBoxSpacing;
- L0865_ps_Champion = &_vm->_championMan->_gK71_champions[champIndex];
+ L0865_ps_Champion = &_gK71_champions[champIndex];
L0862_ui_ChampionAttributes = L0865_ps_Champion->_attributes;
if (!getFlag(L0862_ui_ChampionAttributes, k0x0080_ChampionAttributeNameTitle | k0x0100_ChampionAttributeStatistics | k0x0200_ChampionAttributeLoad | k0x0400_ChampionAttributeIcon | k0x0800_ChampionAttributePanel | k0x1000_ChampionAttributeStatusBox | k0x2000_ChampionAttributeWounds | k0x4000_ChampionAttributeViewport | k0x8000_ChampionAttributeActionHand)) {
return;
@@ -1463,13 +1492,13 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) {
for (uint16 i = 0; i < 3; ++i)
L0872_ai_NativeBitmapIndices[i] = 0;
AL0864_i_BorderCount = 0;
- if (_vm->_championMan->_g407_party._fireShieldDefense > 0) {
+ if (_g407_party._fireShieldDefense > 0) {
L0872_ai_NativeBitmapIndices[AL0864_i_BorderCount++] = k38_BorderPartyFireshieldIndice;
}
- if (_vm->_championMan->_g407_party._spellShieldDefense > 0) {
+ if (_g407_party._spellShieldDefense > 0) {
L0872_ai_NativeBitmapIndices[AL0864_i_BorderCount++] = k39_BorderPartySpellshieldIndice;
}
- if ((_vm->_championMan->_g407_party._shieldDefense > 0) || L0865_ps_Champion->_shieldDefense) {
+ if ((_g407_party._shieldDefense > 0) || L0865_ps_Champion->_shieldDefense) {
L0872_ai_NativeBitmapIndices[AL0864_i_BorderCount++] = k37_BorderPartyShieldIndice;
}
while (AL0864_i_BorderCount--) {
@@ -1491,7 +1520,7 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) {
if (!(L0865_ps_Champion->_currHealth))
goto T0292042;
if (getFlag(L0862_ui_ChampionAttributes, k0x0080_ChampionAttributeNameTitle)) {
- AL0864_i_ColorIndex = (champIndex == _vm->_championMan->_g411_leaderIndex) ? k9_ColorGold : k13_ColorLightestGray;
+ AL0864_i_ColorIndex = (champIndex == _g411_leaderIndex) ? k9_ColorGold : k13_ColorLightestGray;
if (L0863_B_IsInventoryChampion) {
_vm->_textMan->f52_printToViewport(3, 7, (Color)AL0864_i_ColorIndex, L0866_pc_ChampionName = L0865_ps_Champion->_name);
L0869_i_ChampionTitleX = 6 * strlen(L0866_pc_ChampionName) + 3;
@@ -1510,9 +1539,9 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) {
}
}
if (getFlag(L0862_ui_ChampionAttributes, k0x0100_ChampionAttributeStatistics)) {
- _vm->_championMan->f287_drawChampionBarGraphs(champIndex);
+ f287_drawChampionBarGraphs(champIndex);
if (L0863_B_IsInventoryChampion) {
- _vm->_championMan->f290_drawHealthStaminaManaValues(L0865_ps_Champion);
+ f290_drawHealthStaminaManaValues(L0865_ps_Champion);
if ((L0865_ps_Champion->_food < 0) || (L0865_ps_Champion->_water < 0) || (L0865_ps_Champion->_poisonEventCount)) {
AL0870_i_NativeBitmapIndex = k34_SlotBoxWoundedIndice;
} else {
@@ -1532,14 +1561,14 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) {
}
if (getFlag(L0862_ui_ChampionAttributes, k0x2000_ChampionAttributeWounds)) {
for (AL0864_i_SlotIndex = L0863_B_IsInventoryChampion ? k5_ChampionSlotFeet : k1_ChampionSlotActionHand; AL0864_i_SlotIndex >= k0_ChampionSlotReadyHand; AL0864_i_SlotIndex--) {
- _vm->_championMan->f291_drawSlot(champIndex, AL0864_i_SlotIndex);
+ f291_drawSlot(champIndex, AL0864_i_SlotIndex);
}
if (L0863_B_IsInventoryChampion) {
setFlag(L0862_ui_ChampionAttributes, k0x4000_ChampionAttributeViewport);
}
}
if (getFlag(L0862_ui_ChampionAttributes, k0x0200_ChampionAttributeLoad) && L0863_B_IsInventoryChampion) {
- if (L0865_ps_Champion->_load > (AL0864_i_Load = _vm->_championMan->f309_getMaximumLoad(L0865_ps_Champion))) {
+ if (L0865_ps_Champion->_load > (AL0864_i_Load = f309_getMaximumLoad(L0865_ps_Champion))) {
AL0870_i_Color = k8_ColorRed;
} else {
if (((long)L0865_ps_Champion->_load << 3) > ((long)AL0864_i_Load * 5)) {
@@ -1550,28 +1579,28 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) {
}
_vm->_textMan->f52_printToViewport(104, 132, (Color)AL0870_i_Color, "LOAD ");
AL0864_i_Load = L0865_ps_Champion->_load / 10;
- strcpy(_vm->_g353_stringBuildBuffer, _vm->_championMan->f288_getStringFromInteger(AL0864_i_Load, true, 3).c_str());
+ strcpy(_vm->_g353_stringBuildBuffer, f288_getStringFromInteger(AL0864_i_Load, true, 3).c_str());
strcat(_vm->_g353_stringBuildBuffer, ".");
AL0864_i_Load = L0865_ps_Champion->_load - (AL0864_i_Load * 10);
- strcat(_vm->_g353_stringBuildBuffer, _vm->_championMan->f288_getStringFromInteger(AL0864_i_Load, false, 1).c_str());
+ strcat(_vm->_g353_stringBuildBuffer, f288_getStringFromInteger(AL0864_i_Load, false, 1).c_str());
strcat(_vm->_g353_stringBuildBuffer, "/");
- AL0864_i_Load = (_vm->_championMan->f309_getMaximumLoad(L0865_ps_Champion) + 5) / 10;
- strcat(_vm->_g353_stringBuildBuffer, _vm->_championMan->f288_getStringFromInteger(AL0864_i_Load, true, 3).c_str());
+ AL0864_i_Load = (f309_getMaximumLoad(L0865_ps_Champion) + 5) / 10;
+ strcat(_vm->_g353_stringBuildBuffer, f288_getStringFromInteger(AL0864_i_Load, true, 3).c_str());
strcat(_vm->_g353_stringBuildBuffer, " KG");
_vm->_textMan->f52_printToViewport(148, 132, (Color)AL0870_i_Color, _vm->_g353_stringBuildBuffer);
setFlag(L0862_ui_ChampionAttributes, k0x4000_ChampionAttributeViewport);
}
- AL0864_i_ChampionIconIndex = _vm->_championMan->M26_championIconIndex(L0865_ps_Champion->_cell, _vm->_dungeonMan->_g308_partyDir);
+ AL0864_i_ChampionIconIndex = M26_championIconIndex(L0865_ps_Champion->_cell, _vm->_dungeonMan->_g308_partyDir);
if (getFlag(L0862_ui_ChampionAttributes, k0x0400_ChampionAttributeIcon) && (_vm->_eventMan->_g599_useChampionIconOrdinalAsMousePointerBitmap != _vm->M0_indexToOrdinal(AL0864_i_ChampionIconIndex))) {
_vm->_displayMan->D24_fillScreenBox(g54_BoxChampionIcons[AL0864_i_ChampionIconIndex << 2], g46_ChampionColor[champIndex]);
- _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k28_ChampionIcons), _vm->_displayMan->_g348_bitmapScreen, g54_BoxChampionIcons[AL0864_i_ChampionIconIndex << 2], _vm->_championMan->M26_championIconIndex(L0865_ps_Champion->_dir, _vm->_dungeonMan->_g308_partyDir) * 19, 0, k40_byteWidth, k160_byteWidthScreen, k12_ColorDarkestGray, 14, k200_heightScreen);
+ _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k28_ChampionIcons), _vm->_displayMan->_g348_bitmapScreen, g54_BoxChampionIcons[AL0864_i_ChampionIconIndex << 2], M26_championIconIndex(L0865_ps_Champion->_dir, _vm->_dungeonMan->_g308_partyDir) * 19, 0, k40_byteWidth, k160_byteWidthScreen, k12_ColorDarkestGray, 14, k200_heightScreen);
}
if (getFlag(L0862_ui_ChampionAttributes, k0x0800_ChampionAttributePanel) && L0863_B_IsInventoryChampion) {
if (_vm->_g333_pressingMouth) {
_vm->_inventoryMan->f345_drawPanelFoodWaterPoisoned();
} else {
if (_vm->_g331_pressingEye) {
- if (_vm->_championMan->_g415_leaderEmptyHanded) {
+ if (_g415_leaderEmptyHanded) {
_vm->_inventoryMan->f351_drawChampionSkillsAndStatistics();
}
} else {
@@ -1581,7 +1610,7 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) {
setFlag(L0862_ui_ChampionAttributes, k0x4000_ChampionAttributeViewport);
}
if (getFlag(L0862_ui_ChampionAttributes, k0x8000_ChampionAttributeActionHand)) {
- _vm->_championMan->f291_drawSlot(champIndex, k1_ChampionSlotActionHand);
+ f291_drawSlot(champIndex, k1_ChampionSlotActionHand);
_vm->_menuMan->f386_drawActionIcon(champIndex);
if (L0863_B_IsInventoryChampion) {
setFlag(L0862_ui_ChampionAttributes, k0x4000_ChampionAttributeViewport);
diff --git a/engines/dm/champion.h b/engines/dm/champion.h
index 2dc4579ee4..16c53c8c58 100644
--- a/engines/dm/champion.h
+++ b/engines/dm/champion.h
@@ -520,6 +520,7 @@ public:
void f316_deleteScent(uint16 scentIndex); // @ F0316_CHAMPION_DeleteScent
void f317_addScentStrength(int16 mapX, int16 mapY, int32 cycleCount); // @ F0317_CHAMPION_AddScentStrength
void f297_putObjectInLeaderHand(Thing thing, bool setMousePointer); // @ F0297_CHAMPION_PutObjectInLeaderHand
+ int16 f310_getMovementTicks(Champion *champ); // @ F0310_CHAMPION_GetMovementTicks
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp
index cf75acbe58..fa94f258c4 100644
--- a/engines/dm/dm.cpp
+++ b/engines/dm/dm.cpp
@@ -326,7 +326,6 @@ void DMEngine::f2_gameloop() {
_dungeonMan->_g308_partyDir = kDirNorth;
warning(false, "DUMMY CODE: setting InventoryMan::_g432_inventoryChampionOrdinal to zero");
_inventoryMan->_g432_inventoryChampionOrdinal = 0;
- warning(false, "DUMMY CODE: clearing screen to black"); // in loop below
while (true) {
if (_g327_newPartyMapIndex != kM1_mapIndexNone) {
@@ -337,13 +336,14 @@ T0002002:
_eventMan->f357_discardAllInput();
}
- // MISSING: F0261_TIMELINE_Process_CPSEF
+ warning(false, "MISSING CODE: F0261_TIMELINE_Process_CPSEF");
if (_g327_newPartyMapIndex != kM1_mapIndexNone)
goto T0002002;
if (!_inventoryMan->_g432_inventoryChampionOrdinal && !_championMan->_g300_partyIsSleeping) {
Box box(0, 223, 0, 135);
+ warning(false, "DUMMY CODE: clearing screen to black");
_displayMan->f135_fillBoxBitmap(_displayMan->_g296_bitmapViewport, box, k0_ColorBlack, k112_byteWidthViewport, k136_heightViewport); // dummy code
_displayMan->f128_drawDungeon(_dungeonMan->_g308_partyDir, _dungeonMan->_g306_partyMapX, _dungeonMan->_g307_partyMapY);
if (_g325_setMousePointerToObjectInMainLoop) {
diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h
index f9e21d4633..0b01a44a99 100644
--- a/engines/dm/dungeonman.h
+++ b/engines/dm/dungeonman.h
@@ -644,7 +644,6 @@ class DungeonMan {
DungeonMan(const DungeonMan &other); // no implementation on purpose
void operator=(const DungeonMan &rhs); // no implementation on purpose
- Square f151_getSquare(int16 mapX, int16 mapY); // @ F0151_DUNGEON_GetSquare
Square f152_getRelSquare(direction dir, int16 stepsForward, int16 stepsRight, int16 posX, int16 posY); // @ F0152_DUNGEON_GetRelativeSquare
void f455_decompressDungeonFile(); // @ F0455_FLOPPY_DecompressDungeon
@@ -660,6 +659,7 @@ public:
explicit DungeonMan(DMEngine *dmEngine);
~DungeonMan();
+ Square f151_getSquare(int16 mapX, int16 mapY); // @ F0151_DUNGEON_GetSquare
void f173_setCurrentMap(uint16 mapIndex); // @ F0173_DUNGEON_SetCurrentMap
Thing f161_getSquareFirstThing(int16 mapX, int16 mapY); // @ F0161_DUNGEON_GetSquareFirstThing
Thing f159_getNextThing(Thing thing); // @ F0159_DUNGEON_GetNextThing(THING P0280_T_Thing)
diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp
index ad6bd3067c..f57f98688e 100644
--- a/engines/dm/eventman.cpp
+++ b/engines/dm/eventman.cpp
@@ -416,7 +416,7 @@ void EventManager::f68_setPointerToObject(byte* bitmap) {
// dummy code
_vm->_displayMan->f132_blitToBitmap(bitmap, L0051_puc_Bitmap, g619_BoxMousePointerObjectShadow, 0, 0, 8, 16, kM1_ColorNoTransparency, 16, 18);
_vm->_displayMan->f132_blitToBitmap(bitmap, L0051_puc_Bitmap, g620_BoxMousePointerObject, 0, 0, 8, 16, k0_ColorBlack, 16, 18);
-
+
_gK100_preventBuildPointerScreenArea = false;
f73_buildpointerScreenArea(_mousePos.x, _mousePos.y);
}
@@ -549,7 +549,7 @@ void EventManager::processInput() {
input++;
}
}
-
+
if (_g444_secondaryKeyboardInput) {
KeyboardInput *input = _g444_secondaryKeyboardInput;
while (input->_commandToIssue != k0_CommandNone) {
@@ -561,8 +561,8 @@ void EventManager::processInput() {
input++;
}
}
-
- }
+
+ }
case Common::EVENT_MOUSEMOVE:
_mousePos = event.mouse;
break;
@@ -665,31 +665,114 @@ void EventManager::f365_commandTurnParty(CommandType cmdType) {
}
void EventManager::f366_commandMoveParty(CommandType cmdType) {
- _vm->_g321_stopWaitingForPlayerInput = true;
-
- // MISSING CODE: Lots of code
+ static Box g463_BoxMovementArrows[4] = { // @ G0463_as_Graphic561_Box_MovementArrows
+ /* { X1, X2, Y1, Y2 } */
+ Box(263, 289, 125, 145), /* Forward */
+ Box(291, 318, 147, 167), /* Right */
+ Box(263, 289, 147, 167), /* Backward */
+ Box(234, 261, 147, 167)}; /* Left */
+
+ static int16 g465_movementArrowToStepForwardCount[4] = { // @ G0465_ai_Graphic561_MovementArrowToStepForwardCount
+ 1, /* Forward */
+ 0, /* Right */
+ -1, /* Backward */
+ 0}; /* Left */
+ static int16 g466_movementArrowToSepRightCount[4] = { // @ G0466_ai_Graphic561_MovementArrowToStepRightCount
+ 0, /* Forward */
+ 1, /* Right */
+ 0, /* Backward */
+ -1}; /* Left */
+
+ uint16 L1115_ui_Multiple;
+#define AL1115_ui_Square L1115_ui_Multiple
+#define AL1115_ui_Ticks L1115_ui_Multiple
+ int16 L1116_i_SquareType;
+ int16 L1117_B_MovementBlocked;
+ uint16 L1118_ui_Multiple;
+#define AL1118_ui_ChampionIndex L1118_ui_Multiple
+#define AL1118_ui_MovementArrowIndex L1118_ui_Multiple
+ Champion* L1119_ps_Champion;
+ Box* L1120_ps_Box;
+ int16 L1121_i_MapX;
+ int16 L1122_i_MapY;
+ bool L1123_B_StairsSquare;
+ int16 L1124_i_FirstDamagedChampionIndex;
+ int16 L1125_i_SecondDamagedChampionIndex;
- // DUMMY CODE:
- DungeonMan &dungeonMan = *_vm->_dungeonMan;
- switch (cmdType) {
- case k3_CommandMoveForward:
- dungeonMan.f150_mapCoordsAfterRelMovement(dungeonMan._g308_partyDir, 1, 0, dungeonMan._g306_partyMapX, dungeonMan._g307_partyMapY);
- break;
- case k6_CommandMoveLeft:
- dungeonMan.f150_mapCoordsAfterRelMovement(dungeonMan._g308_partyDir, 0, -1, dungeonMan._g306_partyMapX, dungeonMan._g307_partyMapY);
- break;
- case k5_CommandMoveBackward:
- dungeonMan.f150_mapCoordsAfterRelMovement(dungeonMan._g308_partyDir, -1, 0, dungeonMan._g306_partyMapX, dungeonMan._g307_partyMapY);
- break;
- case k4_CommandMoveRight:
- dungeonMan.f150_mapCoordsAfterRelMovement(dungeonMan._g308_partyDir, 0, 1, dungeonMan._g306_partyMapX, dungeonMan._g307_partyMapY);
- break;
- default:
- break;
+ _vm->_g321_stopWaitingForPlayerInput = true;
+ L1119_ps_Champion = _vm->_championMan->_gK71_champions;
+ for (AL1118_ui_ChampionIndex = k0_ChampionFirst; AL1118_ui_ChampionIndex < _vm->_championMan->_g305_partyChampionCount; AL1118_ui_ChampionIndex++) {
+ _vm->_championMan->f325_decrementStamine(AL1118_ui_ChampionIndex, ((L1119_ps_Champion->_load * 3) / _vm->_championMan->f309_getMaximumLoad(L1119_ps_Champion)) + 1); /* BUG0_50 When a champion is brought back to life at a Vi Altar, his current stamina is lower than what it was before dying. Each time the party moves the current stamina of all champions is decreased, including for dead champions, by an amount that depends on the current load of the champion. For a dead champion the load before he died is used */
+ L1119_ps_Champion++;
}
-
- // MISSING CODE: Lots of code
+ AL1118_ui_MovementArrowIndex = cmdType - k3_CommandMoveForward;
+ L1120_ps_Box = &g463_BoxMovementArrows[AL1118_ui_MovementArrowIndex];
+ warning(false, "MISSING CODE: F0362_COMMAND_HighlightBoxEnable");
+ L1123_B_StairsSquare = (Square(AL1115_ui_Square = _vm->_dungeonMan->f151_getSquare(L1121_i_MapX = _vm->_dungeonMan->_g306_partyMapX, L1122_i_MapY = _vm->_dungeonMan->_g307_partyMapY).toByte()).getType() == k3_ElementTypeStairs);
+ if (L1123_B_StairsSquare && (AL1118_ui_MovementArrowIndex == 2)) { /* If moving backward while in stairs */
+ f364_commandTakeStairs(getFlag(AL1115_ui_Square, k0x0004_StairsUp));
+ return;
+ }
+ _vm->_dungeonMan->f150_mapCoordsAfterRelMovement(_vm->_dungeonMan->_g308_partyDir, g465_movementArrowToStepForwardCount[AL1118_ui_MovementArrowIndex], g466_movementArrowToSepRightCount[AL1118_ui_MovementArrowIndex], L1121_i_MapX, L1122_i_MapY);
+ L1116_i_SquareType = Square(AL1115_ui_Square = _vm->_dungeonMan->f151_getSquare(L1121_i_MapX, L1122_i_MapY).toByte()).getType();
+ if (L1116_i_SquareType == k3_ElementTypeStairs) {
+ _vm->_movsens->f267_getMoveResult(Thing::_party, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, kM1_MapXNotOnASquare, 0);
+ _vm->_dungeonMan->_g306_partyMapX = L1121_i_MapX;
+ _vm->_dungeonMan->_g307_partyMapY = L1122_i_MapY;
+ f364_commandTakeStairs(getFlag(AL1115_ui_Square, k0x0004_StairsUp));
+ return;
+ }
+ L1117_B_MovementBlocked = false;
+ if (L1116_i_SquareType == k0_ElementTypeWall) {
+ L1117_B_MovementBlocked = true;
+ } else {
+ if (L1116_i_SquareType == k4_DoorElemType) {
+ L1117_B_MovementBlocked = Square(AL1115_ui_Square).getDoorState();
+ L1117_B_MovementBlocked = (L1117_B_MovementBlocked != k0_doorState_OPEN) && (L1117_B_MovementBlocked != k1_doorState_FOURTH) && (L1117_B_MovementBlocked != k5_doorState_DESTROYED);
+ } else {
+ if (L1116_i_SquareType == k6_ElementTypeFakeWall) {
+ L1117_B_MovementBlocked = (!getFlag(AL1115_ui_Square, k0x0004_FakeWallOpen) && !getFlag(AL1115_ui_Square, k0x0001_FakeWallImaginary));
+ }
+ }
+ }
+ if (_vm->_championMan->_g305_partyChampionCount == 0) {
+ } else {
+ if (L1117_B_MovementBlocked) {
+ L1117_B_MovementBlocked = _vm->_championMan->f321_addPendingDamageAndWounds_getDamage(L1124_i_FirstDamagedChampionIndex = _vm->_championMan->f286_getTargetChampionIndex(L1121_i_MapX, L1122_i_MapY, M21_normalizeModulo4(AL1118_ui_MovementArrowIndex += (_vm->_dungeonMan->_g308_partyDir + 2))), 1, k0x0008_ChampionWoundTorso | k0x0010_ChampionWoundLegs, k2_attackType_SELF);
+ if (L1124_i_FirstDamagedChampionIndex != (L1125_i_SecondDamagedChampionIndex = _vm->_championMan->f286_getTargetChampionIndex(L1121_i_MapX, L1122_i_MapY, returnNextVal(AL1118_ui_MovementArrowIndex)))) {
+ L1117_B_MovementBlocked |= _vm->_championMan->f321_addPendingDamageAndWounds_getDamage(L1125_i_SecondDamagedChampionIndex, 1, k0x0008_ChampionWoundTorso | k0x0010_ChampionWoundLegs, k2_attackType_SELF);
+ }
+ if (L1117_B_MovementBlocked) {
+ warning(false, "MISSING CODE: F0064_SOUND_RequestPlay_CPSD");
+ }
+ } else {
+ if (L1117_B_MovementBlocked = (_vm->_groupMan->f175_groupGetThing(L1121_i_MapX, L1122_i_MapY) != Thing::_endOfList)) {
+ _vm->_groupMan->f209_processEvents29to41(L1121_i_MapX, L1122_i_MapY, kM1_TMEventTypeCreateReactionEvent31ParyIsAdjacent, 0);
+ }
+ }
+ }
+ if (L1117_B_MovementBlocked) {
+ f357_discardAllInput();
+ _vm->_g321_stopWaitingForPlayerInput = false;
+ return;
+ }
+ if (L1123_B_StairsSquare) {
+ _vm->_movsens->f267_getMoveResult(Thing::_party, kM1_MapXNotOnASquare, 0, L1121_i_MapX, L1122_i_MapY);
+ } else {
+ _vm->_movsens->f267_getMoveResult(Thing::_party, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, L1121_i_MapX, L1122_i_MapY);
+ }
+ AL1115_ui_Ticks = 1;
+ L1119_ps_Champion = _vm->_championMan->_gK71_champions;
+ for (AL1118_ui_ChampionIndex = k0_ChampionFirst; AL1118_ui_ChampionIndex < _vm->_championMan->_g305_partyChampionCount; AL1118_ui_ChampionIndex++) {
+ if (L1119_ps_Champion->_currHealth) {
+ warning(false, "possibly dangerous cast to uint16");
+ AL1115_ui_Ticks = MAX(AL1115_ui_Ticks, (uint16)_vm->_championMan->f310_getMovementTicks(L1119_ps_Champion));
+ }
+ L1119_ps_Champion++;
+ }
+ _vm->_g310_disabledMovementTicks = AL1115_ui_Ticks;
+ _vm->_g311_projectileDisableMovementTicks = 0;
}
bool EventManager::f375_processType80_clickDungeonView_isLeaderHandObjThrown(int16 posX, int16 posY) {
@@ -1052,4 +1135,11 @@ void EventManager::f357_discardAllInput() {
_commandQueue.clear();
}
+void EventManager::f364_commandTakeStairs(bool stairsGoDown) {
+ _vm->_movsens->f267_getMoveResult(Thing::_party, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, kM1_MapXNotOnASquare, 0);
+ _vm->_g327_newPartyMapIndex = _vm->_dungeonMan->f154_getLocationAfterLevelChange(_vm->_dungeonMan->_g309_partyMapIndex, stairsGoDown ? -1 : 1, &_vm->_dungeonMan->_g306_partyMapX, &_vm->_dungeonMan->_g307_partyMapY);
+ _vm->_dungeonMan->f173_setCurrentMap(_vm->_g327_newPartyMapIndex);
+ _vm->_championMan->f284_setPartyDirection(_vm->_dungeonMan->f155_getStairsExitDirection(_vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY));
+ _vm->_dungeonMan->f173_setCurrentMap(_vm->_dungeonMan->_g309_partyMapIndex);
+}
} // end of namespace DM
diff --git a/engines/dm/eventman.h b/engines/dm/eventman.h
index eafb64ee1a..2c61d3e7ce 100644
--- a/engines/dm/eventman.h
+++ b/engines/dm/eventman.h
@@ -296,6 +296,8 @@ public:
bool f360_hasPendingClick(Common::Point &point, MouseButton button); // @ F0360_COMMAND_ProcessPendingClick
void f379_drawSleepScreen(); // @ F0379_COMMAND_DrawSleepScreen
void f357_discardAllInput(); // @ F0357_COMMAND_DiscardAllInput
+ void f364_commandTakeStairs(bool stairsGoDown);// @ F0364_COMMAND_TakeStairs
+
};
}