From 0a1cc63abb4e4a43bc8b865fb50c753e7a6669af Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 15 Feb 2013 08:24:10 +0100 Subject: HOPKINS: More renaming and refactoring --- engines/hopkins/dialogs.cpp | 12 +++++++----- engines/hopkins/dialogs.h | 1 + engines/hopkins/globals.cpp | 6 +----- engines/hopkins/globals.h | 2 -- engines/hopkins/hopkins.cpp | 4 ++-- engines/hopkins/objects.cpp | 8 +++++--- engines/hopkins/objects.h | 1 + engines/hopkins/script.cpp | 6 +++--- 8 files changed, 20 insertions(+), 20 deletions(-) (limited to 'engines') diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 690093f22b..e13e820bb8 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -43,10 +43,12 @@ DialogsManager::DialogsManager() { _inventWidth = _inventHeight = 0; _inventWin1 = g_PTRNUL; _inventBuf2 = g_PTRNUL; + _inventoryIcons = NULL; } DialogsManager::~DialogsManager() { _vm->_globals.freeMemory(_inventWin1); + free(_inventoryIcons); } void DialogsManager::setParent(HopkinsEngine *vm) { @@ -491,26 +493,26 @@ void DialogsManager::inventAnim() { _vm->_graphicsManager.addVesaSegment(_vm->_objectsManager._oldInventoryPosX, 27, _vm->_objectsManager._oldInventoryPosX + 48, 65); int newOffset = _vm->_graphicsManager._scrollOffset + 2; - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.ICONE, newOffset + 300, 327, 0); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _inventoryIcons, newOffset + 300, 327, 0); _vm->_graphicsManager.addVesaSegment(newOffset, 27, newOffset + 45, 62); _vm->_objectsManager._oldInventoryPosX = newOffset; } if (_vm->_globals._saveData->_data[svField357] == 1) { if (_vm->_globals._saveData->_data[svField353] == 1) - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, false); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._headSprites, 832, 325, 0, 0, 0, false); if (_vm->_globals._saveData->_data[svField355] == 1) - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 866, 325, 1, 0, 0, false); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._headSprites, 866, 325, 1, 0, 0, false); _vm->_graphicsManager.addVesaSegment(532, 25, 560, 60); _vm->_graphicsManager.addVesaSegment(566, 25, 594, 60); } if (_vm->_globals._saveData->_data[svField356] == 1) { - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, false); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._headSprites, 832, 325, 0, 0, 0, false); _vm->_graphicsManager.addVesaSegment(532, 25, 560, 60); } if (_vm->_globals._saveData->_data[svField354] == 1) { - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, false); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._headSprites, 832, 325, 0, 0, 0, false); _vm->_graphicsManager.addVesaSegment(532, 25, 560, 60); } } diff --git a/engines/hopkins/dialogs.h b/engines/hopkins/dialogs.h index d0fd69250f..fd35eca687 100644 --- a/engines/hopkins/dialogs.h +++ b/engines/hopkins/dialogs.h @@ -48,6 +48,7 @@ public: bool _inventFl; int _inventX, _inventY; int _inventWidth, _inventHeight; + byte *_inventoryIcons; DialogsManager(); ~DialogsManager(); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index fc45a9277b..37dce104ed 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -65,7 +65,7 @@ Globals::Globals() { g_PTRNUL = (byte *)malloc(16); strcpy((char *)g_PTRNUL, "POINTERNULL"); - // Initialise array properties + // Initialize array properties for (int i = 0; i < 6; ++i) CACHE_BANQUE[i] = g_PTRNUL; for (int i = 0; i < 35; ++i) @@ -104,7 +104,6 @@ Globals::Globals() { _oldDirection = 0; _oldDirectionSpriteIdx = 59; _lastDirection = 0; - TETE = NULL; NUM_FICHIER_OBJ = 0; nbrligne = 0; _boxWidth = 0; @@ -144,7 +143,6 @@ Globals::Globals() { _oceanDirection = 0; // Initialize pointers - ICONE = NULL; BUF_ZONE = NULL; for (int idx = 0; idx < 6; ++idx) CACHE_BANQUE[idx] = NULL; @@ -181,8 +179,6 @@ Globals::Globals() { } Globals::~Globals() { - free(ICONE); - freeMemory(TETE); freeMemory(BUF_ZONE); for (int idx = 0; idx < 6; ++idx) CACHE_BANQUE[idx] = freeMemory(CACHE_BANQUE[idx]); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 7e46773caa..0eed175462 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -290,8 +290,6 @@ public: int _oldRouteDestY; int _oldZoneNum; - byte *TETE; - byte *ICONE; bool NOMARCHE; int iRegul; byte *BUF_ZONE; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 296c863934..2b7c026111 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1593,8 +1593,8 @@ void HopkinsEngine::initializeSystem() { _fontManager._font = _fileManager.loadFile("FONTE3.SPR"); _fontManager._fontFixedWidth = 12; _fontManager._fontFixedHeight = 21; - _globals.ICONE = _fileManager.loadFile("ICONE.SPR"); - _globals.TETE = _fileManager.loadFile("TETE.SPR"); + _dialogsManager._inventoryIcons = _fileManager.loadFile("ICONE.SPR"); + _objectsManager._headSprites = _fileManager.loadFile("TETE.SPR"); switch (_globals._language) { case LANG_EN: diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 0f7ff52f9e..e21eb7f347 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -78,11 +78,13 @@ ObjectsManager::ObjectsManager() { _forestSprite = NULL; _gestureBuf = NULL; _curGestureFile = 0; + _headSprites = NULL; } ObjectsManager::~ObjectsManager() { _vm->_globals.freeMemory(_forestSprite); _vm->_globals.freeMemory(_gestureBuf); + _vm->_globals.freeMemory(_headSprites); } void ObjectsManager::setParent(HopkinsEngine *vm) { @@ -91,7 +93,7 @@ void ObjectsManager::setParent(HopkinsEngine *vm) { void ObjectsManager::clearAll() { _forestFl = false; - _forestSprite = g_PTRNUL; + _forestSprite = _vm->_globals.freeMemory(_forestSprite); _curGestureFile = 0; _gestureBuf = _vm->_globals.freeMemory(_gestureBuf); } @@ -2103,7 +2105,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc->_zoomFactor = _sprite[0]._animationType; removeSprite(1); - addStaticSprite(_vm->_globals.TETE, loc->_pos, 1, 3, loc->_zoomFactor, false, 20, 127); + addStaticSprite(_headSprites, loc->_pos, 1, 3, loc->_zoomFactor, false, 20, 127); animateSprite(1); removeSprite(0); @@ -2128,7 +2130,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc->_zoomFactor = _sprite[0]._zoomFactor; removeSprite(1); - addStaticSprite(_vm->_globals.TETE, loc->_pos, 1, 2, loc->_zoomFactor, false, 34, 190); + addStaticSprite(_headSprites, loc->_pos, 1, 2, loc->_zoomFactor, false, 34, 190); animateSprite(1); removeSprite(0); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index ccf2e7a6ad..a39fe29772 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -164,6 +164,7 @@ public: byte *_forestSprite; byte *_saveLoadSprite; byte *_saveLoadSprite2; + byte *_headSprites; SpriteItem _sprite[6]; BobItem _bob[36]; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 04cacf6ec8..d4d008bb07 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -224,7 +224,7 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->_globals._saveData->_data[svField356] == 1 && _vm->_globals._saveData->_realHopkins._location == _vm->_globals._screenId) { _vm->_objectsManager.addStaticSprite( - _vm->_globals.TETE, + _vm->_objectsManager._headSprites, _vm->_globals._saveData->_realHopkins._pos, 1, 2, @@ -239,7 +239,7 @@ int ScriptManager::handleOpcode(byte *dataP) { && _vm->_globals._saveData->_data[svField355] == 1 && _vm->_globals._saveData->_samantha._location == _vm->_globals._screenId) { _vm->_objectsManager.addStaticSprite( - _vm->_globals.TETE, + _vm->_objectsManager._headSprites, _vm->_globals._saveData->_samantha._pos, 1, 3, @@ -2210,7 +2210,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._saveData->_data[svField355] = 1; _vm->_objectsManager._twoCharactersFl = true; _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 373, 191, 3); - _vm->_objectsManager.addStaticSprite(_vm->_globals.TETE, samantha->_pos, 1, 3, samantha->_zoomFactor, false, 20, 127); + _vm->_objectsManager.addStaticSprite(_vm->_objectsManager._headSprites, samantha->_pos, 1, 3, samantha->_zoomFactor, false, 20, 127); _vm->_objectsManager.animateSprite(1); break; } -- cgit v1.2.3