aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorPaweł Kołodziejski2003-11-08 21:59:32 +0000
committerPaweł Kołodziejski2003-11-08 21:59:32 +0000
commit1f9e408e2fab0f11a648d113fd7e4a19f113f234 (patch)
treefd1992d4410f511e2691ddfb8fea144af9df83d2 /scumm
parent9e7402e14b381030b0b09f4ba71e92132e192eff (diff)
downloadscummvm-rg350-1f9e408e2fab0f11a648d113fd7e4a19f113f234.tar.gz
scummvm-rg350-1f9e408e2fab0f11a648d113fd7e4a19f113f234.tar.bz2
scummvm-rg350-1f9e408e2fab0f11a648d113fd7e4a19f113f234.zip
cleanup whitespaces
svn-id: r11217
Diffstat (limited to 'scumm')
-rw-r--r--scumm/charset.cpp2
-rw-r--r--scumm/debugger.cpp11
-rw-r--r--scumm/dialogs.cpp23
-rw-r--r--scumm/gfx.cpp32
-rw-r--r--scumm/imuse.cpp23
-rw-r--r--scumm/imuse_digi.cpp2
-rw-r--r--scumm/imuse_internal.h66
-rw-r--r--scumm/imuse_player.cpp55
-rw-r--r--scumm/intern.h3
-rw-r--r--scumm/midiparser_eup.cpp6
-rw-r--r--scumm/nut_renderer.cpp8
-rw-r--r--scumm/object.cpp2
-rw-r--r--scumm/player_mod.h3
-rw-r--r--scumm/player_v1.cpp18
-rw-r--r--scumm/player_v2.cpp62
-rw-r--r--scumm/player_v2.h4
-rw-r--r--scumm/player_v2a.cpp19
-rw-r--r--scumm/player_v2a.h3
-rw-r--r--scumm/player_v3a.cpp10
-rw-r--r--scumm/player_v3a.h9
-rw-r--r--scumm/resource.cpp127
-rw-r--r--scumm/script_v2.cpp26
-rw-r--r--scumm/scummvm.cpp11
-rw-r--r--scumm/sound.cpp13
-rw-r--r--scumm/string.cpp10
25 files changed, 257 insertions, 291 deletions
diff --git a/scumm/charset.cpp b/scumm/charset.cpp
index 6461775a1a..70218803ba 100644
--- a/scumm/charset.cpp
+++ b/scumm/charset.cpp
@@ -1014,7 +1014,7 @@ void CharsetRendererClassic::printChar(int chr) {
return;
_vm->_charsetColorMap[1] = _color;
-
+
if (is2byte) {
_dropShadow = true;
charPtr = g_scumm->get2byteCharPtr(chr);
diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp
index 3461bb6ad0..c90ad3cf0d 100644
--- a/scumm/debugger.cpp
+++ b/scumm/debugger.cpp
@@ -474,7 +474,7 @@ bool ScummDebugger::Cmd_Object(int argc, const char **argv) {
} else if (!strcmp(argv[2], "name")) {
DebugPrintf("Name of object %d: %s\n", obj, _vm->getObjOrActorName(obj));
} else {
- DebugPrintf("Unknown object command '%s'\nUse <pickup | state> as command\n", argv[2]);
+ DebugPrintf("Unknown object command '%s'\nUse <pickup | state> as command\n", argv[2]);
}
return true;
@@ -605,8 +605,7 @@ void ScummDebugger::printBox(int box) {
static int gfxPrimitivesCompareInt(const void *a, const void *b);
-static void hlineColor(ScummEngine *scumm, int x1, int x2, int y, byte color)
-{
+static void hlineColor(ScummEngine *scumm, int x1, int x2, int y, byte color) {
VirtScreen *vs = &scumm->virtscr[0];
byte *ptr;
@@ -634,13 +633,11 @@ static void hlineColor(ScummEngine *scumm, int x1, int x2, int y, byte color)
}
}
-static int gfxPrimitivesCompareInt(const void *a, const void *b)
-{
+static int gfxPrimitivesCompareInt(const void *a, const void *b) {
return (*(const int *)a) - (*(const int *)b);
}
-static void fillQuad(ScummEngine *scumm, int16 vx[4], int16 vy[4], int color)
-{
+static void fillQuad(ScummEngine *scumm, int16 vx[4], int16 vy[4], int color) {
const int N = 4;
int i;
int y;
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp
index d7054297cf..85e5f9016c 100644
--- a/scumm/dialogs.cpp
+++ b/scumm/dialogs.cpp
@@ -246,7 +246,6 @@ void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 da
}
}
-
Common::StringList generateSavegameList(ScummEngine *scumm, bool saveMode) {
// Get savegame names
Common::StringList l;
@@ -273,15 +272,15 @@ Common::StringList generateSavegameList(ScummEngine *scumm, bool saveMode) {
enum {
kRowHeight = 18,
kBigButtonWidth = 90,
- kMainMenuWidth = (kBigButtonWidth + 2*8),
- kMainMenuHeight = 7*kRowHeight + 3*5 + 7 + 5
+ kMainMenuWidth = (kBigButtonWidth + 2 * 8),
+ kMainMenuHeight = 7 * kRowHeight + 3 * 5 + 7 + 5
};
#define addBigButton(label, cmd, hotkey) \
new ButtonWidget(this, x, y, kBigButtonWidth, 16, label, cmd, hotkey); y += kRowHeight
MainMenuDialog::MainMenuDialog(ScummEngine *scumm)
- : ScummDialog(scumm, (320 - kMainMenuWidth)/2, (200 - kMainMenuHeight)/2, kMainMenuWidth, kMainMenuHeight) {
+ : ScummDialog(scumm, (320 - kMainMenuWidth) / 2, (200 - kMainMenuHeight)/2, kMainMenuWidth, kMainMenuHeight) {
int y = 7;
const int x = (_w - kBigButtonWidth) / 2;
@@ -418,13 +417,13 @@ OptionsDialog::OptionsDialog(ScummEngine *scumm)
// Add the buttons
//
#ifdef _WIN32_WCE
- addButton(_w-kButtonWidth-8, _h-24 - kButtonHeight - 4, "OK", kOKCmd, 'O');
- addButton(_w-2*kButtonWidth-12, _h-24 - kButtonHeight - 4, "Cancel", kCancelCmd, 'C');
+ addButton(_w - kButtonWidth - 8, _h - 24 - kButtonHeight - 4, "OK", kOKCmd, 'O');
+ addButton(_w - 2 * kButtonWidth - 12, _h - 24 - kButtonHeight - 4, "Cancel", kCancelCmd, 'C');
- addButton(kButtonWidth+12, _h-24, "Keys", kKeysCmd, 'K');
+ addButton(kButtonWidth+12, _h - 24, "Keys", kKeysCmd, 'K');
#else
- addButton(_w-kButtonWidth-8, _h-24, "OK", kOKCmd, 'O');
- addButton(_w-2*kButtonWidth-12, _h-24, "Cancel", kCancelCmd, 'C');
+ addButton(_w - kButtonWidth-8, _h - 24, "OK", kOKCmd, 'O');
+ addButton(_w - 2 * kButtonWidth-12, _h - 24, "Cancel", kCancelCmd, 'C');
#endif
//
@@ -433,7 +432,7 @@ OptionsDialog::OptionsDialog(ScummEngine *scumm)
int yoffset = 8;
_masterVolumeSlider = new SliderWidget(this, 5, yoffset, 185, 12, "Master volume: ", 100, kMasterVolumeChanged);
- _masterVolumeLabel = new StaticTextWidget(this, 200, yoffset+2, 24, 16, "100%", kTextAlignLeft);
+ _masterVolumeLabel = new StaticTextWidget(this, 200, yoffset + 2, 24, 16, "100%", kTextAlignLeft);
_masterVolumeSlider->setMinValue(0); _masterVolumeSlider->setMaxValue(255);
_masterVolumeLabel->setFlags(WIDGET_CLEARBG);
yoffset += 16;
@@ -445,7 +444,7 @@ OptionsDialog::OptionsDialog(ScummEngine *scumm)
yoffset += 16;
_sfxVolumeSlider = new SliderWidget(this, 5, yoffset, 185, 12, "SFX volume: ", 100, kSfxVolumeChanged);
- _sfxVolumeLabel = new StaticTextWidget(this, 200, yoffset+2, 24, 16, "100%", kTextAlignLeft);
+ _sfxVolumeLabel = new StaticTextWidget(this, 200, yoffset + 2, 24, 16, "100%", kTextAlignLeft);
_sfxVolumeSlider->setMinValue(0); _sfxVolumeSlider->setMaxValue(255);
_sfxVolumeLabel->setFlags(WIDGET_CLEARBG);
yoffset += 16;
@@ -641,7 +640,7 @@ void InfoDialog::setInfoText(const String& message) {
_x = (_scumm->_screenWidth - width) >> 1;
_w = width;
- new StaticTextWidget(this, 4, 4, _w-8, _h, message, kTextAlignCenter);
+ new StaticTextWidget(this, 4, 4, _w - 8, _h, message, kTextAlignCenter);
}
#pragma mark -
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index 6a03e4cfb7..05dd039263 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -802,7 +802,7 @@ void ScummEngine::redrawBGStrip(int start, int num) {
gdi._C64ObjectMode = false;
}
gdi.drawBitmap(getResourceAddress(rtRoom, _roomResource) + _IM00_offs,
- &virtscr[0], s, 0, _roomWidth, virtscr[0].height, s, num, 0, _roomStrips);
+ &virtscr[0], s, 0, _roomWidth, virtscr[0].height, s, num, 0, _roomStrips);
}
void ScummEngine::restoreCharsetBg() {
@@ -910,7 +910,7 @@ byte *ScummEngine::getMaskBuffer(int x, int y, int z) {
* and objects, used throughout all SCUMM versions.
*/
void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height,
- int stripnr, int numstrip, byte flag, StripTable *table) {
+ int stripnr, int numstrip, byte flag, StripTable *table) {
assert(ptr);
assert(height > 0);
byte *backbuff_ptr, *bgbak_ptr;
@@ -1304,10 +1304,10 @@ StripTable *Gdi::generateStripTable(const byte *src, int width, int height, Stri
for (x = 0 ; x < width; x++) {
if ((x % 8) == 0) {
- assert(x/8 < 160);
- table->run[x/8] = run;
- table->color[x/8] = color;
- table->offsets[x/8] = src - bitmapStart;
+ assert(x / 8 < 160);
+ table->run[x / 8] = run;
+ table->color[x / 8] = color;
+ table->offsets[x / 8] = src - bitmapStart;
}
for (y = 0; y < height; y++) {
@@ -1761,12 +1761,12 @@ void Gdi::decompressMaskImgOr(byte *dst, const byte *src, int height) {
}
}
-#define READ_BIT (cl--, bit = bits&1, bits>>=1,bit)
-#define FILL_BITS do { \
- if (cl <= 8) { \
- bits |= (*src++ << cl); \
- cl += 8; \
- } \
+#define READ_BIT (cl--, bit = bits & 1, bits >>= 1, bit)
+#define FILL_BITS do { \
+ if (cl <= 8) { \
+ bits |= (*src++ << cl); \
+ cl += 8; \
+ } \
} while (0)
void Gdi::unkDecodeA(byte *dst, const byte *src, int height) {
@@ -2829,7 +2829,7 @@ void ScummEngine::cyclePalette() {
if (_proc_special_palette) {
doCycleIndirectPalette(_proc_special_palette, cycl->start, cycl->end, !(cycl->flags & 2));
}
-
+
if (_shadowPalette) {
if (_version >= 7) {
for (j = 0; j < NUM_SHADOW_PALETTE; j++)
@@ -2864,7 +2864,7 @@ void ScummEngine::palManipulateInit(int start, int end, int string_id, int time)
string3 = getStringAddress(string_id + 2);
if (!string1 || !string2 || !string3) {
warning("palManipulateInit(%d,%d,%d,%d): Cannot obtain string resources %d, %d and %d",
- start, end, string_id, time, string_id, string_id + 1, string_id + 2);
+ start, end, string_id, time, string_id, string_id + 1, string_id + 2);
return;
}
@@ -2875,7 +2875,7 @@ void ScummEngine::palManipulateInit(int start, int end, int string_id, int time)
_palManipStart = start;
_palManipEnd = end;
_palManipCounter = 0;
-
+
if (!_palManipPalette)
_palManipPalette = (byte *)calloc(0x300, 1);
if (!_palManipIntermediatePal)
@@ -3509,7 +3509,7 @@ void ScummEngine::setCursorHotspot(int x, int y) {
void ScummEngine::updateCursor() {
_system->set_mouse_cursor(_grabbedCursor, _cursor.width, _cursor.height,
- _cursor.hotspotX, _cursor.hotspotY);
+ _cursor.hotspotX, _cursor.hotspotY);
}
void ScummEngine::animateCursor() {
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp
index e0e01254d2..02ccb729da 100644
--- a/scumm/imuse.cpp
+++ b/scumm/imuse.cpp
@@ -63,8 +63,7 @@ _queue_cleared(0),
_master_volume(0),
_music_volume(0),
_trigger_count(0),
-_snm_trigger_index(0)
-{
+_snm_trigger_index(0) {
memset(_channel_volume,0,sizeof(_channel_volume));
memset(_channel_volume_eff,0,sizeof(_channel_volume_eff));
memset(_volchan_table,0,sizeof(_volchan_table));
@@ -229,7 +228,7 @@ bool IMuseInternal::startSound(int sound) {
debug(2, "IMuseInternal::startSound(): Couldn't find sound %d!", sound);
return false;
}
-
+
// Check which MIDI driver this track should use.
// If it's NULL, it ain't something we can play.
MidiDriver *driver = getBestMidiDriver(sound);
@@ -461,8 +460,7 @@ int IMuseInternal::get_queue_sound_status(int sound) const {
for (i = 0; i < ARRAYSIZE (_deferredCommands); ++i) {
if (_deferredCommands[i].time_left && _deferredCommands[i].a == 8 &&
- _deferredCommands[i].b == sound)
- {
+ _deferredCommands[i].b == sound) {
return 2;
}
}
@@ -942,9 +940,7 @@ int32 IMuseInternal::ImClearTrigger(int sound, int id) {
int i;
ImTrigger *trig = _snm_triggers;
for (i = ARRAYSIZE(_snm_triggers); i; --i, ++trig) {
- if ((sound == -1 || trig->sound == sound) &&
- trig->id && (id == -1 || trig->id == id))
- {
+ if ((sound == -1 || trig->sound == sound) && trig->id && (id == -1 || trig->id == id)) {
trig->sound = trig->id = 0;
++count;
}
@@ -957,8 +953,7 @@ int32 IMuseInternal::ImFireAllTriggers(int sound) {
int count = 0;
int i;
for (i = 0; i < 16; ++i) {
- if (_snm_triggers [i].sound == sound)
- {
+ if (_snm_triggers [i].sound == sound) {
_snm_triggers [i].sound = _snm_triggers [i].id = 0;
doCommand (8, _snm_triggers[i].command);
++count;
@@ -1660,8 +1655,7 @@ void Part::sendPitchBend() {
// so we'll do the scaling ourselves.
if (_player->_se->isNativeMT32())
bend = bend * _pitchbend_factor / 12;
- _mc->pitchBend(clamp(bend + (_detune_eff * 64 / 12) +
- (_transpose_eff * 8192 / 12), -8192, 8191));
+ _mc->pitchBend(clamp(bend + (_detune_eff * 64 / 12) + (_transpose_eff * 8192 / 12), -8192, 8191));
}
void Part::programChange(byte value) {
@@ -1709,9 +1703,8 @@ void IMuseInternal::reallocateMidiChannels(MidiDriver *midi) {
hipart = NULL;
for (i = 32, part = _parts; i; i--, part++) {
if (part->_player && part->_player->getMidiDriver() == midi &&
- !part->_percussion && part->_on &&
- !part->_mc && part->_pri_eff >= hipri)
- {
+ !part->_percussion && part->_on &&
+ !part->_mc && part->_pri_eff >= hipri) {
hipri = part->_pri_eff;
hipart = part;
}
diff --git a/scumm/imuse_digi.cpp b/scumm/imuse_digi.cpp
index adfe7ff35c..74e143ad69 100644
--- a/scumm/imuse_digi.cpp
+++ b/scumm/imuse_digi.cpp
@@ -783,7 +783,7 @@ void IMuseDigital::musicTimer() {
int8 pan = _channel[l]._volumeRight - _channel[l]._volume;
if (_channel[l]._mixerChannel == 0) {
_scumm->_mixer->newStream(&_channel[l]._mixerChannel, buf, mixer_size,
- _channel[l]._freq, _channel[l]._mixerFlags, 100000, _channel[l]._volume, pan);
+ _channel[l]._freq, _channel[l]._mixerFlags, 100000, _channel[l]._volume, pan);
} else {
_scumm->_mixer->appendStream(_channel[l]._mixerChannel, buf, mixer_size);
_scumm->_mixer->setChannelVolume(_channel[l]._mixerChannel, _channel[l]._volume);
diff --git a/scumm/imuse_internal.h b/scumm/imuse_internal.h
index 3cc6b903f4..e959db6e66 100644
--- a/scumm/imuse_internal.h
+++ b/scumm/imuse_internal.h
@@ -222,42 +222,42 @@ public:
Player();
virtual ~Player();
- int addParameterFader(int param, int target, int time);
- void clear();
- void clearLoop();
- void fixAfterLoad();
+ int addParameterFader(int param, int target, int time);
+ void clear();
+ void clearLoop();
+ void fixAfterLoad();
Part * getActivePart(uint8 part);
- uint getBeatIndex();
- int8 getDetune() const { return _detune; }
- byte getEffectiveVolume() const { return _vol_eff; }
- int getID() const { return _id; }
+ uint getBeatIndex();
+ int8 getDetune() const { return _detune; }
+ byte getEffectiveVolume() const { return _vol_eff; }
+ int getID() const { return _id; }
MidiDriver *getMidiDriver() const { return _midi; }
- int getParam(int param, byte chan);
- int8 getPan() const { return _pan; }
+ int getParam(int param, byte chan);
+ int8 getPan() const { return _pan; }
Part * getPart(uint8 part);
- byte getPriority() const { return _priority; }
- uint getTicksPerBeat() const { return TICKS_PER_BEAT; }
- int8 getTranspose() const { return _transpose; }
- byte getVolume() const { return _volume; }
- bool isActive() const { return _active; }
- bool isFadingOut() const;
- bool isGM() const { return _isGM; }
- bool isMT32() const { return _isMT32; }
- bool jump(uint track, uint beat, uint tick);
- void onTimer();
- void removePart(Part *part);
- int scan(uint totrack, uint tobeat, uint totick);
- int save_or_load(Serializer *ser);
- int setHook(byte cls, byte value, byte chan) { return _hook.set(cls, value, chan); }
- void setDetune(int detune);
- bool setLoop(uint count, uint tobeat, uint totick, uint frombeat, uint fromtick);
- void setPan(int pan);
- void setPriority(int pri);
- void setSpeed(byte speed);
- int setTranspose(byte relative, int b);
- int setVolume(byte vol);
- bool startSound(int sound, MidiDriver *midi, bool passThrough);
- int getMusicTimer() const;
+ byte getPriority() const { return _priority; }
+ uint getTicksPerBeat() const { return TICKS_PER_BEAT; }
+ int8 getTranspose() const { return _transpose; }
+ byte getVolume() const { return _volume; }
+ bool isActive() const { return _active; }
+ bool isFadingOut() const;
+ bool isGM() const { return _isGM; }
+ bool isMT32() const { return _isMT32; }
+ bool jump(uint track, uint beat, uint tick);
+ void onTimer();
+ void removePart(Part *part);
+ int scan(uint totrack, uint tobeat, uint totick);
+ int save_or_load(Serializer *ser);
+ int setHook(byte cls, byte value, byte chan) { return _hook.set(cls, value, chan); }
+ void setDetune(int detune);
+ bool setLoop(uint count, uint tobeat, uint totick, uint frombeat, uint fromtick);
+ void setPan(int pan);
+ void setPriority(int pri);
+ void setSpeed(byte speed);
+ int setTranspose(byte relative, int b);
+ int setVolume(byte vol);
+ bool startSound(int sound, MidiDriver *midi, bool passThrough);
+ int getMusicTimer() const;
public:
// MidiDriver interface
diff --git a/scumm/imuse_player.cpp b/scumm/imuse_player.cpp
index 23048341b3..19764b031c 100644
--- a/scumm/imuse_player.cpp
+++ b/scumm/imuse_player.cpp
@@ -58,30 +58,30 @@ uint16 Player::_active_notes[128];
//////////////////////////////////////////////////
Player::Player() :
-_midi(0),
-_parser(0),
-_parts(0),
-_active(false),
-_scanning(false),
-_id(0),
-_priority(0),
-_volume(0),
-_pan(0),
-_transpose(0),
-_detune(0),
-_vol_eff(0),
-_track_index(0),
-_loop_to_beat(0),
-_loop_from_beat(0),
-_loop_counter(0),
-_loop_to_tick(0),
-_loop_from_tick(0),
-_speed(128),
-_isMT32(false),
-_isGM(false),
-_se(0),
-_vol_chan(0)
-{ }
+ _midi(0),
+ _parser(0),
+ _parts(0),
+ _active(false),
+ _scanning(false),
+ _id(0),
+ _priority(0),
+ _volume(0),
+ _pan(0),
+ _transpose(0),
+ _detune(0),
+ _vol_eff(0),
+ _track_index(0),
+ _loop_to_beat(0),
+ _loop_from_beat(0),
+ _loop_counter(0),
+ _loop_to_tick(0),
+ _loop_from_tick(0),
+ _speed(128),
+ _isMT32(false),
+ _isGM(false),
+ _se(0),
+ _vol_chan(0){
+}
Player::~Player() {
if (_parser) {
@@ -101,7 +101,7 @@ bool Player::startSound(int sound, MidiDriver *midi, bool passThrough) {
warning("Player::startSound(): Couldn't find start of sound %d!", sound);
return false;
}
-
+
_isMT32 = _se->isMT32(sound);
_isGM = _se->isGM(sound);
@@ -142,8 +142,7 @@ bool Player::isFadingOut() const {
int i;
for (i = 0; i < ARRAYSIZE(_parameterFaders); ++i) {
if (_parameterFaders[i].param == ParameterFader::pfVolume &&
- _parameterFaders[i].end == 0)
- {
+ _parameterFaders[i].end == 0) {
return true;
}
}
@@ -1217,7 +1216,7 @@ int Player::save_or_load(Serializer *ser) {
ser->saveLoadEntries(this, playerEntries);
ser->saveLoadArrayOf(_parameterFaders, ARRAYSIZE(_parameterFaders),
- sizeof(ParameterFader), parameterFaderEntries);
+ sizeof(ParameterFader), parameterFaderEntries);
return 0;
}
diff --git a/scumm/intern.h b/scumm/intern.h
index e5c34699eb..b3ae70ab94 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -325,8 +325,7 @@ protected:
File _hFileTable[17];
public:
- ScummEngine_v6(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs) : ScummEngine(detector, syst, gs)
- {
+ ScummEngine_v6(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs) : ScummEngine(detector, syst, gs) {
VAR_VIDEONAME = 0xFF;
VAR_TIMEDATE_YEAR = 0xFF;
diff --git a/scumm/midiparser_eup.cpp b/scumm/midiparser_eup.cpp
index c8c6f95fdc..8522b8cc5f 100644
--- a/scumm/midiparser_eup.cpp
+++ b/scumm/midiparser_eup.cpp
@@ -72,13 +72,13 @@ void MidiParser_EUP::parseNextEvent (EventInfo &info) {
// fits-all" sound until we actually support the
// FM synthesis capabilities of FM Towns.
for (; _presend < 12; ++_presend) {
- if (_instr_to_channel[_presend>>1] >= 16)
+ if (_instr_to_channel[_presend >> 1] >= 16)
continue;
info.start = pos;
info.delta = 0;
if (_presend & 1) {
- byte *data = &_instruments[_presend>>1][0];
- data[1] = _instr_to_channel[_presend>>1];
+ byte *data = &_instruments[_presend >> 1][0];
+ data[1] = _instr_to_channel[_presend >> 1];
info.event = 0xF0;
info.ext.data = data;
info.length = 48;
diff --git a/scumm/nut_renderer.cpp b/scumm/nut_renderer.cpp
index 1d3c98eb09..df737d9cda 100644
--- a/scumm/nut_renderer.cpp
+++ b/scumm/nut_renderer.cpp
@@ -118,7 +118,7 @@ bool NutRenderer::loadFont(const char *filename, const char *directory) {
if (_loaded) {
warning("NutRenderer::loadFont() Font already loaded, ok, loading...");
}
-
+
File file;
file.open(filename, directory);
if (file.isOpen() == false) {
@@ -142,7 +142,7 @@ bool NutRenderer::loadFont(const char *filename, const char *directory) {
free(dataSrc);
return false;
}
-
+
_nbChars = READ_LE_UINT16(dataSrc + 10);
uint32 offset = READ_BE_UINT32(dataSrc + 4) + 8;
int32 decoded_length;
@@ -304,7 +304,7 @@ void NutRenderer::drawChar(byte *dst, byte *mask, byte c, int x, int y, byte col
byte maskmask;
int maskpos;
-
+
for (int ty = 0; ty < height; ty++) {
maskmask = revBitMask[x & 7];
maskpos = 0;
@@ -342,7 +342,7 @@ void NutRenderer::draw2byte(byte *dst, byte *mask, int c, int x, int y, byte col
byte maskmask;
int maskpos;
-
+
for (int ty = 0; ty < height; ty++) {
maskmask = revBitMask[x & 7];
maskpos = 0;
diff --git a/scumm/object.cpp b/scumm/object.cpp
index 7dbd6685fc..4e16016b80 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -1399,7 +1399,7 @@ void ScummEngine::nukeFlObjects(int min, int max) {
}
void ScummEngine::enqueueObject(int objectNumber, int objectX, int objectY, int objectWidth,
- int objectHeight, int scaleX, int scaleY, int image, int mode) {
+ int objectHeight, int scaleX, int scaleY, int image, int mode) {
BlastObject *eo;
ObjectData *od;
diff --git a/scumm/player_mod.h b/scumm/player_mod.h
index b48bc07cbe..3533a92eee 100644
--- a/scumm/player_mod.h
+++ b/scumm/player_mod.h
@@ -55,8 +55,7 @@ private:
MOD_MAXCHANS = 16
};
- struct soundChan
- {
+ struct soundChan {
int id;
uint8 vol;
int8 pan;
diff --git a/scumm/player_v1.cpp b/scumm/player_v1.cpp
index 5fc4dea07a..2ae223cdab 100644
--- a/scumm/player_v1.cpp
+++ b/scumm/player_v1.cpp
@@ -133,7 +133,7 @@ void Player_V1::parseSpeakerChunk() {
parse_again:
_chunk_type = READ_LE_UINT16(_next_chunk);
debug(6, "parseSpeakerChunk: sound %d, offset %4x, chunk %x",
- _current_nr, _next_chunk - _current_data, _chunk_type);
+ _current_nr, _next_chunk - _current_data, _chunk_type);
_next_chunk += 2;
switch (_chunk_type) {
@@ -170,7 +170,7 @@ void Player_V1::parseSpeakerChunk() {
_channels[0].freq = _start;
_next_chunk += 10;
debug(6, "chunk 1: mplex %d, freq %d -> %d step %d x %d",
- _mplex, _start, _end, _delta, _repeat_ctr);
+ _mplex, _start, _end, _delta, _repeat_ctr);
break;
case 2:
_start = READ_LE_UINT16(_next_chunk);
@@ -180,7 +180,7 @@ void Player_V1::parseSpeakerChunk() {
_next_chunk += 6;
_forced_level = -1;
debug(6, "chunk 2: %d -> %d step %d",
- _start, _end, _delta);
+ _start, _end, _delta);
break;
case 3:
_start = READ_LE_UINT16(_next_chunk);
@@ -190,7 +190,7 @@ void Player_V1::parseSpeakerChunk() {
_next_chunk += 6;
_forced_level = -1;
debug(6, "chunk 3: %d -> %d step %d",
- _start, _end, _delta);
+ _start, _end, _delta);
break;
}
}
@@ -209,7 +209,7 @@ void Player_V1::nextSpeakerCmd() {
_next_chunk += 2;
}
debug(7, "nextSpeakerCmd: chunk %d, offset %4x: notelen %d",
- _chunk_type, _next_chunk - 2 - _current_data, _time_left);
+ _chunk_type, _next_chunk - 2 - _current_data, _time_left);
if (_time_left == 0) {
parseSpeakerChunk();
@@ -262,7 +262,7 @@ void Player_V1::parsePCjrChunk() {
set_mplex(3000);
_forced_level = 0;
- parse_again:
+parse_again:
_chunk_type = READ_LE_UINT16(_next_chunk);
debug(6, "parsePCjrChunk: sound %d, offset %4x, chunk %x",
@@ -539,7 +539,7 @@ void Player_V1::generateSpkSamples(int16 *data, uint len) {
} else {
squareGenerator(0, _channels[0].freq, 0, 0, data, len);
debug(9, "speaker: %8x: freq %d %.1f", _tick_len,
- _channels[0].freq, 1193000.0/_channels[0].freq);
+ _channels[0].freq, 1193000.0 / _channels[0].freq);
}
lowPassFilter(data, len);
}
@@ -588,7 +588,7 @@ void Player_V1::generatePCjrSamples(int16 *data, uint len) {
hasdata = true;
squareGenerator(i, freq, vol, 0, data, len);
debug(9, "channel[%d]: %8x: freq %d %.1f ; volume %d",
- i, _tick_len, freq, 111860.0/freq, vol);
+ i, _tick_len, freq, 111860.0 / freq, vol);
} else {
int noiseFB = (freq & 4) ? FB_WNOISE : FB_PNOISE;
int n = (freq & 3);
@@ -597,7 +597,7 @@ void Player_V1::generatePCjrSamples(int16 *data, uint len) {
hasdata = true;
squareGenerator(i, freq, vol, noiseFB, data, len);
debug(9, "channel[%d]: %x: noise freq %d %.1f ; volume %d",
- i, _tick_len, freq, 111860.0/freq, vol);
+ i, _tick_len, freq, 111860.0 / freq, vol);
}
}
diff --git a/scumm/player_v2.cpp b/scumm/player_v2.cpp
index 2e42a3d7f7..c0bc738003 100644
--- a/scumm/player_v2.cpp
+++ b/scumm/player_v2.cpp
@@ -447,7 +447,7 @@ void Player_V2::chainSound(int nr, byte *data) {
_channels[i].d.music_script_nr = nr;
if (data) {
- _channels[i].d.next_cmd = READ_LE_UINT16(data+offset+2*i);
+ _channels[i].d.next_cmd = READ_LE_UINT16(data + offset + 2 * i);
if (_channels[i].d.next_cmd)
_channels[i].d.time_left = 1;
}
@@ -521,8 +521,8 @@ void Player_V2::startSound(int nr) {
}
if (nr != _current_nr
- && restartable
- && (!_next_nr
+ && restartable
+ && (!_next_nr
|| nprio <= prio)) {
_next_nr = nr;
@@ -590,15 +590,15 @@ void Player_V2::execute_cmd(ChannelInfo *channel) {
case 0xf8: // set hull curve
debug(7, "channels[%d]: hull curve %2d",
channel - _channels, *script_ptr);
- channel->d.hull_curve = hull_offsets[*script_ptr/2];
+ channel->d.hull_curve = hull_offsets[*script_ptr / 2];
script_ptr++;
break;
case 0xf9: // set freqmod curve
debug(7, "channels[%d]: freqmod curve %2d",
channel - _channels, *script_ptr);
- channel->d.freqmod_table = freqmod_offsets[*script_ptr/4];
- channel->d.freqmod_modulo = freqmod_lengths[*script_ptr/4];
+ channel->d.freqmod_table = freqmod_offsets[*script_ptr / 4];
+ channel->d.freqmod_modulo = freqmod_lengths[*script_ptr / 4];
script_ptr++;
break;
@@ -658,16 +658,16 @@ void Player_V2::execute_cmd(ChannelInfo *channel) {
offset = READ_LE_UINT16 (script_ptr);
script_ptr += 2;
debug(7, "loop if %d to %d", opcode, offset);
- if (!channel->array[opcode/2] || --channel->array[opcode/2])
+ if (!channel->array[opcode / 2] || --channel->array[opcode/2])
script_ptr += offset;
break;
case 0xff: // set parameter
opcode = *script_ptr++;
value = READ_LE_UINT16 (script_ptr);
- channel->array[opcode/2] = value;
+ channel->array[opcode / 2] = value;
debug(7, "channels[%d]: set param %2d = %5d",
- channel - &_channels[0], opcode, value);
+ channel - &_channels[0], opcode, value);
script_ptr += 2;
if (opcode == 14) {
/* tempo var */
@@ -708,11 +708,11 @@ void Player_V2::execute_cmd(ChannelInfo *channel) {
debug(8, "channels[%d]: @%04x note: %3d+%d len: %2d hull: %d mod: %d/%d/%d %s",
- dest_channel - channel, script_ptr ? script_ptr - _current_data - 2 : 0,
- note, (signed short) dest_channel->d.transpose, channel->d.time_left,
- dest_channel->d.hull_curve, dest_channel->d.freqmod_table,
- dest_channel->d.freqmod_incr,dest_channel->d.freqmod_multiplier,
- is_last_note ? "last":"");
+ dest_channel - channel, script_ptr ? script_ptr - _current_data - 2 : 0,
+ note, (signed short) dest_channel->d.transpose, channel->d.time_left,
+ dest_channel->d.hull_curve, dest_channel->d.freqmod_table,
+ dest_channel->d.freqmod_incr,dest_channel->d.freqmod_multiplier,
+ is_last_note ? "last":"");
uint16 myfreq;
@@ -775,10 +775,10 @@ void Player_V2::next_freqs(ChannelInfo *channel) {
+ channel->d.base_freq;
debug(9, "Freq: %d/%d, %d/%d/%d*%d %d",
- channel->d.base_freq, (int16)channel->d.freq_delta,
- channel->d.freqmod_table, channel->d.freqmod_offset,
- channel->d.freqmod_incr, channel->d.freqmod_multiplier,
- channel->d.freq);
+ channel->d.base_freq, (int16)channel->d.freq_delta,
+ channel->d.freqmod_table, channel->d.freqmod_offset,
+ channel->d.freqmod_incr, channel->d.freqmod_multiplier,
+ channel->d.freq);
if (channel->d.note_length && !--channel->d.note_length) {
channel->d.hull_offset = 16;
@@ -791,15 +791,15 @@ void Player_V2::next_freqs(ChannelInfo *channel) {
#if 0
debug(9, "channels[%d]: freq %d hull %d/%d/%d",
- channel - &_channels[0], channel->d.freq,
- channel->d.hull_curve, channel->d.hull_offset,
- channel->d.hull_counter);
+ channel - &_channels[0], channel->d.freq,
+ channel->d.hull_curve, channel->d.hull_offset,
+ channel->d.hull_counter);
#endif
if (channel->d.hull_counter && !--channel->d.hull_counter) {
for (;;) {
const int16 *hull_ptr = hulls
- + channel->d.hull_curve + channel->d.hull_offset/2;
+ + channel->d.hull_curve + channel->d.hull_offset / 2;
if (hull_ptr[1] == -1) {
channel->d.volume = hull_ptr[0];
if (hull_ptr[0] == 0)
@@ -854,14 +854,14 @@ void Player_V2::nextTick() {
void Player_V2::lowPassFilter(int16 *sample, uint len) {
for (uint i = 0; i < len; i++) {
_level = (int) (_level * _decay
- + sample[0] * (0x10000-_decay)) >> 16;
+ + sample[0] * (0x10000 - _decay)) >> 16;
sample[0] = sample[1] = _level;
sample += 2;
}
}
void Player_V2::squareGenerator(int channel, int freq, int vol,
- int noiseFeedback, int16 *sample, uint len) {
+ int noiseFeedback, int16 *sample, uint len) {
int period = _update_step * freq;
long nsample;
if (period == 0)
@@ -896,8 +896,8 @@ void Player_V2::squareGenerator(int channel, int freq, int vol,
duration -= _timer_count[channel];
nsample = *sample +
- (((signed long) (duration - (1 << (FIXP_SHIFT-1)))
- * (signed long) _volumetable[vol]) >> FIXP_SHIFT);
+ (((signed long) (duration - (1 << (FIXP_SHIFT - 1)))
+ * (signed long) _volumetable[vol]) >> FIXP_SHIFT);
/* overflow: clip value */
if (nsample > 0x7fff)
nsample = 0x7fff;
@@ -914,8 +914,8 @@ void Player_V2::generateSpkSamples(int16 *data, uint len) {
int winning_channel = -1;
for (int i = 0; i < 4; i++) {
if (winning_channel == -1
- && _channels[i].d.volume
- && _channels[i].d.time_left) {
+ && _channels[i].d.volume
+ && _channels[i].d.time_left) {
winning_channel = i;
}
}
@@ -943,8 +943,8 @@ void Player_V2::generatePCjrSamples(int16 *data, uint len) {
if (_channels[i].d.volume && _channels[i].d.time_left) {
for (j = 0; j < i; j++) {
if (_channels[j].d.volume
- && _channels[j].d.time_left
- && freq == (_channels[j].d.freq >> 6)) {
+ && _channels[j].d.time_left
+ && freq == (_channels[j].d.freq >> 6)) {
/* HACK: this channel is playing at
* the same frequency as another.
* Synchronize it to the same phase to
@@ -978,7 +978,7 @@ void Player_V2::generatePCjrSamples(int16 *data, uint len) {
}
#if 0
debug(9, "channel[%d]: freq %d %.1f ; volume %d",
- i, freq, 111860.0/freq, vol);
+ i, freq, 111860.0 / freq, vol);
#endif
}
diff --git a/scumm/player_v2.h b/scumm/player_v2.h
index bda919015d..8e47122106 100644
--- a/scumm/player_v2.h
+++ b/scumm/player_v2.h
@@ -140,8 +140,8 @@ protected:
void lowPassFilter(int16 *data, uint len);
void squareGenerator(int channel, int freq, int vol,
- int noiseFeedback, int16 *sample, uint len);
-
+ int noiseFeedback, int16 *sample, uint len);
+
private:
static void premix_proc(void *param, int16 *buf, uint len);
void do_mix(int16 *buf, uint len);
diff --git a/scumm/player_v2a.cpp b/scumm/player_v2a.cpp
index 8b0a823bd7..533ca8e591 100644
--- a/scumm/player_v2a.cpp
+++ b/scumm/player_v2a.cpp
@@ -732,7 +732,7 @@ public:
_id = id;
_data = (char *)malloc(READ_LE_UINT16(data));
memcpy(_data, data, READ_LE_UINT16(data));
-
+
_loopnum = 1;
_step = 2;
_curfreq = _freq1;
@@ -752,7 +752,7 @@ public:
}
if (_curfreq >= _freq2)
return true;
- const char steps[8] = {0,2,2,3,4,8,15,2};
+ const char steps[8] = {0, 2, 2, 3, 4, 8, 15, 2};
_curfreq = _freq1;
_step = steps[++_loopnum];
if (_loopnum == 7) {
@@ -818,10 +818,10 @@ public:
}
virtual bool update() {
assert(_id);
- updatefreq(_freq1,_step1,0x00AA,0x00FA);
- updatefreq(_freq2,_step2,0x019A,0x03B6);
- updatefreq(_freq3,_step3,0x00AA,0x00FA);
- updatefreq(_freq4,_step4,0x019A,0x03B6);
+ updatefreq(_freq1, _step1, 0x00AA, 0x00FA);
+ updatefreq(_freq2, _step2, 0x019A, 0x03B6);
+ updatefreq(_freq3, _step3, 0x00AA, 0x00FA);
+ updatefreq(_freq4, _step4, 0x019A, 0x03B6);
_mod->setChannelFreq(_id | 0x000, BASE_FREQUENCY / _freq1);
_mod->setChannelFreq(_id | 0x100, BASE_FREQUENCY / _freq2);
_mod->setChannelFreq(_id | 0x200, BASE_FREQUENCY / _freq3);
@@ -986,8 +986,9 @@ private:
int _ticks;
};
-#define CRCToSound(CRC, SOUND) \
- if (crc == CRC) return new SOUND
+#define CRCToSound(CRC, SOUND) \
+ if (crc == CRC) \
+ return new SOUND
static V2A_Sound *findSound (unsigned long crc) {
CRCToSound(0x8FAB08C4, V2A_Sound_SingleLooped(0x006C,0x2B58,0x016E,0x3F)); // Maniac 17
@@ -1165,7 +1166,7 @@ void Player_V2A::startSound(int nr) {
assert(_scumm);
byte *data = _scumm->getResourceAddress(rtSound, nr);
assert(data);
- uint32 crc = GetCRC(data + 0x0A,READ_BE_UINT16(data + 0x08));
+ uint32 crc = GetCRC(data + 0x0A, READ_BE_UINT16(data + 0x08));
V2A_Sound *snd = findSound(crc);
if (snd == NULL) {
warning("player_v2a - sound %i not recognized yet (crc %08X)",nr,crc);
diff --git a/scumm/player_v2a.h b/scumm/player_v2a.h
index dfd7ba27bf..438ac29c14 100644
--- a/scumm/player_v2a.h
+++ b/scumm/player_v2a.h
@@ -55,8 +55,7 @@ private:
V2A_MAXSLOTS = 8
};
- struct soundSlot
- {
+ struct soundSlot {
int id;
V2A_Sound *sound;
};
diff --git a/scumm/player_v3a.cpp b/scumm/player_v3a.cpp
index e311de2fbe..865e676c2a 100644
--- a/scumm/player_v3a.cpp
+++ b/scumm/player_v3a.cpp
@@ -28,10 +28,10 @@
namespace Scumm {
static const uint16 note_freqs[4][12] = {
- {0x06B0,0x0650,0x05F4,0x05A0,0x054C,0x0500,0x04B8,0x0474,0x0434,0x03F8,0x03C0,0x0388},
- {0x0358,0x0328,0x02FA,0x02D0,0x02A6,0x0280,0x025C,0x023A,0x021A,0x01FC,0x01E0,0x01C4},
- {0x01AC,0x0194,0x017D,0x0168,0x0153,0x0140,0x012E,0x011D,0x010D,0x00FE,0x00F0,0x00E2},
- {0x00D6,0x00CA,0x00BE,0x00B4,0x00A9,0x00A0,0x0097,0x008E,0x0086,0x007F,0x00F0,0x00E2}
+ {0x06B0, 0x0650, 0x05F4, 0x05A0, 0x054C, 0x0500, 0x04B8, 0x0474, 0x0434, 0x03F8, 0x03C0, 0x0388},
+ {0x0358, 0x0328, 0x02FA, 0x02D0, 0x02A6, 0x0280, 0x025C, 0x023A, 0x021A, 0x01FC, 0x01E0, 0x01C4},
+ {0x01AC, 0x0194, 0x017D, 0x0168, 0x0153, 0x0140, 0x012E, 0x011D, 0x010D, 0x00FE, 0x00F0, 0x00E2},
+ {0x00D6, 0x00CA, 0x00BE, 0x00B4, 0x00A9, 0x00A0, 0x0097, 0x008E, 0x0086, 0x007F, 0x00F0, 0x00E2}
};
Player_V3A::Player_V3A(ScummEngine *scumm) {
@@ -206,7 +206,7 @@ void Player_V3A::startSound(int nr) {
_wavetable[i] = NULL;
_isinit = true;
}
-
+
if (getSoundStatus(nr))
stopSound(nr); // if a sound is playing, restart it
diff --git a/scumm/player_v3a.h b/scumm/player_v3a.h
index 3635ed7ade..9d47791e19 100644
--- a/scumm/player_v3a.h
+++ b/scumm/player_v3a.h
@@ -55,21 +55,18 @@ private:
V3A_MAXSFX = 8
};
- struct musChan
- {
+ struct musChan {
int id;
int dur;
};
- struct sfxChan
- {
+ struct sfxChan {
int id;
int dur;
// SFX will eventually have pitch bends
};
- struct instData
- {
+ struct instData {
char *_idat[6];
uint16 _ilen[6];
char *_ldat[6];
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index b8038d0706..9056466718 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -1297,78 +1297,76 @@ void ScummEngine::convertADResource(int type, int idx, byte *src_ptr, int size)
if (instr[i*16 + 13])
warning("Sound %d instrument %d uses percussion", idx, i);
- debug(4, "Sound %d: instrument %d on channel %d.",
- idx, i, ch);
-
- memcpy(ptr, ADLIB_INSTR_MIDI_HACK,
- sizeof(ADLIB_INSTR_MIDI_HACK));
+ debug(4, "Sound %d: instrument %d on channel %d.", idx, i, ch);
+
+ memcpy(ptr, ADLIB_INSTR_MIDI_HACK, sizeof(ADLIB_INSTR_MIDI_HACK));
ptr[5] += ch;
ptr[28] += ch;
ptr[92] += ch;
-
+
/* flags_1 */
ptr[30 + 0] = (instr[i * 16 + 3] >> 4) & 0xf;
ptr[30 + 1] = instr[i * 16 + 3] & 0xf;
-
+
/* oplvl_1 */
ptr[30 + 2] = (instr[i * 16 + 4] >> 4) & 0xf;
ptr[30 + 3] = instr[i * 16 + 4] & 0xf;
-
+
/* atdec_1 */
ptr[30 + 4] = ((~instr[i * 16 + 5]) >> 4) & 0xf;
ptr[30 + 5] = (~instr[i * 16 + 5]) & 0xf;
-
+
/* sustrel_1 */
ptr[30 + 6] = ((~instr[i * 16 + 6]) >> 4) & 0xf;
ptr[30 + 7] = (~instr[i * 16 + 6]) & 0xf;
-
+
/* waveform_1 */
ptr[30 + 8] = (instr[i * 16 + 7] >> 4) & 0xf;
ptr[30 + 9] = instr[i * 16 + 7] & 0xf;
-
+
/* flags_2 */
ptr[30 + 10] = (instr[i * 16 + 8] >> 4) & 0xf;
ptr[30 + 11] = instr[i * 16 + 8] & 0xf;
-
+
/* oplvl_2 */
ptr[30 + 12] = (instr[i * 16 + 9] >> 4) & 0xf;
ptr[30 + 13] = instr[i * 16 + 9] & 0xf;
-
+
/* atdec_2 */
ptr[30 + 14] = ((~instr[i * 16 + 10]) >> 4) & 0xf;
ptr[30 + 15] = (~instr[i * 16 + 10]) & 0xf;
-
+
/* sustrel_2 */
ptr[30 + 16] = ((~instr[i * 16 + 11]) >> 4) & 0xf;
ptr[30 + 17] = (~instr[i * 16 + 11]) & 0xf;
-
+
/* waveform_2 */
ptr[30 + 18] = (instr[i * 16 + 12] >> 4) & 0xf;
ptr[30 + 19] = instr[i * 16 + 12] & 0xf;
-
+
/* feedback */
ptr[30 + 20] = (instr[i * 16 + 2] >> 4) & 0xf;
ptr[30 + 21] = instr[i * 16 + 2] & 0xf;
ptr += sizeof(ADLIB_INSTR_MIDI_HACK);
}
-
+
// There is a constant delay of ppqn/3 before the music starts.
if (ppqn / 3 >= 128)
*ptr++ = (ppqn / 3 >> 7) | 0x80;
*ptr++ = ppqn / 3 & 0x7f;
-
+
// Now copy the actual music data
memcpy(ptr, track, size);
ptr += size;
-
+
if (!play_once) {
// The song is meant to be looped. We achieve this by inserting just
// before the song end a jump to the song start. More precisely we abuse
// a S&M sysex, "maybe_jump" to achieve this effect. We could also
// use a set_loop sysex, but it's a bit longer, a little more complicated,
// and has no advantage either.
-
+
// First, find the track end
byte *end = ptr;
ptr -= size;
@@ -1377,7 +1375,7 @@ void ScummEngine::convertADResource(int type, int idx, byte *src_ptr, int size)
break;
}
assert(ptr < end);
-
+
// Now insert the jump. The jump offset is measured in ticks.
// We have ppqn/3 ticks before the first note.
@@ -1399,16 +1397,16 @@ void ScummEngine::convertADResource(int type, int idx, byte *src_ptr, int size)
* tracks.
*/
ptr = writeMIDIHeader(ptr, "ASFX", ppqn, total_size);
-
+
byte current_instr[3][14];
int current_note[3];
int track_time[3];
byte *track_data[3];
-
+
int track_ctr = 0;
byte chunk_type = 0;
int delay, delay2, olddelay;
-
+
// Write a tempo change Meta event
// 473 / 4 Hz, convert to micro seconds.
dw = 1000000 * ppqn * 4 / 473;
@@ -1416,7 +1414,7 @@ void ScummEngine::convertADResource(int type, int idx, byte *src_ptr, int size)
*ptr++ = (byte)((dw >> 16) & 0xFF);
*ptr++ = (byte)((dw >> 8) & 0xFF);
*ptr++ = (byte)(dw & 0xFF);
-
+
for (i = 0; i < 3; i++) {
track_time[i] = -1;
current_note[i] = -1;
@@ -1445,7 +1443,7 @@ void ScummEngine::convertADResource(int type, int idx, byte *src_ptr, int size)
break;
src_ptr++;
}
-
+
int curtime = 0;
for (;;) {
int mintime = -1;
@@ -1459,11 +1457,10 @@ void ScummEngine::convertADResource(int type, int idx, byte *src_ptr, int size)
}
if (mintime < 0)
break;
-
+
src_ptr = track_data[ch];
chunk_type = *src_ptr;
-
-
+
if (current_note[ch] >= 0) {
delay = mintime - curtime;
curtime = mintime;
@@ -1473,71 +1470,70 @@ void ScummEngine::convertADResource(int type, int idx, byte *src_ptr, int size)
*ptr++ = 0;
current_note[ch] = -1;
}
-
-
+
switch (chunk_type) {
case 1:
/* Instrument definition */
- memcpy(current_instr[ch], src_ptr+1, 14);
+ memcpy(current_instr[ch], src_ptr + 1, 14);
src_ptr += 15;
break;
-
+
case 2:
/* tone/parammodulation */
memcpy(ptr, ADLIB_INSTR_MIDI_HACK,
sizeof(ADLIB_INSTR_MIDI_HACK));
-
+
ptr[5] += ch;
ptr[28] += ch;
ptr[92] += ch;
-
+
/* flags_1 */
ptr[30 + 0] = (current_instr[ch][3] >> 4) & 0xf;
ptr[30 + 1] = current_instr[ch][3] & 0xf;
-
+
/* oplvl_1 */
ptr[30 + 2] = (current_instr[ch][4] >> 4) & 0xf;
ptr[30 + 3] = current_instr[ch][4] & 0xf;
-
+
/* atdec_1 */
ptr[30 + 4] = ((~current_instr[ch][5]) >> 4) & 0xf;
ptr[30 + 5] = (~current_instr[ch][5]) & 0xf;
-
+
/* sustrel_1 */
ptr[30 + 6] = ((~current_instr[ch][6]) >> 4) & 0xf;
ptr[30 + 7] = (~current_instr[ch][6]) & 0xf;
-
+
/* waveform_1 */
ptr[30 + 8] = (current_instr[ch][7] >> 4) & 0xf;
ptr[30 + 9] = current_instr[ch][7] & 0xf;
-
+
/* flags_2 */
ptr[30 + 10] = (current_instr[ch][8] >> 4) & 0xf;
ptr[30 + 11] = current_instr[ch][8] & 0xf;
-
+
/* oplvl_2 */
ptr[30 + 12] = ((current_instr[ch][9]) >> 4) & 0xf;
ptr[30 + 13] = (current_instr[ch][9]) & 0xf;
-
+
/* atdec_2 */
ptr[30 + 14] = ((~current_instr[ch][10]) >> 4) & 0xf;
ptr[30 + 15] = (~current_instr[ch][10]) & 0xf;
-
+
/* sustrel_2 */
ptr[30 + 16] = ((~current_instr[ch][11]) >> 4) & 0xf;
ptr[30 + 17] = (~current_instr[ch][11]) & 0xf;
-
+
/* waveform_2 */
ptr[30 + 18] = (current_instr[ch][12] >> 4) & 0xf;
ptr[30 + 19] = current_instr[ch][12] & 0xf;
-
+
/* feedback */
ptr[30 + 20] = (current_instr[ch][2] >> 4) & 0xf;
ptr[30 + 21] = current_instr[ch][2] & 0xf;
-
+
delay = mintime - curtime;
curtime = mintime;
-
+
{
delay = convert_extraflags(ptr + 30 + 22, src_ptr + 1);
delay2 = convert_extraflags(ptr + 30 + 40, src_ptr + 6);
@@ -1547,17 +1543,17 @@ void ScummEngine::convertADResource(int type, int idx, byte *src_ptr, int size)
if (delay == -1)
delay = 0;
}
-
+
/* duration */
ptr[30 + 58] = 0; // ((delay * 17 / 63) >> 4) & 0xf;
ptr[30 + 59] = 0; // (delay * 17 / 63) & 0xf;
-
+
ptr += sizeof(ADLIB_INSTR_MIDI_HACK);
-
+
olddelay = mintime - curtime;
curtime = mintime;
ptr = writeVLQ(ptr, olddelay);
-
+
{
int freq = ((current_instr[ch][1] & 3) << 8)
| current_instr[ch][0];
@@ -1580,22 +1576,22 @@ void ScummEngine::convertADResource(int type, int idx, byte *src_ptr, int size)
note = 1;
else if (note > 127)
note = 127;
-
+
// Insert a note on event
*ptr++ = 0x90 + ch; // key on channel
*ptr++ = note;
*ptr++ = 63;
current_note[ch] = note;
- track_time[ch] = curtime + delay;
+ track_time[ch] = curtime + delay;
}
src_ptr += 11;
break;
-
+
case 0x80:
track_time[ch] = -1;
src_ptr ++;
break;
-
+
default:
track_time[ch] = -1;
}
@@ -1645,10 +1641,9 @@ int ScummEngine::readSoundResourceSmallHeader(int type, int idx) {
} else {
total_size = size = _fileHandle.readUint32LE();
tag = _fileHandle.readUint16LE();
- debug(4, " tag='%c%c', size=%d",
- (char) (tag & 0xff),
- (char) ((tag >> 8) & 0xff), size);
-
+ debug(4, " tag='%c%c', size=%d", (char) (tag & 0xff),
+ (char) ((tag >> 8) & 0xff), size);
+
if (tag == 0x4F52) { // RO
ro_offs = _fileHandle.pos();
ro_size = size;
@@ -1657,11 +1652,10 @@ int ScummEngine::readSoundResourceSmallHeader(int type, int idx) {
while (pos < total_size) {
size = _fileHandle.readUint32LE();
tag = _fileHandle.readUint16LE();
- debug(4, " tag='%c%c', size=%d",
- (char) (tag & 0xff),
- (char) ((tag >> 8) & 0xff), size);
+ debug(4, " tag='%c%c', size=%d", (char) (tag & 0xff),
+ (char) ((tag >> 8) & 0xff), size);
pos += size;
-
+
// MI1 and Indy3 uses one or more nested SO resources, which contains AD and WA
// resources.
if ((tag == 0x4441) && !(ad_offs)) { // AD
@@ -1725,7 +1719,6 @@ int ScummEngine::readSoundResourceSmallHeader(int type, int idx) {
return 0;
}
-
int ScummEngine::getResourceRoomNr(int type, int idx) {
if (type == rtRoom)
return idx;
@@ -1888,16 +1881,12 @@ void ScummEngine::lock(int type, int i) {
if (!validateResource("Locking", type, i))
return;
res.flags[type][i] |= RF_LOCK;
-
-// debug(1, "locking %d,%d", type, i);
}
void ScummEngine::unlock(int type, int i) {
if (!validateResource("Unlocking", type, i))
return;
res.flags[type][i] &= ~RF_LOCK;
-
-// debug(1, "unlocking %d,%d", type, i);
}
bool ScummEngine::isResourceInUse(int type, int i) const {
@@ -1940,8 +1929,6 @@ void ScummEngine::expireResources(uint32 size) {
int best_type, best_res = 0;
uint32 oldAllocatedSize;
-// return;
-
if (_expire_counter != 0xFF) {
_expire_counter = 0xFF;
increaseResourceCounter();
diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp
index 7a1e5e51ae..765f735353 100644
--- a/scumm/script_v2.cpp
+++ b/scumm/script_v2.cpp
@@ -421,7 +421,7 @@ void ScummEngine_v2::decodeParseString() {
if (_demoMode && _actorToPrintStrFor == 0xFF)
_string[textSlot].color = 1;
else if (_actorToPrintStrFor != 0xFF)
- _string[textSlot].color = v1_mm_actor_speech_color[_actorToPrintStrFor];
+ _string[textSlot].color = v1_mm_actor_speech_color[_actorToPrintStrFor];
}
_messagePtr = buffer;
@@ -674,7 +674,7 @@ void ScummEngine_v2::o2_actorSet() {
_string[0].color = arg;
return;
}
-
+
a = derefActor(act, "actorSet");
switch (_opcode) {
@@ -801,7 +801,7 @@ void ScummEngine_v2::o2_verbOps() {
_verbs[slot].curmode = state;
break;
-
+
default: { // New Verb
int x = fetchScriptByte() << 3;
int y = fetchScriptByte() << 3;
@@ -888,7 +888,7 @@ void ScummEngine_v2::o2_doSentence() {
st->objectB = getVarOrDirectWord(0x20);
st->preposition = (st->objectB != 0);
st->freezeCount = 0;
-
+
// Execute or print the sentence
_opcode = fetchScriptByte();
switch(_opcode) {
@@ -908,7 +908,7 @@ void ScummEngine_v2::o2_doSentence() {
VAR(VAR_ACTIVE_VERB) = st->verb;
VAR(VAR_ACTIVE_OBJECT1) = st->objectA;
VAR(VAR_ACTIVE_OBJECT2) = st->objectB;
-
+
isBackgroundScript = false;
isSpecialVerb = false;
} else {
@@ -926,7 +926,7 @@ void ScummEngine_v2::o2_doSentence() {
int slot = -1;
ScriptSlot *ss;
int i;
-
+
ss = vm.slot;
for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++) {
if (st->objectA == ss->number &&
@@ -944,7 +944,7 @@ void ScummEngine_v2::o2_doSentence() {
case 2:
// Print the sentence
_sentenceNum--;
-
+
VAR(VAR_SENTENCE_VERB) = st->verb;
VAR(VAR_SENTENCE_OBJECT1) = st->objectA;
VAR(VAR_SENTENCE_OBJECT2) = st->objectB;
@@ -960,7 +960,7 @@ void ScummEngine_v2::o2_drawSentence() {
Common::Rect sentenceline;
static char sentence[256];
const byte *temp;
- int slot = getVerbSlot(VAR(VAR_SENTENCE_VERB),0);
+ int slot = getVerbSlot(VAR(VAR_SENTENCE_VERB), 0);
if (!(_userState & 32))
return;
@@ -983,7 +983,7 @@ void ScummEngine_v2::o2_drawSentence() {
if (_verbs[slot].prep == 0xFF) {
byte *ptr = getOBCDFromObject(VAR(VAR_SENTENCE_OBJECT1));
assert(ptr);
- VAR(VAR_SENTENCE_PREPOSITION) = (*(ptr+12) >> 5);
+ VAR(VAR_SENTENCE_PREPOSITION) = (*(ptr + 12) >> 5);
} else
VAR(VAR_SENTENCE_PREPOSITION) = _verbs[slot].prep;
}
@@ -1360,16 +1360,16 @@ void ScummEngine_v2::o2_cutscene() {
vm.cutSceneData[1] = (int16)VAR(VAR_CURSORSTATE);
vm.cutSceneData[2] = _currentRoom;
vm.cutSceneData[3] = camera._mode;
-
+
VAR(VAR_CURSORSTATE) = 200;
-
+
// FIXME allows quotes script (173) to start during introudction of
// demo mode of V1 Maniac Mansion. setUserState was halting script
// 173 before it started.
if (!(_gameId == GID_MANIAC && _version == 1 && _demoMode))
// Hide inventory, freeze scripts, hide cursor
setUserState(15);
-
+
_sentenceNum = 0;
stopScript(SENTENCE_SCRIPT);
resetSentence();
@@ -1496,7 +1496,7 @@ void ScummEngine_v2::o2_cursorCommand() { // TODO: Define the magic numbers
if (cmd & 0xFF) {
VAR(VAR_CURSORSTATE) = cmd & 0xFF;
}
-
+
setUserState(state);
}
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index 6c6ba53686..64744c4df7 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -82,7 +82,7 @@ struct ScummGameSettings {
byte id, version;
int midi; // MidiDriverType values
uint32 features;
-
+
GameSettings toGameSettings() const {
GameSettings dummy = { gameName, description, midi, features, 0 };
return dummy;
@@ -663,9 +663,8 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
if (!_mixer->bindToSystem(syst)) {
warning("Sound mixer initialization failed");
if (_midiDriver == MD_ADLIB ||
- _midiDriver == MD_PCSPK ||
- _midiDriver == MD_PCJR)
- {
+ _midiDriver == MD_PCSPK ||
+ _midiDriver == MD_PCJR) {
_midiDriver = MD_NULL;
warning("MIDI driver depends on sound mixer, switching to null MIDI driver");
}
@@ -792,9 +791,9 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
ScummEngine::~ScummEngine() {
_mixer->stopAll();
-
+
delete [] _actors;
-
+
delete _2byteFontPtr;
delete _charset;
delete _pauseDialog;
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 7f08607cf7..c3548ed306 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -487,12 +487,12 @@ void Sound::processSfxQueues() {
}
}
}
-
+
if (finished && _scumm->_talkDelay == 0) {
_scumm->stopTalk();
}
}
-
+
if (_sfxMode & 1) {
if (isSfxFinished()) {
_sfxMode &= ~1;
@@ -615,7 +615,7 @@ int Sound::isSoundRunning(int sound) const {
if (sound == _currentCDSound)
return pollCD();
-
+
if (_scumm->_features & GF_HUMONGOUS) {
if (sound == -2) {
return isSfxFinished();
@@ -626,7 +626,7 @@ int Sound::isSoundRunning(int sound) const {
return _scumm->_imuse->getSoundStatus(sound);
}
}
-
+
if (isSoundInQueue(sound))
return 1;
@@ -1632,7 +1632,7 @@ int MP3TrackInfo::play(SoundMixer *mixer, PlayingSoundHandle *handle, int startF
// FIXME: Using _size here is a problem if offset (or equivalently
// startFrame) is non-zero.
mad_timer_set(&durationTime, (_size * 8) / _mad_header.bitrate,
- (_size * 8) % _mad_header.bitrate, _mad_header.bitrate);
+ (_size * 8) % _mad_header.bitrate, _mad_header.bitrate);
} else {
mad_timer_set(&durationTime, duration / 75, duration % 75, 75);
}
@@ -1680,8 +1680,7 @@ int VorbisTrackInfo::play(SoundMixer *mixer, PlayingSoundHandle *handle, int sta
ov_time_seek(&_ov_file, startFrame / 75.0);
#endif
return mixer->playVorbis(handle, &_ov_file,
- duration * ov_info(&_ov_file, -1)->rate / 75,
- true);
+ duration * ov_info(&_ov_file, -1)->rate / 75, true);
}
VorbisTrackInfo::~VorbisTrackInfo() {
diff --git a/scumm/string.cpp b/scumm/string.cpp
index c7c1887e7b..00b2ad2187 100644
--- a/scumm/string.cpp
+++ b/scumm/string.cpp
@@ -592,8 +592,7 @@ void ScummEngine::addIntToStack(int var) {
_msgPtrToAdd += sprintf((char *)_msgPtrToAdd, "%d", num);
}
-void ScummEngine::addVerbToStack(int var)
-{
+void ScummEngine::addVerbToStack(int var) {
int num, k;
num = readVar(var);
@@ -611,8 +610,7 @@ void ScummEngine::addVerbToStack(int var)
}
}
-void ScummEngine::addNameToStack(int var)
-{
+void ScummEngine::addNameToStack(int var) {
int num;
const byte *ptr = 0;
@@ -725,8 +723,8 @@ void ScummEngine::drawBlastTexts() {
if (c != 0 && c != 0xFF) {
_charset->_left = _charset->_nextLeft;
_charset->_top = _charset->_nextTop;
- if (c >= 0x80 && _CJKMode)
- c += *buf++ * 256;
+ if (c >= 0x80 && _CJKMode)
+ c += *buf++ * 256;
_charset->printChar(c);
_charset->_nextLeft = _charset->_left;
_charset->_nextTop = _charset->_top;