aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2014-03-25 22:07:33 -0400
committerPaul Gilbert2014-03-25 22:07:33 -0400
commit407021d245f1e0446867824c6306337f18fe8eb3 (patch)
tree6f3f7815e20661bc624cfe8e15edc744324079bd /engines
parent7b15d2e379ce6ecfc131db803fbe704caaf8d385 (diff)
downloadscummvm-rg350-407021d245f1e0446867824c6306337f18fe8eb3.tar.gz
scummvm-rg350-407021d245f1e0446867824c6306337f18fe8eb3.tar.bz2
scummvm-rg350-407021d245f1e0446867824c6306337f18fe8eb3.zip
MADS: Added a Facing enum for the player directions
Diffstat (limited to 'engines')
-rw-r--r--engines/mads/action.cpp6
-rw-r--r--engines/mads/game.cpp2
-rw-r--r--engines/mads/hotspots.cpp10
-rw-r--r--engines/mads/hotspots.h7
-rw-r--r--engines/mads/nebular/game_nebular.cpp4
-rw-r--r--engines/mads/nebular/nebular_scenes2.cpp70
-rw-r--r--engines/mads/player.cpp31
-rw-r--r--engines/mads/player.h23
-rw-r--r--engines/mads/scene.cpp4
-rw-r--r--engines/mads/scene.h2
-rw-r--r--engines/mads/scene_data.h2
11 files changed, 87 insertions, 74 deletions
diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp
index 0c20fec918..ca29527748 100644
--- a/engines/mads/action.cpp
+++ b/engines/mads/action.cpp
@@ -305,13 +305,13 @@ void MADSAction::startAction() {
if ((hs._feetPos.x == -1) || (hs._feetPos.x == -3)) {
checkCustomDest(hs._feetPos.x);
} else if (hs._feetPos.x == 0) {
- scene._destFacing = hs._facing;
+ scene._targetFacing = hs._facing;
} else if (_savedFields._actionMode == ACTIONMODE_NONE || hs._cursor >= CURSOR_WAIT) {
_startWalkFlag = true;
scene._destPos = hs._feetPos;
}
- scene._destFacing = hs._facing;
+ scene._targetFacing = hs._facing;
hotspotId = -1;
}
}
@@ -328,7 +328,7 @@ void MADSAction::startAction() {
}
}
- scene._destFacing = hs._facing;
+ scene._targetFacing = hs._facing;
}
_walkFlag = _startWalkFlag;
diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp
index f155bc81c2..6e7c530934 100644
--- a/engines/mads/game.cpp
+++ b/engines/mads/game.cpp
@@ -230,7 +230,7 @@ void Game::sectionLoop() {
// Set player data
_player._destPos = _player._playerPos;
_player._newDirection = _player._direction;
- _player._destFacing = _player._direction;
+ _player._targetFacing = _player._direction;
_player.setupFrame();
_player.updateFrame();
_player._visible3 = _player._visible;
diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp
index e082a1e3ce..22e4feb8b0 100644
--- a/engines/mads/hotspots.cpp
+++ b/engines/mads/hotspots.cpp
@@ -27,7 +27,7 @@ namespace MADS {
DynamicHotspot::DynamicHotspot() {
_seqIndex = 0;
- _facing = 0;
+ _facing = FACING_NONE;
_descId = 0;
_vocabId = 0;
_articleNumber = 0;
@@ -61,7 +61,7 @@ int DynamicHotspots::add(int descId, int vocabId, int seqIndex, const Common::Re
_entries[idx]._bounds = bounds;
_entries[idx]._feetPos.x = -3;
_entries[idx]._feetPos.y = 0;
- _entries[idx]._facing = 5;
+ _entries[idx]._facing = FACING_NONE;
_entries[idx]._vocabId = vocabId;
_entries[idx]._articleNumber = 6;
_entries[idx]._cursor = CURSOR_NONE;
@@ -75,7 +75,7 @@ int DynamicHotspots::add(int descId, int vocabId, int seqIndex, const Common::Re
return idx;
}
-int DynamicHotspots::setPosition(int index, int xp, int yp, int facing) {
+int DynamicHotspots::setPosition(int index, int xp, int yp, Facing facing) {
if (index >= 0) {
_entries[index]._feetPos.x = xp;
_entries[index]._feetPos.y = yp;
@@ -147,7 +147,7 @@ void DynamicHotspots::refresh() {
/*------------------------------------------------------------------------*/
Hotspot::Hotspot() {
- _facing = 0;
+ _facing = FACING_NONE;
_articleNumber = 0;
_cursor = CURSOR_NONE;
_vocabId = 0;
@@ -162,7 +162,7 @@ Hotspot::Hotspot(Common::SeekableReadStream &f) {
_bounds.bottom = f.readSint16LE();
_feetPos.x = f.readSint16LE();
_feetPos.y = f.readSint16LE();
- _facing = f.readByte();
+ _facing = (Facing)f.readByte();
_articleNumber = f.readByte();
_active = f.readByte() != 0;
_cursor = (CursorType)f.readByte();
diff --git a/engines/mads/hotspots.h b/engines/mads/hotspots.h
index 37c37fa1c2..a36993f1ac 100644
--- a/engines/mads/hotspots.h
+++ b/engines/mads/hotspots.h
@@ -25,6 +25,7 @@
#include "common/scummsys.h"
#include "mads/events.h"
+#include "mads/player.h"
namespace MADS {
@@ -36,7 +37,7 @@ public:
int _seqIndex;
Common::Rect _bounds;
Common::Point _feetPos;
- int _facing;
+ Facing _facing;
int _descId;
int _vocabId;
int _articleNumber;
@@ -60,7 +61,7 @@ public:
Common::Array<MADS::DynamicHotspot>::size_type size() const { return _entries.size(); }
DynamicHotspot &operator[](uint idx) { return _entries[idx]; }
int add(int descId, int vocabId, int seqIndex, const Common::Rect &bounds);
- int setPosition(int index, int xp, int yp, int facing);
+ int setPosition(int index, int xp, int yp, Facing facing);
int setCursor(int index, CursorType cursor);
void remove(int index);
void clear();
@@ -72,7 +73,7 @@ class Hotspot {
public:
Common::Rect _bounds;
Common::Point _feetPos;
- int _facing;
+ Facing _facing;
int _articleNumber;
bool _active;
CursorType _cursor;
diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp
index 76ea1f55de..f452746360 100644
--- a/engines/mads/nebular/game_nebular.cpp
+++ b/engines/mads/nebular/game_nebular.cpp
@@ -146,8 +146,8 @@ void GameNebular::initialiseGlobals() {
break;
}
- _player._direction = 8;
- _player._newDirection = 8;
+ _player._direction = FACING_NORTH;
+ _player._newDirection = FACING_NORTH;
loadResourceSequence("RXM", 1);
loadResourceSequence("ROX", 1);
diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp
index c4fee2be68..4cec40cd9c 100644
--- a/engines/mads/nebular/nebular_scenes2.cpp
+++ b/engines/mads/nebular/nebular_scenes2.cpp
@@ -144,7 +144,7 @@ void Scene201::enter() {
_scene->_sequences.setMsgPosition(_globals._spriteIndexes[19], Common::Point(185, 46));
int idx = _scene->_dynamicHotspots.add(1159, 209, _globals._spriteIndexes[19], Common::Rect(0, 0, 0, 0));
- _scene->_dynamicHotspots.setPosition(idx, 186, 81, 8);
+ _scene->_dynamicHotspots.setPosition(idx, 186, 81, FACING_NORTH);
_globals._v0 = 0;
@@ -152,7 +152,7 @@ void Scene201::enter() {
_game._player._playerPos = Common::Point(165, 152);
} else {
_game._player._playerPos = Common::Point(223, 149);
- _game._player._direction = 2;
+ _game._player._direction = FACING_SOUTH;
}
if (_globals[39] != 0) {
@@ -197,7 +197,7 @@ void Scene201::enter() {
_scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_FRAME_INDEX, 12, 70);
_scene->_sequences.setDepth(_globals._spriteIndexes[21], 1);
_globals._frameTime = 0;
- _game._player.startWalking(Common::Point(157, 143), 8);
+ _game._player.startWalking(Common::Point(157, 143), FACING_NORTH);
_vm->_palette->setEntry(252, 45, 63, 45);
_vm->_palette->setEntry(253, 20, 45, 20);
_scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 2, 0, 120, _game.getQuote(90));
@@ -214,7 +214,7 @@ void Scene201::step() {
if ((_globals._frameTime) && (_vm->getRandomNumber(5000) == 9)) {
_globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 5, 1, 6, 0);
int idx = _scene->_dynamicHotspots.add(351, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0));
- _scene->_dynamicHotspots.setPosition(idx, 270, 80, 6);
+ _scene->_dynamicHotspots.setPosition(idx, 270, 80, FACING_EAST);
_scene->_sequences.setDepth(_globals._spriteIndexes[20], 8);
_vm->_sound->command(14);
_globals._frameTime = 0;
@@ -368,14 +368,14 @@ void Scene202::enter() {
_scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(149, 113));
_scene->_sequences.setDepth(_globals._spriteIndexes[17], 10);
int idx = _scene->_dynamicHotspots.add(320, 13, _globals._spriteIndexes[17], Common::Rect(0, 0, 0, 0));
- _scene->_dynamicHotspots.setPosition(idx, 153, 97, 2);
+ _scene->_dynamicHotspots.setPosition(idx, 153, 97, FACING_SOUTH);
if (_globals[32] & 1) {
_globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0);
_scene->_sequences.setMsgPosition(_globals._spriteIndexes[16], Common::Point(130, 108));
_scene->_sequences.setDepth(_globals._spriteIndexes[16], 10);
idx = _scene->_dynamicHotspots.add(44, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0));
- _scene->_dynamicHotspots.setPosition(idx, 132, 97, 2);
+ _scene->_dynamicHotspots.setPosition(idx, 132, 97, FACING_SOUTH);
}
if (_globals[32] & 2) {
@@ -383,7 +383,7 @@ void Scene202::enter() {
_scene->_sequences.setMsgPosition(_globals._spriteIndexes[21], Common::Point(166, 110));
_scene->_sequences.setDepth(_globals._spriteIndexes[21], 10);
idx = _scene->_dynamicHotspots.add(44, 13, _globals._spriteIndexes[21], Common::Rect(0, 0, 0, 0));
- _scene->_dynamicHotspots.setPosition(idx, 165, 99, 2);
+ _scene->_dynamicHotspots.setPosition(idx, 165, 99, FACING_SOUTH);
}
if (_globals[32])
@@ -391,10 +391,10 @@ void Scene202::enter() {
if (_scene->_priorSceneId == 201) {
_game._player._playerPos = Common::Point(190, 91);
- _game._player._direction = 2;
+ _game._player._direction = FACING_SOUTH;
} else if (_scene->_priorSceneId != -2) {
_game._player._playerPos = Common::Point(178, 152);
- _game._player._direction = 8;
+ _game._player._direction = FACING_NORTH;
}
if (_globals[31]) {
@@ -402,7 +402,7 @@ void Scene202::enter() {
_scene->_sequences.setDepth(_globals._spriteIndexes[20], 6);
_scene->_hotspots.activate(199, false);
idx = _scene->_dynamicHotspots.add(457, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0));
- _scene->_dynamicHotspots.setPosition(idx, 246, 124, 8);
+ _scene->_dynamicHotspots.setPosition(idx, 246, 124, FACING_NORTH);
}
_game.loadQuoteSet(0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x62, 0x63, 0x64, 0x65, 0x66, 0x61, 0);
@@ -440,12 +440,12 @@ void Scene202::enter() {
if (_globals._v4) {
_scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(247, 82));
_game._player._playerPos = Common::Point(246, 124);
- _game._player._direction = 8;
+ _game._player._direction = FACING_NORTH;
_globals[41] = -1;
} else {
_scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123));
_game._player._playerPos = Common::Point(171, 122);
- _game._player._direction = 8;
+ _game._player._direction = FACING_NORTH;
}
_scene->loadAnimation(formAnimName('M', -1), 71);
@@ -456,7 +456,7 @@ void Scene202::enter() {
_scene->_sequences.setDepth(_globals._spriteIndexes[24], 1);
_scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82));
_game._player._playerPos = Common::Point(246, 124);
- _game._player._direction = 8;
+ _game._player._direction = FACING_NORTH;
}
_globals._abortVal = 0;
}
@@ -540,7 +540,7 @@ void Scene202::step() {
_globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0);
_scene->_hotspots.activate(199, false);
int idx = _scene->_dynamicHotspots.add(457, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0));
- _scene->_dynamicHotspots.setPosition(idx, 246, 124, 8);
+ _scene->_dynamicHotspots.setPosition(idx, 246, 124, FACING_NORTH);
_scene->_sequences.updateTimeout(_globals._spriteIndexes[26], _globals._spriteIndexes[20]);
_scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[26]);
_game._player._stepEnabled = true;
@@ -748,7 +748,7 @@ void Scene202::preActions() {
action->_startWalkFlag = true;
if (_globals._v4 == 0)
- _game._player.startWalking(Common::Point(171, 122), 8);
+ _game._player.startWalking(Common::Point(171, 122), FACING_NORTH);
}
}
@@ -815,7 +815,7 @@ void Scene202::actions() {
int idx = _scene->_dynamicHotspots.add(199, 79, -1, Common::Rect(241, 68, 12, 54));
warning("CHECKME: _globals._frameTime = _scene->_dynamicHotspots.setPosition(idx, 246, 124, 8);");
- _globals._frameTime = _scene->_dynamicHotspots.setPosition(idx, 246, 124, 8);
+ _globals._frameTime = _scene->_dynamicHotspots.setPosition(idx, 246, 124, FACING_NORTH);
_globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0);
_scene->_sequences.setDepth(_globals._spriteIndexes[23], 1);
_scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1);
@@ -986,13 +986,13 @@ void Scene203::setup() {
void Scene203::enter() {
if (_scene->_priorSceneId == 202) {
_game._player._playerPos = Common::Point(187, 99);
- _game._player._direction = 2;
+ _game._player._direction = FACING_SOUTH;
} else if (_scene->_priorSceneId == 209) {
_game._player._playerPos = Common::Point(308, 117);
- _game._player._direction = 4;
+ _game._player._direction = FACING_WEST;
} else if (_scene->_priorSceneId == -2) {
_game._player._playerPos = Common::Point(155, 152);
- _game._player._direction = 8;
+ _game._player._direction = FACING_NORTH;
}
_globals._v0 = 0;
@@ -1000,9 +1000,9 @@ void Scene203::enter() {
if ((_globals[34] == 0) && (_scene->_roomChanged == 0)) {
_globals._v0 = -1;
- _game._player.startWalking(Common::Point(158, 135), 2);
+ _game._player.startWalking(Common::Point(158, 135), FACING_SOUTH);
int idx = _scene->_dynamicHotspots.add(131, 396, 0, Common::Rect(0, 0, 320, 156));
- _scene->_dynamicHotspots.setPosition(idx, 155, 152, 2);
+ _scene->_dynamicHotspots.setPosition(idx, 155, 152, FACING_SOUTH);
_scene->_dynamicHotspots.setCursor(idx, CURSOR_GO_DOWN);
}
@@ -1011,7 +1011,7 @@ void Scene203::enter() {
if (_vm->getRandomNumber(1, 3) == 2) {
_globals._spriteIndexes[15] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 9, 1, 0, 0);
int idx = _scene->_dynamicHotspots.add(477, 209, _globals._spriteIndexes[15], Common::Rect(0, 0, 0, 0));
- _scene->_dynamicHotspots.setPosition(idx, -2, 0, 0);
+ _scene->_dynamicHotspots.setPosition(idx, -2, 0, FACING_NONE);
_vm->_sound->command(14);
}
}
@@ -1053,7 +1053,7 @@ void Scene203::step() {
void Scene203::preActions() {
if (_globals._v0 && !_action.isAction(0x18C, 0x83, 0)) {
- _game._player.startWalking(Common::Point(158, 136), 2);
+ _game._player.startWalking(Common::Point(158, 136), FACING_SOUTH);
_action._inProgress = false;
return;
}
@@ -1110,11 +1110,11 @@ void Scene205::enter() {
_globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 10, 0, 0, 3);
int idx = _scene->_dynamicHotspots.add(73, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0));
- _scene->_dynamicHotspots.setPosition(idx, 162, 120, 9);
+ _scene->_dynamicHotspots.setPosition(idx, 162, 120, FACING_NORTHEAST);
_globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 15, 0, 0, 0);
idx = _scene->_dynamicHotspots.add(73, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0));
- _scene->_dynamicHotspots.setPosition(idx, 162, 120, 9);
+ _scene->_dynamicHotspots.setPosition(idx, 162, 120, FACING_NORTHEAST);
_globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 9, 0, 0, 0);
_globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0);
@@ -1125,7 +1125,7 @@ void Scene205::enter() {
_globals._v3 = _scene->_frameStartTime >> 16;
_globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 1, 0, 0);
idx = _scene->_dynamicHotspots.add(269, 13, _globals._spriteIndexes[21], Common::Rect(0, 0, 0, 0));
- _scene->_dynamicHotspots.setPosition(idx, 49, 86, 8);
+ _scene->_dynamicHotspots.setPosition(idx, 49, 86, FACING_NORTH);
}
if (_game._objects[12]._roomNumber == 0) {
@@ -1224,7 +1224,7 @@ void Scene207::enter() {
_globals._frameTime = _game._player._priorTimer;
int idx = _scene->_dynamicHotspots.add(389, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0));
- _scene->_dynamicHotspots.setPosition(idx, 254, 94, 4);
+ _scene->_dynamicHotspots.setPosition(idx, 254, 94, FACING_WEST);
}
if (_globals._v5) {
@@ -1233,16 +1233,16 @@ void Scene207::enter() {
_globals._v3 = _game._player._priorTimer & 0xFFFF;
_globals._v4 = _game._player._priorTimer >> 16;
int idx = _scene->_dynamicHotspots.add(333, 13, _globals._spriteIndexes[19], Common::Rect(0, 0, 0, 0));
- _scene->_dynamicHotspots.setPosition(idx, 59, 132, 2);
+ _scene->_dynamicHotspots.setPosition(idx, 59, 132, FACING_SOUTH);
}
_globals._v2 = 0;
if (_scene->_priorSceneId == 211) {
_game._player._playerPos = Common::Point(13, 105);
- _game._player._direction = 6;
+ _game._player._direction = FACING_EAST;
} else if (_scene->_priorSceneId == 214) {
_game._player._playerPos = Common::Point(164, 117);
- _game._player._direction = 2;
+ _game._player._direction = FACING_SOUTH;
} else if (_scene->_priorSceneId != -2) {
_game._player._playerPos = Common::Point(305, 131);
}
@@ -1386,16 +1386,16 @@ void Scene208::enter() {
if (_scene->_priorSceneId == 207) {
_game._player._playerPos = Common::Point(8, 122);
- _game._player._direction = 6;
+ _game._player._direction = FACING_EAST;
} else if (_scene->_priorSceneId == 203) {
_game._player._playerPos = Common::Point(142, 108);
- _game._player._direction = 2;
+ _game._player._direction = FACING_SOUTH;
} else if (_scene->_priorSceneId == 209) {
_game._player._playerPos = Common::Point(307, 123);
- _game._player._direction = 4;
+ _game._player._direction = FACING_WEST;
} else if (_scene->_priorSceneId != -2) {
_game._player._playerPos = Common::Point(162, 149);
- _game._player._direction = 8;
+ _game._player._direction = FACING_NORTH;
}
_game.loadQuoteSet(0x81, 0x46, 0);
@@ -1484,7 +1484,7 @@ void Scene208::actions() {
if (_game._player._stepEnabled) {
_game._player._stepEnabled = false;
_globals._v0 = true;
- _game._player.startWalking(Common::Point(20, 148), 6);
+ _game._player.startWalking(Common::Point(20, 148), FACING_EAST);
}
} else if (_action.isAction(0x7, 0x35, 0x1A9)) {
warning("TODO: sub3B282(4);");
diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp
index 1e886ae704..03d03cb4a8 100644
--- a/engines/mads/player.cpp
+++ b/engines/mads/player.cpp
@@ -34,9 +34,9 @@ const int Player::_directionListIndexes[32] = {
Player::Player(MADSEngine *vm): _vm(vm) {
_action = nullptr;
- _direction = 8;
- _newDirection = 8;
- _destFacing = 0;
+ _direction = FACING_NORTH;
+ _newDirection = FACING_NORTH;
+ _targetFacing = FACING_NORTH;
_spritesLoaded = false;
_spritesStart = 0;
_spritesIdx = 0;
@@ -72,7 +72,7 @@ Player::Player(MADSEngine *vm): _vm(vm) {
void Player::reset() {
_action = &_vm->_game->_scene._action;
_destPos = _playerPos;
- _destFacing = 5;
+ _targetFacing = FACING_NONE;
_newDirection = _direction;
_moving = false;
_newSceneId = _v844BE = 0;
@@ -132,8 +132,8 @@ bool Player::loadSprites(const Common::String &prefix) {
}
void Player::turnToDestFacing() {
- if (_destFacing != 5)
- _newDirection = _destFacing;
+ if (_targetFacing != 5)
+ _newDirection = _targetFacing;
}
void Player::dirChanged() {
@@ -165,7 +165,8 @@ void Player::dirChanged() {
if (diff == 0)
diff = newDir - newDir2;
- _direction = (diff >= 0) ? _directionListIndexes[_direction + 20] : _directionListIndexes[_direction + 10];
+ _direction = (diff >= 0) ? (Facing)_directionListIndexes[_direction + 20] :
+ (Facing)_directionListIndexes[_direction + 10];
setupFrame();
if ((_direction == _newDirection) && !_moving)
updateFrame();
@@ -330,13 +331,13 @@ void Player::resetActionList() {
_unk3 = 0;
}
-void Player::setDest(const Common::Point &pt, int facing) {
+void Player::setDest(const Common::Point &pt, Facing facing) {
Scene &scene = _vm->_game->_scene;
resetActionList();
setTicksAmount();
_moving = true;
- _destFacing = facing;
+ _targetFacing = facing;
scene._sceneInfo->setRouteNode(scene._sceneInfo->_nodes.size() - 2,
_playerPos, scene._depthSurface);
@@ -359,14 +360,14 @@ void Player::setDest(const Common::Point &pt, int facing) {
}
}
-void Player::startWalking(const Common::Point &pos, int direction) {
+void Player::startWalking(const Common::Point &pos, Facing direction) {
Scene &scene = _vm->_game->_scene;
reset();
scene._action._startWalkFlag = true;
scene._action._walkFlag = true;
scene._destPos = pos;
- scene._destFacing = direction;
+ scene._targetFacing = direction;
}
void Player::nextFrame() {
@@ -716,14 +717,14 @@ void Player::startMovement() {
switch (majorDir) {
case 1:
- _newDirection = (_yDirection <= 0) ? 8 : 2;
+ _newDirection = (_yDirection <= 0) ? FACING_NORTH : FACING_SOUTH;
break;
case 2: {
- _newDirection = ((_yDirection <= 0) ? 9 : 3) - ((_xDirection <= 0) ? 2 : 0);
- break;
+ _newDirection = (Facing)(((_yDirection <= 0) ? 9 : 3) - ((_xDirection <= 0) ? 2 : 0));
+ break;
}
case 3:
- _newDirection = (_xDirection <= 0) ? 4 : 6;
+ _newDirection = (_xDirection <= 0) ? FACING_WEST : FACING_EAST;
break;
default:
break;
diff --git a/engines/mads/player.h b/engines/mads/player.h
index d7e074afc8..6daacd99ab 100644
--- a/engines/mads/player.h
+++ b/engines/mads/player.h
@@ -29,9 +29,20 @@
namespace MADS {
class MADSEngine;
-class Action;
+class MADSAction;
#define PLAYER_SPRITES_FILE_COUNT 8
+#define MAX_ROUTE_NODES 22
+
+/**
+ * Player facings
+ */
+enum Facing {
+ FACING_NORTH = 8, FACING_SOUTH = 2, FACING_EAST = 6, FACING_WEST = 4,
+ FACING_NORTHEAST = 9, FACING_SOUTHEAST = 3,
+ FACING_SOUTHWEST = 1, FACING_NORTHWEST = 7,
+ FACING_NONE = 5
+};
class Player {
private:
@@ -94,10 +105,10 @@ private:
public:
MADSAction *_action;
- int _direction;
- int _newDirection;
+ Facing _direction;
+ Facing _newDirection;
int _xDirection, _yDirection;
- int _destFacing;
+ Facing _targetFacing;
bool _spritesLoaded;
int _spritesStart;
int _spritesIdx;
@@ -151,9 +162,9 @@ public:
void idle();
- void setDest(const Common::Point &pt, int facing);
+ void setDest(const Common::Point &pt, Facing facing);
- void startWalking(const Common::Point &pos, int direction);
+ void startWalking(const Common::Point &pos, Facing direction);
void nextFrame();
diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp
index 1b3143f60e..6a42ed9005 100644
--- a/engines/mads/scene.cpp
+++ b/engines/mads/scene.cpp
@@ -42,7 +42,7 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm),
_depthStyle = 0;
_roomChanged = false;
_reloadSceneFlag = false;
- _destFacing = 0;
+ _targetFacing = FACING_NONE;
_freeAnimationFlag = false;
_animationData = nullptr;
_activeAnimation = nullptr;
@@ -504,7 +504,7 @@ void Scene::doAction() {
void Scene::checkStartWalk() {
if (_action._startWalkFlag && _action._walkFlag) {
- _vm->_game->_player.setDest(_destPos, _destFacing);
+ _vm->_game->_player.setDest(_destPos, _targetFacing);
_action._startWalkFlag = false;
}
}
diff --git a/engines/mads/scene.h b/engines/mads/scene.h
index e2eec23477..ee1a0c7853 100644
--- a/engines/mads/scene.h
+++ b/engines/mads/scene.h
@@ -119,7 +119,7 @@ public:
bool _roomChanged;
bool _reloadSceneFlag;
Common::Point _destPos;
- int _destFacing;
+ Facing _targetFacing;
Common::Point _posAdjust;
uint32 _frameStartTime;
Layer _layer;
diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h
index 8f03783460..d7c008b66d 100644
--- a/engines/mads/scene_data.h
+++ b/engines/mads/scene_data.h
@@ -32,6 +32,7 @@
#include "mads/assets.h"
#include "mads/events.h"
#include "mads/game_data.h"
+#include "mads/hotspots.h"
#include "mads/messages.h"
#include "mads/user_interface.h"
@@ -45,7 +46,6 @@ class SpriteSlot;
#define MADS_SCENE_HEIGHT 156
#define DEPTH_BANDS_SIZE 15
-#define MAX_ROUTE_NODES 22
#define SPRITE_SLOTS_MAX_SIZE 50
#define TEXT_DISPLAY_MAX_SIZE 40