aboutsummaryrefslogtreecommitdiff
path: root/engines/hopkins
diff options
context:
space:
mode:
authorStrangerke2013-03-24 12:31:28 +0100
committerStrangerke2013-03-24 12:31:28 +0100
commitf782ca1c10b3e74fecedf0e6b3178529cad88ed0 (patch)
tree2d059c3b0081662610ef44cb5baa1d929c231513 /engines/hopkins
parentb91c9527296208bbeff695744d27a94cdebbfd08 (diff)
downloadscummvm-rg350-f782ca1c10b3e74fecedf0e6b3178529cad88ed0.tar.gz
scummvm-rg350-f782ca1c10b3e74fecedf0e6b3178529cad88ed0.tar.bz2
scummvm-rg350-f782ca1c10b3e74fecedf0e6b3178529cad88ed0.zip
HOPKINS: Move inventory dialog display to DialogsManager, set _inventWin1 as private
Diffstat (limited to 'engines/hopkins')
-rw-r--r--engines/hopkins/computer.h12
-rw-r--r--engines/hopkins/dialogs.cpp14
-rw-r--r--engines/hopkins/dialogs.h7
-rw-r--r--engines/hopkins/globals.cpp3
-rw-r--r--engines/hopkins/objects.cpp7
5 files changed, 27 insertions, 16 deletions
diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h
index 154921631e..e5c0ae2af6 100644
--- a/engines/hopkins/computer.h
+++ b/engines/hopkins/computer.h
@@ -84,18 +84,16 @@ private:
void displayLives();
void displayBricks();
void displayGamesSubMenu();
- void displayScore();
int displayHiscores();
void displayHiscoreLine(byte *objectData, int x, int y, int curChar);
+ void displayMessage(int xp, int yp, int textIdx);
+ void displayScore();
+ void displayScoreChar(int charPos, int charDisp);
+ void getScoreName();
void playBreakout();
+ int moveBall();
void saveScore();
- int moveBall();
void checkBallCollisions();
- void getScoreName();
-
- void displayMessage(int xp, int yp, int textIdx);
-
- void displayScoreChar(int charPos, int charDisp);
public:
ComputerManager(HopkinsEngine *vm);
diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp
index 869207d3e3..e0f544d66b 100644
--- a/engines/hopkins/dialogs.cpp
+++ b/engines/hopkins/dialogs.cpp
@@ -51,9 +51,23 @@ DialogsManager::DialogsManager(HopkinsEngine *vm) {
DialogsManager::~DialogsManager() {
_vm->_globals->freeMemory(_inventWin1);
+ _vm->_globals->freeMemory(_inventBuf2);
_vm->_globals->freeMemory(_inventoryIcons);
}
+void DialogsManager::clearAll() {
+ _inventWin1 = g_PTRNUL;
+ _inventBuf2 = g_PTRNUL;
+}
+
+void DialogsManager::drawInvent(Common::Point oldBorder, int oldBorderSpriteIndex, Common::Point newBorder, int newBorderSpriteIndex) {
+ _vm->_graphicsManager->restoreSurfaceRect(_vm->_graphicsManager->_vesaBuffer, _inventWin1, _inventX, _inventY, _inventWidth, _inventHeight);
+ if (oldBorder.x && oldBorder.y)
+ _vm->_graphicsManager->Sprite_Vesa(_vm->_graphicsManager->_vesaBuffer, _vm->_dialogsManager->_inventBuf2, oldBorder.x + 300, oldBorder.y + 300, oldBorderSpriteIndex + 1);
+ if (newBorder.x && newBorder.y)
+ _vm->_graphicsManager->Sprite_Vesa(_vm->_graphicsManager->_vesaBuffer, _vm->_dialogsManager->_inventBuf2, newBorder.x + 300, newBorder.y + 300, newBorderSpriteIndex);
+ _vm->_graphicsManager->addDirtyRect(_vm->_dialogsManager->_inventX, _vm->_dialogsManager->_inventY, _vm->_dialogsManager->_inventX + _vm->_dialogsManager->_inventWidth, _vm->_dialogsManager->_inventY + _vm->_dialogsManager->_inventHeight);
+}
void DialogsManager::showOptionsDialog() {
_vm->_eventsManager->changeMouseCursor(0);
_vm->_eventsManager->refreshScreenAndEvents();
diff --git a/engines/hopkins/dialogs.h b/engines/hopkins/dialogs.h
index fe6c3bc398..73b4bb489b 100644
--- a/engines/hopkins/dialogs.h
+++ b/engines/hopkins/dialogs.h
@@ -26,6 +26,7 @@
#include "common/scummsys.h"
#include "common/system.h"
#include "common/error.h"
+#include "common/rect.h"
namespace Hopkins {
@@ -38,12 +39,13 @@ enum SaveLoadMode { MODE_SAVE = 1, MODE_LOAD = 2 };
*/
class DialogsManager {
private:
+ byte *_inventWin1;
+
HopkinsEngine *_vm;
void showSaveLoad(SaveLoadMode mode);
int searchSavegames();
public:
- byte *_inventWin1;
byte *_inventBuf2;
bool _removeInventFl;
bool _inventDisplayedFl;
@@ -60,6 +62,9 @@ public:
void showSaveGame();
void showOptionsDialog();
void testDialogOpening();
+ void clearAll();
+
+ void drawInvent(Common::Point oldBorder, int oldBorderSpriteIndex, Common::Point newBorder, int newBorderSpriteIndex);
};
} // End of namespace Hopkins
diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp
index 6cf7251e92..6d48599c96 100644
--- a/engines/hopkins/globals.cpp
+++ b/engines/hopkins/globals.cpp
@@ -239,8 +239,7 @@ void Globals::clearAll() {
_objectDataBuf = g_PTRNUL;
_curObjectFileNum = 0;
_vm->_eventsManager->_objectBuf = g_PTRNUL;
- _vm->_dialogsManager->_inventWin1 = g_PTRNUL;
- _vm->_dialogsManager->_inventBuf2 = g_PTRNUL;
+ _vm->_dialogsManager->clearAll();
_answerBuffer = g_PTRNUL;
SPRITE_ECRAN = g_PTRNUL;
_saveData = (Savegame *)g_PTRNUL;
diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp
index df4a6b0854..d753d57fab 100644
--- a/engines/hopkins/objects.cpp
+++ b/engines/hopkins/objects.cpp
@@ -409,12 +409,7 @@ void ObjectsManager::displaySprite() {
_vm->_globals->_sortedDisplayCount = 0;
if (_vm->_dialogsManager->_inventDisplayedFl) {
- _vm->_graphicsManager->restoreSurfaceRect(_vm->_graphicsManager->_vesaBuffer, _vm->_dialogsManager->_inventWin1, _vm->_dialogsManager->_inventX, _vm->_dialogsManager->_inventY, _vm->_dialogsManager->_inventWidth, _vm->_dialogsManager->_inventHeight);
- if (_oldBorderPos.x && _oldBorderPos.y)
- _vm->_graphicsManager->Sprite_Vesa(_vm->_graphicsManager->_vesaBuffer, _vm->_dialogsManager->_inventBuf2, _oldBorderPos.x + 300, _oldBorderPos.y + 300, _oldBorderSpriteIndex + 1);
- if (_borderPos.x && _borderPos.y)
- _vm->_graphicsManager->Sprite_Vesa(_vm->_graphicsManager->_vesaBuffer, _vm->_dialogsManager->_inventBuf2, _borderPos.x + 300, _borderPos.y + 300, _borderSpriteIndex);
- _vm->_graphicsManager->addDirtyRect(_vm->_dialogsManager->_inventX, _vm->_dialogsManager->_inventY, _vm->_dialogsManager->_inventX + _vm->_dialogsManager->_inventWidth, _vm->_dialogsManager->_inventY + _vm->_dialogsManager->_inventHeight);
+ _vm->_dialogsManager->drawInvent(_oldBorderPos, _oldBorderSpriteIndex, _borderPos, _borderSpriteIndex);
}
if (_saveLoadFl) {