cleanup whitespaces

svn-id: r11217
This commit is contained in:
Paweł Kołodziejski 2003-11-08 21:59:32 +00:00
parent 9e7402e14b
commit 1f9e408e2f
25 changed files with 257 additions and 291 deletions

View file

@ -1014,7 +1014,7 @@ void CharsetRendererClassic::printChar(int chr) {
return; return;
_vm->_charsetColorMap[1] = _color; _vm->_charsetColorMap[1] = _color;
if (is2byte) { if (is2byte) {
_dropShadow = true; _dropShadow = true;
charPtr = g_scumm->get2byteCharPtr(chr); charPtr = g_scumm->get2byteCharPtr(chr);

View file

@ -474,7 +474,7 @@ bool ScummDebugger::Cmd_Object(int argc, const char **argv) {
} else if (!strcmp(argv[2], "name")) { } else if (!strcmp(argv[2], "name")) {
DebugPrintf("Name of object %d: %s\n", obj, _vm->getObjOrActorName(obj)); DebugPrintf("Name of object %d: %s\n", obj, _vm->getObjOrActorName(obj));
} else { } 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; return true;
@ -605,8 +605,7 @@ void ScummDebugger::printBox(int box) {
static int gfxPrimitivesCompareInt(const void *a, const void *b); 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]; VirtScreen *vs = &scumm->virtscr[0];
byte *ptr; 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); 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; const int N = 4;
int i; int i;
int y; int y;

View file

@ -246,7 +246,6 @@ void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 da
} }
} }
Common::StringList generateSavegameList(ScummEngine *scumm, bool saveMode) { Common::StringList generateSavegameList(ScummEngine *scumm, bool saveMode) {
// Get savegame names // Get savegame names
Common::StringList l; Common::StringList l;
@ -273,15 +272,15 @@ Common::StringList generateSavegameList(ScummEngine *scumm, bool saveMode) {
enum { enum {
kRowHeight = 18, kRowHeight = 18,
kBigButtonWidth = 90, kBigButtonWidth = 90,
kMainMenuWidth = (kBigButtonWidth + 2*8), kMainMenuWidth = (kBigButtonWidth + 2 * 8),
kMainMenuHeight = 7*kRowHeight + 3*5 + 7 + 5 kMainMenuHeight = 7 * kRowHeight + 3 * 5 + 7 + 5
}; };
#define addBigButton(label, cmd, hotkey) \ #define addBigButton(label, cmd, hotkey) \
new ButtonWidget(this, x, y, kBigButtonWidth, 16, label, cmd, hotkey); y += kRowHeight new ButtonWidget(this, x, y, kBigButtonWidth, 16, label, cmd, hotkey); y += kRowHeight
MainMenuDialog::MainMenuDialog(ScummEngine *scumm) 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; int y = 7;
const int x = (_w - kBigButtonWidth) / 2; const int x = (_w - kBigButtonWidth) / 2;
@ -418,13 +417,13 @@ OptionsDialog::OptionsDialog(ScummEngine *scumm)
// Add the buttons // Add the buttons
// //
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
addButton(_w-kButtonWidth-8, _h-24 - kButtonHeight - 4, "OK", kOKCmd, 'O'); 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 - 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 #else
addButton(_w-kButtonWidth-8, _h-24, "OK", kOKCmd, 'O'); addButton(_w - kButtonWidth-8, _h - 24, "OK", kOKCmd, 'O');
addButton(_w-2*kButtonWidth-12, _h-24, "Cancel", kCancelCmd, 'C'); addButton(_w - 2 * kButtonWidth-12, _h - 24, "Cancel", kCancelCmd, 'C');
#endif #endif
// //
@ -433,7 +432,7 @@ OptionsDialog::OptionsDialog(ScummEngine *scumm)
int yoffset = 8; int yoffset = 8;
_masterVolumeSlider = new SliderWidget(this, 5, yoffset, 185, 12, "Master volume: ", 100, kMasterVolumeChanged); _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); _masterVolumeSlider->setMinValue(0); _masterVolumeSlider->setMaxValue(255);
_masterVolumeLabel->setFlags(WIDGET_CLEARBG); _masterVolumeLabel->setFlags(WIDGET_CLEARBG);
yoffset += 16; yoffset += 16;
@ -445,7 +444,7 @@ OptionsDialog::OptionsDialog(ScummEngine *scumm)
yoffset += 16; yoffset += 16;
_sfxVolumeSlider = new SliderWidget(this, 5, yoffset, 185, 12, "SFX volume: ", 100, kSfxVolumeChanged); _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); _sfxVolumeSlider->setMinValue(0); _sfxVolumeSlider->setMaxValue(255);
_sfxVolumeLabel->setFlags(WIDGET_CLEARBG); _sfxVolumeLabel->setFlags(WIDGET_CLEARBG);
yoffset += 16; yoffset += 16;
@ -641,7 +640,7 @@ void InfoDialog::setInfoText(const String& message) {
_x = (_scumm->_screenWidth - width) >> 1; _x = (_scumm->_screenWidth - width) >> 1;
_w = width; _w = width;
new StaticTextWidget(this, 4, 4, _w-8, _h, message, kTextAlignCenter); new StaticTextWidget(this, 4, 4, _w - 8, _h, message, kTextAlignCenter);
} }
#pragma mark - #pragma mark -

View file

@ -802,7 +802,7 @@ void ScummEngine::redrawBGStrip(int start, int num) {
gdi._C64ObjectMode = false; gdi._C64ObjectMode = false;
} }
gdi.drawBitmap(getResourceAddress(rtRoom, _roomResource) + _IM00_offs, 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() { void ScummEngine::restoreCharsetBg() {
@ -910,7 +910,7 @@ byte *ScummEngine::getMaskBuffer(int x, int y, int z) {
* and objects, used throughout all SCUMM versions. * 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, 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(ptr);
assert(height > 0); assert(height > 0);
byte *backbuff_ptr, *bgbak_ptr; 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++) { for (x = 0 ; x < width; x++) {
if ((x % 8) == 0) { if ((x % 8) == 0) {
assert(x/8 < 160); assert(x / 8 < 160);
table->run[x/8] = run; table->run[x / 8] = run;
table->color[x/8] = color; table->color[x / 8] = color;
table->offsets[x/8] = src - bitmapStart; table->offsets[x / 8] = src - bitmapStart;
} }
for (y = 0; y < height; y++) { 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 READ_BIT (cl--, bit = bits & 1, bits >>= 1, bit)
#define FILL_BITS do { \ #define FILL_BITS do { \
if (cl <= 8) { \ if (cl <= 8) { \
bits |= (*src++ << cl); \ bits |= (*src++ << cl); \
cl += 8; \ cl += 8; \
} \ } \
} while (0) } while (0)
void Gdi::unkDecodeA(byte *dst, const byte *src, int height) { void Gdi::unkDecodeA(byte *dst, const byte *src, int height) {
@ -2829,7 +2829,7 @@ void ScummEngine::cyclePalette() {
if (_proc_special_palette) { if (_proc_special_palette) {
doCycleIndirectPalette(_proc_special_palette, cycl->start, cycl->end, !(cycl->flags & 2)); doCycleIndirectPalette(_proc_special_palette, cycl->start, cycl->end, !(cycl->flags & 2));
} }
if (_shadowPalette) { if (_shadowPalette) {
if (_version >= 7) { if (_version >= 7) {
for (j = 0; j < NUM_SHADOW_PALETTE; j++) 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); string3 = getStringAddress(string_id + 2);
if (!string1 || !string2 || !string3) { if (!string1 || !string2 || !string3) {
warning("palManipulateInit(%d,%d,%d,%d): Cannot obtain string resources %d, %d and %d", 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; return;
} }
@ -2875,7 +2875,7 @@ void ScummEngine::palManipulateInit(int start, int end, int string_id, int time)
_palManipStart = start; _palManipStart = start;
_palManipEnd = end; _palManipEnd = end;
_palManipCounter = 0; _palManipCounter = 0;
if (!_palManipPalette) if (!_palManipPalette)
_palManipPalette = (byte *)calloc(0x300, 1); _palManipPalette = (byte *)calloc(0x300, 1);
if (!_palManipIntermediatePal) if (!_palManipIntermediatePal)
@ -3509,7 +3509,7 @@ void ScummEngine::setCursorHotspot(int x, int y) {
void ScummEngine::updateCursor() { void ScummEngine::updateCursor() {
_system->set_mouse_cursor(_grabbedCursor, _cursor.width, _cursor.height, _system->set_mouse_cursor(_grabbedCursor, _cursor.width, _cursor.height,
_cursor.hotspotX, _cursor.hotspotY); _cursor.hotspotX, _cursor.hotspotY);
} }
void ScummEngine::animateCursor() { void ScummEngine::animateCursor() {

View file

@ -63,8 +63,7 @@ _queue_cleared(0),
_master_volume(0), _master_volume(0),
_music_volume(0), _music_volume(0),
_trigger_count(0), _trigger_count(0),
_snm_trigger_index(0) _snm_trigger_index(0) {
{
memset(_channel_volume,0,sizeof(_channel_volume)); memset(_channel_volume,0,sizeof(_channel_volume));
memset(_channel_volume_eff,0,sizeof(_channel_volume_eff)); memset(_channel_volume_eff,0,sizeof(_channel_volume_eff));
memset(_volchan_table,0,sizeof(_volchan_table)); 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); debug(2, "IMuseInternal::startSound(): Couldn't find sound %d!", sound);
return false; return false;
} }
// Check which MIDI driver this track should use. // Check which MIDI driver this track should use.
// If it's NULL, it ain't something we can play. // If it's NULL, it ain't something we can play.
MidiDriver *driver = getBestMidiDriver(sound); MidiDriver *driver = getBestMidiDriver(sound);
@ -461,8 +460,7 @@ int IMuseInternal::get_queue_sound_status(int sound) const {
for (i = 0; i < ARRAYSIZE (_deferredCommands); ++i) { for (i = 0; i < ARRAYSIZE (_deferredCommands); ++i) {
if (_deferredCommands[i].time_left && _deferredCommands[i].a == 8 && if (_deferredCommands[i].time_left && _deferredCommands[i].a == 8 &&
_deferredCommands[i].b == sound) _deferredCommands[i].b == sound) {
{
return 2; return 2;
} }
} }
@ -942,9 +940,7 @@ int32 IMuseInternal::ImClearTrigger(int sound, int id) {
int i; int i;
ImTrigger *trig = _snm_triggers; ImTrigger *trig = _snm_triggers;
for (i = ARRAYSIZE(_snm_triggers); i; --i, ++trig) { for (i = ARRAYSIZE(_snm_triggers); i; --i, ++trig) {
if ((sound == -1 || trig->sound == sound) && if ((sound == -1 || trig->sound == sound) && trig->id && (id == -1 || trig->id == id)) {
trig->id && (id == -1 || trig->id == id))
{
trig->sound = trig->id = 0; trig->sound = trig->id = 0;
++count; ++count;
} }
@ -957,8 +953,7 @@ int32 IMuseInternal::ImFireAllTriggers(int sound) {
int count = 0; int count = 0;
int i; int i;
for (i = 0; i < 16; ++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; _snm_triggers [i].sound = _snm_triggers [i].id = 0;
doCommand (8, _snm_triggers[i].command); doCommand (8, _snm_triggers[i].command);
++count; ++count;
@ -1660,8 +1655,7 @@ void Part::sendPitchBend() {
// so we'll do the scaling ourselves. // so we'll do the scaling ourselves.
if (_player->_se->isNativeMT32()) if (_player->_se->isNativeMT32())
bend = bend * _pitchbend_factor / 12; bend = bend * _pitchbend_factor / 12;
_mc->pitchBend(clamp(bend + (_detune_eff * 64 / 12) + _mc->pitchBend(clamp(bend + (_detune_eff * 64 / 12) + (_transpose_eff * 8192 / 12), -8192, 8191));
(_transpose_eff * 8192 / 12), -8192, 8191));
} }
void Part::programChange(byte value) { void Part::programChange(byte value) {
@ -1709,9 +1703,8 @@ void IMuseInternal::reallocateMidiChannels(MidiDriver *midi) {
hipart = NULL; hipart = NULL;
for (i = 32, part = _parts; i; i--, part++) { for (i = 32, part = _parts; i; i--, part++) {
if (part->_player && part->_player->getMidiDriver() == midi && if (part->_player && part->_player->getMidiDriver() == midi &&
!part->_percussion && part->_on && !part->_percussion && part->_on &&
!part->_mc && part->_pri_eff >= hipri) !part->_mc && part->_pri_eff >= hipri) {
{
hipri = part->_pri_eff; hipri = part->_pri_eff;
hipart = part; hipart = part;
} }

View file

@ -783,7 +783,7 @@ void IMuseDigital::musicTimer() {
int8 pan = _channel[l]._volumeRight - _channel[l]._volume; int8 pan = _channel[l]._volumeRight - _channel[l]._volume;
if (_channel[l]._mixerChannel == 0) { if (_channel[l]._mixerChannel == 0) {
_scumm->_mixer->newStream(&_channel[l]._mixerChannel, buf, mixer_size, _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 { } else {
_scumm->_mixer->appendStream(_channel[l]._mixerChannel, buf, mixer_size); _scumm->_mixer->appendStream(_channel[l]._mixerChannel, buf, mixer_size);
_scumm->_mixer->setChannelVolume(_channel[l]._mixerChannel, _channel[l]._volume); _scumm->_mixer->setChannelVolume(_channel[l]._mixerChannel, _channel[l]._volume);

View file

@ -222,42 +222,42 @@ public:
Player(); Player();
virtual ~Player(); virtual ~Player();
int addParameterFader(int param, int target, int time); int addParameterFader(int param, int target, int time);
void clear(); void clear();
void clearLoop(); void clearLoop();
void fixAfterLoad(); void fixAfterLoad();
Part * getActivePart(uint8 part); Part * getActivePart(uint8 part);
uint getBeatIndex(); uint getBeatIndex();
int8 getDetune() const { return _detune; } int8 getDetune() const { return _detune; }
byte getEffectiveVolume() const { return _vol_eff; } byte getEffectiveVolume() const { return _vol_eff; }
int getID() const { return _id; } int getID() const { return _id; }
MidiDriver *getMidiDriver() const { return _midi; } MidiDriver *getMidiDriver() const { return _midi; }
int getParam(int param, byte chan); int getParam(int param, byte chan);
int8 getPan() const { return _pan; } int8 getPan() const { return _pan; }
Part * getPart(uint8 part); Part * getPart(uint8 part);
byte getPriority() const { return _priority; } byte getPriority() const { return _priority; }
uint getTicksPerBeat() const { return TICKS_PER_BEAT; } uint getTicksPerBeat() const { return TICKS_PER_BEAT; }
int8 getTranspose() const { return _transpose; } int8 getTranspose() const { return _transpose; }
byte getVolume() const { return _volume; } byte getVolume() const { return _volume; }
bool isActive() const { return _active; } bool isActive() const { return _active; }
bool isFadingOut() const; bool isFadingOut() const;
bool isGM() const { return _isGM; } bool isGM() const { return _isGM; }
bool isMT32() const { return _isMT32; } bool isMT32() const { return _isMT32; }
bool jump(uint track, uint beat, uint tick); bool jump(uint track, uint beat, uint tick);
void onTimer(); void onTimer();
void removePart(Part *part); void removePart(Part *part);
int scan(uint totrack, uint tobeat, uint totick); int scan(uint totrack, uint tobeat, uint totick);
int save_or_load(Serializer *ser); int save_or_load(Serializer *ser);
int setHook(byte cls, byte value, byte chan) { return _hook.set(cls, value, chan); } int setHook(byte cls, byte value, byte chan) { return _hook.set(cls, value, chan); }
void setDetune(int detune); void setDetune(int detune);
bool setLoop(uint count, uint tobeat, uint totick, uint frombeat, uint fromtick); bool setLoop(uint count, uint tobeat, uint totick, uint frombeat, uint fromtick);
void setPan(int pan); void setPan(int pan);
void setPriority(int pri); void setPriority(int pri);
void setSpeed(byte speed); void setSpeed(byte speed);
int setTranspose(byte relative, int b); int setTranspose(byte relative, int b);
int setVolume(byte vol); int setVolume(byte vol);
bool startSound(int sound, MidiDriver *midi, bool passThrough); bool startSound(int sound, MidiDriver *midi, bool passThrough);
int getMusicTimer() const; int getMusicTimer() const;
public: public:
// MidiDriver interface // MidiDriver interface

View file

@ -58,30 +58,30 @@ uint16 Player::_active_notes[128];
////////////////////////////////////////////////// //////////////////////////////////////////////////
Player::Player() : Player::Player() :
_midi(0), _midi(0),
_parser(0), _parser(0),
_parts(0), _parts(0),
_active(false), _active(false),
_scanning(false), _scanning(false),
_id(0), _id(0),
_priority(0), _priority(0),
_volume(0), _volume(0),
_pan(0), _pan(0),
_transpose(0), _transpose(0),
_detune(0), _detune(0),
_vol_eff(0), _vol_eff(0),
_track_index(0), _track_index(0),
_loop_to_beat(0), _loop_to_beat(0),
_loop_from_beat(0), _loop_from_beat(0),
_loop_counter(0), _loop_counter(0),
_loop_to_tick(0), _loop_to_tick(0),
_loop_from_tick(0), _loop_from_tick(0),
_speed(128), _speed(128),
_isMT32(false), _isMT32(false),
_isGM(false), _isGM(false),
_se(0), _se(0),
_vol_chan(0) _vol_chan(0){
{ } }
Player::~Player() { Player::~Player() {
if (_parser) { 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); warning("Player::startSound(): Couldn't find start of sound %d!", sound);
return false; return false;
} }
_isMT32 = _se->isMT32(sound); _isMT32 = _se->isMT32(sound);
_isGM = _se->isGM(sound); _isGM = _se->isGM(sound);
@ -142,8 +142,7 @@ bool Player::isFadingOut() const {
int i; int i;
for (i = 0; i < ARRAYSIZE(_parameterFaders); ++i) { for (i = 0; i < ARRAYSIZE(_parameterFaders); ++i) {
if (_parameterFaders[i].param == ParameterFader::pfVolume && if (_parameterFaders[i].param == ParameterFader::pfVolume &&
_parameterFaders[i].end == 0) _parameterFaders[i].end == 0) {
{
return true; return true;
} }
} }
@ -1217,7 +1216,7 @@ int Player::save_or_load(Serializer *ser) {
ser->saveLoadEntries(this, playerEntries); ser->saveLoadEntries(this, playerEntries);
ser->saveLoadArrayOf(_parameterFaders, ARRAYSIZE(_parameterFaders), ser->saveLoadArrayOf(_parameterFaders, ARRAYSIZE(_parameterFaders),
sizeof(ParameterFader), parameterFaderEntries); sizeof(ParameterFader), parameterFaderEntries);
return 0; return 0;
} }

View file

@ -325,8 +325,7 @@ protected:
File _hFileTable[17]; File _hFileTable[17];
public: 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_VIDEONAME = 0xFF;
VAR_TIMEDATE_YEAR = 0xFF; VAR_TIMEDATE_YEAR = 0xFF;

View file

@ -72,13 +72,13 @@ void MidiParser_EUP::parseNextEvent (EventInfo &info) {
// fits-all" sound until we actually support the // fits-all" sound until we actually support the
// FM synthesis capabilities of FM Towns. // FM synthesis capabilities of FM Towns.
for (; _presend < 12; ++_presend) { for (; _presend < 12; ++_presend) {
if (_instr_to_channel[_presend>>1] >= 16) if (_instr_to_channel[_presend >> 1] >= 16)
continue; continue;
info.start = pos; info.start = pos;
info.delta = 0; info.delta = 0;
if (_presend & 1) { if (_presend & 1) {
byte *data = &_instruments[_presend>>1][0]; byte *data = &_instruments[_presend >> 1][0];
data[1] = _instr_to_channel[_presend>>1]; data[1] = _instr_to_channel[_presend >> 1];
info.event = 0xF0; info.event = 0xF0;
info.ext.data = data; info.ext.data = data;
info.length = 48; info.length = 48;

View file

@ -118,7 +118,7 @@ bool NutRenderer::loadFont(const char *filename, const char *directory) {
if (_loaded) { if (_loaded) {
warning("NutRenderer::loadFont() Font already loaded, ok, loading..."); warning("NutRenderer::loadFont() Font already loaded, ok, loading...");
} }
File file; File file;
file.open(filename, directory); file.open(filename, directory);
if (file.isOpen() == false) { if (file.isOpen() == false) {
@ -142,7 +142,7 @@ bool NutRenderer::loadFont(const char *filename, const char *directory) {
free(dataSrc); free(dataSrc);
return false; return false;
} }
_nbChars = READ_LE_UINT16(dataSrc + 10); _nbChars = READ_LE_UINT16(dataSrc + 10);
uint32 offset = READ_BE_UINT32(dataSrc + 4) + 8; uint32 offset = READ_BE_UINT32(dataSrc + 4) + 8;
int32 decoded_length; int32 decoded_length;
@ -304,7 +304,7 @@ void NutRenderer::drawChar(byte *dst, byte *mask, byte c, int x, int y, byte col
byte maskmask; byte maskmask;
int maskpos; int maskpos;
for (int ty = 0; ty < height; ty++) { for (int ty = 0; ty < height; ty++) {
maskmask = revBitMask[x & 7]; maskmask = revBitMask[x & 7];
maskpos = 0; maskpos = 0;
@ -342,7 +342,7 @@ void NutRenderer::draw2byte(byte *dst, byte *mask, int c, int x, int y, byte col
byte maskmask; byte maskmask;
int maskpos; int maskpos;
for (int ty = 0; ty < height; ty++) { for (int ty = 0; ty < height; ty++) {
maskmask = revBitMask[x & 7]; maskmask = revBitMask[x & 7];
maskpos = 0; maskpos = 0;

View file

@ -1399,7 +1399,7 @@ void ScummEngine::nukeFlObjects(int min, int max) {
} }
void ScummEngine::enqueueObject(int objectNumber, int objectX, int objectY, int objectWidth, 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; BlastObject *eo;
ObjectData *od; ObjectData *od;

View file

@ -55,8 +55,7 @@ private:
MOD_MAXCHANS = 16 MOD_MAXCHANS = 16
}; };
struct soundChan struct soundChan {
{
int id; int id;
uint8 vol; uint8 vol;
int8 pan; int8 pan;

View file

@ -133,7 +133,7 @@ void Player_V1::parseSpeakerChunk() {
parse_again: parse_again:
_chunk_type = READ_LE_UINT16(_next_chunk); _chunk_type = READ_LE_UINT16(_next_chunk);
debug(6, "parseSpeakerChunk: sound %d, offset %4x, chunk %x", 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; _next_chunk += 2;
switch (_chunk_type) { switch (_chunk_type) {
@ -170,7 +170,7 @@ void Player_V1::parseSpeakerChunk() {
_channels[0].freq = _start; _channels[0].freq = _start;
_next_chunk += 10; _next_chunk += 10;
debug(6, "chunk 1: mplex %d, freq %d -> %d step %d x %d", 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; break;
case 2: case 2:
_start = READ_LE_UINT16(_next_chunk); _start = READ_LE_UINT16(_next_chunk);
@ -180,7 +180,7 @@ void Player_V1::parseSpeakerChunk() {
_next_chunk += 6; _next_chunk += 6;
_forced_level = -1; _forced_level = -1;
debug(6, "chunk 2: %d -> %d step %d", debug(6, "chunk 2: %d -> %d step %d",
_start, _end, _delta); _start, _end, _delta);
break; break;
case 3: case 3:
_start = READ_LE_UINT16(_next_chunk); _start = READ_LE_UINT16(_next_chunk);
@ -190,7 +190,7 @@ void Player_V1::parseSpeakerChunk() {
_next_chunk += 6; _next_chunk += 6;
_forced_level = -1; _forced_level = -1;
debug(6, "chunk 3: %d -> %d step %d", debug(6, "chunk 3: %d -> %d step %d",
_start, _end, _delta); _start, _end, _delta);
break; break;
} }
} }
@ -209,7 +209,7 @@ void Player_V1::nextSpeakerCmd() {
_next_chunk += 2; _next_chunk += 2;
} }
debug(7, "nextSpeakerCmd: chunk %d, offset %4x: notelen %d", 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) { if (_time_left == 0) {
parseSpeakerChunk(); parseSpeakerChunk();
@ -262,7 +262,7 @@ void Player_V1::parsePCjrChunk() {
set_mplex(3000); set_mplex(3000);
_forced_level = 0; _forced_level = 0;
parse_again: parse_again:
_chunk_type = READ_LE_UINT16(_next_chunk); _chunk_type = READ_LE_UINT16(_next_chunk);
debug(6, "parsePCjrChunk: sound %d, offset %4x, chunk %x", debug(6, "parsePCjrChunk: sound %d, offset %4x, chunk %x",
@ -539,7 +539,7 @@ void Player_V1::generateSpkSamples(int16 *data, uint len) {
} else { } else {
squareGenerator(0, _channels[0].freq, 0, 0, data, len); squareGenerator(0, _channels[0].freq, 0, 0, data, len);
debug(9, "speaker: %8x: freq %d %.1f", _tick_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); lowPassFilter(data, len);
} }
@ -588,7 +588,7 @@ void Player_V1::generatePCjrSamples(int16 *data, uint len) {
hasdata = true; hasdata = true;
squareGenerator(i, freq, vol, 0, data, len); squareGenerator(i, freq, vol, 0, data, len);
debug(9, "channel[%d]: %8x: freq %d %.1f ; volume %d", 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 { } else {
int noiseFB = (freq & 4) ? FB_WNOISE : FB_PNOISE; int noiseFB = (freq & 4) ? FB_WNOISE : FB_PNOISE;
int n = (freq & 3); int n = (freq & 3);
@ -597,7 +597,7 @@ void Player_V1::generatePCjrSamples(int16 *data, uint len) {
hasdata = true; hasdata = true;
squareGenerator(i, freq, vol, noiseFB, data, len); squareGenerator(i, freq, vol, noiseFB, data, len);
debug(9, "channel[%d]: %x: noise freq %d %.1f ; volume %d", 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);
} }
} }

View file

@ -447,7 +447,7 @@ void Player_V2::chainSound(int nr, byte *data) {
_channels[i].d.music_script_nr = nr; _channels[i].d.music_script_nr = nr;
if (data) { 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) if (_channels[i].d.next_cmd)
_channels[i].d.time_left = 1; _channels[i].d.time_left = 1;
} }
@ -521,8 +521,8 @@ void Player_V2::startSound(int nr) {
} }
if (nr != _current_nr if (nr != _current_nr
&& restartable && restartable
&& (!_next_nr && (!_next_nr
|| nprio <= prio)) { || nprio <= prio)) {
_next_nr = nr; _next_nr = nr;
@ -590,15 +590,15 @@ void Player_V2::execute_cmd(ChannelInfo *channel) {
case 0xf8: // set hull curve case 0xf8: // set hull curve
debug(7, "channels[%d]: hull curve %2d", debug(7, "channels[%d]: hull curve %2d",
channel - _channels, *script_ptr); channel - _channels, *script_ptr);
channel->d.hull_curve = hull_offsets[*script_ptr/2]; channel->d.hull_curve = hull_offsets[*script_ptr / 2];
script_ptr++; script_ptr++;
break; break;
case 0xf9: // set freqmod curve case 0xf9: // set freqmod curve
debug(7, "channels[%d]: freqmod curve %2d", debug(7, "channels[%d]: freqmod curve %2d",
channel - _channels, *script_ptr); channel - _channels, *script_ptr);
channel->d.freqmod_table = freqmod_offsets[*script_ptr/4]; channel->d.freqmod_table = freqmod_offsets[*script_ptr / 4];
channel->d.freqmod_modulo = freqmod_lengths[*script_ptr/4]; channel->d.freqmod_modulo = freqmod_lengths[*script_ptr / 4];
script_ptr++; script_ptr++;
break; break;
@ -658,16 +658,16 @@ void Player_V2::execute_cmd(ChannelInfo *channel) {
offset = READ_LE_UINT16 (script_ptr); offset = READ_LE_UINT16 (script_ptr);
script_ptr += 2; script_ptr += 2;
debug(7, "loop if %d to %d", opcode, offset); 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; script_ptr += offset;
break; break;
case 0xff: // set parameter case 0xff: // set parameter
opcode = *script_ptr++; opcode = *script_ptr++;
value = READ_LE_UINT16 (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", debug(7, "channels[%d]: set param %2d = %5d",
channel - &_channels[0], opcode, value); channel - &_channels[0], opcode, value);
script_ptr += 2; script_ptr += 2;
if (opcode == 14) { if (opcode == 14) {
/* tempo var */ /* 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", 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, dest_channel - channel, script_ptr ? script_ptr - _current_data - 2 : 0,
note, (signed short) dest_channel->d.transpose, channel->d.time_left, note, (signed short) dest_channel->d.transpose, channel->d.time_left,
dest_channel->d.hull_curve, dest_channel->d.freqmod_table, dest_channel->d.hull_curve, dest_channel->d.freqmod_table,
dest_channel->d.freqmod_incr,dest_channel->d.freqmod_multiplier, dest_channel->d.freqmod_incr,dest_channel->d.freqmod_multiplier,
is_last_note ? "last":""); is_last_note ? "last":"");
uint16 myfreq; uint16 myfreq;
@ -775,10 +775,10 @@ void Player_V2::next_freqs(ChannelInfo *channel) {
+ channel->d.base_freq; + channel->d.base_freq;
debug(9, "Freq: %d/%d, %d/%d/%d*%d %d", debug(9, "Freq: %d/%d, %d/%d/%d*%d %d",
channel->d.base_freq, (int16)channel->d.freq_delta, channel->d.base_freq, (int16)channel->d.freq_delta,
channel->d.freqmod_table, channel->d.freqmod_offset, channel->d.freqmod_table, channel->d.freqmod_offset,
channel->d.freqmod_incr, channel->d.freqmod_multiplier, channel->d.freqmod_incr, channel->d.freqmod_multiplier,
channel->d.freq); channel->d.freq);
if (channel->d.note_length && !--channel->d.note_length) { if (channel->d.note_length && !--channel->d.note_length) {
channel->d.hull_offset = 16; channel->d.hull_offset = 16;
@ -791,15 +791,15 @@ void Player_V2::next_freqs(ChannelInfo *channel) {
#if 0 #if 0
debug(9, "channels[%d]: freq %d hull %d/%d/%d", debug(9, "channels[%d]: freq %d hull %d/%d/%d",
channel - &_channels[0], channel->d.freq, channel - &_channels[0], channel->d.freq,
channel->d.hull_curve, channel->d.hull_offset, channel->d.hull_curve, channel->d.hull_offset,
channel->d.hull_counter); channel->d.hull_counter);
#endif #endif
if (channel->d.hull_counter && !--channel->d.hull_counter) { if (channel->d.hull_counter && !--channel->d.hull_counter) {
for (;;) { for (;;) {
const int16 *hull_ptr = hulls 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) { if (hull_ptr[1] == -1) {
channel->d.volume = hull_ptr[0]; channel->d.volume = hull_ptr[0];
if (hull_ptr[0] == 0) if (hull_ptr[0] == 0)
@ -854,14 +854,14 @@ void Player_V2::nextTick() {
void Player_V2::lowPassFilter(int16 *sample, uint len) { void Player_V2::lowPassFilter(int16 *sample, uint len) {
for (uint i = 0; i < len; i++) { for (uint i = 0; i < len; i++) {
_level = (int) (_level * _decay _level = (int) (_level * _decay
+ sample[0] * (0x10000-_decay)) >> 16; + sample[0] * (0x10000 - _decay)) >> 16;
sample[0] = sample[1] = _level; sample[0] = sample[1] = _level;
sample += 2; sample += 2;
} }
} }
void Player_V2::squareGenerator(int channel, int freq, int vol, 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; int period = _update_step * freq;
long nsample; long nsample;
if (period == 0) if (period == 0)
@ -896,8 +896,8 @@ void Player_V2::squareGenerator(int channel, int freq, int vol,
duration -= _timer_count[channel]; duration -= _timer_count[channel];
nsample = *sample + nsample = *sample +
(((signed long) (duration - (1 << (FIXP_SHIFT-1))) (((signed long) (duration - (1 << (FIXP_SHIFT - 1)))
* (signed long) _volumetable[vol]) >> FIXP_SHIFT); * (signed long) _volumetable[vol]) >> FIXP_SHIFT);
/* overflow: clip value */ /* overflow: clip value */
if (nsample > 0x7fff) if (nsample > 0x7fff)
nsample = 0x7fff; nsample = 0x7fff;
@ -914,8 +914,8 @@ void Player_V2::generateSpkSamples(int16 *data, uint len) {
int winning_channel = -1; int winning_channel = -1;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
if (winning_channel == -1 if (winning_channel == -1
&& _channels[i].d.volume && _channels[i].d.volume
&& _channels[i].d.time_left) { && _channels[i].d.time_left) {
winning_channel = i; 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) { if (_channels[i].d.volume && _channels[i].d.time_left) {
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
if (_channels[j].d.volume if (_channels[j].d.volume
&& _channels[j].d.time_left && _channels[j].d.time_left
&& freq == (_channels[j].d.freq >> 6)) { && freq == (_channels[j].d.freq >> 6)) {
/* HACK: this channel is playing at /* HACK: this channel is playing at
* the same frequency as another. * the same frequency as another.
* Synchronize it to the same phase to * Synchronize it to the same phase to
@ -978,7 +978,7 @@ void Player_V2::generatePCjrSamples(int16 *data, uint len) {
} }
#if 0 #if 0
debug(9, "channel[%d]: freq %d %.1f ; volume %d", debug(9, "channel[%d]: freq %d %.1f ; volume %d",
i, freq, 111860.0/freq, vol); i, freq, 111860.0 / freq, vol);
#endif #endif
} }

View file

@ -140,8 +140,8 @@ protected:
void lowPassFilter(int16 *data, uint len); void lowPassFilter(int16 *data, uint len);
void squareGenerator(int channel, int freq, int vol, void squareGenerator(int channel, int freq, int vol,
int noiseFeedback, int16 *sample, uint len); int noiseFeedback, int16 *sample, uint len);
private: private:
static void premix_proc(void *param, int16 *buf, uint len); static void premix_proc(void *param, int16 *buf, uint len);
void do_mix(int16 *buf, uint len); void do_mix(int16 *buf, uint len);

View file

@ -732,7 +732,7 @@ public:
_id = id; _id = id;
_data = (char *)malloc(READ_LE_UINT16(data)); _data = (char *)malloc(READ_LE_UINT16(data));
memcpy(_data, data, READ_LE_UINT16(data)); memcpy(_data, data, READ_LE_UINT16(data));
_loopnum = 1; _loopnum = 1;
_step = 2; _step = 2;
_curfreq = _freq1; _curfreq = _freq1;
@ -752,7 +752,7 @@ public:
} }
if (_curfreq >= _freq2) if (_curfreq >= _freq2)
return true; 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; _curfreq = _freq1;
_step = steps[++_loopnum]; _step = steps[++_loopnum];
if (_loopnum == 7) { if (_loopnum == 7) {
@ -818,10 +818,10 @@ public:
} }
virtual bool update() { virtual bool update() {
assert(_id); assert(_id);
updatefreq(_freq1,_step1,0x00AA,0x00FA); updatefreq(_freq1, _step1, 0x00AA, 0x00FA);
updatefreq(_freq2,_step2,0x019A,0x03B6); updatefreq(_freq2, _step2, 0x019A, 0x03B6);
updatefreq(_freq3,_step3,0x00AA,0x00FA); updatefreq(_freq3, _step3, 0x00AA, 0x00FA);
updatefreq(_freq4,_step4,0x019A,0x03B6); updatefreq(_freq4, _step4, 0x019A, 0x03B6);
_mod->setChannelFreq(_id | 0x000, BASE_FREQUENCY / _freq1); _mod->setChannelFreq(_id | 0x000, BASE_FREQUENCY / _freq1);
_mod->setChannelFreq(_id | 0x100, BASE_FREQUENCY / _freq2); _mod->setChannelFreq(_id | 0x100, BASE_FREQUENCY / _freq2);
_mod->setChannelFreq(_id | 0x200, BASE_FREQUENCY / _freq3); _mod->setChannelFreq(_id | 0x200, BASE_FREQUENCY / _freq3);
@ -986,8 +986,9 @@ private:
int _ticks; int _ticks;
}; };
#define CRCToSound(CRC, SOUND) \ #define CRCToSound(CRC, SOUND) \
if (crc == CRC) return new SOUND if (crc == CRC) \
return new SOUND
static V2A_Sound *findSound (unsigned long crc) { static V2A_Sound *findSound (unsigned long crc) {
CRCToSound(0x8FAB08C4, V2A_Sound_SingleLooped(0x006C,0x2B58,0x016E,0x3F)); // Maniac 17 CRCToSound(0x8FAB08C4, V2A_Sound_SingleLooped(0x006C,0x2B58,0x016E,0x3F)); // Maniac 17
@ -1165,7 +1166,7 @@ void Player_V2A::startSound(int nr) {
assert(_scumm); assert(_scumm);
byte *data = _scumm->getResourceAddress(rtSound, nr); byte *data = _scumm->getResourceAddress(rtSound, nr);
assert(data); 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); V2A_Sound *snd = findSound(crc);
if (snd == NULL) { if (snd == NULL) {
warning("player_v2a - sound %i not recognized yet (crc %08X)",nr,crc); warning("player_v2a - sound %i not recognized yet (crc %08X)",nr,crc);

View file

@ -55,8 +55,7 @@ private:
V2A_MAXSLOTS = 8 V2A_MAXSLOTS = 8
}; };
struct soundSlot struct soundSlot {
{
int id; int id;
V2A_Sound *sound; V2A_Sound *sound;
}; };

View file

@ -28,10 +28,10 @@
namespace Scumm { namespace Scumm {
static const uint16 note_freqs[4][12] = { static const uint16 note_freqs[4][12] = {
{0x06B0,0x0650,0x05F4,0x05A0,0x054C,0x0500,0x04B8,0x0474,0x0434,0x03F8,0x03C0,0x0388}, {0x06B0, 0x0650, 0x05F4, 0x05A0, 0x054C, 0x0500, 0x04B8, 0x0474, 0x0434, 0x03F8, 0x03C0, 0x0388},
{0x0358,0x0328,0x02FA,0x02D0,0x02A6,0x0280,0x025C,0x023A,0x021A,0x01FC,0x01E0,0x01C4}, {0x0358, 0x0328, 0x02FA, 0x02D0, 0x02A6, 0x0280, 0x025C, 0x023A, 0x021A, 0x01FC, 0x01E0, 0x01C4},
{0x01AC,0x0194,0x017D,0x0168,0x0153,0x0140,0x012E,0x011D,0x010D,0x00FE,0x00F0,0x00E2}, {0x01AC, 0x0194, 0x017D, 0x0168, 0x0153, 0x0140, 0x012E, 0x011D, 0x010D, 0x00FE, 0x00F0, 0x00E2},
{0x00D6,0x00CA,0x00BE,0x00B4,0x00A9,0x00A0,0x0097,0x008E,0x0086,0x007F,0x00F0,0x00E2} {0x00D6, 0x00CA, 0x00BE, 0x00B4, 0x00A9, 0x00A0, 0x0097, 0x008E, 0x0086, 0x007F, 0x00F0, 0x00E2}
}; };
Player_V3A::Player_V3A(ScummEngine *scumm) { Player_V3A::Player_V3A(ScummEngine *scumm) {
@ -206,7 +206,7 @@ void Player_V3A::startSound(int nr) {
_wavetable[i] = NULL; _wavetable[i] = NULL;
_isinit = true; _isinit = true;
} }
if (getSoundStatus(nr)) if (getSoundStatus(nr))
stopSound(nr); // if a sound is playing, restart it stopSound(nr); // if a sound is playing, restart it

View file

@ -55,21 +55,18 @@ private:
V3A_MAXSFX = 8 V3A_MAXSFX = 8
}; };
struct musChan struct musChan {
{
int id; int id;
int dur; int dur;
}; };
struct sfxChan struct sfxChan {
{
int id; int id;
int dur; int dur;
// SFX will eventually have pitch bends // SFX will eventually have pitch bends
}; };
struct instData struct instData {
{
char *_idat[6]; char *_idat[6];
uint16 _ilen[6]; uint16 _ilen[6];
char *_ldat[6]; char *_ldat[6];

View file

@ -1297,78 +1297,76 @@ void ScummEngine::convertADResource(int type, int idx, byte *src_ptr, int size)
if (instr[i*16 + 13]) if (instr[i*16 + 13])
warning("Sound %d instrument %d uses percussion", idx, i); warning("Sound %d instrument %d uses percussion", idx, i);
debug(4, "Sound %d: instrument %d on channel %d.", debug(4, "Sound %d: instrument %d on channel %d.", idx, i, ch);
idx, i, ch);
memcpy(ptr, ADLIB_INSTR_MIDI_HACK, sizeof(ADLIB_INSTR_MIDI_HACK));
memcpy(ptr, ADLIB_INSTR_MIDI_HACK,
sizeof(ADLIB_INSTR_MIDI_HACK));
ptr[5] += ch; ptr[5] += ch;
ptr[28] += ch; ptr[28] += ch;
ptr[92] += ch; ptr[92] += ch;
/* flags_1 */ /* flags_1 */
ptr[30 + 0] = (instr[i * 16 + 3] >> 4) & 0xf; ptr[30 + 0] = (instr[i * 16 + 3] >> 4) & 0xf;
ptr[30 + 1] = instr[i * 16 + 3] & 0xf; ptr[30 + 1] = instr[i * 16 + 3] & 0xf;
/* oplvl_1 */ /* oplvl_1 */
ptr[30 + 2] = (instr[i * 16 + 4] >> 4) & 0xf; ptr[30 + 2] = (instr[i * 16 + 4] >> 4) & 0xf;
ptr[30 + 3] = instr[i * 16 + 4] & 0xf; ptr[30 + 3] = instr[i * 16 + 4] & 0xf;
/* atdec_1 */ /* atdec_1 */
ptr[30 + 4] = ((~instr[i * 16 + 5]) >> 4) & 0xf; ptr[30 + 4] = ((~instr[i * 16 + 5]) >> 4) & 0xf;
ptr[30 + 5] = (~instr[i * 16 + 5]) & 0xf; ptr[30 + 5] = (~instr[i * 16 + 5]) & 0xf;
/* sustrel_1 */ /* sustrel_1 */
ptr[30 + 6] = ((~instr[i * 16 + 6]) >> 4) & 0xf; ptr[30 + 6] = ((~instr[i * 16 + 6]) >> 4) & 0xf;
ptr[30 + 7] = (~instr[i * 16 + 6]) & 0xf; ptr[30 + 7] = (~instr[i * 16 + 6]) & 0xf;
/* waveform_1 */ /* waveform_1 */
ptr[30 + 8] = (instr[i * 16 + 7] >> 4) & 0xf; ptr[30 + 8] = (instr[i * 16 + 7] >> 4) & 0xf;
ptr[30 + 9] = instr[i * 16 + 7] & 0xf; ptr[30 + 9] = instr[i * 16 + 7] & 0xf;
/* flags_2 */ /* flags_2 */
ptr[30 + 10] = (instr[i * 16 + 8] >> 4) & 0xf; ptr[30 + 10] = (instr[i * 16 + 8] >> 4) & 0xf;
ptr[30 + 11] = instr[i * 16 + 8] & 0xf; ptr[30 + 11] = instr[i * 16 + 8] & 0xf;
/* oplvl_2 */ /* oplvl_2 */
ptr[30 + 12] = (instr[i * 16 + 9] >> 4) & 0xf; ptr[30 + 12] = (instr[i * 16 + 9] >> 4) & 0xf;
ptr[30 + 13] = instr[i * 16 + 9] & 0xf; ptr[30 + 13] = instr[i * 16 + 9] & 0xf;
/* atdec_2 */ /* atdec_2 */
ptr[30 + 14] = ((~instr[i * 16 + 10]) >> 4) & 0xf; ptr[30 + 14] = ((~instr[i * 16 + 10]) >> 4) & 0xf;
ptr[30 + 15] = (~instr[i * 16 + 10]) & 0xf; ptr[30 + 15] = (~instr[i * 16 + 10]) & 0xf;
/* sustrel_2 */ /* sustrel_2 */
ptr[30 + 16] = ((~instr[i * 16 + 11]) >> 4) & 0xf; ptr[30 + 16] = ((~instr[i * 16 + 11]) >> 4) & 0xf;
ptr[30 + 17] = (~instr[i * 16 + 11]) & 0xf; ptr[30 + 17] = (~instr[i * 16 + 11]) & 0xf;
/* waveform_2 */ /* waveform_2 */
ptr[30 + 18] = (instr[i * 16 + 12] >> 4) & 0xf; ptr[30 + 18] = (instr[i * 16 + 12] >> 4) & 0xf;
ptr[30 + 19] = instr[i * 16 + 12] & 0xf; ptr[30 + 19] = instr[i * 16 + 12] & 0xf;
/* feedback */ /* feedback */
ptr[30 + 20] = (instr[i * 16 + 2] >> 4) & 0xf; ptr[30 + 20] = (instr[i * 16 + 2] >> 4) & 0xf;
ptr[30 + 21] = instr[i * 16 + 2] & 0xf; ptr[30 + 21] = instr[i * 16 + 2] & 0xf;
ptr += sizeof(ADLIB_INSTR_MIDI_HACK); ptr += sizeof(ADLIB_INSTR_MIDI_HACK);
} }
// There is a constant delay of ppqn/3 before the music starts. // There is a constant delay of ppqn/3 before the music starts.
if (ppqn / 3 >= 128) if (ppqn / 3 >= 128)
*ptr++ = (ppqn / 3 >> 7) | 0x80; *ptr++ = (ppqn / 3 >> 7) | 0x80;
*ptr++ = ppqn / 3 & 0x7f; *ptr++ = ppqn / 3 & 0x7f;
// Now copy the actual music data // Now copy the actual music data
memcpy(ptr, track, size); memcpy(ptr, track, size);
ptr += size; ptr += size;
if (!play_once) { if (!play_once) {
// The song is meant to be looped. We achieve this by inserting just // 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 // 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 // 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, // use a set_loop sysex, but it's a bit longer, a little more complicated,
// and has no advantage either. // and has no advantage either.
// First, find the track end // First, find the track end
byte *end = ptr; byte *end = ptr;
ptr -= size; ptr -= size;
@ -1377,7 +1375,7 @@ void ScummEngine::convertADResource(int type, int idx, byte *src_ptr, int size)
break; break;
} }
assert(ptr < end); assert(ptr < end);
// Now insert the jump. The jump offset is measured in ticks. // Now insert the jump. The jump offset is measured in ticks.
// We have ppqn/3 ticks before the first note. // 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. * tracks.
*/ */
ptr = writeMIDIHeader(ptr, "ASFX", ppqn, total_size); ptr = writeMIDIHeader(ptr, "ASFX", ppqn, total_size);
byte current_instr[3][14]; byte current_instr[3][14];
int current_note[3]; int current_note[3];
int track_time[3]; int track_time[3];
byte *track_data[3]; byte *track_data[3];
int track_ctr = 0; int track_ctr = 0;
byte chunk_type = 0; byte chunk_type = 0;
int delay, delay2, olddelay; int delay, delay2, olddelay;
// Write a tempo change Meta event // Write a tempo change Meta event
// 473 / 4 Hz, convert to micro seconds. // 473 / 4 Hz, convert to micro seconds.
dw = 1000000 * ppqn * 4 / 473; 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 >> 16) & 0xFF);
*ptr++ = (byte)((dw >> 8) & 0xFF); *ptr++ = (byte)((dw >> 8) & 0xFF);
*ptr++ = (byte)(dw & 0xFF); *ptr++ = (byte)(dw & 0xFF);
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
track_time[i] = -1; track_time[i] = -1;
current_note[i] = -1; current_note[i] = -1;
@ -1445,7 +1443,7 @@ void ScummEngine::convertADResource(int type, int idx, byte *src_ptr, int size)
break; break;
src_ptr++; src_ptr++;
} }
int curtime = 0; int curtime = 0;
for (;;) { for (;;) {
int mintime = -1; int mintime = -1;
@ -1459,11 +1457,10 @@ void ScummEngine::convertADResource(int type, int idx, byte *src_ptr, int size)
} }
if (mintime < 0) if (mintime < 0)
break; break;
src_ptr = track_data[ch]; src_ptr = track_data[ch];
chunk_type = *src_ptr; chunk_type = *src_ptr;
if (current_note[ch] >= 0) { if (current_note[ch] >= 0) {
delay = mintime - curtime; delay = mintime - curtime;
curtime = mintime; curtime = mintime;
@ -1473,71 +1470,70 @@ void ScummEngine::convertADResource(int type, int idx, byte *src_ptr, int size)
*ptr++ = 0; *ptr++ = 0;
current_note[ch] = -1; current_note[ch] = -1;
} }
switch (chunk_type) { switch (chunk_type) {
case 1: case 1:
/* Instrument definition */ /* Instrument definition */
memcpy(current_instr[ch], src_ptr+1, 14); memcpy(current_instr[ch], src_ptr + 1, 14);
src_ptr += 15; src_ptr += 15;
break; break;
case 2: case 2:
/* tone/parammodulation */ /* tone/parammodulation */
memcpy(ptr, ADLIB_INSTR_MIDI_HACK, memcpy(ptr, ADLIB_INSTR_MIDI_HACK,
sizeof(ADLIB_INSTR_MIDI_HACK)); sizeof(ADLIB_INSTR_MIDI_HACK));
ptr[5] += ch; ptr[5] += ch;
ptr[28] += ch; ptr[28] += ch;
ptr[92] += ch; ptr[92] += ch;
/* flags_1 */ /* flags_1 */
ptr[30 + 0] = (current_instr[ch][3] >> 4) & 0xf; ptr[30 + 0] = (current_instr[ch][3] >> 4) & 0xf;
ptr[30 + 1] = current_instr[ch][3] & 0xf; ptr[30 + 1] = current_instr[ch][3] & 0xf;
/* oplvl_1 */ /* oplvl_1 */
ptr[30 + 2] = (current_instr[ch][4] >> 4) & 0xf; ptr[30 + 2] = (current_instr[ch][4] >> 4) & 0xf;
ptr[30 + 3] = current_instr[ch][4] & 0xf; ptr[30 + 3] = current_instr[ch][4] & 0xf;
/* atdec_1 */ /* atdec_1 */
ptr[30 + 4] = ((~current_instr[ch][5]) >> 4) & 0xf; ptr[30 + 4] = ((~current_instr[ch][5]) >> 4) & 0xf;
ptr[30 + 5] = (~current_instr[ch][5]) & 0xf; ptr[30 + 5] = (~current_instr[ch][5]) & 0xf;
/* sustrel_1 */ /* sustrel_1 */
ptr[30 + 6] = ((~current_instr[ch][6]) >> 4) & 0xf; ptr[30 + 6] = ((~current_instr[ch][6]) >> 4) & 0xf;
ptr[30 + 7] = (~current_instr[ch][6]) & 0xf; ptr[30 + 7] = (~current_instr[ch][6]) & 0xf;
/* waveform_1 */ /* waveform_1 */
ptr[30 + 8] = (current_instr[ch][7] >> 4) & 0xf; ptr[30 + 8] = (current_instr[ch][7] >> 4) & 0xf;
ptr[30 + 9] = current_instr[ch][7] & 0xf; ptr[30 + 9] = current_instr[ch][7] & 0xf;
/* flags_2 */ /* flags_2 */
ptr[30 + 10] = (current_instr[ch][8] >> 4) & 0xf; ptr[30 + 10] = (current_instr[ch][8] >> 4) & 0xf;
ptr[30 + 11] = current_instr[ch][8] & 0xf; ptr[30 + 11] = current_instr[ch][8] & 0xf;
/* oplvl_2 */ /* oplvl_2 */
ptr[30 + 12] = ((current_instr[ch][9]) >> 4) & 0xf; ptr[30 + 12] = ((current_instr[ch][9]) >> 4) & 0xf;
ptr[30 + 13] = (current_instr[ch][9]) & 0xf; ptr[30 + 13] = (current_instr[ch][9]) & 0xf;
/* atdec_2 */ /* atdec_2 */
ptr[30 + 14] = ((~current_instr[ch][10]) >> 4) & 0xf; ptr[30 + 14] = ((~current_instr[ch][10]) >> 4) & 0xf;
ptr[30 + 15] = (~current_instr[ch][10]) & 0xf; ptr[30 + 15] = (~current_instr[ch][10]) & 0xf;
/* sustrel_2 */ /* sustrel_2 */
ptr[30 + 16] = ((~current_instr[ch][11]) >> 4) & 0xf; ptr[30 + 16] = ((~current_instr[ch][11]) >> 4) & 0xf;
ptr[30 + 17] = (~current_instr[ch][11]) & 0xf; ptr[30 + 17] = (~current_instr[ch][11]) & 0xf;
/* waveform_2 */ /* waveform_2 */
ptr[30 + 18] = (current_instr[ch][12] >> 4) & 0xf; ptr[30 + 18] = (current_instr[ch][12] >> 4) & 0xf;
ptr[30 + 19] = current_instr[ch][12] & 0xf; ptr[30 + 19] = current_instr[ch][12] & 0xf;
/* feedback */ /* feedback */
ptr[30 + 20] = (current_instr[ch][2] >> 4) & 0xf; ptr[30 + 20] = (current_instr[ch][2] >> 4) & 0xf;
ptr[30 + 21] = current_instr[ch][2] & 0xf; ptr[30 + 21] = current_instr[ch][2] & 0xf;
delay = mintime - curtime; delay = mintime - curtime;
curtime = mintime; curtime = mintime;
{ {
delay = convert_extraflags(ptr + 30 + 22, src_ptr + 1); delay = convert_extraflags(ptr + 30 + 22, src_ptr + 1);
delay2 = convert_extraflags(ptr + 30 + 40, src_ptr + 6); 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) if (delay == -1)
delay = 0; delay = 0;
} }
/* duration */ /* duration */
ptr[30 + 58] = 0; // ((delay * 17 / 63) >> 4) & 0xf; ptr[30 + 58] = 0; // ((delay * 17 / 63) >> 4) & 0xf;
ptr[30 + 59] = 0; // (delay * 17 / 63) & 0xf; ptr[30 + 59] = 0; // (delay * 17 / 63) & 0xf;
ptr += sizeof(ADLIB_INSTR_MIDI_HACK); ptr += sizeof(ADLIB_INSTR_MIDI_HACK);
olddelay = mintime - curtime; olddelay = mintime - curtime;
curtime = mintime; curtime = mintime;
ptr = writeVLQ(ptr, olddelay); ptr = writeVLQ(ptr, olddelay);
{ {
int freq = ((current_instr[ch][1] & 3) << 8) int freq = ((current_instr[ch][1] & 3) << 8)
| current_instr[ch][0]; | current_instr[ch][0];
@ -1580,22 +1576,22 @@ void ScummEngine::convertADResource(int type, int idx, byte *src_ptr, int size)
note = 1; note = 1;
else if (note > 127) else if (note > 127)
note = 127; note = 127;
// Insert a note on event // Insert a note on event
*ptr++ = 0x90 + ch; // key on channel *ptr++ = 0x90 + ch; // key on channel
*ptr++ = note; *ptr++ = note;
*ptr++ = 63; *ptr++ = 63;
current_note[ch] = note; current_note[ch] = note;
track_time[ch] = curtime + delay; track_time[ch] = curtime + delay;
} }
src_ptr += 11; src_ptr += 11;
break; break;
case 0x80: case 0x80:
track_time[ch] = -1; track_time[ch] = -1;
src_ptr ++; src_ptr ++;
break; break;
default: default:
track_time[ch] = -1; track_time[ch] = -1;
} }
@ -1645,10 +1641,9 @@ int ScummEngine::readSoundResourceSmallHeader(int type, int idx) {
} else { } else {
total_size = size = _fileHandle.readUint32LE(); total_size = size = _fileHandle.readUint32LE();
tag = _fileHandle.readUint16LE(); tag = _fileHandle.readUint16LE();
debug(4, " tag='%c%c', size=%d", debug(4, " tag='%c%c', size=%d", (char) (tag & 0xff),
(char) (tag & 0xff), (char) ((tag >> 8) & 0xff), size);
(char) ((tag >> 8) & 0xff), size);
if (tag == 0x4F52) { // RO if (tag == 0x4F52) { // RO
ro_offs = _fileHandle.pos(); ro_offs = _fileHandle.pos();
ro_size = size; ro_size = size;
@ -1657,11 +1652,10 @@ int ScummEngine::readSoundResourceSmallHeader(int type, int idx) {
while (pos < total_size) { while (pos < total_size) {
size = _fileHandle.readUint32LE(); size = _fileHandle.readUint32LE();
tag = _fileHandle.readUint16LE(); tag = _fileHandle.readUint16LE();
debug(4, " tag='%c%c', size=%d", debug(4, " tag='%c%c', size=%d", (char) (tag & 0xff),
(char) (tag & 0xff), (char) ((tag >> 8) & 0xff), size);
(char) ((tag >> 8) & 0xff), size);
pos += size; pos += size;
// MI1 and Indy3 uses one or more nested SO resources, which contains AD and WA // MI1 and Indy3 uses one or more nested SO resources, which contains AD and WA
// resources. // resources.
if ((tag == 0x4441) && !(ad_offs)) { // AD if ((tag == 0x4441) && !(ad_offs)) { // AD
@ -1725,7 +1719,6 @@ int ScummEngine::readSoundResourceSmallHeader(int type, int idx) {
return 0; return 0;
} }
int ScummEngine::getResourceRoomNr(int type, int idx) { int ScummEngine::getResourceRoomNr(int type, int idx) {
if (type == rtRoom) if (type == rtRoom)
return idx; return idx;
@ -1888,16 +1881,12 @@ void ScummEngine::lock(int type, int i) {
if (!validateResource("Locking", type, i)) if (!validateResource("Locking", type, i))
return; return;
res.flags[type][i] |= RF_LOCK; res.flags[type][i] |= RF_LOCK;
// debug(1, "locking %d,%d", type, i);
} }
void ScummEngine::unlock(int type, int i) { void ScummEngine::unlock(int type, int i) {
if (!validateResource("Unlocking", type, i)) if (!validateResource("Unlocking", type, i))
return; return;
res.flags[type][i] &= ~RF_LOCK; res.flags[type][i] &= ~RF_LOCK;
// debug(1, "unlocking %d,%d", type, i);
} }
bool ScummEngine::isResourceInUse(int type, int i) const { bool ScummEngine::isResourceInUse(int type, int i) const {
@ -1940,8 +1929,6 @@ void ScummEngine::expireResources(uint32 size) {
int best_type, best_res = 0; int best_type, best_res = 0;
uint32 oldAllocatedSize; uint32 oldAllocatedSize;
// return;
if (_expire_counter != 0xFF) { if (_expire_counter != 0xFF) {
_expire_counter = 0xFF; _expire_counter = 0xFF;
increaseResourceCounter(); increaseResourceCounter();

View file

@ -421,7 +421,7 @@ void ScummEngine_v2::decodeParseString() {
if (_demoMode && _actorToPrintStrFor == 0xFF) if (_demoMode && _actorToPrintStrFor == 0xFF)
_string[textSlot].color = 1; _string[textSlot].color = 1;
else if (_actorToPrintStrFor != 0xFF) else if (_actorToPrintStrFor != 0xFF)
_string[textSlot].color = v1_mm_actor_speech_color[_actorToPrintStrFor]; _string[textSlot].color = v1_mm_actor_speech_color[_actorToPrintStrFor];
} }
_messagePtr = buffer; _messagePtr = buffer;
@ -674,7 +674,7 @@ void ScummEngine_v2::o2_actorSet() {
_string[0].color = arg; _string[0].color = arg;
return; return;
} }
a = derefActor(act, "actorSet"); a = derefActor(act, "actorSet");
switch (_opcode) { switch (_opcode) {
@ -801,7 +801,7 @@ void ScummEngine_v2::o2_verbOps() {
_verbs[slot].curmode = state; _verbs[slot].curmode = state;
break; break;
default: { // New Verb default: { // New Verb
int x = fetchScriptByte() << 3; int x = fetchScriptByte() << 3;
int y = fetchScriptByte() << 3; int y = fetchScriptByte() << 3;
@ -888,7 +888,7 @@ void ScummEngine_v2::o2_doSentence() {
st->objectB = getVarOrDirectWord(0x20); st->objectB = getVarOrDirectWord(0x20);
st->preposition = (st->objectB != 0); st->preposition = (st->objectB != 0);
st->freezeCount = 0; st->freezeCount = 0;
// Execute or print the sentence // Execute or print the sentence
_opcode = fetchScriptByte(); _opcode = fetchScriptByte();
switch(_opcode) { switch(_opcode) {
@ -908,7 +908,7 @@ void ScummEngine_v2::o2_doSentence() {
VAR(VAR_ACTIVE_VERB) = st->verb; VAR(VAR_ACTIVE_VERB) = st->verb;
VAR(VAR_ACTIVE_OBJECT1) = st->objectA; VAR(VAR_ACTIVE_OBJECT1) = st->objectA;
VAR(VAR_ACTIVE_OBJECT2) = st->objectB; VAR(VAR_ACTIVE_OBJECT2) = st->objectB;
isBackgroundScript = false; isBackgroundScript = false;
isSpecialVerb = false; isSpecialVerb = false;
} else { } else {
@ -926,7 +926,7 @@ void ScummEngine_v2::o2_doSentence() {
int slot = -1; int slot = -1;
ScriptSlot *ss; ScriptSlot *ss;
int i; int i;
ss = vm.slot; ss = vm.slot;
for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++) { for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++) {
if (st->objectA == ss->number && if (st->objectA == ss->number &&
@ -944,7 +944,7 @@ void ScummEngine_v2::o2_doSentence() {
case 2: case 2:
// Print the sentence // Print the sentence
_sentenceNum--; _sentenceNum--;
VAR(VAR_SENTENCE_VERB) = st->verb; VAR(VAR_SENTENCE_VERB) = st->verb;
VAR(VAR_SENTENCE_OBJECT1) = st->objectA; VAR(VAR_SENTENCE_OBJECT1) = st->objectA;
VAR(VAR_SENTENCE_OBJECT2) = st->objectB; VAR(VAR_SENTENCE_OBJECT2) = st->objectB;
@ -960,7 +960,7 @@ void ScummEngine_v2::o2_drawSentence() {
Common::Rect sentenceline; Common::Rect sentenceline;
static char sentence[256]; static char sentence[256];
const byte *temp; const byte *temp;
int slot = getVerbSlot(VAR(VAR_SENTENCE_VERB),0); int slot = getVerbSlot(VAR(VAR_SENTENCE_VERB), 0);
if (!(_userState & 32)) if (!(_userState & 32))
return; return;
@ -983,7 +983,7 @@ void ScummEngine_v2::o2_drawSentence() {
if (_verbs[slot].prep == 0xFF) { if (_verbs[slot].prep == 0xFF) {
byte *ptr = getOBCDFromObject(VAR(VAR_SENTENCE_OBJECT1)); byte *ptr = getOBCDFromObject(VAR(VAR_SENTENCE_OBJECT1));
assert(ptr); assert(ptr);
VAR(VAR_SENTENCE_PREPOSITION) = (*(ptr+12) >> 5); VAR(VAR_SENTENCE_PREPOSITION) = (*(ptr + 12) >> 5);
} else } else
VAR(VAR_SENTENCE_PREPOSITION) = _verbs[slot].prep; 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[1] = (int16)VAR(VAR_CURSORSTATE);
vm.cutSceneData[2] = _currentRoom; vm.cutSceneData[2] = _currentRoom;
vm.cutSceneData[3] = camera._mode; vm.cutSceneData[3] = camera._mode;
VAR(VAR_CURSORSTATE) = 200; VAR(VAR_CURSORSTATE) = 200;
// FIXME allows quotes script (173) to start during introudction of // FIXME allows quotes script (173) to start during introudction of
// demo mode of V1 Maniac Mansion. setUserState was halting script // demo mode of V1 Maniac Mansion. setUserState was halting script
// 173 before it started. // 173 before it started.
if (!(_gameId == GID_MANIAC && _version == 1 && _demoMode)) if (!(_gameId == GID_MANIAC && _version == 1 && _demoMode))
// Hide inventory, freeze scripts, hide cursor // Hide inventory, freeze scripts, hide cursor
setUserState(15); setUserState(15);
_sentenceNum = 0; _sentenceNum = 0;
stopScript(SENTENCE_SCRIPT); stopScript(SENTENCE_SCRIPT);
resetSentence(); resetSentence();
@ -1496,7 +1496,7 @@ void ScummEngine_v2::o2_cursorCommand() { // TODO: Define the magic numbers
if (cmd & 0xFF) { if (cmd & 0xFF) {
VAR(VAR_CURSORSTATE) = cmd & 0xFF; VAR(VAR_CURSORSTATE) = cmd & 0xFF;
} }
setUserState(state); setUserState(state);
} }

View file

@ -82,7 +82,7 @@ struct ScummGameSettings {
byte id, version; byte id, version;
int midi; // MidiDriverType values int midi; // MidiDriverType values
uint32 features; uint32 features;
GameSettings toGameSettings() const { GameSettings toGameSettings() const {
GameSettings dummy = { gameName, description, midi, features, 0 }; GameSettings dummy = { gameName, description, midi, features, 0 };
return dummy; return dummy;
@ -663,9 +663,8 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
if (!_mixer->bindToSystem(syst)) { if (!_mixer->bindToSystem(syst)) {
warning("Sound mixer initialization failed"); warning("Sound mixer initialization failed");
if (_midiDriver == MD_ADLIB || if (_midiDriver == MD_ADLIB ||
_midiDriver == MD_PCSPK || _midiDriver == MD_PCSPK ||
_midiDriver == MD_PCJR) _midiDriver == MD_PCJR) {
{
_midiDriver = MD_NULL; _midiDriver = MD_NULL;
warning("MIDI driver depends on sound mixer, switching to null MIDI driver"); 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() { ScummEngine::~ScummEngine() {
_mixer->stopAll(); _mixer->stopAll();
delete [] _actors; delete [] _actors;
delete _2byteFontPtr; delete _2byteFontPtr;
delete _charset; delete _charset;
delete _pauseDialog; delete _pauseDialog;

View file

@ -487,12 +487,12 @@ void Sound::processSfxQueues() {
} }
} }
} }
if (finished && _scumm->_talkDelay == 0) { if (finished && _scumm->_talkDelay == 0) {
_scumm->stopTalk(); _scumm->stopTalk();
} }
} }
if (_sfxMode & 1) { if (_sfxMode & 1) {
if (isSfxFinished()) { if (isSfxFinished()) {
_sfxMode &= ~1; _sfxMode &= ~1;
@ -615,7 +615,7 @@ int Sound::isSoundRunning(int sound) const {
if (sound == _currentCDSound) if (sound == _currentCDSound)
return pollCD(); return pollCD();
if (_scumm->_features & GF_HUMONGOUS) { if (_scumm->_features & GF_HUMONGOUS) {
if (sound == -2) { if (sound == -2) {
return isSfxFinished(); return isSfxFinished();
@ -626,7 +626,7 @@ int Sound::isSoundRunning(int sound) const {
return _scumm->_imuse->getSoundStatus(sound); return _scumm->_imuse->getSoundStatus(sound);
} }
} }
if (isSoundInQueue(sound)) if (isSoundInQueue(sound))
return 1; 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 // FIXME: Using _size here is a problem if offset (or equivalently
// startFrame) is non-zero. // startFrame) is non-zero.
mad_timer_set(&durationTime, (_size * 8) / _mad_header.bitrate, 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 { } else {
mad_timer_set(&durationTime, duration / 75, duration % 75, 75); 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); ov_time_seek(&_ov_file, startFrame / 75.0);
#endif #endif
return mixer->playVorbis(handle, &_ov_file, return mixer->playVorbis(handle, &_ov_file,
duration * ov_info(&_ov_file, -1)->rate / 75, duration * ov_info(&_ov_file, -1)->rate / 75, true);
true);
} }
VorbisTrackInfo::~VorbisTrackInfo() { VorbisTrackInfo::~VorbisTrackInfo() {

View file

@ -592,8 +592,7 @@ void ScummEngine::addIntToStack(int var) {
_msgPtrToAdd += sprintf((char *)_msgPtrToAdd, "%d", num); _msgPtrToAdd += sprintf((char *)_msgPtrToAdd, "%d", num);
} }
void ScummEngine::addVerbToStack(int var) void ScummEngine::addVerbToStack(int var) {
{
int num, k; int num, k;
num = readVar(var); num = readVar(var);
@ -611,8 +610,7 @@ void ScummEngine::addVerbToStack(int var)
} }
} }
void ScummEngine::addNameToStack(int var) void ScummEngine::addNameToStack(int var) {
{
int num; int num;
const byte *ptr = 0; const byte *ptr = 0;
@ -725,8 +723,8 @@ void ScummEngine::drawBlastTexts() {
if (c != 0 && c != 0xFF) { if (c != 0 && c != 0xFF) {
_charset->_left = _charset->_nextLeft; _charset->_left = _charset->_nextLeft;
_charset->_top = _charset->_nextTop; _charset->_top = _charset->_nextTop;
if (c >= 0x80 && _CJKMode) if (c >= 0x80 && _CJKMode)
c += *buf++ * 256; c += *buf++ * 256;
_charset->printChar(c); _charset->printChar(c);
_charset->_nextLeft = _charset->_left; _charset->_nextLeft = _charset->_left;
_charset->_nextTop = _charset->_top; _charset->_nextTop = _charset->_top;