aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMatthew Hoops2010-04-19 20:28:36 +0000
committerMatthew Hoops2010-04-19 20:28:36 +0000
commit001bca2d6cf6c211f1d1640a74c9f19d1ef7cca5 (patch)
treeae7630f6b47fa55095b3ac48b12effc808676dd8 /engines
parente6b835bce449ea6dba2a23feef6de627c318bdf3 (diff)
downloadscummvm-rg350-001bca2d6cf6c211f1d1640a74c9f19d1ef7cca5.tar.gz
scummvm-rg350-001bca2d6cf6c211f1d1640a74c9f19d1ef7cca5.tar.bz2
scummvm-rg350-001bca2d6cf6c211f1d1640a74c9f19d1ef7cca5.zip
Remove use of global constructors in Mohawk.
svn-id: r48731
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/graphics.cpp12
-rw-r--r--engines/mohawk/graphics.h2
-rw-r--r--engines/mohawk/riven.cpp22
-rw-r--r--engines/mohawk/riven.h11
4 files changed, 31 insertions, 16 deletions
diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp
index a634cd1584..6c41f67d85 100644
--- a/engines/mohawk/graphics.cpp
+++ b/engines/mohawk/graphics.cpp
@@ -613,11 +613,11 @@ void RivenGraphics::showInventory() {
// bool hasTrapBook = *_vm->matchVarToString("atrapbook") != 0;
if (!hasCathBook) {
- drawInventoryImage(101, atrusJournalRectSolo);
+ drawInventoryImage(101, g_atrusJournalRectSolo);
} else {
- drawInventoryImage(101, atrusJournalRect);
- drawInventoryImage(102, cathJournalRect);
- drawInventoryImage(100, trapBookRect);
+ drawInventoryImage(101, g_atrusJournalRect);
+ drawInventoryImage(102, g_cathJournalRect);
+ drawInventoryImage(100, g_trapBookRect);
}
_vm->_system->updateScreen();
@@ -648,12 +648,12 @@ void RivenGraphics::clearInventoryArea() {
_vm->_system->unlockScreen();
}
-void RivenGraphics::drawInventoryImage(uint16 id, Common::Rect rect) {
+void RivenGraphics::drawInventoryImage(uint16 id, const Common::Rect *rect) {
ImageData *imageData = _bitmapDecoder->decodeImage(_vm->getExtrasResource(ID_TBMP, id));
Graphics::Surface *surface = imageData->getSurface();
delete imageData;
- _vm->_system->copyRectToScreen((byte *)surface->pixels, surface->pitch, rect.left, rect.top, surface->w, surface->h);
+ _vm->_system->copyRectToScreen((byte *)surface->pixels, surface->pitch, rect->left, rect->top, surface->w, surface->h);
surface->free();
delete surface;
diff --git a/engines/mohawk/graphics.h b/engines/mohawk/graphics.h
index ebc1e696f3..8d28e1ff4b 100644
--- a/engines/mohawk/graphics.h
+++ b/engines/mohawk/graphics.h
@@ -174,7 +174,7 @@ private:
// Inventory
void clearInventoryArea();
- void drawInventoryImage(uint16 id, Common::Rect rect);
+ void drawInventoryImage(uint16 id, const Common::Rect *rect);
bool _inventoryDrawn;
// Screen Related
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index d5a4e9b140..805ba52f8a 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -37,6 +37,11 @@
namespace Mohawk {
+Common::Rect *g_atrusJournalRectSolo;
+Common::Rect *g_atrusJournalRect;
+Common::Rect *g_cathJournalRect;
+Common::Rect *g_trapBookRect;
+
MohawkEngine_Riven::MohawkEngine_Riven(OSystem *syst, const MohawkGameDescription *gamedesc) : MohawkEngine(syst, gamedesc) {
_showHotspots = false;
_cardData.hasData = false;
@@ -50,6 +55,11 @@ MohawkEngine_Riven::MohawkEngine_Riven(OSystem *syst, const MohawkGameDescriptio
SearchMan.addSubDirectoryMatching(_gameDataDir, "data");
SearchMan.addSubDirectoryMatching(_gameDataDir, "exe");
SearchMan.addSubDirectoryMatching(_gameDataDir, "assets2");
+
+ g_atrusJournalRectSolo = new Common::Rect(295, 402, 313, 426);
+ g_atrusJournalRect = new Common::Rect(222, 402, 240, 426);
+ g_cathJournalRect = new Common::Rect(291, 408, 311, 419);
+ g_trapBookRect = new Common::Rect(363, 396, 386, 432);
}
MohawkEngine_Riven::~MohawkEngine_Riven() {
@@ -62,6 +72,10 @@ MohawkEngine_Riven::~MohawkEngine_Riven() {
delete _loadDialog;
delete _optionsDialog;
delete _rnd;
+ delete g_atrusJournalRectSolo;
+ delete g_atrusJournalRect;
+ delete g_cathJournalRect;
+ delete g_trapBookRect;
_cardData.scripts.clear();
}
@@ -463,21 +477,21 @@ void MohawkEngine_Riven::checkInventoryClick() {
// Go to the book if a hotspot contains the mouse
if (!hasCathBook) {
- if (atrusJournalRectSolo.contains(_mousePos)) {
+ if (g_atrusJournalRectSolo->contains(_mousePos)) {
_gfx->hideInventory();
changeToStack(aspit);
changeToCard(5);
}
} else {
- if (atrusJournalRect.contains(_mousePos)) {
+ if (g_atrusJournalRect->contains(_mousePos)) {
_gfx->hideInventory();
changeToStack(aspit);
changeToCard(5);
- } else if (cathJournalRect.contains(_mousePos)) {
+ } else if (g_cathJournalRect->contains(_mousePos)) {
_gfx->hideInventory();
changeToStack(aspit);
changeToCard(6);
- } else if (trapBookRect.contains(_mousePos)) {
+ } else if (g_trapBookRect->contains(_mousePos)) {
_gfx->hideInventory();
changeToStack(aspit);
changeToCard(7);
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index 633850529f..f014b76fb8 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -66,11 +66,12 @@ enum {
StackNames = 5
};
-// Rects for the inventory object positions
-static const Common::Rect atrusJournalRectSolo = Common::Rect(295, 402, 313, 426);
-static const Common::Rect atrusJournalRect = Common::Rect(222, 402, 240, 426);
-static const Common::Rect cathJournalRect = Common::Rect(291, 408, 311, 419);
-static const Common::Rect trapBookRect = Common::Rect(363, 396, 386, 432);
+// Rects for the inventory object positions (initialized in
+// MohawkEngine_Riven's constructor).
+extern Common::Rect *g_atrusJournalRectSolo;
+extern Common::Rect *g_atrusJournalRect;
+extern Common::Rect *g_cathJournalRect;
+extern Common::Rect *g_trapBookRect;
struct RivenHotspot {
uint16 blstID;