[Scummvm-git-logs] scummvm master -> a9be9c1453c5106fca7598bd0d7ca1e685a59539

Strangerke Strangerke at scummvm.org
Fri Sep 6 00:46:40 CEST 2019


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

Summary:
9ed4c340a2 HDB: Fix uninitialized variable in sound
27e852e17a HDB: Simplify some code by using CLIP()
a9be9c1453 HDB: Small loop changes in sound


Commit: 9ed4c340a230df61bb92891b00dc7bb3a9814d2b
    https://github.com/scummvm/scummvm/commit/9ed4c340a230df61bb92891b00dc7bb3a9814d2b
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-09-06T00:32:39+02:00

Commit Message:
HDB: Fix uninitialized variable in sound

Changed paths:
    engines/hdb/sound.cpp


diff --git a/engines/hdb/sound.cpp b/engines/hdb/sound.cpp
index 1b42cf6..b8f3793 100644
--- a/engines/hdb/sound.cpp
+++ b/engines/hdb/sound.cpp
@@ -1409,6 +1409,7 @@ Sound::Sound() {
 	_sfxVolume = 255;
 	_musicVolume = 255;
 	_numSounds = 0;
+	_voicesOn = 0;
 }
 
 void Sound::test() {


Commit: 27e852e17a4fe2a3e7bb66f661e651be86c6cf3b
    https://github.com/scummvm/scummvm/commit/27e852e17a4fe2a3e7bb66f661e651be86c6cf3b
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-09-06T00:44:01+02:00

Commit Message:
HDB: Simplify some code by using CLIP()

Changed paths:
    engines/hdb/map.cpp


diff --git a/engines/hdb/map.cpp b/engines/hdb/map.cpp
index ad1e63a..a0eedcb 100644
--- a/engines/hdb/map.cpp
+++ b/engines/hdb/map.cpp
@@ -1140,18 +1140,8 @@ void Map::getMapXY(int *x, int *y) {
 }
 
 void Map::setMapXY(int x, int y) {
-	if (x < 0)
-		x = 0;
-	else if (x > (_width * kTileWidth - g_hdb->_screenDrawWidth))
-		x = _width * kTileWidth - g_hdb->_screenDrawWidth;
-
-	if (y < 0)
-		y = 0;
-	else if (y > (_height * kTileHeight - g_hdb->_screenDrawHeight))
-		y = _height * kTileHeight - g_hdb->_screenDrawHeight;
-
-	_mapX = x;
-	_mapY = y;
+	_mapX = CLIP(x, 0, _width * kTileWidth - g_hdb->_screenDrawWidth);
+	_mapY = CLIP(y, 0, _height * kTileHeight - g_hdb->_screenDrawHeight);
 }
 
 // Sets _mapX and _mapY and tries to center the map around X, Y
@@ -1196,16 +1186,9 @@ void Map::centerMapXY(int x, int y) {
 			break;
 		}
 	}
-
-	if (x < minx)
-		x = minx;
-	else if (x > maxx)
-		x = maxx;
-
-	if (y < miny)
-		y = miny;
-	else if (y > maxy)
-		y = maxy;
+	
+	x = CLIP(x, minx, maxx);
+	y = CLIP(y, miny, maxy);
 
 	x -= (g_hdb->_screenDrawWidth / 2);
 	y -= (g_hdb->_screenDrawHeight / 2);


Commit: a9be9c1453c5106fca7598bd0d7ca1e685a59539
    https://github.com/scummvm/scummvm/commit/a9be9c1453c5106fca7598bd0d7ca1e685a59539
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-09-06T00:44:54+02:00

Commit Message:
HDB: Small loop changes in sound

Changed paths:
    engines/hdb/sound.cpp


diff --git a/engines/hdb/sound.cpp b/engines/hdb/sound.cpp
index b8f3793..057d97d 100644
--- a/engines/hdb/sound.cpp
+++ b/engines/hdb/sound.cpp
@@ -1980,12 +1980,9 @@ const char *Sound::getSNDLuaName(int index) {
 }
 
 int Sound::getSNDIndex(const char *name) {
-	int		i = 0;
-
-	while (soundList[i].idx != LAST_SOUND) {
+	for (int i = 0; soundList[i].idx != LAST_SOUND; ++i) {
 		if (!scumm_stricmp(soundList[i].luaName, name))
 			return i;
-		i++;
 	}
 
 	return 0;
@@ -2002,8 +1999,7 @@ SoundType Sound::whatSongIsPlaying() {
 }
 
 void Sound::markSoundCacheFreeable() {
-	int	i;
-	for (i = 0; i < kMaxSounds; i++) {
+	for (int i = 0; i < kMaxSounds; i++) {
 		if (_soundCache[i].loaded == SNDMEM_LOADED)
 			_soundCache[i].loaded = SNDMEM_FREEABLE;
 	}





More information about the Scummvm-git-logs mailing list