diff options
author | Strangerke | 2013-09-16 22:57:38 +0200 |
---|---|---|
committer | Strangerke | 2013-09-16 22:57:38 +0200 |
commit | 6e08f55160eb9048d892d0b2f13cf4eb12206cc3 (patch) | |
tree | 45a044350f50b2d5a80b5c16daed8dc98bbc655c | |
parent | 68533445a0c8f308907ad815b28abb2ba558e161 (diff) | |
download | scummvm-rg350-6e08f55160eb9048d892d0b2f13cf4eb12206cc3.tar.gz scummvm-rg350-6e08f55160eb9048d892d0b2f13cf4eb12206cc3.tar.bz2 scummvm-rg350-6e08f55160eb9048d892d0b2f13cf4eb12206cc3.zip |
AVALANCHE: Review all for statements
-rw-r--r-- | engines/avalanche/acci.cpp | 38 | ||||
-rw-r--r-- | engines/avalanche/animation.cpp | 18 | ||||
-rw-r--r-- | engines/avalanche/avalanche.cpp | 14 | ||||
-rw-r--r-- | engines/avalanche/avalot.cpp | 6 | ||||
-rw-r--r-- | engines/avalanche/celer.cpp | 6 | ||||
-rw-r--r-- | engines/avalanche/detection.cpp | 4 | ||||
-rw-r--r-- | engines/avalanche/dropdown.cpp | 22 | ||||
-rw-r--r-- | engines/avalanche/graphics.cpp | 28 | ||||
-rw-r--r-- | engines/avalanche/gyro.cpp | 18 | ||||
-rw-r--r-- | engines/avalanche/lucerna.cpp | 62 | ||||
-rw-r--r-- | engines/avalanche/parser.cpp | 2 | ||||
-rw-r--r-- | engines/avalanche/pingo.cpp | 2 | ||||
-rw-r--r-- | engines/avalanche/scrolls.cpp | 22 | ||||
-rw-r--r-- | engines/avalanche/timer.cpp | 6 |
14 files changed, 124 insertions, 124 deletions
diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index 3b46053e56..b607478ba9 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -370,7 +370,7 @@ void Acci::init() { } void Acci::clearWords() { - for (byte i = 0; i < 11; i++) { + for (int i = 0; i < 11; i++) { if (!_realWords[i].empty()) _realWords[i].clear(); } @@ -400,7 +400,7 @@ void Acci::replace(Common::String oldChars, byte newChar) { if (newChar == 0) _thats.deleteChar(pos); else { - for (byte i = pos; i < pos + oldChars.size(); i++) + for (uint i = pos; i < pos + oldChars.size(); i++) _thats.deleteChar(pos); _thats.insertChar(newChar, pos); } @@ -417,7 +417,7 @@ Common::String Acci::rank() { {32767, "copyright'93"} }; - for (byte i = 0; i < 8; i++) { + for (int i = 0; i < 8; i++) { if ((_vm->_gyro->_dnascore >= kRanks[i]._score) && (_vm->_gyro->_dnascore < kRanks[i + 1]._score)) { return kRanks[i]._title; } @@ -458,7 +458,7 @@ void Acci::cheatParse(Common::String codes) { void Acci::stripPunctuation(Common::String &word) { const char punct[] = "~`!@#$%^&*()_+-={}[]:\"|;'\\,./<>?"; - for (byte i = 0; i < 32; i++) { + for (int i = 0; i < 32; i++) { for (;;) { int16 pos = _vm->_parser->pos(Common::String(punct[i]), word); if (pos == -1) @@ -492,7 +492,7 @@ void Acci::displayWhat(byte target, bool animate, bool &ambiguous) { bool Acci::doPronouns() { bool ambiguous = false; - for (byte i = 0; i < _thats.size(); i++) { + for (uint i = 0; i < _thats.size(); i++) { byte wordCode = _thats[i]; switch (wordCode) { case 200: @@ -517,7 +517,7 @@ void Acci::properNouns() { _vm->_parser->_inputText.toLowercase(); // We set every word's first character to uppercase. - for (byte i = 1; i < (_vm->_parser->_inputText.size() - 1); i++) { + for (uint i = 1; i < (_vm->_parser->_inputText.size() - 1); i++) { if (_vm->_parser->_inputText[i] == ' ') _vm->_parser->_inputText.setChar(toupper(_vm->_parser->_inputText[i + 1]), i + 1); } @@ -644,7 +644,7 @@ void Acci::parse() { // Check also[] first, which contains words about the actual room. if (!thisword.empty()) { - for (byte i = 0; i < 31; i++) { + for (int i = 0; i < 31; i++) { if ((_vm->_gyro->_also[i][0] != 0) && (_vm->_parser->pos(',' + thisword, *_vm->_gyro->_also[i][0]) > -1)) { _thats += Common::String(99 + i); notfound = false; @@ -666,13 +666,13 @@ void Acci::parse() { // Delete words we already processed. int16 spacePos = _vm->_parser->pos(Common::String(' '), inputTextUpper); if (spacePos > -1) { - for (byte i = 0; i <= spacePos; i++) + for (int i = 0; i <= spacePos; i++) inputTextUpper.deleteChar(0); } spacePos = _vm->_parser->pos(Common::String(' '), inputText); if (spacePos > -1) { - for (byte i = 0; i <= spacePos; i++) + for (int i = 0; i <= spacePos; i++) inputText.deleteChar(0); } } @@ -911,7 +911,7 @@ void Acci::inventory() { byte itemNum = 0; Common::String tmpStr = Common::String("You're carrying "); - for (byte i = 0; i < kObjectNum; i++) { + for (int i = 0; i < kObjectNum; i++) { if (_vm->_gyro->_objects[i]) { itemNum++; if (itemNum == _vm->_gyro->_carryNum) @@ -993,7 +993,7 @@ void Acci::swallow() { // Eat something. void Acci::peopleInRoom() { byte numPeople = 0; // Number of people in the room. - for (byte i = 1; i < 29; i++) { // Start at 1 so we don't list Avvy himself! + for (int i = 1; i < 29; i++) { // Start at 1 so we don't list Avvy himself! if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_room) numPeople++; } @@ -1003,7 +1003,7 @@ void Acci::peopleInRoom() { Common::String tmpStr; byte actPerson = 0; // Actually listed people. - for (byte i = 1; i < 29; i++) { + for (int i = 1; i < 29; i++) { if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_room) { actPerson++; if (actPerson == 1) // First on the list. @@ -1087,7 +1087,7 @@ void Acci::openDoor() { if ((!_vm->_gyro->_userMovesAvvy) && (_vm->_gyro->_room != kRoomLusties)) return; // No doors can open if you can't move Avvy. - for (byte i = 0; i < 7; i++) { + for (int i = 0; i < 7; i++) { if (_vm->_animation->inField(i + 8)) { MagicType *portal = &_vm->_gyro->_portals[i]; switch (portal->_operation) { @@ -1453,7 +1453,7 @@ Common::String Acci::personSpeaks() { bool found = false; // The _person we're looking for's code is in _person. Common::String tmpStr; - for (byte i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { + for (int i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _person)) { tmpStr += Common::String::format("%c%c", Scrolls::kControlRegister, '1' + i); found = true; @@ -1463,7 +1463,7 @@ Common::String Acci::personSpeaks() { if (found) return tmpStr; - for (byte i = 0; i < 16; i++) { + for (int i = 0; i < 16; i++) { if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_room)) tmpStr += Common::String::format("%c%c", Scrolls::kControlRegister, 'A' + i); } @@ -1550,7 +1550,7 @@ void Acci::doThat() { } else if (((1 <= _vm->_gyro->_subjectNum) && (_vm->_gyro->_subjectNum <= 49)) || (_vm->_gyro->_subjectNum == 253) || (_vm->_gyro->_subjectNum == 249)) { _thats.deleteChar(0); - for (byte i = 0; i < 10; i++) + for (int i = 0; i < 10; i++) _realWords[i] = _realWords[i + 1]; _verb = _vm->_gyro->_subjectNum; @@ -1701,7 +1701,7 @@ void Acci::doThat() { _vm->_scrolls->_aboutScroll = true; Common::String toDisplay; - for (byte i = 0; i < 7; i++) + for (int i = 0; i < 7; i++) toDisplay += Scrolls::kControlNewLine; toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + Scrolls::kControlCenter + Scrolls::kControlNewLine + "The medi\x91val descendant of" + Scrolls::kControlNewLine @@ -2068,11 +2068,11 @@ void Acci::doThat() { _vm->_scrolls->displayScrollChain('Q', 12); else { bool ok = true; - for (byte i = 0; i < _thats.size(); i++) { + for (uint i = 0; i < _thats.size(); i++) { Common::String temp = _realWords[i]; temp.toUppercase(); int pwdId = _vm->_gyro->_passwordNum + kFirstPassword; - for (byte j = 0; j < _vocabulary[pwdId]._word.size(); j++) { + for (uint j = 0; j < _vocabulary[pwdId]._word.size(); j++) { if (_vocabulary[pwdId]._word[j] != temp[j]) ok = false; } diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 3bd3bde1a3..edcc53cdcf 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -70,13 +70,13 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) { if (!_stat._name.empty()) _stat._name.clear(); byte nameSize = inf.readByte(); - for (byte i = 0; i < nameSize; i++) + for (int i = 0; i < nameSize; i++) _stat._name += inf.readByte(); inf.skip(12 - nameSize); //inf.skip(1); // Same as above. byte commentSize = inf.readByte(); - for (byte i = 0; i < commentSize; i++) + for (int i = 0; i < commentSize; i++) _stat._comment += inf.readByte(); inf.skip(16 - commentSize); @@ -93,10 +93,10 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) { _info._xWidth = _info._xLength / 8; if ((_info._xLength % 8) > 0) _info._xWidth++; - for (byte i = 0; i < _stat._frameNum; i++) { + for (int i = 0; i < _stat._frameNum; i++) { _info._sil[_animCount] = new SilType[11 * (_info._yLength + 1)]; _info._mani[_animCount] = new ManiType[_info._size - 6]; - for (byte j = 0; j <= _info._yLength; j++) + for (int j = 0; j <= _info._yLength; j++) inf.read((*_info._sil[_animCount])[j], _info._xWidth); inf.read(*_info._mani[_animCount], _info._size - 6); @@ -163,7 +163,7 @@ void AnimationType::appear(int16 wx, int16 wy, byte wf) { * @remarks Originally called 'collision_check' */ bool AnimationType::checkCollision() { - for (byte i = 0; i < _anim->kSpriteNumbMax; i++) { + for (int i = 0; i < _anim->kSpriteNumbMax; i++) { AnimationType *spr = &_anim->_sprites[i]; if (spr->_quick && (spr->_id != _id) && (_x + _info._xLength > spr->_x) && (_x < spr->_x + spr->_info._xLength) && (spr->_y == _y)) return true; @@ -343,7 +343,7 @@ void AnimationType::remove() { _info._xWidth = _info._xLength / 8; if ((_info._xLength % 8) > 0) _info._xWidth++; - for (byte i = 0; i < _stat._frameNum; i++) { + for (int i = 0; i < _stat._frameNum; i++) { assert(_animCount > 0); _animCount--; delete[] _info._mani[_animCount]; @@ -1200,7 +1200,7 @@ void Animation::drawSprites() { do { ok = true; - for (byte i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { if (((order[i] != -1) && (order[i + 1] != -1)) && (_sprites[order[i]]._y > _sprites[order[i + 1]]._y)) { // Swap them! @@ -1215,7 +1215,7 @@ void Animation::drawSprites() { _vm->_graphics->refreshBackground(); - for (byte i = 0; i < 5; i++) { + for (int i = 0; i < 5; i++) { if (order[i] > -1) _sprites[order[i]].draw(); } @@ -1364,7 +1364,7 @@ bool Animation::nearDoor() { int16 ux = _sprites[0]._x; int16 uy = _sprites[0]._y + _sprites[0]._info._yLength; - for (byte i = 8; i < _vm->_gyro->_fieldNum; i++) { + for (int i = 8; i < _vm->_gyro->_fieldNum; i++) { FieldType *curField = &_vm->_gyro->_fields[i]; if ((ux >= curField->_x1) && (ux <= curField->_x2) && (uy >= curField->_y1) && (uy <= curField->_y2)) return true; diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 75ab53f870..33c72c848f 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -121,7 +121,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { //blockwrite(f, dna, sizeof(dna)); sz.syncAsByte(_animation->_direction); sz.syncAsByte(_gyro->_carryNum); - for (byte i = 0; i < kObjectNum; i++) + for (int i = 0; i < kObjectNum; i++) sz.syncAsByte(_gyro->_objects[i]); sz.syncAsSint16LE(_gyro->_dnascore); sz.syncAsSint32LE(_gyro->_money); @@ -262,7 +262,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { #if 0 - for (byte groi = 0; groi < numtr; groi++) { + for (int groi = 0; groi < numtr; groi++) { if (tr[groi].quick) { blockwrite(f, groi, 1); tr[groi].savedata(f); @@ -272,7 +272,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { byte spriteNum = 0; if (sz.isSaving()) { - for (byte i = 0; i < _animation->kSpriteNumbMax; i++) { + for (int i = 0; i < _animation->kSpriteNumbMax; i++) { if (_animation->_sprites[i]._quick) spriteNum++; } @@ -280,14 +280,14 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(spriteNum); if (sz.isLoading()) { - for (byte i = 0; i < _animation->kSpriteNumbMax; i++) { // Deallocate sprites. + for (int i = 0; i < _animation->kSpriteNumbMax; i++) { // Deallocate sprites. AnimationType *spr = &_animation->_sprites[i]; if (spr->_quick) spr->remove(); } } - for (byte i = 0; i < spriteNum; i++) { + for (int i = 0; i < spriteNum; i++) { AnimationType *spr = &_animation->_sprites[i]; sz.syncAsByte(spr->_id); sz.syncAsByte(spr->_doCheck); @@ -324,7 +324,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { //blockwrite(f, groi, 1); //blockwrite(f, times, sizeof(times)); // Timeout.times: Timers. - for (byte i = 0; i < 7; i++) { + for (int i = 0; i < 7; i++) { sz.syncAsSint32LE(_timer->_times[i]._timeLeft); sz.syncAsByte(_timer->_times[i]._action); sz.syncAsByte(_timer->_times[i]._reason); @@ -396,7 +396,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { // Check for our signature. Common::String signature; - for (byte i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) signature += f->readByte(); if (signature != "AVAL") return false; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 1330ee51ad..2d93ed8954 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -149,7 +149,7 @@ void Avalot::setup() { _vm->_gyro->_enidFilename = ""; // Undefined. _vm->_lucerna->drawToolbar(); _vm->_scrolls->setReadyLight(2); - for (byte i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) _vm->_gyro->_scoreToDisplay[i] = -1; // Impossible digits. _vm->_animation->loadAnims(); @@ -198,12 +198,12 @@ void Avalot::run(Common::String arg) { #ifdef DEBUG // ONLY FOR TESTING!!! - for (byte i = 0; i < _vm->_gyro->_lineNum; i++) { + for (int i = 0; i < _vm->_gyro->_lineNum; i++) { LineType *curLine = &_vm->_gyro->_lines[i]; _vm->_graphics->_surface.drawLine(curLine->_x1, curLine->_y1, curLine->_x2, curLine->_y2, curLine->col); } - for (byte i = 0; i < _vm->_gyro->_fieldNum; i++) { + for (int i = 0; i < _vm->_gyro->_fieldNum; i++) { FieldType *curField = &_vm->_gyro->_fields[i]; if (curField->_x1 < 640) _vm->_graphics->_surface.frameRect(Common::Rect(curField->_x1, curField->_y1, curField->_x2, curField->_y2), kColorLightmagenta); diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp index f6e3773ae3..6edb4d2bb4 100644 --- a/engines/avalanche/celer.cpp +++ b/engines/avalanche/celer.cpp @@ -272,10 +272,10 @@ void Celer::loadBackgroundSprites(byte number) { f.seek(44); _spriteNum = f.readByte(); - for (byte i = 0; i < _spriteNum; i++) + for (int i = 0; i < _spriteNum; i++) _offsets[i] = f.readSint32LE(); - for (byte i = 0; i < _spriteNum; i++) { + for (int i = 0; i < _spriteNum; i++) { f.seek(_offsets[i]); SpriteType sprite; @@ -315,7 +315,7 @@ void Celer::loadBackgroundSprites(byte number) { } void Celer::forgetBackgroundSprites() { - for (byte i = 0; i < _spriteNum; i++) { + for (int i = 0; i < _spriteNum; i++) { if (_sprites[i]._x > kOnDisk) _sprites[i]._picture.free(); } diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index 97b823eb1d..6e34a5afb9 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -128,7 +128,7 @@ SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { if (file) { // Check for our signature. Common::String signature; - for (byte i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) signature += file->readByte(); if (signature != "AVAL") { warning("Savegame of incompatible type!"); @@ -176,7 +176,7 @@ SaveStateDescriptor AvalancheMetaEngine::querySaveMetaInfos(const char *target, if (f) { // Check for our signature. Common::String signature; - for (byte i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) signature += f->readByte(); if (signature != "AVAL") { warning("Savegame of incompatible type!"); diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp index edf99ae9a2..d088654c6a 100644 --- a/engines/avalanche/dropdown.cpp +++ b/engines/avalanche/dropdown.cpp @@ -143,7 +143,7 @@ void MenuItem::display() { _dr->_vm->_graphics->_surface.frameRect(Common::Rect((_flx1 + 1) * 8 - 1, 11, (_flx2 + 1) * 8 + 1, fly + 1), _dr->kMenuBorderColor); displayOption(0, true); - for (byte y = 1; y < _optionNum; y++) + for (int y = 1; y < _optionNum; y++) displayOption(y, false); _dr->_vm->_gyro->_defaultLed = 1; @@ -209,7 +209,7 @@ void MenuItem::select(byte which) { void MenuItem::parseKey(char c) { c = toupper(c); bool found = false; - for (byte i = 0; i < _optionNum; i++) { + for (int i = 0; i < _optionNum; i++) { if ((toupper(_options[i]._trigger) == c) && _options[i]._valid) { select(i); found = true; @@ -237,7 +237,7 @@ void MenuBar::draw() { byte savecp = _dr->_vm->_gyro->_cp; _dr->_vm->_gyro->_cp = 3; - for (byte i = 0; i < _menuNum; i++) + for (int i = 0; i < _menuNum; i++) _menuItems[i].draw(); _dr->_vm->_gyro->_cp = savecp; @@ -325,12 +325,12 @@ void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text, ander = 170; FontType font; - for (byte i = 0; i < text.size(); i++) { - for (byte j = 0; j < 8; j++) { + for (uint i = 0; i < text.size(); i++) { + for (int j = 0; j < 8; j++) { byte idx = text[i]; font[idx][j] = _vm->_gyro->_font[idx][j] & ander; // Set the font. // And set the background of the text to the desired color. - for (byte k = 0; k < 8; k++) + for (int k = 0; k < 8; k++) *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + i * 8 + k, y + j) = backgroundColor; } } @@ -346,7 +346,7 @@ void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text, ; // Search for the character in the string. byte pixel = ander; - for (byte bit = 0; bit < 8; bit++) { + for (int bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; if (pixelBit) *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + i * 8 + 7 - bit, y + 8) = fontColor; @@ -438,7 +438,7 @@ void Dropdown::setupMenuAction() { _activeMenuItem.reset(); Common::String f5Does = _vm->_gyro->f5Does(); - for (byte i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) if (!f5Does.empty()) f5Does.deleteChar(0); if (f5Does.empty()) @@ -466,7 +466,7 @@ void Dropdown::setupMenuPeople() { _activeMenuItem.reset(); - for (byte i = 150; i <= 178; i++) { + for (int i = 150; i <= 178; i++) { if (_vm->_gyro->_whereIs[i - 150] == _vm->_gyro->_room) { _activeMenuItem.setupOption(_vm->_gyro->getName(i), _vm->_gyro->getNameChar(i), "", true); people += i; @@ -478,7 +478,7 @@ void Dropdown::setupMenuPeople() { void Dropdown::setupMenuObjects() { _activeMenuItem.reset(); - for (byte i = 0; i < kObjectNum; i++) { + for (int i = 0; i < kObjectNum; i++) { if (_vm->_gyro->_objects[i]) _activeMenuItem.setupOption(_vm->_gyro->getThing(i + 1), _vm->_gyro->getThingChar(i + 1), "", true); } @@ -491,7 +491,7 @@ void Dropdown::setupMenuWith() { if (_vm->_gyro->_thinkThing) { findWhatYouCanDoWithIt(); - for (byte i = 0; i < _vm->_gyro->_verbStr.size(); i++) { + for (uint i = 0; i < _vm->_gyro->_verbStr.size(); i++) { char vbchar; Common::String verb; diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index a6cbe3d765..5b5d39ec6c 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -62,7 +62,7 @@ void Graphics::init() { _egaPalette[i][2] = (i & 1) * 0xaa + (i >> 3 & 1) * 0x55; } - for (byte i = 0; i < 16; i++) + for (int i = 0; i < 16; i++) g_system->getPaletteManager()->setPalette(_egaPalette[kEgaPaletteIndex[i]], i, 1); _surface.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); @@ -176,7 +176,7 @@ void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte // Get the top and the bottom of the triangle. uint16 maxY = p[0].y, minY = p[0].y; - for (byte i = 1; i < 3; i++) { + for (int i = 1; i < 3; i++) { if (p[i].y < minY) minY = p[i].y; if (p[i].y > maxY) @@ -206,10 +206,10 @@ void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte } void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, byte color) { - for (byte i = 0; i < text.size(); i++) { - for (byte j = 0; j < fontHeight; j++) { + for (uint i = 0; i < text.size(); i++) { + for (int j = 0; j < fontHeight; j++) { byte pixel = font[(byte)text[i]][j]; - for (byte bit = 0; bit < 8; bit++) { + for (int bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; if (pixelBit) *(byte *)surface.getBasePtr(x + i * 8 + 7 - bit, y + j) = color; @@ -228,11 +228,11 @@ void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text picture.create(width, height, ::Graphics::PixelFormat::createFormatCLUT8()); // Produce the picture. We read it in row-by-row, and every row has 4 planes. - for (byte y = 0; y < height; y++) { + for (int y = 0; y < height; y++) { for (int8 plane = 3; plane >= 0; plane--) { // The planes are in the opposite way. for (uint16 x = 0; x < width; x += 8) { byte pixel = file.readByte(); - for (byte bit = 0; bit < 8; bit++) { + for (int bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; if (pixelBit != 0) *(byte *)picture.getBasePtr(x + 7 - bit, y) += (pixelBit << plane); @@ -251,11 +251,11 @@ void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text ::Graphics::Surface picture; picture.create(width, height, ::Graphics::PixelFormat::createFormatCLUT8()); - for (byte plane = 0; plane < 4; plane++) { + for (int plane = 0; plane < 4; plane++) { for (uint16 y = 0; y < height; y++) { for (uint16 x = 0; x < width; x += 8) { byte pixel = file.readByte(); - for (byte i = 0; i < 8; i++) { + for (int i = 0; i < 8; i++) { byte pixelBit = (pixel >> i) & 1; *(byte *)picture.getBasePtr(x + 7 - i, y) += (pixelBit << plane); } @@ -268,8 +268,8 @@ void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { // First we make the pixels of the spirte blank. - for (byte j = 0; j < sprite._yLength; j++) { - for (byte i = 0; i < sprite._xLength; i++) { + for (int j = 0; j < sprite._yLength; j++) { + for (int i = 0; i < sprite._xLength; i++) { if (((*sprite._sil[picnum])[j][i / 8] >> ((7 - i % 8)) & 1) == 0) *(byte *)_surface.getBasePtr(x + i, y + j) = 0; } @@ -278,11 +278,11 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 // Then we draw the picture to the blank places. uint16 maniPos = 0; // Because the original manitype starts at 5!!! See Graphics.h for definition. - for (byte j = 0; j < sprite._yLength; j++) { + for (int j = 0; j < sprite._yLength; j++) { for (int8 plane = 3; plane >= 0; plane--) { // The planes are in the opposite way. for (uint16 i = 0; i < sprite._xLength; i += 8) { byte pixel = (*sprite._mani[picnum])[maniPos++]; - for (byte bit = 0; bit < 8; bit++) { + for (int bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; *(byte *)_surface.getBasePtr(x + i + 7 - bit, y + j) += (pixelBit << plane); } @@ -304,7 +304,7 @@ void Graphics::refreshScreen() { // These cycles are for doubling the screen height. for (uint16 y = 0; y < _screen.h / 2; y++) { for (uint16 x = 0; x < _screen.w; x++) { - for (byte j = 0; j < 2; j++) + for (int j = 0; j < 2; j++) *(byte *)_screen.getBasePtr(x, y * 2 + j) = *(byte *)_surface.getBasePtr(x, y); } } diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index 62dd4a3805..2cb9d0e6e8 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -182,7 +182,7 @@ Gyro::Gyro(AvalancheEngine *vm) : _interrogation(0), _onCanDoPageSwap(true) { } Gyro::~Gyro() { - for (byte i = 0; i < 9; i++) { + for (int i = 0; i < 9; i++) { _digits[i].free(); _directions[i].free(); } @@ -309,7 +309,7 @@ void Gyro::resetVariables() { } void Gyro::newGame() { - for (byte i = 0; i < kMaxSprites; i++) { + for (int i = 0; i < kMaxSprites; i++) { AnimationType *spr = &_vm->_animation->_sprites[i]; if (spr->_quick) spr->remove(); @@ -550,9 +550,9 @@ void Gyro::loadMouse(byte which) { ::Graphics::Surface mask = _vm->_graphics->loadPictureGraphic(f); - for (byte j = 0; j < mask.h; j++) { - for (byte i = 0; i < mask.w; i++) { - for (byte k = 0; k < 2; k++) { + for (int j = 0; j < mask.h; j++) { + for (int i = 0; i < mask.w; i++) { + for (int k = 0; k < 2; k++) { if (*(byte *)mask.getBasePtr(i, j) == 0) *(byte *)cursor.getBasePtr(i, j * 2 + k) = 0; } @@ -566,9 +566,9 @@ void Gyro::loadMouse(byte which) { mask = _vm->_graphics->loadPictureGraphic(f); - for (byte j = 0; j < mask.h; j++) { - for (byte i = 0; i < mask.w; i++) { - for (byte k = 0; k < 2; k++) { + for (int j = 0; j < mask.h; j++) { + for (int i = 0; i < mask.w; i++) { + for (int k = 0; k < 2; k++) { byte pixel = *(byte *)mask.getBasePtr(i, j); if (pixel != 0) *(byte *)cursor.getBasePtr(i, j * 2 + k) = pixel; @@ -588,7 +588,7 @@ void Gyro::setBackgroundColor(byte x) { } void Gyro::hangAroundForAWhile() { - for (byte i = 0; i < 28; i++) + for (int i = 0; i < 28; i++) slowDown(); } diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 3fdca0c561..2b75d5abcc 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -117,8 +117,8 @@ Lucerna::Lucerna(AvalancheEngine *vm) : _fxHidden(false), _clock(vm) { } Lucerna::~Lucerna() { - for (byte i = 0; i < 31; i++) { - for (byte j = 0; j < 2; j++) { + for (int i = 0; i < 31; i++) { + for (int j = 0; j < 2; j++) { if (_vm->_gyro->_also[i][j] != 0) { delete _vm->_gyro->_also[i][j]; _vm->_gyro->_also[i][j] = 0; @@ -128,8 +128,8 @@ Lucerna::~Lucerna() { } void Lucerna::init() { - for (byte i = 0; i < 31; i++) { - for (byte j = 0; j < 2; j++) + for (int i = 0; i < 31; i++) { + for (int j = 0; j < 2; j++) _vm->_gyro->_also[i][j] = 0; } @@ -165,7 +165,7 @@ void Lucerna::drawAlsoLines() { _vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 640, 161), 15); - for (byte i = 0; i < _vm->_gyro->_lineNum; i++) { + for (int i = 0; i < _vm->_gyro->_lineNum; i++) { // We had to check if the lines are within the borders of the screen. if ((_vm->_gyro->_lines[i]._x1 >= 0) && (_vm->_gyro->_lines[i]._x1 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->_lines[i]._y1 >= 0) && (_vm->_gyro->_lines[i]._y1 < _vm->_graphics->kScreenHeight) && (_vm->_gyro->_lines[i]._x2 >= 0) && (_vm->_gyro->_lines[i]._x2 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->_lines[i]._y2 >= 0) && (_vm->_gyro->_lines[i]._y2 < _vm->_graphics->kScreenHeight)) @@ -195,8 +195,8 @@ void Lucerna::scram(Common::String &str) { } void Lucerna::unScramble() { - for (byte i = 0; i < 31; i++) { - for (byte j = 0; j < 2; j++) { + for (int i = 0; i < 31; i++) { + for (int j = 0; j < 2; j++) { if (_vm->_gyro->_also[i][j] != 0) scram(*_vm->_gyro->_also[i][j]); } @@ -206,8 +206,8 @@ void Lucerna::unScramble() { } void Lucerna::loadAlso(byte num) { - for (byte i = 0; i < 31; i++) { - for (byte j = 0; j < 2; j++) { + for (int i = 0; i < 31; i++) { + for (int j = 0; j < 2; j++) { if (_vm->_gyro->_also[i][j] != 0) { delete _vm->_gyro->_also[i][j]; _vm->_gyro->_also[i][j] = 0; @@ -223,8 +223,8 @@ void Lucerna::loadAlso(byte num) { byte alsoNum = file.readByte(); Common::String tmpStr; - for (byte i = 0; i <= alsoNum; i++) { - for (byte j = 0; j < 2; j++) { + for (int i = 0; i <= alsoNum; i++) { + for (int j = 0; j < 2; j++) { _vm->_gyro->_also[i][j] = new Common::String; *_vm->_gyro->_also[i][j] = readAlsoStringFromFile(); } @@ -235,7 +235,7 @@ void Lucerna::loadAlso(byte num) { memset(_vm->_gyro->_lines, 0xFF, sizeof(_vm->_gyro->_lines)); _vm->_gyro->_lineNum = file.readByte(); - for (byte i = 0; i < _vm->_gyro->_lineNum; i++) { + for (int i = 0; i < _vm->_gyro->_lineNum; i++) { LineType *curLine = &_vm->_gyro->_lines[i]; curLine->_x1 = file.readSint16LE(); curLine->_y1 = file.readSint16LE(); @@ -246,7 +246,7 @@ void Lucerna::loadAlso(byte num) { memset(_vm->_gyro->_peds, 177, sizeof(_vm->_gyro->_peds)); byte pedNum = file.readByte(); - for (byte i = 0; i < pedNum; i++) { + for (int i = 0; i < pedNum; i++) { PedType *curPed = &_vm->_gyro->_peds[i]; curPed->_x = file.readSint16LE(); curPed->_y = file.readSint16LE(); @@ -254,7 +254,7 @@ void Lucerna::loadAlso(byte num) { } _vm->_gyro->_fieldNum = file.readByte(); - for (byte i = 0; i < _vm->_gyro->_fieldNum; i++) { + for (int i = 0; i < _vm->_gyro->_fieldNum; i++) { FieldType *curField = &_vm->_gyro->_fields[i]; curField->_x1 = file.readSint16LE(); curField->_y1 = file.readSint16LE(); @@ -262,32 +262,32 @@ void Lucerna::loadAlso(byte num) { curField->_y2 = file.readSint16LE(); } - for (byte i = 0; i < 15; i++) { + for (int i = 0; i < 15; i++) { MagicType *magic = &_vm->_gyro->_magics[i]; magic->_operation = file.readByte(); magic->_data = file.readUint16LE(); } - for (byte i = 0; i < 7; i++) { + for (int i = 0; i < 7; i++) { MagicType *portal = &_vm->_gyro->_portals[i]; portal->_operation = file.readByte(); portal->_data = file.readUint16LE(); } _vm->_gyro->_flags.clear(); - for (byte i = 0; i < 26; i++) + for (int i = 0; i < 26; i++) _vm->_gyro->_flags += file.readByte(); int16 listen_length = file.readByte(); _vm->_gyro->_listen.clear(); - for (byte i = 0; i < listen_length; i++) + for (int i = 0; i < listen_length; i++) _vm->_gyro->_listen += file.readByte(); drawAlsoLines(); file.close(); unScramble(); - for (byte i = 0; i <= alsoNum; i++) { + for (int i = 0; i <= alsoNum; i++) { tmpStr = Common::String::format(",%s,", _vm->_gyro->_also[i][0]->c_str()); *_vm->_gyro->_also[i][0] = tmpStr; } @@ -305,7 +305,7 @@ void Lucerna::loadRoom(byte num) { file.seek(146); if (!_vm->_gyro->_roomnName.empty()) _vm->_gyro->_roomnName.clear(); - for (byte i = 0; i < 30; i++) { + for (int i = 0; i < 30; i++) { char actChar = file.readByte(); if ((32 <= actChar) && (actChar <= 126)) _vm->_gyro->_roomnName += actChar; @@ -329,7 +329,7 @@ void Lucerna::zoomOut(int16 x, int16 y) { } void Lucerna::findPeople(byte room) { - for (byte i = 1; i < 29; i++) { + for (int i = 1; i < 29; i++) { if (_vm->_gyro->_whereIs[i] == room) { if (i < 25) _vm->_gyro->_him = i + 150; @@ -886,12 +886,12 @@ void Lucerna::loadDigits() { // Load the scoring digits & rwlites if (!file.open("digit.avd")) error("AVALANCHE: Lucerna: File not found: digit.avd"); - for (byte i = 0; i < 10; i++) { + for (int i = 0; i < 10; i++) { file.seek(i * digitsize); _vm->_gyro->_digits[i] = _vm->_graphics->loadPictureGraphic(file); } - for (byte i = 0; i < 9; i++) { + for (int i = 0; i < 9; i++) { file.seek(10 * digitsize + i * rwlitesize); _vm->_gyro->_directions[i] = _vm->_graphics->loadPictureGraphic(file); } @@ -920,9 +920,9 @@ void Lucerna::drawToolbar() { void Lucerna::drawScore() { uint16 score = _vm->_gyro->_dnascore; int8 numbers[3] = {0, 0, 0}; - for (byte i = 0; i < 2; i++) { + for (int i = 0; i < 2; i++) { byte divisor = 1; - for (byte j = 0; j < (2 - i); j++) + for (int j = 0; j < (2 - i); j++) divisor *= 10; numbers[i] = score / divisor; score -= numbers[i] * divisor; @@ -931,24 +931,24 @@ void Lucerna::drawScore() { CursorMan.showMouse(false); - for (byte i = 0; i < 3; i++) { + for (int i = 0; i < 3; i++) { if (_vm->_gyro->_scoreToDisplay[i] != numbers[i]) _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_digits[numbers[i]], 250 + (i + 1) * 15, 177); } CursorMan.showMouse(true); - for (byte i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) _vm->_gyro->_scoreToDisplay[i] = numbers[i]; } void Lucerna::incScore(byte num) { // Add on no. of points - for (byte i = 1; i <= num; i++) { + for (int i = 1; i <= num; i++) { _vm->_gyro->_dnascore++; #if 0 if (soundfx) { - for (byte j = 1; j <= 97; j++) + for (int j = 1; j <= 97; j++) sound(177 + dna.score * 3); } nosound; @@ -1002,7 +1002,7 @@ void Lucerna::refreshObjectList() { if (_vm->_gyro->_thinkThing && !_vm->_gyro->_objects[_vm->_gyro->_thinks - 1]) thinkAbout(Gyro::kObjectMoney, Gyro::kThing); // you always have money - for (byte i = 0; i < kObjectNum; i++) { + for (int i = 0; i < kObjectNum; i++) { if (_vm->_gyro->_objects[i]) { _vm->_gyro->_objectList[_vm->_gyro->_carryNum] = i + 1; _vm->_gyro->_carryNum++; @@ -1197,7 +1197,7 @@ void Lucerna::minorRedraw() { enterRoom(_vm->_gyro->_room, 0); // Ped unknown or non-existant. - for (byte i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) _vm->_gyro->_scoreToDisplay[i] = -1; // impossible digits drawScore(); diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index e2667b1fc7..7f2ad4ff3a 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -146,7 +146,7 @@ int16 Parser::pos(const Common::String &crit, const Common::String &src) { void Parser::drawCursor() { // Draw the '_' character. - for (byte bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) *(byte *)_vm->_graphics->_surface.getBasePtr(24 + _inputTextPos * 8 + 7 - bit, 168) = kColorWhite; ByteField bf; diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 5f2df1bc11..8fa1ef0d6a 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -117,7 +117,7 @@ void Pingo::winningPic() { error("AVALANCHE: Lucerna: File not found: finale.avd"); #if 0 - for (byte bit = 0; bit <= 3; bit++) { + for (int bit = 0; bit <= 3; bit++) { port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 3e277c997c..0cde27dc68 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -88,7 +88,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { x /= 8; y++; int16 i = 0; - for (byte xx = 0; xx < lz; xx++) { + for (int xx = 0; xx < lz; xx++) { switch (z[xx]) { case kControlRoman: _currentFont = kFontStyleRoman; @@ -97,7 +97,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { _currentFont = kFontStyleItalic; break; default: { - for (byte yy = 0; yy < 12; yy++) + for (int yy = 0; yy < 12; yy++) itw[(byte)z[xx]][yy] = _scrollFonts[_currentFont][(byte)z[xx]][yy + 2]; // We have to draw the characters one-by-one because of the accidental font changes. @@ -198,7 +198,7 @@ void Scrolls::store(byte what, TuneType &played) { bool Scrolls::theyMatch(TuneType &played) { byte mistakes = 0; - for (byte i = 0; i < sizeof(played); i++) { + for (int i = 0; i < sizeof(played); i++) { if (played[i] != _vm->_gyro->kTune[i]) { mistakes += 1; } @@ -244,7 +244,7 @@ void Scrolls::resetScrollDriver() { } void Scrolls::ringBell() { // Pussy's in the well. Who put her in? Little... - for (byte i = 0; i < _vm->_gyro->_scrollBells; i++) + for (int i = 0; i < _vm->_gyro->_scrollBells; i++) _vm->_lucerna->errorLed(); // Ring the bell "x" times. } @@ -313,7 +313,7 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { int16 lx = 0; int16 ly = (_vm->_gyro->_scrollNum) * 6; - for (byte i = 0; i < _vm->_gyro->_scrollNum; i++) { + for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { ex = _vm->_gyro->_scroll[i].size() * 8; if (lx < ex) lx = ex; @@ -384,7 +384,7 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { } - for (byte i = 0; i < _vm->_gyro->_scrollNum; i++) { + for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { if (!_vm->_gyro->_scroll[i].empty()) switch (_vm->_gyro->_scroll[i][_vm->_gyro->_scroll[i].size() - 1]) { case kControlCenter: @@ -456,7 +456,7 @@ void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { int16 xl = 0; int16 yl = _vm->_gyro->_scrollNum * 5; - for (byte i = 0; i < _vm->_gyro->_scrollNum; i++) { + for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { uint16 textWidth = _vm->_gyro->_scroll[i].size() * 8; if (textWidth > xl) xl = textWidth; @@ -506,7 +506,7 @@ void Scrolls::drawBubble(ScrollsFunctionType modeFunc) { // 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. // It's almost the same, only notable differences are '?', '!', etc. - for (byte i = 0; i < _vm->_gyro->_scrollNum; i++) { + for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { int16 x = xc + _vm->_gyro->_talkX - _vm->_gyro->_scroll[i].size() / 2 * 8; bool offset = _vm->_gyro->_scroll[i].size() % 2; _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->_scroll[i], _vm->_gyro->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_gyro->_talkFontColor); @@ -732,7 +732,7 @@ void Scrolls::callScrollDriver() { } break; case 11: - for (byte j = 0; j < kObjectNum; j++) { + for (int j = 0; j < kObjectNum; j++) { if (_vm->_gyro->_objects[j]) displayText(_vm->_gyro->getItem(j) + ", " + kControlToBuffer); } @@ -760,7 +760,7 @@ void Scrolls::callScrollDriver() { mouthnext = true; break; case kControlInsertSpaces: - for (byte j = 0; j < 9; j++) + for (int j = 0; j < 9; j++) _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += ' '; break; default: // Add new char. @@ -1017,7 +1017,7 @@ void Scrolls::talkTo(byte whom) { whom -= 149; bool noMatches = true; - for (byte i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { + for (int i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { if (_vm->_animation->_sprites[i]._stat._acciNum == whom) { Common::String tmpStr = Common::String::format("%c%c%c", Scrolls::kControlRegister, i + 49, Scrolls::kControlToBuffer); _vm->_scrolls->displayText(tmpStr); diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 8c169c5a9f..2a8a569b59 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -44,7 +44,7 @@ namespace Avalanche { Timer::Timer(AvalancheEngine *vm) { _vm = vm; - for (byte i = 0; i < 7; i++) { + for (int i = 0; i < 7; i++) { _times[i]._timeLeft = 0; _times[i]._action = 0; _times[i]._reason = 0; @@ -83,7 +83,7 @@ void Timer::updateTimer() { if (_vm->_gyro->_dropdownActive) return; - for (byte i = 0; i < 7; i++) { + for (int i = 0; i < 7; i++) { if (_times[i]._timeLeft <= 0) continue; @@ -222,7 +222,7 @@ void Timer::updateTimer() { } void Timer::loseTimer(byte which) { - for (byte i = 0; i < 7; i++) { + for (int i = 0; i < 7; i++) { if (_times[i]._reason == which) _times[i]._timeLeft = 0; // Cancel this one! } |