Whitespace changes

svn-id: r10390
This commit is contained in:
Torbjörn Andersson 2003-09-24 06:33:59 +00:00
parent 3854ce8f3d
commit 570e60a487
30 changed files with 1289 additions and 1356 deletions

View file

@ -212,9 +212,7 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
str[len] = '\0';
char *completion = 0;
if ((*_completionCallbackProc)(this, str, completion,
_callbackRefCon))
{
if ((*_completionCallbackProc)(this, str, completion, _callbackRefCon)) {
if (_caretVisible)
drawCaret(true);
insertIntoPrompt(completion);
@ -268,7 +266,6 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
_currentPos--;
draw();
break;
default:
if (ascii == '~' || ascii == '#') {
close();

View file

@ -147,7 +147,7 @@ void NewGui::runLoop() {
uint32 time = get_time();
while (_system->poll_event(&event)) {
switch(event.event_code) {
switch (event.event_code) {
case OSystem::EVENT_KEYDOWN:
#if !defined(_WIN32_WCE) && !defined(__PALM_OS__)
// init continuous event stream

View file

@ -283,7 +283,6 @@ bool ScummDebugger::RunCommand(const char *inputOrig) {
*(int *)_dvars[i].variable = atoi(param[1]);
Debug_Printf("(int)%s = %d\n", param[0], *(int *)_dvars[i].variable);
break;
// Integer Array
case DVAR_INTARRAY: {
char *chr = strchr(param[0], '[');
@ -297,12 +296,10 @@ bool ScummDebugger::RunCommand(const char *inputOrig) {
} else {
var[element] = atoi(param[1]);
Debug_Printf("(int)%s = %d\n", param[0], var[element]);
}
}
}
break;
default:
Debug_Printf("Failed to set variable %s to %s - unknown type\n", _dvars[i].name, param[1]);
break;
@ -314,7 +311,6 @@ bool ScummDebugger::RunCommand(const char *inputOrig) {
case DVAR_INT:
Debug_Printf("(int)%s = %d\n", param[0], *(int *)_dvars[i].variable);
break;
// Integer array
case DVAR_INTARRAY: {
char *chr = strchr(param[0], '[');
@ -327,17 +323,14 @@ bool ScummDebugger::RunCommand(const char *inputOrig) {
Debug_Printf("%s is out of range (array is %d elements big)\n", param[0], _dvars[i].optional);
} else {
Debug_Printf("(int)%s = %d\n", param[0], var[element]);
}
}
}
break;
// String
case DVAR_STRING:
Debug_Printf("(string)%s = %s\n", param[0], *(char **)_dvars[i].variable);
break;
default:
Debug_Printf("%s = (unknown type)\n", param[0]);
break;

View file

@ -907,7 +907,7 @@ void Scumm::runInputScript(int a, int cmd, int mode) {
if (_version <= 2) {
verbScript = 4;
_scummVars[VAR_CLICK_AREA] = a;
switch(a) {
switch (a) {
case 1: // Verb clicked
_scummVars[33] = cmd;
break;

View file

@ -695,7 +695,6 @@ void Scumm_v2::o2_actorSet() {
case 1: // Actor Sound
a->sound[0] = arg;
break;
case 2: // Actor Set Color
if (_version == 1)
i = act;
@ -705,15 +704,12 @@ void Scumm_v2::o2_actorSet() {
a->palette[i] = arg;
a->needRedraw = true;
break;
case 3: // Actor Name
loadPtrToResource(rtActorName, a->number, NULL);
break;
case 4: // Actor Costume
a->setActorCostume(arg);
break;
case 5: // Talk Color
if ((_gameId == GID_MANIAC) && (_version == 1))
v1_mm_actor_speech_color[act] = arg;

View file

@ -881,7 +881,6 @@ void Scumm_v5::saveVars() {
b = _resultVarNumber;
warning("stub saveVars: vars %d -> %d", a, b);
break;
case 0x02: // write a range of string variables
a = getVarOrDirectByte(0x80);
b = getVarOrDirectByte(0x40);
@ -900,7 +899,6 @@ void Scumm_v5::saveVars() {
return;
break;
}
}
}
@ -935,9 +933,7 @@ void Scumm_v5::loadVars() {
return;
break;
}
}
}
void Scumm_v5::o5_expression() {

View file

@ -54,8 +54,7 @@ bool SaudChannel::handleSubTags(int32 &offset) {
if (available_size >= (size + 8)) {
MemoryChunk c((byte *)_tbuffer + offset);
handleStrk(c);
}
else
} else
return false;
break;
case TYPE_SMRK:
@ -63,8 +62,7 @@ bool SaudChannel::handleSubTags(int32 &offset) {
if (available_size >= (size + 8)) {
MemoryChunk c((byte *)_tbuffer + offset);
handleSmrk(c);
}
else
} else
return false;
break;
case TYPE_SHDR:
@ -72,8 +70,7 @@ bool SaudChannel::handleSubTags(int32 &offset) {
if (available_size >= (size + 8)) {
MemoryChunk c((byte *)_tbuffer + offset);
handleShdr(c);
}
else
} else
return false;
break;
case TYPE_SDAT:

View file

@ -542,7 +542,7 @@ void SmushPlayer::handleTextResource(Chunk &b) {
}
while (str[0] == '^') {
switch(str[1]) {
switch (str[1]) {
case 'f':
{
int id = str[3] - '0';
@ -753,7 +753,7 @@ void SmushPlayer::handleFrame(Chunk &b) {
while (!b.eof()) {
Chunk *sub = b.subBlock();
if (sub->getSize() & 1) b.seek(1);
switch(sub->getType()) {
switch (sub->getType()) {
case TYPE_NPAL:
handleNewPalette(*sub);
break;
@ -854,7 +854,7 @@ void SmushPlayer::parseNextFrame() {
}
Chunk *sub = _base->subBlock();
switch(sub->getType()) {
switch (sub->getType()) {
case TYPE_FRME:
handleFrame(*sub);
break;

View file

@ -347,9 +347,11 @@ void Sound::playSound(int soundID) {
rate = 11025;
int type = *(ptr + 0x0D);
int numInstruments;
switch(type) {
case 0: { // Sound effect
int numInstruments = *(ptr + 0x14);
case 0: // Sound effect
numInstruments = *(ptr + 0x14);
ptr += 0x16;
size -= 0x16;
while (numInstruments--) {
@ -381,31 +383,31 @@ void Sound::playSound(int soundID) {
_scumm->_mixer->playRaw(NULL, sound, waveSize, rate, flags, soundID, 255, 0, loopStart, loopEnd);
}
break;
}
case 1: { // Music (Euphony format)
case 1:
// Music (Euphony format)
if (_scumm->_musicEngine)
_scumm->_musicEngine->startSound (soundID);
break;
}
case 2: { // CD track resource
case 2: // CD track resource
ptr += 0x16;
int track = ptr[0];
int loops = ptr[1];
int start = (ptr[2] * 60 + ptr[3]) * 75 + ptr[4];
int end = (ptr[5] * 60 + ptr[6]) * 75 + ptr[7];
if (soundID == _currentCDSound)
if (pollCD() == 1)
return;
{
int track = ptr[0];
int loops = ptr[1];
int start = (ptr[2] * 60 + ptr[3]) * 75 + ptr[4];
int end = (ptr[5] * 60 + ptr[6]) * 75 + ptr[7];
playCDTrack(track, loops == 0xff ? -1 : loops, start, end - start);
}
_currentCDSound = soundID;
break;
}
}
}
else if ((_scumm->_gameId == GID_LOOM) && (_scumm->_features & GF_MACINTOSH)) {
// Mac version of Loom uses yet another sound format
/*
@ -1290,11 +1292,9 @@ void Sound::playBundleSound(char *sound, PlayingSoundHandle *handle) {
case MKID_BE('SYNC'):
size = READ_BE_UINT32(ptr); ptr += size + 4;
break;
case MKID_BE('DATA'):
size = READ_BE_UINT32(ptr); ptr += 4;
break;
default:
error("Unknown sound header %c%c%c%c",
(byte)(tag >> 24),

View file

@ -49,7 +49,7 @@ static const byte mt32_to_gm[128] = {
MidiPlayer::MidiPlayer (OSystem *system) {
MidiPlayer::MidiPlayer(OSystem *system) {
// Since initialize() is called every time the music changes,
// this is where we'll initialize stuff that must persist
// between songs.
@ -72,10 +72,10 @@ MidiPlayer::MidiPlayer (OSystem *system) {
}
MidiPlayer::~MidiPlayer() {
_system->lock_mutex (_mutex);
_system->lock_mutex(_mutex);
close();
_system->unlock_mutex (_mutex);
_system->delete_mutex (_mutex);
_system->unlock_mutex(_mutex);
_system->delete_mutex(_mutex);
}
int MidiPlayer::open() {
@ -86,7 +86,7 @@ int MidiPlayer::open() {
int ret = _driver->open();
if (ret)
return ret;
_driver->setTimerCallback (this, &onTimer);
_driver->setTimerCallback(this, &onTimer);
return 0;
}
@ -100,7 +100,7 @@ void MidiPlayer::close() {
// _system->unlock_mutex (_mutex);
}
void MidiPlayer::send (uint32 b) {
void MidiPlayer::send(uint32 b) {
if (!_current)
return;
@ -108,22 +108,22 @@ void MidiPlayer::send (uint32 b) {
if ((b & 0xFFF0) == 0x07B0) {
// Adjust volume changes by master volume.
byte volume = (byte) ((b >> 16) & 0x7F);
_current->volume [channel] = volume;
_current->volume[channel] = volume;
volume = volume * _masterVolume / 255;
b = (b & 0xFF00FFFF) | (volume << 16);
} else if ((b & 0xF0) == 0xC0 && _map_mt32_to_gm) {
b = (b & 0xFFFF00FF) | (mt32_to_gm [(b >> 8) & 0xFF] << 8);
b = (b & 0xFFFF00FF) | (mt32_to_gm[(b >> 8) & 0xFF] << 8);
} else if ((b & 0xFFF0) == 0x007BB0) {
// Only respond to an All Notes Off if this channel
// has already been allocated.
if (!_current->channel [b & 0x0F])
if (!_current->channel[b & 0x0F])
return;
}
if (!_current->channel [channel])
if (!_current->channel[channel])
_current->channel[channel] = (channel == 9) ? _driver->getPercussionChannel() : _driver->allocateChannel();
if (_current->channel [channel])
_current->channel[channel]->send (b);
if (_current->channel[channel])
_current->channel[channel]->send(b);
}
void MidiPlayer::metaEvent (byte type, byte *data, uint16 length) {
@ -131,9 +131,9 @@ void MidiPlayer::metaEvent (byte type, byte *data, uint16 length) {
if (!_current || type != 0x2F) {
return;
} else if (_current == &_sfx) {
clearConstructs (_sfx);
clearConstructs(_sfx);
} else if (_loopTrack) {
_current->parser->jumpToTick (0);
_current->parser->jumpToTick(0);
} else if (_queuedTrack != 255) {
_currentTrack = 255;
byte destination = _queuedTrack;
@ -145,9 +145,9 @@ void MidiPlayer::metaEvent (byte type, byte *data, uint16 length) {
// Have to unlock it before calling jump()
// (which locks it itself), and then relock it
// upon returning.
_system->unlock_mutex (_mutex);
_system->unlock_mutex(_mutex);
startTrack (destination);
_system->lock_mutex (_mutex);
_system->lock_mutex(_mutex);
} else {
stop();
}
@ -155,7 +155,7 @@ void MidiPlayer::metaEvent (byte type, byte *data, uint16 length) {
void MidiPlayer::onTimer (void *data) {
MidiPlayer *p = (MidiPlayer *) data;
p->_system->lock_mutex (p->_mutex);
p->_system->lock_mutex(p->_mutex);
if (!p->_paused) {
if (p->_music.parser && p->_currentTrack != 255) {
p->_current = &p->_music;
@ -167,7 +167,7 @@ void MidiPlayer::onTimer (void *data) {
p->_sfx.parser->onTimer();
}
p->_current = 0;
p->_system->unlock_mutex (p->_mutex);
p->_system->unlock_mutex(p->_mutex);
}
void MidiPlayer::startTrack (int track) {
@ -178,7 +178,7 @@ void MidiPlayer::startTrack (int track) {
if (track >= _music.num_songs)
return;
_system->lock_mutex (_mutex);
_system->lock_mutex(_mutex);
if (_music.parser) {
_current = &_music;
@ -200,29 +200,29 @@ void MidiPlayer::startTrack (int track) {
_currentTrack = (byte) track;
_music.parser = parser; // That plugs the power cord into the wall
} else if (_music.parser) {
_system->lock_mutex (_mutex);
if (!_music.parser->setTrack (track)) {
_system->unlock_mutex (_mutex);
_system->lock_mutex(_mutex);
if (!_music.parser->setTrack(track)) {
_system->unlock_mutex(_mutex);
return;
}
_currentTrack = (byte) track;
_current = &_music;
_music.parser->jumpToTick (0);
_music.parser->jumpToTick(0);
_current = 0;
}
_system->unlock_mutex (_mutex);
_system->unlock_mutex(_mutex);
}
void MidiPlayer::stop() {
_system->lock_mutex (_mutex);
_system->lock_mutex(_mutex);
if (_music.parser) {
_current = &_music;
_music.parser->jumpToTick(0);
}
_current = 0;
_currentTrack = 255;
_system->unlock_mutex (_mutex);
_system->unlock_mutex(_mutex);
}
void MidiPlayer::pause (bool b) {
@ -230,14 +230,14 @@ void MidiPlayer::pause (bool b) {
return;
_paused = b;
_system->lock_mutex (_mutex);
_system->lock_mutex(_mutex);
for (int i = 0; i < 16; ++i) {
if (_music.channel[i])
_music.channel[i]->volume (_paused ? 0 : (_music.volume[i] * _masterVolume / 255));
if (_sfx.channel[i])
_sfx.channel[i]->volume (_paused ? 0 : (_sfx.volume[i] * _masterVolume / 255));
}
_system->unlock_mutex (_mutex);
_system->unlock_mutex(_mutex);
}
void MidiPlayer::set_volume (int volume) {
@ -255,9 +255,9 @@ void MidiPlayer::set_volume (int volume) {
if (_driver && !_paused) {
for (int i = 0; i < 16; ++i) {
if (_music.channel[i])
_music.channel[i]->volume (_music.volume[i] * _masterVolume / 255);
_music.channel[i]->volume(_music.volume[i] * _masterVolume / 255);
if (_sfx.channel[i])
_sfx.channel[i]->volume (_sfx.volume[i] * _masterVolume / 255);
_sfx.channel[i]->volume(_sfx.volume[i] * _masterVolume / 255);
}
}
_system->unlock_mutex (_mutex);
@ -271,45 +271,45 @@ void MidiPlayer::set_driver(MidiDriver *md) {
}
void MidiPlayer::mapMT32toGM (bool map) {
_system->lock_mutex (_mutex);
_system->lock_mutex(_mutex);
_map_mt32_to_gm = map;
_system->unlock_mutex (_mutex);
_system->unlock_mutex(_mutex);
}
void MidiPlayer::setLoop (bool loop) {
_system->lock_mutex (_mutex);
_system->lock_mutex(_mutex);
_loopTrack = loop;
_system->unlock_mutex (_mutex);
_system->unlock_mutex(_mutex);
}
void MidiPlayer::queueTrack (int track, bool loop) {
_system->lock_mutex (_mutex);
_system->lock_mutex(_mutex);
if (_currentTrack == 255) {
_system->unlock_mutex (_mutex);
setLoop (loop);
startTrack (track);
_system->unlock_mutex(_mutex);
setLoop(loop);
startTrack(track);
} else {
_queuedTrack = track;
_loopQueuedTrack = loop;
_system->unlock_mutex (_mutex);
_system->unlock_mutex(_mutex);
}
}
void MidiPlayer::clearConstructs() {
clearConstructs (_music);
clearConstructs (_sfx);
clearConstructs(_music);
clearConstructs(_sfx);
}
void MidiPlayer::clearConstructs (MusicInfo &info) {
void MidiPlayer::clearConstructs(MusicInfo &info) {
int i;
if (info.num_songs > 0) {
for (i = 0; i < info.num_songs; ++i)
free (info.songs [i]);
free (info.songs[i]);
info.num_songs = 0;
}
if (info.data) {
free (info.data);
free(info.data);
info.data = 0;
} // end if
@ -346,15 +346,15 @@ static int simon1_gmf_size[] = {
};
void MidiPlayer::loadSMF (File *in, int song, bool sfx) {
_system->lock_mutex (_mutex);
_system->lock_mutex(_mutex);
MusicInfo *p = sfx ? &_sfx : &_music;
clearConstructs (*p);
uint32 startpos = in->pos();
byte header[4];
in->read (header, 4);
in->read(header, 4);
bool isGMF = !memcmp (header, "GMF\x1", 4);
in->seek (startpos, SEEK_SET);
in->seek(startpos, SEEK_SET);
uint32 size = in->size() - in->pos();
if (isGMF) {
@ -363,29 +363,29 @@ void MidiPlayer::loadSMF (File *in, int song, bool sfx) {
// but each one is referenced by a pointer at the
// beginning of the file. Those pointers can be used
// to determine file size.
in->seek (0, SEEK_SET);
in->seek(0, SEEK_SET);
uint16 value = in->readUint16LE() >> 2; // Number of resources
if (song != value - 1) {
in->seek (song * 2 + 2, SEEK_SET);
in->seek(song * 2 + 2, SEEK_SET);
value = in->readUint16LE();
size = value - startpos;
}
in->seek (startpos, SEEK_SET);
in->seek(startpos, SEEK_SET);
} else if (size >= 64000) {
// For GMF resources not in separate
// files, we're going to have to use
// hardcoded size tables.
size = simon1_gmf_size [song];
size = simon1_gmf_size[song];
}
}
// When allocating space, add 4 bytes in case
// this is a GMF and we have to tack on our own
// End of Track event.
p->data = (byte *) calloc (size + 4, 1);
in->read (p->data, size);
p->data = (byte *) calloc(size + 4, 1);
in->read(p->data, size);
if (!memcmp (p->data, "GMF\x1", 4)) {
if (!memcmp(p->data, "GMF\x1", 4)) {
// BTW, here's what we know about the GMF header,
// the 7 bytes preceding the actual MIDI events.
// 3 BYTES: 'GMF'
@ -394,15 +394,15 @@ void MidiPlayer::loadSMF (File *in, int song, bool sfx) {
// 1 BYTE : Ranges from 0x02 to 0x08 (always 0x02 for SFX, though)
// 1 BYTE : Loop control. 0 = no loop, 1 = loop
if (!sfx)
setLoop (p->data[6] != 0);
setLoop(p->data[6] != 0);
}
MidiParser *parser = MidiParser::createParser_SMF();
parser->property (MidiParser::mpMalformedPitchBends, 1);
parser->setMidiDriver (this);
parser->setTimerRate (_driver->getBaseTempo());
if (!parser->loadMusic (p->data, size)) {
parser->property(MidiParser::mpMalformedPitchBends, 1);
parser->setMidiDriver(this);
parser->setTimerRate(_driver->getBaseTempo());
if (!parser->loadMusic(p->data, size)) {
printf ("Error reading track!\n");
delete parser;
parser = 0;
@ -413,7 +413,7 @@ void MidiPlayer::loadSMF (File *in, int song, bool sfx) {
resetVolumeTable();
}
p->parser = parser; // That plugs the power cord into the wall
_system->unlock_mutex (_mutex);
_system->unlock_mutex(_mutex);
}
void MidiPlayer::loadMultipleSMF (File *in, bool sfx) {
@ -426,14 +426,14 @@ void MidiPlayer::loadMultipleSMF (File *in, bool sfx) {
// We need to load ALL the songs and then
// treat them as separate tracks -- for the
// purpose of jumps, anyway.
_system->lock_mutex (_mutex);
_system->lock_mutex(_mutex);
MusicInfo *p = sfx ? &_sfx : &_music;
clearConstructs (*p);
clearConstructs(*p);
p->num_songs = in->readByte();
if (p->num_songs > 16) {
printf ("playMultipleSMF: %d is too many songs to keep track of!\n", (int) p->num_songs);
_system->unlock_mutex (_mutex);
_system->unlock_mutex(_mutex);
return;
}
@ -443,27 +443,27 @@ void MidiPlayer::loadMultipleSMF (File *in, bool sfx) {
uint32 pos = in->pos();
// Make sure there's a MThd
in->read (buf, 4);
in->read(buf, 4);
if (memcmp (buf, "MThd", 4)) {
printf ("Expected MThd but found '%c%c%c%c' instead!\n", buf[0], buf[1], buf[2], buf[3]);
_system->unlock_mutex (_mutex);
return;
}
in->seek (in->readUint32BE() + in->pos(), SEEK_SET);
in->seek(in->readUint32BE() + in->pos(), SEEK_SET);
// Now skip all the MTrk blocks
while (true) {
in->read (buf, 4);
if (memcmp (buf, "MTrk", 4))
if (memcmp(buf, "MTrk", 4))
break;
in->seek (in->readUint32BE() + in->pos(), SEEK_SET);
in->seek(in->readUint32BE() + in->pos(), SEEK_SET);
}
uint32 pos2 = in->pos() - 4;
uint32 size = pos2 - pos;
p->songs[i] = (byte *) calloc (size, 1);
in->seek (pos, SEEK_SET);
in->read (p->songs[i], size);
p->songs[i] = (byte *) calloc(size, 1);
in->seek(pos, SEEK_SET);
in->read(p->songs[i], size);
p->song_sizes[i] = size;
}
@ -471,47 +471,47 @@ void MidiPlayer::loadMultipleSMF (File *in, bool sfx) {
_currentTrack = 255;
resetVolumeTable();
}
_system->unlock_mutex (_mutex);
_system->unlock_mutex(_mutex);
}
void MidiPlayer::loadXMIDI (File *in, bool sfx) {
_system->lock_mutex (_mutex);
void MidiPlayer::loadXMIDI(File *in, bool sfx) {
_system->lock_mutex(_mutex);
MusicInfo *p = sfx ? &_sfx : &_music;
clearConstructs (*p);
clearConstructs(*p);
char buf[4];
uint32 pos = in->pos();
uint32 size = 4;
in->read (buf, 4);
if (!memcmp (buf, "FORM", 4)) {
in->read(buf, 4);
if (!memcmp(buf, "FORM", 4)) {
int i;
for (i = 0; i < 16; ++i) {
if (!memcmp (buf, "CAT ", 4))
if (!memcmp(buf, "CAT ", 4))
break;
size += 2;
memcpy (buf, &buf[2], 2);
in->read (&buf[2], 2);
memcpy(buf, &buf[2], 2);
in->read(&buf[2], 2);
}
if (memcmp (buf, "CAT ", 4)) {
printf ("ERROR! Could not find 'CAT ' tag to determine resource size!\n");
if (memcmp(buf, "CAT ", 4)) {
warning("Could not find 'CAT ' tag to determine resource size!");
_system->unlock_mutex (_mutex);
return;
}
size += 4 + in->readUint32BE();
in->seek (pos, 0);
p->data = (byte *) calloc (size, 1);
in->read (p->data, size);
in->seek(pos, 0);
p->data = (byte *) calloc(size, 1);
in->read(p->data, size);
} else {
printf ("ERROR! Expected 'FORM' tag but found '%c%c%c%c' instead!\n", buf[0], buf[1], buf[2], buf[3]);
_system->unlock_mutex (_mutex);
warning("Expected 'FORM' tag but found '%c%c%c%c' instead!", buf[0], buf[1], buf[2], buf[3]);
_system->unlock_mutex(_mutex);
return;
}
MidiParser *parser = MidiParser::createParser_XMIDI();
parser->setMidiDriver (this);
parser->setTimerRate (_driver->getBaseTempo());
if (!parser->loadMusic (p->data, size)) {
printf ("Error reading track!\n");
parser->setMidiDriver(this);
parser->setTimerRate(_driver->getBaseTempo());
if (!parser->loadMusic(p->data, size)) {
warning("Error reading track!");
delete parser;
parser = 0;
}
@ -521,29 +521,29 @@ void MidiPlayer::loadXMIDI (File *in, bool sfx) {
resetVolumeTable();
}
p->parser = parser; // That plugs the power cord into the wall
_system->unlock_mutex (_mutex);
_system->unlock_mutex(_mutex);
}
void MidiPlayer::loadS1D (File *in, bool sfx) {
_system->lock_mutex (_mutex);
_system->lock_mutex(_mutex);
MusicInfo *p = sfx ? &_sfx : &_music;
clearConstructs (*p);
clearConstructs(*p);
uint16 size = in->readUint16LE();
if (size != in->size() - 2) {
printf ("ERROR! Size mismatch in simon1demo MUS file (%ld versus reported %d)\n", (long) in->size() - 2, (int) size);
_system->unlock_mutex (_mutex);
warning("Size mismatch in simon1demo MUS file (%ld versus reported %d)", (long) in->size() - 2, (int) size);
_system->unlock_mutex(_mutex);
return;
}
p->data = (byte *) calloc (size, 1);
in->read (p->data, size);
p->data = (byte *) calloc(size, 1);
in->read(p->data, size);
MidiParser *parser = MidiParser_createS1D();
parser->setMidiDriver (this);
parser->setTimerRate (_driver->getBaseTempo());
if (!parser->loadMusic (p->data, size)) {
printf ("Error reading track!\n");
parser->setMidiDriver(this);
parser->setTimerRate(_driver->getBaseTempo());
if (!parser->loadMusic(p->data, size)) {
warning("Error reading track!");
delete parser;
parser = 0;
}
@ -553,5 +553,5 @@ void MidiPlayer::loadS1D (File *in, bool sfx) {
resetVolumeTable();
}
p->parser = parser; // That plugs the power cord into the wall
_system->unlock_mutex (_mutex);
_system->unlock_mutex(_mutex);
}

View file

@ -40,12 +40,12 @@ protected:
protected:
void parseNextEvent (EventInfo &info);
void resetTracking();
uint32 readVLQ2 (byte * &data);
uint32 readVLQ2(byte * &data);
public:
MidiParser_S1D() : _data(0), _no_delta(false) {}
bool loadMusic (byte *data, uint32 size);
bool loadMusic(byte *data, uint32 size);
};
@ -64,7 +64,7 @@ public:
// The VLQs for simon1demo seem to be
// in Little Endian format.
uint32 MidiParser_S1D::readVLQ2 (byte * &data) {
uint32 MidiParser_S1D::readVLQ2(byte * &data) {
byte str;
uint32 value = 0;
int i;
@ -79,9 +79,9 @@ uint32 MidiParser_S1D::readVLQ2 (byte * &data) {
return value;
}
void MidiParser_S1D::parseNextEvent (EventInfo &info) {
void MidiParser_S1D::parseNextEvent(EventInfo &info) {
info.start = _position._play_pos;
info.delta = _no_delta ? 0 : readVLQ2 (_position._play_pos);
info.delta = _no_delta ? 0 : readVLQ2(_position._play_pos);
_no_delta = false;
info.event = *(_position._play_pos++);
@ -127,7 +127,7 @@ void MidiParser_S1D::parseNextEvent (EventInfo &info) {
}
}
bool MidiParser_S1D::loadMusic (byte *data, uint32 size) {
bool MidiParser_S1D::loadMusic(byte *data, uint32 size) {
unloadMusic();
byte *pos = data;
@ -149,8 +149,8 @@ bool MidiParser_S1D::loadMusic (byte *data, uint32 size) {
// will persist beyond this call, i.e. we do NOT
// copy the data to our own buffer. Take warning....
resetTracking();
setTempo (500000);
setTrack (0);
setTempo(500000);
setTrack(0);
return true;
}

View file

@ -353,7 +353,6 @@ byte *SimonEngine::readSingleOpcode(File *in, byte *ptr) {
*ptr++ = val >> 8;
*ptr++ = val & 255;
break;
default:
error("Bad cmd table entry %c", l);
}

View file

@ -3390,7 +3390,6 @@ void SimonEngine::processSpecialKeys() {
case 27: // escape
_exit_cutscene = true;
break;
case 59: // F1
vc_write_var(5, 50);
vc_write_var(86, 0);
@ -3407,45 +3406,36 @@ void SimonEngine::processSpecialKeys() {
if (_game & GF_SIMON2)
_exit_cutscene = true;
break;
case 't':
if (_game & GF_SIMON2 && _game & GF_TALKIE || _game & GF_TALKIE && _language > 1)
_subtitles ^= 1;
break;
case '+':
midi.set_volume(midi.get_volume() + 16);
break;
case '-':
midi.set_volume(midi.get_volume() - 16);
break;
case 'm':
midi.pause(_music_paused ^= 1);
break;
case 's':
if (_game == GAME_SIMON1DOS)
midi._enable_sfx ^= 1;
else
_sound->effectsPause(_effects_paused ^= 1);
break;
case 'b':
_sound->ambientPause(_ambient_paused ^= 1);
break;
case 'r':
if (_debugMode)
_start_mainscript ^= 1;
break;
case 'o':
if (_debugMode)
_continous_mainscript ^= 1;
break;
case 'v':
if (_debugMode)
_continous_vgascript ^= 1;
@ -4576,12 +4566,10 @@ void SimonEngine::delay(uint amount) {
else
_key_pressed = (byte)event.kbd.ascii;
break;
case OSystem::EVENT_MOUSEMOVE:
_sdl_mouse_x = event.mouse.x;
_sdl_mouse_y = event.mouse.y;
break;
case OSystem::EVENT_LBUTTONDOWN:
_left_button_down++;
#ifdef _WIN32_WCE
@ -4589,19 +4577,16 @@ void SimonEngine::delay(uint amount) {
_sdl_mouse_y = event.mouse.y;
#endif
break;
case OSystem::EVENT_RBUTTONDOWN:
if (_game & GF_SIMON2)
_skip_speech = true;
else
_exit_cutscene = true;
break;
case OSystem::EVENT_QUIT:
shutdown();
return;
break;
default:
break;
}

View file

@ -1838,8 +1838,8 @@ void SimonEngine::vc_69_play_track() {
// specifying a non-valid track number (999 or -1)
// as a means of stopping what music is currently
// playing.
midi.setLoop (loop != 0);
midi.startTrack (track);
midi.setLoop(loop != 0);
midi.startTrack(track);
}
void SimonEngine::vc_70_queue_music() {
@ -1853,9 +1853,9 @@ void SimonEngine::vc_70_queue_music() {
// track and, if not, whether to switch to
// a different track upon completion.
if (track != 0xFFFF && track != 999)
midi.queueTrack (track, loop != 0);
midi.queueTrack(track, loop != 0);
else
midi.setLoop (loop != 0);
midi.setLoop(loop != 0);
}
void SimonEngine::vc_71_check_music_queue() {

View file

@ -504,75 +504,58 @@ uint16 SkyControl::handleClick(SkyConResource *pButton) {
switch(pButton->_onClick) {
case DO_NOTHING:
return 0;
case REST_GAME_PANEL:
if (!loadSaveAllowed())
return CANCEL_PRESSED; // can't save/restore while choosing
animClick(pButton);
return saveRestorePanel(false); // texts can't be edited
case SAVE_GAME_PANEL:
if (!loadSaveAllowed())
return CANCEL_PRESSED; // can't save/restore while choosing
animClick(pButton);
return saveRestorePanel(true); // texts can be edited
case SAVE_A_GAME:
animClick(pButton);
return saveGameToFile();
case RESTORE_A_GAME:
animClick(pButton);
return restoreGameFromFile(false);
case RESTORE_AUTO:
animClick(pButton);
return restoreGameFromFile(true);
case SP_CANCEL:
animClick(pButton);
return CANCEL_PRESSED;
case SHIFT_DOWN_FAST:
animClick(pButton);
return shiftDown(FAST);
case SHIFT_DOWN_SLOW:
animClick(pButton);
return shiftDown(SLOW);
case SHIFT_UP_FAST:
animClick(pButton);
return shiftUp(FAST);
case SHIFT_UP_SLOW:
animClick(pButton);
return shiftUp(SLOW);
case SPEED_SLIDE:
_mouseClicked = true;
return doSpeedSlide();
case MUSIC_SLIDE:
_mouseClicked = true;
return doMusicSlide();
case TOGGLE_FX:
return toggleFx(pButton);
case TOGGLE_MS:
animClick(pButton);
toggleMusic();
return TOGGLED;
case TOGGLE_TEXT:
animClick(pButton);
return toggleText();
case EXIT:
animClick(pButton);
return QUIT_PANEL;
case RESTART:
animClick(pButton);
if (getYesNo(NULL)) {
@ -580,7 +563,6 @@ uint16 SkyControl::handleClick(SkyConResource *pButton) {
return GAME_RESTORED;
} else
return 0;
case QUIT_TO_DOS:
animClick(pButton);
if (getYesNo(quitDos)) {
@ -589,7 +571,6 @@ uint16 SkyControl::handleClick(SkyConResource *pButton) {
_system->quit();
}
return 0;
default:
error("SkyControl::handleClick: unknown routine: %X",pButton->_onClick);
}
@ -1695,12 +1676,10 @@ void SkyControl::delay(unsigned int amount) {
else
_keyPressed = (byte)event.kbd.ascii;
break;
case OSystem::EVENT_MOUSEMOVE:
_mouseX = event.mouse.x;
_mouseY = event.mouse.y;
break;
case OSystem::EVENT_LBUTTONDOWN:
_mouseClicked = true;
#ifdef _WIN32_WCE
@ -1708,19 +1687,15 @@ void SkyControl::delay(unsigned int amount) {
_mouseY = event.mouse.y;
#endif
break;
case OSystem::EVENT_LBUTTONUP:
_mouseClicked = false;
break;
case OSystem::EVENT_RBUTTONDOWN:
break;
case OSystem::EVENT_QUIT:
if (!SkyState::_systemVars.quitting)
showGameQuitMsg(false);
break;
default:
break;
}

View file

@ -435,14 +435,12 @@ void SkyState::delay(uint amount) { //copied and mutilated from Simon.cpp
else
_key_pressed = (byte)event.kbd.ascii;
break;
case OSystem::EVENT_MOUSEMOVE:
if (!(_systemVars.systemFlags & SF_MOUSE_LOCKED)) {
_sdl_mouse_x = event.mouse.x;
_sdl_mouse_y = event.mouse.y;
}
break;
case OSystem::EVENT_LBUTTONDOWN:
_skyMouse->buttonPressed(2);
#ifdef _WIN32_WCE
@ -450,16 +448,13 @@ void SkyState::delay(uint amount) { //copied and mutilated from Simon.cpp
_sdl_mouse_y = event.mouse.y;
#endif
break;
case OSystem::EVENT_RBUTTONDOWN:
_skyMouse->buttonPressed(1);
break;
case OSystem::EVENT_QUIT:
if (!SkyState::_systemVars.quitting)
_skyControl->showGameQuitMsg(); // will call _system->quit()
break;
default:
break;
}