[Scummvm-cvs-logs] CVS: scummvm gui.cpp,1.16,1.17 gui.h,1.9,1.10 object.cpp,1.42,1.43 resource.cpp,1.52,1.53 scumm.h,1.84,1.85 scummvm.dsp,1.22,1.23 sdl.cpp,1.43,1.44 sound.cpp,1.30,1.31 windows.cpp,1.29,1.30

James Brown ender at users.sourceforge.net
Fri Mar 15 21:34:03 CET 2002


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

Modified Files:
	gui.cpp gui.h object.cpp resource.cpp scumm.h scummvm.dsp 
	sdl.cpp sound.cpp windows.cpp 
Log Message:
Lots of stuff - GUI fixes. More launcher work... and CD music working in MI1. Thanks to frob and realmz for their work on that.



Index: gui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** gui.cpp	15 Mar 2002 00:31:51 -0000	1.16
--- gui.cpp	16 Mar 2002 05:33:25 -0000	1.17
***************
*** 45,49 ****
  	KEYS_DIALOG,
  	OPTIONS_DIALOG,
! 	ABOUT_DIALOG
  };
  
--- 45,50 ----
  	KEYS_DIALOG,
  	OPTIONS_DIALOG,
! 	ABOUT_DIALOG,
! 	LAUNCHER_DIALOG
  };
  
***************
*** 98,102 ****
    unsigned int buffer, mask = 0, x, y;    
    byte *tmp;
!   
    tmp = &guifont[0];
    tmp += 224 + (str + 1)*8;
--- 99,105 ----
    unsigned int buffer, mask = 0, x, y;    
    byte *tmp;
!   int tempc = _color;
!   _color = _textcolor;
! 
    tmp = &guifont[0];
    tmp += 224 + (str + 1)*8;
***************
*** 108,114 ****
          color = ((buffer & mask) != 0);
          if (color)
! 				hline(xx + x, yy + y, yy + y + 1);
        }
    }
  
  }
--- 111,118 ----
          color = ((buffer & mask) != 0);
          if (color)
! 				vline(xx + x, yy + y, yy + y);
        }
    }
+   _color = tempc;
  
  }
***************
*** 134,138 ****
  	const char *s;
  	int x,y;
! 
  	x = w->_x;
  	y = w->_y;
--- 138,142 ----
  	const char *s;
  	int x,y;
! 	
  	x = w->_x;
  	y = w->_y;
***************
*** 178,185 ****
  		}
  		
! 		if (*text)
  			drawString(text, x+_parentX, y+_parentY, w->_w,
  				(_clickWidget && _clickWidget==w->_id) ? _textcolorhi : _textcolor,
  				false);
  		break;
  	}
--- 182,191 ----
  		}
  		
! 		if (*text) {
! 			printf("drawString(%s)\n", text);
  			drawString(text, x+_parentX, y+_parentY, w->_w,
  				(_clickWidget && _clickWidget==w->_id) ? _textcolorhi : _textcolor,
  				false);
+ 		}
  		break;
  	}
***************
*** 318,321 ****
--- 324,334 ----
  		close();
  }
+ const GuiWidget launcher_dialog[] = {
+ 	{GUI_STAT, 0xFF, GWF_DEFAULT, 0, 0, 320, 200, 0, 0 },	
+ 	{GUI_CUSTOMTEXT,0x01,GWF_CLEARBG, 5,   180, 45, 15, 20, 12},
+ 	{GUI_CUSTOMTEXT,0x01,GWF_CLEARBG, 130, 180, 65, 15, 21,17},
+ 	{GUI_CUSTOMTEXT,0x01,GWF_CLEARBG, 265, 180, 50, 15, 22, 7},
+ 	{0,0,0,0,0,0,0,0,0}
+ };
  const GuiWidget keys_dialog[] = {
  	{GUI_STAT, 0xFF, GWF_DEFAULT, 30, 10, 260, 130, 0, 0 },
***************
*** 353,357 ****
  	//OK
  	{GUI_RESTEXT, 0x01, GWF_BUTTON, 30 + 113, 10 + 106, 54, 16, 60, 9 },
! 	{0}
  };
  
--- 366,370 ----
  	//OK
  	{GUI_RESTEXT, 0x01, GWF_BUTTON, 30 + 113, 10 + 106, 54, 16, 60, 9 },
! 	{0,0,0,0,0,0,0,0,0}
  };
  
***************
*** 364,368 ****
  	{GUI_CUSTOMTEXT, 0x01, 0, 30 + 75, 20 + 10 + 15 + 5 + 15 + 15 + 15, 150, 15, 0, 11}, // Lucasarts
  	{GUI_RESTEXT, 0x01, GWF_BUTTON, 30 + 113, 20 + 96, 54, 16, 40, 9 },
! 	{0}
  };
  
--- 377,381 ----
  	{GUI_CUSTOMTEXT, 0x01, 0, 30 + 75, 20 + 10 + 15 + 5 + 15 + 15 + 15, 150, 15, 0, 11}, // Lucasarts
  	{GUI_RESTEXT, 0x01, GWF_BUTTON, 30 + 113, 20 + 96, 54, 16, 40, 9 },
! 	{0,0,0,0,0,0,0,0,0}
  };
  
***************
*** 372,376 ****
  	{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 50 + 10 + 40 + 30 , 80 + 10, 40, 15 , 2, 6}, // Keys
  	{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 50 + 10 + 40 + 30 + 40 + 30, 80 + 10, 40, 15, 3, 7},	 // About
! 	{0}
  };
  
--- 385,389 ----
  	{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 50 + 10 + 40 + 30 , 80 + 10, 40, 15 , 2, 6}, // Keys
  	{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 50 + 10 + 40 + 30 + 40 + 30, 80 + 10, 40, 15, 3, 7},	 // About
! 	{0,0,0,0,0,0,0,0,0}
  };
  
***************
*** 388,392 ****
  	{GUI_RESTEXT,0x01,GWF_BUTTON,30 + (260 / 2) - 80, 20 + 25 + 25 + 11 + 25 ,54,16,40,9}, /* OK */
  	{GUI_RESTEXT,0x01,GWF_BUTTON,30 + (260 / 2), 20 + 25 + 25 + 11 + 25 ,54,16,50,7}, /* Cancel */
! 	{0}
  };
  
--- 401,405 ----
  	{GUI_RESTEXT,0x01,GWF_BUTTON,30 + (260 / 2) - 80, 20 + 25 + 25 + 11 + 25 ,54,16,40,9}, /* OK */
  	{GUI_RESTEXT,0x01,GWF_BUTTON,30 + (260 / 2), 20 + 25 + 25 + 11 + 25 ,54,16,50,7}, /* Cancel */
! 	{0,0,0,0,0,0,0,0,0}
  };
  
***************
*** 483,486 ****
--- 496,500 ----
  			_active = true;
  			_cur_page = 0;
+ 			_return_to = 0;
  			_dialog = ABOUT_DIALOG;
  			draw(0, 100);
***************
*** 515,523 ****
  }
  
  
  void Gui::handleCommand(int cmd) {
  	int lastEdit = _editString;
  	showCaret(false);
! 	
  	if (_dialog == SOUND_DIALOG) {
  		handleSoundDialogCommand(cmd);
--- 529,564 ----
  }
  
+ void Gui::handleLauncherDialogCommand(int cmd) {
+ 	printf("handle launcher command\n");
+  switch(cmd) {
+ 	case 20:
+ 		close();
+ 	break;
+ 	case 21:
+ 		// Nothing yet
+ 	break;
+ 	case 22:
+ 			_widgets[0] = about_dialog;
+ 			_active = true;
+ 			_cur_page = 0;
+ 			_return_to = LAUNCHER_DIALOG;
+ 			_dialog = ABOUT_DIALOG;
+ 			draw(0, 100);
+ 			printf("about dialog\n");
+ 	break;
+ 	default:
+ 		printf("default\n");
+ 		close();
+  }
+ }
  
  void Gui::handleCommand(int cmd) {
  	int lastEdit = _editString;
  	showCaret(false);
! 
! 	if (_dialog == LAUNCHER_DIALOG) {
! 		handleLauncherDialogCommand(cmd);
! 		return;
! 	}
  	if (_dialog == SOUND_DIALOG) {
  		handleSoundDialogCommand(cmd);
***************
*** 536,540 ****
  
  	if (_dialog == ABOUT_DIALOG) {
! 		close();
  		return;
  	}
--- 577,588 ----
  
  	if (_dialog == ABOUT_DIALOG) {
! 		if (_return_to == LAUNCHER_DIALOG) {
! 			_widgets[0] = launcher_dialog;
! 			_active = true;
! 			_cur_page = 0;
! 			_dialog = LAUNCHER_DIALOG;
! 			draw(0, 100);
! 		} else 
! 			close();
  		return;
  	}
***************
*** 707,711 ****
  
  byte Gui::getDefaultColor(int color) {
! 	if(_s->_features & GF_AFTER_V7)
  		return 0;
  	if (_s->_features&GF_AFTER_V6) {
--- 755,759 ----
  
  byte Gui::getDefaultColor(int color) {
! 	if((_s->_features & GF_AFTER_V7) || (_s->_features & GF_SMALL_HEADER))
  		return 0;
  	if (_s->_features&GF_AFTER_V6) {
***************
*** 727,734 ****
  	} else {
  		_bgcolor = 0;
! 		_color = 2;
! 		_textcolor = 6;
! 		_textcolorhi = 3;
! 		_shadowcolor = 2;
  	}
  }
--- 775,782 ----
  	} else {
  		_bgcolor = 0;
! 		_color	= 0;
! 		_textcolor = 8;	// 15 is nice
! 		_textcolorhi = 15;
! 		_shadowcolor = 0;
  	}
  }
***************
*** 774,778 ****
  	_active = false;
  
! #ifdef _WIN32_WCE
  	// Option dialog can be accessed from the file dialog now, always check
  	if (draw_keyboard) {
--- 822,827 ----
  	_active = false;
  
! #ifdef _WIN32_WCE
! 
  	// Option dialog can be accessed from the file dialog now, always check
  	if (draw_keyboard) {
***************
*** 803,805 ****
--- 852,861 ----
  	_cur_page = 0;
  	_dialog = OPTIONS_DIALOG;
+ }
+ 
+ void Gui::launcher() {
+ 	_widgets[0] = launcher_dialog;
+ 	_active = true;
+ 	_cur_page = 0;
+ 	_dialog = LAUNCHER_DIALOG;
  }

Index: gui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** gui.h	14 Mar 2002 17:36:12 -0000	1.9
--- gui.h	16 Mar 2002 05:33:25 -0000	1.10
***************
*** 24,45 ****
  
  static const char* string_map_table_custom[] = { 
! 	"Master Volume :",
! 	"Music Volume :",
! 	"SFX Volume :",
! 	"+",
! 	"-",
! 	"Sound",
! 	"Keys",
! 	"About",
! 	"Pocket ScummVM",
! 	"Build " SCUMMVM_VERSION "(" SCUMMVM_CVS ")",	
! 	"ScummVM http://scummvm.sourceforge.net",	
! 	"All games (c) LucasArts",
! 	"Quit",
! 	"Pause",
! 	"Save",
! 	"Skip",
! 	"Hide",
! 	"Options"
  };
  
--- 24,45 ----
  
  static const char* string_map_table_custom[] = { 
! 	"Master Volume :",	//0
! 	"Music Volume :",	//1
! 	"SFX Volume :",		//2
! 	"+",				//3
! 	"-",				//4
! 	"Sound",			//5
! 	"Keys",				//6
! 	"About",			//7
! 	"Pocket ScummVM",	//8
! 	"Build " SCUMMVM_VERSION "(" SCUMMVM_CVS ")",	//9
! 	"ScummVM http://scummvm.sourceforge.net",		//10
! 	"All games (c) LucasArts",						//11
! 	"Quit",											//12
! 	"Pause",										//13
! 	"Save",											//14
! 	"Skip",											//15
! 	"Hide",											//16
! 	"Options"										//17
  };
  
***************
*** 85,88 ****
--- 85,89 ----
  	Scumm *_s;
  	const GuiWidget *_widgets[4];
+ 	int _return_to;
  	int _curX, _curY;
  	VirtScreen *_vs;
***************
*** 138,146 ****
  	void pause();
  	void options();
  
  	void handleSoundDialogCommand(int cmd);
  	void handleOptionsDialogCommand(int cmd);
  	void handleKeysDialogCommand(int cmd);
! 
  };
  
--- 139,148 ----
  	void pause();
  	void options();
+ 	void launcher();
  
  	void handleSoundDialogCommand(int cmd);
  	void handleOptionsDialogCommand(int cmd);
  	void handleKeysDialogCommand(int cmd);
! 	void handleLauncherDialogCommand(int cmd);
  };
  

Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/object.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** object.cpp	14 Mar 2002 14:45:03 -0000	1.42
--- object.cpp	16 Mar 2002 05:33:25 -0000	1.43
***************
*** 673,677 ****
  
  		objptr = getOBCDFromObject(obj);
! 		offset = *(objptr+18);
  		return(objptr+offset);
          }
--- 673,678 ----
  
  		objptr = getOBCDFromObject(obj);
! 		if (objptr)
! 			offset = *(objptr+18);
  		return(objptr+offset);
          }
***************
*** 902,906 ****
  int Scumm::getObjX(int obj) {
  	if (obj < NUM_ACTORS) {
! 		if (obj==0)
  			return 0; /* fix for indy4's map */
  		return derefActorSafe(obj,"getObjX")->x;
--- 903,907 ----
  int Scumm::getObjX(int obj) {
  	if (obj < NUM_ACTORS) {
! 		if (obj<1)
  			return 0; /* fix for indy4's map */
  		return derefActorSafe(obj,"getObjX")->x;
***************
*** 915,919 ****
  int Scumm::getObjY(int obj) {
  	if (obj < NUM_ACTORS) {
! 		if (obj==0)
  			return 0; /* fix for indy4's map */
  		return derefActorSafe(obj,"getObjY")->y;
--- 916,920 ----
  int Scumm::getObjY(int obj) {
  	if (obj < NUM_ACTORS) {
! 		if (obj<1)
  			return 0; /* fix for indy4's map */
  		return derefActorSafe(obj,"getObjY")->y;

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -d -r1.52 -r1.53
*** resource.cpp	14 Mar 2002 13:57:28 -0000	1.52
--- resource.cpp	16 Mar 2002 05:33:25 -0000	1.53
***************
*** 667,671 ****
  			return 1;
          	}
! 	} else {
  		best_pri = -1;
  		while (pos < total_size) {
--- 667,671 ----
  			return 1;
          	}
! 	} else if (basetag == MKID('SOU ')) {
  		best_pri = -1;
  		while (pos < total_size) {
***************
*** 698,701 ****
--- 698,711 ----
  			return 1;
  		}		
+ 	} else if (FROM_LE_32(basetag) == 24) {
+ 		fileSeek(_fileHandle, -12, SEEK_CUR);
+ 		total_size = fileReadDwordBE();
+ 		fileSeek(_fileHandle, -8, SEEK_CUR);
+ 		fileRead(_fileHandle, createResource(type, idx, total_size), total_size);
+ 		return 1;
+ 	} else {
+ 		error("Unrecognized base tag %c%c%c%c in sound %d",
+ 		      basetag&0xff, basetag>>8, basetag>>16, basetag>>24,
+ 		      idx);
  	}
  	res.roomoffs[type][idx] = 0xFFFFFFFF;

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.84
retrieving revision 1.85
diff -C2 -d -r1.84 -r1.85
*** scumm.h	14 Mar 2002 22:45:22 -0000	1.84
--- scumm.h	16 Mar 2002 05:33:25 -0000	1.85
***************
*** 1205,1209 ****
  	int num_sound_effects;
  #endif
!   
  	void openRoom(int room);
  	void deleteRoomOffsets();
--- 1205,1211 ----
  	int num_sound_effects;
  #endif
! 
! 	int current_cd_sound;
! 
  	void openRoom(int room);
  	void deleteRoomOffsets();

Index: scummvm.dsp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.dsp,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** scummvm.dsp	7 Mar 2002 09:21:43 -0000	1.22
--- scummvm.dsp	16 Mar 2002 05:33:25 -0000	1.23
***************
*** 69,73 ****
  # 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 /I "./sound" /I "./" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "ALLOW_GDI" /D "BYPASS_COPY_PROT" /D "USE_ADLIB" /D "DUMP_SCRIPTS" /Yu"stdafx.h" /FD /GZ /c
  # SUBTRACT CPP /Fr
  # ADD BASE RSC /l 0x41d /d "_DEBUG"
--- 69,73 ----
  # 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 /I "./sound" /I "./" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "ALLOW_GDI" /D "BYPASS_COPY_PROT" /D "DUMP_SCRIPTS" /D "USE_ADLIB" /Yu"stdafx.h" /FD /GZ /c
  # SUBTRACT CPP /Fr
  # ADD BASE RSC /l 0x41d /d "_DEBUG"
***************
*** 78,82 ****
  LINK32=link.exe
  # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
! # ADD LINK32 kernel32.lib user32.lib gdi32.lib sdl.lib winmm.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
  
  !ELSEIF  "$(CFG)" == "scummvm - Win32 MP3 Enabled Debug"
--- 78,82 ----
  LINK32=link.exe
  # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
! # ADD LINK32 kernel32.lib user32.lib gdi32.lib sdl.lib winmm.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
  
  !ELSEIF  "$(CFG)" == "scummvm - Win32 MP3 Enabled Debug"
***************
*** 413,416 ****
--- 413,420 ----
  
  SOURCE=.\sound\fmopl.h
+ # End Source File
+ # Begin Source File
+ 
+ SOURCE=.\sound\gmidi.h
  # End Source File
  # Begin Source File

Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sdl.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** sdl.cpp	14 Mar 2002 13:57:28 -0000	1.43
--- sdl.cpp	16 Mar 2002 05:33:25 -0000	1.44
***************
*** 28,31 ****
--- 28,33 ----
  #include "SDL_thread.h"
  
+ #include "cdmusic.h"
+ 
  static unsigned int scale;
  
***************
*** 177,180 ****
--- 179,184 ----
  		}
  
+ 		cd_music_loop(); // Loop CD Music if necessary
+ 
  		if (SDL_GetTicks() >= start_time + msec_delay)
  			break;
***************
*** 664,669 ****
  
  void cd_playtrack(int track, int offset, int delay) {
!         SDL_CDStatus(cdrom);
!         SDL_CDPlayTracks(cdrom, track, (int)((offset * 7.5) - 22650), 0, (int)(delay * 7.5));
  }
  
--- 668,746 ----
  
  void cd_playtrack(int track, int offset, int delay) {
! 	if (!cdrom) return;
!     
! 	SDL_CDStatus(cdrom);
!     SDL_CDPlayTracks(cdrom, track, (int)((offset * 7.5) - 22650), 0, (int)(delay * 7.5));
! }
! 
! static int cd_track, cd_num_loops = 0, cd_start_frame;
! 
! // On my system, calling SDL_CDStatus all the time slows things down a
! // lot and prevents music from playing at all :( So this saves the
! // time the track is expected to be finished.
! static Uint32 cd_end_time;
! 
! static Uint32 cd_stop_time;
! 
! void cd_play(int track, int num_loops, int start_frame) {
! 	// warning("cd_play(%d,%d,%d)", track, num_loops, start_frame);
! 	if (!cdrom) return;
! 
! 	cd_track = track;
! 	cd_num_loops = num_loops;
! 	cd_start_frame = start_frame;
! 
! 	SDL_CDStatus(cdrom);
! 	SDL_CDPlayTracks(cdrom, track, start_frame, 1, 0);
! 	cd_stop_time = 0;
! 	cd_end_time = SDL_GetTicks() +
! 		cdrom->track[track].length * 1000 / CD_FPS;
! }
! 
! // Schedule the music to be stopped after 1/10 sec, unless another
! // track is started in the meantime.  (On my machine, stopping and
! // then restarting the CD takes a few seconds.)
! void cd_stop() {
! 	cd_stop_time = SDL_GetTicks() + 100;
! 	cd_num_loops = 0;
! }
! 
! int cd_is_running() {
! 	if (!cdrom) return 0;
! 
! 	return (cd_num_loops != 0 && (SDL_GetTicks() < cd_end_time ||
! 				      SDL_CDStatus(cdrom) != CD_STOPPED));
! }
! 
! static void cd_shutdown() {
! 	if (!cdrom) return;
! 
! 	if (cd_num_loops != 0)
! 		SDL_CDStop(cdrom);
! }
! 
! void cd_music_loop() {
! 	if (!cdrom) return;
! 
! 	if (cd_stop_time != 0 && SDL_GetTicks() >= cd_stop_time) {
! 		SDL_CDStop(cdrom);
! 		cd_num_loops = 0;
! 		cd_stop_time = 0;
! 		return;
! 	}
! 	if (cd_num_loops == 0 || SDL_GetTicks() < cd_end_time)
! 		return;
! 	if (cd_num_loops != 1 && SDL_CDStatus(cdrom) != CD_STOPPED) {
! 		// Wait another second for it to be done
! 		cd_end_time += 1000;
! 		return;
! 	}
! 	if (cd_num_loops > 0)
! 		cd_num_loops--;
! 	if (cd_num_loops != 0) {
! 		SDL_CDPlayTracks(cdrom, cd_track, cd_start_frame, 1, 0);
! 		cd_end_time = SDL_GetTicks() +
! 			cdrom->track[cd_track].length * 1000 / CD_FPS;
! 	}
  }
  
***************
*** 704,707 ****
--- 781,785 ----
  	/* Clean up on exit */
   	atexit(SDL_Quit);
+ 	atexit(cd_shutdown);
  	atexit(resetCursor);
  
***************
*** 778,782 ****
  	last_time = SDL_GetTicks();
  
! 	gui.saveLoadDialog();
  	do {
  		updateScreen(&scumm);
--- 856,860 ----
  	last_time = SDL_GetTicks();
  
! 	gui.launcher();
  	do {
  		updateScreen(&scumm);

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** sound.cpp	15 Mar 2002 02:23:44 -0000	1.30
--- sound.cpp	16 Mar 2002 05:33:25 -0000	1.31
***************
*** 22,30 ****
  #include "stdafx.h"
  #include "scumm.h"
! #include "sound.h"
! 
! #ifdef _WIN32_WCE
! extern void *bsearch(const void *, const void *, size_t, 
! 			  size_t, int (*x)(const void *, const void *));
  #endif
  
--- 22,31 ----
  #include "stdafx.h"
  #include "scumm.h"
! #include "sound.h"
! #include "cdmusic.h"
! 
! #ifdef _WIN32_WCE
! extern void *bsearch(const void *, const void *, size_t, 
! 			  size_t, int (*x)(const void *, const void *));
  #endif
  
***************
*** 99,103 ****
--- 100,115 ----
  
  void Scumm::playSound(int sound) {
+ 	byte *ptr;
          SoundEngine *se = (SoundEngine*)_soundEngine;
+ 
+ 	ptr = getResourceAddress(rtSound, sound);
+ 	if (ptr != NULL && READ_UINT32_UNALIGNED(ptr) == MKID('SOUN')) {
+ 		ptr += 8;
+ 		cd_play(ptr[16], ptr[17] == 0xff ? -1 : ptr[17],
+ 			(ptr[18] * 60 + ptr[19]) * 75 + ptr[20]);
+ 		current_cd_sound = sound;
+ 		return;
+ 	}
+ 
          if (_features & GF_OLD256) return; /* FIXME */
  
***************
*** 170,174 ****
  	  
  	  key.org_offset = offset;
! 	  result = (OffsetTable *) bsearch(&key, offset_table, num_sound_effects, sizeof(OffsetTable), compar);
  
  	  if (result == NULL) {
--- 182,187 ----
  	  
  	  key.org_offset = offset;
! 	  result = (OffsetTable *) bsearch(&key, offset_table, num_sound_effects, sizeof(OffsetTable), compar);
! 
  
  	  if (result == NULL) {
***************
*** 234,237 ****
--- 247,253 ----
  	int i;
  
+ 	if (sound == current_cd_sound)
+ 		return cd_is_running();
+ 
  	i = _soundQue2Pos;
  	while (i--) {
***************
*** 276,279 ****
--- 292,300 ----
  	int i;
  
+ 	if (a == current_cd_sound) {
+ 		current_cd_sound = 0;
+ 		cd_stop();
+ 	}
+ 
  	se = (SoundEngine*)_soundEngine;
  	if (se)
***************
*** 287,290 ****
--- 308,317 ----
  void Scumm::stopAllSounds() {
  	SoundEngine *se = (SoundEngine*)_soundEngine;
+ 
+ 	if (current_cd_sound != 0) {
+ 		current_cd_sound = 0;
+ 		cd_stop();
+ 	}
+ 
  	if (se) {
  		se->stop_all_sounds();
***************
*** 549,558 ****
    mc->_sfx_sound = sound;
  
!   mad_stream_init(&mc->sound_data.mp3.stream);
! 
! #ifdef _WIN32_WCE  
!   // 11 kHz on WinCE
!   mad_stream_options((mad_stream*)&mc->sound_data.mp3.stream, MAD_OPTION_HALFSAMPLERATE);
! #endif
    
    mad_frame_init(&mc->sound_data.mp3.frame);
--- 576,591 ----
    mc->_sfx_sound = sound;
  
!   mad_stream_init(&mc->sound_data.mp3.stream);
! 
! 
! 
! #ifdef _WIN32_WCE  
! 
!   // 11 kHz on WinCE
! 
!   mad_stream_options((mad_stream*)&mc->sound_data.mp3.stream, MAD_OPTION_HALFSAMPLERATE);
! 
! #endif
! 
    
    mad_frame_init(&mc->sound_data.mp3.frame);

Index: windows.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/windows.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** windows.cpp	10 Mar 2002 17:33:04 -0000	1.29
--- windows.cpp	16 Mar 2002 05:33:25 -0000	1.30
***************
*** 24,27 ****
--- 24,28 ----
  #include "scumm.h"
  #include "sound.h"
+ #include "cdmusic.h"
  #include "gui.h"
  
***************
*** 114,117 ****
--- 115,119 ----
  
  void modifyslot(int sel, int what);
+ void launcherLoop() {;}
  
  int mapKey(int key) {
***************
*** 122,125 ****
--- 124,133 ----
  }
  
+ // FIXME: CD Music Stubs
+ void cd_playtrack(int track, int offset, int delay) {;}
+ void cd_play(int track, int num_loops, int start_frame) {;}
+ void cd_stop() {;}
+ int cd_is_running() {return 0;}
+ 
  static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
  	WndMan *wm = (WndMan*)GetWindowLong(hWnd, GWL_USERDATA);	
***************
*** 409,415 ****
  
  void blitToScreen(Scumm *s, byte *src,int x, int y, int w, int h) {
! 	byte *dst;
! 	SDL_Rect *r;
! 	int i;
  
  	dst = (byte*)wm->_vgabuf + y*320 + x;
--- 417,421 ----
  
  void blitToScreen(Scumm *s, byte *src,int x, int y, int w, int h) {
! 	byte *dst;	
  
  	dst = (byte*)wm->_vgabuf + y*320 + x;
***************
*** 461,468 ****
  void fill_buffer(int16 *buf, int len) {
  	scumm.mixWaves(buf, len);
- }
- 
- void cd_playtrack(int track, int offset, int delay) { // FIXME: Add for Win32
- ;
  }
  
--- 467,470 ----





More information about the Scummvm-git-logs mailing list