[Scummvm-git-logs] scummvm master -> 0267faf5c35399daa1d7ec3a8a36462071595cb6

dreammaster dreammaster at scummvm.org
Tue Mar 14 03:17:46 CET 2017


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:
0267faf5c3 TITANIC: Fix some starfield startup crashes and initialization


Commit: 0267faf5c35399daa1d7ec3a8a36462071595cb6
    https://github.com/scummvm/scummvm/commit/0267faf5c35399daa1d7ec3a8a36462071595cb6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-03-13T22:17:40-04:00

Commit Message:
TITANIC: Fix some starfield startup crashes and initialization

Changed paths:
    engines/titanic/star_control/star_control_sub5.cpp
    engines/titanic/star_control/surface_area.cpp
    engines/titanic/titanic.h


diff --git a/engines/titanic/star_control/star_control_sub5.cpp b/engines/titanic/star_control/star_control_sub5.cpp
index 5023a59..4ca22ff 100644
--- a/engines/titanic/star_control/star_control_sub5.cpp
+++ b/engines/titanic/star_control/star_control_sub5.cpp
@@ -175,7 +175,7 @@ bool CStarControlSub5::setup2(int val1, int val2) {
 				
 				e->_fieldC = g_vm->getRandomNumber(255);
 				e->_field10 = FACTOR * (double)g_vm->getRandomNumber(15);
-				e->_field14 = ((double)g_vm->getRandomNumber(0xffffffff)
+				e->_field14 = ((double)g_vm->getRandomNumber(0xfffffffe)
 					* 50.0 * 0.000015259022) * 0.00390625;
 			}
 		}
diff --git a/engines/titanic/star_control/surface_area.cpp b/engines/titanic/star_control/surface_area.cpp
index 9b46cf0..4cfc4f8 100644
--- a/engines/titanic/star_control/surface_area.cpp
+++ b/engines/titanic/star_control/surface_area.cpp
@@ -28,11 +28,14 @@ CSurfaceArea::CSurfaceArea(CVideoSurface *surface) {
 	_width = surface->getWidth();
 	_height = surface->getHeight();
 	_pitch = surface->getPitch();
+	_field0 = 0;
+	_colorMask = _color = 0;
+	_mode = SA_NONE;
 
 	// Original supported other pixel depths
 	_bpp = surface->getPixelDepth();
-	assert(_bpp == 2);
 	_pixelsPtr = surface->getPixels();
+	assert(_bpp == 2 && _pixelsPtr);
 
 	initialize();
 }
diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h
index fdc9402..6bc999c 100644
--- a/engines/titanic/titanic.h
+++ b/engines/titanic/titanic.h
@@ -166,7 +166,7 @@ public:
 	/**
 	 * Returns a random floating point number between 0.0 to 65535.0
 	 */
-	double getRandomFloat() { return getRandomNumber(0xffffffff) * 0.000015259022; }
+	double getRandomFloat() { return getRandomNumber(0xfffffffe) * 0.000015259022; }
 
 	/**
 	 * Support method that generates a savegame name





More information about the Scummvm-git-logs mailing list