Skip to content

Commit

Permalink
XEEN: Proper setup of window list
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Dec 30, 2014
1 parent 676e758 commit 6a71a9f
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 161 deletions.
221 changes: 61 additions & 160 deletions engines/xeen/screen.cpp
Expand Up @@ -28,162 +28,14 @@

namespace Xeen {

const int WX[48] = {
0, 237, 225, 0,
235, 70, 52, 108, 232, 103, 226, 8,
0, 50, 0, 50,
228, 20, 0, 231,
72, 99, 65, 80,
0, 27, 15, 90,
0, 0, 0, 50,
12, 8, 232, 226,
225, 27, 225, 0,
0, 0, 0, 0,
0, 0, 0, 0
};

const int WY[48] = {
0, 9, 1, 0,
148, 20, 149, 0,
9, 156, 0, 8,
143, 103, 7, 71,
106, 142, 20, 48,
37, 59, 23, 28,
0, 6, 15, 45,
0, 101, 0, 112,
11, 147, 74, 26,
74, 6, 140, 0,
0, 0, 0, 0,
0, 0, 0, 0
};
Window::Window() : _screen(nullptr), _a(0), _border(0),
_xLo(0), _xHi(0), _ycL(0), _ycH(0) {
}

const int WW[48] = {
320, 80, 94, 230,
74, 180, 216, 92,
80, 114, 93, 216,
320, 216, 320, 132,
91, 270, 320, 86,
176, 138, 185, 176,
320, 180, 146, 130,
320, 320, 320, 216,
152, 216, 80, 93,
94, 168, 94, 0,
0, 0, 0, 0,
0, 0, 0, 0
};

const int WH[48] = {
200, 65, 72, 149,
41, 163, 48, 200,
65, 30, 146, 132,
56, 36, 131, 58,
40, 57, 160, 93,
126, 82, 140, 120,
146, 136, 76, 112,
200, 45, 108, 36,
83, 45, 64, 120,
80, 136, 59, 0,
0, 0, 0, 0,
0, 0, 0, 0
};

const int WA[48] = {
0, 0, 1, 0,
2, 3, 4, 5,
0, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16,
17, 18, 19, 20,
21, 22, 23, 24,
25, 26, 27, 28,
0, 0, 29, 30,
31, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0
};

const int WB[48] = {
0, 0, 8, 0,
8, 8, 8, 0,
0, 8, 8, 8,
8, 8, 8, 8,
8, 8, 8, 8,
8, 8, 8, 8,
8, 8, 8, 8,
8, 8, 8, 8,
0, 8, 8, 8,
8, 8, 8, 8,
8, 8, 8, 8,
8, 8, 8, 8
};

const int WXlo[48] = { 0, 237, 225, 9,
0, 80, 0, 0,
0, 0, 0, 8,
0, 0, 0, 0,
0, 0, 0, 0,
0, 99, 75, 80,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0
};

const int WYcl[48] = {
0, 12, 1, 8,
0, 38, 0, 0,
0, 0, 0, 8,
0, 0, 0, 0,
0, 0, 0, 0,
0, 59, 36, 28,
0, 0, 0, 0,
0, 101, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0
};

const int WXhi[48] = {
320, 307, 319, 216,
0, 240, 0, 0,
0, 0, 0, 224,
0, 0, 0, 0,
0, 0, 0, 0,
0, 237, 245, 256,
320, 0, 0, 0,
0, 320, 0, 0,
52, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0
};

const int WYch[48] = {
200, 68, 73, 140,
0, 166, 0, 0,
0, 0, 0, 200,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 141, 172,
148, 146, 0, 0,
0, 0, 45, 0,
0, 94, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0
};

Window::Window(const Common::Rect &bounds, int a, int border, int xLo, int ycL, int xHi, int ycH) {
_bounds = bounds;
_a = a;
_border = border;
_xLo = xLo;
_ycL = ycL;
_xHi = xHi;
_ycH = ycH;
Window::Window(Screen *screen, const Common::Rect &bounds, int a, int border,
int xLo, int ycL, int xHi, int ycH):
_screen(screen), _bounds(bounds), _a(a), _border(border),
_xLo(xLo), _ycL(ycL), _xHi(xHi), _ycH(ycH) {
}

/*------------------------------------------------------------------------*/
Expand All @@ -194,12 +46,61 @@ Window::Window(const Common::Rect &bounds, int a, int border, int xLo, int ycL,
Screen::Screen(XeenEngine *vm) : _vm(vm) {
_fadeIn = false;
create(SCREEN_WIDTH, SCREEN_HEIGHT);
setupWindows();
}

for (int i = 0; i < 48; ++i) {
warning("Window(Common::Rect(%d, %d, %d, %d), %d, %d, %d, %d, %d, %d);",
WX[i], WY[i], WX[i] + WW[i], WY[i] + WH[i], WA[i], WB[i], WXlo[i],
WYcl[i], WXhi[i], WYch[i]);
}
void Screen::setupWindows() {
Window windows[48] = {
Window(this, Common::Rect(0, 0, 320, 200), 0, 0, 0, 0, 320, 200),
Window(this, Common::Rect(237, 9, 317, 74), 0, 0, 237, 12, 307, 68),
Window(this, Common::Rect(225, 1, 319, 73), 1, 8, 225, 1, 319, 73),
Window(this, Common::Rect(0, 0, 230, 149), 0, 0, 9, 8, 216, 140),
Window(this, Common::Rect(235, 148, 309, 189), 2, 8, 0, 0, 0, 0),
Window(this, Common::Rect(70, 20, 250, 183), 3, 8, 80, 38, 240, 166),
Window(this, Common::Rect(52, 149, 268, 197), 4, 8, 0, 0, 0, 0),
Window(this, Common::Rect(108, 0, 200, 200), 5, 0, 0, 0, 0, 0),
Window(this, Common::Rect(232, 9, 312, 74), 0, 0, 0, 0, 0, 0),
Window(this, Common::Rect(103, 156, 217, 186), 6, 8, 0, 0, 0, 0),
Window(this, Common::Rect(226, 0, 319, 146), 7, 8, 0, 0, 0, 0),
Window(this, Common::Rect(8, 8, 224, 140), 8, 8, 8, 8, 224, 200),
Window(this, Common::Rect(0, 143, 320, 199), 9, 8, 0, 0, 0, 0),
Window(this, Common::Rect(50, 103, 266, 139), 10, 8, 0, 0, 0, 0),
Window(this, Common::Rect(0, 7, 320, 138), 11, 8, 0, 0, 0, 0),
Window(this, Common::Rect(50, 71, 182, 129), 12, 8, 0, 0, 0, 0),
Window(this, Common::Rect(228, 106, 319, 146), 13, 8, 0, 0, 0, 0),
Window(this, Common::Rect(20, 142, 290, 199), 14, 8, 0, 0, 0, 0),
Window(this, Common::Rect(0, 20, 320, 180), 15, 8, 0, 0, 0, 0),
Window(this, Common::Rect(231, 48, 317, 141), 16, 8, 0, 0, 0, 0),
Window(this, Common::Rect(72, 37, 248, 163), 17, 8, 0, 0, 0, 0),
Window(this, Common::Rect(99, 59, 237, 141), 18, 8, 99, 59, 237, 0),
Window(this, Common::Rect(65, 23, 250, 163), 19, 8, 75, 36, 245, 141),
Window(this, Common::Rect(80, 28, 256, 148), 20, 8, 80, 28, 256, 172),
Window(this, Common::Rect(0, 0, 320, 146), 21, 8, 0, 0, 320, 148),
Window(this, Common::Rect(27, 6, 207, 142), 22, 8, 0, 0, 0, 146),
Window(this, Common::Rect(15, 15, 161, 91), 23, 8, 0, 0, 0, 0),
Window(this, Common::Rect(90, 45, 220, 157), 24, 8, 0, 0, 0, 0),
Window(this, Common::Rect(0, 0, 320, 200), 25, 8, 0, 0, 0, 0),
Window(this, Common::Rect(0, 101, 320, 146), 26, 8, 0, 101, 320, 0),
Window(this, Common::Rect(0, 0, 320, 108), 27, 8, 0, 0, 0, 45),
Window(this, Common::Rect(50, 112, 266, 148), 28, 8, 0, 0, 0, 0),
Window(this, Common::Rect(12, 11, 164, 94), 0, 0, 0, 0, 52, 0),
Window(this, Common::Rect(8, 147, 224, 192), 0, 8, 0, 0, 0, 94),
Window(this, Common::Rect(232, 74, 312, 138), 29, 8, 0, 0, 0, 0),
Window(this, Common::Rect(226, 26, 319, 146), 30, 8, 0, 0, 0, 0),
Window(this, Common::Rect(225, 74, 319, 154), 31, 8, 0, 0, 0, 0),
Window(this, Common::Rect(27, 6, 195, 142), 0, 8, 0, 0, 0, 0),
Window(this, Common::Rect(225, 140, 319, 199), 0, 8, 0, 0, 0, 0),
Window(this, Common::Rect(), 0, 8, 0, 0, 0, 0),
Window(this, Common::Rect(), 0, 8, 0, 0, 0, 0),
Window(this, Common::Rect(), 0, 8, 0, 0, 0, 0),
Window(this, Common::Rect(), 0, 8, 0, 0, 0, 0),
Window(this, Common::Rect(), 0, 8, 0, 0, 0, 0),
Window(this, Common::Rect(), 0, 8, 0, 0, 0, 0),
Window(this, Common::Rect(), 0, 8, 0, 0, 0, 0),
Window(this, Common::Rect(), 0, 8, 0, 0, 0, 0)
};

_windows = Common::Array<Window>(windows, 48);
}

void Screen::update() {
Expand Down
10 changes: 9 additions & 1 deletion engines/xeen/screen.h
Expand Up @@ -37,28 +37,36 @@ namespace Xeen {
#define PALETTE_SIZE (256 * 3)

class XeenEngine;
class Screen;

class Window {
private:
Screen *_screen;
Common::Rect _bounds;
int _a;
int _border;
int _xLo, _xHi;
int _ycL, _ycH;
public:
Window(const Common::Rect &bounds, int a, int border, int xLo, int ycL, int xHi, int ycH);
Window();

Window(Screen *screen, const Common::Rect &bounds, int a, int border,
int xLo, int ycL, int xHi, int ycH);
};

class Screen: public XSurface {
private:
XeenEngine *_vm;
Common::Array<Window> _windows;
Common::List<Common::Rect> _dirtyRects;
byte _mainPalette[PALETTE_SIZE];
byte _tempPaltte[PALETTE_SIZE];
XSurface _pages[2];
XSurface _savedScreens[10];
bool _fadeIn;

void setupWindows();

void mergeDirtyRects();

bool unionRectangle(Common::Rect &destRect, const Common::Rect &src1, const Common::Rect &src2);
Expand Down

0 comments on commit 6a71a9f

Please sign in to comment.