From 1670cb035ffef58af7dff4c87f5408736e10f8ff Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 Sep 2016 07:05:37 +0200 Subject: DM: Change the definition of setMapAndTime, move SoundIndex enum to SoundMan --- engines/dm/champion.cpp | 8 ++++---- engines/dm/dm.cpp | 10 +++++++--- engines/dm/dm.h | 10 ++++++---- engines/dm/eventman.cpp | 2 +- engines/dm/group.cpp | 10 +++++----- engines/dm/inventory.cpp | 2 +- engines/dm/menus.cpp | 14 +++++++------- engines/dm/movesens.cpp | 6 +++--- engines/dm/projexpl.cpp | 6 +++--- engines/dm/projexpl.h | 39 --------------------------------------- engines/dm/sounds.cpp | 10 +++++----- engines/dm/sounds.h | 43 ++++++++++++++++++++++++++++++++++++++++--- engines/dm/timeline.cpp | 8 ++++---- 13 files changed, 86 insertions(+), 82 deletions(-) (limited to 'engines/dm') diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index dc05ebc5c7..8a63113431 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -942,7 +942,7 @@ void ChampionMan::disableAction(uint16 champIndex, uint16 ticks) { setFlag(curChampion->_attributes, kDMAttributeActionHand | kDMAttributeDisableAction); drawChampionState((ChampionIndex)champIndex); } - _vm->setMapAndTime(curEvent._mapTime, _vm->_dungeonMan->_partyMapIndex, updatedEnableActionEventTime); + curEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, updatedEnableActionEventTime); curChampion->_enableActionEventIndex = _vm->_timeline->addEventGetEventIndex(&curEvent); } @@ -1117,7 +1117,7 @@ void ChampionMan::championPoison(int16 champIndex, uint16 attack) { TimelineEvent newEvent; newEvent._type = k75_TMEventTypePoisonChampion; newEvent._priority = champIndex; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + 36); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + 36); newEvent._Bu._attack = attack; _vm->_timeline->addEventGetEventIndex(&newEvent); } @@ -1432,12 +1432,12 @@ void ChampionMan::applyAndDrawPendingDamageAndWounds() { if (eventIndex == -1) { TimelineEvent newEvent; newEvent._type = k12_TMEventTypeHideDamageReceived; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + 5); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + 5); newEvent._priority = championIndex; championPtr->_hideDamageReceivedIndex = _vm->_timeline->addEventGetEventIndex(&newEvent); } else { TimelineEvent *curEvent = &_vm->_timeline->_events[eventIndex]; - _vm->setMapAndTime(curEvent->_mapTime, _vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + 5); + curEvent->_mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + 5); _vm->_timeline->fixChronology(_vm->_timeline->getIndex(eventIndex)); } drawChampionState((ChampionIndex)championIndex); diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index 15a397b92a..41611d730a 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -95,12 +95,16 @@ int32 DMEngine::filterTime(int32 mapTime) { return mapTime & 0x00FFFFFF; } -int32 DMEngine::setMapAndTime(int32 &mapTime, uint32 map, uint32 time) { - return (mapTime) = ((time) | (((long)(map)) << 24)); +int32 DMEngine::setMapAndTime(uint32 map, uint32 time) { + return (time | (map << 24)); } uint16 DMEngine::getMap(int32 mapTime) { - return ((uint16)((mapTime) >> 24)); + return ((uint16)(mapTime >> 24)); +} + +int32 DMEngine::setMap(int32 mapTime, uint32 map) { + return ((mapTime & 0x00FFFFFF) | (map << 24)); } Thing DMEngine::thingWithNewCell(Thing thing, int16 cell) { diff --git a/engines/dm/dm.h b/engines/dm/dm.h index e4fc837558..e2f5f4186c 100644 --- a/engines/dm/dm.h +++ b/engines/dm/dm.h @@ -265,11 +265,13 @@ public: bool isOrientedWestEast(int16 dir); // @ M16_IS_ORIENTED_WEST_EAST uint16 normalizeModulo4(int16 dir); // @ M21_NORMALIZE - int32 filterTime(int32 map_time); // @ M30_TIME - int32 setMapAndTime(int32 &map_time, uint32 map, uint32 time); // @ M33_SET_MAP_AND_TIME - uint16 getMap(int32 map_time); // @ M29_MAP + int32 filterTime(int32 mapTime); // @ M30_TIME + int32 setMapAndTime(uint32 map, uint32 time); // @ M33_SET_MAP_AND_TIME + uint16 getMap(int32 mapTime); // @ M29_MAP Thing thingWithNewCell(Thing thing, int16 cell); // @ M15_THING_WITH_NEW_CELL - int16 getDistance(int16 mapx1, int16 mapy1, int16 mapx2, int16 mapy2);// @ M38_DISTANCE + int16 getDistance(int16 mapx1, int16 mapy1, int16 mapx2, int16 mapy2); // @ M38_DISTANCE + int32 setMap(int32 mapTime, uint32 map); // @ M31_setMap + private: uint16 _dungeonId; // @ G0526_ui_DungeonID diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index 98828d990e..c6a2e8b985 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -1397,7 +1397,7 @@ void EventManager::clickInDungeonViewDropLeaderHandObject(uint16 viewCell) { if (droppingIntoAnAlcove && _vm->_dungeonMan->_isFacingViAltar && (_vm->_objectMan->getIconIndex(removedThing) == kDMIconIndiceJunkChampionBones)) { Junk *removedJunk = (Junk*)_vm->_dungeonMan->getThingData(removedThing); TimelineEvent newEvent; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + 1); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + 1); newEvent._type = k13_TMEventTypeViAltarRebirth; newEvent._priority = removedJunk->getChargeCount(); newEvent._Bu._location._mapX = mapX; diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp index c1598c43d6..b8106f4784 100644 --- a/engines/dm/group.cpp +++ b/engines/dm/group.cpp @@ -363,7 +363,7 @@ bool GroupMan::groupIsDoorDestoryedByAttack(uint16 mapX, uint16 mapY, int16 atta if (Square(*curSquare).getDoorState() == kDMDoorStateClosed) { if (ticks) { TimelineEvent newEvent; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime + ticks); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, _vm->_gameTime + ticks); newEvent._type = k2_TMEventTypeDoorDestruction; newEvent._priority = 0; newEvent._Bu._location._mapX = mapX; @@ -595,7 +595,7 @@ void GroupMan::processEvents29to41(int16 eventMapX, int16 eventMapY, int16 event CreatureInfo creatureInfo = _vm->_dungeonMan->_creatureInfos[curGroup->_type]; /* Update the event */ TimelineEvent nextEvent; - _vm->setMapAndTime(nextEvent._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime); + nextEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, _vm->_gameTime); nextEvent._priority = kDMMovementTicksImmobile - creatureInfo._movementTicks; /* The fastest creatures (with small MovementTicks value) get higher event priority */ nextEvent._Bu._location._mapX = eventMapX; nextEvent._Bu._location._mapY = eventMapY; @@ -1296,7 +1296,7 @@ int32 GroupMan::getCreatureAspectUpdateTime(ActiveGroup *activeGroup, int16 crea if (_vm->getRandomNumber(2)) { toggleFlag(aspect, kDMAspectMaskActiveGroupFlipBitmap); uint16 soundIndex = _vm->_moveSens->getSound(kDMCreatureTypeCouatl); - if (soundIndex <= k34_D13_soundCount) + if (soundIndex <= kDMSoundCount) _vm->_sound->requestPlay(soundIndex, _currentGroupMapX, _currentGroupMapY, kDMSoundModePlayIfPrioritized); } } else if (_vm->getRandomNumber(2)) @@ -1649,7 +1649,7 @@ void GroupMan::startWandering(int16 mapX, int16 mapY) { L0332_ps_Group->setBehaviour(kDMBehaviorWander); } TimelineEvent nextEvent; - _vm->setMapAndTime(nextEvent._mapTime, _vm->_dungeonMan->_currMapIndex, (_vm->_gameTime + 1)); + nextEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, (_vm->_gameTime + 1)); nextEvent._type = k37_TMEventTypeUpdateBehaviourGroup; nextEvent._priority = kDMMovementTicksImmobile - _vm->_dungeonMan->_creatureInfos[L0332_ps_Group->_type]._movementTicks; /* The fastest creatures (with small MovementTicks value) get higher event priority */ nextEvent._Cu._ticks = 0; @@ -1894,7 +1894,7 @@ void GroupMan::fluxCageAction(int16 mapX, int16 mapY) { _vm->_dungeonMan->linkThingToList(unusedThing, Thing(0), mapX, mapY); (((Explosion *)_vm->_dungeonMan->_thingData[kDMThingTypeExplosion])[unusedThing.getIndex()]).setType(kDMExplosionTypeFluxcage); TimelineEvent newEvent; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime + 100); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, _vm->_gameTime + 100); newEvent._type = k24_TMEventTypeRemoveFluxcage; newEvent._priority = 0; newEvent._Cu._slot = unusedThing.toUint16(); diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index 633237945d..cceae3b3d3 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -958,7 +958,7 @@ void InventoryMan::clickOnMouth() { curChampion->_shieldDefense += adjustedPotionPower; TimelineEvent newEvent; newEvent._type = k72_TMEventTypeChampionShield; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + (adjustedPotionPower * adjustedPotionPower)); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + (adjustedPotionPower * adjustedPotionPower)); newEvent._priority = championIndex; newEvent._Bu._defense = adjustedPotionPower; _vm->_timeline->addEventGetEventIndex(&newEvent); diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index 0b9368b483..c32e5495f9 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -610,7 +610,7 @@ int16 MenuMan::getChampionSpellCastResult(uint16 champIndex) { _vm->_championMan->_party._event73Count_ThievesEye++; spellPower = (spellPower >> 1); uint16 spellTicks = spellPower * spellPower; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + spellTicks); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + spellTicks); _vm->_timeline->addEventGetEventIndex(&newEvent); } break; @@ -618,7 +618,7 @@ int16 MenuMan::getChampionSpellCastResult(uint16 champIndex) { newEvent._type = k71_TMEventTypeInvisibility; _vm->_championMan->_party._event71Count_Invisibility++; uint16 spellTicks = spellPower; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + spellTicks); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + spellTicks); _vm->_timeline->addEventGetEventIndex(&newEvent); } break; @@ -631,7 +631,7 @@ int16 MenuMan::getChampionSpellCastResult(uint16 champIndex) { _vm->_championMan->_party._shieldDefense += newEvent._Bu._defense; _vm->_timeline->refreshAllChampionStatusBoxes(); uint16 spellTicks = spellPower * spellPower; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + spellTicks); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + spellTicks); _vm->_timeline->addEventGetEventIndex(&newEvent); } break; @@ -645,7 +645,7 @@ int16 MenuMan::getChampionSpellCastResult(uint16 champIndex) { _vm->_championMan->_party._lastScentIndex = 0; uint16 spellTicks = spellPower * spellPower; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + spellTicks); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + spellTicks); _vm->_timeline->addEventGetEventIndex(&newEvent); } break; @@ -815,7 +815,7 @@ void MenuMan::createEvent70_light(int16 lightPower, int16 ticks) { TimelineEvent newEvent; newEvent._type = k70_TMEventTypeLight; newEvent._Bu._lightPower = lightPower; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + ticks); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + ticks); newEvent._priority = 0; _vm->_timeline->addEventGetEventIndex(&newEvent); _vm->_inventoryMan->setDungeonViewPalette(); @@ -850,7 +850,7 @@ bool MenuMan::isPartySpellOrFireShieldSuccessful(Champion *champ, bool spellShie _vm->_championMan->_party._fireShieldDefense += newEvent._Bu._defense; } newEvent._priority = 0; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + ticks); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + ticks); _vm->_timeline->addEventGetEventIndex(&newEvent); _vm->_timeline->refreshAllChampionStatusBoxes(); @@ -1275,7 +1275,7 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) { TimelineEvent newEvent; newEvent._priority = 0; newEvent._type = k73_TMEventTypeThievesEye; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + windowTicks); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + windowTicks); _vm->_timeline->addEventGetEventIndex(&newEvent); _vm->_championMan->_party._event73Count_ThievesEye++; decrementCharges(curChampion); diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp index 1034f271fa..0fcae4ba9d 100644 --- a/engines/dm/movesens.cpp +++ b/engines/dm/movesens.cpp @@ -444,7 +444,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM } Group *tmpGroup = (Group *)_vm->_dungeonMan->_thingData[kDMThingTypeGroup]; uint16 movementSoundIndex = getSound((CreatureType)tmpGroup[thing.getIndex()]._type); - if (movementSoundIndex < k34_D13_soundCount) + if (movementSoundIndex < kDMSoundCount) _vm->_sound->requestPlay(movementSoundIndex, destMapX, destMapY, kDMSoundModePlayIfPrioritized); if (groupOnPartyMap && (mapIndexDestination != _vm->_dungeonMan->_partyMapIndex)) { /* If the group leaves the party map */ @@ -585,7 +585,7 @@ T0266017_CheckProjectileImpacts: void MovesensMan::addEvent(byte type, byte mapX, byte mapY, Cell cell, SensorEffect effect, int32 time) { TimelineEvent newEvent; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_currMapIndex, time); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, time); newEvent._type = type; newEvent._priority = 0; newEvent._Bu._location._mapX = mapX; @@ -983,7 +983,7 @@ void MovesensMan::processRotationEffect() { void MovesensMan::createEventMoveGroup(Thing groupThing, int16 mapX, int16 mapY, int16 mapIndex, bool audible) { TimelineEvent newEvent; - _vm->setMapAndTime(newEvent._mapTime, mapIndex, _vm->_gameTime + 5); + newEvent._mapTime = _vm->setMapAndTime(mapIndex, _vm->_gameTime + 5); newEvent._type = audible ? k61_TMEventTypeMoveGroupAudible : k60_TMEventTypeMoveGroupSilent; newEvent._priority = 0; newEvent._Bu._location._mapX = mapX; diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 81751a0bfc..b686220007 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -57,7 +57,7 @@ void ProjExpl::createProjectile(Thing thing, int16 mapX, int16 mapY, uint16 cell projectilePtr->_attack = attack; _vm->_dungeonMan->linkThingToList(projectileThing, Thing(0), mapX, mapY); /* Projectiles are added on the square and not 'moved' onto the square. In the case of a projectile launcher sensor, this means that the new projectile traverses the square in front of the launcher without any trouble: there is no impact if it is a wall, the projectile direction is not changed if it is a teleporter. Impacts with creatures and champions are still processed */ TimelineEvent newEvent; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime + 1); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, _vm->_gameTime + 1); if (_createLauncherProjectile) newEvent._type = k49_TMEventTypeMoveProjectile; /* Launcher projectiles can impact immediately */ else @@ -311,7 +311,7 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, _vm->_dungeonMan->linkThingToList(unusedThing, Thing(0), projectileMapX, projectileMapY); TimelineEvent newEvent; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime + ((explThing == Thing::_explRebirthStep1) ? 5 : 1)); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, _vm->_gameTime + ((explThing == Thing::_explRebirthStep1) ? 5 : 1)); newEvent._type = k25_TMEventTypeExplosion; newEvent._priority = 0; newEvent._Cu._slot = unusedThing.toUint16(); @@ -453,7 +453,7 @@ void ProjExpl::processEvents48To49(TimelineEvent *event) { curEvent->_Cu._projectile.setMapY(_vm->_moveSens->_moveResultMapY); curEvent->_Cu._projectile.setDir((Direction)_vm->_moveSens->_moveResultDir); projectileThingNewCell = _vm->thingWithNewCell(projectileThingNewCell, _vm->_moveSens->_moveResultCell); - M31_setMap(curEvent->_mapTime, _vm->_moveSens->_moveResultMapIndex); + _vm->setMap(curEvent->_mapTime, _vm->_moveSens->_moveResultMapIndex); } else { if ((Square(_vm->_dungeonMan->getSquare(destinationMapX, destinationMapY)).getType() == kDMElementTypeDoor) && hasProjectileImpactOccurred(kDMElementTypeDoor, destinationMapX, destinationMapY, projectileNewCell, projectileThing)) return; diff --git a/engines/dm/projexpl.h b/engines/dm/projexpl.h index 9ed636aff5..ad39609a16 100644 --- a/engines/dm/projexpl.h +++ b/engines/dm/projexpl.h @@ -37,45 +37,6 @@ enum KillOutcome { kDMKillOutcomeAllCreaturesInGroup = 2 // @ C2_OUTCOME_KILLED_ALL_CREATURES_IN_GROUP }; -enum SoundIndex { - kDMSoundIndexMetallicThud = 0, // @ C00_SOUND_METALLIC_THUD - kDMSoundIndexSwitch = 1, // @ C01_SOUND_SWITCH - kDMSoundIndexDoorRattle = 2, // @ C02_SOUND_DOOR_RATTLE - kDMSoundIndexAttackPainRatHellHoundRedDragon = 3, // @ C03_SOUND_ATTACK_PAIN_RAT_HELLHOUND_RED_DRAGON - kDMSoundIndexWoodenThudAttackTrolinAntmanStoneGolem = 4, // @ C04_SOUND_WOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM - kDMSoundIndexStrongExplosion = 5, // @ C05_SOUND_STRONG_EXPLOSION - kDMSoundIndexScream = 6, // @ C06_SOUND_SCREAM - kDMSoundIndexAttackMummyGhostRive = 7, // @ C07_SOUND_ATTACK_MUMMY_GHOST_RIVE - kDMSoundIndexSwallow = 8, // @ C08_SOUND_SWALLOW - kDMSoundIndexChampion0Damaged = 9, // @ C09_SOUND_CHAMPION_0_DAMAGED - kDMSoundIndexChampion1Damaged = 10, // @ C10_SOUND_CHAMPION_1_DAMAGED - kDMSoundIndexChampion2Damaged = 11, // @ C11_SOUND_CHAMPION_2_DAMAGED - kDMSoundIndexChampion3Damaged = 12, // @ C12_SOUND_CHAMPION_3_DAMAGED - kDMSoundIndexSpell = 13, // @ C13_SOUND_SPELL - kDMSoundIndexAttackScreamerOitu = 14, // @ C14_SOUND_ATTACK_SCREAMER_OITU - kDMSoundIndexAttackGiantScorpion = 15, // @ C15_SOUND_ATTACK_GIANT_SCORPION_SCORPION - kDMSoundIndexAttackSkelettonAnimatedArmorDethKnight = 16, // @ C16_SOUND_COMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT - kDMSoundIndexBuzz = 17, // @ C17_SOUND_BUZZ - kDMSoundIndexPartyDamaged = 18, // @ C18_SOUND_PARTY_DAMAGED - kDMSoundIndexAttackMagentaWorm = 19, // @ C19_SOUND_ATTACK_MAGENTA_WORM_WORM - kDMSoundIndexWeakExplosion = 20, // @ C20_SOUND_WEAK_EXPLOSION - kDMSoundIndexAttackGiggler = 21, // @ C21_SOUND_ATTACK_GIGGLER - kDMSoundIndexMoveAnimatedArmorDethKnight = 22, // @ C22_SOUND_MOVE_ANIMATED_ARMOUR_DETH_KNIGHT - kDMSoundIndexMoveCouatlGiantWaspMuncher = 23, // @ C23_SOUND_MOVE_COUATL_GIANT_WASP_MUNCHER - kDMSoundIndexMoveMummyTrolinAntmanStoneGolemGiggleVexirkDemon = 24, // @ C24_SOUND_MOVE_MUMMY_TROLIN_ANTMAN_STONE_GOLEM_GIGGLER_VEXIRK_DEMON - kDMSoundIndexBlowHorn = 25, // @ C25_SOUND_BLOW_HORN - kDMSoundIndexMoveScreamerRocksWormPainRatHellHoundRusterScorpionsOitu = 26, // @ C26_SOUND_MOVE_SCREAMER_ROCK_ROCKPILE_MAGENTA_WORM_WORM_PAIN_RAT_HELLHOUND_RUSTER_GIANT_SCORPION_SCORPION_OITU - kDMSoundIndexMoveSlimesDevilWaterElemental = 27, // @ C27_SOUND_MOVE_SWAMP_SLIME_SLIME_DEVIL_WATER_ELEMENTAL - kDMSoundIndexWarCry = 28, // @ C28_SOUND_WAR_CRY - kDMSoundIndexAttackRocks = 29, // @ C29_SOUND_ATTACK_ROCK_ROCKPILE - kDMSoundIndexAttackWaterElemental = 30, // @ C30_SOUND_ATTACK_WATER_ELEMENTAL - kDMSoundIndexAttackCouatl = 31, // @ C31_SOUND_ATTACK_COUATL - kDMSoundIndexMoveRedDragon = 32, // @ C32_SOUND_MOVE_RED_DRAGON - kDMSoundIndexMoveSkeletton = 33 // @ C33_SOUND_MOVE_SKELETON -}; - -#define M31_setMap(map_time, map) ((map_time) = (((map_time) & 0x00FFFFFF) | (((int32)(map)) << 24))) - class TimelineEvent; class Projectile; diff --git a/engines/dm/sounds.cpp b/engines/dm/sounds.cpp index 0c14cda19e..ab58b942e1 100644 --- a/engines/dm/sounds.cpp +++ b/engines/dm/sounds.cpp @@ -52,7 +52,7 @@ SoundMan *SoundMan::getSoundMan(DMEngine *vm, const DMADGameDescription *gameVer } void SoundMan::initConstants() { - Sound sounds[k34_D13_soundCount] = { + Sound sounds[kDMSoundCount] = { Sound(533, 112, 11, 3, 6), /* k00_soundMETALLIC_THUD 0 */ Sound(534, 112, 15, 0, 3), /* k01_soundSWITCH 1 */ Sound(535, 112, 72, 3, 6), /* k02_soundDOOR_RATTLE 2 */ @@ -88,7 +88,7 @@ void SoundMan::initConstants() { Sound(573, 138, 29, 0, 4), /* k32_soundMOVE_RED_DRAGON 32 Atari ST: not present */ Sound(574, 150, 22, 0, 4) /* k33_soundMOVE_SKELETON 33 Atari ST: not present */ }; - for (int i = 0; i < k34_D13_soundCount; i++) + for (int i = 0; i < kDMSoundCount; i++) _sounds[i] = sounds[i]; } @@ -97,12 +97,12 @@ SoundMan::SoundMan(DMEngine *vm) : _vm(vm) { } SoundMan::~SoundMan() { - for (uint16 i = 0; i < k34_D13_soundCount; ++i) + for (uint16 i = 0; i < kDMSoundCount; ++i) delete[] _soundData[i]._firstSample; } void SoundMan::loadSounds() { - for (uint16 soundIndex = 0; soundIndex < k34_D13_soundCount; ++soundIndex) { + for (uint16 soundIndex = 0; soundIndex < kDMSoundCount; ++soundIndex) { SoundData *soundData = _soundData + soundIndex; uint16 graphicIndex = _sounds[soundIndex]._graphicIndex; @@ -203,7 +203,7 @@ void SoundMan::requestPlay(uint16 soundIndex, int16 mapX, int16 mapY, SoundMode Sound *sound = &_sounds[soundIndex]; 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 + soundMode - 1); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, _vm->_gameTime + soundMode - 1); newEvent._type = k20_TMEventTypePlaySound; newEvent._priority = sound->_priority; newEvent._Cu._soundIndex = soundIndex; diff --git a/engines/dm/sounds.h b/engines/dm/sounds.h index fe0c0f446f..04c51719d4 100644 --- a/engines/dm/sounds.h +++ b/engines/dm/sounds.h @@ -39,7 +39,44 @@ enum SoundMode { kDMSoundModePlayOneTickLater = 2 // @ C02_MODE_PLAY_ONE_TICK_LATER }; -#define k34_D13_soundCount 34 // @ D13_SOUND_COUNT +enum SoundIndex { + kDMSoundIndexMetallicThud = 0, // @ C00_SOUND_METALLIC_THUD + kDMSoundIndexSwitch = 1, // @ C01_SOUND_SWITCH + kDMSoundIndexDoorRattle = 2, // @ C02_SOUND_DOOR_RATTLE + kDMSoundIndexAttackPainRatHellHoundRedDragon = 3, // @ C03_SOUND_ATTACK_PAIN_RAT_HELLHOUND_RED_DRAGON + kDMSoundIndexWoodenThudAttackTrolinAntmanStoneGolem = 4, // @ C04_SOUND_WOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM + kDMSoundIndexStrongExplosion = 5, // @ C05_SOUND_STRONG_EXPLOSION + kDMSoundIndexScream = 6, // @ C06_SOUND_SCREAM + kDMSoundIndexAttackMummyGhostRive = 7, // @ C07_SOUND_ATTACK_MUMMY_GHOST_RIVE + kDMSoundIndexSwallow = 8, // @ C08_SOUND_SWALLOW + kDMSoundIndexChampion0Damaged = 9, // @ C09_SOUND_CHAMPION_0_DAMAGED + kDMSoundIndexChampion1Damaged = 10, // @ C10_SOUND_CHAMPION_1_DAMAGED + kDMSoundIndexChampion2Damaged = 11, // @ C11_SOUND_CHAMPION_2_DAMAGED + kDMSoundIndexChampion3Damaged = 12, // @ C12_SOUND_CHAMPION_3_DAMAGED + kDMSoundIndexSpell = 13, // @ C13_SOUND_SPELL + kDMSoundIndexAttackScreamerOitu = 14, // @ C14_SOUND_ATTACK_SCREAMER_OITU + kDMSoundIndexAttackGiantScorpion = 15, // @ C15_SOUND_ATTACK_GIANT_SCORPION_SCORPION + kDMSoundIndexAttackSkelettonAnimatedArmorDethKnight = 16, // @ C16_SOUND_COMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT + kDMSoundIndexBuzz = 17, // @ C17_SOUND_BUZZ + kDMSoundIndexPartyDamaged = 18, // @ C18_SOUND_PARTY_DAMAGED + kDMSoundIndexAttackMagentaWorm = 19, // @ C19_SOUND_ATTACK_MAGENTA_WORM_WORM + kDMSoundIndexWeakExplosion = 20, // @ C20_SOUND_WEAK_EXPLOSION + kDMSoundIndexAttackGiggler = 21, // @ C21_SOUND_ATTACK_GIGGLER + kDMSoundIndexMoveAnimatedArmorDethKnight = 22, // @ C22_SOUND_MOVE_ANIMATED_ARMOUR_DETH_KNIGHT + kDMSoundIndexMoveCouatlGiantWaspMuncher = 23, // @ C23_SOUND_MOVE_COUATL_GIANT_WASP_MUNCHER + kDMSoundIndexMoveMummyTrolinAntmanStoneGolemGiggleVexirkDemon = 24, // @ C24_SOUND_MOVE_MUMMY_TROLIN_ANTMAN_STONE_GOLEM_GIGGLER_VEXIRK_DEMON + kDMSoundIndexBlowHorn = 25, // @ C25_SOUND_BLOW_HORN + kDMSoundIndexMoveScreamerRocksWormPainRatHellHoundRusterScorpionsOitu = 26, // @ C26_SOUND_MOVE_SCREAMER_ROCK_ROCKPILE_MAGENTA_WORM_WORM_PAIN_RAT_HELLHOUND_RUSTER_GIANT_SCORPION_SCORPION_OITU + kDMSoundIndexMoveSlimesDevilWaterElemental = 27, // @ C27_SOUND_MOVE_SWAMP_SLIME_SLIME_DEVIL_WATER_ELEMENTAL + kDMSoundIndexWarCry = 28, // @ C28_SOUND_WAR_CRY + kDMSoundIndexAttackRocks = 29, // @ C29_SOUND_ATTACK_ROCK_ROCKPILE + kDMSoundIndexAttackWaterElemental = 30, // @ C30_SOUND_ATTACK_WATER_ELEMENTAL + kDMSoundIndexAttackCouatl = 31, // @ C31_SOUND_ATTACK_COUATL + kDMSoundIndexMoveRedDragon = 32, // @ C32_SOUND_MOVE_RED_DRAGON + kDMSoundIndexMoveSkeletton = 33 // @ C33_SOUND_MOVE_SKELETON +}; + +#define kDMSoundCount 34 // @ D13_SOUND_COUNT class SoundData { public: @@ -80,7 +117,7 @@ public: static SoundMan *getSoundMan(DMEngine *vm, const DMADGameDescription *gameVersion); - SoundData _soundData[k34_D13_soundCount]; // @ K0024_as_SoundData + SoundData _soundData[kDMSoundCount]; // @ K0024_as_SoundData Common::Queue _pendingSounds; virtual void loadSounds(); // @ F0503_SOUND_LoadAll @@ -89,7 +126,7 @@ public: void playPendingSound(); // @ F0065_SOUND_PlayPendingSound_CPSD bool soundGetVolume(int16 mapX, int16 mapY, uint8 *leftVolume, uint8 *rightVolume); // @ F0505_SOUND_GetVolume - Sound _sounds[k34_D13_soundCount]; + Sound _sounds[kDMSoundCount]; void initConstants(); }; diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp index aed99ac923..49f82892de 100644 --- a/engines/dm/timeline.cpp +++ b/engines/dm/timeline.cpp @@ -541,7 +541,7 @@ void Timeline::moveTeleporterOrPitSquareThings(uint16 mapX, uint16 mapY) { newEvent->_Cu._projectile.setMapY(_vm->_moveSens->_moveResultMapY); newEvent->_Cu._projectile.setDir((Direction)_vm->_moveSens->_moveResultDir); newEvent->_Bu._slot = _vm->thingWithNewCell(curThing, _vm->_moveSens->_moveResultCell).toUint16(); - M31_setMap(newEvent->_mapTime, _vm->_moveSens->_moveResultMapIndex); + _vm->setMap(newEvent->_mapTime, _vm->_moveSens->_moveResultMapIndex); } else if (curThingType == kDMThingTypeExplosion) { TimelineEvent *newEvent = _events; for (uint16 i = 0; i < _eventMaxCount; newEvent++, i++) { @@ -549,7 +549,7 @@ void Timeline::moveTeleporterOrPitSquareThings(uint16 mapX, uint16 mapY) { newEvent->_Bu._location._mapX = _vm->_moveSens->_moveResultMapX; newEvent->_Bu._location._mapY = _vm->_moveSens->_moveResultMapY; newEvent->_Cu._slot = _vm->thingWithNewCell(curThing, _vm->_moveSens->_moveResultCell).toUint16(); - M31_setMap(newEvent->_mapTime, _vm->_moveSens->_moveResultMapIndex); + _vm->setMap(newEvent->_mapTime, _vm->_moveSens->_moveResultMapIndex); } } } @@ -749,7 +749,7 @@ void Timeline::processEventSquareCorridor(TimelineEvent *event) { TimelineEvent newEvent; newEvent._type = k65_TMEventTypeEnableGroupGenerator; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime + actionTicks); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, _vm->_gameTime + actionTicks); newEvent._priority = 0; newEvent._Bu._location._mapX = mapX; newEvent._Bu._location._mapY = mapY; @@ -900,7 +900,7 @@ void Timeline::processEventLight(TimelineEvent *event) { TimelineEvent newEvent; newEvent._type = k70_TMEventTypeLight; newEvent._Bu._lightPower = weakerLightPower; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + 4); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + 4); newEvent._priority = 0; addEventGetEventIndex(&newEvent); } -- cgit v1.2.3