aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2016-04-28 11:28:55 +0200
committerEugene Sandulenko2016-04-28 11:28:55 +0200
commit6998182b1fef719499ab8b19d415d1a24dd7d908 (patch)
tree8f0d5892bff4cd6d13b2eea103ffe1384d522c4c /engines
parent367946f83b5688490bb40c54bb884df4dac3c11e (diff)
downloadscummvm-rg350-6998182b1fef719499ab8b19d415d1a24dd7d908.tar.gz
scummvm-rg350-6998182b1fef719499ab8b19d415d1a24dd7d908.tar.bz2
scummvm-rg350-6998182b1fef719499ab8b19d415d1a24dd7d908.zip
WAGE: Moved pattern and palette to WM
Diffstat (limited to 'engines')
-rw-r--r--engines/wage/dialog.cpp6
-rw-r--r--engines/wage/gui-console.cpp6
-rw-r--r--engines/wage/gui.cpp20
-rw-r--r--engines/wage/gui.h10
-rw-r--r--engines/wage/macmenu.cpp22
-rw-r--r--engines/wage/macwindowmanager.cpp20
-rw-r--r--engines/wage/macwindowmanager.h9
7 files changed, 42 insertions, 51 deletions
diff --git a/engines/wage/dialog.cpp b/engines/wage/dialog.cpp
index 5495409934..981f42beaf 100644
--- a/engines/wage/dialog.cpp
+++ b/engines/wage/dialog.cpp
@@ -92,7 +92,7 @@ const Graphics::Font *Dialog::getDialogFont() {
}
void Dialog::paint() {
- Design::drawFilledRect(&_gui->_screen, _bbox, kColorWhite, _gui->_patterns, kPatternSolid);
+ Design::drawFilledRect(&_gui->_screen, _bbox, kColorWhite, _gui->_wm.getPatterns(), kPatternSolid);
_font->drawString(&_gui->_screen, _text, _bbox.left + 24, _bbox.top + 16, _bbox.width(), kColorBlack);
static int boxOutline[] = { 1, 0, 0, 1, 1 };
@@ -114,7 +114,7 @@ void Dialog::paint() {
Common::Rect bb(button->bounds.left + 5, button->bounds.top + 5,
button->bounds.right - 5, button->bounds.bottom - 5);
- Design::drawFilledRect(&_gui->_screen, bb, kColorBlack, _gui->_patterns, kPatternSolid);
+ Design::drawFilledRect(&_gui->_screen, bb, kColorBlack, _gui->_wm.getPatterns(), kPatternSolid);
color = kColorWhite;
}
@@ -137,7 +137,7 @@ void Dialog::drawOutline(Common::Rect &bounds, int *spec, int speclen) {
for (int i = 0; i < speclen; i++)
if (spec[i] != 0)
Design::drawRect(&_gui->_screen, bounds.left + i, bounds.top + i, bounds.right - i, bounds.bottom - i,
- 1, kColorBlack, _gui->_patterns, kPatternSolid);
+ 1, kColorBlack, _gui->_wm.getPatterns(), kPatternSolid);
}
int Dialog::run() {
diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp
index 9c89c2721f..ef494bf25d 100644
--- a/engines/wage/gui-console.cpp
+++ b/engines/wage/gui-console.cpp
@@ -198,7 +198,7 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) {
color = kColorWhite;
Common::Rect trect(0, y1, _console.w, y1 + _consoleLineHeight);
- Design::drawFilledRect(&_console, trect, kColorBlack, _patterns, kPatternSolid);
+ Design::drawFilledRect(&_console, trect, kColorBlack, _wm.getPatterns(), kPatternSolid);
}
if (line == _selectionStartY || line == _selectionEndY) {
@@ -225,7 +225,7 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) {
else
trect.left = rectW;
- Design::drawFilledRect(&_console, trect, kColorBlack, _patterns, kPatternSolid);
+ Design::drawFilledRect(&_console, trect, kColorBlack, _wm.getPatterns(), kPatternSolid);
font->drawString(&_console, beg, x1, y1, textW, color1);
font->drawString(&_console, end, x1 + rectW - kConWPadding - kConWOverlap, y1, textW, color2);
@@ -244,7 +244,7 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) {
int rectW2 = rectW1 + font->getStringWidth(mid);
Common::Rect trect(rectW1, y1, rectW2, y1 + _consoleLineHeight);
- Design::drawFilledRect(&_console, trect, kColorBlack, _patterns, kPatternSolid);
+ Design::drawFilledRect(&_console, trect, kColorBlack, _wm.getPatterns(), kPatternSolid);
font->drawString(&_console, beg, x1, y1, textW, kColorBlack);
font->drawString(&_console, mid, x1 + rectW1 - kConWPadding - kConWOverlap, y1, textW, kColorWhite);
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index e3e7ccfcf7..9689788162 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -48,7 +48,6 @@
#include "common/timer.h"
#include "common/system.h"
#include "graphics/cursorman.h"
-#include "graphics/palette.h"
#include "graphics/primitives.h"
#include "wage/wage.h"
@@ -62,19 +61,6 @@
namespace Wage {
-static const byte palette[] = {
- 0, 0, 0, // Black
- 0x80, 0x80, 0x80, // Gray
- 0xff, 0xff, 0xff, // White
- 0x00, 0xff, 0x00, // Green
- 0x00, 0xcf, 0x00 // Green2
-};
-
-static byte fillPatterns[][8] = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, // kPatternSolid
- { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 }, // kPatternStripes
- { 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa } // kPatternCheckers2
-};
-
static const byte macCursorArrow[] = {
2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
2, 0, 2, 3, 3, 3, 3, 3, 3, 3, 3,
@@ -170,16 +156,10 @@ Gui::Gui(WageEngine *engine) {
_inputTextLineNum = 0;
- g_system->getPaletteManager()->setPalette(palette, 0, ARRAYSIZE(palette) / 3);
-
- CursorMan.replaceCursorPalette(palette, 0, 4);
CursorMan.replaceCursor(macCursorArrow, 11, 16, 1, 1, 3);
_cursorIsArrow = true;
CursorMan.showMouse(true);
- for (int i = 0; i < ARRAYSIZE(fillPatterns); i++)
- _patterns.push_back(fillPatterns[i]);
-
g_system->getTimerManager()->installTimerProc(&cursorTimerHandler, 200000, this, "wageCursor");
_menu = _wm.addMenu(this);
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index 9b1995c3f8..448f0b44f7 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -75,12 +75,6 @@ enum {
kCursorHeight = 12
};
-enum {
- kPatternSolid = 1,
- kPatternStripes = 2,
- kPatternCheckers2 = 3
-};
-
class Gui {
public:
Gui(WageEngine *engine);
@@ -110,8 +104,6 @@ public:
bool processSceneEvents(WindowClick click, Common::Event &event);
bool processConsoleEvents(WindowClick click, Common::Event &event);
- Patterns &getPatterns() { return _patterns; }
-
private:
void drawScene();
void drawConsole();
@@ -132,8 +124,6 @@ public:
WageEngine *_engine;
- Patterns _patterns;
-
bool _cursorDirty;
Common::Rect _cursorRect;
bool _cursorOff;
diff --git a/engines/wage/macmenu.cpp b/engines/wage/macmenu.cpp
index 8dee8eba18..15831825c7 100644
--- a/engines/wage/macmenu.cpp
+++ b/engines/wage/macmenu.cpp
@@ -346,11 +346,11 @@ bool Menu::draw(Graphics::ManagedSurface *g, bool forceRedraw) {
_contentIsDirty = true;
- Design::drawFilledRoundRect(&_screen, r, kDesktopArc, kColorWhite, _gui->_patterns, kPatternSolid);
+ Design::drawFilledRoundRect(&_screen, r, kDesktopArc, kColorWhite, _wm->getPatterns(), kPatternSolid);
r.top = 7;
- Design::drawFilledRect(&_screen, r, kColorWhite, _gui->_patterns, kPatternSolid);
+ Design::drawFilledRect(&_screen, r, kColorWhite, _wm->getPatterns(), kPatternSolid);
r.top = kMenuHeight - 1;
- Design::drawFilledRect(&_screen, r, kColorBlack, _gui->_patterns, kPatternSolid);
+ Design::drawFilledRect(&_screen, r, kColorBlack, _wm->getPatterns(), kPatternSolid);
for (uint i = 0; i < _items.size(); i++) {
int color = kColorBlack;
@@ -362,7 +362,7 @@ bool Menu::draw(Graphics::ManagedSurface *g, bool forceRedraw) {
hbox.left -= 1;
hbox.right += 2;
- Design::drawFilledRect(&_screen, hbox, kColorBlack, _gui->_patterns, kPatternSolid);
+ Design::drawFilledRect(&_screen, hbox, kColorBlack, _wm->getPatterns(), kPatternSolid);
color = kColorWhite;
if (!it->subitems.empty())
@@ -383,10 +383,10 @@ void Menu::renderSubmenu(MenuItem *menu) {
if (r->width() == 0 || r->height() == 0)
return;
- Design::drawFilledRect(&_screen, *r, kColorWhite, _gui->_patterns, kPatternSolid);
- Design::drawRect(&_screen, *r, 1, kColorBlack, _gui->_patterns, kPatternSolid);
- Design::drawVLine(&_screen, r->right + 1, r->top + 3, r->bottom + 1, 1, kColorBlack, _gui->_patterns, kPatternSolid);
- Design::drawHLine(&_screen, r->left + 3, r->right + 1, r->bottom + 1, 1, kColorBlack, _gui->_patterns, kPatternSolid);
+ Design::drawFilledRect(&_screen, *r, kColorWhite, _wm->getPatterns(), kPatternSolid);
+ Design::drawRect(&_screen, *r, 1, kColorBlack, _wm->getPatterns(), kPatternSolid);
+ Design::drawVLine(&_screen, r->right + 1, r->top + 3, r->bottom + 1, 1, kColorBlack, _wm->getPatterns(), kPatternSolid);
+ Design::drawHLine(&_screen, r->left + 3, r->right + 1, r->bottom + 1, 1, kColorBlack, _wm->getPatterns(), kPatternSolid);
int x = r->left + kMenuDropdownPadding;
int y = r->top + 1;
@@ -400,7 +400,7 @@ void Menu::renderSubmenu(MenuItem *menu) {
color = kColorWhite;
Common::Rect trect(r->left, y - (_wm->hasBuiltInFonts() ? 1 : 0), r->right, y + _font->getFontHeight());
- Design::drawFilledRect(&_screen, trect, kColorBlack, _gui->_patterns, kPatternSolid);
+ Design::drawFilledRect(&_screen, trect, kColorBlack, _wm->getPatterns(), kPatternSolid);
}
if (!text.empty()) {
@@ -427,7 +427,7 @@ void Menu::renderSubmenu(MenuItem *menu) {
for (int ii = 0; ii < _tempSurface.h; ii++) {
const byte *src = (const byte *)_tempSurface.getBasePtr(0, ii);
byte *dst = (byte *)_screen.getBasePtr(x, y+ii);
- byte pat = _gui->_patterns[kPatternCheckers2 - 1][ii % 8];
+ byte pat = _wm->getPatterns()[kPatternCheckers2 - 1][ii % 8];
for (int j = 0; j < r->width(); j++) {
if (*src != kColorGreen && (pat & (1 << (7 - (x + j) % 8))))
*dst = *src;
@@ -437,7 +437,7 @@ void Menu::renderSubmenu(MenuItem *menu) {
}
}
} else { // Delimiter
- Design::drawHLine(&_screen, r->left + 1, r->right - 1, y + kMenuDropdownItemHeight / 2, 1, kColorBlack, _gui->_patterns, kPatternStripes);
+ Design::drawHLine(&_screen, r->left + 1, r->right - 1, y + kMenuDropdownItemHeight / 2, 1, kColorBlack, _wm->getPatterns(), kPatternStripes);
}
y += kMenuDropdownItemHeight;
diff --git a/engines/wage/macwindowmanager.cpp b/engines/wage/macwindowmanager.cpp
index 66c5bf173c..c98c63532f 100644
--- a/engines/wage/macwindowmanager.cpp
+++ b/engines/wage/macwindowmanager.cpp
@@ -51,8 +51,10 @@
#include "common/unzip.h"
#include "common/system.h"
+#include "graphics/cursorman.h"
#include "graphics/fonts/bdf.h"
#include "graphics/managed_surface.h"
+#include "graphics/palette.h"
#include "wage/wage.h"
#include "wage/design.h"
@@ -63,14 +65,20 @@
namespace Wage {
-enum {
- kPatternCheckers = 1
+static const byte palette[] = {
+ 0, 0, 0, // Black
+ 0x80, 0x80, 0x80, // Gray
+ 0xff, 0xff, 0xff, // White
+ 0x00, 0xff, 0x00, // Green
+ 0x00, 0xcf, 0x00 // Green2
};
-static byte fillPatterns[][8] = { { 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 } // kPatternCheckers
+static byte fillPatterns[][8] = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, // kPatternSolid
+ { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 }, // kPatternStripes
+ { 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 }, // kPatternCheckers
+ { 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa } // kPatternCheckers2
};
-
MacWindowManager::MacWindowManager() {
_screen = 0;
_lastId = 0;
@@ -86,6 +94,10 @@ MacWindowManager::MacWindowManager() {
_patterns.push_back(fillPatterns[i]);
loadFonts();
+
+ g_system->getPaletteManager()->setPalette(palette, 0, ARRAYSIZE(palette) / 3);
+
+ CursorMan.replaceCursorPalette(palette, 0, ARRAYSIZE(palette) / 3);
}
MacWindowManager::~MacWindowManager() {
diff --git a/engines/wage/macwindowmanager.h b/engines/wage/macwindowmanager.h
index 1c0b5c0aea..d570264679 100644
--- a/engines/wage/macwindowmanager.h
+++ b/engines/wage/macwindowmanager.h
@@ -50,6 +50,13 @@
namespace Wage {
+enum {
+ kPatternSolid = 1,
+ kPatternStripes = 2,
+ kPatternCheckers = 3,
+ kPatternCheckers2 = 4
+};
+
class MacWindow;
class Menu;
@@ -74,6 +81,8 @@ public:
BaseMacWindow *getWindow(int id) { return _windows[id]; }
+ Patterns &getPatterns() { return _patterns; }
+
private:
void drawDesktop();
void loadFonts();