[Scummvm-cvs-logs] CVS: scummvm script_v1.cpp,1.76,1.77 scumm.h,1.120,1.121 scummvm.cpp,1.113,1.114 sdl.cpp,1.93,1.94 sound.cpp,1.44,1.45 system.h,1.8,1.9 vars.cpp,1.6,1.7 cdmusic.h,1.3,NONE

James Brown ender at users.sourceforge.net
Tue Apr 16 05:19:05 CEST 2002


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

Modified Files:
	script_v1.cpp scumm.h scummvm.cpp sdl.cpp sound.cpp system.h 
	vars.cpp 
Removed Files:
	cdmusic.h 
Log Message:
Add hack for loom staff verbs.
Readd CD Audio



Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v1.cpp,v
retrieving revision 1.76
retrieving revision 1.77
diff -C2 -d -r1.76 -r1.77
*** script_v1.cpp	15 Apr 2002 14:22:34 -0000	1.76
--- script_v1.cpp	16 Apr 2002 12:18:49 -0000	1.77
***************
*** 21,28 ****
   */
  
- 
  #include "stdafx.h"
  #include "scumm.h"
- #include "cdmusic.h"
  
  void Scumm::setupOpcodes()
--- 21,26 ----
***************
*** 2363,2366 ****
--- 2361,2389 ----
  			vs->x = getVarOrDirectWord(0x80);
  			vs->y = getVarOrDirectWord(0x40);
+ 			// FIXME: hack loom notes into right spot
+ 			if (_gameId == GID_LOOM256) {
+ 				if ((verb >= 90) && (verb <= 97)) { // Notes
+ 					switch (verb) {
+ 						case 90:
+                         case 91:
+ 							vs->y -= 7;
+ 						break;
+ 						case 92:
+ 							vs->y -= 6;
+ 						break;
+ 						case 93:
+ 							vs->y -= 4;
+ 						break;
+ 						case 94:
+ 							vs->y -= 3;
+ 						break;
+ 						case 95:
+ 							vs->y -= 1;
+ 						break;
+ 						case 97:
+ 							vs->y -= 5;
+ 					}
+ 				}
+ 			}
  			break;
  		case 6:										/* set on */
***************
*** 2646,2650 ****
  				delay = (int)((getVarOrDirectWord(0x40) & 0xffff) * 7.5);
  				if (_gameId == GID_LOOM256)
! 					cd_play(this, 1, 0, offset, delay);
  				else
  					warning("parseString: 8");
--- 2669,2673 ----
  				delay = (int)((getVarOrDirectWord(0x40) & 0xffff) * 7.5);
  				if (_gameId == GID_LOOM256)
! 					_system->play_cdrom(1, 0, offset, delay);
  				else
  					warning("parseString: 8");

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.120
retrieving revision 1.121
diff -C2 -d -r1.120 -r1.121
*** scumm.h	16 Apr 2002 12:07:17 -0000	1.120
--- scumm.h	16 Apr 2002 12:18:50 -0000	1.121
***************
*** 1821,1823 ****
  void setWindowName(Scumm *s);
  uint16 newTag2Old(uint32 oldTag);
! //void cd_playtrack(int track, int offset, int delay);
--- 1821,1823 ----
  void setWindowName(Scumm *s);
  uint16 newTag2Old(uint32 oldTag);
! 

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.113
retrieving revision 1.114
diff -C2 -d -r1.113 -r1.114
*** scummvm.cpp	16 Apr 2002 12:07:17 -0000	1.113
--- scummvm.cpp	16 Apr 2002 12:18:50 -0000	1.114
***************
*** 1149,1152 ****
--- 1149,1153 ----
  		}
  
+ 		_system->update_cdrom(); /* Loop CD Audio if needed */
  		if (_system->get_msecs() >= start_time + msec_delay)
  			break;

Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sdl.cpp,v
retrieving revision 1.93
retrieving revision 1.94
diff -C2 -d -r1.93 -r1.94
*** sdl.cpp	16 Apr 2002 12:07:18 -0000	1.93
--- sdl.cpp	16 Apr 2002 12:18:50 -0000	1.94
***************
*** 5,9 ****
  #include "gameDetector.h"
  
- #include "cdmusic.h"
  #include "mp3_cd.h"
  #include <SDL.h>
--- 5,8 ----
***************
*** 55,58 ****
--- 54,70 ----
  	bool set_sound_proc(void *param, SoundProc *proc, byte sound);
  		
+ 	// Poll cdrom status
+ 	// Returns true if cd audio is playing
+ 	bool poll_cdrom();
+ 
+ 	// Play cdrom audio track
+ 	void play_cdrom(int track, int num_loops, int start_frame, int end_frame);
+ 
+ 	// Stop cdrom audio track
+ 	void stop_cdrom();
+ 
+ 	// Update cdrom audio status
+ 	void update_cdrom();
+ 
  	// Quit
  	void quit();
***************
*** 110,113 ****
--- 122,129 ----
  	int scaling;
  
+ 	/* CD Audio */
+ 	int cd_track, cd_num_loops, cd_start_frame, cd_end_frame;
+ 	Uint32 cd_end_time, cd_stop_time, cd_next_second;
+ 
  	struct MousePos {
  		int16 x,y,w,h;
***************
*** 1019,1022 ****
--- 1035,1100 ----
  }
  
+ void OSystem_SDL::stop_cdrom() {	/* Stop CD Audio in 1/10th of a second */
+ 	cd_stop_time = SDL_GetTicks() + 100;
+ 	cd_num_loops = 0;
+ 
+ }
+ 
+ void OSystem_SDL::play_cdrom(int track, int num_loops, int start_frame, int end_frame) {
+ 	/* Reset sync count */
+ 	g_scumm->_vars[g_scumm->VAR_MI1_TIMER] = 0;
+ 
+ 	if (!num_loops && !start_frame)
+ 		return;
+ 
+ 	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, 0, end_frame + 5);
+ 	cd_end_frame = end_frame;
+ 	cd_stop_time = 0;
+ 	cd_end_time = SDL_GetTicks() + cdrom->track[track].length * 1000 / CD_FPS;
+ }
+ 
+ bool OSystem_SDL::poll_cdrom() {
+ 	if (!cdrom)
+ 		return false;
+ 
+ 	return (cd_num_loops != 0 && (SDL_GetTicks() < cd_end_time || SDL_CDStatus(cdrom) != CD_STOPPED));
+ }
+ 
+ void OSystem_SDL::update_cdrom() {
+ 	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, 0, cd_end_frame);
+ 		cd_end_time = SDL_GetTicks() + cdrom->track[cd_track].length * 1000 / CD_FPS;
+ 	}
+ }
  
  #ifdef USE_NULL_DRIVER
***************
*** 1090,1107 ****
  
  #endif
- 
- 
- 
- void cd_stop() {
- }
- 
- void cd_play(Scumm *s, int track, int num_loops, int start_frame, int end_track) {
- }
- 
- int cd_is_running() {
- 	return 0;
- }
- 
- void cd_music_loop() {
- }
- 
--- 1168,1169 ----

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** sound.cpp	16 Apr 2002 04:34:35 -0000	1.44
--- sound.cpp	16 Apr 2002 12:18:50 -0000	1.45
***************
*** 25,29 ****
  #include "mididrv.h"
  #include "imuse.h"
- #include "cdmusic.h"
  
  #ifdef _WIN32_WCE
--- 25,28 ----
***************
*** 108,112 ****
  	if (ptr != NULL && READ_UINT32_UNALIGNED(ptr) == MKID('SOUN')) {
  		ptr += 8;
! 		cd_play(this, ptr[16], ptr[17] == 0xff ? -1 : ptr[17],
  						(ptr[18] * 60 + ptr[19]) * 75 + ptr[20], 0);
  		current_cd_sound = sound;
--- 107,111 ----
  	if (ptr != NULL && READ_UINT32_UNALIGNED(ptr) == MKID('SOUN')) {
  		ptr += 8;
! 		_system->play_cdrom(ptr[16], ptr[17] == 0xff ? -1 : ptr[17],
  						(ptr[18] * 60 + ptr[19]) * 75 + ptr[20], 0);
  		current_cd_sound = sound;
***************
*** 258,262 ****
  
  	if (sound == current_cd_sound)
! 		return cd_is_running();
  
  	i = _soundQue2Pos;
--- 257,261 ----
  
  	if (sound == current_cd_sound)
! 		return _system->poll_cdrom();
  
  	i = _soundQue2Pos;
***************
*** 306,310 ****
  	if (a == current_cd_sound) {
  		current_cd_sound = 0;
! 		cd_stop();
  	}
  
--- 305,309 ----
  	if (a == current_cd_sound) {
  		current_cd_sound = 0;
! 		_system->stop_cdrom();
  	}
  
***************
*** 324,328 ****
  	if (current_cd_sound != 0) {
  		current_cd_sound = 0;
! 		cd_stop();
  	}
  
--- 323,327 ----
  	if (current_cd_sound != 0) {
  		current_cd_sound = 0;
! 		_system->stop_cdrom();
  	}
  

Index: system.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/system.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** system.h	16 Apr 2002 12:07:18 -0000	1.8
--- system.h	16 Apr 2002 12:18:50 -0000	1.9
***************
*** 95,98 ****
--- 95,111 ----
  	virtual uint32 property(int param, uint32 value) = 0;
  		
+ 	// Poll cdrom status
+ 	// Returns true if cd audio is playing
+ 	virtual bool poll_cdrom();
+ 
+ 	// Play cdrom audio track
+ 	virtual void play_cdrom(int track, int num_loops, int start_frame, int end_frame);
+ 
+ 	// Stop cdrom audio track
+ 	virtual void stop_cdrom();
+ 
+ 	// Update cdrom audio status
+ 	virtual void update_cdrom();
+ 
  	// Quit
  	virtual void quit() = 0;

Index: vars.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/vars.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** vars.cpp	11 Apr 2002 17:19:15 -0000	1.6
--- vars.cpp	16 Apr 2002 12:18:50 -0000	1.7
***************
*** 98,108 ****
  	VAR_MI1_TIMER = 14;
  
- 	//if (_features & GF_OLD256) {
  	VAR_V5_OBJECT_LO = 15;
  	VAR_V5_OBJECT_HI = 16;
- 	/*} else {
- 	   VAR_V5_OBJECT_LO = 16;
- 	   VAR_V5_OBJECT_HI = 15;
- 	   } */
  
  	VAR_V5_TALK_STRING_Y = 54;
--- 98,103 ----

--- cdmusic.h DELETED ---





More information about the Scummvm-git-logs mailing list