diff options
author | Strangerke | 2013-03-05 07:45:15 +0100 |
---|---|---|
committer | Strangerke | 2013-03-05 07:45:15 +0100 |
commit | 2ae05f05735e88e123be293560255a91b5e9d0ba (patch) | |
tree | 0246b722b9f84fa613c63482df98c4872fda11cc | |
parent | cd412b3a893ada5ce7bb28bfe8e0abc4e8c24692 (diff) | |
download | scummvm-rg350-2ae05f05735e88e123be293560255a91b5e9d0ba.tar.gz scummvm-rg350-2ae05f05735e88e123be293560255a91b5e9d0ba.tar.bz2 scummvm-rg350-2ae05f05735e88e123be293560255a91b5e9d0ba.zip |
HOPKINS: Misc renaming and refactoring
-rw-r--r-- | engines/hopkins/font.cpp | 22 | ||||
-rw-r--r-- | engines/hopkins/font.h | 3 | ||||
-rw-r--r-- | engines/hopkins/globals.cpp | 8 | ||||
-rw-r--r-- | engines/hopkins/globals.h | 5 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 12 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 2 | ||||
-rw-r--r-- | engines/hopkins/objects.h | 6 | ||||
-rw-r--r-- | engines/hopkins/script.cpp | 4 | ||||
-rw-r--r-- | engines/hopkins/talk.cpp | 8 |
9 files changed, 37 insertions, 33 deletions
diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index afe9dfe309..743ae8ba70 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -40,12 +40,27 @@ FontManager::FontManager() { FontManager::~FontManager() { _vm->_globals.freeMemory(_font); + _vm->_globals.freeMemory(BUF_ZONE); } void FontManager::setParent(HopkinsEngine *vm) { _vm = vm; } +void FontManager::loadZoneTxt() { + switch (_vm->_globals._language) { + case LANG_EN: + BUF_ZONE = _vm->_fileManager.loadFile("ZONEAN.TXT"); + break; + case LANG_FR: + BUF_ZONE = _vm->_fileManager.loadFile("ZONE01.TXT"); + break; + case LANG_SP: + BUF_ZONE = _vm->_fileManager.loadFile("ZONEES.TXT"); + break; + } +} + void FontManager::clearAll() { _font = g_PTRNUL; _fontFixedHeight = 0; @@ -71,13 +86,14 @@ void FontManager::clearAll() { _index[idx] = 0; _tempText = g_PTRNUL; + BUF_ZONE = g_PTRNUL; } void FontManager::initData() { _font = _vm->_fileManager.loadFile("FONTE3.SPR"); _fontFixedWidth = 12; _fontFixedHeight = 21; - + loadZoneTxt(); } /** * Display Text @@ -209,8 +225,8 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in bufSize = 100; _tempText = _vm->_globals.allocMemory(110); Common::fill(&_tempText[0], &_tempText[110], 0); - memcpy(_tempText, _vm->_globals.BUF_ZONE + _index[messageId], 96); - WRITE_LE_UINT16((uint16 *)_tempText + 48, READ_LE_INT16(_vm->_globals.BUF_ZONE + _index[messageId] + 96)); + memcpy(_tempText, BUF_ZONE + _index[messageId], 96); + WRITE_LE_UINT16((uint16 *)_tempText + 48, READ_LE_INT16(BUF_ZONE + _index[messageId] + 96)); } byte *curTempTextPtr = _tempText; for (int i = 0; i < bufSize; i++) { diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 837539dd2f..6243a2e6d0 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -68,6 +68,9 @@ private: int _index[4048]; byte *_tempText; + byte *BUF_ZONE; + + void loadZoneTxt(); public: byte *_font; int _fontFixedWidth; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index a9a39e2b50..fd474c510c 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -143,7 +143,6 @@ Globals::Globals() { // Initialize pointers for (int i = 0; i < 6; ++i) _hidingItemData[i] = g_PTRNUL; - BUF_ZONE = NULL; SPRITE_ECRAN = NULL; _saveData = NULL; _answerBuffer = g_PTRNUL; @@ -175,7 +174,6 @@ Globals::Globals() { } Globals::~Globals() { - freeMemory(BUF_ZONE); for (int idx = 0; idx < 6; ++idx) _hidingItemData[idx] = freeMemory(_hidingItemData[idx]); freeMemory(SPRITE_ECRAN); @@ -247,14 +245,14 @@ void Globals::clearAll() { _vm->_dialogsManager._inventBuf2 = g_PTRNUL; _answerBuffer = g_PTRNUL; SPRITE_ECRAN = g_PTRNUL; - _saveData = (Sauvegarde *)g_PTRNUL; + _saveData = (Savegame *)g_PTRNUL; _vm->_objectsManager._curObjectIndex = 0; _vm->_linesManager.clearAll(); _vm->_objectsManager.clearAll(); - _saveData = (Sauvegarde *)malloc(sizeof(Sauvegarde)); - memset(_saveData, 0, sizeof(Sauvegarde)); + _saveData = (Savegame *)malloc(sizeof(Savegame)); + memset(_saveData, 0, sizeof(Savegame)); _boxWidth = 240; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 8004ad0498..c3e0190653 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -182,7 +182,7 @@ enum SauvegardeOffset { }; // TODO: Sauvegrade1 fields should really be mapped into data array -struct Sauvegarde { +struct Savegame { byte _data[2050]; CharacterLocation _cloneHopkins; CharacterLocation _realHopkins; @@ -259,7 +259,7 @@ public: int _characterType; uint _speed; byte *_answerBuffer; - Sauvegarde *_saveData; + Savegame *_saveData; Language _language; HopkinsItem _hopkinsItem[70]; SortItem _sortedDisplay[51]; @@ -305,7 +305,6 @@ public: Common::String _textFilename; int iRegul; - byte *BUF_ZONE; byte *SPRITE_ECRAN; byte *PERSO; ListeItem Liste[6]; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index e5631e27d8..30b0b86f22 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1566,18 +1566,6 @@ void HopkinsEngine::initializeSystem() { _dialogsManager._inventoryIcons = _fileManager.loadFile("ICONE.SPR"); _objectsManager._headSprites = _fileManager.loadFile("TETE.SPR"); - switch (_globals._language) { - case LANG_EN: - _globals.BUF_ZONE = _fileManager.loadFile("ZONEAN.TXT"); - break; - case LANG_FR: - _globals.BUF_ZONE = _fileManager.loadFile("ZONE01.TXT"); - break; - case LANG_SP: - _globals.BUF_ZONE = _fileManager.loadFile("ZONEES.TXT"); - break; - } - _eventsManager.setMouseOn(); _eventsManager._mouseFl = false; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index ab800e8f7d..67d620caf7 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -620,7 +620,7 @@ void ObjectsManager::hideBob(int idx) { _bob[idx].field0++; } -void ObjectsManager::BOB_OFFSET(int idx, int offset) { +void ObjectsManager::setBobOffset(int idx, int offset) { _bob[idx]._oldX2 = offset; } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 6f4657a0ae..677cbe3a4f 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -197,6 +197,9 @@ public: void removeObject(int objIndex); void resetBob(int idx); + void hideBob(int idx); + void displayBob(int idx); + void setBobOffset(int idx, int offset); void setBobAnimDataIdx(int idx, int animIdx); void setBobAnimation(int idx); void stopBobAnimation(int idx); @@ -226,8 +229,6 @@ public: const Common::String &animFile, const Common::String &s4, int soundNum, bool initializeScreen); byte *loadObjectFromFile(int objIndex, bool mode); void OPTI_OBJET(); - void hideBob(int idx); - void displayBob(int idx); void SPACTION(byte *spriteData, const Common::String &animationSeq, int speed, bool flipFl); void BOB_VIVANT(int idx); void VBOB(byte *src, int idx, int xp, int yp, int frameIndex); @@ -236,7 +237,6 @@ public: void SCI_OPTI_ONE(int idx, int animIdx, int animDataIdx, int a4); void GOHOME(); void OPTI_BOBON(int idx1, int idx2, int idx3, int anim1Idx, int anim2Idx, int anim3Idx); - void BOB_OFFSET(int idx, int offset); void SPACTION1(byte *spriteData, const Common::String &animString, int speed); void PARADISE(); }; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index c79f888917..50f7999077 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -1682,7 +1682,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(9); _vm->_objectsManager.setBobAnimation(10); - _vm->_objectsManager.BOB_OFFSET(10, 300); + _vm->_objectsManager.setBobOffset(10, 300); _vm->_soundManager.playSoundFile("SOUND44.WAV"); do { if (_vm->shouldQuit()) @@ -2410,7 +2410,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case MKTAG24('B', 'O', 'S'): opcodeType = 1; - _vm->_objectsManager.BOB_OFFSET(READ_LE_INT16(dataP + 5), READ_LE_INT16(dataP + 7)); + _vm->_objectsManager.setBobOffset(READ_LE_INT16(dataP + 5), READ_LE_INT16(dataP + 7)); break; case MKTAG24('V', 'O', 'N'): _vm->_objectsManager.enableVerb(READ_LE_INT16(dataP + 5), READ_LE_INT16(dataP + 7)); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index f1a4ca07c3..ac83b9c878 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -638,14 +638,14 @@ void TalkManager::startCharacterAnim0(int startIdx, bool readOnlyFl) { _characterAnim = _characterBuffer + animIdx + 25; if (!readOnlyFl) { int idx = 0; - int v7; do { - v7 = READ_LE_INT16(&_characterAnim[2 * idx + 4]); - if (v7 && _vm->_globals._speed != 501) + if (!READ_LE_INT16(&_characterAnim[2 * idx + 4])) + break; + if (_vm->_globals._speed != 501) _vm->_graphicsManager.fastDisplay(_characterSprite, _vm->_eventsManager._startPos.x + READ_LE_INT16(&_characterAnim[2 * idx]), READ_LE_INT16(&_characterAnim[2 * idx + 2]), _characterAnim[2 * idx + 8]); idx += 5; - } while (_vm->_globals._speed != 501 && v7); + } while (_vm->_globals._speed != 501); } } |