aboutsummaryrefslogtreecommitdiff
path: root/engines/neverhood/navigationscene.cpp
diff options
context:
space:
mode:
authorjohndoe1232013-06-11 11:33:05 +0200
committerjohndoe1232013-06-11 11:33:05 +0200
commitadd321c93049e006c202c67bdb0170b8bca83833 (patch)
tree6efcb8811197b861286a2a3bea2ef9e6065bf846 /engines/neverhood/navigationscene.cpp
parent19e92a09fc790dfc1da69f886b1d330a878d7e75 (diff)
downloadscummvm-rg350-add321c93049e006c202c67bdb0170b8bca83833.tar.gz
scummvm-rg350-add321c93049e006c202c67bdb0170b8bca83833.tar.bz2
scummvm-rg350-add321c93049e006c202c67bdb0170b8bca83833.zip
NEVERHOOD: Try to fix the Smacker issues inside of SmackerPlayer only (instead the numerous classes using it)
SmackerPlayer now creates a surface in the constructor and deletes it in the destructor. There will be only this surface during the lifetime of the player, so there shouldn't be any issues any more when the player is reused for different Smacker files. This is imo nicer than to remove/add the surface. I kept the several openSmacker since it wraps some code which is nice.
Diffstat (limited to 'engines/neverhood/navigationscene.cpp')
-rw-r--r--engines/neverhood/navigationscene.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/engines/neverhood/navigationscene.cpp b/engines/neverhood/navigationscene.cpp
index 9752ee618c..33e2a264a8 100644
--- a/engines/neverhood/navigationscene.cpp
+++ b/engines/neverhood/navigationscene.cpp
@@ -41,9 +41,7 @@ NavigationScene::NavigationScene(NeverhoodEngine *vm, Module *parentModule, uint
SetUpdateHandler(&NavigationScene::update);
SetMessageHandler(&NavigationScene::handleMessage);
- _smackerPlayer = new SmackerPlayer(_vm, this, (*_navigationList)[_navigationIndex].fileHash, true, true);
- addEntity(_smackerPlayer);
- addSurface(_smackerPlayer->getSurface());
+ _smackerPlayer = addSmackerPlayer(new SmackerPlayer(_vm, this, (*_navigationList)[_navigationIndex].fileHash, true, true));
createMouseCursor();
@@ -69,7 +67,7 @@ int NavigationScene::getNavigationAreaType() {
void NavigationScene::update() {
if (_smackerFileHash != 0) {
showMouse(false);
- openSmacker(_smackerFileHash, false);
+ _smackerPlayer->open(_smackerFileHash, false);
_vm->_screen->clear();
_vm->_screen->setSmackerDecoder(_smackerPlayer->getSmackerDecoder());
_smackerDone = false;
@@ -92,7 +90,7 @@ void NavigationScene::update() {
_vm->_soundMan->setTwoSoundsPlayFlag(false);
_vm->_soundMan->setSoundThreePlayFlag(false);
_smackerDone = false;
- openSmacker(navigationItem.fileHash, true);
+ _smackerPlayer->open(navigationItem.fileHash, true);
_vm->_screen->clear();
_vm->_screen->setSmackerDecoder(_smackerPlayer->getSmackerDecoder());
sendMessage(_parentModule, 0x100A, _navigationIndex);
@@ -101,13 +99,6 @@ void NavigationScene::update() {
Scene::update();
}
-void NavigationScene::openSmacker(uint32 fileHash, bool keepLastFrame) {
- // The old Smacker surface is deleted when a new Smacker is opened.
- removeSurface(_smackerPlayer->getSurface());
- _smackerPlayer->open(fileHash, keepLastFrame);
- addSurface(_smackerPlayer->getSurface());
-}
-
uint32 NavigationScene::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
switch (messageNum) {
case 0x0000: