diff options
-rw-r--r-- | engines/dm/dungeonman.h | 9 | ||||
-rw-r--r-- | engines/dm/movesens.cpp | 19 | ||||
-rw-r--r-- | engines/dm/movesens.h | 13 | ||||
-rw-r--r-- | engines/dm/timeline.cpp | 4 |
4 files changed, 20 insertions, 25 deletions
diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h index 822ea4385c..0177860dc5 100644 --- a/engines/dm/dungeonman.h +++ b/engines/dm/dungeonman.h @@ -131,15 +131,6 @@ enum TeleporterScope { kDMTeleporterScopeObjectsOrParty = 2 // @ MASK0x0002_SCOPE_OBJECTS_OR_PARTY }; -enum SensorEffect { - kDMSensorEffectNone = -1, // @ CM1_EFFECT_NONE - kDMSensorEffectSet = 0, // @ C00_EFFECT_SET - kDMSensorEffectClear = 1, // @ C01_EFFECT_CLEAR - kDMSensorEffectToggle = 2, // @ C02_EFFECT_TOGGLE - kDMSensorEffectHold = 3, // @ C03_EFFECT_HOLD - kDMSensorEffectAddExperience = 10 // @ C10_EFFECT_ADD_EXPERIENCE -}; - enum SensorType { kDMSensorDisabled = 0, // @ C000_SENSOR_DISABLED /* Never triggered, may be used for a floor or wall ornament */ kDMSensorFloorTheronPartyCreatureObj = 1, // @ C001_SENSOR_FLOOR_THERON_PARTY_CREATURE_OBJECT /* Triggered by party/thing F0276_SENSOR_ProcessThingAdditionOrRemoval */ diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp index 7445819531..1258ac740c 100644 --- a/engines/dm/movesens.cpp +++ b/engines/dm/movesens.cpp @@ -25,7 +25,6 @@ * maintainer of the Dungeon Master Encyclopaedia (http://dmweb.free.fr/) */ - #include "dm/movesens.h" #include "dm/champion.h" #include "dm/inventory.h" @@ -37,7 +36,6 @@ #include "dm/text.h" #include "dm/sounds.h" - namespace DM { MovesensMan::MovesensMan(DMEngine *vm) : _vm(vm) { @@ -89,11 +87,8 @@ bool MovesensMan::sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, uint16 continue; bool doNotTriggerSensor; - int16 sensorData = 0; - int16 sensorEffect = 0; - - sensorData = currentSensor->getData(); - sensorEffect = currentSensor->getAttrEffectA(); + int16 sensorData = currentSensor->getData(); + SensorEffect sensorEffect = (SensorEffect)currentSensor->getAttrEffectA(); switch (processedSensorType) { case kDMSensorWallOrnClick: @@ -837,7 +832,7 @@ void MovesensMan::processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing } triggerSensor ^= curSensor->getAttrRevertEffectA(); - int16 curSensorEffect = curSensor->getAttrEffectA(); + SensorEffect curSensorEffect = (SensorEffect)curSensor->getAttrEffectA(); if (curSensorEffect == kDMSensorEffectHold) curSensorEffect = triggerSensor ? kDMSensorEffectSet : kDMSensorEffectClear; else if (!triggerSensor) @@ -894,7 +889,7 @@ bool MovesensMan::isObjectInPartyPossession(int16 objectType) { return false; } -void MovesensMan::triggerEffect(Sensor *sensor, int16 effect, int16 mapX, int16 mapY, uint16 cell) { +void MovesensMan::triggerEffect(Sensor *sensor, SensorEffect effect, int16 mapX, int16 mapY, uint16 cell) { TimelineEventType squareTypeToEventTypeArray[7] = { // @ G0059_auc_Graphic562_SquareTypeToEventType k6_TMEventTypeWall, k5_TMEventTypeCorridor, @@ -910,7 +905,7 @@ void MovesensMan::triggerEffect(Sensor *sensor, int16 effect, int16 mapX, int16 int32 endTime = _vm->_gameTime + sensor->getAttrValue(); if (sensor->getAttrLocalEffect()) - triggerLocalEffect(sensor->getActionLocalEffect(), mapX, mapY, cell); + triggerLocalEffect((SensorEffect)sensor->getActionLocalEffect(), mapX, mapY, cell); else { int16 targetMapX = sensor->getActionTargetMapX(); int16 targetMapY = sensor->getActionTargetMapY(); @@ -925,9 +920,9 @@ void MovesensMan::triggerEffect(Sensor *sensor, int16 effect, int16 mapX, int16 } } -void MovesensMan::triggerLocalEffect(int16 localEffect, int16 effX, int16 effY, int16 effCell) { +void MovesensMan::triggerLocalEffect(SensorEffect localEffect, int16 effX, int16 effY, int16 effCell) { if (localEffect == kDMSensorEffectAddExperience) { - addSkillExperience(kDMSkillSteal, 300, localEffect != kDMCellAny); + addSkillExperience(kDMSkillSteal, 300, localEffect != kDMSensorEffectNone); return; } _sensorRotationEffect = localEffect; diff --git a/engines/dm/movesens.h b/engines/dm/movesens.h index 7746fcac6c..1a7e230d16 100644 --- a/engines/dm/movesens.h +++ b/engines/dm/movesens.h @@ -31,6 +31,15 @@ #include "dm/dm.h" +enum SensorEffect { + kDMSensorEffectNone = -1, // @ CM1_EFFECT_NONE + kDMSensorEffectSet = 0, // @ C00_EFFECT_SET + kDMSensorEffectClear = 1, // @ C01_EFFECT_CLEAR + kDMSensorEffectToggle = 2, // @ C02_EFFECT_TOGGLE + kDMSensorEffectHold = 3, // @ C03_EFFECT_HOLD + kDMSensorEffectAddExperience = 10 // @ C10_EFFECT_ADD_EXPERIENCE +}; + namespace DM { class Sensor; class Teleporter; @@ -61,8 +70,8 @@ public: Thing getTeleporterRotatedProjectileThing(Teleporter *teleporter, Thing projectileThing); // @ F0263_MOVE_GetTeleporterRotatedProjectileThing void processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing thing, bool partySquare, bool addThing);// @ F0276_SENSOR_ProcessThingAdditionOrRemoval bool isObjectInPartyPossession(int16 objectType); // @ F0274_SENSOR_IsObjectInPartyPossession - void triggerEffect(Sensor *sensor, int16 effect, int16 mapX, int16 mapY, uint16 cell); // @ F0272_SENSOR_TriggerEffect - void triggerLocalEffect(int16 localEffect, int16 effX, int16 effY, int16 effCell); // @ F0270_SENSOR_TriggerLocalEffect + void triggerEffect(Sensor *sensor, SensorEffect effect, int16 mapX, int16 mapY, uint16 cell); // @ F0272_SENSOR_TriggerEffect + void triggerLocalEffect(SensorEffect localEffect, int16 effX, int16 effY, int16 effCell); // @ F0270_SENSOR_TriggerLocalEffect void addSkillExperience(int16 skillIndex, uint16 exp, bool leaderOnly); // @ F0269_SENSOR_AddSkillExperience void processRotationEffect();// @ F0271_SENSOR_ProcessRotationEffect void createEventMoveGroup(Thing groupThing, int16 mapX, int16 mapY, int16 mapIndex, bool audible); // @ F0265_MOVE_CreateEvent60To61_MoveGroup diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp index fce768dff2..6d854d1ab4 100644 --- a/engines/dm/timeline.cpp +++ b/engines/dm/timeline.cpp @@ -599,7 +599,7 @@ void Timeline::processEventSquareWall(TimelineEvent *event) { int16 triggerSetEffect = ((curSensorData == 0) != curThingSensor->getAttrRevertEffectA()); _vm->_moveSens->triggerEffect(curThingSensor, triggerSetEffect ? kDMSensorEffectSet : kDMSensorEffectClear, mapX, mapY, curCell); } else if (curSensorData == 0) - _vm->_moveSens->triggerEffect(curThingSensor, curThingSensor->getAttrEffectA(), mapX, mapY, curCell); + _vm->_moveSens->triggerEffect(curThingSensor, (SensorEffect)curThingSensor->getAttrEffectA(), mapX, mapY, curCell); } } else if (curSensorType == kDMSensorWallAndOrGate) { int16 bitMask = 1 << (event->_Cu.A._cell); @@ -618,7 +618,7 @@ void Timeline::processEventSquareWall(TimelineEvent *event) { if (curThingSensor->getAttrEffectA() == kDMSensorEffectHold) _vm->_moveSens->triggerEffect(curThingSensor, triggerSetEffect ? kDMSensorEffectSet : kDMSensorEffectClear, mapX, mapY, curCell); else if (triggerSetEffect) - _vm->_moveSens->triggerEffect(curThingSensor, curThingSensor->getAttrEffectA(), mapX, mapY, curCell); + _vm->_moveSens->triggerEffect(curThingSensor, (SensorEffect)curThingSensor->getAttrEffectA(), mapX, mapY, curCell); } else if ((((curSensorType >= kDMSensorWallSingleProjLauncherNewObj) && (curSensorType <= kDMSensorWallDoubleProjLauncherExplosion)) || (curSensorType == kDMSensorWallSingleProjLauncherSquareObj) || (curSensorType == kDMSensorWallDoubleProjLauncherSquareObj)) && (curThing.getCell() == event->_Cu.A._cell)) { triggerProjectileLauncher(curThingSensor, event); if (curThingSensor->getAttrOnlyOnce()) |