diff options
Diffstat (limited to 'engines/hopkins/objects.cpp')
-rw-r--r-- | engines/hopkins/objects.cpp | 672 |
1 files changed, 587 insertions, 85 deletions
diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 2c0a8d10a6..25d4cde43a 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -46,7 +46,7 @@ ObjectsManager::ObjectsManager() { inventaire2 = PTRNUL; SL_SPR = PTRNUL; SL_SPR2 = PTRNUL; - _vm->_objectsManager.PERSO_ON = false; + PERSO_ON = false; SL_FLAG = false; FLAG_VISIBLE = false; DESACTIVE_INVENT = false; @@ -331,7 +331,7 @@ void ObjectsManager::AFF_SPRITES() { ++v30; } while (v30 <= 10); - if (!_vm->_objectsManager.PERSO_ON) { + if (!PERSO_ON) { v31 = 0; do { v5 = v31; @@ -362,7 +362,7 @@ void ObjectsManager::AFF_SPRITES() { AFF_BOB_ANIM(); AFF_VBOB(); - if (!_vm->_objectsManager.PERSO_ON) { + if (!PERSO_ON) { v32 = 0; do { _vm->_globals.Liste[v32].field0 = 0; @@ -1276,7 +1276,7 @@ void ObjectsManager::AFF_BOB_ANIM() { int idx = 0; do { ++idx; - if (idx <= 20 && _vm->_objectsManager.PERSO_ON == 1) { + if (idx <= 20 && PERSO_ON == 1) { _vm->_globals.Bob[idx].field1C = 0; continue; } @@ -1305,7 +1305,7 @@ void ObjectsManager::AFF_BOB_ANIM() { _vm->_globals.Bob[idx].field8 = READ_LE_UINT16(v20 + 2 * v24); if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals.Bob[idx].field8 = _vm->_globals.BL_ANIM[idx].v2; - if ( _vm->_objectsManager.PERSO_ON == 1 && idx > 20 ) + if ( PERSO_ON == 1 && idx > 20 ) _vm->_globals.Bob[idx].field8 += _vm->_eventsManager.start_x; _vm->_globals.Bob[idx].fieldA = READ_LE_UINT16(v20 + 2 * v24 + 2); @@ -1346,7 +1346,7 @@ LABEL_38: if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals.Bob[idx].field8 = _vm->_globals.BL_ANIM[idx].v2; - if (_vm->_objectsManager.PERSO_ON == 1 && idx > 20) + if (PERSO_ON == 1 && idx > 20) _vm->_globals.Bob[idx].field8 += _vm->_eventsManager.start_x; _vm->_globals.Bob[idx].fieldA = READ_LE_UINT16(v21 + 2); @@ -1370,7 +1370,7 @@ LABEL_38: } } while (idx != 35); - if (!_vm->_objectsManager.PERSO_ON && BOBTOUS == 1) { + if (!PERSO_ON && BOBTOUS == 1) { v26 = 0; do { v13 = v26; @@ -1385,7 +1385,7 @@ LABEL_38: do { ++v27; - if (v27 > 20 || _vm->_objectsManager.PERSO_ON != 1) { + if (v27 > 20 || PERSO_ON != 1) { if (_vm->_globals.Bob[v27].field0 == 10) { if (_vm->_globals.Bob[v27].field1C == 1) { v14 = _vm->_globals.Bob[v27].field1E; @@ -1800,7 +1800,7 @@ LABEL_54: _vm->_eventsManager.CHANGE_MOUSE(4); } } - _vm->_objectsManager.NUMZONE = v4; + NUMZONE = v4; _vm->_globals.old_x_69 = v0; _vm->_globals.old_y_70 = v2; _vm->_globals.old_zone_68 = v4; @@ -2104,7 +2104,7 @@ void ObjectsManager::BTGAUCHE() { if (GOACTION != 1) goto LABEL_38; VERIFZONE(); - if (_vm->_objectsManager.NUMZONE <= 0) + if (NUMZONE <= 0) return; v2 = 0; v3 = _vm->_globals.essai2; @@ -2126,10 +2126,10 @@ void ObjectsManager::BTGAUCHE() { _vm->_globals.SAUVEGARDE->data[svField2] = 0; } LABEL_38: - if (_vm->_globals.PLAN_FLAG == 1 && (_vm->_eventsManager.btsouris != 4 || _vm->_objectsManager.NUMZONE <= 0)) + if (_vm->_globals.PLAN_FLAG == 1 && (_vm->_eventsManager.btsouris != 4 || NUMZONE <= 0)) return; - if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u) { - v6 = _vm->_objectsManager.NUMZONE; + if ((uint16)(NUMZONE + 1) > 1u) { + v6 = NUMZONE; v7 = _vm->_globals.ZONEP[v6].field0; if (v7) { v8 = _vm->_globals.ZONEP[v6].field2; @@ -2144,7 +2144,7 @@ LABEL_38: GOACTION = 0; v9 = _vm->_globals.chemin; _vm->_globals.chemin = PTRNUL; - if (_vm->_globals.FORET && ((uint16)(_vm->_objectsManager.NUMZONE - 20) <= 1u || (uint16)(_vm->_objectsManager.NUMZONE - 22) <= 1u)) { + if (_vm->_globals.FORET && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { if (YSPR(0) <= 374 || YSPR(0) > 410) { v10 = XSPR(0); v11 = YSPR(0); @@ -2196,24 +2196,24 @@ LABEL_65: _vm->_globals.chemin = PARC_VOITURE(v18, v17, v19, v0); } } - if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u) { + if ((uint16)(NUMZONE + 1) > 1u) { // TODO: Reformat the weird if statement generated by the decompiler if (_vm->_eventsManager.btsouris == 23 || (_vm->_globals.SAUVEGARDE->data[svField1] = _vm->_eventsManager.btsouris, _vm->_eventsManager.btsouris == 23)) _vm->_globals.SAUVEGARDE->data[svField1] = 5; if (_vm->_globals.PLAN_FLAG == 1) _vm->_globals.SAUVEGARDE->data[svField1] = 6; - _vm->_globals.SAUVEGARDE->data[svField2] = _vm->_objectsManager.NUMZONE; + _vm->_globals.SAUVEGARDE->data[svField2] = NUMZONE; _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; GOACTION = 1; } _vm->_fontManager.TEXTE_OFF(5); _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); ARRET_PERSO_FLAG = 0; - if (_vm->_eventsManager.btsouris == 21 && _vm->_globals.BOBZONE[_vm->_objectsManager.NUMZONE]) { + if (_vm->_eventsManager.btsouris == 21 && _vm->_globals.BOBZONE[NUMZONE]) { ARRET_PERSO_FLAG = 1; - ARRET_PERSO_NUM = _vm->_globals.BOBZONE[_vm->_objectsManager.NUMZONE]; + ARRET_PERSO_NUM = _vm->_globals.BOBZONE[NUMZONE]; } - if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->data[svField13] == 1 && _vm->_globals.OBJET_EN_COURS == 20 && _vm->_objectsManager.NUMZONE == 12 + if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->data[svField13] == 1 && _vm->_globals.OBJET_EN_COURS == 20 && NUMZONE == 12 && _vm->_eventsManager.btsouris == 23) { _vm->_globals.chemin = PTRNUL; XSPR(0); @@ -2235,7 +2235,7 @@ void ObjectsManager::PARADISE() { result = _vm->_globals.SAUVEGARDE->data[svField1]; if (result && _vm->_globals.SAUVEGARDE->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.TEXTE_OFF(5); - if (_vm->_globals.FORET != 1 || ((uint16)(_vm->_objectsManager.NUMZONE - 20) > 1u && (uint16)(_vm->_objectsManager.NUMZONE - 22) > 1u)) { + if (_vm->_globals.FORET != 1 || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { _vm->_graphicsManager.no_scroll = 2; if (_vm->_eventsManager.start_x >= XSPR(0) - 320) @@ -2299,11 +2299,11 @@ LABEL_64: _vm->_talkManager.REPONSE2(_vm->_globals.SAUVEGARDE->data[svField2], _vm->_globals.SAUVEGARDE->data[svField1]); } _vm->_eventsManager.CHANGE_MOUSE(4); - if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u && !_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field16) { - _vm->_objectsManager.NUMZONE = -1; + if ((uint16)(NUMZONE + 1) > 1u && !_vm->_globals.ZONEP[NUMZONE].field16) { + NUMZONE = -1; FORCEZONE = 1; } - if (_vm->_objectsManager.NUMZONE != _vm->_globals.SAUVEGARDE->data[svField2] || (uint16)(_vm->_objectsManager.NUMZONE + 1) <= 1u) { + if (NUMZONE != _vm->_globals.SAUVEGARDE->data[svField2] || (uint16)(NUMZONE + 1) <= 1u) { _vm->_eventsManager.btsouris = 4; CHANGEVERBE = 0; } else { @@ -2317,7 +2317,7 @@ LABEL_64: } if (_vm->_eventsManager.btsouris != 23) _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); - _vm->_objectsManager.NUMZONE = 0; + NUMZONE = 0; _vm->_globals.SAUVEGARDE->data[svField1] = 0; _vm->_globals.SAUVEGARDE->data[svField2] = 0; } @@ -2327,8 +2327,8 @@ LABEL_64: } if (_vm->_globals.NOMARCHE == 1) { if (_vm->_eventsManager.btsouris == 4) { - result = _vm->_objectsManager.NUMZONE + 1; - if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u) + result = NUMZONE + 1; + if ((uint16)(NUMZONE + 1) > 1u) BTDROITE(); } } @@ -2358,7 +2358,7 @@ void ObjectsManager::CLEAR_ECRAN() { } while (v1 <= 48); _vm->_eventsManager.btsouris = 4; verbe = 4; - _vm->_objectsManager.NUMZONE = 0; + NUMZONE = 0; Vold_taille = 0; SPEED_FLAG = 0; SPEED_PTR = PTRNUL; @@ -2394,6 +2394,20 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_graphicsManager.RESET_SEGMENT_VESA(); } +void ObjectsManager::TEST_INVENT() { + if (_vm->_globals.PLAN_FLAG) + KEY_INVENT = 0; + if (KEY_INVENT == 1) { + if (!INVENTFLAG) { + KEY_INVENT = 0; + INVENTFLAG = 1; + INVENT(); + INVENTFLAG = 0; + KEY_INVENT = 0; + } + } +} + void ObjectsManager::INVENT() { int v1; size_t filesize; @@ -3240,7 +3254,7 @@ void ObjectsManager::VERBEPLUS() { do { _vm->_eventsManager.btsouris = 4; LABEL_24: - if (_vm->_globals.NOMARCHE != 1 || (v = _vm->_objectsManager.NUMZONE + 1, (uint16)(_vm->_objectsManager.NUMZONE + 1) <= 1u)) { + if (_vm->_globals.NOMARCHE != 1 || (v = NUMZONE + 1, (uint16)(NUMZONE + 1) <= 1u)) { if (_vm->_eventsManager.btsouris == 4) return; } else { @@ -3250,146 +3264,146 @@ LABEL_28: ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 6) { LABEL_29: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field6 == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field6 == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 7) { LABEL_31: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field7 == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field7 == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 8) { LABEL_33: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field8 == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field8 == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 9) { LABEL_35: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field9 == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field9 == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 10) { LABEL_37: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldA == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldA == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 11) { LABEL_39: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldB == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldB == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 12) { LABEL_41: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldC == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldC == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 13) { LABEL_43: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldD == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldD == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 14) { LABEL_45: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldE == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldE == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 15) { LABEL_47: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldF == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldF == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 16) { LABEL_49: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field6 == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field6 == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 17) { LABEL_51: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field9 == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field9 == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 18) { LABEL_53: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldA == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldA == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 19) { LABEL_55: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldB == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldB == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 20) { LABEL_57: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldC == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldC == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 21) { LABEL_59: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldF == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldF == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 22) { LABEL_61: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldD == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldD == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 23) { LABEL_63: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field8 == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field8 == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 24) { LABEL_65: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field9 == 3) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field9 == 3) return; } v = _vm->_eventsManager.btsouris + 1; _vm->_eventsManager.btsouris = v; } while (v != 25); LABEL_67: - v = 5 * _vm->_objectsManager.NUMZONE; - } while (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldE != 2); + v = 5 * NUMZONE; + } while (_vm->_globals.ZONEP[NUMZONE].fieldE != 2); } void ObjectsManager::BTDROITE() { - if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u) { + if ((uint16)(NUMZONE + 1) > 1u) { VERBEPLUS(); if (_vm->_eventsManager.btsouris != 23) _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); @@ -3773,7 +3787,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); _vm->_soundManager.SPECIAL_SOUND = 198; - _vm->_objectsManager.PERSO_ON = 1; + PERSO_ON = 1; _vm->_animationManager.NO_SEQ = 1; _vm->_animationManager.CLS_ANM = 0; _vm->_animationManager.PLAY_ANM("otage.ANM", 1, 24, 500); @@ -3784,7 +3798,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_globals.NECESSAIRE = 0; FileManager::CONSTRUIT_LINUX("TEMP1.SCR"); FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); - _vm->_objectsManager.PERSO_ON = 0; + PERSO_ON = 0; memcpy(_vm->_graphicsManager.Palette, v1, 0x301u); _vm->_graphicsManager.SHOW_PALETTE(); _vm->_globals.dos_free2(v1); @@ -4694,7 +4708,7 @@ LABEL_1141: v13 = YSPR(0); v14 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v14, v13, 564, 420); - _vm->_objectsManager.NUMZONE = -1; + NUMZONE = -1; do { GOHOME(); _vm->_eventsManager.VBL(); @@ -5316,7 +5330,7 @@ LABEL_1141: v38 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v38, v37, 330, 418); _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.NUMZONE = 0; + NUMZONE = 0; do { GOHOME(); _vm->_eventsManager.VBL(); @@ -5341,7 +5355,7 @@ LABEL_1141: v39 = YSPR(0); v40 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v40, v39, 330, 314); - _vm->_objectsManager.NUMZONE = 0; + NUMZONE = 0; _vm->_globals.NOT_VERIF = 1; do { GOHOME(); @@ -5919,14 +5933,14 @@ LABEL_1141: if (v76 == 246) { SPRITE_OFF(0); OPTI_ONE(6, 0, 15, 0); - _vm->_objectsManager.PERSO_ON = 1; + PERSO_ON = 1; _vm->_graphicsManager.NB_SCREEN(); _vm->_animationManager.NO_SEQ = 1; _vm->_soundManager.PLAY_SEQ2("TUNNEL.SEQ", 1, 18, 20); _vm->_animationManager.NO_SEQ = 0; _vm->_graphicsManager.NOFADE = 1; _vm->_graphicsManager.FADE_OUTW(); - _vm->_objectsManager.PERSO_ON = 0; + PERSO_ON = 0; _vm->_globals.SORTIE = 100; } if (v76 == 55) { @@ -5953,7 +5967,7 @@ LABEL_1141: v56 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v56, v55, 361, 325); _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.NUMZONE = -1; + NUMZONE = -1; do { GOHOME(); _vm->_eventsManager.VBL(); @@ -5974,7 +5988,7 @@ LABEL_1141: v58 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v58, v57, 361, 325); _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.NUMZONE = -1; + NUMZONE = -1; do { GOHOME(); _vm->_eventsManager.VBL(); @@ -6609,13 +6623,122 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.dos_free2(ptr); } +void ObjectsManager::SPECIAL_INI(const Common::String &a1) { + int v2; + int v3; + int v4; + int v5; + int v6; + int v7; + + if (_vm->_globals.ECRAN == 73 && !_vm->_globals.SAUVEGARDE->data[svField318]) { + _vm->_globals.CACHE_SUB(0); + _vm->_globals.CACHE_SUB(1); + } + if ((uint16)(_vm->_globals.ECRAN - 35) <= 6u) { + _vm->_globals.BOBZONE[20] = 1; + _vm->_globals.BOBZONE[21] = 2; + _vm->_globals.BOBZONE[22] = 3; + _vm->_globals.BOBZONE[23] = 4; + _vm->_globals.BOBZONE_FLAG[20] = 1; + _vm->_globals.BOBZONE_FLAG[21] = 1; + _vm->_globals.BOBZONE_FLAG[22] = 1; + _vm->_globals.BOBZONE_FLAG[23] = 1; + _vm->_objectsManager.VERBE_ON(20, 5); + _vm->_objectsManager.VERBE_ON(21, 5); + _vm->_objectsManager.VERBE_ON(22, 5); + _vm->_objectsManager.VERBE_ON(23, 5); + _vm->_globals.ZONEP[20].field12 = 30; + _vm->_globals.ZONEP[21].field12 = 30; + _vm->_globals.ZONEP[22].field12 = 30; + _vm->_globals.ZONEP[23].field12 = 30; + v2 = 200; + do { + if (_vm->_globals.SAUVEGARDE->data[v2] != 2) + _vm->_globals.SAUVEGARDE->data[v2] = 0; + ++v2; + } while (v2 <= 214); + } + if (_vm->_globals.ECRAN == 93) { + if (!_vm->_globals.SAUVEGARDE->data[svField333]) + _vm->_objectsManager.BOBANIM_ON(8); + } + if (_vm->_globals.ECRAN == 18 && _vm->_globals.OLD_ECRAN == 17) { + _vm->_eventsManager.souris_n = 4; + _vm->_globals.BPP_NOAFF = 1; + v3 = 0; + do { + _vm->_eventsManager.VBL(); + ++v3; + } while (v3 <= 4); + _vm->_globals.BPP_NOAFF = 0; + _vm->_graphicsManager.FADE_INW(); + _vm->_globals.iRegul = 1; + _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_graphicsManager.NOFADE = 1; + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("MAGE1.pe2"); + _vm->_graphicsManager.NOFADE = 1; + _vm->_globals.DESACTIVE_INVENT = 0; + } + if (_vm->_globals.ECRAN == 17 && _vm->_globals.OLD_ECRAN == 20) { + _vm->_globals.DESACTIVE_INVENT = 1; + _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + _vm->_globals.BPP_NOAFF = 1; + v4 = 0; + do { + _vm->_eventsManager.VBL(); + ++v4; + } while (v4 <= 4); + _vm->_globals.BPP_NOAFF = 0; + _vm->_graphicsManager.FADE_INW(); + SPRITE_ON(0); + v5 = 0; + do { + _vm->_eventsManager.VBL(); + ++v5; + } while (v5 <= 4); + VBOB(_vm->_globals.SPRITE_ECRAN, 5, 15, 28, 1); + _vm->_fontManager.TEXTE_OFF(9); + if (!_vm->_soundManager.TEXTOFF) { + _vm->_fontManager.DOS_TEXT(9, 383, _vm->_globals.FICH_TEXTE, 220, 72, 20, 25, 6, 36, 253); + if (!_vm->_soundManager.TEXTOFF) + _vm->_fontManager.TEXTE_ON(9); + } + if (!_vm->_soundManager.VOICEOFF) + _vm->_soundManager.VOICE_MIX(383, 4); + _vm->_globals.SAUVEGARDE->data[svField270] = 1; + _vm->_globals.SAUVEGARDE->data[svField300] = 1; + _vm->_globals.SAUVEGARDE->data[svField320] = 1; + if (_vm->_soundManager.VOICEOFF == 1) { + v6 = 0; + do { + _vm->_eventsManager.VBL(); + ++v6; + } while (v6 <= 199); + } + _vm->_fontManager.TEXTE_OFF(9); + VBOB_OFF(5); + v7 = 0; + do { + _vm->_eventsManager.VBL(); + ++v7; + } while (v7 <= 3); + _vm->_graphicsManager.NOFADE = 1; + _vm->_globals.DESACTIVE_INVENT = 0; + } +} + void ObjectsManager::OPTI_BOBON(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { if (a1 != -1) - _vm->_objectsManager.BOBANIM_ON(a1); + BOBANIM_ON(a1); if (a2 != -1) - _vm->_objectsManager.BOBANIM_ON(a2); + BOBANIM_ON(a2); if (a3 != -1) - _vm->_objectsManager.BOBANIM_ON(a3); + BOBANIM_ON(a3); if (!a7) { if (a1 != -1) SET_BOBPOSI(a1, a4); @@ -6631,7 +6754,7 @@ void ObjectsManager::SCI_OPTI_ONE(int a1, int a2, int a3, int a4) { _vm->_eventsManager.souris_b = 0; if (a4 != 3) { - _vm->_objectsManager.BOBANIM_ON(a1); + BOBANIM_ON(a1); SET_BOBPOSI(a1, a2); } @@ -6641,7 +6764,7 @@ void ObjectsManager::SCI_OPTI_ONE(int a1, int a2, int a3, int a4) { break; } while (a3 != BOBPOSI(a1)); if (!a4) - _vm->_objectsManager.BOBANIM_OFF(a1); + BOBANIM_OFF(a1); } int ObjectsManager::Control_Goto(const byte *dataP) { @@ -7116,11 +7239,129 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in } void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4, int a5, int a6) { - warning("TODO: SPACTION"); + int v6; + signed __int16 v7; + char v8; + __int32 v9; + signed __int16 v10; + __int32 v11; + __int16 v13; + char v14; + __int16 v15; + Common::String v16; + + v15 = 0; + v6 = 0; + v13 = 0; + v16 = " "; + v14 = a5; + if (_vm->_globals.vitesse == 2) + v14 = a5 / 2; + if (_vm->_globals.vitesse == 3) + v14 = a5 / 3; + S_old_spr = Sprite[0].spriteData; + S_old_ani = Sprite[0].field10; + S_old_ret = Sprite[0].fieldE; + Sprite[0].field12 += a3; + Sprite[0].field14 += a4; + Sprite[0].fieldE = a6; + do { + do { + v7 = 0; + v8 = a2[v15]; + if (v8 == ',') { + v9 = atoi(v16.c_str()); + v13 = v9; + v6 = 0; + v16 = " "; + v7 = 1; + } else { + v9 = v6; + v16.setChar(v8, v6); + v6 = v6 + 1; + } + ++v15; + } while (v7 != 1); + if (v13 != -1) { + Sprite[0].spriteData = a1; + Sprite[0].field10 = v13; + } + v10 = 0; + v9 = v14; + if (v14 > 0) { + do { + v11 = v9; + _vm->_eventsManager.VBL(); + ++v10; + v9 = v11; + } while (v10 < v11); + } + } while (v13 != -1); } void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a4, int a5) { - warning("TODO: SPACTION1"); + int v5; + int v6; + char v7; + int v8; + int v9; + int v10; + int v12; + int v13; + int v14; + Common::String v15; + int v16; + + v14 = 0; + v5 = 0; + v12 = 0; + v15 = " "; + v13 = a5; + if (_vm->_globals.vitesse == 2) + v13 = a5 / 2; + if (_vm->_globals.vitesse == 3) + v13 = a5 / 3; + while (1) { + v6 = 0; + v7 = a2[v14]; + if (v7 == 44) { + v8 = atoi(v15.c_str()); + v12 = v8; + v5 = 0; + v15 = " "; + v6 = 1; + } else { + v8 = v5; + v15.setChar(v7, v5); + v5 = v5 + 1; + } + ++v14; + if (v6 == 1) { + if (v12 == -1) { + Sprite[0].spriteData = S_old_spr; + Sprite[0].field10 = 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; + } + + v9 = 0; + v16 = v13; + if (v13 > 0) { + do { + v10 = v8; + _vm->_eventsManager.VBL(); + ++v9; + v16 = v10; + } while (v9 < v10); + } + if (v12 == -1) + break; + } + } } void ObjectsManager::TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6) { @@ -7226,5 +7467,266 @@ void ObjectsManager::BLOQUE_ANIMX(int idx, int a2) { _vm->_globals.BL_ANIM[idx].v2 = a2; } +void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s2, const Common::String &s3, + const Common::String &s4, int v) { + int v5; + int v6; + int v7; + int v8; + int v9; + + v5 = 0; + INVENTFLAG = 0; + KEY_INVENT = 0; + VIRE_INVENT = 0; + _vm->_graphicsManager.ofscroll = 0; + _vm->_globals.PLAN_FLAG = 0; + _vm->_globals.iRegul = 1; + _vm->_soundManager.WSOUND(v); + _vm->_globals.chemin = PTRNUL; + _vm->_globals.NOMARCHE = 1; + _vm->_globals.SORTIE = 0; + _vm->_globals.AFFLI = 0; + _vm->_globals.AFFIVBL = 0; + if (!s1.empty()) + _vm->_graphicsManager.LOAD_IMAGE(s1); + if (!s2.empty()) + INILINK(s2); + if (!s3.empty()) + _vm->_animationManager.CHARGE_ANIM(s3); + _vm->_graphicsManager.VISU_ALL(); + if (!s4.empty()) { + if (!_vm->_globals.NOSPRECRAN) + _vm->_graphicsManager.INI_ECRAN(s4); + if (!s4.empty() && _vm->_globals.NOSPRECRAN == 1) + _vm->_graphicsManager.INI_ECRAN2(s4); + } + _vm->_eventsManager.MOUSE_ON(); + if (_vm->_globals.ECRAN == 61) { + SPRITE(_vm->_globals.PERSO, 330, 418, 0, 60, 0, 0, 34, 190); + SPRITE_ON(0); + _vm->_globals.chemin = PTRNUL; + VERIFTAILLE(); + } + _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + _vm->_eventsManager.CHANGE_MOUSE(4); + _vm->_globals.BPP_NOAFF = 1; + v6 = 0; + do { + _vm->_eventsManager.VBL(); + ++v6; + } while (v6 <= 4); + _vm->_globals.BPP_NOAFF = 0; + _vm->_graphicsManager.FADE_INW(); + if (_vm->_globals.ECRAN == 61) { + _vm->_soundManager.PLAY_SEQ(0, "OUVRE.SEQ", 10, 4, 10); + BOBANIM_OFF(3); + _vm->_globals.NOT_VERIF = 1; + g_old_x = XSPR(0); + g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.chemin = PTRNUL; + v7 = YSPR(0); + v8 = XSPR(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v8, v7, 330, 345); + _vm->_globals.NOT_VERIF = 1; + do { + GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != PTRNUL); + SETANISPR(0, 64); + } + do { + v9 = _vm->_eventsManager.BMOUSE(); + if (v9 == 1) { + BTGAUCHE(); + v9 = 1; + } + if (v9 == 2) + BTDROITE(); + TEST_INVENT(); + VERIFZONE(); + if (GOACTION == 1) + PARADISE(); + if (!_vm->_globals.SORTIE) { + _vm->_eventsManager.VBL(); + if (!_vm->_globals.SORTIE) + continue; + } + v5 = 1; + } while (v5 != 1); + _vm->_graphicsManager.FADE_OUTW(); + if (!s3.empty()) + _vm->_graphicsManager.FIN_VISU(); + if (_vm->_globals.ECRAN == 61) + SPRITE_OFF(0); + CLEAR_ECRAN(); + _vm->_globals.iRegul = 0; +} + +void ObjectsManager::PERSONAGE2(const Common::String &s1, const Common::String &s2, const Common::String &s3, + const Common::String &s4, int v) { + Common::String v5; + int v6; + int v7; + int v8; + int v10; + int v11; + int v12; + int v13; + int xp, yp; + + v5 = s2; + INVENTFLAG = 0; + KEY_INVENT = 0; + _vm->_objectsManager.verbe = 4; + _vm->_globals.MAX_COMPTE = 6; + _vm->_graphicsManager.ofscroll = 0; + VIRE_INVENT = 0; + v11 = 0; + v12 = 0; + _vm->_globals.PLAN_FLAG = 0; + _vm->_graphicsManager.NOFADE = 0; + _vm->_globals.NOMARCHE = 0; + _vm->_globals.SORTIE = 0; + _vm->_globals.AFFLI = 0; + _vm->_globals.AFFIVBL = 0; + _vm->_globals.NOT_VERIF = 1; + _vm->_soundManager.WSOUND(v); + _vm->_globals.iRegul = 1; + if (!s1.empty()) + _vm->_graphicsManager.LOAD_IMAGE(s1); + if (!s2.empty()) + _vm->_objectsManager.INILINK(s2); + if (!s3.empty()) { + _vm->_animationManager.CHARGE_ANIM(s3); + _vm->_graphicsManager.VISU_ALL(); + } + if (!s4.empty()) { + if (!_vm->_globals.NOSPRECRAN) + _vm->_graphicsManager.INI_ECRAN(s4); + if (!s4.empty() && _vm->_globals.NOSPRECRAN == 1) + _vm->_graphicsManager.INI_ECRAN2(s4); + } + _vm->_eventsManager.MOUSE_ON(); + _vm->_eventsManager.btsouris = 4; + _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + if (!_vm->_globals.PERSO_TYPE) + goto LABEL_70; + if (!_vm->_globals.SAUVEGARDE->data[svField122] && !_vm->_globals.SAUVEGARDE->data[svField356]) { + FileManager::CONSTRUIT_SYSTEM("PERSO.SPR"); + FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_globals.PERSO_TYPE = 0; + } + if (!_vm->_globals.PERSO_TYPE) { +LABEL_70: + if (_vm->_globals.SAUVEGARDE->data[svField122] == 1) { + FileManager::CONSTRUIT_SYSTEM("HOPFEM.SPR"); + FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_globals.PERSO_TYPE = 1; + } + } + if (_vm->_globals.PERSO_TYPE != 2 && _vm->_globals.SAUVEGARDE->data[svField356] == 1) { + FileManager::CONSTRUIT_SYSTEM("PSAMAN.SPR"); + FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_globals.PERSO_TYPE = 2; + } + _vm->_globals.HOPKINS_DATA(); + if (!_vm->_globals.PERSO_TYPE) + SPRITE(_vm->_globals.PERSO, _vm->_objectsManager.PERX, _vm->_objectsManager.PERY, 0, _vm->_objectsManager.PERI, 0, 0, 34, 190); + if (_vm->_globals.PERSO_TYPE == 1) + SPRITE(_vm->_globals.PERSO, _vm->_objectsManager.PERX, _vm->_objectsManager.PERY, 0, _vm->_objectsManager.PERI, 0, 0, 28, 155); + if (_vm->_globals.PERSO_TYPE == 2) + SPRITE(_vm->_globals.PERSO, _vm->_objectsManager.PERX, _vm->_objectsManager.PERY, 0, _vm->_objectsManager.PERI, 0, 0, 20, 127); + _vm->_eventsManager.souris_xy(_vm->_objectsManager.PERX, _vm->_objectsManager.PERY); + if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) + _vm->_graphicsManager.SCROLL = (signed __int16)XSPR(0) - 320; + _vm->_objectsManager.VERIFTAILLE(); + SPRITE_ON(0); + _vm->_globals.CACHE_ON(); + _vm->_globals.chemin = PTRNUL; + _vm->_objectsManager.VERIFTAILLE(); + SPECIAL_INI(s2); + _vm->_eventsManager.souris_n = 4; + g_old_x = _vm->_objectsManager.PERX; + g_old_y = _vm->_objectsManager.PERY; + g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.BPP_NOAFF = 1; + v6 = 0; + do { + _vm->_eventsManager.VBL(); + ++v6; + } while (v6 <= 4); + _vm->_globals.BPP_NOAFF = 0; + _vm->_globals.iRegul = 1; + if (!_vm->_graphicsManager.NOFADE) + _vm->_graphicsManager.FADE_INW(); + _vm->_graphicsManager.NOFADE = 0; + _vm->_eventsManager.CHANGE_MOUSE(4); + v13 = 0; + do { + v7 = _vm->_eventsManager.BMOUSE(); + v8 = v7; + if (v7) { + if (v7 == 1) { + if (_vm->_objectsManager.verbe == 16 && _vm->_eventsManager.btsouris == 16) { + xp = _vm->_eventsManager.XMOUSE(); + yp = _vm->_eventsManager.YMOUSE(); + v10 = yp; + if (v12 == xp) { + if (v11 == yp) { + _vm->_globals.chemin = PTRNUL; + _vm->_objectsManager.PARADISE(); + if (_vm->_globals.SORTIE) + v13 = 1; + } + } + v12 = xp; + v11 = v10; + } + _vm->_objectsManager.BTGAUCHE(); + } + if (v8 == 2) + _vm->_objectsManager.BTDROITE(); + } + if (!_vm->_globals.SORTIE) { + TEST_INVENT(); + _vm->_objectsManager.VERIFZONE(); + if (_vm->_globals.chemin == PTRNUL || (_vm->_objectsManager.GOHOME(), _vm->_globals.chemin == PTRNUL)) { + if (_vm->_objectsManager.GOACTION == 1) + _vm->_objectsManager.PARADISE(); + } + SPECIAL_JEU(); + _vm->_eventsManager.VBL(); + if (!_vm->_globals.SORTIE) + continue; + } + v13 = 1; + } while (v13 != 1); + if (_vm->_globals.SORTIE != 8 || _vm->_globals.ECRAN != 5 || _vm->_globals.HELICO != 1) { + if (!_vm->_graphicsManager.NOFADE) + _vm->_graphicsManager.FADE_OUTW(); + _vm->_graphicsManager.NOFADE = 0; + SPRITE_OFF(0); + _vm->_globals.AFFLI = 0; + if (DEUXPERSO == 1) { + SPRITE_OFF(1); + DEUXPERSO = 0; + } + if (!s3.empty()) + _vm->_graphicsManager.FIN_VISU(); + CLEAR_ECRAN(); + } else { + _vm->_globals.HELICO = 0; + } + _vm->_globals.iRegul = 0; +} } // End of namespace Hopkins |