DM: refact f293_drawAllChampionStates, f283_viAltarRebirth, f327_isProjectileSpellCast and f326_championShootProjectile. Rename Direction.

This commit is contained in:
Strangerke 2016-07-25 14:35:26 +02:00 committed by Bendegúz Nagy
parent 63fc9fb27d
commit b174331e71
17 changed files with 132 additions and 138 deletions

View file

@ -1097,11 +1097,11 @@ void ChampionMan::f284_setPartyDirection(int16 dir) {
Champion *curChampion = _gK71_champions; Champion *curChampion = _gK71_champions;
for (int16 i = k0_ChampionFirst; i < _g305_partyChampionCount; i++) { for (int16 i = k0_ChampionFirst; i < _g305_partyChampionCount; i++) {
curChampion->_cell = (ViewCell)M21_normalizeModulo4(curChampion->_cell + L0834_i_Delta); 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++; curChampion++;
} }
_vm->_dungeonMan->_g308_partyDir = (direction)dir; _vm->_dungeonMan->_g308_partyDir = (Direction)dir;
f296_drawChangedObjectIcons(); f296_drawChangedObjectIcons();
} }
@ -1228,31 +1228,26 @@ bool ChampionMan::f294_isAmmunitionCompatibleWithWeapon(uint16 champIndex, uint1
} }
void ChampionMan::f293_drawAllChampionStates() { void ChampionMan::f293_drawAllChampionStates() {
int16 L0873_i_ChampionIndex; for (int16 i = k0_ChampionFirst; i < _vm->_championMan->_g305_partyChampionCount; i++)
for (L0873_i_ChampionIndex = k0_ChampionFirst; L0873_i_ChampionIndex < _vm->_championMan->_g305_partyChampionCount; L0873_i_ChampionIndex++) { _vm->_championMan->f292_drawChampionState((ChampionIndex)i);
_vm->_championMan->f292_drawChampionState((ChampionIndex)L0873_i_ChampionIndex);
}
} }
void ChampionMan::f283_viAltarRebirth(uint16 champIndex) { void ChampionMan::f283_viAltarRebirth(uint16 champIndex) {
uint16 L0831_ui_Multiple; Champion *curChampion = &_vm->_championMan->_gK71_champions[champIndex];
#define AL0831_ui_Cell L0831_ui_Multiple if (_vm->_championMan->f285_getIndexInCell(curChampion->_cell) != kM1_ChampionNone) {
#define AL0831_ui_MaximumHealth L0831_ui_Multiple uint16 numCell = k0_CellNorthWest;
Champion* L0832_ps_Champion; while (_vm->_championMan->f285_getIndexInCell(numCell) != kM1_ChampionNone)
numCell++;
L0832_ps_Champion = &_vm->_championMan->_gK71_champions[champIndex]; curChampion->_cell = (ViewCell)numCell;
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;
} uint16 maximumHealth = curChampion->_maxHealth;
AL0831_ui_MaximumHealth = L0832_ps_Champion->_maxHealth; curChampion->_maxHealth = MAX(25, maximumHealth - (maximumHealth >> 6) - 1);
L0832_ps_Champion->_currHealth = (L0832_ps_Champion->_maxHealth = MAX(25, AL0831_ui_MaximumHealth - (AL0831_ui_MaximumHealth >> 6) - 1)) >> 1; curChampion->_currHealth = curChampion->_maxHealth >> 1;
_vm->_menuMan->f393_drawSpellAreaControls(_vm->_championMan->_g514_magicCasterChampionIndex); _vm->_menuMan->f393_drawSpellAreaControls(_vm->_championMan->_g514_magicCasterChampionIndex);
L0832_ps_Champion->_dir = _vm->_dungeonMan->_g308_partyDir; curChampion->_dir = _vm->_dungeonMan->_g308_partyDir;
setFlag(L0832_ps_Champion->_attributes, k0x8000_ChampionAttributeActionHand | k0x1000_ChampionAttributeStatusBox | k0x0400_ChampionAttributeIcon); setFlag(curChampion->_attributes, k0x8000_ChampionAttributeActionHand | k0x1000_ChampionAttributeStatusBox | k0x0400_ChampionAttributeIcon);
_vm->_championMan->f292_drawChampionState((ChampionIndex)champIndex); _vm->_championMan->f292_drawChampionState((ChampionIndex)champIndex);
} }
@ -1261,18 +1256,19 @@ void ChampionMan::f302_processCommands28to65_clickOnSlotBox(uint16 slotBoxIndex)
uint16 slotIndex; uint16 slotIndex;
if (slotBoxIndex < k8_SlotBoxInventoryFirstSlot) { if (slotBoxIndex < k8_SlotBoxInventoryFirstSlot) {
if (_g299_candidateChampionOrdinal) { if (_g299_candidateChampionOrdinal)
return; return;
}
champIndex = slotBoxIndex >> 1; 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; return;
}
slotIndex = M70_handSlotIndex(slotBoxIndex); slotIndex = M70_handSlotIndex(slotBoxIndex);
} else { } else {
champIndex = _vm->M1_ordinalToIndex(_vm->_inventoryMan->_g432_inventoryChampionOrdinal); champIndex = _vm->M1_ordinalToIndex(_vm->_inventoryMan->_g432_inventoryChampionOrdinal);
slotIndex = slotBoxIndex - k8_SlotBoxInventoryFirstSlot; slotIndex = slotBoxIndex - k8_SlotBoxInventoryFirstSlot;
} }
Thing leaderHandObject = _g414_leaderHandObject; Thing leaderHandObject = _g414_leaderHandObject;
Thing slotThing; Thing slotThing;
if (slotIndex >= k30_ChampionSlotChest_1) { if (slotIndex >= k30_ChampionSlotChest_1) {
@ -1280,53 +1276,51 @@ void ChampionMan::f302_processCommands28to65_clickOnSlotBox(uint16 slotBoxIndex)
} else { } else {
slotThing = _gK71_champions[champIndex]._slots[slotIndex]; slotThing = _gK71_champions[champIndex]._slots[slotIndex];
} }
if ((slotThing == Thing::_none) && (leaderHandObject == Thing::_none)) {
if ((slotThing == Thing::_none) && (leaderHandObject == Thing::_none))
return; 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; return;
}
_vm->_eventMan->f78_showMouse(); _vm->_eventMan->f78_showMouse();
if (leaderHandObject != Thing::_none) { if (leaderHandObject != Thing::_none)
f298_getObjectRemovedFromLeaderHand(); f298_getObjectRemovedFromLeaderHand();
}
if (slotThing != Thing::_none) { if (slotThing != Thing::_none) {
f300_getObjectRemovedFromSlot(champIndex, slotIndex); f300_getObjectRemovedFromSlot(champIndex, slotIndex);
f297_putObjectInLeaderHand(slotThing, false); f297_putObjectInLeaderHand(slotThing, false);
} }
if (leaderHandObject != Thing::_none) {
if (leaderHandObject != Thing::_none)
f301_addObjectInSlot((ChampionIndex)champIndex, leaderHandObject, (ChampionSlot)slotIndex); f301_addObjectInSlot((ChampionIndex)champIndex, leaderHandObject, (ChampionSlot)slotIndex);
}
f292_drawChampionState((ChampionIndex)champIndex); f292_drawChampionState((ChampionIndex)champIndex);
_vm->_eventMan->f77_hideMouse(); _vm->_eventMan->f77_hideMouse();
} }
bool ChampionMan::f327_isProjectileSpellCast(uint16 champIndex, Thing thing, int16 kineticEnergy, uint16 requiredManaAmount) { bool ChampionMan::f327_isProjectileSpellCast(uint16 champIndex, Thing thing, int16 kineticEnergy, uint16 requiredManaAmount) {
int16 L0991_i_StepEnergy; Champion *curChampion = &_vm->_championMan->_gK71_champions[champIndex];
Champion* L0992_ps_Champion; if (curChampion->_currMana < requiredManaAmount)
L0992_ps_Champion = &_vm->_championMan->_gK71_champions[champIndex];
if (L0992_ps_Champion->_currMana < requiredManaAmount) {
return false; return false;
}
L0992_ps_Champion->_currMana -= requiredManaAmount; curChampion->_currMana -= requiredManaAmount;
setFlag(L0992_ps_Champion->_attributes, k0x0100_ChampionAttributeStatistics); setFlag(curChampion->_attributes, k0x0100_ChampionAttributeStatistics);
L0991_i_StepEnergy = 10 - MIN(8, L0992_ps_Champion->_maxMana >> 3); int16 stepEnergy = 10 - MIN(8, curChampion->_maxMana >> 3);
if (kineticEnergy < (L0991_i_StepEnergy << 2)) { if (kineticEnergy < (stepEnergy << 2)) {
kineticEnergy += 3; 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 return true; // fix BUG_01
} }
void ChampionMan::f326_championShootProjectile(Champion* champ, Thing thing, int16 kineticEnergy, int16 attack, int16 stepEnergy) { void ChampionMan::f326_championShootProjectile(Champion* champ, Thing thing, int16 kineticEnergy, int16 attack, int16 stepEnergy) {
uint16 L0990_ui_Direction; 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);
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);
_vm->_g311_projectileDisableMovementTicks = 4; _vm->_g311_projectileDisableMovementTicks = 4;
_vm->_g312_lastProjectileDisabledMovementDirection = L0990_ui_Direction; _vm->_g312_lastProjectileDisabledMovementDirection = newDirection;
} }
void ChampionMan::f320_applyAndDrawPendingDamageAndWounds() { void ChampionMan::f320_applyAndDrawPendingDamageAndWounds() {
@ -1777,7 +1771,7 @@ void ChampionMan::load2_PartyPart(Common::InSaveFile* file) {
champ->_name[j] = file->readByte(); champ->_name[j] = file->readByte();
for (uint16 j = 0; j < 20; ++j) for (uint16 j = 0; j < 20; ++j)
champ->_title[j] = file->readByte(); champ->_title[j] = file->readByte();
champ->_dir = (direction)file->readUint16BE(); champ->_dir = (Direction)file->readUint16BE();
champ->_cell = (ViewCell)file->readUint16BE(); champ->_cell = (ViewCell)file->readUint16BE();
champ->_actionIndex = (ChampionAction)file->readUint16BE(); champ->_actionIndex = (ChampionAction)file->readUint16BE();
champ->_symbolStep = file->readUint16BE(); champ->_symbolStep = file->readUint16BE();
@ -2282,7 +2276,7 @@ T0292042:
_vm->_eventMan->f77_hideMouse(); _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); return ((val + 4 - dir) & 0x3);
} }

View file

@ -370,7 +370,7 @@ public:
Skill _skills[20]; Skill _skills[20];
char _name[8]; char _name[8];
char _title[20]; char _title[20];
direction _dir; Direction _dir;
ViewCell _cell; ViewCell _cell;
ChampionAction _actionIndex; ChampionAction _actionIndex;
uint16 _symbolStep; uint16 _symbolStep;
@ -537,7 +537,7 @@ public:
uint16 f306_getStaminaAdjustedValue(Champion *champ, int16 val); // @ F0306_CHAMPION_GetStaminaAdjustedValue uint16 f306_getStaminaAdjustedValue(Champion *champ, int16 val); // @ F0306_CHAMPION_GetStaminaAdjustedValue
uint16 f309_getMaximumLoad(Champion *champ); // @ F0309_CHAMPION_GetMaximumLoad uint16 f309_getMaximumLoad(Champion *champ); // @ F0309_CHAMPION_GetMaximumLoad
void f292_drawChampionState(ChampionIndex champIndex); // @ F0292_CHAMPION_DrawState 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 f290_drawHealthStaminaManaValues(Champion *champ); // @ F0290_CHAMPION_DrawHealthStaminaManaValues
void f291_drawSlot(uint16 champIndex, int16 slotIndex); // @ F0291_CHAMPION_DrawSlot void f291_drawSlot(uint16 champIndex, int16 slotIndex); // @ F0291_CHAMPION_DrawSlot
void f281_renameChampion(Champion* champ); // @ F0281_CHAMPION_Rename void f281_renameChampion(Champion* champ); // @ F0281_CHAMPION_Rename

View file

@ -76,19 +76,19 @@ void warning(bool repeat, const char* s, ...) {
} }
} }
void turnDirRight(direction &dir) { dir = (direction)((dir + 1) & 3); } void turnDirRight(Direction &dir) { dir = (Direction)((dir + 1) & 3); }
void turnDirLeft(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); } Direction returnOppositeDir(Direction dir) { return (Direction)((dir + 2) & 3); }
uint16 returnPrevVal(uint16 val) { uint16 returnPrevVal(uint16 val) {
return (direction)((val + 3) & 3); return (Direction)((val + 3) & 3);
} }
uint16 returnNextVal(uint16 val) { uint16 returnNextVal(uint16 val) {
return (val + 1) & 0x3; return (val + 1) & 0x3;
} }
bool isOrientedWestEast(direction dir) { return dir & 1; } bool isOrientedWestEast(Direction dir) { return dir & 1; }
uint16 toggleFlag(uint16& val, uint16 mask) { uint16 toggleFlag(uint16& val, uint16 mask) {
return val ^= mask; return val ^= mask;

View file

@ -57,7 +57,7 @@ class DialogMan;
void warning(bool repeat, const char *s, ...); void warning(bool repeat, const char *s, ...);
enum direction { enum Direction {
kDirNorth = 0, kDirNorth = 0,
kDirEast = 1, kDirEast = 1,
kDirSouth = 2, kDirSouth = 2,
@ -122,12 +122,12 @@ public:
void turnDirRight(direction &dir); void turnDirRight(Direction &dir);
void turnDirLeft(direction &dir); void turnDirLeft(Direction &dir);
direction returnOppositeDir(direction dir); // @ M18_OPPOSITE Direction returnOppositeDir(Direction dir); // @ M18_OPPOSITE
uint16 returnPrevVal(uint16 val); // @ M19_PREVIOUS uint16 returnPrevVal(uint16 val); // @ M19_PREVIOUS
uint16 returnNextVal(uint16 val); // @ M17_NEXT 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)) #define setFlag(val, mask) ((val) |= (mask))

View file

@ -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}, {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}}; {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; posX += _vm->_dirIntoStepCountEast[dir] * stepsForward;
posY += _vm->_dirIntoStepCountNorth[dir] * stepsForward; posY += _vm->_dirIntoStepCountNorth[dir] * stepsForward;
turnDirRight(dir); turnDirRight(dir);
@ -385,7 +385,7 @@ DungeonMan::DungeonMan(DMEngine *dmEngine) : _vm(dmEngine) {
for (uint16 i = 0; i < 16; ++i) for (uint16 i = 0; i < 16; ++i)
_g284_thingData[i] = nullptr; _g284_thingData[i] = nullptr;
_g279_dungeonMapData = nullptr; _g279_dungeonMapData = nullptr;
_g308_partyDir = (direction)0; _g308_partyDir = (Direction)0;
_g306_partyMapX = 0; _g306_partyMapX = 0;
_g307_partyMapY = 0; _g307_partyMapY = 0;
_g309_partyMapIndex = 0; _g309_partyMapIndex = 0;
@ -549,7 +549,7 @@ void DungeonMan::f434_loadDungeonFile() {
dunDataStream.readByte(); // discard 1 byte dunDataStream.readByte(); // discard 1 byte
_g278_dungeonFileHeader._textDataWordCount = dunDataStream.readUint16BE(); _g278_dungeonFileHeader._textDataWordCount = dunDataStream.readUint16BE();
uint16 partyPosition = 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._partyStartPosY = (partyPosition >> 5) & 0x1F;
_g278_dungeonFileHeader._partyStartPosX = (partyPosition >> 0) & 0x1F; _g278_dungeonFileHeader._partyStartPosX = (partyPosition >> 0) & 0x1F;
_g278_dungeonFileHeader._squareFirstThingCount = dunDataStream.readUint16BE(); _g278_dungeonFileHeader._squareFirstThingCount = dunDataStream.readUint16BE();
@ -788,7 +788,7 @@ Square DungeonMan::f151_getSquare(int16 mapX, int16 mapY) {
return Square(k0_ElementTypeWall, 0); 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); f150_mapCoordsAfterRelMovement(dir, stepsForward, stepsForward, posX, posY);
return f151_getSquare(posX, posY); return f151_getSquare(posX, posY);
} }
@ -822,7 +822,7 @@ Thing DungeonMan::f161_getSquareFirstThing(int16 mapX, int16 mapY) {
// TODO: produce more GOTOs // 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 #define thingType dir
byte L0307_uc_Multiple; byte L0307_uc_Multiple;
#define square 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: T0172029_Teleporter:
footprintsAllowed = true; footprintsAllowed = true;
T0172030_Pit: 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) { if (thingType == k3_SensorThingType) {
sensor = (Sensor*)_vm->_dungeonMan->f156_getThingData(thing); sensor = (Sensor*)_vm->_dungeonMan->f156_getThingData(thing);
aspectArray[k4_FloorOrnOrdAspect] = sensor->getOrnOrdinal(); 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) { void DungeonMan::f148_setGroupDirections(Group* group, int16 dir, uint16 mapIndex) {
if (mapIndex == _vm->_dungeonMan->_g309_partyMapIndex) { 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 { } else {
group->setDir(M21_normalizeModulo4(dir)); group->setDir(M21_normalizeModulo4(dir));
} }

View file

@ -244,7 +244,7 @@ public:
bool isAudible() { return (_attributes >> 15) & 1; } bool isAudible() { return (_attributes >> 15) & 1; }
TeleporterScope getScope() { return (TeleporterScope)((_attributes >> 13) & 1); } TeleporterScope getScope() { return (TeleporterScope)((_attributes >> 13) & 1); }
bool getAbsoluteRotation() { return (_attributes >> 12) & 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 getTargetMapY() { return (_attributes >> 5) & 0xF; }
byte getTargetMapX() { return _attributes & 0xF; } byte getTargetMapX() { return _attributes & 0xF; }
uint16 getTargetMapIndex() { return _destMapIndex >> 8; } uint16 getTargetMapIndex() { return _destMapIndex >> 8; }
@ -334,7 +334,7 @@ public:
uint16 getTargetMapY() { return (_action >> 11); } uint16 getTargetMapY() { return (_action >> 11); }
uint16 getTargetMapX() { return (_action >> 6) & 0x1F; } 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 M47_kineticEnergy() { return (_action & 0xFF); }// @ M47_KINETIC_ENERGY
uint16 M48_stepEnergy() { return (_action >> 8) & 0xFF; }// @ M48_STEP_ENERGY uint16 M48_stepEnergy() { return (_action >> 8) & 0xFF; }// @ M48_STEP_ENERGY
uint16 M49_localEffect() { return _action; } // @ M49_LOCAL_EFFECT uint16 M49_localEffect() { return _action; } // @ M49_LOCAL_EFFECT
@ -611,7 +611,7 @@ struct DungeonFileHeader {
uint32 _rawMapDataSize; uint32 _rawMapDataSize;
uint8 _mapCount; uint8 _mapCount;
uint16 _textDataWordCount; uint16 _textDataWordCount;
direction _partyStartDir; // @ InitialPartyLocation Direction _partyStartDir; // @ InitialPartyLocation
uint16 _partyStartPosX, _partyStartPosY; uint16 _partyStartPosX, _partyStartPosY;
uint16 _squareFirstThingCount; // @ SquareFirstThingCount uint16 _squareFirstThingCount; // @ SquareFirstThingCount
uint16 _thingCounts[16]; // @ ThingCount[16] uint16 _thingCounts[16]; // @ ThingCount[16]
@ -656,7 +656,7 @@ class DungeonMan {
DungeonMan(const DungeonMan &other); // no implementation on purpose DungeonMan(const DungeonMan &other); // no implementation on purpose
void operator=(const DungeonMan &rhs); // 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 void f455_decompressDungeonFile(); // @ F0455_FLOPPY_DecompressDungeon
@ -683,11 +683,11 @@ public:
void f174_setCurrentMapAndPartyMap(uint16 mapIndex); // @ F0174_DUNGEON_SetCurrentMapAndPartyMap void f174_setCurrentMapAndPartyMap(uint16 mapIndex); // @ F0174_DUNGEON_SetCurrentMapAndPartyMap
bool f149_isWallOrnAnAlcove(int16 wallOrnIndex); // @ F0149_DUNGEON_IsWallOrnamentAnAlcove bool f149_isWallOrnAnAlcove(int16 wallOrnIndex); // @ F0149_DUNGEON_IsWallOrnamentAnAlcove
void f150_mapCoordsAfterRelMovement(direction dir, int16 stepsForward, int16 stepsRight, int16 &posX, int16 &posY); // @ F0150_DUNGEON_UpdateMapCoordinatesAfterRelativeMovement 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) { SquareType f153_getRelSquareType(Direction dir, int16 stepsForward, int16 stepsRight, int16 posX, int16 posY) {
return Square(f152_getRelSquare(dir, stepsForward, stepsRight, posX, posY)).getType(); return Square(f152_getRelSquare(dir, stepsForward, stepsRight, posX, posY)).getType();
} // @ F0153_DUNGEON_GetRelativeSquareType } // @ 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 void f168_decodeText(char *destString, Thing thing, TextType type); // F0168_DUNGEON_DecodeText
Thing f166_getUnusedThing(uint16 thingType); // @ F0166_DUNGEON_GetUnusedThing Thing f166_getUnusedThing(uint16 thingType); // @ F0166_DUNGEON_GetUnusedThing
@ -725,7 +725,7 @@ public:
byte ***_g279_dungeonMapData; // @ G0279_pppuc_DungeonMapData 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 _g306_partyMapX; // @ G0306_i_PartyMapX
int16 _g307_partyMapY; // @ G0307_i_PartyMapY int16 _g307_partyMapY; // @ G0307_i_PartyMapY
uint8 _g309_partyMapIndex; // @ G0309_i_PartyMapIndex uint8 _g309_partyMapIndex; // @ G0309_i_PartyMapIndex

View file

@ -1462,7 +1462,7 @@ void DisplayMan::f100_drawWallSetBitmap(byte *bitmap, Frame &f) {
// NOTE: has been screened for missing code // 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 static DoorFrames g179_doorFrame_D3L = DoorFrames( // @ G0179_s_Graphic558_Frames_Door_D3L
/* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */ /* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */
Frame(24, 71, 28, 67, 24, 41, 0, 0), /* Closed Or Destroyed */ 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 static DoorFrames g181_doorFrame_D3R = DoorFrames( // @ G0181_s_Graphic558_Frames_Door_D3R
/* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */ /* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */
Frame(150, 197, 28, 67, 24, 41, 0, 0), /* Closed Or Destroyed */ 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 static DoorFrames g180_doorFrame_D3C = DoorFrames( // @ G0180_s_Graphic558_Frames_Door_D3C
/* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */ /* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */
Frame(88, 135, 28, 67, 24, 41, 0, 0), /* Closed Or Destroyed */ 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 static DoorFrames g182_doorFrame_D2L = DoorFrames( // @ G0182_s_Graphic558_Frames_Door_D2L
/* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */ /* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */
Frame(0, 63, 24, 82, 32, 61, 0, 0), /* Closed Or Destroyed */ 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 static DoorFrames g184_doorFrame_D2R = DoorFrames( // @ G0184_s_Graphic558_Frames_Door_D2R
/* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */ /* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */
Frame(160, 223, 24, 82, 32, 61, 0, 0), /* Closed Or Destroyed */ 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 static DoorFrames g183_doorFrame_D2C = DoorFrames( // @ G0183_s_Graphic558_Frames_Door_D2C
/* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */ /* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */
Frame(80, 143, 24, 82, 32, 61, 0, 0), /* Closed Or Destroyed */ 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 static DoorFrames g185_doorFrame_D1L = DoorFrames( // @ G0185_s_Graphic558_Frames_Door_D1L
/* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */ /* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */
Frame(0, 31, 17, 102, 48, 88, 64, 0), /* Closed Or Destroyed */ 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 static DoorFrames g187_doorFrame_D1R = DoorFrames( // @ G0187_s_Graphic558_Frames_Door_D1R
/* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */ /* { X1, X2, Y1, Y2, ByteWidth, Height, X, Y } */
Frame(192, 223, 17, 102, 48, 88, 0, 0), /* Closed Or Destroyed */ 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); 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 static Box g107_BoxThievesEyeVisibleArea(0, 95, 0, 94); // @ G0107_s_Graphic558_Box_ThievesEye_VisibleArea
int16 order; int16 order;
int16 squareAspect[5]; 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]; uint16 squareAspect[5];
_vm->_dungeonMan->f172_setSquareAspect(squareAspect, dir, posX, posY); _vm->_dungeonMan->f172_setSquareAspect(squareAspect, dir, posX, posY);
switch (squareAspect[0]) { 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]; 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 static Box g108_BoxThievesEyeHoleInDoorFrame(0, 31, 19, 113); // @ G0108_s_Graphic558_Box_ThievesEye_HoleInDoorFrame
int16 squareAspect[5]; 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 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 #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) { int16 mapYpos, int16 viewSquareIndex, uint16 orderedViewCellOrdinals) {
DungeonMan &dunMan = *_vm->_dungeonMan; DungeonMan &dunMan = *_vm->_dungeonMan;
@ -3460,7 +3460,7 @@ continue;
projectileBitmapIndexData = 0; projectileBitmapIndexData = 0;
flipVertical = flipHorizontal = false; flipVertical = flipHorizontal = false;
} else { } 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)) { != isOrientedWestEast(directionParam)) {
if (projectileAspectType == k2_ProjectileAspectHasRotation) { if (projectileAspectType == k2_ProjectileAspectHasRotation) {
projectileBitmapIndexData = 1; projectileBitmapIndexData = 1;

View file

@ -530,18 +530,18 @@ class DisplayMan {
void f104_drawFloorPitOrStairsBitmap(uint16 nativeIndex, Frame &frame); // @ F0104_DUNGEONVIEW_DrawFloorPitOrStairsBitmap void f104_drawFloorPitOrStairsBitmap(uint16 nativeIndex, Frame &frame); // @ F0104_DUNGEONVIEW_DrawFloorPitOrStairsBitmap
void f100_drawWallSetBitmap(byte *bitmap, Frame &f); // @ F0100_DUNGEONVIEW_DrawWallSetBitmap void f100_drawWallSetBitmap(byte *bitmap, Frame &f); // @ F0100_DUNGEONVIEW_DrawWallSetBitmap
void f101_drawWallSetBitmapWithoutTransparency(byte *bitmap, Frame &f); // @ F0101_DUNGEONVIEW_DrawWallSetBitmapWithoutTransparency void f101_drawWallSetBitmapWithoutTransparency(byte *bitmap, Frame &f); // @ F0101_DUNGEONVIEW_DrawWallSetBitmapWithoutTransparency
void f116_drawSquareD3L(direction dir, int16 posX, int16 posY); // @ F0116_DUNGEONVIEW_DrawSquareD3L 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 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 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 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 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 f121_drawSquareD2C(Direction dir, int16 posX, int16 posY); // @ F0121_DUNGEONVIEW_DrawSquareD2C
void f122_drawSquareD1L(direction dir, int16 posX, int16 posY); // @ F0122_DUNGEONVIEW_DrawSquareD1L 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 f123_drawSquareD1R(Direction dir, int16 posX, int16 posY); // @ F0123_DUNGEONVIEW_DrawSquareD1R
void f124_drawSquareD1C(direction dir, int16 posX, int16 posY); // @ F0124_DUNGEONVIEW_DrawSquareD1C 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 f125_drawSquareD0L(Direction dir, int16 posX, int16 posY); // @ F0125_DUNGEONVIEW_DrawSquareD0L
void f126_drawSquareD0R(direction dir, int16 posX, int16 posY); // @ F0126_DUNGEONVIEW_DrawSquareD0R 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 f127_drawSquareD0C(Direction dir, int16 posX, int16 posY); // @ F0127_DUNGEONVIEW_DrawSquareD0C
void f93_applyCreatureReplColors(int replacedColor, int replacementColor); // @ F0093_DUNGEONVIEW_ApplyCreatureReplacementColors 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 void D24_fillScreenBox(Box &box, Color color); // @ D24_FillScreenBox, F0550_VIDEO_FillScreenBox
/* Expects inclusive boundaries in box */ /* Expects inclusive boundaries in box */
void f135_fillBoxBitmap(byte *destBitmap, Box &box, Color color, int16 byteWidth, int16 height); // @ F0135_VIDEO_FillBox 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 f98_drawFloorAndCeiling(); // @ F0098_DUNGEONVIEW_DrawFloorAndCeiling
void updateScreen(); void updateScreen();
void f97_drawViewport(int16 palSwitchingRequestedState); // @ F0097_DUNGEONVIEW_DrawViewport 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 f459_getScaledBitmapByteCount(int16 byteWidth, int16 height, int16 scale); // @ F0459_START_GetScaledBitmapByteCount
int16 M78_getScaledDimension(int16 dimension, int16 scale); // @ M78_SCALED_DIMENSION 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, int16 mapXpos, int16 mapYpos, int16 viewSquareIndex,
uint16 orderedViewCellOrdinals); // @ F0115_DUNGEONVIEW_DrawObjectsCreaturesProjectilesExplosions_CPSEF uint16 orderedViewCellOrdinals); // @ F0115_DUNGEONVIEW_DrawObjectsCreaturesProjectilesExplosions_CPSEF
uint16 M77_getNormalizedByteWidth(uint16 byteWidth); // @ M77_NORMALIZED_BYTE_WIDTH uint16 M77_getNormalizedByteWidth(uint16 byteWidth); // @ M77_NORMALIZED_BYTE_WIDTH

View file

@ -873,8 +873,8 @@ T0209084_SingleSquareMoveTowardParty:
T0209085_SingleSquareMove: T0209085_SingleSquareMove:
if (f202_isMovementPossible(&L0448_s_CreatureInfo, eventMapX, eventMapY, AL0446_i_Direction = L0454_i_PrimaryDirectionToOrFromParty, L0456_B_AllowMovementOverImaginaryPitsAndFakeWalls) || 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 = _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) || 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))) { (!_vm->getRandomNumber(4) && f202_isMovementPossible(&L0448_s_CreatureInfo, eventMapX, eventMapY, AL0446_i_Direction = returnOppositeDir((Direction)L0454_i_PrimaryDirectionToOrFromParty), false))) {
AL0450_i_DestinationMapX = eventMapX; AL0450_i_DestinationMapX = eventMapX;
AL0451_i_DestinationMapY = eventMapY; AL0451_i_DestinationMapY = eventMapY;
AL0450_i_DestinationMapX += _vm->_dirIntoStepCountEast[AL0446_i_Direction], AL0451_i_DestinationMapY += _vm->_dirIntoStepCountNorth[AL0446_i_Direction]; 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 */ 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) || 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) || 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 && 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 >= 2) && f204_isArchenemyDoubleMovementPossible(&L0448_s_CreatureInfo, eventMapX, eventMapY, AL0446_i_Direction = returnOppositeDir((Direction)L0454_i_PrimaryDirectionToOrFromParty)))) {
AL0450_i_DestinationMapX = eventMapX; AL0450_i_DestinationMapX = eventMapX;
AL0451_i_DestinationMapY = eventMapY; AL0451_i_DestinationMapY = eventMapY;
AL0450_i_DestinationMapX += _vm->_dirIntoStepCountEast[AL0446_i_Direction] * 2, AL0451_i_DestinationMapY += _vm->_dirIntoStepCountNorth[AL0446_i_Direction] * 2; 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; AL0451_i_TargetMapY = L0445_ps_ActiveGroup->_targetMapY;
} }
/* Try and flee from the party (opposite direction) */ /* Try and flee from the party (opposite direction) */
L0454_i_PrimaryDirectionToOrFromParty = returnOppositeDir((direction)f228_getDirsWhereDestIsVisibleFromSource(eventMapX, eventMapY, AL0450_i_TargetMapX, AL0451_i_TargetMapY)); 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); _vm->_projexpl->_g363_secondaryDirToOrFromParty = returnOppositeDir((Direction)_vm->_projexpl->_g363_secondaryDirToOrFromParty);
L0461_i_MovementTicks -= (L0461_i_MovementTicks >> 2); L0461_i_MovementTicks -= (L0461_i_MovementTicks >> 2);
goto T0209085_SingleSquareMove; goto T0209085_SingleSquareMove;
} }
@ -996,7 +996,7 @@ T0209096_SetBehavior0_Wander:
AL0446_i_Cell++; AL0446_i_Cell++;
} }
if (!_vm->_groupMan->f176_getCreatureOrdinalInCell(L0444_ps_Group, AL0446_i_Cell = M21_normalizeModulo4(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 */ 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; goto T0209139_Return;
if (_vm->_projexpl->_g364_creatureDamageOutcome != k1_outcomeKilledSomeCreaturesInGroup) { 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) { if (creatureInfo->_movementTicks == k255_immobile) {
return false; 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; L0428_i_MapX = mapX;
L0429_i_MapY = mapY; L0429_i_MapY = mapY;
if (_g387_groupMovBlockedByWallStairsPitFakeWalFluxCageTeleporter = if (_g387_groupMovBlockedByWallStairsPitFakeWalFluxCageTeleporter =
@ -1333,7 +1333,7 @@ void GroupMan::f205_setDirection(ActiveGroup *activeGroup, int16 dir, int16 crea
G0395_l_TwoHalfSquareSizedCreaturesGroupLastDirectionSetTime = _vm->_g313_gameTime; G0395_l_TwoHalfSquareSizedCreaturesGroupLastDirectionSetTime = _vm->_g313_gameTime;
G0396_ps_TwoHalfSquareSizedCreaturesGroupLastDirectionSetActiveGroup = activeGroup; G0396_ps_TwoHalfSquareSizedCreaturesGroupLastDirectionSetActiveGroup = activeGroup;
} }
activeGroup->_directions = (direction)L0435_ui_GroupDirections; activeGroup->_directions = (Direction)L0435_ui_GroupDirections;
} }
void GroupMan::f208_groupAddEvent(TimelineEvent *event, uint32 time) { 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);
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->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 { } else {
if (getFlag(L0441_ps_CreatureInfo->_attributes, k0x0010_MaskCreatureInfo_attackAnyChamp)) { if (getFlag(L0441_ps_CreatureInfo->_attributes, k0x0010_MaskCreatureInfo_attackAnyChamp)) {
AL0439_i_ChampionIndex = _vm->getRandomNumber(4); 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]; Champion *L0442_ps_Champion = &_vm->_championMan->_gK71_champions[AL0439_i_ChampionIndex];
if (AL0440_i_Damage > L0442_ps_Champion->_maximumDamageReceived) { if (AL0440_i_Damage > L0442_ps_Champion->_maximumDamageReceived) {
L0442_ps_Champion->_maximumDamageReceived = AL0440_i_Damage; 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; L0341_ps_ActiveGroup->_lastMoveTime = _vm->_g313_gameTime - 127;
L0339_ui_CreatureIndex = L0340_ps_Group->getCount(); L0339_ui_CreatureIndex = L0340_ps_Group->getCount();
do { 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; L0341_ps_ActiveGroup->_aspect[L0339_ui_CreatureIndex] = 0;
} while (L0339_ui_CreatureIndex--); } while (L0339_ui_CreatureIndex--);
f179_getCreatureAspectUpdateTime(L0341_ps_ActiveGroup, kM1_wholeCreatureGroup, false); 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; Thing L0349_T_GroupThing;
uint16 L0350_ui_BaseHealth; uint16 L0350_ui_BaseHealth;
uint16 L0351_ui_Cell = 0; uint16 L0351_ui_Cell = 0;
@ -2082,7 +2082,7 @@ void GroupMan::load1_ActiveGroupPart(Common::InSaveFile* file) {
for (uint16 i = 0; i < _g376_maxActiveGroupCount; ++i) { for (uint16 i = 0; i < _g376_maxActiveGroupCount; ++i) {
ActiveGroup *group = &_g375_activeGroups[i]; ActiveGroup *group = &_g375_activeGroups[i];
group->_groupThingIndex = file->readUint16BE(); group->_groupThingIndex = file->readUint16BE();
group->_directions = (direction)file->readUint16BE(); group->_directions = (Direction)file->readUint16BE();
group->_cells = file->readByte(); group->_cells = file->readByte();
group->_lastMoveTime = file->readByte(); group->_lastMoveTime = file->readByte();
group->_delayFleeingFromTarget = file->readByte(); group->_delayFleeingFromTarget = file->readByte();

View file

@ -93,7 +93,7 @@ enum CreatureType {
class ActiveGroup { class ActiveGroup {
public: public:
int16 _groupThingIndex; int16 _groupThingIndex;
direction _directions; Direction _directions;
byte _cells; byte _cells;
byte _lastMoveTime; byte _lastMoveTime;
byte _delayFleeingFromTarget; byte _delayFleeingFromTarget;
@ -130,7 +130,7 @@ public:
uint16 setBehaviour(uint16 val) { _flags = (_flags & ~0xF) | (val & 0xF); return (val & 0xF); } uint16 setBehaviour(uint16 val) { _flags = (_flags & ~0xF) | (val & 0xF); return (val & 0xF); }
uint16 getCount() { return (_flags >> 5) & 0x3; } uint16 getCount() { return (_flags >> 5) & 0x3; }
void setCount(uint16 val) { _flags = (_flags & ~(0x3 << 5)) | ((val & 0x3) << 5); } 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); } void setDir(uint16 val) { _flags = (_flags & ~(0x3 << 8)) | ((val & 0x3) << 8); }
uint16 getDoNotDiscard() { return (_flags >> 10) & 0x1; } uint16 getDoNotDiscard() { return (_flags >> 10) & 0x1; }
void setDoNotDiscard(bool val) { _flags = (_flags & ~(1 << 10)) | ((val & 1) << 10); } 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 f184_removeActiveGroup(uint16 activeGroupIndex); // @ F0184_GROUP_RemoveActiveGroup
void f194_removeAllActiveGroups(); // @ F0194_GROUP_RemoveAllActiveGroups void f194_removeAllActiveGroups(); // @ F0194_GROUP_RemoveAllActiveGroups
void f195_addAllActiveGroups(); // @ F0195_GROUP_AddAllActiveGroups 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 bool f223_isSquareACorridorTeleporterPitOrDoor(int16 mapX, int16 mapY); // @ F0223_GROUP_IsSquareACorridorTeleporterPitOrDoor
int16 f177_getMeleeTargetCreatureOrdinal(int16 groupX, int16 groupY, int16 partyX, int16 paryY, int16 f177_getMeleeTargetCreatureOrdinal(int16 groupX, int16 groupY, int16 partyX, int16 paryY,
uint16 champCell); // @ F0177_GROUP_GetMeleeTargetCreatureOrdinal uint16 champCell); // @ F0177_GROUP_GetMeleeTargetCreatureOrdinal

View file

@ -83,7 +83,7 @@ LoadgameResponse DMEngine::f435_loadgame(int16 slot) {
_championMan->_g305_partyChampionCount = file->readUint16BE(); _championMan->_g305_partyChampionCount = file->readUint16BE();
_dungeonMan->_g306_partyMapX = file->readSint16BE(); _dungeonMan->_g306_partyMapX = file->readSint16BE();
_dungeonMan->_g307_partyMapY = file->readSint16BE(); _dungeonMan->_g307_partyMapY = file->readSint16BE();
_dungeonMan->_g308_partyDir = (direction)file->readUint16BE(); _dungeonMan->_g308_partyDir = (Direction)file->readUint16BE();
_dungeonMan->_g309_partyMapIndex = file->readByte(); _dungeonMan->_g309_partyMapIndex = file->readByte();
_championMan->_g411_leaderIndex = (ChampionIndex)file->readSint16BE(); _championMan->_g411_leaderIndex = (ChampionIndex)file->readSint16BE();
_championMan->_g514_magicCasterChampionIndex = (ChampionIndex)file->readSint16BE(); _championMan->_g514_magicCasterChampionIndex = (ChampionIndex)file->readSint16BE();

View file

@ -215,7 +215,7 @@ void MenuMan::f390_refreshActionAreaAndSetChampDirMaxDamageReceived() {
&& (champ->_maximumDamageReceived) && (champ->_maximumDamageReceived)
&& (champ->_dir != champ->_directionMaximumDamageReceived)) { && (champ->_dir != champ->_directionMaximumDamageReceived)) {
champ->_dir = (direction)champ->_directionMaximumDamageReceived; champ->_dir = (Direction)champ->_directionMaximumDamageReceived;
champ->setAttributeFlag(k0x0400_ChampionAttributeIcon, true); champ->setAttributeFlag(k0x0400_ChampionAttributeIcon, true);
champMan.f292_drawChampionState((ChampionIndex)champIndex); champMan.f292_drawChampionState((ChampionIndex)champIndex);
} }

View file

@ -377,7 +377,7 @@ bool MovesensMan::f267_getMoveResult(Thing thing, int16 mapX, int16 mapY, int16
} }
L0716_ui_Direction = _vm->_dungeonMan->f155_getStairsExitDirection(destMapX, destMapY); L0716_ui_Direction = _vm->_dungeonMan->f155_getStairsExitDirection(destMapX, destMapY);
destMapX += _vm->_dirIntoStepCountEast[L0716_ui_Direction], destMapY += _vm->_dirIntoStepCountNorth[L0716_ui_Direction]; 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 = thing.getCell();
AL0727_ui_ThingCell = M21_normalizeModulo4((((AL0727_ui_ThingCell - L0716_ui_Direction + 1) & 0x0002) >> 1) + L0716_ui_Direction); AL0727_ui_ThingCell = M21_normalizeModulo4((((AL0727_ui_ThingCell - L0716_ui_Direction + 1) & 0x0002) >> 1) + L0716_ui_Direction);
thing = M15_thingWithNewCell(thing, AL0727_ui_ThingCell); thing = M15_thingWithNewCell(thing, AL0727_ui_ThingCell);

View file

@ -45,7 +45,7 @@ ProjExpl::ProjExpl(DMEngine* vm) : _vm(vm) {
_g362_lastPartyMovementTime = 0; _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; Thing L0466_T_ProjectileThing;
Projectile* L0467_ps_Projectile; Projectile* L0467_ps_Projectile;
TimelineEvent L0468_s_Event; 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); _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.setMapX(_vm->_movsens->_g397_moveResultMapX);
L0519_ps_Event->_C._projectile.setMapY(_vm->_movsens->_g398_moveResultMapY); 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); L0515_T_ProjectileThingNewCell = M15_thingWithNewCell(L0515_T_ProjectileThingNewCell, _vm->_movsens->_g401_moveResultCell);
M31_setMap(L0519_ps_Event->_mapTime, _vm->_movsens->_g399_moveResultMapIndex); M31_setMap(L0519_ps_Event->_mapTime, _vm->_movsens->_g399_moveResultMapIndex);
} else { } else {

View file

@ -88,7 +88,7 @@ public:
int16 _g367_projectileAttackType; // @ G0367_i_ProjectileAttackType int16 _g367_projectileAttackType; // @ G0367_i_ProjectileAttackType
int32 _g362_lastPartyMovementTime; // @ G0362_l_LastPartyMovementTime int32 _g362_lastPartyMovementTime; // @ G0362_l_LastPartyMovementTime
explicit ProjExpl(DMEngine *vm); 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 byte kineticEnergy, byte attack, byte stepEnergy); // @ F0212_PROJECTILE_Create
bool f217_projectileHasImpactOccurred(int16 impactType, int16 mapXCombo, int16 mapYCombo, bool f217_projectileHasImpactOccurred(int16 impactType, int16 mapXCombo, int16 mapYCombo,
int16 cell, Thing projectileThing); // @ F0217_PROJECTILE_HasImpactOccured int16 cell, Thing projectileThing); // @ F0217_PROJECTILE_HasImpactOccured

View file

@ -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 = &_vm->_timeline->_g370_events[L0646_ps_Projectile->_eventIndex];
L0647_ps_Event->_C._projectile.setMapX(_vm->_movsens->_g397_moveResultMapX); 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.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(); 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); M31_setMap(L0647_ps_Event->_mapTime, _vm->_movsens->_g399_moveResultMapIndex);
} else { } else {
@ -734,7 +734,7 @@ void Timeline::f247_triggerProjectileLauncher(Sensor* sensor, TimelineEvent* eve
L0626_i_MapX = event->_B._location._mapX; L0626_i_MapX = event->_B._location._mapX;
L0627_i_MapY = event->_B._location._mapY; L0627_i_MapY = event->_B._location._mapY;
L0624_ui_Cell = event->_C.A._cell; 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(); L0625_i_SensorType = sensor->getType();
L0629_i_SensorData = sensor->getData(); L0629_i_SensorData = sensor->getData();
L0630_i_KineticEnergy = sensor->M47_kineticEnergy(); 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 */ 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->_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) { 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; _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) { if ((AL0618_ui_HealthMultiplier = L0614_ps_Sensor->M45_healthMultiplier()) == 0) {
AL0618_ui_HealthMultiplier = _vm->_dungeonMan->_g269_currMap->_difficulty; 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()) { if (L0614_ps_Sensor->getAudibleA()) {
_vm->f064_SOUND_RequestPlay_CPSD(k17_soundBUZZ, L0616_ui_MapX, L0617_ui_MapY, k1_soundModePlayIfPrioritized); _vm->f064_SOUND_RequestPlay_CPSD(k17_soundBUZZ, L0616_ui_MapX, L0617_ui_MapY, k1_soundModePlayIfPrioritized);
} }

View file

@ -131,11 +131,11 @@ public:
public: public:
uint16 getMapX() { return _backing & 0x1F; } uint16 getMapX() { return _backing & 0x1F; }
uint16 getMapY() { return (_backing >> 5) & 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; } uint16 getStepEnergy() { return (_backing >> 12) & 0xF; }
void setMapX(uint16 val) { _backing = (_backing & ~0x1F) | (val & 0x1F); } void setMapX(uint16 val) { _backing = (_backing & ~0x1F) | (val & 0x1F); }
void setMapY(uint16 val) { _backing = (_backing & ~(0x1F << 5)) | ((val & 0x1F) << 5); } 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); } void setStepEnergy(uint16 val) { _backing = (_backing & ~(0xF << 12)) | ((val & 0xF) << 12); }
} _projectile; } _projectile;