[Scummvm-cvs-logs] SF.net SVN: scummvm:[41861] scummvm/branches/gsoc2009-draci/engines/draci

dkasak13 at users.sourceforge.net dkasak13 at users.sourceforge.net
Thu Jun 25 13:02:10 CEST 2009


Revision: 41861
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41861&view=rev
Author:   dkasak13
Date:     2009-06-25 11:02:10 +0000 (Thu, 25 Jun 2009)

Log Message:
-----------
Implemented some more methods in Mouse so all mouse-related events are handled through it.

Modified Paths:
--------------
    scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp
    scummvm/branches/gsoc2009-draci/engines/draci/mouse.cpp

Modified: scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp	2009-06-25 10:55:01 UTC (rev 41860)
+++ scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp	2009-06-25 11:02:10 UTC (rev 41861)
@@ -66,9 +66,9 @@
 	// Initialize graphics using following:
 	initGraphics(kScreenWidth, kScreenHeight, false);
 
-	_mouse = new Mouse(this);
 	_screen = new Screen(this);
 	_font = new Font();
+	_mouse = new Mouse(this);
 
 	// Load default font
 	_font->setFont(kFontBig);
@@ -131,7 +131,7 @@
 	}	
 
 	_screen->setPalette(f->_data, 0, kNumColours);
-	
+
 	// Fill screen with light grey
 	_screen->fillScreen(225);
 
@@ -186,22 +186,10 @@
 		_system->delayMillis(100);
 
 		debugC(5, kDraciGeneralDebugLevel, "Finished frame %d", t);	
-	}	
-	
-	path = "HRA.DFW";
-	ar.openArchive(path);
-	
-	if(ar.isOpen()) {
-		f = ar[0];	
-	} else {
-		debugC(2, kDraciGeneralDebugLevel, "ERROR - Archive not opened");
-		return Common::kUnknownError;
-	}	
+	}
 
-	Sprite sp(f->_data, f->_length, 0, 0, true);
-	CursorMan.pushCursorPalette(_screen->getPalette(), 0, kNumColours);
-	CursorMan.pushCursor(sp._data, sp._width, sp._height, sp._width / 2, sp._height / 2);
-	CursorMan.showMouse(true);
+	_mouse->setCursorNum(kNormalCursor);
+	_mouse->cursorOn();
 
 	Common::Event event;
 	bool quit = false;
@@ -210,9 +198,10 @@
 			switch (event.type) {
 			case Common::EVENT_QUIT:
 				quit = true;
+				break;
 			default:
 				_mouse->handleEvent(event);
-			}
+			}		
 		}
 		_screen->copyToScreen();
 		_system->delayMillis(20);

Modified: scummvm/branches/gsoc2009-draci/engines/draci/mouse.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/mouse.cpp	2009-06-25 10:55:01 UTC (rev 41860)
+++ scummvm/branches/gsoc2009-draci/engines/draci/mouse.cpp	2009-06-25 11:02:10 UTC (rev 41861)
@@ -25,6 +25,7 @@
 
 #include "draci/draci.h"
 #include "draci/mouse.h"
+#include "draci/barchive.h"
 
 namespace Draci {
 
@@ -78,8 +79,26 @@
 	_vm->_system->warpMouse(x, y);
 }
 
-// FIXME: stub
+// FIXME: Handle hotspots properly
+// TODO: Implement a resource manager
 void Mouse::setCursorNum(CursorType cursorNum) {
+	_cursorNum = cursorNum;
+	
+	Common::String path("HRA.DFW");
+	BAFile *f;
+	BArchive ar;
+	ar.openArchive(path);
+	
+	if(ar.isOpen()) {
+		f = ar[cursorNum];	
+	} else {
+		debugC(2, kDraciGeneralDebugLevel, "ERROR - Archive not opened - %s", path.c_str());
+		return;
+	}	
+
+	Sprite sp(f->_data, f->_length, 0, 0, true);
+	CursorMan.replaceCursorPalette(_vm->_screen->getPalette(), 0, kNumColours);
+	CursorMan.replaceCursor(sp._data, sp._width, sp._height, sp._width / 2, sp._height / 2);
 }
 
 }


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