aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2014-02-09 20:06:08 +0100
committerStrangerke2014-02-09 20:06:08 +0100
commit56664d036fa5ad1ef405fb4b019ef71d97baf427 (patch)
tree9f79641f1c2764b02155ef28f3f825e9cfa126fe /engines
parent4ae6d57a03a013f3072a548548b3ca24743055f7 (diff)
downloadscummvm-rg350-56664d036fa5ad1ef405fb4b019ef71d97baf427.tar.gz
scummvm-rg350-56664d036fa5ad1ef405fb4b019ef71d97baf427.tar.bz2
scummvm-rg350-56664d036fa5ad1ef405fb4b019ef71d97baf427.zip
HOPKINS: Reduce the scope of some more variables
Diffstat (limited to 'engines')
-rw-r--r--engines/hopkins/lines.cpp15
-rw-r--r--engines/hopkins/objects.cpp8
2 files changed, 9 insertions, 14 deletions
diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp
index aa708fdfb2..e849f8635c 100644
--- a/engines/hopkins/lines.cpp
+++ b/engines/hopkins/lines.cpp
@@ -548,8 +548,6 @@ int LinesManager::avoidObstacleOnSegment(int lineIdx, int lineDataIdx, int route
bool LinesManager::MIRACLE(int fromX, int fromY, int lineIdx, int destLineIdx, int routeIdx) {
debugC(5, kDebugPath, "MIRACLE(%d, %d, %d, %d, %d)", fromX, fromY, lineIdx, destLineIdx, routeIdx);
- int newLinesDataIdx = 0;
- int newLinesIdx = 0;
int lineIdxLeft = 0;
int lineDataIdxLeft = 0;
int lineIdxRight = 0;
@@ -700,6 +698,8 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int lineIdx, int destLineIdx, i
newDir = DIR_LEFT;
}
+ int newLinesDataIdx = 0;
+ int newLinesIdx = 0;
switch(newDir) {
case DIR_UP:
newLinesIdx = linesIdxUp;
@@ -1552,7 +1552,6 @@ void LinesManager::useRoute2(int idx, int curRouteIdx) {
int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int startLineIdx, int endLineIdx, int routeIdx) {
debugC(5, kDebugPath, "characterRoute(%d, %d, %d, %d, %d, %d, %d)", fromX, fromY, destX, destY, startLineIdx, endLineIdx, routeIdx);
int collDataIdxRoute2 = 0;
- bool colResult = false;
int curX = fromX;
int curY = fromY;
@@ -1603,7 +1602,6 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int
int collLineIdxRoute1 = -1;
int collLineIdxRoute2 = -1;
- int distX, distY;
int repeatFlag = 0;
int collDataIdxRoute0 = 0;
int collDataIdxRoute1 = 0;
@@ -1615,8 +1613,8 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int
useRoute0(idxRoute0, curRouteIdx);
return 1;
}
- distX = abs(curX - destX) + 1;
- distY = abs(curY - destY) + 1;
+ int distX = abs(curX - destX) + 1;
+ int distY = abs(curY - destY) + 1;
int maxDist;
if (distX > distY)
maxDist = distX;
@@ -1912,7 +1910,7 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int
posXRoute2 = _newPosX;
posYRoute2 = _newPosY;
- colResult = checkCollisionLine(_newPosX, _newPosY, &collDataIdxRoute2, &collLineIdxRoute2, 0, _lastLine);
+ bool colResult = checkCollisionLine(_newPosX, _newPosY, &collDataIdxRoute2, &collLineIdxRoute2, 0, _lastLine);
if (colResult && collLineIdxRoute2 <= _lastLine)
break;
}
@@ -2456,13 +2454,12 @@ bool LinesManager::PLAN_TEST(int paramX, int paramY, int superRouteIdx, int para
int LinesManager::testLine(int paramX, int paramY, int *testValue, int *foundLineIdx, int *foundDataIdx) {
debugC(5, kDebugPath, "testLine(%d, %d, testValue, foundLineIdx, foundDataIdx)", paramX, paramY);
int16 *lineData;
- int lineDataEndIdx;
int collLineIdx;
int collDataIdx;
for (int idx = _lastLine + 1; idx < _linesNumb + 1; idx++) {
lineData = _lineItem[idx]._lineData;
- lineDataEndIdx = _lineItem[idx]._lineDataEndIdx;
+ int lineDataEndIdx = _lineItem[idx]._lineDataEndIdx;
if (!lineData)
continue;
diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp
index 347a6aabe8..2c780dd428 100644
--- a/engines/hopkins/objects.cpp
+++ b/engines/hopkins/objects.cpp
@@ -376,7 +376,6 @@ void ObjectsManager::addObject(int objIndex) {
void ObjectsManager::displaySprite() {
int clipX;
int clipY;
- bool loopCondFl;
uint16 arr[50];
// Handle copying any background areas that text are going to be drawn on
@@ -441,6 +440,7 @@ void ObjectsManager::displaySprite() {
for (int i = 1; i <= 48; i++)
arr[i] = i;
+ bool loopCondFl;
do {
loopCondFl = false;
for (int sortIdx = 1; sortIdx < _sortedDisplayCount; sortIdx++) {
@@ -3613,12 +3613,10 @@ void ObjectsManager::showSpecialActionAnimation(const byte *spriteData, const Co
realSpeed = speed / 3;
int spriteIndex = 0;
- bool completeTokenFl;
- char nextChar;
for (int idx = 0; ; idx++) {
- completeTokenFl = false;
- nextChar = animString[idx];
+ bool completeTokenFl = false;
+ char nextChar = animString[idx];
if (nextChar == ',') {
spriteIndex = atoi(tmpStr.c_str());
tmpStr = "";