diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hopkins/globals.cpp | 4 | ||||
-rw-r--r-- | engines/hopkins/lines.cpp | 46 | ||||
-rw-r--r-- | engines/hopkins/lines.h | 4 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 114 |
4 files changed, 78 insertions, 90 deletions
diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 0185b2bf1a..30f25ce222 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -324,9 +324,9 @@ void Globals::clearAll() { _vm->_linesManager.Ligne[idx].field8 = 0; _vm->_linesManager.Ligne[idx].fieldC = g_PTRNUL; - _vm->_linesManager.LigneZone[idx].field0 = 0; + _vm->_linesManager.LigneZone[idx].count = 0; _vm->_linesManager.LigneZone[idx].field2 = 0; - _vm->_linesManager.LigneZone[idx].field4 = g_PTRNUL; + _vm->_linesManager.LigneZone[idx].zoneData = (int16 *)g_PTRNUL; } for (int idx = 0; idx < 100; ++idx) { diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 26cef1d7d9..7b6e895715 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -130,23 +130,21 @@ int LinesManager::OPTI_ZONE(int a1, int a2, int a3) { void LinesManager::RETIRE_LIGNE_ZONE(int idx) { if (idx > 400) error("Attempting to add a line obstacle > MAX_LIGNE."); - if (_vm->_linesManager.LigneZone[idx].field4 != g_PTRNUL) - _vm->_globals.dos_free2(_vm->_linesManager.LigneZone[idx].field4); + if (_vm->_linesManager.LigneZone[idx].zoneData != (int16 *)g_PTRNUL) + _vm->_globals.dos_free2((byte *)_vm->_linesManager.LigneZone[idx].zoneData); - _vm->_linesManager.LigneZone[idx].field4 = g_PTRNUL; + _vm->_linesManager.LigneZone[idx].zoneData = (int16 *)g_PTRNUL; } void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, int a6) { - int v7; int v8; int v9; - byte *v10; + int16 *zoneData; + int16 *dataP; int v11; - byte *v12; int v13; int v14; - byte *v15; int v16; int v17; int v18; @@ -159,9 +157,9 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in if (a2 != a3 || a3 != a4 || a3 != a5) { if (idx > 400) error("Attempting to add a line obstacle > MAX_LIGNE."); - v7 = idx; - if (LigneZone[v7].field4 != g_PTRNUL) - LigneZone[v7].field4 = _vm->_globals.dos_free2(LigneZone[v7].field4); + + if (LigneZone[idx].zoneData != (int16 *)g_PTRNUL) + LigneZone[idx].zoneData = (int16 *)_vm->_globals.dos_free2((byte *)LigneZone[idx].zoneData); v8 = a2 - a4; if (a2 - a4 < 0) v8 = -v8; @@ -170,17 +168,18 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in if (a3 - a5 < 0) v9 = -v9; v18 = v9; - if (v19 <= (int)v9) + if (v19 <= v9) v20 = v9 + 1; else v20 = v19 + 1; - v10 = _vm->_globals.dos_malloc2(4 * v20 + 8); + + zoneData = (int16 *)_vm->_globals.dos_malloc2(2 * sizeof(int16) * v20 + (4 * sizeof(int16))); v11 = idx; - LigneZone[v11].field4 = v10; - if (g_PTRNUL == v10) + LigneZone[v11].zoneData = zoneData; + if (zoneData == (int16 *)g_PTRNUL) error("AJOUTE LIGNE ZONE"); - v12 = LigneZone[v11].field4; + dataP = zoneData; v23 = 1000 * v19 / v20; v22 = 1000 * v18 / v20; if (a4 < a2) @@ -194,10 +193,9 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in v14 = 0; if (v20 > 0) { do { - WRITE_LE_UINT16(v12, v17); - v15 = v12 + 2; - WRITE_LE_UINT16(v15, v21); - v12 = v15 + 2; + *dataP++ = v17; + *dataP++ = v21; + v13 += v23; v16 += v22; v17 = v13 / 1000; @@ -205,14 +203,14 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in ++v14; } while (v20 > v14); } - WRITE_LE_UINT16(v12, (uint16)-1); - WRITE_LE_UINT16(v12 + 2, (uint16)-1); + *dataP++ = -1; + *dataP++ = -1; - LigneZone[idx].field0 = v20; + LigneZone[idx].count = v20; LigneZone[idx].field2 = a6; } else { - _vm->_globals.BOBZONE_FLAG[idx] = 1; - _vm->_globals.BOBZONE[idx] = a3; + _vm->_globals.BOBZONE_FLAG[a6] = 1; + _vm->_globals.BOBZONE[a6] = a3; } } diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 1ac44b8bb0..cded40646e 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -31,9 +31,9 @@ namespace Hopkins { class HopkinsEngine; struct LigneZoneItem { - int field0; + int count; int field2; - byte *field4; + int16 *zoneData; }; struct LigneItem { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 80fb61b692..ce8e870936 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -329,10 +329,7 @@ void ObjectsManager::AFF_SPRITES() { int v13; int v14; int v15; - int v16; int v17; - int v18; - int v19; int v20; int v21; int y1_1; @@ -350,7 +347,6 @@ void ObjectsManager::AFF_SPRITES() { int v35; int v36; int v37; - int v38; uint16 arr[50]; _vm->_globals.NBTRI = 0; @@ -538,50 +534,46 @@ void ObjectsManager::AFF_SPRITES() { _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 164, 107, _vm->_eventsManager.start_x + 498, 320); } - v38 = 0; - do { - v16 = v38; - if (_vm->_fontManager.Txt[v16].field0 == 1) { - if ((uint16)(_vm->_fontManager.Txt[v16].field3FC - 2) > 1) - _vm->_fontManager.BOITE(v38, - _vm->_fontManager.Txt[v16].fieldC, _vm->_fontManager.Txt[v16].filename, - _vm->_eventsManager.start_x + _vm->_fontManager.Txt[v16].xp, _vm->_fontManager.Txt[v16].yp); + for (int idx = 0; idx <= 10; ++idx) { + if (_vm->_fontManager.Txt[idx].field0 == 1) { + if ((uint16)(_vm->_fontManager.Txt[idx].field3FC - 2) > 1) + _vm->_fontManager.BOITE(idx, + _vm->_fontManager.Txt[idx].fieldC, _vm->_fontManager.Txt[idx].filename, + _vm->_eventsManager.start_x + _vm->_fontManager.Txt[idx].xp, _vm->_fontManager.Txt[idx].yp); else _vm->_fontManager.BOITE( - v38, - _vm->_fontManager.Txt[v16].fieldC, - _vm->_fontManager.Txt[v16].filename, - _vm->_fontManager.Txt[v16].xp, - _vm->_fontManager.Txt[v16].yp); - _vm->_fontManager.ListeTxt[v38].enabled = true; + idx, + _vm->_fontManager.Txt[idx].fieldC, + _vm->_fontManager.Txt[idx].filename, + _vm->_fontManager.Txt[idx].xp, + _vm->_fontManager.Txt[idx].yp); + _vm->_fontManager.ListeTxt[idx].enabled = true; - v17 = v38; + v17 = idx; if ((uint16)(_vm->_fontManager.Txt[v17].field3FC - 2) > 1) - _vm->_fontManager.ListeTxt[v38].xp = _vm->_eventsManager.start_x + _vm->_fontManager.Txt[v17].xp; + _vm->_fontManager.ListeTxt[idx].xp = _vm->_eventsManager.start_x + _vm->_fontManager.Txt[v17].xp; else - _vm->_fontManager.ListeTxt[v38].xp = _vm->_fontManager.Txt[v17].xp; + _vm->_fontManager.ListeTxt[idx].xp = _vm->_fontManager.Txt[v17].xp; - v18 = v38; - v19 = v38; - _vm->_fontManager.ListeTxt[v18].yp = _vm->_fontManager.Txt[v19].yp; - _vm->_fontManager.ListeTxt[v18].width = _vm->_fontManager.Txt[v19].width; - _vm->_fontManager.ListeTxt[v18].height = _vm->_fontManager.Txt[v19].height; - - if (_vm->_fontManager.ListeTxt[v38].xp < _vm->_graphicsManager.min_x) - _vm->_fontManager.ListeTxt[v38].xp = _vm->_graphicsManager.min_x - 1; - if (_vm->_fontManager.ListeTxt[v38].yp < _vm->_graphicsManager.min_y) - _vm->_fontManager.ListeTxt[v38].yp = _vm->_graphicsManager.min_y - 1; - v20 = _vm->_fontManager.ListeTxt[v38].xp; - if (_vm->_fontManager.ListeTxt[v38].width + v20 > _vm->_graphicsManager.max_x) - _vm->_fontManager.ListeTxt[v38].width = _vm->_graphicsManager.max_x - v20; - v21 = _vm->_fontManager.ListeTxt[v38].yp; - if (_vm->_fontManager.ListeTxt[v38].height + v21 > _vm->_graphicsManager.max_y) - _vm->_fontManager.ListeTxt[v38].height = _vm->_graphicsManager.max_y - v21; - if (_vm->_fontManager.ListeTxt[v38].width <= 0 || _vm->_fontManager.ListeTxt[v38].height <= 0) - _vm->_fontManager.ListeTxt[v18].enabled = false; - } - ++v38; - } while (v38 <= 10); + _vm->_fontManager.ListeTxt[idx].yp = _vm->_fontManager.Txt[idx].yp; + _vm->_fontManager.ListeTxt[idx].width = _vm->_fontManager.Txt[idx].width; + _vm->_fontManager.ListeTxt[idx].height = _vm->_fontManager.Txt[idx].height; + + if (_vm->_fontManager.ListeTxt[idx].xp < _vm->_graphicsManager.min_x) + _vm->_fontManager.ListeTxt[idx].xp = _vm->_graphicsManager.min_x - 1; + if (_vm->_fontManager.ListeTxt[idx].yp < _vm->_graphicsManager.min_y) + _vm->_fontManager.ListeTxt[idx].yp = _vm->_graphicsManager.min_y - 1; + + v20 = _vm->_fontManager.ListeTxt[idx].xp; + if (_vm->_fontManager.ListeTxt[idx].width + v20 > _vm->_graphicsManager.max_x) + _vm->_fontManager.ListeTxt[idx].width = _vm->_graphicsManager.max_x - v20; + v21 = _vm->_fontManager.ListeTxt[idx].yp; + if (_vm->_fontManager.ListeTxt[idx].height + v21 > _vm->_graphicsManager.max_y) + _vm->_fontManager.ListeTxt[idx].height = _vm->_graphicsManager.max_y - v21; + if (_vm->_fontManager.ListeTxt[idx].width <= 0 || _vm->_fontManager.ListeTxt[idx].height <= 0) + _vm->_fontManager.ListeTxt[idx].enabled = false; + } + } INVENT_ANIM(); } @@ -2611,10 +2603,9 @@ void ObjectsManager::CHARGE_ZONE(const Common::String &file) { } void ObjectsManager::CARRE_ZONE() { - byte *v3; + int16 *dataP; int v4; int v5; - byte *v6; int v7; int v8; int v10; @@ -2635,8 +2626,8 @@ void ObjectsManager::CARRE_ZONE() { } for (int idx = 0; idx < 400; ++idx) { - v3 = _vm->_linesManager.LigneZone[idx].field4; - if (v3 != g_PTRNUL) { + dataP = _vm->_linesManager.LigneZone[idx].zoneData; + if (dataP != (int16 *)g_PTRNUL) { v4 = _vm->_linesManager.LigneZone[idx].field2; _vm->_globals.CarreZone[v4].field0 = 1; if (_vm->_globals.CarreZone[v4].fieldC < idx) @@ -2645,13 +2636,12 @@ void ObjectsManager::CARRE_ZONE() { _vm->_globals.CarreZone[v4].fieldA = idx; v13 = 0; - v12 = _vm->_linesManager.LigneZone[idx].field0; + v12 = _vm->_linesManager.LigneZone[idx].count; if (v12 > 0) { do { - v5 = (int16)READ_LE_UINT16(v3); - v6 = v3 + 2; - v11 = (int16)READ_LE_UINT16(v6); - v3 = v6 + 2; + v5 = *dataP++; + v11 = *dataP++; + if (_vm->_globals.CarreZone[v4].field2 >= v5) _vm->_globals.CarreZone[v4].field2 = v5; if (_vm->_globals.CarreZone[v4].field4 <= v5) @@ -7874,13 +7864,13 @@ int ObjectsManager::colision(int a1, int a2) { int v9 = v3 + 1; do { - byte *srcP = _vm->_linesManager.LigneZone[v8].field4; - if (srcP != g_PTRNUL) { + int16 *srcP = _vm->_linesManager.LigneZone[v8].zoneData; + if (srcP != (int16 *)g_PTRNUL) { bool flag = true; - int v11 = (int16)READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 2); - int dataV2 = (int16)READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 2 + 2); - int v12 = (int16)READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 4 - 4); - int v13 = (int16)READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 4 - 2); + int v11 = *(srcP + _vm->_linesManager.LigneZone[v8].count); + int dataV2 = *(srcP + _vm->_linesManager.LigneZone[v8].count + 1); + int v12 = *(srcP + _vm->_linesManager.LigneZone[v8].count * 2 - 2); + int v13 = *(srcP + _vm->_linesManager.LigneZone[v8].count * 2 - 1); int v10 = v13; if (v11 < v12 && v4 >= v11 && v5 > v13) @@ -7894,11 +7884,11 @@ int ObjectsManager::colision(int a1, int a2) { if (!flag) { - if (v11 < _vm->_linesManager.LigneZone[v8].field0) { - for (; v11 < _vm->_linesManager.LigneZone[v8].field0; ++idx) { - int v11 = (int16)READ_LE_UINT16(srcP); - int v12 = (int16)READ_LE_UINT16(srcP + 2); - srcP += 4; + if (v11 < _vm->_linesManager.LigneZone[v8].count) { + for (; v11 < _vm->_linesManager.LigneZone[v8].count; ++idx) { + int v11 = *srcP; + int v12 = *(srcP + 1); + srcP += 2; if ((v2 == v11 || v9 == v11) && a2 == v12) return _vm->_linesManager.LigneZone[v8].field2; |