DM: Rename TimelineEventType members

This commit is contained in:
Strangerke 2016-09-20 21:51:42 +02:00
parent 4b93ebedf1
commit dd9e43925f
10 changed files with 168 additions and 168 deletions

View File

@ -925,7 +925,7 @@ void ChampionMan::disableAction(uint16 champIndex, uint16 ticks) {
int32 updatedEnableActionEventTime = _vm->_gameTime + ticks;
TimelineEvent curEvent;
curEvent._type = k11_TMEventTypeEnableChampionAction;
curEvent._type = kDMEventTypeEnableChampionAction;
curEvent._priority = champIndex;
curEvent._Bu._slotOrdinal = 0;
@ -1115,7 +1115,7 @@ void ChampionMan::championPoison(int16 champIndex, uint16 attack) {
if (--attack) {
curChampion->_poisonEventCount++;
TimelineEvent newEvent;
newEvent._type = k75_TMEventTypePoisonChampion;
newEvent._type = kDMEventTypePoisonChampion;
newEvent._priority = champIndex;
newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + 36);
newEvent._Bu._attack = attack;
@ -1431,7 +1431,7 @@ void ChampionMan::applyAndDrawPendingDamageAndWounds() {
int16 eventIndex = championPtr->_hideDamageReceivedIndex;
if (eventIndex == -1) {
TimelineEvent newEvent;
newEvent._type = k12_TMEventTypeHideDamageReceived;
newEvent._type = kDMEventTypeHideDamageReceived;
newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + 5);
newEvent._priority = championIndex;
championPtr->_hideDamageReceivedIndex = _vm->_timeline->addEventGetEventIndex(&newEvent);
@ -1563,7 +1563,7 @@ void ChampionMan::unpoison(int16 champIndex) {
TimelineEvent *eventPtr = _vm->_timeline->_events;
for (uint16 eventIndex = 0; eventIndex < _vm->_timeline->_eventMaxCount; eventPtr++, eventIndex++) {
if ((eventPtr->_type == k75_TMEventTypePoisonChampion) && (eventPtr->_priority == champIndex))
if ((eventPtr->_type == kDMEventTypePoisonChampion) && (eventPtr->_priority == champIndex))
_vm->_timeline->deleteEvent(eventIndex);
}
_champions[champIndex]._poisonEventCount = 0;

View File

@ -1032,7 +1032,7 @@ void EventManager::commandMoveParty(CommandType cmdType) {
} else {
isMovementBlocked = (_vm->_groupMan->groupGetThing(partyMapX, partyMapY) != Thing::_endOfList);
if (isMovementBlocked)
_vm->_groupMan->processEvents29to41(partyMapX, partyMapY, kM1_TMEventTypeCreateReactionEvent31ParyIsAdjacent, 0);
_vm->_groupMan->processEvents29to41(partyMapX, partyMapY, kDMEventTypeCreateReactionPartyIsAdjacent, 0);
}
}
@ -1175,7 +1175,7 @@ void EventManager::commandProcessType80ClickInDungeonView(int16 posX, int16 posY
if ((((Door*)junkPtr)->hasButton()) && _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn].isPointInside(posX, posY - 33)) {
_vm->_stopWaitingForPlayerInput = true;
_vm->_sound->requestPlay(kDMSoundIndexSwitch, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMSoundModePlayIfPrioritized);
_vm->_moveSens->addEvent(k10_TMEventTypeDoor, mapX, mapY, kDMCellNorthWest, kDMSensorEffectToggle, _vm->_gameTime + 1);
_vm->_moveSens->addEvent(kDMEventTypeDoor, mapX, mapY, kDMCellNorthWest, kDMSensorEffectToggle, _vm->_gameTime + 1);
return;
}
} else if (isLeaderHandObjThrown(posX, posY))
@ -1398,7 +1398,7 @@ void EventManager::clickInDungeonViewDropLeaderHandObject(uint16 viewCell) {
Junk *removedJunk = (Junk*)_vm->_dungeonMan->getThingData(removedThing);
TimelineEvent newEvent;
newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + 1);
newEvent._type = k13_TMEventTypeViAltarRebirth;
newEvent._type = kDMEventTypeViAltarRebirth;
newEvent._priority = removedJunk->getChargeCount();
newEvent._Bu._location._mapX = mapX;
newEvent._Bu._location._mapY = mapY;

View File

@ -364,7 +364,7 @@ bool GroupMan::groupIsDoorDestoryedByAttack(uint16 mapX, uint16 mapY, int16 atta
if (ticks) {
TimelineEvent newEvent;
newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, _vm->_gameTime + ticks);
newEvent._type = k2_TMEventTypeDoorDestruction;
newEvent._type = kDMEventTypeDoorDestruction;
newEvent._priority = 0;
newEvent._Bu._location._mapX = mapX;
newEvent._Bu._location._mapY = mapY;
@ -424,13 +424,13 @@ int16 GroupMan::groupGetDamageCreatureOutcome(Group *group, uint16 creatureIndex
if ((_vm->getMap(curEvent->_mapTime) == _vm->_dungeonMan->_currMapIndex) &&
(curEvent->_Bu._location._mapX == mapX) &&
(curEvent->_Bu._location._mapY == mapY) &&
(curEventType > k32_TMEventTypeUpdateAspectGroup) &&
(curEventType < k41_TMEventTypeUpdateBehaviour_3 + 1)) {
(curEventType > kDMEventTypeUpdateAspectGroup) &&
(curEventType < kDMEventTypeUpdateBehavior3 + 1)) {
uint16 nextCreatureIndex;
if (curEventType < k37_TMEventTypeUpdateBehaviourGroup)
nextCreatureIndex = curEventType - k33_TMEventTypeUpdateAspectCreature_0; /* Get creature index for events 33 to 36 */
if (curEventType < kDMEventTypeUpdateBehaviourGroup)
nextCreatureIndex = curEventType - kDMEventTypeUpdateAspectCreature0; /* Get creature index for events 33 to 36 */
else
nextCreatureIndex = curEventType - k38_TMEventTypeUpdateBehaviour_0; /* Get creature index for events 38 to 41 */
nextCreatureIndex = curEventType - kDMEventTypeUpdateBehavior0; /* Get creature index for events 38 to 41 */
if (nextCreatureIndex == creatureIndex)
_vm->_timeline->deleteEvent(eventIndex);
@ -508,7 +508,7 @@ void GroupMan::groupDeleteEvents(int16 mapX, int16 mapY) {
for (int16 eventIndex = 0; eventIndex < _vm->_timeline->_eventMaxCount; eventIndex++) {
uint16 curEventType = curEvent->_type;
if ((_vm->getMap(curEvent->_mapTime) == _vm->_dungeonMan->_currMapIndex) &&
(curEventType > k29_TMEventTypeGroupReactionDangerOnSquare - 1) && (curEventType < k41_TMEventTypeUpdateBehaviour_3 + 1) &&
(curEventType > kDMEventTypeGroupReactionDangerOnSquare - 1) && (curEventType < kDMEventTypeUpdateBehavior3 + 1) &&
(curEvent->_Bu._location._mapX == mapX) && (curEvent->_Bu._location._mapY == mapY)) {
_vm->_timeline->deleteEvent(eventIndex);
}
@ -582,8 +582,8 @@ void GroupMan::processEvents29to41(int16 eventMapX, int16 eventMapY, int16 event
/* If the party is not on the map specified in the event and the event type is not one of 32, 33, 37, 38 then the event is ignored */
if ((_vm->_dungeonMan->_currMapIndex != _vm->_dungeonMan->_partyMapIndex)
&& (eventType != k37_TMEventTypeUpdateBehaviourGroup) && (eventType != k32_TMEventTypeUpdateAspectGroup)
&& (eventType != k38_TMEventTypeUpdateBehaviour_0) && (eventType != k33_TMEventTypeUpdateAspectCreature_0))
&& (eventType != kDMEventTypeUpdateBehaviourGroup) && (eventType != kDMEventTypeUpdateAspectGroup)
&& (eventType != kDMEventTypeUpdateBehavior0) && (eventType != kDMEventTypeUpdateAspectCreature0))
return;
Thing groupThing = groupGetThing(eventMapX, eventMapY);
@ -611,7 +611,7 @@ void GroupMan::processEvents29to41(int16 eventMapX, int16 eventMapY, int16 event
nextEvent._Bu._location._mapX = _vm->_moveSens->_moveResultMapX;
nextEvent._Bu._location._mapY = _vm->_moveSens->_moveResultMapY;
}
nextEvent._type = k37_TMEventTypeUpdateBehaviourGroup;
nextEvent._type = kDMEventTypeUpdateBehaviourGroup;
AL0446_i_Ticks = MAX(ABS(_vm->_dungeonMan->_currMapIndex - _vm->_dungeonMan->_partyMapIndex) << 4, creatureInfo._movementTicks << 1);
/* BUG0_68 A group moves or acts with a wrong timing. Event is added below but L0465_s_NextEvent.C.Ticks has not been initialized. No consequence while the group is not on the party map. When the party enters the group map the first group event may have a wrong timing */
T0209005_AddEventAndReturn:
@ -651,8 +651,8 @@ T0209005_AddEventAndReturn:
For event kM1_TMEventTypeCreateReactionEvent31ParyIsAdjacent, the reaction time is 1 tick
For event kM2_TMEventTypeCreateReactionEvent30HitByProjectile and kM3_TMEventTypeCreateReactionEvent29DangerOnSquare, the reaction time may be 1 tick or slower: slow moving creatures react more slowly. The more recent is the last creature move, the slower the reaction */
if (eventType < 0) {
nextEvent._type = eventType + k32_TMEventTypeUpdateAspectGroup;
if (eventType == kM1_TMEventTypeCreateReactionEvent31ParyIsAdjacent) {
nextEvent._type = eventType + kDMEventTypeUpdateAspectGroup;
if (eventType == kDMEventTypeCreateReactionPartyIsAdjacent) {
AL0446_i_Ticks = 1; /* Retry in 1 tick */
} else {
AL0446_i_Ticks = ((movementTicks + 2) >> 2) - ticksSinceLastMove;
@ -680,9 +680,9 @@ T0209005_AddEventAndReturn:
bool moveToPriorLocation = false;
int16 distanceToVisibleParty = 0;
if (eventType <= k31_TMEventTypeGroupReactionPartyIsAdjecent) { /* Process Reaction events 29 to 31 */
switch (eventType = eventType - k32_TMEventTypeUpdateAspectGroup) {
case kM1_TMEventTypeCreateReactionEvent31ParyIsAdjacent: /* This event is used when the party bumps into a group or attacks a group physically (not with a spell). It causes the creature behavior to change to attack if it is not already attacking the party or fleeing from target */
if (eventType <= kDMEventTypeGroupReactionPartyIsAdjecent) { /* Process Reaction events 29 to 31 */
switch (eventType = eventType - kDMEventTypeUpdateAspectGroup) {
case kDMEventTypeCreateReactionPartyIsAdjacent: /* This event is used when the party bumps into a group or attacks a group physically (not with a spell). It causes the creature behavior to change to attack if it is not already attacking the party or fleeing from target */
if ((AL0447_i_Behavior != kDMBehaviorAttack) && (AL0447_i_Behavior != kDMBehaviorFlee)) {
groupDeleteEvents(eventMapX, eventMapY);
goto T0209044_SetBehavior6_Attack;
@ -690,7 +690,7 @@ T0209005_AddEventAndReturn:
activeGroup->_targetMapX = _vm->_dungeonMan->_partyMapX;
activeGroup->_targetMapY = _vm->_dungeonMan->_partyMapY;
return;
case kM2_TMEventTypeCreateReactionEvent30HitByProjectile: /* This event is used for the reaction of a group after a projectile impacted with one creature in the group (some creatures may have been killed) */
case kDMEventTypeCreateReactionHitByProjectile: /* This event is used for the reaction of a group after a projectile impacted with one creature in the group (some creatures may have been killed) */
if ((AL0447_i_Behavior == kDMBehaviorAttack) || (AL0447_i_Behavior == kDMBehaviorFlee)) /* If the creature is attacking the party or fleeing from the target then there is no reaction */
return;
AL0446_i_Behavior2Or3 = ((AL0447_i_Behavior == kDMBehaviorUnknown3) || (AL0447_i_Behavior == kDMBehaviorUnknown2));
@ -702,13 +702,13 @@ T0209005_AddEventAndReturn:
if (AL0446_i_Behavior2Or3 || (_vm->getRandomNumber(4))) /* BUG0_00 Useless code. Behavior cannot be 2 nor 3 because these values are never used. The actual condition is thus: if 3/4 chances then no reaction */
return;
} /* No 'break': proceed to instruction after the next 'case' below. Reaction is to move in a random direction to try and avoid other projectiles */
case kM3_TMEventTypeCreateReactionEvent29DangerOnSquare: /* This event is used when some creatures in the group were killed by a Poison Cloud or by a closing door or if Lord Chaos is surrounded by 3 Fluxcages. It causes the creature to move in a random direction to avoid the danger */
case kDMEventTypeCreateReactionDangerOnSquare: /* This event is used when some creatures in the group were killed by a Poison Cloud or by a closing door or if Lord Chaos is surrounded by 3 Fluxcages. It causes the creature to move in a random direction to avoid the danger */
approachAfterReaction = (AL0447_i_Behavior == kDMBehaviorAttack); /* If the creature behavior is 'Attack' and it has to move to avoid danger then it will change its behavior to 'Approach' after the movement */
newGroupDirectionFound = false;
goto T0209058_MoveInRandomDirection;
}
}
if (eventType < k37_TMEventTypeUpdateBehaviourGroup) { /* Process Update Aspect events 32 to 36 */
if (eventType < kDMEventTypeUpdateBehaviourGroup) { /* Process Update Aspect events 32 to 36 */
nextEvent._type = eventType + 5;
if (groupGetDistanceToVisibleParty(curGroup, kDMWholeCreatureGroup, eventMapX, eventMapY)) {
if ((AL0447_i_Behavior != kDMBehaviorAttack) && (AL0447_i_Behavior != kDMBehaviorFlee)) {
@ -721,7 +721,7 @@ T0209005_AddEventAndReturn:
activeGroup->_targetMapY = _vm->_dungeonMan->_partyMapY;
}
if (AL0447_i_Behavior == kDMBehaviorAttack) {
AL0446_i_CreatureAspectIndex = eventType - k33_TMEventTypeUpdateAspectCreature_0; /* Value -1 for event 32, meaning aspect will be updated for all creatures in the group */
AL0446_i_CreatureAspectIndex = eventType - kDMEventTypeUpdateAspectCreature0; /* Value -1 for event 32, meaning aspect will be updated for all creatures in the group */
nextAspectUpdateTime = getCreatureAspectUpdateTime(activeGroup, AL0446_i_CreatureAspectIndex, getFlag(activeGroup->_aspect[AL0446_i_CreatureAspectIndex], kDMAspectMaskActiveGroupIsAttacking));
goto T0209136;
}
@ -735,14 +735,14 @@ T0209005_AddEventAndReturn:
if (ticks)
nextAspectUpdateTime = _vm->_gameTime;
if (eventType == k37_TMEventTypeUpdateBehaviourGroup) { /* Process event 37, Update Group Behavior */
if (eventType == kDMEventTypeUpdateBehaviourGroup) { /* Process event 37, Update Group Behavior */
bool allowMovementOverFakePitsAndFakeWalls;
if ((AL0447_i_Behavior == kDMBehaviorWander) || (AL0447_i_Behavior == kDMBehaviorUnknown2) || (AL0447_i_Behavior == kDMBehaviorUnknown3)) { /* BUG0_00 Useless code. Behavior cannot be 2 nor 3 because these values are never used. The actual condition is: if (AL0447_i_Behavior == k0_behavior_WANDER) */
distanceToVisibleParty = groupGetDistanceToVisibleParty(curGroup, kDMWholeCreatureGroup, eventMapX, eventMapY);
if (distanceToVisibleParty) {
if ((distanceToVisibleParty <= (creatureInfo.getAttackRange())) && ((!AL0450_i_DistanceXToParty) || (!AL0451_i_DistanceYToParty))) { /* If the creature is in range for attack and on the same row or column as the party on the map */
T0209044_SetBehavior6_Attack:
if (eventType == kM2_TMEventTypeCreateReactionEvent30HitByProjectile) {
if (eventType == kDMEventTypeCreateReactionHitByProjectile) {
groupDeleteEvents(eventMapX, eventMapY);
}
activeGroup->_targetMapX = _vm->_dungeonMan->_partyMapX;
@ -760,7 +760,7 @@ T0209044_SetBehavior6_Attack:
if (notUpdateBehaviorFl) {
nextEvent._mapTime += MIN((uint16)((creatureInfo._attackTicks >> 1) + _vm->getRandomNumber(4)), ticks);
}
nextEvent._type = k38_TMEventTypeUpdateBehaviour_0 + AL0447_i_CreatureIndex;
nextEvent._type = kDMEventTypeUpdateBehavior0 + AL0447_i_CreatureIndex;
addGroupEvent(&nextEvent, getCreatureAspectUpdateTime(activeGroup, AL0447_i_CreatureIndex, false));
}
return;
@ -812,7 +812,7 @@ T0209061_MoveGroup:
break;
}
if (_groupMovementBlockedByParty) {
if ((eventType != kM3_TMEventTypeCreateReactionEvent29DangerOnSquare) &&
if ((eventType != kDMEventTypeCreateReactionDangerOnSquare) &&
((curGroup->getBehaviour() != kDMBehaviorFlee) ||
!getFirstPossibleMovementDirOrdinal(&creatureInfo, eventMapX, eventMapY, false) ||
_vm->getRandomNumber(2)))
@ -826,11 +826,11 @@ T0209061_MoveGroup:
if (!newGroupDirectionFound &&
(ticksSinceLastMove != -1) &&
isArchEnemy &&
((eventType == kM3_TMEventTypeCreateReactionEvent29DangerOnSquare) || !_vm->getRandomNumber(4))) { /* BUG0_15 The game hangs when you close a door on Lord Chaos. A condition is missing in the code to manage creatures and this may create an infinite loop between two parts in the code */
((eventType == kDMEventTypeCreateReactionDangerOnSquare) || !_vm->getRandomNumber(4))) { /* BUG0_15 The game hangs when you close a door on Lord Chaos. A condition is missing in the code to manage creatures and this may create an infinite loop between two parts in the code */
_vm->_projexpl->_secondaryDirToOrFromParty = _vm->turnDirRight(primaryDirectionToOrFromParty = _vm->getRandomNumber(4));
goto T0209089_DoubleSquareMove; /* BUG0_69 Memory corruption when you close a door on Lord Chaos. The local variable (L0454_i_PrimaryDirectionToOrFromParty) containing the direction where Lord Chaos tries to move may be used as an array index without being initialized and cause memory corruption */
}
if (newGroupDirectionFound || ((!_vm->getRandomNumber(4) || (distanceToVisibleParty <= creatureInfo.getSmellRange())) && (eventType != kM3_TMEventTypeCreateReactionEvent29DangerOnSquare))) {
if (newGroupDirectionFound || ((!_vm->getRandomNumber(4) || (distanceToVisibleParty <= creatureInfo.getSmellRange())) && (eventType != kDMEventTypeCreateReactionDangerOnSquare))) {
T0209073_SetDirectionGroup:
if (!newGroupDirectionFound && (ticksSinceLastMove >= 0)) { /* If direction is not found yet then look around in a random direction */
AL0446_i_Direction = _vm->getRandomNumber(4);
@ -838,7 +838,7 @@ T0209073_SetDirectionGroup:
setDirGroup(activeGroup, AL0446_i_Direction, creatureCount, creatureSize);
}
/* If event is kM3_TMEventTypeCreateReactionEvent29DangerOnSquare or kM2_TMEventTypeCreateReactionEvent30HitByProjectile */
if (eventType < kM1_TMEventTypeCreateReactionEvent31ParyIsAdjacent) {
if (eventType < kDMEventTypeCreateReactionPartyIsAdjacent) {
if (!newGroupDirectionFound)
return;
if (approachAfterReaction)
@ -944,7 +944,7 @@ T0209096_SetBehavior0_Wander:
goto T0209094_FleeFromTarget;
}
/* If the creature is attacking, then compute the next aspect update time and the next attack time */
if (getFlag(activeGroup->_aspect[AL0447_i_CreatureIndex = eventType - k38_TMEventTypeUpdateBehaviour_0], kDMAspectMaskActiveGroupIsAttacking)) {
if (getFlag(activeGroup->_aspect[AL0447_i_CreatureIndex = eventType - kDMEventTypeUpdateBehavior0], kDMAspectMaskActiveGroupIsAttacking)) {
nextAspectUpdateTime = getCreatureAspectUpdateTime(activeGroup, AL0447_i_CreatureIndex, false);
nextEvent._mapTime += ((AL0447_i_Ticks = creatureInfo._attackTicks) + _vm->getRandomNumber(4) - 1);
if (AL0447_i_Ticks > 15)
@ -1043,7 +1043,7 @@ T0209096_SetBehavior0_Wander:
}
nextEvent._mapTime += MAX(1, _vm->getRandomNumber(4) + movementTicks - 1);
T0209134_SetEvent37:
nextEvent._type = k37_TMEventTypeUpdateBehaviourGroup;
nextEvent._type = kDMEventTypeUpdateBehaviourGroup;
}
T0209135:
if (!nextAspectUpdateTime) {
@ -1650,7 +1650,7 @@ void GroupMan::startWandering(int16 mapX, int16 mapY) {
}
TimelineEvent nextEvent;
nextEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, (_vm->_gameTime + 1));
nextEvent._type = k37_TMEventTypeUpdateBehaviourGroup;
nextEvent._type = kDMEventTypeUpdateBehaviourGroup;
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;
nextEvent._Bu._location._mapX = mapX;
@ -1877,7 +1877,7 @@ T0231015:
T0231016:
_vm->_championMan->drawChampionState((ChampionIndex)champIndex);
if (L0569_i_Outcome != kDMKillOutcomeAllCreaturesInGroup) {
processEvents29to41(mapX, mapY, kM1_TMEventTypeCreateReactionEvent31ParyIsAdjacent, 0);
processEvents29to41(mapX, mapY, kDMEventTypeCreateReactionPartyIsAdjacent, 0);
}
return L0565_i_Damage;
}
@ -1895,7 +1895,7 @@ void GroupMan::fluxCageAction(int16 mapX, int16 mapY) {
(((Explosion *)_vm->_dungeonMan->_thingData[kDMThingTypeExplosion])[unusedThing.getIndex()]).setType(kDMExplosionTypeFluxcage);
TimelineEvent newEvent;
newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, _vm->_gameTime + 100);
newEvent._type = k24_TMEventTypeRemoveFluxcage;
newEvent._type = kDMEventTypeRemoveFluxcage;
newEvent._priority = 0;
newEvent._Cu._slot = unusedThing.toUint16();
newEvent._Bu._location._mapX = mapX;
@ -1923,7 +1923,7 @@ void GroupMan::fluxCageAction(int16 mapX, int16 mapY) {
fluxcageCount = 0;
if (fluxcageCount == 2)
processEvents29to41(mapX, mapY, kM3_TMEventTypeCreateReactionEvent29DangerOnSquare, 0);
processEvents29to41(mapX, mapY, kDMEventTypeCreateReactionDangerOnSquare, 0);
}
uint16 GroupMan::isLordChaosOnSquare(int16 mapX, int16 mapY) {

View File

@ -957,7 +957,7 @@ void InventoryMan::clickOnMouth() {
curChampion->_shieldDefense += adjustedPotionPower;
TimelineEvent newEvent;
newEvent._type = k72_TMEventTypeChampionShield;
newEvent._type = kDMEventTypeChampionShield;
newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + (adjustedPotionPower * adjustedPotionPower));
newEvent._priority = championIndex;
newEvent._Bu._defense = adjustedPotionPower;

View File

@ -606,7 +606,7 @@ int16 MenuMan::getChampionSpellCastResult(uint16 champIndex) {
}
break;
case kDMSpellTypeOtherThievesEye: {
newEvent._type = k73_TMEventTypeThievesEye;
newEvent._type = kDMEventTypeThievesEye;
_vm->_championMan->_party._event73Count_ThievesEye++;
spellPower = (spellPower >> 1);
uint16 spellTicks = spellPower * spellPower;
@ -615,7 +615,7 @@ int16 MenuMan::getChampionSpellCastResult(uint16 champIndex) {
}
break;
case kDMSpellTypeOtherInvisibility: {
newEvent._type = k71_TMEventTypeInvisibility;
newEvent._type = kDMEventTypeInvisibility;
_vm->_championMan->_party._event71Count_Invisibility++;
uint16 spellTicks = spellPower;
newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + spellTicks);
@ -623,7 +623,7 @@ int16 MenuMan::getChampionSpellCastResult(uint16 champIndex) {
}
break;
case kDMSpellTypeOtherPartyShield: {
newEvent._type = k74_TMEventTypePartyShield;
newEvent._type = kDMEventTypePartyShield;
newEvent._Bu._defense = spellPower;
if (_vm->_championMan->_party._shieldDefense > 50)
newEvent._Bu._defense >>= 2;
@ -636,7 +636,7 @@ int16 MenuMan::getChampionSpellCastResult(uint16 champIndex) {
}
break;
case kDMSpellTypeOtherFootprints: {
newEvent._type = k79_TMEventTypeFootprints;
newEvent._type = kDMEventTypeFootprints;
_vm->_championMan->_party._event79Count_Footprints++;
_vm->_championMan->_party._firstScentIndex = _vm->_championMan->_party._scentCount;
if (powerSymbolOrdinal < 3)
@ -813,7 +813,7 @@ Potion *MenuMan::getEmptyFlaskInHand(Champion *champ, Thing *potionThing) {
void MenuMan::createEvent70_light(int16 lightPower, int16 ticks) {
TimelineEvent newEvent;
newEvent._type = k70_TMEventTypeLight;
newEvent._type = kDMEventTypeLight;
newEvent._Bu._lightPower = lightPower;
newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + ticks);
newEvent._priority = 0;
@ -837,13 +837,13 @@ bool MenuMan::isPartySpellOrFireShieldSuccessful(Champion *champ, bool spellShie
TimelineEvent newEvent;
newEvent._Bu._defense = ticks >> 5;
if (spellShield) {
newEvent._type = k77_TMEventTypeSpellShield;
newEvent._type = kDMEventTypeSpellShield;
if (_vm->_championMan->_party._spellShieldDefense > 50)
newEvent._Bu._defense >>= 2;
_vm->_championMan->_party._spellShieldDefense += newEvent._Bu._defense;
} else {
newEvent._type = k78_TMEventTypeFireShield;
newEvent._type = kDMEventTypeFireShield;
if (_vm->_championMan->_party._fireShieldDefense > 50)
newEvent._Bu._defense >>= 2;
@ -1274,7 +1274,7 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) {
int16 windowTicks = _vm->getRandomNumber(_vm->_championMan->getSkillLevel(champIndex, actionSkillIndex) + 8) + 5;
TimelineEvent newEvent;
newEvent._priority = 0;
newEvent._type = k73_TMEventTypeThievesEye;
newEvent._type = kDMEventTypeThievesEye;
newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + windowTicks);
_vm->_timeline->addEventGetEventIndex(&newEvent);
_vm->_championMan->_party._event73Count_ThievesEye++;

View File

@ -560,7 +560,7 @@ T0266017_CheckProjectileImpacts:
Thing curThing = _vm->_dungeonMan->getSquareFirstThing(projectileMapX, projectileMapY);
while (curThing != Thing::_endOfList) {
if ((curThing.getType() == kDMThingTypeProjectile) &&
(_vm->_timeline->_events[(((Projectile *)_vm->_dungeonMan->_thingData[kDMThingTypeProjectile])[curThing.getIndex()])._eventIndex]._type != k48_TMEventTypeMoveProjectileIgnoreImpacts)) {
(_vm->_timeline->_events[(((Projectile *)_vm->_dungeonMan->_thingData[kDMThingTypeProjectile])[curThing.getIndex()])._eventIndex]._type != kDMEventTypeMoveProjectileIgnoreImpacts)) {
int16 championOrCreatureOrdinal = championOrCreatureOrdinalInCell[curThing.getCell()];
if (championOrCreatureOrdinal && _vm->_projexpl->hasProjectileImpactOccurred(impactType, srcMapX, srcMapY, _vm->ordinalToIndex(championOrCreatureOrdinal), curThing)) {
_vm->_projexpl->projectileDeleteEvent(curThing);
@ -892,13 +892,13 @@ bool MovesensMan::isObjectInPartyPossession(int16 objectType) {
void MovesensMan::triggerEffect(Sensor *sensor, SensorEffect effect, int16 mapX, int16 mapY, uint16 cell) {
TimelineEventType squareTypeToEventTypeArray[7] = { // @ G0059_auc_Graphic562_SquareTypeToEventType
k6_TMEventTypeWall,
k5_TMEventTypeCorridor,
k9_TMEventTypePit,
k0_TMEventTypeNone,
k10_TMEventTypeDoor,
k8_TMEventTypeTeleporter,
k7_TMEventTypeFakeWall
kDMEventTypeWall,
kDMEventTypeCorridor,
kDMEventTypePit,
kDMEventTypeNone,
kDMEventTypeDoor,
kDMEventTypeTeleporter,
kDMEventTypeFakeWall
};
if (sensor->getAttrOnlyOnce())
@ -984,7 +984,7 @@ void MovesensMan::processRotationEffect() {
void MovesensMan::createEventMoveGroup(Thing groupThing, int16 mapX, int16 mapY, int16 mapIndex, bool audible) {
TimelineEvent newEvent;
newEvent._mapTime = _vm->setMapAndTime(mapIndex, _vm->_gameTime + 5);
newEvent._type = audible ? k61_TMEventTypeMoveGroupAudible : k60_TMEventTypeMoveGroupSilent;
newEvent._type = audible ? kDMEventTypeMoveGroupAudible : kDMEventTypeMoveGroupSilent;
newEvent._priority = 0;
newEvent._Bu._location._mapX = mapX;
newEvent._Bu._location._mapY = mapY;

View File

@ -59,9 +59,9 @@ void ProjExpl::createProjectile(Thing thing, int16 mapX, int16 mapY, uint16 cell
TimelineEvent newEvent;
newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, _vm->_gameTime + 1);
if (_createLauncherProjectile)
newEvent._type = k49_TMEventTypeMoveProjectile; /* Launcher projectiles can impact immediately */
newEvent._type = kDMEventTypeMoveProjectile; /* Launcher projectiles can impact immediately */
else
newEvent._type = k48_TMEventTypeMoveProjectileIgnoreImpacts; /* Projectiles created by champions or creatures ignore impacts on their first movement */
newEvent._type = kDMEventTypeMoveProjectileIgnoreImpacts; /* Projectiles created by champions or creatures ignore impacts on their first movement */
newEvent._priority = 0;
newEvent._Bu._slot = projectileThing.toUint16();
@ -118,7 +118,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in
Door *curDoor = (Door *)_vm->_dungeonMan->getSquareFirstThingData(projectileTargetMapX, projectileTargetMapY);
if ((curDoorState != kDMDoorStateDestroyed) && (projectileAssociatedThing == Thing::_explOpenDoor)) {
if (curDoor->hasButton())
_vm->_moveSens->addEvent(k10_TMEventTypeDoor, projectileTargetMapX, projectileTargetMapY, kDMCellNorthWest, kDMSensorEffectToggle, _vm->_gameTime + 1);
_vm->_moveSens->addEvent(kDMEventTypeDoor, projectileTargetMapX, projectileTargetMapY, kDMCellNorthWest, kDMSensorEffectToggle, _vm->_gameTime + 1);
break;
}
@ -177,7 +177,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in
if (attack) {
int16 outcome = _vm->_groupMan->groupGetDamageCreatureOutcome(curGroup, curCreatureIndex, projectileTargetMapX, projectileTargetMapY, attack + _vm->_groupMan->groupGetResistanceAdjustedPoisonAttack(curCreatureType, _projectilePoisonAttack), true);
if (outcome != kDMKillOutcomeNoCreaturesInGroup)
_vm->_groupMan->processEvents29to41(projectileTargetMapX, projectileTargetMapY, kM2_TMEventTypeCreateReactionEvent30HitByProjectile, 0);
_vm->_groupMan->processEvents29to41(projectileTargetMapX, projectileTargetMapY, kDMEventTypeCreateReactionHitByProjectile, 0);
_creatureDamageOutcome = outcome;
if (!createExplosionOnImpact && (outcome == kDMKillOutcomeNoCreaturesInGroup)
@ -312,7 +312,7 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo,
_vm->_dungeonMan->linkThingToList(unusedThing, Thing(0), projectileMapX, projectileMapY);
TimelineEvent newEvent;
newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, _vm->_gameTime + ((explThing == Thing::_explRebirthStep1) ? 5 : 1));
newEvent._type = k25_TMEventTypeExplosion;
newEvent._type = kDMEventTypeExplosion;
newEvent._priority = 0;
newEvent._Cu._slot = unusedThing.toUint16();
newEvent._Bu._location._mapX = projectileMapX;
@ -400,8 +400,8 @@ void ProjExpl::processEvents48To49(TimelineEvent *event) {
int16 destinationMapX = curEvent->_Cu._projectile.getMapX();
int16 destinationMapY = curEvent->_Cu._projectile.getMapY();
if (curEvent->_type == k48_TMEventTypeMoveProjectileIgnoreImpacts)
curEvent->_type = k49_TMEventTypeMoveProjectile;
if (curEvent->_type == kDMEventTypeMoveProjectileIgnoreImpacts)
curEvent->_type = kDMEventTypeMoveProjectile;
else {
uint16 projectileCurCell = projectileThingNewCell.getCell();
if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (destinationMapX == _vm->_dungeonMan->_partyMapX) && (destinationMapY == _vm->_dungeonMan->_partyMapY) && hasProjectileImpactOccurred(kDMElementTypeChampion, destinationMapX, destinationMapY, projectileCurCell, projectileThingNewCell))
@ -541,7 +541,7 @@ void ProjExpl::processEvent25(TimelineEvent *event) {
&& (attack = _vm->_groupMan->groupGetResistanceAdjustedPoisonAttack(creatureType, attack))
&& (_vm->_groupMan->getDamageAllCreaturesOutcome(group, mapX, mapY, attack, true) != kDMKillOutcomeAllCreaturesInGroup)
&& (attack > 2)) {
_vm->_groupMan->processEvents29to41(mapX, mapY, kM3_TMEventTypeCreateReactionEvent29DangerOnSquare, 0);
_vm->_groupMan->processEvents29to41(mapX, mapY, kDMEventTypeCreateReactionDangerOnSquare, 0);
}
if (explosion->getAttack() >= 6) {
explosion->setAttack(explosion->getAttack() - 3);

View File

@ -204,7 +204,7 @@ void SoundMan::requestPlay(uint16 soundIndex, int16 mapX, int16 mapY, SoundMode
if (soundMode == kDMSoundModePlayOneTickLater) { /* Add an event in the timeline to play the sound (mode - 1) ticks later */
TimelineEvent newEvent;
newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, _vm->_gameTime + soundMode - 1);
newEvent._type = k20_TMEventTypePlaySound;
newEvent._type = kDMEventTypePlaySound;
newEvent._priority = sound->_priority;
newEvent._Cu._soundIndex = soundIndex;
newEvent._Bu._location._mapX = mapX;

View File

@ -112,14 +112,14 @@ void Timeline::initTimeline() {
_timeline = new uint16[_eventMaxCount];
if (_vm->_gameMode != kDMModeLoadSavedGame) {
for (int16 i = 0; i < _eventMaxCount; ++i)
_events[i]._type = k0_TMEventTypeNone;
_events[i]._type = kDMEventTypeNone;
_eventCount = 0;
_firstUnusedEventIndex = 0;
}
}
void Timeline::deleteEvent(uint16 eventIndex) {
_events[eventIndex]._type = k0_TMEventTypeNone;
_events[eventIndex]._type = kDMEventTypeNone;
if (eventIndex < _firstUnusedEventIndex)
_firstUnusedEventIndex = eventIndex;
@ -199,16 +199,16 @@ uint16 Timeline::addEventGetEventIndex(TimelineEvent *event) {
if (_eventCount == _eventMaxCount)
error("Too many events");
if ((event->_type >= k5_TMEventTypeCorridor) && (event->_type <= k10_TMEventTypeDoor)) {
if ((event->_type >= kDMEventTypeCorridor) && (event->_type <= kDMEventTypeDoor)) {
TimelineEvent *curEvent = _events;
for (uint16 eventIndex = 0; eventIndex < _eventMaxCount; eventIndex++, curEvent++) {
if ((curEvent->_type >= k5_TMEventTypeCorridor) && (curEvent->_type <= k10_TMEventTypeDoor)) {
if ((event->_mapTime == curEvent->_mapTime) && (event->getMapXY() == curEvent->getMapXY()) && ((curEvent->_type != k6_TMEventTypeWall) || (curEvent->_Cu.A._cell == event->_Cu.A._cell))) {
if ((curEvent->_type >= kDMEventTypeCorridor) && (curEvent->_type <= kDMEventTypeDoor)) {
if ((event->_mapTime == curEvent->_mapTime) && (event->getMapXY() == curEvent->getMapXY()) && ((curEvent->_type != kDMEventTypeWall) || (curEvent->_Cu.A._cell == event->_Cu.A._cell))) {
curEvent->_Cu.A._effect = event->_Cu.A._effect;
return eventIndex;
}
continue;
} else if ((curEvent->_type == k1_TMEventTypeDoorAnimation) && (event->_mapTime == curEvent->_mapTime) && (event->getMapXY() == curEvent->getMapXY())) {
} else if ((curEvent->_type == kDMEventTypeDoorAnimation) && (event->_mapTime == curEvent->_mapTime) && (event->getMapXY() == curEvent->getMapXY())) {
if (event->_Cu.A._effect == kDMSensorEffectToggle)
event->_Cu.A._effect = 1 - curEvent->_Cu.A._effect;
@ -216,27 +216,27 @@ uint16 Timeline::addEventGetEventIndex(TimelineEvent *event) {
break;
}
}
} else if (event->_type == k1_TMEventTypeDoorAnimation) {
} else if (event->_type == kDMEventTypeDoorAnimation) {
TimelineEvent *curEvent = _events;
for (uint16 eventIndex = 0; eventIndex < _eventMaxCount; eventIndex++, curEvent++) {
if ((event->_mapTime == curEvent->_mapTime) && (event->getMapXY() == curEvent->getMapXY())) {
if (curEvent->_type == k10_TMEventTypeDoor) {
if (curEvent->_type == kDMEventTypeDoor) {
if (curEvent->_Cu.A._effect == kDMSensorEffectToggle)
curEvent->_Cu.A._effect = 1 - event->_Cu.A._effect;
return eventIndex;
}
if (curEvent->_type == k1_TMEventTypeDoorAnimation) {
if (curEvent->_type == kDMEventTypeDoorAnimation) {
curEvent->_Cu.A._effect = event->_Cu.A._effect;
return eventIndex;
}
}
}
} else if (event->_type == k2_TMEventTypeDoorDestruction) {
} else if (event->_type == kDMEventTypeDoorDestruction) {
TimelineEvent *curEvent = _events;
for (uint16 eventIndex = 0; eventIndex < _eventMaxCount; eventIndex++, curEvent++) {
if ((event->getMapXY() == curEvent->getMapXY()) && (_vm->getMap(event->_mapTime) == _vm->getMap(curEvent->_mapTime))) {
if ((curEvent->_type == k1_TMEventTypeDoorAnimation) || (curEvent->_type == k10_TMEventTypeDoor))
if ((curEvent->_type == kDMEventTypeDoorAnimation) || (curEvent->_type == kDMEventTypeDoor))
deleteEvent(eventIndex);
}
}
@ -248,7 +248,7 @@ uint16 Timeline::addEventGetEventIndex(TimelineEvent *event) {
if (_firstUnusedEventIndex == _eventMaxCount)
break;
_firstUnusedEventIndex++;
} while ((_events[_firstUnusedEventIndex])._type != k0_TMEventTypeNone);
} while ((_events[_firstUnusedEventIndex])._type != kDMEventTypeNone);
_timeline[_eventCount] = newEventIndex;
fixChronology(_eventCount++);
return newEventIndex;
@ -261,106 +261,106 @@ void Timeline::processTimeline() {
extractFirstEvent(curEvent);
_vm->_dungeonMan->setCurrentMap(_vm->getMap(newEvent._mapTime));
uint16 curEventType = newEvent._type;
if ((curEventType > (k29_TMEventTypeGroupReactionDangerOnSquare - 1)) && (curEventType < (k41_TMEventTypeUpdateBehaviour_3 + 1)))
if ((curEventType > (kDMEventTypeGroupReactionDangerOnSquare - 1)) && (curEventType < (kDMEventTypeUpdateBehavior3 + 1)))
_vm->_groupMan->processEvents29to41(newEvent._Bu._location._mapX, newEvent._Bu._location._mapY, curEventType, newEvent._Cu._ticks);
else {
switch (curEventType) {
case k48_TMEventTypeMoveProjectileIgnoreImpacts:
case k49_TMEventTypeMoveProjectile:
case kDMEventTypeMoveProjectileIgnoreImpacts:
case kDMEventTypeMoveProjectile:
_vm->_projexpl->processEvents48To49(curEvent);
break;
case k1_TMEventTypeDoorAnimation:
case kDMEventTypeDoorAnimation:
processEventDoorAnimation(curEvent);
break;
case k25_TMEventTypeExplosion:
case kDMEventTypeExplosion:
_vm->_projexpl->processEvent25(curEvent);
break;
case k7_TMEventTypeFakeWall:
case kDMEventTypeFakeWall:
processEventSquareFakewall(curEvent);
break;
case k2_TMEventTypeDoorDestruction:
case kDMEventTypeDoorDestruction:
processEventDoorDestruction(curEvent);
break;
case k10_TMEventTypeDoor:
case kDMEventTypeDoor:
processEventSquareDoor(curEvent);
break;
case k9_TMEventTypePit:
case kDMEventTypePit:
processEventSquarePit(curEvent);
break;
case k8_TMEventTypeTeleporter:
case kDMEventTypeTeleporter:
processEventSquareTeleporter(curEvent);
break;
case k6_TMEventTypeWall:
case kDMEventTypeWall:
processEventSquareWall(curEvent);
break;
case k5_TMEventTypeCorridor:
case kDMEventTypeCorridor:
processEventSquareCorridor(curEvent);
break;
case k60_TMEventTypeMoveGroupSilent:
case k61_TMEventTypeMoveGroupAudible:
case kDMEventTypeMoveGroupSilent:
case kDMEventTypeMoveGroupAudible:
processEventsMoveGroup(curEvent);
break;
case k65_TMEventTypeEnableGroupGenerator:
case kDMEventTypeEnableGroupGenerator:
procesEventEnableGroupGenerator(curEvent);
break;
case k20_TMEventTypePlaySound:
case kDMEventTypePlaySound:
_vm->_sound->requestPlay(newEvent._Cu._soundIndex, newEvent._Bu._location._mapX, newEvent._Bu._location._mapY, kDMSoundModePlayIfPrioritized);
break;
case k24_TMEventTypeRemoveFluxcage:
case kDMEventTypeRemoveFluxcage:
if (!_vm->_gameWon) {
_vm->_dungeonMan->unlinkThingFromList(Thing(newEvent._Cu._slot), Thing(0), newEvent._Bu._location._mapX, newEvent._Bu._location._mapY);
curEvent = (TimelineEvent *)_vm->_dungeonMan->getThingData(Thing(newEvent._Cu._slot));
((Explosion *)curEvent)->setNextThing(Thing::_none);
}
break;
case k11_TMEventTypeEnableChampionAction:
case kDMEventTypeEnableChampionAction:
processEventEnableChampionAction(newEvent._priority);
if (newEvent._Bu._slotOrdinal)
processEventMoveWeaponFromQuiverToSlot(newEvent._priority, _vm->ordinalToIndex(newEvent._Bu._slotOrdinal));
_vm->_championMan->drawChampionState((ChampionIndex)newEvent._priority);
break;
case k12_TMEventTypeHideDamageReceived:
case kDMEventTypeHideDamageReceived:
processEventHideDamageReceived(newEvent._priority);
break;
case k70_TMEventTypeLight:
case kDMEventTypeLight:
_vm->_dungeonMan->setCurrentMap(_vm->_dungeonMan->_partyMapIndex);
processEventLight(curEvent);
_vm->_inventoryMan->setDungeonViewPalette();
break;
case k71_TMEventTypeInvisibility:
case kDMEventTypeInvisibility:
_vm->_championMan->_party._event71Count_Invisibility--;
break;
case k72_TMEventTypeChampionShield:
case kDMEventTypeChampionShield:
_vm->_championMan->_champions[newEvent._priority]._shieldDefense -= newEvent._Bu._defense;
setFlag(_vm->_championMan->_champions[newEvent._priority]._attributes, kDMAttributeStatusBox);
_vm->_championMan->drawChampionState((ChampionIndex)newEvent._priority);
break;
case k73_TMEventTypeThievesEye:
case kDMEventTypeThievesEye:
_vm->_championMan->_party._event73Count_ThievesEye--;
break;
case k74_TMEventTypePartyShield:
case kDMEventTypePartyShield:
_vm->_championMan->_party._shieldDefense -= newEvent._Bu._defense;
refreshAllChampionStatusBoxes();
break;
case k77_TMEventTypeSpellShield:
case kDMEventTypeSpellShield:
_vm->_championMan->_party._spellShieldDefense -= newEvent._Bu._defense;
refreshAllChampionStatusBoxes();
break;
case k78_TMEventTypeFireShield:
case kDMEventTypeFireShield:
_vm->_championMan->_party._fireShieldDefense -= newEvent._Bu._defense;
refreshAllChampionStatusBoxes();
break;
case k75_TMEventTypePoisonChampion: {
case kDMEventTypePoisonChampion: {
uint16 championIndex = newEvent._priority;
_vm->_championMan->_champions[championIndex = newEvent._priority]._poisonEventCount--;
_vm->_championMan->championPoison(championIndex, newEvent._Bu._attack);
}
break;
case k13_TMEventTypeViAltarRebirth:
case kDMEventTypeViAltarRebirth:
processEventViAltarRebirth(curEvent);
break;
case k79_TMEventTypeFootprints:
case kDMEventTypeFootprints:
_vm->_championMan->_party._event79Count_Footprints--;
}
}
@ -413,7 +413,7 @@ void Timeline::processEventDoorAnimation(TimelineEvent *event) {
if ((groupThing != Thing::_endOfList) && !getFlag(creatureAttributes, kDMCreatureMaskNonMaterial)) {
if (doorState >= (verticalDoorFl ? CreatureInfo::getHeight(creatureAttributes) : 1)) { /* Creature height or 1 */
if (_vm->_groupMan->getDamageAllCreaturesOutcome((Group *)_vm->_dungeonMan->getThingData(groupThing), mapX, mapY, 5, true) != kDMKillOutcomeAllCreaturesInGroup)
_vm->_groupMan->processEvents29to41(mapX, mapY, kM3_TMEventTypeCreateReactionEvent29DangerOnSquare, 0);
_vm->_groupMan->processEvents29to41(mapX, mapY, kDMEventTypeCreateReactionDangerOnSquare, 0);
int16 nextState = doorState - 1;
doorState = (doorState == kDMDoorStateOpen) ? kDMDoorStateOpen : (DoorState) nextState;
@ -486,7 +486,7 @@ void Timeline::processEventSquareDoor(TimelineEvent *event) {
if ((doorState == kDMDoorStateOpen) || (doorState == kDMDoorStateClosed))
return;
}
event->_type = k1_TMEventTypeDoorAnimation;
event->_type = kDMEventTypeDoorAnimation;
addEventGetEventIndex(event);
}
@ -545,7 +545,7 @@ void Timeline::moveTeleporterOrPitSquareThings(uint16 mapX, uint16 mapY) {
} else if (curThingType == kDMThingTypeExplosion) {
TimelineEvent *newEvent = _events;
for (uint16 i = 0; i < _eventMaxCount; newEvent++, i++) {
if ((newEvent->_type == k25_TMEventTypeExplosion) && (newEvent->_Cu._slot == curThing.toUint16())) { /* BUG0_23 A Fluxcage explosion remains on a square forever. If you open a pit or teleporter on a square where there is a Fluxcage explosion, the Fluxcage explosion is moved but the associated event is not updated (because Fluxcage explosions do not use k25_TMEventTypeExplosion but rather k24_TMEventTypeRemoveFluxcage) causing the Fluxcage explosion to remain in the dungeon forever on its destination square. When the k24_TMEventTypeRemoveFluxcage expires the explosion thing is not removed, but it is marked as unused. Consequently, any objects placed on the Fluxcage square after it was moved but before it expires become orphans upon expiration. After expiration, any object placed on the fluxcage square is cloned when picked up */
if ((newEvent->_type == kDMEventTypeExplosion) && (newEvent->_Cu._slot == curThing.toUint16())) { /* BUG0_23 A Fluxcage explosion remains on a square forever. If you open a pit or teleporter on a square where there is a Fluxcage explosion, the Fluxcage explosion is moved but the associated event is not updated (because Fluxcage explosions do not use k25_TMEventTypeExplosion but rather k24_TMEventTypeRemoveFluxcage) causing the Fluxcage explosion to remain in the dungeon forever on its destination square. When the k24_TMEventTypeRemoveFluxcage expires the explosion thing is not removed, but it is marked as unused. Consequently, any objects placed on the Fluxcage square after it was moved but before it expires become orphans upon expiration. After expiration, any object placed on the fluxcage square is cloned when picked up */
newEvent->_Bu._location._mapX = _vm->_moveSens->_moveResultMapX;
newEvent->_Bu._location._mapY = _vm->_moveSens->_moveResultMapY;
newEvent->_Cu._slot = _vm->thingWithNewCell(curThing, _vm->_moveSens->_moveResultCell).toUint16();
@ -725,8 +725,8 @@ void Timeline::processEventSquareCorridor(TimelineEvent *event) {
Sensor *curSensor = (Sensor *)_vm->_dungeonMan->getThingData(curThing);
if (curSensor->getType() == kDMSensorFloorGroupGenerator) {
int16 creatureCount = curSensor->getAttrValue();
if (getFlag(creatureCount, k0x0008_randomizeGeneratedCreatureCount))
creatureCount = _vm->getRandomNumber(getFlag(creatureCount, k0x0007_generatedCreatureCount));
if (getFlag(creatureCount, kDMMaskRandomizeGeneratedCreatureCount))
creatureCount = _vm->getRandomNumber(getFlag(creatureCount, kDMMaskGeneratedCreatureCount));
else
creatureCount--;
@ -748,7 +748,7 @@ void Timeline::processEventSquareCorridor(TimelineEvent *event) {
actionTicks = (actionTicks - 126) << 6;
TimelineEvent newEvent;
newEvent._type = k65_TMEventTypeEnableGroupGenerator;
newEvent._type = kDMEventTypeEnableGroupGenerator;
newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, _vm->_gameTime + actionTicks);
newEvent._priority = 0;
newEvent._Bu._location._mapX = mapX;
@ -770,7 +770,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)
if (event->_type == kDMEventTypeMoveGroupAudible)
_vm->_sound->requestPlay(kDMSoundIndexBuzz, mapX, mapY, kDMSoundModePlayIfPrioritized);
_vm->_moveSens->getMoveResult(Thing(event->_Cu._slot), kDMMapXNotOnASquare, 0, mapX, mapY);
@ -898,7 +898,7 @@ void Timeline::processEventLight(TimelineEvent *event) {
_vm->_championMan->_party._magicalLightAmount += lightAmount;
if (weakerLightPower) {
TimelineEvent newEvent;
newEvent._type = k70_TMEventTypeLight;
newEvent._type = kDMEventTypeLight;
newEvent._Bu._lightPower = weakerLightPower;
newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_partyMapIndex, _vm->_gameTime + 4);
newEvent._priority = 0;

View File

@ -37,66 +37,66 @@ namespace DM {
/* Event types */
enum TimelineEventType {
/* Used when a creature in a group was damaged or killed by a Poison Cloud or by a closing door or if Lord Chaos is surrounded by = 3, Fluxcages */
kM3_TMEventTypeCreateReactionEvent29DangerOnSquare = -3, // @ CM3_EVENT_CREATE_REACTION_EVENT_29_DANGER_ON_SQUARE
kDMEventTypeCreateReactionDangerOnSquare = -3, // @ CM3_EVENT_CREATE_REACTION_EVENT_29_DANGER_ON_SQUARE
/* Used when a projectile impacts with a creature in a group */
kM2_TMEventTypeCreateReactionEvent30HitByProjectile = -2, // @ CM2_EVENT_CREATE_REACTION_EVENT_30_HIT_BY_PROJECTILE
kDMEventTypeCreateReactionHitByProjectile = -2, // @ CM2_EVENT_CREATE_REACTION_EVENT_30_HIT_BY_PROJECTILE
/* Used when the party bumps into a group or performs a melee attack */
kM1_TMEventTypeCreateReactionEvent31ParyIsAdjacent = -1, // @ CM1_EVENT_CREATE_REACTION_EVENT_31_PARTY_IS_ADJACENT
k0_TMEventTypeNone = 0, // @ C00_EVENT_NONE
k1_TMEventTypeDoorAnimation = 1, // @ C01_EVENT_DOOR_ANIMATION
k2_TMEventTypeDoorDestruction = 2, // @ C02_EVENT_DOOR_DESTRUCTION
k5_TMEventTypeCorridor = 5, // @ C05_EVENT_CORRIDOR
k6_TMEventTypeWall = 6, // @ C06_EVENT_WALL
k7_TMEventTypeFakeWall = 7, // @ C07_EVENT_FAKEWALL
k8_TMEventTypeTeleporter = 8, // @ C08_EVENT_TELEPORTER
k9_TMEventTypePit = 9, // @ C09_EVENT_PIT
k10_TMEventTypeDoor = 10, // @ C10_EVENT_DOOR
k11_TMEventTypeEnableChampionAction = 11, // @ C11_EVENT_ENABLE_CHAMPION_ACTION
k12_TMEventTypeHideDamageReceived = 12, // @ C12_EVENT_HIDE_DAMAGE_RECEIVED
k13_TMEventTypeViAltarRebirth = 13, // @ C13_EVENT_VI_ALTAR_REBIRTH
k20_TMEventTypePlaySound = 20, // @ C20_EVENT_PLAY_SOUND
k22_TMEventTypeCPSE = 22, // @ C22_EVENT_CPSE
k24_TMEventTypeRemoveFluxcage = 24, // @ C24_EVENT_REMOVE_FLUXCAGE
k25_TMEventTypeExplosion = 25, // @ C25_EVENT_EXPLOSION
k29_TMEventTypeGroupReactionDangerOnSquare = 29, // @ C29_EVENT_GROUP_REACTION_DANGER_ON_SQUARE
k30_TMEventTypeGroupReacionHitByProjectile = 30, // @ C30_EVENT_GROUP_REACTION_HIT_BY_PROJECTILE
k31_TMEventTypeGroupReactionPartyIsAdjecent = 31, // @ C31_EVENT_GROUP_REACTION_PARTY_IS_ADJACENT
k32_TMEventTypeUpdateAspectGroup = 32, // @ C32_EVENT_UPDATE_ASPECT_GROUP
kDMEventTypeCreateReactionPartyIsAdjacent = -1, // @ CM1_EVENT_CREATE_REACTION_EVENT_31_PARTY_IS_ADJACENT
kDMEventTypeNone = 0, // @ C00_EVENT_NONE
kDMEventTypeDoorAnimation = 1, // @ C01_EVENT_DOOR_ANIMATION
kDMEventTypeDoorDestruction = 2, // @ C02_EVENT_DOOR_DESTRUCTION
kDMEventTypeCorridor = 5, // @ C05_EVENT_CORRIDOR
kDMEventTypeWall = 6, // @ C06_EVENT_WALL
kDMEventTypeFakeWall = 7, // @ C07_EVENT_FAKEWALL
kDMEventTypeTeleporter = 8, // @ C08_EVENT_TELEPORTER
kDMEventTypePit = 9, // @ C09_EVENT_PIT
kDMEventTypeDoor = 10, // @ C10_EVENT_DOOR
kDMEventTypeEnableChampionAction = 11, // @ C11_EVENT_ENABLE_CHAMPION_ACTION
kDMEventTypeHideDamageReceived = 12, // @ C12_EVENT_HIDE_DAMAGE_RECEIVED
kDMEventTypeViAltarRebirth = 13, // @ C13_EVENT_VI_ALTAR_REBIRTH
kDMEventTypePlaySound = 20, // @ C20_EVENT_PLAY_SOUND
kDMEventTypeCPSE = 22, // @ C22_EVENT_CPSE
kDMEventTypeRemoveFluxcage = 24, // @ C24_EVENT_REMOVE_FLUXCAGE
kDMEventTypeExplosion = 25, // @ C25_EVENT_EXPLOSION
kDMEventTypeGroupReactionDangerOnSquare = 29, // @ C29_EVENT_GROUP_REACTION_DANGER_ON_SQUARE
kDMEventTypeGroupReacionHitByProjectile = 30, // @ C30_EVENT_GROUP_REACTION_HIT_BY_PROJECTILE
kDMEventTypeGroupReactionPartyIsAdjecent = 31, // @ C31_EVENT_GROUP_REACTION_PARTY_IS_ADJACENT
kDMEventTypeUpdateAspectGroup = 32, // @ C32_EVENT_UPDATE_ASPECT_GROUP
/* Events = 33,-36 and = 38,-41 are used for individual creatures only while the group is attacking the party */
k33_TMEventTypeUpdateAspectCreature_0 = 33, // @ C33_EVENT_UPDATE_ASPECT_CREATURE_0
k34_TMEventTypeUpdateAspectCreature_1 = 34, // @ C34_EVENT_UPDATE_ASPECT_CREATURE_1
k35_TMEventTypeUpdateAspectCreature_2 = 35, // @ C35_EVENT_UPDATE_ASPECT_CREATURE_2
k36_TMEventTypeUpdateAspectCreature_3 = 36, // @ C36_EVENT_UPDATE_ASPECT_CREATURE_3
k37_TMEventTypeUpdateBehaviourGroup = 37, // @ C37_EVENT_UPDATE_BEHAVIOR_GROUP
k38_TMEventTypeUpdateBehaviour_0 = 38, // @ C38_EVENT_UPDATE_BEHAVIOR_CREATURE_0
k39_TMEventTypeUpdateBehaviour_1 = 39, // @ C39_EVENT_UPDATE_BEHAVIOR_CREATURE_1
k40_TMEventTypeUpdateBehaviour_2 = 40, // @ C40_EVENT_UPDATE_BEHAVIOR_CREATURE_2
k41_TMEventTypeUpdateBehaviour_3 = 41, // @ C41_EVENT_UPDATE_BEHAVIOR_CREATURE_3
kDMEventTypeUpdateAspectCreature0 = 33, // @ C33_EVENT_UPDATE_ASPECT_CREATURE_0
kDMEventTypeUpdateAspectCreature1 = 34, // @ C34_EVENT_UPDATE_ASPECT_CREATURE_1
kDMEventTypeUpdateAspectCreature2 = 35, // @ C35_EVENT_UPDATE_ASPECT_CREATURE_2
kDMEventTypeUpdateAspectCreature3 = 36, // @ C36_EVENT_UPDATE_ASPECT_CREATURE_3
kDMEventTypeUpdateBehaviourGroup = 37, // @ C37_EVENT_UPDATE_BEHAVIOR_GROUP
kDMEventTypeUpdateBehavior0 = 38, // @ C38_EVENT_UPDATE_BEHAVIOR_CREATURE_0
kDMEventTypeUpdateBehavior1 = 39, // @ C39_EVENT_UPDATE_BEHAVIOR_CREATURE_1
kDMEventTypeUpdateBehavior2 = 40, // @ C40_EVENT_UPDATE_BEHAVIOR_CREATURE_2
kDMEventTypeUpdateBehavior3 = 41, // @ C41_EVENT_UPDATE_BEHAVIOR_CREATURE_3
/* Projectiles created by a champion (by casting a spell, shooting a weapon or throwing an object) or by a creature (by casting a spell) ignore impacts during their first movement otherwise an impact would always occur immediately as these projectiles are created on the champion or creature square */
k48_TMEventTypeMoveProjectileIgnoreImpacts = 48, // @ C48_EVENT_MOVE_PROJECTILE_IGNORE_IMPACTS
kDMEventTypeMoveProjectileIgnoreImpacts = 48, // @ C48_EVENT_MOVE_PROJECTILE_IGNORE_IMPACTS
/* Projectiles created by projectile launcher sensors never ignore impacts as well as all other projectiles after their first movement */
k49_TMEventTypeMoveProjectile = 49, // @ C49_EVENT_MOVE_PROJECTILE
k53_TMEventTypeWatchdoge = 53, // @ C53_EVENT_WATCHDOG
k60_TMEventTypeMoveGroupSilent = 60, // @ C60_EVENT_MOVE_GROUP_SILENT
k61_TMEventTypeMoveGroupAudible = 61, // @ C61_EVENT_MOVE_GROUP_AUDIBLE
k65_TMEventTypeEnableGroupGenerator = 65, // @ C65_EVENT_ENABLE_GROUP_GENERATOR
k70_TMEventTypeLight = 70, // @ C70_EVENT_LIGHT
k71_TMEventTypeInvisibility = 71, // @ C71_EVENT_INVISIBILITY
k72_TMEventTypeChampionShield = 72, // @ C72_EVENT_CHAMPION_SHIELD
k73_TMEventTypeThievesEye = 73, // @ C73_EVENT_THIEVES_EYE
k74_TMEventTypePartyShield = 74, // @ C74_EVENT_PARTY_SHIELD
k75_TMEventTypePoisonChampion = 75, // @ C75_EVENT_POISON_CHAMPION
k77_TMEventTypeSpellShield = 77, // @ C77_EVENT_SPELLSHIELD
k78_TMEventTypeFireShield = 78, // @ C78_EVENT_FIRESHIELD
k79_TMEventTypeFootprints = 79, // @ C79_EVENT_FOOTPRINTS
k80_TMEventTypeMagicMap_C80 = 80, // @ C80_EVENT_MAGIC_MAP
k81_TMEventTypeMagicMap_C81 = 81, // @ C81_EVENT_MAGIC_MAP
k82_TMEventTypeMagicMap_C82 = 82, // @ C82_EVENT_MAGIC_MAP
k83_TMEventTypeMagicMap_C83 = 83 // @ C83_EVENT_MAGIC_MAP
kDMEventTypeMoveProjectile = 49, // @ C49_EVENT_MOVE_PROJECTILE
kDMEventTypeWatchdoge = 53, // @ C53_EVENT_WATCHDOG
kDMEventTypeMoveGroupSilent = 60, // @ C60_EVENT_MOVE_GROUP_SILENT
kDMEventTypeMoveGroupAudible = 61, // @ C61_EVENT_MOVE_GROUP_AUDIBLE
kDMEventTypeEnableGroupGenerator = 65, // @ C65_EVENT_ENABLE_GROUP_GENERATOR
kDMEventTypeLight = 70, // @ C70_EVENT_LIGHT
kDMEventTypeInvisibility = 71, // @ C71_EVENT_INVISIBILITY
kDMEventTypeChampionShield = 72, // @ C72_EVENT_CHAMPION_SHIELD
kDMEventTypeThievesEye = 73, // @ C73_EVENT_THIEVES_EYE
kDMEventTypePartyShield = 74, // @ C74_EVENT_PARTY_SHIELD
kDMEventTypePoisonChampion = 75, // @ C75_EVENT_POISON_CHAMPION
kDMEventTypeSpellShield = 77, // @ C77_EVENT_SPELLSHIELD
kDMEventTypeFireShield = 78, // @ C78_EVENT_FIRESHIELD
kDMEventTypeFootprints = 79, // @ C79_EVENT_FOOTPRINTS
kDMEventTypeMagicMap0 = 80, // @ C80_EVENT_MAGIC_MAP
kDMEventTypeMagicMap1 = 81, // @ C81_EVENT_MAGIC_MAP
kDMEventTypeMagicMap2 = 82, // @ C82_EVENT_MAGIC_MAP
kDMEventTypeMagicMap3 = 83 // @ C83_EVENT_MAGIC_MAP
};
#define k0x0007_generatedCreatureCount 0x0007 // @ MASK0x0007_GENERATED_CREATURE_COUNT
#define k0x0008_randomizeGeneratedCreatureCount 0x0008 // @ MASK0x0008_RANDOMIZE_GENERATED_CREATURE_COUNT
#define kDMMaskGeneratedCreatureCount 0x0007 // @ MASK0x0007_GENERATED_CREATURE_COUNT
#define kDMMaskRandomizeGeneratedCreatureCount 0x0008 // @ MASK0x0008_RANDOMIZE_GENERATED_CREATURE_COUNT
class TimelineEvent {
public: