diff options
author | Denis Kasak | 2009-08-05 17:58:14 +0000 |
---|---|---|
committer | Denis Kasak | 2009-08-05 17:58:14 +0000 |
commit | e63210616972e59d6e9e98989c489cbf760bcb79 (patch) | |
tree | 46d77b818e1bda5da3dc053fd4674d1d80a94998 /engines/draci | |
parent | 1363a0680a564c356f497d0e90aefeef5f426f76 (diff) | |
download | scummvm-rg350-e63210616972e59d6e9e98989c489cbf760bcb79.tar.gz scummvm-rg350-e63210616972e59d6e9e98989c489cbf760bcb79.tar.bz2 scummvm-rg350-e63210616972e59d6e9e98989c489cbf760bcb79.zip |
* Made some type changes to struct/class members in game.cpp (uint -> int and uint16 -> uint)
* Added enum constant kNoEscRoom for rooms that have no escape room defined
* Fixed crash when ESC is pressed in rooms which have no escape room defined
* Renamed kNotFound (used as a return value for Game::getObjectWithAnimation) to kObjectNotFound for clarity.
svn-id: r43072
Diffstat (limited to 'engines/draci')
-rw-r--r-- | engines/draci/draci.cpp | 11 | ||||
-rw-r--r-- | engines/draci/game.cpp | 4 | ||||
-rw-r--r-- | engines/draci/game.h | 37 |
3 files changed, 33 insertions, 19 deletions
diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp index 87408dbccf..aea3938f24 100644 --- a/engines/draci/draci.cpp +++ b/engines/draci/draci.cpp @@ -202,9 +202,14 @@ bool DraciEngine::handleEvents() { _game->_roomChange = true; } else if (event.kbd.keycode == Common::KEYCODE_ESCAPE) { - _game->setRoomNum(_game->getEscRoom()); - _game->setGateNum(0); - _game->_roomChange = true; + int escRoom = _game->getEscRoom(); + + // Check if there is an escape room defined for the current room + if (escRoom != kNoEscRoom) { + _game->setRoomNum(_game->getEscRoom()); + _game->setGateNum(0); + _game->_roomChange = true; + } } // Show walking map toggle else if (event.kbd.keycode == Common::KEYCODE_w) { diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index e9714d6124..d8152b0fcb 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -264,7 +264,7 @@ void Game::loop() { // If there is an object under the cursor, display its title and enable // executing its look and use scripts - if (curObject != kNotFound) { + if (curObject != kObjectNotFound) { // Mark dirty rectangle to update the text titleAnim->markDirtyRect(surface); @@ -337,7 +337,7 @@ int Game::getObjectWithAnimation(int animID) { } } - return kNotFound; + return kObjectNotFound; } void Game::walkHero(int x, int y) { diff --git a/engines/draci/game.h b/engines/draci/game.h index 8b8be1e9ea..c041490e04 100644 --- a/engines/draci/game.h +++ b/engines/draci/game.h @@ -43,8 +43,17 @@ enum StructSizes { personSize = sizeof(uint16) * 2 + sizeof(byte) }; + +// Used as a return value for Game::getObjectWithAnimation() if no object +// owns the animation in question +enum { + kObjectNotFound = -1 +}; + +// Used as the value of the _escRoom field of the current room if there is +// no escape room defined enum { - kNotFound = -1 + kNoEscRoom = -1 }; enum SpeechConstants { @@ -95,9 +104,9 @@ struct GameObject { bool _imInit, _imLook, _imUse; byte _walkDir; byte _z; - uint16 _lookX, _lookY, _useX, _useY; + uint _lookX, _lookY, _useX, _useY; byte _lookDir, _useDir; - uint16 _absNum; + uint _absNum; Common::Array<int> _anims; GPL2Program _program; Common::String _title; @@ -106,26 +115,26 @@ struct GameObject { }; struct GameInfo { - byte _startRoom; - byte _mapRoom; - uint16 _numObjects; - uint16 _numIcons; + int _startRoom; + int _mapRoom; + uint _numObjects; + uint _numIcons; byte _numVariables; byte _numPersons; byte _numDialogs; - uint16 _maxIconWidth, _maxIconHeight; - uint16 _musicLength; - uint16 _crc[4]; - uint16 _numDialogBlocks; + uint _maxIconWidth, _maxIconHeight; + uint _musicLength; + uint _crc[4]; + uint _numDialogBlocks; }; struct Person { - uint16 _x, _y; + uint _x, _y; byte _fontColour; }; struct Room { - byte _roomNum; + int _roomNum; byte _music; WalkingMap _walkingMap; byte _palette; @@ -134,7 +143,7 @@ struct Room { bool _imInit, _imLook, _imUse; bool _mouseOn, _heroOn; double _pers0, _persStep; - byte _escRoom; + int _escRoom; byte _numGates; Common::Array<int> _gates; GPL2Program _program; |