aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2012-10-22 22:31:46 +1100
committerPaul Gilbert2012-10-22 22:31:46 +1100
commit71268b44184cfb9525186f008789cd5e5e2ae298 (patch)
tree8977a008c97fd3f01ee7ce4f84d16a1391302f53
parent7fec14d97f06eb49cf4c59fceae47e3e5edf4096 (diff)
downloadscummvm-rg350-71268b44184cfb9525186f008789cd5e5e2ae298.tar.gz
scummvm-rg350-71268b44184cfb9525186f008789cd5e5e2ae298.tar.bz2
scummvm-rg350-71268b44184cfb9525186f008789cd5e5e2ae298.zip
HOPKINS: Furhter bugfixes for pathfinding and walking
-rw-r--r--engines/hopkins/graphics.cpp4
-rw-r--r--engines/hopkins/graphics.h2
-rw-r--r--engines/hopkins/lines.cpp100
-rw-r--r--engines/hopkins/lines.h2
-rw-r--r--engines/hopkins/objects.cpp130
-rw-r--r--engines/hopkins/objects.h6
6 files changed, 120 insertions, 124 deletions
diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp
index 691781383d..feecff9c2c 100644
--- a/engines/hopkins/graphics.cpp
+++ b/engines/hopkins/graphics.cpp
@@ -1756,7 +1756,7 @@ int GraphicsManager::Asm_Reduc(int v, int percentage) {
}
// Display 'Perfect?'
-void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int spriteIndex, int a6, int a7, int a8) {
+void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int a6, int a7, int a8) {
const byte *v8;
int i;
const byte *v10;
@@ -1817,7 +1817,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp
int v65;
v8 = srcData + 3;
- for (i = spriteIndex; i; --i)
+ for (i = frameIndex; i; --i)
v8 += READ_LE_UINT32(v8) + 16;
v11 = 0;
diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h
index 7b8a5f5151..8a337e0104 100644
--- a/engines/hopkins/graphics.h
+++ b/engines/hopkins/graphics.h
@@ -170,7 +170,7 @@ public:
void Restore_Mem(byte *a1, const byte *a2, int a3, int a4, unsigned int a5, int a6);
int Reel_Zoom(int v, int percentage);
int Reel_Reduc(int v, int percentage);
- void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int a5, int a6, int a7, int a8);
+ void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int a6, int a7, int a8);
void AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex);
void SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY);
void Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY);
diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp
index 67ce626e0e..500a7e590b 100644
--- a/engines/hopkins/lines.cpp
+++ b/engines/hopkins/lines.cpp
@@ -1690,9 +1690,7 @@ LABEL_17:
}
// Avoid 2
-// TODO: method casting int arrays as byte pointers. Double-check later whether
-// we can convert the return to a uint16 *
-int16 *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) {
+int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) {
int v4;
int v5;
int v6;
@@ -1818,15 +1816,15 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) {
int v136[10];
int v141[10];
- v123 = a3;
- v122 = a4;
+ v123 = destX;
+ v122 = destY;
v121 = 0;
v120 = 0;
v115 = 0;
v114 = 0;
v113 = 0;
v111 = 0;
- if (a4 <= 24)
+ if (destY <= 24)
v122 = 25;
if (!_vm->_globals.NOT_VERIF) {
v4 = a1 - _vm->_globals.old_x1_65;
@@ -1837,7 +1835,7 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) {
if (v5 < 0)
v5 = -v5;
if (v5 <= 4) {
- v6 = _vm->_globals.old_x2_67 - a3;
+ v6 = _vm->_globals.old_x2_67 - destX;
if (v6 < 0)
v6 = -v6;
if (v6 <= 4) {
@@ -1849,7 +1847,7 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) {
}
}
}
- v8 = a1 - a3;
+ v8 = a1 - destX;
if (v8 < 0)
v8 = -v8;
if (v8 <= 4) {
@@ -1865,12 +1863,12 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) {
_vm->_globals.NOT_VERIF = 0;
_vm->_globals.old_z_69 = _vm->_objectsManager.NUMZONE;
_vm->_globals.old_x1_65 = a1;
- _vm->_globals.old_x2_67 = a3;
+ _vm->_globals.old_x2_67 = destX;
_vm->_globals.old_y1_66 = a2;
_vm->_globals.old_y2_68 = v122;
_vm->_globals.STOP_BUG = 0;
v112 = 0;
- if (a3 <= 19)
+ if (destX <= 19)
v123 = 20;
if (v122 <= 19)
v122 = 20;
@@ -2715,7 +2713,7 @@ LABEL_150:
}
if (v94 == -1 && (unsigned int)(v101 + 150) <= 0x96)
v91 = 1;
- if (v91 == -1 && !VERIF_SMOOTH(v7, v109, a3, a4) && SMOOTH_MOVE(0, a3, v7, v109, a3, a4) != -1)
+ if (v91 == -1 && !VERIF_SMOOTH(v7, v109, a3, a4) && SMOOTH_MOVE(v7, v109, a3, a4) != -1)
break;
LABEL_72:
v19 = v111 - a3;
@@ -2855,8 +2853,8 @@ LABEL_67:
v17 = _vm->_globals.essai0;
v17[v16] = v112;
- WRITE_LE_UINT16(v17 + 2 * v16 + 2, v110);
- WRITE_LE_UINT16(v17 + 2 * v16 + 4, v91);
+ v17[v16 + 1] = v110;
+ v17[v16 + 2] = v91;
v115 += 3;
++v14;
LABEL_70:
@@ -3347,7 +3345,7 @@ int LinesManager::VERIF_SMOOTH(int a1, int a2, int a3, int a4) {
return 0;
}
-int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) {
+int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) {
int v6;
int v7;
int v8;
@@ -3404,10 +3402,10 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) {
int v60;
int v61;
int v62;
+ int v63;
- warning("TODO: SMOOTH_MOVE - a1 = a4 doesn't look like that in the IDB, need to double-check");
v62 = a3;
- a1 = a4;
+ v63 = a4;
if (a3 >= a5 || a6 >= a4) {
if (a3 <= a5 || a6 >= a4) {
if (a3 >= a5 || a6 <= a4) {
@@ -3418,20 +3416,20 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) {
do {
v25 = _vm->_globals.Hopkins[v53].field0;
v40 = _vm->_globals.Hopkins[v53].field2;
- v26 = _vm->_globals.STAILLE[a1];
+ v26 = _vm->_globals.STAILLE[v63];
if (v26 < 0) {
v27 = v26;
v28 = v26;
if (v26 < 0)
v28 = -v26;
- v48 = _vm->_globals.STAILLE[a1];
- v45 = a1;
+ v48 = _vm->_globals.STAILLE[v63];
+ v45 = v63;
v25 = _vm->_graphicsManager.Reel_Reduc(v25, v28);
v29 = v27;
if ((v27 & 0x80000000u) != 0)
v29 = -v27;
v40 = _vm->_graphicsManager.Reel_Reduc(v40, v29);
- a1 = v45;
+ v63 = v45;
v26 = v48;
}
if (v26 > 0) {
@@ -3439,23 +3437,23 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) {
v31 = v26;
if (v26 < 0)
v31 = -v26;
- v46 = a1;
+ v46 = v63;
v25 = _vm->_graphicsManager.Reel_Zoom(v25, v31);
v32 = v30;
if ((v30 & 0x80000000u) != 0)
v32 = -v30;
v40 = _vm->_graphicsManager.Reel_Zoom(v40, v32);
- a1 = v46;
+ v63 = v46;
}
- v33 = a1 + v40;
+ v33 = v63 + v40;
v34 = 0;
if (v25 > 0) {
do {
--v62;
SMOOTH[v61].field0 = v62;
- if (a1 != v33)
- a1 = a1 + 1;
- SMOOTH[v61++].field2 = a1;
+ if (v63 != v33)
+ v63 = v63 + 1;
+ SMOOTH[v61++].field2 = v63;
++v34;
} while (v34 < v25);
}
@@ -3463,7 +3461,7 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) {
if (v53 == 48)
v53 = 36;
++v57;
- if (v62 <= a5 || a6 <= a1)
+ if (v62 <= a5 || a6 <= v63)
v49 = 1;
} while (v49 != 1);
if (v57 > 5) {
@@ -3481,20 +3479,20 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) {
do {
v14 = _vm->_globals.Hopkins[v52].field0;
v39 = _vm->_globals.Hopkins[v52].field2;
- v15 = _vm->_globals.STAILLE[a1];
+ v15 = _vm->_globals.STAILLE[v63];
if (v15 < 0) {
v16 = v15;
v17 = v15;
if (v15 < 0)
v17 = -v15;
- v47 = _vm->_globals.STAILLE[a1];
- v43 = a1;
+ v47 = _vm->_globals.STAILLE[v63];
+ v43 = v63;
v14 = _vm->_graphicsManager.Reel_Reduc(v14, v17);
v18 = v16;
if ((v16 & 0x80000000u) != 0)
v18 = -v16;
v39 = _vm->_graphicsManager.Reel_Reduc(v39, v18);
- a1 = v43;
+ v63 = v43;
v15 = v47;
}
if (v15 > 0) {
@@ -3502,23 +3500,23 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) {
v20 = v15;
if (v15 < 0)
v20 = -v15;
- v44 = a1;
+ v44 = v63;
v14 = _vm->_graphicsManager.Reel_Zoom(v14, v20);
v21 = v19;
if ((v19 & 0x80000000u) != 0)
v21 = -v19;
v39 = _vm->_graphicsManager.Reel_Zoom(v39, v21);
- a1 = v44;
+ v63 = v44;
}
- v22 = a1 + v39;
+ v22 = v63 + v39;
v23 = 0;
if (v14 > 0) {
do {
++v62;
SMOOTH[v60].field0 = v62;
- if (a1 != v22)
- a1 = a1 + 1;
- SMOOTH[v60++].field2 = a1;
+ if (v63 != v22)
+ v63 = v63 + 1;
+ SMOOTH[v60++].field2 = v63;
++v23;
} while (v23 < v14);
}
@@ -3526,7 +3524,7 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) {
if (v52 == 48)
v52 = 36;
++v56;
- if (v62 >= a5 || a6 <= (int)a1)
+ if (v62 >= a5 || a6 <= (int)v63)
v49 = 1;
} while (v49 != 1);
if (v56 > 5) {
@@ -3543,18 +3541,18 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) {
v55 = 0;
do {
v10 = _vm->_globals.Hopkins[v51].field2;
- v42 = a1;
+ v42 = v63;
v11 = _vm->_graphicsManager.Reel_Reduc(_vm->_globals.Hopkins[v51].field0, 0x19u);
v38 = _vm->_graphicsManager.Reel_Reduc(v10, 0x19u);
- a1 = v42;
+ v63 = v42;
v12 = 0;
if (v11 > 0) {
do {
--v62;
SMOOTH[v59].field0 = v62;
- if ((uint16)a1 != (uint16)v42 + v38)
- a1 = a1 - 1;
- SMOOTH[v59++].field2 = a1;
+ if ((uint16)v63 != (uint16)v42 + v38)
+ v63 = v63 - 1;
+ SMOOTH[v59++].field2 = v63;
++v12;
} while (v12 < v11);
}
@@ -3562,7 +3560,7 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) {
if (v51 == 24)
v51 = 12;
++v55;
- if (v62 <= a5 || a6 >= (int)a1)
+ if (v62 <= a5 || a6 >= (int)v63)
v49 = 1;
} while (v49 != 1);
if (v55 > 5) {
@@ -3579,18 +3577,18 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) {
v54 = 0;
do {
v6 = _vm->_globals.Hopkins[v50].field2;
- v41 = a1;
+ v41 = v63;
v7 = _vm->_graphicsManager.Reel_Reduc(_vm->_globals.Hopkins[v50].field0, 0x19u);
v37 = _vm->_graphicsManager.Reel_Reduc(v6, 0x19u);
- a1 = v41;
+ v63 = v41;
v8 = 0;
if (v7 > 0) {
do {
++v62;
SMOOTH[v58].field0 = v62;
- if ((uint16)a1 != (uint16)v41 + v37)
- a1 = a1 - 1;
- SMOOTH[v58++].field2 = a1;
+ if ((uint16)v63 != (uint16)v41 + v37)
+ v63 = v63 - 1;
+ SMOOTH[v58++].field2 = v63;
++v8;
} while (v8 < v7);
}
@@ -3598,7 +3596,7 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) {
if (v50 == 24)
v50 = 12;
++v54;
- if (v62 >= a5 || a6 >= (int)a1)
+ if (v62 >= a5 || a6 >= (int)v63)
v49 = 1;
} while (v49 != 1);
if (v54 > 5) {
@@ -3608,7 +3606,7 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) {
_vm->_linesManager.SMOOTH_SENS = 2;
LABEL_85:
SMOOTH_X = v62;
- SMOOTH_Y = a1;
+ SMOOTH_Y = v63;
return 0;
}
}
diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h
index 5da48bc1c4..20a1bccb65 100644
--- a/engines/hopkins/lines.h
+++ b/engines/hopkins/lines.h
@@ -88,7 +88,7 @@ public:
int16 *PARCOURS2(int a1, int a2, int a3, int a4);
int PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7);
int VERIF_SMOOTH(int a1, int a2, int a3, int a4);
- int SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6);
+ int SMOOTH_MOVE(int a3, int a4, int a5, int a6);
int PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6);
int TEST_LIGNE(int a1, int a2, int *a3, int *a4, int *a5);
};
diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp
index 7f6acf0bad..d6089c2ad6 100644
--- a/engines/hopkins/objects.cpp
+++ b/engines/hopkins/objects.cpp
@@ -965,7 +965,7 @@ void ObjectsManager::VERIFCACHE() {
v10 = 0;
do {
if (Sprite[v10].field0 == 1) {
- if (Sprite[v10].field10 != 250) {
+ if (Sprite[v10].spriteIndex != 250) {
v1 = Sprite[v10].field2C;
v11 = Sprite[v10].field30 + v1;
v2 = Sprite[v10].field32 + Sprite[v10].field2E;
@@ -1095,10 +1095,10 @@ void ObjectsManager::DEF_SPRITE(int idx) {
v4 = Sprite[v2].field2E;
if (Sprite[v2].field28)
_vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, Sprite[v2].spriteData,
- v3 + 300, v4 + 300, Sprite[v2].field10);
+ v3 + 300, v4 + 300, Sprite[v2].spriteIndex);
else
_vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, Sprite[v2].spriteData,
- v3 + 300, v4 + 300, Sprite[v2].field10, Sprite[v2].field36, Sprite[v2].field34, Sprite[v2].fieldE);
+ v3 + 300, v4 + 300, Sprite[v2].spriteIndex, Sprite[v2].field36, Sprite[v2].field34, Sprite[v2].fieldE);
v5 = idx;
v6 = idx;
@@ -1168,18 +1168,18 @@ void ObjectsManager::CALCUL_SPRITE(int idx) {
int v22;
Sprite[idx].field2A = 0;
- int v0 = Sprite[idx].field10;
- if (v0 != 250) {
+ int spriteIndex = Sprite[idx].spriteIndex;
+ if (spriteIndex != 250) {
if (Sprite[idx].fieldE) {
- v5 = get_offsetx(Sprite[idx].spriteData, v0, 1);
+ v5 = get_offsetx(Sprite[idx].spriteData, spriteIndex, 1);
v22 = Sprite[idx].field12 + v5;
v4 = Sprite[idx].field12 + v5;
- v6 = get_offsety(Sprite[idx].spriteData, Sprite[idx].field10, 1);
+ v6 = get_offsety(Sprite[idx].spriteData, Sprite[idx].spriteIndex, 1);
} else {
- v3 = get_offsetx(Sprite[idx].spriteData, v0, 0);
+ v3 = get_offsetx(Sprite[idx].spriteData, spriteIndex, 0);
v22 = Sprite[idx].field12 + v3;
v4 = Sprite[idx].field12 + v3;
- v6 = get_offsety(Sprite[idx].spriteData, Sprite[idx].field10, 0);
+ v6 = get_offsety(Sprite[idx].spriteData, Sprite[idx].spriteIndex, 0);
}
v9 = Sprite[idx].field14 + v6;
@@ -1254,8 +1254,8 @@ void ObjectsManager::CALCUL_SPRITE(int idx) {
_vm->_globals.Liste[v17].field0 = 1;
_vm->_globals.Liste[v17].field2 = v15;
_vm->_globals.Liste[v17].field4 = v16;
- width = Get_Largeur(Sprite[idx].spriteData, Sprite[idx].field10);
- height = Get_Hauteur(Sprite[idx].spriteData, Sprite[idx].field10);
+ width = Get_Largeur(Sprite[idx].spriteData, Sprite[idx].spriteIndex);
+ height = Get_Hauteur(Sprite[idx].spriteData, Sprite[idx].spriteIndex);
if (zoomPercent) {
width = _vm->_graphicsManager.Reel_Zoom(width, zoomPercent);
@@ -1638,12 +1638,12 @@ void ObjectsManager::SPRITE_ON(int idx) {
Sprite[idx].field0 = 1;
}
-void ObjectsManager::SPRITE(const byte *spriteData, int xp, int yp, int idx, int a5, int a6, int a7, int a8, int a9) {
+void ObjectsManager::SPRITE(const byte *spriteData, int xp, int yp, int idx, int spriteIndex, int a6, int a7, int a8, int a9) {
if (idx > 5)
error("Attempt to display a sprite > MAX_SPRITE.");
Sprite[idx].spriteData = spriteData;
Sprite[idx].spritePos = Common::Point(xp, yp);
- Sprite[idx].field10 = a5;
+ Sprite[idx].spriteIndex = spriteIndex;
Sprite[idx].fieldC = a6;
Sprite[idx].field12 = a8;
Sprite[idx].field14 = a9;
@@ -1698,13 +1698,13 @@ void ObjectsManager::SPRITE_GEL(int idx) {
int ObjectsManager::SXSPR(int idx) {
if (idx > 5)
error("request of the size of a sprite x > MAX_SPRITE.");
- return Get_Largeur(Sprite[idx].spriteData, Sprite[idx].field10);
+ return Get_Largeur(Sprite[idx].spriteData, Sprite[idx].spriteIndex);
}
int ObjectsManager::SYSPR(int idx) {
if (idx > 5)
error("request of the size of a sprite y > MAX_SPRITE.");
- return Get_Hauteur(Sprite[idx].spriteData, Sprite[idx].field10);
+ return Get_Hauteur(Sprite[idx].spriteData, Sprite[idx].spriteIndex);
}
int ObjectsManager::POSISPR(int idx) {
@@ -1723,11 +1723,11 @@ void ObjectsManager::SETXSPR(int idx, int xp) {
Sprite[idx].spritePos.x = xp;
}
-void ObjectsManager::SETANISPR(int idx, int a2) {
+void ObjectsManager::SETANISPR(int idx, int spriteIndex) {
if (idx > 5)
error("Set the Coord. x a sprite> MAX_SPRITE.");
- Sprite[idx].field10 = a2;
+ Sprite[idx].spriteIndex = spriteIndex;
}
void ObjectsManager::SETYSPR(int idx, int yp) {
@@ -2800,31 +2800,30 @@ void ObjectsManager::PLAN_BETA() {
// Left Button
void ObjectsManager::BTGAUCHE() {
- int v0;
+ int srcX, srcY;
+ int destX, destY;
int v1;
int v2;
int16 *v3;
int16 *v4;
int16 *v5;
- int v6;
- int v7;
- int v8;
+ int zoneCount;
+ int zoneX;
+ int zoneY;
int16 *v9;
int v10;
int v11;
int v12;
int16 *v13;
- int v14;
- int v15;
int16 *v16;
int v17;
int v18;
- int v19;
_vm->_fontManager.TEXTE_OFF(9);
- v19 = _vm->_eventsManager.XMOUSE();
- v0 = _vm->_eventsManager.YMOUSE();
- if (!INVENTFLAG && !_vm->_globals.PLAN_FLAG && v19 > _vm->_graphicsManager.ofscroll - 30 && v19 < _vm->_graphicsManager.ofscroll + 50 && (uint16)(v0 + 29) <= 0x4Eu) {
+ destX = _vm->_eventsManager.XMOUSE();
+ destY = _vm->_eventsManager.YMOUSE();
+
+ if (!INVENTFLAG && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager.ofscroll - 30 && destX < _vm->_graphicsManager.ofscroll + 50 && (uint16)(destY + 29) <= 0x4Eu) {
v1 = _vm->_eventsManager.btsouris;
INVENTFLAG = 1;
INVENT();
@@ -2838,30 +2837,30 @@ void ObjectsManager::BTGAUCHE() {
}
if (_vm->_globals.SAUVEGARDE->data[svField354] == 1
&& !_vm->_globals.PLAN_FLAG
- && (uint16)(v19 - 533) <= 0x1Au
- && (uint16)(v0 - 26) <= 0x21u) {
+ && (uint16)(destX - 533) <= 0x1Au
+ && (uint16)(destY - 26) <= 0x21u) {
CHANGE_TETE(1, 0);
return;
}
if (_vm->_globals.SAUVEGARDE->data[svField356] == 1
&& !_vm->_globals.PLAN_FLAG
- && (uint16)(v19 - 533) <= 0x1Au
- && (uint16)(v0 - 26) <= 0x21u) {
+ && (uint16)(destX - 533) <= 0x1Au
+ && (uint16)(destY - 26) <= 0x21u) {
CHANGE_TETE(2, 0);
return;
}
if (_vm->_globals.SAUVEGARDE->data[svField357] == 1) {
if (_vm->_globals.SAUVEGARDE->data[svField353] == 1
&& !_vm->_globals.PLAN_FLAG
- && (uint16)(v19 - 533) <= 0x1Au
- && (uint16)(v0 - 26) <= 0x21u) {
+ && (uint16)(destX - 533) <= 0x1Au
+ && (uint16)(destY - 26) <= 0x21u) {
CHANGE_TETE(0, 1);
return;
}
if (_vm->_globals.SAUVEGARDE->data[svField355] == 1
&& !_vm->_globals.PLAN_FLAG
- && (uint16)(v19 - 567) <= 0x1Au
- && (uint16)(v0 - 26) <= 0x21u) {
+ && (uint16)(destX - 567) <= 0x1Au
+ && (uint16)(destY - 26) <= 0x21u) {
CHANGE_TETE(0, 2);
return;
}
@@ -2896,14 +2895,14 @@ LABEL_38:
if (_vm->_globals.PLAN_FLAG == 1 && (_vm->_eventsManager.btsouris != 4 || NUMZONE <= 0))
return;
if ((uint16)(NUMZONE + 1) > 1u) {
- v6 = NUMZONE;
- v7 = _vm->_globals.ZONEP[v6].field0;
- if (v7) {
- v8 = _vm->_globals.ZONEP[v6].field2;
- if (v8) {
- if (v8 != 31) {
- v19 = v7;
- v0 = v8;
+ zoneCount = NUMZONE;
+ zoneX = _vm->_globals.ZONEP[zoneCount].field0;
+ if (zoneX) {
+ zoneY = _vm->_globals.ZONEP[zoneCount].field2;
+ if (zoneY) {
+ if (zoneY != 31) {
+ destX = zoneX;
+ destY = zoneY;
}
}
}
@@ -2942,9 +2941,9 @@ LABEL_64:
}
if (!_vm->_globals.NOMARCHE) {
if (!_vm->_globals.PLAN_FLAG) {
- v14 = YSPR(0);
- v15 = XSPR(0);
- v16 = _vm->_linesManager.PARCOURS2(v15, v14, v19, v0);
+ srcY = YSPR(0);
+ srcX = XSPR(0);
+ v16 = _vm->_linesManager.PARCOURS2(srcX, srcY, destX, destY);
_vm->_globals.chemin = v16;
if (v16 != (int16 *)g_PTRNUL)
PACOURS_PROPRE(v16);
@@ -2960,7 +2959,7 @@ LABEL_65:
if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG == 1) {
v17 = YSPR(0);
v18 = XSPR(0);
- _vm->_globals.chemin = PARC_VOITURE(v18, v17, v19, v0);
+ _vm->_globals.chemin = PARC_VOITURE(v18, v17, destX, destY);
}
}
if ((uint16)(NUMZONE + 1) > 1u) {
@@ -7919,7 +7918,7 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in
const byte *v14;
char v15;
int v16;
- int v17;
+ int spriteIndex;
int v18;
Common::String v19;
@@ -7933,7 +7932,7 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in
if (_vm->_globals.vitesse == 3)
v15 = a5 / 3;
v14 = Sprite[0].spriteData;
- v17 = Sprite[0].field10;
+ spriteIndex = Sprite[0].spriteIndex;
v16 = Sprite[0].fieldE;
Sprite[0].field12 += a3;
Sprite[0].field14 += a4;
@@ -7957,13 +7956,13 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in
if (v7 == 1) {
if (v13 == -1) {
Sprite[0].spriteData = v14;
- Sprite[0].field10 = v17;
+ Sprite[0].spriteIndex = spriteIndex;
Sprite[0].field12 -= a3;
Sprite[0].field14 -= a4;
Sprite[0].fieldE = v16;
} else {
Sprite[0].spriteData = spriteData;
- Sprite[0].field10 = v13;
+ Sprite[0].spriteIndex = v13;
}
v10 = 0;
v9 = v15;
@@ -7979,7 +7978,6 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in
break;
}
}
- return;
}
void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4, int a5, int a6) {
@@ -7989,14 +7987,14 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4
__int32 v9;
signed __int16 v10;
__int32 v11;
- __int16 v13;
+ int spriteIndex;
char v14;
__int16 v15;
Common::String v16;
v15 = 0;
v6 = 0;
- v13 = 0;
+ spriteIndex = 0;
v16 = " ";
v14 = a5;
if (_vm->_globals.vitesse == 2)
@@ -8004,7 +8002,7 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4
if (_vm->_globals.vitesse == 3)
v14 = a5 / 3;
S_old_spr = Sprite[0].spriteData;
- S_old_ani = Sprite[0].field10;
+ S_old_ani = Sprite[0].spriteIndex;
S_old_ret = Sprite[0].fieldE;
Sprite[0].field12 += a3;
Sprite[0].field14 += a4;
@@ -8015,7 +8013,7 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4
v8 = a2[v15];
if (v8 == ',') {
v9 = atoi(v16.c_str());
- v13 = v9;
+ spriteIndex = v9;
v6 = 0;
v16 = " ";
v7 = 1;
@@ -8026,9 +8024,9 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4
}
++v15;
} while (v7 != 1);
- if (v13 != -1) {
+ if (spriteIndex != -1) {
Sprite[0].spriteData = a1;
- Sprite[0].field10 = v13;
+ Sprite[0].spriteIndex = spriteIndex;
}
v10 = 0;
v9 = v14;
@@ -8040,7 +8038,7 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4
v9 = v11;
} while (v10 < v11);
}
- } while (v13 != -1);
+ } while (spriteIndex != -1);
}
void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a4, int a5) {
@@ -8050,7 +8048,7 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a
int v8;
int v9;
int v10;
- int v12;
+ int spriteIndex;
int v13;
int v14;
Common::String v15;
@@ -8058,7 +8056,7 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a
v14 = 0;
v5 = 0;
- v12 = 0;
+ spriteIndex = 0;
v15 = " ";
v13 = a5;
if (_vm->_globals.vitesse == 2)
@@ -8070,7 +8068,7 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a
v7 = a2[v14];
if (v7 == 44) {
v8 = atoi(v15.c_str());
- v12 = v8;
+ spriteIndex = v8;
v5 = 0;
v15 = " ";
v6 = 1;
@@ -8081,15 +8079,15 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a
}
++v14;
if (v6 == 1) {
- if (v12 == -1) {
+ if (spriteIndex == -1) {
Sprite[0].spriteData = S_old_spr;
- Sprite[0].field10 = S_old_ani;
+ Sprite[0].spriteIndex = S_old_ani;
Sprite[0].field12 -= a3;
Sprite[0].field14 -= a4;
Sprite[0].fieldE = S_old_ret;
} else {
Sprite[0].spriteData = a1;
- Sprite[0].field10 = v12;
+ Sprite[0].spriteIndex = spriteIndex;
}
v9 = 0;
@@ -8102,7 +8100,7 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a
v16 = v10;
} while (v9 < v10);
}
- if (v12 == -1)
+ if (spriteIndex == -1)
break;
}
}
diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h
index e835afe80e..61483a0e88 100644
--- a/engines/hopkins/objects.h
+++ b/engines/hopkins/objects.h
@@ -37,7 +37,7 @@ struct SpriteItem {
int spriteY;
int fieldC;
int fieldE;
- int field10;
+ int spriteIndex;
int field12;
int field14;
byte *field1C;
@@ -176,7 +176,7 @@ public:
void CLEAR_SPR();
void SPRITE_ON(int idx);
- void SPRITE(const byte *spriteData, int xp, int yp, int idx, int a5, int a6, int a7, int a8, int a9);
+ void SPRITE(const byte *spriteData, int xp, int yp, int idx, int spriteIndex, int a6, int a7, int a8, int a9);
void SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, int a5);
void SPRITE_OFF(int idx);
void SPRITE_GEL(int idx);
@@ -185,7 +185,7 @@ public:
int POSISPR(int idx);
void SETPOSISPR(int idx, int a2);
void SETXSPR(int idx, int xp);
- void SETANISPR(int idx, int a2);
+ void SETANISPR(int idx, int spriteIndex);
void SETYSPR(int idx, int yp);
void SETTAILLESPR(int idx, int a2);
void SETFLIPSPR(int idx, int a2);