Skip to content

Commit

Permalink
ACCESS: Fix the ability to switch between players
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Dec 13, 2014
1 parent 80ec09d commit 74a61d1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions engines/access/amazon/amazon_game.cpp
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion engines/access/amazon/amazon_room.cpp
Expand Up @@ -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;
}
Expand Down
9 changes: 5 additions & 4 deletions engines/access/amazon/amazon_scripts.cpp
Expand Up @@ -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) {
Expand All @@ -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();
}
}

Expand All @@ -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);
}
Expand Down

0 comments on commit 74a61d1

Please sign in to comment.