From b8e504518ea77e8106d7dd8be087c5f51c8dff01 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Mar 2013 18:57:46 +0100 Subject: HOPKINS: Some renaming and refactoring in Globals --- engines/hopkins/font.cpp | 24 +++++------ engines/hopkins/font.h | 1 + engines/hopkins/globals.cpp | 17 +++----- engines/hopkins/globals.h | 5 +-- engines/hopkins/graphics.cpp | 10 ++--- engines/hopkins/hopkins.cpp | 52 ++++++++++++------------ engines/hopkins/objects.cpp | 26 ++++++------ engines/hopkins/script.cpp | 94 ++++++++++++++++++++++---------------------- 8 files changed, 113 insertions(+), 116 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 0379e29bfd..03b4e2e472 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -84,6 +84,8 @@ void FontManager::clearAll() { _tempText = g_PTRNUL; _zoneText = g_PTRNUL; + + _boxWidth = 240; } void FontManager::initData() { @@ -160,7 +162,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in error("Bad number for text"); _fontFixedWidth = 11; - _vm->_globals->_boxWidth = 11 * _text[idx]._length; + _boxWidth = 11 * _text[idx]._length; if (_text[idx]._textLoadedFl) { int textType = _text[idx]._textType; if (textType != 6 && textType != 1 && textType != 3 && textType != 5) { @@ -254,29 +256,29 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in if (bufSize && bufSize > textLength) { _text[idx]._length = textLength; - _vm->_globals->_boxWidth = 0; + _boxWidth = 0; for (int curStrIdx = 0; curStrIdx < textLength + 1; curStrIdx++) { byte curChar = _tempText[curStrIdx]; if (curChar <= 31) curChar = ' '; - _vm->_globals->_boxWidth += _vm->_objectsManager->getWidth(_font, curChar - 32); + _boxWidth += _vm->_objectsManager->getWidth(_font, curChar - 32); } - _vm->_globals->_boxWidth += 2; - _text[idx]._pos.x = 320 - abs(_vm->_globals->_boxWidth / 2); + _boxWidth += 2; + _text[idx]._pos.x = 320 - abs(_boxWidth / 2); textPosX = _vm->_eventsManager->_startPos.x + _text[idx]._pos.x; lineCount = 1; _text[idx]._lines[0] = Common::String((const char *)_tempText, textLength); } else { - if (!_vm->_globals->_boxWidth) - _vm->_globals->_boxWidth = 240; + if (!_boxWidth) + _boxWidth = 240; int tempTextIdx = 0; int lineSize; byte curChar; do { int curLineSize = 0; - int ptrb = _vm->_globals->_boxWidth - 4; + int ptrb = _boxWidth - 4; for (;;) { lineSize = curLineSize; do @@ -330,12 +332,12 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in for (int i = 0; i <= 19; i++) { if (_textSortArray[i]) - _vm->_globals->_boxWidth = _textSortArray[i]; + _boxWidth = _textSortArray[i]; } if ((_text[idx]._textType < 2) || (_text[idx]._textType > 3)) { int i; - for (i = xp - _vm->_eventsManager->_startPos.x; _vm->_globals->_boxWidth + i > 638 && i > -2 && _text[idx]._textType; i -= 2) + for (i = xp - _vm->_eventsManager->_startPos.x; _boxWidth + i > 638 && i > -2 && _text[idx]._textType; i -= 2) ; _text[idx]._pos.x = i; textPosX = _vm->_eventsManager->_startPos.x + i; @@ -345,7 +347,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in } int posX = textPosX; int posY = yp; - int saveWidth = _vm->_globals->_boxWidth + 10; + int saveWidth = _boxWidth + 10; int saveHeight = (_fontFixedHeight + 1) * lineCount + 12; if (_text[idx]._textType == 6) { _text[idx]._pos.x = 315 - abs(saveWidth / 2); diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index e9483bb256..93e807ea4b 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -68,6 +68,7 @@ private: int _index[4048]; byte *_tempText; byte *_zoneText; + int _boxWidth; void loadZoneText(); public: diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 79edddc40d..87efe9925d 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -107,13 +107,12 @@ Globals::Globals(HopkinsEngine *vm) { _oldDirectionSpriteIdx = 59; _lastDirection = DIR_NONE; _curObjectFileNum = 0; - _boxWidth = 0; _objectWidth = _objectHeight = 0; _catalogPos = 0; _catalogSize = 0; iRegul = 0; _exitId = 0; - PERSO = 0; + _characterSpriteBuf = 0; _screenId = 0; _prevScreenId = 0; _characterMaxPosY = 0; @@ -144,11 +143,11 @@ Globals::Globals(HopkinsEngine *vm) { // Initialize pointers for (int i = 0; i < 6; ++i) _hidingItemData[i] = g_PTRNUL; - SPRITE_ECRAN = NULL; + _levelSpriteBuf = NULL; _saveData = NULL; _answerBuffer = g_PTRNUL; _objectDataBuf = NULL; - PERSO = NULL; + _characterSpriteBuf = NULL; _optionDialogSpr = NULL; // Reset flags @@ -176,11 +175,11 @@ Globals::Globals(HopkinsEngine *vm) { Globals::~Globals() { for (int idx = 0; idx < 6; ++idx) _hidingItemData[idx] = freeMemory(_hidingItemData[idx]); - freeMemory(SPRITE_ECRAN); + freeMemory(_levelSpriteBuf); freeMemory((byte *)_saveData); freeMemory(_answerBuffer); freeMemory(_objectDataBuf); - freeMemory(PERSO); + freeMemory(_characterSpriteBuf); clearVBob(); @@ -229,8 +228,6 @@ void Globals::clearAll() { initAnimBqe(); - _boxWidth = 0; - _vm->_fontManager->clearAll(); initVBob(); @@ -238,7 +235,7 @@ void Globals::clearAll() { _curObjectFileNum = 0; _vm->_dialogsManager->clearAll(); _answerBuffer = g_PTRNUL; - SPRITE_ECRAN = g_PTRNUL; + _levelSpriteBuf = g_PTRNUL; _saveData = (Savegame *)g_PTRNUL; _vm->_objectsManager->_curObjectIndex = 0; @@ -248,8 +245,6 @@ void Globals::clearAll() { _saveData = (Savegame *)malloc(sizeof(Savegame)); memset(_saveData, 0, sizeof(Savegame)); - _boxWidth = 240; - _vm->_eventsManager->clearAll(); _objectDataBuf = g_PTRNUL; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 84549fa4ff..2a27d59c1b 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -249,7 +249,6 @@ public: int _objectWidth, _objectHeight; int _screenId; int _prevScreenId; - int _boxWidth; int _characterMaxPosY; int _baseMapColor; int _spriteSize[500]; @@ -301,12 +300,12 @@ public: ObjectAuthIcon _objectAuthIcons[300]; int _curObjectFileNum; byte *_objectDataBuf; + byte *_characterSpriteBuf; Common::String _zoneFilename; Common::String _textFilename; + byte *_levelSpriteBuf; int iRegul; - byte *SPRITE_ECRAN; - byte *PERSO; ListeItem Liste[6]; ListeItem Liste2[35]; BankItem Bank[8]; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 9730fba51b..5c65e59c5e 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1745,13 +1745,13 @@ void GraphicsManager::initScreen(const Common::String &file, int mode, bool init } if (!mode) { filename = file + ".spr"; - _vm->_globals->SPRITE_ECRAN = _vm->_globals->freeMemory(_vm->_globals->SPRITE_ECRAN); + _vm->_globals->_levelSpriteBuf = _vm->_globals->freeMemory(_vm->_globals->_levelSpriteBuf); if (initializeScreen) { - _vm->_globals->SPRITE_ECRAN = _vm->_fileManager->searchCat(filename, RES_SLI); - if (_vm->_globals->SPRITE_ECRAN) { - _vm->_globals->SPRITE_ECRAN = _vm->_fileManager->loadFile(filename); + _vm->_globals->_levelSpriteBuf = _vm->_fileManager->searchCat(filename, RES_SLI); + if (_vm->_globals->_levelSpriteBuf) { + _vm->_globals->_levelSpriteBuf = _vm->_fileManager->loadFile(filename); } else { - _vm->_globals->SPRITE_ECRAN = _vm->_fileManager->loadFile("RES_SLI.RES"); + _vm->_globals->_levelSpriteBuf = _vm->_fileManager->loadFile("RES_SLI.RES"); } } } diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 76c085c6d8..69c09aa8df 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -165,7 +165,7 @@ bool HopkinsEngine::runWin95Demo() { _globals->_speed = 3; _graphicsManager->fadeOutLong(); _globals->iRegul = 1; - _globals->PERSO = _fileManager->loadFile("PERSO.SPR"); + _globals->_characterSpriteBuf = _fileManager->loadFile("PERSO.SPR"); _globals->_characterType = 0; _objectsManager->_mapCarPosX = _objectsManager->_mapCarPosY = 0; memset(_globals->_saveData, 0, 2000); @@ -182,7 +182,7 @@ bool HopkinsEngine::runWin95Demo() { if (!_globals->_exitId) { _globals->_exitId = _menuManager->menu(); if (_globals->_exitId == -1) { - _globals->PERSO = _globals->freeMemory(_globals->PERSO); + _globals->_characterSpriteBuf = _globals->freeMemory(_globals->_characterSpriteBuf); restoreSystem(); return false; } @@ -455,7 +455,7 @@ bool HopkinsEngine::runLinuxDemo() { playIntro(); _globals->iRegul = 0; - _globals->PERSO = _fileManager->loadFile("PERSO.SPR"); + _globals->_characterSpriteBuf = _fileManager->loadFile("PERSO.SPR"); _globals->_characterType = 0; _objectsManager->_mapCarPosX = _objectsManager->_mapCarPosY = 0; memset(_globals->_saveData, 0, 2000); @@ -470,7 +470,7 @@ bool HopkinsEngine::runLinuxDemo() { if (_globals->_exitId == -1) { if (!shouldQuit()) endLinuxDemo(); - _globals->PERSO = _globals->freeMemory(_globals->PERSO); + _globals->_characterSpriteBuf = _globals->freeMemory(_globals->_characterSpriteBuf); restoreSystem(); } } @@ -819,7 +819,7 @@ bool HopkinsEngine::runFull() { _graphicsManager->fadeOutLong(); } _globals->iRegul = 0; - _globals->PERSO = _fileManager->loadFile("PERSO.SPR"); + _globals->_characterSpriteBuf = _fileManager->loadFile("PERSO.SPR"); _globals->_characterType = 0; _objectsManager->_mapCarPosX = _objectsManager->_mapCarPosY = 0; memset(_globals->_saveData, 0, 2000); @@ -832,7 +832,7 @@ bool HopkinsEngine::runFull() { if (!_globals->_exitId) { _globals->_exitId = _menuManager->menu(); if (_globals->_exitId == -1) { - _globals->PERSO = _globals->freeMemory(_globals->PERSO); + _globals->_characterSpriteBuf = _globals->freeMemory(_globals->_characterSpriteBuf); restoreSystem(); return false; } @@ -1539,21 +1539,21 @@ bool HopkinsEngine::runFull() { case 197: case 198: case 199: - _globals->PERSO = _globals->freeMemory(_globals->PERSO); + _globals->_characterSpriteBuf = _globals->freeMemory(_globals->_characterSpriteBuf); _globals->iRegul = 1; _soundManager->stopSound(); _soundManager->playSound(23); _globals->_exitId = handleBaseMap(); // Handles the base map (non-Windows) //_globals->_exitId = WBASE(); // Handles the 3D Doom level (Windows) _soundManager->stopSound(); - _globals->PERSO = _fileManager->loadFile("PERSO.SPR"); + _globals->_characterSpriteBuf = _fileManager->loadFile("PERSO.SPR"); _globals->_characterType = 0; _globals->iRegul = 0; _graphicsManager->_lineNbr = SCREEN_WIDTH; break; } } - _globals->PERSO = _globals->freeMemory(_globals->PERSO); + _globals->_characterSpriteBuf = _globals->freeMemory(_globals->_characterSpriteBuf); restoreSystem(); return true; } @@ -2058,7 +2058,7 @@ void HopkinsEngine::playUnderwaterBaseCutscene() { } void HopkinsEngine::playEnding() { - _globals->PERSO = _globals->freeMemory(_globals->PERSO); + _globals->_characterSpriteBuf = _globals->freeMemory(_globals->_characterSpriteBuf); _dialogsManager->disableInvent(); _globals->_disableInventFl = true; _graphicsManager->_scrollOffset = 0; @@ -2203,7 +2203,7 @@ void HopkinsEngine::playEnding() { _globals->iRegul = 0; _globals->_exitId = 300; } - _globals->PERSO = _fileManager->loadFile("PERSO.SPR"); + _globals->_characterSpriteBuf = _fileManager->loadFile("PERSO.SPR"); _globals->_characterType = 0; _globals->iRegul = 0; } @@ -2547,13 +2547,13 @@ void HopkinsEngine::handleOceanMouseEvents() { case 1: switch (_globals->_oceanDirection) { case DIR_UP: - _objectsManager->SPACTION(_globals->PERSO, "27,26,25,24,23,22,21,20,19,18,-1,", 6, false); + _objectsManager->SPACTION(_globals->_characterSpriteBuf, "27,26,25,24,23,22,21,20,19,18,-1,", 6, false); break; case DIR_RIGHT: - _objectsManager->SPACTION(_globals->PERSO, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,-1,", 6, false); + _objectsManager->SPACTION(_globals->_characterSpriteBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,-1,", 6, false); break; case DIR_DOWN: - _objectsManager->SPACTION(_globals->PERSO, "9,10,11,12,13,14,15,16,17,18,-1,", 6, false); + _objectsManager->SPACTION(_globals->_characterSpriteBuf, "9,10,11,12,13,14,15,16,17,18,-1,", 6, false); break; default: break; @@ -2584,13 +2584,13 @@ void HopkinsEngine::handleOceanMouseEvents() { case 2: switch (_globals->_oceanDirection) { case DIR_UP: - _objectsManager->SPACTION(_globals->PERSO, "27,28,29,30,31,32,33,34,35,36,-1,", 6, false); + _objectsManager->SPACTION(_globals->_characterSpriteBuf, "27,28,29,30,31,32,33,34,35,36,-1,", 6, false); break; case DIR_DOWN: - _objectsManager->SPACTION(_globals->PERSO, "9,8,7,6,5,4,3,2,1,0,-1,", 6, false); + _objectsManager->SPACTION(_globals->_characterSpriteBuf, "9,8,7,6,5,4,3,2,1,0,-1,", 6, false); break; case DIR_LEFT: - _objectsManager->SPACTION(_globals->PERSO, "18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,-1,", 6, false); + _objectsManager->SPACTION(_globals->_characterSpriteBuf, "18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,-1,", 6, false); break; default: break; @@ -2636,10 +2636,10 @@ void HopkinsEngine::handleOceanMouseEvents() { } } while (oldX <= 235); if (!displAnim) - _objectsManager->SPACTION(_globals->PERSO, "36,35,34,33,32,31,30,29,28,27,-1,", 6, false); + _objectsManager->SPACTION(_globals->_characterSpriteBuf, "36,35,34,33,32,31,30,29,28,27,-1,", 6, false); break; case DIR_DOWN: - _objectsManager->SPACTION(_globals->PERSO, "9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,", 6, false); + _objectsManager->SPACTION(_globals->_characterSpriteBuf, "9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,", 6, false); break; case DIR_LEFT: oldX = _objectsManager->getSpriteX(0); @@ -2659,7 +2659,7 @@ void HopkinsEngine::handleOceanMouseEvents() { } } while (oldX > 236); if (!displAnim) - _objectsManager->SPACTION(_globals->PERSO, "18,19,20,21,22,23,24,25,26,27,-1,", 6, false); + _objectsManager->SPACTION(_globals->_characterSpriteBuf, "18,19,20,21,22,23,24,25,26,27,-1,", 6, false); break; default: break; @@ -2670,7 +2670,7 @@ void HopkinsEngine::handleOceanMouseEvents() { case 4: switch (_globals->_oceanDirection) { case DIR_UP: - _objectsManager->SPACTION(_globals->PERSO, "27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,-1,", 6, false); + _objectsManager->SPACTION(_globals->_characterSpriteBuf, "27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,-1,", 6, false); break; case DIR_RIGHT: oldX = _objectsManager->getSpriteX(0); @@ -2690,7 +2690,7 @@ void HopkinsEngine::handleOceanMouseEvents() { } } while (oldX <= 235); if (!displAnim) - _objectsManager->SPACTION(_globals->PERSO, "0,1,2,3,4,5,6,7,8,9,-1,", 6, false); + _objectsManager->SPACTION(_globals->_characterSpriteBuf, "0,1,2,3,4,5,6,7,8,9,-1,", 6, false); break; case DIR_LEFT: oldX = _objectsManager->getSpriteX(0); @@ -2709,7 +2709,7 @@ void HopkinsEngine::handleOceanMouseEvents() { if (oldX <= 236) { if (!displAnim) - _objectsManager->SPACTION(_globals->PERSO, "18,17,16,15,14,13,12,11,10,9,-1,", 6, false); + _objectsManager->SPACTION(_globals->_characterSpriteBuf, "18,17,16,15,14,13,12,11,10,9,-1,", 6, false); break; } } @@ -2749,7 +2749,7 @@ void HopkinsEngine::handleOceanMaze(int16 curExitId, Common::String backgroundFi _globals->_exitId = 0; _globals->_disableInventFl = true; _soundManager->playSound(soundId); - _globals->PERSO = _fileManager->loadFile("VAISSEAU.SPR"); + _globals->_characterSpriteBuf = _fileManager->loadFile("VAISSEAU.SPR"); if (backgroundFilename.size()) _graphicsManager->loadImage(backgroundFilename); @@ -2795,7 +2795,7 @@ void HopkinsEngine::handleOceanMaze(int16 curExitId, Common::String backgroundFi break; } - _objectsManager->addStaticSprite(_globals->PERSO, Common::Point(_objectsManager->_characterPos.x, 110), 0, _objectsManager->_startSpriteIndex, 0, false, 0, 0); + _objectsManager->addStaticSprite(_globals->_characterSpriteBuf, Common::Point(_objectsManager->_characterPos.x, 110), 0, _objectsManager->_startSpriteIndex, 0, false, 0, 0); _graphicsManager->SETCOLOR3(252, 100, 100, 100); _graphicsManager->SETCOLOR3(253, 100, 100, 100); _graphicsManager->SETCOLOR3(251, 100, 100, 100); @@ -2836,7 +2836,7 @@ void HopkinsEngine::handleOceanMaze(int16 curExitId, Common::String backgroundFi _graphicsManager->fadeOutLong(); _objectsManager->removeSprite(0); _objectsManager->clearScreen(); - _globals->PERSO = _fileManager->loadFile("PERSO.SPR"); + _globals->_characterSpriteBuf = _fileManager->loadFile("PERSO.SPR"); _globals->_characterType = 0; } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index c3e28bd993..83c11588aa 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2061,7 +2061,7 @@ void ObjectsManager::clearScreen() { _vm->_linesManager->resetLastLine(); _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; _vm->_globals->_answerBuffer = _vm->_globals->freeMemory(_vm->_globals->_answerBuffer); - _vm->_globals->SPRITE_ECRAN = _vm->_globals->freeMemory(_vm->_globals->SPRITE_ECRAN); + _vm->_globals->_levelSpriteBuf = _vm->_globals->freeMemory(_vm->_globals->_levelSpriteBuf); _vm->_eventsManager->_startPos.x = 0; _vm->_eventsManager->_mouseSpriteId = 0; _vm->_globals->_saveData->_data[svLastMouseCursor] = 0; @@ -2108,9 +2108,9 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha _vm->_globals->_saveData->_data[svField357] = 1; loc = &_vm->_globals->_saveData->_realHopkins; - _vm->_globals->PERSO = _vm->_fileManager->loadFile("PERSO.SPR"); + _vm->_globals->_characterSpriteBuf = _vm->_fileManager->loadFile("PERSO.SPR"); _vm->_globals->_characterType = 0; - addStaticSprite(_vm->_globals->PERSO, loc->_pos, 0, 64, loc->_zoomFactor, false, 34, 190); + addStaticSprite(_vm->_globals->_characterSpriteBuf, loc->_pos, 0, 64, loc->_zoomFactor, false, 34, 190); animateSprite(0); _vm->_globals->loadCharacterData(); } else if (oldCharacter == CHARACTER_HOPKINS && newCharacter == CHARACTER_SAMANTHA @@ -2133,9 +2133,9 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha _vm->_globals->_saveData->_data[svField357] = 0; loc = &_vm->_globals->_saveData->_samantha; - _vm->_globals->PERSO = _vm->_fileManager->loadFile("PSAMAN.SPR"); + _vm->_globals->_characterSpriteBuf = _vm->_fileManager->loadFile("PSAMAN.SPR"); _vm->_globals->_characterType = 2; - addStaticSprite(_vm->_globals->PERSO, loc->_pos, 0, 64, loc->_zoomFactor, false, 20, 127); + addStaticSprite(_vm->_globals->_characterSpriteBuf, loc->_pos, 0, 64, loc->_zoomFactor, false, 20, 127); animateSprite(0); _vm->_globals->loadCharacterData(); } else { @@ -3204,7 +3204,7 @@ void ObjectsManager::sceneSpecialIni() { animateSprite(0); for (int i = 0; i <= 4; i++) _vm->_eventsManager->refreshScreenAndEvents(); - VBOB(_vm->_globals->SPRITE_ECRAN, 5, 15, 28, 1); + VBOB(_vm->_globals->_levelSpriteBuf, 5, 15, 28, 1); _vm->_fontManager->hideText(9); bool displayedTxtFl = false; if (!_vm->_soundManager->_textOffFl) { @@ -3677,7 +3677,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo } _vm->_eventsManager->mouseOn(); if (_vm->_globals->_screenId == 61) { - addStaticSprite(_vm->_globals->PERSO, Common::Point(330, 418), 0, 60, 0, false, 34, 190); + addStaticSprite(_vm->_globals->_characterSpriteBuf, Common::Point(330, 418), 0, 60, 0, false, 34, 190); animateSprite(0); _vm->_linesManager->_route = (RouteItem *)g_PTRNUL; computeAndSetSpriteSize(); @@ -3774,29 +3774,29 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_graphicsManager->SETCOLOR3(254, 0, 0, 0); if (_vm->_globals->_characterType) { if (!_vm->_globals->_saveData->_data[svAlternateSpriteFl] && !_vm->_globals->_saveData->_data[svField356]) { - _vm->_globals->PERSO = _vm->_fileManager->loadFile("PERSO.SPR"); + _vm->_globals->_characterSpriteBuf = _vm->_fileManager->loadFile("PERSO.SPR"); _vm->_globals->_characterType = 0; } } if (!_vm->_globals->_characterType && _vm->_globals->_saveData->_data[svAlternateSpriteFl] == 1) { - _vm->_globals->PERSO = _vm->_fileManager->loadFile("HOPFEM.SPR"); + _vm->_globals->_characterSpriteBuf = _vm->_fileManager->loadFile("HOPFEM.SPR"); _vm->_globals->_characterType = 1; } if (_vm->_globals->_characterType != 2 && _vm->_globals->_saveData->_data[svField356] == 1) { - _vm->_globals->PERSO = _vm->_fileManager->loadFile("PSAMAN.SPR"); + _vm->_globals->_characterSpriteBuf = _vm->_fileManager->loadFile("PSAMAN.SPR"); _vm->_globals->_characterType = 2; } _vm->_globals->loadCharacterData(); switch (_vm->_globals->_characterType) { case 0: - addStaticSprite(_vm->_globals->PERSO, _characterPos, 0, _startSpriteIndex, 0, false, 34, 190); + addStaticSprite(_vm->_globals->_characterSpriteBuf, _characterPos, 0, _startSpriteIndex, 0, false, 34, 190); break; case 1: - addStaticSprite(_vm->_globals->PERSO, _characterPos, 0, _startSpriteIndex, 0, false, 28, 155); + addStaticSprite(_vm->_globals->_characterSpriteBuf, _characterPos, 0, _startSpriteIndex, 0, false, 28, 155); break; case 2: - addStaticSprite(_vm->_globals->PERSO, _characterPos, 0, _startSpriteIndex, 0, false, 20, 127); + addStaticSprite(_vm->_globals->_characterSpriteBuf, _characterPos, 0, _startSpriteIndex, 0, false, 20, 127); break; } _vm->_eventsManager->setMouseXY(_characterPos); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 373b28a8e0..3731ad6e46 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -180,11 +180,11 @@ int ScriptManager::handleOpcode(byte *dataP) { int vbobPosX = READ_LE_INT16(dataP + 8); int vbobPosY = READ_LE_INT16(dataP + 10); if (vbobIdx == 52) { - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, vbobPosX, READ_LE_INT16(dataP + 10), vbobFrameIndex); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, vbobPosX, READ_LE_INT16(dataP + 10), vbobFrameIndex); } else if (vbobIdx == 51) { _vm->_objectsManager->BOB_VIVANT(vbobFrameIndex); } else if (vbobIdx != 50) { - _vm->_objectsManager->VBOB(_vm->_globals->SPRITE_ECRAN, vbobIdx, vbobPosX, vbobPosY, vbobFrameIndex); + _vm->_objectsManager->VBOB(_vm->_globals->_levelSpriteBuf, vbobIdx, vbobPosX, vbobPosY, vbobFrameIndex); if (moveChange) moveChange /= _vm->_globals->_speed; if (moveChange > 1) { @@ -808,14 +808,14 @@ int ScriptManager::handleOpcode(byte *dataP) { playFl = false; break; case 12: - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 513, 249, 1); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 249, 1); break; case 23: - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 513, 249, 2); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 249, 2); playFl = false; break; case 34: - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 513, 249, 3); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 249, 3); playFl = false; break; } @@ -954,7 +954,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 56: - _vm->_globals->PERSO = _vm->_fileManager->loadFile("HOPFEM.SPR"); + _vm->_globals->_characterSpriteBuf = _vm->_fileManager->loadFile("HOPFEM.SPR"); _vm->_globals->_characterType = 1; _vm->_globals->_saveData->_data[svAlternateSpriteFl] = 1; _vm->_globals->loadCharacterData(); @@ -964,7 +964,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 57: - _vm->_globals->PERSO = _vm->_fileManager->loadFile("PERSO.SPR"); + _vm->_globals->_characterSpriteBuf = _vm->_fileManager->loadFile("PERSO.SPR"); _vm->_globals->_characterType = 0; _vm->_globals->_saveData->_data[svAlternateSpriteFl] = 0; _vm->_globals->loadCharacterData(); @@ -1155,7 +1155,7 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->_objectsManager->getBobAnimDataIdx(8) == 32) break; } - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 201, 14, 1); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 201, 14, 1); _vm->_objectsManager->animateSprite(0); _vm->_objectsManager->stopBobAnimation(11); _vm->_objectsManager->stopBobAnimation(8); @@ -1256,7 +1256,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } _vm->_objectsManager->stopBobAnimation(1); _vm->_objectsManager->stopBobAnimation(2); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 283, 160, 6); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 283, 160, 6); _vm->_soundManager->removeSample(1); } if (_vm->_globals->_saveData->_data[svField183] == 2) { @@ -1293,7 +1293,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } _vm->_objectsManager->stopBobAnimation(1); _vm->_objectsManager->stopBobAnimation(3); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 283, 161, 8); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 283, 161, 8); _vm->_soundManager->removeSample(1); } break; @@ -1302,11 +1302,11 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager->playSoundFile("SOUND52.WAV"); if (!_vm->_globals->_saveData->_data[svField186]) { _vm->_animationManager->playSequence("CIB5A.SEQ", 1, 12, 1, false, false); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 155, 29, 0); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 155, 29, 0); } else if (_vm->_globals->_saveData->_data[svField186] == 1) { _vm->_animationManager->playSequence("CIB5C.SEQ", 1, 12, 1, false, false); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 155, 29, 0); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 329, 87, 2); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 155, 29, 0); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 329, 87, 2); } break; @@ -1314,11 +1314,11 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager->playSoundFile("SOUND52.WAV"); if (!_vm->_globals->_saveData->_data[svField186]) { _vm->_animationManager->playSequence("CIB5B.SEQ", 1, 12, 1, false, false); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 155, 29, 5); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 155, 29, 5); } else if (_vm->_globals->_saveData->_data[svField186] == 1) { _vm->_animationManager->playSequence("CIB5D.SEQ", 1, 12, 1, false, false); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 155, 29, 5); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 283, 160, 6); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 155, 29, 5); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 283, 160, 6); } break; @@ -1326,11 +1326,11 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager->playSoundFile("SOUND52.WAV"); if (!_vm->_globals->_saveData->_data[svField184]) { _vm->_animationManager->playSequence("CIB6A.SEQ", 1, 12, 1, false, false); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 155, 29, 0); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 155, 29, 0); } else if (_vm->_globals->_saveData->_data[svField184] == 1) { _vm->_animationManager->playSequence("CIB6C.SEQ", 1, 12, 1, false, false); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 155, 29, 0); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 293, 139, 3); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 155, 29, 0); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 293, 139, 3); } break; @@ -1338,11 +1338,11 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager->playSoundFile("SOUND52.WAV"); if (!_vm->_globals->_saveData->_data[svField184]) { _vm->_animationManager->playSequence("CIB6B.SEQ", 1, 12, 1, false, false); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 155, 29, 5); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 155, 29, 5); } else if (_vm->_globals->_saveData->_data[svField184] == 1) { _vm->_animationManager->playSequence("CIB6D.SEQ", 1, 12, 1, false, false); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 155, 29, 5); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 283, 161, 8); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 155, 29, 5); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 283, 161, 8); } break; @@ -1376,7 +1376,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager->refreshScreenAndEvents(); } while (_vm->_objectsManager->getBobAnimDataIdx(12) != 117); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 830, 122, 0); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 830, 122, 0); _vm->_objectsManager->stopBobAnimation(12); _vm->_objectsManager->stopBobAnimation(10); _vm->_objectsManager->setBobAnimation(11); @@ -1808,7 +1808,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager->refreshScreenAndEvents(); if (_vm->_objectsManager->getBobAnimDataIdx(4) == 18) - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 18, 334, 0, false); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 18, 334, 0, false); } while (_vm->_objectsManager->getBobAnimDataIdx(4) != 26); _vm->_objectsManager->stopBobAnimation(4); _vm->_objectsManager->animateSprite(0); @@ -1944,7 +1944,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager->_specialSoundNum = 210; _vm->_animationManager->playSequence2("SECRET1.SEQ", 1, 12, 1, true); _vm->_soundManager->_specialSoundNum = 0; - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 192, 152, 0); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 192, 152, 0); _vm->_objectsManager->setBobAnimation(9); _vm->_objectsManager->OBSSEUL = true; _vm->_objectsManager->loadLinkFile("IM73a"); @@ -1996,7 +1996,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager->_specialSoundNum = 229; _vm->_animationManager->playSequence("MUR.SEQ", 1, 12, 1, false, false); _vm->_soundManager->_specialSoundNum = 0; - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 340, 157, 2); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 340, 157, 2); break; case 230: { @@ -2036,7 +2036,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager->setSpriteX(0, 476); _vm->_objectsManager->setSpriteY(0, 278); _vm->_objectsManager->animateSprite(0); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 337, 154, 3); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 337, 154, 3); _vm->_objectsManager->OBSSEUL = true; _vm->_objectsManager->loadLinkFile("IM93c"); _vm->_objectsManager->OBSSEUL = false; @@ -2118,22 +2118,22 @@ int ScriptManager::handleOpcode(byte *dataP) { switch (_vm->_globals->_saveData->_data[svField341]) { case 1: - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 27, 117, 0); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 27, 117, 0); _vm->_globals->_saveData->_data[svField338] = 0; break; case 2: - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 145, 166, 2); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 145, 166, 2); _vm->_globals->_saveData->_data[svField339] = 0; break; case 3: - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 296, 212, 4); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 296, 212, 4); _vm->_globals->_saveData->_data[svField340] = 0; break; } } _vm->_soundManager->playSoundFile("SOUND83.WAV"); _vm->_objectsManager->OPTI_ONE(6, 0, 23, 0); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 27, 117, 1); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 27, 117, 1); break; } @@ -2156,15 +2156,15 @@ int ScriptManager::handleOpcode(byte *dataP) { switch (_vm->_globals->_saveData->_data[svField341]) { case 1: - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 27, 117, 0); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 27, 117, 0); _vm->_globals->_saveData->_data[svField338] = 0; break; case 2: - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 145, 166, 2); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 145, 166, 2); _vm->_globals->_saveData->_data[svField339] = 0; break; case 3: - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 296, 212, 4); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 296, 212, 4); _vm->_globals->_saveData->_data[svField340] = 0; break; } @@ -2172,7 +2172,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager->playSoundFile("SOUND83.WAV"); _vm->_objectsManager->OPTI_ONE(5, 0, 23, 0); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 145, 166, 3); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 145, 166, 3); break; } @@ -2194,22 +2194,22 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager->OPTI_ONE(vbobFrameIndex, 26, 50, 0); switch (_vm->_globals->_saveData->_data[svField341]) { case 1: - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 27, 117, 0); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 27, 117, 0); _vm->_globals->_saveData->_data[svField338] = 0; break; case 2: - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 145, 166, 2); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 145, 166, 2); _vm->_globals->_saveData->_data[svField339] = 0; break; case 3: - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 296, 212, 4); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 296, 212, 4); _vm->_globals->_saveData->_data[svField340] = 0; break; } } _vm->_soundManager->playSoundFile("SOUND83.WAV"); _vm->_objectsManager->OPTI_ONE(4, 0, 23, 0); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 296, 212, 5); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 296, 212, 5); break; } @@ -2298,7 +2298,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals->_saveData->_data[svField356] = 0; _vm->_globals->_saveData->_data[svField355] = 1; _vm->_objectsManager->_twoCharactersFl = true; - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 373, 191, 3); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 373, 191, 3); _vm->_objectsManager->addStaticSprite(_vm->_objectsManager->_headSprites, samantha->_pos, 1, 3, samantha->_zoomFactor, false, 20, 127); _vm->_objectsManager->animateSprite(1); break; @@ -2318,7 +2318,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager->OPTI_ONE(5, 0, 6, 0); _vm->_linesManager->ZONEP[4]._destX = 276; _vm->_objectsManager->enableVerb(4, 19); - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 285, 379, 0); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 285, 379, 0); _vm->_globals->_saveData->_data[svField399] = 1; break; @@ -2350,17 +2350,17 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 601: - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 513, 163, 7, false); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 163, 7, false); _vm->_objectsManager->OPTI_ONE(2, 0, 16, 4); break; case 602: - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 513, 163, 7, false); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 163, 7, false); _vm->_objectsManager->OPTI_ONE(4, 0, 16, 4); break; case 603: - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 513, 163, 7, false); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 163, 7, false); _vm->_objectsManager->OPTI_ONE(3, 0, 16, 4); _vm->_soundManager->_specialSoundNum = 199; _vm->_graphicsManager->FADE_LINUX = 2; @@ -2372,7 +2372,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 604: - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 513, 163, 7, false); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 163, 7, false); _vm->_objectsManager->OPTI_ONE(1, 0, 16, 4); _vm->_soundManager->_specialSoundNum = 199; _vm->_animationManager->playAnim("BOMBE2A.ANM", 50, 14, 500); @@ -2383,7 +2383,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 605: - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 513, 163, 7, false); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 163, 7, false); _vm->_objectsManager->OPTI_ONE(5, 0, 16, 4); _vm->_graphicsManager->fadeOutShort(); _vm->_soundManager->_specialSoundNum = 199; @@ -2396,7 +2396,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 606: - _vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 513, 163, 7, false); + _vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 163, 7, false); _vm->_objectsManager->OPTI_ONE(6, 0, 16, 4); if ((_vm->getPlatform() != Common::kPlatformWindows) || !_vm->getIsDemo()) { _vm->_animationManager->playAnim("BOMBE3A.ANM", 50, 14, 500); -- cgit v1.2.3