diff --git a/script_v1.cpp b/script_v1.cpp index b89b3599d85..23aa26cf578 100644 --- a/script_v1.cpp +++ b/script_v1.cpp @@ -2433,10 +2433,14 @@ void Scumm::decodeParseString() { case 7: /* overhead */ string[textSlot].overhead = true; break; - case 8: /* ignore */ - getVarOrDirectWord(0x80); - getVarOrDirectWord(0x40); + case 8: { /* play loom talkie sound - use in other games ? */ + int offset = getVarOrDirectWord(0x80); + int delay = getVarOrDirectWord(0x40); + + if (_gameId == GID_LOOM256) + cd_playtrack(1, offset, delay); break; + } case 15: _messagePtr = _scriptPointer; switch(textSlot) { diff --git a/scumm.h b/scumm.h index 22c47cd4fcc..7976e708d5c 100644 --- a/scumm.h +++ b/scumm.h @@ -2264,3 +2264,4 @@ bool isSfxFinished(); void waitForTimer(Scumm *s, int msec_delay); void setShakePos(Scumm *s, int shake_pos); uint16 newTag2Old(uint32 oldTag); +void cd_playtrack(int track, int offset, int delay); \ No newline at end of file diff --git a/sdl.cpp b/sdl.cpp index d34514863f8..47edb234275 100644 --- a/sdl.cpp +++ b/sdl.cpp @@ -37,6 +37,7 @@ SoundEngine sound; SOUND_DRIVER_TYPE snd_driv; static SDL_Surface *screen; +static SDL_CD *cdrom; static int current_shake_pos; @@ -462,6 +463,11 @@ void fill_sound(void *userdata, Uint8 *stream, int len) { scumm.mixWaves((int16*)stream, len>>1); } +void cd_playtrack(int track, int offset, int delay) { + SDL_CDStatus(cdrom); + SDL_CDPlayTracks(cdrom, track, (offset * 7.5) - 22650, 0, delay * 7.5); +} + int music_thread(Scumm *s) { int old_time, cur_time; @@ -489,6 +495,11 @@ void initGraphics(Scumm *s, bool fullScreen) { exit(1); } + if (SDL_InitSubSystem(SDL_INIT_CDROM) == -1) + cdrom = NULL; + else + cdrom = SDL_CDOpen(0); + /* Clean up on exit */ atexit(SDL_Quit); diff --git a/windows.cpp b/windows.cpp index 6b1f55c87fc..d44b665c526 100644 --- a/windows.cpp +++ b/windows.cpp @@ -461,6 +461,10 @@ void fill_buffer(int16 *buf, int len) { scumm.mixWaves(buf, len); } +void cd_playtrack(int track, int offset, int delay) { // FIXME: Add for Win32 +; +} + void WndMan::prepare_header(WAVEHDR *wh, int i) { memset(wh, 0, sizeof(WAVEHDR)); wh->lpData = (char*)malloc(BUFFER_SIZE);