[Scummvm-git-logs] scummvm master -> 95cec5019518e3154a44ca346fdf173c1f6eaad2

bluegr bluegr at gmail.com
Sun Jun 20 14:04:18 UTC 2021


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7ebd9c9558 TRECISION: Janitorial - use unified naming for loop variables
95cec50195 TRECISION: Don't refresh objs outside of the current room - bug #12625


Commit: 7ebd9c9558fff13c38e3ff3029216844e07e6c67
    https://github.com/scummvm/scummvm/commit/7ebd9c9558fff13c38e3ff3029216844e07e6c67
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-06-20T17:04:01+03:00

Commit Message:
TRECISION: Janitorial - use unified naming for loop variables

Changed paths:
    engines/trecision/actor.cpp
    engines/trecision/anim.cpp
    engines/trecision/dialog.cpp
    engines/trecision/fastfile.cpp
    engines/trecision/graphics.cpp
    engines/trecision/logic.cpp
    engines/trecision/pathfinding3d.cpp
    engines/trecision/renderer3d.cpp
    engines/trecision/resource.cpp
    engines/trecision/saveload.cpp
    engines/trecision/text.cpp
    engines/trecision/utils.cpp
    engines/trecision/video.cpp


diff --git a/engines/trecision/actor.cpp b/engines/trecision/actor.cpp
index f80189d0c5..04cdd1a813 100644
--- a/engines/trecision/actor.cpp
+++ b/engines/trecision/actor.cpp
@@ -213,8 +213,8 @@ void Actor::microproseHeadFix(uint32 actionNum) {
 	m1[0][1] = v1[1];
 	m1[0][2] = v1[2];
 
-	for (uint b = 0; b < actionNum; ++b) {
-		SVertex *sv = &_vertex[b * _vertexNum];
+	for (uint i = 0; i < actionNum; ++i) {
+		SVertex *sv = &_vertex[i * _vertexNum];
 
 		v1[0] = sv[idx2]._x - sv[idx1]._x;
 		v1[1] = sv[idx2]._y - sv[idx1]._y;
@@ -260,18 +260,18 @@ void Actor::microproseHeadFix(uint32 actionNum) {
 		v1[1] = _vertex[idx1]._y;
 		v1[2] = _vertex[idx1]._z;
 
-		for (int e = 279; e < 383; ++e) {
+		for (int j = 279; j < 383; ++j) {
 			int f;
 			for (f = 0; f < 84; ++f) {
-				if (_vertsCorrList[f] == e)
+				if (_vertsCorrList[f] == j)
 					break;
 			}
 			if (f == 84)
 				continue;
 
-			v[0] = _vertsCorr[e - 279][0];
-			v[1] = _vertsCorr[e - 279][2];
-			v[2] = _vertsCorr[e - 279][1];
+			v[0] = _vertsCorr[j - 279][0];
+			v[1] = _vertsCorr[j - 279][2];
+			v[2] = _vertsCorr[j - 279][1];
 
 			q[0] = 0.0;
 			q[1] = 0.0;
@@ -288,14 +288,14 @@ void Actor::microproseHeadFix(uint32 actionNum) {
 					v[c] += m2[d][c] * q[d];
 			}
 
-			if (b < 42) {
-				sv[e]._x += _vertsCorr[e - 279][0];
-				sv[e]._y += _vertsCorr[e - 279][2];
-				sv[e]._z += _vertsCorr[e - 279][1];
+			if (i < 42) {
+				sv[j]._x += _vertsCorr[j - 279][0];
+				sv[j]._y += _vertsCorr[j - 279][2];
+				sv[j]._z += _vertsCorr[j - 279][1];
 			} else {
-				sv[e]._x += v[0];
-				sv[e]._y += v[1];
-				sv[e]._z += v[2];
+				sv[j]._x += v[0];
+				sv[j]._y += v[1];
+				sv[j]._z += v[2];
 			}
 		}
 	}
diff --git a/engines/trecision/anim.cpp b/engines/trecision/anim.cpp
index 864f527289..de645102d6 100644
--- a/engines/trecision/anim.cpp
+++ b/engines/trecision/anim.cpp
@@ -331,16 +331,16 @@ void AnimTypeManager::end(int type) {
 
 	uint16 flag = _vm->_animMgr->_animTab[_vm->_room[_vm->_curRoom]._bkgAnim]._flag;
 
-	for (int32 a = 0; a < MAXATFRAME; ++a) {
+	for (int32 i = 0; i < MAXATFRAME; ++i) {
 		// if it's time to run this AtFrame
-		if (anim->_atFrame[a]._numFrame == 0 && anim->_atFrame[a]._type) {
-			const uint8 child = anim->_atFrame[a]._child;
+		if (anim->_atFrame[i]._numFrame == 0 && anim->_atFrame[i]._type) {
+			const uint8 child = anim->_atFrame[i]._child;
 			if ( child == 0 ||
 				(child == 1 && !(flag & SMKANIM_OFF1)) ||
 				(child == 2 && !(flag & SMKANIM_OFF2)) ||
 				(child == 3 && !(flag & SMKANIM_OFF3)) ||
 				(child == 4 && !(flag & SMKANIM_OFF4)))
-				processAtFrame(h, anim->_atFrame[a]._type, a);
+				processAtFrame(h, anim->_atFrame[i]._type, i);
 		}
 	}
 
@@ -361,18 +361,18 @@ void AnimTypeManager::handler(int type) {
 
 	const uint16 flag = _vm->_animMgr->_animTab[_vm->_room[_vm->_curRoom]._bkgAnim]._flag;
 
-	for (int32 a = 0; a < MAXATFRAME; ++a) {
+	for (int32 i = 0; i < MAXATFRAME; ++i) {
 		// if it's time to run this AtFrame
-		if (anim->_atFrame[a]._numFrame > h->_lastFrame &&
-			anim->_atFrame[a]._numFrame <= h->_curFrame &&
-			anim->_atFrame[a]._numFrame != 0) {
-			const uint8 child = anim->_atFrame[a]._child;
+		if (anim->_atFrame[i]._numFrame > h->_lastFrame &&
+			anim->_atFrame[i]._numFrame <= h->_curFrame &&
+			anim->_atFrame[i]._numFrame != 0) {
+			const uint8 child = anim->_atFrame[i]._child;
 			if ( child == 0 ||
 				(child == 1 && !(flag & SMKANIM_OFF1)) ||
 				(child == 2 && !(flag & SMKANIM_OFF2)) ||
 				(child == 3 && !(flag & SMKANIM_OFF3)) ||
 				(child == 4 && !(flag & SMKANIM_OFF4)))
-				processAtFrame(h, anim->_atFrame[a]._type, a);
+				processAtFrame(h, anim->_atFrame[i]._type, i);
 		}
 	}
 
diff --git a/engines/trecision/dialog.cpp b/engines/trecision/dialog.cpp
index b5c3246f8e..4335878e1f 100644
--- a/engines/trecision/dialog.cpp
+++ b/engines/trecision/dialog.cpp
@@ -715,30 +715,30 @@ bool DialogManager::handleShopKeeperDialog(uint16 curObj) {
 }
 
 void DialogManager::syncGameStream(Common::Serializer &ser) {
-	for (int a = 0; a < MAXCHOICE; ++a) {
-		DialogChoice *choice = &_choice[a];
+	for (int i = 0; i < MAXCHOICE; ++i) {
+		DialogChoice *choice = &_choice[i];
 		ser.syncAsUint16LE(choice->_flag);
 		ser.syncAsUint16LE(choice->_sentenceIndex);
 		ser.syncAsUint16LE(choice->_firstSubTitle);
 		ser.syncAsUint16LE(choice->_subTitleNumb);
-		for (int i = 0; i < MAXDISPCHOICES; ++i)
-			ser.syncAsUint16LE(choice->_on[i]);
-		for (int i = 0; i < MAXDISPCHOICES; ++i)
-			ser.syncAsUint16LE(choice->_off[i]);
+		for (int j = 0; j < MAXDISPCHOICES; ++j)
+			ser.syncAsUint16LE(choice->_on[j]);
+		for (int j = 0; j < MAXDISPCHOICES; ++j)
+			ser.syncAsUint16LE(choice->_off[j]);
 		ser.syncAsUint16LE(choice->_startFrame);
 		ser.syncAsUint16LE(choice->_nextDialog);
 	}
 
-	for (int a = 0; a < MAXDIALOG; ++a) {
-		Dialog *dialog = &_dialog[a];
+	for (int i = 0; i < MAXDIALOG; ++i) {
+		Dialog *dialog = &_dialog[i];
 		ser.syncAsUint16LE(dialog->_flag);
 		ser.syncAsUint16LE(dialog->_interlocutor);
 		ser.syncBytes((byte *)dialog->_startAnim, 14);
 		ser.syncAsUint16LE(dialog->_startLen);
 		ser.syncAsUint16LE(dialog->_firstChoice);
 		ser.syncAsUint16LE(dialog->_choiceNumb);
-		for (int i = 0; i < MAXNEWSMKPAL; ++i)
-			ser.syncAsUint16LE(dialog->_newPal[i]);
+		for (int j = 0; j < MAXNEWSMKPAL; ++j)
+			ser.syncAsUint16LE(dialog->_newPal[j]);
 	}
 }
 
diff --git a/engines/trecision/fastfile.cpp b/engines/trecision/fastfile.cpp
index 5b4fb1a491..da11c8f9e6 100644
--- a/engines/trecision/fastfile.cpp
+++ b/engines/trecision/fastfile.cpp
@@ -81,8 +81,8 @@ bool FastFile::hasFile(const Common::String &name) const {
 
 int FastFile::listMembers(Common::ArchiveMemberList &list) const {
 	list.clear();
-	for (Common::Array<FileEntry>::const_iterator i = _fileEntries.begin(); i != _fileEntries.end(); ++i)
-		list.push_back(getMember(i->name));
+	for (Common::Array<FileEntry>::const_iterator it = _fileEntries.begin(); it != _fileEntries.end(); ++it)
+		list.push_back(getMember(it->name));
 
 	return list.size();
 }
diff --git a/engines/trecision/graphics.cpp b/engines/trecision/graphics.cpp
index 821648eef0..5a47948e0a 100644
--- a/engines/trecision/graphics.cpp
+++ b/engines/trecision/graphics.cpp
@@ -61,10 +61,10 @@ bool GraphicsManager::init() {
 	// Find a suitable 16-bit format
 	const Graphics::PixelFormat rgb555(2, 5, 5, 5, 0, 10, 5, 0, 0);
 	Common::List<Graphics::PixelFormat> formats = g_system->getSupportedFormats();
-	for (Common::List<Graphics::PixelFormat>::iterator i = formats.begin(); i != formats.end(); ++i) {
-		if (i->bytesPerPixel != 2 || i->aBits()) {
-			i = formats.reverse_erase(i);
-		} else if (*i == rgb555) {
+	for (Common::List<Graphics::PixelFormat>::iterator it = formats.begin(); it != formats.end(); ++it) {
+		if (it->bytesPerPixel != 2 || it->aBits()) {
+			it = formats.reverse_erase(it);
+		} else if (*it == rgb555) {
 			formats.clear();
 			formats.push_back(rgb555);
 			break;
@@ -523,9 +523,9 @@ void GraphicsManager::paintScreen(bool flag) {
 	}
 
 	// Suppress all the objects you removed
-	for (Common::List<SSortTable>::iterator i = _vm->_sortTable.begin(); i != _vm->_sortTable.end(); ++i) {
-		if (i->_remove) {
-			drawObj(-1, false, Common::Rect(0, TOP, MAXX, AREA + TOP), _vm->_obj[i->_objectId]._rect);
+	for (Common::List<SSortTable>::iterator it = _vm->_sortTable.begin(); it != _vm->_sortTable.end(); ++it) {
+		if (it->_remove) {
+			drawObj(-1, false, Common::Rect(0, TOP, MAXX, AREA + TOP), _vm->_obj[it->_objectId]._rect);
 		}
 	}
 
@@ -575,27 +575,27 @@ void GraphicsManager::paintObjAnm(uint16 curBox) {
 	_vm->_animMgr->refreshAnim(curBox);
 
 	// draws new cards belonging to the current box
-	for (Common::List<SSortTable>::iterator i = _vm->_sortTable.begin(); i != _vm->_sortTable.end(); ++i) {
-		if (!i->_remove && _vm->_obj[i->_objectId]._nbox == curBox) {
+	for (Common::List<SSortTable>::iterator it = _vm->_sortTable.begin(); it != _vm->_sortTable.end(); ++it) {
+		if (!it->_remove && _vm->_obj[it->_objectId]._nbox == curBox) {
 			// the bitmap object at the desired level
-			SObject obj = _vm->_obj[i->_objectId];
+			SObject obj = _vm->_obj[it->_objectId];
 			Common::Rect drawRect = obj._rect;
 			drawRect.translate(0, TOP);
-			drawObj(_vm->getRoomObjectIndex(i->_objectId), obj.isModeMask(), drawRect, Common::Rect(drawRect.width(), drawRect.height()), false);
+			drawObj(_vm->getRoomObjectIndex(it->_objectId), obj.isModeMask(), drawRect, Common::Rect(drawRect.width(), drawRect.height()), false);
 			_dirtyRects.push_back(drawRect);
 		}
 	}
 
-	for (DirtyRectsIterator d = _dirtyRects.begin(); d != _dirtyRects.end(); ++d) {
-		for (int b = 0; b < MAXOBJINROOM; ++b) {
-			const uint16 curObject = _vm->_room[_vm->_curRoom]._object[b];
+	for (DirtyRectsIterator it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
+		for (int i = 0; i < MAXOBJINROOM; ++i) {
+			const uint16 curObject = _vm->_room[_vm->_curRoom]._object[i];
 			if (!curObject)
 				break;
 
 			SObject obj = _vm->_obj[curObject];
 
 			if ((obj.isModeFull() || obj.isModeMask()) && _vm->isObjectVisible(curObject) && (obj._nbox == curBox)) {
-				Common::Rect r = *d;
+				Common::Rect r = *it;
 				Common::Rect r2 = obj._rect;
 
 				r2.translate(0, TOP);
@@ -617,7 +617,7 @@ void GraphicsManager::paintObjAnm(uint16 curBox) {
 					const int16 yr1 = (r2.top > r.top) ? 0 : r.top - r2.top;
 					const int16 xr2 = MIN<int16>(r.right, r2.right) - r2.left;
 					const int16 yr2 = MIN<int16>(r.bottom, r2.bottom) - r2.top;
-					drawObj(b, obj.isModeMask(), drawRect, Common::Rect(xr1, yr1, xr2, yr2), false);
+					drawObj(i, obj.isModeMask(), drawRect, Common::Rect(xr1, yr1, xr2, yr2), false);
 				}
 			}
 		}
diff --git a/engines/trecision/logic.cpp b/engines/trecision/logic.cpp
index b5fe573f24..5a06586a61 100644
--- a/engines/trecision/logic.cpp
+++ b/engines/trecision/logic.cpp
@@ -2334,8 +2334,8 @@ bool LogicManager::mouseExamine(uint16 curObj) {
 
 	case oEXIT58T:
 		_count58 = 0;
-		for (int a = 0; a < 6; ++a)
-			_vm->setObjectVisible(oLED158 + a, false);
+		for (int i = 0; i < 6; ++i)
+			_vm->setObjectVisible(oLED158 + i, false);
 		_vm->changeRoom(_vm->_obj[oEXIT58T]._goRoom);
 		break;
 
@@ -2602,8 +2602,8 @@ bool LogicManager::mouseOperate(uint16 curObj) {
 
 	case oEXIT58T:
 		_count58 = 0;
-		for (uint8 a = 0; a < 6; ++a)
-			_vm->setObjectVisible(oLED158 + a, false);
+		for (uint8 i = 0; i < 6; ++i)
+			_vm->setObjectVisible(oLED158 + i, false);
 		_vm->changeRoom(_vm->_obj[oEXIT58T]._goRoom);
 		break;
 
@@ -2851,8 +2851,8 @@ bool LogicManager::mouseOperate(uint16 curObj) {
 	case oFORO549:
 	case oFORO649:
 	case oFORO749:
-		for (int a = oASTAC49; a <= oASTA749; ++a)
-			_vm->setObjectVisible(a, false);
+		for (int i = oASTAC49; i <= oASTA749; ++i)
+			_vm->setObjectVisible(i, false);
 		_vm->setObjectVisible(oASTAC49 + curObj - oFOROC49, true);
 		_comb49[3] = _comb49[2];
 		_comb49[2] = _comb49[1];
@@ -2888,8 +2888,8 @@ bool LogicManager::mouseOperate(uint16 curObj) {
 	case oASTA549:
 	case oASTA649:
 	case oASTA749:
-		for (int a = oASTAC49; a <= oASTA749; ++a)
-			_vm->setObjectVisible(a, false);
+		for (int i = oASTAC49; i <= oASTA749; ++i)
+			_vm->setObjectVisible(i, false);
 		_vm->setObjectVisible(oASTAC49, true);
 		_vm->changeRoom(kRoom49, a496, 1);
 		retVal = false;
@@ -2970,20 +2970,20 @@ bool LogicManager::mouseOperate(uint16 curObj) {
 		break;
 
 	case oPULSANTECD:
-		for (int a = oPULSANTE1AD; a <= oPULSANTE33AD; ++a) {
-			if ((_vm->_obj[a]._goRoom == _vm->_obj[oEXIT41D]._goRoom) ||
-				((_vm->_obj[a]._goRoom == kRoom45) && (_vm->_obj[oEXIT41D]._goRoom == kRoom45S))) {
+		for (int i = oPULSANTE1AD; i <= oPULSANTE33AD; ++i) {
+			if ((_vm->_obj[i]._goRoom == _vm->_obj[oEXIT41D]._goRoom) ||
+				((_vm->_obj[i]._goRoom == kRoom45) && (_vm->_obj[oEXIT41D]._goRoom == kRoom45S))) {
 				_vm->_textMgr->characterSay(903);
 				break;
 			}
 
-			if (_vm->_obj[a]._goRoom == 0) {
+			if (_vm->_obj[i]._goRoom == 0) {
 				if (_vm->_obj[oEXIT41D]._goRoom == kRoom45S)
-					_vm->_obj[a]._goRoom = kRoom45;
+					_vm->_obj[i]._goRoom = kRoom45;
 				else
-					_vm->_obj[a]._goRoom = _vm->_obj[oEXIT41D]._goRoom;
-				_vm->setObjectVisible(a, true);
-				_vm->setObjectVisible(a - 40, false);
+					_vm->_obj[i]._goRoom = _vm->_obj[oEXIT41D]._goRoom;
+				_vm->setObjectVisible(i, true);
+				_vm->setObjectVisible(i - 40, false);
 				break;
 			}
 		}
@@ -3091,8 +3091,8 @@ bool LogicManager::mouseOperate(uint16 curObj) {
 		_vm->_graphicsMgr->paintScreen(false);
 		_vm->waitDelay(60);
 		_count58 = 0;
-		for (int a = 0; a < 6; ++a)
-			_vm->setObjectVisible(oLED158 + a, false);
+		for (int i = 0; i < 6; ++i)
+			_vm->setObjectVisible(oLED158 + i, false);
 
 		if ((_comb58[0] == oTASTO058) && (_comb58[1] == oTASTO258) && (_comb58[2] == oTASTO358) &&
 			(_comb58[3] == oTASTO858) && (_comb58[4] == oTASTO558) && (_comb58[5] == oTASTO958)) {
@@ -3531,8 +3531,8 @@ bool LogicManager::operateInventory() {
 		break;
 
 	case kItemPositioner:
-		for (int a = oROOM41; a <= oROOM45B; ++a)
-			_vm->setObjectVisible(a, false);
+		for (int i = oROOM41; i <= oROOM45B; ++i)
+			_vm->setObjectVisible(i, false);
 		_vm->_obj[oEXIT41D]._goRoom = _vm->_curRoom;
 		_vm->changeRoom(kRoom41D);
 		_vm->_inventoryObj[kItemPositioner].setFlagExtra(false);
@@ -3577,9 +3577,9 @@ void LogicManager::doMouseGame() {
 		const uint16 displacerRoom = oROOM41 + _vm->_obj[_vm->_curObj]._goRoom - kRoom41;
 		if ((_vm->_curObj >= oPULSANTE1AD) && (_vm->_curObj <= oPULSANTE33AD)) {
 			if (!_vm->isObjectVisible(displacerRoom)) {
-				for (int a = oROOM41; a <= oROOM4X; ++a) {
-					if (_vm->isObjectVisible(a))
-						_vm->setObjectVisible(a, false);
+				for (int i = oROOM41; i <= oROOM4X; ++i) {
+					if (_vm->isObjectVisible(i))
+						_vm->setObjectVisible(i, false);
 				}
 				_vm->setObjectVisible(oROOM45B, false);
 
@@ -3589,9 +3589,9 @@ void LogicManager::doMouseGame() {
 					_vm->setObjectVisible(displacerRoom, true);
 			}
 		} else {
-			for (int a = oROOM41; a <= oROOM4X; ++a) {
-				if (_vm->isObjectVisible(a))
-					_vm->setObjectVisible(a, false);
+			for (int i = oROOM41; i <= oROOM4X; ++i) {
+				if (_vm->isObjectVisible(i))
+					_vm->setObjectVisible(i, false);
 			}
 			_vm->setObjectVisible(oROOM45B, false);
 
diff --git a/engines/trecision/pathfinding3d.cpp b/engines/trecision/pathfinding3d.cpp
index fbf72e1f79..030f05f598 100644
--- a/engines/trecision/pathfinding3d.cpp
+++ b/engines/trecision/pathfinding3d.cpp
@@ -109,51 +109,51 @@ void PathFinding3D::findPath() {
 
 	float dist = _vm->dist2D(actor->_px, actor->_pz, _curX, _curZ);
 
-	for (int b = 0; b < _panelNum; ++b) {
-		if (_panel[b]._flags & 0x80000000) { // it must be a wide panel
-			if (intersectLineLine(_panel[b]._x1, _panel[b]._z1,
-								  _panel[b]._x2, _panel[b]._z2,
+	for (int i = 0; i < _panelNum; ++i) {
+		if (_panel[i]._flags & 0x80000000) { // it must be a wide panel
+			if (intersectLineLine(_panel[i]._x1, _panel[i]._z1,
+								  _panel[i]._x2, _panel[i]._z2,
 								  actor->_px, actor->_pz, _curX, _curZ)) {
 				++inters;
 
 				_pathNode[_numPathNodes]._x = _x3d;
 				_pathNode[_numPathNodes]._z = _z3d;
 				_pathNode[_numPathNodes]._dist = _vm->dist2D(actor->_px, actor->_pz, _x3d, _z3d);
-				_pathNode[_numPathNodes]._oldPanel = b;
-				_pathNode[_numPathNodes]._curPanel = b;
+				_pathNode[_numPathNodes]._oldPanel = i;
+				_pathNode[_numPathNodes]._curPanel = i;
 				++_numPathNodes;
 
 				// CORNERS - lever intersections in corners
-				if (_oldPanel >= 0 && (b == _panel[_oldPanel]._nearPanel1 || b == _panel[_oldPanel]._nearPanel2)) {
+				if (_oldPanel >= 0 && (i == _panel[_oldPanel]._nearPanel1 || i == _panel[_oldPanel]._nearPanel2)) {
 					// otherwise if it's near the starting panel
 					if ((_pathNode[_numPathNodes - 1]._dist < EPSILON) &&
-						(b != _oldPanel) && (b != _curPanel)) {
+						(i != _oldPanel) && (i != _curPanel)) {
 						// and the distance is very small to the intersection
 						--inters;
 						--_numPathNodes;
 
 						// If the click is inside the nearby panel
-						if (_curPanel < 0 && pointInside(b, _curX, _curZ)) {
+						if (_curPanel < 0 && pointInside(i, _curX, _curZ)) {
 							_curX = actor->_px;
 							_curZ = actor->_pz;
 							actor->_px -= actor->_dx;
 							actor->_pz -= actor->_dz;
 
-							_curPanel = b;
+							_curPanel = i;
 							lookAt(_lookX, _lookZ);
 							return;
 						}
 					}
-				} else if (_curPanel >= 0 && (b == _panel[_curPanel]._nearPanel1 || b == _panel[_curPanel]._nearPanel2)) {
+				} else if (_curPanel >= 0 && (i == _panel[_curPanel]._nearPanel1 || i == _panel[_curPanel]._nearPanel2)) {
 					// otherwise if it is near the finish panel
-					if (ABS(_pathNode[_numPathNodes - 1]._dist - dist) < EPSILON && b != _oldPanel && b != _curPanel) {
+					if (ABS(_pathNode[_numPathNodes - 1]._dist - dist) < EPSILON && i != _oldPanel && i != _curPanel) {
 						// and the distance is very small to the intersection
 						--inters;
 						--_numPathNodes;
 					}
 				}
 
-			} else if (b == _oldPanel) {
+			} else if (i == _oldPanel) {
 				// always adds start and finish node only in on a panel
 				++inters;
 
@@ -163,7 +163,7 @@ void PathFinding3D::findPath() {
 				_pathNode[_numPathNodes]._oldPanel = _oldPanel;
 				_pathNode[_numPathNodes]._curPanel = _oldPanel;
 				++_numPathNodes;
-			} else if (b == _curPanel) {
+			} else if (i == _curPanel) {
 				++inters;
 
 				_pathNode[_numPathNodes]._x = _curX;
@@ -211,25 +211,25 @@ void PathFinding3D::findPath() {
 
 		// Count the intersections with narrow panels
 		// and with the union of large panels and small panels
-		for (int b = 0; b < _panelNum; ++b) {
-			if (!(_panel[b]._flags & 0x80000000)) {
-				if (intersectLineLine(_panel[b]._x1, _panel[b]._z1,
-									  _panel[b]._x2, _panel[b]._z2,
+		for (int i = 0; i < _panelNum; ++i) {
+			if (!(_panel[i]._flags & 0x80000000)) {
+				if (intersectLineLine(_panel[i]._x1, _panel[i]._z1,
+									  _panel[i]._x2, _panel[i]._z2,
 									  _pathNode[_numPathNodes - 1]._x, _pathNode[_numPathNodes - 1]._z,
 									  _curX, _curZ))
 					++inters;
 			} else {
-				if (_panel[b]._col1 & 0x80) {
-					if (intersectLineLine(_panel[b]._x1, _panel[b]._z1,
-										  _panel[_panel[b]._col1 & 0x7F]._x2, _panel[_panel[b]._col1 & 0x7F]._z2,
+				if (_panel[i]._col1 & 0x80) {
+					if (intersectLineLine(_panel[i]._x1, _panel[i]._z1,
+										  _panel[_panel[i]._col1 & 0x7F]._x2, _panel[_panel[i]._col1 & 0x7F]._z2,
 										  _pathNode[_numPathNodes - 1]._x, _pathNode[_numPathNodes - 1]._z,
 										  _curX, _curZ)) {
 						if (_vm->dist2D(_x3d, _z3d, _pathNode[_numPathNodes - 1]._x, _pathNode[_numPathNodes - 1]._z) > EPSILON &&
 							_vm->dist2D(_x3d, _z3d, _curX, _curZ) > EPSILON)
 							++inters;
 					}
-				} else if (intersectLineLine(_panel[b]._x1, _panel[b]._z1,
-											 _panel[_panel[b]._col1 & 0x7F]._x1, _panel[_panel[b]._col1 & 0x7F]._z1,
+				} else if (intersectLineLine(_panel[i]._x1, _panel[i]._z1,
+											 _panel[_panel[i]._col1 & 0x7F]._x1, _panel[_panel[i]._col1 & 0x7F]._z1,
 											 _pathNode[_numPathNodes - 1]._x, _pathNode[_numPathNodes - 1]._z,
 											 _curX, _curZ)) {
 					if (_vm->dist2D(_x3d, _z3d, _pathNode[_numPathNodes - 1]._x, _pathNode[_numPathNodes - 1]._z) > EPSILON &&
@@ -237,17 +237,17 @@ void PathFinding3D::findPath() {
 						++inters;
 				}
 
-				if (_panel[b]._col2 & 0x80) {
-					if (intersectLineLine(_panel[b]._x2, _panel[b]._z2,
-										  _panel[_panel[b]._col2 & 0x7F]._x2, _panel[_panel[b]._col2 & 0x7F]._z2,
+				if (_panel[i]._col2 & 0x80) {
+					if (intersectLineLine(_panel[i]._x2, _panel[i]._z2,
+										  _panel[_panel[i]._col2 & 0x7F]._x2, _panel[_panel[i]._col2 & 0x7F]._z2,
 										  _pathNode[_numPathNodes - 1]._x, _pathNode[_numPathNodes - 1]._z,
 										  _curX, _curZ)) {
 						if (_vm->dist2D(_x3d, _z3d, _pathNode[_numPathNodes - 1]._x, _pathNode[_numPathNodes - 1]._z) > EPSILON &&
 							_vm->dist2D(_x3d, _z3d, _curX, _curZ) > EPSILON)
 							++inters;
 					}
-				} else if (intersectLineLine(_panel[b]._x2, _panel[b]._z2,
-											 _panel[_panel[b]._col2 & 0x7F]._x1, _panel[_panel[b]._col2 & 0x7F]._z1,
+				} else if (intersectLineLine(_panel[i]._x2, _panel[i]._z2,
+											 _panel[_panel[i]._col2 & 0x7F]._x1, _panel[_panel[i]._col2 & 0x7F]._z1,
 											 _pathNode[_numPathNodes - 1]._x, _pathNode[_numPathNodes - 1]._z,
 											 _curX, _curZ)) {
 					if (_vm->dist2D(_x3d, _z3d, _pathNode[_numPathNodes - 1]._x, _pathNode[_numPathNodes - 1]._z) > EPSILON &&
@@ -326,23 +326,23 @@ void PathFinding3D::findShortPath() {
 
 	// for every obstacle, try to go around it by the right and the left
 	// then take the sorter path
-	for (int a = 0; a < _numPathNodes - 1; ++a) {
-		memcpy(&tempPath[count], &_pathNode[a], sizeof(SPathNode));
+	for (int i = 0; i < _numPathNodes - 1; ++i) {
+		memcpy(&tempPath[count], &_pathNode[i], sizeof(SPathNode));
 		++count;
 		if (count >= MAXPATHNODES - 2)
 			count = MAXPATHNODES - 2;
 
-		curPanel = _pathNode[a]._curPanel;
+		curPanel = _pathNode[i]._curPanel;
 
 		// if source and destination panel are on the same block
-		if (!findAttachedPanel(curPanel, _pathNode[a + 1]._curPanel))
+		if (!findAttachedPanel(curPanel, _pathNode[i + 1]._curPanel))
 			continue;
 
 		// go around obstacle starting with _nearPanel1
-		len1 = evalPath(a, _panel[curPanel]._x1, _panel[curPanel]._z1, _panel[curPanel]._nearPanel1) + _vm->dist2D(_pathNode[a]._x, _pathNode[a]._z, _panel[curPanel]._x1, _panel[curPanel]._z1);
+		len1 = evalPath(i, _panel[curPanel]._x1, _panel[curPanel]._z1, _panel[curPanel]._nearPanel1) + _vm->dist2D(_pathNode[i]._x, _pathNode[i]._z, _panel[curPanel]._x1, _panel[curPanel]._z1);
 
 		// go around obstacle starting with _nearPanel2
-		len2 = evalPath(a, _panel[curPanel]._x2, _panel[curPanel]._z2, _panel[curPanel]._nearPanel2) + _vm->dist2D(_pathNode[a]._x, _pathNode[a]._z, _panel[curPanel]._x2, _panel[curPanel]._z2);
+		len2 = evalPath(i, _panel[curPanel]._x2, _panel[curPanel]._z2, _panel[curPanel]._nearPanel2) + _vm->dist2D(_pathNode[i]._x, _pathNode[i]._z, _panel[curPanel]._x2, _panel[curPanel]._z2);
 
 		// Check which route was shorter
 		if ((len1 < 32000.0f) && (len2 < 32000.0f)) {
@@ -356,11 +356,11 @@ void PathFinding3D::findShortPath() {
 				nearPanel = _panel[curPanel]._nearPanel2;
 			}
 
-			float curX = _pathNode[a]._x;
-			float curZ = _pathNode[a]._z;
+			float curX = _pathNode[i]._x;
+			float curZ = _pathNode[i]._z;
 			oldPanel = curPanel;
 
-			int b = 0;
+			int index = 0;
 
 			// Save the shorter path
 			for (;;) {
@@ -373,8 +373,8 @@ void PathFinding3D::findShortPath() {
 					count = MAXPATHNODES - 2;
 
 				// if it reaches the point, exit the loop
-				if (curPanel == _pathNode[a + 1]._curPanel) {
-					memcpy(&tempPath[count], &_pathNode[a + 1], sizeof(SPathNode));
+				if (curPanel == _pathNode[i + 1]._curPanel) {
+					memcpy(&tempPath[count], &_pathNode[i + 1], sizeof(SPathNode));
 					++count;
 					if (count >= MAXPATHNODES - 2)
 						count = MAXPATHNODES - 2;
@@ -382,7 +382,7 @@ void PathFinding3D::findShortPath() {
 				}
 
 				// If it's back to the starting panel, it didn't find a route
-				if (((curPanel == _pathNode[a]._curPanel) && b) || (b > _panelNum)) {
+				if (((curPanel == _pathNode[i]._curPanel) && index) || (index > _panelNum)) {
 					fail = true; // stop at the edge first
 					break;    // and stop walking
 				}
@@ -413,7 +413,7 @@ void PathFinding3D::findShortPath() {
 					nearPanel = _panel[curPanel]._nearPanel1;
 				}
 
-				++b;
+				++index;
 			}
 		} else {
 			fail = true;
@@ -433,75 +433,75 @@ void PathFinding3D::findShortPath() {
 
 	// after walking around all obstacles, optimize
 	_numPathNodes = 0;
-	for (int a = 0; a < count; ++a) {
+	for (int i = 0; i < count; ++i) {
 		if (_numPathNodes > MAXPATHNODES - 2)
 			_numPathNodes = MAXPATHNODES - 2;
 
-		int b;
+		int j;
 		// remove all the attached nodes
-		for (b = count - 1; b >= a; --b) {
-			if (_vm->dist2D(tempPath[b]._x, tempPath[b]._z, tempPath[a]._x, tempPath[a]._z) < EPSILON)
+		for (j = count - 1; j >= i; --j) {
+			if (_vm->dist2D(tempPath[j]._x, tempPath[j]._z, tempPath[i]._x, tempPath[i]._z) < EPSILON)
 				break;
 		}
 
-		a = b;
+		i = j;
 
-		memcpy(&_pathNode[_numPathNodes], &tempPath[a], sizeof(SPathNode));
+		memcpy(&_pathNode[_numPathNodes], &tempPath[i], sizeof(SPathNode));
 		++_numPathNodes;
 
-		for (b = count - 1; b > a + 1; --b) {
+		for (j = count - 1; j > i + 1; --j) {
 			int inters = 0;
-			for (int c = 0; c < _panelNum; ++c) {
+			for (int k = 0; k < _panelNum; ++k) {
 				// it must never intersect the small panel
-				if (!(_panel[c]._flags & 0x80000000)) {
-					if (intersectLineLine(_panel[c]._x1, _panel[c]._z1,
-										  _panel[c]._x2, _panel[c]._z2,
-										  tempPath[a]._x, tempPath[a]._z,
-										  tempPath[b]._x, tempPath[b]._z))
+				if (!(_panel[k]._flags & 0x80000000)) {
+					if (intersectLineLine(_panel[k]._x1, _panel[k]._z1,
+										  _panel[k]._x2, _panel[k]._z2,
+										  tempPath[i]._x, tempPath[i]._z,
+										  tempPath[j]._x, tempPath[j]._z))
 						++inters;
 
-					if (_panel[c]._col1 & 0x80) {
-						if (intersectLineLine(_panel[c]._x1, _panel[c]._z1,
-											  _panel[_panel[c]._col1 & 0x7F]._x2, _panel[_panel[c]._col1 & 0x7F]._z2,
-											  tempPath[a]._x, tempPath[a]._z,
-											  tempPath[b]._x, tempPath[b]._z)) {
-							len2 = _vm->dist2D(_x3d, _z3d, tempPath[a]._x, tempPath[a]._z);
-							len1 = _vm->dist2D(_x3d, _z3d, tempPath[b]._x, tempPath[b]._z);
+					if (_panel[k]._col1 & 0x80) {
+						if (intersectLineLine(_panel[k]._x1, _panel[k]._z1,
+											  _panel[_panel[k]._col1 & 0x7F]._x2, _panel[_panel[k]._col1 & 0x7F]._z2,
+											  tempPath[i]._x, tempPath[i]._z,
+											  tempPath[j]._x, tempPath[j]._z)) {
+							len2 = _vm->dist2D(_x3d, _z3d, tempPath[i]._x, tempPath[i]._z);
+							len1 = _vm->dist2D(_x3d, _z3d, tempPath[j]._x, tempPath[j]._z);
 
 							// intersect at a point distant from the start and the finish
 							if ((len1 > EPSILON) && (len2 > EPSILON))
 								++inters;
 						}
-					} else if (intersectLineLine(_panel[c]._x1, _panel[c]._z1,
-												 _panel[_panel[c]._col1 & 0x7F]._x1, _panel[_panel[c]._col1 & 0x7F]._z1,
-												 tempPath[a]._x, tempPath[a]._z,
-												 tempPath[b]._x, tempPath[b]._z)) {
-						len2 = _vm->dist2D(_x3d, _z3d, tempPath[a]._x, tempPath[a]._z);
-						len1 = _vm->dist2D(_x3d, _z3d, tempPath[b]._x, tempPath[b]._z);
+					} else if (intersectLineLine(_panel[k]._x1, _panel[k]._z1,
+												 _panel[_panel[k]._col1 & 0x7F]._x1, _panel[_panel[k]._col1 & 0x7F]._z1,
+												 tempPath[i]._x, tempPath[i]._z,
+												 tempPath[j]._x, tempPath[j]._z)) {
+						len2 = _vm->dist2D(_x3d, _z3d, tempPath[i]._x, tempPath[i]._z);
+						len1 = _vm->dist2D(_x3d, _z3d, tempPath[j]._x, tempPath[j]._z);
 
 						// intersect at a point distant from the start and the finish
 						if ((len1 > EPSILON) && (len2 > EPSILON))
 							++inters;
 					}
 
-					if (_panel[c]._col2 & 0x80) {
-						if (intersectLineLine(_panel[c]._x2, _panel[c]._z2,
-											  _panel[_panel[c]._col2 & 0x7F]._x2, _panel[_panel[c]._col2 & 0x7F]._z2,
-											  tempPath[a]._x, tempPath[a]._z,
-											  tempPath[b]._x, tempPath[b]._z)) {
-							len2 = _vm->dist2D(_x3d, _z3d, tempPath[a]._x, tempPath[a]._z);
-							len1 = _vm->dist2D(_x3d, _z3d, tempPath[b]._x, tempPath[b]._z);
+					if (_panel[k]._col2 & 0x80) {
+						if (intersectLineLine(_panel[k]._x2, _panel[k]._z2,
+											  _panel[_panel[k]._col2 & 0x7F]._x2, _panel[_panel[k]._col2 & 0x7F]._z2,
+											  tempPath[i]._x, tempPath[i]._z,
+											  tempPath[j]._x, tempPath[j]._z)) {
+							len2 = _vm->dist2D(_x3d, _z3d, tempPath[i]._x, tempPath[i]._z);
+							len1 = _vm->dist2D(_x3d, _z3d, tempPath[j]._x, tempPath[j]._z);
 
 							// intersect at a point distant from the start and the finish
 							if ((len1 > EPSILON) && (len2 > EPSILON))
 								++inters;
 						}
-					} else if (intersectLineLine(_panel[c]._x2, _panel[c]._z2,
-												 _panel[_panel[c]._col2 & 0x7F]._x1, _panel[_panel[c]._col2 & 0x7F]._z1,
-												 tempPath[a]._x, tempPath[a]._z,
-												 tempPath[b]._x, tempPath[b]._z)) {
-						len2 = _vm->dist2D(_x3d, _z3d, tempPath[a]._x, tempPath[a]._z);
-						len1 = _vm->dist2D(_x3d, _z3d, tempPath[b]._x, tempPath[b]._z);
+					} else if (intersectLineLine(_panel[k]._x2, _panel[k]._z2,
+												 _panel[_panel[k]._col2 & 0x7F]._x1, _panel[_panel[k]._col2 & 0x7F]._z1,
+												 tempPath[i]._x, tempPath[i]._z,
+												 tempPath[j]._x, tempPath[j]._z)) {
+						len2 = _vm->dist2D(_x3d, _z3d, tempPath[i]._x, tempPath[i]._z);
+						len1 = _vm->dist2D(_x3d, _z3d, tempPath[j]._x, tempPath[j]._z);
 
 						// intersect at a point distant from the start and the finish
 						if ((len1 > EPSILON) && (len2 > EPSILON))
@@ -516,20 +516,20 @@ void PathFinding3D::findShortPath() {
 			// if from A it's possible to reach B directly
 			if (!inters) {
 				curPanel = _pathNode[_numPathNodes - 1]._curPanel;
-				oldPanel = tempPath[b]._oldPanel;
+				oldPanel = tempPath[j]._oldPanel;
 
 				int c;
-				for (c = a; c <= b; ++c) {
+				for (c = i; c <= j; ++c) {
 					if ((tempPath[c]._oldPanel == curPanel) && (tempPath[c]._curPanel == oldPanel))
 						break;
 				}
 
 				// if they weren't connected it means it went through the floor
-				if (c > b) {
+				if (c > j) {
 					_pathNode[_numPathNodes - 1]._curPanel = -1; // start
-					tempPath[b]._oldPanel = -1;                  // destination
+					tempPath[j]._oldPanel = -1;                  // destination
 				}
-				a = b - 1;
+				i = j - 1;
 				break;
 			}
 		}
@@ -540,7 +540,7 @@ void PathFinding3D::findShortPath() {
  *			Evaluate path length
  */
 float PathFinding3D::evalPath(int a, float destX, float destZ, int nearP) {
-	int b = 0;
+	int index = 0;
 	float len = 0.0f;
 
 	int curPanel = _pathNode[a]._curPanel;
@@ -555,7 +555,7 @@ float PathFinding3D::evalPath(int a, float destX, float destZ, int nearP) {
 		}
 
 		// if it's back to the starting plane, there's no route
-		if (((curPanel == _pathNode[a]._curPanel) && b) || (b > _panelNum)) {
+		if (((curPanel == _pathNode[a]._curPanel) && index) || (index > _panelNum)) {
 			len += 32000.0f; // Absurd length
 			break;
 		}
@@ -589,7 +589,7 @@ float PathFinding3D::evalPath(int a, float destX, float destZ, int nearP) {
 			nearP = _panel[curPanel]._nearPanel1;
 		}
 
-		++b;
+		++index;
 	}
 
 	return len;
@@ -678,7 +678,7 @@ bool PathFinding3D::pointInside(int pan, float x, float z) const {
 void PathFinding3D::setPosition(int num) {
 	SLight *curLight = _vm->_actor->_light;
 
-	for (uint32 a = 0; a < _vm->_actor->_lightNum; ++a, ++curLight) {
+	for (uint32 i = 0; i < _vm->_actor->_lightNum; ++i, ++curLight) {
 		if (curLight->_inten != 0 || curLight->_position != num)
 			continue;
 
@@ -723,7 +723,7 @@ void PathFinding3D::setPosition(int num) {
 void PathFinding3D::goToPosition(int num) {
 	SLight *curLight = _vm->_actor->_light;
 
-	for (uint32 a = 0; a < _vm->_actor->_lightNum; ++a, ++curLight) {
+	for (uint32 i = 0; i < _vm->_actor->_lightNum; ++i, ++curLight) {
 		if (curLight->_inten != 0 || curLight->_position != num)
 			continue;
 
@@ -808,14 +808,14 @@ void PathFinding3D::lookAt(float x, float z) {
  */
 void PathFinding3D::buildFramelist() {
 	// check that it never crosses or touches a narrow panel
-	for (int a = 1; a < _numPathNodes; ++a) {
+	for (int i = 1; i < _numPathNodes; ++i) {
 		for (int c = 0; c < _panelNum; ++c) {
 			// it must never intersect narrow panel
 			if (!(_panel[c]._flags & 0x80000000) && intersectLineLine(_panel[c]._x1, _panel[c]._z1,
 																	  _panel[c]._x2, _panel[c]._z2,
-																	  _pathNode[a - 1]._x, _pathNode[a - 1]._z,
-																	  _pathNode[a]._x, _pathNode[a]._z)) {
-				_numPathNodes = a;
+																	  _pathNode[i - 1]._x, _pathNode[i - 1]._z,
+																	  _pathNode[i]._x, _pathNode[i]._z)) {
+				_numPathNodes = i;
 				break;
 			}
 		}
@@ -827,11 +827,11 @@ void PathFinding3D::buildFramelist() {
 	float ox = _pathNode[0]._x;
 	float oz = _pathNode[0]._z;
 
-	for (int a = 1; a < _numPathNodes; ++a) {
-		len += _vm->dist3D(_pathNode[a]._x, 0.0f, _pathNode[a]._z, ox, 0.0f, oz);
+	for (int i = 1; i < _numPathNodes; ++i) {
+		len += _vm->dist3D(_pathNode[i]._x, 0.0f, _pathNode[i]._z, ox, 0.0f, oz);
 
-		ox = _pathNode[a]._x;
-		oz = _pathNode[a]._z;
+		ox = _pathNode[i]._x;
+		oz = _pathNode[i]._z;
 	}
 	// total route length calculated - if too small, returns
 	if (_vm->floatComp(len, 2.0f) == -1) {
@@ -839,7 +839,7 @@ void PathFinding3D::buildFramelist() {
 		return;
 	}
 
-	int a = 0;
+	int i = 0;
 	// compute offset
 	SVertex *v = _vm->_actor->_characterArea;
 	float firstFrame = _vm->_actor->frameCenter(v);
@@ -886,13 +886,13 @@ void PathFinding3D::buildFramelist() {
 
 	// until it arrives at the destination
 	curLen = oz + _vm->_actor->frameCenter(v) - firstFrame;
-	while (_vm->floatComp(curLen, len) == -1 || !a) {
-		_step[a]._pz = oz - firstFrame; // where to render
-		_step[a]._dz = curLen;          // where it is
-		_step[a]._curAction = curAction;
-		_step[a]._curFrame = curFrame;
+	while (_vm->floatComp(curLen, len) == -1 || !i) {
+		_step[i]._pz = oz - firstFrame; // where to render
+		_step[i]._dz = curLen;          // where it is
+		_step[i]._curAction = curAction;
+		_step[i]._curFrame = curFrame;
 
-		++a;
+		++i;
 		v += _vm->_actor->_vertexNum;
 
 		++curFrame;
@@ -931,8 +931,8 @@ void PathFinding3D::buildFramelist() {
 	// After the destination, add the stop frame
 
 	// if he was walking
-	if (_step[a - 1]._curAction == hWALK)
-		curAction = _step[a - 1]._curFrame + hSTOP0; // stop previous step.
+	if (_step[i - 1]._curAction == hWALK)
+		curAction = _step[i - 1]._curFrame + hSTOP0; // stop previous step.
 	else
 		curAction = hSTOP0; // stop step 01
 
@@ -940,27 +940,27 @@ void PathFinding3D::buildFramelist() {
 
 	curFrame = 0;
 
-	int b = 0;
+	int index = 0;
 	cfp = 0;
-	while (b != curAction)
-		cfp += _vm->_defActionLen[b++];
+	while (index != curAction)
+		cfp += _vm->_defActionLen[index++];
 
 	v = &_vm->_actor->_characterArea[cfp * _vm->_actor->_vertexNum];
 
-	for (b = 0; b < _vm->_defActionLen[curAction]; ++b) {
+	for (index = 0; index < _vm->_defActionLen[curAction]; ++index) {
 		curLen = oz + _vm->_actor->frameCenter(v) - firstFrame;
-		_step[a]._pz = oz - firstFrame; // where to render
-		_step[a]._dz = curLen;          // where it is
-		_step[a]._curAction = curAction;
-		_step[a]._curFrame = curFrame;
+		_step[i]._pz = oz - firstFrame; // where to render
+		_step[i]._dz = curLen;          // where it is
+		_step[i]._curAction = curAction;
+		_step[i]._curFrame = curFrame;
 
-		++a;
+		++i;
 		++curFrame;
 		v += _vm->_actor->_vertexNum;
 	}
 
 	// how far is it from the destination?
-	int divider = a - 2;
+	int divider = i - 2;
 	if (divider == 0)
 		// Safeguard, should never be useful... but if it is, it'll avoid a divide by 0 error.
 		divider = 1;
@@ -968,35 +968,35 @@ void PathFinding3D::buildFramelist() {
 	float approx = (len - curLen - EPSILON) / (float)divider;
 	float theta = 0.0f;
 	// Adjust all the steps so it arrives exactly where clicked
-	for (b = 1; b < a; ++b) {
+	for (index = 1; index < i; ++index) {
 		// verify there's no reverse step
-		if (_vm->floatComp(_step[b - 1]._dz, _step[b]._dz + approx * b) == 1 || _vm->floatComp(_step[b]._dz + approx * b + EPSILON, len) >= 0) {
-			theta = _step[b]._dz - _step[b]._pz;
-			_step[b]._dz = _step[b - 1]._dz;
-			_step[b]._pz = _step[b]._dz - theta;
+		if (_vm->floatComp(_step[index - 1]._dz, _step[index]._dz + approx * index) == 1 || _vm->floatComp(_step[index]._dz + approx * index + EPSILON, len) >= 0) {
+			theta = _step[index]._dz - _step[index]._pz;
+			_step[index]._dz = _step[index - 1]._dz;
+			_step[index]._pz = _step[index]._dz - theta;
 		} else {
-			_step[b]._pz += (approx * b);
-			_step[b]._dz += (approx * b);
+			_step[index]._pz += (approx * index);
+			_step[index]._dz += (approx * index);
 		}
 	}
-	float cx = _step[b - 1]._dz;
+	float cx = _step[index - 1]._dz;
 
-	_lastStep = b; // last step
+	_lastStep = index; // last step
 	_curStep = 0;  // current step
 
 	// now insert exact directions and start and destination points
-	b = 0;
+	index = 0;
 
 	len = 0.0f;
 	float startPos = 0.0f;
-	for (a = 0; a < _numPathNodes - 1; ++a) {
+	for (i = 0; i < _numPathNodes - 1; ++i) {
 		curLen = 0.0f;
-		len += _vm->dist3D(_pathNode[a]._x, 0.0f, _pathNode[a]._z,
-					  _pathNode[a + 1]._x, 0.0f, _pathNode[a + 1]._z);
+		len += _vm->dist3D(_pathNode[i]._x, 0.0f, _pathNode[i]._z,
+					  _pathNode[i + 1]._x, 0.0f, _pathNode[i + 1]._z);
 
 		// determine the direction
-		ox = _pathNode[a + 1]._x - _pathNode[a]._x;
-		oz = _pathNode[a + 1]._z - _pathNode[a]._z;
+		ox = _pathNode[i + 1]._x - _pathNode[i]._x;
+		oz = _pathNode[i + 1]._z - _pathNode[i]._z;
 		// if it's a useless node, remove it
 		if (_vm->floatComp(ox, 0.0f) == 0 && _vm->floatComp(oz, 0.0f) == 0)
 			continue;
@@ -1011,25 +1011,25 @@ void PathFinding3D::buildFramelist() {
 		if (_vm->floatComp(theta, 0.0f) == -1)
 			theta += 360.0f;
 
-		while (b < _lastStep && _vm->floatComp(_step[b]._dz, len) <= 0) {
-			curLen = _step[b]._dz - _step[b]._pz;
+		while (index < _lastStep && _vm->floatComp(_step[index]._dz, len) <= 0) {
+			curLen = _step[index]._dz - _step[index]._pz;
 
-			_step[b]._px = _pathNode[a]._x + (_step[b]._pz - startPos) * ox;
-			_step[b]._pz = _pathNode[a]._z + (_step[b]._pz - startPos) * oz;
-			_step[b]._dx = curLen * ox;
-			_step[b]._dz = curLen * oz;
-			_step[b]._theta = theta;
+			_step[index]._px = _pathNode[i]._x + (_step[index]._pz - startPos) * ox;
+			_step[index]._pz = _pathNode[i]._z + (_step[index]._pz - startPos) * oz;
+			_step[index]._dx = curLen * ox;
+			_step[index]._dz = curLen * oz;
+			_step[index]._theta = theta;
 
-			_step[b]._curPanel = _pathNode[a]._curPanel;
+			_step[index]._curPanel = _pathNode[i]._curPanel;
 
-			++b;
+			++index;
 		}
 		startPos = len;
 	}
 
-	reset(b, _curX, _curZ, theta);
+	reset(index, _curX, _curZ, theta);
 
-	_lastStep = b; // last step
+	_lastStep = index; // last step
 	_curStep = 0;  // current step
 
 	// starting angle
@@ -1048,33 +1048,33 @@ void PathFinding3D::buildFramelist() {
 
 		approx /= 3.0f;
 
-		for (b = 0; b < 2; ++b) {
-			_step[b]._theta = oldTheta + (float)(b + 1) * approx;
-			_step[b]._theta = _vm->floatComp(_step[b]._theta, 360.0f) == 1 ? _step[b]._theta - 360.0f : _vm->floatComp(_step[b]._theta, 0.0f) == -1 ? _step[b]._theta + 360.0f : _step[b]._theta;
+		for (index = 0; index < 2; ++index) {
+			_step[index]._theta = oldTheta + (float)(index + 1) * approx;
+			_step[index]._theta = _vm->floatComp(_step[index]._theta, 360.0f) == 1 ? _step[index]._theta - 360.0f : _vm->floatComp(_step[index]._theta, 0.0f) == -1 ? _step[index]._theta + 360.0f : _step[index]._theta;
 
-			theta = _step[b]._theta;
+			theta = _step[index]._theta;
 
-			curLen = sqrt(_step[b]._dx * _step[b]._dx + _step[b]._dz * _step[b]._dz);
+			curLen = sqrt(_step[index]._dx * _step[index]._dx + _step[index]._dz * _step[index]._dz);
 
 			theta = ((270.0f - theta) * PI) / 180.0f;
 			ox = cos(theta) * curLen;
 			oz = sin(theta) * curLen;
 
-			cx = _step[b]._px + _step[b]._dx;
-			float cz = _step[b]._pz + _step[b]._dz;
+			cx = _step[index]._px + _step[index]._dx;
+			float cz = _step[index]._pz + _step[index]._dz;
 
-			_step[b]._px += _step[b]._dx - ox;
-			_step[b]._pz += _step[b]._dz - oz;
+			_step[index]._px += _step[index]._dx - ox;
+			_step[index]._pz += _step[index]._dz - oz;
 
-			_step[b]._dx = cx - _step[b]._px;
-			_step[b]._dz = cz - _step[b]._pz;
+			_step[index]._dx = cx - _step[index]._px;
+			_step[index]._dz = cz - _step[index]._pz;
 		}
 	}
 
 	// makes the curve
 	oldTheta = _step[2]._theta;
-	for (b = 3; b <= _lastStep; ++b) {
-		theta = _step[b]._theta;
+	for (index = 3; index <= _lastStep; ++index) {
+		theta = _step[index]._theta;
 
 		// if it made a curve
 		if (_vm->floatComp(oldTheta, theta) != 0) {
@@ -1088,47 +1088,47 @@ void PathFinding3D::buildFramelist() {
 			approx /= 3.0f;
 
 			// for the previous one
-			_step[b - 1]._theta += approx;
-			_step[b - 1]._theta = _vm->floatComp(_step[b - 1]._theta, 360.0f) == 1 ? _step[b - 1]._theta - 360.0f : _vm->floatComp(_step[b - 1]._theta, 0.0f) == -1 ? _step[b - 1]._theta + 360.0f : _step[b - 1]._theta;
+			_step[index - 1]._theta += approx;
+			_step[index - 1]._theta = _vm->floatComp(_step[index - 1]._theta, 360.0f) == 1 ? _step[index - 1]._theta - 360.0f : _vm->floatComp(_step[index - 1]._theta, 0.0f) == -1 ? _step[index - 1]._theta + 360.0f : _step[index - 1]._theta;
 
-			oldTheta = _step[b - 1]._theta;
+			oldTheta = _step[index - 1]._theta;
 
-			curLen = sqrt(_step[b - 1]._dx * _step[b - 1]._dx + _step[b - 1]._dz * _step[b - 1]._dz);
+			curLen = sqrt(_step[index - 1]._dx * _step[index - 1]._dx + _step[index - 1]._dz * _step[index - 1]._dz);
 
 			oldTheta = ((270.0f - oldTheta) * PI) / 180.0f;
 			ox = cos(oldTheta) * curLen;
 			oz = sin(oldTheta) * curLen;
 
-			cx = _step[b - 1]._px + _step[b - 1]._dx;
-			float cz = _step[b - 1]._pz + _step[b - 1]._dz;
+			cx = _step[index - 1]._px + _step[index - 1]._dx;
+			float cz = _step[index - 1]._pz + _step[index - 1]._dz;
 
-			_step[b - 1]._px += _step[b - 1]._dx - ox;
-			_step[b - 1]._pz += _step[b - 1]._dz - oz;
+			_step[index - 1]._px += _step[index - 1]._dx - ox;
+			_step[index - 1]._pz += _step[index - 1]._dz - oz;
 
-			_step[b - 1]._dx = cx - _step[b - 1]._px;
-			_step[b - 1]._dz = cz - _step[b - 1]._pz;
+			_step[index - 1]._dx = cx - _step[index - 1]._px;
+			_step[index - 1]._dz = cz - _step[index - 1]._pz;
 
 			// for the next one
-			_step[b]._theta -= approx;
-			_step[b]._theta = _vm->floatComp(_step[b]._theta, 360.0f) == 1 ? _step[b]._theta - 360.0f : _vm->floatComp(_step[b]._theta, 0.0f) == -1 ? _step[b]._theta + 360.0f : _step[b]._theta;
+			_step[index]._theta -= approx;
+			_step[index]._theta = _vm->floatComp(_step[index]._theta, 360.0f) == 1 ? _step[index]._theta - 360.0f : _vm->floatComp(_step[index]._theta, 0.0f) == -1 ? _step[index]._theta + 360.0f : _step[index]._theta;
 
 			oldTheta = theta;
-			theta = _step[b]._theta;
+			theta = _step[index]._theta;
 
-			curLen = sqrt(_step[b]._dx * _step[b]._dx + _step[b]._dz * _step[b]._dz);
+			curLen = sqrt(_step[index]._dx * _step[index]._dx + _step[index]._dz * _step[index]._dz);
 
 			theta = ((270.0f - theta) * PI) / 180.0f;
 			ox = cos(theta) * curLen;
 			oz = sin(theta) * curLen;
 
-			cx = _step[b]._px + _step[b]._dx;
-			cz = _step[b]._pz + _step[b]._dz;
+			cx = _step[index]._px + _step[index]._dx;
+			cz = _step[index]._pz + _step[index]._dz;
 
-			_step[b]._px += _step[b]._dx - ox;
-			_step[b]._pz += _step[b]._dz - oz;
+			_step[index]._px += _step[index]._dx - ox;
+			_step[index]._pz += _step[index]._dz - oz;
 
-			_step[b]._dx = cx - _step[b]._px;
-			_step[b]._dz = cz - _step[b]._pz;
+			_step[index]._dx = cx - _step[index]._px;
+			_step[index]._dz = cz - _step[index]._pz;
 
 		} else
 			oldTheta = theta;
@@ -1184,16 +1184,16 @@ bool PathFinding3D::findAttachedPanel(int16 srcPanel, int16 destPanel) {
 	int16 curPanel = srcPanel;
 	int16 nearPanel = _panel[srcPanel]._nearPanel1;
 
-	for (int b = 0;; ++b) {
+	for (int i = 0;; ++i) {
 		// if they are attached, return true
 		if (curPanel == destPanel)
 			return true;
 
 		// if it has returned to the starting panel, return false
-		if (srcPanel == curPanel && b)
+		if (srcPanel == curPanel && i)
 			return false;
 
-		if (b > _panelNum)
+		if (i > _panelNum)
 			return false;
 
 		// if they are attached to vertex 1, take 2
@@ -1236,9 +1236,9 @@ void PathFinding3D::sortPath() {
 void PathFinding3D::initSortPan() {
 	_numSortPanel = 31;
 
-	for (int a = 1; a < _numSortPanel - 1; ++a) {
-		_sortPan[a]._min = 32000.0f;
-		_sortPan[a]._num = a;
+	for (int i = 1; i < _numSortPanel - 1; ++i) {
+		_sortPan[i]._min = 32000.0f;
+		_sortPan[i]._num = i;
 	}
 
 	// First panel is behind everything and is not sorted
@@ -1251,17 +1251,17 @@ void PathFinding3D::initSortPan() {
 
 	Actor *actor = _vm->_actor;
 	// Sort panel blocks by increasing distance from the camera
-	for (int b = 0; b < _panelNum; ++b) {
-		if (!(_panel[b]._flags & 0x80000000)) {
-			float dist1 = _vm->dist3D(actor->_camera->_ex, 0.0, actor->_camera->_ez, _panel[b]._x1, 0.0, _panel[b]._z1);
-			float dist2 = _vm->dist3D(actor->_camera->_ex, 0.0, actor->_camera->_ez, _panel[b]._x2, 0.0, _panel[b]._z2);
+	for (int i = 0; i < _panelNum; ++i) {
+		if (!(_panel[i]._flags & 0x80000000)) {
+			float dist1 = _vm->dist3D(actor->_camera->_ex, 0.0, actor->_camera->_ez, _panel[i]._x1, 0.0, _panel[i]._z1);
+			float dist2 = _vm->dist3D(actor->_camera->_ex, 0.0, actor->_camera->_ez, _panel[i]._x2, 0.0, _panel[i]._z2);
 
 			float min = MIN(dist1, dist2);
 
-			for (int a = 0; a < _numSortPanel; ++a) {
-				if (_panel[b]._flags & (1 << a)) {
-					if (_sortPan[a + 1]._min > min)
-						_sortPan[a + 1]._min = min;
+			for (int j = 0; j < _numSortPanel; ++j) {
+				if (_panel[i]._flags & (1 << j)) {
+					if (_sortPan[j + 1]._min > min)
+						_sortPan[j + 1]._min = min;
 				}
 			}
 		}
@@ -1269,10 +1269,10 @@ void PathFinding3D::initSortPan() {
 
 	sortPanel();
 
-	for (int b = 0; b < _numSortPanel; ++b) {
-		if (_sortPan[b]._num == BOX_BACKGROUND) {
+	for (int i = 0; i < _numSortPanel; ++i) {
+		if (_sortPan[i]._num == BOX_BACKGROUND) {
 			// now the panels go from 0 (foreground) to _numSortPanel (background)
-			_numSortPanel = b;
+			_numSortPanel = i;
 			break;
 		}
 	}
@@ -1397,13 +1397,13 @@ void PathFinding3D::whereIs(int px, int py) {
 	}
 
 	// try all the panels and choose the closest one
-	for (int b = 0; b < _panelNum; ++b) {
-		if (intersectLinePanel(&_panel[b], x, y, z)) {
+	for (int i = 0; i < _panelNum; ++i) {
+		if (intersectLinePanel(&_panel[i], x, y, z)) {
 			float temp = _vm->dist3D(_vm->_actor->_camera->_ex, _vm->_actor->_camera->_ey, _vm->_actor->_camera->_ez, _x3d, _y3d, _z3d);
 
 			if (_vm->floatComp(temp, inters) == -1) {
 				inters = temp;
-				_curPanel = b;
+				_curPanel = i;
 				_curX = _x3d;
 				_curZ = _z3d;
 			}
@@ -1441,8 +1441,8 @@ void PathFinding3D::pointOut() {
 	nz /= temp;
 
 	// move the point on the wide panel
-	for (int b = 0; b < _panelNum; ++b) {
-		panel = &_panel[b];
+	for (int i = 0; i < _panelNum; ++i) {
+		panel = &_panel[i];
 		// Only check the external panels with the same flag
 		if ((panel->_flags & 0x80000000) && (panel->_flags & (_panel[_curPanel]._flags & 0x7FFFFFFF))) {
 			// check point 1
@@ -1450,7 +1450,7 @@ void PathFinding3D::pointOut() {
 
 			if (_vm->floatComp(temp, inters) == -1) {
 				inters = temp;
-				_curPanel = b;
+				_curPanel = i;
 				x = panel->_x1;
 				z = panel->_z1;
 			}
@@ -1460,7 +1460,7 @@ void PathFinding3D::pointOut() {
 
 			if (_vm->floatComp(temp, inters) == -1) {
 				inters = temp;
-				_curPanel = b;
+				_curPanel = i;
 				x = panel->_x2;
 				z = panel->_z2;
 			}
@@ -1470,7 +1470,7 @@ void PathFinding3D::pointOut() {
 
 			if (_vm->floatComp(temp, inters) == -1) {
 				inters = temp;
-				_curPanel = b;
+				_curPanel = i;
 				x = (panel->_x1 * 2.0f + panel->_x2) / 3.0f;
 				z = (panel->_z1 * 2.0f + panel->_z2) / 3.0f;
 			}
@@ -1480,7 +1480,7 @@ void PathFinding3D::pointOut() {
 
 			if (_vm->floatComp(temp, inters) == -1) {
 				inters = temp;
-				_curPanel = b;
+				_curPanel = i;
 				x = (panel->_x1 + panel->_x2 * 2.0f) / 3.0f;
 				z = (panel->_z1 + panel->_z2 * 2.0f) / 3.0f;
 			}
@@ -1491,7 +1491,7 @@ void PathFinding3D::pointOut() {
 
 				if (_vm->floatComp(temp, inters) == -1) {
 					inters = temp;
-					_curPanel = b;
+					_curPanel = i;
 					x = _x3d;
 					z = _z3d;
 				}
@@ -1503,7 +1503,7 @@ void PathFinding3D::pointOut() {
 
 				if (_vm->floatComp(temp, inters) == -1) {
 					inters = temp;
-					_curPanel = b;
+					_curPanel = i;
 					x = _x3d;
 					z = _z3d;
 				}
@@ -1516,7 +1516,7 @@ void PathFinding3D::pointOut() {
 
 				if (_vm->floatComp(temp, inters) == -1) {
 					inters = temp;
-					_curPanel = b;
+					_curPanel = i;
 					x = _x3d;
 					z = _z3d;
 				}
@@ -1677,14 +1677,14 @@ void PathFinding3D::actorOrder() {
 	// It must be copied in front of the nearest box
 	_actorPos = _sortPan[1]._num;
 	// from closest to farthest
-	for (int b = 1; b < _numSortPanel; ++b) {
-		for (int a = 0; a < _panelNum; ++a) {
+	for (int i = 1; i < _numSortPanel; ++i) {
+		for (int j = 0; j < _panelNum; ++j) {
 			// If it's not wide and belongs to this level
-			if (!(_panel[a]._flags & 0x80000000) && (_panel[a]._flags & (1 << (_sortPan[b]._num - 1)))) {
+			if (!(_panel[j]._flags & 0x80000000) && (_panel[j]._flags & (1 << (_sortPan[i]._num - 1)))) {
 				// If it intersects the center of the character camera
-				if (intersectLineLine(_panel[a]._x1, _panel[a]._z1, _panel[a]._x2, _panel[a]._z2, actor->_camera->_ex, actor->_camera->_ez, ox, oz) || intersectLineLine(_panel[a]._x1, _panel[a]._z1, _panel[a]._x2, _panel[a]._z2, actor->_camera->_ex, actor->_camera->_ez, ox + lx, oz + lz) || intersectLineLine(_panel[a]._x1, _panel[a]._z1, _panel[a]._x2, _panel[a]._z2, actor->_camera->_ex, actor->_camera->_ez, ox - lx, oz - lz)) {
+				if (intersectLineLine(_panel[j]._x1, _panel[j]._z1, _panel[j]._x2, _panel[j]._z2, actor->_camera->_ex, actor->_camera->_ez, ox, oz) || intersectLineLine(_panel[j]._x1, _panel[j]._z1, _panel[j]._x2, _panel[j]._z2, actor->_camera->_ex, actor->_camera->_ez, ox + lx, oz + lz) || intersectLineLine(_panel[j]._x1, _panel[j]._z1, _panel[j]._x2, _panel[j]._z2, actor->_camera->_ex, actor->_camera->_ez, ox - lx, oz - lz)) {
 					// If it intersects it must be copied after the next box
-					_actorPos = _sortPan[b + 1]._num;
+					_actorPos = _sortPan[i + 1]._num;
 				}
 			}
 		}
diff --git a/engines/trecision/renderer3d.cpp b/engines/trecision/renderer3d.cpp
index c6fb0eade6..7b5c1b9c8f 100644
--- a/engines/trecision/renderer3d.cpp
+++ b/engines/trecision/renderer3d.cpp
@@ -517,7 +517,7 @@ void Renderer3D::calcCharacterPoints() {
 	float tz = 0.0f;
 	float pa0, pa1, pa2;
 
-	for (uint32 b = 0; b < actor->_lightNum; ++b) {
+	for (uint32 i = 0; i < actor->_lightNum; ++i) {
 		// if off                lint == 0
 		// if it has a shadow    lint & 0x80
 
@@ -584,14 +584,14 @@ void Renderer3D::calcCharacterPoints() {
 		if ((light->_inten & 0x80) && lint) { // if it's shadowed and still on
 
 			// casts shadow vertices
-			for (int a = 0; a < SHADOWVERTSNUM; ++a) {
-				pa0 = actor->_vertex[_shadowVerts[a]]._x;
-				pa1 = actor->_vertex[_shadowVerts[a]]._y;
-				pa2 = actor->_vertex[_shadowVerts[a]]._z;
-
-				_shVertex[vertexNum + _totalShadowVerts + a]._x = pa0 - (pa1 * l0);
-				_shVertex[vertexNum + _totalShadowVerts + a]._z = pa2 - (pa1 * l2);
-				_shVertex[vertexNum + _totalShadowVerts + a]._y = 0;
+			for (int j = 0; j < SHADOWVERTSNUM; ++j) {
+				pa0 = actor->_vertex[_shadowVerts[j]]._x;
+				pa1 = actor->_vertex[_shadowVerts[j]]._y;
+				pa2 = actor->_vertex[_shadowVerts[j]]._z;
+
+				_shVertex[vertexNum + _totalShadowVerts + j]._x = pa0 - (pa1 * l0);
+				_shVertex[vertexNum + _totalShadowVerts + j]._z = pa2 - (pa1 * l2);
+				_shVertex[vertexNum + _totalShadowVerts + j]._y = 0;
 			}
 
 			// per default all shadows are equally faint
@@ -609,7 +609,7 @@ void Renderer3D::calcCharacterPoints() {
 			l2 = l2 * t;
 
 			SVertex *curVertex = actor->_vertex;
-			for (int a = 0; a < vertexNum; ++a) {
+			for (int j = 0; j < vertexNum; ++j) {
 				pa0 = curVertex->_nx;
 				pa1 = curVertex->_ny;
 				pa2 = curVertex->_nz;
@@ -617,7 +617,7 @@ void Renderer3D::calcCharacterPoints() {
 				lint = (int)((acos(pa0 * l0 + pa1 * l1 + pa2 * l2) * 360.0) / PI);
 				lint = CLIP(lint, 0, 180);
 
-				_vVertex[a]._angle -= (180 - lint);
+				_vVertex[j]._angle -= (180 - lint);
 				++curVertex;
 			}
 		}
@@ -626,8 +626,8 @@ void Renderer3D::calcCharacterPoints() {
 	}
 
 	// rearranged light values so they can be viewed
-	for (int a = 0; a < vertexNum; ++a)
-		_vVertex[a]._angle = CLIP<int32>(_vVertex[a]._angle, 0, 180);
+	for (int i = 0; i < vertexNum; ++i)
+		_vVertex[i]._angle = CLIP<int32>(_vVertex[i]._angle, 0, 180);
 
 	// Calculate the distance of the character from the room
 	tx = camera->_ex - actor->_px;
@@ -638,15 +638,15 @@ void Renderer3D::calcCharacterPoints() {
 
 	SVertex *curVertex = actor->_vertex;
 
-	for (int a = 0; a < vertexNum + _totalShadowVerts; ++a) {
-		if (a < vertexNum) {
+	for (int i = 0; i < vertexNum + _totalShadowVerts; ++i) {
+		if (i < vertexNum) {
 			l0 = curVertex->_x;
 			l1 = curVertex->_z;
 			pa1 = ty - curVertex->_y;
 		} else {
-			l0 = _shVertex[a]._x;
-			l1 = _shVertex[a]._z;
-			pa1 = ty - _shVertex[a]._y;
+			l0 = _shVertex[i]._x;
+			l1 = _shVertex[i]._z;
+			pa1 = ty - _shVertex[i]._y;
 		}
 
 		pa0 = tx - (l0 * cost + l1 * sint); // rotate _curVertex
@@ -659,17 +659,17 @@ void Renderer3D::calcCharacterPoints() {
 		int x2d = _vm->_cx + (int)((l0 * camera->_fovX) / l2);
 		int y2d = _vm->_cy + (int)((l1 * camera->_fovY) / l2);
 
-		_vVertex[a]._x = x2d;
-		_vVertex[a]._y = y2d;
-		_vVertex[a]._z = (int32)((dist - l2) * 128.0);
+		_vVertex[i]._x = x2d;
+		_vVertex[i]._y = y2d;
+		_vVertex[i]._z = (int32)((dist - l2) * 128.0);
 
 		actor->_lim[0] = MIN(x2d, actor->_lim[0]);
 		actor->_lim[1] = MAX(x2d, actor->_lim[1]);
 		actor->_lim[2] = MIN(y2d, actor->_lim[2]);
 		actor->_lim[3] = MAX(y2d, actor->_lim[3]);
 
-		actor->_lim[4] = MIN<int32>(_vVertex[a]._z, actor->_lim[4]);
-		actor->_lim[5] = MAX<int32>(_vVertex[a]._z, actor->_lim[5]);
+		actor->_lim[4] = MIN<int32>(_vVertex[i]._z, actor->_lim[4]);
+		actor->_lim[5] = MAX<int32>(_vVertex[i]._z, actor->_lim[5]);
 
 		++curVertex;
 	}
@@ -717,11 +717,11 @@ void Renderer3D::drawCharacterFaces() {
 	if (actor->_curAction == hLAST)
 		setClipping(0, actor->_lim[2], MAXX, actor->_lim[3]);
 
-	for (int b = 0; b < _shadowLightNum; ++b) {
-		for (int a = 0; a < SHADOWFACESNUM; ++a) {
-			int p0 = _shadowFaces[a][0] + vertexNum + b * SHADOWVERTSNUM;
-			int p1 = _shadowFaces[a][1] + vertexNum + b * SHADOWVERTSNUM;
-			int p2 = _shadowFaces[a][2] + vertexNum + b * SHADOWVERTSNUM;
+	for (int i = 0; i < _shadowLightNum; ++i) {
+		for (int j = 0; j < SHADOWFACESNUM; ++j) {
+			int p0 = _shadowFaces[j][0] + vertexNum + i * SHADOWVERTSNUM;
+			int p1 = _shadowFaces[j][1] + vertexNum + i * SHADOWVERTSNUM;
+			int p2 = _shadowFaces[j][2] + vertexNum + i * SHADOWVERTSNUM;
 
 			int px0 = _vVertex[p0]._x;
 			int py0 = _vVertex[p0]._y;
@@ -730,11 +730,11 @@ void Renderer3D::drawCharacterFaces() {
 			int px2 = _vVertex[p2]._x;
 			int py2 = _vVertex[p2]._y;
 
-			shadowTriangle(px0, py0, px1, py1, px2, py2, 127 - _shadowIntens[b], (int16)(0x7FF0 + b));
+			shadowTriangle(px0, py0, px1, py1, px2, py2, 127 - _shadowIntens[i], (int16)(0x7FF0 + i));
 		}
 	}
 
-	for (uint a = 0; a < actor->_faceNum; ++a) {
+	for (uint i = 0; i < actor->_faceNum; ++i) {
 		int p0 = face->_a;
 		int p1 = face->_b;
 		int p2 = face->_c;
@@ -747,12 +747,12 @@ void Renderer3D::drawCharacterFaces() {
 		int py2 = _vVertex[p2]._y;
 
 		if (clockWise(px0, py0, px1, py1, px2, py2) > 0) {
-			uint16 b = face->_mat;
-			if (b < MAXMAT && textures[b].isActive()) {
-				textureTriangle(px0, py0, _vVertex[p0]._z, _vVertex[p0]._angle, actor->_textureCoord[a][0][0], actor->_textureCoord[a][0][1],
-								px1, py1, _vVertex[p1]._z, _vVertex[p1]._angle, actor->_textureCoord[a][1][0], actor->_textureCoord[a][1][1],
-								px2, py2, _vVertex[p2]._z, _vVertex[p2]._angle, actor->_textureCoord[a][2][0], actor->_textureCoord[a][2][1],
-								&textures[b]);
+			uint16 textureId = face->_mat;
+			if (textureId < MAXMAT && textures[textureId].isActive()) {
+				textureTriangle(px0, py0, _vVertex[p0]._z, _vVertex[p0]._angle, actor->_textureCoord[i][0][0], actor->_textureCoord[i][0][1],
+								px1, py1, _vVertex[p1]._z, _vVertex[p1]._angle, actor->_textureCoord[i][1][0], actor->_textureCoord[i][1][1],
+								px2, py2, _vVertex[p2]._z, _vVertex[p2]._angle, actor->_textureCoord[i][2][0], actor->_textureCoord[i][2][1],
+								&textures[textureId]);
 			}
 		}
 
@@ -760,8 +760,8 @@ void Renderer3D::drawCharacterFaces() {
 	}
 
 	int p0 = 0;
-	for (int b = _zBufStartY; b < actor->_lim[3]; ++b) {
-		for (int a = 1; a < _zBufWid; ++a) {
+	for (int i = _zBufStartY; i < actor->_lim[3]; ++i) {
+		for (int j = 1; j < _zBufWid; ++j) {
 			int py1 = (_zBuffer[p0] >= 0x7FF0) * 0x8000;
 			int py2 = (_zBuffer[p0 + 1] >= 0x7FF0) * 0x8000;
 
@@ -769,7 +769,7 @@ void Renderer3D::drawCharacterFaces() {
 			int p2 = _zBuffer[p0 + 1] < 0x7FFF;
 
 			if (p1 != p2) {
-				_vm->_graphicsMgr->pixelAliasing(a + _zBufStartX, b);
+				_vm->_graphicsMgr->pixelAliasing(j + _zBufStartX, i);
 
 				// if the first is the character
 				if (p1)
@@ -777,9 +777,9 @@ void Renderer3D::drawCharacterFaces() {
 				else
 					_zBuffer[p0] = 0x003F | py2;
 
-				if (a + 1 < _zBufWid) {
+				if (j + 1 < _zBufWid) {
 					++p0;
-					++a;
+					++j;
 
 					// if the second is the character
 					if (p2)
@@ -798,7 +798,7 @@ void Renderer3D::drawCharacterFaces() {
 			++p0;
 
 			// if it's the last of the line
-			if (a == _zBufWid - 1) {
+			if (j == _zBufWid - 1) {
 				if (p2)
 					_zBuffer[p0] = 0x00FF | py2;
 				else
diff --git a/engines/trecision/resource.cpp b/engines/trecision/resource.cpp
index a7bef58e7d..4c83b2572e 100644
--- a/engines/trecision/resource.cpp
+++ b/engines/trecision/resource.cpp
@@ -98,14 +98,14 @@ void TrecisionEngine::loadAll() {
 
 	_textPtr = _textArea;
 
-	for (int a = 0; a < MAXOBJNAME; a++)
-		_objName[a] = getNextSentence();
+	for (int i = 0; i < MAXOBJNAME; i++)
+		_objName[i] = getNextSentence();
 
-	for (int a = 0; a < MAXSENTENCE; a++)
-		_sentence[a] = getNextSentence();
+	for (int i = 0; i < MAXSENTENCE; i++)
+		_sentence[i] = getNextSentence();
 
-	for (int a = 0; a < MAXSYSTEXT; a++)
-		_sysText[a] = getNextSentence();
+	for (int i = 0; i < MAXSYSTEXT; i++)
+		_sysText[i] = getNextSentence();
 
 	delete data;
 	dataNl.close();
diff --git a/engines/trecision/saveload.cpp b/engines/trecision/saveload.cpp
index 0c691d2f28..1783679d76 100644
--- a/engines/trecision/saveload.cpp
+++ b/engines/trecision/saveload.cpp
@@ -408,14 +408,14 @@ bool TrecisionEngine::syncGameStream(Common::Serializer &ser) {
 	_actor->syncGameStream(ser);
 	_pathFind->syncGameStream(ser);
 
-	for (int a = 0; a < MAXROOMS; a++)
-		_room[a].syncGameStream(ser);
+	for (int i = 0; i < MAXROOMS; i++)
+		_room[i].syncGameStream(ser);
 
-	for (int a = 0; a < MAXOBJ; a++)
-		_obj[a].syncGameStream(ser);
+	for (int i = 0; i < MAXOBJ; i++)
+		_obj[i].syncGameStream(ser);
 
-	for (int a = 0; a < MAXINVENTORY; a++)
-		_inventoryObj[a].syncGameStream(ser);
+	for (int i = 0; i < MAXINVENTORY; i++)
+		_inventoryObj[i].syncGameStream(ser);
 
 	_animMgr->syncGameStream(ser);
 	ser.skip(NUMSAMPLES * 2, SAVE_VERSION_ORIGINAL_MIN, SAVE_VERSION_ORIGINAL_MAX); // SoundManager::syncGameStream()
diff --git a/engines/trecision/text.cpp b/engines/trecision/text.cpp
index 626ad74222..dc066b9f74 100644
--- a/engines/trecision/text.cpp
+++ b/engines/trecision/text.cpp
@@ -442,11 +442,11 @@ void TextManager::clearText() {
 }
 
 void TextManager::drawTexts() {
-	for (Common::List<StackText>::iterator i = _textStack.begin(); i != _textStack.end(); ++i) {
-		if (i->_clear)
+	for (Common::List<StackText>::iterator it = _textStack.begin(); it != _textStack.end(); ++it) {
+		if (it->_clear)
 			clearText();
 		else
-			drawText(&*i);
+			drawText(&*it);
 	}
 }
 
diff --git a/engines/trecision/utils.cpp b/engines/trecision/utils.cpp
index 2f6877e926..44ab420170 100644
--- a/engines/trecision/utils.cpp
+++ b/engines/trecision/utils.cpp
@@ -114,8 +114,8 @@ uint32 TrecisionEngine::readTime() {
 }
 
 bool TrecisionEngine::checkMask(Common::Point pos) {
-	for (int8 a = MAXOBJINROOM - 1; a >= 0; --a) {
-		uint16 checkedObj = _room[_curRoom]._object[a];
+	for (int8 i = MAXOBJINROOM - 1; i >= 0; --i) {
+		uint16 checkedObj = _room[_curRoom]._object[i];
 		Common::Rect lim = _obj[checkedObj]._lim;
 		lim.translate(0, TOP);
 		// Trecision includes the bottom and right coordinates
@@ -131,16 +131,16 @@ bool TrecisionEngine::checkMask(Common::Point pos) {
 				}
 
 				if (_obj[checkedObj].isModeMask()) {
-					uint8 *mask = _maskPointers[a];
+					uint8 *mask = _maskPointers[i];
 					int16 d = _obj[checkedObj]._rect.left;
 					uint16 max = _obj[checkedObj]._rect.bottom;
 
-					for (uint16 b = _obj[checkedObj]._rect.top; b < max; ++b) {
+					for (uint16 j = _obj[checkedObj]._rect.top; j < max; ++j) {
 						bool insideObj = false;
 						int16 e = 0;
 						while (e < _obj[checkedObj]._rect.width()) {
 							if (!insideObj) { // not inside an object
-								if (b + TOP == pos.y) {
+								if (j + TOP == pos.y) {
 									if ((pos.x >= d + e) && (pos.x < d + e + *mask)) {
 										_curObj = 0;
 									}
@@ -150,7 +150,7 @@ bool TrecisionEngine::checkMask(Common::Point pos) {
 								++mask;
 								insideObj = true;
 							} else { // inside an object
-								if (b + TOP == pos.y) {
+								if (j + TOP == pos.y) {
 									if ((pos.x >= d + e) && (pos.x < d + e + *mask)) {
 										_curObj = checkedObj;
 										return true;
@@ -313,16 +313,16 @@ uint16 SDText::calcHeight(TrecisionEngine *vm) {
 		return CARHEI;
 	}
 
-	uint16 a = 0;
+	uint16 index = 0;
 	uint16 tmpDy = 0;
 	uint16 lastSpace = 0;
 	uint16 curInit = 0;
 
-	while (a < _text.size()) {
-		++a;
-		if (a < _text.size() && _text[a] == ' ') {
-			if (vm->textLength(_text, curInit, a) <= _rect.width())
-				lastSpace = a;
+	while (index < _text.size()) {
+		++index;
+		if (index < _text.size() && _text[index] == ' ') {
+			if (vm->textLength(_text, curInit, index) <= _rect.width())
+				lastSpace = index;
 			else if (vm->textLength(_text, curInit, lastSpace) <= _rect.width()) {
 				_drawTextLines[curLine] = _text.substr(curInit, lastSpace - curInit);
 
@@ -330,12 +330,12 @@ uint16 SDText::calcHeight(TrecisionEngine *vm) {
 				curInit = lastSpace + 1;
 
 				tmpDy += CARHEI;
-				a = curInit;
+				index = curInit;
 			} else
 				return 0;
-		} else if (a == _text.size()) {
-			if (vm->textLength(_text, curInit, a) <= _rect.width()) {
-				_drawTextLines[curLine] = _text.substr(curInit, a - curInit);
+		} else if (index == _text.size()) {
+			if (vm->textLength(_text, curInit, index) <= _rect.width()) {
+				_drawTextLines[curLine] = _text.substr(curInit, index - curInit);
 
 				tmpDy += CARHEI;
 				return tmpDy;
diff --git a/engines/trecision/video.cpp b/engines/trecision/video.cpp
index 55416f9d29..fbffd5064b 100644
--- a/engines/trecision/video.cpp
+++ b/engines/trecision/video.cpp
@@ -574,23 +574,23 @@ void AnimManager::swapCD(int cd) {
 }
 
 void AnimManager::syncGameStream(Common::Serializer &ser) {
-	for (int a = 0; a < MAXANIM; a++) {
-		SAnim *cur = &_animTab[a];
+	for (int i = 0; i < MAXANIM; i++) {
+		SAnim *cur = &_animTab[i];
 		ser.syncBytes((byte *)cur->_name, 14);
 		ser.syncAsUint16LE(cur->_flag);
-		for (uint8 i = 0; i < MAXCHILD; ++i) {
-			ser.syncAsUint16LE(cur->_lim[i].left);
-			ser.syncAsUint16LE(cur->_lim[i].top);
-			ser.syncAsUint16LE(cur->_lim[i].right);
-			ser.syncAsUint16LE(cur->_lim[i].bottom);
+		for (uint8 j = 0; j < MAXCHILD; ++j) {
+			ser.syncAsUint16LE(cur->_lim[j].left);
+			ser.syncAsUint16LE(cur->_lim[j].top);
+			ser.syncAsUint16LE(cur->_lim[j].right);
+			ser.syncAsUint16LE(cur->_lim[j].bottom);
 		}
 		ser.syncAsByte(cur->_nbox);
 		ser.skip(1, SAVE_VERSION_ORIGINAL_MIN, SAVE_VERSION_ORIGINAL_MAX);
-		for (uint8 i = 0; i < MAXATFRAME; ++i) {
-			ser.syncAsByte(cur->_atFrame[i]._type);
-			ser.syncAsByte(cur->_atFrame[i]._child);
-			ser.syncAsUint16LE(cur->_atFrame[i]._numFrame);
-			ser.syncAsUint16LE(cur->_atFrame[i]._index);
+		for (uint8 j = 0; j < MAXATFRAME; ++j) {
+			ser.syncAsByte(cur->_atFrame[j]._type);
+			ser.syncAsByte(cur->_atFrame[j]._child);
+			ser.syncAsUint16LE(cur->_atFrame[j]._numFrame);
+			ser.syncAsUint16LE(cur->_atFrame[j]._index);
 		}
 	}
 }


Commit: 95cec5019518e3154a44ca346fdf173c1f6eaad2
    https://github.com/scummvm/scummvm/commit/95cec5019518e3154a44ca346fdf173c1f6eaad2
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-06-20T17:04:01+03:00

Commit Message:
TRECISION: Don't refresh objs outside of the current room - bug #12625

Changed paths:
    engines/trecision/trecision.cpp


diff --git a/engines/trecision/trecision.cpp b/engines/trecision/trecision.cpp
index 869e0b496b..ebd7f32b77 100644
--- a/engines/trecision/trecision.cpp
+++ b/engines/trecision/trecision.cpp
@@ -339,6 +339,15 @@ void TrecisionEngine::setObjectVisible(uint16 objectId, bool visible) {
 }
 
 void TrecisionEngine::refreshObject(uint16 objectId) {
+	for (int i = 0; i < MAXOBJINROOM; ++i) {
+		if (!_room[_curRoom]._object[i])
+			return;	// reached the end of the list, object not found
+
+		if (objectId == _room[_curRoom]._object[i]) {
+			break;	// object found in room objects, continue
+		}
+	}
+
 	if (_obj[objectId].isModeMask() || _obj[objectId].isModeFull()) {
 		SSortTable entry;
 		entry._objectId = objectId;




More information about the Scummvm-git-logs mailing list