aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2014-12-31 11:12:18 -1000
committerPaul Gilbert2014-12-31 11:12:18 -1000
commit5c88d2cc42d9b6124f552464b9c02e800f3956df (patch)
tree8e29758709f81b2bdb431b7e691d81eea79e0642 /engines
parent9506635bad402d58886cc9a47512871b321a10a2 (diff)
downloadscummvm-rg350-5c88d2cc42d9b6124f552464b9c02e800f3956df.tar.gz
scummvm-rg350-5c88d2cc42d9b6124f552464b9c02e800f3956df.tar.bz2
scummvm-rg350-5c88d2cc42d9b6124f552464b9c02e800f3956df.zip
XEEN: Implement window framing code and dialog event handling
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/events.cpp13
-rw-r--r--engines/xeen/events.h6
-rw-r--r--engines/xeen/menus.cpp80
-rw-r--r--engines/xeen/menus.h25
-rw-r--r--engines/xeen/module.mk1
-rw-r--r--engines/xeen/resdata.cpp151
-rw-r--r--engines/xeen/resdata.h35
-rw-r--r--engines/xeen/screen.cpp60
-rw-r--r--engines/xeen/screen.h4
-rw-r--r--engines/xeen/xsurface.cpp36
-rw-r--r--engines/xeen/xsurface.h11
11 files changed, 405 insertions, 17 deletions
diff --git a/engines/xeen/events.cpp b/engines/xeen/events.cpp
index 54cc843dbb..fd0871edbc 100644
--- a/engines/xeen/events.cpp
+++ b/engines/xeen/events.cpp
@@ -94,6 +94,9 @@ void EventsManager::pollEvents() {
case Common::EVENT_KEYDOWN:
_keyCode = event.kbd.keycode;
break;
+ case Common::EVENT_MOUSEMOVE:
+ _mousePos = event.mouse;
+ break;
case Common::EVENT_LBUTTONDOWN:
_leftButton = true;
return;
@@ -168,6 +171,16 @@ uint32 EventsManager::timeElapsed() {
return _frameCounter - _gameCounter;
}
+bool EventsManager::wait(uint numFrames, bool interruptable) {
+ while (!_vm->shouldQuit() && timeElapsed() < numFrames) {
+ pollEventsAndWait();
+ if (interruptable && (_leftButton || _rightButton || isKeyPending()))
+ return true;
+ }
+
+ return false;
+}
+
/**
* Handles moving to the next game frame
*/
diff --git a/engines/xeen/events.h b/engines/xeen/events.h
index bf41bc9f40..6183b75105 100644
--- a/engines/xeen/events.h
+++ b/engines/xeen/events.h
@@ -41,11 +41,13 @@ private:
uint32 _gameCounter;
uint32 _priorGameCounterTime;
Common::KeyCode _keyCode;
- bool _leftButton, _rightButton;
FramesResource _sprites;
void nextFrame();
public:
+ bool _leftButton, _rightButton;
+ Common::Point _mousePos;
+public:
EventsManager(XeenEngine *vm);
~EventsManager();
@@ -77,6 +79,8 @@ public:
void updateGameCounter();
uint32 timeElapsed();
+
+ bool wait(uint numFrames, bool interruptable = false);
};
class GameEvent {
diff --git a/engines/xeen/menus.cpp b/engines/xeen/menus.cpp
index da272b6f3d..0a7b0307c6 100644
--- a/engines/xeen/menus.cpp
+++ b/engines/xeen/menus.cpp
@@ -47,6 +47,39 @@ void Dialog::addButton(const Common::Rect &bounds, char c, SpriteResource *sprit
_buttons.push_back(DialogButton(bounds, c, sprites, d));
}
+void Dialog::checkEvents() {
+ EventsManager &events = *_vm->_events;
+ events.pollEventsAndWait();
+
+ if (events._leftButton) {
+ // Check whether any button is selected
+ events.debounceMouse();
+ Common::Point pt = events._mousePos;
+
+ for (uint i = 0; i < _buttons.size(); ++i) {
+ if (_buttons[i]._bounds.contains(pt)) {
+ _key = _buttons[i]._c;
+ return;
+ }
+ }
+ } else if (events.isKeyPending()) {
+ Common::KeyState keyState;
+ events.getKey(keyState);
+ if (keyState.ascii >= 32 && keyState.ascii <= 127) {
+ _key = keyState.ascii;
+ return;
+ }
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+void SettingsBaseDialog::showContents(SpriteResource &title1, bool waitFlag) {
+ while (!_vm->shouldQuit() && _key == Common::KEYCODE_INVALID) {
+ checkEvents();
+ }
+}
+
/*------------------------------------------------------------------------*/
void OptionsMenu::show(XeenEngine *vm) {
@@ -81,9 +114,9 @@ void OptionsMenu::execute() {
screen._windows[28].setBounds(Common::Rect(72, 25, 248, 175));
- Common::String title1, buttonsName;
- startup(title1, buttonsName);
- SpriteResource buttonSprites(buttonsName);
+ Common::String title1, title2;
+ startup(title1, title2);
+ SpriteResource title1Sprites(title1), title2Sprites(title2);
bool firstTime = true;
while (!_vm->shouldQuit()) {
@@ -96,33 +129,33 @@ void OptionsMenu::execute() {
}
for (;;) {
- showTitles1(title1);
+ showTitles1(title1Sprites);
showTitles2();
reopen:
clearButtons();
- setupButtons(&buttonSprites);
+ setupButtons(&title2Sprites);
openWindow();
while (!_vm->shouldQuit()) {
+ showContents(title1Sprites, true);
}
}
}
}
-void OptionsMenu::showTitles1(const Common::String &title) {
- SpriteResource titleSprites(title);
+void OptionsMenu::showTitles1(SpriteResource &sprites) {
Screen &screen = *_vm->_screen;
EventsManager &events = *_vm->_events;
- int frame = 0;
+ int frameNum = 0;
while (!_vm->shouldQuit() && !events.isKeyMousePressed()) {
events.updateGameCounter();
- frame = ++frame % (_vm->getGameID() == GType_WorldOfXeen ? 5 : 10);
+ frameNum = ++frameNum % (_vm->getGameID() == GType_WorldOfXeen ? 5 : 10);
screen.restoreBackground();
- titleSprites.draw(screen, frame);
+ sprites.draw(screen, frameNum);
while (events.timeElapsed() == 0)
events.pollEventsAndWait();
@@ -319,5 +352,32 @@ void WorldOptionsMenu::openWindow() {
_vm->_screen->_windows[28].open();
}
+void WorldOptionsMenu::showContents(SpriteResource &title1, bool waitFlag) {
+ Screen &screen = *_vm->_screen;
+ EventsManager &events = *_vm->_events;
+
+ events.updateGameCounter();
+ _bgFrame = ++_bgFrame % 5;
+ title1.draw(screen._windows[0], 0);
+ screen._windows[28].frame();
+
+ screen._windows[28].writeString("\r\x01\x03c\fdMight and Magic Options\n"
+ "World of Xeen\x02\n"
+ "117Copyright (c) 1993 NWC, Inc.\n"
+ "All Rights Reserved\x01");
+
+ for (uint btnIndex = 0; btnIndex < _buttons.size(); ++btnIndex) {
+ DialogButton &btn = _buttons[btnIndex];
+ if (btn._d) {
+ btn._sprites->draw(screen._windows[0], btnIndex * 2,
+ Common::Point(btn._bounds.left, btn._bounds.top));
+ }
+ }
+
+ if (waitFlag) {
+ screen._windows[0].update();
+ SettingsBaseDialog::showContents(title1, true);
+ }
+}
} // End of namespace Xeen
diff --git a/engines/xeen/menus.h b/engines/xeen/menus.h
index 774c7cfcb9..07a7bb7e8d 100644
--- a/engines/xeen/menus.h
+++ b/engines/xeen/menus.h
@@ -45,14 +45,17 @@ public:
class Dialog {
private:
- Common::Array<DialogButton> _buttons;
Common::Stack< Common::Array<DialogButton> > _savedButtons;
protected:
XeenEngine *_vm;
+ Common::Array<DialogButton> _buttons;
+ char _key;
virtual void doScroll(bool drawFlag, bool doFade) = 0;
+
+ void checkEvents();
public:
- Dialog(XeenEngine *vm): _vm(vm) {}
+ Dialog(XeenEngine *vm): _vm(vm), _key('\0') {}
void saveButtons();
@@ -63,17 +66,23 @@ public:
void addButton(const Common::Rect &bounds, char c, SpriteResource *sprites, bool d);
};
-class OptionsMenu: public Dialog {
+class SettingsBaseDialog : public Dialog {
+protected:
+ virtual void showContents(SpriteResource &title1, bool mode);
+public:
+ SettingsBaseDialog(XeenEngine *vm) : Dialog(vm) {}
+};
+class OptionsMenu : public SettingsBaseDialog {
private:
void execute();
protected:
- OptionsMenu(XeenEngine *vm) : Dialog(vm) {}
+ OptionsMenu(XeenEngine *vm) : SettingsBaseDialog(vm) {}
protected:
virtual void startup(Common::String &title1, Common::String &title2);
virtual void setBackground() {}
- virtual void showTitles1(const Common::String &title);
+ virtual void showTitles1(SpriteResource &sprites);
virtual void showTitles2();
@@ -103,6 +112,8 @@ public:
};
class WorldOptionsMenu : public DarkSideOptionsMenu {
+private:
+ int _bgFrame;
protected:
virtual void startup(Common::String &title1, Common::String &title2);
@@ -113,8 +124,10 @@ protected:
virtual void setupButtons(SpriteResource *buttons);
virtual void openWindow();
+
+ virtual void showContents(SpriteResource &title1, bool mode);
public:
- WorldOptionsMenu(XeenEngine *vm) : DarkSideOptionsMenu(vm) {}
+ WorldOptionsMenu(XeenEngine *vm) : DarkSideOptionsMenu(vm), _bgFrame(0) {}
};
} // End of namespace Xeen
diff --git a/engines/xeen/module.mk b/engines/xeen/module.mk
index 0dd15b90eb..a410fbcf10 100644
--- a/engines/xeen/module.mk
+++ b/engines/xeen/module.mk
@@ -8,6 +8,7 @@ MODULE_OBJS := \
detection.o \
events.o \
menus.o \
+ resdata.o \
resources.o \
screen.o \
sound.o \
diff --git a/engines/xeen/resdata.cpp b/engines/xeen/resdata.cpp
new file mode 100644
index 0000000000..44002c62f2
--- /dev/null
+++ b/engines/xeen/resdata.cpp
@@ -0,0 +1,151 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/scummsys.h"
+#include "xeen/resdata.h"
+
+namespace Xeen {
+
+const byte SYMBOLS[20][64] = {
+ { // 0
+ 0x00, 0x00, 0xA8, 0xA4, 0xA4, 0xA4, 0xA4, 0xA4, 0x00, 0xA8, 0x9E, 0x9C, 0x9C, 0x9E, 0x9E, 0x9E,
+ 0xAC, 0x9C, 0xA4, 0xAC, 0xAC, 0x9A, 0x9A, 0x9A, 0xAC, 0x9E, 0xAC, 0xA8, 0xA8, 0xA6, 0x97, 0x98,
+ 0xAC, 0xA0, 0xAC, 0xAC, 0xA4, 0xA6, 0x98, 0x99, 0x00, 0xAC, 0xA0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 0x9E, 0xA0, 0xAC, 0x00, 0x99, 0x98, 0x98, 0x99, 0x9A, 0x9A, 0xA0, 0xAC,
+ 0x9C, 0x9C, 0x9C, 0x9C, 0x9C, 0x9C, 0xA0, 0xAC, 0xA0, 0xA0, 0x9E, 0xA0, 0xA0, 0xA0, 0xA0, 0xAC,
+ 0xA4, 0xA4, 0xA4, 0xA4, 0xA4, 0xA4, 0xAC, 0x00, 0xAC, 0xAC, 0xAC, 0xAC, 0xAC, 0xAC, 0x00, 0x00,
+ }
+};
+
+} // End of namespace Xeen
diff --git a/engines/xeen/resdata.h b/engines/xeen/resdata.h
new file mode 100644
index 0000000000..ce355e71cb
--- /dev/null
+++ b/engines/xeen/resdata.h
@@ -0,0 +1,35 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef XEEN_RESDATA_H
+#define XEEN_RESDATA_H
+
+#include "common/scummsys.h"
+#include "gui/debugger.h"
+
+namespace Xeen {
+
+extern const byte SYMBOLS[20][64];
+
+} // End of namespace Xeen
+
+#endif /* XEEN_RESDATA_H */
diff --git a/engines/xeen/screen.cpp b/engines/xeen/screen.cpp
index 1f8e50cd87..4563e37498 100644
--- a/engines/xeen/screen.cpp
+++ b/engines/xeen/screen.cpp
@@ -61,6 +61,62 @@ void Window::open2() {
create(_bounds.width(), _bounds.height());
copyRectToSurface(*_vm->_screen, 0, 0, _bounds);
_dirtyRects.push(_bounds);
+ frame();
+}
+
+void Window::frame() {
+ Screen &screen = *_vm->_screen;
+ int xCount = (_bounds.width() - 9) / SYMBOL_WIDTH;
+ int yCount = (_bounds.height() - 9) / SYMBOL_HEIGHT;
+
+ // Write the top line
+ screen._writePos = Common::Point(_bounds.left, _bounds.top);
+ screen.writeSymbol(0);
+
+ if (xCount > 0) {
+ int symbolId = 1;
+ for (int i = 0; i < xCount; ++i) {
+ screen.writeSymbol(symbolId);
+ if (++symbolId == 5)
+ symbolId = 1;
+ }
+ }
+
+ screen._writePos.x = _bounds.right - SYMBOL_WIDTH;
+ screen.writeSymbol(5);
+
+ // Write the vertical edges
+ if (yCount > 0) {
+ int symbolId = 6;
+ for (int i = 0; i < yCount; ++i) {
+ screen._writePos.y += 8;
+
+ screen._writePos.x = _bounds.left;
+ screen.writeSymbol(symbolId);
+
+ screen._writePos.x = _bounds.right - SYMBOL_WIDTH;
+ screen.writeSymbol(symbolId + 4);
+
+ if (++symbolId == 10)
+ symbolId = 6;
+ }
+ }
+
+ // Write the bottom line
+ screen._writePos = Common::Point(_bounds.left, _bounds.bottom - SYMBOL_HEIGHT);
+ screen.writeSymbol(14);
+
+ if (xCount > 0) {
+ int symbolId = 15;
+ for (int i = 0; i < xCount; ++i) {
+ screen.writeSymbol(symbolId);
+ if (++symbolId == 19)
+ symbolId = 15;
+ }
+ }
+
+ screen._writePos.x = _bounds.right - SYMBOL_WIDTH;
+ screen.writeSymbol(19);
}
void Window::close() {
@@ -94,6 +150,10 @@ void Window::update() {
}
}
+void Window::addDirtyRect(const Common::Rect &r) {
+ _dirtyRects.push(r);
+}
+
/*------------------------------------------------------------------------*/
/**
diff --git a/engines/xeen/screen.h b/engines/xeen/screen.h
index b132e3321a..cbf57670b3 100644
--- a/engines/xeen/screen.h
+++ b/engines/xeen/screen.h
@@ -54,6 +54,8 @@ private:
void open2();
public:
+ virtual void addDirtyRect(const Common::Rect &r);
+public:
Window();
Window(XeenEngine *vm, const Common::Rect &bounds, int a, int border,
@@ -66,6 +68,8 @@ public:
void close();
void update();
+
+ void frame();
};
class Screen: public XSurface {
diff --git a/engines/xeen/xsurface.cpp b/engines/xeen/xsurface.cpp
index f63ad14350..d3c547861b 100644
--- a/engines/xeen/xsurface.cpp
+++ b/engines/xeen/xsurface.cpp
@@ -22,6 +22,7 @@
#include "common/algorithm.h"
#include "xeen/xsurface.h"
+#include "xeen/resdata.h"
namespace Xeen {
@@ -79,4 +80,39 @@ void XSurface::blitTo(XSurface &dest, const Common::Point &destPos) const {
dest.addDirtyRect(Common::Rect(destPos.x, destPos.y, destPos.x + w, destPos.y));
}
+/**
+ * Draws a symbol to the surface.
+ * @param symbolId Symbol number from 0 to 19
+ */
+void XSurface::writeSymbol(int symbolId) {
+ const byte *srcP = &SYMBOLS[symbolId][0];
+
+ for (int yp = 0; yp < SYMBOL_HEIGHT; ++yp) {
+ byte *destP = (byte *)getBasePtr(_writePos.x, _writePos.y + yp);
+
+ for (int xp = 0; xp < SYMBOL_WIDTH; ++xp, ++destP) {
+ byte b = *srcP++;
+ if (b)
+ *destP = b;
+ }
+ }
+
+ _writePos.x += 8;
+}
+
+/**
+ * Write a string to the surface
+ */
+void XSurface::writeString(const Common::String &s) {
+ error("TODO");
+}
+
+/**
+ * Wrie a character to the surface
+ */
+void XSurface::writeChar(char c) {
+ error("TODO");
+}
+
+
} // End of namespace Xeen
diff --git a/engines/xeen/xsurface.h b/engines/xeen/xsurface.h
index 92f1236349..6688285361 100644
--- a/engines/xeen/xsurface.h
+++ b/engines/xeen/xsurface.h
@@ -30,8 +30,13 @@
namespace Xeen {
+#define SYMBOL_WIDTH 8
+#define SYMBOL_HEIGHT 8
+
class XSurface: public Graphics::Surface {
public:
+ Common::Point _writePos;
+public:
virtual void addDirtyRect(const Common::Rect &r) {}
public:
XSurface();
@@ -49,6 +54,12 @@ public:
void blitTo(XSurface &dest) const;
bool empty() const { return getPixels() == nullptr; }
+
+ void writeSymbol(int symbolId);
+
+ void writeString(const Common::String &s);
+
+ void writeChar(char c);
};
} // End of namespace Xeen