aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2003-09-24 06:33:59 +0000
committerTorbjörn Andersson2003-09-24 06:33:59 +0000
commit570e60a48797efa08ae5a6c7102f16678704bae8 (patch)
treef7fe3554f78b9c5e70ba4391eeedb69a5f0911ea
parent3854ce8f3d060f5bb4c1e248d846f73a7fe2942c (diff)
downloadscummvm-rg350-570e60a48797efa08ae5a6c7102f16678704bae8.tar.gz
scummvm-rg350-570e60a48797efa08ae5a6c7102f16678704bae8.tar.bz2
scummvm-rg350-570e60a48797efa08ae5a6c7102f16678704bae8.zip
Whitespace changes
svn-id: r10390
-rw-r--r--gui/EditTextWidget.cpp100
-rw-r--r--gui/PopUpWidget.cpp34
-rw-r--r--gui/console.cpp285
-rw-r--r--gui/newgui.cpp104
-rw-r--r--scumm/debugger.cpp93
-rw-r--r--scumm/imuse_digi.cpp90
-rw-r--r--scumm/object.cpp48
-rw-r--r--scumm/script.cpp2
-rw-r--r--scumm/script_v2.cpp54
-rw-r--r--scumm/script_v5.cpp160
-rw-r--r--scumm/script_v6.cpp16
-rw-r--r--scumm/script_v8.cpp26
-rw-r--r--scumm/smush/chunk.cpp30
-rw-r--r--scumm/smush/imuse_channel.cpp84
-rw-r--r--scumm/smush/saud_channel.cpp63
-rw-r--r--scumm/smush/smush_player.cpp130
-rw-r--r--scumm/sound.cpp136
-rw-r--r--simon/midi.cpp204
-rw-r--r--simon/midiparser_s1d.cpp16
-rw-r--r--simon/res.cpp1
-rw-r--r--simon/simon.cpp191
-rw-r--r--simon/vga.cpp8
-rw-r--r--sky/compact.cpp42
-rw-r--r--sky/control.cpp249
-rw-r--r--sky/intro.cpp198
-rw-r--r--sky/music/adlibchannel.cpp48
-rw-r--r--sky/music/gmchannel.cpp48
-rw-r--r--sky/music/musicbase.cpp52
-rw-r--r--sky/sky.cpp109
-rw-r--r--sky/text.cpp22
30 files changed, 1288 insertions, 1355 deletions
diff --git a/gui/EditTextWidget.cpp b/gui/EditTextWidget.cpp
index 17a4abc3f6..82eb2b4c22 100644
--- a/gui/EditTextWidget.cpp
+++ b/gui/EditTextWidget.cpp
@@ -82,59 +82,59 @@ bool EditTextWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
drawCaret(true);
switch (keycode) {
- case '\n': // enter/return
- case '\r':
- _boss->releaseFocus();
- dirty = true;
- break;
- case 27: // escape
- _label = _backupString;
- _pos = _label.size() - 1;
- _labelOffset = (_boss->getGui()->getStringWidth(_label) - (_w-6));
- if (_labelOffset < 0)
- _labelOffset = 0;
- _boss->releaseFocus();
- dirty = true;
- break;
- case 8: // backspace
- if (_pos > 0) {
- _pos--;
- _label.deleteChar(_pos);
- }
- dirty = true;
- break;
- case 127: // delete
+ case '\n': // enter/return
+ case '\r':
+ _boss->releaseFocus();
+ dirty = true;
+ break;
+ case 27: // escape
+ _label = _backupString;
+ _pos = _label.size() - 1;
+ _labelOffset = (_boss->getGui()->getStringWidth(_label) - (_w-6));
+ if (_labelOffset < 0)
+ _labelOffset = 0;
+ _boss->releaseFocus();
+ dirty = true;
+ break;
+ case 8: // backspace
+ if (_pos > 0) {
+ _pos--;
_label.deleteChar(_pos);
- dirty = true;
- break;
- case 256 + 20: // left arrow
- if (_pos > 0) {
- _pos--;
- dirty = adjustOffset();
- }
- break;
- case 256 + 19: // right arrow
- if (_pos < _label.size()) {
- _pos++;
- dirty = adjustOffset();
- }
- break;
- case 256 + 22: // home
- _pos = 0;
+ }
+ dirty = true;
+ break;
+ case 127: // delete
+ _label.deleteChar(_pos);
+ dirty = true;
+ break;
+ case 256 + 20: // left arrow
+ if (_pos > 0) {
+ _pos--;
dirty = adjustOffset();
- break;
- case 256 + 23: // end
- _pos = _label.size();
+ }
+ break;
+ case 256 + 19: // right arrow
+ if (_pos < _label.size()) {
+ _pos++;
dirty = adjustOffset();
- break;
- default:
- if (isprint((char)ascii)) {
- _label.insertChar((char)ascii, _pos++);
- //_label += (char)ascii;
- dirty = true;
- } else {
- handled = false;
- }
+ }
+ break;
+ case 256 + 22: // home
+ _pos = 0;
+ dirty = adjustOffset();
+ break;
+ case 256 + 23: // end
+ _pos = _label.size();
+ dirty = adjustOffset();
+ break;
+ default:
+ if (isprint((char)ascii)) {
+ _label.insertChar((char)ascii, _pos++);
+ //_label += (char)ascii;
+ dirty = true;
+ } else {
+ handled = false;
+ }
}
if (dirty)
diff --git a/gui/PopUpWidget.cpp b/gui/PopUpWidget.cpp
index 06c0b7fdb0..ab08fc551c 100644
--- a/gui/PopUpWidget.cpp
+++ b/gui/PopUpWidget.cpp
@@ -167,23 +167,23 @@ void PopUpDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
return;
switch (keycode) {
- case '\n': // enter/return
- case '\r':
- setResult(_selection);
- close();
- break;
- case 256+17: // up arrow
- moveUp();
- break;
- case 256+18: // down arrow
- moveDown();
- break;
- case 256+22: // home
- setSelection(0);
- break;
- case 256+23: // end
- setSelection(_popUpBoss->_entries.size()-1);
- break;
+ case '\n': // enter/return
+ case '\r':
+ setResult(_selection);
+ close();
+ break;
+ case 256+17: // up arrow
+ moveUp();
+ break;
+ case 256+18: // down arrow
+ moveDown();
+ break;
+ case 256+22: // home
+ setSelection(0);
+ break;
+ case 256+23: // end
+ setSelection(_popUpBoss->_entries.size()-1);
+ break;
}
}
diff --git a/gui/console.cpp b/gui/console.cpp
index a35903a189..815f6f5c1c 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -141,146 +141,143 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
int i;
switch (keycode) {
- case '\n': // enter/return
- case '\r': {
- if (_caretVisible)
- drawCaret(true);
+ case '\n': // enter/return
+ case '\r': {
+ if (_caretVisible)
+ drawCaret(true);
- nextLine();
+ nextLine();
- int len = _promptEndPos - _promptStartPos;
- bool keepRunning = true;
+ int len = _promptEndPos - _promptStartPos;
+ bool keepRunning = true;
- // FIXME - len should NEVER be negative. If anything makes it negative,
- // then the code doing that is buggy and needs to be fixed.
- assert(len >= 0);
+ // FIXME - len should NEVER be negative. If anything makes it negative,
+ // then the code doing that is buggy and needs to be fixed.
+ assert(len >= 0);
- if (len > 0) {
+ if (len > 0) {
- // We have to allocate the string buffer with new, since VC++ sadly does not
- // comply to the C++ standard, so we can't use a dynamic sized stack array.
- char *str = new char[len + 1];
+ // We have to allocate the string buffer with new, since VC++ sadly does not
+ // comply to the C++ standard, so we can't use a dynamic sized stack array.
+ char *str = new char[len + 1];
- // Copy the user input to str
- for (i = 0; i < len; i++)
- str[i] = _buffer[(_promptStartPos + i) % kBufferSize];
- str[len] = '\0';
+ // Copy the user input to str
+ for (i = 0; i < len; i++)
+ str[i] = _buffer[(_promptStartPos + i) % kBufferSize];
+ str[len] = '\0';
- // Add the input to the history
- addToHistory(str);
+ // Add the input to the history
+ addToHistory(str);
- // Pass it to the input callback, if any
- if (_callbackProc)
- keepRunning = (*_callbackProc)(this, str, _callbackRefCon);
+ // Pass it to the input callback, if any
+ if (_callbackProc)
+ keepRunning = (*_callbackProc)(this, str, _callbackRefCon);
- // Get rid of the string buffer
- delete [] str;
- }
+ // Get rid of the string buffer
+ delete [] str;
+ }
- print(PROMPT);
- _promptStartPos = _promptEndPos = _currentPos;
+ print(PROMPT);
+ _promptStartPos = _promptEndPos = _currentPos;
- draw();
- if (!keepRunning)
- close();
- break;
- }
- case 27: // escape
+ draw();
+ if (!keepRunning)
close();
- break;
- case 8: // backspace
- if (_caretVisible)
- drawCaret(true);
-
- if (_currentPos > _promptStartPos) {
- _currentPos--;
- killChar();
- }
- scrollToCurrent();
- draw(); // FIXME - not nice to redraw the full console just for one char!
- break;
- case 9: // tab
- {
- if (_completionCallbackProc) {
- int len = _currentPos - _promptStartPos;
- assert(len >= 0);
- char *str = new char[len + 1];
+ break;
+ }
+ case 27: // escape
+ close();
+ break;
+ case 8: // backspace
+ if (_caretVisible)
+ drawCaret(true);
+
+ if (_currentPos > _promptStartPos) {
+ _currentPos--;
+ killChar();
+ }
+ scrollToCurrent();
+ draw(); // FIXME - not nice to redraw the full console just for one char!
+ break;
+ case 9: // tab
+ {
+ if (_completionCallbackProc) {
+ int len = _currentPos - _promptStartPos;
+ assert(len >= 0);
+ char *str = new char[len + 1];
- // Copy the user input to str
- for (i = 0; i < len; i++)
- str[i] = _buffer[(_promptStartPos + i) % kBufferSize];
- str[len] = '\0';
-
- char *completion = 0;
- if ((*_completionCallbackProc)(this, str, completion,
- _callbackRefCon))
- {
- if (_caretVisible)
- drawCaret(true);
- insertIntoPrompt(completion);
- scrollToCurrent();
- draw();
- delete[] completion;
- }
- delete[] str;
+ // Copy the user input to str
+ for (i = 0; i < len; i++)
+ str[i] = _buffer[(_promptStartPos + i) % kBufferSize];
+ str[len] = '\0';
+
+ char *completion = 0;
+ if ((*_completionCallbackProc)(this, str, completion, _callbackRefCon)) {
+ if (_caretVisible)
+ drawCaret(true);
+ insertIntoPrompt(completion);
+ scrollToCurrent();
+ draw();
+ delete[] completion;
}
- break;
+ delete[] str;
}
- case 127:
- killChar();
- draw();
- break;
+ break;
+ }
+ case 127:
+ killChar();
+ draw();
+ break;
/*
- case 256 + 24: // pageup
- _selectedItem -= _entriesPerPage - 1;
- if (_selectedItem < 0)
- _selectedItem = 0;
- break;
- case 256 + 25: // pagedown
- _selectedItem += _entriesPerPage - 1;
- if (_selectedItem >= _list.size() )
- _selectedItem = _list.size() - 1;
- break;
+ case 256 + 24: // pageup
+ _selectedItem -= _entriesPerPage - 1;
+ if (_selectedItem < 0)
+ _selectedItem = 0;
+ break;
+ case 256 + 25: // pagedown
+ _selectedItem += _entriesPerPage - 1;
+ if (_selectedItem >= _list.size() )
+ _selectedItem = _list.size() - 1;
+ break;
*/
- case 256 + 22: // home
- _scrollLine = _linesPerPage - 1; // FIXME - this is not correct after a wrap around
- updateScrollBar();
- draw();
- break;
- case 256 + 23: // end
- _scrollLine = _currentPos / _lineWidth;
- updateScrollBar();
- draw();
- break;
- case 273: // cursor up
- historyScroll(+1);
- break;
- case 274: // cursor down
- historyScroll(-1);
- break;
- case 275: // cursor right
- if (_currentPos < _promptEndPos)
- _currentPos++;
- draw();
- break;
- case 276: // cursor left
- if (_currentPos > _promptStartPos)
- _currentPos--;
- draw();
- break;
-
- default:
- if (ascii == '~' || ascii == '#') {
- close();
- } else if (modifiers == OSystem::KBD_CTRL) {
- specialKeys(keycode);
- } else if (isprint((char)ascii)) {
- for (i = _promptEndPos-1; i >= _currentPos; i--)
- _buffer[(i + 1) % kBufferSize] = _buffer[i % kBufferSize];
- _promptEndPos++;
- putchar((char)ascii);
- scrollToCurrent();
- }
+ case 256 + 22: // home
+ _scrollLine = _linesPerPage - 1; // FIXME - this is not correct after a wrap around
+ updateScrollBar();
+ draw();
+ break;
+ case 256 + 23: // end
+ _scrollLine = _currentPos / _lineWidth;
+ updateScrollBar();
+ draw();
+ break;
+ case 273: // cursor up
+ historyScroll(+1);
+ break;
+ case 274: // cursor down
+ historyScroll(-1);
+ break;
+ case 275: // cursor right
+ if (_currentPos < _promptEndPos)
+ _currentPos++;
+ draw();
+ break;
+ case 276: // cursor left
+ if (_currentPos > _promptStartPos)
+ _currentPos--;
+ draw();
+ break;
+ default:
+ if (ascii == '~' || ascii == '#') {
+ close();
+ } else if (modifiers == OSystem::KBD_CTRL) {
+ specialKeys(keycode);
+ } else if (isprint((char)ascii)) {
+ for (i = _promptEndPos-1; i >= _currentPos; i--)
+ _buffer[(i + 1) % kBufferSize] = _buffer[i % kBufferSize];
+ _promptEndPos++;
+ putchar((char)ascii);
+ scrollToCurrent();
+ }
}
}
@@ -310,28 +307,28 @@ void ConsoleDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
void ConsoleDialog::specialKeys(int keycode) {
switch (keycode) {
- case 'a':
- _currentPos = _promptStartPos;
- draw();
- break;
- case 'd':
- if (_currentPos < _promptEndPos) {
- killChar();
- draw();
- }
- break;
- case 'e':
- _currentPos = _promptEndPos;
- draw();
- break;
- case 'k':
- killLine();
- draw();
- break;
- case 'w':
- killLastWord();
+ case 'a':
+ _currentPos = _promptStartPos;
+ draw();
+ break;
+ case 'd':
+ if (_currentPos < _promptEndPos) {
+ killChar();
draw();
- break;
+ }
+ break;
+ case 'e':
+ _currentPos = _promptEndPos;
+ draw();
+ break;
+ case 'k':
+ killLine();
+ draw();
+ break;
+ case 'w':
+ killLastWord();
+ draw();
+ break;
}
}
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index 736be2d8c8..2bc9aacac0 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -147,60 +147,60 @@ void NewGui::runLoop() {
uint32 time = get_time();
while (_system->poll_event(&event)) {
- switch(event.event_code) {
- case OSystem::EVENT_KEYDOWN:
+ switch (event.event_code) {
+ case OSystem::EVENT_KEYDOWN:
#if !defined(_WIN32_WCE) && !defined(__PALM_OS__)
- // init continuous event stream
- // not done on WinCE because keyboard is emulated and
- // keyup is not generated
- _currentKeyDown.ascii = event.kbd.ascii;
- _currentKeyDown.keycode = event.kbd.keycode;
- _currentKeyDown.flags = event.kbd.flags;
- _keyRepeatTime = time + kKeyRepeatInitialDelay;
+ // init continuous event stream
+ // not done on WinCE because keyboard is emulated and
+ // keyup is not generated
+ _currentKeyDown.ascii = event.kbd.ascii;
+ _currentKeyDown.keycode = event.kbd.keycode;
+ _currentKeyDown.flags = event.kbd.flags;
+ _keyRepeatTime = time + kKeyRepeatInitialDelay;
#endif
- activeDialog->handleKeyDown(event.kbd.ascii, event.kbd.keycode, event.kbd.flags);
- break;
- case OSystem::EVENT_KEYUP:
- activeDialog->handleKeyUp(event.kbd.ascii, event.kbd.keycode, event.kbd.flags);
- if (event.kbd.keycode == _currentKeyDown.keycode)
- // only stop firing events if it's the current key
- _currentKeyDown.keycode = 0;
- break;
- case OSystem::EVENT_MOUSEMOVE:
- activeDialog->handleMouseMoved(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y, 0);
- break;
- // We don't distinguish between mousebuttons (for now at least)
- case OSystem::EVENT_LBUTTONDOWN:
- case OSystem::EVENT_RBUTTONDOWN: {
- if (_lastClick.count && (time < _lastClick.time + kDoubleClickDelay)
- && ABS(_lastClick.x - event.mouse.x) < 3
- && ABS(_lastClick.y - event.mouse.y) < 3) {
- _lastClick.count++;
- } else {
- _lastClick.x = event.mouse.x;
- _lastClick.y = event.mouse.y;
- _lastClick.count = 1;
- }
- _lastClick.time = time;
- }
- activeDialog->handleMouseDown(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y, 1, _lastClick.count);
- break;
- case OSystem::EVENT_LBUTTONUP:
- case OSystem::EVENT_RBUTTONUP:
- activeDialog->handleMouseUp(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y, 1, _lastClick.count);
- break;
- case OSystem::EVENT_WHEELUP:
- activeDialog->handleMouseWheel(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y, -1);
- break;
- case OSystem::EVENT_WHEELDOWN:
- activeDialog->handleMouseWheel(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y, 1);
- break;
- case OSystem::EVENT_QUIT:
- _system->quit();
- return;
- case OSystem::EVENT_SCREEN_CHANGED:
- updateColors();
- break;
+ activeDialog->handleKeyDown(event.kbd.ascii, event.kbd.keycode, event.kbd.flags);
+ break;
+ case OSystem::EVENT_KEYUP:
+ activeDialog->handleKeyUp(event.kbd.ascii, event.kbd.keycode, event.kbd.flags);
+ if (event.kbd.keycode == _currentKeyDown.keycode)
+ // only stop firing events if it's the current key
+ _currentKeyDown.keycode = 0;
+ break;
+ case OSystem::EVENT_MOUSEMOVE:
+ activeDialog->handleMouseMoved(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y, 0);
+ break;
+ // We don't distinguish between mousebuttons (for now at least)
+ case OSystem::EVENT_LBUTTONDOWN:
+ case OSystem::EVENT_RBUTTONDOWN: {
+ if (_lastClick.count && (time < _lastClick.time + kDoubleClickDelay)
+ && ABS(_lastClick.x - event.mouse.x) < 3
+ && ABS(_lastClick.y - event.mouse.y) < 3) {
+ _lastClick.count++;
+ } else {
+ _lastClick.x = event.mouse.x;
+ _lastClick.y = event.mouse.y;
+ _lastClick.count = 1;
+ }
+ _lastClick.time = time;
+ }
+ activeDialog->handleMouseDown(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y, 1, _lastClick.count);
+ break;
+ case OSystem::EVENT_LBUTTONUP:
+ case OSystem::EVENT_RBUTTONUP:
+ activeDialog->handleMouseUp(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y, 1, _lastClick.count);
+ break;
+ case OSystem::EVENT_WHEELUP:
+ activeDialog->handleMouseWheel(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y, -1);
+ break;
+ case OSystem::EVENT_WHEELDOWN:
+ activeDialog->handleMouseWheel(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y, 1);
+ break;
+ case OSystem::EVENT_QUIT:
+ _system->quit();
+ return;
+ case OSystem::EVENT_SCREEN_CHANGED:
+ updateColors();
+ break;
}
}
diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp
index fefe6e2700..ea35395804 100644
--- a/scumm/debugger.cpp
+++ b/scumm/debugger.cpp
@@ -278,68 +278,61 @@ bool ScummDebugger::RunCommand(const char *inputOrig) {
if (num_params > 1) {
// Alright, we need to check the TYPE of the variable to deref and stuff... the array stuff is a bit ugly :)
switch(_dvars[i].type) {
- // Integer
- case DVAR_INT:
- *(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], '[');
- if (!chr) {
- Debug_Printf("You must access this array as %s[element]\n", param[0]);
+ // Integer
+ case DVAR_INT:
+ *(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], '[');
+ if (!chr) {
+ Debug_Printf("You must access this array as %s[element]\n", param[0]);
+ } else {
+ int element = atoi(chr+1);
+ int32 *var = *(int32 **)_dvars[i].variable;
+ if (element > _dvars[i].optional) {
+ Debug_Printf("%s is out of range (array is %d elements big)\n", param[0], _dvars[i].optional);
} else {
- int element = atoi(chr+1);
- int32 *var = *(int32 **)_dvars[i].variable;
- if (element > _dvars[i].optional) {
- Debug_Printf("%s is out of range (array is %d elements big)\n", param[0], _dvars[i].optional);
- } else {
- var[element] = atoi(param[1]);
- Debug_Printf("(int)%s = %d\n", param[0], var[element]);
-
- }
+ 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;
+ default:
+ Debug_Printf("Failed to set variable %s to %s - unknown type\n", _dvars[i].name, param[1]);
break;
}
} else {
// And again, type-dependent prints/defrefs. The array one is still ugly.
switch(_dvars[i].type) {
- // Integer
- 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], '[');
- if (!chr) {
- Debug_Printf("You must access this array as %s[element]\n", param[0]);
+ // Integer
+ 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], '[');
+ if (!chr) {
+ Debug_Printf("You must access this array as %s[element]\n", param[0]);
+ } else {
+ int element = atoi(chr+1);
+ int16 *var = *(int16 **)_dvars[i].variable;
+ if (element > _dvars[i].optional) {
+ Debug_Printf("%s is out of range (array is %d elements big)\n", param[0], _dvars[i].optional);
} else {
- int element = atoi(chr+1);
- int16 *var = *(int16 **)_dvars[i].variable;
- if (element > _dvars[i].optional) {
- 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]);
-
- }
+ 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;
-
- // 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]);
+ default:
+ Debug_Printf("%s = (unknown type)\n", param[0]);
break;
}
}
diff --git a/scumm/imuse_digi.cpp b/scumm/imuse_digi.cpp
index 5330289f18..7fb38a7b92 100644
--- a/scumm/imuse_digi.cpp
+++ b/scumm/imuse_digi.cpp
@@ -653,34 +653,34 @@ static byte *readCreativeVocFile(byte *ptr, int32 &size, int &rate) {
code = len & 0xFF;
len >>= 8;
switch(code) {
- case 0: quit = 1; break;
- case 1: {
- int time_constant = ptr[offset++];
- int packing = ptr[offset++];
- len -= 2;
- rate = getSampleRateFromVOCRate(time_constant);
- debug(9, "VOC Data Bloc : %d, %d, %d", rate, packing, len);
- if (packing == 0) {
- if (size) {
- ret_sound = (byte *)realloc(ret_sound, size + len);
- } else {
- ret_sound = (byte *)malloc(len);
- }
- memcpy(ret_sound + size, ptr + offset, len);
- size += len;
+ case 0: quit = 1; break;
+ case 1: {
+ int time_constant = ptr[offset++];
+ int packing = ptr[offset++];
+ len -= 2;
+ rate = getSampleRateFromVOCRate(time_constant);
+ debug(9, "VOC Data Bloc : %d, %d, %d", rate, packing, len);
+ if (packing == 0) {
+ if (size) {
+ ret_sound = (byte *)realloc(ret_sound, size + len);
} else {
- warning("VOC file packing %d unsupported", packing);
+ ret_sound = (byte *)malloc(len);
}
- } break;
- case 6: // begin of loop
- loops = len + 1;
- break;
- case 7: // end of loop
- break;
- default:
- warning("Invalid code in VOC file : %d", code);
- quit = 1;
- break;
+ memcpy(ret_sound + size, ptr + offset, len);
+ size += len;
+ } else {
+ warning("VOC file packing %d unsupported", packing);
+ }
+ } break;
+ case 6: // begin of loop
+ loops = len + 1;
+ break;
+ case 7: // end of loop
+ break;
+ default:
+ warning("Invalid code in VOC file : %d", code);
+ quit = 1;
+ break;
}
// FIXME some FT samples (ex. 362) has bad length, 2 bytes too short
offset += len;
@@ -848,30 +848,30 @@ void IMuseDigital::startSound(int sound) {
for (;;) {
tag = READ_BE_UINT32(ptr); ptr += 4;
switch(tag) {
- case MKID_BE('FRMT'):
- ptr += 12;
- _channel[l]._bits = READ_BE_UINT32(ptr); ptr += 4;
- _channel[l]._freq = READ_BE_UINT32(ptr); ptr += 4;
- _channel[l]._channels = READ_BE_UINT32(ptr); ptr += 4;
- break;
- case MKID_BE('TEXT'):
- size = READ_BE_UINT32(ptr); ptr += size + 4;
+ case MKID_BE('FRMT'):
+ ptr += 12;
+ _channel[l]._bits = READ_BE_UINT32(ptr); ptr += 4;
+ _channel[l]._freq = READ_BE_UINT32(ptr); ptr += 4;
+ _channel[l]._channels = READ_BE_UINT32(ptr); ptr += 4;
+ break;
+ case MKID_BE('TEXT'):
+ size = READ_BE_UINT32(ptr); ptr += size + 4;
break;
- case MKID_BE('REGN'):
- ptr += 12;
+ case MKID_BE('REGN'):
+ ptr += 12;
break;
- case MKID_BE('STOP'):
- ptr += 4;
- _channel[l]._offsetStop = READ_BE_UINT32(ptr); ptr += 4;
+ case MKID_BE('STOP'):
+ ptr += 4;
+ _channel[l]._offsetStop = READ_BE_UINT32(ptr); ptr += 4;
break;
- case MKID_BE('JUMP'):
- ptr += 20;
+ case MKID_BE('JUMP'):
+ ptr += 20;
break;
- case MKID_BE('DATA'):
- size = READ_BE_UINT32(ptr); ptr += 4;
+ case MKID_BE('DATA'):
+ size = READ_BE_UINT32(ptr); ptr += 4;
break;
- default:
- error("IMuseDigital::startSound(%d) Unknown sfx header %c%c%c%c", sound, (byte)(tag >> 24), (byte)(tag >> 16), (byte)(tag >> 8), (byte)tag);
+ default:
+ error("IMuseDigital::startSound(%d) Unknown sfx header %c%c%c%c", sound, (byte)(tag >> 24), (byte)(tag >> 16), (byte)(tag >> 8), (byte)tag);
}
if (tag == MKID_BE('DATA')) break;
}
diff --git a/scumm/object.cpp b/scumm/object.cpp
index 847441c58e..5e1c5b737e 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -59,18 +59,18 @@ bool Scumm::getClass(int obj, int cls) const {
// Translate the new (V5) object classes to the old classes
// (for those which differ).
switch (cls) {
- case kObjectClassUntouchable:
- cls = 24;
- break;
- case kObjectClassPlayer:
- cls = 23;
- break;
- case kObjectClassXFlip:
- cls = 19;
- break;
- case kObjectClassYFlip:
- cls = 18;
- break;
+ case kObjectClassUntouchable:
+ cls = 24;
+ break;
+ case kObjectClassPlayer:
+ cls = 23;
+ break;
+ case kObjectClassXFlip:
+ cls = 19;
+ break;
+ case kObjectClassYFlip:
+ cls = 18;
+ break;
}
}
@@ -86,18 +86,18 @@ void Scumm::putClass(int obj, int cls, bool set) {
// Translate the new (V5) object classes to the old classes
// (for those which differ).
switch (cls) {
- case kObjectClassUntouchable:
- cls = 24;
- break;
- case kObjectClassPlayer:
- cls = 23;
- break;
- case kObjectClassXFlip:
- cls = 19;
- break;
- case kObjectClassYFlip:
- cls = 18;
- break;
+ case kObjectClassUntouchable:
+ cls = 24;
+ break;
+ case kObjectClassPlayer:
+ cls = 23;
+ break;
+ case kObjectClassXFlip:
+ cls = 19;
+ break;
+ case kObjectClassYFlip:
+ cls = 18;
+ break;
}
}
diff --git a/scumm/script.cpp b/scumm/script.cpp
index 060bda73af..29c94efd21 100644
--- a/scumm/script.cpp
+++ b/scumm/script.cpp
@@ -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;
diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp
index 267ac2a096..6b688bfdf9 100644
--- a/scumm/script_v2.cpp
+++ b/scumm/script_v2.cpp
@@ -692,36 +692,32 @@ void Scumm_v2::o2_actorSet() {
a = derefActor(act, "actorSet");
switch (_opcode) {
- case 1: // Actor Sound
- a->sound[0] = arg;
- break;
-
- case 2: // Actor Set Color
- if (_version == 1)
- i = act;
- else
- i = fetchScriptByte();
-
- 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 1: // Actor Sound
+ a->sound[0] = arg;
+ break;
+ case 2: // Actor Set Color
+ if (_version == 1)
+ i = act;
+ else
+ i = fetchScriptByte();
- case 5: // Talk Color
- if ((_gameId == GID_MANIAC) && (_version == 1))
- v1_mm_actor_speech_color[act] = arg;
- else
- a->talkColor = arg;
- break;
- default:
- warning("o2_actorSet: opcode %d not yet supported", _opcode);
+ 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;
+ else
+ a->talkColor = arg;
+ break;
+ default:
+ warning("o2_actorSet: opcode %d not yet supported", _opcode);
}
}
diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp
index 484102519f..b8560154d9 100644
--- a/scumm/script_v5.cpp
+++ b/scumm/script_v5.cpp
@@ -874,33 +874,31 @@ void Scumm_v5::saveVars() {
while ((_opcode = fetchScriptByte()) != 0) {
switch (_opcode & 0x1F) {
- case 0x01: // write a range of variables
- getResultPos();
- a = _resultVarNumber;
- getResultPos();
- 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);
- warning("stub saveVars: strings %d -> %d", a, b);
- break;
- case 0x03: // open file
- a = resStrLen(_scriptPointer);
- warning("stub saveVars to %s", _scriptPointer);
- _scriptPointer += a + 1;
- break;
- case 0x04:
- return;
- break;
- case 0x1F: // close file
- warning("stub saveVars close file");
- return;
- break;
+ case 0x01: // write a range of variables
+ getResultPos();
+ a = _resultVarNumber;
+ getResultPos();
+ 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);
+ warning("stub saveVars: strings %d -> %d", a, b);
+ break;
+ case 0x03: // open file
+ a = resStrLen(_scriptPointer);
+ warning("stub saveVars to %s", _scriptPointer);
+ _scriptPointer += a + 1;
+ break;
+ case 0x04:
+ return;
+ break;
+ case 0x1F: // close file
+ warning("stub saveVars close file");
+ return;
+ break;
}
-
}
}
@@ -910,34 +908,32 @@ void Scumm_v5::loadVars() {
hexdump(_scriptPointer, 64);
while ((_opcode = fetchScriptByte()) != 0) {
switch (_opcode & 0x1F) {
- case 0x01: // read a range of variables
- getResultPos();
- a = _resultVarNumber;
- getResultPos();
- b = _resultVarNumber;
- warning("stub loadVars: vars %d -> %d", a, b);
- break;
- case 0x02: // read a range of string variables
- a = getVarOrDirectByte(0x80);
- b = getVarOrDirectByte(0x40);
- warning("stub loadVars: strings %d -> %d", a, b);
- break;
- case 0x03: // open file
- a = resStrLen(_scriptPointer);
- warning("stub loadVars from %s", _scriptPointer);
- _scriptPointer += a + 1;
- break;
- case 0x04:
- return;
- break;
- case 0x1F: // close file
- warning("stub loadVars close file");
- return;
- break;
+ case 0x01: // read a range of variables
+ getResultPos();
+ a = _resultVarNumber;
+ getResultPos();
+ b = _resultVarNumber;
+ warning("stub loadVars: vars %d -> %d", a, b);
+ break;
+ case 0x02: // read a range of string variables
+ a = getVarOrDirectByte(0x80);
+ b = getVarOrDirectByte(0x40);
+ warning("stub loadVars: strings %d -> %d", a, b);
+ break;
+ case 0x03: // open file
+ a = resStrLen(_scriptPointer);
+ warning("stub loadVars from %s", _scriptPointer);
+ _scriptPointer += a + 1;
+ break;
+ case 0x04:
+ return;
+ break;
+ case 0x1F: // close file
+ warning("stub loadVars close file");
+ return;
+ break;
}
-
}
-
}
void Scumm_v5::o5_expression() {
@@ -1142,37 +1138,37 @@ void Scumm_v5::o5_saveLoadGame() {
_opcode = a & 0xE0;
switch (_opcode) {
- case 0x00: // num slots available
- result = 100;
- break;
- case 0x20: // drive
- // 0 = hard drive
- // 1 = disk drive
+ case 0x00: // num slots available
+ result = 100;
+ break;
+ case 0x20: // drive
+ // 0 = hard drive
+ // 1 = disk drive
+ result = 0;
+ break;
+ case 0x40: // load
+ if (loadState(slot, _saveLoadCompatible))
+ result = 3; // sucess
+ else
+ result = 5; // failed to load
+ break;
+ case 0x80: // save
+ if (saveState(slot, _saveLoadCompatible))
result = 0;
- break;
- case 0x40: // load
- if (loadState(slot, _saveLoadCompatible))
- result = 3; // sucess
- else
- result = 5; // failed to load
- break;
- case 0x80: // save
- if (saveState(slot, _saveLoadCompatible))
- result = 0;
- else
- result = 2;
- break;
- case 0xC0: // test if save exists
- bool avail_saves[100];
- char filename[256];
- SaveFileManager *mgr = _system->get_savefile_manager();
- listSavegames(avail_saves, ARRAYSIZE(avail_saves), mgr);
- makeSavegameName(filename, slot, false);
- if (avail_saves[slot] && (mgr->open_savefile(filename, getSavePath(), false)))
- result = 6; // save file exists
- else
- result = 7; // save file does not exist
- break;
+ else
+ result = 2;
+ break;
+ case 0xC0: // test if save exists
+ bool avail_saves[100];
+ char filename[256];
+ SaveFileManager *mgr = _system->get_savefile_manager();
+ listSavegames(avail_saves, ARRAYSIZE(avail_saves), mgr);
+ makeSavegameName(filename, slot, false);
+ if (avail_saves[slot] && (mgr->open_savefile(filename, getSavePath(), false)))
+ result = 6; // save file exists
+ else
+ result = 7; // save file does not exist
+ break;
}
setResult(result);
}
diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp
index 7d4be06aea..297ab95d3e 100644
--- a/scumm/script_v6.cpp
+++ b/scumm/script_v6.cpp
@@ -3116,14 +3116,14 @@ void Scumm_v6::o6_unknownEA() {
eax = fetchScriptByte();
switch (eax) {
- case 197:
- unknownEA_func(5, esi, edi, fetchScriptWord(), eax);
- break;
- case 202:
- unknownEA_func(3, esi, edi, fetchScriptWord(), eax);
- break;
- default:
- break;
+ case 197:
+ unknownEA_func(5, esi, edi, fetchScriptWord(), eax);
+ break;
+ case 202:
+ unknownEA_func(3, esi, edi, fetchScriptWord(), eax);
+ break;
+ default:
+ break;
}
}
diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp
index e502faa9df..82a4763306 100644
--- a/scumm/script_v8.cpp
+++ b/scumm/script_v8.cpp
@@ -1401,19 +1401,19 @@ void Scumm_v8::o8_kernelGetFunctions() {
break;
case 0xD3: // getKeyState
switch(args[1]) {
- // Stub out a few specific cases, just to make things less noisy
-
- // To actually implement this, we may need a new OSystem call to do
- // asyncronous keyboard state checking...
- case 0x14B: // Left Arrow depressed?
- case 0x14D: // Right Arrow depressed?
- case 0x09: // Tab depressed (fire in ship combat)
- push(0);
- break;
- default:
- warning("getKeyState(0x%X)", args[1]);
- push(0);
- break;
+ // Stub out a few specific cases, just to make things less noisy
+
+ // To actually implement this, we may need a new OSystem call to do
+ // asyncronous keyboard state checking...
+ case 0x14B: // Left Arrow depressed?
+ case 0x14D: // Right Arrow depressed?
+ case 0x09: // Tab depressed (fire in ship combat)
+ push(0);
+ break;
+ default:
+ warning("getKeyState(0x%X)", args[1]);
+ push(0);
+ break;
}
break;
case 0xCE: // getRGBSlot
diff --git a/scumm/smush/chunk.cpp b/scumm/smush/chunk.cpp
index d737d41f49..d55629ef56 100644
--- a/scumm/smush/chunk.cpp
+++ b/scumm/smush/chunk.cpp
@@ -87,21 +87,21 @@ uint32 BaseChunk::getSize() const {
bool BaseChunk::seek(int32 delta, seek_type dir) {
switch(dir) {
- case seek_cur:
- _curPos += delta;
- break;
- case seek_start:
- if (delta < 0)
- error("invalid seek request");
-
- _curPos = (uint32)delta;
- break;
- case seek_end:
- if (delta > 0 || _size < (uint32)-delta)
- error("invalid seek request");
-
- _curPos = (uint32)(_size + delta);
- break;
+ case seek_cur:
+ _curPos += delta;
+ break;
+ case seek_start:
+ if (delta < 0)
+ error("invalid seek request");
+
+ _curPos = (uint32)delta;
+ break;
+ case seek_end:
+ if (delta > 0 || _size < (uint32)-delta)
+ error("invalid seek request");
+
+ _curPos = (uint32)(_size + delta);
+ break;
}
if (_curPos > _size) {
error("invalid seek request : %d > %d (delta == %d)", _curPos, _size, delta);
diff --git a/scumm/smush/imuse_channel.cpp b/scumm/smush/imuse_channel.cpp
index e4c0000a06..45a475f30a 100644
--- a/scumm/smush/imuse_channel.cpp
+++ b/scumm/smush/imuse_channel.cpp
@@ -141,20 +141,20 @@ bool ImuseChannel::handleMap(Chunk &map) {
while (!map.eof()) {
Chunk *sub = map.subBlock();
switch(sub->getType()) {
- case TYPE_FRMT:
- handleFormat(*sub);
- break;
- case TYPE_TEXT:
- handleText(*sub);
- break;
- case TYPE_REGN:
- handleRegion(*sub);
- break;
- case TYPE_STOP:
- handleStop(*sub);
- break;
- default:
- error("Unknown iMUS subChunk found : %s, %d", Chunk::ChunkString(sub->getType()), sub->getSize());
+ case TYPE_FRMT:
+ handleFormat(*sub);
+ break;
+ case TYPE_TEXT:
+ handleText(*sub);
+ break;
+ case TYPE_REGN:
+ handleRegion(*sub);
+ break;
+ case TYPE_STOP:
+ handleStop(*sub);
+ break;
+ default:
+ error("Unknown iMUS subChunk found : %s, %d", Chunk::ChunkString(sub->getType()), sub->getSize());
}
delete sub;
}
@@ -213,36 +213,36 @@ bool ImuseChannel::handleSubTags(int32 &offset) {
uint32 size = READ_BE_UINT32(_tbuffer + offset + 4);
uint32 available_size = _tbufferSize - offset;
switch(type) {
- case TYPE_MAP_:
- _inData = false;
- if (available_size >= (size + 8)) {
- MemoryChunk c((byte *)_tbuffer + offset);
- handleMap(c);
+ case TYPE_MAP_:
+ _inData = false;
+ if (available_size >= (size + 8)) {
+ MemoryChunk c((byte *)_tbuffer + offset);
+ handleMap(c);
+ }
+ break;
+ case TYPE_DATA:
+ _inData = true;
+ _dataSize = size;
+ offset += 8;
+ {
+ int reqsize = 1;
+ if (_channels == 2)
+ reqsize *= 2;
+ if (_bitsize == 16)
+ reqsize *= 2;
+ else if (_bitsize == 12) {
+ if (reqsize > 1)
+ reqsize = reqsize * 3 / 2;
+ else reqsize = 3;
}
- break;
- case TYPE_DATA:
- _inData = true;
- _dataSize = size;
- offset += 8;
- {
- int reqsize = 1;
- if (_channels == 2)
- reqsize *= 2;
- if (_bitsize == 16)
- reqsize *= 2;
- else if (_bitsize == 12) {
- if (reqsize > 1)
- reqsize = reqsize * 3 / 2;
- else reqsize = 3;
- }
- if ((size % reqsize) != 0) {
- debug(2, "Invalid iMUS sound data size : (%d %% %d) != 0, correcting...", size, reqsize);
- size += 3 - (size % reqsize);
- }
+ if ((size % reqsize) != 0) {
+ debug(2, "Invalid iMUS sound data size : (%d %% %d) != 0, correcting...", size, reqsize);
+ size += 3 - (size % reqsize);
}
- return false;
- default:
- error("unknown Chunk in iMUS track : %s ", Chunk::ChunkString(type));
+ }
+ return false;
+ default:
+ error("unknown Chunk in iMUS track : %s ", Chunk::ChunkString(type));
}
offset += size + 8;
return true;
diff --git a/scumm/smush/saud_channel.cpp b/scumm/smush/saud_channel.cpp
index d6a495950f..1c5030974d 100644
--- a/scumm/smush/saud_channel.cpp
+++ b/scumm/smush/saud_channel.cpp
@@ -49,40 +49,37 @@ bool SaudChannel::handleSubTags(int32 &offset) {
uint32 available_size = _tbufferSize - offset;
switch(type) {
- case TYPE_STRK:
- _inData = false;
- if (available_size >= (size + 8)) {
- MemoryChunk c((byte *)_tbuffer + offset);
- handleStrk(c);
- }
- else
- return false;
- break;
- case TYPE_SMRK:
- _inData = false;
- if (available_size >= (size + 8)) {
- MemoryChunk c((byte *)_tbuffer + offset);
- handleSmrk(c);
- }
- else
- return false;
- break;
- case TYPE_SHDR:
- _inData = false;
- if (available_size >= (size + 8)) {
- MemoryChunk c((byte *)_tbuffer + offset);
- handleShdr(c);
- }
- else
- return false;
- break;
- case TYPE_SDAT:
- _inData = true;
- _dataSize = size;
- offset += 8;
+ case TYPE_STRK:
+ _inData = false;
+ if (available_size >= (size + 8)) {
+ MemoryChunk c((byte *)_tbuffer + offset);
+ handleStrk(c);
+ } else
return false;
- default:
- error("unknown Chunk in SAUD track : %s ", Chunk::ChunkString(type));
+ break;
+ case TYPE_SMRK:
+ _inData = false;
+ if (available_size >= (size + 8)) {
+ MemoryChunk c((byte *)_tbuffer + offset);
+ handleSmrk(c);
+ } else
+ return false;
+ break;
+ case TYPE_SHDR:
+ _inData = false;
+ if (available_size >= (size + 8)) {
+ MemoryChunk c((byte *)_tbuffer + offset);
+ handleShdr(c);
+ } else
+ return false;
+ break;
+ case TYPE_SDAT:
+ _inData = true;
+ _dataSize = size;
+ offset += 8;
+ return false;
+ default:
+ error("unknown Chunk in SAUD track : %s ", Chunk::ChunkString(type));
}
offset += size + 8;
return true;
diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp
index e317e7a903..549cafb539 100644
--- a/scumm/smush/smush_player.cpp
+++ b/scumm/smush/smush_player.cpp
@@ -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';
@@ -574,31 +574,31 @@ void SmushPlayer::handleTextResource(Chunk &b) {
// bit 2 - ??? 4
// bit 3 - wrap around 8
switch (flags & 9) {
- case 0:
- sf->drawStringAbsolute(str, _dst, _width, pos_x, pos_y);
- break;
- case 1:
- sf->drawStringCentered(str, _dst, _width, _height, pos_x, MAX(pos_y, top));
- break;
- case 8:
- // FIXME: Is 'right' the maximum line width here, just
- // as it is in the next case? It's used several times
- // in The Dig's intro, where 'left' and 'right' are
- // always 0 and 321 respectively, and apparently we
- // handle that correctly.
- sf->drawStringWrap(str, _dst, _width, _height, pos_x, MAX(pos_y, top), left, right);
- break;
- case 9:
- // In this case, the 'right' parameter is actually the
- // maximum line width. This explains why it's sometimes
- // smaller than 'left'.
- //
- // Note that in The Dig's "Spacetime Six" movie it's
- // 621. I have no idea what that means.
- sf->drawStringWrapCentered(str, _dst, _width, _height, pos_x, MAX(pos_y, top), left, MIN(left + right, _width));
- break;
- default:
- warning("SmushPlayer::handleTextResource. Not handled flags: %d", flags);
+ case 0:
+ sf->drawStringAbsolute(str, _dst, _width, pos_x, pos_y);
+ break;
+ case 1:
+ sf->drawStringCentered(str, _dst, _width, _height, pos_x, MAX(pos_y, top));
+ break;
+ case 8:
+ // FIXME: Is 'right' the maximum line width here, just
+ // as it is in the next case? It's used several times
+ // in The Dig's intro, where 'left' and 'right' are
+ // always 0 and 321 respectively, and apparently we
+ // handle that correctly.
+ sf->drawStringWrap(str, _dst, _width, _height, pos_x, MAX(pos_y, top), left, right);
+ break;
+ case 9:
+ // In this case, the 'right' parameter is actually the
+ // maximum line width. This explains why it's sometimes
+ // smaller than 'left'.
+ //
+ // Note that in The Dig's "Spacetime Six" movie it's
+ // 621. I have no idea what that means.
+ sf->drawStringWrapCentered(str, _dst, _width, _height, pos_x, MAX(pos_y, top), left, MIN(left + right, _width));
+ break;
+ default:
+ warning("SmushPlayer::handleTextResource. Not handled flags: %d", flags);
}
if (string != NULL) {
@@ -753,39 +753,39 @@ void SmushPlayer::handleFrame(Chunk &b) {
while (!b.eof()) {
Chunk *sub = b.subBlock();
if (sub->getSize() & 1) b.seek(1);
- switch(sub->getType()) {
- case TYPE_NPAL:
- handleNewPalette(*sub);
- break;
- case TYPE_FOBJ:
- handleFrameObject(*sub);
- break;
- case TYPE_PSAD:
- handleSoundFrame(*sub);
- break;
- case TYPE_TRES:
- handleTextResource(*sub);
- break;
- case TYPE_XPAL:
- handleDeltaPalette(*sub);
- break;
- case TYPE_IACT:
- handleImuseAction(*sub);
- break;
- case TYPE_STOR:
- handleStore(*sub);
- break;
- case TYPE_FTCH:
- handleFetch(*sub);
- break;
- case TYPE_SKIP:
- handleSkip(*sub);
- break;
- case TYPE_TEXT:
- handleTextResource(*sub);
- break;
- default:
- error("Unknown frame subChunk found : %s, %d", Chunk::ChunkString(sub->getType()), sub->getSize());
+ switch (sub->getType()) {
+ case TYPE_NPAL:
+ handleNewPalette(*sub);
+ break;
+ case TYPE_FOBJ:
+ handleFrameObject(*sub);
+ break;
+ case TYPE_PSAD:
+ handleSoundFrame(*sub);
+ break;
+ case TYPE_TRES:
+ handleTextResource(*sub);
+ break;
+ case TYPE_XPAL:
+ handleDeltaPalette(*sub);
+ break;
+ case TYPE_IACT:
+ handleImuseAction(*sub);
+ break;
+ case TYPE_STOR:
+ handleStore(*sub);
+ break;
+ case TYPE_FTCH:
+ handleFetch(*sub);
+ break;
+ case TYPE_SKIP:
+ handleSkip(*sub);
+ break;
+ case TYPE_TEXT:
+ handleTextResource(*sub);
+ break;
+ default:
+ error("Unknown frame subChunk found : %s, %d", Chunk::ChunkString(sub->getType()), sub->getSize());
}
delete sub;
}
@@ -854,12 +854,12 @@ void SmushPlayer::parseNextFrame() {
}
Chunk *sub = _base->subBlock();
- switch(sub->getType()) {
- case TYPE_FRME:
- handleFrame(*sub);
- break;
- default:
- error("Unknown Chunk found : %d, %d", sub->getType(), sub->getSize());
+ switch (sub->getType()) {
+ case TYPE_FRME:
+ handleFrame(*sub);
+ break;
+ default:
+ error("Unknown Chunk found : %d, %d", sub->getType(), sub->getSize());
}
delete sub;
}
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 9138ce1a99..ef6219e20a 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -347,63 +347,65 @@ void Sound::playSound(int soundID) {
rate = 11025;
int type = *(ptr + 0x0D);
+ int numInstruments;
+
switch(type) {
- case 0: { // Sound effect
- int numInstruments = *(ptr + 0x14);
- ptr += 0x16;
- size -= 0x16;
- while (numInstruments--) {
- int waveSize = READ_LE_UINT32(ptr + 0x0C);
- int loopStart = READ_LE_UINT32(ptr + 0x10);
- int loopEnd = READ_LE_UINT32(ptr + 0x14);
- // it's not exactly * 10, maybe it's not even linear, but * 10 sounds ok.
- rate = READ_LE_UINT32(ptr + 0x18) * 10;
-
- ptr += 0x20;
- size -= 0x20;
- if (size < waveSize) {
- warning("Wrong wave size in sound #%i: %i", soundID, waveSize);
- waveSize = size;
- }
- sound = (char *)malloc(waveSize);
- for (int x = 0; x < waveSize; x++) {
- int bit = *ptr++;
- if (bit < 0x80)
- sound[x] = 0x7F - bit;
- else
- sound[x] = bit;
- }
- size -= waveSize;
-
- if (loopEnd > 0)
- flags |= SoundMixer::FLAG_LOOP;
-
- _scumm->_mixer->playRaw(NULL, sound, waveSize, rate, flags, soundID, 255, 0, loopStart, loopEnd);
+ case 0: // Sound effect
+ numInstruments = *(ptr + 0x14);
+ ptr += 0x16;
+ size -= 0x16;
+ while (numInstruments--) {
+ int waveSize = READ_LE_UINT32(ptr + 0x0C);
+ int loopStart = READ_LE_UINT32(ptr + 0x10);
+ int loopEnd = READ_LE_UINT32(ptr + 0x14);
+ // it's not exactly * 10, maybe it's not even linear, but * 10 sounds ok.
+ rate = READ_LE_UINT32(ptr + 0x18) * 10;
+
+ ptr += 0x20;
+ size -= 0x20;
+ if (size < waveSize) {
+ warning("Wrong wave size in sound #%i: %i", soundID, waveSize);
+ waveSize = size;
}
- break;
- }
+ sound = (char *)malloc(waveSize);
+ for (int x = 0; x < waveSize; x++) {
+ int bit = *ptr++;
+ if (bit < 0x80)
+ sound[x] = 0x7F - bit;
+ else
+ sound[x] = bit;
+ }
+ size -= waveSize;
- case 1: { // Music (Euphony format)
- if (_scumm->_musicEngine)
- _scumm->_musicEngine->startSound (soundID);
- break;
+ if (loopEnd > 0)
+ flags |= SoundMixer::FLAG_LOOP;
+
+ _scumm->_mixer->playRaw(NULL, sound, waveSize, rate, flags, soundID, 255, 0, loopStart, loopEnd);
}
-
- case 2: { // CD track resource
- ptr += 0x16;
+ break;
+ case 1:
+ // Music (Euphony format)
+ if (_scumm->_musicEngine)
+ _scumm->_musicEngine->startSound (soundID);
+ break;
+ case 2: // CD track resource
+ ptr += 0x16;
+
+ 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];
- if (soundID == _currentCDSound)
- if (pollCD() == 1)
- return;
-
playCDTrack(track, loops == 0xff ? -1 : loops, start, end - start);
- _currentCDSound = soundID;
- break;
- }
+ }
+
+ _currentCDSound = soundID;
+ break;
}
}
else if ((_scumm->_gameId == GID_LOOM) && (_scumm->_features & GF_MACINTOSH)) {
@@ -1277,30 +1279,28 @@ void Sound::playBundleSound(char *sound, PlayingSoundHandle *handle) {
while (tag != MKID_BE('DATA')) {
tag = READ_BE_UINT32(ptr); ptr += 4;
switch(tag) {
- case MKID_BE('FRMT'):
- ptr += 12;
- bits = READ_BE_UINT32(ptr); ptr += 4;
- rate = READ_BE_UINT32(ptr); ptr += 4;
- channels = READ_BE_UINT32(ptr); ptr += 4;
+ case MKID_BE('FRMT'):
+ ptr += 12;
+ bits = READ_BE_UINT32(ptr); ptr += 4;
+ rate = READ_BE_UINT32(ptr); ptr += 4;
+ channels = READ_BE_UINT32(ptr); ptr += 4;
break;
- case MKID_BE('TEXT'):
- case MKID_BE('REGN'):
- case MKID_BE('STOP'):
- case MKID_BE('JUMP'):
- case MKID_BE('SYNC'):
- size = READ_BE_UINT32(ptr); ptr += size + 4;
+ case MKID_BE('TEXT'):
+ case MKID_BE('REGN'):
+ case MKID_BE('STOP'):
+ case MKID_BE('JUMP'):
+ case MKID_BE('SYNC'):
+ size = READ_BE_UINT32(ptr); ptr += size + 4;
break;
-
- case MKID_BE('DATA'):
- size = READ_BE_UINT32(ptr); ptr += 4;
+ case MKID_BE('DATA'):
+ size = READ_BE_UINT32(ptr); ptr += 4;
break;
-
- default:
- error("Unknown sound header %c%c%c%c",
- (byte)(tag >> 24),
- (byte)(tag >> 16),
- (byte)(tag >> 8),
- (byte)tag);
+ default:
+ error("Unknown sound header %c%c%c%c",
+ (byte)(tag >> 24),
+ (byte)(tag >> 16),
+ (byte)(tag >> 8),
+ (byte)tag);
}
}
diff --git a/simon/midi.cpp b/simon/midi.cpp
index 038e42e471..04bf64c4da 100644
--- a/simon/midi.cpp
+++ b/simon/midi.cpp
@@ -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);
}
diff --git a/simon/midiparser_s1d.cpp b/simon/midiparser_s1d.cpp
index a8ac5ae603..ffe51cd441 100644
--- a/simon/midiparser_s1d.cpp
+++ b/simon/midiparser_s1d.cpp
@@ -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;
}
diff --git a/simon/res.cpp b/simon/res.cpp
index 1c8a0926ca..2a9de5dd83 100644
--- a/simon/res.cpp
+++ b/simon/res.cpp
@@ -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);
}
diff --git a/simon/simon.cpp b/simon/simon.cpp
index 2d4f525219..bcfdf01396 100644
--- a/simon/simon.cpp
+++ b/simon/simon.cpp
@@ -3387,73 +3387,63 @@ bool SimonEngine::has_vgastruct_with_id(uint16 id, uint16 file) {
void SimonEngine::processSpecialKeys() {
switch (_key_pressed) {
- case 27: // escape
+ case 27: // escape
+ _exit_cutscene = true;
+ break;
+ case 59: // F1
+ vc_write_var(5, 50);
+ vc_write_var(86, 0);
+ break;
+ case 60: // F2
+ vc_write_var(5, 75);
+ vc_write_var(86, 1);
+ break;
+ case 61: // F3
+ vc_write_var(5, 125);
+ vc_write_var(86, 2);
+ break;
+ case 63: // F5
+ if (_game & GF_SIMON2)
_exit_cutscene = true;
- break;
-
- case 59: // F1
- vc_write_var(5, 50);
- vc_write_var(86, 0);
- break;
- case 60: // F2
- vc_write_var(5, 75);
- vc_write_var(86, 1);
- break;
- case 61: // F3
- vc_write_var(5, 125);
- vc_write_var(86, 2);
- break;
- case 63: // F5
- 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;
- break;
- case 'i':
- if (_debugMode)
- _draw_images_debug ^= 1;
- break;
+ 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;
+ break;
+ case 'i':
+ if (_debugMode)
+ _draw_images_debug ^= 1;
+ break;
}
_key_pressed = 0;
@@ -4565,45 +4555,40 @@ void SimonEngine::delay(uint amount) {
while (_system->poll_event(&event)) {
switch (event.event_code) {
- case OSystem::EVENT_KEYDOWN:
- if (event.kbd.flags==OSystem::KBD_CTRL) {
- if (event.kbd.keycode == 'f')
- _fast_mode ^= 1;
- }
- // Make sure backspace works right (this fixes a small issue on OS X)
- if (event.kbd.keycode == 8)
- _key_pressed = 8;
- 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++;
+ case OSystem::EVENT_KEYDOWN:
+ if (event.kbd.flags==OSystem::KBD_CTRL) {
+ if (event.kbd.keycode == 'f')
+ _fast_mode ^= 1;
+ }
+ // Make sure backspace works right (this fixes a small issue on OS X)
+ if (event.kbd.keycode == 8)
+ _key_pressed = 8;
+ 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
- _sdl_mouse_x = event.mouse.x;
- _sdl_mouse_y = event.mouse.y;
+ _sdl_mouse_x = event.mouse.x;
+ _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;
+ 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;
}
}
diff --git a/simon/vga.cpp b/simon/vga.cpp
index 9d7fc54b4b..22d5c78ef1 100644
--- a/simon/vga.cpp
+++ b/simon/vga.cpp
@@ -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() {
diff --git a/sky/compact.cpp b/sky/compact.cpp
index 5a18cb8c47..90879ba512 100644
--- a/sky/compact.cpp
+++ b/sky/compact.cpp
@@ -58,27 +58,27 @@ namespace SkyCompact {
uint16 *getGrafixPtr(Compact *cpt) {
uint16 *buf;
switch (cpt->grafixProg.ptrType) {
- case PTR_NULL:
- return NULL;
- case AUTOROUTE:
- if (!cpt->extCompact)
- error("::getGrafixPtr: request for AR pointer, extCompact is NULL, though.");
- return (cpt->extCompact->animScratch + cpt->grafixProg.pos);
- case COMPACT:
- buf = (uint16*)SkyState::fetchCompact(cpt->grafixProg.ptrTarget);
- if (buf == NULL)
- error("::getGrafixPtr: request for cpt %d pointer. It's NULL.", cpt->grafixProg.ptrTarget);
- return (buf + cpt->grafixProg.pos);
- case COMPACTELEM:
- buf = *(uint16 **)SkyCompact::getCompactElem(cpt, cpt->grafixProg.ptrTarget);
- if (buf == NULL)
- error("::getGrafixPtr: request for elem ptr %d. It's NULL.", cpt->grafixProg.ptrTarget);
- return buf + cpt->grafixProg.pos;
- case TALKTABLE:
- buf = (uint16 *)SkyTalkAnims::animTalkTablePtr[cpt->grafixProg.ptrTarget];
- return buf + cpt->grafixProg.pos;
- default:
- error("::getGrafixPtr: unknown grafixProg type for Compact cpt");
+ case PTR_NULL:
+ return NULL;
+ case AUTOROUTE:
+ if (!cpt->extCompact)
+ error("::getGrafixPtr: request for AR pointer, extCompact is NULL, though.");
+ return (cpt->extCompact->animScratch + cpt->grafixProg.pos);
+ case COMPACT:
+ buf = (uint16*)SkyState::fetchCompact(cpt->grafixProg.ptrTarget);
+ if (buf == NULL)
+ error("::getGrafixPtr: request for cpt %d pointer. It's NULL.", cpt->grafixProg.ptrTarget);
+ return (buf + cpt->grafixProg.pos);
+ case COMPACTELEM:
+ buf = *(uint16 **)SkyCompact::getCompactElem(cpt, cpt->grafixProg.ptrTarget);
+ if (buf == NULL)
+ error("::getGrafixPtr: request for elem ptr %d. It's NULL.", cpt->grafixProg.ptrTarget);
+ return buf + cpt->grafixProg.pos;
+ case TALKTABLE:
+ buf = (uint16 *)SkyTalkAnims::animTalkTablePtr[cpt->grafixProg.ptrTarget];
+ return buf + cpt->grafixProg.pos;
+ default:
+ error("::getGrafixPtr: unknown grafixProg type for Compact cpt");
}
return NULL; // never reached
}
diff --git a/sky/control.cpp b/sky/control.cpp
index ca36685866..36f115b368 100644
--- a/sky/control.cpp
+++ b/sky/control.cpp
@@ -502,96 +502,77 @@ uint16 SkyControl::handleClick(SkyConResource *pButton) {
char quitDos[] = "Quit to DOS?";
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)) {
- restartGame();
- return GAME_RESTORED;
- } else
- return 0;
-
- case QUIT_TO_DOS:
- animClick(pButton);
- if (getYesNo(quitDos)) {
- showGameQuitMsg(false);
- delay(1500);
- _system->quit();
- }
+ 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)) {
+ restartGame();
+ return GAME_RESTORED;
+ } else
return 0;
-
- default:
- error("SkyControl::handleClick: unknown routine: %X",pButton->_onClick);
+ case QUIT_TO_DOS:
+ animClick(pButton);
+ if (getYesNo(quitDos)) {
+ showGameQuitMsg(false);
+ delay(1500);
+ _system->quit();
+ }
+ return 0;
+ default:
+ error("SkyControl::handleClick: unknown routine: %X",pButton->_onClick);
}
}
@@ -1649,21 +1630,21 @@ void SkyControl::restartGame(void) {
uint16 *resetData = lz77decode((uint16 *)_resetData288);
switch (SkyState::_systemVars.gameVersion) {
- case 303:
- applyDiff(resetData, (uint16*)_resetDiff303, 206);
- break;
- case 331:
- applyDiff(resetData, (uint16*)_resetDiff331, 206);
- break;
- case 348:
- applyDiff(resetData, (uint16*)_resetDiff348, 206);
- break;
- case 365:
- case 368:
- case 372:
- applyDiff(resetData, (uint16*)_resetDiffCd, 214);
- default:
- break;
+ case 303:
+ applyDiff(resetData, (uint16*)_resetDiff303, 206);
+ break;
+ case 331:
+ applyDiff(resetData, (uint16*)_resetDiff331, 206);
+ break;
+ case 348:
+ applyDiff(resetData, (uint16*)_resetDiff348, 206);
+ break;
+ case 365:
+ case 368:
+ case 372:
+ applyDiff(resetData, (uint16*)_resetDiffCd, 214);
+ default:
+ break;
}
// ok, we finally have our savedata
@@ -1688,41 +1669,35 @@ void SkyControl::delay(unsigned int amount) {
do {
while (_system->poll_event(&event)) {
switch (event.event_code) {
- case OSystem::EVENT_KEYDOWN:
- // Make sure backspace works right (this fixes a small issue on OS X)
- if (event.kbd.keycode == 8)
- _keyPressed = 8;
- 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;
+ case OSystem::EVENT_KEYDOWN:
+ // Make sure backspace works right (this fixes a small issue on OS X)
+ if (event.kbd.keycode == 8)
+ _keyPressed = 8;
+ 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
- _mouseX = event.mouse.x;
- _mouseY = event.mouse.y;
+ _mouseX = event.mouse.x;
+ _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;
+ 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;
}
}
diff --git a/sky/intro.cpp b/sky/intro.cpp
index 4ed7bf7fa3..c40a47f41f 100644
--- a/sky/intro.cpp
+++ b/sky/intro.cpp
@@ -667,86 +667,86 @@ bool SkyIntro::nextPart(uint16 *&data) {
// return false means cancel intro
uint16 command = *data++;
switch (command) {
- case SHOWSCREEN:
- _skyScreen->showScreen(*data++);
- return true;
- case FADEUP:
- _skyScreen->paletteFadeUp(*data++);
- return true;
- case FADEDOWN:
- _skyScreen->fnFadeDown(0);
- return true;
- case DELAY:
- if (!escDelay(*data++))
+ case SHOWSCREEN:
+ _skyScreen->showScreen(*data++);
+ return true;
+ case FADEUP:
+ _skyScreen->paletteFadeUp(*data++);
+ return true;
+ case FADEDOWN:
+ _skyScreen->fnFadeDown(0);
+ return true;
+ case DELAY:
+ if (!escDelay(*data++))
+ return false;
+ return true;
+ case DOFLIRT:
+ _skyScreen->startSequence(*data++);
+ while (_skyScreen->sequenceRunning())
+ if (!escDelay(50))
return false;
- return true;
- case DOFLIRT:
- _skyScreen->startSequence(*data++);
- while (_skyScreen->sequenceRunning())
- if (!escDelay(50))
- return false;
- return true;
- case SCROLLFLIRT:
- return floppyScrollFlirt();
- case COMMANDFLIRT:
- return commandFlirt(data);
- case STOPFLIRT:
- _skyScreen->stopSequence();
- return true;
- case STARTMUSIC:
- _skyMusic->startMusic(*data++);
- return true;
- case WAITMUSIC:
- while (_skyMusic->musicIsPlaying())
- if (!escDelay(50))
- return false;
- return true;
- case BGFLIRT:
- _skyScreen->startSequence(*data++);
- return true;
- case WAITFLIRT:
- while (_skyScreen->sequenceRunning())
- if (!escDelay(50))
- return false;
- return true;
- case PLAYVOICE:
- if (!escDelay(200))
+ return true;
+ case SCROLLFLIRT:
+ return floppyScrollFlirt();
+ case COMMANDFLIRT:
+ return commandFlirt(data);
+ case STOPFLIRT:
+ _skyScreen->stopSequence();
+ return true;
+ case STARTMUSIC:
+ _skyMusic->startMusic(*data++);
+ return true;
+ case WAITMUSIC:
+ while (_skyMusic->musicIsPlaying())
+ if (!escDelay(50))
return false;
- vData = _skyDisk->loadFile(*data++, NULL);
- // HACK: Fill the header with silence. We should
- // probably use _skySound instead of calling playRaw()
- // directly, but this will have to do for now.
- memset(vData, 127, sizeof(struct dataFileHeader));
- _mixer->playRaw(&_voice, vData, _skyDisk->_lastLoadedFileSize, 11025,
- SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED, SOUND_VOICE);
- return true;
- case WAITVOICE:
- while (_voice)
- if (!escDelay(50))
- return false;
- return true;
- case LOADBG:
- _mixer->stopID(SOUND_BG);
- if (_bgBuf)
- free(_bgBuf);
- _bgBuf = _skyDisk->loadFile(*data++, NULL);
- _bgSize = _skyDisk->_lastLoadedFileSize;
- return true;
- case LOOPBG:
- _mixer->stopID(SOUND_BG);
- _mixer->playRaw(&_bgSfx, _bgBuf + 256, _bgSize - 768, 11025,
- SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_LOOP, SOUND_BG);
- return true;
- case PLAYBG:
- _mixer->stopID(SOUND_BG);
- _mixer->playRaw(&_bgSfx, _bgBuf + 256, _bgSize - 768, 11025,
- SoundMixer::FLAG_UNSIGNED, SOUND_BG);
- return true;
- case STOPBG:
- _mixer->stopID(SOUND_BG);
- return true;
- default:
- error("Unknown intro command %X", command);
+ return true;
+ case BGFLIRT:
+ _skyScreen->startSequence(*data++);
+ return true;
+ case WAITFLIRT:
+ while (_skyScreen->sequenceRunning())
+ if (!escDelay(50))
+ return false;
+ return true;
+ case PLAYVOICE:
+ if (!escDelay(200))
+ return false;
+ vData = _skyDisk->loadFile(*data++, NULL);
+ // HACK: Fill the header with silence. We should
+ // probably use _skySound instead of calling playRaw()
+ // directly, but this will have to do for now.
+ memset(vData, 127, sizeof(struct dataFileHeader));
+ _mixer->playRaw(&_voice, vData, _skyDisk->_lastLoadedFileSize, 11025,
+ SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED, SOUND_VOICE);
+ return true;
+ case WAITVOICE:
+ while (_voice)
+ if (!escDelay(50))
+ return false;
+ return true;
+ case LOADBG:
+ _mixer->stopID(SOUND_BG);
+ if (_bgBuf)
+ free(_bgBuf);
+ _bgBuf = _skyDisk->loadFile(*data++, NULL);
+ _bgSize = _skyDisk->_lastLoadedFileSize;
+ return true;
+ case LOOPBG:
+ _mixer->stopID(SOUND_BG);
+ _mixer->playRaw(&_bgSfx, _bgBuf + 256, _bgSize - 768, 11025,
+ SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_LOOP, SOUND_BG);
+ return true;
+ case PLAYBG:
+ _mixer->stopID(SOUND_BG);
+ _mixer->playRaw(&_bgSfx, _bgBuf + 256, _bgSize - 768, 11025,
+ SoundMixer::FLAG_UNSIGNED, SOUND_BG);
+ return true;
+ case STOPBG:
+ _mixer->stopID(SOUND_BG);
+ return true;
+ default:
+ error("Unknown intro command %X", command);
}
return true;
}
@@ -803,27 +803,27 @@ bool SkyIntro::commandFlirt(uint16 *&data) {
data++;
uint16 command = *data++;
switch(command) {
- case IC_PREPARE_TEXT:
- _skyText->getText(*data++);
- _skyText->displayText(_textBuf, true, INTRO_TEXT_WIDTH, 255);
- break;
- case IC_SHOW_TEXT:
- ((dataFileHeader*)_textBuf)->s_x = *data++;
- ((dataFileHeader*)_textBuf)->s_y = *data++;
- showTextBuf();
- break;
- case IC_REMOVE_TEXT:
- restoreScreen();
- break;
- case IC_MAKE_SOUND:
- _skySound->playSound(data[0], data[1], 0);
- data += 2;
- break;
- case IC_FX_VOLUME:
- _skySound->playSound(1, *data++, 0);
- break;
- default:
- error("Unknown FLIRT command %X\n", command);
+ case IC_PREPARE_TEXT:
+ _skyText->getText(*data++);
+ _skyText->displayText(_textBuf, true, INTRO_TEXT_WIDTH, 255);
+ break;
+ case IC_SHOW_TEXT:
+ ((dataFileHeader*)_textBuf)->s_x = *data++;
+ ((dataFileHeader*)_textBuf)->s_y = *data++;
+ showTextBuf();
+ break;
+ case IC_REMOVE_TEXT:
+ restoreScreen();
+ break;
+ case IC_MAKE_SOUND:
+ _skySound->playSound(data[0], data[1], 0);
+ data += 2;
+ break;
+ case IC_FX_VOLUME:
+ _skySound->playSound(1, *data++, 0);
+ break;
+ default:
+ error("Unknown FLIRT command %X\n", command);
}
}
if (!escDelay(50)) {
diff --git a/sky/music/adlibchannel.cpp b/sky/music/adlibchannel.cpp
index 98b7a9fb17..a5215ca2b5 100644
--- a/sky/music/adlibchannel.cpp
+++ b/sky/music/adlibchannel.cpp
@@ -138,30 +138,30 @@ uint8 SkyAdlibChannel::process(uint16 aktTime) {
// dummy opcode
} else if (opcode >= 0x90) {
switch (opcode&0xF) {
- case 0: com90_caseNoteOff(); break;
- case 1: com90_stopChannel(); break;
- case 2: com90_setupInstrument(); break;
- case 3:
- returnVal = com90_updateTempo();
- break;
- case 5: com90_getFreqOffset(); break;
- case 6: com90_getChannelVolume(); break;
- case 7: com90_getTremoVibro(); break;
- case 8: com90_rewindMusic(); break;
- case 9: com90_keyOff(); break;
- case 12: com90_setStartOfData(); break;
- case 4: //com90_dummy();
- case 10: //com90_error();
- case 11: //com90_doLodsb();
- case 13: //com90_do_two_Lodsb();
- error("SkyChannel: dummy music routine 0x%02X was called",opcode);
- _channelData.channelActive = 0;
- break;
- default:
- // these opcodes aren't implemented in original music driver
- error("SkyChannel: Not existant routine 0x%02X was called",opcode);
- _channelData.channelActive = 0;
- break;
+ case 0: com90_caseNoteOff(); break;
+ case 1: com90_stopChannel(); break;
+ case 2: com90_setupInstrument(); break;
+ case 3:
+ returnVal = com90_updateTempo();
+ break;
+ case 5: com90_getFreqOffset(); break;
+ case 6: com90_getChannelVolume(); break;
+ case 7: com90_getTremoVibro(); break;
+ case 8: com90_rewindMusic(); break;
+ case 9: com90_keyOff(); break;
+ case 12: com90_setStartOfData(); break;
+ case 4: //com90_dummy();
+ case 10: //com90_error();
+ case 11: //com90_doLodsb();
+ case 13: //com90_do_two_Lodsb();
+ error("SkyChannel: dummy music routine 0x%02X was called",opcode);
+ _channelData.channelActive = 0;
+ break;
+ default:
+ // these opcodes aren't implemented in original music driver
+ error("SkyChannel: Not existant routine 0x%02X was called",opcode);
+ _channelData.channelActive = 0;
+ break;
}
} else {
// new adlib channel assignment
diff --git a/sky/music/gmchannel.cpp b/sky/music/gmchannel.cpp
index ceb3ca24a0..744b15f383 100644
--- a/sky/music/gmchannel.cpp
+++ b/sky/music/gmchannel.cpp
@@ -93,30 +93,30 @@ uint8 SkyGmChannel::process(uint16 aktTime) {
// dummy opcode
} else if (opcode >= 0x90) {
switch (opcode&0xF) {
- case 0: com90_caseNoteOff(); break;
- case 1: com90_stopChannel(); break;
- case 2: com90_setupInstrument(); break;
- case 3:
- returnVal = com90_updateTempo();
- break;
- case 5: com90_getPitch(); break;
- case 6: com90_getChannelVolume(); break;
- case 8: com90_rewindMusic(); break;
- case 9: com90_keyOff(); break;
- case 11: com90_getChannelPanValue(); break;
- case 12: com90_setStartOfData(); break;
- case 13: com90_getChannelControl(); break;
- case 4: //com90_dummy();
- case 7: //com90_skipTremoVibro();
- case 10: //com90_error();
- error("SkyChannel: dummy music routine 0x%02X was called",opcode);
- _channelData.channelActive = 0;
- break;
- default:
- // these opcodes aren't implemented in original music driver
- error("SkyChannel: Not existant routine 0x%02X was called",opcode);
- _channelData.channelActive = 0;
- break;
+ case 0: com90_caseNoteOff(); break;
+ case 1: com90_stopChannel(); break;
+ case 2: com90_setupInstrument(); break;
+ case 3:
+ returnVal = com90_updateTempo();
+ break;
+ case 5: com90_getPitch(); break;
+ case 6: com90_getChannelVolume(); break;
+ case 8: com90_rewindMusic(); break;
+ case 9: com90_keyOff(); break;
+ case 11: com90_getChannelPanValue(); break;
+ case 12: com90_setStartOfData(); break;
+ case 13: com90_getChannelControl(); break;
+ case 4: //com90_dummy();
+ case 7: //com90_skipTremoVibro();
+ case 10: //com90_error();
+ error("SkyChannel: dummy music routine 0x%02X was called",opcode);
+ _channelData.channelActive = 0;
+ break;
+ default:
+ // these opcodes aren't implemented in original music driver
+ error("SkyChannel: Not existant routine 0x%02X was called",opcode);
+ _channelData.channelActive = 0;
+ break;
}
} else {
// new midi channel assignment
diff --git a/sky/music/musicbase.cpp b/sky/music/musicbase.cpp
index c0672d70b5..fecfff6dae 100644
--- a/sky/music/musicbase.cpp
+++ b/sky/music/musicbase.cpp
@@ -78,32 +78,32 @@ void SkyMusicBase::musicCommand(uint16 command)
return ;
}
switch(command >> 8) {
- case 0:
- debug(1,"SkyMusic: got call to startAdlibDriver(). Not necessary in this implementation.");
- break;
- case 1:
- debug(1,"SkyMusic: got call to stopDriver(). Not necessary in this implementation.");
- break;
- case 2:
- debug(1,"SkyMusic: got call to SetTempo(). Tempo is fixed in this implementation.");
- break;
- case 3:
- debug(1,"SkyMusic: ignored direct call to driverPoll().");
- break;
- case 4:
- startMusic(command&0xFF);
- break;
- case 6:
- reinitFM();
- break;
- case 7:
- stopMusic();
- break;
- case 13:
- setFMVolume(command&0xFF);
- break;
- default:
- debug(1,"musicCommand %d ignored.",command>>8);
+ case 0:
+ debug(1,"SkyMusic: got call to startAdlibDriver(). Not necessary in this implementation.");
+ break;
+ case 1:
+ debug(1,"SkyMusic: got call to stopDriver(). Not necessary in this implementation.");
+ break;
+ case 2:
+ debug(1,"SkyMusic: got call to SetTempo(). Tempo is fixed in this implementation.");
+ break;
+ case 3:
+ debug(1,"SkyMusic: ignored direct call to driverPoll().");
+ break;
+ case 4:
+ startMusic(command&0xFF);
+ break;
+ case 6:
+ reinitFM();
+ break;
+ case 7:
+ stopMusic();
+ break;
+ case 13:
+ setFMVolume(command&0xFF);
+ break;
+ default:
+ debug(1,"musicCommand %d ignored.",command>>8);
}
}
diff --git a/sky/sky.cpp b/sky/sky.cpp
index 84d21b495b..8709522b68 100644
--- a/sky/sky.cpp
+++ b/sky/sky.cpp
@@ -142,24 +142,24 @@ uint8 SkyState::_languageTable[11] = {
void SkyState::doCheat(uint8 num) {
switch(num) {
- case 1: warning("executed cheat: get jammer");
- SkyLogic::_scriptVariables[258] = 42; // got_jammer
- SkyLogic::_scriptVariables[240] = 69; // got_sponsor
- break;
- case 2: warning("executed cheat: computer room");
- SkyLogic::_scriptVariables[479] = 2; // card_status
- SkyLogic::_scriptVariables[480] = 1; // card_fix
- break;
- case 3: warning("executed cheat: get to burke");
- SkyLogic::_scriptVariables[190] = 42; // knows_port
- break;
- case 4: warning("executed cheat: get to reactor section");
- SkyLogic::_scriptVariables[451] = 42; // foreman_friend
- _skyLogic->fnSendSync(8484, 1, 0); // send sync to RAD suit (put in locker)
- _skyLogic->fnKillId(ID_ANITA_SPY, 0, 0); // stop anita from getting to you
- break;
- default: warning("unknown cheat: %d", num);
- break;
+ case 1: warning("executed cheat: get jammer");
+ SkyLogic::_scriptVariables[258] = 42; // got_jammer
+ SkyLogic::_scriptVariables[240] = 69; // got_sponsor
+ break;
+ case 2: warning("executed cheat: computer room");
+ SkyLogic::_scriptVariables[479] = 2; // card_status
+ SkyLogic::_scriptVariables[480] = 1; // card_fix
+ break;
+ case 3: warning("executed cheat: get to burke");
+ SkyLogic::_scriptVariables[190] = 42; // knows_port
+ break;
+ case 4: warning("executed cheat: get to reactor section");
+ SkyLogic::_scriptVariables[451] = 42; // foreman_friend
+ _skyLogic->fnSendSync(8484, 1, 0); // send sync to RAD suit (put in locker)
+ _skyLogic->fnKillId(ID_ANITA_SPY, 0, 0); // stop anita from getting to you
+ break;
+ default: warning("unknown cheat: %d", num);
+ break;
}
}
@@ -417,51 +417,46 @@ void SkyState::delay(uint amount) { //copied and mutilated from Simon.cpp
do {
while (_system->poll_event(&event)) {
switch (event.event_code) {
- case OSystem::EVENT_KEYDOWN:
- if (event.kbd.flags == OSystem::KBD_CTRL) {
- if (event.kbd.keycode == 'f') {
- _fastMode ^= 1;
- break;
- }
- if (event.kbd.keycode == 'g') {
- _fastMode ^= 2;
- break;
- }
+ case OSystem::EVENT_KEYDOWN:
+ if (event.kbd.flags == OSystem::KBD_CTRL) {
+ if (event.kbd.keycode == 'f') {
+ _fastMode ^= 1;
+ break;
}
-
- // Make sure backspace works right (this fixes a small issue on OS X)
- if (event.kbd.keycode == 8)
- _key_pressed = 8;
- 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;
+ if (event.kbd.keycode == 'g') {
+ _fastMode ^= 2;
+ break;
}
- break;
+ }
- case OSystem::EVENT_LBUTTONDOWN:
- _skyMouse->buttonPressed(2);
-#ifdef _WIN32_WCE
+ // Make sure backspace works right (this fixes a small issue on OS X)
+ if (event.kbd.keycode == 8)
+ _key_pressed = 8;
+ 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
+ _sdl_mouse_x = event.mouse.x;
+ _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;
+ 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;
}
}
diff --git a/sky/text.cpp b/sky/text.cpp
index 12d7cc7aab..f308b5c198 100644
--- a/sky/text.cpp
+++ b/sky/text.cpp
@@ -222,17 +222,17 @@ void SkyText::fnSetFont(uint32 fontNr) {
struct charSet *newCharSet;
switch (fontNr) {
- case 0:
- newCharSet = &_mainCharacterSet;
- break;
- case 1:
- newCharSet = &_controlCharacterSet;
- break;
- case 2:
- newCharSet = &_linkCharacterSet;
- break;
- default:
- error("Tried to set invalid font (%d)", fontNr);
+ case 0:
+ newCharSet = &_mainCharacterSet;
+ break;
+ case 1:
+ newCharSet = &_controlCharacterSet;
+ break;
+ case 2:
+ newCharSet = &_linkCharacterSet;
+ break;
+ default:
+ error("Tried to set invalid font (%d)", fontNr);
}
_curCharSet = fontNr;