From 076546d41d1454c87317b5e53c2b322865331d92 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 19 Dec 2012 08:00:22 +0100 Subject: HOPKINS: More renaming --- engines/hopkins/anim.cpp | 12 +-- engines/hopkins/computer.cpp | 2 +- engines/hopkins/dialogs.cpp | 2 +- engines/hopkins/events.cpp | 30 +++--- engines/hopkins/files.cpp | 10 +- engines/hopkins/globals.cpp | 6 +- engines/hopkins/globals.h | 7 +- engines/hopkins/graphics.cpp | 123 ++++++++++++------------ engines/hopkins/graphics.h | 6 +- engines/hopkins/hopkins.cpp | 28 +++--- engines/hopkins/objects.cpp | 11 +-- engines/hopkins/sound.cpp | 8 +- engines/hopkins/talk.cpp | 218 +++++++++++++++++++++---------------------- engines/hopkins/talk.h | 10 +- 14 files changed, 229 insertions(+), 244 deletions(-) (limited to 'engines/hopkins') diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 313d7a9ee1..d26b1b8b17 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -236,11 +236,11 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); - if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) + if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); - else if (_vm->_graphicsManager.nbrligne == 1280) + else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); - if (!_vm->_graphicsManager.nbrligne) + if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; v12 = _vm->_graphicsManager._vesaScreen; @@ -827,11 +827,11 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_eventsManager.VBL(); _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); - if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) + if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); - else if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) + else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); - if (!_vm->_graphicsManager.nbrligne) + if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; } v9 = _vm->_graphicsManager._vesaScreen; diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index bfc5ca92ff..9509a849bd 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -76,7 +76,7 @@ void ComputerManager::setTextMode() { _vm->_graphicsManager.unlockScreen(); //SET_MODE(SCREEN_WIDTH, SCREEN_HEIGHT); - _vm->_graphicsManager.nbrligne = SCREEN_WIDTH; + _vm->_graphicsManager._lineNbr = SCREEN_WIDTH; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "STFONT.SPR"); _vm->_globals.police = _vm->_globals.freeMemory(_vm->_globals.police); _vm->_globals.police = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 7f45d06dc8..a228b030ba 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -361,7 +361,7 @@ LABEL_7: if (v6 && v4 <= 29) { byte *v7 = _vm->_objectsManager.CAPTURE_OBJET(v6, 0); _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, v7, v19 + v16 + 6, - v15 + 120, _vm->_globals.OBJL, _vm->_globals.OBJH); + v15 + 120, _vm->_globals._objectWidth, _vm->_globals._objectHeight); _vm->_globals.freeMemory(v7); } v16 += 54; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index d75d5a098d..2def49cfbf 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -341,8 +341,8 @@ void EventsManager::VBL() { v14 = _mouseSizeX; v13 = _mouseSizeY; if (_mouseCursorId == 23) { - v14 = _vm->_globals.OBJL; - v13 = _vm->_globals.OBJH; + v14 = _vm->_globals._objectWidth; + v13 = _vm->_globals._objectHeight; goto LABEL_35; } if (_breakoutFl) { @@ -473,14 +473,14 @@ void EventsManager::updateCursor() { Common::Rect clipBounds(_vm->_graphicsManager.min_x, _vm->_graphicsManager.min_y, _vm->_graphicsManager.max_x, _vm->_graphicsManager.max_y); _vm->_graphicsManager.min_x = _vm->_graphicsManager.min_y = 0; - _vm->_graphicsManager.max_x = _vm->_globals.OBJL; - _vm->_graphicsManager.max_y = _vm->_globals.OBJH; - int pitch = _vm->_graphicsManager.nbrligne2; - _vm->_graphicsManager.nbrligne2 = _vm->_globals.OBJL; + _vm->_graphicsManager.max_x = _vm->_globals._objectWidth; + _vm->_graphicsManager.max_y = _vm->_globals._objectHeight; + int pitch = _vm->_graphicsManager._lineNbr2; + _vm->_graphicsManager._lineNbr2 = _vm->_globals._objectWidth; // Create the temporary cursor surface - byte *cursorSurface = new byte[_vm->_globals.OBJH * _vm->_globals.OBJL]; - Common::fill(cursorSurface, cursorSurface + _vm->_globals.OBJH * _vm->_globals.OBJL, 0); + byte *cursorSurface = new byte[_vm->_globals._objectHeight * _vm->_globals._objectWidth]; + Common::fill(cursorSurface, cursorSurface + _vm->_globals._objectHeight * _vm->_globals._objectWidth, 0); if (_mouseCursorId != 23) { // Draw standard cursor @@ -495,23 +495,23 @@ void EventsManager::updateCursor() { _vm->_graphicsManager.min_y = clipBounds.top; _vm->_graphicsManager.max_x = clipBounds.right; _vm->_graphicsManager.max_y = clipBounds.bottom; - _vm->_graphicsManager.nbrligne2 = pitch; + _vm->_graphicsManager._lineNbr2 = pitch; // Convert the cursor to the pixel format. At the moment, it's hardcoded // to expect the game to be in 16-bit mode - uint16 *cursorPixels = new uint16[_vm->_globals.OBJH * _vm->_globals.OBJL]; + uint16 *cursorPixels = new uint16[_vm->_globals._objectHeight * _vm->_globals._objectWidth]; const byte *srcP = cursorSurface; uint16 *destP = cursorPixels; - for (int yp = 0; yp < _vm->_globals.OBJH; ++yp) { + for (int yp = 0; yp < _vm->_globals._objectHeight; ++yp) { const byte *lineSrcP = srcP; uint16 *lineDestP = destP; - for (int xp = 0; xp < _vm->_globals.OBJL; ++xp) + for (int xp = 0; xp < _vm->_globals._objectWidth; ++xp) *lineDestP++ = *(uint16 *)&_vm->_graphicsManager.PAL_PIXELS[*lineSrcP++ * 2]; - srcP += _vm->_globals.OBJL; - destP += _vm->_globals.OBJL; + srcP += _vm->_globals._objectWidth; + destP += _vm->_globals._objectWidth; } // Calculate the X offset within the pointer image to the actual cursor data @@ -519,7 +519,7 @@ void EventsManager::updateCursor() { // Set the ScummVM cursor from the surface Graphics::PixelFormat pixelFormat = g_system->getScreenFormat(); - CursorMan.replaceCursor(cursorPixels, _vm->_globals.OBJL, _vm->_globals.OBJH, + CursorMan.replaceCursor(cursorPixels, _vm->_globals._objectWidth, _vm->_globals._objectHeight, xOffset, 0, *((uint16 *)cursorPixels), true, &pixelFormat); // Delete the cursor surface diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 3e840ed60e..8ab86bb180 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -251,8 +251,8 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { if (name == filename) { // Found entry for file, so get it's details from the catalogue entry const byte *pData = ptr + offsetVal; - _vm->_globals.CAT_POSI = READ_LE_UINT32(pData + 15); - _vm->_globals.CAT_TAILLE = READ_LE_UINT32(pData + 19); + _vm->_globals._catalogPos = READ_LE_UINT32(pData + 15); + _vm->_globals._catalogSize = READ_LE_UINT32(pData + 19); matchFlag = true; } @@ -271,13 +271,13 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { if (!f.open(_vm->_globals.NFICHIER)) error("CHARGE_FICHIER"); - f.seek(_vm->_globals.CAT_POSI); + f.seek(_vm->_globals._catalogPos); - byte *catData = _vm->_globals.allocMemory(_vm->_globals.CAT_TAILLE); + byte *catData = _vm->_globals.allocMemory(_vm->_globals._catalogSize); if (catData == g_PTRNUL) error("CHARGE_FICHIER"); - readStream(f, catData, _vm->_globals.CAT_TAILLE); + readStream(f, catData, _vm->_globals._catalogSize); f.close(); result = catData; } else { diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index fda679daa4..5739cc1d74 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -138,10 +138,10 @@ Globals::Globals() { largeur_boite = 0; hauteur_boite = 0; FORET = false; - OBJL = OBJH = 0; + _objectWidth = _objectHeight = 0; HELICO = 0; - CAT_POSI = 0; - CAT_TAILLE = 0; + _catalogPos = 0; + _catalogSize = 0; _newObjectFl = false; iRegul = 0; SORTIE = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 85bd6cde89..d1fdae57a8 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -400,12 +400,11 @@ public: byte *Bufferdecor; byte *ADR_FICHIER_OBJ; byte *PERSO; - int OBJL, OBJH; + int _objectWidth, _objectHeight; bool _newObjectFl; int HELICO; - uint32 CAT_POSI; - uint32 CAT_TAILLE; - bool CAT_FLAG; + uint32 _catalogPos; + uint32 _catalogSize; int iRegul; bool BPP_NOAFF; int SORTIE; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 44c775b660..a6992c0b23 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -39,7 +39,7 @@ GraphicsManager::GraphicsManager() { XSCREEN = YSCREEN = 0; WinScan = 0; PAL_PIXELS = NULL; - nbrligne = 0; + _lineNbr = 0; Linear = false; _videoPtr = NULL; ofscroll = 0; @@ -48,7 +48,7 @@ GraphicsManager::GraphicsManager() { DOUBLE_ECRAN = false; OLD_SCROLL = 0; - nbrligne2 = 0; + _lineNbr2 = 0; Agr_x = Agr_y = 0; Agr_Flag_x = Agr_Flag_y = 0; FADESPD = 15; @@ -115,7 +115,7 @@ void GraphicsManager::setGraphicalMode(int width, int height) { WinScan = width * 2; // Refactor me PAL_PIXELS = SD_PIXELS; - nbrligne = width; + _lineNbr = width; Common::fill(&cmap[0], &cmap[256 * 3], 0); SDL_MODEYES = true; @@ -311,7 +311,7 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, "PIC.RES"); if (!f.open(_vm->_globals.NFICHIER)) error("(nom)Erreur en cours de lecture."); - f.seek(_vm->_globals.CAT_POSI); + f.seek(_vm->_globals._catalogPos); } else { // Load stand alone PCX file @@ -424,7 +424,7 @@ void GraphicsManager::Cls_Pal() { } void GraphicsManager::SCANLINE(int pitch) { - nbrligne = nbrligne2 = pitch; + _lineNbr = _lineNbr2 = pitch; } void GraphicsManager::m_scroll(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { @@ -437,7 +437,7 @@ void GraphicsManager::m_scroll(const byte *surface, int xs, int ys, int width, i unsigned int widthRemaining; assert(_videoPtr); - srcP = xs + nbrligne2 * ys + surface; + srcP = xs + _lineNbr2 * ys + surface; destP = destX + WinScan * destY + (byte *)_videoPtr->pixels; yNext = height; do { @@ -448,7 +448,7 @@ void GraphicsManager::m_scroll(const byte *surface, int xs, int ys, int width, i widthRemaining = width - 4 * (width >> 2); memcpy(dest2P, src2P, widthRemaining); destP = dest2P + widthRemaining + WinScan - width; - srcP = src2P + widthRemaining + nbrligne2 - width; + srcP = src2P + widthRemaining + _lineNbr2 - width; yNext = yCtr - 1; } while (yCtr != 1); } @@ -460,7 +460,7 @@ void GraphicsManager::m_scroll16(const byte *surface, int xs, int ys, int width, lockScreen(); assert(_videoPtr); - const byte *srcP = xs + nbrligne2 * ys + surface; + const byte *srcP = xs + _lineNbr2 * ys + surface; uint16 *destP = (uint16 *)((byte *)_videoPtr->pixels + destX * 2 + WinScan * destY); for (int yp = 0; yp < height; ++yp) { @@ -472,7 +472,7 @@ void GraphicsManager::m_scroll16(const byte *surface, int xs, int ys, int width, *lineDestP++ = *(uint16 *)&PAL_PIXELS[*lineSrcP++ * 2]; // Move to the start of the next line - srcP += nbrligne2; + srcP += _lineNbr2; destP += WinScan / 2; } @@ -492,7 +492,7 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width const byte *destCopyP; assert(_videoPtr); - srcP = xs + nbrligne2 * ys + surface; + srcP = xs + _lineNbr2 * ys + surface; destP = destX + destX + WinScan * destY + (byte *)_videoPtr->pixels; yNext = height; Agr_x = 0; @@ -536,7 +536,7 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width } Agr_Flag_y = 0; - srcP = nbrligne2 + srcCopyP; + srcP = _lineNbr2 + srcCopyP; yNext = yCtr - 1; } while (yCtr != 1); } @@ -1049,7 +1049,7 @@ void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int // TODO: This code in the original is potentially dangerous, as it doesn't clip the area to within // the screen, and so thus can read areas outside of the allocated surface buffer - srcP = xs + nbrligne2 * ys + srcSurface; + srcP = xs + _lineNbr2 * ys + srcSurface; destP = destSurface; rowCount = height; do { @@ -1069,7 +1069,7 @@ void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int srcP += 4 * (width >> 2); destP += 4 * (width >> 2); } - srcP = nbrligne2 + srcP - width; + srcP = _lineNbr2 + srcP - width; rowCount = rowCount2 - 1; } while (rowCount2 != 1); } @@ -1141,12 +1141,12 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, spriteP += srcOffset; // Set up surface destination - byte *destP = surface + (yp - 300) * nbrligne2 + (xp - 300); + byte *destP = surface + (yp - 300) * _lineNbr2 + (xp - 300); // Handling for clipped versus non-clipped if (clip_flag) { // Clipped version - for (int yc = 0; yc < height; ++yc, destP += nbrligne2) { + for (int yc = 0; yc < height; ++yc, destP += _lineNbr2) { byte *tempDestP = destP; byte byteVal; int xc = 0; @@ -1175,7 +1175,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, } } else { // Non-clipped - for (int yc = 0; yc < height; ++yc, destP += nbrligne2) { + for (int yc = 0; yc < height; ++yc, destP += _lineNbr2) { byte *tempDestP = destP; byte byteVal; @@ -1428,7 +1428,7 @@ void GraphicsManager::Restore_Mem(byte *destSurface, const byte *src, int xp, in int i; int yCtr; - destP = xp + nbrligne2 * yp + destSurface; + destP = xp + _lineNbr2 * yp + destSurface; yNext = height; srcP = src; do { @@ -1448,7 +1448,7 @@ void GraphicsManager::Restore_Mem(byte *destSurface, const byte *src, int xp, in srcP += 4 * (width >> 2); destP += 4 * (width >> 2); } - destP = nbrligne2 + destP - width; + destP = _lineNbr2 + destP - width; yNext = yCtr - 1; } while (yCtr != 1); } @@ -1510,7 +1510,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp clip_x1 = max_x + 300 - xp300; if ((uint16)yp300 < (uint16)(max_y + 300)) { clip_y1 = max_y + 300 - yp300; - dest1P = xp300 + nbrligne2 * (yp300 - 300) - 300 + surface; + dest1P = xp300 + _lineNbr2 * (yp300 - 300) - 300 + surface; if (zoom2) { Compteur_y = 0; Agr_x = 0; @@ -1533,7 +1533,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp ; v20 = v52; spritePixelsP += _width * v30; - v29 += nbrligne2 * (uint16)clip_y; + v29 += _lineNbr2 * (uint16)clip_y; v22 = v61 - (uint16)clip_y; } if (v22 > (uint16)clip_y1) @@ -1584,7 +1584,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp } R_Aff_Zoom_Larg_Cont1: spritePixelsP = _width + v46; - v29 = nbrligne2 + v53; + v29 = _lineNbr2 + v53; ++Compteur_y; if (!Agr_Flag_y) Agr_y = zoom2 + Agr_y; @@ -1612,7 +1612,7 @@ R_Aff_Zoom_Larg_Cont1: ; v20 = v49; spritePixelsP += _width * v23; - dest1P += nbrligne2 * (uint16)clip_y; + dest1P += _lineNbr2 * (uint16)clip_y; v22 = v58 - (uint16)clip_y; } if (v22 > (uint16)clip_y1) @@ -1666,7 +1666,7 @@ R_Aff_Zoom_Larg_Cont1: } while (v28); Aff_Zoom_Larg_Cont1: spritePixelsP = _width + v45; - dest1P = nbrligne2 + v51; + dest1P = _lineNbr2 + v51; if (!Agr_Flag_y) Agr_y = zoom2 + Agr_y; if ((uint16)Agr_y < 0x64u) @@ -1713,7 +1713,7 @@ Aff_Zoom_Larg_Cont1: } } spriteHeight2 = v65; - v40 = nbrligne2 + v55; + v40 = _lineNbr2 + v55; } else { Red_y = Red_y - 100; spritePixelsP += _width; @@ -1742,7 +1742,7 @@ Aff_Zoom_Larg_Cont1: } } spriteHeight2 = v64; - dest1P = nbrligne2 + v54; + dest1P = _lineNbr2 + v54; } else { Red_y = Red_y - 100; spritePixelsP += _width; @@ -1761,7 +1761,7 @@ Aff_Zoom_Larg_Cont1: if ((uint16)clip_y >= (unsigned int)spriteHeight1) return; spritePixelsP += spriteWidth * (uint16)clip_y; - dest2P += nbrligne2 * (uint16)clip_y; + dest2P += _lineNbr2 * (uint16)clip_y; spriteHeight1 -= (uint16)clip_y; } int xLeft = (uint16)clip_y1; @@ -1791,7 +1791,7 @@ Aff_Zoom_Larg_Cont1: --dest2P; } spritePixelsP = spec_largeur + spritePixelsCopy2P; - dest2P = nbrligne2 + destCopy2P; + dest2P = _lineNbr2 + destCopy2P; spriteHeight1 = yCtr2 - 1; } while (yCtr2 != 1); } else { @@ -1800,7 +1800,7 @@ Aff_Zoom_Larg_Cont1: if ((uint16)clip_y >= (unsigned int)spriteHeight1) return; spritePixelsP += spriteWidth * (uint16)clip_y; - dest1P += nbrligne2 * (uint16)clip_y; + dest1P += _lineNbr2 * (uint16)clip_y; spriteHeight1 -= (uint16)clip_y; } if (spriteHeight1 > clip_y1) @@ -1826,7 +1826,7 @@ Aff_Zoom_Larg_Cont1: ++spritePixelsP; } spritePixelsP = spec_largeur + spritePixelsCopyP; - dest1P = nbrligne2 + dest1CopyP; + dest1P = _lineNbr2 + dest1CopyP; spriteHeight1 = yCtr1 - 1; } while (yCtr1 != 1); } @@ -1898,8 +1898,8 @@ void GraphicsManager::Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned const byte *src2P; unsigned int pitch; - srcP = x1 + nbrligne2 * y1 + srcSurface; - destP = destX + nbrligne2 * destY + destSurface; + srcP = x1 + _lineNbr2 * y1 + srcSurface; + destP = destX + _lineNbr2 * destY + destSurface; yp = height; do { yCurrent = yp; @@ -1908,8 +1908,8 @@ void GraphicsManager::Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned dest2P = (destP + 4 * (width >> 2)); pitch = width - 4 * (width >> 2); memcpy(dest2P, src2P, pitch); - destP = (dest2P + pitch + nbrligne2 - width); - srcP = (src2P + pitch + nbrligne2 - width); + destP = (dest2P + pitch + _lineNbr2 - width); + srcP = (src2P + pitch + _lineNbr2 - width); yp = yCurrent - 1; } while (yCurrent != 1); } @@ -1939,7 +1939,7 @@ void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int x spriteSizeP += 2; spriteHeight = (int16)READ_LE_UINT16(spriteSizeP); spritePixelsP = spriteSizeP + 10; - destP = surface + xp + nbrligne2 * yp; + destP = surface + xp + _lineNbr2 * yp; _width = spriteWidth; do { @@ -1956,7 +1956,7 @@ void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int x ++destP; ++spritePixelsP; } - destP = nbrligne2 + destLineP; + destP = _lineNbr2 + destLineP; spriteHeight = yCtr - 1; } while (yCtr != 1); } @@ -1985,14 +1985,11 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { if (!_vm->_globals.NOSPRECRAN) { _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.searchCat(filename, 8); if (_vm->_globals.SPRITE_ECRAN) { - _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); } else { - _vm->_globals.CAT_FLAG = true; _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "RES_SLI.RES"); } _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - _vm->_globals.CAT_FLAG = false; } } if (*ptr != 'I' || *(ptr + 1) != 'N' || *(ptr + 2) != 'I') { @@ -2041,9 +2038,9 @@ void GraphicsManager::NB_SCREEN() { if (!_vm->_globals.NECESSAIRE) INIT_TABLE(50, 65, Palette); - if (nbrligne == SCREEN_WIDTH) + if (_lineNbr == SCREEN_WIDTH) Trans_bloc2(_vesaBuffer, TABLE_COUL, 307200); - if (nbrligne == 1280) + else if (_lineNbr == (SCREEN_WIDTH * 2)) Trans_bloc2(_vesaBuffer, TABLE_COUL, 614400); lockScreen(); m_scroll16(_vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -2113,23 +2110,25 @@ void GraphicsManager::Copy_Video_Vbe(const byte *src) { for (;;) { byteVal = *srcP; if (*srcP < kByteStop) - goto Video_Cont_Vbe; - if (byteVal == kByteStop) - return; - if (byteVal == k8bVal) { - destOffset += *(srcP + 1); - byteVal = *(srcP + 2); - srcP += 2; - } else if (byteVal == k16bVal) { - destOffset += READ_LE_UINT16(srcP + 1); - byteVal = *(srcP + 3); - srcP += 3; - } else { - destOffset += READ_LE_UINT32(srcP + 1); - byteVal = *(srcP + 5); - srcP += 5; + break; + else { + if (byteVal == kByteStop) + return; + if (byteVal == k8bVal) { + destOffset += *(srcP + 1); + byteVal = *(srcP + 2); + srcP += 2; + } else if (byteVal == k16bVal) { + destOffset += READ_LE_UINT16(srcP + 1); + byteVal = *(srcP + 3); + srcP += 3; + } else { + destOffset += READ_LE_UINT32(srcP + 1); + byteVal = *(srcP + 5); + srcP += 5; + } } -Video_Cont_Vbe: + *((byte *)_videoPtr->pixels + destOffset) = byteVal; ++srcP; ++destOffset; @@ -2141,7 +2140,7 @@ void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int const byte *srcP; byte *destP; - srcP = xp + nbrligne2 * yp + srcSurface; + srcP = xp + _lineNbr2 * yp + srcSurface; destP = destSurface; Red = zoom; _width = width; @@ -2151,7 +2150,7 @@ void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int Reduc_Ecran_L = zoomOut(width, Red); Reduc_Ecran_H = zoomOut(height, Red); - for (int yCtr = 0; yCtr < height; ++yCtr, srcP += nbrligne2) { + for (int yCtr = 0; yCtr < height; ++yCtr, srcP += _lineNbr2) { Red_y += Red; if (Red_y < 100) { Red_x = 0; @@ -2177,22 +2176,22 @@ void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int * Draw horizontal line */ void GraphicsManager::drawHorizontalLine(byte *surface, int xp, int yp, unsigned int width, byte col) { - memset(surface + xp + nbrligne2 * yp, col, width); + memset(surface + xp + _lineNbr2 * yp, col, width); } /** * Draw vertical line */ void GraphicsManager::drawVerticalLine(byte *surface, int xp, int yp, int height, byte col) { - byte *destP = surface + xp + nbrligne2 * yp; + byte *destP = surface + xp + _lineNbr2 * yp; for (int yCtr = height; yCtr; yCtr--) { *destP = col; - destP += nbrligne2; + destP += _lineNbr2; } } -void GraphicsManager::MODE_VESA() { +void GraphicsManager::setModeVesa() { setGraphicalMode(640, 480); } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 3439439baa..b3b4e476a9 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -60,7 +60,7 @@ public: int WinScan; byte SD_PIXELS[PALETTE_SIZE * 2]; byte *PAL_PIXELS; - int nbrligne; + int _lineNbr; byte TABLE_COUL[PALETTE_EXT_BLOCK_SIZE]; byte cmap[PALETTE_BLOCK_SIZE]; byte Palette[PALETTE_EXT_BLOCK_SIZE]; @@ -77,7 +77,7 @@ public: int OLD_SCROLL; bool MANU_SCROLL; int SPEED_SCROLL; - int nbrligne2; + int _lineNbr2; int Agr_x, Agr_y; int Agr_Flag_x, Agr_Flag_y; int FADESPD; @@ -185,7 +185,7 @@ public: void Reduc_Ecran(const byte *srcSruface, byte *destSurface, int xp, int yp, int width, int height, int zoom); void drawHorizontalLine(byte *surface, int xp, int yp, unsigned int width, byte col); void drawVerticalLine(byte *surface, int xp, int yp, int height, byte col); - void MODE_VESA(); + void setModeVesa(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index fc96102cea..27504dce08 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -387,7 +387,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.ECRAN = 113; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _computerManager.showComputer(COMPUTER_HOPKINS); - _graphicsManager.MODE_VESA(); + _graphicsManager.setModeVesa(); break; case 114: @@ -397,7 +397,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _globals.SORTIE = 0; _computerManager.showComputer(COMPUTER_SAMANTHAS); - _graphicsManager.MODE_VESA(); + _graphicsManager.setModeVesa(); break; case 115: @@ -407,7 +407,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.ECRAN = 115; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _computerManager.showComputer(COMPUTER_PUBLIC); - _graphicsManager.MODE_VESA(); + _graphicsManager.setModeVesa(); break; case 150: @@ -1592,7 +1592,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.ECRAN = 113; _globals.SAUVEGARDE->data[svField5] = 113; _computerManager.showComputer(COMPUTER_HOPKINS); - _graphicsManager.MODE_VESA(); + _graphicsManager.setModeVesa(); break; case 114: @@ -1602,7 +1602,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.ECRAN = 114; _globals.SAUVEGARDE->data[svField5] = 114; _computerManager.showComputer(COMPUTER_SAMANTHAS); - _graphicsManager.MODE_VESA(); + _graphicsManager.setModeVesa(); break; case 115: @@ -1612,7 +1612,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.ECRAN = 115; _globals.SAUVEGARDE->data[svField5] = 115; _computerManager.showComputer(COMPUTER_PUBLIC); - _graphicsManager.MODE_VESA(); + _graphicsManager.setModeVesa(); break; case 150: @@ -2457,7 +2457,7 @@ bool HopkinsEngine::runWin95full() { _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _globals.SORTIE = 0; _computerManager.showComputer(COMPUTER_HOPKINS); - _graphicsManager.MODE_VESA(); + _graphicsManager.setModeVesa(); break; case 114: @@ -2467,7 +2467,7 @@ bool HopkinsEngine::runWin95full() { _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _computerManager.showComputer(COMPUTER_SAMANTHAS); - _graphicsManager.MODE_VESA(); + _graphicsManager.setModeVesa(); break; case 115: @@ -2477,7 +2477,7 @@ bool HopkinsEngine::runWin95full() { _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _globals.SORTIE = 0; _computerManager.showComputer(COMPUTER_PUBLIC); - _graphicsManager.MODE_VESA(); + _graphicsManager.setModeVesa(); break; case 150: @@ -2534,8 +2534,8 @@ bool HopkinsEngine::runWin95full() { _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; - _graphicsManager.nbrligne = SCREEN_WIDTH; - _graphicsManager.MODE_VESA(); + _graphicsManager._lineNbr = SCREEN_WIDTH; + _graphicsManager.setModeVesa(); if (_globals.SORTIE == -1) error("FIN BASE SOUS MARINE"); break; @@ -3424,7 +3424,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; - _graphicsManager.nbrligne = SCREEN_WIDTH; + _graphicsManager._lineNbr = SCREEN_WIDTH; break; } } @@ -3799,7 +3799,7 @@ void HopkinsEngine::ENDEMO() { } void HopkinsEngine::BOOM() { - _graphicsManager.nbrligne = SCREEN_WIDTH; + _graphicsManager._lineNbr = SCREEN_WIDTH; _graphicsManager.SCANLINE(SCREEN_WIDTH); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -3925,7 +3925,7 @@ void HopkinsEngine::INCENDIE() { void HopkinsEngine::BASE() { _globals.iRegul = 1; - _graphicsManager.nbrligne = SCREEN_WIDTH; + _graphicsManager._lineNbr = SCREEN_WIDTH; _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 2e2d492dc6..0c632b02ce 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -129,8 +129,8 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { int width = ObjectsManager::getWidth(_vm->_globals.ADR_FICHIER_OBJ, val2); int height = ObjectsManager::getHeight(_vm->_globals.ADR_FICHIER_OBJ, val2); - _vm->_globals.OBJL = width; - _vm->_globals.OBJH = height; + _vm->_globals._objectWidth = width; + _vm->_globals._objectHeight = height; switch (mode) { case 0: @@ -4058,7 +4058,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_saveLoadManager.SAUVE_FICHIER("TEMP1.SCR", _vm->_graphicsManager._vesaScreen, 0x4B000u); - if (!_vm->_graphicsManager.nbrligne) + if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); _vm->_soundManager.SPECIAL_SOUND = 198; @@ -4481,7 +4481,7 @@ void ObjectsManager::INILINK(const Common::String &file) { filename = file + ".LNK"; ptr = _vm->_fileManager.searchCat(filename, 3); - nbytes = _vm->_globals.CAT_TAILLE; + nbytes = _vm->_globals._catalogSize; if (ptr == g_PTRNUL) { _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); @@ -4506,15 +4506,12 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.searchCat(filename2, 8); if (_vm->_globals.CACHE_BANQUE[1] || _vm->_globals.CACHE_BANQUE[1] == g_PTRNUL) { - _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename2); } else { - _vm->_globals.CAT_FLAG = true; _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "RES_SLI.RES"); } _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - _vm->_globals.CAT_FLAG = false; v36 = 60; v37 = ptr + 1000; for (int v40 = 0; v40 <= 21; v40++) { diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 209215bba6..1e24346f60 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -577,8 +577,8 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { else if (_vm->_globals.FR == 2) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VES.RES"); - catPos = _vm->_globals.CAT_POSI; - catLen = _vm->_globals.CAT_TAILLE; + catPos = _vm->_globals._catalogPos; + catLen = _vm->_globals._catalogSize; } else if (!_vm->_fileManager.searchCat(filename + ".APC", 9)) { if (_vm->_globals.FR == 1) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VFR.RES"); @@ -587,8 +587,8 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { else if (_vm->_globals.FR == 2) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VES.RES"); - catPos = _vm->_globals.CAT_POSI; - catLen = _vm->_globals.CAT_TAILLE; + catPos = _vm->_globals._catalogPos; + catLen = _vm->_globals._catalogSize; } else { _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, filename + ".WAV"); if (!f.exists(_vm->_globals.NFICHIER)) { diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index ac6326ad21..ef2ff53e19 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -34,11 +34,11 @@ namespace Hopkins { TalkManager::TalkManager() { - BUFFERPERSO = NULL; - PALPERSO = NULL; + _characterBuffer = NULL; + _characterPalette = NULL; _characterSprite = NULL; ADR_ANIM = NULL; - TAILLEPERSO = 0; + _characterSize = 0; STATI = 0; PLIGNE1 = PLIGNE2 = 0; PLIGNE3 = PLIGNE4 = 0; @@ -69,45 +69,42 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.no_scroll = 1; bool oldDisableInventFl = _vm->_globals._disableInventFl; _vm->_globals._disableInventFl = true; - BUFFERPERSO = _vm->_fileManager.searchCat(filename, 5); - TAILLEPERSO = _vm->_globals.CAT_TAILLE; - if (BUFFERPERSO == g_PTRNUL) { + _characterBuffer = _vm->_fileManager.searchCat(filename, 5); + _characterSize = _vm->_globals._catalogSize; + if (_characterBuffer == g_PTRNUL) { _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); - BUFFERPERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - TAILLEPERSO = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); + _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _characterSize = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); } _vm->_globals.SAUVEGARDE->data[svField4] = 0; - RENVOIE_FICHIER(40, v16, (const char *)BUFFERPERSO); - RENVOIE_FICHIER(0, FQUEST, (const char *)BUFFERPERSO); - RENVOIE_FICHIER(20, FREPON, (const char *)BUFFERPERSO); + RENVOIE_FICHIER(40, v16, (const char *)_characterBuffer); + RENVOIE_FICHIER(0, _questionsFilename, (const char *)_characterBuffer); + RENVOIE_FICHIER(20, _answersFilename, (const char *)_characterBuffer); if (_vm->_globals.FR == 1) { - FREPON = FQUEST = "RUE.TXT"; + _answersFilename = _questionsFilename = "RUE.TXT"; } else if (!_vm->_globals.FR) { - FREPON = FQUEST = "RUEAN.TXT"; + _answersFilename = _questionsFilename = "RUEAN.TXT"; } else if (_vm->_globals.FR == 2) { - FREPON = FQUEST = "RUEES.TXT"; + _answersFilename = _questionsFilename = "RUEES.TXT"; } - 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; + v2 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40); + v3 = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; + PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; _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"); } _characterSprite = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); - _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); - if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) + if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); - else if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) + else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); - if (!_vm->_graphicsManager.nbrligne) + if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); _vm->_objectsManager.PERSO_ON = true; @@ -141,7 +138,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { clearCharacterAnim(); _vm->_globals.NOPARLE = false; _vm->_globals.NECESSAIRE = true; - BUFFERPERSO = _vm->_globals.freeMemory(BUFFERPERSO); + _characterBuffer = _vm->_globals.freeMemory(_characterBuffer); _characterSprite = _vm->_globals.freeMemory(_characterSprite); _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = false; @@ -184,35 +181,35 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { STATI = 1; bool v7 = _vm->_globals._disableInventFl; _vm->_globals._disableInventFl = true; - BUFFERPERSO = _vm->_fileManager.searchCat(filename, 5); - TAILLEPERSO = _vm->_globals.CAT_TAILLE; - if (BUFFERPERSO == g_PTRNUL) { + _characterBuffer = _vm->_fileManager.searchCat(filename, 5); + _characterSize = _vm->_globals._catalogSize; + if (_characterBuffer == g_PTRNUL) { _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); - BUFFERPERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - TAILLEPERSO = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); + _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _characterSize = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); } _vm->_globals.SAUVEGARDE->data[svField4] = 0; - RENVOIE_FICHIER(0, FQUEST, (const char *)BUFFERPERSO); - RENVOIE_FICHIER(20, FREPON, (const char *)BUFFERPERSO); + RENVOIE_FICHIER(0, _questionsFilename, (const char *)_characterBuffer); + RENVOIE_FICHIER(20, _answersFilename, (const char *)_characterBuffer); switch (_vm->_globals.FR) { case 0: - FQUEST = "RUEAN.TXT"; - FREPON = "RUEAN.TXT"; + _questionsFilename = "RUEAN.TXT"; + _answersFilename = "RUEAN.TXT"; break; case 1: - FQUEST = "RUE.TXT"; - FREPON = "RUE.TXT"; + _questionsFilename = "RUE.TXT"; + _answersFilename = "RUE.TXT"; break; case 2: - FQUEST = "RUEES.TXT"; - FREPON = "RUEES.TXT"; + _questionsFilename = "RUEES.TXT"; + _answersFilename = "RUEES.TXT"; break; } - int v1 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 40); - PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; + int v1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40); + PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; CHERCHE_PAL(PCHERCHE, 0); PLIGNE1 = v1; PLIGNE2 = v1 + 1; @@ -242,7 +239,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { while (v5 != -1); } - BUFFERPERSO = _vm->_globals.freeMemory(BUFFERPERSO); + _characterBuffer = _vm->_globals.freeMemory(_characterBuffer); _vm->_eventsManager._mouseCursorId = v8; _vm->_eventsManager.changeMouseCursor(v8); @@ -281,8 +278,8 @@ int TalkManager::DIALOGUE() { int v21; if (STATI) { - v0 = BUFFERPERSO; - v1 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 48); + v0 = _characterBuffer; + v1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 48); if (v1) _vm->_objectsManager.BOBANIM_ON(v1); if ((int16)READ_LE_UINT16((uint16 *)v0 + 48) != 1) @@ -297,17 +294,17 @@ int TalkManager::DIALOGUE() { VISU_WAIT(); } - v19 = VERIF_BOITE(PLIGNE1, FQUEST, 65); - v2 = VERIF_BOITE(PLIGNE2, FQUEST, 65); - v3 = VERIF_BOITE(PLIGNE3, FQUEST, 65); - v20 = 420 - 20 * VERIF_BOITE(PLIGNE4, FQUEST, 65); + v19 = VERIF_BOITE(PLIGNE1, _questionsFilename, 65); + v2 = VERIF_BOITE(PLIGNE2, _questionsFilename, 65); + v3 = VERIF_BOITE(PLIGNE3, _questionsFilename, 65); + v20 = 420 - 20 * VERIF_BOITE(PLIGNE4, _questionsFilename, 65); v21 = v20 - 20 * v3; v18 = v20 - 20 * v3 - 1; v4 = v20 - 20 * v3 - 20 * v2; - _vm->_fontManager.initTextBuffers(5, PLIGNE1, FQUEST, 5, v4 - 20 * v19, 0, 0, 0, 65, 255); - _vm->_fontManager.initTextBuffers(6, PLIGNE2, FQUEST, 5, v4, 0, 0, 0, 65, 255); - _vm->_fontManager.initTextBuffers(7, PLIGNE3, FQUEST, 5, v21, 0, 0, 0, 65, 255); - _vm->_fontManager.initTextBuffers(8, PLIGNE4, FQUEST, 5, v20, 0, 0, 0, 65, 255); + _vm->_fontManager.initTextBuffers(5, PLIGNE1, _questionsFilename, 5, v4 - 20 * v19, 0, 0, 0, 65, 255); + _vm->_fontManager.initTextBuffers(6, PLIGNE2, _questionsFilename, 5, v4, 0, 0, 0, 65, 255); + _vm->_fontManager.initTextBuffers(7, PLIGNE3, _questionsFilename, 5, v21, 0, 0, 0, 65, 255); + _vm->_fontManager.initTextBuffers(8, PLIGNE4, _questionsFilename, 5, v20, 0, 0, 0, 65, 255); _vm->_fontManager.showText(5); _vm->_fontManager.showText(6); _vm->_fontManager.showText(7); @@ -354,8 +351,8 @@ int TalkManager::DIALOGUE() { _vm->_fontManager.hideText(8); if (STATI) { - v11 = BUFFERPERSO; - v12 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 48); + v11 = _characterBuffer; + v12 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 48); if (v12) _vm->_objectsManager.BOBANIM_OFF(v12); v13 = (int16)READ_LE_UINT16((uint16 *)v11 + 49); @@ -406,10 +403,10 @@ int TalkManager::DIALOGUE_REP(int idx) { v1 = 0; v2 = 0; - v3 = BUFFERPERSO + 110; - for (i = idx; (int16)READ_LE_UINT16(v3) != idx; v3 = BUFFERPERSO + 20 * v1 + 110) { + v3 = _characterBuffer + 110; + for (i = idx; (int16)READ_LE_UINT16(v3) != idx; v3 = _characterBuffer + 20 * v1 + 110) { ++v1; - if ((int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) < v1) + if ((int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) < v1) v2 = 1; if (v2 == 1) return -1; @@ -435,8 +432,8 @@ int TalkManager::DIALOGUE_REP(int idx) { if (!v6) v6 = 10; if (STATI) { - v8 = BUFFERPERSO; - v9 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); + v8 = _characterBuffer; + v9 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 43); if (v9) _vm->_objectsManager.BOBANIM_ON(v9); v10 = (int16)READ_LE_UINT16((uint16 *)v8 + 44); @@ -456,7 +453,7 @@ int TalkManager::DIALOGUE_REP(int idx) { } if (!_vm->_soundManager.TEXTOFF) { - _vm->_fontManager.initTextBuffers(9, v22, FREPON, v25, v24, 20, 25, 5, v23, 252); + _vm->_fontManager.initTextBuffers(9, v22, _answersFilename, v25, v24, 20, 25, 5, v23, 252); _vm->_fontManager.showText(9); } if (!_vm->_soundManager.VOICE_MIX(v22, 1)) { @@ -491,8 +488,8 @@ int TalkManager::DIALOGUE_REP(int idx) { if (!_vm->_soundManager.TEXTOFF) _vm->_fontManager.hideText(9); if (STATI) { - v15 = BUFFERPERSO; - v16 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); + v15 = _characterBuffer; + v16 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 43); if (v16) _vm->_objectsManager.BOBANIM_OFF(v16); v17 = (int16)READ_LE_UINT16((uint16 *)v15 + 44); @@ -528,22 +525,22 @@ void TalkManager::CHERCHE_PAL(int a1, int a2) { v8 = 0; v4 = a1; for (;;) { - if ( *(BUFFERPERSO + v4) == 'P' - && *(BUFFERPERSO + v4 + 1) == 'A' - && *(BUFFERPERSO + v4 + 2) == 'L') { + if ( *(_characterBuffer + v4) == 'P' + && *(_characterBuffer + v4 + 1) == 'A' + && *(_characterBuffer + v4 + 2) == 'L') { v8 = 1; v2 = v4; } ++v4; if (v8 == 1) break; - if (TAILLEPERSO == v4) + if (_characterSize == v4) return; } v5 = v2 + 5; - palette = BUFFERPERSO + v5; - PALPERSO = BUFFERPERSO + v5; + palette = _characterBuffer + v5; + _characterPalette = _characterBuffer + v5; if (a2 == 0) { *(palette + 762) = 0; *(palette + 763) = 0; @@ -763,24 +760,24 @@ void TalkManager::CHERCHE_ANIM0(int a1, int a2) { v3 = 0; v4 = a1; for (;;) { - if (*(BUFFERPERSO + v4) == 'A' - && *(BUFFERPERSO + v4 + 1) == 'N' - && *(BUFFERPERSO + v4 + 2) == 'I' - && *(BUFFERPERSO + v4 + 3) == 'M' - && *(BUFFERPERSO + v4 + 4) == 1) { + if (*(_characterBuffer + v4) == 'A' + && *(_characterBuffer + v4 + 1) == 'N' + && *(_characterBuffer + v4 + 2) == 'I' + && *(_characterBuffer + v4 + 3) == 'M' + && *(_characterBuffer + v4 + 4) == 1) { v3 = 1; v2 = v4; } ++v4; if (v3 == 1) break; - if (TAILLEPERSO == v4) + if (_characterSize == v4) return; } v5 = v2 + 25; - v9 = BUFFERPERSO + v5; - v8 = BUFFERPERSO + v5; - ADR_ANIM = BUFFERPERSO + v5; + v9 = _characterBuffer + v5; + v8 = _characterBuffer + v5; + ADR_ANIM = _characterBuffer + v5; if (!a2) { v6 = 0; do { @@ -810,38 +807,38 @@ void TalkManager::initCharacterAnim() { int v11; int v12; - v0 = BUFFERPERSO; - v1 = BUFFERPERSO + 110; - v2 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); + v0 = _characterBuffer; + v1 = _characterBuffer + 110; + v2 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 43); if (v2) - searchCharacterAnim(21, (BUFFERPERSO + 110), v2, TAILLEPERSO); + searchCharacterAnim(21, (_characterBuffer + 110), v2, _characterSize); v4 = (int16)READ_LE_UINT16((uint16 *)v0 + 44); if (v4) - searchCharacterAnim(22, v1, v4, TAILLEPERSO); + searchCharacterAnim(22, v1, v4, _characterSize); v5 = (int16)READ_LE_UINT16((uint16 *)v0 + 45); if (v5) - searchCharacterAnim(23, v1, v5, TAILLEPERSO); + searchCharacterAnim(23, v1, v5, _characterSize); v6 = (int16)READ_LE_UINT16((uint16 *)v0 + 46); if (v6) - searchCharacterAnim(24, v1, v6, TAILLEPERSO); + searchCharacterAnim(24, v1, v6, _characterSize); v7 = (int16)READ_LE_UINT16((uint16 *)v0 + 47); if (v7) - searchCharacterAnim(25, v1, v7, TAILLEPERSO); + searchCharacterAnim(25, v1, v7, _characterSize); v8 = (int16)READ_LE_UINT16((uint16 *)v0 + 48); if (v8) - searchCharacterAnim(26, v1, v8, TAILLEPERSO); + searchCharacterAnim(26, v1, v8, _characterSize); v9 = (int16)READ_LE_UINT16((uint16 *)v0 + 49); if (v9) - searchCharacterAnim(27, v1, v9, TAILLEPERSO); + searchCharacterAnim(27, v1, v9, _characterSize); v10 = (int16)READ_LE_UINT16((uint16 *)v0 + 50); if (v10) - searchCharacterAnim(28, v1, v10, TAILLEPERSO); + searchCharacterAnim(28, v1, v10, _characterSize); v11 = (int16)READ_LE_UINT16((uint16 *)v0 + 51); if (v11) - searchCharacterAnim(29, v1, v11, TAILLEPERSO); + searchCharacterAnim(29, v1, v11, _characterSize); v12 = (int16)READ_LE_UINT16((uint16 *)v0 + 52); if (v12) - searchCharacterAnim(30, v1, v12, TAILLEPERSO); + searchCharacterAnim(30, v1, v12, _characterSize); } void TalkManager::clearCharacterAnim() { @@ -1158,9 +1155,7 @@ void TalkManager::REPONSE2(int a1, int a2) { } void TalkManager::OBJET_VIVANT(const Common::String &a2) { - const char *v4; int v5; - bool v6; int v10; byte *v11; int v12; @@ -1186,45 +1181,40 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_objectsManager.NUMZONE = -1; _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(0); - BUFFERPERSO = _vm->_fileManager.searchCat(a2, 5); - TAILLEPERSO = _vm->_globals.CAT_TAILLE; - if (BUFFERPERSO == g_PTRNUL) { + _characterBuffer = _vm->_fileManager.searchCat(a2, 5); + _characterSize = _vm->_globals._catalogSize; + if (_characterBuffer == g_PTRNUL) { _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, a2); - BUFFERPERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - TAILLEPERSO = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); + _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _characterSize = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); } - RENVOIE_FICHIER(40, v23, (const char *)BUFFERPERSO); - RENVOIE_FICHIER(0, v22, (const char *)BUFFERPERSO); - RENVOIE_FICHIER(20, v20, (const char *)BUFFERPERSO); - v4 = "NULL"; + RENVOIE_FICHIER(40, v23, (const char *)_characterBuffer); + RENVOIE_FICHIER(0, v22, (const char *)_characterBuffer); + RENVOIE_FICHIER(20, v20, (const char *)_characterBuffer); v5 = 5; - v6 = v20 != v4; - if (!v6) { + if (v20 == "NULL") v20 = Common::String::format("IM%d", _vm->_globals.ECRAN); - } + _characterSprite = _vm->_fileManager.searchCat(v23, 7); - if (_characterSprite) { - _vm->_globals.CAT_FLAG = false; + if (_characterSprite) _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, v23); - } else { - _vm->_globals.CAT_FLAG = true; + else _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, "RES_SAN.RES"); - } + _characterSprite = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); - _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); - if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) + if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); - if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) + else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); - if (!_vm->_graphicsManager.nbrligne) + if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); - v10 = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; - PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; + v10 = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; + PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; _vm->_graphicsManager.NB_SCREEN(); _vm->_objectsManager.PERSO_ON = true; CHERCHE_PAL(v10, 1); @@ -1262,7 +1252,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { clearCharacterAnim(); _vm->_globals.NOPARLE = false; _vm->_globals.NECESSAIRE = true; - BUFFERPERSO = _vm->_globals.freeMemory(BUFFERPERSO); + _characterBuffer = _vm->_globals.freeMemory(_characterBuffer); _characterSprite = _vm->_globals.freeMemory(_characterSprite); _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = false; diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index 3cb680d866..65b06bf8a4 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -34,13 +34,13 @@ class TalkManager { private: HopkinsEngine *_vm; public: - Common::String FQUEST; - Common::String FREPON; - byte *BUFFERPERSO; - byte *PALPERSO; + Common::String _questionsFilename; + Common::String _answersFilename; + byte *_characterBuffer; + byte *_characterPalette; byte *_characterSprite; byte *ADR_ANIM; - size_t TAILLEPERSO; + size_t _characterSize; int STATI; int PLIGNE1, PLIGNE2; int PLIGNE3, PLIGNE4; -- cgit v1.2.3