aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBorja Lorente2016-06-12 22:27:23 +0200
committerBorja Lorente2016-08-14 18:22:19 +0200
commit61134cf570b711b61bef8034db2b167a3a6f4ef3 (patch)
treed20d204a4d51b67dc027bd30cce987466bafa234
parentec40b4ec441dd1e3af4cdf1fb670d44efc19f7f4 (diff)
downloadscummvm-rg350-61134cf570b711b61bef8034db2b167a3a6f4ef3.tar.gz
scummvm-rg350-61134cf570b711b61bef8034db2b167a3a6f4ef3.tar.bz2
scummvm-rg350-61134cf570b711b61bef8034db2b167a3a6f4ef3.zip
MACVENTURE: Add the rest of the windows
-rw-r--r--engines/macventure/gui.cpp112
-rw-r--r--engines/macventure/gui.h7
2 files changed, 116 insertions, 3 deletions
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index 8f922d3dd2..3aac7e1ada 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -68,7 +68,14 @@ static const Graphics::MenuData menuSubItems[] = {
{ 0, NULL, 0, 0, false }
};
+bool controlsWindowCallback(Graphics::WindowClick, Common::Event &event, void *gui);
+bool mainGameWindowCallback(Graphics::WindowClick, Common::Event &event, void *gui);
bool outConsoleWindowCallback(Graphics::WindowClick, Common::Event &event, void *gui);
+bool selfWindowCallback(Graphics::WindowClick, Common::Event &event, void *gui);
+bool exitsWindowCallback(Graphics::WindowClick, Common::Event &event, void *gui);
+bool diplomaWindowCallback(Graphics::WindowClick, Common::Event &event, void *gui);
+bool inventoryWindowCallback(Graphics::WindowClick, Common::Event &event, void *gui);
+
void menuCommandsCallback(int action, Common::String &text, void *data);
Gui::Gui(MacVentureEngine *engine, Common::MacResManager *resman) {
@@ -92,6 +99,24 @@ bool Gui::processEvent(Common::Event &event) {
return _wm.processEvent(event);
}
+const WindowData& Gui::getWindowData(WindowReference reference) {
+ assert(_windowData);
+
+ Common::List<WindowData>::const_iterator iter = _windowData->begin();
+ while (iter->refcon != reference && iter != _windowData->end()) {
+ iter++;
+ }
+
+ if (iter->refcon == reference)
+ return *iter;
+
+ error("Could not locate the desired window data");
+}
+
+const Graphics::Font& Gui::getCurrentFont() {
+ return *_wm.getFont("Chicago-12", Graphics::FontManager::kBigGUIFont);
+}
+
void Gui::initGUI() {
_screen.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8());
_wm.setScreen(&_screen);
@@ -126,6 +151,12 @@ void Gui::initWindows() {
loadBorder(_controlsWindow, "border_command.bmp", true);
// Main Game Window
+ _mainGameWindow = _wm.addWindow(false, false, false);
+ _mainGameWindow->setDimensions(getWindowData(kMainGameWindow).bounds);
+ _mainGameWindow->setActive(false);
+ _mainGameWindow->setCallback(mainGameWindowCallback, this);
+ loadBorder(_mainGameWindow, "border_command.bmp", false);
+ loadBorder(_mainGameWindow, "border_command.bmp", true);
// In-game Output Console
_outConsoleWindow = _wm.addWindow(false, true, true);
@@ -134,6 +165,36 @@ void Gui::initWindows() {
_outConsoleWindow->setCallback(outConsoleWindowCallback, this);
loadBorder(_outConsoleWindow, "border_command.bmp", false);
+ // Self Window
+ _selfWindow = _wm.addWindow(false, true, true);
+ _selfWindow->setDimensions(getWindowData(kSelfWindow).bounds);
+ _selfWindow->setActive(false);
+ _selfWindow->setCallback(selfWindowCallback, this);
+ loadBorder(_selfWindow, "border_command.bmp", false);
+
+ // Exits Window
+ _exitsWindow = _wm.addWindow(false, true, true);
+ _exitsWindow->setDimensions(getWindowData(kExitsWindow).bounds);
+ _exitsWindow->setActive(false);
+ _exitsWindow->setCallback(exitsWindowCallback, this);
+ loadBorder(_exitsWindow, "border_command.bmp", false);
+
+ // Diploma Window
+ _diplomaWindow = _wm.addWindow(false, true, true);
+ _diplomaWindow->setDimensions(getWindowData(kDiplomaWindow).bounds);
+ _diplomaWindow->setActive(false);
+ _diplomaWindow->setCallback(diplomaWindowCallback, this);
+ loadBorder(_diplomaWindow, "border_command.bmp", false);
+ // Render invisible for now
+ _diplomaWindow->getSurface()->fillRect(_diplomaWindow->getSurface()->getBounds(), kColorGreen2);
+
+ // Inventory Window
+ _inventoryWindow = _wm.addWindow(false, true, true);
+ _inventoryWindow->setDimensions(getWindowData(kInventoryWindow).bounds);
+ _inventoryWindow->setActive(false);
+ _inventoryWindow->setCallback(inventoryWindowCallback, this);
+ loadBorder(_inventoryWindow, "border_command.bmp", false);
+
}
void Gui::loadBorder(Graphics::MacWindow * target, Common::String filename, bool active) {
@@ -265,12 +326,28 @@ bool Gui::loadWindows() {
data.title[data.titleLength] = '\0';
}
+ debug(5, "Window loaded: %s", data.title);
+
_windowData->push_back(data);
}
+ loadInventoryWindow();
+
return true;
}
+void Gui::loadInventoryWindow() {
+ WindowData data;
+ data.bounds = Common::Rect(5, 30, 125, 190);
+ data.title = "Inventory";
+ data.visible = true;
+ data.hasCloseBox = false;
+ data.refcon = kInventoryWindow;
+ data.titleLength = 10;
+
+ _windowData->push_back(data);
+}
+
bool Gui::loadControls() {
Common::MacResIDArray resArray;
Common::SeekableReadStream *res;
@@ -344,14 +421,45 @@ void Gui::drawCommandsWindow() {
/* CALLBACKS */
+
+bool controlsWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui) {
+ Gui *g = (Gui*)gui;
+
+ return g->processCommandEvents(click, event);
+}
+
+bool mainGameWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui) {
+ Gui *g = (Gui*)gui;
+
+ return true;
+}
+
bool outConsoleWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui) {
return true;
}
-bool controlsWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui) {
+bool selfWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui) {
Gui *g = (Gui*)gui;
- return g->processCommandEvents(click, event);
+ return true;
+}
+
+bool exitsWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui) {
+ Gui *g = (Gui*)gui;
+
+ return true;
+}
+
+bool diplomaWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui) {
+ Gui *g = (Gui*)gui;
+
+ return true;
+}
+
+bool inventoryWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui) {
+ Gui *g = (Gui*)gui;
+
+ return true;
}
void menuCommandsCallback(int action, Common::String &text, void *data) {
diff --git a/engines/macventure/gui.h b/engines/macventure/gui.h
index 9316f91fd3..7ffe199344 100644
--- a/engines/macventure/gui.h
+++ b/engines/macventure/gui.h
@@ -59,7 +59,8 @@ enum WindowReference {
kOutConsoleWindow = 0x82,
kSelfWindow = 0x83,
kExitsWindow = 0x84,
- kDiplomaWindow = 0x85
+ kDiplomaWindow = 0x85,
+ kInventoryWindow = 0x90 // Not in the files, but here for convenience
};
enum MVWindowType {
@@ -148,6 +149,7 @@ private: // Attributes
Graphics::MacWindow *_selfWindow;
Graphics::MacWindow *_exitsWindow;
Graphics::MacWindow *_diplomaWindow;
+ Graphics::MacWindow *_inventoryWindow;
Graphics::Menu *_menu;
private: // Methods
@@ -159,6 +161,9 @@ private: // Methods
// Loaders
bool loadMenus();
+ bool loadWindows();
+ void loadInventoryWindow();
+ bool loadControls();
void loadBorder(Graphics::MacWindow * target, Common::String filename, bool active);
// Drawers