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

Strangerke Strangerke at scummvm.org
Fri Oct 10 20:16:07 CEST 2014


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:
f553a48329 PRINCE: Reduce the scope of several variables in Hero


Commit: f553a48329d1fc2fbea8c10ff37d7e51467d1e0b
    https://github.com/scummvm/scummvm/commit/f553a48329d1fc2fbea8c10ff37d7e51467d1e0b
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-10-10T20:13:26+02:00

Commit Message:
PRINCE: Reduce the scope of several variables in Hero

Changed paths:
    engines/prince/hero.cpp



diff --git a/engines/prince/hero.cpp b/engines/prince/hero.cpp
index 8c13c6d..06fba25 100644
--- a/engines/prince/hero.cpp
+++ b/engines/prince/hero.cpp
@@ -109,9 +109,9 @@ uint16 Hero::getData(AttrId dataId) {
 }
 
 int Hero::getScaledValue(int size) {
-	int newSize = 0;
 	int16 initScaleValue = _vm->_scaleValue;
 	if (_vm->_scaleValue != 10000) {
+		int newSize = 0;
 		for (int i = 0; i < size; i++) {
 			initScaleValue -= 100;
 			if (initScaleValue >= 0) {
@@ -271,10 +271,6 @@ void Hero::showHeroShadow(Graphics::Surface *screen, DrawNode *drawNode) {
 
 		// linear_loop
 		for (int i = 0; i < heroSurfaceHeight; i++) {
-			int shadSkipX = 0;
-			int ctLoop = 0;
-			int sprModulo = 0;
-
 			int j;
 			//retry_line:
 			for (j = heroSurfaceHeight - i; j > 0; j--) {
@@ -296,10 +292,14 @@ void Hero::showHeroShadow(Graphics::Surface *screen, DrawNode *drawNode) {
 				break;
 			}
 
-			bool skipLineFlag = false;
 			//line_y_ok
 			if (shadLastY != shadPosY && shadPosY >= 0 && shadPosY < 480 && shadPosX < 640) {
 				shadLastY = shadPosY;
+				bool skipLineFlag = false;
+				int shadSkipX = 0;
+				int ctLoop = 0;
+				int sprModulo = 0;
+
 				if (shadPosX < 0) {
 					shadSkipX = -1 * shadPosX;
 					if (heroSurfaceWidth > shadSkipX) {
@@ -746,17 +746,15 @@ void Hero::showHero() {
 			}
 		}
 
-		int x, y, dir;
-
 		if (_state == kHeroStateMove || _state == kHeroStateRun) {
 			//go_for_it:
 			while (1) {
 				if (_currCoords != nullptr) {
 					if (READ_LE_UINT32(_currCoords) != 0xFFFFFFFF) {
-						x = READ_LE_UINT16(_currCoords);
-						y = READ_LE_UINT16(_currCoords + 2);
+						int x = READ_LE_UINT16(_currCoords);
+						int y = READ_LE_UINT16(_currCoords + 2);
 						_currCoords += 4;
-						dir = *_currDirTab;
+						int dir = *_currDirTab;
 						_currDirTab++;
 						if (_lastDirection != dir) {
 							_phase = 0;






More information about the Scummvm-git-logs mailing list