diff options
author | Johannes Schickel | 2008-04-23 18:18:11 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-04-23 18:18:11 +0000 |
commit | 347eb2dc0787df12c186882b215d1550cb2ea823 (patch) | |
tree | 04bef2e64be86cd30c16425ccf3b11abc09812b7 /engines | |
parent | 4f108832c3fe47eaea18dd6bc838bcc72b5ac8d0 (diff) | |
download | scummvm-rg350-347eb2dc0787df12c186882b215d1550cb2ea823.tar.gz scummvm-rg350-347eb2dc0787df12c186882b215d1550cb2ea823.tar.bz2 scummvm-rg350-347eb2dc0787df12c186882b215d1550cb2ea823.zip |
- cleanup
- some valgrind warning fixes
svn-id: r31669
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/kyra_v3.cpp | 13 | ||||
-rw-r--r-- | engines/kyra/kyra_v3.h | 2 | ||||
-rw-r--r-- | engines/kyra/screen.cpp | 6 | ||||
-rw-r--r-- | engines/kyra/text.cpp | 3 | ||||
-rw-r--r-- | engines/kyra/text_v3.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/wsamovie.cpp | 4 |
6 files changed, 18 insertions, 12 deletions
diff --git a/engines/kyra/kyra_v3.cpp b/engines/kyra/kyra_v3.cpp index f1d7a9deb5..08b006568d 100644 --- a/engines/kyra/kyra_v3.cpp +++ b/engines/kyra/kyra_v3.cpp @@ -600,8 +600,9 @@ void KyraEngine_v3::startup() { musicUpdate(0); memset(_hiddenItems, -1, sizeof(_hiddenItems)); - - //resetNewSceneDlgState(); + + memset(_newSceneDlgState, 0, sizeof(_newSceneDlgState)); + memset(_conversationState, -1, sizeof(_conversationState)); _sceneList = new SceneDesc[98]; musicUpdate(0); @@ -728,6 +729,14 @@ void KyraEngine_v3::addShapeToPool(const uint8 *data, int realIndex, int shape) assert(_gameShapes[realIndex]); } +uint8 *KyraEngine_v3::getShapePtr(int shape) const { + debugC(9, kDebugLevelMain, "KyraEngine_v3::getShapePtr(%d)", shape); + ShapeMap::iterator iter = _gameShapes.find(shape); + if (iter == _gameShapes.end()) + return 0; + return iter->_value; +} + void KyraEngine_v3::loadMalcolmShapes(int newShapes) { debugC(9, kDebugLevelMain, "KyraEngine_v3::loadMalcolmShapes(%d)", newShapes); static const uint8 numberOffset[] = { 3, 3, 4, 4, 3, 3 }; diff --git a/engines/kyra/kyra_v3.h b/engines/kyra/kyra_v3.h index 0e7efe91be..2b4e9c478e 100644 --- a/engines/kyra/kyra_v3.h +++ b/engines/kyra/kyra_v3.h @@ -296,7 +296,7 @@ private: ShapeMap _gameShapes; void addShapeToPool(const uint8 *data, int realIndex, int shape); - uint8 *getShapePtr(int shape) const { return _gameShapes[shape]; } + uint8 *getShapePtr(int shape) const; void initMouseShapes(); diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 6dff6a0fa4..6ffd0ace79 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -1127,13 +1127,11 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int _drawShapeVar5 = 256; } - if (flags & 0x4000) { + if (flags & 0x4000) _drawShapeVar5 = va_arg(args, int); - } - if (flags & 0x800) { + if (flags & 0x800) _dsDrawLayer = va_arg(args, int); - } if (flags & DSF_SCALE) { _dsScaleW = va_arg(args, int); diff --git a/engines/kyra/text.cpp b/engines/kyra/text.cpp index eb6df65304..980b762b23 100644 --- a/engines/kyra/text.cpp +++ b/engines/kyra/text.cpp @@ -151,9 +151,8 @@ int TextDisplayer::buildMessageSubstrings(const char *str) { } else { _talkSubstrings[currentLine * TALK_SUBSTRING_LEN + pos] = *str; ++pos; - if (pos > TALK_SUBSTRING_LEN - 2) { + if (pos >= TALK_SUBSTRING_LEN - 2) pos = TALK_SUBSTRING_LEN - 2; - } } ++str; } diff --git a/engines/kyra/text_v3.cpp b/engines/kyra/text_v3.cpp index 17f6f0699f..984adc4cb8 100644 --- a/engines/kyra/text_v3.cpp +++ b/engines/kyra/text_v3.cpp @@ -36,7 +36,7 @@ TextDisplayer_v3::TextDisplayer_v3(KyraEngine_v3 *vm, Screen_v3 *screen) char *TextDisplayer_v3::preprocessString(const char *str) { debugC(9, kDebugLevelMain, "TextDisplayer_v3::preprocessString('%s')", str); if (_talkBuffer != str) - strcpy(_talkBuffer, str); + strncpy(_talkBuffer, str, sizeof(_talkBuffer)); char *p = _talkBuffer; while (*p) { diff --git a/engines/kyra/wsamovie.cpp b/engines/kyra/wsamovie.cpp index a8ffafb355..9da75ed20c 100644 --- a/engines/kyra/wsamovie.cpp +++ b/engines/kyra/wsamovie.cpp @@ -237,7 +237,7 @@ void WSAMovieAmiga::close() { void WSAMovieAmiga::displayFrame(int frameNum, ...) { debugC(9, kDebugLevelMovie, "WSAMovieAmiga::displayFrame(%d)", frameNum); - if (frameNum >= _numFrames || !_opened) + if (frameNum >= _numFrames || frameNum < 0 || !_opened) return; uint8 *dst; @@ -430,7 +430,7 @@ int WSAMovieV2::open(const char *filename, int unk1, uint8 *palBuf) { void WSAMovieV2::displayFrame(int frameNum, ...) { debugC(9, kDebugLevelMovie, "WSAMovieV2::displayFrame(%d, ...)", frameNum); - if (frameNum >= _numFrames || !_opened) + if (frameNum >= _numFrames || frameNum < 0 || !_opened) return; uint8 *dst = 0; |