Skip to content

Commit

Permalink
TITANIC: Fix some starfield startup crashes and initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Mar 14, 2017
1 parent 527b814 commit 0267faf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion engines/titanic/star_control/star_control_sub5.cpp
Expand Up @@ -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;
}
}
Expand Down
5 changes: 4 additions & 1 deletion engines/titanic/star_control/surface_area.cpp
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion engines/titanic/titanic.h
Expand Up @@ -166,7 +166,7 @@ class TitanicEngine : public Engine {
/**
* 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
Expand Down

0 comments on commit 0267faf

Please sign in to comment.