diff options
-rw-r--r-- | engines/hopkins/anim.cpp | 107 | ||||
-rw-r--r-- | engines/hopkins/anim.h | 2 | ||||
-rw-r--r-- | engines/hopkins/events.cpp | 4 | ||||
-rw-r--r-- | engines/hopkins/globals.h | 1 | ||||
-rw-r--r-- | engines/hopkins/lines.cpp | 6 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 15 |
6 files changed, 61 insertions, 74 deletions
diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 247f267027..42aef7dd1d 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -843,111 +843,100 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam return result; } -void AnimationManager::RECHERCHE_ANIM(const byte *data, int idx, int nbytes) { - int v4; +void AnimationManager::RECHERCHE_ANIM(const byte *data, int animIndex, int count) { + int v3; const byte *v5; int v6; int v7; + int v8; byte *v9; int v10; int v11; int v12; - char v13; - signed int v14; - int v15; - int v16; - char v17; + int v13; + int v14; + int v15; + int v16; + int v17; int v19; - char v20; + int v20; int v21; int v22; - const byte *v23; - int v24; - - bool doneFlag = false; - bool breakFlag; + const byte *v23; + int v; v21 = 0; - v4 = 8 * idx; - v19 = 8 * idx; - + v3 = 0; + v19 = animIndex; do { v20 = *(v21 + data); - if (*(data + v20) == 'A' && *(data + v20 + 1) == 'N' && *(data + v20 + 2) == 'I' - && *(data + v20 + 3) == 'M') { - v4 = *(data + v21 + 4); - if (idx == v4) { + if (v20 == 'A' && *(data + v21 + 1) == 'N' && *(data + v21 + 2) == 'I' && *(data + v21 + 3) == 'M') { + int entryIndex = *(data + v21 + 4); + if (animIndex == entryIndex) { v5 = v21 + data + 5; v6 = v21 + 5; v7 = 0; - breakFlag = false; - + v8 = 0; do { if (*v5 == 'A' && *(v5 + 1) == 'N' && *(v5 + 2) == 'I' && *(v5 + 3) == 'M') - breakFlag = true; - + v8 = 1; if (*v5 == 'F' && *(v5 + 1) == 'I' && *(v5 + 2) == 'N') - breakFlag = true; - - if (nbytes < v6) { - _vm->_globals.Bqe_Anim[idx].field4 = 0; - _vm->_globals.Bqe_Anim[idx].data = g_PTRNUL; + v8 = 1; + if (count < v6) { + _vm->_globals.Bqe_Anim[animIndex].field4 = 0; + _vm->_globals.Bqe_Anim[v19].data = g_PTRNUL; + return; } - ++v6; ++v7; ++v5; - } while (!breakFlag); - - _vm->_globals.Bqe_Anim[idx].data = _vm->_globals.dos_malloc2(v7 + 50); - _vm->_globals.Bqe_Anim[idx].field4 = 1; - memcpy(_vm->_globals.Bqe_Anim[idx].data, v21 + data + 5, 20); - - byte *dataP = _vm->_globals.Bqe_Anim[idx].data; + } while (v8 != 1); + _vm->_globals.Bqe_Anim[v19].data = _vm->_globals.dos_malloc2(v7 + 50); + _vm->_globals.Bqe_Anim[animIndex].field4 = 1; + memcpy(_vm->_globals.Bqe_Anim[v19].data, v21 + data + 5, 0x14u); + byte *dataP = _vm->_globals.Bqe_Anim[v19].data; v9 = dataP + 20; v23 = v21 + data + 25; - v10 = (int16)READ_LE_UINT16(v21 + data + 25); - v11 = (int16)READ_LE_UINT16(v21 + data + 27); - v22 = (int16)READ_LE_UINT16(v21 + data + 29); - v12 = (int16)READ_LE_UINT16(v21 + data + 31); - v13 = (int16)READ_LE_UINT16(v21 + data + 33); + v10 = READ_LE_UINT16(v21 + data + 25); + v11 = READ_LE_UINT16(v21 + data + 27); + v22 = READ_LE_UINT16(v21 + data + 29); + v12 = READ_LE_UINT16(v21 + data + 31); + v13 = *(v21 + data + 33); *(dataP + 29) = *(v21 + data + 34); WRITE_LE_UINT16(dataP + 20, v10); WRITE_LE_UINT16(dataP + 22, v11); WRITE_LE_UINT16(dataP + 24, v22); WRITE_LE_UINT16(dataP + 26, v12); - WRITE_LE_UINT16(dataP + 28, v13); + *(dataP + 28) = v13; + v14 = 1; - do { v9 += 10; v23 += 10; if (!v22) break; - - v24 = (int16)READ_LE_UINT16(v23); - v15 = (int16)READ_LE_UINT16(v23 + 2); - v22 = (int16)READ_LE_UINT16(v23 + 4); - v16 = (int16)READ_LE_UINT16(v23 + 6); - v17 = (int16)READ_LE_UINT16(v23 + 8); + + v = READ_LE_UINT16(v23); + v15 = READ_LE_UINT16(v23 + 2); + v22 = READ_LE_UINT16(v23 + 4); + v16 = READ_LE_UINT16(v23 + 6); + v17 = *(v23 + 8); *(v9 + 9) = *(v23 + 9); - WRITE_LE_UINT16(v9, v24); + WRITE_LE_UINT16(v9, v); WRITE_LE_UINT16(v9 + 2, v15); WRITE_LE_UINT16(v9 + 4, v22); - WRITE_LE_UINT16(v9 + 6, v16); - WRITE_LE_UINT16(v9 + 8, v17); + WRITE_LE_UINT16(v9 + 6, v16); + *(v9 + 8) = v17; ++v14; } while (v14 <= 4999); - - doneFlag = 1; + v3 = 1; } } - - if (*(data + v20) == 'F' && *(data + v21 + 1) == 'I' && *(data + v21 + 2) == 'N') - doneFlag = 1; + if (v20 == 'F' && *(data + v21 + 1) == 'I' && *(data + v21 + 2) == 'N') + v3 = 1; ++v21; - } while (v21 <= nbytes && !doneFlag); + } while (v21 <= count && v3 != 1); } void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uint32 a4, uint32 a5) { diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index 66f623f257..339355ef75 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -49,7 +49,7 @@ public: bool REDRAW_ANIM(); void CHARGE_ANIM(const Common::String &animName); void CLEAR_ANIM(); - void RECHERCHE_ANIM(const byte *data, int idx, int nbytes); + void RECHERCHE_ANIM(const byte *data, int animIndex, int count); void PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uint32 a4, uint32 a5); void PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, uint32 a4); }; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 8f4d5eee5c..030e321316 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -451,8 +451,8 @@ LABEL_65: if (yp < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x && v14 > 1 && v13 > 1) { /* Commented out in favour of using ScummVM cursor display _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, yp, v14, v13); -*/ _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v12, v11); +*/ goto LABEL_113; } if (btsouris != 23) @@ -461,8 +461,8 @@ LABEL_65: if (yp < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x && v14 > 1 && v13 > 1) { /* Commented out in favour of using ScummVM cursor display _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, yp, v14, v13); -*/ _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v14 + v15, yp + v13); +*/ } } LABEL_113: diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 5b54c1d90a..324e134c4f 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -102,7 +102,6 @@ struct BobItem { int field14; int field16; byte *field18; - int field1A; int field1C; int field1E; int field20; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 7b6e895715..eda1b3efd3 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -3071,7 +3071,7 @@ LABEL_323: _vm->_globals.super_parcours[v81 + 3] = 0; v121 += 3; v137 += 4; - if ((int16)(int16)READ_LE_UINT16(v80 + 2 * v121) == -1 && (int16)(int16)READ_LE_UINT16(v80 + 2 * v121 + 2) == -1) + if ((int16)READ_LE_UINT16(v80 + 2 * v121) == -1 && (int16)READ_LE_UINT16(v80 + 2 * v121 + 2) == -1) v131 = 1; } while (v131 != 1); LABEL_301: @@ -3129,7 +3129,7 @@ LABEL_312: goto LABEL_301; } v86 = _vm->_globals.essai2; - if ((int16)(int16)READ_LE_UINT16(_vm->_globals.essai2) != -1 && v144 > v138 && v140 >= v138 && v142 >= v138 && a6 <= v138) { + if ((int16)READ_LE_UINT16(_vm->_globals.essai2) != -1 && v144 > v138 && v140 >= v138 && v142 >= v138 && a6 <= v138) { NV_LIGNEDEP = v138; NV_LIGNEOFS = v139; v134 = 0; @@ -3147,7 +3147,7 @@ LABEL_312: } while (v134 != 1); goto LABEL_312; } - if ((int16)(int16)READ_LE_UINT16(_vm->_globals.essai1) != -1 && v144 > v142 && v140 >= v142 && v138 >= v142 && a6 <= v142) { + if ((int16)READ_LE_UINT16(_vm->_globals.essai1) != -1 && v144 > v142 && v140 >= v142 && v138 >= v142 && a6 <= v142) { NV_LIGNEDEP = v142; NV_LIGNEOFS = v143; v135 = 0; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 29a9c2eb00..19636839ff 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -245,7 +245,7 @@ int ObjectsManager::Get_Largeur(const byte *objectData, int idx) { for (int i = idx; i; --i) rectP += READ_LE_UINT32(rectP) + 16; - return (int16)(int16)READ_LE_UINT16(rectP + 4); + return (int16)READ_LE_UINT16(rectP + 4); } int ObjectsManager::Get_Hauteur(const byte *objectData, int idx) { @@ -253,7 +253,7 @@ int ObjectsManager::Get_Hauteur(const byte *objectData, int idx) { for (int i = idx; i; --i) rectP += READ_LE_UINT32(rectP) + 16; - return (int16)(int16)READ_LE_UINT16(rectP + 6); + return (int16)READ_LE_UINT16(rectP + 6); } int ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIndex) { @@ -590,7 +590,6 @@ void ObjectsManager::BOB_ZERO(int idx) { bob.field14 = 0; bob.field16 = 0; bob.field18 = g_PTRNUL; - bob.field1A = 0; bob.field1C = 0; bob.field1E = 0; bob.field20 = 0; @@ -2863,7 +2862,7 @@ void ObjectsManager::BTGAUCHE() { do { WRITE_LE_UINT16(v3 + 2 * v2, (int16)READ_LE_UINT16(v4 + 2 * v2)); ++v2; - } while ((int16)(int16)READ_LE_UINT16(v4 + 2 * v2) != -1); + } while ((int16)READ_LE_UINT16(v4 + 2 * v2) != -1); v5 = _vm->_globals.essai2; WRITE_LE_UINT16(_vm->_globals.essai2 + 2 * v2, (uint16)-1); WRITE_LE_UINT16(v5 + 2 * v2 + 2, (uint16)-1); @@ -3496,7 +3495,7 @@ void ObjectsManager::PACOURS_PROPRE(byte *a1) { v14 = -1; v2 = (int16)READ_LE_UINT16(a1 + 2); v15 = (int16)READ_LE_UINT16(a1 + 4); - if ((int16)(int16)READ_LE_UINT16(a1) != -1 || v2 != -1) { + if ((int16)READ_LE_UINT16(a1) != -1 || v2 != -1) { while (1) { if (v14 != -1 && v15 != v14) { v11 = v1; @@ -7247,7 +7246,7 @@ void ObjectsManager::INILINK(const Common::String &file) { v34 = 0; _vm->_linesManager.TOTAL_LIGNES = 0; do { - v27 = (int16)(int16)READ_LE_UINT16(v16 + 2 * v32); + v27 = (int16)READ_LE_UINT16(v16 + 2 * v32); if (v27 != -1) { _vm->_linesManager.AJOUTE_LIGNE( v34, @@ -7277,7 +7276,7 @@ void ObjectsManager::INILINK(const Common::String &file) { v35 = 0; v18 = 1; do { - v19 = 20 * v18; + v19 = v18; _vm->_globals.ZONEP[v19].field0 = 0; _vm->_globals.ZONEP[v19].field2 = 0; _vm->_globals.ZONEP[v19].field4 = 0; @@ -7297,7 +7296,7 @@ void ObjectsManager::INILINK(const Common::String &file) { v31 = 0; do { - v28 = (int16)(int16)READ_LE_UINT16(v17 + 2 * v33); + v28 = (int16)READ_LE_UINT16(v17 + 2 * v33); if (v28 != -1) { _vm->_linesManager.AJOUTE_LIGNE_ZONE( v35, |