[Scummvm-cvs-logs] CVS: scummvm sdl.cpp,1.91,1.92 gfx.cpp,1.64,1.65

Ludvig Strigeus strigeus at users.sourceforge.net
Mon Apr 15 10:48:49 CEST 2002


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

Modified Files:
	sdl.cpp gfx.cpp 
Log Message:
removed mouse cursor flicker

Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sdl.cpp,v
retrieving revision 1.91
retrieving revision 1.92
diff -C2 -d -r1.91 -r1.92
*** sdl.cpp	14 Apr 2002 18:13:07 -0000	1.91
--- sdl.cpp	15 Apr 2002 17:45:52 -0000	1.92
***************
*** 120,130 ****
  	int16 _ms_hotspot_x;
  	int16 _ms_hotspot_y;
- 
  	int _current_shake_pos;
- 
  	TwoXSaiProc *_sai_func;
- 
  	SDL_Color *_cur_pal;
  
  	void add_dirty_rgn_auto(const byte *buf);
  	void mk_checksums(const byte *buf);
--- 120,129 ----
  	int16 _ms_hotspot_x;
  	int16 _ms_hotspot_y;
  	int _current_shake_pos;
  	TwoXSaiProc *_sai_func;
  	SDL_Color *_cur_pal;
  
+ 	uint _palette_changed_first, _palette_changed_last;
+ 
  	void add_dirty_rgn_auto(const byte *buf);
  	void mk_checksums(const byte *buf);
***************
*** 191,197 ****
  	}
  
! 	if (_mode_flags & DF_FORCE_FULL_ON_PALETTE)
! 		force_full = true;
! 	SDL_SetColors(sdl_screen, base, start, num);
  }
  
--- 190,198 ----
  	}
  
! 	if (start < _palette_changed_first)
! 		_palette_changed_first = start;
! 
! 	if (start + num > _palette_changed_last)
! 		_palette_changed_last = start + num;
  }
  
***************
*** 215,227 ****
  
  	case GFX_DOUBLESIZE:
- 		if (_full_screen) {
- 			warning("full screen in useless in doublesize mode, reverting to normal mode");
- 			goto normal_mode;
- 		}
  		scaling = 2;
  		_internal_scaling = 2;
  		_mode_flags = DF_WANT_RECT_OPTIM;
  		
! 		sdl_hwscreen = sdl_screen = SDL_SetVideoMode(640, 400, 8, SDL_SWSURFACE);
  		if (sdl_screen == NULL)
  			error("sdl_screen failed");
--- 216,226 ----
  
  	case GFX_DOUBLESIZE:
  		scaling = 2;
  		_internal_scaling = 2;
  		_mode_flags = DF_WANT_RECT_OPTIM;
  		
! 		sdl_hwscreen = sdl_screen = SDL_SetVideoMode(640, 400, 8, 
! 			_full_screen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
! 		);
  		if (sdl_screen == NULL)
  			error("sdl_screen failed");
***************
*** 321,325 ****
  		 * It tries to determine what areas were actually changed,
  		 * and just updates those, on the actual display. */
- 	
  		add_dirty_rgn_auto(buf);
  	} else {
--- 320,323 ----
***************
*** 333,345 ****
  			return;
  
- 		/* FIXME: undraw mouse only if the draw rect intersects with the mouse rect */
- 		if (_mouse_drawn)
- 			undraw_mouse();
- 			
  		cksum_valid = false;
- 
  		add_dirty_rect(x, y, w, h);
  	}
  
  	if (SDL_LockSurface(sdl_screen) == -1)
  		error("SDL_LockSurface failed: %s.\n", SDL_GetError());
--- 331,342 ----
  			return;
  
  		cksum_valid = false;
  		add_dirty_rect(x, y, w, h);
  	}
  
+ 	/* FIXME: undraw mouse only if the draw rect intersects with the mouse rect */
+ 	if (_mouse_drawn)
+ 		undraw_mouse();
+ 
  	if (SDL_LockSurface(sdl_screen) == -1)
  		error("SDL_LockSurface failed: %s.\n", SDL_GetError());
***************
*** 462,468 ****
  
  void OSystem_SDL::add_dirty_rgn_auto(const byte *buf) {
- 	if (_mouse_drawn)
- 		undraw_mouse();
- 
  	/* generate a table of the checksums */
  	mk_checksums(buf);
--- 459,462 ----
***************
*** 509,512 ****
--- 503,518 ----
  	draw_mouse();
  	
+ 
+ 	if (_palette_changed_last != 0) {
+ 		SDL_SetColors(sdl_screen, _cur_pal + _palette_changed_first, 
+ 			_palette_changed_first,
+ 			_palette_changed_last - _palette_changed_first);
+ 		
+ 		_palette_changed_last = 0;
+ 
+ 		if (_mode_flags & DF_FORCE_FULL_ON_PALETTE)
+ 			force_full = true;
+ 	}
+ 
  	/* force a full redraw, accomplish that by adding one big rect to the dirty
  	 * rect list */
***************
*** 517,523 ****
  	}
  
  	if (num_dirty_rects == 0 || sdl_hwscreen == NULL)
  		return;
! 		
  	if (_mode_flags & DF_2xSAI) {
  		SDL_Rect *r;
--- 523,530 ----
  	}
  
+ 
  	if (num_dirty_rects == 0 || sdl_hwscreen == NULL)
  		return;
! 
  	if (_mode_flags & DF_2xSAI) {
  		SDL_Rect *r;
***************
*** 553,566 ****
  		SDL_UnlockSurface(sdl_hwscreen);
  
- 		/* Call SDL update on the affected regions */
- 		SDL_UpdateRects(sdl_hwscreen, num_dirty_rects, dirty_rect_list);
  #ifdef WIN32
  		if (GetAsyncKeyState(VK_SHIFT)<0)
  			printf("Update area %d pixels. %d%%\n", area, (area+(320*2)/2) / (320*2));
  #endif
- 	} else {
- 		/* Call SDL update on the affected regions */
- 		SDL_UpdateRects(sdl_hwscreen, num_dirty_rects, dirty_rect_list);
  	}
  	
  	num_dirty_rects = 0;
--- 560,570 ----
  		SDL_UnlockSurface(sdl_hwscreen);
  
  #ifdef WIN32
  		if (GetAsyncKeyState(VK_SHIFT)<0)
  			printf("Update area %d pixels. %d%%\n", area, (area+(320*2)/2) / (320*2));
  #endif
  	}
+ 
+ 	SDL_UpdateRects(sdl_hwscreen, num_dirty_rects, dirty_rect_list);
  	
  	num_dirty_rects = 0;

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gfx.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -d -r1.64 -r1.65
*** gfx.cpp	14 Apr 2002 18:13:07 -0000	1.64
--- gfx.cpp	15 Apr 2002 17:45:52 -0000	1.65
***************
*** 2420,2429 ****
  void Scumm::animateCursor() {
  	if (_cursorAnimate) {
! 		if (!(_cursorAnimateIndex & 0x3))
  			decompressDefaultCursor((_cursorAnimateIndex >> 2) & 3);
  		_cursorAnimateIndex++;
  	}
  
- 	updateCursor();
  }
  
--- 2420,2429 ----
  void Scumm::animateCursor() {
  	if (_cursorAnimate) {
! 		if (!(_cursorAnimateIndex & 0x3)) {
  			decompressDefaultCursor((_cursorAnimateIndex >> 2) & 3);
+ 		}
  		_cursorAnimateIndex++;
  	}
  
  }
  





More information about the Scummvm-git-logs mailing list