[Scummvm-cvs-logs] CVS: scummvm util.cpp,1.2,1.3 util.h,1.2,1.3 scummvm.cpp,1.184,1.185 newgui.h,1.18,1.19

Max Horn fingolfin at users.sourceforge.net
Thu Jul 18 13:27:09 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv30355

Modified Files:
	util.cpp util.h scummvm.cpp newgui.h 
Log Message:
put stuff in util.h into namespace ScummVM; fixed stupid bug in String class; took painelf's patch which implements save/load dialog in new GUI and fixed it slightly; various other minor changes

Index: util.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/util.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- util.cpp	18 Jul 2002 18:17:57 -0000	1.2
+++ util.cpp	18 Jul 2002 20:26:35 -0000	1.3
@@ -82,6 +82,8 @@
 
 #pragma mark -
 
+namespace ScummVM {
+
 String::String(const char *str)
 {
 	_refCount = new int(1);
@@ -123,7 +125,7 @@
 		
 		_len = len;
 		memcpy(_str, str, _len + 1);
-	} if (_len > 0) {
+	} else if (_len > 0) {
 		decRefCount();
 		
 		_refCount = new int(1);
@@ -223,3 +225,4 @@
 	_str = newStr;
 }
 
+};	// End of namespace ScummVM

Index: util.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/util.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- util.h	18 Jul 2002 18:17:58 -0000	1.2
+++ util.h	18 Jul 2002 20:26:35 -0000	1.3
@@ -23,12 +23,13 @@
 
 #include "scummsys.h"
 
-
 int RGBMatch(byte *palette, int r, int g, int b);
 int Blend(int src, int dst, byte *palette);
 void ClearBlendCache(byte *palette, int weight);
 
 
+namespace ScummVM {
+
 template <class T>
 class List {
 protected:
@@ -117,6 +118,7 @@
 	}
 };
 
+
 class String {
 protected:
 	int		*_refCount;
@@ -148,13 +150,17 @@
 	void decRefCount();
 };
 
+
 class StringList : public List<String> {
 public:
 	void push_back(const char* str)
 	{
 		ensureCapacity(_size + 1);
-		_data[_size++] = str;
+		_data[_size] = str;
+		_size++;
 	}
 };
+
+};	// End of namespace ScummVM
 
 #endif

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.184
retrieving revision 1.185
diff -u -d -r1.184 -r1.185
--- scummvm.cpp	18 Jul 2002 15:45:10 -0000	1.184
+++ scummvm.cpp	18 Jul 2002 20:26:35 -0000	1.185
@@ -1264,8 +1264,18 @@
 
 			// if newgui is running, copy event to EventList, and let the GUI handle it itself
 			// we might consider this approach for ScummLoop as well, and clean up the current mess
-			if (_newgui->isActive())
+			if (_newgui->isActive()) {
+				if (event.event_code == OSystem::EVENT_MOUSEMOVE) {
+					mouse.x = event.mouse.x;
+					mouse.y = event.mouse.y;
+					_system->set_mouse_pos(event.mouse.x, event.mouse.y);
+#if !defined(__MORPHOS__)
+					_system->update_screen();
+#endif
+				}
 				_newgui->handleEvent(event);
+				continue;
+			}
 
 			switch(event.event_code) {
 			case OSystem::EVENT_KEYDOWN:
@@ -1285,7 +1295,7 @@
 						g_debugger.attach(this);
 					else if (event.kbd.keycode=='s')
 						resourceStats();
-				} else if (!_newgui->isActive())
+				} else
 					_keyPressed = event.kbd.ascii;	// Normal key press, pass on to the game.
 				break;
 

Index: newgui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- newgui.h	18 Jul 2002 14:47:25 -0000	1.18
+++ newgui.h	18 Jul 2002 20:26:35 -0000	1.19
@@ -45,7 +45,7 @@
 	void	pop()				{ if (_size > 0) _stack[--_size] = 0; }
 };
 
-typedef List<OSystem::Event> EventList;
+typedef ScummVM::List<OSystem::Event> EventList;
 
 // This class hopefully will replace the old Gui class completly one day 
 class NewGui {
@@ -69,6 +69,8 @@
 	NewGui(Scumm *s);
 
 	void handleEvent(const OSystem::Event &event) { _eventList.push_back(event); }
+	
+	Scumm *getScumm() { return _s; }
 
 protected:
 	Scumm		*_s;





More information about the Scummvm-git-logs mailing list