[Scummvm-cvs-logs] SF.net SVN: scummvm:[44998] scummvm/trunk/engines/sci/gui/gui_gfx.cpp

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Tue Oct 13 00:08:36 CEST 2009


Revision: 44998
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44998&view=rev
Author:   m_kiewitz
Date:     2009-10-12 22:08:35 +0000 (Mon, 12 Oct 2009)

Log Message:
-----------
SCI/newgui: priority band initialization now working exactly the same way as sierra sci did (fixes at least lsl3)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gui/gui_gfx.cpp

Modified: scummvm/trunk/engines/sci/gui/gui_gfx.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_gfx.cpp	2009-10-12 20:46:32 UTC (rev 44997)
+++ scummvm/trunk/engines/sci/gui/gui_gfx.cpp	2009-10-12 22:08:35 UTC (rev 44998)
@@ -923,19 +923,22 @@
 }
 
 void SciGuiGfx::PriorityBandsInit(int16 bandCount, int16 top, int16 bottom) {
-	double bandSize;
 	int16 y;
+	int32 bandSize;
 
 	if (bandCount != -1)
 		_priorityBandCount = bandCount;
 
 	_priorityTop = top;
 	_priorityBottom = bottom;
-	bandSize = (_priorityBottom - _priorityTop) / (_priorityBandCount);
 
-	memset(_priorityBands, 0, _priorityTop);
+	// Do NOT modify this algo or optimize it anyhow, sierra sci used int32 for calculating the
+	//  priority bands and by using double or anything rounding may destroy the result
+	bandSize = ((_priorityBottom - _priorityTop) * 2000) / 14;
+
+	memset(_priorityBands, 0, sizeof(byte) * _priorityTop);
 	for (y = _priorityTop; y < _priorityBottom; y++)
-		_priorityBands[y] = (byte)(1 + (y - _priorityTop) / bandSize);
+		_priorityBands[y] = 1 + (((y - _priorityTop) * 2000) / bandSize);
 	for (y = _priorityBottom; y < _screen->_height; y++)
 		_priorityBands[y] = _priorityBandCount;
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list