From 74a61d1118df5c54b2ad75f6068328d8a6d54bec Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Nov 2014 17:31:43 -0500 Subject: ACCESS: Fix the ability to switch between players --- engines/access/amazon/amazon_game.cpp | 6 +++--- engines/access/amazon/amazon_room.cpp | 2 +- engines/access/amazon/amazon_scripts.cpp | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp index 5c7a3edca2..657458fa44 100644 --- a/engines/access/amazon/amazon_game.cpp +++ b/engines/access/amazon/amazon_game.cpp @@ -79,12 +79,12 @@ AmazonEngine::AmazonEngine(OSystem *syst, const AccessGameDescription *gameDesc) } AmazonEngine::~AmazonEngine() { - delete _inactive._spritesPtr; + delete _inactive._altSpritesPtr; } void AmazonEngine::freeInactivePlayer() { - delete _inactive._spritesPtr; - _inactive._spritesPtr = nullptr; + delete _inactive._altSpritesPtr; + _inactive._altSpritesPtr = nullptr; } void AmazonEngine::playGame() { diff --git a/engines/access/amazon/amazon_room.cpp b/engines/access/amazon/amazon_room.cpp index 262a6caa87..3381688356 100644 --- a/engines/access/amazon/amazon_room.cpp +++ b/engines/access/amazon/amazon_room.cpp @@ -78,7 +78,7 @@ void AmazonRoom::reloadRoom1() { if (_vm->_player->_roomNumber == 29 || _vm->_player->_roomNumber == 31 || _vm->_player->_roomNumber == 42 || _vm->_player->_roomNumber == 44) { Resource *spriteData = _vm->_files->loadFile("MAYA.LZ"); - _game->_inactive._spritesPtr = new SpriteResource(_vm, spriteData); + _game->_inactive._altSpritesPtr = new SpriteResource(_vm, spriteData); delete spriteData; _vm->_currentCharFlag = false; } diff --git a/engines/access/amazon/amazon_scripts.cpp b/engines/access/amazon/amazon_scripts.cpp index 8a92dd6994..e4c58c9eb5 100644 --- a/engines/access/amazon/amazon_scripts.cpp +++ b/engines/access/amazon/amazon_scripts.cpp @@ -1558,9 +1558,7 @@ void AmazonScripts::plotInactive() { if (_game->_charSegSwitch) { _game->_currentCharFlag = true; - SpriteResource *tmp = inactive._spritesPtr; - inactive._spritesPtr = player._playerSprites; - player._playerSprites = tmp; + SWAP(inactive._altSpritesPtr, player._playerSprites); _game->_charSegSwitch = false; } else if (_game->_jasMayaFlag != (_game->_currentCharFlag ? 1 : 0)) { if (player._playerOff) { @@ -1575,6 +1573,9 @@ void AmazonScripts::plotInactive() { player._rawPlayer.y = tmpY; _game->_inactiveYOff = player._playerOffset.y; player.calcManScale(); + + SWAP(inactive._altSpritesPtr, player._playerSprites); + _vm->_room->setWallCodes(); } } @@ -1595,7 +1596,7 @@ void AmazonScripts::plotInactive() { inactive._position.x = _game->_rawInactiveX; inactive._position.y = _game->_rawInactiveY - _game->_inactiveYOff; inactive._offsetY = _game->_inactiveYOff; - inactive._frameNumber = 0; + inactive._spritesPtr = inactive._altSpritesPtr; _vm->_images.addToList(_game->_inactive); } -- cgit v1.2.3