diff options
author | Strangerke | 2013-09-08 10:29:38 +0200 |
---|---|---|
committer | Strangerke | 2013-09-08 10:31:54 +0200 |
commit | f783f2c28a13e9513ec6a0fc0fccac22d3502d2d (patch) | |
tree | b8c79664cc973380053b99ffe6b0a89c22060c5f /engines | |
parent | 3f2ed1c803d36842b01320da28d4e68592317781 (diff) | |
download | scummvm-rg350-f783f2c28a13e9513ec6a0fc0fccac22d3502d2d.tar.gz scummvm-rg350-f783f2c28a13e9513ec6a0fc0fccac22d3502d2d.tar.bz2 scummvm-rg350-f783f2c28a13e9513ec6a0fc0fccac22d3502d2d.zip |
AVALANCHE: Silent some CppCheck warnings, rename some loop variables
Diffstat (limited to 'engines')
-rw-r--r-- | engines/avalanche/animation.cpp | 28 | ||||
-rw-r--r-- | engines/avalanche/detection.cpp | 3 | ||||
-rw-r--r-- | engines/avalanche/dropdown2.cpp | 3 | ||||
-rw-r--r-- | engines/avalanche/pingo2.cpp | 2 | ||||
-rw-r--r-- | engines/avalanche/scrolls2.cpp | 8 | ||||
-rw-r--r-- | engines/avalanche/visa2.cpp | 19 | ||||
-rw-r--r-- | engines/avalanche/visa2.h | 2 |
7 files changed, 30 insertions, 35 deletions
diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 127fbf9178..6b6138ca02 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -184,11 +184,8 @@ bool AnimationType::checkCollision() { } void AnimationType::walk() { - byte tc; - ByteField r; - - if (_visible) { + ByteField r; r._x1 = (_x / 8) - 1; if (r._x1 == 255) r._x1 = 0; @@ -204,8 +201,8 @@ void AnimationType::walk() { _oldY[_tr->_vm->_gyro->_cp] = _y; if (_homing) homestep(); - _x = _x + _moveX; - _y = _y + _moveY; + _x += _moveX; + _y += _moveY; } if (_doCheck) { @@ -214,7 +211,7 @@ void AnimationType::walk() { return; } - tc = _tr->checkfeet(_x, _x + _info._xLength, _oldY[_tr->_vm->_gyro->_cp], _y, _info._yLength) - 1; + byte tc = _tr->checkfeet(_x, _x + _info._xLength, _oldY[_tr->_vm->_gyro->_cp], _y, _info._yLength) - 1; // -1 is because the modified array indexes of magics[] compared to Pascal . if ((tc != 255) & (!_tr->_vm->_gyro->_doingSpriteRun)) { @@ -475,11 +472,8 @@ void Animation::loadtrip() { } byte Animation::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { - byte a, c; - int16 fv, ff; - // if not alive then begin checkfeet:=0; exit; end; - a = 0; + byte a = 0; //setactivepage(2); if (x1 < 0) @@ -487,17 +481,17 @@ byte Animation::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { if (x2 > 639) x2 = 639; if (oy < y) { - for (fv = x1; fv <= x2; fv++) { - for (ff = oy + yl; ff <= y + yl; ff++) { - c = *(byte *)_vm->_graphics->_magics.getBasePtr(fv, ff); + for (int16 i = x1; i <= x2; i++) { + for (int16 j = oy + yl; j <= y + yl; j++) { + byte c = *(byte *)_vm->_graphics->_magics.getBasePtr(i, j); if (c > a) a = c; } } } else { - for (fv = x1; fv <= x2; fv++) { - for (ff = y + yl; ff <= oy + yl; ff++) { - c = *(byte *)_vm->_graphics->_magics.getBasePtr(fv, ff); + for (int16 i = x1; i <= x2; i++) { + for (int16 j = y + yl; j <= oy + yl; j++) { + byte c = *(byte *)_vm->_graphics->_magics.getBasePtr(i, j); if (c > a) a = c; } diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index 39c6f0836f..97b823eb1d 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -117,13 +117,12 @@ SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { SaveStateList saveList; char slot[3]; - int slotNum = 0; for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) { slot[0] = filename->c_str()[filename->size() - 6]; slot[1] = filename->c_str()[filename->size() - 5]; slot[2] = '\0'; // Obtain the last 2 digits of the filename (without extension), since they correspond to the save slot - slotNum = atoi(slot); + int slotNum = atoi(slot); if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) { Common::InSaveFile *file = saveFileMan->openForLoading(*filename); if (file) { diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 74d0a25823..33a2671a8b 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -168,9 +168,8 @@ void MenuItem::wipe() { } void MenuItem::moveHighlight(int8 inc) { - int8 highlightNum; if (inc != 0) { - highlightNum = _highlightNum + inc; + int8 highlightNum = _highlightNum + inc; if ((highlightNum < 0) || (highlightNum >= _optionNum)) return; _highlightNum = highlightNum; diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp index e522254ab2..3ebb47ed98 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo2.cpp @@ -53,7 +53,7 @@ void Pingo::bossKey() { const months : array[0..11] of char = 'JFMAMJJASOND'; title = 'Net Profits'; - fish = #224; { à } + fish = 224; // 'à' var fv:byte; gd,gm:int16; r:char; begin; dusk; delavvy; diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 62f2fe3bf3..c79002a612 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -356,7 +356,8 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { _vm->_graphics->_scrolls.fillRect(Common::Rect(mx - lx - 15, my - ly, mx - lx - 14, my + ly), kColorRed); _vm->_graphics->_scrolls.fillRect(Common::Rect(mx + lx + 15, my - ly, mx + lx + 16, my + ly), kColorRed); - ex = mx - lx; +// CHECKME: unused? +// ex = mx - lx; // int16 ey = my - ly; mx -= lx; my -= ly + 2; @@ -466,7 +467,7 @@ void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { if (textWidth > xl) xl = textWidth; } - xl = xl / 2; + xl /= 2; int16 xw = xl + 18; int16 yw = yl + 7; @@ -505,7 +506,8 @@ void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, points, _vm->_gyro->_talkBackgroundColor); - yl -= 3; + // CHECKME: Unused? + // yl -= 3; // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Gyro::characters instead. diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 66f1faf4c8..b31b64bcf9 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -43,6 +43,7 @@ namespace Avalanche { Visa::Visa(AvalancheEngine *vm) { _vm = vm; + noError = true; } void Visa::unskrimble() { @@ -77,7 +78,7 @@ void Visa::dixi(char block, byte point, bool report, bool bubbling) { indexfile.close(); - went_ok = !error; + noError = !error; if (error) { if (report) { @@ -106,7 +107,6 @@ void Visa::dixi(char block, byte point, bool report, bool bubbling) { void Visa::speech(byte who, byte subject) { Common::File indexfile, sezfile; - uint16 idx_offset, sez_offset, next_idx_offset; if (subject == 0) { // No subject. @@ -114,7 +114,7 @@ void Visa::speech(byte who, byte subject) { } else { // Subject given. - went_ok = false; // Assume that until we know otherwise. + noError = false; // Assume that until we know otherwise. if (!indexfile.open("converse.avd")) { warning("AVALANCHE: Visa: File not found: converse.avd"); @@ -122,13 +122,14 @@ void Visa::speech(byte who, byte subject) { } indexfile.seek(who * 2 - 2); - idx_offset = indexfile.readUint16LE(); - next_idx_offset = indexfile.readUint16LE(); + uint16 idx_offset = indexfile.readUint16LE(); + uint16 next_idx_offset = indexfile.readUint16LE(); - if ((idx_offset == 0) || ((((next_idx_offset - idx_offset) / 2) - 1) < subject)) return; + if ((idx_offset == 0) || ((((next_idx_offset - idx_offset) / 2) - 1) < subject)) + return; indexfile.seek(idx_offset + subject * 2); - sez_offset = indexfile.readUint16LE(); + uint16 sez_offset = indexfile.readUint16LE(); if ((sez_offset == 0) || (indexfile.err())) return; indexfile.close(); @@ -146,7 +147,7 @@ void Visa::speech(byte who, byte subject) { do_the_bubble(); _vm->_scrolls->callScrollDriver(); - went_ok = true; + noError = true; } warning("STUB: Visa::speech()"); @@ -263,7 +264,7 @@ void Visa::talkto(byte whom) { speech(whom, _vm->_gyro->_subjectNum); - if (!went_ok) + if (!noError) dixi('n', whom); // File not found! if ((_vm->_gyro->_subjectNum == 0) && ((whom + 149) == _vm->_gyro->kPeopleCrapulus)) { // Crapulus: get the badge - first time only diff --git a/engines/avalanche/visa2.h b/engines/avalanche/visa2.h index 9d26d7a747..2d12e3322d 100644 --- a/engines/avalanche/visa2.h +++ b/engines/avalanche/visa2.h @@ -44,7 +44,7 @@ public: private: AvalancheEngine *_vm; - bool went_ok; + bool noError; void unskrimble(); void do_the_bubble(); void speech(byte who, byte subject); |