[Scummvm-cvs-logs] CVS: scummvm gfx.cpp,1.15,1.16 resource.cpp,1.14,1.15 saveload.cpp,1.10,1.11 script.cpp,1.9,1.10 script_v1.cpp,1.8,1.9 scumm.h,1.21,1.22 scummvm.cpp,1.21,1.22 scummvm.dsp,1.11,1.12 sdl.cpp,1.16,1.17 string.cpp,1.8,1.9 windows.cpp,1.13,1.14

Ludvig Strigeus strigeus at users.sourceforge.net
Fri Nov 9 10:55:02 CET 2001


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

Modified Files:
	gfx.cpp resource.cpp saveload.cpp script.cpp script_v1.cpp 
	scumm.h scummvm.cpp scummvm.dsp sdl.cpp string.cpp windows.cpp 
Log Message:
save/load dialog by pressing F5,
multiple sounds at the same time,
some other fixes

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gfx.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** gfx.cpp	2001/11/08 19:59:05	1.15
--- gfx.cpp	2001/11/09 18:54:14	1.16
***************
*** 25,29 ****
  void Scumm::getGraphicsPerformance() {
  	int i;
- 	_scummTimer = 0;
  
  	for (i=10; i!=0; i--) {
--- 25,28 ----
***************
*** 31,43 ****
  	}
  
! 	_vars[VAR_PERFORMANCE_1] = _scummTimer;
! 	_scummTimer = 0;
  
  	for (i=10; i!=0; i--) {
  		setDirtyRange(0, 0, 200);
! 		unkVirtScreen2();
  	}
  
! 	_vars[VAR_PERFORMANCE_2] = _scummTimer;
  	
  	initScreens(0, 16, 320, 144);
--- 30,41 ----
  	}
  
! 	_vars[VAR_PERFORMANCE_1] = 0;//_scummTimer;
  
  	for (i=10; i!=0; i--) {
  		setDirtyRange(0, 0, 200);
! 		drawDirtyScreenParts();
  	}
  
! 	_vars[VAR_PERFORMANCE_2] = 0;//_scummTimer;
  	
  	initScreens(0, 16, 320, 144);
***************
*** 104,108 ****
  }
  
! void Scumm::unkVirtScreen2() {
  	int i;
  	VirtScreen *vs;
--- 102,106 ----
  }
  
! void Scumm::drawDirtyScreenParts() {
  	int i;
  	VirtScreen *vs;
***************
*** 341,359 ****
  	dest = _currentPalette;
  
! 	if (_videoMode==0x13) {
! 		for (i=0; i<numcolor; i++) {
! 			r = *ptr++;
! 			g = *ptr++;
! 			b = *ptr++;
! 			if (i<=15 || r<252 || g<252 || b<252) {
! 				*dest++ = r>>2;
! 				*dest++ = g>>2;
! 				*dest++ = b>>2;
! 			} else {
! 				dest += 3;
! 			}
  		}
  	}
! 	
  	if (_videoMode==0xE) {
  		epal = getResourceAddress(rtRoom, _roomResource) + _EPAL_offs + 8;
--- 339,356 ----
  	dest = _currentPalette;
  
! 	for (i=0; i<numcolor; i++) {
! 		r = *ptr++;
! 		g = *ptr++;
! 		b = *ptr++;
! 		if (i<=15 || r<252 || g<252 || b<252) {
! 			*dest++ = r>>2;
! 			*dest++ = g>>2;
! 			*dest++ = b>>2;
! 		} else {
! 			dest += 3;
  		}
  	}
! 
! #if 0
  	if (_videoMode==0xE) {
  		epal = getResourceAddress(rtRoom, _roomResource) + _EPAL_offs + 8;
***************
*** 363,367 ****
  		}
  	}
! 	
  	setDirtyColors(0, numcolor-1);
  }
--- 360,365 ----
  		}
  	}
! #endif
! 
  	setDirtyColors(0, numcolor-1);
  }
***************
*** 425,431 ****
  	byte tmp[3];
  
- 	if(_videoMode != 0x13)
- 		return;
- 
  	valueToAdd = _vars[VAR_TIMER];
  	if (valueToAdd < _vars[VAR_TIMER_NEXT])
--- 423,426 ----
***************
*** 1274,1279 ****
  	}
  
! 	rp = right >> 3;
! 	lp = left >> 3;
  
  	if (lp>=40 || rp<0)
--- 1269,1278 ----
  	}
  
! 	setVirtscreenDirty(vs, left, top, right, bottom);
! }
! 
! void Scumm::setVirtscreenDirty(VirtScreen *vs, int left, int top, int right, int bottom) {
! 	int lp = left >> 3;
! 	int rp = right >> 3;
  
  	if (lp>=40 || rp<0)
***************
*** 1288,1292 ****
  			vs->bdirty[lp] = bottom;
  		lp++;
! 	}
  }
  
--- 1287,1291 ----
  			vs->bdirty[lp] = bottom;
  		lp++;
! 	}	
  }
  
***************
*** 1668,1681 ****
  
  void Scumm::setPalColor(int index, int r, int g, int b) {
! 	if(_videoMode==0x13) {
! 		_currentPalette[index*3+0] = r>>2;
! 		_currentPalette[index*3+1] = g>>2;
! 		_currentPalette[index*3+2] = b>>2;
! 		setDirtyColors(index,index);
! 	}
! 	if (_videoMode==0xE) {
! 		/* TODO: implement this */
! 		warning("stub setPalColor(%d,%d,%d,%d)",index,r,g,b);
! 	}
  }
  
--- 1667,1674 ----
  
  void Scumm::setPalColor(int index, int r, int g, int b) {
! 	_currentPalette[index*3+0] = r>>2;
! 	_currentPalette[index*3+1] = g>>2;
! 	_currentPalette[index*3+2] = b>>2;
! 	setDirtyColors(index,index);
  }
  
***************
*** 1696,1711 ****
  		_cursorHeight,
  		_grabbedCursor,
! 		gdi._unk4>0
  	);
- 
- /*
- 	::drawMouse(this,
- 		mouse.x - gdi._hotspot_x,
- 		mouse.y - gdi._hotspot_y,
- 		gdi._mouseColors[((++gdi._mouseColorIndex)>>2)&3],
- 		gdi._mouseMask + ((gdi._drawMouseX&7)<<6),
- 		gdi._unk4>0
- 		);
- 	*/
  }
  
--- 1689,1694 ----
  		_cursorHeight,
  		_grabbedCursor,
! 		gdi._cursorActive>0
  	);
  }
  
***************
*** 1793,1835 ****
  	byte color;
  
! 	if (_videoMode==0xE) {
! 		warning("stub darkenPalette(%d,%d,%d,%d,%d)",a,b,c,d,e);
! 	}
! 
! 	if (_videoMode==0x13) {
! 		cptr = getPalettePtr();
! 		cptr += 8 + a*3;
! 		cur = _currentPalette + a*3;
! 		if (a <= b) {
! 			num = b - a + 1;
  
! 			do {
! 				if (c != 0xFF) {
! 					color = *cptr++ * (c>>2) / 0xFF;
! 				} else {
! 					color = *cptr++ >> 2;
! 				}
! 				if(color>63) color = 63;
! 				*cur++=color;
  
! 				if (d != 0xFF) {
! 					color = *cptr++ * (d>>2) / 0xFF;
! 				} else {
! 					color = *cptr++ >> 2;
! 				}
! 				if(color>63) color = 63;
! 				*cur++=color;
  
! 				if (e != 0xFF) {
! 					color = *cptr++ * (e>>2) / 0xFF;
! 				} else {
! 					color = *cptr++ >> 2;
! 				}
! 				if(color>63) color = 63;
! 				*cur++=color;
! 			} while (--num);
! 		}
! 		setDirtyColors(a,b);
  	}
  }
  
--- 1776,1812 ----
  	byte color;
  
! 	cptr = getPalettePtr();
! 	cptr += 8 + a*3;
! 	cur = _currentPalette + a*3;
! 	if (a <= b) {
! 		num = b - a + 1;
  
! 		do {
! 			if (c != 0xFF) {
! 				color = *cptr++ * (c>>2) / 0xFF;
! 			} else {
! 				color = *cptr++ >> 2;
! 			}
! 			if(color>63) color = 63;
! 			*cur++=color;
  
! 			if (d != 0xFF) {
! 				color = *cptr++ * (d>>2) / 0xFF;
! 			} else {
! 				color = *cptr++ >> 2;
! 			}
! 			if(color>63) color = 63;
! 			*cur++=color;
  
! 			if (e != 0xFF) {
! 				color = *cptr++ * (e>>2) / 0xFF;
! 			} else {
! 				color = *cptr++ >> 2;
! 			}
! 			if(color>63) color = 63;
! 			*cur++=color;
! 		} while (--num);
  	}
+ 	setDirtyColors(a,b);
  }
  
***************
*** 1882,1886 ****
  	_cursorWidth = width;
  	_cursorHeight = height;
! 	_cursorAnimate = false;
  
  	dst = _grabbedCursor;
--- 1859,1863 ----
  	_cursorWidth = width;
  	_cursorHeight = height;
! 	_cursorAnimate = 0;
  
  	dst = _grabbedCursor;
***************
*** 1924,1928 ****
  	_cursorWidth = width;
  	_cursorHeight = height;
! 	_cursorAnimate = false;
  
  	decompressBomp(_grabbedCursor, im+10, width, height);
--- 1901,1905 ----
  	_cursorWidth = width;
  	_cursorHeight = height;
! 	_cursorAnimate = 0;
  
  	decompressBomp(_grabbedCursor, im+10, width, height);

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** resource.cpp	2001/11/08 20:00:33	1.14
--- resource.cpp	2001/11/09 18:54:14	1.15
***************
*** 482,486 ****
  
  			if (!fileReadFailed(_fileHandle)) {
- 				_scummTimer = 0;
  				return 1;
  			}
--- 482,485 ----

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saveload.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** saveload.cpp	2001/11/07 18:10:51	1.10
--- saveload.cpp	2001/11/09 18:54:14	1.11
***************
*** 27,42 ****
  	uint32 size;
  	uint32 ver;
  };
  
! #define CURRENT_VER 3
  
! bool Scumm::saveState(const char *filename) {
! 	FILE *out = fopen(filename,"wb");
  	SaveGameHeader hdr;
  	Serializer ser;
  	
  	if (out==NULL)
  		return false;
  
  	hdr.type = MKID('SCVM');
  	hdr.size = 0;
--- 27,49 ----
  	uint32 size;
  	uint32 ver;
+ 	char name[32];
  };
  
! #define CURRENT_VER 4
  
! bool Scumm::saveState(int slot, bool compat) {
! 	char filename[256];
! 	FILE *out;
  	SaveGameHeader hdr;
  	Serializer ser;
+ 
+ 	makeSavegameName(filename, slot, compat);
  	
+ 	out = fopen(filename,"wb");
  	if (out==NULL)
  		return false;
  
+ 	memcpy(hdr.name, _saveLoadName, sizeof(hdr.name));
+ 		
  	hdr.type = MKID('SCVM');
  	hdr.size = 0;
***************
*** 54,59 ****
  }
  
! bool Scumm::loadState(const char *filename) {
! 	FILE *out = fopen(filename,"rb");
  	int i,j;
  	SaveGameHeader hdr;
--- 61,67 ----
  }
  
! bool Scumm::loadState(int slot, bool compat) {
! 	char filename[256];
!  	FILE *out;
  	int i,j;
  	SaveGameHeader hdr;
***************
*** 61,64 ****
--- 69,75 ----
  	int sb,sh;
  
+ 	makeSavegameName(filename, slot, compat);
+ 	out = fopen(filename,"rb");
+ 
  	if (out==NULL)
  		return false;
***************
*** 76,79 ****
--- 87,92 ----
  		return false;
  	}
+ 
+ 	memcpy(_saveLoadName, hdr.name, sizeof(hdr.name));
  	
  	CHECK_HEAP
***************
*** 108,112 ****
  	initScreens(0, sb, 320, sh);
  
! 	_completeScreenRedraw = 1;
  	setDirtyColors(0,255);
  
--- 121,125 ----
  	initScreens(0, sb, 320, sh);
  
! 	_completeScreenRedraw = true;
  	setDirtyColors(0,255);
  
***************
*** 125,128 ****
--- 138,176 ----
  }
  
+ void Scumm::makeSavegameName(char *out, int slot, bool compatible) {
+ 	sprintf(out, "%s.%c%.2d", _exe_name, compatible ? 'c': 's', slot);
+ }
+ 
+ bool Scumm::getSavegameName(int slot, char *desc) {
+ 	char filename[256];
+ 	FILE *out;
+ 	SaveGameHeader hdr;
+ 	bool result;
+ 	int len;
+ 
+ 	makeSavegameName(filename, slot, false);
+ 	out = fopen(filename,"rb");	
+ 	if (out==NULL) {
+ 		strcpy(desc,"");
+ 		return false;
+ 	}
+ 	len = fread(&hdr, sizeof(hdr), 1, out);
+ 	fclose(out);
+ 
+ 	if (len!=1 || hdr.type != MKID('SCVM')) {
+ 		strcpy(desc, "Invalid savegame");
+ 		return false;
+ 	}
+ 	
+ 	if (hdr.ver != CURRENT_VER) {
+ 		strcpy(desc, "Invalid version");
+ 		return false;
+ 	}
+ 	
+ 	memcpy(desc, hdr.name, sizeof(hdr.name));
+ 	desc[sizeof(hdr.name)-1] = 0;
+ 	return true;
+ }
+ 
  #define OFFS(type,item) ((int)(&((type*)0)->item))
  #define SIZE(type,item) sizeof(((type*)0)->item)
***************
*** 268,272 ****
  		MKLINE(Scumm,_screenStartStrip,sleInt16),
  		MKLINE(Scumm,_screenEndStrip,sleInt16),
- 		MKLINE(Scumm,_scummTimer,sleInt16),
  		MKLINE(Scumm,camera._mode,sleByte),
  		MKLINE(Scumm,camera._follows,sleByte),
--- 316,319 ----
***************
*** 296,300 ****
  		MKLINE(Scumm,_userPut,sleByte),
  		MKLINE(Scumm,_cursorState,sleByte),
! 		MKLINE(Scumm,gdi._unk4,sleByte),
  		MKLINE(Scumm,gdi._currentCursor,sleByte),
  
--- 343,347 ----
  		MKLINE(Scumm,_userPut,sleByte),
  		MKLINE(Scumm,_cursorState,sleByte),
! 		MKLINE(Scumm,gdi._cursorActive,sleByte),
  		MKLINE(Scumm,gdi._currentCursor,sleByte),
  

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** script.cpp	2001/11/07 18:10:51	1.9
--- script.cpp	2001/11/09 18:54:14	1.10
***************
*** 954,955 ****
--- 954,968 ----
  	return len+1;
  }
+ 
+ void Scumm::exitCutscene() {
+ 	uint32 offs = vm.cutScenePtr[vm.cutSceneStackPointer];
+ 	if (offs) {
+ 		ScriptSlot *ss = &vm.slot[vm.cutSceneScript[vm.cutSceneStackPointer]];
+ 		ss->offs = offs;
+ 		ss->status = 2;
+ 		ss->freezeCount = 0;
+ 		ss->cutsceneOverride--;
+ 		_vars[VAR_OVERRIDE] = 1;
+ 		vm.cutScenePtr[vm.cutSceneStackPointer] = 0;
+ 	}
+ }
\ No newline at end of file

Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v1.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** script_v1.cpp	2001/11/07 18:10:51	1.8
--- script_v1.cpp	2001/11/09 18:54:14	1.9
***************
*** 713,716 ****
--- 713,717 ----
  		error("o5_drawObject: default case");
  	}
+ 
  	index = getObjectIndex(obj);
  	if (index==-1)

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** scumm.h	2001/11/07 21:44:09	1.21
--- scumm.h	2001/11/09 18:54:14	1.22
***************
*** 512,516 ****
  	uint _readOffs;
  
! 	int8 _unk4;
  
  	int _numZBuffer;
--- 512,516 ----
  	uint _readOffs;
  
! 	int8 _cursorActive;
  
  	int _numZBuffer;
***************
*** 592,597 ****
  	byte _middleScummVersion;
  	byte _minorScummVersion;
- 
  	ScummDebugger *_debugger;
  	
  	int _lastLoadedRoom;
--- 592,597 ----
  	byte _middleScummVersion;
  	byte _minorScummVersion;
  	ScummDebugger *_debugger;
+ 	void *_gui; /* actually a pointer to a Gui */
  	
  	int _lastLoadedRoom;
***************
*** 676,680 ****
  	byte _haveMsg;
  	byte _newEffect;
! 	uint16 _fullRedraw;
  	uint16 _soundParam,_soundParam2,_soundParam3;
  	
--- 676,680 ----
  	byte _haveMsg;
  	byte _newEffect;
! 	bool _fullRedraw;
  	uint16 _soundParam,_soundParam2,_soundParam3;
  	
***************
*** 702,706 ****
  	int _cursorWidth, _cursorHeight;
  	byte _cursorAnimateIndex;
! 	bool _cursorAnimate;
  
  	byte _charsetColor;
--- 702,706 ----
  	int _cursorWidth, _cursorHeight;
  	byte _cursorAnimateIndex;
! 	byte _cursorAnimate;
  
  	byte _charsetColor;
***************
*** 720,729 ****
  	int16 _screenEndStrip;
  
- 	int16 _scummTimer;
- 
- 	byte _playBackFile;
  	byte _fastMode;
  	
! 	uint16 _completeScreenRedraw;
  
  	int8 _userPut;
--- 720,726 ----
  	int16 _screenEndStrip;
  
  	byte _fastMode;
  	
! 	bool _completeScreenRedraw;
  
  	int8 _userPut;
***************
*** 756,760 ****
  	uint16 _currentDrive;
  	uint16 _soundCardType;
- 	uint16 _videoMode;
  	byte _mousePresent;
  
--- 753,756 ----
***************
*** 883,887 ****
  
  	byte _grabbedCursor[1024];
! 	
  	OpcodeProc getOpcode(int i) { return _opcodes[i]; }
  
--- 879,885 ----
  
  	byte _grabbedCursor[1024];
! 
! 	char _saveLoadName[32];
! 
  	OpcodeProc getOpcode(int i) { return _opcodes[i]; }
  
***************
*** 950,959 ****
  	void initVirtScreen(int slot, int top, int height, bool twobufs, bool fourextra);
  	void setDirtyRange(int slot, int a, int height);
! 	void unkVirtScreen2();
  	void updateDirtyScreen(int slot);
  	void unkVirtScreen4(int a);
  	
- 	
- 
  	void restoreMouse();
  	void initActor(Actor *a, int mode);
--- 948,955 ----
  	void initVirtScreen(int slot, int top, int height, bool twobufs, bool fourextra);
  	void setDirtyRange(int slot, int a, int height);
! 	void drawDirtyScreenParts();
  	void updateDirtyScreen(int slot);
  	void unkVirtScreen4(int a);
  	
  	void restoreMouse();
  	void initActor(Actor *a, int mode);
***************
*** 1463,1468 ****
  	void dumpResource(char *tag, int index, byte *ptr);
  
! 	bool saveState(const char *filename);
! 	bool loadState(const char *filename);
  	void saveOrLoad(Serializer *s);
  
--- 1459,1464 ----
  	void dumpResource(char *tag, int index, byte *ptr);
  
! 	bool saveState(int slot, bool compat);
! 	bool loadState(int slot, bool compat);
  	void saveOrLoad(Serializer *s);
  
***************
*** 1573,1577 ****
  	void decompressBomp(byte *dst, byte *src, int w, int h);
  
! 	void setupCursor() { _cursorAnimate = true; }
  
  	void decompressDefaultCursor(int index);
--- 1569,1573 ----
  	void decompressBomp(byte *dst, byte *src, int w, int h);
  
! 	void setupCursor() { _cursorAnimate = 1; }
  
  	void decompressDefaultCursor(int index);
***************
*** 1580,1583 ****
--- 1576,1587 ----
  
  	void initializeLocals(int slot, int16 *vars);
+ 
+ 	static void setVirtscreenDirty(VirtScreen *vs, int left, int top, int right, int bottom);
+ 	int scummLoop(int delta);
+ 
+ 	bool getSavegameName(int slot, char *desc);
+ 	void makeSavegameName(char *out, int slot, bool compatible);
+ 
+ 	void exitCutscene();
  };
  
***************
*** 1625,1629 ****
  	bool _saveOrLoad;
  
- 	
  	void saveLoadBytes(void *b, int len);
  	void saveLoadArrayOf(void *b, int len, int datasize, byte filetype);
--- 1629,1632 ----

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** scummvm.cpp	2001/11/08 20:00:32	1.21
--- scummvm.cpp	2001/11/09 18:54:15	1.22
***************
*** 22,25 ****
--- 22,26 ----
  #include "stdafx.h"
  #include "scumm.h"
+ #include "gui.h"
  
  void Scumm::initThingsV5() {
***************
*** 138,142 ****
  	
  	_newEffect = 129;
! 	_fullRedraw = 1;
  
  	clearDrawObjectQueue();
--- 139,143 ----
  	
  	_newEffect = 129;
! 	_fullRedraw = true;
  
  	clearDrawObjectQueue();
***************
*** 168,172 ****
  	_vars[VAR_FIXEDDISK] = checkFixedDisk();
  	_vars[VAR_SOUNDCARD] = _soundCardType;
! 	_vars[VAR_VIDEOMODE] = _videoMode;
  	_vars[VAR_HEAPSPACE] = 600;
  	_vars[VAR_MOUSEPRESENT] = _mousePresent;
--- 169,173 ----
  	_vars[VAR_FIXEDDISK] = checkFixedDisk();
  	_vars[VAR_SOUNDCARD] = _soundCardType;
! 	_vars[VAR_VIDEOMODE] = 0x13;
  	_vars[VAR_HEAPSPACE] = 600;
  	_vars[VAR_MOUSEPRESENT] = _mousePresent;
***************
*** 196,201 ****
  	_debugMode = 1;
  
! 	_maxHeapThreshold = 350000;
! 	_minHeapThreshold = 300000;
  	
  	parseCommandLine(argc, argv);
--- 197,202 ----
  	_debugMode = 1;
  
! 	_maxHeapThreshold = 500000;
! 	_minHeapThreshold = 450000;
  	
  	parseCommandLine(argc, argv);
***************
*** 232,329 ****
  
  	runScript(1,0,0,&_bootParam);
! 	_scummTimer = 0;
! 
! 	do {
! 		if (_playBackFile) {
! 			while ((_scummTimer>>2) < _vars[VAR_TIMER_NEXT]) {}
! 			_scummTimer = _vars[VAR_TIMER_NEXT] << 2;
! 		}
! 		
! 		CHECK_HEAP
! 		updateScreen(this);
! 
! 		if (_debugger)
! 			_debugger->on_frame();
! 
! 		if (!(++_expire_counter)) {
! 			increaseResourceCounter();
! 		}
! 
! 		_vars[VAR_TIMER] = _scummTimer >> 2;
! 		do {
! 			waitForTimer(this);
! 			tmr = _scummTimer >> 2;
! 			if (_fastMode)
! 				tmr += 15;
! 		} while (tmr < _vars[VAR_TIMER_NEXT]);
! 		_scummTimer = 0;
! 
! 		_vars[VAR_TMR_1] += tmr;
! 		_vars[VAR_TMR_2] += tmr;
! 		_vars[VAR_TMR_3] += tmr;
! 		_vars[VAR_TMR_4] += tmr;
  
! 		if (tmr > 15)
! 			tmr = 15;
  
! 		decreaseScriptDelay(tmr);
  
! 		_talkDelay -= tmr;
! 		if (_talkDelay<0) _talkDelay=0;
  
! 		processKbd();
  
! 		/* XXX: memory low check skipped */
! 		_vars[VAR_CAMERA_CUR_POS] = camera._curPos;
! 		_vars[VAR_HAVE_MSG] = _haveMsg;
! 		_vars[VAR_VIRT_MOUSE_X] = _virtual_mouse_x;
! 		_vars[VAR_VIRT_MOUSE_Y] = _virtual_mouse_y;
! 		_vars[VAR_MOUSE_X] = mouse.x;
! 		_vars[VAR_MOUSE_Y] = mouse.y;
! 		_vars[VAR_DEBUGMODE] = _debugMode;
  
! 		if (_gameId==GID_MONKEY)
! 			_vars[VAR_MI1_TIMER]+=40;
  
! 		if (_saveLoadFlag) {
! 			char buf[256];
  
! 			sprintf(buf, "%s.%c%.2d", _exe_name, _saveLoadCompatible ? 'c': 's', _saveLoadSlot);
! 			if (_saveLoadFlag==1) {
! 				saveState(buf);
! 				if (_saveLoadCompatible)
! 					_vars[VAR_GAME_LOADED] = 201;
! 			} else {
! 				loadState(buf);
! 				if (_saveLoadCompatible) {
! 					_vars[VAR_GAME_LOADED] = 203;
! 				}
  			}
- 			_saveLoadFlag = 0;
- 		}
- 
- 		if (_completeScreenRedraw) {
- 			_completeScreenRedraw = 0;
- 			gdi.clearUpperMask();
- 			charset._hasMask = false;
- 			redrawVerbs();
- 			_fullRedraw = 1;
- 			for (i=0,a=getFirstActor(); i<13; i++,a++)
- 				a->needRedraw = 1;
  		}
  
! 		runAllScripts();
! 		checkExecVerbs();
! 		checkAndRunVar33();
  
! 		if (_currentRoom==0) {
! 			gdi._unk4 = 0;
! 			CHARSET_1();
! 			unkVirtScreen2();
! 			processSoundQues();
! 			camera._lastPos = camera._curPos;
! 			continue;
! 		}
  
  		walkActors();
  		moveCamera();
--- 233,306 ----
  
  	runScript(1,0,0,&_bootParam);
! //	_scummTimer = 0;
! }
  
! int Scumm::scummLoop(int delta) {
! 	if (_debugger)
! 		_debugger->on_frame();
! 	
! 	_vars[VAR_TMR_1] += delta;
! 	_vars[VAR_TMR_2] += delta;
! 	_vars[VAR_TMR_3] += delta;
! 	_vars[VAR_TMR_4] += delta;
  
! 	if (delta > 15)
! 		delta = 15;
  
! 	decreaseScriptDelay(delta);
  
! 	_talkDelay -= delta;
! 	if (_talkDelay<0) _talkDelay=0;
  
! 	processKbd();
  
! 	_vars[VAR_CAMERA_CUR_POS] = camera._curPos;
! 	_vars[VAR_HAVE_MSG] = _haveMsg;
! 	_vars[VAR_VIRT_MOUSE_X] = _virtual_mouse_x;
! 	_vars[VAR_VIRT_MOUSE_Y] = _virtual_mouse_y;
! 	_vars[VAR_MOUSE_X] = mouse.x;
! 	_vars[VAR_MOUSE_Y] = mouse.y;
! 	_vars[VAR_DEBUGMODE] = _debugMode;
  
! 	if (_gameId==GID_MONKEY)
! 		_vars[VAR_MI1_TIMER]+=40;
  
! 	if (_saveLoadFlag) {
! 		if (_saveLoadFlag==1) {
! 			saveState(_saveLoadSlot, _saveLoadCompatible);
! 			if (_saveLoadCompatible)
! 				_vars[VAR_GAME_LOADED] = 201;
! 		} else {
! 			loadState(_saveLoadSlot, _saveLoadCompatible);
! 			if (_saveLoadCompatible) {
! 				_vars[VAR_GAME_LOADED] = 203;
  			}
  		}
+ 		_saveLoadFlag = 0;
+ 	}
  
! 	if (_completeScreenRedraw) {
! 		int i;
! 		Actor *a;
! 		_completeScreenRedraw = false;
! 		gdi.clearUpperMask();
! 		charset._hasMask = false;
! 		redrawVerbs();
! 		_fullRedraw = true;
! 		for (i=0,a=getFirstActor(); i<13; i++,a++)
! 			a->needRedraw = 1;
! 	}
  
! 	runAllScripts();
! 	checkExecVerbs();
! 	checkAndRunVar33();
  
+ 	if (_currentRoom==0) {
+ 		gdi._cursorActive = 0;
+ 		CHARSET_1();
+ 		drawDirtyScreenParts();
+ 		processSoundQues();
+ 		camera._lastPos = camera._curPos;
+ 	} else {
  		walkActors();
  		moveCamera();
***************
*** 345,349 ****
  		cyclePalette();
  		palManipulate();
! 		
  		if (_doEffect) {
  			_doEffect = false;
--- 322,326 ----
  		cyclePalette();
  		palManipulate();
! 
  		if (_doEffect) {
  			_doEffect = false;
***************
*** 351,362 ****
  			clearClickedStatus();
  		}
! 		
  		if (_cursorState > 0) {
  			verbMouseOver(checkMouseOver(mouse.x, mouse.y));
  		}
  
! 		gdi._unk4 = _cursorState > 0;
  
! 		unkVirtScreen2();
  
  		if (_majorScummVersion==5)
--- 328,339 ----
  			clearClickedStatus();
  		}
! 
  		if (_cursorState > 0) {
  			verbMouseOver(checkMouseOver(mouse.x, mouse.y));
  		}
  
! 		gdi._cursorActive = _cursorState > 0;
  
! 		drawDirtyScreenParts();
  
  		if (_majorScummVersion==5)
***************
*** 365,370 ****
--- 342,366 ----
  		processSoundQues();
  		camera._lastPos = camera._curPos;
+ 	}
+ 
+ 	if (!(++_expire_counter)) {
+ 		increaseResourceCounter();
+ 	}
+ 
+ 	_vars[VAR_TIMER] = 0;
+ 	return _vars[VAR_TIMER_NEXT];
+ 
+ }
+ 
+ #if 0
+ void Scumm::scummMain(int argc, char **argv) {
+ 
+ 	do {
+ 		updateScreen(this);
+ 
+ 
  	} while (1);
  }
+ #endif
  
  void Scumm::parseCommandLine(int argc, char **argv) {
***************
*** 790,806 ****
  
  	if (_lastKeyHit==_vars[VAR_CUTSCENEEXIT_KEY]) {
! 		uint32 offs = vm.cutScenePtr[vm.cutSceneStackPointer];
! 		if (offs) {
! 			ScriptSlot *ss = &vm.slot[vm.cutSceneScript[vm.cutSceneStackPointer]];
! 			ss->offs = offs;
! 			ss->status = 2;
! 			ss->freezeCount = 0;
! 			ss->cutsceneOverride--;
! 			_vars[VAR_OVERRIDE] = 1;
! 			vm.cutScenePtr[vm.cutSceneStackPointer] = 0;
! 		}
! 	}
! 
! 	if (_lastKeyHit==_vars[VAR_TALKSTOP_KEY]) {
  		_talkDelay = 0;
  		return;
--- 786,793 ----
  
  	if (_lastKeyHit==_vars[VAR_CUTSCENEEXIT_KEY]) {
! 		exitCutscene();
! 	} else if (_lastKeyHit==_vars[VAR_SAVELOADDIALOG_KEY]) {
! 		((Gui*)_gui)->saveLoadDialog();
! 	} else if (_lastKeyHit==_vars[VAR_TALKSTOP_KEY]) {
  		_talkDelay = 0;
  		return;

Index: scummvm.dsp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.dsp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** scummvm.dsp	2001/11/06 20:00:47	1.11
--- scummvm.dsp	2001/11/09 18:54:15	1.12
***************
*** 67,71 ****
  # PROP Target_Dir ""
  # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
! # ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "DUMP_SCRIPTS" /Yu"stdafx.h" /FD /GZ /c
  # SUBTRACT CPP /Fr
  # ADD BASE RSC /l 0x41d /d "_DEBUG"
--- 67,71 ----
  # PROP Target_Dir ""
  # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
! # ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
  # SUBTRACT CPP /Fr
  # ADD BASE RSC /l 0x41d /d "_DEBUG"
***************
*** 154,157 ****
--- 154,161 ----
  # Begin Source File
  
+ SOURCE=.\gui.cpp
+ # End Source File
+ # Begin Source File
+ 
  SOURCE=.\object.cpp
  
***************
*** 318,321 ****
--- 322,329 ----
  
  # PROP Default_Filter "h;hpp;hxx;hm;inl"
+ # Begin Source File
+ 
+ SOURCE=.\gui.h
+ # End Source File
  # Begin Source File
  

Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sdl.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** sdl.cpp	2001/11/06 20:00:47	1.16
--- sdl.cpp	2001/11/09 18:54:15	1.17
***************
*** 24,27 ****
--- 24,28 ----
  #include "stdafx.h"
  #include "scumm.h"
+ #include "gui.h"
  
  #if defined(USE_IMUSE)
***************
*** 33,36 ****
--- 34,38 ----
  Scumm scumm;
  ScummDebugger debugger;
+ Gui gui;
  
  #if defined(USE_IMUSE)
***************
*** 61,64 ****
--- 63,76 ----
  }
  
+ int mapKey(int key, byte mod) {
+ 	if (key>=SDLK_F1 && key<=SDLK_F9) {
+ 		return key - SDLK_F1 + 315;
+ 	} else if (key>='a' && key<='z' && mod&KMOD_SHIFT) {
+ 		key&=~0x20;
+ 	} else if (key>=SDLK_NUMLOCK && key<=SDLK_EURO)
+ 		return 0;
+ 	return key;
+ }
+ 
  void waitForTimer(Scumm *s) {
  	SDL_Event event;
***************
*** 69,78 ****
  			switch(event.type) {
  			case SDL_KEYDOWN:
! 				s->_keyPressed = event.key.keysym.sym;
  				if (event.key.keysym.sym >= '0' && event.key.keysym.sym<='9') {
  					s->_saveLoadSlot = event.key.keysym.sym - '0';
! 					if (event.key.keysym.mod&KMOD_SHIFT)
  						s->_saveLoadFlag = 1;
! 					else if (event.key.keysym.mod&KMOD_CTRL)
  						s->_saveLoadFlag = 2;
  					s->_saveLoadCompatible = false;
--- 81,91 ----
  			switch(event.type) {
  			case SDL_KEYDOWN:
! 				s->_keyPressed = mapKey(event.key.keysym.sym, event.key.keysym.mod);
  				if (event.key.keysym.sym >= '0' && event.key.keysym.sym<='9') {
  					s->_saveLoadSlot = event.key.keysym.sym - '0';
! 					if (event.key.keysym.mod&KMOD_SHIFT) {
! 						sprintf(s->_saveLoadName, "Quicksave %d", s->_saveLoadSlot);
  						s->_saveLoadFlag = 1;
! 					} else if (event.key.keysym.mod&KMOD_CTRL)
  						s->_saveLoadFlag = 2;
  					s->_saveLoadCompatible = false;
***************
*** 80,84 ****
  				if (event.key.keysym.sym=='z' && event.key.keysym.mod&KMOD_CTRL) {
  					exit(1);
! 				}
  				if (event.key.keysym.sym=='f' && event.key.keysym.mod&KMOD_CTRL) {
  					s->_fastMode ^= 1;
--- 93,97 ----
  				if (event.key.keysym.sym=='z' && event.key.keysym.mod&KMOD_CTRL) {
  					exit(1);
! 				} 
  				if (event.key.keysym.sym=='f' && event.key.keysym.mod&KMOD_CTRL) {
  					s->_fastMode ^= 1;
***************
*** 136,140 ****
  	} while (!dontPause);
  
- 	s->_scummTimer+=3;
  }
  
--- 149,152 ----
***************
*** 226,230 ****
  		return;
  
- 
  	if (hide_mouse) {
  		hide_mouse = false;
--- 238,241 ----
***************
*** 467,501 ****
  #define BITS_PER_SAMPLE 16
  
! static void *_sfx_sound;
! static uint32 _sfx_pos;
! static uint32 _sfx_size;
  
! static uint32 _sfx_fp_speed;
! static uint32 _sfx_fp_pos;
  
  bool isSfxFinished() {
! 	return _sfx_size == 0;
  }
  
  void playSfxSound(void *sound, uint32 size, uint rate) {
! 	if (_sfx_sound) {
! 		free(_sfx_sound);
! 	}
! 	_sfx_sound = sound;
! 	_sfx_pos = 0;
! 	_sfx_fp_speed = (1<<16) * rate / 22050;
! 	_sfx_fp_pos = 0;
! //	debug(1, "size=%d, rate=%d", size, rate);
! 	
  	while (size&0xFFFF0000) size>>=1, rate>>=1;
! 	_sfx_size = size * 22050 / rate;
  }
  
! void mix_sound(int16 *data, uint32 len) {
  	int8 *s;
  	int i;
  	uint32 fp_pos, fp_speed;
  
! 	if (!_sfx_size)
  		return;
  	if (len > _sfx_size)
--- 478,533 ----
  #define BITS_PER_SAMPLE 16
  
! struct MixerChannel {
! 	void *_sfx_sound;
! 	uint32 _sfx_pos;
! 	uint32 _sfx_size;
! 	uint32 _sfx_fp_speed;
! 	uint32 _sfx_fp_pos;
  
! 	void mix(int16 *data, uint32 len);
! 	void clear();
! };
! 
! #define NUM_MIXER 4
! 
! static MixerChannel mixer_channel[NUM_MIXER];
! 
! MixerChannel *find_channel() {
! 	int i;
! 	MixerChannel *mc = mixer_channel;
! 	for(i=0; i<NUM_MIXER; i++,mc++) {
! 		if (!mc->_sfx_sound)
! 			return mc;
! 	}
! 	return mc;
! }
! 
  
  bool isSfxFinished() {
! 	int i;
! 	for(i=0; i<NUM_MIXER; i++)
! 		if (mixer_channel[i]._sfx_sound)
! 			return false;
! 	return true;
  }
  
  void playSfxSound(void *sound, uint32 size, uint rate) {
! 	MixerChannel *mc = find_channel();
! 
! 	mc->_sfx_sound = sound;
! 	mc->_sfx_pos = 0;
! 	mc->_sfx_fp_speed = (1<<16) * rate / 22050;
! 	mc->_sfx_fp_pos = 0;
! 
  	while (size&0xFFFF0000) size>>=1, rate>>=1;
! 	mc->_sfx_size = size * 22050 / rate;
  }
  
! void MixerChannel::mix(int16 *data, uint32 len) {
  	int8 *s;
  	int i;
  	uint32 fp_pos, fp_speed;
  
! 	if (!_sfx_sound)
  		return;
  	if (len > _sfx_size)
***************
*** 517,523 ****
--- 549,565 ----
  	_sfx_fp_speed = fp_speed;
  	_sfx_fp_pos = fp_pos;
+ 
+ 	if (!_sfx_size)
+ 		clear();
  }
  
+ void MixerChannel::clear() {
+ 	free(_sfx_sound);
+ 	_sfx_sound = NULL;
+ }
+ 
  void fill_sound(void *userdata, Uint8 *stream, int len) {
+ 	int i;
+ 
  #if defined(USE_IMUSE)
  	sound.generate_samples((int16*)stream, len>>1);
***************
*** 525,529 ****
  	memset(stream, 0, len);
  #endif
! 	mix_sound((int16*)stream, len>>1);
  }
  
--- 567,574 ----
  	memset(stream, 0, len);
  #endif
! 	
! 	for(i=NUM_MIXER-1; i>=0;i--) {
! 		mixer_channel[i].mix((int16*)stream, len>>1);
! 	}
  }
  
***************
*** 575,579 ****
  #undef main
  int main(int argc, char* argv[]) {
! 	scumm._videoMode = 0x13;
  
  #if defined(USE_IMUSE)
--- 620,624 ----
  #undef main
  int main(int argc, char* argv[]) {
! 	int delta,tmp;
  
  #if defined(USE_IMUSE)
***************
*** 582,586 ****
--- 627,656 ----
  #endif
  
+ 	scumm._gui = &gui;
  	scumm.scummMain(argc, argv);
+ 
+ 	gui.init(&scumm);
+ 
+ 	delta = 0;
+ 	do {
+ 		updateScreen(&scumm);
+ 
+ 		if (gui._active) {
+ 			gui.loop();
+ 			tmp = 5;
+ 		} else {
+ 			tmp = delta = scumm.scummLoop(delta);
+ 			tmp += tmp>>1;
+ 			
+ 			if (scumm._fastMode)
+ 				tmp=1;
+ 		}
+ 		
+ 		while(tmp>0) {
+ 			waitForTimer(&scumm);
+ 			tmp--;
+ 		}
+ 	} while(1);
+ 
  	return 0;
  }

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/string.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** string.cpp	2001/11/07 18:10:51	1.8
--- string.cpp	2001/11/09 18:54:15	1.9
***************
*** 760,764 ****
  }
  
- 
  void CharsetRenderer::drawBits() {
  	bool usemask;
--- 760,763 ----

Index: windows.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/windows.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** windows.cpp	2001/11/06 21:29:23	1.13
--- windows.cpp	2001/11/09 18:54:15	1.14
***************
*** 16,69 ****
   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
   *
!  * Change Log:
!  * $Log$
!  * Revision 1.13  2001/11/06 21:29:23  strigeus
!  * fix in save game loader,
!  * sizeof(an element) * number of elements instead of sizeof(a pointer) fixed it,
!  * buffer out of bounds read fixed in Scumm::isMaskActiveAt
!  *
!  * Revision 1.12  2001/11/06 20:00:47  strigeus
!  * full screen flag,
!  * better mouse cursors,
!  * removed change log from individual files
!  *
!  * Revision 1.11  2001/11/06 07:47:00  strigeus
!  * fixed integer overflow for large sounds
!  *
!  * Revision 1.10  2001/11/05 20:44:34  strigeus
!  * speech support
!  *
!  * Revision 1.9  2001/11/05 19:21:49  strigeus
!  * bug fixes,
!  * speech in dott
!  *
!  * Revision 1.8  2001/10/26 17:34:50  strigeus
!  * bug fixes, code cleanup
!  *
!  * Revision 1.7  2001/10/23 19:51:50  strigeus
!  * recompile not needed when switching games
!  * debugger skeleton implemented
!  *
!  * Revision 1.6  2001/10/16 20:31:27  strigeus
!  * misc fixes
!  *
!  * Revision 1.5  2001/10/16 10:01:48  strigeus
!  * preliminary DOTT support
!  *
!  * Revision 1.4  2001/10/12 07:24:06  strigeus
!  * fast mode support
!  *
!  * Revision 1.3  2001/10/10 10:02:33  strigeus
!  * alternative mouse cursor
!  * basic save&load
!  *
!  * Revision 1.2  2001/10/09 19:02:28  strigeus
!  * command line parameter support
!  *
!  * Revision 1.1.1.1  2001/10/09 14:30:13  strigeus
!  *
!  * initial revision
!  *
!  *
   */
  
--- 16,20 ----
   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
   *
!  * $Header$
   */
  
***************
*** 86,89 ****
--- 37,46 ----
  #endif
  
+ #include "gui.h"
+ 
+ #if !defined(ALLOW_GDI)
+ #error The GDI driver is not as complete as the SDL driver. You need to define ALLOW_GDI to use this driver.
+ #endif
+ 
  #define SRC_WIDTH 320
  #define SRC_HEIGHT 200
***************
*** 178,181 ****
--- 135,139 ----
  Scumm scumm;
  ScummDebugger debugger;
+ Gui gui;
  
  #if defined(USE_IMUSE)
***************
*** 188,192 ****
  void modifyslot(int sel, int what);
  
- 
  static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
  	WndMan *wm = (WndMan*)GetWindowLong(hWnd, GWL_USERDATA);	
--- 146,149 ----
***************
*** 208,234 ****
  			if (wParam>='0' && wParam<='9') {
  				wm->_scumm->_saveLoadSlot = wParam - '0';
! 				if (GetAsyncKeyState(VK_SHIFT)<0)
  					wm->_scumm->_saveLoadFlag = 1;
! 				else if (GetAsyncKeyState(VK_CONTROL)<0)
  					wm->_scumm->_saveLoadFlag = 2;
  				wm->_scumm->_saveLoadCompatible = false;
  			}
  
! 			if (wParam=='F') {
! 				wm->_scumm->_fastMode ^= 1;
! 			}
  
! 			if (wParam=='G') {
! 				veryFastMode ^= 1;
! 			}
  
! 			if (wParam=='D') {
! 				debugger.attach(wm->_scumm);
! 			}
! 			
! 			if (wParam=='S') {
! 				wm->_scumm->resourceStats();
  			}
- 
  			break;
  
--- 165,193 ----
  			if (wParam>='0' && wParam<='9') {
  				wm->_scumm->_saveLoadSlot = wParam - '0';
! 				if (GetAsyncKeyState(VK_SHIFT)<0) {
! 					sprintf(wm->_scumm->_saveLoadName, "Quicksave %d", wm->_scumm->_saveLoadSlot);
  					wm->_scumm->_saveLoadFlag = 1;
! 				} else if (GetAsyncKeyState(VK_CONTROL)<0)
  					wm->_scumm->_saveLoadFlag = 2;
  				wm->_scumm->_saveLoadCompatible = false;
  			}
  
! 			if (GetAsyncKeyState(VK_CONTROL)<0) {
! 				if (wParam=='F') {
! 					wm->_scumm->_fastMode ^= 1;
! 				}
  
! 				if (wParam=='G') {
! 					veryFastMode ^= 1;
! 				}
  
! 				if (wParam=='D') {
! 					debugger.attach(wm->_scumm);
! 				}
! 				
! 				if (wParam=='S') {
! 					wm->_scumm->resourceStats();
! 				}
  			}
  			break;
  
***************
*** 841,852 ****
  }
  
- 
- #if 0
- void outputdisplay(Scumm *s) {
- 	s->drawMouse();
- 	wm->writeToScreen();	
- }
- #endif
- 
  void blitToScreen(Scumm *s, byte *src,int x, int y, int w, int h) {
  	byte *dst;
--- 800,803 ----
***************
*** 931,937 ****
  void waitForTimer(Scumm *s) {
  	if (!veryFastMode) {
! 		Sleep(5);
  	} 
- 	s->_scummTimer+=2;
  	wm->handleMessage();
  }
--- 882,887 ----
  void waitForTimer(Scumm *s) {
  	if (!veryFastMode) {
! 		Sleep(10);
  	} 
  	wm->handleMessage();
  }
***************
*** 1008,1013 ****
  #undef main
  int main(int argc, char* argv[]) {
! 	scumm._videoMode = 0x13;
! 
  
  	wm->init();
--- 958,963 ----
  #undef main
  int main(int argc, char* argv[]) {
! 	int delta;
! 	int tmp;
  
  	wm->init();
***************
*** 1021,1025 ****
--- 971,998 ----
  #endif
  
+ 	scumm._gui = &gui;
  	scumm.scummMain(argc, argv);
+ 	gui.init(&scumm);
+ 
+ 	delta = 0;
+ 	do {
+ 		updateScreen(&scumm);
+ 
+ 		if (gui._active) {
+ 			gui.loop();
+ 			tmp = 5;
+ 		} else {
+ 			tmp = delta = scumm.scummLoop(delta);
+ 			tmp += tmp>>1;
+ 			
+ 			if (scumm._fastMode)
+ 				tmp=1;
+ 		}
+ 		
+ 		while(tmp>0) {
+ 			waitForTimer(&scumm);
+ 			tmp--;
+ 		}
+ 	} while(1);
  
  	return 0;





More information about the Scummvm-git-logs mailing list