diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/dm/champion.cpp | 2 | ||||
-rw-r--r-- | engines/dm/dm.cpp | 6 | ||||
-rw-r--r-- | engines/dm/dungeonman.cpp | 2 | ||||
-rw-r--r-- | engines/dm/dungeonman.h | 7 | ||||
-rw-r--r-- | engines/dm/eventman.cpp | 4 | ||||
-rw-r--r-- | engines/dm/group.cpp | 38 | ||||
-rw-r--r-- | engines/dm/group.h | 11 | ||||
-rw-r--r-- | engines/dm/inventory.cpp | 3 | ||||
-rw-r--r-- | engines/dm/menus.cpp | 12 | ||||
-rw-r--r-- | engines/dm/movesens.cpp | 16 | ||||
-rw-r--r-- | engines/dm/projexpl.cpp | 8 | ||||
-rw-r--r-- | engines/dm/sounds.cpp | 11 | ||||
-rw-r--r-- | engines/dm/sounds.h | 8 | ||||
-rw-r--r-- | engines/dm/timeline.cpp | 12 |
14 files changed, 71 insertions, 69 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index fb77c09ee1..fc3131f885 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -217,7 +217,7 @@ bool ChampionMan::isObjectThrown(uint16 champIndex, int16 slotIndex, int16 side) return false; } - _vm->_sound->requestPlay(k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMSoundModePlayIfPrioritized); decrementStamina(champIndex, getThrowingStaminaCost(curThing)); disableAction(champIndex, 4); int16 experience = 8; diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index b8c1a80645..2eed7b842e 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -596,7 +596,7 @@ void DMEngine::endGame(bool doNotDrawCreditsOnly) { _eventMan->_primaryKeyboardInput = nullptr; _eventMan->_secondaryKeyboardInput = nullptr; if (doNotDrawCreditsOnly && !_gameWon) { - _sound->requestPlay(k06_soundSCREAM, _dungeonMan->_partyMapX, _dungeonMan->_partyMapY, k0_soundModePlayImmediately); + _sound->requestPlay(k06_soundSCREAM, _dungeonMan->_partyMapX, _dungeonMan->_partyMapY, kDMSoundModePlayImmediately); delay(240); } @@ -940,7 +940,7 @@ void DMEngine::fuseSequence() { _projexpl->createExplosion(Thing::_explFireBall, attackId, lordChaosMapX, lordChaosMapY, k255_CreatureTypeSingleCenteredCreature); fuseSequenceUpdate(); } - _sound->requestPlay(k17_soundBUZZ, lordChaosMapX, lordChaosMapY, k1_soundModePlayIfPrioritized); + _sound->requestPlay(k17_soundBUZZ, lordChaosMapX, lordChaosMapY, kDMSoundModePlayIfPrioritized); lordGroup->_type = k25_CreatureTypeLordOrder; fuseSequenceUpdate(); for (int16 attackId = 55; attackId <= 255; attackId += 40) { @@ -949,7 +949,7 @@ void DMEngine::fuseSequence() { } for (int16 cycleCount = 3; cycleCount > 0; cycleCount--) { for (int16 switchCount = 4; switchCount > 0; switchCount--) { - _sound->requestPlay(k17_soundBUZZ, lordChaosMapX, lordChaosMapY, k1_soundModePlayIfPrioritized); + _sound->requestPlay(k17_soundBUZZ, lordChaosMapX, lordChaosMapY, kDMSoundModePlayIfPrioritized); lordGroup->_type = (switchCount & 0x0001) ? k25_CreatureTypeLordOrder : k23_CreatureTypeLordChaos; for (int16 fuseSequenceUpdateCount = cycleCount - 1; fuseSequenceUpdateCount >= 0; fuseSequenceUpdateCount--) fuseSequenceUpdate(); diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp index a9658b8222..6dc5a73048 100644 --- a/engines/dm/dungeonman.cpp +++ b/engines/dm/dungeonman.cpp @@ -1455,7 +1455,7 @@ Thing DungeonMan::getDiscardThing(uint16 thingType) { case kDMThingTypeProjectile: setCurrentMap(mapIndex); if (thingType == kDMThingTypeGroup) { - _vm->_groupMan->dropGroupPossessions(currMapX, currMapY, squareThing, kM1_soundModeDoNotPlaySound); + _vm->_groupMan->dropGroupPossessions(currMapX, currMapY, squareThing, kDMSoundModeDoNotPlaySound); _vm->_groupMan->groupDelete(currMapX, currMapY); } else { _vm->_projexpl->projectileDeleteEvent(squareThing); diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h index 6eb34f2176..471a3b8d64 100644 --- a/engines/dm/dungeonman.h +++ b/engines/dm/dungeonman.h @@ -214,13 +214,6 @@ enum JunkType { kDMJunkTypeZokathra = 51 // @ C51_JUNK_ZOKATHRA, }; -enum SoundMode { - kM1_soundModeDoNotPlaySound = -1, // @ CM1_MODE_DO_NOT_PLAY_SOUND - k0_soundModePlayImmediately = 0, // @ C00_MODE_PLAY_IMMEDIATELY - k1_soundModePlayIfPrioritized = 1, // @ C01_MODE_PLAY_IF_PRIORITIZED - k2_soundModePlayOneTickLater = 2 // @ C02_MODE_PLAY_ONE_TICK_LATER -}; - #define k0_ExplosionType_Fireball 0 // @ C000_EXPLOSION_FIREBALL #define k1_ExplosionType_Slime 1 // @ C001_EXPLOSION_SLIME #define k2_ExplosionType_LightningBolt 2 // @ C002_EXPLOSION_LIGHTNING_BOLT diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index 08882adb47..4cbcff3965 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -1028,7 +1028,7 @@ void EventManager::commandMoveParty(CommandType cmdType) { damage |= _vm->_championMan->addPendingDamageAndWounds_getDamage(secondDamagedChampionIndex, 1, kDMWoundTorso | kDMWoundLegs, kDMAttackTypeSelf); if (damage) - _vm->_sound->requestPlay(k18_soundPARTY_DAMAGED, partyMapX, partyMapY, k0_soundModePlayImmediately); + _vm->_sound->requestPlay(k18_soundPARTY_DAMAGED, partyMapX, partyMapY, kDMSoundModePlayImmediately); } else { isMovementBlocked = (_vm->_groupMan->groupGetThing(partyMapX, partyMapY) != Thing::_endOfList); if (isMovementBlocked) @@ -1174,7 +1174,7 @@ void EventManager::commandProcessType80ClickInDungeonView(int16 posX, int16 posY Junk *junkPtr = (Junk*)_vm->_dungeonMan->getSquareFirstThingData(mapX, mapY); if ((((Door*)junkPtr)->hasButton()) && _vm->_dungeonMan->_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn].isPointInside(posX, posY - 33)) { _vm->_stopWaitingForPlayerInput = true; - _vm->_sound->requestPlay(k01_soundSWITCH, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k01_soundSWITCH, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMSoundModePlayIfPrioritized); _vm->_moveSens->addEvent(k10_TMEventTypeDoor, mapX, mapY, kDMCellNorthWest, kDMSensorEffectToggle, _vm->_gameTime + 1); return; } diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp index 93fb718d72..1503d48d73 100644 --- a/engines/dm/group.cpp +++ b/engines/dm/group.cpp @@ -137,37 +137,37 @@ uint16 GroupMan::getCreatureValue(uint16 groupVal, uint16 creatureIndex) { return (groupVal >> (creatureIndex << 1)) & 0x3; } -void GroupMan::dropGroupPossessions(int16 mapX, int16 mapY, Thing groupThing, int16 mode) { +void GroupMan::dropGroupPossessions(int16 mapX, int16 mapY, Thing groupThing, SoundMode soundMode) { Group *group = (Group *)_vm->_dungeonMan->getThingData(groupThing); uint16 creatureType = group->_type; - if ((mode >= k0_soundModePlayImmediately) && getFlag(_vm->_dungeonMan->_creatureInfos[creatureType]._attributes, k0x0200_MaskCreatureInfo_dropFixedPoss)) { + if ((soundMode != kDMSoundModeDoNotPlaySound) && getFlag(_vm->_dungeonMan->_creatureInfos[creatureType]._attributes, k0x0200_MaskCreatureInfo_dropFixedPoss)) { int16 creatureIndex = group->getCount(); uint16 groupCells = getGroupCells(group, _vm->_dungeonMan->_currMapIndex); do { dropCreatureFixedPossessions(creatureType, mapX, mapY, - (groupCells == k255_CreatureTypeSingleCenteredCreature) ? k255_CreatureTypeSingleCenteredCreature : getCreatureValue(groupCells, creatureIndex), mode); + (groupCells == k255_CreatureTypeSingleCenteredCreature) ? k255_CreatureTypeSingleCenteredCreature : getCreatureValue(groupCells, creatureIndex), soundMode); } while (creatureIndex--); } Thing currentThing = group->_slot; if ((currentThing) != Thing::_endOfList) { - bool L0371_B_WeaponDropped = false; + bool weaponDropped = false; Thing nextThing; do { nextThing = _vm->_dungeonMan->getNextThing(currentThing); currentThing = _vm->thingWithNewCell(currentThing, _vm->getRandomNumber(4)); if ((currentThing).getType() == kDMThingTypeWeapon) { - L0371_B_WeaponDropped = true; + weaponDropped = true; } _vm->_moveSens->getMoveResult(currentThing, kDMMapXNotOnASquare, 0, mapX, mapY); } while ((currentThing = nextThing) != Thing::_endOfList); - if (mode >= k0_soundModePlayImmediately) - _vm->_sound->requestPlay(L0371_B_WeaponDropped ? k00_soundMETALLIC_THUD : k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM, mapX, mapY, mode); + if (soundMode != kDMSoundModeDoNotPlaySound) + _vm->_sound->requestPlay(weaponDropped ? k00_soundMETALLIC_THUD : k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM, mapX, mapY, soundMode); } } -void GroupMan::dropCreatureFixedPossessions(uint16 creatureType, int16 mapX, int16 mapY, uint16 cell, int16 mode) { +void GroupMan::dropCreatureFixedPossessions(uint16 creatureType, int16 mapX, int16 mapY, uint16 cell, SoundMode soundMode) { static uint16 fixedPossessionCreature12Skeleton[3] = { // @ G0245_aui_Graphic559_FixedPossessionsCreature12Skeleton kDMObjectInfoIndexFirstWeapon + kDMWeaponFalchion, kDMObjectInfoIndexFirstArmour + kDMArmourWoodenShield, @@ -291,7 +291,7 @@ void GroupMan::dropCreatureFixedPossessions(uint16 creatureType, int16 mapX, int _vm->_moveSens->getMoveResult(nextUnusedThing, kDMMapXNotOnASquare, 0, mapX, mapY); currFixedPossession = *fixedPossessions++; } - _vm->_sound->requestPlay(weaponDropped ? k00_soundMETALLIC_THUD : k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM, mapX, mapY, mode); + _vm->_sound->requestPlay(weaponDropped ? k00_soundMETALLIC_THUD : k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM, mapX, mapY, soundMode); } int16 GroupMan::getDirsWhereDestIsVisibleFromSource(int16 srcMapX, int16 srcMapY, int16 destMapX, int16 destMapY) { @@ -397,7 +397,7 @@ int16 GroupMan::groupGetDamageCreatureOutcome(Group *group, uint16 creatureIndex if (!creatureCount) { /* If there is a single creature in the group */ if (notMoving) { - dropGroupPossessions(mapX, mapY, groupGetThing(mapX, mapY), k2_soundModePlayOneTickLater); + dropGroupPossessions(mapX, mapY, groupGetThing(mapX, mapY), kDMSoundModePlayOneTickLater); groupDelete(mapX, mapY); } retVal = k2_outcomeKilledAllCreaturesInGroup; @@ -405,7 +405,7 @@ int16 GroupMan::groupGetDamageCreatureOutcome(Group *group, uint16 creatureIndex uint16 groupDirections = getGroupDirections(group, _vm->_dungeonMan->_currMapIndex); if (getFlag(creatureInfo->_attributes, k0x0200_MaskCreatureInfo_dropFixedPoss)) { if (notMoving) - dropCreatureFixedPossessions(creatureType, mapX, mapY, cell, k2_soundModePlayOneTickLater); + dropCreatureFixedPossessions(creatureType, mapX, mapY, cell, kDMSoundModePlayOneTickLater); else _dropMovingCreatureFixedPossessionsCell[_dropMovingCreatureFixedPossCellCount++] = cell; } @@ -890,7 +890,7 @@ T0209089_DoubleSquareMove: 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; - _vm->_sound->requestPlay(k17_soundBUZZ, AL0450_i_DestinationMapX, AL0451_i_DestinationMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k17_soundBUZZ, AL0450_i_DestinationMapX, AL0451_i_DestinationMapY, kDMSoundModePlayIfPrioritized); goto T0209061_MoveGroup; } } @@ -1275,7 +1275,7 @@ int32 GroupMan::getCreatureAspectUpdateTime(ActiveGroup *activeGroup, int16 crea if (getFlag(aspect, k0x0080_MaskActiveGroupIsAttacking) && (creatureType == k18_CreatureTypeAnimatedArmourDethKnight)) { if (_vm->getRandomNumber(2)) { toggleFlag(aspect, k0x0040_MaskActiveGroupFlipBitmap); - _vm->_sound->requestPlay(k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, _currentGroupMapX, _currentGroupMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, _currentGroupMapX, _currentGroupMapY, kDMSoundModePlayIfPrioritized); } } else if (!getFlag(aspect, k0x0080_MaskActiveGroupIsAttacking) || !getFlag(creatureGraphicInfo, k0x0400_CreatureInfoGraphicMaskFlipDuringAttack)) { if (_vm->getRandomNumber(2)) @@ -1294,7 +1294,7 @@ int32 GroupMan::getCreatureAspectUpdateTime(ActiveGroup *activeGroup, int16 crea toggleFlag(aspect, k0x0040_MaskActiveGroupFlipBitmap); uint16 soundIndex = _vm->_moveSens->getSound(k13_CreatureTypeCouatl); if (soundIndex <= k34_D13_soundCount) - _vm->_sound->requestPlay(soundIndex, _currentGroupMapX, _currentGroupMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(soundIndex, _currentGroupMapX, _currentGroupMapY, kDMSoundModePlayIfPrioritized); } } else if (_vm->getRandomNumber(2)) setFlag(aspect, k0x0040_MaskActiveGroupFlipBitmap); @@ -1472,7 +1472,7 @@ bool GroupMan::isCreatureAttacking(Group *group, int16 mapX, int16 mapY, uint16 int16 kineticEnergy = (creatureInfo->_attack >> 2) + 1; kineticEnergy += _vm->getRandomNumber(kineticEnergy); kineticEnergy += _vm->getRandomNumber(kineticEnergy); - _vm->_sound->requestPlay(k13_soundSPELL, mapX, mapY, k0_soundModePlayImmediately); + _vm->_sound->requestPlay(k13_soundSPELL, mapX, mapY, kDMSoundModePlayImmediately); _vm->_projexpl->createProjectile(projectileThing, mapX, mapY, targetCell, (Direction)_currGroupPrimaryDirToParty, CLIP<byte>(20, kineticEnergy, 255), creatureInfo->_dexterity, 8); } else { int16 championIndex; @@ -1503,7 +1503,7 @@ bool GroupMan::isCreatureAttacking(Group *group, int16 mapX, int16 mapY, uint16 } int16 attackSoundOrdinal = creatureInfo->_attackSoundOrdinal; if (attackSoundOrdinal) - _vm->_sound->requestPlay(creatureAttackSounds[--attackSoundOrdinal], mapX, mapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(creatureAttackSounds[--attackSoundOrdinal], mapX, mapY, kDMSoundModePlayIfPrioritized); return true; } @@ -1612,7 +1612,7 @@ int16 GroupMan::getChampionDamage(Group *group, uint16 champIndex) { int16 damage = _vm->_championMan->addPendingDamageAndWounds_getDamage(champIndex, attack, allowedWound, creatureInfo._attackType); if (damage) { - _vm->_sound->requestPlay(k09_soundCHAMPION_0_DAMAGED + champIndex, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, k2_soundModePlayOneTickLater); + _vm->_sound->requestPlay(k09_soundCHAMPION_0_DAMAGED + champIndex, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMSoundModePlayOneTickLater); uint16 poisonAttack = creatureInfo._poisonAttack; if (poisonAttack && _vm->getRandomNumber(2)) { @@ -1632,7 +1632,7 @@ void GroupMan::dropMovingCreatureFixedPossession(Thing thing, int16 mapX, int16 Group *group = (Group *)_vm->_dungeonMan->getThingData(thing); int16 creatureType = group->_type; while (_dropMovingCreatureFixedPossCellCount) { - dropCreatureFixedPossessions(creatureType, mapX, mapY, _dropMovingCreatureFixedPossessionsCell[--_dropMovingCreatureFixedPossCellCount], k2_soundModePlayOneTickLater); + dropCreatureFixedPossessions(creatureType, mapX, mapY, _dropMovingCreatureFixedPossessionsCell[--_dropMovingCreatureFixedPossCellCount], kDMSoundModePlayOneTickLater); } } } @@ -1763,7 +1763,7 @@ Thing GroupMan::groupGetGenerated(int16 creatureType, int16 healthMultiplier, ui (in which case the thing is referenced in the event) */ return Thing::_none; } - _vm->_sound->requestPlay(k17_soundBUZZ, mapX, mapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k17_soundBUZZ, mapX, mapY, kDMSoundModePlayIfPrioritized); return groupThing; } diff --git a/engines/dm/group.h b/engines/dm/group.h index 3b6cf2f8aa..ad68a03216 100644 --- a/engines/dm/group.h +++ b/engines/dm/group.h @@ -89,6 +89,13 @@ enum CreatureType { #define k0x0040_MaskActiveGroupFlipBitmap 0x0040 // @ MASK0x0040_FLIP_BITMAP #define k0x0080_MaskActiveGroupIsAttacking 0x0080 // @ MASK0x0080_IS_ATTACKING +enum SoundMode { + kDMSoundModeDoNotPlaySound = -1, // @ CM1_MODE_DO_NOT_PLAY_SOUND + kDMSoundModePlayImmediately = 0, // @ C00_MODE_PLAY_IMMEDIATELY + kDMSoundModePlayIfPrioritized = 1, // @ C01_MODE_PLAY_IF_PRIORITIZED + kDMSoundModePlayOneTickLater = 2 // @ C02_MODE_PLAY_ONE_TICK_LATER +}; + class ActiveGroup { public: int16 _groupThingIndex; @@ -185,9 +192,9 @@ public: uint16 getGroupDirections(Group *group, int16 mapIndex); // @ F0147_DUNGEON_GetGroupDirections int16 getCreatureOrdinalInCell(Group *group, uint16 cell); // @ F0176_GROUP_GetCreatureOrdinalInCell uint16 getCreatureValue(uint16 groupVal, uint16 creatureIndex); // @ M50_CREATURE_VALUE - void dropGroupPossessions(int16 mapX, int16 mapY, Thing groupThing, int16 mode); // @ F0188_GROUP_DropGroupPossessions + void dropGroupPossessions(int16 mapX, int16 mapY, Thing groupThing, SoundMode mode); // @ F0188_GROUP_DropGroupPossessions void dropCreatureFixedPossessions(uint16 creatureType, int16 mapX, int16 mapY, uint16 cell, - int16 mode); // @ F0186_GROUP_DropCreatureFixedPossessions + SoundMode soundMode); // @ F0186_GROUP_DropCreatureFixedPossessions int16 getDirsWhereDestIsVisibleFromSource(int16 srcMapX, int16 srcMapY, int16 destMapX, int16 destMapY); // @ F0228_GROUP_GetDirectionsWhereDestinationIsVisibleFromSource bool isDestVisibleFromSource(uint16 dir, int16 srcMapX, int16 srcMapY, int16 destMapX, diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index ca4734b56e..31d3436b1b 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -31,6 +31,7 @@ #include "dm/inventory.h" #include "dm/dungeonman.h" #include "dm/eventman.h" +#include "dm/group.h" #include "dm/menus.h" #include "dm/gfx.h" #include "dm/text.h" @@ -1017,7 +1018,7 @@ void InventoryMan::clickOnMouth() { _vm->_championMan->_champions[_vm->_championMan->_leaderIndex]._load += _vm->_dungeonMan->getObjectWeight(handThing) - handThingWeight; setFlag(_vm->_championMan->_champions[_vm->_championMan->_leaderIndex]._attributes, kDMAttributeLoad); } - _vm->_sound->requestPlay(k08_soundSWALLOW, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, k0_soundModePlayImmediately); + _vm->_sound->requestPlay(k08_soundSWALLOW, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMSoundModePlayImmediately); setFlag(curChampion->_attributes, kDMAttributeStatistics); if (_panelContent == k0_PanelContentFoodWaterPoisoned) diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index 00094583ad..abf0d0a358 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -1106,10 +1106,10 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) { case kDMActionSwing: case kDMActionChop: if ((Square(targetSquare).getType() == k4_DoorElemType) && (Square(targetSquare).getDoorState() == k4_doorState_CLOSED)) { - _vm->_sound->requestPlay(k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMSoundModePlayIfPrioritized); actionDisabledTicks = 6; _vm->_groupMan->groupIsDoorDestoryedByAttack(nextMapX, nextMapY, _vm->_championMan->getStrength(champIndex, kDMSlotActionHand), false, 2); - _vm->_sound->requestPlay(k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, k2_soundModePlayOneTickLater); + _vm->_sound->requestPlay(k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMSoundModePlayOneTickLater); break; } case kDMActionDisrupt: @@ -1136,9 +1136,9 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) { case kDMActionBrandish: case kDMActionBlowHorn: if (actionIndex == kDMActionWarCry) - _vm->_sound->requestPlay(k28_soundWAR_CRY, nextMapX, nextMapY, k0_soundModePlayImmediately); + _vm->_sound->requestPlay(k28_soundWAR_CRY, nextMapX, nextMapY, kDMSoundModePlayImmediately); else if (actionIndex == kDMActionBlowHorn) - _vm->_sound->requestPlay(k25_soundBLOW_HORN, nextMapX, nextMapY, k0_soundModePlayImmediately); + _vm->_sound->requestPlay(k25_soundBLOW_HORN, nextMapX, nextMapY, kDMSoundModePlayImmediately); actionPerformed = isGroupFrightenedByAction(champIndex, actionIndex, nextMapX, nextMapY); break; @@ -1175,7 +1175,7 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) { setChampionDirectionToPartyDirection(curChampion); Thing removedObject = _vm->_championMan->getObjectRemovedFromSlot(champIndex, kDMSlotReadyHand); - _vm->_sound->requestPlay(k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMSoundModePlayIfPrioritized); _vm->_championMan->championShootProjectile(curChampion, removedObject, weaponInfoActionHand->_kineticEnergy + weaponInfoReadyHand->_kineticEnergy, (weaponInfoActionHand->getShootAttack() + _vm->_championMan->getSkillLevel(champIndex, kDMSkillShoot)) << 1, stepEnergy); } break; @@ -1482,7 +1482,7 @@ bool MenuMan::isMeleeActionPerformed(int16 champIndex, Champion *champ, int16 ac 0 /* FUSE */ }; - _vm->_sound->requestPlay(k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMSoundModePlayIfPrioritized); if (_actionTargetGroupThing == Thing::_endOfList) return false; diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp index bd95c7f04b..d61a43e850 100644 --- a/engines/dm/movesens.cpp +++ b/engines/dm/movesens.cpp @@ -182,7 +182,7 @@ bool MovesensMan::sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, uint16 if (!doNotTriggerSensor) { atLeastOneSensorWasTriggered = true; if (currentSensor->getAttrAudibleA()) - _vm->_sound->requestPlay(k01_soundSWITCH, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k01_soundSWITCH, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMSoundModePlayIfPrioritized); if (!_vm->_championMan->_leaderEmptyHanded && ((processedSensorType == kDMSensorWallOrnClickWithSpecObjRemoved) || (processedSensorType == kDMSensorWallOrnClickWithSpecObjRemovedRotateSensors) || (processedSensorType == kDMSensorWallOrnClickWithSpecObjRemovedSensor))) { Thing *leaderThing = (Thing *)_vm->_dungeonMan->getThingData(leaderHandObject); @@ -279,7 +279,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM _vm->_dungeonMan->_partyMapX = destMapX; _vm->_dungeonMan->_partyMapY = destMapY; if (teleporter->isAudible()) - _vm->_sound->requestPlay(k17_soundBUZZ, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, k0_soundModePlayImmediately); + _vm->_sound->requestPlay(k17_soundBUZZ, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMSoundModePlayImmediately); drawDungeonViewWhileFalling = true; if (teleporter->getAbsoluteRotation()) @@ -289,7 +289,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM } else { if (thingType == kDMThingTypeGroup) { if (teleporter->isAudible()) - _vm->_sound->requestPlay(k17_soundBUZZ, destMapX, destMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k17_soundBUZZ, destMapX, destMapY, kDMSoundModePlayIfPrioritized); moveGroupResult = getTeleporterRotatedGroupResult(teleporter, thing, mapIndexSource); } else { @@ -327,7 +327,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM _vm->_championMan->decrementStamina(championIdx, ((curChampion->_load * 25) / _vm->_championMan->getMaximumLoad(curChampion)) + 1); } } else if (_vm->_championMan->getDamagedChampionCount(20, kDMWoundLegs | kDMWoundFeet, kDMAttackTypeSelf)) - _vm->_sound->requestPlay(k06_soundSCREAM, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, k0_soundModePlayImmediately); + _vm->_sound->requestPlay(k06_soundSCREAM, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMSoundModePlayImmediately); } _useRopeToClimbDownPit = false; } else if (thingType == kDMThingTypeGroup) { @@ -358,7 +358,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM } if ((thingType == kDMThingTypeGroup) && (fallKilledGroup || !_vm->_dungeonMan->isCreatureAllowedOnMap(thing, mapIndexDestination))) { _vm->_groupMan->dropMovingCreatureFixedPossession(thing, destMapX, destMapY); - _vm->_groupMan->dropGroupPossessions(destMapX, destMapY, thing, k2_soundModePlayOneTickLater); + _vm->_groupMan->dropGroupPossessions(destMapX, destMapY, thing, kDMSoundModePlayOneTickLater); _vm->_dungeonMan->setCurrentMap(mapIndexSource); if (mapX >= 0) _vm->_groupMan->groupDelete(mapX, mapY); @@ -416,7 +416,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM if (thing == Thing::_party) { _vm->_dungeonMan->setCurrentMap(mapIndexDestination); if ((thing = _vm->_groupMan->groupGetThing(_vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY)) != Thing::_endOfList) { /* Delete group if party moves onto its square */ - _vm->_groupMan->dropGroupPossessions(_vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, thing, k1_soundModePlayIfPrioritized); + _vm->_groupMan->dropGroupPossessions(_vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, thing, kDMSoundModePlayIfPrioritized); _vm->_groupMan->groupDelete(_vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY); } @@ -444,7 +444,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM } uint16 movementSoundIndex = getSound(((Group *)_vm->_dungeonMan->_thingData[kDMThingTypeGroup])[thing.getIndex()]._type); if (movementSoundIndex < k34_D13_soundCount) - _vm->_sound->requestPlay(movementSoundIndex, destMapX, destMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(movementSoundIndex, destMapX, destMapY, kDMSoundModePlayIfPrioritized); if (groupOnPartyMap && (mapIndexDestination != _vm->_dungeonMan->_partyMapIndex)) { /* If the group leaves the party map */ _vm->_groupMan->removeActiveGroup(activeGroupIndex); @@ -839,7 +839,7 @@ void MovesensMan::processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing continue; if (curSensor->getAttrAudibleA()) - _vm->_sound->requestPlay(k01_soundSWITCH, mapX, mapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k01_soundSWITCH, mapX, mapY, kDMSoundModePlayIfPrioritized); triggerEffect(curSensor, curSensorEffect, mapX, mapY, (uint16)kDMCellAny); // this will wrap around continue; diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 97463b606e..850873525f 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -218,7 +218,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in else soundIndex = k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM; - _vm->_sound->requestPlay(soundIndex, projectileMapX, projectileMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(soundIndex, projectileMapX, projectileMapY, kDMSoundModePlayIfPrioritized); } T0217044: if (removePotion) { @@ -305,9 +305,9 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, explosion->setAttack(attack); if (explThing.toUint16() < Thing::_explHarmNonMaterial.toUint16()) { uint16 soundIndex = (attack > 80) ? k05_soundSTRONG_EXPLOSION : k20_soundWEAK_EXPLOSION; - _vm->_sound->requestPlay(soundIndex, projectileMapX, projectileMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(soundIndex, projectileMapX, projectileMapY, kDMSoundModePlayIfPrioritized); } else if (explThing != Thing::_explSmoke) - _vm->_sound->requestPlay(k13_soundSPELL, projectileMapX, projectileMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k13_soundSPELL, projectileMapX, projectileMapY, kDMSoundModePlayIfPrioritized); _vm->_dungeonMan->linkThingToList(unusedThing, Thing(0), projectileMapX, projectileMapY); TimelineEvent newEvent; @@ -525,7 +525,7 @@ void ProjExpl::processEvent25(TimelineEvent *event) { break; case 0xFFE4: explosion->setType(explosion->getType() + 1); - _vm->_sound->requestPlay(k05_soundSTRONG_EXPLOSION, mapX, mapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k05_soundSTRONG_EXPLOSION, mapX, mapY, kDMSoundModePlayIfPrioritized); AddEventFl = true; break; case 0xFFA8: diff --git a/engines/dm/sounds.cpp b/engines/dm/sounds.cpp index d077ee58ec..0c14cda19e 100644 --- a/engines/dm/sounds.cpp +++ b/engines/dm/sounds.cpp @@ -34,6 +34,7 @@ #include "dm/gfx.h" #include "dm/timeline.h" #include "dm/dungeonman.h" +#include "dm/group.h" #include "dm/sounds.h" namespace DM { @@ -195,14 +196,14 @@ bool SoundMan::soundGetVolume(int16 mapX, int16 mapY, uint8 *leftVolume, uint8 * return true; } -void SoundMan::requestPlay(uint16 soundIndex, int16 mapX, int16 mapY, uint16 mode) { - if (mode && (_vm->_dungeonMan->_currMapIndex != _vm->_dungeonMan->_partyMapIndex)) +void SoundMan::requestPlay(uint16 soundIndex, int16 mapX, int16 mapY, SoundMode soundMode) { + if ((soundMode != kDMSoundModePlayImmediately) && (_vm->_dungeonMan->_currMapIndex != _vm->_dungeonMan->_partyMapIndex)) return; Sound *sound = &_sounds[soundIndex]; - if (mode > k1_soundModePlayIfPrioritized) { /* Add an event in the timeline to play the sound (mode - 1) ticks later */ + if (soundMode == kDMSoundModePlayOneTickLater) { /* Add an event in the timeline to play the sound (mode - 1) ticks later */ TimelineEvent newEvent; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime + mode - 1); + _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime + soundMode - 1); newEvent._type = k20_TMEventTypePlaySound; newEvent._priority = sound->_priority; newEvent._Cu._soundIndex = soundIndex; @@ -216,7 +217,7 @@ void SoundMan::requestPlay(uint16 soundIndex, int16 mapX, int16 mapY, uint16 mod if (!soundGetVolume(mapX, mapY, &leftVolume, &rightVolume)) return; - if (!mode) { /* Play the sound immediately */ + if (soundMode == kDMSoundModePlayImmediately) { /* Play the sound immediately */ play(soundIndex, sound->_period, leftVolume, rightVolume); return; } diff --git a/engines/dm/sounds.h b/engines/dm/sounds.h index fc9561a0c8..92b9340dbd 100644 --- a/engines/dm/sounds.h +++ b/engines/dm/sounds.h @@ -77,8 +77,8 @@ public: Common::Queue<PendingSound> _pendingSounds; virtual void loadSounds(); // @ F0503_SOUND_LoadAll - virtual void requestPlay(uint16 P0088_ui_SoundIndex, int16 P0089_i_MapX, int16 P0090_i_MapY, uint16 P0091_ui_Mode); // @ F0064_SOUND_RequestPlay_CPSD - virtual void play(uint16 P0921_ui_SoundIndex, uint16 P0085_i_Period, uint8 leftVol, uint8 rightVol); // @ F0060_SOUND_Play + virtual void requestPlay(uint16 soundIndex, int16 mapX, int16 mapY, SoundMode soundMode); // @ F0064_SOUND_RequestPlay_CPSD + virtual void play(uint16 soundIndex, uint16 period, uint8 leftVolume, uint8 rightVolume); // @ F0060_SOUND_Play void playPendingSound(); // @ F0065_SOUND_PlayPendingSound_CPSD bool soundGetVolume(int16 mapX, int16 mapY, uint8 *leftVolume, uint8 *rightVolume); // @ F0505_SOUND_GetVolume @@ -92,8 +92,8 @@ class SoundMan_Atari: public SoundMan { SoundMan_Atari(DMEngine *vm): SoundMan(vm) {}; public: void loadSounds() override {} // @ F0503_SOUND_LoadAll - void requestPlay(uint16 P0088_ui_SoundIndex, int16 P0089_i_MapX, int16 P0090_i_MapY, uint16 P0091_ui_Mode) override {} // @ F0064_SOUND_RequestPlay_CPSD - void play(uint16 P0921_ui_SoundIndex, uint16 P0085_i_Period, uint8 leftVol, uint8 rightVol) override {} // @ F0060_SOUND_Play + void requestPlay(uint16 soundIndex, int16 mapX, int16 mapY, SoundMode soundMode) override {} // @ F0064_SOUND_RequestPlay_CPSD + void play(uint16 soundIndex, uint16 period, uint8 leftVolume, uint8 rightVolume) override {} // @ F0060_SOUND_Play }; } diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp index 6d854d1ab4..0e61a87000 100644 --- a/engines/dm/timeline.cpp +++ b/engines/dm/timeline.cpp @@ -304,7 +304,7 @@ void Timeline::processTimeline() { procesEventEnableGroupGenerator(curEvent); break; case k20_TMEventTypePlaySound: - _vm->_sound->requestPlay(newEvent._Cu._soundIndex, newEvent._Bu._location._mapX, newEvent._Bu._location._mapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(newEvent._Cu._soundIndex, newEvent._Bu._location._mapX, newEvent._Bu._location._mapY, kDMSoundModePlayIfPrioritized); break; case k24_TMEventTypeRemoveFluxcage: if (!_vm->_gameWon) { @@ -402,7 +402,7 @@ void Timeline::processEventDoorAnimation(TimelineEvent *event) { // See BUG0_78 int16 wounds = kDMWoundTorso | (verticalDoorFl ? kDMWoundHead : kDMWoundReadHand | kDMWoundActionHand); if (_vm->_championMan->getDamagedChampionCount(5, wounds, kDMAttackTypeSelf)) - _vm->_sound->requestPlay(k18_soundPARTY_DAMAGED, mapX, mapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k18_soundPARTY_DAMAGED, mapX, mapY, kDMSoundModePlayIfPrioritized); } event->_mapTime++; addEventGetEventIndex(event); @@ -417,7 +417,7 @@ void Timeline::processEventDoorAnimation(TimelineEvent *event) { doorState = (doorState == k0_doorState_OPEN) ? k0_doorState_OPEN : (doorState - 1); curSquare->setDoorState(doorState); - _vm->_sound->requestPlay(k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM, mapX, mapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM, mapX, mapY, kDMSoundModePlayIfPrioritized); event->_mapTime++; addEventGetEventIndex(event); return; @@ -432,7 +432,7 @@ void Timeline::processEventDoorAnimation(TimelineEvent *event) { doorState += (sensorEffect == kDMSensorEffectSet) ? -1 : 1; curSquare->setDoorState(doorState); - _vm->_sound->requestPlay(k02_soundDOOR_RATTLE, mapX, mapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k02_soundDOOR_RATTLE, mapX, mapY, kDMSoundModePlayIfPrioritized); if (sensorEffect == kDMSensorEffectSet) { if (doorState == k0_doorState_OPEN) @@ -733,7 +733,7 @@ void Timeline::processEventSquareCorridor(TimelineEvent *event) { _vm->_groupMan->groupGetGenerated(curSensor->getData(), healthMultiplier, creatureCount, (Direction)_vm->getRandomNumber(4), mapX, mapY); if (curSensor->getAttrAudibleA()) - _vm->_sound->requestPlay(k17_soundBUZZ, mapX, mapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k17_soundBUZZ, mapX, mapY, kDMSoundModePlayIfPrioritized); if (curSensor->getAttrOnlyOnce()) curSensor->setTypeDisabled(); @@ -768,7 +768,7 @@ void Timeline::processEventsMoveGroup(TimelineEvent *event) { T0252001: if (((_vm->_dungeonMan->_currMapIndex != _vm->_dungeonMan->_partyMapIndex) || (mapX != _vm->_dungeonMan->_partyMapX) || (mapY != _vm->_dungeonMan->_partyMapY)) && (_vm->_groupMan->groupGetThing(mapX, mapY) == Thing::_endOfList)) { /* BUG0_24 Lord Chaos may teleport into one of the Black Flames and become invisible until the Black Flame is killed. In this case, _vm->_groupMan->f175_groupGetThing returns the Black Flame thing and the Lord Chaos thing is not moved into the dungeon until the Black Flame is killed */ if (event->_type == k61_TMEventTypeMoveGroupAudible) - _vm->_sound->requestPlay(k17_soundBUZZ, mapX, mapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k17_soundBUZZ, mapX, mapY, kDMSoundModePlayIfPrioritized); _vm->_moveSens->getMoveResult(Thing(event->_Cu._slot), kDMMapXNotOnASquare, 0, mapX, mapY); } else { |