aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorJames Brown2003-01-02 10:36:17 +0000
committerJames Brown2003-01-02 10:36:17 +0000
commit9df455ce380f4a7389ca093dfd619761c3bea046 (patch)
treedd539999845c443a135ed04370e1ca22342cbc7f /scumm
parent3c3c5bb57467d4bcef2c71c923dd9cacc49217f2 (diff)
downloadscummvm-rg350-9df455ce380f4a7389ca093dfd619761c3bea046.tar.gz
scummvm-rg350-9df455ce380f4a7389ca093dfd619761c3bea046.tar.bz2
scummvm-rg350-9df455ce380f4a7389ca093dfd619761c3bea046.zip
Plop in some better disk switching code for CMI - I have no idea how well this will work transitioning from a disk1 room to a disk2
room in-game, but it works for bootparams and saved games.. svn-id: r6322
Diffstat (limited to 'scumm')
-rw-r--r--scumm/resource.cpp39
-rw-r--r--scumm/scumm.h4
-rw-r--r--scumm/scummvm.cpp12
-rw-r--r--scumm/sound.cpp14
4 files changed, 45 insertions, 24 deletions
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index 9788207ff3..0d7d719848 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -27,9 +27,8 @@
#include "scumm/sound.h"
#include "common/map.h"
#include "common/str.h"
-
-#include <stdio.h>
-
+#include "gui/message.h"
+#include "dialogs.h"
uint16 newTag2Old(uint32 oldTag);
@@ -75,9 +74,11 @@ void Scumm::openRoom(int room)
}
if (!(_features & GF_SMALL_HEADER)) {
- if (_features & GF_AFTER_V7)
+ if (_features & GF_AFTER_V7) {
+ if (room > 0)
+ _vars[VAR_CURRENTDISK] = res.roomno[rtRoom][room];
sprintf(buf, "%s.la%d", _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
- else if (_features & GF_HUMONGOUS)
+ } else if (_features & GF_HUMONGOUS)
sprintf(buf, "%s.he%.1d", _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
else
sprintf(buf, "%s.%.3d", _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
@@ -90,10 +91,10 @@ void Scumm::openRoom(int room)
if (openResourceFile(buf)) {
return;
}
- askForDisk(buf);
+ askForDisk(buf, room == 0 ? 0 : res.roomno[rtRoom][room]);
} else {
- sprintf(buf, "disk%.2d.lec", res.roomno[rtRoom][room]);
+ sprintf(buf, "disk%.2d.lec", room == 0 ? 0 : res.roomno[rtRoom][room]);
_encbyte = 0x69;
}
} else {
@@ -115,7 +116,7 @@ void Scumm::openRoom(int room)
error("Room %d not in %s", room, buf);
return;
}
- askForDisk(buf);
+ askForDisk(buf, room == 0 ? 0 : res.roomno[rtRoom][room]);
}
do {
@@ -123,7 +124,7 @@ void Scumm::openRoom(int room)
_encbyte = 0;
if (openResourceFile(buf))
break;
- askForDisk(buf);
+ askForDisk(buf, room == 0 ? 0 : res.roomno[rtRoom][room]);
} while (1);
deleteRoomOffsets();
@@ -199,9 +200,25 @@ bool Scumm::openResourceFile(const char *filename)
return _fileHandle.isOpen();
}
-void Scumm::askForDisk(const char *filename)
+void Scumm::askForDisk(const char *filename, int disknum)
{
- error("ask Cannot find '%s'", filename);
+ char buf[128];
+
+ if (_features & GF_AFTER_V8) {
+ char result;
+
+ sprintf(buf, "Cannot find file: '%s'\nInsert disk %d into drive %s\nHit Ok to retry, Cancel to exit", filename, disknum, getResDataPath());
+
+ result = displayError(true, buf);
+ if (result == 2)
+ error("Cannot find file: '%s'", filename);
+ } else {
+ sprintf(buf, "Cannot find file: '%s'", filename);
+ InfoDialog* dialog = new InfoDialog(_newgui, this, (char*)buf);
+ runDialog (dialog);
+ delete dialog;
+ error("Cannot find file: '%s'", filename);
+ }
}
void Scumm::readIndexFile()
diff --git a/scumm/scumm.h b/scumm/scumm.h
index 716d94927f..edd0c67d77 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -321,7 +321,7 @@ public:
void pauseDialog();
void saveloadDialog();
void optionsDialog();
- void displayError(const char *message, ...);
+ char displayError(bool showCancel, const char *message, ...);
// Misc startup/event functions
void main();
@@ -512,7 +512,7 @@ public:
void closeRoom();
void deleteRoomOffsets();
void readRoomsOffsets();
- void askForDisk(const char *filename);
+ void askForDisk(const char *filename, int disknum);
bool openResourceFile(const char *filename);
void loadPtrToResource(int type, int i, byte *ptr);
void readResTypeList(int id, uint32 tag, const char *name);
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index 7299b046e0..b0c4a53f47 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -474,7 +474,7 @@ int Scumm::scummLoop(int delta)
makeSavegameName(filename, _saveLoadSlot, _saveLoadCompatible);
if (!success) {
- displayError(errMsg, filename);
+ displayError(false, errMsg, filename);
} else if (_saveLoadFlag == 1 && _saveLoadSlot != 0 && !_saveLoadCompatible) {
// Display "Save succesful" message, except for auto saves
char buf[1024];
@@ -1065,18 +1065,20 @@ void Scumm::optionsDialog()
runDialog(_optionsDialog);
}
-void Scumm::displayError(const char *message, ...)
+char Scumm::displayError(bool showCancel, const char *message, ...)
{
- char buf[1024];
+ char buf[1024], result;
va_list va;
va_start(va, message);
vsprintf(buf, message, va);
va_end(va);
- Dialog *dialog = new MessageDialog(_newgui, buf);
- runDialog(dialog);
+ Dialog *dialog = new MessageDialog(_newgui, buf, 0, true, showCancel);
+ result = runDialog(dialog);
delete dialog;
+
+ return result;
}
void Scumm::shutDown(int i)
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 4d4e30ef13..308ba3a03d 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -958,8 +958,10 @@ void Sound::playBundleMusic(char * song) {
// FIXME: we have MUSDISK1.BUN and MUSDISK2.BUN in COMI.
_outputMixerSize = 66150; // ((22050 * 2 * 2) / 4) * 3
if (_scumm->_gameId == GID_CMI) {
+ char bunfile[20];
+ sprintf(bunfile, "musdisk%d.bun", _scumm->_vars[_scumm->VAR_CURRENTDISK]);
printf("Opening bundle\n");
- if (_scumm->_bundle->openMusicFile("musdisk1.bun", _scumm->getGameDataPath()) == false)
+ if (_scumm->_bundle->openMusicFile(bunfile, _scumm->getGameDataPath()) == false)
return;
_outputMixerSize = 88140; // ((22050 * 2 * 2)
} else {
@@ -1123,11 +1125,11 @@ int Sound::playBundleSound(char *sound) {
byte * ptr;
bool result;
- if (_scumm->_gameId == GID_CMI)
- // FIXME: HACK! There are actually two voice files in COMI... I dunno how to do this
- // right, though :-/
- result = _scumm->_bundle->openVoiceFile("voxdisk1.bun", _scumm->getGameDataPath());
- else if (_scumm->_gameId == GID_DIG)
+ if (_scumm->_gameId == GID_CMI) {
+ char voxfile[20];
+ sprintf(voxfile, "voxdisk%d.bun", _scumm->_vars[_scumm->VAR_CURRENTDISK]);
+ result = _scumm->_bundle->openVoiceFile(voxfile, _scumm->getGameDataPath());
+ } else if (_scumm->_gameId == GID_DIG)
result = _scumm->_bundle->openVoiceFile("digvoice.bun", _scumm->getGameDataPath());
else
error("Don't know which bundle file to load");