diff options
author | Strangerke | 2012-12-17 08:01:29 +0100 |
---|---|---|
committer | Strangerke | 2012-12-17 08:01:29 +0100 |
commit | 1182885d127774895246e52d0fef435ff71a8441 (patch) | |
tree | 0f6090dff303b1077e164391bd56ee279ec27aa9 /engines/hopkins | |
parent | e99d5b320a3e2737d0bb6aa9d4c401b2c3116beb (diff) | |
download | scummvm-rg350-1182885d127774895246e52d0fef435ff71a8441.tar.gz scummvm-rg350-1182885d127774895246e52d0fef435ff71a8441.tar.bz2 scummvm-rg350-1182885d127774895246e52d0fef435ff71a8441.zip |
HOPKINS: Some renaming, rework some loop statements
Diffstat (limited to 'engines/hopkins')
-rw-r--r-- | engines/hopkins/computer.cpp | 8 | ||||
-rw-r--r-- | engines/hopkins/dialogs.cpp | 8 | ||||
-rw-r--r-- | engines/hopkins/events.cpp | 6 | ||||
-rw-r--r-- | engines/hopkins/globals.cpp | 8 | ||||
-rw-r--r-- | engines/hopkins/globals.h | 4 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 60 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 44 | ||||
-rw-r--r-- | engines/hopkins/script.cpp | 8 | ||||
-rw-r--r-- | engines/hopkins/talk.cpp | 107 | ||||
-rw-r--r-- | engines/hopkins/talk.h | 4 |
10 files changed, 117 insertions, 140 deletions
diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 165f4c3b3b..6616ebbb59 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -579,7 +579,7 @@ void ComputerManager::readText(int idx) { ++v7; } ++v10; - } while (v4 != 37); + } while (v4 != '%'); _vm->_eventsManager.waitKeyPress(); ptr = _vm->_globals.freeMemory(ptr); @@ -590,9 +590,9 @@ void ComputerManager::readText(int idx) { */ void ComputerManager::displayGamesSubMenu() { const byte *v1 = _vm->_objectsManager._sprite[0]._spriteData; - uint oldSpeed = _vm->_globals.vitesse; + uint oldSpeed = _vm->_globals._speed; - _vm->_globals.vitesse = 1; + _vm->_globals._speed = 1; _vm->_eventsManager.changeMouseCursor(0); _breakoutSpr = g_PTRNUL; _vm->_eventsManager._breakoutFl = true; @@ -625,7 +625,7 @@ void ComputerManager::displayGamesSubMenu() { _vm->_soundManager.DEL_SAMPLE(1); _vm->_soundManager.DEL_SAMPLE(2); _vm->_soundManager.DEL_SAMPLE(3); - _vm->_globals.vitesse = oldSpeed; + _vm->_globals._speed = oldSpeed; _vm->_eventsManager._breakoutFl = false; setVideoMode(); setTextColor(15); diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 2c17d24e2e..9cb647b112 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -233,7 +233,7 @@ void DialogsManager::showOptionsDialog() { } if (mousePos.x >= _vm->_graphicsManager.ofscroll + 348 && mousePos.y > 248 && mousePos.x <= _vm->_graphicsManager.ofscroll + 394 && mousePos.y <= 273) - _vm->_globals.vitesse = 2; + _vm->_globals._speed = 2; if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 221 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 246) _vm->_globals.SVGA = 2; if (mousePos.x < _vm->_graphicsManager.ofscroll + 165 || mousePos.x > _vm->_graphicsManager.ofscroll + 496 || (uint)(mousePos.y - 107) > 0xD3u) @@ -245,11 +245,11 @@ void DialogsManager::showOptionsDialog() { else if (_vm->_graphicsManager.MANU_SCROLL == 1) _vm->_globals.opt_scrtype = 1; - if (_vm->_globals.vitesse == 1) + if (_vm->_globals._speed == 1) _vm->_globals.opt_vitesse = 6; - else if (_vm->_globals.vitesse == 2) + else if (_vm->_globals._speed == 2) _vm->_globals.opt_vitesse = 5; - else if (_vm->_globals.vitesse == 3) + else if (_vm->_globals._speed == 3) _vm->_globals.opt_vitesse = 4; _vm->_globals.opt_txt = !_vm->_soundManager.TEXTOFF ? 7 : 8; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index ba43e182ee..311ab92686 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -400,7 +400,7 @@ LABEL_45: _vm->_eventsManager.updateCursor(); _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v12, v11); LABEL_54: - _vm->_globals.vitesse = 2; + _vm->_globals._speed = 2; do { while (!_vm->shouldQuit()) { checkForNextFrameCounter(); @@ -413,7 +413,7 @@ LABEL_54: if (_rateCounter > 1) goto LABEL_65; } - if (_vm->_globals.vitesse != 2) + if (_vm->_globals._speed != 2) break; if (_rateCounter > 9) goto LABEL_65; @@ -422,7 +422,7 @@ LABEL_63: ; } while (!_vm->shouldQuit() && _vm->_globals.iRegul == 3 && _rateCounter <= 15); LABEL_65: - _vm->_globals.vitesse = 2; + _vm->_globals._speed = 2; _rateCounter = 0; if (!_vm->_graphicsManager.DOUBLE_ECRAN || _vm->_graphicsManager.no_scroll == 1) { _vm->_graphicsManager.Affiche_Segment_Vesa(); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 82da133636..6010ed7574 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -116,10 +116,10 @@ Globals::Globals() { // Initialise fields FR = 0; SVGA = 2; - internet = true; + _internetFl = true; PUBEXIT = false; - vitesse = 1; + _speed = 1; INSTALL_TYPE = 1; MUSICVOL = 6; SOUNDVOL = 6; @@ -317,9 +317,9 @@ void Globals::setConfig() { } if (_vm->getIsDemo()) - internet = true; + _internetFl = true; else - internet = false; + _internetFl = false; // End of CHECKME switch (FR) { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 8aa49af756..937483f6bb 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -336,10 +336,10 @@ public: TriItem Tri[51]; int FR; int SVGA; - bool internet; + bool _internetFl; bool PUBEXIT; int PERSO_TYPE; - uint vitesse; + uint _speed; int INSTALL_TYPE; Common::String HOPIMAGE; Common::String HOPANIM; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 2780b68113..49e4996f4c 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -155,7 +155,7 @@ bool HopkinsEngine::runWin95Demo() { warning("TODO Init_Interrupt_();"); _globals.iRegul = 1; - _globals.vitesse = 1; + _globals._speed = 1; for (int i = 1; i < 50; i++) { _graphicsManager.SCOPY(_graphicsManager.VESA_SCREEN, 0, 0, 640, 440, _graphicsManager.VESA_BUFFER, 0, 0); @@ -168,10 +168,10 @@ bool HopkinsEngine::runWin95Demo() { warning("TODO TEST = 0;"); // if (SPEEDJ > 475) if (_eventsManager._rateCounter > 475) - _globals.vitesse = 2; + _globals._speed = 2; // if (SPEEDJ > 700) if (_eventsManager._rateCounter > 700) - _globals.vitesse = 3; + _globals._speed = 3; warning("TODO Fin_Interrupt_();"); warning("TODO Init_Interrupt_();"); _graphicsManager.FADE_OUTW(); @@ -470,7 +470,7 @@ bool HopkinsEngine::runLinuxDemo() { _eventsManager.delay(1500); _graphicsManager.FADE_OUTW(); - if (!_globals.internet) { + if (!_globals._internetFl) { _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("MP.ANM", 10, 16, 200); } @@ -2563,7 +2563,7 @@ bool HopkinsEngine::runLinuxFull() { _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); - _globals.vitesse = 2; + _globals._speed = 2; _globals.iRegul = 1; _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("MP.ANM", 10, 16, 200); @@ -3606,7 +3606,7 @@ void HopkinsEngine::INTRORUN() { _globals.BPP_NOAFF = false; _globals.iRegul = 1; _graphicsManager.FADE_INW(); - for (uint i = 0; i < 200 / _globals.vitesse; ++i) + for (uint i = 0; i < 200 / _globals._speed; ++i) _eventsManager.VBL(); _objectsManager.BOBANIM_ON(3); @@ -3691,24 +3691,24 @@ void HopkinsEngine::INTRORUN() { v9 += 2; if (v9 > 15) { _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager.VESA_BUFFER); - for (uint j = 1; j < 100 / _globals.vitesse; ++j) + for (uint j = 1; j < 100 / _globals._speed; ++j) _eventsManager.VBL(); _objectsManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(7, 3); _objectsManager.BOBANIM_OFF(3); - for (uint k = 1; k < 60 / _globals.vitesse; ++k) + for (uint k = 1; k < 60 / _globals._speed; ++k) _eventsManager.VBL(); _objectsManager.BOBANIM_ON(5); - for (uint l = 0; l < 20 / _globals.vitesse; ++l) + for (uint l = 0; l < 20 / _globals._speed; ++l) _eventsManager.VBL(); Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager.Palette[0]); _graphicsManager.setpal_vga256_linux(_graphicsManager.Palette, _graphicsManager.VESA_BUFFER); - for (uint m = 0; m < 50 / _globals.vitesse; ++m) { - if (m == 30 / _globals.vitesse) { + for (uint m = 0; m < 50 / _globals._speed; ++m) { + if (m == 30 / _globals._speed) { _objectsManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(8, 3); _objectsManager.BOBANIM_OFF(3); @@ -4125,7 +4125,7 @@ void HopkinsEngine::JOUE_FIN() { if (!_eventsManager._escKeyFl) { do _eventsManager.refreshEvents(); - while (_eventsManager._rateCounter < 2000 / _globals.vitesse && !_eventsManager._escKeyFl); + while (_eventsManager._rateCounter < 2000 / _globals._speed && !_eventsManager._escKeyFl); } _eventsManager._escKeyFl = false; _graphicsManager.FADE_OUTW(); @@ -4539,11 +4539,11 @@ void HopkinsEngine::BTOCEAN() { _globals.SORTIE = 1; int oldX = _objectsManager.getSpriteX(0); for (;;) { - if (_globals.vitesse == 1) + if (_globals._speed == 1) oldX -= 2; - else if (_globals.vitesse == 2) + else if (_globals._speed == 2) oldX -= 4; - else if (_globals.vitesse == 3) + else if (_globals._speed == 3) oldX -= 6; _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); @@ -4571,11 +4571,11 @@ LABEL_22: _globals.SORTIE = 2; int oldX = _objectsManager.getSpriteX(0); for (;;) { - if (_globals.vitesse == 1) + if (_globals._speed == 1) oldX += 2; - else if (_globals.vitesse == 2) + else if (_globals._speed == 2) oldX += 4; - else if (_globals.vitesse == 3) + else if (_globals._speed == 3) oldX += 6; _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); @@ -4596,11 +4596,11 @@ LABEL_41: if (_globals.OCEAN_SENS == 3) { int oldX = _objectsManager.getSpriteX(0); do { - if (_globals.vitesse == 1) + if (_globals._speed == 1) oldX += 2; - else if (_globals.vitesse == 2) + else if (_globals._speed == 2) oldX += 4; - else if (_globals.vitesse == 3) + else if (_globals._speed == 3) oldX += 6; _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); @@ -4621,11 +4621,11 @@ LABEL_57: if (_globals.OCEAN_SENS == 7) { int oldX = _objectsManager.getSpriteX(0); do { - if (_globals.vitesse == 1) + if (_globals._speed == 1) oldX -= 2; - else if (_globals.vitesse == 2) + else if (_globals._speed == 2) oldX -= 4; - else if (_globals.vitesse == 3) + else if (_globals._speed == 3) oldX -= 6; _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); @@ -4652,11 +4652,11 @@ LABEL_72: if (_globals.OCEAN_SENS == 3) { int oldX = _objectsManager.getSpriteX(0); do { - if (_globals.vitesse == 1) + if (_globals._speed == 1) oldX += 2; - else if (_globals.vitesse == 2) + else if (_globals._speed == 2) oldX += 4; - else if (_globals.vitesse == 3) + else if (_globals._speed == 3) oldX += 6; _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); @@ -4677,11 +4677,11 @@ LABEL_91: if (_globals.OCEAN_SENS == 7) { int oldX = _objectsManager.getSpriteX(0); for (;;) { - if (_globals.vitesse == 1) + if (_globals._speed == 1) oldX -= 2; - else if (_globals.vitesse == 2) + else if (_globals._speed == 2) oldX -= 4; - else if (_globals.vitesse == 3) + else if (_globals._speed == 3) oldX -= 6; _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 6e3aa4f2e5..1f38b74582 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1217,8 +1217,8 @@ void ObjectsManager::AFF_BOB_ANIM() { v5 = _vm->_globals.Bob[idx].field12; if (v5 > 0) { - v6 = v5 / _vm->_globals.vitesse; - _vm->_globals.Bob[idx].field12 = v5 / _vm->_globals.vitesse; + v6 = v5 / _vm->_globals._speed; + _vm->_globals.Bob[idx].field12 = v5 / _vm->_globals._speed; if (v6 > 0) { LABEL_37: _vm->_globals.Bob[idx].field14 = 1; @@ -1258,8 +1258,8 @@ LABEL_38: v10 = _vm->_globals.Bob[idx].field12; if (v10 > 0) { - v11 = v10 / _vm->_globals.vitesse; - _vm->_globals.Bob[idx].field12 = v10 / _vm->_globals.vitesse; + v11 = v10 / _vm->_globals._speed; + _vm->_globals.Bob[idx].field12 = v10 / _vm->_globals._speed; // Original code. It can't be negative, so the check is on == 0 if (v11 <= 0) _vm->_globals.Bob[idx].field12 = 1; @@ -1870,7 +1870,7 @@ LABEL_241: } v1 = 24; LABEL_23: - _vm->_globals.Compteur = 5 / _vm->_globals.vitesse; + _vm->_globals.Compteur = 5 / _vm->_globals._speed; } if (_vm->_globals.g_old_sens != 7) goto LABEL_43; @@ -1908,7 +1908,7 @@ LABEL_23: } v1 = 24; LABEL_42: - _vm->_globals.Compteur = 5 / _vm->_globals.vitesse; + _vm->_globals.Compteur = 5 / _vm->_globals._speed; LABEL_43: if (_vm->_globals.g_old_sens != 1) goto LABEL_60; @@ -1940,7 +1940,7 @@ LABEL_43: } v1 = 0; LABEL_59: - _vm->_globals.Compteur = 4 / _vm->_globals.vitesse; + _vm->_globals.Compteur = 4 / _vm->_globals._speed; LABEL_60: if (_vm->_globals.g_old_sens != 5) goto LABEL_77; @@ -1972,7 +1972,7 @@ LABEL_60: } v1 = 48; LABEL_76: - _vm->_globals.Compteur = 4 / _vm->_globals.vitesse; + _vm->_globals.Compteur = 4 / _vm->_globals._speed; LABEL_77: if (_vm->_globals.g_old_sens != 2) goto LABEL_96; @@ -2010,7 +2010,7 @@ LABEL_77: } v1 = 12; LABEL_95: - _vm->_globals.Compteur = 5 / _vm->_globals.vitesse; + _vm->_globals.Compteur = 5 / _vm->_globals._speed; LABEL_96: if (_vm->_globals.g_old_sens != 8) goto LABEL_115; @@ -2048,7 +2048,7 @@ LABEL_96: } v1 = 12; LABEL_114: - _vm->_globals.Compteur = 5 / _vm->_globals.vitesse; + _vm->_globals.Compteur = 5 / _vm->_globals._speed; LABEL_115: if (_vm->_globals.g_old_sens != 4) goto LABEL_134; @@ -2086,7 +2086,7 @@ LABEL_115: } v1 = 36; LABEL_133: - _vm->_globals.Compteur = 5 / _vm->_globals.vitesse; + _vm->_globals.Compteur = 5 / _vm->_globals._speed; LABEL_134: if (_vm->_globals.g_old_sens != 6) goto LABEL_153; @@ -2124,7 +2124,7 @@ LABEL_134: } v1 = 36; LABEL_152: - _vm->_globals.Compteur = 5 / _vm->_globals.vitesse; + _vm->_globals.Compteur = 5 / _vm->_globals._speed; LABEL_153: v47 = 0; do { @@ -2247,9 +2247,9 @@ void ObjectsManager::GOHOME2() { if (_vm->_globals.chemin != (int16 *)g_PTRNUL) { int v0 = 2; - if (_vm->_globals.vitesse == 2) + if (_vm->_globals._speed == 2) v0 = 4; - else if (_vm->_globals.vitesse == 3) + else if (_vm->_globals._speed == 3) v0 = 6; _vm->_globals.j_104 = 0; if (v0) { @@ -4264,11 +4264,11 @@ void ObjectsManager::BOB_VIVANT(int idx) { v4 = *(_vm->_talkManager.ADR_ANIM + 2 * v1 + 8); if ((int16)READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1 + 4)) { if (!_vm->_globals.NO_OFFSET) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager.PERSOSPR, + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager._characterSprite, _vm->_graphicsManager.ofscroll + v2, v3, *(_vm->_talkManager.ADR_ANIM + 2 * v1 + 8)); if (_vm->_globals.NO_OFFSET) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager.PERSOSPR, v2, v3, v4); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager._characterSprite, v2, v3, v4); } } @@ -5165,9 +5165,9 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in v13 = 0; v15 = a5; v19 = " "; - if (_vm->_globals.vitesse == 2) + if (_vm->_globals._speed == 2) v15 = a5 / 2; - else if (_vm->_globals.vitesse == 3) + else if (_vm->_globals._speed == 3) v15 = a5 / 3; v14 = _sprite[0]._spriteData; spriteIndex = _sprite[0]._spriteIndex; @@ -5232,9 +5232,9 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int spriteIndex = 0; v16 = " "; v14 = a5; - if (_vm->_globals.vitesse == 2) + if (_vm->_globals._speed == 2) v14 = a5 / 2; - else if (_vm->_globals.vitesse == 3) + else if (_vm->_globals._speed == 3) v14 = a5 / 3; S_old_spr = _sprite[0]._spriteData; S_old_ani = _sprite[0]._spriteIndex; @@ -5299,9 +5299,9 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a spriteIndex = 0; v15 = " "; v13 = a5; - if (_vm->_globals.vitesse == 2) + if (_vm->_globals._speed == 2) v13 = a5 / 2; - else if (_vm->_globals.vitesse == 3) + else if (_vm->_globals._speed == 3) v13 = a5 / 3; for (;;) { v6 = 0; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 52140d5c5f..54212b992d 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -185,7 +185,7 @@ LABEL_104: goto LABEL_1141; _vm->_objectsManager.VBOB(_vm->_globals.SPRITE_ECRAN, v72, v68, v66, v70); if (v4) - v4 /= _vm->_globals.vitesse; + v4 /= _vm->_globals._speed; if (v4 > 1) { do { if (_vm->shouldQuit()) @@ -477,7 +477,7 @@ LABEL_1141: if (*(a1 + 2) == 'M' && *(a1 + 3) == 'U' && *(a1 + 4) == 'S') v1 = 1; if (*(a1 + 2) == 'W' && *(a1 + 3) == 'A' && *(a1 + 4) == 'I') { - uint v74 = READ_LE_UINT16(a1 + 5) / _vm->_globals.vitesse; + uint v74 = READ_LE_UINT16(a1 + 5) / _vm->_globals._speed; if (!v74) v74 = 1; if (v74 + 1 > 0) { @@ -547,7 +547,7 @@ LABEL_1141: _vm->_talkManager.PARLER_PERSO("bqetueur.pe2"); } if (v76 == 600) { - if (!_vm->_globals.internet) { + if (!_vm->_globals._internetFl) { _vm->_graphicsManager.FADE_LINUX = 2; _vm->_graphicsManager.FADESPD = 1; if (_vm->_globals.SVGA == 2) @@ -638,7 +638,7 @@ LABEL_1141: _vm->_globals.SORTIE = 6; } if (v76 == 607) { - if (!_vm->_globals.internet) { + if (!_vm->_globals._internetFl) { memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 0x301u); v1 = _vm->_graphicsManager.OLD_PAL[769]; _vm->_animationManager.playAnim2("PLAN.ANM", 50, 10, 800); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 0a89e9db31..2fb083baef 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -36,7 +36,7 @@ namespace Hopkins { TalkManager::TalkManager() { BUFFERPERSO = NULL; PALPERSO = NULL; - PERSOSPR = NULL; + _characterSprite = NULL; ADR_ANIM = NULL; TAILLEPERSO = 0; STATI = 0; @@ -54,12 +54,10 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { int v3; int v4; int v5; - int v6; int v7; byte *v8; byte *v9; byte *v10; - int v11; int v14; int v15; Common::String v16; @@ -92,15 +90,15 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { v2 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 40); v3 = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; - PERSOSPR = _vm->_fileManager.searchCat(v16, 7); - if (PERSOSPR) { + _characterSprite = _vm->_fileManager.searchCat(v16, 7); + if (_characterSprite) { _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, v16); } else { _vm->_globals.CAT_FLAG = true; _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, "RES_SAN.RES"); } - PERSOSPR = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); + _characterSprite = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); @@ -115,7 +113,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_objectsManager.PERSO_ON = true; CHERCHE_PAL(v3, 0); CHERCHE_ANIM0(v3, 0); - ANIM_PERSO_INIT(); + initCharacterAnim(); PLIGNE1 = v2; PLIGNE2 = v2 + 1; PLIGNE3 = v2 + 2; @@ -135,7 +133,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { } while (v5 != v4); } if (_vm->_globals.NOPARLE == true) { - v6 = 1; + int v6 = 1; do v7 = DIALOGUE_REP(v6++); while (v7 != -1); @@ -144,7 +142,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_globals.NOPARLE = false; _vm->_globals.NECESSAIRE = true; BUFFERPERSO = _vm->_globals.freeMemory(BUFFERPERSO); - PERSOSPR = _vm->_globals.freeMemory(PERSOSPR); + _characterSprite = _vm->_globals.freeMemory(_characterSprite); _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = false; @@ -176,11 +174,8 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { v10 = v8 + 1; _vm->_globals._disableInventFl = oldDisableInventFl; _vm->_graphicsManager.DD_VBL(); - v11 = 0; - do { + for (int i = 0; i <= 4; i++) _vm->_eventsManager.VBL(); - ++v11; - } while (v11 <= 4); _vm->_graphicsManager.no_scroll = 0; } @@ -617,8 +612,6 @@ void TalkManager::FIN_VISU_PARLE() { } int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { - int v6; - int v7; char v8; int v9; int v10; @@ -666,8 +659,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { f.close(); v19 = ptr; - v6 = 0; - do { + for (int i = 0; i < 2048; i++) { v13 = *v19; if ((byte)(*v19 + 46) > 0x1Bu) { if ((byte)(v13 + 80) > 0x1Bu) { @@ -681,16 +673,13 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { } *v19 = v13; v19 = v19 + 1; - ++v6; - } while ((unsigned int)v6 < 0x800); + } - v7 = 0; - do { - v8 = *(ptr + v7); + for (int i = 0; i < 2048; i++) { + v8 = ptr[i]; if ( v8 == 10 || v8 == 13 ) - *(ptr + v7) = 0; - ++v7; - } while ((unsigned int)v7 < 0x800); + ptr[i] = 0; + } v9 = 0; v15 = (11 * a3) - 4; @@ -703,6 +692,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { v14 = v11; ++v10; } while (v11 != 32 && v11 != 37); + if (v10 >= v15 / _vm->_globals.police_l) break; if (v11 == 37) { @@ -749,8 +739,8 @@ void TalkManager::BOB_VISU_PARLE(int idx) { _vm->_globals.Bob[idx].field38 = 0; _vm->_globals.Bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; _vm->_globals.Bob[idx].field0 = 10; - v5 = PERSOSPR; - _vm->_globals.Bob[idx]._spriteData = PERSOSPR; + v5 = _characterSprite; + _vm->_globals.Bob[idx]._spriteData = _characterSprite; _vm->_globals.Bob[idx].field1E = v4; _vm->_globals.Bob[idx].field20 = -1; _vm->_globals.Bob[idx].field22 = 0; @@ -795,15 +785,18 @@ void TalkManager::CHERCHE_ANIM0(int a1, int a2) { v6 = 0; do { v7 = (int16)READ_LE_UINT16(&v8[2 * v6 + 4]); - if (v7 && _vm->_globals.vitesse != 501) - _vm->_graphicsManager.AFFICHE_SPEED(PERSOSPR, _vm->_eventsManager._startPos.x + (int16)READ_LE_UINT16(&v8[2 * v6]), + if (v7 && _vm->_globals._speed != 501) + _vm->_graphicsManager.AFFICHE_SPEED(_characterSprite, _vm->_eventsManager._startPos.x + (int16)READ_LE_UINT16(&v8[2 * v6]), (int16)READ_LE_UINT16(&v8[2 * v6 + 2]), v9[2 * v6 + 8]); v6 += 5; - } while (_vm->_globals.vitesse != 501 && v7); + } while (_vm->_globals._speed != 501 && v7); } } -void TalkManager::ANIM_PERSO_INIT() { +/** + * Initialize character animation + */ +void TalkManager::initCharacterAnim() { byte *v0; byte *v1; int v2; @@ -874,7 +867,6 @@ bool TalkManager::searchCharacterAnim(int a1, const byte *bufPerso, int a3, int int v16; char v17; int v18; - int v19; int v20; int v22; int v23; @@ -923,8 +915,7 @@ bool TalkManager::searchCharacterAnim(int a1, const byte *bufPerso, int a3, int WRITE_LE_UINT16(v8 + 24, v23); WRITE_LE_UINT16(v8 + 26, v12); *(v8 + 28) = v13; - v19 = 1; - do { + for (int i = 1; i < 5000; i++) { v9 += 10; v24 += 10; if (!v23) @@ -940,8 +931,7 @@ bool TalkManager::searchCharacterAnim(int a1, const byte *bufPerso, int a3, int WRITE_LE_UINT16(v9 + 4, v23); WRITE_LE_UINT16(v9 + 6, v16); *(v9 + 8) = v17; - ++v19; - } while (v19 <= 4999); + } result = 1; } if (*(bufPerso + v22) == 'F' && *(bufPerso + v22 + 1) == 'I' && *(bufPerso + v22 + 2) == 'N') @@ -977,15 +967,9 @@ LABEL_2: if (_vm->_globals.COUCOU != g_PTRNUL) { v5 = _vm->_globals.COUCOU; for (;;) { - if (*v5 == 'C') { - if (*(v5 + 1) == 'O') { - if (*(v5 + 2) == 'D') { - if (*(v5 + 3) == v2) { - if (*(v5 + 4) == v3) - v15 = 1; - } - } - } + if ((*v5 == 'C') && (*(v5 + 1) == 'O') && (*(v5 + 2) == 'D')) { + if ((*(v5 + 3) == v2) && (*(v5 + 4) == v3)) + v15 = 1; } if (*v5 == 'F' && *(v5 + 1) == 'I' && *(v5 + 2) == 'N') break; @@ -1174,18 +1158,15 @@ void TalkManager::REPONSE2(int a1, int a2) { } void TalkManager::OBJET_VIVANT(const Common::String &a2) { - int v2; const char *v4; int v5; bool v6; int v10; byte *v11; int v12; - int v13; byte *v14; byte *v15; byte *v16; - int v17; Common::String s; Common::String v20; Common::String v22; @@ -1198,10 +1179,10 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_linesManager.CLEAR_ZONE(); _vm->_linesManager.RESET_OBSTACLE(); _vm->_globals.RESET_CACHE(); - v2 = 0; - do - _vm->_globals.BOBZONE[v2++] = 0; - while (v2 <= 44); + + for (int i = 0; i <= 44; i++) + _vm->_globals.BOBZONE[i] = 0; + _vm->_objectsManager.NUMZONE = -1; _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(0); @@ -1222,15 +1203,15 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { if (!v6) { v20 = Common::String::format("IM%d", _vm->_globals.ECRAN); } - PERSOSPR = _vm->_fileManager.searchCat(v23, 7); - if (PERSOSPR) { + _characterSprite = _vm->_fileManager.searchCat(v23, 7); + if (_characterSprite) { _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, v23); } else { _vm->_globals.CAT_FLAG = true; _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, "RES_SAN.RES"); } - PERSOSPR = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); + _characterSprite = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); @@ -1255,7 +1236,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_objectsManager.PERSO_ON = true; _vm->_globals.GOACTION = 0; _vm->_objectsManager.NUMZONE = -1; - ANIM_PERSO_INIT(); + initCharacterAnim(); VISU_PARLE(); VISU_WAIT(); _vm->_graphicsManager.INI_ECRAN2(v22); @@ -1282,16 +1263,15 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_globals.NOPARLE = false; _vm->_globals.NECESSAIRE = true; BUFFERPERSO = _vm->_globals.freeMemory(BUFFERPERSO); - PERSOSPR = _vm->_globals.freeMemory(PERSOSPR); + _characterSprite = _vm->_globals.freeMemory(_characterSprite); _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = false; _vm->_linesManager.CLEAR_ZONE(); _vm->_linesManager.RESET_OBSTACLE(); _vm->_globals.RESET_CACHE(); - v13 = 0; - do - _vm->_globals.BOBZONE[v13++] = 0; - while (v13 <= 44); + for (int i = 0; i <= 44; i++) + _vm->_globals.BOBZONE[i] = 0; + _vm->_globals.freeMemory(_vm->_globals.COUCOU); _vm->_globals.COUCOU = v11; _vm->_objectsManager.DESACTIVE = true; @@ -1330,11 +1310,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { v16 = v14 + 1; _vm->_globals._disableInventFl = false; _vm->_graphicsManager.DD_VBL(); - v17 = 0; - do { + for (int i = 0; i <= 4; i++) _vm->_eventsManager.VBL(); - ++v17; - } while (v17 <= 4); _vm->_graphicsManager.no_scroll = 0; } diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index 3b0ec674ff..3cb680d866 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -38,7 +38,7 @@ public: Common::String FREPON; byte *BUFFERPERSO; byte *PALPERSO; - byte *PERSOSPR; + byte *_characterSprite; byte *ADR_ANIM; size_t TAILLEPERSO; int STATI; @@ -62,7 +62,7 @@ public: void VISU_PARLE(); void BOB_VISU_PARLE(int idx); void CHERCHE_ANIM0(int a1, int a2); - void ANIM_PERSO_INIT(); + void initCharacterAnim(); void clearCharacterAnim(); bool searchCharacterAnim(int a1, const byte *a2, int a3, int a4); void REPONSE(int a1, int a2); |