aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gui
diff options
context:
space:
mode:
authorMartin Kiewitz2009-10-12 22:08:35 +0000
committerMartin Kiewitz2009-10-12 22:08:35 +0000
commit71686a2e7bc0273e857d8328066c1e7294ae0b69 (patch)
tree9fc73cc3fac848a0d709b79595b4412f801fad2d /engines/sci/gui
parent30cb28e7efe0e3a5c69c658d50634e6161e92680 (diff)
downloadscummvm-rg350-71686a2e7bc0273e857d8328066c1e7294ae0b69.tar.gz
scummvm-rg350-71686a2e7bc0273e857d8328066c1e7294ae0b69.tar.bz2
scummvm-rg350-71686a2e7bc0273e857d8328066c1e7294ae0b69.zip
SCI/newgui: priority band initialization now working exactly the same way as sierra sci did (fixes at least lsl3)
svn-id: r44998
Diffstat (limited to 'engines/sci/gui')
-rw-r--r--engines/sci/gui/gui_gfx.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp
index 69205fab54..18f5a8131c 100644
--- a/engines/sci/gui/gui_gfx.cpp
+++ b/engines/sci/gui/gui_gfx.cpp
@@ -923,19 +923,22 @@ static inline int sign_extend_byte(int value) {
}
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;
}