aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/cruise/actor.cpp51
-rw-r--r--engines/cruise/cruise_main.cpp9
2 files changed, 25 insertions, 35 deletions
diff --git a/engines/cruise/actor.cpp b/engines/cruise/actor.cpp
index 0a7bbfe86a..331b1c1edd 100644
--- a/engines/cruise/actor.cpp
+++ b/engines/cruise/actor.cpp
@@ -289,16 +289,15 @@ void poly2(int x1, int y1, int x2, int y2) {
}
int point_proche(int16 table[][2]) {
- int x1, y1, i, x, y, p;
int d1 = 1000;
_vm->_polyStructs = &_vm->_polyStructNorm;
if (nclick_noeud == 1) {
- x = x_mouse;
- y = y_mouse;
- x1 = table_ptselect[0][0];
- y1 = table_ptselect[0][1];
+ int x = x_mouse;
+ int y = y_mouse;
+ int x1 = table_ptselect[0][0];
+ int y1 = table_ptselect[0][1];
_vm->_polyStructs = &_vm->_polyStructExp;
@@ -326,10 +325,10 @@ int point_proche(int16 table[][2]) {
}
_vm->_polyStructs = &_vm->_polyStructNorm;
- p = -1;
- for (i = 0; i < ctp_routeCoordCount; i++) {
- x = table[i][0];
- y = table[i][1];
+ int p = -1;
+ for (int i = 0; i < ctp_routeCoordCount; i++) {
+ int x = table[i][0];
+ int y = table[i][1];
int pointDistance = computeDistance(x_mouse, y_mouse, x, y);
if (pointDistance < d1) {
@@ -363,9 +362,7 @@ int8 Fsol[NBNOEUD + 1];
int D;
void explore(int depart, int arrivee) {
- int id1, id2, i;
-
- id1 = depart;
+ int id1 = depart;
fl[id1]++;
sol[idsol++] = (char)id1;
@@ -377,8 +374,9 @@ void explore(int depart, int arrivee) {
return;
}
+ int i;
while ((i = fl[id1]) < 20) {
- id2 = ctp_routes[id1][i + 1];
+ int id2 = ctp_routes[id1][i + 1];
if (id2 == arrivee) {
if (idsol < solmax) {
@@ -441,9 +439,6 @@ void chemin0(int depart, int arrivee) {
}
void valide_noeud(int16 table[], int16 p, int *nclick, int16 solution0[20 + 3][2]) {
- int a, b, d, i, p1, x1, x2, y1, y2;
- //int y=30;
-
table[*nclick] = p;
table[(*nclick) + 1] = -1;
table_ptselect[*nclick][0] = x_mouse;
@@ -452,10 +447,10 @@ void valide_noeud(int16 table[], int16 p, int *nclick, int16 solution0[20 + 3][2
_vm->_polyStructs = &_vm->_polyStructNorm;
if (*nclick == 2) { // second point
- x1 = table_ptselect[0][0];
- y1 = table_ptselect[0][1];
- x2 = table_ptselect[1][0];
- y2 = table_ptselect[1][1];
+ int x1 = table_ptselect[0][0];
+ int y1 = table_ptselect[0][1];
+ int x2 = table_ptselect[1][0];
+ int y2 = table_ptselect[1][1];
if ((x1 == x2) && (y1 == y2)) {
return;
}
@@ -504,13 +499,11 @@ void valide_noeud(int16 table[], int16 p, int *nclick, int16 solution0[20 + 3][2
} else {
solution0[0][0] = x1;
solution0[0][1] = y1;
- i = 0;
+ int i = 0;
while (solution[i] != -1) {
- p1 = solution[i];
- solution0[i + 1][0] =
- ctp_routeCoords[p1][0];
- solution0[++i][1] =
- ctp_routeCoords[p1][1];
+ int p1 = solution[i];
+ solution0[i + 1][0] = ctp_routeCoords[p1][0];
+ solution0[++i][1] = ctp_routeCoords[p1][1];
}
_vm->_polyStructs = &_vm->_polyStructExp;
poly2(x2, y2,
@@ -527,8 +520,8 @@ void valide_noeud(int16 table[], int16 p, int *nclick, int16 solution0[20 + 3][2
/****** Trim down any un-necessary walk points ******/
i++;
- d = 0;
- a = i;
+ int d = 0;
+ int a = i;
flag_obstacle = 1;
while (d != a) {
x1 = solution0[d][0];
@@ -544,7 +537,7 @@ void valide_noeud(int16 table[], int16 p, int *nclick, int16 solution0[20 + 3][2
flag_obstacle = 1;
if (d != i) {
i++;
- for (b = d + 1; b < i; b++) {
+ for (int b = d + 1; b < i; b++) {
solution0[b][0] = -2;
}
} else
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index b3f9308d17..f9ae722fe6 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -989,7 +989,6 @@ bool findRelation(int objOvl, int objIdx, int x, int y) {
ovlDataStruct *ovl2 = NULL;
ovlDataStruct *ovl3 = NULL;
- //ovlDataStruct *ovl4 = NULL;
if (verbOvl > 0)
ovl2 = overlayTable[verbOvl].ovlData;
@@ -1079,9 +1078,6 @@ void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj) {
}
if ((obj2Ovl == nOvl) && (pHeader->obj2Number != -1) && (pHeader->obj2Number == nObj)) {
- int x = 60;
- int y = 60;
-
objectParamsQuery params;
memset(&params, 0, sizeof(objectParamsQuery)); // to remove warning
@@ -1129,6 +1125,8 @@ void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj) {
}
}
} else if (pHeader->type == RT_MSG) {
+ int x = 60;
+ int y = 60;
if (pHeader->obj2Number >= 0) {
if ((pHeader->trackX !=-1) && (pHeader->trackY !=-1) &&
@@ -1897,11 +1895,10 @@ void CruiseEngine::mainLoop() {
// Raoul appearing when looking at the book is being there are 3 script iterations separation between the
// scene being changed to the book, and the Raoul actor being frozen/disabled. This loop is a hack to ensure
// that does a few extra script executions for that scene
- bool bgChanged;
int numIterations = 1;
while (numIterations-- > 0) {
- bgChanged = backgroundChanged[masterScreen];
+ bool bgChanged = backgroundChanged[masterScreen];
manageScripts(&relHead);
manageScripts(&procHead);