[Scummvm-cvs-logs] scummvm master -> 3c1c080c3a236ca9aac40d7f04f82b57ec879cbe

Strangerke Strangerke at scummvm.org
Fri Jun 6 23:20:05 CEST 2014


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

Summary:
b830b8498f CRUISE: Disable a bit more efficiently some code in Op_Random() and Op_PlayFx()
ec0d6b916d CRUISE: Reduce the scope of several variables in processActorWalk()
23abf274a7 CRUISE: Fix CppCheck warnings in gfxModule
8cb50b52e0 CRUISE: Reduce the scope of some more variables
3dcfa95b44 Merge branch 'master' of github.com:scummvm/scummvm
3c1c080c3a CRUISE: Fix some more CppCheck warnings


Commit: b830b8498fcbf4a8a8fc3cba466c44f03602c25c
    https://github.com/scummvm/scummvm/commit/b830b8498fcbf4a8a8fc3cba466c44f03602c25c
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-06-06T22:40:29+02:00

Commit Message:
CRUISE: Disable a bit more efficiently some code in Op_Random() and Op_PlayFx()

Changed paths:
    engines/cruise/function.cpp



diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp
index a026bbe..8833efc 100644
--- a/engines/cruise/function.cpp
+++ b/engines/cruise/function.cpp
@@ -196,13 +196,22 @@ int16 Op_Random() {
 
 int16 Op_PlayFX() {
 	int volume = popVar();
+
+#if 0
 	int speed = popVar();
-	/*int channelNum = */popVar();
+	int channelNum = popVar();
+#else
+	popVar();
+	popVar();
+#endif
+
 	int sampleNum = popVar();
 
 	if ((sampleNum >= 0) && (sampleNum < NUM_FILE_ENTRIES) && (filesDatabase[sampleNum].subData.ptr)) {
+#if 0
 		if (speed == -1)
 			speed = filesDatabase[sampleNum].subData.transparency;
+#endif
 
 		_vm->sound().playSound(filesDatabase[sampleNum].subData.ptr,
 			filesDatabase[sampleNum].width, volume);
@@ -213,13 +222,23 @@ int16 Op_PlayFX() {
 
 int16 Op_LoopFX() {
 	int volume = popVar();
+
+#if 0
 	int speed = popVar();
-	/*int channelNum = */popVar();
+	int channelNum = popVar();
+#else
+	popVar();
+	popVar();
+#endif
+
 	int sampleNum = popVar();
 
 	if ((sampleNum >= 0) && (sampleNum < NUM_FILE_ENTRIES) && (filesDatabase[sampleNum].subData.ptr)) {
+
+#if 0
 		if (speed == -1)
 			speed = filesDatabase[sampleNum].subData.transparency;
+#endif
 
 		_vm->sound().playSound(filesDatabase[sampleNum].subData.ptr,
 			filesDatabase[sampleNum].width, volume);
@@ -552,15 +571,13 @@ int16 Op_LoadFrame() {
 }
 
 int16 Op_LoadAbs() {
-	int slot;
-	char name[36] = "";
-	char *ptr;
 	int result = 0;
 
-	ptr = (char *) popPtr();
-	slot = popVar();
+	char *ptr = (char *) popPtr();
+	int slot = popVar();
 
 	if ((slot >= 0) && (slot < NUM_FILE_ENTRIES)) {
+		char name[36] = "";
 		Common::strlcpy(name, ptr, sizeof(name));
 		strToUpper(name);
 
@@ -1360,12 +1377,11 @@ int16 Op_RestoreSong() {
 }
 
 int16 Op_SongSize() {
-	int size, oldSize;
-
+	int oldSize;
 	if (_vm->sound().songLoaded()) {
 		oldSize = _vm->sound().numOrders();
 
-		size = popVar();
+		int size = popVar();
 		if ((size >= 1) && (size < 128))
 			_vm->sound().setNumOrders(size);
 	} else
@@ -1495,8 +1511,6 @@ int16 Op_Itoa() {
 	int nbp = popVar();
 	int param[160];
 	char txt[40];
-	char format[30];
-	char nbf[20];
 
 	for (int i = nbp - 1; i >= 0; i--)
 		param[i] = popVar();
@@ -1507,6 +1521,8 @@ int16 Op_Itoa() {
 	if (!nbp)
 		sprintf(txt, "%d", val);
 	else {
+		char format[30];
+		char nbf[20];
 		strcpy(format, "%");
 		sprintf(nbf, "%d", param[0]);
 		strcat(format, nbf);


Commit: ec0d6b916ddc2dd5bd232a2909b4a035eea4a4c8
    https://github.com/scummvm/scummvm/commit/ec0d6b916ddc2dd5bd232a2909b4a035eea4a4c8
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-06-06T22:41:44+02:00

Commit Message:
CRUISE: Reduce the scope of several variables in processActorWalk()

Changed paths:
    engines/cruise/perso.cpp



diff --git a/engines/cruise/perso.cpp b/engines/cruise/perso.cpp
index 3a599bc..66c9718 100644
--- a/engines/cruise/perso.cpp
+++ b/engines/cruise/perso.cpp
@@ -172,23 +172,20 @@ void processActorWalk(MovementEntry &resx_y, int16 *inc_droite, int16 *inc_droit
                       int16 *inc_chemin, point* cor_joueur,
                       int16 solution0[NUM_NODES + 3][2], int16 *inc_jo1, int16 *inc_jo2,
                       int16 *dir_perso, int16 *inc_jo0, int16 num) {
-	int x1, x2, y1, y2;
-	int i, u;
-
-	u = 0;
+	int u = 0;
 	inc_jo = *inc_jo0;
 
-	i = *inc_chemin;
+	int i = *inc_chemin;
 
 	if (!*inc_droite) {
-		x1 = solution0[i][0];
-		y1 = solution0[i][1];
+		int x1 = solution0[i][0];
+		int y1 = solution0[i][1];
 		i++;
 		if (solution0[i][0] != -1) {
 			do {
 				if (solution0[i][0] != -2) {
-					x2 = solution0[i][0];
-					y2 = solution0[i][1];
+					int x2 = solution0[i][0];
+					int y2 = solution0[i][1];
 					if ((x1 == x2) && (y1 == y2)) {
 						resx_y.x = -1;
 						resx_y.y = -1;


Commit: 23abf274a7a2f3de00d1e203b3675785af3184d1
    https://github.com/scummvm/scummvm/commit/23abf274a7a2f3de00d1e203b3675785af3184d1
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-06-06T22:45:14+02:00

Commit Message:
CRUISE: Fix CppCheck warnings in gfxModule

Changed paths:
    engines/cruise/gfxModule.cpp



diff --git a/engines/cruise/gfxModule.cpp b/engines/cruise/gfxModule.cpp
index e3e7a2d..9fd94d7 100644
--- a/engines/cruise/gfxModule.cpp
+++ b/engines/cruise/gfxModule.cpp
@@ -121,12 +121,10 @@ void gfxModuleData_setPalColor(int idx, int r, int g, int b) {
 }
 
 void gfxModuleData_setPalEntries(const byte *ptr, int start, int num) {
-	int R, G, B, i;
-
-	for (i = start; i < start + num; i++) {
-		R = *(ptr++);
-		G = *(ptr++);
-		B = *(ptr++);
+	for (int i = start; i < start + num; i++) {
+		int R = *(ptr++);
+		int G = *(ptr++);
+		int B = *(ptr++);
 
 		lpalette[i].R = R;
 		lpalette[i].G = G;
@@ -339,7 +337,6 @@ void resetBitmap(uint8 *dataPtr, int32 dataSize) {
  */
 void switchBackground(const byte *newBg) {
 	const byte *bg = gfxModuleData.pPage00;
-	int sliceXStart, sliceXEnd;
 
 	// If both the upper corners are different, presume it's a full screen change
 	if ((*newBg != *bg) && (*(newBg + 319) != *(bg + 319))) {
@@ -352,7 +349,8 @@ void switchBackground(const byte *newBg) {
 	 */
 
 	for (int yp = 0; yp < 200; ++yp) {
-		sliceXStart = -1; sliceXEnd = -1;
+		int sliceXStart = -1;
+		int sliceXEnd = -1;
 		for (int xp = 0; xp < 320; ++xp, ++bg, ++newBg) {
 			if (*bg != *newBg) {
 				if (sliceXStart == -1) {


Commit: 8cb50b52e0e6614343419ca75803c8a18cf085df
    https://github.com/scummvm/scummvm/commit/8cb50b52e0e6614343419ca75803c8a18cf085df
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-06-06T22:49:21+02:00

Commit Message:
CRUISE: Reduce the scope of some more variables

Changed paths:
    engines/cruise/linker.cpp
    engines/cruise/menu.cpp
    engines/cruise/object.cpp



diff --git a/engines/cruise/linker.cpp b/engines/cruise/linker.cpp
index 7768e05..9786de7 100644
--- a/engines/cruise/linker.cpp
+++ b/engines/cruise/linker.cpp
@@ -129,8 +129,6 @@ int updateScriptImport(int ovlIdx) {
 	// do it for the 2 first string types
 	do {
 
-		int i = 0;
-
 		if (param == 0) {
 			var_32 = numData3;
 		} else {
@@ -138,16 +136,16 @@ int updateScriptImport(int ovlIdx) {
 		}
 
 		if (var_32) {
+			int i = 0;
 			do {
 				importScriptStruct *ptrImportData;
 				const char *ptrImportName;
 				uint8 *ptrData;
 
-				if (param == 0) {
+				if (param == 0)
 					pScript = getOvlData3Entry(ovlIdx, i);
-				} else {
+				else
 					pScript = scriptFunc1Sub2(ovlIdx, i);
-				}
 
 				ptrImportData = (importScriptStruct *)(pScript->dataPtr + pScript->offsetToImportData);	// import data
 				ptrImportName = (const char*)(pScript->dataPtr + pScript->offsetToImportName);	// import name
diff --git a/engines/cruise/menu.cpp b/engines/cruise/menu.cpp
index 8f162ee..0a49720 100644
--- a/engines/cruise/menu.cpp
+++ b/engines/cruise/menu.cpp
@@ -233,7 +233,6 @@ static void handleSaveLoad(bool saveFlag) {
 }
 
 int playerMenu(int menuX, int menuY) {
-	int retourMenu;
 	//int restartGame = 0;
 
 	if (playerMenuEnabled && displayOn) {
@@ -277,7 +276,7 @@ int playerMenu(int menuX, int menuY) {
 		addSelectableMenuEntry(0, 6, menuTable[0], 1, -1, _vm->langString(ID_RESTART));
 		addSelectableMenuEntry(0, 7, menuTable[0], 1, -1, _vm->langString(ID_QUIT));
 
-		retourMenu = processMenu(menuTable[0]);
+		int retourMenu = processMenu(menuTable[0]);
 
 		freeMenu(menuTable[0]);
 		menuTable[0] = NULL;
diff --git a/engines/cruise/object.cpp b/engines/cruise/object.cpp
index 3e61ff4..664627b 100644
--- a/engines/cruise/object.cpp
+++ b/engines/cruise/object.cpp
@@ -116,14 +116,10 @@ int16 getMultipleObjectParam(int16 overlayIdx, int16 objectIdx, objectParamsQuer
 }
 
 void setObjectPosition(int16 ovlIdx, int16 objIdx, int16 param3, int16 param4) {
-	objDataStruct *ptr;
-	objectParams *ptr2;
-
-	ptr = getObjectDataFromOverlay(ovlIdx, objIdx);
-
-	if (!ptr) {
+	objDataStruct *ptr = getObjectDataFromOverlay(ovlIdx, objIdx);
+	if (!ptr)
 		return;
-	}
+
 	//overlayTable[param1].ovlData
 
 	switch (ptr->_class) {
@@ -138,7 +134,7 @@ void setObjectPosition(int16 ovlIdx, int16 objIdx, int16 param3, int16 param4) {
 	case UNIQUE:
 		return;
 	case VARIABLE: {
-		ptr2 =  &overlayTable[ovlIdx].ovlData->arrayObjVar[ptr->_varTableIdx];
+		objectParams *ptr2 =  &overlayTable[ovlIdx].ovlData->arrayObjVar[ptr->_varTableIdx];
 
 		switch (param3) {
 		case 0: {	// x


Commit: 3dcfa95b44ec47c6eff1de03f946e2ac20bed29e
    https://github.com/scummvm/scummvm/commit/3dcfa95b44ec47c6eff1de03f946e2ac20bed29e
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-06-06T23:18:01+02:00

Commit Message:
Merge branch 'master' of github.com:scummvm/scummvm

Changed paths:
    devtools/create_neverhood/create_neverhood.cpp
    devtools/create_neverhood/tables.h
    dists/engine-data/neverhood.dat
    engines/fullpipe/modal.cpp
    engines/fullpipe/motion.cpp
    engines/fullpipe/scenes.cpp
    engines/fullpipe/scenes/scene16.cpp
    engines/fullpipe/statics.cpp





Commit: 3c1c080c3a236ca9aac40d7f04f82b57ec879cbe
    https://github.com/scummvm/scummvm/commit/3c1c080c3a236ca9aac40d7f04f82b57ec879cbe
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-06-06T23:18:47+02:00

Commit Message:
CRUISE: Fix some more CppCheck warnings

Changed paths:
    engines/cruise/mainDraw.cpp



diff --git a/engines/cruise/mainDraw.cpp b/engines/cruise/mainDraw.cpp
index 0e39740..31fafbb 100644
--- a/engines/cruise/mainDraw.cpp
+++ b/engines/cruise/mainDraw.cpp
@@ -479,10 +479,7 @@ void buildSegment() {
 				// swap again ?
 				SWAP(X1, X2);
 
-				int patchAdd = 2;
-
 				int dy = Y2 - Y1;
-
 				if (dy == 0) {
 					// hline
 					int16* ptr = (Y1 - ydep) * 2 + XMIN_XMAX + 1;
@@ -503,6 +500,8 @@ void buildSegment() {
 							ptr[1] = SI;
 					}
 				} else {
+					int patchAdd = 2;
+
 					if (dy < 0) {
 						dy = -dy;
 						patchAdd = -2;
@@ -721,7 +720,6 @@ void buildPolyModel(int positionX, int positionY, int scale, char *pMask, char *
 	int startX = 0;		// first X in model
 	int startY = 0;		// first Y in model
 	int x = 0;		// current X
-	int y = 0;		// current Y
 	int offsetXinModel = 0;	// offset of the X value in the model
 	int offsetYinModel = 0;	// offset of the Y value in the model
 	unsigned char *dataPointer = (unsigned char *)dataPtr;
@@ -761,9 +759,8 @@ void buildPolyModel(int positionX, int positionY, int scale, char *pMask, char *
 		startY >>= 1;
 	}
 
-	if (m_flipLeftRight) {
+	if (m_flipLeftRight)
 		startX = -startX;
-	}
 
 	/*
 	 * NOTE:
@@ -796,7 +793,7 @@ void buildPolyModel(int positionX, int positionY, int scale, char *pMask, char *
 		ptrPoly_1_Buf++;
 		offsetXinModel = x;
 
-		y = *(dataPointer) - m_first_Y;
+		int y = *(dataPointer) - m_first_Y;
 		dataPointer++;
 		if (m_useSmallScale) {
 			y >>= 1;
@@ -881,7 +878,6 @@ bool findPoly(char* dataPtr, int positionX, int positionY, int scale, int mouseX
 	int startX = 0;		// first X in model
 	int startY = 0;		// first Y in model
 	int x = 0;		// current X
-	int y = 0;		// current Y
 	int offsetXinModel = 0;	// offset of the X value in the model
 	int offsetYinModel = 0;	// offset of the Y value in the model
 	unsigned char *dataPointer = (unsigned char *)dataPtr;
@@ -955,11 +951,11 @@ bool findPoly(char* dataPtr, int positionX, int positionY, int scale, int mouseX
 		ptrPoly_1_Buf++;
 		offsetXinModel = x;
 
-		y = *(dataPointer) - m_first_Y;
+		int y = *(dataPointer) - m_first_Y;
 		dataPointer++;
-		if (m_useSmallScale) {
+		if (m_useSmallScale)
 			y >>= 1;
-		}
+
 		ptrPoly_1_Buf[0] = -(offsetYinModel - y);
 		ptrPoly_1_Buf++;
 		offsetYinModel = y;
@@ -1150,10 +1146,6 @@ void drawMessage(const gfxEntryStruct *pGfxPtr, int globalX, int globalY, int wi
 	// this is used for font only
 
 	if (pGfxPtr) {
-		uint8 *initialOuput;
-		uint8 *output;
-		int xp, yp;
-		int x, y;
 		const uint8 *ptr = pGfxPtr->imagePtr;
 		int height = pGfxPtr->height;
 
@@ -1172,14 +1164,14 @@ void drawMessage(const gfxEntryStruct *pGfxPtr, int globalX, int globalY, int wi
 
 		gfxModuleData_addDirtyRect(Common::Rect(globalX, globalY, globalX + width, globalY + height));
 
-		initialOuput = ouputPtr + (globalY * 320) + globalX;
+		uint8 *initialOuput = ouputPtr + (globalY * 320) + globalX;
 
-		for (yp = 0; yp < height; yp++) {
-			output = initialOuput + 320 * yp;
-			y = globalY + yp;
+		for (int yp = 0; yp < height; yp++) {
+			uint8 *output = initialOuput + 320 * yp;
+			int y = globalY + yp;
 
-			for (xp = 0; xp < pGfxPtr->width; xp++) {
-				x = globalX + xp;
+			for (int xp = 0; xp < pGfxPtr->width; xp++) {
+				int x = globalX + xp;
 				uint8 color = *(ptr++);
 
 				if (color) {






More information about the Scummvm-git-logs mailing list