diff options
Diffstat (limited to 'engines/xeen/window.cpp')
-rw-r--r-- | engines/xeen/window.cpp | 95 |
1 files changed, 76 insertions, 19 deletions
diff --git a/engines/xeen/window.cpp b/engines/xeen/window.cpp index 3bb929fc88..aeb8328d56 100644 --- a/engines/xeen/window.cpp +++ b/engines/xeen/window.cpp @@ -25,12 +25,73 @@ namespace Xeen { -XeenEngine *Window::_vm; +Windows::Windows() { + Window windows[40] = { + Window(Common::Rect(0, 0, 320, 200), 0, 0, 0, 0, 320, 200), + Window(Common::Rect(237, 9, 317, 74), 0, 0, 237, 12, 307, 68), + Window(Common::Rect(225, 1, 319, 73), 1, 8, 225, 1, 319, 73), + Window(Common::Rect(0, 0, 230, 149), 0, 0, 9, 8, 216, 140), + Window(Common::Rect(235, 148, 309, 189), 2, 8, 0, 0, 0, 0), + Window(Common::Rect(70, 20, 250, 183), 3, 8, 80, 38, 240, 166), + Window(Common::Rect(52, 149, 268, 197), 4, 8, 0, 0, 0, 0), + Window(Common::Rect(108, 0, 200, 200), 5, 0, 0, 0, 0, 0), + Window(Common::Rect(232, 9, 312, 74), 0, 0, 0, 0, 0, 0), + Window(Common::Rect(103, 156, 217, 186), 6, 8, 0, 0, 0, 0), + Window(Common::Rect(226, 0, 319, 146), 7, 8, 0, 0, 0, 0), + Window(Common::Rect(8, 8, 224, 140), 8, 8, 8, 8, 224, 200), + Window(Common::Rect(0, 143, 320, 199), 9, 8, 0, 0, 0, 0), + Window(Common::Rect(50, 103, 266, 139), 10, 8, 0, 0, 0, 0), + Window(Common::Rect(0, 7, 320, 138), 11, 8, 0, 0, 0, 0), + Window(Common::Rect(50, 71, 182, 129), 12, 8, 0, 0, 0, 0), + Window(Common::Rect(228, 106, 319, 146), 13, 8, 0, 0, 0, 0), + Window(Common::Rect(20, 142, 290, 199), 14, 8, 0, 0, 0, 0), + Window(Common::Rect(0, 20, 320, 180), 15, 8, 0, 0, 0, 0), + Window(Common::Rect(231, 48, 317, 141), 16, 8, 0, 0, 0, 0), + Window(Common::Rect(72, 37, 248, 163), 17, 8, 0, 0, 0, 0), + Window(Common::Rect(99, 59, 237, 141), 18, 8, 99, 59, 237, 0), + Window(Common::Rect(65, 23, 250, 163), 19, 8, 75, 36, 245, 141), + Window(Common::Rect(80, 28, 256, 148), 20, 8, 80, 28, 256, 172), + Window(Common::Rect(0, 0, 320, 146), 21, 8, 0, 0, 320, 148), + Window(Common::Rect(27, 6, 207, 142), 22, 8, 0, 0, 0, 146), + Window(Common::Rect(15, 15, 161, 91), 23, 8, 0, 0, 0, 0), + Window(Common::Rect(90, 45, 220, 157), 24, 8, 0, 0, 0, 0), + Window(Common::Rect(0, 0, 320, 200), 25, 8, 0, 0, 0, 0), + Window(Common::Rect(0, 101, 320, 146), 26, 8, 0, 101, 320, 0), + Window(Common::Rect(0, 0, 320, 108), 27, 8, 0, 0, 0, 45), + Window(Common::Rect(50, 112, 266, 148), 28, 8, 0, 0, 0, 0), + Window(Common::Rect(12, 11, 164, 94), 0, 0, 0, 0, 52, 0), + Window(Common::Rect(8, 147, 224, 192), 0, 8, 0, 0, 0, 94), + Window(Common::Rect(232, 74, 312, 138), 29, 8, 0, 0, 0, 0), + Window(Common::Rect(226, 26, 319, 146), 30, 8, 0, 0, 0, 0), + Window(Common::Rect(225, 74, 319, 154), 31, 8, 0, 0, 0, 0), + Window(Common::Rect(27, 6, 195, 142), 0, 8, 0, 0, 0, 0), + Window(Common::Rect(225, 140, 319, 199), 0, 8, 0, 0, 0, 0) + }; + + _windows = Common::Array<Window>(windows, 40); +} + +void Windows::closeAll() { + for (int i = (int)_windowStack.size() - 1; i >= 0; --i) + _windowStack[i]->close(); + assert(_windowStack.size() == 0); +} + +void Windows::addToStack(Window *win) { + _windowStack.push_back(win); +} -void Window::init(XeenEngine *vm) { - _vm = vm; +void Windows::removeFromStack(Window *win) { + for (uint i = 0; i < _windowStack.size(); ++i) { + if (_windowStack[i] == win) { + _windowStack.remove_at(i); + break; + } + } } +/*------------------------------------------------------------------------*/ + Window::Window() : XSurface(), _enabled(false), _a(0), _border(0), _xLo(0), _xHi(0), _ycL(0), _ycH(0) { } @@ -40,7 +101,7 @@ Window::Window(const Window &src) : XSurface(), _enabled(src._enabled), _xHi(src._xHi), _ycH(src._ycH) { setBounds(src._bounds); - create(*_vm->_screen, Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); + create(*g_vm->_screen, Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); } Window::Window(const Common::Rect &bounds, int a, int border, @@ -48,7 +109,7 @@ Window::Window(const Common::Rect &bounds, int a, int border, _enabled(false), _a(a), _border(border), _xLo(xLo), _ycL(ycL), _xHi(xHi), _ycH(ycH) { setBounds(bounds); - create(*_vm->_screen, Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); + create(*g_vm->_screen, Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); } void Window::setBounds(const Common::Rect &r) { @@ -60,17 +121,17 @@ void Window::setBounds(const Common::Rect &r) { void Window::open() { if (!_enabled) { _enabled = true; - _vm->_screen->_windowStack.push_back(this); + g_vm->_windows->addToStack(this); open2(); } - if (_vm->_mode == MODE_9) { + if (g_vm->_mode == MODE_9) { warning("TODO: copyFileToMemory"); } } void Window::open2() { - Screen &screen = *_vm->_screen; + Screen &screen = *g_vm->_screen; // Save a copy of the area under the window _savedArea.create(_bounds.width(), _bounds.height()); @@ -91,7 +152,7 @@ void Window::open2() { } void Window::frame() { - Screen &screen = *_vm->_screen; + Screen &screen = *g_vm->_screen; int xCount = (_bounds.width() - 9) / FONT_WIDTH; int yCount = (_bounds.height() - 9) / FONT_HEIGHT; @@ -146,7 +207,7 @@ void Window::frame() { } void Window::close() { - Screen &screen = *_vm->_screen; + Screen &screen = *g_vm->_screen; if (_enabled) { // Update the window @@ -158,15 +219,11 @@ void Window::close() { addDirtyRect(_bounds); // Remove the window from the stack and flag it as now disabled - for (uint i = 0; i < _vm->_screen->_windowStack.size(); ++i) { - if (_vm->_screen->_windowStack[i] == this) - _vm->_screen->_windowStack.remove_at(i); - } - + g_vm->_windows->removeFromStack(this); _enabled = false; } - if (_vm->_mode == MODE_9) { + if (g_vm->_mode == MODE_9) { warning("TODO: copyFileToMemory"); } } @@ -177,15 +234,15 @@ void Window::update() { } void Window::addDirtyRect(const Common::Rect &r) { - _vm->_screen->addDirtyRect(r); + g_vm->_screen->addDirtyRect(r); } void Window::fill() { - fillRect(_innerBounds, _vm->_screen->_bgColor); + fillRect(_innerBounds, g_vm->_screen->_bgColor); } const char *Window::writeString(const Common::String &s) { - return _vm->_screen->writeString(s, _innerBounds); + return g_vm->_screen->writeString(s, _innerBounds); } void Window::drawList(DrawStruct *items, int count) { |