Ticket #7930: mi1_cdmusic.diff
File mi1_cdmusic.diff, 13.7 KB (added by , 23 years ago) |
---|
-
CVS/Entries
diff -ruN scummvm/CVS/Entries scumm_cd/CVS/Entries
old new 34 34 /verbs.cpp/1.12/Thu Dec 27 17:51:58 2001// 35 35 /whatsnew.txt/1.3/Sun Jan 13 19:49:26 2002// 36 36 /windows.cpp/1.24/Fri Dec 28 15:26:28 2001// 37 D 37 D/PocketSCUMM//// 38 D/debian//// 39 D/sound//// 40 D/wince//// 41 D/scummvm//// -
CVS/Entries.Log
diff -ruN scummvm/CVS/Entries.Log scumm_cd/CVS/Entries.Log
old new 1 A D/PocketSCUMM////2 A D/debian////3 A D/sound////4 A D/wince//// -
Makefile
diff -ruN scummvm/Makefile scumm_cd/Makefile
old new 15 15 saveload.o script.o scummvm.o sound.o string.o \ 16 16 sys.o verbs.o sdl.o script_v1.o script_v2.o debug.o gui.o \ 17 17 sound/imuse.o sound/fmopl.o sound/adlib.o sound/gmidi.o debugrl.o \ 18 akos.o 18 akos.o sound/cdmusic.o 19 19 20 20 DISTFILES=$(OBJS:.o=.cpp) Makefile scumm.h scummsys.h stdafx.h stdafx.cpp \ 21 21 windows.cpp debugrl.h whatsnew.txt readme.txt copying.txt \ -
PocketSCUMM/CVS/Entries
diff -ruN scummvm/PocketSCUMM/CVS/Entries scumm_cd/PocketSCUMM/CVS/Entries
old new 1 D 1 D/gapi//// 2 D/missing//// -
PocketSCUMM/CVS/Entries.Log
diff -ruN scummvm/PocketSCUMM/CVS/Entries.Log scumm_cd/PocketSCUMM/CVS/Entries.Log
old new 1 A D/gapi////2 A D/missing//// -
PocketSCUMM/missing/CVS/Entries
diff -ruN scummvm/PocketSCUMM/missing/CVS/Entries scumm_cd/PocketSCUMM/missing/CVS/Entries
old new 1 D 1 D/sys//// -
PocketSCUMM/missing/CVS/Entries.Log
diff -ruN scummvm/PocketSCUMM/missing/CVS/Entries.Log scumm_cd/PocketSCUMM/missing/CVS/Entries.Log
old new 1 A D/sys//// -
debug.cpp
diff -ruN scummvm/debug.cpp scumm_cd/debug.cpp
old new 26 26 #include "stdafx.h" 27 27 #include "scumm.h" 28 28 29 #include "cdmusic.h" 30 29 31 #ifdef HAVE_READLINE 30 32 #include "debugrl.h" 31 33 #endif … … 38 40 CMD_ACTOR, 39 41 CMD_SCRIPTS, 40 42 CMD_LOAD_ROOM, 43 CMD_CD_INFO, 41 44 CMD_EXIT 42 45 }; 43 46 … … 68 71 "(a)ctor [actornum] -> show actor information\n" 69 72 "(r)oom roomnum -> load room\n" 70 73 "(s)cripts -> show running scripts\n" 74 "(c)dinfo -> show cd and track info\n" 71 75 "(e)xit -> exit game\n" 72 76 ); 73 77 return true; … … 102 106 } 103 107 return true; 104 108 109 /*-------------------------------------------------------------------------*/ 110 /*CD Music related commands added by realmz for use with Monkey Island 1 111 and for Loom (When Loom support is added and it SHOULD be sooner!) */ 112 113 case CMD_CD_INFO: 114 cd_print_info(); 115 return true; 116 117 /*-------------------------------------------------------------------------*/ 118 105 119 case CMD_EXIT: 106 120 exit(1); 107 121 } … … 144 158 { "a", 1, CMD_ACTOR }, 145 159 { "s", 1, CMD_SCRIPTS }, 146 160 { "r", 1, CMD_LOAD_ROOM }, 161 { "c", 1, CMD_CD_INFO }, 147 162 { "e", 1, CMD_EXIT }, 148 163 { 0, 0, 0 }, 149 164 }; -
debugrl.cpp
diff -ruN scummvm/debugrl.cpp scumm_cd/debugrl.cpp
old new 10 10 "go", 11 11 "actor", 12 12 "scripts", 13 "cdinfo", 13 14 "exit", 14 15 (char *)NULL 15 16 }; -
scummvm.cpp
diff -ruN scummvm/scummvm.cpp scumm_cd/scummvm.cpp
old new 23 23 #include "scumm.h" 24 24 #include "gui.h" 25 25 26 #include "cdmusic.h" 27 26 28 void Scumm::initRandSeeds() { 27 29 _randSeed1 = 0xA943DE35; 28 30 _randSeed2 = 0x37A9ED27; … … 202 204 // if (_gameId==GID_MONKEY2 && _bootParam==0) { 203 205 // _bootParam = 10001; 204 206 // } 207 208 //Init CD Music if Monkey Island 1 209 if(_gameId==GID_MONKEY) { 210 cd_init(0); //Init for MI1 211 212 } 205 213 206 214 initGraphics(this, _fullScreen); 207 215 -
sdl.cpp
diff -ruN scummvm/sdl.cpp scumm_cd/sdl.cpp
old new 27 27 #include "sound.h" 28 28 #include "SDL_thread.h" 29 29 30 #include "cdmusic.h" 31 30 32 #define SCALEUP_2x2 31 33 32 34 Scumm scumm; … … 98 100 s->_saveLoadFlag = 2; 99 101 s->_saveLoadCompatible = false; 100 102 } else if (event.key.keysym.sym=='z' && event.key.keysym.mod&KMOD_CTRL) { 103 cd_stop(); //Stop music on exit 101 104 exit(1); 102 105 } else if (event.key.keysym.sym=='f' && event.key.keysym.mod&KMOD_CTRL) { 103 106 s->_fastMode ^= 1; … … 149 152 break; 150 153 151 154 case SDL_QUIT: 155 cd_stop(); //Stop music on exit 152 156 exit(1); 153 157 break; 154 158 } 155 159 } 160 161 cd_music_loop(); //Loop CD Music 156 162 157 163 if (SDL_GetTicks() >= start_time + msec_delay) 158 164 break; -
sound/cdmusic.cpp
diff -ruN scummvm/sound/cdmusic.cpp scumm_cd/sound/cdmusic.cpp
old new 1 /* ScummVM - Scumm Interpreter 2 * Copyright (C) 2001 Ludvig Strigeus 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 * ------------------------------------------------------------------------- 19 * 20 * The Secret of Monkey Island uses audio tracks from a CD-ROM for music. 21 * This file adds FULL support for CD music for Monkey Island through 22 * custom mapping of sounds to tracks. There is NO purpose and mabye 23 * no way to know how SCUMM originally mapped the sounds. 24 * This will also be used to support music and voice for Loom WHEN 25 * Loom is supported. 26 * 27 * By: realmz <realmi2@yahoo.com> 28 * 29 * ------------------------------------------------------------------------- 30 */ 31 32 #include <SDL.h> 33 34 #include "cdmusic.h" 35 36 37 #define MAX_MI1_TRACKS 26 //Maximum number of tracks for MI1 38 39 //Stores a sound number for each track 40 int mi1_sound[MAX_MI1_TRACKS*2] = 41 { 42 1,115, //Voodoo 43 2,114, //Jail 44 2,107, //Saving Elaine (Unsure if correct track) 45 3,109, //Forest 46 3,107, //Saving Elaine (Unsure if correct track) 47 4,103, //Chapel 48 5,112, //Melee Island Map 49 6,104, //Part x (room changed too fast to hear all) 50 7,117, //Guybrush & Elaine 51 8,101, //SCUMM Bar 52 10,119, //Meanwhile... (Returned to MI) 53 9,111, //On LeCheck's Ship 54 10,100, //Meanwhile... (A Problem...) 55 11,113, //Circus 56 14,116, //Monkey Island Map 57 14,128, //Monkey Island Map 58 15,105, //Voyage 59 // 15,102, //Voyage (Commented out to prevent restarting track) 60 17,110, //Intro 61 17,108, //Intro - Lookout 62 18,121, //Stan's Used Ships 63 19,129, //LeChuck Leaving Melee (Kidnapping) 64 21,127, //Village 65 22,122, //Dock Sounds 66 23,126, //Night Sounds 67 24,123 //Jungle Sounds 68 69 //00,106, // ??? 70 }; 71 72 int cd_current_track, current_sound; 73 74 SDL_CD *cdrom; 75 76 int start_frame,length; //For Loom Support 77 78 int game_type; 79 80 int cd_init(int game) 81 { 82 83 if (SDL_Init (SDL_INIT_CDROM) < 0) 84 { 85 printf ("Failed to open CD-ROM: %s\n", SDL_GetError ()); 86 return -1; 87 } 88 89 if(!SDL_CDNumDrives()){ 90 printf("No CDROM devices available\n"); 91 return -1; 92 } 93 94 cdrom=SDL_CDOpen(0); 95 96 if(cdrom == NULL) 97 { 98 printf("Couldn't open drive: %s\n", SDL_GetError()); 99 exit(-1); 100 } 101 102 cd_current_track = -1; 103 104 current_sound = -1; 105 106 start_frame = 0; 107 length = 0; 108 109 game_type = game; // 0 is MI1 and 1 is Loom 110 111 return 0; 112 } 113 114 int cd_print_info() 115 { 116 int min,sec,frame; 117 118 if(!cdrom) 119 { 120 printf("No CD Music support for this game.\n"); 121 return -1; 122 } 123 124 FRAMES_TO_MSF(cdrom->cur_frame, &min, &sec, &frame); 125 126 127 printf("| Track # | M:S:F |\n"); 128 printf("| %d | %d:%d:%d |\n",cd_current_track,min,sec,frame); 129 130 printf( 131 "Sound Map:\n" 132 "|---------------|\n" 133 "| Sound | Track |\n" 134 "|---------------|\n"); 135 136 for(int i = 0;i<MAX_MI1_TRACKS*2;i+=2) 137 { 138 if(mi1_sound[i] < 10) 139 printf("| %d | %d |\n",mi1_sound[i+1],mi1_sound[i]); 140 else 141 printf("| %d | %d |\n",mi1_sound[i+1],mi1_sound[i]); 142 } 143 144 printf( "|---------------|\n"); 145 146 return 0; 147 } 148 149 int cd_stop() 150 { 151 if(!cdrom) 152 return -1; 153 154 SDL_CDStop(cdrom); 155 156 cd_current_track = -1; 157 current_sound = -1; 158 159 return 0; 160 } 161 162 int cd_stop(int sound) 163 { 164 165 if(sound == current_sound) 166 return cd_stop(); 167 168 return -1; 169 } 170 171 int cd_play() 172 { 173 if(!cdrom) 174 return -1; 175 176 //cd_stop(); 177 178 SDL_CDStatus (cdrom); //Update SDL_CD 179 180 if(current_sound == 108 && game_type == 0) //Play specific section of track 17 181 { 182 SDL_CDPlayTracks(cdrom,cd_current_track,96*CD_FPS,0,0); 183 return 0; 184 } 185 186 SDL_CDPlayTracks(cdrom,cd_current_track,start_frame,0,length); 187 188 return 0; 189 } 190 191 int cd_track_set(int track) 192 { 193 194 cd_current_track = track; 195 196 return 0; 197 } 198 199 int cd_set_sound(int sound) 200 { 201 202 if(!cdrom) 203 return -1; 204 205 if(game_type == 0) //MI1 206 { 207 208 if(sound == current_sound) //Don't restart the same sound 209 return 0; 210 211 for(int i = 0;i<MAX_MI1_TRACKS*2;i+=2) 212 { 213 214 if(mi1_sound[i+1] == sound) 215 { 216 current_sound = sound; 217 cd_track_set(mi1_sound[i]); 218 cd_play(); 219 return 0; 220 } 221 } 222 223 return -1; 224 } 225 226 else //game_type == 1 which is Loom 227 { 228 //No loom support yet :( 229 } 230 231 } 232 233 int cd_music_loop() 234 { 235 if(!cdrom) 236 return 0; 237 238 SDL_CDStatus (cdrom); //Update SDL_CD 239 240 if(cdrom->cur_track != cd_current_track) 241 { 242 cd_play(); 243 } 244 245 return 0; 246 } -
sound/cdmusic.h
diff -ruN scummvm/sound/cdmusic.h scumm_cd/sound/cdmusic.h
old new 1 /* ScummVM - Scumm Interpreter 2 * Copyright (C) 2001 Ludvig Strigeus 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 * ------------------------------------------------------------------------- 19 * 20 * The Secret of Monkey Island uses audio tracks from a CD-ROM for music. 21 * This file adds FULL support for CD music for Monkey Island through 22 * custom mapping of sounds to tracks. There is NO purpose and mabye 23 * no way to know how SCUMM originally mapped the sounds. 24 * This will also be used to support music and voice for Loom WHEN 25 * Loom is supported. 26 * 27 * By: realmz <realmi2@yahoo.com> 28 * 29 * ------------------------------------------------------------------------- 30 */ 31 32 #ifndef CD_MUSIC_H 33 #define CD_MUSIC_H 34 35 int cd_init(int game); 36 int cd_print_info(); 37 int cd_stop(); 38 int cd_stop(int sound); 39 int cd_play(); 40 int cd_track_set(int track); 41 int cd_set_sound(int sound); 42 int cd_music_loop(); 43 44 #endif 45 -
sound.cpp
diff -ruN scummvm/sound.cpp scumm_cd/sound.cpp
old new 23 23 #include "scumm.h" 24 24 #include "sound.h" 25 25 26 #include "cdmusic.h" 27 26 28 void Scumm::addSoundToQueue(int sound) { 27 29 #if !defined(FULL_THROTTLE) 28 30 _vars[VAR_LAST_SOUND] = sound; … … 90 92 91 93 void Scumm::playSound(int sound) { 92 94 SoundEngine *se = (SoundEngine*)_soundEngine; 95 96 //Set the sound for CD Music, if it's not for music then uses resources. 97 if(cd_set_sound(sound) == 0) 98 return; 99 93 100 if (se) { 94 101 getResourceAddress(rtSound, sound); 95 102 se->start_sound(sound); … … 239 246 for (i=0; i<10; i++) 240 247 if (_soundQue2[i] == (byte)a) 241 248 _soundQue2[i] = 0; 249 250 cd_stop(a); 251 242 252 } 243 253 244 254 void Scumm::stopAllSounds() { -
wince/CVS/Entries
diff -ruN scummvm/wince/CVS/Entries scumm_cd/wince/CVS/Entries
old new 7 7 /screen.cpp/1.1.1.1/Sun Nov 18 10:24:47 2001// 8 8 /screen.h/1.1.1.1/Sun Nov 18 10:24:47 2001// 9 9 /sdl.h/1.1.1.1/Sun Nov 18 10:24:47 2001// 10 D 10 D/missing//// -
wince/CVS/Entries.Log
diff -ruN scummvm/wince/CVS/Entries.Log scumm_cd/wince/CVS/Entries.Log
old new 1 A D/missing//// -
wince/missing/CVS/Entries
diff -ruN scummvm/wince/missing/CVS/Entries scumm_cd/wince/missing/CVS/Entries
old new 10 10 /signal.h/1.1.1.1/Sun Nov 18 10:24:48 2001// 11 11 /time.h/1.1.1.1/Sun Nov 18 10:24:48 2001// 12 12 /unistd.h/1.1.1.1/Sun Nov 18 10:24:48 2001// 13 D 13 D/sys//// -
wince/missing/CVS/Entries.Log
diff -ruN scummvm/wince/missing/CVS/Entries.Log scumm_cd/wince/missing/CVS/Entries.Log
old new 1 A D/sys////