[Scummvm-cvs-logs] SF.net SVN: scummvm:[47682] scummvm/trunk/engines/sci

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Fri Jan 29 23:02:29 CET 2010


Revision: 47682
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47682&view=rev
Author:   mthreepwood
Date:     2010-01-29 22:02:28 +0000 (Fri, 29 Jan 2010)

Log Message:
-----------
Fix compile when ENABLE_SCI32 is not set.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kevent.cpp
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/engine/state.h
    scummvm/trunk/engines/sci/module.mk
    scummvm/trunk/engines/sci/sci.cpp

Modified: scummvm/trunk/engines/sci/engine/kevent.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kevent.cpp	2010-01-29 21:51:21 UTC (rev 47681)
+++ scummvm/trunk/engines/sci/engine/kevent.cpp	2010-01-29 22:02:28 UTC (rev 47682)
@@ -47,10 +47,12 @@
 	SegManager *segMan = s->_segMan;
 	Common::Point mousePos;
 
-	if (s->_gui)
+#ifdef ENABLE_SCI32
+	if (s->_gui32)
+		mousePos = s->_gui32->getCursorPos();
+	else
+#endif
 		mousePos = s->_gui->getCursorPos();
-	else
-		mousePos = s->_gui32->getCursorPos();
 
 	// If there's a simkey pending, and the game wants a keyboard event, use the
 	// simkey instead of a normal event

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-01-29 21:51:21 UTC (rev 47681)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-01-29 22:02:28 UTC (rev 47682)
@@ -78,10 +78,13 @@
 		else loopNo = -1;
 	}
 
-	if (s->_gui)
+#ifdef ENABLE_SCI32
+	if (s->_gui32)
+		maxLoops = s->_gui32->getLoopCount(viewId);
+	else
+#endif
 		maxLoops = s->_gui->getLoopCount(viewId);
-	else
-		maxLoops = s->_gui32->getLoopCount(viewId);
+		
 
 	if ((loopNo > 1) && (maxLoops < 4))
 		return;
@@ -116,10 +119,12 @@
 	case 1:
 		switch (argv[0].toSint16()) {
 		case 0:
-			if (s->_gui)
+#ifdef ENABLE_SCI32
+			if (s->_gui32)
+				s->_gui32->hideCursor();
+			else
+#endif
 				s->_gui->hideCursor();
-			else
-				s->_gui32->hideCursor();
 			break;
 		case -1:
 			// TODO: Special case at least in kq6, check disassembly
@@ -128,19 +133,24 @@
 			// TODO: Special case at least in kq6, check disassembly
 			break;
 		default:
-			if (s->_gui)
+#ifdef ENABLE_SCI32
+			if (s->_gui32)
+				s->_gui32->showCursor();
+			else
+#endif
 				s->_gui->showCursor();
-			else
-				s->_gui32->showCursor();
 			break;
 		}
 	case 2:
 		pos.y = argv[1].toSint16();
 		pos.x = argv[0].toSint16();
-		if (s->_gui)
+		
+#ifdef ENABLE_SCI32
+		if (s->_gui32)
+			s->_gui32->setCursorPos(pos);
+		else
+#endif
 			s->_gui->setCursorPos(pos);
-		else
-			s->_gui32->setCursorPos(pos);
 		break;
 	case 4: {
 		int16 top = argv[0].toSint16();
@@ -150,10 +160,12 @@
 
 		if ((right >= left) && (bottom >= top)) {
 			Common::Rect rect = Common::Rect(left, top, right, bottom);
-			if (s->_gui)
+#ifdef ENABLE_SCI32
+			if (s->_gui32)
+				s->_gui32->setCursorZone(rect);
+			else
+#endif
 				s->_gui->setCursorZone(rect);
-			else
-				s->_gui32->setCursorZone(rect);
 		} else {
 			warning("kSetCursor: Ignoring invalid mouse zone (%i, %i)-(%i, %i)", left, top, right, bottom);
 		}
@@ -164,10 +176,12 @@
 		hotspot = new Common::Point(argv[3].toSint16(), argv[4].toSint16());
 		// Fallthrough
 	case 3:
-		if (s->_gui)
+#ifdef ENABLE_SCI32
+		if (s->_gui32)
+			s->_gui32->setCursorView(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot);
+		else
+#endif
 			s->_gui->setCursorView(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot);
-		else
-			s->_gui32->setCursorView(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot);
 		break;
 	default :
 		warning("kSetCursor: Unhandled case: %d arguments given", argc);
@@ -343,12 +357,15 @@
 	}
 
 	textWidth = dest[3].toUint16(); textHeight = dest[2].toUint16();
-	if (s->_gui)
+	
+#ifdef ENABLE_SCI32
+	if (s->_gui32)
+		s->_gui32->textSize(s->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight);
+	else
+#endif
 		s->_gui->textSize(s->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight);
-	else
-		s->_gui32->textSize(s->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight);
+	
 	debugC(2, kDebugLevelStrings, "GetTextSize '%s' -> %dx%d\n", text.c_str(), textWidth, textHeight);
-
 	dest[2] = make_reg(0, textHeight);
 	dest[3] = make_reg(0, textWidth);
 	return s->r_acc;
@@ -402,10 +419,14 @@
 	reg_t curObject = argv[0];
 	reg_t listReference = (argc > 1) ? argv[1] : NULL_REG;
 	bool canBeHere;
-	if (s->_gui)
+	
+#ifdef ENABLE_SCI32
+	if (s->_gui32)
+		canBeHere = s->_gui32->canBeHere(curObject, listReference);
+	else
+#endif
 		canBeHere = s->_gui->canBeHere(curObject, listReference);
-	else
-		canBeHere = s->_gui32->canBeHere(curObject, listReference);
+		
 	return make_reg(0, canBeHere);
 }
 
@@ -414,10 +435,14 @@
 	reg_t curObject = argv[0];
 	reg_t listReference = (argc > 1) ? argv[1] : NULL_REG;
 	bool canBeHere;
-	if (s->_gui)
+	
+#ifdef ENABLE_SCI32
+	if (s->_gui32)
+		canBeHere = s->_gui32->canBeHere(curObject, listReference);
+	else
+#endif
 		canBeHere = s->_gui->canBeHere(curObject, listReference);
-	else
-		canBeHere = s->_gui32->canBeHere(curObject, listReference);
+
 	return make_reg(0, !canBeHere);
 }
 
@@ -439,10 +464,13 @@
 	int16 celNo = (argc >= 3) ? argv[2].toSint16() : 0;
 	int16 celHeight;
 
-	if (s->_gui)
+#ifdef ENABLE_SCI32
+	if (s->_gui32)
+		celHeight = s->_gui32->getCelHeight(viewId, loopNo, celNo);
+	else
+#endif
 		celHeight = s->_gui->getCelHeight(viewId, loopNo, celNo);
-	else
-		celHeight = s->_gui32->getCelHeight(viewId, loopNo, celNo);
+
 	return make_reg(0, celHeight);
 }
 
@@ -454,10 +482,13 @@
 	int16 celNo = (argc >= 3) ? argv[2].toSint16() : 0;
 	int16 celWidth;
 
-	if (s->_gui)
+#ifdef ENABLE_SCI32
+	if (s->_gui32)
+		celWidth = s->_gui32->getCelWidth(viewId, loopNo, celNo);
+	else
+#endif
 		celWidth = s->_gui->getCelWidth(viewId, loopNo, celNo);
-	else
-		celWidth = s->_gui32->getCelWidth(viewId, loopNo, celNo);
+
 	return make_reg(0, celWidth);
 }
 
@@ -466,10 +497,12 @@
 	GuiResourceId viewId = GET_SEL32V(s->_segMan, object, view);
 	int16 loopCount;
 
-	if (s->_gui)
+#ifdef ENABLE_SCI32
+	if (s->_gui32)
+		loopCount = s->_gui32->getLoopCount(viewId);
+	else
+#endif
 		loopCount = s->_gui->getLoopCount(viewId);
-	else
-		loopCount = s->_gui32->getLoopCount(viewId);
 
 	debugC(2, kDebugLevelGraphics, "NumLoops(view.%d) = %d\n", viewId, loopCount);
 
@@ -482,10 +515,12 @@
 	int16 loopNo = GET_SEL32V(s->_segMan, object, loop);
 	int16 celCount;
 
-	if (s->_gui)
+#ifdef ENABLE_SCI32
+	if (s->_gui32)
+		celCount = s->_gui32->getCelCount(viewId, loopNo);
+	else
+#endif
 		celCount = s->_gui->getCelCount(viewId, loopNo);
-	else
-		celCount = s->_gui32->getCelCount(viewId, loopNo);
 
 	debugC(2, kDebugLevelGraphics, "NumCels(view.%d, %d) = %d\n", viewId, loopNo, celCount);
 
@@ -553,10 +588,12 @@
 reg_t kBaseSetter(EngineState *s, int argc, reg_t *argv) {
 	reg_t object = argv[0];
 
-	if (s->_gui)
+#ifdef ENABLE_SCI32
+	if (s->_gui32)
+		s->_gui32->baseSetter(object);
+	else
+#endif
 		s->_gui->baseSetter(object);
-	else
-		s->_gui32->baseSetter(object);
 
 	// WORKAROUND for a problem in LSL1VGA. This allows the casino door to be opened,
 	// till the actual problem is found
@@ -569,10 +606,13 @@
 }
 
 reg_t kSetNowSeen(EngineState *s, int argc, reg_t *argv) {
-	if (s->_gui)
+#ifdef ENABLE_SCI32
+	if (s->_gui32)
+		s->_gui32->setNowSeen(argv[0]);
+	else
+#endif
 		s->_gui->setNowSeen(argv[0]);
-	else
-		s->_gui32->setNowSeen(argv[0]);
+
 	return s->r_acc;
 }
 
@@ -1070,10 +1110,13 @@
 	int16 shakeCount = (argc > 0) ? argv[0].toUint16() : 1;
 	int16 directions = (argc > 1) ? argv[1].toUint16() : 1;
 
-	if (s->_gui)
+#ifdef ENABLE_SCI32
+	if (s->_gui32)
+		s->_gui32->shakeScreen(shakeCount, directions);
+	else
+#endif
 		s->_gui->shakeScreen(shakeCount, directions);
-	else
-		s->_gui32->shakeScreen(shakeCount, directions);
+
 	return s->r_acc;
 }
 
@@ -1106,15 +1149,20 @@
 	// Hide the cursor if it's showing and then show it again if it was
 	// previously visible.
 	bool reshowCursor;
-	if (s->_gui) {
+	
+#ifdef ENABLE_SCI32
+	if (s->_gui32) {
+		reshowCursor = s->_gui32->isCursorVisible();
+		if (reshowCursor)
+			s->_gui32->hideCursor();
+	} else {
+#endif
 		reshowCursor = s->_gui->isCursorVisible();
 		if (reshowCursor)
 			s->_gui->hideCursor();
-	} else {
-		reshowCursor = s->_gui32->isCursorVisible();
-		if (reshowCursor)
-			s->_gui32->hideCursor();
+#ifdef ENABLE_SCI32
 	}
+#endif
 
 	// The Windows and DOS versions use different video format as well
 	// as a different argument set.
@@ -1154,22 +1202,27 @@
 	}
 
 	if (playedVideo) {
-		if (s->_gui)
+#ifdef ENABLE_SCI32
+		if (s->_gui32)
+			s->_gui32->syncWithFramebuffer();
+		else
+#endif
 			s->_gui->syncWithFramebuffer();
-		else
-			s->_gui32->syncWithFramebuffer();
 	}
 
 	if (reshowCursor) {
-		if (s->_gui)
+#ifdef ENABLE_SCI32
+		if (s->_gui32)
+			s->_gui32->showCursor();
+		else
+#endif
 			s->_gui->showCursor();
-		else
-			s->_gui32->showCursor();
 	}
 
 	return s->r_acc;
 }
 
+#ifdef ENABLE_SCI32
 reg_t kRobot(EngineState *s, int argc, reg_t *argv) {
 
 	int16 subop = argv[0].toUint16();
@@ -1199,6 +1252,7 @@
 
 	return s->r_acc;
 }
+#endif
 
 reg_t kSetVideoMode(EngineState *s, int argc, reg_t *argv) {
 	// This call is used for KQ6's intro. It has one parameter, which is

Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h	2010-01-29 21:51:21 UTC (rev 47681)
+++ scummvm/trunk/engines/sci/engine/state.h	2010-01-29 22:02:28 UTC (rev 47682)
@@ -52,11 +52,14 @@
 class SciEvent;
 class Menubar;
 class SciGui;
-class SciGui32;
 class Cursor;
 class MessageState;
 class SoundCommandParser;
 
+#ifdef ENABLE_SCI32
+class SciGui32;
+#endif
+
 struct GfxState;
 struct GfxPort;
 struct GfxVisual;
@@ -145,8 +148,11 @@
 	/* Non-VM information */
 
 	SciGui *_gui; /* Currently active Gui */
-	SciGui32 *_gui32;
 
+#ifdef ENABLE_SCI32
+	SciGui32 *_gui32; // GUI for SCI32 games
+#endif
+
 	SciEvent *_event; // Event handling
 
 	AudioPlayer *_audio;

Modified: scummvm/trunk/engines/sci/module.mk
===================================================================
--- scummvm/trunk/engines/sci/module.mk	2010-01-29 21:51:21 UTC (rev 47681)
+++ scummvm/trunk/engines/sci/module.mk	2010-01-29 22:02:28 UTC (rev 47682)
@@ -43,7 +43,6 @@
 	graphics/palette.o \
 	graphics/picture.o \
 	graphics/portrait.o \
-	graphics/robot.o \
 	graphics/screen.o \
 	graphics/text.o \
 	graphics/transitions.o \
@@ -64,13 +63,15 @@
 	sound/drivers/fb01.o \
 	sound/drivers/midi.o \
 	sound/drivers/pcjr.o \
-	video/seq_decoder.o \
-	video/vmd_decoder.o
+	video/seq_decoder.o
 	
+	
 ifdef ENABLE_SCI32
 MODULE_OBJS += \
 	engine/kernel32.o \
-	graphics/gui32.o
+	graphics/gui32.o \
+	graphics/robot.o \
+	video/vmd_decoder.o
 endif
 
 # This module can be built as a plugin

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2010-01-29 21:51:21 UTC (rev 47681)
+++ scummvm/trunk/engines/sci/sci.cpp	2010-01-29 22:02:28 UTC (rev 47682)
@@ -40,11 +40,14 @@
 #include "sci/sound/audio.h"
 #include "sci/sound/soundcmd.h"
 #include "sci/graphics/gui.h"
-#include "sci/graphics/gui32.h"
 #include "sci/graphics/palette.h"
 #include "sci/graphics/cursor.h"
 #include "sci/graphics/screen.h"
 
+#ifdef ENABLE_SCI32
+#include "sci/graphics/gui32.h"
+#endif
+
 namespace Sci {
 
 class GfxDriver;
@@ -163,10 +166,13 @@
 	if (script_init_engine(_gamestate))
 		return Common::kUnknownError;
 
-	if (getSciVersion() <= SCI_VERSION_1_1)
+#ifdef ENABLE_SCI32
+	if (getSciVersion() >= SCI_VERSION_2)
+		_gamestate->_gui32 = new SciGui32(_gamestate, screen, palette, cursor);
+	else
+#endif
 		_gamestate->_gui = new SciGui(_gamestate, screen, palette, cursor, _audio);
-	else
-		_gamestate->_gui32 = new SciGui32(_gamestate, screen, palette, cursor);
+		
 
 	if (game_init(_gamestate)) { /* Initialize */
 		warning("Game initialization failed: Aborting...");
@@ -196,10 +202,12 @@
 
 	syncSoundSettings();
 
-	if (_gamestate->_gui)
+#ifdef ENABLE_SCI32
+	if (_gamestate->_gui32)
+		_gamestate->_gui32->init();
+	else
+#endif
 		_gamestate->_gui->init(_gamestate->usesOldGfxFunctions());
-	else
-		_gamestate->_gui32->init();
 
 	debug("Emulating SCI version %s\n", getSciVersionDesc(getSciVersion()).c_str());
 


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