aboutsummaryrefslogtreecommitdiff
path: root/engines/dm
diff options
context:
space:
mode:
authorStrangerke2016-07-25 14:35:26 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commitb174331e71f4c63b2847762acddcf8d20a712cb8 (patch)
tree61be93d547f0db97ae590e038f84662f98f97bbe /engines/dm
parent63fc9fb27d684d69770cb626963d341c2f1aab77 (diff)
downloadscummvm-rg350-b174331e71f4c63b2847762acddcf8d20a712cb8.tar.gz
scummvm-rg350-b174331e71f4c63b2847762acddcf8d20a712cb8.tar.bz2
scummvm-rg350-b174331e71f4c63b2847762acddcf8d20a712cb8.zip
DM: refact f293_drawAllChampionStates, f283_viAltarRebirth, f327_isProjectileSpellCast and f326_championShootProjectile. Rename Direction.
Diffstat (limited to 'engines/dm')
-rw-r--r--engines/dm/champion.cpp98
-rw-r--r--engines/dm/champion.h4
-rw-r--r--engines/dm/dm.cpp10
-rw-r--r--engines/dm/dm.h10
-rw-r--r--engines/dm/dungeonman.cpp14
-rw-r--r--engines/dm/dungeonman.h16
-rw-r--r--engines/dm/gfx.cpp30
-rw-r--r--engines/dm/gfx.h28
-rw-r--r--engines/dm/group.cpp28
-rw-r--r--engines/dm/group.h6
-rw-r--r--engines/dm/loadsave.cpp2
-rw-r--r--engines/dm/menus.cpp2
-rw-r--r--engines/dm/movesens.cpp2
-rw-r--r--engines/dm/projexpl.cpp4
-rw-r--r--engines/dm/projexpl.h2
-rw-r--r--engines/dm/timeline.cpp10
-rw-r--r--engines/dm/timeline.h4
17 files changed, 132 insertions, 138 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp
index c7592310cc..3c0d08ac2c 100644
--- a/engines/dm/champion.cpp
+++ b/engines/dm/champion.cpp
@@ -1097,11 +1097,11 @@ void ChampionMan::f284_setPartyDirection(int16 dir) {
Champion *curChampion = _gK71_champions;
for (int16 i = k0_ChampionFirst; i < _g305_partyChampionCount; i++) {
curChampion->_cell = (ViewCell)M21_normalizeModulo4(curChampion->_cell + L0834_i_Delta);
- curChampion->_dir = (direction)M21_normalizeModulo4(curChampion->_dir + L0834_i_Delta);
+ curChampion->_dir = (Direction)M21_normalizeModulo4(curChampion->_dir + L0834_i_Delta);
curChampion++;
}
- _vm->_dungeonMan->_g308_partyDir = (direction)dir;
+ _vm->_dungeonMan->_g308_partyDir = (Direction)dir;
f296_drawChangedObjectIcons();
}
@@ -1228,31 +1228,26 @@ bool ChampionMan::f294_isAmmunitionCompatibleWithWeapon(uint16 champIndex, uint1
}
void ChampionMan::f293_drawAllChampionStates() {
- int16 L0873_i_ChampionIndex;
- for (L0873_i_ChampionIndex = k0_ChampionFirst; L0873_i_ChampionIndex < _vm->_championMan->_g305_partyChampionCount; L0873_i_ChampionIndex++) {
- _vm->_championMan->f292_drawChampionState((ChampionIndex)L0873_i_ChampionIndex);
- }
+ for (int16 i = k0_ChampionFirst; i < _vm->_championMan->_g305_partyChampionCount; i++)
+ _vm->_championMan->f292_drawChampionState((ChampionIndex)i);
}
void ChampionMan::f283_viAltarRebirth(uint16 champIndex) {
- uint16 L0831_ui_Multiple;
-#define AL0831_ui_Cell L0831_ui_Multiple
-#define AL0831_ui_MaximumHealth L0831_ui_Multiple
- Champion* L0832_ps_Champion;
+ Champion *curChampion = &_vm->_championMan->_gK71_champions[champIndex];
+ if (_vm->_championMan->f285_getIndexInCell(curChampion->_cell) != kM1_ChampionNone) {
+ uint16 numCell = k0_CellNorthWest;
+ while (_vm->_championMan->f285_getIndexInCell(numCell) != kM1_ChampionNone)
+ numCell++;
- L0832_ps_Champion = &_vm->_championMan->_gK71_champions[champIndex];
- if (_vm->_championMan->f285_getIndexInCell(L0832_ps_Champion->_cell) != kM1_ChampionNone) {
- AL0831_ui_Cell = k0_CellNorthWest;
- while (_vm->_championMan->f285_getIndexInCell(AL0831_ui_Cell) != kM1_ChampionNone) {
- AL0831_ui_Cell++;
- }
- L0832_ps_Champion->_cell = (ViewCell)AL0831_ui_Cell;
+ curChampion->_cell = (ViewCell)numCell;
}
- AL0831_ui_MaximumHealth = L0832_ps_Champion->_maxHealth;
- L0832_ps_Champion->_currHealth = (L0832_ps_Champion->_maxHealth = MAX(25, AL0831_ui_MaximumHealth - (AL0831_ui_MaximumHealth >> 6) - 1)) >> 1;
+
+ uint16 maximumHealth = curChampion->_maxHealth;
+ curChampion->_maxHealth = MAX(25, maximumHealth - (maximumHealth >> 6) - 1);
+ curChampion->_currHealth = curChampion->_maxHealth >> 1;
_vm->_menuMan->f393_drawSpellAreaControls(_vm->_championMan->_g514_magicCasterChampionIndex);
- L0832_ps_Champion->_dir = _vm->_dungeonMan->_g308_partyDir;
- setFlag(L0832_ps_Champion->_attributes, k0x8000_ChampionAttributeActionHand | k0x1000_ChampionAttributeStatusBox | k0x0400_ChampionAttributeIcon);
+ curChampion->_dir = _vm->_dungeonMan->_g308_partyDir;
+ setFlag(curChampion->_attributes, k0x8000_ChampionAttributeActionHand | k0x1000_ChampionAttributeStatusBox | k0x0400_ChampionAttributeIcon);
_vm->_championMan->f292_drawChampionState((ChampionIndex)champIndex);
}
@@ -1261,18 +1256,19 @@ void ChampionMan::f302_processCommands28to65_clickOnSlotBox(uint16 slotBoxIndex)
uint16 slotIndex;
if (slotBoxIndex < k8_SlotBoxInventoryFirstSlot) {
- if (_g299_candidateChampionOrdinal) {
+ if (_g299_candidateChampionOrdinal)
return;
- }
+
champIndex = slotBoxIndex >> 1;
- if ((champIndex >= _g305_partyChampionCount) || (_vm->M0_indexToOrdinal(champIndex) == _vm->_inventoryMan->_g432_inventoryChampionOrdinal) || !_gK71_champions[champIndex]._currHealth) {
+ if ((champIndex >= _g305_partyChampionCount) || (_vm->M0_indexToOrdinal(champIndex) == _vm->_inventoryMan->_g432_inventoryChampionOrdinal) || !_gK71_champions[champIndex]._currHealth)
return;
- }
+
slotIndex = M70_handSlotIndex(slotBoxIndex);
} else {
champIndex = _vm->M1_ordinalToIndex(_vm->_inventoryMan->_g432_inventoryChampionOrdinal);
slotIndex = slotBoxIndex - k8_SlotBoxInventoryFirstSlot;
}
+
Thing leaderHandObject = _g414_leaderHandObject;
Thing slotThing;
if (slotIndex >= k30_ChampionSlotChest_1) {
@@ -1280,53 +1276,51 @@ void ChampionMan::f302_processCommands28to65_clickOnSlotBox(uint16 slotBoxIndex)
} else {
slotThing = _gK71_champions[champIndex]._slots[slotIndex];
}
- if ((slotThing == Thing::_none) && (leaderHandObject == Thing::_none)) {
+
+ if ((slotThing == Thing::_none) && (leaderHandObject == Thing::_none))
return;
- }
- if ((leaderHandObject != Thing::_none) && (!(g237_ObjectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(leaderHandObject)]._allowedSlots & g38_slotMasks[slotIndex]))) {
+
+ if ((leaderHandObject != Thing::_none) && (!(g237_ObjectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(leaderHandObject)]._allowedSlots & g38_slotMasks[slotIndex])))
return;
- }
+
_vm->_eventMan->f78_showMouse();
- if (leaderHandObject != Thing::_none) {
+ if (leaderHandObject != Thing::_none)
f298_getObjectRemovedFromLeaderHand();
- }
+
if (slotThing != Thing::_none) {
f300_getObjectRemovedFromSlot(champIndex, slotIndex);
f297_putObjectInLeaderHand(slotThing, false);
}
- if (leaderHandObject != Thing::_none) {
+
+ if (leaderHandObject != Thing::_none)
f301_addObjectInSlot((ChampionIndex)champIndex, leaderHandObject, (ChampionSlot)slotIndex);
- }
+
f292_drawChampionState((ChampionIndex)champIndex);
_vm->_eventMan->f77_hideMouse();
}
bool ChampionMan::f327_isProjectileSpellCast(uint16 champIndex, Thing thing, int16 kineticEnergy, uint16 requiredManaAmount) {
- int16 L0991_i_StepEnergy;
- Champion* L0992_ps_Champion;
-
- L0992_ps_Champion = &_vm->_championMan->_gK71_champions[champIndex];
- if (L0992_ps_Champion->_currMana < requiredManaAmount) {
+ Champion *curChampion = &_vm->_championMan->_gK71_champions[champIndex];
+ if (curChampion->_currMana < requiredManaAmount)
return false;
- }
- L0992_ps_Champion->_currMana -= requiredManaAmount;
- setFlag(L0992_ps_Champion->_attributes, k0x0100_ChampionAttributeStatistics);
- L0991_i_StepEnergy = 10 - MIN(8, L0992_ps_Champion->_maxMana >> 3);
- if (kineticEnergy < (L0991_i_StepEnergy << 2)) {
+
+ curChampion->_currMana -= requiredManaAmount;
+ setFlag(curChampion->_attributes, k0x0100_ChampionAttributeStatistics);
+ int16 stepEnergy = 10 - MIN(8, curChampion->_maxMana >> 3);
+ if (kineticEnergy < (stepEnergy << 2)) {
kineticEnergy += 3;
- L0991_i_StepEnergy--;
+ stepEnergy--;
}
- f326_championShootProjectile(L0992_ps_Champion, thing, kineticEnergy, 90, L0991_i_StepEnergy);
+
+ f326_championShootProjectile(curChampion, thing, kineticEnergy, 90, stepEnergy);
return true; // fix BUG_01
}
void ChampionMan::f326_championShootProjectile(Champion* champ, Thing thing, int16 kineticEnergy, int16 attack, int16 stepEnergy) {
- uint16 L0990_ui_Direction;
-
- L0990_ui_Direction = champ->_dir;
- _vm->_projexpl->f212_projectileCreate(thing, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, M21_normalizeModulo4((((champ->_cell - L0990_ui_Direction + 1) & 0x0002) >> 1) + L0990_ui_Direction), (direction)L0990_ui_Direction, kineticEnergy, attack, stepEnergy);
+ Direction newDirection = champ->_dir;
+ _vm->_projexpl->f212_projectileCreate(thing, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, M21_normalizeModulo4((((champ->_cell - newDirection + 1) & 0x0002) >> 1) + newDirection), newDirection, kineticEnergy, attack, stepEnergy);
_vm->_g311_projectileDisableMovementTicks = 4;
- _vm->_g312_lastProjectileDisabledMovementDirection = L0990_ui_Direction;
+ _vm->_g312_lastProjectileDisabledMovementDirection = newDirection;
}
void ChampionMan::f320_applyAndDrawPendingDamageAndWounds() {
@@ -1777,7 +1771,7 @@ void ChampionMan::load2_PartyPart(Common::InSaveFile* file) {
champ->_name[j] = file->readByte();
for (uint16 j = 0; j < 20; ++j)
champ->_title[j] = file->readByte();
- champ->_dir = (direction)file->readUint16BE();
+ champ->_dir = (Direction)file->readUint16BE();
champ->_cell = (ViewCell)file->readUint16BE();
champ->_actionIndex = (ChampionAction)file->readUint16BE();
champ->_symbolStep = file->readUint16BE();
@@ -2282,7 +2276,7 @@ T0292042:
_vm->_eventMan->f77_hideMouse();
}
-uint16 ChampionMan::M26_championIconIndex(int16 val, direction dir) {
+uint16 ChampionMan::M26_championIconIndex(int16 val, Direction dir) {
return ((val + 4 - dir) & 0x3);
}
diff --git a/engines/dm/champion.h b/engines/dm/champion.h
index e2956c1364..04ab76988f 100644
--- a/engines/dm/champion.h
+++ b/engines/dm/champion.h
@@ -370,7 +370,7 @@ public:
Skill _skills[20];
char _name[8];
char _title[20];
- direction _dir;
+ Direction _dir;
ViewCell _cell;
ChampionAction _actionIndex;
uint16 _symbolStep;
@@ -537,7 +537,7 @@ public:
uint16 f306_getStaminaAdjustedValue(Champion *champ, int16 val); // @ F0306_CHAMPION_GetStaminaAdjustedValue
uint16 f309_getMaximumLoad(Champion *champ); // @ F0309_CHAMPION_GetMaximumLoad
void f292_drawChampionState(ChampionIndex champIndex); // @ F0292_CHAMPION_DrawState
- uint16 M26_championIconIndex(int16 val, direction dir); // @ M26_CHAMPION_ICON_INDEX
+ uint16 M26_championIconIndex(int16 val, Direction dir); // @ M26_CHAMPION_ICON_INDEX
void f290_drawHealthStaminaManaValues(Champion *champ); // @ F0290_CHAMPION_DrawHealthStaminaManaValues
void f291_drawSlot(uint16 champIndex, int16 slotIndex); // @ F0291_CHAMPION_DrawSlot
void f281_renameChampion(Champion* champ); // @ F0281_CHAMPION_Rename
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp
index e7bb4a704d..5d003b7373 100644
--- a/engines/dm/dm.cpp
+++ b/engines/dm/dm.cpp
@@ -76,19 +76,19 @@ void warning(bool repeat, const char* s, ...) {
}
}
-void turnDirRight(direction &dir) { dir = (direction)((dir + 1) & 3); }
-void turnDirLeft(direction &dir) { dir = (direction)((dir - 1) & 3); }
-direction returnOppositeDir(direction dir) { return (direction)((dir + 2) & 3); }
+void turnDirRight(Direction &dir) { dir = (Direction)((dir + 1) & 3); }
+void turnDirLeft(Direction &dir) { dir = (Direction)((dir - 1) & 3); }
+Direction returnOppositeDir(Direction dir) { return (Direction)((dir + 2) & 3); }
uint16 returnPrevVal(uint16 val) {
- return (direction)((val + 3) & 3);
+ return (Direction)((val + 3) & 3);
}
uint16 returnNextVal(uint16 val) {
return (val + 1) & 0x3;
}
-bool isOrientedWestEast(direction dir) { return dir & 1; }
+bool isOrientedWestEast(Direction dir) { return dir & 1; }
uint16 toggleFlag(uint16& val, uint16 mask) {
return val ^= mask;
diff --git a/engines/dm/dm.h b/engines/dm/dm.h
index 4d48c94c83..c1881a0638 100644
--- a/engines/dm/dm.h
+++ b/engines/dm/dm.h
@@ -57,7 +57,7 @@ class DialogMan;
void warning(bool repeat, const char *s, ...);
-enum direction {
+enum Direction {
kDirNorth = 0,
kDirEast = 1,
kDirSouth = 2,
@@ -122,12 +122,12 @@ public:
-void turnDirRight(direction &dir);
-void turnDirLeft(direction &dir);
-direction returnOppositeDir(direction dir); // @ M18_OPPOSITE
+void turnDirRight(Direction &dir);
+void turnDirLeft(Direction &dir);
+Direction returnOppositeDir(Direction dir); // @ M18_OPPOSITE
uint16 returnPrevVal(uint16 val); // @ M19_PREVIOUS
uint16 returnNextVal(uint16 val); // @ M17_NEXT
-bool isOrientedWestEast(direction dir); // @ M16_IS_ORIENTED_WEST_EAST
+bool isOrientedWestEast(Direction dir); // @ M16_IS_ORIENTED_WEST_EAST
#define setFlag(val, mask) ((val) |= (mask))
diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp
index 6f13c9bf63..e01a154dc3 100644
--- a/engines/dm/dungeonman.cpp
+++ b/engines/dm/dungeonman.cpp
@@ -363,7 +363,7 @@ CreatureInfo g243_CreatureInfo[k27_CreatureTypeCount] = { // @ G0243_as_Graphic5
{25, 0, 0x38AA, 0x0000, 12, 22, 255, 180, 210, 0, 130, 0x6369, 0xFF37, 0x0FBF, 0x0564, 0xFB52, 5},
{26, 0, 0x38AA, 0x0000, 12, 22, 255, 180, 210, 0, 130, 0x6369, 0xFF37, 0x0FBF, 0x0564, 0xFB52, 5}};
-void DungeonMan::f150_mapCoordsAfterRelMovement(direction dir, int16 stepsForward, int16 stepsRight, int16 &posX, int16 &posY) {
+void DungeonMan::f150_mapCoordsAfterRelMovement(Direction dir, int16 stepsForward, int16 stepsRight, int16 &posX, int16 &posY) {
posX += _vm->_dirIntoStepCountEast[dir] * stepsForward;
posY += _vm->_dirIntoStepCountNorth[dir] * stepsForward;
turnDirRight(dir);
@@ -385,7 +385,7 @@ DungeonMan::DungeonMan(DMEngine *dmEngine) : _vm(dmEngine) {
for (uint16 i = 0; i < 16; ++i)
_g284_thingData[i] = nullptr;
_g279_dungeonMapData = nullptr;
- _g308_partyDir = (direction)0;
+ _g308_partyDir = (Direction)0;
_g306_partyMapX = 0;
_g307_partyMapY = 0;
_g309_partyMapIndex = 0;
@@ -549,7 +549,7 @@ void DungeonMan::f434_loadDungeonFile() {
dunDataStream.readByte(); // discard 1 byte
_g278_dungeonFileHeader._textDataWordCount = dunDataStream.readUint16BE();
uint16 partyPosition = dunDataStream.readUint16BE();
- _g278_dungeonFileHeader._partyStartDir = (direction)((partyPosition >> 10) & 3);
+ _g278_dungeonFileHeader._partyStartDir = (Direction)((partyPosition >> 10) & 3);
_g278_dungeonFileHeader._partyStartPosY = (partyPosition >> 5) & 0x1F;
_g278_dungeonFileHeader._partyStartPosX = (partyPosition >> 0) & 0x1F;
_g278_dungeonFileHeader._squareFirstThingCount = dunDataStream.readUint16BE();
@@ -788,7 +788,7 @@ Square DungeonMan::f151_getSquare(int16 mapX, int16 mapY) {
return Square(k0_ElementTypeWall, 0);
}
-Square DungeonMan::f152_getRelSquare(direction dir, int16 stepsForward, int16 stepsRight, int16 posX, int16 posY) {
+Square DungeonMan::f152_getRelSquare(Direction dir, int16 stepsForward, int16 stepsRight, int16 posX, int16 posY) {
f150_mapCoordsAfterRelMovement(dir, stepsForward, stepsForward, posX, posY);
return f151_getSquare(posX, posY);
}
@@ -822,7 +822,7 @@ Thing DungeonMan::f161_getSquareFirstThing(int16 mapX, int16 mapY) {
// TODO: produce more GOTOs
-void DungeonMan::f172_setSquareAspect(uint16 *aspectArray, direction dir, int16 mapX, int16 mapY) { // complete, except where marked
+void DungeonMan::f172_setSquareAspect(uint16 *aspectArray, Direction dir, int16 mapX, int16 mapY) { // complete, except where marked
#define thingType dir
byte L0307_uc_Multiple;
#define square L0307_uc_Multiple
@@ -928,7 +928,7 @@ different sides of the wall, the same text is drawn on each affected side */
T0172029_Teleporter:
footprintsAllowed = true;
T0172030_Pit:
- while ((thing != Thing::_endOfList) && ((thingType = (direction)thing.getType()) <= k3_SensorThingType)) {
+ while ((thing != Thing::_endOfList) && ((thingType = (Direction)thing.getType()) <= k3_SensorThingType)) {
if (thingType == k3_SensorThingType) {
sensor = (Sensor*)_vm->_dungeonMan->f156_getThingData(thing);
aspectArray[k4_FloorOrnOrdAspect] = sensor->getOrnOrdinal();
@@ -1554,7 +1554,7 @@ void DungeonMan::f146_setGroupCells(Group* group, uint16 cells, uint16 mapIndex)
void DungeonMan::f148_setGroupDirections(Group* group, int16 dir, uint16 mapIndex) {
if (mapIndex == _vm->_dungeonMan->_g309_partyMapIndex) {
- _vm->_groupMan->_g375_activeGroups[group->getActiveGroupIndex()]._directions = (direction)dir;
+ _vm->_groupMan->_g375_activeGroups[group->getActiveGroupIndex()]._directions = (Direction)dir;
} else {
group->setDir(M21_normalizeModulo4(dir));
}
diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h
index 16af8b31cb..95f8a1abf4 100644
--- a/engines/dm/dungeonman.h
+++ b/engines/dm/dungeonman.h
@@ -244,7 +244,7 @@ public:
bool isAudible() { return (_attributes >> 15) & 1; }
TeleporterScope getScope() { return (TeleporterScope)((_attributes >> 13) & 1); }
bool getAbsoluteRotation() { return (_attributes >> 12) & 1; }
- direction getRotation() { return (direction)((_attributes >> 10) & 1); }
+ Direction getRotation() { return (Direction)((_attributes >> 10) & 1); }
byte getTargetMapY() { return (_attributes >> 5) & 0xF; }
byte getTargetMapX() { return _attributes & 0xF; }
uint16 getTargetMapIndex() { return _destMapIndex >> 8; }
@@ -334,7 +334,7 @@ public:
uint16 getTargetMapY() { return (_action >> 11); }
uint16 getTargetMapX() { return (_action >> 6) & 0x1F; }
- direction getTargetCell() { return (direction)((_action >> 4) & 3); }
+ Direction getTargetCell() { return (Direction)((_action >> 4) & 3); }
uint16 M47_kineticEnergy() { return (_action & 0xFF); }// @ M47_KINETIC_ENERGY
uint16 M48_stepEnergy() { return (_action >> 8) & 0xFF; }// @ M48_STEP_ENERGY
uint16 M49_localEffect() { return _action; } // @ M49_LOCAL_EFFECT
@@ -611,7 +611,7 @@ struct DungeonFileHeader {
uint32 _rawMapDataSize;
uint8 _mapCount;
uint16 _textDataWordCount;
- direction _partyStartDir; // @ InitialPartyLocation
+ Direction _partyStartDir; // @ InitialPartyLocation
uint16 _partyStartPosX, _partyStartPosY;
uint16 _squareFirstThingCount; // @ SquareFirstThingCount
uint16 _thingCounts[16]; // @ ThingCount[16]
@@ -656,7 +656,7 @@ class DungeonMan {
DungeonMan(const DungeonMan &other); // no implementation on purpose
void operator=(const DungeonMan &rhs); // no implementation on purpose
- Square f152_getRelSquare(direction dir, int16 stepsForward, int16 stepsRight, int16 posX, int16 posY); // @ F0152_DUNGEON_GetRelativeSquare
+ Square f152_getRelSquare(Direction dir, int16 stepsForward, int16 stepsRight, int16 posX, int16 posY); // @ F0152_DUNGEON_GetRelativeSquare
void f455_decompressDungeonFile(); // @ F0455_FLOPPY_DecompressDungeon
@@ -683,11 +683,11 @@ public:
void f174_setCurrentMapAndPartyMap(uint16 mapIndex); // @ F0174_DUNGEON_SetCurrentMapAndPartyMap
bool f149_isWallOrnAnAlcove(int16 wallOrnIndex); // @ F0149_DUNGEON_IsWallOrnamentAnAlcove
- void f150_mapCoordsAfterRelMovement(direction dir, int16 stepsForward, int16 stepsRight, int16 &posX, int16 &posY); // @ F0150_DUNGEON_UpdateMapCoordinatesAfterRelativeMovement
- SquareType f153_getRelSquareType(direction dir, int16 stepsForward, int16 stepsRight, int16 posX, int16 posY) {
+ void f150_mapCoordsAfterRelMovement(Direction dir, int16 stepsForward, int16 stepsRight, int16 &posX, int16 &posY); // @ F0150_DUNGEON_UpdateMapCoordinatesAfterRelativeMovement
+ SquareType f153_getRelSquareType(Direction dir, int16 stepsForward, int16 stepsRight, int16 posX, int16 posY) {
return Square(f152_getRelSquare(dir, stepsForward, stepsRight, posX, posY)).getType();
} // @ F0153_DUNGEON_GetRelativeSquareType
- void f172_setSquareAspect(uint16 *aspectArray, direction dir, int16 mapX, int16 mapY); // @ F0172_DUNGEON_SetSquareAspect
+ void f172_setSquareAspect(uint16 *aspectArray, Direction dir, int16 mapX, int16 mapY); // @ F0172_DUNGEON_SetSquareAspect
void f168_decodeText(char *destString, Thing thing, TextType type); // F0168_DUNGEON_DecodeText
Thing f166_getUnusedThing(uint16 thingType); // @ F0166_DUNGEON_GetUnusedThing
@@ -725,7 +725,7 @@ public:
byte ***_g279_dungeonMapData; // @ G0279_pppuc_DungeonMapData
- direction _g308_partyDir; // @ G0308_i_PartyDirection
+ Direction _g308_partyDir; // @ G0308_i_PartyDirection
int16 _g306_partyMapX; // @ G0306_i_PartyMapX
int16 _g307_partyMapY; // @ G0307_i_PartyMapY
uint8 _g309_partyMapIndex; // @ G0309_i_PartyMapIndex
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index dae340085f..d264bf1c79 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -1462,7 +1462,7 @@ void DisplayMan::f100_drawWallSetBitmap(byte *bitmap, Frame &f) {
// NOTE: has been screened for missing code
-void DisplayMan::f116_drawSquareD3L(direction dir, int16 posX, int16 posY) {
+void DisplayMan::f116_drawSquareD3L(Direction dir, int16 posX, int16 posY) {
static DoorFrames g179_doorFrame_D3L = DoorFrames( // @ G0179_s_Graphic558_Frames_Door_D3L
/* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */
Frame(24, 71, 28, 67, 24, 41, 0, 0), /* Closed Or Destroyed */
@@ -1527,7 +1527,7 @@ T0116017_orangeElk:
}
}
-void DisplayMan::f117_drawSquareD3R(direction dir, int16 posX, int16 posY) {
+void DisplayMan::f117_drawSquareD3R(Direction dir, int16 posX, int16 posY) {
static DoorFrames g181_doorFrame_D3R = DoorFrames( // @ G0181_s_Graphic558_Frames_Door_D3R
/* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */
Frame(150, 197, 28, 67, 24, 41, 0, 0), /* Closed Or Destroyed */
@@ -1598,7 +1598,7 @@ T0117018:
}
}
-void DisplayMan::f118_drawSquareD3C(direction dir, int16 posX, int16 posY) {
+void DisplayMan::f118_drawSquareD3C(Direction dir, int16 posX, int16 posY) {
static DoorFrames g180_doorFrame_D3C = DoorFrames( // @ G0180_s_Graphic558_Frames_Door_D3C
/* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */
Frame(88, 135, 28, 67, 24, 41, 0, 0), /* Closed Or Destroyed */
@@ -1662,7 +1662,7 @@ T0118028:
}
}
-void DisplayMan::f119_drawSquareD2L(direction dir, int16 posX, int16 posY) {
+void DisplayMan::f119_drawSquareD2L(Direction dir, int16 posX, int16 posY) {
static DoorFrames g182_doorFrame_D2L = DoorFrames( // @ G0182_s_Graphic558_Frames_Door_D2L
/* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */
Frame(0, 63, 24, 82, 32, 61, 0, 0), /* Closed Or Destroyed */
@@ -1728,7 +1728,7 @@ T0119020:
}
}
-void DisplayMan::f120_drawSquareD2R(direction dir, int16 posX, int16 posY) {
+void DisplayMan::f120_drawSquareD2R(Direction dir, int16 posX, int16 posY) {
static DoorFrames g184_doorFrame_D2R = DoorFrames( // @ G0184_s_Graphic558_Frames_Door_D2R
/* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */
Frame(160, 223, 24, 82, 32, 61, 0, 0), /* Closed Or Destroyed */
@@ -1796,7 +1796,7 @@ T0120029:
}
}
-void DisplayMan::f121_drawSquareD2C(direction dir, int16 posX, int16 posY) {
+void DisplayMan::f121_drawSquareD2C(Direction dir, int16 posX, int16 posY) {
static DoorFrames g183_doorFrame_D2C = DoorFrames( // @ G0183_s_Graphic558_Frames_Door_D2C
/* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */
Frame(80, 143, 24, 82, 32, 61, 0, 0), /* Closed Or Destroyed */
@@ -1862,7 +1862,7 @@ T0121016:
}
}
-void DisplayMan::f122_drawSquareD1L(direction dir, int16 posX, int16 posY) {
+void DisplayMan::f122_drawSquareD1L(Direction dir, int16 posX, int16 posY) {
static DoorFrames g185_doorFrame_D1L = DoorFrames( // @ G0185_s_Graphic558_Frames_Door_D1L
/* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */
Frame(0, 31, 17, 102, 48, 88, 64, 0), /* Closed Or Destroyed */
@@ -1929,7 +1929,7 @@ T0122021:
}
}
-void DisplayMan::f123_drawSquareD1R(direction dir, int16 posX, int16 posY) {
+void DisplayMan::f123_drawSquareD1R(Direction dir, int16 posX, int16 posY) {
static DoorFrames g187_doorFrame_D1R = DoorFrames( // @ G0187_s_Graphic558_Frames_Door_D1R
/* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */
Frame(192, 223, 17, 102, 48, 88, 0, 0), /* Closed Or Destroyed */
@@ -1995,7 +1995,7 @@ T0123021:
f113_drawField(&g188_FieldAspects[k8_ViewSquare_D1R], g163_FrameWalls[k8_ViewSquare_D1R]._box);
}
}
-void DisplayMan::f124_drawSquareD1C(direction dir, int16 posX, int16 posY) {
+void DisplayMan::f124_drawSquareD1C(Direction dir, int16 posX, int16 posY) {
static Box g107_BoxThievesEyeVisibleArea(0, 95, 0, 94); // @ G0107_s_Graphic558_Box_ThievesEye_VisibleArea
int16 order;
int16 squareAspect[5];
@@ -2075,7 +2075,7 @@ T0124018:
}
}
-void DisplayMan::f125_drawSquareD0L(direction dir, int16 posX, int16 posY) {
+void DisplayMan::f125_drawSquareD0L(Direction dir, int16 posX, int16 posY) {
uint16 squareAspect[5];
_vm->_dungeonMan->f172_setSquareAspect(squareAspect, dir, posX, posY);
switch (squareAspect[0]) {
@@ -2091,7 +2091,7 @@ void DisplayMan::f125_drawSquareD0L(direction dir, int16 posX, int16 posY) {
}
}
-void DisplayMan::f126_drawSquareD0R(direction dir, int16 posX, int16 posY) {
+void DisplayMan::f126_drawSquareD0R(Direction dir, int16 posX, int16 posY) {
int16 squareAspect[5];
@@ -2118,7 +2118,7 @@ void DisplayMan::f126_drawSquareD0R(direction dir, int16 posX, int16 posY) {
}
}
-void DisplayMan::f127_drawSquareD0C(direction dir, int16 posX, int16 posY) {
+void DisplayMan::f127_drawSquareD0C(Direction dir, int16 posX, int16 posY) {
static Box g108_BoxThievesEyeHoleInDoorFrame(0, 31, 19, 113); // @ G0108_s_Graphic558_Box_ThievesEye_HoleInDoorFrame
int16 squareAspect[5];
@@ -2155,7 +2155,7 @@ void DisplayMan::f127_drawSquareD0C(direction dir, int16 posX, int16 posY) {
}
}
-void DisplayMan::f128_drawDungeon(direction dir, int16 posX, int16 posY) {
+void DisplayMan::f128_drawDungeon(Direction dir, int16 posX, int16 posY) {
loadPalette(g20_PalEntrance); // dummy code
@@ -2878,7 +2878,7 @@ int16 g225_CenteredExplosionCoordinates[15][2] = { // @ G0225_aai_Graphic558_Cen
#define k0x0080_BlitDoNotUseMask 0x0080 // @ MASK0x0080_DO_NOT_USE_MASK
-void DisplayMan::f115_cthulhu(Thing thingParam, direction directionParam, int16 mapXpos,
+void DisplayMan::f115_cthulhu(Thing thingParam, Direction directionParam, int16 mapXpos,
int16 mapYpos, int16 viewSquareIndex, uint16 orderedViewCellOrdinals) {
DungeonMan &dunMan = *_vm->_dungeonMan;
@@ -3460,7 +3460,7 @@ continue;
projectileBitmapIndexData = 0;
flipVertical = flipHorizontal = false;
} else {
- if (isOrientedWestEast((direction)(projectileDirection = _vm->_timeline->_g370_events[projectile->_eventIndex]._C._projectile.getDir()))
+ if (isOrientedWestEast((Direction)(projectileDirection = _vm->_timeline->_g370_events[projectile->_eventIndex]._C._projectile.getDir()))
!= isOrientedWestEast(directionParam)) {
if (projectileAspectType == k2_ProjectileAspectHasRotation) {
projectileBitmapIndexData = 1;
diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h
index 1a1ad493e1..3af375d493 100644
--- a/engines/dm/gfx.h
+++ b/engines/dm/gfx.h
@@ -530,18 +530,18 @@ class DisplayMan {
void f104_drawFloorPitOrStairsBitmap(uint16 nativeIndex, Frame &frame); // @ F0104_DUNGEONVIEW_DrawFloorPitOrStairsBitmap
void f100_drawWallSetBitmap(byte *bitmap, Frame &f); // @ F0100_DUNGEONVIEW_DrawWallSetBitmap
void f101_drawWallSetBitmapWithoutTransparency(byte *bitmap, Frame &f); // @ F0101_DUNGEONVIEW_DrawWallSetBitmapWithoutTransparency
- void f116_drawSquareD3L(direction dir, int16 posX, int16 posY); // @ F0116_DUNGEONVIEW_DrawSquareD3L
- void f117_drawSquareD3R(direction dir, int16 posX, int16 posY); // @ F0117_DUNGEONVIEW_DrawSquareD3R
- void f118_drawSquareD3C(direction dir, int16 posX, int16 posY); // @ F0118_DUNGEONVIEW_DrawSquareD3C_CPSF
- void f119_drawSquareD2L(direction dir, int16 posX, int16 posY); // @ F0119_DUNGEONVIEW_DrawSquareD2L
- void f120_drawSquareD2R(direction dir, int16 posX, int16 posY); // @ F0120_DUNGEONVIEW_DrawSquareD2R_CPSF
- void f121_drawSquareD2C(direction dir, int16 posX, int16 posY); // @ F0121_DUNGEONVIEW_DrawSquareD2C
- void f122_drawSquareD1L(direction dir, int16 posX, int16 posY); // @ F0122_DUNGEONVIEW_DrawSquareD1L
- void f123_drawSquareD1R(direction dir, int16 posX, int16 posY); // @ F0123_DUNGEONVIEW_DrawSquareD1R
- void f124_drawSquareD1C(direction dir, int16 posX, int16 posY); // @ F0124_DUNGEONVIEW_DrawSquareD1C
- void f125_drawSquareD0L(direction dir, int16 posX, int16 posY); // @ F0125_DUNGEONVIEW_DrawSquareD0L
- void f126_drawSquareD0R(direction dir, int16 posX, int16 posY); // @ F0126_DUNGEONVIEW_DrawSquareD0R
- void f127_drawSquareD0C(direction dir, int16 posX, int16 posY); // @ F0127_DUNGEONVIEW_DrawSquareD0C
+ void f116_drawSquareD3L(Direction dir, int16 posX, int16 posY); // @ F0116_DUNGEONVIEW_DrawSquareD3L
+ void f117_drawSquareD3R(Direction dir, int16 posX, int16 posY); // @ F0117_DUNGEONVIEW_DrawSquareD3R
+ void f118_drawSquareD3C(Direction dir, int16 posX, int16 posY); // @ F0118_DUNGEONVIEW_DrawSquareD3C_CPSF
+ void f119_drawSquareD2L(Direction dir, int16 posX, int16 posY); // @ F0119_DUNGEONVIEW_DrawSquareD2L
+ void f120_drawSquareD2R(Direction dir, int16 posX, int16 posY); // @ F0120_DUNGEONVIEW_DrawSquareD2R_CPSF
+ void f121_drawSquareD2C(Direction dir, int16 posX, int16 posY); // @ F0121_DUNGEONVIEW_DrawSquareD2C
+ void f122_drawSquareD1L(Direction dir, int16 posX, int16 posY); // @ F0122_DUNGEONVIEW_DrawSquareD1L
+ void f123_drawSquareD1R(Direction dir, int16 posX, int16 posY); // @ F0123_DUNGEONVIEW_DrawSquareD1R
+ void f124_drawSquareD1C(Direction dir, int16 posX, int16 posY); // @ F0124_DUNGEONVIEW_DrawSquareD1C
+ void f125_drawSquareD0L(Direction dir, int16 posX, int16 posY); // @ F0125_DUNGEONVIEW_DrawSquareD0L
+ void f126_drawSquareD0R(Direction dir, int16 posX, int16 posY); // @ F0126_DUNGEONVIEW_DrawSquareD0R
+ void f127_drawSquareD0C(Direction dir, int16 posX, int16 posY); // @ F0127_DUNGEONVIEW_DrawSquareD0C
void f93_applyCreatureReplColors(int replacedColor, int replacementColor); // @ F0093_DUNGEONVIEW_ApplyCreatureReplacementColors
@@ -680,7 +680,7 @@ public:
void D24_fillScreenBox(Box &box, Color color); // @ D24_FillScreenBox, F0550_VIDEO_FillScreenBox
/* Expects inclusive boundaries in box */
void f135_fillBoxBitmap(byte *destBitmap, Box &box, Color color, int16 byteWidth, int16 height); // @ F0135_VIDEO_FillBox
- void f128_drawDungeon(direction dir, int16 posX, int16 posY); // @ F0128_DUNGEONVIEW_Draw_CPSF
+ void f128_drawDungeon(Direction dir, int16 posX, int16 posY); // @ F0128_DUNGEONVIEW_Draw_CPSF
void f98_drawFloorAndCeiling(); // @ F0098_DUNGEONVIEW_DrawFloorAndCeiling
void updateScreen();
void f97_drawViewport(int16 palSwitchingRequestedState); // @ F0097_DUNGEONVIEW_DrawViewport
@@ -692,7 +692,7 @@ public:
int16 f459_getScaledBitmapByteCount(int16 byteWidth, int16 height, int16 scale); // @ F0459_START_GetScaledBitmapByteCount
int16 M78_getScaledDimension(int16 dimension, int16 scale); // @ M78_SCALED_DIMENSION
- void f115_cthulhu(Thing thingParam, direction directionParam,
+ void f115_cthulhu(Thing thingParam, Direction directionParam,
int16 mapXpos, int16 mapYpos, int16 viewSquareIndex,
uint16 orderedViewCellOrdinals); // @ F0115_DUNGEONVIEW_DrawObjectsCreaturesProjectilesExplosions_CPSEF
uint16 M77_getNormalizedByteWidth(uint16 byteWidth); // @ M77_NORMALIZED_BYTE_WIDTH
diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp
index 235bfe40b6..ec2090cc6e 100644
--- a/engines/dm/group.cpp
+++ b/engines/dm/group.cpp
@@ -873,8 +873,8 @@ T0209084_SingleSquareMoveTowardParty:
T0209085_SingleSquareMove:
if (f202_isMovementPossible(&L0448_s_CreatureInfo, eventMapX, eventMapY, AL0446_i_Direction = L0454_i_PrimaryDirectionToOrFromParty, L0456_B_AllowMovementOverImaginaryPitsAndFakeWalls) ||
f202_isMovementPossible(&L0448_s_CreatureInfo, eventMapX, eventMapY, AL0446_i_Direction = _vm->_projexpl->_g363_secondaryDirToOrFromParty, L0456_B_AllowMovementOverImaginaryPitsAndFakeWalls && _vm->getRandomNumber(2)) ||
- f202_isMovementPossible(&L0448_s_CreatureInfo, eventMapX, eventMapY, AL0446_i_Direction = returnOppositeDir((direction)AL0446_i_Direction), false) ||
- (!_vm->getRandomNumber(4) && f202_isMovementPossible(&L0448_s_CreatureInfo, eventMapX, eventMapY, AL0446_i_Direction = returnOppositeDir((direction)L0454_i_PrimaryDirectionToOrFromParty), false))) {
+ f202_isMovementPossible(&L0448_s_CreatureInfo, eventMapX, eventMapY, AL0446_i_Direction = returnOppositeDir((Direction)AL0446_i_Direction), false) ||
+ (!_vm->getRandomNumber(4) && f202_isMovementPossible(&L0448_s_CreatureInfo, eventMapX, eventMapY, AL0446_i_Direction = returnOppositeDir((Direction)L0454_i_PrimaryDirectionToOrFromParty), false))) {
AL0450_i_DestinationMapX = eventMapX;
AL0451_i_DestinationMapY = eventMapY;
AL0450_i_DestinationMapX += _vm->_dirIntoStepCountEast[AL0446_i_Direction], AL0451_i_DestinationMapY += _vm->_dirIntoStepCountNorth[AL0446_i_Direction];
@@ -885,8 +885,8 @@ T0209089_DoubleSquareMove:
f203_getFirstPossibleMovementDirOrdinal(&L0448_s_CreatureInfo, eventMapX, eventMapY, false); /* BUG0_00 Useless code. Returned value is ignored. When Lord Chaos teleports two squares away the ability to move to the first square is ignored which means Lord Chaos can teleport through walls or any other obstacle */
if (f204_isArchenemyDoubleMovementPossible(&L0448_s_CreatureInfo, eventMapX, eventMapY, AL0446_i_Direction = L0454_i_PrimaryDirectionToOrFromParty) ||
f204_isArchenemyDoubleMovementPossible(&L0448_s_CreatureInfo, eventMapX, eventMapY, AL0446_i_Direction = _vm->_projexpl->_g363_secondaryDirToOrFromParty) ||
- (_g386_fluxCageCount && f204_isArchenemyDoubleMovementPossible(&L0448_s_CreatureInfo, eventMapX, eventMapY, AL0446_i_Direction = returnOppositeDir((direction)AL0446_i_Direction))) ||
- ((_g386_fluxCageCount >= 2) && f204_isArchenemyDoubleMovementPossible(&L0448_s_CreatureInfo, eventMapX, eventMapY, AL0446_i_Direction = returnOppositeDir((direction)L0454_i_PrimaryDirectionToOrFromParty)))) {
+ (_g386_fluxCageCount && f204_isArchenemyDoubleMovementPossible(&L0448_s_CreatureInfo, eventMapX, eventMapY, AL0446_i_Direction = returnOppositeDir((Direction)AL0446_i_Direction))) ||
+ ((_g386_fluxCageCount >= 2) && f204_isArchenemyDoubleMovementPossible(&L0448_s_CreatureInfo, eventMapX, eventMapY, AL0446_i_Direction = returnOppositeDir((Direction)L0454_i_PrimaryDirectionToOrFromParty)))) {
AL0450_i_DestinationMapX = eventMapX;
AL0451_i_DestinationMapY = eventMapY;
AL0450_i_DestinationMapX += _vm->_dirIntoStepCountEast[AL0446_i_Direction] * 2, AL0451_i_DestinationMapY += _vm->_dirIntoStepCountNorth[AL0446_i_Direction] * 2;
@@ -925,8 +925,8 @@ T0209096_SetBehavior0_Wander:
AL0451_i_TargetMapY = L0445_ps_ActiveGroup->_targetMapY;
}
/* Try and flee from the party (opposite direction) */
- L0454_i_PrimaryDirectionToOrFromParty = returnOppositeDir((direction)f228_getDirsWhereDestIsVisibleFromSource(eventMapX, eventMapY, AL0450_i_TargetMapX, AL0451_i_TargetMapY));
- _vm->_projexpl->_g363_secondaryDirToOrFromParty = returnOppositeDir((direction)_vm->_projexpl->_g363_secondaryDirToOrFromParty);
+ L0454_i_PrimaryDirectionToOrFromParty = returnOppositeDir((Direction)f228_getDirsWhereDestIsVisibleFromSource(eventMapX, eventMapY, AL0450_i_TargetMapX, AL0451_i_TargetMapY));
+ _vm->_projexpl->_g363_secondaryDirToOrFromParty = returnOppositeDir((Direction)_vm->_projexpl->_g363_secondaryDirToOrFromParty);
L0461_i_MovementTicks -= (L0461_i_MovementTicks >> 2);
goto T0209085_SingleSquareMove;
}
@@ -996,7 +996,7 @@ T0209096_SetBehavior0_Wander:
AL0446_i_Cell++;
}
if (!_vm->_groupMan->f176_getCreatureOrdinalInCell(L0444_ps_Group, AL0446_i_Cell = M21_normalizeModulo4(AL0446_i_Cell)) ||
- (_vm->getRandomNumber(2) && !_vm->_groupMan->f176_getCreatureOrdinalInCell(L0444_ps_Group, AL0446_i_Cell = returnOppositeDir((direction)AL0446_i_Cell)))) { /* If the selected cell (or the opposite cell) is not already occupied by a creature */
+ (_vm->getRandomNumber(2) && !_vm->_groupMan->f176_getCreatureOrdinalInCell(L0444_ps_Group, AL0446_i_Cell = returnOppositeDir((Direction)AL0446_i_Cell)))) { /* If the selected cell (or the opposite cell) is not already occupied by a creature */
if (_vm->_projexpl->f218_projectileGetImpactCount(kM1_CreatureElemType, eventMapX, eventMapY, L0445_ps_ActiveGroup->_cells) && (_vm->_projexpl->_g364_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup)) /* BUG0_70 A projectile impact on a creature may be ignored. The function F0218_PROJECTILE_GetImpactCount to detect projectile impacts when a quarter square sized creature moves inside a group (to another cell on the same square) may fail if there are several creatures in the group because the function expects a single cell index for its last parameter. The function should be called once for each cell where there is a creature */
goto T0209139_Return;
if (_vm->_projexpl->_g364_creatureDamageOutcome != k1_outcomeKilledSomeCreaturesInGroup) {
@@ -1072,7 +1072,7 @@ bool GroupMan::f202_isMovementPossible(CreatureInfo *creatureInfo, int16 mapX, i
if (creatureInfo->_movementTicks == k255_immobile) {
return false;
}
- _vm->_dungeonMan->f150_mapCoordsAfterRelMovement((direction)dir, 1, 0, mapX, mapY);
+ _vm->_dungeonMan->f150_mapCoordsAfterRelMovement((Direction)dir, 1, 0, mapX, mapY);
L0428_i_MapX = mapX;
L0429_i_MapY = mapY;
if (_g387_groupMovBlockedByWallStairsPitFakeWalFluxCageTeleporter =
@@ -1333,7 +1333,7 @@ void GroupMan::f205_setDirection(ActiveGroup *activeGroup, int16 dir, int16 crea
G0395_l_TwoHalfSquareSizedCreaturesGroupLastDirectionSetTime = _vm->_g313_gameTime;
G0396_ps_TwoHalfSquareSizedCreaturesGroupLastDirectionSetActiveGroup = activeGroup;
}
- activeGroup->_directions = (direction)L0435_ui_GroupDirections;
+ activeGroup->_directions = (Direction)L0435_ui_GroupDirections;
}
void GroupMan::f208_groupAddEvent(TimelineEvent *event, uint32 time) {
@@ -1488,7 +1488,7 @@ bool GroupMan::f207_isCreatureAttacking(Group *group, int16 mapX, int16 mapY, ui
AL0440_i_KineticEnergy += _vm->getRandomNumber(AL0440_i_KineticEnergy);
AL0440_i_KineticEnergy += _vm->getRandomNumber(AL0440_i_KineticEnergy);
_vm->f064_SOUND_RequestPlay_CPSD(k13_soundSPELL, mapX, mapY, k0_soundModePlayImmediately);
- _vm->_projexpl->f212_projectileCreate(Thing(AL0437_T_Thing), mapX, mapY, AL0439_i_TargetCell, (direction)_g382_currGroupPrimaryDirToParty, f26_getBoundedValue((int16)20, AL0440_i_KineticEnergy, (int16)255), L0441_ps_CreatureInfo->_dexterity, 8);
+ _vm->_projexpl->f212_projectileCreate(Thing(AL0437_T_Thing), mapX, mapY, AL0439_i_TargetCell, (Direction)_g382_currGroupPrimaryDirToParty, f26_getBoundedValue((int16)20, AL0440_i_KineticEnergy, (int16)255), L0441_ps_CreatureInfo->_dexterity, 8);
} else {
if (getFlag(L0441_ps_CreatureInfo->_attributes, k0x0010_MaskCreatureInfo_attackAnyChamp)) {
AL0439_i_ChampionIndex = _vm->getRandomNumber(4);
@@ -1510,7 +1510,7 @@ bool GroupMan::f207_isCreatureAttacking(Group *group, int16 mapX, int16 mapY, ui
Champion *L0442_ps_Champion = &_vm->_championMan->_gK71_champions[AL0439_i_ChampionIndex];
if (AL0440_i_Damage > L0442_ps_Champion->_maximumDamageReceived) {
L0442_ps_Champion->_maximumDamageReceived = AL0440_i_Damage;
- L0442_ps_Champion->_directionMaximumDamageReceived = returnOppositeDir((direction)L0438_ui_PrimaryDirectionToParty);
+ L0442_ps_Champion->_directionMaximumDamageReceived = returnOppositeDir((Direction)L0438_ui_PrimaryDirectionToParty);
}
}
}
@@ -1710,7 +1710,7 @@ void GroupMan::f183_addActiveGroup(Thing thing, int16 mapX, int16 mapY) {
L0341_ps_ActiveGroup->_lastMoveTime = _vm->_g313_gameTime - 127;
L0339_ui_CreatureIndex = L0340_ps_Group->getCount();
do {
- L0341_ps_ActiveGroup->_directions = (direction)f178_getGroupValueUpdatedWithCreatureValue(L0341_ps_ActiveGroup->_directions, L0339_ui_CreatureIndex, L0340_ps_Group->getDir());
+ L0341_ps_ActiveGroup->_directions = (Direction)f178_getGroupValueUpdatedWithCreatureValue(L0341_ps_ActiveGroup->_directions, L0339_ui_CreatureIndex, L0340_ps_Group->getDir());
L0341_ps_ActiveGroup->_aspect[L0339_ui_CreatureIndex] = 0;
} while (L0339_ui_CreatureIndex--);
f179_getCreatureAspectUpdateTime(L0341_ps_ActiveGroup, kM1_wholeCreatureGroup, false);
@@ -1770,7 +1770,7 @@ void GroupMan::f195_addAllActiveGroups() {
}
}
-Thing GroupMan::f185_groupGetGenerated(int16 creatureType, int16 healthMultiplier, uint16 creatureCount, direction dir, int16 mapX, int16 mapY) {
+Thing GroupMan::f185_groupGetGenerated(int16 creatureType, int16 healthMultiplier, uint16 creatureCount, Direction dir, int16 mapX, int16 mapY) {
Thing L0349_T_GroupThing;
uint16 L0350_ui_BaseHealth;
uint16 L0351_ui_Cell = 0;
@@ -2082,7 +2082,7 @@ void GroupMan::load1_ActiveGroupPart(Common::InSaveFile* file) {
for (uint16 i = 0; i < _g376_maxActiveGroupCount; ++i) {
ActiveGroup *group = &_g375_activeGroups[i];
group->_groupThingIndex = file->readUint16BE();
- group->_directions = (direction)file->readUint16BE();
+ group->_directions = (Direction)file->readUint16BE();
group->_cells = file->readByte();
group->_lastMoveTime = file->readByte();
group->_delayFleeingFromTarget = file->readByte();
diff --git a/engines/dm/group.h b/engines/dm/group.h
index 1447783ffc..5194b907fd 100644
--- a/engines/dm/group.h
+++ b/engines/dm/group.h
@@ -93,7 +93,7 @@ enum CreatureType {
class ActiveGroup {
public:
int16 _groupThingIndex;
- direction _directions;
+ Direction _directions;
byte _cells;
byte _lastMoveTime;
byte _delayFleeingFromTarget;
@@ -130,7 +130,7 @@ public:
uint16 setBehaviour(uint16 val) { _flags = (_flags & ~0xF) | (val & 0xF); return (val & 0xF); }
uint16 getCount() { return (_flags >> 5) & 0x3; }
void setCount(uint16 val) { _flags = (_flags & ~(0x3 << 5)) | ((val & 0x3) << 5); }
- direction getDir() { return (direction)((_flags >> 8) & 0x3); }
+ Direction getDir() { return (Direction)((_flags >> 8) & 0x3); }
void setDir(uint16 val) { _flags = (_flags & ~(0x3 << 8)) | ((val & 0x3) << 8); }
uint16 getDoNotDiscard() { return (_flags >> 10) & 0x1; }
void setDoNotDiscard(bool val) { _flags = (_flags & ~(1 << 10)) | ((val & 1) << 10); }
@@ -234,7 +234,7 @@ public:
void f184_removeActiveGroup(uint16 activeGroupIndex); // @ F0184_GROUP_RemoveActiveGroup
void f194_removeAllActiveGroups(); // @ F0194_GROUP_RemoveAllActiveGroups
void f195_addAllActiveGroups(); // @ F0195_GROUP_AddAllActiveGroups
- Thing f185_groupGetGenerated(int16 creatureType, int16 healthMultiplier, uint16 creatureCount, direction dir, int16 mapX, int16 mapY); // @ F0185_GROUP_GetGenerated
+ Thing f185_groupGetGenerated(int16 creatureType, int16 healthMultiplier, uint16 creatureCount, Direction dir, int16 mapX, int16 mapY); // @ F0185_GROUP_GetGenerated
bool f223_isSquareACorridorTeleporterPitOrDoor(int16 mapX, int16 mapY); // @ F0223_GROUP_IsSquareACorridorTeleporterPitOrDoor
int16 f177_getMeleeTargetCreatureOrdinal(int16 groupX, int16 groupY, int16 partyX, int16 paryY,
uint16 champCell); // @ F0177_GROUP_GetMeleeTargetCreatureOrdinal
diff --git a/engines/dm/loadsave.cpp b/engines/dm/loadsave.cpp
index 138f9fd7ed..a19cef20b9 100644
--- a/engines/dm/loadsave.cpp
+++ b/engines/dm/loadsave.cpp
@@ -83,7 +83,7 @@ LoadgameResponse DMEngine::f435_loadgame(int16 slot) {
_championMan->_g305_partyChampionCount = file->readUint16BE();
_dungeonMan->_g306_partyMapX = file->readSint16BE();
_dungeonMan->_g307_partyMapY = file->readSint16BE();
- _dungeonMan->_g308_partyDir = (direction)file->readUint16BE();
+ _dungeonMan->_g308_partyDir = (Direction)file->readUint16BE();
_dungeonMan->_g309_partyMapIndex = file->readByte();
_championMan->_g411_leaderIndex = (ChampionIndex)file->readSint16BE();
_championMan->_g514_magicCasterChampionIndex = (ChampionIndex)file->readSint16BE();
diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp
index 5a4c8742c7..54ce632590 100644
--- a/engines/dm/menus.cpp
+++ b/engines/dm/menus.cpp
@@ -215,7 +215,7 @@ void MenuMan::f390_refreshActionAreaAndSetChampDirMaxDamageReceived() {
&& (champ->_maximumDamageReceived)
&& (champ->_dir != champ->_directionMaximumDamageReceived)) {
- champ->_dir = (direction)champ->_directionMaximumDamageReceived;
+ champ->_dir = (Direction)champ->_directionMaximumDamageReceived;
champ->setAttributeFlag(k0x0400_ChampionAttributeIcon, true);
champMan.f292_drawChampionState((ChampionIndex)champIndex);
}
diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp
index 89b369386a..1011b4240c 100644
--- a/engines/dm/movesens.cpp
+++ b/engines/dm/movesens.cpp
@@ -377,7 +377,7 @@ bool MovesensMan::f267_getMoveResult(Thing thing, int16 mapX, int16 mapY, int16
}
L0716_ui_Direction = _vm->_dungeonMan->f155_getStairsExitDirection(destMapX, destMapY);
destMapX += _vm->_dirIntoStepCountEast[L0716_ui_Direction], destMapY += _vm->_dirIntoStepCountNorth[L0716_ui_Direction];
- L0716_ui_Direction = returnOppositeDir((direction)L0716_ui_Direction);
+ L0716_ui_Direction = returnOppositeDir((Direction)L0716_ui_Direction);
AL0727_ui_ThingCell = thing.getCell();
AL0727_ui_ThingCell = M21_normalizeModulo4((((AL0727_ui_ThingCell - L0716_ui_Direction + 1) & 0x0002) >> 1) + L0716_ui_Direction);
thing = M15_thingWithNewCell(thing, AL0727_ui_ThingCell);
diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp
index 8996693f4b..06ba83afd8 100644
--- a/engines/dm/projexpl.cpp
+++ b/engines/dm/projexpl.cpp
@@ -45,7 +45,7 @@ ProjExpl::ProjExpl(DMEngine* vm) : _vm(vm) {
_g362_lastPartyMovementTime = 0;
}
-void ProjExpl::f212_projectileCreate(Thing thing, int16 mapX, int16 mapY, uint16 cell, direction dir, byte kineticEnergy, byte attack, byte stepEnergy) {
+void ProjExpl::f212_projectileCreate(Thing thing, int16 mapX, int16 mapY, uint16 cell, Direction dir, byte kineticEnergy, byte attack, byte stepEnergy) {
Thing L0466_T_ProjectileThing;
Projectile* L0467_ps_Projectile;
TimelineEvent L0468_s_Event;
@@ -482,7 +482,7 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) {
_vm->_movsens->f267_getMoveResult(L0515_T_ProjectileThingNewCell, L0525_i_SourceMapX, L0526_i_SourceMapY, L0523_i_DestinationMapX, L0524_i_DestinationMapY);
L0519_ps_Event->_C._projectile.setMapX(_vm->_movsens->_g397_moveResultMapX);
L0519_ps_Event->_C._projectile.setMapY(_vm->_movsens->_g398_moveResultMapY);
- L0519_ps_Event->_C._projectile.setDir((direction)_vm->_movsens->_g400_moveResultDir);
+ L0519_ps_Event->_C._projectile.setDir((Direction)_vm->_movsens->_g400_moveResultDir);
L0515_T_ProjectileThingNewCell = M15_thingWithNewCell(L0515_T_ProjectileThingNewCell, _vm->_movsens->_g401_moveResultCell);
M31_setMap(L0519_ps_Event->_mapTime, _vm->_movsens->_g399_moveResultMapIndex);
} else {
diff --git a/engines/dm/projexpl.h b/engines/dm/projexpl.h
index d0e030f719..0d6f3b66c0 100644
--- a/engines/dm/projexpl.h
+++ b/engines/dm/projexpl.h
@@ -88,7 +88,7 @@ public:
int16 _g367_projectileAttackType; // @ G0367_i_ProjectileAttackType
int32 _g362_lastPartyMovementTime; // @ G0362_l_LastPartyMovementTime
explicit ProjExpl(DMEngine *vm);
- void f212_projectileCreate(Thing thing, int16 mapX, int16 mapY, uint16 cell, direction dir,
+ void f212_projectileCreate(Thing thing, int16 mapX, int16 mapY, uint16 cell, Direction dir,
byte kineticEnergy, byte attack, byte stepEnergy); // @ F0212_PROJECTILE_Create
bool f217_projectileHasImpactOccurred(int16 impactType, int16 mapXCombo, int16 mapYCombo,
int16 cell, Thing projectileThing); // @ F0217_PROJECTILE_HasImpactOccured
diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp
index 09e31bf935..33bfc61555 100644
--- a/engines/dm/timeline.cpp
+++ b/engines/dm/timeline.cpp
@@ -582,7 +582,7 @@ void Timeline::f249_moveTeleporterOrPitSquareThings(uint16 mapX, uint16 mapY) {
L0647_ps_Event = &_vm->_timeline->_g370_events[L0646_ps_Projectile->_eventIndex];
L0647_ps_Event->_C._projectile.setMapX(_vm->_movsens->_g397_moveResultMapX);
L0647_ps_Event->_C._projectile.setMapY(_vm->_movsens->_g398_moveResultMapY);
- L0647_ps_Event->_C._projectile.setDir((direction)_vm->_movsens->_g400_moveResultDir);
+ L0647_ps_Event->_C._projectile.setDir((Direction)_vm->_movsens->_g400_moveResultDir);
L0647_ps_Event->_B._slot = M15_thingWithNewCell(L0645_T_Thing, _vm->_movsens->_g401_moveResultCell).toUint16();
M31_setMap(L0647_ps_Event->_mapTime, _vm->_movsens->_g399_moveResultMapIndex);
} else {
@@ -734,7 +734,7 @@ void Timeline::f247_triggerProjectileLauncher(Sensor* sensor, TimelineEvent* eve
L0626_i_MapX = event->_B._location._mapX;
L0627_i_MapY = event->_B._location._mapY;
L0624_ui_Cell = event->_C.A._cell;
- L0628_ui_ProjectileCell = returnOppositeDir((direction)L0624_ui_Cell);
+ L0628_ui_ProjectileCell = returnOppositeDir((Direction)L0624_ui_Cell);
L0625_i_SensorType = sensor->getType();
L0629_i_SensorData = sensor->getData();
L0630_i_KineticEnergy = sensor->M47_kineticEnergy();
@@ -785,9 +785,9 @@ void Timeline::f247_triggerProjectileLauncher(Sensor* sensor, TimelineEvent* eve
}
L0626_i_MapX += _vm->_dirIntoStepCountEast[L0624_ui_Cell], L0627_i_MapY += _vm->_dirIntoStepCountNorth[L0624_ui_Cell]; /* BUG0_20 The game crashes if the launcher sensor is on a map boundary and shoots in a direction outside the map */
_vm->_projexpl->_g365_createLanucherProjectile = true;
- _vm->_projexpl->f212_projectileCreate(L0622_T_FirstProjectileAssociatedThing, L0626_i_MapX, L0627_i_MapY, L0628_ui_ProjectileCell, (direction)L0624_ui_Cell, L0630_i_KineticEnergy, 100, L0631_i_StepEnergy);
+ _vm->_projexpl->f212_projectileCreate(L0622_T_FirstProjectileAssociatedThing, L0626_i_MapX, L0627_i_MapY, L0628_ui_ProjectileCell, (Direction)L0624_ui_Cell, L0630_i_KineticEnergy, 100, L0631_i_StepEnergy);
if (!L0632_B_LaunchSingleProjectile) {
- _vm->_projexpl->f212_projectileCreate(L0623_T_SecondProjectileAssociatedThing, L0626_i_MapX, L0627_i_MapY, returnNextVal(L0628_ui_ProjectileCell), (direction)L0624_ui_Cell, L0630_i_KineticEnergy, 100, L0631_i_StepEnergy);
+ _vm->_projexpl->f212_projectileCreate(L0623_T_SecondProjectileAssociatedThing, L0626_i_MapX, L0627_i_MapY, returnNextVal(L0628_ui_ProjectileCell), (Direction)L0624_ui_Cell, L0630_i_KineticEnergy, 100, L0631_i_StepEnergy);
}
_vm->_projexpl->_g365_createLanucherProjectile = false;
}
@@ -837,7 +837,7 @@ void Timeline::f245_timlineProcessEvent5_squareCorridor(TimelineEvent* event) {
if ((AL0618_ui_HealthMultiplier = L0614_ps_Sensor->M45_healthMultiplier()) == 0) {
AL0618_ui_HealthMultiplier = _vm->_dungeonMan->_g269_currMap->_difficulty;
}
- _vm->_groupMan->f185_groupGetGenerated(L0614_ps_Sensor->getData(), AL0618_ui_HealthMultiplier, L0612_i_CreatureCount, (direction)_vm->getRandomNumber(4), L0616_ui_MapX, L0617_ui_MapY);
+ _vm->_groupMan->f185_groupGetGenerated(L0614_ps_Sensor->getData(), AL0618_ui_HealthMultiplier, L0612_i_CreatureCount, (Direction)_vm->getRandomNumber(4), L0616_ui_MapX, L0617_ui_MapY);
if (L0614_ps_Sensor->getAudibleA()) {
_vm->f064_SOUND_RequestPlay_CPSD(k17_soundBUZZ, L0616_ui_MapX, L0617_ui_MapY, k1_soundModePlayIfPrioritized);
}
diff --git a/engines/dm/timeline.h b/engines/dm/timeline.h
index bb9b781d91..ffc6cc7fed 100644
--- a/engines/dm/timeline.h
+++ b/engines/dm/timeline.h
@@ -131,11 +131,11 @@ public:
public:
uint16 getMapX() { return _backing & 0x1F; }
uint16 getMapY() { return (_backing >> 5) & 0x1F; }
- direction getDir() { return (direction)((_backing >> 10) & 0x3); }
+ Direction getDir() { return (Direction)((_backing >> 10) & 0x3); }
uint16 getStepEnergy() { return (_backing >> 12) & 0xF; }
void setMapX(uint16 val) { _backing = (_backing & ~0x1F) | (val & 0x1F); }
void setMapY(uint16 val) { _backing = (_backing & ~(0x1F << 5)) | ((val & 0x1F) << 5); }
- void setDir(direction val) { _backing = (_backing & ~(0x3 << 10)) | ((val & 0x3) << 10); }
+ void setDir(Direction val) { _backing = (_backing & ~(0x3 << 10)) | ((val & 0x3) << 10); }
void setStepEnergy(uint16 val) { _backing = (_backing & ~(0xF << 12)) | ((val & 0xF) << 12); }
} _projectile;