aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2009-12-02 21:30:43 +0000
committerMartin Kiewitz2009-12-02 21:30:43 +0000
commitafee877c46b1a4fb9e88934862be383e23c61bc8 (patch)
treef571d08484503f70d449849ffc1c6e875cd72bd2 /engines
parent6dad0ab29e6d2d290fc477ec17fce49287920408 (diff)
downloadscummvm-rg350-afee877c46b1a4fb9e88934862be383e23c61bc8.tar.gz
scummvm-rg350-afee877c46b1a4fb9e88934862be383e23c61bc8.tar.bz2
scummvm-rg350-afee877c46b1a4fb9e88934862be383e23c61bc8.zip
SCI: Do clipping on celNo for case when celNo is below 0 (fixes crash in island dr. brain intro)
svn-id: r46240
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/gui/gui_view.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/engines/sci/gui/gui_view.cpp b/engines/sci/gui/gui_view.cpp
index 26413ec0a8..ff60511008 100644
--- a/engines/sci/gui/gui_view.cpp
+++ b/engines/sci/gui/gui_view.cpp
@@ -225,23 +225,20 @@ GuiResourceId SciGuiView::getResourceId() {
}
int16 SciGuiView::getWidth(GuiViewLoopNo loopNo, GuiViewCelNo celNo) {
- loopNo = CLIP<int16>(loopNo, 0, _loopCount -1);
- if (celNo >= _loop[loopNo].celCount)
- celNo = 0;
+ loopNo = CLIP<int16>(loopNo, 0, _loopCount - 1);
+ celNo = CLIP<int16>(celNo, 0, _loop[loopNo].celCount - 1);
return _loopCount ? _loop[loopNo].cel[celNo].width : 0;
}
int16 SciGuiView::getHeight(GuiViewLoopNo loopNo, GuiViewCelNo celNo) {
loopNo = CLIP<int16>(loopNo, 0, _loopCount -1);
- if (celNo >= _loop[loopNo].celCount)
- celNo = 0;
+ celNo = CLIP<int16>(celNo, 0, _loop[loopNo].celCount - 1);
return _loopCount ? _loop[loopNo].cel[celNo].height : 0;
}
sciViewCelInfo *SciGuiView::getCelInfo(GuiViewLoopNo loopNo, GuiViewCelNo celNo) {
loopNo = CLIP<int16>(loopNo, 0, _loopCount - 1);
- if (celNo >= _loop[loopNo].celCount)
- celNo = 0;
+ celNo = CLIP<int16>(celNo, 0, _loop[loopNo].celCount - 1);
return _loopCount ? &_loop[loopNo].cel[celNo] : NULL;
}
@@ -345,8 +342,7 @@ void SciGuiView::unpackCel(GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte *outPt
byte *SciGuiView::getBitmap(GuiViewLoopNo loopNo, GuiViewCelNo celNo) {
loopNo = CLIP<int16>(loopNo, 0, _loopCount -1);
- if (celNo >= _loop[loopNo].celCount)
- celNo = 0;
+ celNo = CLIP<int16>(celNo, 0, _loop[loopNo].celCount - 1);
if (_loop[loopNo].cel[celNo].rawBitmap)
return _loop[loopNo].cel[celNo].rawBitmap;