diff options
author | Paul Gilbert | 2017-03-13 22:17:40 -0400 |
---|---|---|
committer | Paul Gilbert | 2017-03-13 22:17:40 -0400 |
commit | 0267faf5c35399daa1d7ec3a8a36462071595cb6 (patch) | |
tree | c04b2b702a478412a249091a8462115341df9ca7 | |
parent | 527b814bf14476fbb6df95846192f8a763967777 (diff) | |
download | scummvm-rg350-0267faf5c35399daa1d7ec3a8a36462071595cb6.tar.gz scummvm-rg350-0267faf5c35399daa1d7ec3a8a36462071595cb6.tar.bz2 scummvm-rg350-0267faf5c35399daa1d7ec3a8a36462071595cb6.zip |
TITANIC: Fix some starfield startup crashes and initialization
-rw-r--r-- | engines/titanic/star_control/star_control_sub5.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/star_control/surface_area.cpp | 5 | ||||
-rw-r--r-- | engines/titanic/titanic.h | 2 |
3 files changed, 6 insertions, 3 deletions
diff --git a/engines/titanic/star_control/star_control_sub5.cpp b/engines/titanic/star_control/star_control_sub5.cpp index 5023a59383..4ca22ff922 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 9b46cf03b7..4cfc4f84d2 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 fdc9402d89..6bc999cd40 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 |