aboutsummaryrefslogtreecommitdiff
path: root/engines/agos/menus.cpp
diff options
context:
space:
mode:
authorTravis Howell2006-10-15 04:15:48 +0000
committerTravis Howell2006-10-15 04:15:48 +0000
commited897780369cd866e6656ad22942a9984dcdbdcc (patch)
treeaddbd702ffc590f24ba0c30b68904c72eb93f6f2 /engines/agos/menus.cpp
parent2f639ab4d78862be3c4ba0bfe1b951f1245f0b22 (diff)
downloadscummvm-rg350-ed897780369cd866e6656ad22942a9984dcdbdcc.tar.gz
scummvm-rg350-ed897780369cd866e6656ad22942a9984dcdbdcc.tar.bz2
scummvm-rg350-ed897780369cd866e6656ad22942a9984dcdbdcc.zip
Add menu support for Amiga demo of Elvira 1
svn-id: r24332
Diffstat (limited to 'engines/agos/menus.cpp')
-rw-r--r--engines/agos/menus.cpp127
1 files changed, 127 insertions, 0 deletions
diff --git a/engines/agos/menus.cpp b/engines/agos/menus.cpp
new file mode 100644
index 0000000000..f7bcfa1188
--- /dev/null
+++ b/engines/agos/menus.cpp
@@ -0,0 +1,127 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001 Ludvig Strigeus
+ * Copyright (C) 2001-2006 The ScummVM project
+ *
+ * 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/stdafx.h"
+
+#include "common/file.h"
+
+#include "agos/agos.h"
+#include "agos/intern.h"
+
+using Common::File;
+
+namespace AGOS {
+
+void AGOSEngine::loadMenuFile() {
+ Common::File in;
+
+ in.open(getFileName(GAME_MENUFILE));
+ if (in.isOpen() == false) {
+ error("loadMenuFile: Can't load menus file '%s'", getFileName(GAME_MENUFILE));
+ }
+
+ uint fileSize = in.size();
+ _menuBase = (byte *)malloc(fileSize);
+ if (_menuBase == NULL)
+ error("loadMenuFile: Out of memory for menu data");
+ in.read(_menuBase, fileSize);
+ in.close();
+}
+
+// Elvira 1 specific
+void AGOSEngine::drawMenuStrip(uint windowNum, uint menuNum) {
+ WindowBlock *window = _windowArray[windowNum % 8];
+
+ mouseOff();
+
+ byte *srcPtr = _menuBase;
+ int menu = (menuNum != 0) ? menuNum * 4 + 1 : 0;
+
+ while (menu--) {
+ if (READ_LE_UINT16(srcPtr) != 0xFFFF) {
+ srcPtr += 2;
+ while (*srcPtr != 0)
+ srcPtr++;
+ srcPtr++;
+ } else {
+ srcPtr += 2;
+ }
+ }
+
+ clearWindow(window);
+
+ int newline = 0;
+ while (READ_LE_UINT16(srcPtr) != 0xFFFF) {
+ byte *tmp = srcPtr;
+ srcPtr += 2;
+
+ if (newline != 0) {
+ windowPutChar(window, 10);
+ }
+
+ uint len = 0;
+ while (*srcPtr != 0 && *srcPtr != 1) {
+ len++;
+ srcPtr++;
+ }
+ if (*srcPtr == 1)
+ srcPtr++;
+
+ uint maxLen = window->textMaxLength - len;
+
+ if (window->flags & 1)
+ window->textColumnOffset += 4;
+
+ maxLen /= 2;
+ while (maxLen--)
+ windowPutChar(window, 32);
+
+ srcPtr = tmp;
+ uint verb = READ_BE_UINT16(srcPtr); srcPtr += 2;
+
+ while (*srcPtr != 0) {
+ windowPutChar(window, *srcPtr++);
+ }
+ srcPtr++;
+
+ if (verb != 0xFFFE) {
+ HitArea *ha = findEmptyHitArea();
+ ha->x = window->x * 8 + 3;
+ ha->y = window->textRow * 8 + window->y;
+ ha->data = menuNum;
+ ha->width = window->width * 8 - 6;
+ ha->height = 7;
+ ha->flags = kBFBoxInUse | kBFInvertTouch;
+ ha->id = 30000;
+ ha->priority = 1;
+ ha->verb = verb;
+ }
+
+ newline = 0xFFFF;
+ }
+
+ mouseOn();
+}
+
+
+} // End of namespace AGOS