[Scummvm-cvs-logs] SF.net SVN: scummvm: [28832] scummvm/trunk

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun Sep 2 23:36:43 CEST 2007


Revision: 28832
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28832&view=rev
Author:   thebluegr
Date:     2007-09-02 14:36:43 -0700 (Sun, 02 Sep 2007)

Log Message:
-----------
Renamed preagi_input.cpp to preagi_common.cpp, as it now contains the code that all preagi games share (commit 2 of 2)

Modified Paths:
--------------
    scummvm/trunk/dists/msvc8/agi.vcproj
    scummvm/trunk/engines/agi/module.mk

Added Paths:
-----------
    scummvm/trunk/engines/agi/preagi_common.cpp

Removed Paths:
-------------
    scummvm/trunk/engines/agi/preagi_input.cpp

Modified: scummvm/trunk/dists/msvc8/agi.vcproj
===================================================================
--- scummvm/trunk/dists/msvc8/agi.vcproj	2007-09-02 21:31:51 UTC (rev 28831)
+++ scummvm/trunk/dists/msvc8/agi.vcproj	2007-09-02 21:36:43 UTC (rev 28832)
@@ -293,7 +293,7 @@
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\agi\preagi_input.cpp"
+			RelativePath="..\..\engines\agi\preagi_common.cpp"
 			>
 		</File>
 		<File

Modified: scummvm/trunk/engines/agi/module.mk
===================================================================
--- scummvm/trunk/engines/agi/module.mk	2007-09-02 21:31:51 UTC (rev 28831)
+++ scummvm/trunk/engines/agi/module.mk	2007-09-02 21:36:43 UTC (rev 28832)
@@ -24,7 +24,7 @@
 	op_test.o \
 	picture.o \
 	preagi.o \
-	preagi_input.o \
+	preagi_common.o \
 	preagi_mickey.o \
 	predictive.o \
 	saveload.o \

Copied: scummvm/trunk/engines/agi/preagi_common.cpp (from rev 28831, scummvm/trunk/engines/agi/preagi_input.cpp)
===================================================================
--- scummvm/trunk/engines/agi/preagi_common.cpp	                        (rev 0)
+++ scummvm/trunk/engines/agi/preagi_common.cpp	2007-09-02 21:36:43 UTC (rev 28832)
@@ -0,0 +1,214 @@
+/* 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/stdafx.h"
+#include "common/events.h"
+
+#include "agi/agi.h"
+#include "agi/font.h"
+#include "agi/graphics.h"
+#include "agi/keyboard.h"
+
+// preagi engines
+#include "agi/preagi_mickey.h"
+
+// default attributes
+#define IDA_DEFAULT		0x0F
+#define IDA_DEFAULT_REV	0xF0
+
+#define IDI_MAX_ROW_PIC	20
+
+namespace Agi {
+
+// String functions
+
+void PreAgiEngine::drawStr(int row, int col, int attr, const char *buffer) {
+	int code;
+
+	for (int iChar = 0; iChar < (int)strlen(buffer); iChar++) {
+		code = buffer[iChar];
+
+		switch (code) {
+		case '\n':
+		case 0x8D:
+			if (++row == 200 / 8) return;
+			col = 0;
+			break;
+
+		case '|':
+			// swap attribute nibbles
+			break;
+
+		default:
+			drawChar(col * 8, row * 8, attr, code, (const char*)mickey_fontdata);
+
+			if (++col == 320 / 8) {
+				col = 0;
+				if (++row == 200 / 8) return;
+			}
+		}
+	}
+}
+
+void PreAgiEngine::drawStrMiddle(int row, int attr, const char *buffer) {
+	int col = (25 / 2) - (strlen(buffer) / 2);	// 25 = 320 / 8 (maximum column)
+	drawStr(row, col, attr, buffer);
+}
+
+void PreAgiEngine::clearTextArea() {
+	// FIXME: this causes crashes, I imagine it's because we're not currently locking the screen in drawStr
+	for (int row = IDI_MAX_ROW_PIC; row < 200 / 8; row++) {
+		//drawStr(row, 0, IDA_DEFAULT, "                                        ");	// 40 spaces
+	}
+}
+
+void PreAgiEngine::drawChar(int x, int y, int attr, int code, const char *fontdata) {
+	int cx, cy;
+	uint8 color;
+
+	for (cy = 0; cy < 8; cy++) {
+		for (cx = 0; cx < 8; cx++) {
+			if (fontdata[(code * 8) + cy] & (1 << (7 - cx)))
+				color = attr & 0x0f;			// foreground color
+			else
+				color = (attr & 0xf0) / 0x10;	// background color
+
+			_gfx->putPixelsA(x + cx, y + cy, 1, &color);
+		}
+	}
+}
+
+// Input functions
+
+void PreAgiEngine::waitAnyKeyAnim() {
+	waitAnyKey(true);
+}
+
+int PreAgiEngine::getSelection(int type) {
+	Common::Event event;
+
+	// Selection types:
+	// 0: Y/N
+	// 1: 1-9
+	for (;;) {
+		while (_eventMan->pollEvent(event)) {
+			switch(event.type) {
+			case Common::EVENT_QUIT:
+				_system->quit();
+			case Common::EVENT_LBUTTONUP:
+				if (type == 0)
+					return 1;
+			case Common::EVENT_RBUTTONUP:
+				return 0;
+			case Common::EVENT_KEYDOWN:
+				switch (event.kbd.keycode) {
+				case Common::KEYCODE_y:
+					if (type == 0)
+						return 1;
+				case Common::KEYCODE_n:
+					if (type == 0)
+						return 0;
+				case Common::KEYCODE_ESCAPE:
+					if (type == 1)
+						return 0;
+				case Common::KEYCODE_1:
+				case Common::KEYCODE_2:
+				case Common::KEYCODE_3:
+				case Common::KEYCODE_4:
+				case Common::KEYCODE_5:
+				case Common::KEYCODE_6:
+				case Common::KEYCODE_7:
+				case Common::KEYCODE_8:
+				case Common::KEYCODE_9:
+					if (type == 1)
+						return event.kbd.keycode - Common::KEYCODE_1 + 1;
+				default:
+					if (type == 0) {
+						return 2;
+					} else {
+						return 10;
+					}
+				}
+				break;
+			default:
+				break;
+			}
+		}
+	}
+	return 0;
+}
+
+bool PreAgiEngine::waitAnyKeyChoice() {
+	Common::Event event;
+
+	for (;;) {
+		while (_eventMan->pollEvent(event)) {
+			switch(event.type) {
+			case Common::EVENT_QUIT:
+				_system->quit();
+			case Common::EVENT_LBUTTONUP:
+				return true;
+			case Common::EVENT_RBUTTONUP:
+				return false;
+			case Common::EVENT_KEYDOWN:
+				switch (event.kbd.keycode) {
+				case Common::KEYCODE_ESCAPE: //Escape
+					return false;
+				default:
+					return true;
+				}
+				break;
+			default:
+				break;
+			}
+		}
+	}
+}
+
+void PreAgiEngine::waitAnyKey(bool anim) {
+	Common::Event event;
+	
+	for (;;) {
+		while (_eventMan->pollEvent(event)) {
+			switch(event.type) {
+			case Common::EVENT_QUIT:
+				_system->quit();
+			case Common::EVENT_KEYDOWN:
+			case Common::EVENT_LBUTTONUP:
+			case Common::EVENT_RBUTTONUP:
+				return;
+			default:
+				break;
+			}
+		}
+		// TODO
+		/*if (anim) {
+			_game->Animate();
+			UpdateScreen();
+		}*/
+	}
+}
+
+}

Deleted: scummvm/trunk/engines/agi/preagi_input.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_input.cpp	2007-09-02 21:31:51 UTC (rev 28831)
+++ scummvm/trunk/engines/agi/preagi_input.cpp	2007-09-02 21:36:43 UTC (rev 28832)
@@ -1,214 +0,0 @@
-/* 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.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/stdafx.h"
-#include "common/events.h"
-
-#include "agi/agi.h"
-#include "agi/font.h"
-#include "agi/graphics.h"
-#include "agi/keyboard.h"
-
-// preagi engines
-#include "agi/preagi_mickey.h"
-
-// default attributes
-#define IDA_DEFAULT		0x0F
-#define IDA_DEFAULT_REV	0xF0
-
-#define IDI_MAX_ROW_PIC	20
-
-namespace Agi {
-
-// String functions
-
-void PreAgiEngine::drawStr(int row, int col, int attr, const char *buffer) {
-	int code;
-
-	for (int iChar = 0; iChar < (int)strlen(buffer); iChar++) {
-		code = buffer[iChar];
-
-		switch (code) {
-		case '\n':
-		case 0x8D:
-			if (++row == 200 / 8) return;
-			col = 0;
-			break;
-
-		case '|':
-			// swap attribute nibbles
-			break;
-
-		default:
-			drawChar(col * 8, row * 8, attr, code, (const char*)mickey_fontdata);
-
-			if (++col == 320 / 8) {
-				col = 0;
-				if (++row == 200 / 8) return;
-			}
-		}
-	}
-}
-
-void PreAgiEngine::drawStrMiddle(int row, int attr, const char *buffer) {
-	int col = (25 / 2) - (strlen(buffer) / 2);	// 25 = 320 / 8 (maximum column)
-	drawStr(row, col, attr, buffer);
-}
-
-void PreAgiEngine::clearTextArea() {
-	// FIXME: this causes crashes, I imagine it's because we're not currently locking the screen in drawStr
-	for (int row = IDI_MAX_ROW_PIC; row < 200 / 8; row++) {
-		//drawStr(row, 0, IDA_DEFAULT, "                                        ");	// 40 spaces
-	}
-}
-
-void PreAgiEngine::drawChar(int x, int y, int attr, int code, const char *fontdata) {
-	int cx, cy;
-	uint8 color;
-
-	for (cy = 0; cy < 8; cy++) {
-		for (cx = 0; cx < 8; cx++) {
-			if (fontdata[(code * 8) + cy] & (1 << (7 - cx)))
-				color = attr & 0x0f;			// foreground color
-			else
-				color = (attr & 0xf0) / 0x10;	// background color
-
-			_gfx->putPixelsA(x + cx, y + cy, 1, &color);
-		}
-	}
-}
-
-// Input functions
-
-void PreAgiEngine::waitAnyKeyAnim() {
-	waitAnyKey(true);
-}
-
-int PreAgiEngine::getSelection(int type) {
-	Common::Event event;
-
-	// Selection types:
-	// 0: Y/N
-	// 1: 1-9
-	for (;;) {
-		while (_eventMan->pollEvent(event)) {
-			switch(event.type) {
-			case Common::EVENT_QUIT:
-				_system->quit();
-			case Common::EVENT_LBUTTONUP:
-				if (type == 0)
-					return 1;
-			case Common::EVENT_RBUTTONUP:
-				return 0;
-			case Common::EVENT_KEYDOWN:
-				switch (event.kbd.keycode) {
-				case Common::KEYCODE_y:
-					if (type == 0)
-						return 1;
-				case Common::KEYCODE_n:
-					if (type == 0)
-						return 0;
-				case Common::KEYCODE_ESCAPE:
-					if (type == 1)
-						return 0;
-				case Common::KEYCODE_1:
-				case Common::KEYCODE_2:
-				case Common::KEYCODE_3:
-				case Common::KEYCODE_4:
-				case Common::KEYCODE_5:
-				case Common::KEYCODE_6:
-				case Common::KEYCODE_7:
-				case Common::KEYCODE_8:
-				case Common::KEYCODE_9:
-					if (type == 1)
-						return event.kbd.keycode - Common::KEYCODE_1 + 1;
-				default:
-					if (type == 0) {
-						return 2;
-					} else {
-						return 10;
-					}
-				}
-				break;
-			default:
-				break;
-			}
-		}
-	}
-	return 0;
-}
-
-bool PreAgiEngine::waitAnyKeyChoice() {
-	Common::Event event;
-
-	for (;;) {
-		while (_eventMan->pollEvent(event)) {
-			switch(event.type) {
-			case Common::EVENT_QUIT:
-				_system->quit();
-			case Common::EVENT_LBUTTONUP:
-				return true;
-			case Common::EVENT_RBUTTONUP:
-				return false;
-			case Common::EVENT_KEYDOWN:
-				switch (event.kbd.keycode) {
-				case Common::KEYCODE_ESCAPE: //Escape
-					return false;
-				default:
-					return true;
-				}
-				break;
-			default:
-				break;
-			}
-		}
-	}
-}
-
-void PreAgiEngine::waitAnyKey(bool anim) {
-	Common::Event event;
-	
-	for (;;) {
-		while (_eventMan->pollEvent(event)) {
-			switch(event.type) {
-			case Common::EVENT_QUIT:
-				_system->quit();
-			case Common::EVENT_KEYDOWN:
-			case Common::EVENT_LBUTTONUP:
-			case Common::EVENT_RBUTTONUP:
-				return;
-			default:
-				break;
-			}
-		}
-		// TODO
-		/*if (anim) {
-			_game->Animate();
-			UpdateScreen();
-		}*/
-	}
-}
-
-}


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