From 4fed1f580eb3a02ffde3f3b8ee4f8167326a7782 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 29 Jan 2013 08:35:14 +0100 Subject: HOPKINS: More renaming in the Global class --- engines/hopkins/computer.cpp | 32 +++++++++++----------- engines/hopkins/font.cpp | 30 ++++++++++----------- engines/hopkins/globals.cpp | 39 ++++++++++++--------------- engines/hopkins/globals.h | 30 +++++++++------------ engines/hopkins/hopkins.cpp | 64 +++++++++++++++++++++----------------------- engines/hopkins/lines.cpp | 44 ++++++++++++------------------ engines/hopkins/objects.cpp | 64 ++++++++++++++++++++++---------------------- engines/hopkins/talk.cpp | 4 +-- 8 files changed, 143 insertions(+), 164 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index b4b89f7dac..38b464cf68 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -77,15 +77,15 @@ void ComputerManager::setTextMode() { _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager._lineNbr = SCREEN_WIDTH; - _vm->_globals.police = _vm->_globals.freeMemory(_vm->_globals.police); + _vm->_globals._font = _vm->_globals.freeMemory(_vm->_globals._font); Common::String filename = "STFONT.SPR"; Common::File f; if (!f.exists(filename)) filename = "FONTE.SPR"; // Used by the BeOS and OS/2 versions as an alternative - _vm->_globals.police = _vm->_fileManager.loadFile(filename); - _vm->_globals.police_l = 8; - _vm->_globals.police_h = 8; + _vm->_globals._font = _vm->_fileManager.loadFile(filename); + _vm->_globals._fontFixedWidth = 8; + _vm->_globals._fontFixedHeight = 8; _vm->_graphicsManager.loadImage("WINTEXT"); _vm->_graphicsManager.fadeInLong(); @@ -424,28 +424,28 @@ void ComputerManager::displayMessage(int xp, int yp, int textIdx) { // BackSpace if (curChar == 8 && textIndex > 0) { _inputBuf[textIndex--] = 0; - x1 -= _vm->_globals.police_l; - x2 = x1 + 2 * _vm->_globals.police_l; - _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, 3 * _vm->_globals.police_l, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); + x1 -= _vm->_globals._fontFixedWidth; + x2 = x1 + 2 * _vm->_globals._fontFixedWidth; + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, 3 * _vm->_globals._fontFixedWidth, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); _vm->_graphicsManager.addVesaSegment(x1, yp, x2, yp + 12); _vm->_fontManager.displayTextVesa(x1, yp, "_", 252); } if (mappedChar != '*') { newChar = mappedChar; - _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_globals.police_l, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); - _vm->_graphicsManager.addVesaSegment(x1, yp, _vm->_globals.police_l + x1, yp + 12); + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_globals._fontFixedWidth, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); + _vm->_graphicsManager.addVesaSegment(x1, yp, _vm->_globals._fontFixedWidth + x1, yp + 12); _inputBuf[textIndex] = newChar; charString = Common::String::format("%c_", newChar); _vm->_fontManager.displayTextVesa(x1, yp, charString, 252); ++textIndex; - x1 += _vm->_globals.police_l; + x1 += _vm->_globals._fontFixedWidth; } _vm->_eventsManager.VBL(); } while (textIndex != textIdx && curChar != 13); - _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_globals.police_l, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); - _vm->_graphicsManager.addVesaSegment(x1, yp, _vm->_globals.police_l + x1, yp + 12); + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_globals._fontFixedWidth, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); + _vm->_graphicsManager.addVesaSegment(x1, yp, _vm->_globals._fontFixedWidth + x1, yp + 12); _vm->_eventsManager.VBL(); _inputBuf[textIndex] = 0; @@ -470,11 +470,11 @@ void ComputerManager::outText2(const Common::String &msg) { * Restores the scene for the FBI headquarters room */ void ComputerManager::restoreFBIRoom() { - _vm->_globals.freeMemory(_vm->_globals.police); - _vm->_globals.police = _vm->_fileManager.loadFile("FONTE3.SPR"); + _vm->_globals.freeMemory(_vm->_globals._font); + _vm->_globals._font = _vm->_fileManager.loadFile("FONTE3.SPR"); - _vm->_globals.police_l = 12; - _vm->_globals.police_h = 21; + _vm->_globals._fontFixedWidth = 12; + _vm->_globals._fontFixedHeight = 21; _vm->_eventsManager._mouseFl = true; } diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index faa77377f1..59c37b27f8 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -135,7 +135,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in int v73 = xp; if (idx < 0) error("Bad number for text"); - _vm->_globals.police_l = 11; + _vm->_globals._fontFixedWidth = 11; _vm->_globals._boxWidth = 11 * _text[idx]._length; if (_text[idx]._textLoadedFl) { @@ -144,7 +144,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in int yCurrent = yp + 5; for (int lineNum = 0; lineNum < _text[idx]._lineCount; ++lineNum) { displayText(xp + 5, yCurrent, _text[idx]._lines[lineNum], _text[idx]._color); - yCurrent += _vm->_globals.police_h + 1; + yCurrent += _vm->_globals._fontFixedHeight + 1; } } else { int height = _text[idx]._height; @@ -243,7 +243,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in byte v16 = _tempText[v15]; if (v16 <= 31) v16 = ' '; - _vm->_globals._boxWidth += _vm->_objectsManager.getWidth(_vm->_globals.police, v16 - 32); + _vm->_globals._boxWidth += _vm->_objectsManager.getWidth(_vm->_globals._font, v16 - 32); } _vm->_globals._boxWidth += 2; @@ -271,7 +271,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in do curChar = _tempText[v65 + v19++]; while (curChar != ' ' && curChar != '%'); - if (v19 >= ptrb / _vm->_globals.police_l) { + if (v19 >= ptrb / _vm->_globals._fontFixedWidth) { if (curChar == '%') curChar = ' '; break; @@ -306,7 +306,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in byte v24 = (v23 >= (int)line.size()) ? '\0' : line.c_str()[v23]; if (v24 <= 32) v24 = ' '; - ptrc += _vm->_objectsManager.getWidth(_vm->_globals.police, (byte)v24 - 32); + ptrc += _vm->_objectsManager.getWidth(_vm->_globals._font, (byte)v24 - 32); } _textSortArray[i] = ptrc; } @@ -344,7 +344,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in int posX = v73; int posY = yp; int saveWidth = _vm->_globals._boxWidth + 10; - int saveHeight = (_vm->_globals.police_h + 1) * lineCount + 12; + int saveHeight = (_vm->_globals._fontFixedHeight + 1) * lineCount + 12; if (_text[idx]._textType == 6) { int v27 = saveWidth / 2; if (v27 < 0) @@ -378,7 +378,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in for (int lineNum = 0; lineNum < lineCount; ++lineNum) { displayText(v73 + 5, v71, _text[idx]._lines[lineNum], _text[idx]._color); - v71 += _vm->_globals.police_h + 1; + v71 += _vm->_globals._fontFixedHeight + 1; } int blockWidth = saveWidth + 1; @@ -418,9 +418,9 @@ void FontManager::displayTextVesa(int xp, int yp, const Common::String &message, break; if (currChar >= 32) { charIndex = currChar - 32; - _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, + _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals._font, currentX, yp, currChar - 32, col); - currentX += _vm->_objectsManager.getWidth(_vm->_globals.police, charIndex); + currentX += _vm->_objectsManager.getWidth(_vm->_globals._font, charIndex); } } @@ -436,8 +436,8 @@ void FontManager::displayText(int xp, int yp, const Common::String &message, int if (currentChar > 31) { int characterIndex = currentChar - 32; - _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, xp, yp, characterIndex, col); - xp += _vm->_objectsManager.getWidth(_vm->_globals.police, characterIndex); + _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals._font, xp, yp, characterIndex, col); + xp += _vm->_objectsManager.getWidth(_vm->_globals._font, characterIndex); } } } @@ -463,7 +463,7 @@ void FontManager::renderTextDisplay(int xp, int yp, const Common::String &msg, i break; if (curChar >= 32) { byte printChar = curChar - 32; - _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, charEndPosX, yp, printChar, fontCol); + _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals._font, charEndPosX, yp, printChar, fontCol); // UGLY HACK: For some obscure reason, the BeOS and OS/2 versions use another font file, which doesn't have variable width. // All the fonts have a length of 9, which results in completely broken text in the computer. @@ -472,13 +472,13 @@ void FontManager::renderTextDisplay(int xp, int yp, const Common::String &msg, i int charWidth; if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) { if ((curChar >= 'A' && curChar <= 'Z') || (curChar >= 'a' && curChar <= 'z' && curChar != 'm' && curChar != 'w') || (curChar >= '0' && curChar <= '9') || curChar == '*' || (curChar >= 128 && curChar <= 168)) - charWidth = _vm->_objectsManager.getWidth(_vm->_globals.police, printChar) - 1; + charWidth = _vm->_objectsManager.getWidth(_vm->_globals._font, printChar) - 1; else if (curChar == 'm' || curChar == 'w') - charWidth = _vm->_objectsManager.getWidth(_vm->_globals.police, printChar); + charWidth = _vm->_objectsManager.getWidth(_vm->_globals._font, printChar); else charWidth = 6; } else - charWidth = _vm->_objectsManager.getWidth(_vm->_globals.police, printChar); + charWidth = _vm->_objectsManager.getWidth(_vm->_globals._font, printChar); int charStartPosX = charEndPosX; charEndPosX += charWidth; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 5d27768522..d912f4f227 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -110,11 +110,11 @@ Globals::Globals() { PUBEXIT = false; _speed = 1; - g_old_anim = 0; + _oldFrameIndex = 0; _oldDirection = 0; _oldDirectionSpriteIdx = 59; _lastDirection = 0; - police_l = police_h = 0; + _fontFixedWidth = _fontFixedHeight = 0; TETE = NULL; NUM_FICHIER_OBJ = 0; nbrligne = 0; @@ -152,12 +152,10 @@ Globals::Globals() { Credit_bx1 = -1; Credit_by = -1; Credit_by1 = -1; - Credit_y = 0; - Credit_lignes = 0; - memset(Credit, 0, 12000); - Credit_step = 0; - Credit_l = 0; - Credit_h = 0; + _creditsPosY = 0; + _creditsLineNumb = 0; + memset(_creditsItem, 0, 12000); + _creditsStep = 0; _oceanDirection = 0; @@ -168,13 +166,12 @@ Globals::Globals() { CACHE_BANQUE[idx] = NULL; SPRITE_ECRAN = NULL; _saveData = NULL; - inventaire2 = NULL; GESTE = NULL; _inventoryObject = NULL; _forestSprite = NULL; _answerBuffer = g_PTRNUL; ADR_FICHIER_OBJ = NULL; - police = NULL; + _font = NULL; PERSO = NULL; OPTION_SPR = NULL; @@ -186,15 +183,14 @@ Globals::Globals() { _optionDialogFl = false; _cacheFl = false; _introSpeechOffFl = false; - couleur_40 = 50; + _baseMapColor = 50; // Reset indexed variables _hotspotTextColor = 0; - oldzone_46 = 0; - old_x1_65 = 0; - old_y1_66 = 0; - old_x2_67 = 0; - old_y2_68 = 0; + _oldRouteFromX = 0; + _oldRouteFromY = 0; + _oldRouteDestX = 0; + _oldRouteDestY = 0; _oldMouseZoneId = 0; _oldZoneNum = 0; _oldMouseX = 0; @@ -207,13 +203,12 @@ Globals::Globals() { Globals::~Globals() { free(ICONE); freeMemory(TETE); - freeMemory(police); + freeMemory(_font); freeMemory(BUF_ZONE); for (int idx = 0; idx < 6; ++idx) CACHE_BANQUE[idx] = freeMemory(CACHE_BANQUE[idx]); freeMemory(SPRITE_ECRAN); freeMemory((byte *)_saveData); - freeMemory(inventaire2); freeMemory(GESTE); freeMemory(_inventoryObject); freeMemory(_forestSprite); @@ -273,9 +268,9 @@ void Globals::clearAll() { nbrligne = 80; INIT_ANIM(); - police = g_PTRNUL; - police_h = 0; - police_l = 0; + _font = g_PTRNUL; + _fontFixedHeight = 0; + _fontFixedWidth = 0; _boxWidth = 0; _vm->_fontManager.clearAll(); @@ -326,7 +321,7 @@ void Globals::loadCharacterData() { Hopkins[idx].field2 = *srcP++; } - g_old_anim = -1; + _oldFrameIndex = -1; _oldDirection = -1; } diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 8676c9384a..c29b9789ff 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -304,18 +304,17 @@ public: Common::String FICH_ZONE; Common::String FICH_TEXTE; bool _censorshipFl; - int g_old_anim; + int _oldFrameIndex; int _oldDirection, _oldDirectionSpriteIdx; int _lastDirection; - byte *police; - int police_l; - int police_h; + byte *_font; + int _fontFixedWidth; + int _fontFixedHeight; byte *TETE; byte *ICONE; byte *BUF_ZONE; byte *SPRITE_ECRAN; Sauvegarde *_saveData; - byte *inventaire2; byte *GESTE; int NUM_FICHIER_OBJ; int nbrligne; // Useless variable? @@ -358,18 +357,17 @@ public: bool GOACTION; int Compteur; int _actionDirection; - int couleur_40; + int _baseMapColor; int _hotspotTextColor; - int oldzone_46; - int old_x1_65; - int old_y1_66; - int old_x2_67; + int _oldRouteFromX; + int _oldRouteFromY; + int _oldRouteDestX; int _oldMouseZoneId; int _oldMouseX, _oldMouseY; int compteur_71; bool _forceHideText; - int old_y2_68; + int _oldRouteDestY; int _oldZoneNum; int j_104; @@ -377,12 +375,10 @@ public: int Credit_bx1; int Credit_by; int Credit_by1; - int Credit_y; - int Credit_lignes; - CreditItem Credit[200]; - int Credit_step; - int Credit_l; - int Credit_h; + int _creditsPosY; + int _creditsLineNumb; + CreditItem _creditsItem[200]; + int _creditsStep; int _oceanDirection; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 766c37bea3..2ff70f5abd 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1557,7 +1557,7 @@ void HopkinsEngine::initializeSystem() { // Set graphics mode _graphicsManager.setGraphicalMode(SCREEN_WIDTH, SCREEN_HEIGHT); - // Synchronise the sound settings from ScummVM + // Synchronize the sound settings from ScummVM _soundManager.syncSoundSettings(); const Common::FSNode gameDataDir(ConfMan.get("path")); @@ -1608,9 +1608,9 @@ void HopkinsEngine::initializeSystem() { _globals.clearAll(); - _globals.police = _fileManager.loadFile("FONTE3.SPR"); - _globals.police_l = 12; - _globals.police_h = 21; + _globals._font = _fileManager.loadFile("FONTE3.SPR"); + _globals._fontFixedWidth = 12; + _globals._fontFixedHeight = 21; _globals.ICONE = _fileManager.loadFile("ICONE.SPR"); _globals.TETE = _fileManager.loadFile("TETE.SPR"); @@ -2326,10 +2326,10 @@ int HopkinsEngine::handleBaseMap() { zone = 6; if (zone) { _eventsManager.changeMouseCursor(4); - _globals.couleur_40 += 25; - if (_globals.couleur_40 > 100) - _globals.couleur_40 = 0; - _graphicsManager.SETCOLOR4(251, _globals.couleur_40, _globals.couleur_40, _globals.couleur_40); + _globals._baseMapColor += 25; + if (_globals._baseMapColor > 100) + _globals._baseMapColor = 0; + _graphicsManager.SETCOLOR4(251, _globals._baseMapColor, _globals._baseMapColor, _globals._baseMapColor); } else { _eventsManager.changeMouseCursor(0); _graphicsManager.SETCOLOR4(251, 100, 100, 100); @@ -2370,10 +2370,8 @@ int HopkinsEngine::handleBaseMap() { } void HopkinsEngine::loadCredits() { - _globals.Credit_y = 440; - _globals.Credit_l = 10; - _globals.Credit_h = 40; - _globals.Credit_step = 45; + _globals._creditsPosY = 440; + _globals._creditsStep = 45; byte *bufPtr; switch (_globals._language) { case LANG_EN: @@ -2399,25 +2397,25 @@ void HopkinsEngine::loadCredits() { loopCond = true; break; } - _globals.Credit[idxLines]._colour = curPtr[1]; - _globals.Credit[idxLines]._actvFl = true; - _globals.Credit[idxLines]._linePosY = _globals.Credit_y + idxLines * _globals.Credit_step; + _globals._creditsItem[idxLines]._colour = curPtr[1]; + _globals._creditsItem[idxLines]._actvFl = true; + _globals._creditsItem[idxLines]._linePosY = _globals._creditsPosY + idxLines * _globals._creditsStep; int idxBuf = 0; for(; idxBuf < 49; idxBuf++) { byte curChar = curPtr[idxBuf + 3]; if (curChar == '%' || curChar == 10) break; - _globals.Credit[idxLines]._line[idxBuf] = curChar; + _globals._creditsItem[idxLines]._line[idxBuf] = curChar; } - _globals.Credit[idxLines]._line[idxBuf] = 0; - _globals.Credit[idxLines]._lineSize = idxBuf - 1; + _globals._creditsItem[idxLines]._line[idxBuf] = 0; + _globals._creditsItem[idxLines]._lineSize = idxBuf - 1; curPtr = curPtr + idxBuf + 2; ++idxLines; } else { curPtr++; } - _globals.Credit_lignes = idxLines; + _globals._creditsLineNumb = idxLines; } while (!loopCond); _globals.freeMemory(bufPtr); @@ -2432,7 +2430,7 @@ void HopkinsEngine::displayCredits(int startPosY, byte *buffer, char colour) { if (!curChar) break; if (curChar > 31) - strWidth += _objectsManager.getWidth(_globals.police, curChar - 32); + strWidth += _objectsManager.getWidth(_globals._font, curChar - 32); } int startPosX = 320 - strWidth / 2; int endPosX = strWidth + startPosX; @@ -2458,15 +2456,15 @@ void HopkinsEngine::displayCredits(int startPosY, byte *buffer, char colour) { if (!curChar) break; if (curChar > 31) { - _graphicsManager.displayFont(_graphicsManager._vesaBuffer, _globals.police, startPosX, startPosY, curChar - 32, colour); - startPosX += _objectsManager.getWidth(_globals.police, curChar - 32); + _graphicsManager.displayFont(_graphicsManager._vesaBuffer, _globals._font, startPosX, startPosY, curChar - 32, colour); + startPosX += _objectsManager.getWidth(_globals._font, curChar - 32); } } } void HopkinsEngine::displayCredits() { loadCredits(); - _globals.Credit_y = 436; + _globals._creditsPosY = 436; _graphicsManager.loadImage("GENERIC"); _graphicsManager.fadeInLong(); _soundManager.WSOUND(28); @@ -2475,14 +2473,14 @@ void HopkinsEngine::displayCredits() { _globals.Credit_bx = _globals.Credit_bx1 = _globals.Credit_by = _globals.Credit_by1 = -1; int soundId = 28; do { - for (int i = 0; i < _globals.Credit_lignes; ++i) { - if (_globals.Credit[i]._actvFl) { - int nextY = _globals.Credit_y + i * _globals.Credit_step; - _globals.Credit[i]._linePosY = nextY; + for (int i = 0; i < _globals._creditsLineNumb; ++i) { + if (_globals._creditsItem[i]._actvFl) { + int nextY = _globals._creditsPosY + i * _globals._creditsStep; + _globals._creditsItem[i]._linePosY = nextY; if ((nextY - 21 >= 0) && (nextY - 21 <= 418)) { int col = 0; - switch (_globals.Credit[i]._colour) { + switch (_globals._creditsItem[i]._colour) { case '1': col = 163; break; @@ -2497,20 +2495,20 @@ void HopkinsEngine::displayCredits() { col = 163; break; } - if (_globals.Credit[i]._lineSize != -1) - displayCredits(nextY, _globals.Credit[i]._line, col); + if (_globals._creditsItem[i]._lineSize != -1) + displayCredits(nextY, _globals._creditsItem[i]._line, col); } } } - --_globals.Credit_y; + --_globals._creditsPosY; if (_globals.Credit_bx != -1 || _globals.Credit_bx1 != -1 || _globals.Credit_by != -1 || _globals.Credit_by1 != -1) { _eventsManager.VBL(); _graphicsManager.copySurface(_graphicsManager._vesaScreen, 60, 50, 520, 380, _graphicsManager._vesaBuffer, 60, 50); } else { _eventsManager.VBL(); } - if (_globals.Credit[_globals.Credit_lignes - 1]._linePosY <= 39) { - _globals.Credit_y = 440; + if (_globals._creditsItem[_globals._creditsLineNumb - 1]._linePosY <= 39) { + _globals._creditsPosY = 440; ++soundId; if (soundId > 31) soundId = 28; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 4ee656848c..1ed1841077 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1204,8 +1204,8 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { if (destY <= 24) clipDestY = 25; if (!_vm->_globals.NOT_VERIF) { - if (abs(fromX - _vm->_globals.old_x1_65) <= 4 && abs(fromY - _vm->_globals.old_y1_66) <= 4 && - abs(_vm->_globals.old_x2_67 - destX) <= 4 && abs(_vm->_globals.old_y2_68 - clipDestY) <= 4) + if (abs(fromX - _vm->_globals._oldRouteFromX) <= 4 && abs(fromY - _vm->_globals._oldRouteFromY) <= 4 && + abs(_vm->_globals._oldRouteDestX - destX) <= 4 && abs(_vm->_globals._oldRouteDestY - clipDestY) <= 4) return (int16 *)g_PTRNUL; if (abs(fromX - destX) <= 4 && abs(fromY - clipDestY) <= 4) @@ -1216,10 +1216,10 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { } _vm->_globals.NOT_VERIF = false; _vm->_globals._oldZoneNum = _vm->_objectsManager._zoneNum; - _vm->_globals.old_x1_65 = fromX; - _vm->_globals.old_x2_67 = destX; - _vm->_globals.old_y1_66 = fromY; - _vm->_globals.old_y2_68 = clipDestY; + _vm->_globals._oldRouteFromX = fromX; + _vm->_globals._oldRouteDestX = destX; + _vm->_globals._oldRouteFromY = fromY; + _vm->_globals._oldRouteDestY = clipDestY; _pathFindingMaxDepth = 0; int v112 = 0; if (destX <= 19) @@ -3004,19 +3004,17 @@ int LinesManager::MZONE() { if (_vm->_globals.ZONEP[squareZoneId]._enabledFl && _squareZone[squareZoneId]._enabledFl == 1 && _squareZone[squareZoneId]._left <= xp && _squareZone[squareZoneId]._right >= xp && _squareZone[squareZoneId]._top <= yp && _squareZone[squareZoneId]._bottom >= yp) { - if (_squareZone[squareZoneId]._squareZoneFl) { - _vm->_globals.oldzone_46 = _zoneLine[_squareZone[squareZoneId]._minZoneLineIdx]._bobZoneIdx; - return _vm->_globals.oldzone_46; - } + if (_squareZone[squareZoneId]._squareZoneFl) + return _zoneLine[_squareZone[squareZoneId]._minZoneLineIdx]._bobZoneIdx; + _segment[_currentSegmentId]._minZoneLineIdx = _squareZone[squareZoneId]._minZoneLineIdx; _segment[_currentSegmentId]._maxZoneLineIdx = _squareZone[squareZoneId]._maxZoneLineIdx; ++_currentSegmentId; } } - if (!_currentSegmentId) { - _vm->_globals.oldzone_46 = -1; + if (!_currentSegmentId) return -1; - } + int colRes1 = 0; for (int yCurrent = yp; yCurrent >= 0; --yCurrent) { @@ -3025,10 +3023,8 @@ int LinesManager::MZONE() { break; } - if (colRes1 == -1) { - _vm->_globals.oldzone_46 = -1; + if (colRes1 == -1) return -1; - } int colRes2 = 0; for (int j = yp; j < _vm->_graphicsManager._maxY; ++j) { @@ -3037,10 +3033,8 @@ int LinesManager::MZONE() { break; } - if (colRes2 == -1) { - _vm->_globals.oldzone_46 = -1; + if (colRes2 == -1) return -1; - } int colRes3 = 0; for (int k = xp; k >= 0; --k) { @@ -3048,10 +3042,8 @@ int LinesManager::MZONE() { if (colRes3 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) break; } - if (colRes3 == -1) { - _vm->_globals.oldzone_46 = -1; + if (colRes3 == -1) return -1; - } int colRes4 = 0; for (int xCurrent = xp; _vm->_graphicsManager._maxX > xCurrent; ++xCurrent) { @@ -3059,13 +3051,11 @@ int LinesManager::MZONE() { if (colRes4 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) break; } - if (colRes1 == colRes2 && colRes1 == colRes3 && colRes1 == colRes4) { - _vm->_globals.oldzone_46 = colRes1; + if (colRes1 == colRes2 && colRes1 == colRes3 && colRes1 == colRes4) result = colRes1; - } else { - _vm->_globals.oldzone_46 = -1; + else result = -1; - } + } else { result = 0; } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 558c006b98..62d02238f5 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1369,7 +1369,7 @@ void ObjectsManager::GOHOME() { if (newPosX != -1 || newPosY != -1) { _vm->_globals._oldDirection = newDirection; _vm->_globals._oldDirectionSpriteIdx = newDirection + 59; - _vm->_globals.g_old_anim = 0; + _vm->_globals._oldFrameIndex = 0; g_old_x = newPosX; g_old_y = newPosY; } else { @@ -1403,13 +1403,13 @@ void ObjectsManager::GOHOME() { return; } if (_vm->_globals._oldDirection == 3) { - if (_vm->_globals.g_old_anim < 24 || _vm->_globals.g_old_anim > 35) { + if (_vm->_globals._oldFrameIndex < 24 || _vm->_globals._oldFrameIndex > 35) { v0 = g_old_x; v58 = g_old_y; v1 = 24; } else { - int v3 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - int v4 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + int v3 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; + int v4 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; if (_sprite[0]._zoomFactor < 0) { v3 = _vm->_graphicsManager.zoomOut(v3, -_sprite[0]._zoomFactor); @@ -1420,20 +1420,20 @@ void ObjectsManager::GOHOME() { } v0 = v3 + g_old_x; v58 = g_old_y + v4; - v1 = _vm->_globals.g_old_anim + 1; + v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 35) v1 = 24; } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 7) { - if (_vm->_globals.g_old_anim < 24 || _vm->_globals.g_old_anim > 35) { + if (_vm->_globals._oldFrameIndex < 24 || _vm->_globals._oldFrameIndex > 35) { v0 = g_old_x; v58 = g_old_y; v1 = 24; } else { - int v9 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - int v10 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + int v9 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; + int v10 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; if (_sprite[0]._zoomFactor < 0) { v9 = _vm->_graphicsManager.zoomOut(v9, -_sprite[0]._zoomFactor); v10 = _vm->_graphicsManager.zoomOut(v10, -_sprite[0]._zoomFactor); @@ -1443,19 +1443,19 @@ void ObjectsManager::GOHOME() { } v0 = g_old_x - v9; v58 = g_old_y - v10; - v1 = _vm->_globals.g_old_anim + 1; + v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 35) v1 = 24; } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 1) { - if (_vm->_globals.g_old_anim > 11) { + if (_vm->_globals._oldFrameIndex > 11) { v0 = g_old_x; v58 = g_old_y; v1 = 0; } else { - int v16 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); + int v16 = abs(_vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2); if (_sprite[0]._zoomFactor < 0) { v16 = _vm->_graphicsManager.zoomOut(v16, -_sprite[0]._zoomFactor); } else if (_sprite[0]._zoomFactor > 0) { @@ -1463,7 +1463,7 @@ void ObjectsManager::GOHOME() { } v0 = g_old_x; v58 = g_old_y - v16; - v1 = _vm->_globals.g_old_anim + 1; + v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 11) v1 = 0; } @@ -1471,12 +1471,12 @@ void ObjectsManager::GOHOME() { } if (_vm->_globals._oldDirection == 5) { - if (_vm->_globals.g_old_anim < 48 || _vm->_globals.g_old_anim > 59) { + if (_vm->_globals._oldFrameIndex < 48 || _vm->_globals._oldFrameIndex > 59) { v0 = g_old_x; v58 = g_old_y; v1 = 48; } else { - int v20 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); + int v20 = abs(_vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2); if (_sprite[0]._zoomFactor < 0) { v20 = _vm->_graphicsManager.zoomOut(v20, -_sprite[0]._zoomFactor); } else if (_sprite[0]._zoomFactor > 0) { @@ -1484,20 +1484,20 @@ void ObjectsManager::GOHOME() { } v0 = g_old_x; v58 = v20 + g_old_y; - v1 = _vm->_globals.g_old_anim + 1; + v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 59) v1 = 48; } _vm->_globals.Compteur = 4 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 2) { - if (_vm->_globals.g_old_anim < 12 || _vm->_globals.g_old_anim > 23) { + if (_vm->_globals._oldFrameIndex < 12 || _vm->_globals._oldFrameIndex > 23) { v0 = g_old_x; v58 = g_old_y; v1 = 12; } else { - int v23 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - int v24 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + int v23 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; + int v24 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; if (_sprite[0]._zoomFactor < 0) { v23 = _vm->_graphicsManager.zoomOut(v23, -_sprite[0]._zoomFactor); v24 = _vm->_graphicsManager.zoomOut(v24, -_sprite[0]._zoomFactor); @@ -1508,20 +1508,20 @@ void ObjectsManager::GOHOME() { } v0 = v23 + g_old_x; v58 = g_old_y + v24; - v1 = _vm->_globals.g_old_anim + 1; + v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 23) v1 = 12; } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 8) { - if (_vm->_globals.g_old_anim < 12 || _vm->_globals.g_old_anim > 23) { + if (_vm->_globals._oldFrameIndex < 12 || _vm->_globals._oldFrameIndex > 23) { v0 = g_old_x; v58 = g_old_y; v1 = 12; } else { - int v29 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - int v30 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + int v29 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; + int v30 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; if (_sprite[0]._zoomFactor < 0) { v29 = _vm->_graphicsManager.zoomOut(v29, -_sprite[0]._zoomFactor); v30 = _vm->_graphicsManager.zoomOut(v30, -_sprite[0]._zoomFactor); @@ -1531,20 +1531,20 @@ void ObjectsManager::GOHOME() { } v0 = g_old_x - v29; v58 = g_old_y + v30; - v1 = _vm->_globals.g_old_anim + 1; + v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 23) v1 = 12; } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 4) { - if (_vm->_globals.g_old_anim < 36 || _vm->_globals.g_old_anim > 47) { + if (_vm->_globals._oldFrameIndex < 36 || _vm->_globals._oldFrameIndex > 47) { v0 = g_old_x; v58 = g_old_y; v1 = 36; } else { - int v35 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - int v36 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + int v35 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; + int v36 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; if (_sprite[0]._zoomFactor < 0) { v35 = _vm->_graphicsManager.zoomOut(v35, -_sprite[0]._zoomFactor); v36 = _vm->_graphicsManager.zoomOut(v36, -_sprite[0]._zoomFactor); @@ -1555,20 +1555,20 @@ void ObjectsManager::GOHOME() { } v0 = v35 + g_old_x; v58 = g_old_y + v36; - v1 = _vm->_globals.g_old_anim + 1; + v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 47) v1 = 36; } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 6) { - if (_vm->_globals.g_old_anim < 36 || _vm->_globals.g_old_anim > 47) { + if (_vm->_globals._oldFrameIndex < 36 || _vm->_globals._oldFrameIndex > 47) { v0 = g_old_x; v58 = g_old_y; v1 = 36; } else { - int v41 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - int v42 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + int v41 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; + int v42 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; if (_sprite[0]._zoomFactor < 0) { v41 = _vm->_graphicsManager.zoomOut(v41, -_sprite[0]._zoomFactor); v42 = _vm->_graphicsManager.zoomOut(v42, -_sprite[0]._zoomFactor); @@ -1579,7 +1579,7 @@ void ObjectsManager::GOHOME() { } v0 = g_old_x - v41; v58 = g_old_y + v42; - v1 = _vm->_globals.g_old_anim + 1; + v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 47) v1 = 36; } @@ -1654,7 +1654,7 @@ void ObjectsManager::GOHOME() { } _vm->_globals._oldDirection = newDirection; _vm->_globals._oldDirectionSpriteIdx = newDirection + 59; - _vm->_globals.g_old_anim = v1; + _vm->_globals._oldFrameIndex = v1; g_old_x = newPosX; g_old_y = newPosY; } diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 60553cd009..88110157ca 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -516,7 +516,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { Common::File f; int filesize; - _vm->_globals.police_l = 11; + _vm->_globals._fontFixedWidth = 11; // Build up the filename filename = dest = file; @@ -577,7 +577,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { ++v10; } while (v11 != ' ' && v11 != '%'); - if (v10 >= v15 / _vm->_globals.police_l) { + if (v10 >= v15 / _vm->_globals._fontFixedWidth) { if (v11 == '%') v11 = ' '; break; -- cgit v1.2.3