aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Brown2002-03-16 05:33:25 +0000
committerJames Brown2002-03-16 05:33:25 +0000
commit3308d6b9dac03cc16e2e18212809fa2f45010f5f (patch)
tree49bf5b9a5bc014f2d0dabae19b6b48549bf9fdd2
parent829bad142c2757a7025c292055bd769dd87f2995 (diff)
downloadscummvm-rg350-3308d6b9dac03cc16e2e18212809fa2f45010f5f.tar.gz
scummvm-rg350-3308d6b9dac03cc16e2e18212809fa2f45010f5f.tar.bz2
scummvm-rg350-3308d6b9dac03cc16e2e18212809fa2f45010f5f.zip
Lots of stuff - GUI fixes. More launcher work... and CD music working in MI1. Thanks to frob and realmz for their work on that.
svn-id: r3762
-rw-r--r--dc/dcmain.cpp10
-rw-r--r--gui.cpp88
-rw-r--r--gui.h40
-rw-r--r--mac/mac.cpp10
-rw-r--r--object.cpp7
-rw-r--r--resource.cpp12
-rw-r--r--scumm.h4
-rw-r--r--scummvm.dsp8
-rw-r--r--sdl.cpp84
-rw-r--r--sound.cpp33
-rw-r--r--wince/pocketpc.cpp10
-rw-r--r--windows.cpp16
12 files changed, 264 insertions, 58 deletions
diff --git a/dc/dcmain.cpp b/dc/dcmain.cpp
index 8100b29bae..0e3c92ed56 100644
--- a/dc/dcmain.cpp
+++ b/dc/dcmain.cpp
@@ -36,9 +36,15 @@ Icon icon;
SoundEngine sound;
SOUND_DRIVER_TYPE snd_driv;
-
+/* CD Audio 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;}
void cd_playtrack(int track, int offset, int delay) {
- /* Not implemented yet => stub function */
+
+void launcherLoop() {
+ /* No launcher on DC yet => stub function */
}
void BoxTest(int num) {
diff --git a/gui.cpp b/gui.cpp
index 62852eded2..2a5dae201d 100644
--- a/gui.cpp
+++ b/gui.cpp
@@ -44,7 +44,8 @@ enum {
SOUND_DIALOG,
KEYS_DIALOG,
OPTIONS_DIALOG,
- ABOUT_DIALOG
+ ABOUT_DIALOG,
+ LAUNCHER_DIALOG
};
@@ -97,7 +98,9 @@ const GuiWidget *Gui::widgetFromPos(int x, int y) {
void Gui::drawChar(const char str, int xx, int yy) {
unsigned int buffer, mask = 0, x, y;
byte *tmp;
-
+ int tempc = _color;
+ _color = _textcolor;
+
tmp = &guifont[0];
tmp += 224 + (str + 1)*8;
@@ -107,9 +110,10 @@ void Gui::drawChar(const char str, int xx, int yy) {
if ((mask >>= 1) == 0) {buffer = *tmp++; mask = 0x80;}
color = ((buffer & mask) != 0);
if (color)
- hline(xx + x, yy + y, yy + y + 1);
+ vline(xx + x, yy + y, yy + y);
}
}
+ _color = tempc;
}
void Gui::drawString(const char *str, int x, int y, int w, byte color, bool center) {
@@ -133,7 +137,7 @@ void Gui::drawString(const char *str, int x, int y, int w, byte color, bool cent
void Gui::drawWidget(const GuiWidget *w) {
const char *s;
int x,y;
-
+
x = w->_x;
y = w->_y;
@@ -177,10 +181,12 @@ void Gui::drawWidget(const GuiWidget *w) {
#endif
}
- if (*text)
+ if (*text) {
+ printf("drawString(%s)\n", text);
drawString(text, x+_parentX, y+_parentY, w->_w,
(_clickWidget && _clickWidget==w->_id) ? _textcolorhi : _textcolor,
false);
+ }
break;
}
case GUI_IMAGE:
@@ -317,6 +323,13 @@ void Gui::leftMouseClick(int x, int y) {
if (_dialog == PAUSE_DIALOG)
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 },
@@ -352,7 +365,7 @@ const GuiWidget keys_dialog[] = {
//OK
{GUI_RESTEXT, 0x01, GWF_BUTTON, 30 + 113, 10 + 106, 54, 16, 60, 9 },
- {0}
+ {0,0,0,0,0,0,0,0,0}
};
@@ -363,7 +376,7 @@ const GuiWidget about_dialog[] = {
{GUI_CUSTOMTEXT, 0x01, 0, 30 + 10, 20 + 10 + 15 + 5 + 15, 230, 15, 0, 10}, // ScummVM Url
{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,0}
};
const GuiWidget options_dialog[] = {
@@ -371,7 +384,7 @@ const GuiWidget options_dialog[] = {
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 50 + 10 , 80 + 10, 40, 15, 1, 5}, // Sound
{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,0}
};
const GuiWidget sound_dialog[] = {
@@ -387,7 +400,7 @@ const GuiWidget sound_dialog[] = {
{GUI_VARTEXT, 0x01, GWF_BUTTON, 30 + 73, 20 + 25 + 25 + 11, 128, 15, 23, 2}, // SFX
{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,0}
};
const GuiWidget save_load_dialog[] = {
@@ -482,6 +495,7 @@ void Gui::handleOptionsDialogCommand(int cmd) {
_widgets[0] = about_dialog;
_active = true;
_cur_page = 0;
+ _return_to = 0;
_dialog = ABOUT_DIALOG;
draw(0, 100);
return;
@@ -514,11 +528,38 @@ void Gui::handleKeysDialogCommand(int cmd) {
#endif
}
+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);
return;
@@ -535,7 +576,14 @@ void Gui::handleCommand(int cmd) {
}
if (_dialog == ABOUT_DIALOG) {
- close();
+ if (_return_to == LAUNCHER_DIALOG) {
+ _widgets[0] = launcher_dialog;
+ _active = true;
+ _cur_page = 0;
+ _dialog = LAUNCHER_DIALOG;
+ draw(0, 100);
+ } else
+ close();
return;
}
@@ -706,7 +754,7 @@ void Gui::addLetter(byte letter) {
}
byte Gui::getDefaultColor(int color) {
- if(_s->_features & GF_AFTER_V7)
+ if((_s->_features & GF_AFTER_V7) || (_s->_features & GF_SMALL_HEADER))
return 0;
if (_s->_features&GF_AFTER_V6) {
if (color==8) color=1;
@@ -726,10 +774,10 @@ void Gui::init(Scumm *s) {
_shadowcolor = getDefaultColor(8);
} else {
_bgcolor = 0;
- _color = 2;
- _textcolor = 6;
- _textcolorhi = 3;
- _shadowcolor = 2;
+ _color = 0;
+ _textcolor = 8; // 15 is nice
+ _textcolorhi = 15;
+ _shadowcolor = 0;
}
}
@@ -774,6 +822,7 @@ void Gui::close() {
_active = false;
#ifdef _WIN32_WCE
+
// Option dialog can be accessed from the file dialog now, always check
if (draw_keyboard) {
draw_keyboard = false;
@@ -803,3 +852,10 @@ void Gui::options() {
_cur_page = 0;
_dialog = OPTIONS_DIALOG;
}
+
+void Gui::launcher() {
+ _widgets[0] = launcher_dialog;
+ _active = true;
+ _cur_page = 0;
+ _dialog = LAUNCHER_DIALOG;
+}
diff --git a/gui.h b/gui.h
index 2056b45dbe..f210fd2032 100644
--- a/gui.h
+++ b/gui.h
@@ -23,24 +23,24 @@ enum {
};
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"
+ "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
};
static const byte string_map_table_v6[] = {
@@ -84,6 +84,7 @@ struct GuiWidget {
struct Gui {
Scumm *_s;
const GuiWidget *_widgets[4];
+ int _return_to;
int _curX, _curY;
VirtScreen *_vs;
byte _color,_shadowcolor;
@@ -137,11 +138,12 @@ struct Gui {
void saveLoadDialog();
void pause();
void options();
+ void launcher();
void handleSoundDialogCommand(int cmd);
void handleOptionsDialogCommand(int cmd);
void handleKeysDialogCommand(int cmd);
-
+ void handleLauncherDialogCommand(int cmd);
};
// Built-in font
diff --git a/mac/mac.cpp b/mac/mac.cpp
index 7d32c4c21a..55c865a47d 100644
--- a/mac/mac.cpp
+++ b/mac/mac.cpp
@@ -866,8 +866,14 @@ void Preferences()
osError = RunAppModalLoopForWindow(prefsWin);
}
-void cd_playtrack(int track, int offset, int delay) {
- /* No CD Playback in the Mac-Version right now */
+/* 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;}
+
+void launcherLoop() {
+ /* No launcher on mac yet => stub function */
}
void BoxTest(int num) {
diff --git a/object.cpp b/object.cpp
index 5c93f0f9d2..e2d19386e4 100644
--- a/object.cpp
+++ b/object.cpp
@@ -672,7 +672,8 @@ byte *Scumm::getObjOrActorName(int obj) {
byte offset;
objptr = getOBCDFromObject(obj);
- offset = *(objptr+18);
+ if (objptr)
+ offset = *(objptr+18);
return(objptr+offset);
}
@@ -901,7 +902,7 @@ void Scumm::setOwnerOf(int obj, int owner) {
int Scumm::getObjX(int obj) {
if (obj < NUM_ACTORS) {
- if (obj==0)
+ if (obj<1)
return 0; /* fix for indy4's map */
return derefActorSafe(obj,"getObjX")->x;
} else {
@@ -914,7 +915,7 @@ int Scumm::getObjX(int obj) {
int Scumm::getObjY(int obj) {
if (obj < NUM_ACTORS) {
- if (obj==0)
+ if (obj<1)
return 0; /* fix for indy4's map */
return derefActorSafe(obj,"getObjY")->y;
} else {
diff --git a/resource.cpp b/resource.cpp
index a362dbbc03..304e8c87ab 100644
--- a/resource.cpp
+++ b/resource.cpp
@@ -666,7 +666,7 @@ int Scumm::readSoundResource(int type, int idx) {
fileRead(_fileHandle,createResource(type, idx, total_size+8), total_size+8);
return 1;
}
- } else {
+ } else if (basetag == MKID('SOU ')) {
best_pri = -1;
while (pos < total_size) {
tag = fileReadDword();
@@ -697,6 +697,16 @@ int Scumm::readSoundResource(int type, int idx) {
fileRead(_fileHandle,createResource(type, idx, best_size), best_size);
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;
return 0;
diff --git a/scumm.h b/scumm.h
index 581e89fbe8..36fa6005ab 100644
--- a/scumm.h
+++ b/scumm.h
@@ -1204,7 +1204,9 @@ struct Scumm {
OffsetTable *offset_table;
int num_sound_effects;
#endif
-
+
+ int current_cd_sound;
+
void openRoom(int room);
void deleteRoomOffsets();
void readRoomsOffsets();
diff --git a/scummvm.dsp b/scummvm.dsp
index b2d6102b63..aa23a217ba 100644
--- a/scummvm.dsp
+++ b/scummvm.dsp
@@ -68,7 +68,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# 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
+# 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"
# ADD RSC /l 0x41d /d "_DEBUG"
@@ -77,7 +77,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
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
+# 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"
@@ -415,6 +415,10 @@ SOURCE=.\sound\fmopl.h
# End Source File
# Begin Source File
+SOURCE=.\sound\gmidi.h
+# End Source File
+# Begin Source File
+
SOURCE=.\gui.h
# End Source File
# Begin Source File
diff --git a/sdl.cpp b/sdl.cpp
index cf3cce6b36..4535e85f27 100644
--- a/sdl.cpp
+++ b/sdl.cpp
@@ -27,6 +27,8 @@
#include "sound.h"
#include "SDL_thread.h"
+#include "cdmusic.h"
+
static unsigned int scale;
Scumm scumm;
@@ -176,6 +178,8 @@ void waitForTimer(Scumm *s, int msec_delay) {
}
}
+ cd_music_loop(); // Loop CD Music if necessary
+
if (SDL_GetTicks() >= start_time + msec_delay)
break;
SDL_Delay(10);
@@ -663,8 +667,81 @@ void fill_sound(void *userdata, Uint8 *stream, int len) {
}
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));
+ 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;
+ }
}
int music_thread(Scumm *s) {
@@ -703,6 +780,7 @@ void initGraphics(Scumm *s, bool fullScreen, unsigned int scaleFactor) {
/* Clean up on exit */
atexit(SDL_Quit);
+ atexit(cd_shutdown);
atexit(resetCursor);
char buf[512], *gameName;
@@ -777,7 +855,7 @@ void launcherLoop() {
int delta = 0;
last_time = SDL_GetTicks();
- gui.saveLoadDialog();
+ gui.launcher();
do {
updateScreen(&scumm);
diff --git a/sound.cpp b/sound.cpp
index 104af5bfce..50b36e2884 100644
--- a/sound.cpp
+++ b/sound.cpp
@@ -22,6 +22,7 @@
#include "stdafx.h"
#include "scumm.h"
#include "sound.h"
+#include "cdmusic.h"
#ifdef _WIN32_WCE
extern void *bsearch(const void *, const void *, size_t,
@@ -98,7 +99,18 @@ void Scumm::processSoundQues() {
}
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 */
if (se) {
@@ -171,6 +183,7 @@ void Scumm::startTalkSound(uint32 offset, uint32 b, int mode) {
key.org_offset = offset;
result = (OffsetTable *) bsearch(&key, offset_table, num_sound_effects, sizeof(OffsetTable), compar);
+
if (result == NULL) {
warning("startTalkSound: did not find sound at offset %d !", offset);
return;
@@ -233,6 +246,9 @@ int Scumm::isSoundRunning(int sound) {
SoundEngine *se;
int i;
+ if (sound == current_cd_sound)
+ return cd_is_running();
+
i = _soundQue2Pos;
while (i--) {
if (_soundQue2[i] == sound)
@@ -275,6 +291,11 @@ void Scumm::stopSound(int a) {
SoundEngine *se;
int i;
+ if (a == current_cd_sound) {
+ current_cd_sound = 0;
+ cd_stop();
+ }
+
se = (SoundEngine*)_soundEngine;
if (se)
se->stop_sound(a);
@@ -286,6 +307,12 @@ void Scumm::stopSound(int a) {
void Scumm::stopAllSounds() {
SoundEngine *se = (SoundEngine*)_soundEngine;
+
+ if (current_cd_sound != 0) {
+ current_cd_sound = 0;
+ cd_stop();
+ }
+
if (se) {
se->stop_all_sounds();
se->clear_queue();
@@ -550,10 +577,16 @@ void Scumm::playSfxSound_MP3(void *sound, uint32 size) {
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);
mad_synth_init(&mc->sound_data.mp3.synth);
diff --git a/wince/pocketpc.cpp b/wince/pocketpc.cpp
index 583d0a8181..7defdd1827 100644
--- a/wince/pocketpc.cpp
+++ b/wince/pocketpc.cpp
@@ -33,6 +33,7 @@
#include "commctrl.h"
#include <Winuser.h>
+
#include <Winnls.h>
#include <sipapi.h>
#include <Aygshell.h>
@@ -45,6 +46,7 @@
#include "SDL_timer.h"
#include "SDL_thread.h"
+
#define VERSION "(VM " SCUMMVM_CVS ")"
#define SHMenuBar_GetMenu(hWndMB,ID_MENU) (HMENU)SendMessage((hWndMB), SHCMBM_GETSUBMENU, (WPARAM)0, (LPARAM)ID_MENU)
@@ -1020,7 +1022,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLin
void setShakePos(Scumm *s, int shake_pos) {}
// TODO : switch to MP3 support
void cd_playtrack(int track, int offset, int delay) {}
-// Never happening on Pocket version
-void launcherLoop() {}
+// Never happening on Pocket version
+void launcherLoop() {;}
+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;} \ No newline at end of file
diff --git a/windows.cpp b/windows.cpp
index 5d43000ce4..3841d0d8a1 100644
--- a/windows.cpp
+++ b/windows.cpp
@@ -23,6 +23,7 @@
#include "scumm.h"
#include "sound.h"
+#include "cdmusic.h"
#include "gui.h"
#if !defined(ALLOW_GDI)
@@ -113,6 +114,7 @@ WndMan wm[1];
byte veryFastMode;
void modifyslot(int sel, int what);
+void launcherLoop() {;}
int mapKey(int key) {
if (key>=VK_F1 && key<=VK_F9) {
@@ -121,6 +123,12 @@ int mapKey(int key) {
return key;
}
+// 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);
@@ -408,9 +416,7 @@ void outputdisplay2(Scumm *s, int disp) {
}
void blitToScreen(Scumm *s, byte *src,int x, int y, int w, int h) {
- byte *dst;
- SDL_Rect *r;
- int i;
+ byte *dst;
dst = (byte*)wm->_vgabuf + y*320 + x;
@@ -462,10 +468,6 @@ 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);