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

clone2727 clone2727 at gmail.com
Sat Apr 11 22:20:28 CEST 2015


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:
797506eff7 SWORD25: Use fabs for absolute value of doubles
75acef7566 GRAPHICS: Force a cast to int to avoid gcc warnings
ddf170de4a ZVISION: Silence gcc warnings


Commit: 797506eff79126e60ec97e8377b5a6d632769564
    https://github.com/scummvm/scummvm/commit/797506eff79126e60ec97e8377b5a6d632769564
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2015-04-11T16:12:47-04:00

Commit Message:
SWORD25: Use fabs for absolute value of doubles

Changed paths:
    engines/sword25/util/double_serialization.cpp



diff --git a/engines/sword25/util/double_serialization.cpp b/engines/sword25/util/double_serialization.cpp
index 73da296..13fa42b 100644
--- a/engines/sword25/util/double_serialization.cpp
+++ b/engines/sword25/util/double_serialization.cpp
@@ -33,7 +33,7 @@ SerializedDouble encodeDouble(double value) {
 	double significand = frexp(value, &exponent);
 
 	// Shift the the first part of the significand into the integer range
-	double shiftedsignificandPart = ldexp(abs(significand), 32);
+	double shiftedsignificandPart = ldexp(fabs(significand), 32);
 	uint32 significandOne = uint32(floor(shiftedsignificandPart));
 
 	// Shift the remainder of the significand into the integer range


Commit: 75acef75661cc4554ad0bf114d62bf553afae7ab
    https://github.com/scummvm/scummvm/commit/75acef75661cc4554ad0bf114d62bf553afae7ab
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2015-04-11T16:12:47-04:00

Commit Message:
GRAPHICS: Force a cast to int to avoid gcc warnings

Changed paths:
    graphics/fonts/ttf.cpp



diff --git a/graphics/fonts/ttf.cpp b/graphics/fonts/ttf.cpp
index 7373a96..dc7335f 100644
--- a/graphics/fonts/ttf.cpp
+++ b/graphics/fonts/ttf.cpp
@@ -474,11 +474,11 @@ bool TTFFont::cacheGlyph(Glyph &glyph, uint32 chr) const {
 
 	switch (bitmap.pixel_mode) {
 	case FT_PIXEL_MODE_MONO:
-		for (uint y = 0; y < bitmap.rows; ++y) {
+		for (int y = 0; y < (int)bitmap.rows; ++y) {
 			const uint8 *curSrc = src;
 			uint8 mask = 0;
 
-			for (uint x = 0; x < bitmap.width; ++x) {
+			for (int x = 0; x < (int)bitmap.width; ++x) {
 				if ((x % 8) == 0)
 					mask = *curSrc++;
 
@@ -494,7 +494,7 @@ bool TTFFont::cacheGlyph(Glyph &glyph, uint32 chr) const {
 		break;
 
 	case FT_PIXEL_MODE_GRAY:
-		for (uint y = 0; y < bitmap.rows; ++y) {
+		for (int y = 0; y < (int)bitmap.rows; ++y) {
 			memcpy(dst, src, bitmap.width);
 			dst += glyph.image.pitch;
 			src += srcPitch;


Commit: ddf170de4a33fac4cac3093bf6dd97d253216092
    https://github.com/scummvm/scummvm/commit/ddf170de4a33fac4cac3093bf6dd97d253216092
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2015-04-11T16:12:47-04:00

Commit Message:
ZVISION: Silence gcc warnings

Changed paths:
    engines/zvision/graphics/effects/fog.cpp
    engines/zvision/graphics/effects/wave.cpp
    engines/zvision/graphics/render_manager.cpp
    engines/zvision/scripting/effects/distort_effect.cpp
    engines/zvision/scripting/effects/music_effect.cpp
    engines/zvision/scripting/menu.cpp
    engines/zvision/text/truetype_font.cpp



diff --git a/engines/zvision/graphics/effects/fog.cpp b/engines/zvision/graphics/effects/fog.cpp
index 32a0191..7b65f60 100644
--- a/engines/zvision/graphics/effects/fog.cpp
+++ b/engines/zvision/graphics/effects/fog.cpp
@@ -142,9 +142,9 @@ void FogFx::update() {
 
 		for (uint8 i = 0; i < 31; i++) {
 			float perc = (float)i / 31.0;
-			uint8 cr = (float)_r * perc;
-			uint8 cg = (float)_g * perc;
-			uint8 cb = (float)_b * perc;
+			uint8 cr = (uint8)((float)_r * perc);
+			uint8 cg = (uint8)((float)_g * perc);
+			uint8 cb = (uint8)((float)_b * perc);
 			_colorMap[i] = _engine->_resourcePixelFormat.RGBToColor(cr << 3, cg << 3, cb << 3);
 		}
 	}
diff --git a/engines/zvision/graphics/effects/wave.cpp b/engines/zvision/graphics/effects/wave.cpp
index cec6316..d2887b3 100644
--- a/engines/zvision/graphics/effects/wave.cpp
+++ b/engines/zvision/graphics/effects/wave.cpp
@@ -54,7 +54,7 @@ WaveFx::WaveFx(ZVision *engine, uint32 key, Common::Rect region, bool ported, in
 				int16 dx = (x - quarterWidth);
 				int16 dy = (y - quarterHeight);
 
-				_ampls[i][x + y * _halfWidth] = ampl * sin(sqrt(dx * dx / (float)centerX + dy * dy / (float)centerY) / (-waveln * 3.1415926) + phase);
+				_ampls[i][x + y * _halfWidth] = (int8)(ampl * sin(sqrt(dx * dx / (float)centerX + dy * dy / (float)centerY) / (-waveln * 3.1415926) + phase));
 			}
 		phase += spd;
 	}
diff --git a/engines/zvision/graphics/render_manager.cpp b/engines/zvision/graphics/render_manager.cpp
index 3772d59..ce0a02a 100644
--- a/engines/zvision/graphics/render_manager.cpp
+++ b/engines/zvision/graphics/render_manager.cpp
@@ -1108,7 +1108,7 @@ void RenderManager::updateRotation() {
 			int16 newPosition = startPosition + _velocity;
 
 			int16 screenHeight = getBkgSize().y;
-			int16 tiltGap = _renderTable.getTiltGap();
+			int16 tiltGap = (int16)_renderTable.getTiltGap();
 
 			if (newPosition >= (screenHeight - tiltGap))
 				newPosition = screenHeight - tiltGap;
@@ -1143,7 +1143,7 @@ void RenderManager::checkBorders() {
 		int16 newPosition = startPosition;
 
 		int16 screenHeight = getBkgSize().y;
-		int16 tiltGap = _renderTable.getTiltGap();
+		int16 tiltGap = (int16)_renderTable.getTiltGap();
 
 		if (newPosition >= (screenHeight - tiltGap))
 			newPosition = screenHeight - tiltGap;
diff --git a/engines/zvision/scripting/effects/distort_effect.cpp b/engines/zvision/scripting/effects/distort_effect.cpp
index 78c4a1b..113b5d0 100644
--- a/engines/zvision/scripting/effects/distort_effect.cpp
+++ b/engines/zvision/scripting/effects/distort_effect.cpp
@@ -52,7 +52,7 @@ DistortNode::DistortNode(ZVision *engine, uint32 key, int16 speed, float startAn
 	_diffLinScale = endLineScale - startLineScale;
 
 	_frmSpeed = (float)speed / 15.0;
-	_frames = ceil((5.0 - _frmSpeed * 2.0) / _frmSpeed);
+	_frames = (int)ceil((5.0 - _frmSpeed * 2.0) / _frmSpeed);
 	if (_frames <= 0)
 		_frames = 1;
 
diff --git a/engines/zvision/scripting/effects/music_effect.cpp b/engines/zvision/scripting/effects/music_effect.cpp
index ad3c0f6..e3fdc96 100644
--- a/engines/zvision/scripting/effects/music_effect.cpp
+++ b/engines/zvision/scripting/effects/music_effect.cpp
@@ -140,7 +140,7 @@ bool MusicNode::process(uint32 deltaTimeInMillis) {
 			if (_crossfadeTime > 0) {
 				if ((int32)deltaTimeInMillis > _crossfadeTime)
 					deltaTimeInMillis = _crossfadeTime;
-				_newvol += floor(((float)(_crossfadeTarget - _newvol) / (float)_crossfadeTime)) * (float)deltaTimeInMillis;
+				_newvol += (int)(floor(((float)(_crossfadeTarget - _newvol) / (float)_crossfadeTime)) * (float)deltaTimeInMillis);
 				_crossfadeTime -= deltaTimeInMillis;
 			} else {
 				_crossfade = false;
diff --git a/engines/zvision/scripting/menu.cpp b/engines/zvision/scripting/menu.cpp
index 16aa57e..e7775cb 100644
--- a/engines/zvision/scripting/menu.cpp
+++ b/engines/zvision/scripting/menu.cpp
@@ -50,9 +50,9 @@ MenuZGI::MenuZGI(ZVision *engine) :
 	scrolled[0] = false;
 	scrolled[1] = false;
 	scrolled[2] = false;
-	scrollPos[0] = 0.0;
-	scrollPos[1] = 0.0;
-	scrollPos[2] = 0.0;
+	scrollPos[0] = 0;
+	scrollPos[1] = 0;
+	scrollPos[2] = 0;
 	mouseOnItem = -1;
 	redraw = false;
 	clean = false;
@@ -361,11 +361,11 @@ void MenuZGI::process(uint32 deltatime) {
 				if (scrl == 0)
 					scrl = 1.0;
 
-				scrollPos [kMenuItem] += scrl;
+				scrollPos[kMenuItem] += (int)scrl;
 
 				if (scrollPos[kMenuItem] >= 0) {
 					scrolled[kMenuItem] = true;
-					scrollPos [kMenuItem] = 0;
+					scrollPos[kMenuItem] = 0;
 				}
 			}
 		if (redraw) {
@@ -430,11 +430,11 @@ void MenuZGI::process(uint32 deltatime) {
 				if (scrl == 0)
 					scrl = 1.0;
 
-				scrollPos [kMenuMagic] += scrl;
+				scrollPos[kMenuMagic] += (int)scrl;
 
 				if (scrollPos[kMenuMagic] >= 600) {
 					scrolled[kMenuMagic] = true;
-					scrollPos [kMenuMagic] = 600;
+					scrollPos[kMenuMagic] = 600;
 				}
 			}
 		if (redraw) {
@@ -495,11 +495,11 @@ void MenuZGI::process(uint32 deltatime) {
 			if (scrl == 0)
 				scrl = 1.0;
 
-			scrollPos [kMenuMain] += scrl;
+			scrollPos[kMenuMain] += (int)scrl;
 
 			if (scrollPos[kMenuMain] >= 0) {
 				scrolled[kMenuMain] = true;
-				scrollPos [kMenuMain] = 0;
+				scrollPos[kMenuMain] = 0;
 			}
 		}
 		if (redraw) {
@@ -553,7 +553,7 @@ MenuNemesis::MenuNemesis(ZVision *engine) :
 	MenuHandler(engine) {
 	inmenu = false;
 	scrolled = false;
-	scrollPos = 0.0;
+	scrollPos = 0;
 	mouseOnItem = -1;
 	redraw = false;
 	delay = 0;
@@ -696,7 +696,7 @@ void MenuNemesis::process(uint32 deltatime) {
 			if (scrl == 0)
 				scrl = 1.0;
 
-			scrollPos += scrl;
+			scrollPos += (int)scrl;
 			redraw = true;
 		}
 
@@ -743,10 +743,10 @@ void MenuNemesis::process(uint32 deltatime) {
 			if (scrl == 0)
 				scrl = 1.0;
 
-			Common::Rect cl(64, 32 + scrollPos - scrl, 64 + 512, 32 + scrollPos + 1);
+			Common::Rect cl(64, (int16)(32 + scrollPos - scrl), 64 + 512, 32 + scrollPos + 1);
 			_engine->getRenderManager()->clearMenuSurface(cl);
 
-			scrollPos -= scrl;
+			scrollPos -= (int)scrl;
 			redraw = true;
 		} else
 			scrollPos = -32;
diff --git a/engines/zvision/text/truetype_font.cpp b/engines/zvision/text/truetype_font.cpp
index 7ad8d6d..acb053e 100644
--- a/engines/zvision/text/truetype_font.cpp
+++ b/engines/zvision/text/truetype_font.cpp
@@ -199,12 +199,12 @@ void StyledTTFont::drawChar(Graphics::Surface *dst, byte chr, int x, int y, uint
 	if (_font) {
 		_font->drawChar(dst, chr, x, y, color);
 		if (_style & TTF_STYLE_UNDERLINE) {
-			int16 pos = floor(_font->getFontHeight() * 0.87);
+			int16 pos = (int16)floor(_font->getFontHeight() * 0.87);
 			int thk = MAX((int)(_font->getFontHeight() * 0.05), 1);
 			dst->fillRect(Common::Rect(x, y + pos, x + _font->getCharWidth(chr), y + pos + thk), color);
 		}
 		if (_style & TTF_STYLE_STRIKETHROUGH) {
-			int16 pos = floor(_font->getFontHeight() * 0.60);
+			int16 pos = (int16)floor(_font->getFontHeight() * 0.60);
 			int thk = MAX((int)(_font->getFontHeight() * 0.05), 1);
 			dst->fillRect(Common::Rect(x, y + pos, x + _font->getCharWidth(chr), y + pos + thk), color);
 		}
@@ -216,7 +216,7 @@ void StyledTTFont::drawString(Graphics::Surface *dst, const Common::String &str,
 		Common::U32String u32str = convertUtf8ToUtf32(str);
 		_font->drawString(dst, u32str, x, y, w, color, align);
 		if (_style & TTF_STYLE_UNDERLINE) {
-			int16 pos = floor(_font->getFontHeight() * 0.87);
+			int16 pos = (int16)floor(_font->getFontHeight() * 0.87);
 			int16 wd = MIN(_font->getStringWidth(u32str), w);
 			int16 stX = x;
 			if (align == Graphics::kTextAlignCenter)
@@ -229,7 +229,7 @@ void StyledTTFont::drawString(Graphics::Surface *dst, const Common::String &str,
 			dst->fillRect(Common::Rect(stX, y + pos, stX + wd, y + pos + thk), color);
 		}
 		if (_style & TTF_STYLE_STRIKETHROUGH) {
-			int16 pos = floor(_font->getFontHeight() * 0.60);
+			int16 pos = (int16)floor(_font->getFontHeight() * 0.60);
 			int16 wd = MIN(_font->getStringWidth(u32str), w);
 			int16 stX = x;
 			if (align == Graphics::kTextAlignCenter)






More information about the Scummvm-git-logs mailing list