aboutsummaryrefslogtreecommitdiff
path: root/engines/gob
diff options
context:
space:
mode:
authorSven Hesse2010-10-15 04:37:44 +0000
committerSven Hesse2010-10-15 04:37:44 +0000
commit089988c11c379e1b48c198a867215365373f6b11 (patch)
tree64b9d760ce526c71e5f05d8691646002f150668b /engines/gob
parentdad3f32278436be0831ac19393d4dc77d0b634ea (diff)
downloadscummvm-rg350-089988c11c379e1b48c198a867215365373f6b11.tar.gz
scummvm-rg350-089988c11c379e1b48c198a867215365373f6b11.tar.bz2
scummvm-rg350-089988c11c379e1b48c198a867215365373f6b11.zip
GOB: Fix Code analysis warnings
See bug report #3087831 svn-id: r53464
Diffstat (limited to 'engines/gob')
-rw-r--r--engines/gob/draw.cpp2
-rw-r--r--engines/gob/draw_playtoons.cpp2
-rw-r--r--engines/gob/game.cpp22
-rw-r--r--engines/gob/sound/adlib.cpp2
4 files changed, 17 insertions, 11 deletions
diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp
index 960f4e9e34..5c918e6b7e 100644
--- a/engines/gob/draw.cpp
+++ b/engines/gob/draw.cpp
@@ -328,7 +328,7 @@ void Draw::adjustCoords(char adjust, int16 *coord1, int16 *coord2) {
if (coord2)
*coord2 *= 2;
if (coord1)
- *coord2 *= 2;
+ *coord1 *= 2;
break;
case 1:
diff --git a/engines/gob/draw_playtoons.cpp b/engines/gob/draw_playtoons.cpp
index 8d8f040924..fc5521a959 100644
--- a/engines/gob/draw_playtoons.cpp
+++ b/engines/gob/draw_playtoons.cpp
@@ -151,7 +151,7 @@ void Draw_Playtoons::spriteOperation(int16 operation) {
case DRAW_PUTPIXEL:
switch (_pattern & 0xFF) {
- case -1:
+ case 0xFF:
warning("oPlaytoons_spriteOperation: operation DRAW_PUTPIXEL, pattern -1");
break;
case 1:
diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp
index f77b3e946a..bf0dc4147c 100644
--- a/engines/gob/game.cpp
+++ b/engines/gob/game.cpp
@@ -319,10 +319,12 @@ void Game::playTot(int16 skipPlay) {
_vm->_inter->renewTimeInVars();
- WRITE_VAR(13, _vm->_global->_useMouse);
- WRITE_VAR(14, _vm->_global->_soundFlags);
- WRITE_VAR(15, _vm->_global->_fakeVideoMode);
- WRITE_VAR(16, _vm->_global->_language);
+ if (_vm->_inter->_variables) {
+ WRITE_VAR(13, _vm->_global->_useMouse);
+ WRITE_VAR(14, _vm->_global->_soundFlags);
+ WRITE_VAR(15, _vm->_global->_fakeVideoMode);
+ WRITE_VAR(16, _vm->_global->_language);
+ }
_vm->_inter->callSub(2);
@@ -335,8 +337,9 @@ void Game::playTot(int16 skipPlay) {
_resources->unload();
- for (int i = 0; i < *_vm->_scenery->_pCaptureCounter; i++)
- capturePop(0);
+ if (_vm->_scenery->_pCaptureCounter)
+ for (int i = 0; i < *_vm->_scenery->_pCaptureCounter; i++)
+ capturePop(0);
if (skipPlay != -1) {
_vm->_goblin->freeObjects();
@@ -357,7 +360,9 @@ void Game::playTot(int16 skipPlay) {
if (_totToLoad[0] == 0)
break;
- strcpy(_curTotFile, _totToLoad);
+ strncpy(_curTotFile, _totToLoad, 14);
+ _curTotFile[13] = '\0';
+
}
} else {
_vm->_inter->initControlVars(0);
@@ -370,7 +375,8 @@ void Game::playTot(int16 skipPlay) {
_vm->_inter->_terminate = 2;
}
- strcpy(_curTotFile, savedTotName);
+ strncpy(_curTotFile, savedTotName, 14);
+ _curTotFile[13] = '\0';
_vm->_inter->_nestLevel = oldNestLevel;
_vm->_inter->_breakFromLevel = oldBreakFrom;
diff --git a/engines/gob/sound/adlib.cpp b/engines/gob/sound/adlib.cpp
index 28123668cc..d643ae511b 100644
--- a/engines/gob/sound/adlib.cpp
+++ b/engines/gob/sound/adlib.cpp
@@ -240,7 +240,7 @@ void AdLib::setKey(byte voice, byte note, bool on, bool spec) {
freq = _freqs[_notLin[voice]][note - octa * 12];
writeOPL(0xA0 + voice, freq & 0xFF);
- writeOPL(0xB0 + voice, (freq >> 8) | (octa << 2) | 0x20 * on);
+ writeOPL(0xB0 + voice, (freq >> 8) | (octa << 2) | (0x20 * (on ? 1 : 0)));
if (!freq)
warning("AdLib::setKey Voice %d, note %02X unknown", voice, note);