aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2013-03-24 21:25:29 +0100
committerStrangerke2013-03-24 22:12:48 +0100
commitb0f0a6cd92d922115916947929060096f91a19d5 (patch)
tree1b0d1974c169cb701c310c447adc90d5c274887b
parentee3c0cc4faa66b57bf82ee59dac9c3484b582b5d (diff)
downloadscummvm-rg350-b0f0a6cd92d922115916947929060096f91a19d5.tar.gz
scummvm-rg350-b0f0a6cd92d922115916947929060096f91a19d5.tar.bz2
scummvm-rg350-b0f0a6cd92d922115916947929060096f91a19d5.zip
HOPKINS: Move two more variables to ObjectsManager, make them private
-rw-r--r--engines/hopkins/dialogs.cpp2
-rw-r--r--engines/hopkins/events.cpp16
-rw-r--r--engines/hopkins/globals.cpp1
-rw-r--r--engines/hopkins/globals.h1
-rw-r--r--engines/hopkins/objects.cpp5
-rw-r--r--engines/hopkins/objects.h3
6 files changed, 15 insertions, 13 deletions
diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp
index 281f3ddb99..712ee7b3e0 100644
--- a/engines/hopkins/dialogs.cpp
+++ b/engines/hopkins/dialogs.cpp
@@ -396,7 +396,7 @@ void DialogsManager::showInventory() {
if (inventIdx && inventCount <= 29) {
byte *obj = _vm->_objectsManager->loadObjectFromFile(inventIdx, false);
_vm->_graphicsManager->restoreSurfaceRect(_vm->_graphicsManager->_vesaBuffer, obj, _inventX + curPosX + 6,
- curPosY + 120, _vm->_globals->_objectWidth, _vm->_globals->_objectHeight);
+ curPosY + 120, _vm->_objectsManager->getObjectWidth(), _vm->_objectsManager->getObjectHeight());
_vm->_globals->freeMemory(obj);
}
curPosX += 54;
diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp
index 8e25539b94..1f42bf120a 100644
--- a/engines/hopkins/events.cpp
+++ b/engines/hopkins/events.cpp
@@ -369,8 +369,8 @@ void EventsManager::refreshScreenAndEvents() {
width = _mouseSizeX;
height = _mouseSizeY;
if (_mouseCursorId == 23) {
- width = _vm->_globals->_objectWidth;
- height = _vm->_globals->_objectHeight;
+ width = _vm->_objectsManager->getObjectWidth();
+ height = _vm->_objectsManager->getObjectHeight();
} else {
if (_breakoutFl) {
if (xp < _vm->_graphicsManager->_minX)
@@ -492,14 +492,14 @@ void EventsManager::updateCursor() {
Common::Rect clipBounds(_vm->_graphicsManager->_minX, _vm->_graphicsManager->_minY,
_vm->_graphicsManager->_maxX, _vm->_graphicsManager->_maxY);
_vm->_graphicsManager->_minX = _vm->_graphicsManager->_minY = 0;
- _vm->_graphicsManager->_maxX = _vm->_globals->_objectWidth;
- _vm->_graphicsManager->_maxY = _vm->_globals->_objectHeight;
+ _vm->_graphicsManager->_maxX = _vm->_objectsManager->getObjectWidth();
+ _vm->_graphicsManager->_maxY = _vm->_objectsManager->getObjectHeight();
int pitch = _vm->_graphicsManager->_lineNbr2;
- _vm->_graphicsManager->_lineNbr2 = _vm->_globals->_objectWidth;
+ _vm->_graphicsManager->_lineNbr2 = _vm->_objectsManager->getObjectWidth();
// Create the temporary cursor surface
- byte *cursorSurface = new byte[_vm->_globals->_objectHeight * _vm->_globals->_objectWidth];
- Common::fill(cursorSurface, cursorSurface + _vm->_globals->_objectHeight * _vm->_globals->_objectWidth, 0);
+ byte *cursorSurface = new byte[_vm->_objectsManager->getObjectHeight() * _vm->_objectsManager->getObjectWidth()];
+ Common::fill(cursorSurface, cursorSurface + _vm->_objectsManager->getObjectHeight() * _vm->_objectsManager->getObjectWidth(), 0);
if (_mouseCursorId != 23) {
// Draw standard cursor
@@ -535,7 +535,7 @@ void EventsManager::updateCursor() {
// Set the ScummVM cursor from the surface
CursorMan.replaceCursorPalette(cursorPalette, 0, PALETTE_SIZE - 1);
- CursorMan.replaceCursor(cursorSurface, _vm->_globals->_objectWidth, _vm->_globals->_objectHeight,
+ CursorMan.replaceCursor(cursorSurface, _vm->_objectsManager->getObjectWidth(), _vm->_objectsManager->getObjectHeight(),
xOffset, 0, 0, true);
// Delete the cursor surface and palette
diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp
index 93997eaea5..eff4c13602 100644
--- a/engines/hopkins/globals.cpp
+++ b/engines/hopkins/globals.cpp
@@ -103,7 +103,6 @@ Globals::Globals(HopkinsEngine *vm) {
_linuxEndDemoFl = false;
_speed = 1;
_curObjectFileNum = 0;
- _objectWidth = _objectHeight = 0;
_catalogPos = 0;
_catalogSize = 0;
iRegul = 0;
diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h
index 1b63e724cc..5be467c730 100644
--- a/engines/hopkins/globals.h
+++ b/engines/hopkins/globals.h
@@ -240,7 +240,6 @@ public:
Directions _oceanDirection;
int _actionDirection;
int _inventory[36];
- int _objectWidth, _objectHeight;
int _screenId;
int _prevScreenId;
int _characterMaxPosY;
diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp
index b0170b2df3..5bf8342488 100644
--- a/engines/hopkins/objects.cpp
+++ b/engines/hopkins/objects.cpp
@@ -88,6 +88,7 @@ ObjectsManager::ObjectsManager(HopkinsEngine *vm) {
_lastDirection = DIR_NONE;
_oldDirection = DIR_NONE;
_oldDirectionSpriteIdx = 59;
+ _objectWidth = _objectHeight = 0;
}
ObjectsManager::~ObjectsManager() {
@@ -130,8 +131,8 @@ byte *ObjectsManager::loadObjectFromFile(int objIndex, bool mode) {
int width = ObjectsManager::getWidth(_vm->_globals->_objectDataBuf, idx);
int height = ObjectsManager::getHeight(_vm->_globals->_objectDataBuf, idx);
- _vm->_globals->_objectWidth = width;
- _vm->_globals->_objectHeight = height;
+ _objectWidth = width;
+ _objectHeight = height;
if (mode) {
sprite_alone(_vm->_globals->_objectDataBuf, _vm->_eventsManager->_objectBuf, idx);
diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h
index b194749794..44cd4e723e 100644
--- a/engines/hopkins/objects.h
+++ b/engines/hopkins/objects.h
@@ -86,6 +86,7 @@ class ObjectsManager {
private:
HopkinsEngine *_vm;
+ int _objectWidth, _objectHeight;
int _oldBorderSpriteIndex;
int _borderSpriteIndex;
byte *_spritePtr;
@@ -248,6 +249,8 @@ public:
void resetOldFrameIndex() { _oldFrameIndex = -1; }
void resetOldDirection() { _oldDirection = DIR_NONE; }
+ int getObjectWidth() { return _objectWidth; }
+ int getObjectHeight() { return _objectHeight; }
};
} // End of namespace Hopkins