diff options
-rw-r--r-- | engines/hopkins/computer.cpp | 32 | ||||
-rw-r--r-- | engines/hopkins/dialogs.cpp | 5 | ||||
-rw-r--r-- | engines/hopkins/events.h | 1 | ||||
-rw-r--r-- | engines/hopkins/font.cpp | 39 | ||||
-rw-r--r-- | engines/hopkins/font.h | 4 | ||||
-rw-r--r-- | engines/hopkins/globals.cpp | 7 | ||||
-rw-r--r-- | engines/hopkins/globals.h | 181 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 12 | ||||
-rw-r--r-- | engines/hopkins/talk.cpp | 4 |
9 files changed, 141 insertions, 144 deletions
diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 04c81fe2b5..12ac40e6d8 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._font = _vm->_globals.freeMemory(_vm->_globals._font); + _vm->_fontManager._font = _vm->_globals.freeMemory(_vm->_fontManager._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._font = _vm->_fileManager.loadFile(filename); - _vm->_globals._fontFixedWidth = 8; - _vm->_globals._fontFixedHeight = 8; + _vm->_fontManager._font = _vm->_fileManager.loadFile(filename); + _vm->_fontManager._fontFixedWidth = 8; + _vm->_fontManager._fontFixedHeight = 8; _vm->_graphicsManager.loadImage("WINTEXT"); _vm->_graphicsManager.fadeInLong(); @@ -421,28 +421,28 @@ void ComputerManager::displayMessage(int xp, int yp, int textIdx) { // BackSpace if (curChar == 8 && textIndex > 0) { _inputBuf[textIndex--] = 0; - 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); + x1 -= _vm->_fontManager._fontFixedWidth; + x2 = x1 + 2 * _vm->_fontManager._fontFixedWidth; + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, 3 * _vm->_fontManager._fontFixedWidth, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); _vm->_graphicsManager.addVesaSegment(x1, yp, x2, yp + 12); _vm->_fontManager.displayTextVesa(x1, yp, "_", 252); } if (mappedChar != '*') { char newChar = mappedChar; - _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->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_fontManager._fontFixedWidth, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); + _vm->_graphicsManager.addVesaSegment(x1, yp, _vm->_fontManager._fontFixedWidth + x1, yp + 12); _inputBuf[textIndex] = newChar; Common::String charString = Common::String::format("%c_", newChar); _vm->_fontManager.displayTextVesa(x1, yp, charString, 252); ++textIndex; - x1 += _vm->_globals._fontFixedWidth; + x1 += _vm->_fontManager._fontFixedWidth; } _vm->_eventsManager.VBL(); } while (textIndex != textIdx && curChar != 13); - _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->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_fontManager._fontFixedWidth, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); + _vm->_graphicsManager.addVesaSegment(x1, yp, _vm->_fontManager._fontFixedWidth + x1, yp + 12); _vm->_eventsManager.VBL(); _inputBuf[textIndex] = 0; @@ -467,11 +467,11 @@ void ComputerManager::outText2(const Common::String &msg) { * Restores the scene for the FBI headquarters room */ void ComputerManager::restoreFBIRoom() { - _vm->_globals.freeMemory(_vm->_globals._font); - _vm->_globals._font = _vm->_fileManager.loadFile("FONTE3.SPR"); + _vm->_globals.freeMemory(_vm->_fontManager._font); + _vm->_fontManager._font = _vm->_fileManager.loadFile("FONTE3.SPR"); + _vm->_fontManager._fontFixedWidth = 12; + _vm->_fontManager._fontFixedHeight = 21; - _vm->_globals._fontFixedWidth = 12; - _vm->_globals._fontFixedHeight = 21; _vm->_eventsManager._mouseFl = true; } diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index e1a8e16811..690093f22b 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -238,11 +238,6 @@ void DialogsManager::showOptionsDialog() { doneFlag = true; } - if (_vm->_graphicsManager.MANU_SCROLL) - _vm->_globals._menuScrollType = 1; - else - _vm->_globals._menuScrollType = 2; - if (_vm->_globals._speed == 1) _vm->_globals._menuSpeed = 6; else if (_vm->_globals._speed == 2) diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 4ca66fb1f1..03f8593091 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -86,7 +86,6 @@ public: void setMouseOn(); void VBL(); - }; } // End of namespace Hopkins diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 59c37b27f8..b9ee2d886f 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -36,11 +36,19 @@ FontManager::FontManager() { clearAll(); } +FontManager::~FontManager() { + _vm->_globals.freeMemory(_font); +} + void FontManager::setParent(HopkinsEngine *vm) { _vm = vm; } void FontManager::clearAll() { + _font = g_PTRNUL; + _fontFixedHeight = 0; + _fontFixedWidth = 0; + for (int idx = 0; idx < 12; ++idx) { Common::fill((byte *)&_text[idx], (byte *)&_text[idx] + sizeof(TxtItem), 0); @@ -135,7 +143,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._fontFixedWidth = 11; + _fontFixedWidth = 11; _vm->_globals._boxWidth = 11 * _text[idx]._length; if (_text[idx]._textLoadedFl) { @@ -144,7 +152,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._fontFixedHeight + 1; + yCurrent += _fontFixedHeight + 1; } } else { int height = _text[idx]._height; @@ -243,7 +251,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._font, v16 - 32); + _vm->_globals._boxWidth += _vm->_objectsManager.getWidth(_font, v16 - 32); } _vm->_globals._boxWidth += 2; @@ -271,7 +279,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._fontFixedWidth) { + if (v19 >= ptrb / _fontFixedWidth) { if (curChar == '%') curChar = ' '; break; @@ -306,7 +314,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._font, (byte)v24 - 32); + ptrc += _vm->_objectsManager.getWidth(_font, (byte)v24 - 32); } _textSortArray[i] = ptrc; } @@ -344,7 +352,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._fontFixedHeight + 1) * lineCount + 12; + int saveHeight = (_fontFixedHeight + 1) * lineCount + 12; if (_text[idx]._textType == 6) { int v27 = saveWidth / 2; if (v27 < 0) @@ -378,7 +386,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._fontFixedHeight + 1; + v71 += _fontFixedHeight + 1; } int blockWidth = saveWidth + 1; @@ -418,9 +426,8 @@ 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._font, - currentX, yp, currChar - 32, col); - currentX += _vm->_objectsManager.getWidth(_vm->_globals._font, charIndex); + _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _font, currentX, yp, currChar - 32, col); + currentX += _vm->_objectsManager.getWidth(_font, charIndex); } } @@ -436,8 +443,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._font, xp, yp, characterIndex, col); - xp += _vm->_objectsManager.getWidth(_vm->_globals._font, characterIndex); + _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _font, xp, yp, characterIndex, col); + xp += _vm->_objectsManager.getWidth(_font, characterIndex); } } } @@ -463,7 +470,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._font, charEndPosX, yp, printChar, fontCol); + _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _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 +479,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._font, printChar) - 1; + charWidth = _vm->_objectsManager.getWidth(_font, printChar) - 1; else if (curChar == 'm' || curChar == 'w') - charWidth = _vm->_objectsManager.getWidth(_vm->_globals._font, printChar); + charWidth = _vm->_objectsManager.getWidth(_font, printChar); else charWidth = 6; } else - charWidth = _vm->_objectsManager.getWidth(_vm->_globals._font, printChar); + charWidth = _vm->_objectsManager.getWidth(_font, printChar); int charStartPosX = charEndPosX; charEndPosX += charWidth; diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 0d31324421..14aa4a7eae 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -70,10 +70,14 @@ private: byte *_tempText; public: + byte *_font; + int _fontFixedWidth; + int _fontFixedHeight; TxtItem _text[12]; TxtItemList _textList[12]; FontManager(); + ~FontManager(); void setParent(HopkinsEngine *vm); void clearAll(); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index e9229c4d59..e90748236a 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -112,7 +112,6 @@ Globals::Globals() { _oldDirection = 0; _oldDirectionSpriteIdx = 59; _lastDirection = 0; - _fontFixedWidth = _fontFixedHeight = 0; TETE = NULL; NUM_FICHIER_OBJ = 0; nbrligne = 0; @@ -129,7 +128,6 @@ Globals::Globals() { _screenId = 0; _prevScreenId = 0; _characterMaxPosY = 0; - _menuScrollType = 0; _menuScrollSpeed = 0; _menuSpeed = 0; _menuSoundOff = 0; @@ -168,7 +166,6 @@ Globals::Globals() { _forestSprite = NULL; _answerBuffer = g_PTRNUL; ADR_FICHIER_OBJ = NULL; - _font = NULL; PERSO = NULL; _optionDialogSpr = NULL; @@ -200,7 +197,6 @@ Globals::Globals() { Globals::~Globals() { free(ICONE); freeMemory(TETE); - freeMemory(_font); freeMemory(BUF_ZONE); for (int idx = 0; idx < 6; ++idx) CACHE_BANQUE[idx] = freeMemory(CACHE_BANQUE[idx]); @@ -265,9 +261,6 @@ void Globals::clearAll() { nbrligne = 80; INIT_ANIM(); - _font = g_PTRNUL; - _fontFixedHeight = 0; - _fontFixedWidth = 0; _boxWidth = 0; _vm->_fontManager.clearAll(); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 033d40f935..c2b9ec6e69 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -270,129 +270,128 @@ class HopkinsEngine; class Globals { private: HopkinsEngine *_vm; + + byte *_inventoryObject; + + void INIT_ANIM(); + void INIT_VBOB(); + void B_CACHE_OFF(int idx); + public: - byte *CACHE_BANQUE[6]; - ZonePItem ZONEP[106]; - BqeAnimItem Bqe_Anim[35]; - BankItem Bank[8]; - BobItem _bob[36]; - ListeItem Liste[6]; - ListeItem Liste2[35]; - LockAnimItem _lockedAnims[30]; - VBobItem VBob[30]; - ObjetWItem ObjetW[300]; - CacheItem Cache[25]; - int BOBZONE[105]; - bool BOBZONE_FLAG[105]; - int _spriteSize[500]; - HopkinsItem Hopkins[70]; - int _inventory[36]; - SortItem _sortedDisplay[51]; - Language _language; + bool _disableInventFl; + bool _cityMapEnabledFl; bool _linuxEndDemoFl; - int PERSO_TYPE; - uint _speed; - Common::String FICH_ZONE; - Common::String FICH_TEXTE; bool _censorshipFl; - int _oldFrameIndex; + bool _helicopterFl; + bool _forestFl; + bool _introSpeechOffFl; + bool _cacheFl; + bool _forceHideText; + int _exitId; + int _oceanDirection; int _oldDirection, _oldDirectionSpriteIdx; + int _actionDirection; int _lastDirection; - byte *_font; - int _fontFixedWidth; - int _fontFixedHeight; - byte *TETE; - byte *ICONE; - byte *BUF_ZONE; - byte *SPRITE_ECRAN; - Sauvegarde *_saveData; - byte *GESTE; - int NUM_FICHIER_OBJ; - int nbrligne; // Useless variable? - int _boxWidth; - byte *_inventoryObject; - int GESTE_FLAG; - byte *_forestSprite; - bool _forestFl; - byte *_answerBuffer; - byte *ADR_FICHIER_OBJ; - byte *PERSO; + int _oldFrameIndex; + int _hotspotTextColor; + int _inventory[36]; int _objectWidth, _objectHeight; - bool _helicopterFl; - uint32 _catalogPos; - uint32 _catalogSize; - int iRegul; - int _exitId; - int _mapCarPosX, _mapCarPosY; int _screenId; int _prevScreenId; + int _boxWidth; + int _mapCarPosX, _mapCarPosY; int _characterMaxPosY; - bool _disableInventFl; - bool NOMARCHE; - byte *_optionDialogSpr; - bool _optionDialogFl; - int _menuDisplayType; + int _baseMapColor; + int _spriteSize[500]; + int _sortedDisplayCount; + int _oldMouseZoneId; + int _oldMouseX, _oldMouseY; + uint _speed; + byte *_forestSprite; + byte *_answerBuffer; + Sauvegarde *_saveData; + Language _language; + HopkinsItem Hopkins[70]; + BobItem _bob[36]; + SortItem _sortedDisplay[51]; + + CreditItem _creditsItem[200]; + int _creditsLineNumb; + int _creditsStep; + int _creditsPosY; + int Credit_bx; + int Credit_bx1; + int Credit_by; + int Credit_by1; + int _menuSpeed; - int _menuScrollType; - int _menuScrollSpeed; int _menuSoundOff; + int _menuTextOff; int _menuVoiceOff; int _menuMusicOff; - int _menuTextOff; - int _sortedDisplayCount; - bool NOT_VERIF; - bool _cacheFl; - bool _introSpeechOffFl; - bool _cityMapEnabledFl; - bool GOACTION; - int Compteur; - int _actionDirection; - int _baseMapColor; + int _menuDisplayType; + int _menuScrollSpeed; - int _hotspotTextColor; + byte *_optionDialogSpr; + bool _optionDialogFl; + uint32 _catalogPos; + uint32 _catalogSize; + LockAnimItem _lockedAnims[30]; int _oldRouteFromX; int _oldRouteFromY; int _oldRouteDestX; - int _oldMouseZoneId; - int _oldMouseX, _oldMouseY; - int compteur_71; - bool _forceHideText; int _oldRouteDestY; int _oldZoneNum; - int j_104; - - int Credit_bx; - int Credit_bx1; - int Credit_by; - int Credit_by1; - int _creditsPosY; - int _creditsLineNumb; - CreditItem _creditsItem[200]; - int _creditsStep; - int _oceanDirection; + byte *TETE; + byte *ICONE; + bool NOMARCHE; + int iRegul; + byte *BUF_ZONE; + int nbrligne; // Useless variable? + BqeAnimItem Bqe_Anim[35]; + byte *SPRITE_ECRAN; + byte *PERSO; + int PERSO_TYPE; + int BOBZONE[105]; + bool BOBZONE_FLAG[105]; + bool NOT_VERIF; + ZonePItem ZONEP[106]; + ObjetWItem ObjetW[300]; + int NUM_FICHIER_OBJ; + byte *ADR_FICHIER_OBJ; + ListeItem Liste[6]; + ListeItem Liste2[35]; + BankItem Bank[8]; + byte *CACHE_BANQUE[6]; + CacheItem Cache[25]; + VBobItem VBob[30]; + int Compteur; + int compteur_71; + Common::String FICH_ZONE; + bool GOACTION; + int j_104; + int GESTE_FLAG; + byte *GESTE; + Common::String FICH_TEXTE; Globals(); ~Globals(); void setParent(HopkinsEngine *vm); - + byte *allocMemory(int count); + byte *freeMemory(byte *p); void setConfig(); + void loadObjects(); void clearAll(); void loadCharacterData(); - void INIT_ANIM(); - void INIT_VBOB(); - void CLEAR_VBOB(); - void loadObjects(); - byte *allocMemory(int count); - byte *freeMemory(byte *p); - void resetCache(); + void loadCache(const Common::String &file); + + void CLEAR_VBOB(); void CACHE_ON(); void CACHE_OFF(int v1 = 0); void CACHE_SUB(int idx); void CACHE_ADD(int idx); - void loadCache(const Common::String &file); - void B_CACHE_OFF(int idx); }; // Global null pointer diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 1b8187a5cf..0b5aa67aae 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1610,9 +1610,9 @@ void HopkinsEngine::initializeSystem() { _globals.clearAll(); - _globals._font = _fileManager.loadFile("FONTE3.SPR"); - _globals._fontFixedWidth = 12; - _globals._fontFixedHeight = 21; + _fontManager._font = _fileManager.loadFile("FONTE3.SPR"); + _fontManager._fontFixedWidth = 12; + _fontManager._fontFixedHeight = 21; _globals.ICONE = _fileManager.loadFile("ICONE.SPR"); _globals.TETE = _fileManager.loadFile("TETE.SPR"); @@ -2432,7 +2432,7 @@ void HopkinsEngine::displayCredits(int startPosY, byte *buffer, char colour) { if (!curChar) break; if (curChar > 31) - strWidth += _objectsManager.getWidth(_globals._font, curChar - 32); + strWidth += _objectsManager.getWidth(_fontManager._font, curChar - 32); } int startPosX = 320 - strWidth / 2; int endPosX = strWidth + startPosX; @@ -2458,8 +2458,8 @@ void HopkinsEngine::displayCredits(int startPosY, byte *buffer, char colour) { if (!curChar) break; if (curChar > 31) { - _graphicsManager.displayFont(_graphicsManager._vesaBuffer, _globals._font, startPosX, startPosY, curChar - 32, colour); - startPosX += _objectsManager.getWidth(_globals._font, curChar - 32); + _graphicsManager.displayFont(_graphicsManager._vesaBuffer, _fontManager._font, startPosX, startPosY, curChar - 32, colour); + startPosX += _objectsManager.getWidth(_fontManager._font, curChar - 32); } } } diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index fea3bcc235..319b9f93a6 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._fontFixedWidth = 11; + _vm->_fontManager._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._fontFixedWidth) { + if (v10 >= v15 / _vm->_fontManager._fontFixedWidth) { if (v11 == '%') v11 = ' '; break; |