[Scummvm-cvs-logs] scummvm master -> 2e4f64066da7c08edcd17b5c66c6463887b836b4

eriktorbjorn eriktorbjorn at telia.com
Mon May 27 07:10:13 CEST 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2e4f64066d NEVERHOOD: Fix invalid memory access in navigation scenes


Commit: 2e4f64066da7c08edcd17b5c66c6463887b836b4
    https://github.com/scummvm/scummvm/commit/2e4f64066da7c08edcd17b5c66c6463887b836b4
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2013-05-26T21:48:23-07:00

Commit Message:
NEVERHOOD: Fix invalid memory access in navigation scenes

When a new Smacker is opened, the old Smacker surface is deleted
and a new one is created. Therefore, it has to be removed from the
scene and the new one has to be added.

Changed paths:
    engines/neverhood/navigationscene.cpp
    engines/neverhood/navigationscene.h



diff --git a/engines/neverhood/navigationscene.cpp b/engines/neverhood/navigationscene.cpp
index d802322..9752ee6 100644
--- a/engines/neverhood/navigationscene.cpp
+++ b/engines/neverhood/navigationscene.cpp
@@ -69,7 +69,7 @@ int NavigationScene::getNavigationAreaType() {
 void NavigationScene::update() {
 	if (_smackerFileHash != 0) {
 		showMouse(false);
-		_smackerPlayer->open(_smackerFileHash, false);
+		openSmacker(_smackerFileHash, false);
 		_vm->_screen->clear();
 		_vm->_screen->setSmackerDecoder(_smackerPlayer->getSmackerDecoder());
 		_smackerDone = false;
@@ -92,7 +92,7 @@ void NavigationScene::update() {
 			_vm->_soundMan->setTwoSoundsPlayFlag(false);
 			_vm->_soundMan->setSoundThreePlayFlag(false);
 			_smackerDone = false;
-			_smackerPlayer->open(navigationItem.fileHash, true);
+			openSmacker(navigationItem.fileHash, true);
 			_vm->_screen->clear();
 			_vm->_screen->setSmackerDecoder(_smackerPlayer->getSmackerDecoder());
 			sendMessage(_parentModule, 0x100A, _navigationIndex);
@@ -101,6 +101,13 @@ 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:
diff --git a/engines/neverhood/navigationscene.h b/engines/neverhood/navigationscene.h
index ebe9a35..767b3f5 100644
--- a/engines/neverhood/navigationscene.h
+++ b/engines/neverhood/navigationscene.h
@@ -50,6 +50,7 @@ protected:
 	bool _leaveSceneAfter;
 	const byte *_itemsTypes;
 	void update();
+	void openSmacker(uint32 fileHash, bool keepLastFrame);
 	uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
 	void createMouseCursor();
 	void handleNavigation(const NPoint &mousePos);






More information about the Scummvm-git-logs mailing list