[Scummvm-cvs-logs] scummvm master -> cfe7bf614b425671167a0b1e92418bfeb7b20bf4

digitall digitall at scummvm.org
Sat Jul 7 15:39:31 CEST 2012


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:
cfe7bf614b TOON: Remove unecessary getSystem() function.


Commit: cfe7bf614b425671167a0b1e92418bfeb7b20bf4
    https://github.com/scummvm/scummvm/commit/cfe7bf614b425671167a0b1e92418bfeb7b20bf4
Author: D G Turner (digitall at scummvm.org)
Date: 2012-07-07T06:37:15-07:00

Commit Message:
TOON: Remove unecessary getSystem() function.

This was needed due to the unecessary protected shadow variable
hiding the Engine superclass _system member variable.

Changed paths:
    engines/toon/character.cpp
    engines/toon/movie.cpp
    engines/toon/script_func.cpp
    engines/toon/toon.cpp
    engines/toon/toon.h



diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp
index e19656f..479f496 100644
--- a/engines/toon/character.cpp
+++ b/engines/toon/character.cpp
@@ -62,7 +62,7 @@ Character::Character(ToonEngine *vm) : _vm(vm) {
 	_speed = 150;   // 150 = nominal drew speed
 	_lastWalkTime = 0;
 	_numPixelToWalk = 0;
-	_nextIdleTime = _vm->getSystem()->getMillis() + (_vm->randRange(0, 600) + 300) * _vm->getTickLength();
+	_nextIdleTime = _vm->_system->getMillis() + (_vm->randRange(0, 600) + 300) * _vm->getTickLength();
 	_lineToSayId = 0;
 }
 
@@ -101,7 +101,7 @@ void Character::setFacing(int32 facing) {
 
 		int32 dir = 0;
 
-		_lastWalkTime = _vm->getSystem()->getMillis();
+		_lastWalkTime = _vm->_system->getMillis();
 		if ((_facing - facing + 8) % 8 > (facing - _facing + 8) % 8)
 			dir = 1;
 		else
@@ -188,7 +188,7 @@ bool Character::walkTo(int16 newPosX, int16 newPosY) {
 		_currentPathNode = 0;
 		stopSpecialAnim();
 
-		_lastWalkTime = _vm->getSystem()->getMillis();
+		_lastWalkTime = _vm->_system->getMillis();
 
 		_numPixelToWalk = 0;
 
@@ -220,8 +220,8 @@ bool Character::walkTo(int16 newPosX, int16 newPosY) {
 				}
 
 				// in 1/1000 pixels
-				_numPixelToWalk += _speed * (_vm->getSystem()->getMillis() - _lastWalkTime) * _scale / 1024;
-				_lastWalkTime =  _vm->getSystem()->getMillis();
+				_numPixelToWalk += _speed * (_vm->_system->getMillis() - _lastWalkTime) * _scale / 1024;
+				_lastWalkTime = _vm->_system->getMillis();
 
 				while (_numPixelToWalk >= 1000 && _currentPathNode < _currentPath.size()) {
 					_x = _currentPath[_currentPathNode].x;
@@ -356,8 +356,8 @@ void Character::update(int32 timeIncrement) {
 			}
 
 			// in 1/1000 pixels
-			_numPixelToWalk += _speed * (_vm->getSystem()->getMillis() - _lastWalkTime) * _scale / 1024;
-			_lastWalkTime =  _vm->getSystem()->getMillis();
+			_numPixelToWalk += _speed * (_vm->_system->getMillis() - _lastWalkTime) * _scale / 1024;
+			_lastWalkTime = _vm->_system->getMillis();
 
 			while (_numPixelToWalk > 1000 && _currentPathNode < _currentPath.size()) {
 				_x = _currentPath[_currentPathNode].x;
diff --git a/engines/toon/movie.cpp b/engines/toon/movie.cpp
index 8cdf923..93e41ad 100644
--- a/engines/toon/movie.cpp
+++ b/engines/toon/movie.cpp
@@ -109,40 +109,40 @@ bool Movie::playVideo(bool isFirstIntroVideo) {
 			if (frame) {
 				if (_decoder->isLowRes()) {
 					// handle manually 2x scaling here
-					Graphics::Surface* surf = _vm->getSystem()->lockScreen();
+					Graphics::Surface* surf = _vm->_system->lockScreen();
 					for (int y = 0; y < frame->h / 2; y++) {
 						memcpy(surf->getBasePtr(0, y * 2 + 0), frame->getBasePtr(0, y), frame->pitch);
 						memcpy(surf->getBasePtr(0, y * 2 + 1), frame->getBasePtr(0, y), frame->pitch);
 					}
-					_vm->getSystem()->unlockScreen();
+					_vm->_system->unlockScreen();
 				} else {
-					_vm->getSystem()->copyRectToScreen(frame->pixels, frame->pitch, 0, 0, frame->w, frame->h);
+					_vm->_system->copyRectToScreen(frame->pixels, frame->pitch, 0, 0, frame->w, frame->h);
 
 					// WORKAROUND: There is an encoding glitch in the first intro video. This hides this using the adjacent pixels.
 					if (isFirstIntroVideo) {
 						int32 currentFrame = _decoder->getCurFrame();
 						if (currentFrame >= 956 && currentFrame <= 1038) {
 							debugC(1, kDebugMovie, "Triggered workaround for glitch in first intro video...");
-							_vm->getSystem()->copyRectToScreen(frame->getBasePtr(frame->w-188, 123), frame->pitch, frame->w-188, 124, 188, 1);
-							_vm->getSystem()->copyRectToScreen(frame->getBasePtr(frame->w-188, 126), frame->pitch, frame->w-188, 125, 188, 1);
-							_vm->getSystem()->copyRectToScreen(frame->getBasePtr(0, 125), frame->pitch, 0, 126, 64, 1);
-							_vm->getSystem()->copyRectToScreen(frame->getBasePtr(0, 128), frame->pitch, 0, 127, 64, 1);
+							_vm->_system->copyRectToScreen(frame->getBasePtr(frame->w-188, 123), frame->pitch, frame->w-188, 124, 188, 1);
+							_vm->_system->copyRectToScreen(frame->getBasePtr(frame->w-188, 126), frame->pitch, frame->w-188, 125, 188, 1);
+							_vm->_system->copyRectToScreen(frame->getBasePtr(0, 125), frame->pitch, 0, 126, 64, 1);
+							_vm->_system->copyRectToScreen(frame->getBasePtr(0, 128), frame->pitch, 0, 127, 64, 1);
 						}
 					}
 				}
 			}
 			_decoder->setSystemPalette();
-			_vm->getSystem()->updateScreen();
+			_vm->_system->updateScreen();
 		}
 
 		Common::Event event;
-		while (_vm->getSystem()->getEventManager()->pollEvent(event))
+		while (_vm->_system->getEventManager()->pollEvent(event))
 			if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE)) {
 				_vm->dirtyAllScreen();
 				return false;
 			}
 
-		_vm->getSystem()->delayMillis(10);
+		_vm->_system->delayMillis(10);
 	}
 	_vm->dirtyAllScreen();
 	return !_vm->shouldQuit();
diff --git a/engines/toon/script_func.cpp b/engines/toon/script_func.cpp
index e9b7534..1fa4058 100644
--- a/engines/toon/script_func.cpp
+++ b/engines/toon/script_func.cpp
@@ -564,9 +564,9 @@ int32 ScriptFunc::sys_Cmd_Exit_Conversation(EMCState *state) {
 
 int32 ScriptFunc::sys_Cmd_Set_Mouse_Pos(EMCState *state) {
 	if (_vm->state()->_inCloseUp) {
-		_vm->getSystem()->warpMouse(stackPos(0), stackPos(1));
+		_vm->_system->warpMouse(stackPos(0), stackPos(1));
 	} else {
-		_vm->getSystem()->warpMouse(stackPos(0) - _vm->state()->_currentScrollValue, stackPos(1));
+		_vm->_system->warpMouse(stackPos(0) - _vm->state()->_currentScrollValue, stackPos(1));
 	}
 	return 0;
 }
diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp
index 0956b96..ee42765 100644
--- a/engines/toon/toon.cpp
+++ b/engines/toon/toon.cpp
@@ -820,7 +820,6 @@ Common::Error ToonEngine::run() {
 ToonEngine::ToonEngine(OSystem *syst, const ADGameDescription *gameDescription)
 	: Engine(syst), _gameDescription(gameDescription),
 	_language(gameDescription->language), _rnd("toon") {
-	_system = syst;
 	_tickLength = 16;
 	_currentPicture = NULL;
 	_inventoryPicture = NULL;
@@ -1224,7 +1223,7 @@ void ToonEngine::loadScene(int32 SceneId, bool forGameLoad) {
 		_script->init(&_sceneAnimationScripts[i]._state, _sceneAnimationScripts[i]._data);
 		if (!forGameLoad) {
 			_script->start(&_sceneAnimationScripts[i]._state, 9 + i);
-			_sceneAnimationScripts[i]._lastTimer = getSystem()->getMillis();
+			_sceneAnimationScripts[i]._lastTimer = _system->getMillis();
 			_sceneAnimationScripts[i]._frozen = false;
 			_sceneAnimationScripts[i]._frozenForConversation = false;
 		}
diff --git a/engines/toon/toon.h b/engines/toon/toon.h
index 540f3e4..d40c489 100644
--- a/engines/toon/toon.h
+++ b/engines/toon/toon.h
@@ -289,10 +289,6 @@ public:
 		return _oldTimer2;
 	}
 
-	OSystem *getSystem() {
-		return _system;
-	}
-
 	AudioManager *getAudioManager() {
 		return _audioManager;
 	}
@@ -340,7 +336,6 @@ public:
 	void clearDirtyRects();
 
 protected:
-	OSystem *_system;
 	int32 _tickLength;
 	Resources *_resources;
 	TextResource *_genericTexts;






More information about the Scummvm-git-logs mailing list