[Scummvm-cvs-logs] CVS: scummvm scumm.h,1.23,1.24 sdl.cpp,1.18,1.19 gfx.cpp,1.17,1.18 windows.cpp,1.15,1.16 gui.h,1.2,1.3 gui.cpp,1.1,1.2

Ludvig Strigeus strigeus at users.sourceforge.net
Sat Nov 10 12:52:03 CET 2001


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

Modified Files:
	scumm.h sdl.cpp gfx.cpp windows.cpp gui.h gui.cpp 
Log Message:
new timing algorithm

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** scumm.h	2001/11/10 19:12:32	1.23
--- scumm.h	2001/11/10 20:51:55	1.24
***************
*** 1651,1656 ****
  
  
- 
- void waitForTimer(Scumm *s);
  void outputdisplay2(Scumm *s, int disp);
  extern const byte revBitMask[8];
--- 1651,1654 ----
***************
*** 1668,1672 ****
  void initGraphics(Scumm *s, bool fullScreen);
  void updateScreen(Scumm *s);
- 
  void drawMouse(Scumm *s, int x, int y, int color, byte *mask, bool visible);
  void drawMouse(Scumm *s, int x, int y, int w, int h, byte *buf, bool visible);
--- 1666,1669 ----
***************
*** 1675,1676 ****
--- 1672,1674 ----
  void playSfxSound(void *sound, uint32 size, uint rate);
  bool isSfxFinished();
+ void waitForTimer(Scumm *s, int delay);
\ No newline at end of file

Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sdl.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** sdl.cpp	2001/11/09 19:08:47	1.18
--- sdl.cpp	2001/11/10 20:51:55	1.19
***************
*** 42,45 ****
--- 42,47 ----
  static SDL_Surface *screen;
  
+ void updateScreen(Scumm *s);
+ 
  void updatePalette(Scumm *s) {
  	SDL_Color colors[256];
***************
*** 73,152 ****
  }
  
! void waitForTimer(Scumm *s) {
  	SDL_Event event;
- 	byte dontPause = true;
  	
! 	do {
! 		while (SDL_PollEvent(&event)) {
! 			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;
! 				}
! 				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;
! 				}
! 				if (event.key.keysym.sym=='g' && event.key.keysym.mod&KMOD_CTRL) {
! 					s->_fastMode ^= 2;
! 				}
  
! 				if (event.key.keysym.sym=='d' && event.key.keysym.mod&KMOD_CTRL) {
! 					debugger.attach(s);
! 				}
! 				if (event.key.keysym.sym=='s' && event.key.keysym.mod&KMOD_CTRL) {
! 					s->resourceStats();
! 				}
! 				
! 				break;
! 			case SDL_MOUSEMOTION: {
! 				int newx,newy;
  #if !defined(SCALEUP_2x2)
! 				newx = event.motion.x;
! 				newy = event.motion.y;
  #else
! 				newx = event.motion.x>>1;
! 				newy = event.motion.y>>1;
! #endif
! 				if (newx != s->mouse.x || newy != s->mouse.y) {
! 					s->mouse.x = newx;
! 					s->mouse.y = newy;
! 					s->drawMouse();
! 					updateScreen(s);
! 				}
! 				break;
! 				}
! 			case SDL_MOUSEBUTTONDOWN:
! 				if (event.button.button==SDL_BUTTON_LEFT)
! 					s->_leftBtnPressed |= 1;
! 				else if (event.button.button==SDL_BUTTON_RIGHT)
! 					s->_rightBtnPressed |= 1;
! 				break;
! #if 0
! 			case SDL_ACTIVEEVENT:
! 				if (event.active.state & SDL_APPINPUTFOCUS) {
! 					dontPause = event.active.gain;
! 				}
! 				break;
  #endif
! 			case SDL_QUIT:
! 				exit(1);
! 				break;
  			}
  		}
! 		
! 		if (!(s->_fastMode&2))
! 			SDL_Delay(dontPause ? 10 : 100);
! 	} while (!dontPause);
! 
  }
  
--- 75,143 ----
  }
  
! void waitForTimer(Scumm *s, int delay) {
  	SDL_Event event;
  	
! 	while (SDL_PollEvent(&event)) {
! 		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;
! 			}
! 			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;
! 			}
! 			if (event.key.keysym.sym=='g' && event.key.keysym.mod&KMOD_CTRL) {
! 				s->_fastMode ^= 2;
! 			}
  
! 			if (event.key.keysym.sym=='d' && event.key.keysym.mod&KMOD_CTRL) {
! 				debugger.attach(s);
! 			}
! 			if (event.key.keysym.sym=='s' && event.key.keysym.mod&KMOD_CTRL) {
! 				s->resourceStats();
! 			}
! 			
! 			break;
! 		case SDL_MOUSEMOTION: {
! 			int newx,newy;
  #if !defined(SCALEUP_2x2)
! 			newx = event.motion.x;
! 			newy = event.motion.y;
  #else
! 			newx = event.motion.x>>1;
! 			newy = event.motion.y>>1;
  #endif
! 			if (newx != s->mouse.x || newy != s->mouse.y) {
! 				s->mouse.x = newx;
! 				s->mouse.y = newy;
! 				s->drawMouse();
! 				updateScreen(s);
! 			}
! 			break;
  			}
+ 		case SDL_MOUSEBUTTONDOWN:
+ 			if (event.button.button==SDL_BUTTON_LEFT)
+ 				s->_leftBtnPressed |= 1;
+ 			else if (event.button.button==SDL_BUTTON_RIGHT)
+ 				s->_rightBtnPressed |= 1;
+ 			break;
+ 		case SDL_QUIT:
+ 			exit(1);
+ 			break;
  		}
! 	}
! 	
! 	if (!(s->_fastMode&2))
! 		SDL_Delay(delay*10);
  }
  
***************
*** 650,659 ****
  			if (scumm._fastMode)
  				tmp=1;
- 		}
- 		
- 		while(tmp>0) {
- 			waitForTimer(&scumm);
- 			tmp--;
  		}
  	} while(1);
  
--- 641,647 ----
  			if (scumm._fastMode)
  				tmp=1;
  		}
+ 
+ 		waitForTimer(&scumm, tmp);
  	} while(1);
  

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gfx.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** gfx.cpp	2001/11/10 19:12:32	1.17
--- gfx.cpp	2001/11/10 20:51:55	1.18
***************
*** 1395,1399 ****
  		
  		updateScreen(this);
! 		waitForTimer(this);
  	}
  }
--- 1395,1399 ----
  		
  		updateScreen(this);
! 		waitForTimer(this,3);
  	}
  }

Index: windows.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/windows.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** windows.cpp	2001/11/09 19:08:47	1.15
--- windows.cpp	2001/11/10 20:51:55	1.16
***************
*** 916,924 ****
  }
  
! void waitForTimer(Scumm *s) {
  	if (!veryFastMode) {
! 		Sleep(10);
  	} 
- 	wm->handleMessage();
  }
  
--- 916,924 ----
  }
  
! void waitForTimer(Scumm *s, int delay) {
! 	wm->handleMessage();
  	if (!veryFastMode) {
! 		Sleep(delay*10);
  	} 
  }
  
***************
*** 1031,1038 ****
  		}
  		
! 		while(tmp>0) {
! 			waitForTimer(&scumm);
! 			tmp--;
! 		}
  	} while(1);
  
--- 1031,1035 ----
  		}
  		
! 		waitForTimer(&scumm, tmp);
  	} while(1);
  

Index: gui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** gui.h	2001/11/10 19:12:32	1.2
--- gui.h	2001/11/10 20:51:55	1.3
***************
*** 29,32 ****
--- 29,34 ----
  };
  
+ #define SAVEGAME_NAME_LEN 32
+ 
  struct Gui {
  	Scumm *_s;
***************
*** 50,54 ****
  	int _editLen;
  	bool valid_games[9];
! 	char game_names[9][32];
  	void loop();
  	void init(Scumm *s);
--- 52,56 ----
  	int _editLen;
  	bool valid_games[9];
! 	char game_names[9][SAVEGAME_NAME_LEN];
  	void loop();
  	void init(Scumm *s);
***************
*** 72,76 ****
  	void editString(int index);
  	void showCaret(bool show);
! 	void addLetter(char letter);
  	void saveLoadDialog();
  	void queryMessage(const char *msg, const char *alts);
--- 74,78 ----
  	void editString(int index);
  	void showCaret(bool show);
! 	void addLetter(byte letter);
  	void saveLoadDialog();
  	void queryMessage(const char *msg, const char *alts);

Index: gui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** gui.cpp	2001/11/09 18:56:27	1.1
--- gui.cpp	2001/11/10 20:51:55	1.2
***************
*** 217,221 ****
  
  const GuiWidget save_load_dialog[] = {
! 	{GUI_STAT,0xFF,GWF_DEFAULT|GWF_PARENT,30,20,260,120,0,NULL},
  	{GUI_TEXT,0x01,0,40,5,128,16,0,1}, /* How may I serve you? */
  	{GUI_TEXT,0x02,0,40,5,128,16,0,2}, /* Select a game to LOAD */
--- 217,221 ----
  
  const GuiWidget save_load_dialog[] = {
! 	{GUI_STAT,0xFF,GWF_DEFAULT|GWF_PARENT,30,20,260,120,0,0},
  	{GUI_TEXT,0x01,0,40,5,128,16,0,1}, /* How may I serve you? */
  	{GUI_TEXT,0x02,0,40,5,128,16,0,2}, /* Select a game to LOAD */
***************
*** 247,251 ****
  	{GUI_TEXT,0x04,GWF_BUTTON,200,45,54,16,8,9}, /* Ok */
  	{GUI_TEXT,0x04,GWF_BUTTON,200,65,54,16,7,7}, /* Cancel */
- 
  	{0}
  };
--- 247,250 ----
***************
*** 375,379 ****
  
  	if (show) {
! 		if (i < 31) {
  			s[i] = '_';
  			s[i+1] = 0;
--- 374,378 ----
  
  	if (show) {
! 		if (i < SAVEGAME_NAME_LEN-1) {
  			s[i] = '_';
  			s[i+1] = 0;
***************
*** 400,404 ****
  }
  
! void Gui::addLetter(char letter) {
  	if (_editString==-1)
  		return;
--- 399,403 ----
  }
  
! void Gui::addLetter(byte letter) {
  	if (_editString==-1)
  		return;
***************
*** 409,413 ****
  	}
  
! 	if (letter>=32 && letter<128 && _editLen < 31) {
  		game_names[_editString][_editLen++] = letter;	
  	} else if (letter==8 && _editLen>0) {
--- 408,412 ----
  	}
  
! 	if (letter>=32 && letter<128 && _editLen < SAVEGAME_NAME_LEN-1) {
  		game_names[_editString][_editLen++] = letter;	
  	} else if (letter==8 && _editLen>0) {





More information about the Scummvm-git-logs mailing list