diff options
author | Strangerke | 2012-11-24 00:16:44 +0100 |
---|---|---|
committer | Strangerke | 2012-11-24 00:16:44 +0100 |
commit | 38acdce7358a92d78faecd618f1905ad5fe8462b (patch) | |
tree | 3277310a7d34c11171e047c731a61eb743cd2b1f | |
parent | 384ca5dd827c1a62d81a957fbfd3a18ed47a56e0 (diff) | |
download | scummvm-rg350-38acdce7358a92d78faecd618f1905ad5fe8462b.tar.gz scummvm-rg350-38acdce7358a92d78faecd618f1905ad5fe8462b.tar.bz2 scummvm-rg350-38acdce7358a92d78faecd618f1905ad5fe8462b.zip |
HOPKINS: Fix more CppCheck warnings
-rw-r--r-- | engines/hopkins/graphics.cpp | 213 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 8 | ||||
-rw-r--r-- | engines/hopkins/lines.cpp | 141 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 52 | ||||
-rw-r--r-- | engines/hopkins/script.cpp | 159 | ||||
-rw-r--r-- | engines/hopkins/sound.cpp | 4 | ||||
-rw-r--r-- | engines/hopkins/talk.cpp | 23 |
7 files changed, 205 insertions, 395 deletions
diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index b5985a1f4f..29b3631887 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -831,23 +831,15 @@ void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface void GraphicsManager::fade_out(const byte *palette, int step, const byte *surface) { int palByte; - int palIndex; - int palDataIndex; - int palCtr3; - int palCtr4; - int palCtr5; - int palValue; - int palCtr2; - int palCtr1; uint16 palMax; byte palData[PALETTE_BLOCK_SIZE]; int tempPalette[PALETTE_BLOCK_SIZE]; palMax = palByte = FADESPD; if (palette) { - palIndex = 0; + int palIndex = 0; do { - palDataIndex = palIndex; + int palDataIndex = palIndex; palByte = *(palIndex + palette); palByte <<= 8; tempPalette[palDataIndex] = palByte; @@ -863,13 +855,13 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac DD_VBL(); } - palCtr3 = 0; + int palCtr3 = 0; if (palMax > 0) { do { - palCtr4 = 0; + int palCtr4 = 0; do { - palCtr5 = palCtr4; - palValue = tempPalette[palCtr4] - (*(palCtr4 + palette) << 8) / palMax; + int palCtr5 = palCtr4; + int palValue = tempPalette[palCtr4] - (*(palCtr4 + palette) << 8) / palMax; tempPalette[palCtr5] = palValue; palData[palCtr5] = (palValue >> 8) & 0xff; ++palCtr4; @@ -888,10 +880,8 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac } while (palMax > palCtr3); } - palCtr2 = 0; - do { - palData[palCtr2++] = 0; - } while (palCtr2 < (PALETTE_BLOCK_SIZE)); + for (int i = 0; i < PALETTE_BLOCK_SIZE; i++) + palData[i] = 0; setpal_vga256(palData); @@ -903,10 +893,8 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac goto LABEL_28; } } else { - palCtr1 = 0; - do { - palData[palCtr1++] = 0; - } while (palCtr1 < (PALETTE_BLOCK_SIZE)); + for (int i = 0; i < PALETTE_BLOCK_SIZE; i++) + palData[i] = 0; setpal_vga256(palData); if (Winbpp == 2) { @@ -1479,15 +1467,9 @@ void GraphicsManager::VISU_ALL() { } void GraphicsManager::RESET_SEGMENT_VESA() { - int idx; - int blocCount; - if (_vm->_globals.NBBLOC > 0) { - idx = 0; - blocCount = _vm->_globals.NBBLOC; - do { - _vm->_globals.BLOC[idx++].field0 = 0; - } while (idx != blocCount); + for (int idx = 0; idx != _vm->_globals.NBBLOC; idx++) + _vm->_globals.BLOC[idx].field0 = 0; _vm->_globals.NBBLOC = 0; } @@ -1497,7 +1479,6 @@ void GraphicsManager::RESET_SEGMENT_VESA() { void GraphicsManager::Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2) { int tempX; int blocCount; - int16 blocIndex; bool addFlag; tempX = x1; @@ -1514,7 +1495,7 @@ void GraphicsManager::Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2) { blocCount = _vm->_globals.NBBLOC; if (_vm->_globals.NBBLOC > 1) { - blocIndex = 0; + int16 blocIndex = 0; do { BlocItem &bloc = _vm->_globals.BLOC[blocIndex]; @@ -1811,71 +1792,23 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp const byte *spriteStartP; int i; const byte *spriteSizeP; - int spriteWidth; - int spriteHeight1; const byte *spritePixelsP; byte *dest1P; - int xCtr1; byte *dest2P; - int xLeft; - int clippedWidth; - int xCtr2; - int v20; - int v22; - int v23; - int v24; - int v25; - int v26; - int v27; - int v28; byte *v29; - int v30; - int v31; - int v32; - int v33; - int v34; - int v35; - int spriteHeight2; - int v37; - int v38; - uint16 v39; byte *v40; - int v41; - uint16 v42; - const byte *spritePixelsCopyP; - const byte *spritePixelsCopy2P; const byte *v45; const byte *v46; - byte *dest1CopyP; - byte *destCopy2P; - int v49; - int v50; - byte *v51; - int v52; - byte *v53; - byte *v54; - byte *v55; - int yCtr1; - int yCtr2; - int v58; - int v59; - int v60; - int v61; - int v62; - int v63; - int v64; - int v65; spriteStartP = srcData + 3; for (i = frameIndex; i; --i) spriteStartP += READ_LE_UINT32(spriteStartP) + 16; - spriteWidth = 0; - spriteHeight1 = 0; spriteSizeP = spriteStartP + 4; - spriteWidth = (int16)READ_LE_UINT16(spriteSizeP); + int spriteWidth = (int16)READ_LE_UINT16(spriteSizeP); spriteSizeP += 2; - spriteHeight1 = spriteHeight2 = (int16)READ_LE_UINT16(spriteSizeP); + int spriteHeight2 = (int16)READ_LE_UINT16(spriteSizeP); + int spriteHeight1 = spriteHeight2; spritePixelsP = spriteSizeP + 10; clip_x = 0; clip_y = 0; @@ -1899,17 +1832,17 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp Agr_Flag_y = 0; Agr_Flag_x = 0; Largeur = spriteWidth; - v20 = Asm_Zoom(spriteWidth, zoom2); - v22 = Asm_Zoom(spriteHeight1, zoom2); + int v20 = Asm_Zoom(spriteWidth, zoom2); + int v22 = Asm_Zoom(spriteHeight1, zoom2); if (modeFlag) { v29 = v20 + dest1P; if (clip_y) { if ((uint16)clip_y >= v22) return; - v61 = v22; - v52 = v20; - v30 = 0; - v31 = (uint16)clip_y; + int v61 = v22; + int v52 = v20; + int v30 = 0; + int v31 = (uint16)clip_y; while (Asm_Zoom(v30 + 1, zoom2) < v31) ; v20 = v52; @@ -1925,25 +1858,26 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp v20 -= (uint16)clip_x; } if (v20 > (uint16)clip_x1) { - v32 = v20 - (uint16)clip_x1; + int v32 = v20 - (uint16)clip_x1; v29 -= v32; - v62 = v22; - v33 = 0; + int v62 = v22; + int v33 = 0; while (Asm_Zoom(v33 + 1, zoom2) < v32) ; - v34 = v33; + int v34 = v33; v22 = v62; spritePixelsP += v34; v20 = (uint16)clip_x1; } + int v63; do { while (1) { v63 = v22; - v53 = v29; + byte *v53 = v29; v46 = spritePixelsP; Agr_Flag_x = 0; Agr_x = 0; - v35 = v20; + int v35 = v20; do { while (1) { if (*spritePixelsP) @@ -1986,10 +1920,10 @@ R_Aff_Zoom_Larg_Cont1: if (clip_y) { if ((uint16)clip_y >= v22) return; - v58 = v22; - v49 = v20; - v23 = 0; - v24 = (uint16)clip_y; + int v58 = v22; + int v49 = v20; + int v23 = 0; + int v24 = (uint16)clip_y; while (Asm_Zoom(v23 + 1, zoom2) < v24) ; v20 = v49; @@ -2002,13 +1936,13 @@ R_Aff_Zoom_Larg_Cont1: if (clip_x) { if ((uint16)clip_x >= v20) return; - v59 = v22; - v50 = v20; - v25 = (uint16)clip_x; - v26 = 0; + int v59 = v22; + int v50 = v20; + int v25 = (uint16)clip_x; + int v26 = 0; while (Asm_Zoom(v26 + 1, zoom2) < v25) ; - v27 = v26; + int v27 = v26; v22 = v59; spritePixelsP += v27; dest1P += (uint16)clip_x; @@ -2017,12 +1951,13 @@ R_Aff_Zoom_Larg_Cont1: if (v20 > (uint16)clip_x1) v20 = (uint16)clip_x1; + int v60; do { while (1) { v60 = v22; - v51 = dest1P; + byte *v51 = dest1P; v45 = spritePixelsP; - v28 = v20; + int v28 = v20; Agr_Flag_x = 0; Agr_x = 0; do { @@ -2070,17 +2005,17 @@ Aff_Zoom_Larg_Cont1: Largeur = spriteWidth; Red = zoom1; if (zoom1 < 100) { - v37 = Asm_Reduc(spriteWidth, Red); + int v37 = Asm_Reduc(spriteWidth, Red); if (modeFlag) { v40 = v37 + dest1P; do { - v65 = spriteHeight2; - v55 = v40; + int v65 = spriteHeight2; + byte *v55 = v40; Red_y = Red + Red_y; if ((uint16)Red_y < 0x64u) { Red_x = 0; - v41 = Largeur; - v42 = v37; + int v41 = Largeur; + int v42 = v37; do { Red_x = Red + Red_x; if ((uint16)Red_x < 0x64u) { @@ -2105,13 +2040,13 @@ Aff_Zoom_Larg_Cont1: } while (spriteHeight2); } else { do { - v64 = spriteHeight2; - v54 = dest1P; + int v64 = spriteHeight2; + byte *v54 = dest1P; Red_y = Red + Red_y; if ((uint16)Red_y < 0x64u) { Red_x = 0; - v38 = Largeur; - v39 = 0; + int v38 = Largeur; + int v39 = 0; do { Red_x = Red + Red_x; if ((uint16)Red_x < 0x64u) { @@ -2149,7 +2084,7 @@ Aff_Zoom_Larg_Cont1: dest2P += nbrligne2 * (uint16)clip_y; spriteHeight1 -= (uint16)clip_y; } - xLeft = (uint16)clip_y1; + int xLeft = (uint16)clip_y1; if (spriteHeight1 > clip_y1) spriteHeight1 = clip_y1; xLeft = clip_x; @@ -2159,23 +2094,22 @@ Aff_Zoom_Larg_Cont1: spriteWidth -= xLeft; } if (spriteWidth > (uint16)clip_x1) { - clippedWidth = spriteWidth - (uint16)clip_x1; + int clippedWidth = spriteWidth - (uint16)clip_x1; spritePixelsP += clippedWidth; dest2P -= clippedWidth; spriteWidth = (uint16)clip_x1; } + int yCtr2; do { yCtr2 = spriteHeight1; - destCopy2P = dest2P; - spritePixelsCopy2P = spritePixelsP; - xCtr2 = spriteWidth; - do { + byte *destCopy2P = dest2P; + const byte *spritePixelsCopy2P = spritePixelsP; + for (int xCtr2 = spriteWidth; xCtr2; xCtr2--) { if (*spritePixelsP) *dest2P = *spritePixelsP; ++spritePixelsP; --dest2P; - --xCtr2; - } while (xCtr2); + } spritePixelsP = spec_largeur + spritePixelsCopy2P; dest2P = nbrligne2 + destCopy2P; spriteHeight1 = yCtr2 - 1; @@ -2200,18 +2134,17 @@ Aff_Zoom_Larg_Cont1: } if (spriteWidth > (uint16)clip_x1) spriteWidth = (uint16)clip_x1; + int yCtr1; do { yCtr1 = spriteHeight1; - dest1CopyP = dest1P; - spritePixelsCopyP = spritePixelsP; - xCtr1 = spriteWidth; - do { + byte *dest1CopyP = dest1P; + const byte *spritePixelsCopyP = spritePixelsP; + for (int xCtr1 = spriteWidth; xCtr1; xCtr1--) { if (*spritePixelsP) *dest1P = *spritePixelsP; ++dest1P; ++spritePixelsP; - --xCtr1; - } while (xCtr1); + } spritePixelsP = spec_largeur + spritePixelsCopyP; dest1P = nbrligne2 + dest1CopyP; spriteHeight1 = yCtr1 - 1; @@ -2246,7 +2179,6 @@ void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int width, int int croppedWidth; int croppedHeight; int xRight; - int height2; int top2; int left; @@ -2271,7 +2203,7 @@ void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int width, int croppedWidth = max_x - left; if (croppedWidth > 0 && croppedHeight > 0) { - height2 = croppedHeight; + int height2 = croppedHeight; Copy_Mem(surface, left, top2, croppedWidth, croppedHeight, destSurface, destX, destY); Ajoute_Segment_Vesa(left, top2, left + croppedWidth, top2 + height2); } @@ -2363,16 +2295,10 @@ void GraphicsManager::INI_ECRAN2(const Common::String &file) { } void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { - int dataOffset; - int dataVal1; - bool doneFlag; - byte *ptr; - Common::String filename; + int dataOffset = 1; + Common::String filename = file + ".ini"; + byte *ptr = _vm->_fileManager.RECHERCHE_CAT(filename, 1); - dataOffset = 1; - - filename = file + ".ini"; - ptr = _vm->_fileManager.RECHERCHE_CAT(filename, 1); if (ptr == g_PTRNUL) { _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename); ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); @@ -2397,9 +2323,9 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { if (*ptr != 'I' || *(ptr + 1) != 'N' || *(ptr + 2) != 'I') { error("Error, file not ini"); } else { - doneFlag = false; + bool doneFlag = false; do { - dataVal1 = _vm->_scriptManager.Traduction(ptr + 20 * dataOffset); + int dataVal1 = _vm->_scriptManager.Traduction(ptr + 20 * dataOffset); if (_vm->shouldQuit()) return; @@ -2549,7 +2475,6 @@ Video_Cont_Vbe: void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int xp, int yp, int width, int height, int zoom) { const byte *srcP; byte *destP; - const byte *lineSrcP; srcP = xp + nbrligne2 * yp + srcSurface; destP = destSurface; @@ -2565,7 +2490,7 @@ void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int Red_y += Red; if (Red_y < 100) { Red_x = 0; - lineSrcP = srcP; + const byte *lineSrcP = srcP; for (int xCtr = 0; xCtr < Largeur; ++xCtr) { Red_x += Red; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 0c76ab307d..190a6ad679 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1820,10 +1820,12 @@ void HopkinsEngine::PUBQUIT() { _globals.netscape = true; bool mouseClicked = false; - int xp, yp; + + // CHECKME: Useless variables ? + // int xp, yp; do { - xp = _eventsManager.XMOUSE(); - yp = _eventsManager.YMOUSE(); +// xp = _eventsManager.XMOUSE(); +// yp = _eventsManager.YMOUSE(); _eventsManager.VBL(); if (_eventsManager.BMOUSE() == 1) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 4337f93357..2a6addc9d8 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -140,21 +140,7 @@ void LinesManager::RETIRE_LIGNE_ZONE(int idx) { // Add Line Zone void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, int a6) { - int v8; - int v9; int16 *zoneData; - int16 *dataP; - int v11; - int v13; - int v14; - int v16; - int v17; - int v18; - int v19; - int v20; - int v21; - int v22; - int v23; if (a2 != a3 || a3 != a4 || a3 != a5) { if (idx > 400) @@ -162,39 +148,39 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in if (LigneZone[idx].zoneData != (int16 *)g_PTRNUL) LigneZone[idx].zoneData = (int16 *)_vm->_globals.dos_free2((byte *)LigneZone[idx].zoneData); - v8 = a2 - a4; + int v8 = a2 - a4; if (a2 - a4 < 0) v8 = -v8; - v19 = v8; - v9 = a3 - a5; + int v19 = v8; + int v9 = a3 - a5; if (a3 - a5 < 0) v9 = -v9; - v18 = v9; + int v18 = v9; + int v20 = 1; if (v19 <= v9) - v20 = v9 + 1; + v20 += v9; else - v20 = v19 + 1; + v20 += v19; zoneData = (int16 *)_vm->_globals.dos_malloc2(2 * sizeof(int16) * v20 + (4 * sizeof(int16))); - v11 = idx; + int v11 = idx; LigneZone[v11].zoneData = zoneData; if (zoneData == (int16 *)g_PTRNUL) error("AJOUTE LIGNE ZONE"); - dataP = zoneData; - v23 = 1000 * v19 / v20; - v22 = 1000 * v18 / v20; + int16 *dataP = zoneData; + int v23 = 1000 * v19 / v20; + int v22 = 1000 * v18 / v20; if (a4 < a2) v23 = -v23; if (a5 < a3) v22 = -v22; - v13 = 1000 * a2; - v16 = 1000 * a3; - v17 = 1000 * a2 / 1000; - v21 = 1000 * a3 / 1000; - v14 = 0; + int v13 = 1000 * a2; + int v16 = 1000 * a3; + int v17 = 1000 * a2 / 1000; + int v21 = 1000 * a3 / 1000; if (v20 > 0) { - do { + for (int i = 0; i < v20; i++) { *dataP++ = v17; *dataP++ = v21; @@ -202,8 +188,7 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in v16 += v22; v17 = v13 / 1000; v21 = v16 / 1000; - ++v14; - } while (v20 > v14); + } } *dataP++ = -1; *dataP++ = -1; @@ -389,46 +374,32 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, // Line Collision 2 int LinesManager::colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { - int v6; int16 *v7; - int v8; - int v9; - int v10; - int v11; - int v12; int16 *v13; - int v14; int result; - int v16; - int v17; - int v18; - int v19; - int v20; - int v21; - int v22; - int v23; - int v24; - v24 = a5; - v6 = a5; + int v24 = a5; + int v6 = a5; if (a5 >= a6 + 1) { LABEL_29: result = 0; } else { - v22 = a1 + 4; - v21 = a1 - 4; - v20 = a2 + 4; - v19 = a2 - 4; + int v11; + int v22 = a1 + 4; + int v21 = a1 - 4; + int v20 = a2 + 4; + int v19 = a2 - 4; + int v17; while (1) { v7 = Ligne[v6].lineData; if (v7 != (int16 *)g_PTRNUL) { - v23 = 1; - v8 = 2 * Ligne[v6].field0; - v9 = v7[0]; - v16 = v7[1]; - v10 = v7[v8 - 2]; - v18 = v7[v8 - 1]; + int v23 = 1; + int v8 = 2 * Ligne[v6].field0; + int v9 = v7[0]; + int v16 = v7[1]; + int v10 = v7[v8 - 2]; + int v18 = v7[v8 - 1]; if (v7[0] >= v10) goto LABEL_32; if (v22 < v9 || v21 > v10) @@ -461,10 +432,10 @@ LABEL_28: goto LABEL_29; } while (1) { - v12 = v7[0]; + int v12 = v7[0]; v13 = v7 + 1; - v14 = v13[0]; + int v14 = v13[0]; v7 = v13 + 1; if (a1 == v12 || a1 + 1 == v12) { @@ -483,46 +454,32 @@ LABEL_28: } int LinesManager::Scolision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { - int v6; int16 *v7; - int v8; - int v9; - int v10; - int v11; - int v12; int16 *v13; int result; - int v15; - int v16; - int v17; - int v18; - int v19; - int v20; - int v21; - int v22; - int v23; - int v24; - v24 = a5; - v6 = a5; + int v24 = a5; + int v6 = a5; + if (a5 >= a6 + 1) { LABEL_47: result = 0; } else { - v22 = a1 + 10; - v21 = a1 - 10; - v20 = a2 + 10; - v19 = a2 - 10; + int v22 = a1 + 10; + int v21 = a1 - 10; + int v20 = a2 + 10; + int v19 = a2 - 10; + int v11, v18; for (;;) { v7 = Ligne[v6].lineData; if (v7 != (int16 *)g_PTRNUL) { - v23 = 1; - v8 = 2 * Ligne[v6].field0; - v9 = v7[0]; - v15 = v7[1]; - v10 = v7[v8 - 2]; - v17 = v7[v8 - 1]; + int v23 = 1; + int v8 = 2 * Ligne[v6].field0; + int v9 = v7[0]; + int v15 = v7[1]; + int v10 = v7[v8 - 2]; + int v17 = v7[v8 - 1]; if (v7[0] >= v10) goto LABEL_50; if (v22 < v9 || v21 > v10) @@ -555,9 +512,9 @@ LABEL_46: goto LABEL_47; } while (1) { - v12 = v7[0]; + int v12 = v7[0]; v13 = v7 + 1; - v16 = v13[0]; + int v16 = v13[0]; v7 = v13 + 1; if (a1 == v12 || v12 == a1 + 1 diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 9b46b3d03d..1a544a931b 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -159,24 +159,20 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { // Delete Object void ObjectsManager::DELETE_OBJET(int objIndex) { - int v1; - int v2; - int i; - - v1 = 0; - v2 = 0; + byte lookCond = false; + int v2 = 0; do { ++v2; if (_vm->_globals.INVENTAIRE[v2] == objIndex) - v1 = 1; + lookCond = true; if (v2 > 32) - v1 = 1; - } while (v1 != 1); + lookCond = true; + } while (!lookCond); if (v2 <= 32) { if (v2 == 32) { _vm->_globals.INVENTAIRE[32] = 0; } else { - for (i = v2; i < 32; ++i) + for (int i = v2; i < 32; ++i) _vm->_globals.INVENTAIRE[i] = _vm->_globals.INVENTAIRE[i + 1]; } } @@ -608,18 +604,9 @@ void ObjectsManager::BOB_ZERO(int idx) { } void ObjectsManager::DEF_BOB(int idx) { - int v5; - int v6; - int v7; - int v8; - int v9; - int v10; - int xp; - int yp; - if (_vm->_globals.Bob[idx].isActive) { - xp = _vm->_globals.Bob[idx].oldX; - yp = _vm->_globals.Bob[idx].oldY; + int xp = _vm->_globals.Bob[idx].oldX; + int yp = _vm->_globals.Bob[idx].oldY; if (_vm->_globals.Bob[idx].isSprite) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bob[idx].spriteData, @@ -637,24 +624,24 @@ void ObjectsManager::DEF_BOB(int idx) { _vm->_globals.Liste2[idx].width = _vm->_globals.Bob[idx].oldWidth; _vm->_globals.Liste2[idx].height = _vm->_globals.Bob[idx].oldHeight; - v5 = _vm->_globals.Liste2[idx].xp; - v6 = _vm->_graphicsManager.min_x; + int v5 = _vm->_globals.Liste2[idx].xp; + int v6 = _vm->_graphicsManager.min_x; if (v5 < _vm->_graphicsManager.min_x) { _vm->_globals.Liste2[idx].width -= _vm->_graphicsManager.min_x - v5; _vm->_globals.Liste2[idx].xp = v6; } - v7 = _vm->_globals.Liste2[idx].yp; - v8 = _vm->_graphicsManager.min_y; + int v7 = _vm->_globals.Liste2[idx].yp; + int v8 = _vm->_graphicsManager.min_y; if (v7 < _vm->_graphicsManager.min_y) { _vm->_globals.Liste2[idx].height -= _vm->_graphicsManager.min_y - v7; _vm->_globals.Liste2[idx].yp = v8; } - v9 = _vm->_globals.Liste2[idx].xp; + int v9 = _vm->_globals.Liste2[idx].xp; if (_vm->_globals.Liste2[idx].width + v9 > _vm->_graphicsManager.max_x) _vm->_globals.Liste2[idx].width = _vm->_graphicsManager.max_x - v9; - v10 = _vm->_globals.Liste2[idx].yp; + int v10 = _vm->_globals.Liste2[idx].yp; if (_vm->_globals.Liste2[idx].height + v10 > _vm->_graphicsManager.max_y) _vm->_globals.Liste2[idx].height = _vm->_graphicsManager.max_y - v10; @@ -671,7 +658,6 @@ void ObjectsManager::DEF_BOB(int idx) { } void ObjectsManager::BOB_VISU(int idx) { - int v1; const byte *data; int16 v6; int16 offsetY; @@ -684,7 +670,7 @@ void ObjectsManager::BOB_VISU(int idx) { BOB_ZERO(idx); data = _vm->_globals.Bqe_Anim[idx].data; - v1 = (int16)READ_LE_UINT16(data); + int v1 = (int16)READ_LE_UINT16(data); v9 = (int16)READ_LE_UINT16(data + 2); v8 = (int16)READ_LE_UINT16(data + 4); offsetY = (int16)READ_LE_UINT16(data + 6); @@ -850,9 +836,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { v7 = _vm->_globals.Bob[idx].field36; if (v7 < 0) { - v7 = v7; - if (v7 < 0) - v7 = -v7; + v7 = -v7; v20 = v7; if (v7 > 95) v20 = 95; @@ -1130,9 +1114,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { v9 = Sprite[idx].fieldC; if (v9 < 0) { - v9 = v9; - if (v9 < 0) - v9 = -v9; + v9 = -v9; reducePercent = v9; if (v9 > 95) reducePercent = 95; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index ba0d81b8bf..e8f1fff6d5 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -43,52 +43,6 @@ void ScriptManager::setParent(HopkinsEngine *vm) { } int ScriptManager::Traduction(byte *a1) { - int v1; - int v2; - int v3; - int v4; - int v5; - int v6; - int v7; - int v8; - int v9; - int v10; - int v11; - int v12; - int v13; - int v14; - int v15; - int v16; - int v17; - int v18; - int v19; - int v20; - int v21; - int v22; - int v23; - int v24; - int v25; - int v26; - int v27; - int v28; - int v29; - int v30; - int v31; - int v32; - int v33; - int v34; - int v35; - int v36; - int v37; - int v38; - int v39; - int v40; - int v41; - int v42; - int v43; - int v44; - int v45; - int v46; char v47; char v48; char v49; @@ -108,7 +62,6 @@ int ScriptManager::Traduction(byte *a1) { int v67; int v68; int v69; - int v70; int v71; int v72; int v73; @@ -117,17 +70,17 @@ int ScriptManager::Traduction(byte *a1) { int v76; Common::String file; - v1 = 0; - v70 = 0; + int v1 = 0; + int v70 = 0; if (*a1 != 'F' || *(a1 + 1) != 'C') return 0; if (*(a1 + 2) == 'T' && *(a1 + 3) == 'X' && *(a1 + 4) == 'T') { v70 = *(a1 + 6); - v2 = *(a1 + 7); + int v2 = *(a1 + 7); v69 = *(a1 + 8); v67 = (int16)READ_LE_UINT16(a1 + 9); v65 = (int16)READ_LE_UINT16(a1 + 11); - v3 = (int16)READ_LE_UINT16(a1 + 13); + int v3 = (int16)READ_LE_UINT16(a1 + 13); v1 = 1; if (!TRAVAILOBJET) { if (_vm->_globals.SAUVEGARDE->data[svField356] == 1) { @@ -247,7 +200,7 @@ LABEL_104: if (_vm->_objectsManager.DESACTIVE != true) { v72 = *(a1 + 5); v70 = *(a1 + 6); - v4 = *(a1 + 7); + int v4 = *(a1 + 7); v68 = (int16)READ_LE_UINT16(a1 + 8); v66 = (int16)READ_LE_UINT16(a1 + 10); if (v72 == 52) { @@ -280,8 +233,8 @@ LABEL_1141: if (*(a1 + 3) == 'T' && *(a1 + 4) == 'P') { if (_vm->_objectsManager.DESACTIVE != true) { _vm->_objectsManager.DEUXPERSO = false; - v5 = *(a1 + 5); - v6 = (int16)READ_LE_UINT16(a1 + 8); + int v5 = *(a1 + 5); + int v6 = (int16)READ_LE_UINT16(a1 + 8); _vm->_objectsManager.PERX = (int16)READ_LE_UINT16(a1 + 6); _vm->_objectsManager.PERY = v6; _vm->_objectsManager.PERI = v5; @@ -350,10 +303,10 @@ LABEL_1141: } if (*(a1 + 2) == 'S' && *(a1 + 3) == 'T' && *(a1 + 4) == 'E') { if (_vm->_objectsManager.DESACTIVE != true) { - v7 = *(a1 + 5); + int v7 = *(a1 + 5); v70 = *(a1 + 6); - v8 = *(a1 + 7); - v9 = *(a1 + 8); + int v8 = *(a1 + 7); + int v9 = *(a1 + 8); _vm->_objectsManager.RECALL = 0; _vm->_globals.OLD_ECRAN = _vm->_globals.ECRAN; _vm->_globals.SAUVEGARDE->data[svField6] = _vm->_globals.ECRAN; @@ -560,7 +513,7 @@ LABEL_1141: v74 = (int16)READ_LE_UINT16(a1 + 5) / _vm->_globals.vitesse; if (!v74) v74 = 1; - v10 = 0; + int v10 = 0; if (v74 + 1 > 0) { do { if (_vm->shouldQuit()) @@ -783,14 +736,14 @@ LABEL_1141: _vm->_animationManager.CHARGE_ANIM("otage"); _vm->_graphicsManager.LOAD_IMAGE("IM05"); _vm->_graphicsManager.VISU_ALL(); - v11 = 0; - do { + + for (int i = 0; i <= 4; i++) { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - ++v11; - } while (v11 <= 4); + } + _vm->_eventsManager.MOUSE_OFF(); _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager.VESA_BUFFER); do { @@ -811,14 +764,14 @@ LABEL_1141: _vm->_eventsManager.MOUSE_OFF(); _vm->_graphicsManager.LOAD_IMAGE("ASCEN"); _vm->_graphicsManager.VISU_ALL(); - v12 = 0; - do { + + for (int i = 0; i <= 4; i++) { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - ++v12; - } while (v12 <= 4); + } + _vm->_eventsManager.MOUSE_OFF(); _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager.VESA_BUFFER); _vm->_objectsManager.SCI_OPTI_ONE(1, 0, 17, 3); @@ -891,8 +844,8 @@ LABEL_1141: if (v76 == 46) { _vm->_globals.NOT_VERIF = 1; _vm->_globals.chemin = (int16 *)g_PTRNUL; - v13 = _vm->_objectsManager.YSPR(0); - v14 = _vm->_objectsManager.XSPR(0); + int v13 = _vm->_objectsManager.YSPR(0); + int v14 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v14, v13, 564, 420); _vm->_objectsManager.NUMZONE = -1; do { @@ -907,7 +860,7 @@ LABEL_1141: _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND44.WAV"); _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND45.WAV"); _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); - v15 = 0; + int v15 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -968,8 +921,8 @@ LABEL_1141: _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - v16 = _vm->_objectsManager.YSPR(0); - v17 = _vm->_objectsManager.XSPR(0); + int v16 = _vm->_objectsManager.YSPR(0); + int v17 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v17, v16, 445, 332); _vm->_globals.NOT_VERIF = 1; do { @@ -982,7 +935,7 @@ LABEL_1141: _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.BOBANIM_ON(7); _vm->_objectsManager.SET_BOBPOSI(7, 0); - v18 = 0; + int v18 = 0; _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); do { if (_vm->shouldQuit()) @@ -1019,10 +972,10 @@ LABEL_1141: _vm->_globals.CACHE_OFF(); _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); - v19 = 12; + int v19 = 12; if (_vm->_globals.SAUVEGARDE->data[svField133] == 1) v19 = 41; - v20 = 0; + int v20 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1059,7 +1012,7 @@ LABEL_1141: _vm->_objectsManager.BOBANIM_ON(13); _vm->_objectsManager.SET_BOBPOSI(12, 0); _vm->_objectsManager.SET_BOBPOSI(13, 0); - v21 = 0; + int v21 = 0; _vm->_soundManager.LOAD_WAV("SOUND44.WAV", 1); _vm->_soundManager.LOAD_WAV("SOUND71.WAV", 2); do { @@ -1100,8 +1053,8 @@ LABEL_1141: _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - v22 = _vm->_objectsManager.YSPR(0); - v23 = _vm->_objectsManager.XSPR(0); + int v22 = _vm->_objectsManager.YSPR(0); + int v23 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v23, v22, 119, 268); _vm->_globals.NOT_VERIF = 1; do { @@ -1119,7 +1072,7 @@ LABEL_1141: _vm->_soundManager.LOAD_WAV("SOUND44.WAV", 1); _vm->_soundManager.LOAD_WAV("SOUND48.WAV", 2); _vm->_soundManager.LOAD_WAV("SOUND49.WAV", 3); - v24 = 0; + int v24 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1209,7 +1162,7 @@ LABEL_1141: _vm->_objectsManager.BOBANIM_ON(1); _vm->_objectsManager.BOBANIM_ON(2); _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); - v25 = 0; + int v25 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1251,7 +1204,7 @@ LABEL_1141: _vm->_objectsManager.BOBANIM_ON(1); _vm->_objectsManager.BOBANIM_ON(3); _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); - v26 = 0; + int v26 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1347,18 +1300,18 @@ LABEL_1141: _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { - v27 = _vm->_objectsManager.YSPR(0); - v28 = _vm->_objectsManager.XSPR(0); + int v27 = _vm->_objectsManager.YSPR(0); + int v28 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v28, v27, 201, 294); } if (_vm->_globals.SAUVEGARDE->data[svField253] == 2) { - v29 = _vm->_objectsManager.YSPR(0); - v30 = _vm->_objectsManager.XSPR(0); + int v29 = _vm->_objectsManager.YSPR(0); + int v30 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v30, v29, 158, 338); } if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { - v31 = _vm->_objectsManager.YSPR(0); - v32 = _vm->_objectsManager.XSPR(0); + int v31 = _vm->_objectsManager.YSPR(0); + int v32 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v32, v31, 211, 393); } _vm->_globals.NOT_VERIF = 1; @@ -1374,7 +1327,7 @@ LABEL_1141: _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND63.WAV"); if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { _vm->_objectsManager.BOBANIM_ON(4); - v33 = 0; + int v33 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1403,7 +1356,7 @@ LABEL_1141: } if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { _vm->_objectsManager.BOBANIM_ON(6); - v34 = 0; + int v34 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1432,7 +1385,7 @@ LABEL_1141: } if (_vm->_globals.SAUVEGARDE->data[svField253] == 2) { _vm->_objectsManager.BOBANIM_ON(5); - v35 = 0; + int v35 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1567,14 +1520,14 @@ LABEL_1141: _vm->_animationManager.NO_SEQ = false; _vm->_graphicsManager.NOFADE = true; _vm->_graphicsManager.FADE_OUTW(); - v36 = 1; - do { + + for (int i = 1; i <= 39; i++) { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - ++v36; - } while (v36 <= 39); + } + _vm->_graphicsManager.SETCOLOR4(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR4(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); @@ -1593,8 +1546,8 @@ LABEL_1141: } _vm->_globals.NOT_VERIF = 1; _vm->_globals.chemin = (int16 *)g_PTRNUL; - v37 = _vm->_objectsManager.YSPR(0); - v38 = _vm->_objectsManager.XSPR(0); + int v37 = _vm->_objectsManager.YSPR(0); + int v38 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v38, v37, 330, 418); _vm->_globals.NOT_VERIF = 1; _vm->_objectsManager.NUMZONE = 0; @@ -1625,8 +1578,8 @@ LABEL_1141: _vm->_globals.NO_VISU = true; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; - v39 = _vm->_objectsManager.YSPR(0); - v40 = _vm->_objectsManager.XSPR(0); + int v39 = _vm->_objectsManager.YSPR(0); + int v40 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v40, v39, 330, 314); _vm->_objectsManager.NUMZONE = 0; _vm->_globals.NOT_VERIF = 1; @@ -1680,7 +1633,7 @@ LABEL_1141: _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.BOBANIM_ON(3); _vm->_soundManager.LOAD_WAV("SOUND67.WAV", 1); - v41 = 0; + int v41 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1700,7 +1653,7 @@ LABEL_1141: _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.BOBANIM_ON(4); _vm->_soundManager.LOAD_WAV("SOUND69.WAV", 1); - v42 = 0; + int v42 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1779,8 +1732,8 @@ LABEL_1141: _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; - v43 = _vm->_objectsManager.YSPR(0); - v44 = _vm->_objectsManager.XSPR(0); + int v43 = _vm->_objectsManager.YSPR(0); + int v44 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v44, v43, 488, 280); _vm->_globals.NOT_VERIF = 1; do { @@ -1791,7 +1744,7 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); _vm->_objectsManager.SPRITE_OFF(0); - v45 = 0; + int v45 = 0; _vm->_objectsManager.BOBANIM_ON(7); do { if (_vm->shouldQuit()) @@ -1840,7 +1793,7 @@ LABEL_1141: _vm->_globals.CACHE_OFF(); _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.BOBANIM_ON(11); - v46 = 0; + int v46 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 8974d3e9fe..da3a3de747 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -633,11 +633,9 @@ int SoundManager::VOICE_STAT(int voiceIndex) { } void SoundManager::STOP_VOICE(int voiceIndex) { - int wavIndex; - if (Voice[voiceIndex]._status) { Voice[voiceIndex]._status = 0; - wavIndex = Voice[voiceIndex]._wavIndex; + int wavIndex = Voice[voiceIndex]._wavIndex; if (Swav[wavIndex]._active) { if (Swav[wavIndex].freeSample) DEL_SAMPLE_SDL(wavIndex); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 7d8eecbf64..0e57e57437 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -196,19 +196,10 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { } void TalkManager::PARLER_PERSO2(const Common::String &filename) { - int v1; - int v2; - int v3; - int v4; - int v5; - byte v7; - int v8; - int v9; - - v9 = 0; + int v9 = 0; _vm->_objectsManager.DESACTIVE_CURSOR = 1; STATI = 1; - v7 = _vm->_dialogsManager.DESACTIVE_INVENT; + byte v7 = _vm->_dialogsManager.DESACTIVE_INVENT; _vm->_dialogsManager.DESACTIVE_INVENT = 1; BUFFERPERSO = _vm->_fileManager.RECHERCHE_CAT(filename, 5); TAILLEPERSO = _vm->_globals.CAT_TAILLE; @@ -237,19 +228,20 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { break; } - v1 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 40); + int v1 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 40); PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; CHERCHE_PAL(PCHERCHE, 0); PLIGNE1 = v1; PLIGNE2 = v1 + 1; PLIGNE3 = v1 + 2; PLIGNE4 = v1 + 3; - v8 = _vm->_eventsManager.btsouris; + int v8 = _vm->_eventsManager.btsouris; _vm->_eventsManager.btsouris = 4; _vm->_eventsManager.CHANGE_MOUSE(0); if (!_vm->_globals.NOPARLE) { - v2 = v1 + 3; + int v2 = v1 + 3; + int v3; do { v3 = DIALOGUE(); if (v3 != v2) @@ -261,7 +253,8 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { } if (_vm->_globals.NOPARLE) { - v4 = 1; + int v4 = 1; + int v5; do v5 = DIALOGUE_REP(v4++); while (v5 != -1); |