diff options
author | Paul Gilbert | 2014-08-16 10:33:03 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-08-16 10:33:03 -0400 |
commit | dc5500e2464d3457d9dee70993ecd4340963946e (patch) | |
tree | f304fa53c90a9adc09077b638fd5fa95760aa332 /engines/access | |
parent | b3ab8a42a6bf77d99b6b349793f1fa7393359d24 (diff) | |
download | scummvm-rg350-dc5500e2464d3457d9dee70993ecd4340963946e.tar.gz scummvm-rg350-dc5500e2464d3457d9dee70993ecd4340963946e.tar.bz2 scummvm-rg350-dc5500e2464d3457d9dee70993ecd4340963946e.zip |
ACCESS: Cleanup of timer flags and some inventory logic
Diffstat (limited to 'engines/access')
-rw-r--r-- | engines/access/access.cpp | 1 | ||||
-rw-r--r-- | engines/access/access.h | 3 | ||||
-rw-r--r-- | engines/access/amazon/amazon_game.cpp | 1 | ||||
-rw-r--r-- | engines/access/amazon/amazon_room.cpp | 2 | ||||
-rw-r--r-- | engines/access/data.cpp | 19 | ||||
-rw-r--r-- | engines/access/data.h | 19 | ||||
-rw-r--r-- | engines/access/inventory.cpp | 10 | ||||
-rw-r--r-- | engines/access/inventory.h | 2 | ||||
-rw-r--r-- | engines/access/player.cpp | 6 | ||||
-rw-r--r-- | engines/access/room.cpp | 1 |
10 files changed, 54 insertions, 10 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp index d6f19924b7..6a61527ef9 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -75,7 +75,6 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc) _newDate = 0; _intTim[3] = 0; _timer[3] = 0; - _timerFlag = false; Common::fill(&_objectsTable[0], &_objectsTable[100], (SpriteResource *)nullptr); Common::fill(&_establishTable[0], &_establishTable[100], 0); Common::fill(&_flags[0], &_flags[256], 0); diff --git a/engines/access/access.h b/engines/access/access.h index 81b1185922..105b00b0ff 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -124,7 +124,7 @@ public: int _establishMode; int _establishGroup; int _numAnimTimers; - Common::Array<TimerEntry> _timers; + TimerList _timers; Common::Array<Common::Rect> _newRects; Common::Array<Common::Rect> _oldRects; Common::Array<ExtraCell> _extraCells; @@ -161,7 +161,6 @@ public: uint32 _newDate; int _intTim[3]; int _timer[3]; - bool _timerFlag; int _flags[256]; byte _help1[366]; byte _help2[366]; diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp index 36d6d80e47..1b824ac730 100644 --- a/engines/access/amazon/amazon_game.cpp +++ b/engines/access/amazon/amazon_game.cpp @@ -176,7 +176,6 @@ void AmazonEngine::setupGame() { _player->_roomNumber = 4; _player->_playerX = _player->_rawPlayer.x = TRAVEL_POS[_player->_roomNumber][0]; _player->_playerY = _player->_rawPlayer.y = TRAVEL_POS[_player->_roomNumber][1]; - _room->_selectCommand = -1; } } // End of namespace Amazon diff --git a/engines/access/amazon/amazon_room.cpp b/engines/access/amazon/amazon_room.cpp index cb6c8140ef..405889fe1a 100644 --- a/engines/access/amazon/amazon_room.cpp +++ b/engines/access/amazon/amazon_room.cpp @@ -83,7 +83,7 @@ void AmazonRoom::reloadRoom1() { _vm->_normalMouse = 1; _vm->_mouseMode = 0; _vm->_boxSelect = true; - _vm->_player->_playerOff = 0; + _vm->_player->_playerOff = false; _vm->_screen->fadeOut(); _vm->_screen->clearScreen(); diff --git a/engines/access/data.cpp b/engines/access/data.cpp index c3a6bb3d90..f5dbbb367f 100644 --- a/engines/access/data.cpp +++ b/engines/access/data.cpp @@ -25,4 +25,23 @@ namespace Access { +TimerList::TimerList() : Common::Array<TimerEntry>() { + _timersSavedFlag = false; +} + +void TimerList::saveTimers() { + if (!_timersSavedFlag /* && !_flashbackFlag */) { + _savedTimers = *this; + _timersSavedFlag = true; + } +} + +void TimerList::restoreTimers() { + if (_timersSavedFlag /* && !_flashbackFlag */) { + clear(); + *static_cast<Common::Array<TimerEntry> *>(this) = _savedTimers; + _timersSavedFlag = false; + } +} + } // End of namespace Access diff --git a/engines/access/data.h b/engines/access/data.h index b9da858216..67b9cfe9fd 100644 --- a/engines/access/data.h +++ b/engines/access/data.h @@ -51,6 +51,25 @@ struct TimerEntry { } }; +class TimerList : public Common::Array<TimerEntry> { +private: + Common::Array<TimerEntry> _savedTimers; +public: + bool _timersSavedFlag; +public: + TimerList(); + + /** + * Save a copy of all current timers + */ + void saveTimers(); + + /** + * Resetore the set of previously saved timers + */ + void restoreTimers(); +}; + class ExtraCell { public: int _vidTable; diff --git a/engines/access/inventory.cpp b/engines/access/inventory.cpp index e784b873c9..15668b0bc2 100644 --- a/engines/access/inventory.cpp +++ b/engines/access/inventory.cpp @@ -30,6 +30,8 @@ InventoryManager::InventoryManager(AccessEngine *vm) : Manager(vm) { _startInvItem = 0; _startInvBox = 0; _invChangeFlag = true; + _invRefreshFlag = false; + _invModeFlag = false; _startAboutItem = 0; _startTravelItem = 0; @@ -59,11 +61,15 @@ void InventoryManager::setUseItem(int itemId) { } void InventoryManager::refreshInventory() { - error("TODO: refreshInventory"); + if (_vm->_screen->_vesaMode) { + _invRefreshFlag = true; + newDisplayInv(); + } } int InventoryManager::newDisplayInv() { - error("TODO: newDisplayInv"); + warning("TODO: newDisplayInv"); + return 0; } diff --git a/engines/access/inventory.h b/engines/access/inventory.h index 399c763483..dddfe2eda1 100644 --- a/engines/access/inventory.h +++ b/engines/access/inventory.h @@ -38,6 +38,8 @@ public: int _startInvItem; int _startInvBox; bool _invChangeFlag; + bool _invRefreshFlag; + bool _invModeFlag; int _startAboutItem; int _startTravelItem; public: diff --git a/engines/access/player.cpp b/engines/access/player.cpp index 0e005f936e..72cafde243 100644 --- a/engines/access/player.cpp +++ b/engines/access/player.cpp @@ -181,9 +181,9 @@ void Player::walk() { _collideFlag = false; _playerDirection = NONE; - if (_playerOff != 0) + if (_playerOff) return; - else if (_vm->_timerFlag) { + else if (_vm->_timers[0]._flag) { plotCom3(); return; } @@ -640,7 +640,7 @@ void Player::plotCom1() { } void Player::plotCom2() { - if (_playerOff != 1) + if (!_playerOff) _vm->_images.addToList(this); } diff --git a/engines/access/room.cpp b/engines/access/room.cpp index 773a42b9d4..cf8da17f05 100644 --- a/engines/access/room.cpp +++ b/engines/access/room.cpp @@ -37,6 +37,7 @@ Room::Room(AccessEngine *vm) : Manager(vm) { _tile = nullptr; _selectCommand = 0; _conFlag = false; + _selectCommand = -1; } Room::~Room() { |