[Scummvm-cvs-logs] SF.net SVN: scummvm: [24332] scummvm/trunk/engines/agos

kirben at users.sourceforge.net kirben at users.sourceforge.net
Sun Oct 15 06:16:00 CEST 2006


Revision: 24332
          http://svn.sourceforge.net/scummvm/?rev=24332&view=rev
Author:   kirben
Date:     2006-10-14 21:15:48 -0700 (Sat, 14 Oct 2006)

Log Message:
-----------
Add menu support for Amiga demo of Elvira 1

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.cpp
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/items.cpp
    scummvm/trunk/engines/agos/module.mk
    scummvm/trunk/engines/agos/res.cpp

Added Paths:
-----------
    scummvm/trunk/engines/agos/menus.cpp

Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp	2006-10-15 03:58:31 UTC (rev 24331)
+++ scummvm/trunk/engines/agos/agos.cpp	2006-10-15 04:15:48 UTC (rev 24332)
@@ -107,6 +107,7 @@
 	_stringIdLocalMin = 0;
 	_stringIdLocalMax = 0;
 
+	_menuBase = 0;
 	_roomsList = 0;
 
 	_xtblList = 0;
@@ -2305,6 +2306,10 @@
 		loadIconFile();
 	}
 
+	if (getFileName(GAME_MENUFILE) != NULL) {
+		loadMenuFile();
+	}
+
 	vc34_setMouseOff();
 
 	if ((getPlatform() == Common::kPlatformAmiga || getPlatform() == Common::kPlatformMacintosh) &&

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2006-10-15 03:58:31 UTC (rev 24331)
+++ scummvm/trunk/engines/agos/agos.h	2006-10-15 04:15:48 UTC (rev 24332)
@@ -243,6 +243,7 @@
 	byte **_localStringtable;
 	uint _stringIdLocalMin, _stringIdLocalMax;
 
+	byte *_menuBase;
 	byte *_roomsList;
 
 	byte *_xtblList;
@@ -653,6 +654,8 @@
 	TextLocation *getTextLocation(uint a);
 	void setup_cond_c_helper();
 
+	void drawMenuStrip(uint windowNum, uint menuNum);
+
 	void checkLinkBox();
  	void hyperLinkOn(uint16 x);
  	void hyperLinkOff();
@@ -743,6 +746,7 @@
 
 	void loadIconData();	
 	void loadIconFile();
+	void loadMenuFile();
 
 	bool processSpecialKeys();
 	void hitarea_stuff_helper();

Modified: scummvm/trunk/engines/agos/items.cpp
===================================================================
--- scummvm/trunk/engines/agos/items.cpp	2006-10-15 03:58:31 UTC (rev 24331)
+++ scummvm/trunk/engines/agos/items.cpp	2006-10-15 04:15:48 UTC (rev 24332)
@@ -2077,9 +2077,9 @@
 
 void AGOSEngine::oe1_menu() {
 	// 233: agos menu
-	// Used by Amiga demo
-	getVarOrWord();
-	getVarOrWord();
+	uint b = getVarOrWord();
+	uint a = getVarOrWord();
+	drawMenuStrip(a, b);
 }
 
 void AGOSEngine::oe1_bitClear() {

Added: scummvm/trunk/engines/agos/menus.cpp
===================================================================
--- scummvm/trunk/engines/agos/menus.cpp	                        (rev 0)
+++ scummvm/trunk/engines/agos/menus.cpp	2006-10-15 04:15:48 UTC (rev 24332)
@@ -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


Property changes on: scummvm/trunk/engines/agos/menus.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Modified: scummvm/trunk/engines/agos/module.mk
===================================================================
--- scummvm/trunk/engines/agos/module.mk	2006-10-15 03:58:31 UTC (rev 24331)
+++ scummvm/trunk/engines/agos/module.mk	2006-10-15 04:15:48 UTC (rev 24332)
@@ -13,6 +13,7 @@
 	game.o \
 	icons.o \
 	items.o \
+	menus.o \
 	midi.o \
 	midiparser_s1d.o \
 	oracle.o \

Modified: scummvm/trunk/engines/agos/res.cpp
===================================================================
--- scummvm/trunk/engines/agos/res.cpp	2006-10-15 03:58:31 UTC (rev 24331)
+++ scummvm/trunk/engines/agos/res.cpp	2006-10-15 04:15:48 UTC (rev 24332)
@@ -150,7 +150,7 @@
 void AGOSEngine::loadGamePcFile() {
 	Common::File in;
 	int num_inited_objects;
-	int i, file_size;
+	int i, fileSize;
 
 	/* read main gamepc file */
 	in.open(getFileName(GAME_BASEFILE));
@@ -177,12 +177,12 @@
 			error("loadGamePcFile: Can't load table resources file '%s'", getFileName(GAME_TBLFILE));
 		}
 
-		file_size = in.size();
+		fileSize = in.size();
 
-		_tblList = (byte *)malloc(file_size);
+		_tblList = (byte *)malloc(fileSize);
 		if (_tblList == NULL)
 			error("loadGamePcFile: Out of memory for strip table list");
-		in.read(_tblList, file_size);
+		in.read(_tblList, fileSize);
 		in.close();
 
 		/* Remember the current state */
@@ -197,11 +197,11 @@
 		if (in.isOpen() == false)
 			error("loadGamePcFile: Can't load text resources file '%s'", getFileName(GAME_STRFILE));
 
-		file_size = in.size();
-		_strippedTxtMem = (byte *)malloc(file_size);
+		fileSize = in.size();
+		_strippedTxtMem = (byte *)malloc(fileSize);
 		if (_strippedTxtMem == NULL)
 			error("loadGamePcFile: Out of memory for strip text list");
-		in.read(_strippedTxtMem, file_size);
+		in.read(_strippedTxtMem, fileSize);
 		in.close();
 	}
 
@@ -209,15 +209,15 @@
 		/* Read list of ROOM ITEMS resources */
 		in.open(getFileName(GAME_RMSLFILE));
 		if (in.isOpen() == false) {
-			error("loadGamePcFile: Can't load room resources file '%s'", getFileName(GAME_XTBLFILE));
+			error("loadGamePcFile: Can't load room resources file '%s'", getFileName(GAME_RMSLFILE));
 		}
 
-		file_size = in.size();
+		fileSize = in.size();
 
-		_roomsList = (byte *)malloc(file_size);
+		_roomsList = (byte *)malloc(fileSize);
 		if (_roomsList == NULL)
 			error("loadGamePcFile: Out of memory for room items list");
-		in.read(_roomsList, file_size);
+		in.read(_roomsList, fileSize);
 		in.close();
 	}
 
@@ -228,12 +228,12 @@
 			error("loadGamePcFile: Can't load xtable resources file '%s'", getFileName(GAME_XTBLFILE));
 		}
 
-		file_size = in.size();
+		fileSize = in.size();
 
-		_xtblList = (byte *)malloc(file_size);
+		_xtblList = (byte *)malloc(fileSize);
 		if (_xtblList == NULL)
 			error("loadGamePcFile: Out of memory for strip xtable list");
-		in.read(_xtblList, file_size);
+		in.read(_xtblList, fileSize);
 		in.close();
 
 		/* Remember the current state */


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list