mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 07:53:36 +00:00
DM: Make use of TimeLineEventType
This commit is contained in:
parent
dd9e43925f
commit
58728d2f16
@ -435,7 +435,8 @@ int16 GroupMan::groupGetDamageCreatureOutcome(Group *group, uint16 creatureIndex
|
||||
if (nextCreatureIndex == creatureIndex)
|
||||
_vm->_timeline->deleteEvent(eventIndex);
|
||||
else if (nextCreatureIndex > creatureIndex) {
|
||||
curEvent->_type -= 1;
|
||||
int16 curType = curEvent->_type - 1;
|
||||
curEvent->_type = (TimelineEventType)curType;
|
||||
_vm->_timeline->fixChronology(_vm->_timeline->getIndex(eventIndex));
|
||||
}
|
||||
}
|
||||
@ -556,7 +557,7 @@ int16 GroupMan::groupGetResistanceAdjustedPoisonAttack(CreatureType creatureType
|
||||
return ((poisonAttack + _vm->getRandomNumber(4)) << 3) / (poisonResistance + 1);
|
||||
}
|
||||
|
||||
void GroupMan::processEvents29to41(int16 eventMapX, int16 eventMapY, int16 eventType, uint16 ticks) {
|
||||
void GroupMan::processEvents29to41(int16 eventMapX, int16 eventMapY, TimelineEventType eventType, uint16 ticks) {
|
||||
int16 L0446_i_Multiple = 0;
|
||||
#define AL0446_i_Direction L0446_i_Multiple
|
||||
#define AL0446_i_Ticks L0446_i_Multiple
|
||||
@ -651,7 +652,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 + kDMEventTypeUpdateAspectGroup;
|
||||
int16 nextType = eventType + kDMEventTypeUpdateAspectGroup;
|
||||
nextEvent._type = (TimelineEventType)nextType;
|
||||
if (eventType == kDMEventTypeCreateReactionPartyIsAdjacent) {
|
||||
AL0446_i_Ticks = 1; /* Retry in 1 tick */
|
||||
} else {
|
||||
@ -681,7 +683,9 @@ T0209005_AddEventAndReturn:
|
||||
int16 distanceToVisibleParty = 0;
|
||||
|
||||
if (eventType <= kDMEventTypeGroupReactionPartyIsAdjecent) { /* Process Reaction events 29 to 31 */
|
||||
switch (eventType = eventType - kDMEventTypeUpdateAspectGroup) {
|
||||
int16 tmpType = eventType - kDMEventTypeUpdateAspectGroup;
|
||||
eventType = (TimelineEventType) tmpType;
|
||||
switch (eventType) {
|
||||
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);
|
||||
@ -709,7 +713,8 @@ T0209005_AddEventAndReturn:
|
||||
}
|
||||
}
|
||||
if (eventType < kDMEventTypeUpdateBehaviourGroup) { /* Process Update Aspect events 32 to 36 */
|
||||
nextEvent._type = eventType + 5;
|
||||
int16 nextType = eventType + 5;
|
||||
nextEvent._type = (TimelineEventType)nextType;
|
||||
if (groupGetDistanceToVisibleParty(curGroup, kDMWholeCreatureGroup, eventMapX, eventMapY)) {
|
||||
if ((AL0447_i_Behavior != kDMBehaviorAttack) && (AL0447_i_Behavior != kDMBehaviorFlee)) {
|
||||
if (_vm->getDistance(_vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, eventMapX, eventMapY) <= 1)
|
||||
@ -760,7 +765,8 @@ T0209044_SetBehavior6_Attack:
|
||||
if (notUpdateBehaviorFl) {
|
||||
nextEvent._mapTime += MIN((uint16)((creatureInfo._attackTicks >> 1) + _vm->getRandomNumber(4)), ticks);
|
||||
}
|
||||
nextEvent._type = kDMEventTypeUpdateBehavior0 + AL0447_i_CreatureIndex;
|
||||
int16 nextType = kDMEventTypeUpdateBehavior0 + AL0447_i_CreatureIndex;
|
||||
nextEvent._type = (TimelineEventType)nextType;
|
||||
addGroupEvent(&nextEvent, getCreatureAspectUpdateTime(activeGroup, AL0447_i_CreatureIndex, false));
|
||||
}
|
||||
return;
|
||||
@ -1341,7 +1347,8 @@ void GroupMan::setGroupDirection(ActiveGroup *activeGroup, int16 dir, int16 crea
|
||||
void GroupMan::addGroupEvent(TimelineEvent *event, uint32 time) {
|
||||
warning("potentially dangerous cast to uint32 below");
|
||||
if (time < (uint32)_vm->filterTime(event->_mapTime)) {
|
||||
event->_type -= 5;
|
||||
int16 tmpType = event->_type - 5;
|
||||
event->_type = (TimelineEventType)tmpType;
|
||||
event->_Cu._ticks = _vm->filterTime(event->_mapTime) - time;
|
||||
setTime(event->_mapTime, time);
|
||||
} else
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include "dm/dm.h"
|
||||
#include "dm/sounds.h"
|
||||
#include "dm/timeline.h"
|
||||
|
||||
namespace DM {
|
||||
class Champion;
|
||||
@ -204,7 +205,7 @@ public:
|
||||
uint16 getGroupValueUpdatedWithCreatureValue(uint16 groupVal, uint16 creatureIndex, uint16 creatureVal); // @ F0178_GROUP_GetGroupValueUpdatedWithCreatureValue
|
||||
int16 getDamageAllCreaturesOutcome(Group *group, int16 mapX, int16 mapY, int16 attack, bool notMoving); // @ F0191_GROUP_GetDamageAllCreaturesOutcome
|
||||
int16 groupGetResistanceAdjustedPoisonAttack(CreatureType creatureType, int16 poisonAttack); // @ F0192_GROUP_GetResistanceAdjustedPoisonAttack
|
||||
void processEvents29to41(int16 eventMapX, int16 eventMapY, int16 eventType, uint16 ticks); // @ F0209_GROUP_ProcessEvents29to41
|
||||
void processEvents29to41(int16 eventMapX, int16 eventMapY, TimelineEventType eventType, uint16 ticks); // @ F0209_GROUP_ProcessEvents29to41
|
||||
bool isMovementPossible(CreatureInfo *creatureInfo, int16 mapX, int16 mapY,
|
||||
uint16 dir, bool allowMovementOverImaginaryPitsAndFakeWalls); // @ F0202_GROUP_IsMovementPossible
|
||||
int16 getDistanceBetweenSquares(int16 srcMapX, int16 srcMapY, int16 destMapX,
|
||||
|
@ -583,7 +583,7 @@ T0266017_CheckProjectileImpacts:
|
||||
return false;
|
||||
}
|
||||
|
||||
void MovesensMan::addEvent(byte type, byte mapX, byte mapY, Cell cell, SensorEffect effect, int32 time) {
|
||||
void MovesensMan::addEvent(TimelineEventType type, byte mapX, byte mapY, Cell cell, SensorEffect effect, int32 time) {
|
||||
TimelineEvent newEvent;
|
||||
newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, time);
|
||||
newEvent._type = type;
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
bool getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destMapX, int16 destMapY); // @ F0267_MOVE_GetMoveResult_CPSCE
|
||||
bool isLevitating(Thing thing); // @ F0264_MOVE_IsLevitating
|
||||
bool moveIsKilledByProjectileImpact(int16 srcMapX, int16 srcMapY, int16 destMapX, int16 destMapY, Thing thing); // @ F0266_MOVE_IsKilledByProjectileImpact
|
||||
void addEvent(byte type, byte mapX, byte mapY, Cell cell, SensorEffect effect, int32 time); // @ F0268_SENSOR_AddEvent
|
||||
void addEvent(TimelineEventType type, byte mapX, byte mapY, Cell cell, SensorEffect effect, int32 time); // @ F0268_SENSOR_AddEvent
|
||||
int16 getSound(CreatureType creatureType); // @ F0514_MOVE_GetSound
|
||||
int16 getTeleporterRotatedGroupResult(Teleporter *teleporter, Thing thing, uint16 mapIndex);// @ F0262_MOVE_GetTeleporterRotatedGroupResult
|
||||
Thing getTeleporterRotatedProjectileThing(Teleporter *teleporter, Thing projectileThing); // @ F0263_MOVE_GetTeleporterRotatedProjectileThing
|
||||
|
@ -260,7 +260,7 @@ void Timeline::processTimeline() {
|
||||
TimelineEvent *curEvent = &newEvent;
|
||||
extractFirstEvent(curEvent);
|
||||
_vm->_dungeonMan->setCurrentMap(_vm->getMap(newEvent._mapTime));
|
||||
uint16 curEventType = newEvent._type;
|
||||
TimelineEventType curEventType = newEvent._type;
|
||||
if ((curEventType > (kDMEventTypeGroupReactionDangerOnSquare - 1)) && (curEventType < (kDMEventTypeUpdateBehavior3 + 1)))
|
||||
_vm->_groupMan->processEvents29to41(newEvent._Bu._location._mapX, newEvent._Bu._location._mapY, curEventType, newEvent._Cu._ticks);
|
||||
else {
|
||||
@ -974,7 +974,7 @@ void Timeline::loadEventsPart(Common::InSaveFile *file) {
|
||||
for (uint16 i = 0; i < _eventMaxCount; ++i) {
|
||||
TimelineEvent *event = &_events[i];
|
||||
event->_mapTime = file->readSint32BE();
|
||||
event->_type = file->readByte();
|
||||
event->_type = (TimelineEventType)file->readByte();
|
||||
event->_priority = file->readByte();
|
||||
event->_Bu._location._mapX = file->readByte();
|
||||
event->_Bu._location._mapY = file->readByte();
|
||||
|
@ -101,7 +101,7 @@ enum TimelineEventType {
|
||||
class TimelineEvent {
|
||||
public:
|
||||
int32 _mapTime;
|
||||
byte _type;
|
||||
TimelineEventType _type;
|
||||
byte _priority; // CHECKME: byte? or int16? Inconsistency in the code
|
||||
|
||||
uint16 getTypePriority() { return (_type << 8) + _priority; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user