[Scummvm-cvs-logs] SF.net SVN: scummvm: [31982] scummvm/branches/gsoc2008-tfmx/engines/gob
marwanhilmi at users.sourceforge.net
marwanhilmi at users.sourceforge.net
Sat May 10 20:51:26 CEST 2008
Revision: 31982
http://scummvm.svn.sourceforge.net/scummvm/?rev=31982&view=rev
Author: marwanhilmi
Date: 2008-05-10 11:51:25 -0700 (Sat, 10 May 2008)
Log Message:
-----------
Updates to GobEngine taken from trunk.
Modified Paths:
--------------
scummvm/branches/gsoc2008-tfmx/engines/gob/coktelvideo.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/coktelvideo.h
scummvm/branches/gsoc2008-tfmx/engines/gob/dataio.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/detection.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/draw.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/draw_v1.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/draw_v2.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/driver_vga.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/game.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/game.h
scummvm/branches/gsoc2008-tfmx/engines/gob/game_v1.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/game_v2.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/gob.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/gob.h
scummvm/branches/gsoc2008-tfmx/engines/gob/goblin.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/goblin.h
scummvm/branches/gsoc2008-tfmx/engines/gob/goblin_v1.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/goblin_v2.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/init.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/init_v1.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/init_v2.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/inter.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/inter_bargon.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/inter_v1.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/inter_v2.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/inter_v4.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/map.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/map_v1.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/map_v2.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/module.mk
scummvm/branches/gsoc2008-tfmx/engines/gob/mult.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/mult.h
scummvm/branches/gsoc2008-tfmx/engines/gob/mult_v1.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/mult_v2.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/parse.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/parse_v1.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/parse_v2.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/scenery.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/scenery.h
scummvm/branches/gsoc2008-tfmx/engines/gob/scenery_v1.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/scenery_v2.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/util.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/video.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/video_v1.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/video_v2.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/videoplayer.cpp
scummvm/branches/gsoc2008-tfmx/engines/gob/videoplayer.h
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/coktelvideo.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/coktelvideo.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/coktelvideo.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -270,6 +270,13 @@
_mixer = 0;
}
+bool Imd::isSoundPlaying() const {
+ if (_audioStream && _mixer->isSoundHandleActive(_audioHandle))
+ return true;
+
+ return false;
+}
+
void Imd::seekFrame(int32 frame, int16 whence, bool restart) {
if (!_stream)
// Nothing to do
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/coktelvideo.h
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/coktelvideo.h 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/coktelvideo.h 2008-05-10 18:51:25 UTC (rev 31982)
@@ -139,6 +139,9 @@
/** Don't play sound or stop currently playing sound. */
virtual void disableSound() = 0;
+ /** Is sound currently playing? */
+ virtual bool isSoundPlaying() const = 0;
+
/** Seek to a specific frame.
*
* @param frame The frame to which to seek.
@@ -203,6 +206,8 @@
void enableSound(Audio::Mixer &mixer);
void disableSound();
+ bool isSoundPlaying() const;
+
void seekFrame(int32 frame, int16 whence = SEEK_SET, bool restart = false);
State nextFrame();
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/dataio.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/dataio.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/dataio.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "gob/gob.h"
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/detection.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/detection.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/detection.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "base/plugins.h"
#include "common/advancedDetector.h"
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/draw.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/draw.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/draw.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "gob/gob.h"
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/draw_v1.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/draw_v1.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/draw_v1.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "graphics/cursorman.h"
@@ -31,9 +30,9 @@
#include "gob/draw.h"
#include "gob/global.h"
#include "gob/util.h"
-#include "gob/cdrom.h"
#include "gob/game.h"
#include "gob/scenery.h"
+#include "gob/sound/sound.h"
namespace Gob {
@@ -170,7 +169,7 @@
int16 spriteRight, spriteBottom;
char buf[20];
- _vm->_cdrom->playMultMusic();
+ _vm->_sound->cdPlayMultMusic();
if (!_vm->_game->_totTextData || !_vm->_game->_totTextData->dataPtr)
return;
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/draw_v2.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/draw_v2.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/draw_v2.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "graphics/cursorman.h"
@@ -178,13 +177,13 @@
_vm->_util->delay(5);
}
}
- } else
+ } else {
blitCursor();
+ _cursorX = newX;
+ _cursorY = newY;
+ }
_showCursor &= ~1;
-
- _cursorX = newX;
- _cursorY = newY;
}
void Draw_v2::printTotText(int16 id) {
@@ -246,22 +245,25 @@
}
if (_renderFlags & RENDERFLAG_FROMSPLIT) {
- destY = _vm->_video->_splitStart;
+ destY = _vm->_video->_splitHeight1;
spriteBottom = READ_LE_UINT16(ptr + 6) - READ_LE_UINT16(ptr + 2);
+
if (_renderFlags & RENDERFLAG_DOUBLECOORDS)
spriteBottom *= 3;
- spriteBottom += _vm->_video->_splitStart;
+
+ spriteBottom += _vm->_video->_splitHeight1;
+
if (_renderFlags & RENDERFLAG_DOUBLECOORDS) {
- spriteBottom += _backDeltaX;
- destY += _backDeltaX;
+ spriteBottom += _backDeltaY;
+ destY += _backDeltaY;
}
} else {
+ destY = READ_LE_UINT16(ptr + 2);
+ spriteBottom = READ_LE_UINT16(ptr + 6);
+
if (_renderFlags & RENDERFLAG_DOUBLECOORDS) {
- destY = READ_LE_UINT16(ptr + 2) * 2;
- spriteBottom = READ_LE_UINT16(ptr + 6) * 2;
- } else {
- destY = READ_LE_UINT16(ptr + 2);
- spriteBottom = READ_LE_UINT16(ptr + 6);
+ destY *= 2;
+ spriteBottom *= 2;
}
}
@@ -629,8 +631,7 @@
_destSpriteX += _backDeltaX;
_destSpriteY += _backDeltaY;
if ((operation == DRAW_DRAWLINE) ||
- ((operation >= DRAW_DRAWBAR) &&
- (operation <= DRAW_FILLRECTABS))) {
+ ((operation >= DRAW_DRAWBAR) && (operation <= DRAW_FILLRECTABS))) {
_spriteRight += _backDeltaX;
_spriteBottom += _backDeltaY;
}
@@ -646,6 +647,20 @@
int16 destSurface = _destSurface;
int16 sourceSurface = _sourceSurface;
+ if ((_destSpriteY >= _vm->_video->_splitHeight1) &&
+ ((_destSurface == 20) || (_destSurface == 21))) {
+
+ _destSpriteY = (_destSpriteY - _vm->_video->_splitHeight1) + _vm->_video->_splitStart;
+ if ((operation == DRAW_DRAWLINE) ||
+ ((operation >= DRAW_DRAWBAR) && (operation <= DRAW_FILLRECTABS)))
+ _spriteBottom = (_spriteBottom - _vm->_video->_splitHeight1) + _vm->_video->_splitStart;
+
+ }
+
+ if ((_spriteTop >= _vm->_video->_splitHeight1) && (operation == DRAW_BLITSURF) &&
+ ((_destSurface == 20) || (_destSurface == 21)))
+ _spriteTop = (_spriteTop - _vm->_video->_splitHeight1) + _vm->_video->_splitStart;
+
adjustCoords(0, &_destSpriteX, &_destSpriteY);
if ((operation != DRAW_LOADSPRITE) && (_needAdjust != 2)) {
adjustCoords(0, &_spriteRight, &_spriteBottom);
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/driver_vga.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/driver_vga.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/driver_vga.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "graphics/primitives.h"
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/game.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/game.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/game.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "gob/gob.h"
@@ -35,7 +34,7 @@
#include "gob/parse.h"
#include "gob/draw.h"
#include "gob/mult.h"
-#include "gob/music.h"
+#include "gob/sound/sound.h"
namespace Gob {
@@ -60,9 +59,6 @@
_collStackElemSizes[i] = 0;
}
- _infIns = 0;
- _infogrames = 0;
-
_curTotFile[0] = 0;
_curExtFile[0] = 0;
_totToLoad[0] = 0;
@@ -105,10 +101,6 @@
}
Game::~Game() {
- delete _infIns;
-
- for (int i = 0; i < 60; i++)
- _soundSamples[i].free();
}
byte *Game::loadExtData(int16 itemId, int16 *pResWidth,
@@ -295,16 +287,7 @@
if (slot == -1)
slot = _vm->_parse->parseValExpr();
- if ((slot < 0) || (slot >= 60) || _soundSamples[slot].empty())
- return;
-
- SoundDesc &sample = _soundSamples[slot];
-
- if (sample.getType() == SOUND_ADL)
- if (_vm->_adlib && (_vm->_adlib->getIndex() == slot))
- _vm->_adlib->stopPlay();
-
- _vm->_snd->freeSample(sample);
+ _vm->_sound->sampleFree(_vm->_sound->sampleGetBySlot(slot));
}
void Game::evaluateScroll(int16 x, int16 y) {
@@ -380,7 +363,7 @@
if ((_vm->_inter->_soundEndTimeKey != 0) &&
(_vm->_util->getTimeKey() >= _vm->_inter->_soundEndTimeKey)) {
- _vm->_snd->stopSound(_vm->_inter->_soundStopVal);
+ _vm->_sound->blasterStop(_vm->_inter->_soundStopVal);
_vm->_inter->_soundEndTimeKey = 0;
}
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/game.h
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/game.h 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/game.h 2008-05-10 18:51:25 UTC (rev 31982)
@@ -26,10 +26,6 @@
#ifndef GOB_GAME_H
#define GOB_GAME_H
-#include "sound/mods/infogrames.h"
-
-#include "gob/sound.h"
-
namespace Gob {
class Game {
@@ -119,12 +115,6 @@
int16 _extHandle;
- SoundDesc _soundSamples[60];
-
- Audio::Infogrames::Instruments *_infIns;
- Audio::Infogrames *_infogrames;
- Audio::SoundHandle _infHandle;
-
char _totToLoad[20];
int32 _startTimeKey;
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/game_v1.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/game_v1.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/game_v1.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "common/stream.h"
@@ -32,15 +31,13 @@
#include "gob/global.h"
#include "gob/util.h"
#include "gob/dataio.h"
-#include "gob/music.h"
-#include "gob/cdrom.h"
#include "gob/draw.h"
#include "gob/inter.h"
#include "gob/mult.h"
#include "gob/video.h"
#include "gob/parse.h"
-#include "gob/sound.h"
#include "gob/scenery.h"
+#include "gob/sound/sound.h"
namespace Gob {
@@ -74,11 +71,11 @@
_vm->_draw->_fontToSprite[i].height = -1;
}
- if (_vm->_platform == Common::kPlatformMacintosh) {
- if (_vm->_adlib)
- _vm->_adlib->stopPlay();
- } else
- _vm->_cdrom->stopPlaying();
+ if (_vm->getPlatform() == Common::kPlatformMacintosh)
+ _vm->_sound->adlibStop();
+ else
+ _vm->_sound->cdStop();
+
_vm->_draw->animateCursor(4);
_vm->_inter->initControlVars(1);
_vm->_mult->initAll();
@@ -229,7 +226,7 @@
for (int i = 0; i < SPRITES_COUNT; i++)
_vm->_draw->freeSprite(i);
- _vm->_snd->stopSound(0);
+ _vm->_sound->blasterStop(0);
for (int i = 0; i < 20; i++)
freeSoundSlot(i);
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/game_v2.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/game_v2.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/game_v2.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "common/stream.h"
@@ -38,9 +37,9 @@
#include "gob/mult.h"
#include "gob/parse.h"
#include "gob/scenery.h"
-#include "gob/sound.h"
#include "gob/video.h"
#include "gob/videoplayer.h"
+#include "gob/sound/sound.h"
namespace Gob {
@@ -265,11 +264,14 @@
if (skipPlay != -1) {
_vm->_goblin->freeObjects();
- _vm->_snd->stopSound(0);
+ _vm->_sound->blasterStop(0);
- for (int i = 0; i < 60; i++)
- if (_soundSamples[i].getType() == SOUND_SND)
- _vm->_snd->freeSample(_soundSamples[i]);
+ for (int i = 0; i < Sound::kSoundsCount; i++) {
+ SoundDesc *sound = _vm->_sound->sampleGetBySlot(i);
+
+ if (sound && (sound->getType() == SOUND_SND))
+ _vm->_sound->sampleFree(sound);
+ }
}
_vm->_vidPlayer->primaryClose();
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/gob.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/gob.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/gob.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "common/events.h"
@@ -37,18 +36,16 @@
#include "gob/util.h"
#include "gob/dataio.h"
#include "gob/game.h"
-#include "gob/sound.h"
+#include "gob/sound/sound.h"
#include "gob/init.h"
#include "gob/inter.h"
#include "gob/draw.h"
-#include "gob/cdrom.h"
#include "gob/goblin.h"
#include "gob/map.h"
#include "gob/mult.h"
#include "gob/palanim.h"
#include "gob/parse.h"
#include "gob/scenery.h"
-#include "gob/music.h"
#include "gob/videoplayer.h"
#include "gob/saveload.h"
@@ -71,13 +68,12 @@
GobEngine::GobEngine(OSystem *syst) : Engine(syst) {
_vm = this;
- _snd = 0; _adlib = 0; _mult = 0;
- _game = 0; _global = 0; _cdrom = 0;
- _dataIO = 0; _goblin = 0; _vidPlayer = 0;
- _init = 0; _inter = 0; _map = 0;
- _palAnim = 0; _parse = 0; _scenery = 0;
- _draw = 0; _util = 0; _video = 0;
- _saveLoad = 0;
+ _sound = 0; _mult = 0; _game = 0;
+ _global = 0; _dataIO = 0; _goblin = 0;
+ _vidPlayer = 0; _init = 0; _inter = 0;
+ _map = 0; _palAnim = 0; _parse = 0;
+ _scenery = 0; _draw = 0; _util = 0;
+ _video = 0; _saveLoad = 0;
// Setup mixer
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
@@ -118,6 +114,12 @@
_quitRequested = true;
}
+const char *GobEngine::getLangDesc(int16 language) const {
+ if ((language < 0) || (language > 8))
+ language = 2;
+ return Common::getLanguageDescription(_gobToScummVMLang[language]);
+}
+
void GobEngine::validateLanguage() {
if (_vm->_global->_languageWanted != _vm->_global->_language) {
warning("Your game version doesn't support the requested language %s",
@@ -140,6 +142,30 @@
error("Video mode 0x%X is not supported!", videoMode);
}
+Common::Platform GobEngine::getPlatform() const {
+ return _platform;
+}
+
+GameType GobEngine::getGameType() const {
+ return _gameType;
+}
+
+bool GobEngine::isCD() const {
+ return (_features & kFeaturesCD) != 0;
+}
+
+bool GobEngine::isEGA() const {
+ return (_features & kFeaturesEGA) != 0;
+}
+
+bool GobEngine::is640() const {
+ return (_features & kFeatures640) != 0;
+}
+
+bool GobEngine::hasAdlib() const {
+ return (_features & kFeaturesAdlib) != 0;
+}
+
int GobEngine::init() {
if (!initGameParts()) {
GUIErrorMessage("GobEngine::init(): Unknown version of game engine");
@@ -220,7 +246,8 @@
}
bool GobEngine::initGameParts() {
- _adlib = 0;
+ _noMusic = MidiDriver::parseMusicDriver(ConfMan.get("music_driver")) == MD_NULL;
+
_saveLoad = 0;
_global = new Global(this);
@@ -228,8 +255,7 @@
_dataIO = new DataIO(this);
_palAnim = new PalAnim(this);
_vidPlayer = new VideoPlayer(this);
- _cdrom = new CDROM(this);
- _snd = new Snd(this);
+ _sound = new Sound(this);
switch (_gameType) {
case kGameTypeGob1:
@@ -336,10 +362,6 @@
break;
}
- _noMusic = MidiDriver::parseMusicDriver(ConfMan.get("music_driver")) == MD_NULL;
- if (!_noMusic && hasAdlib())
- _adlib = new Adlib(this);
-
if (is640()) {
_video->_surfWidth = _width = 640;
_video->_surfHeight = _video->_splitHeight1 = _height = 480;
@@ -360,15 +382,12 @@
}
void GobEngine::deinitGameParts() {
- delete _snd; _snd = 0;
- delete _adlib; _adlib = 0;
+ delete _saveLoad; _saveLoad = 0;
delete _mult; _mult = 0;
+ delete _vidPlayer; _vidPlayer = 0;
delete _game; _game = 0;
delete _global; _global = 0;
- delete _cdrom; _cdrom = 0;
- delete _dataIO; _dataIO = 0;
delete _goblin; _goblin = 0;
- delete _vidPlayer; _vidPlayer = 0;
delete _init; _init = 0;
delete _inter; _inter = 0;
delete _map; _map = 0;
@@ -378,7 +397,8 @@
delete _draw; _draw = 0;
delete _util; _util = 0;
delete _video; _video = 0;
- delete _saveLoad; _saveLoad = 0;
+ delete _sound; _sound = 0;
+ delete _dataIO; _dataIO = 0;
}
} // End of namespace Gob
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/gob.h
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/gob.h 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/gob.h 2008-05-10 18:51:25 UTC (rev 31982)
@@ -35,11 +35,10 @@
namespace Gob {
class Game;
-class Snd;
+class Sound;
class Video;
class Global;
class Draw;
-class CDROM;
class DataIO;
class Goblin;
class VideoPlayer;
@@ -52,7 +51,6 @@
class Scenery;
class Util;
class SaveLoad;
-class Adlib;
#define VARP(offs) (_vm->_global->_inter_variables + (offs))
#define WRITE_VARO_UINT32(offs, val) _vm->_global->writeVar(offs, (uint32) (val))
@@ -171,9 +169,13 @@
struct GOBGameDescription;
class GobEngine : public Engine {
-protected:
+private:
GobEngine *_vm;
+ GameType _gameType;
+ int32 _features;
+ Common::Platform _platform;
+
int go();
int init();
@@ -185,11 +187,7 @@
Common::RandomSource _rnd;
- GameType _gameType;
- int32 _features;
Common::Language _language;
- Common::Platform _platform;
-
uint16 _width;
uint16 _height;
uint8 _mode;
@@ -204,10 +202,9 @@
Util *_util;
DataIO *_dataIO;
Game *_game;
- Snd *_snd;
+ Sound *_sound;
Video *_video;
Draw *_draw;
- CDROM *_cdrom;
Goblin *_goblin;
Init *_init;
Map *_map;
@@ -217,24 +214,20 @@
Scenery *_scenery;
Inter *_inter;
SaveLoad *_saveLoad;
- Adlib *_adlib;
VideoPlayer *_vidPlayer;
void shutdown();
- const char *getLangDesc(int16 language) {
- if ((language < 0) || (language > 8))
- language = 2;
- return Common::getLanguageDescription(_gobToScummVMLang[language]);
- }
+ const char *getLangDesc(int16 language) const;
void validateLanguage();
void validateVideoMode(int16 videoMode);
- GameType getGameType() { return _gameType; }
- bool isCD() { return (_features & kFeaturesCD) != 0; }
- bool isEGA() { return (_features & kFeaturesEGA) != 0; }
- bool is640() { return (_features & kFeatures640) != 0; }
- bool hasAdlib() { return (_features & kFeaturesAdlib) != 0; }
+ Common::Platform getPlatform() const;
+ GameType getGameType() const;
+ bool isCD() const;
+ bool isEGA() const;
+ bool is640() const;
+ bool hasAdlib() const;
GobEngine(OSystem *syst);
virtual ~GobEngine();
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/goblin.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/goblin.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/goblin.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -32,7 +32,7 @@
#include "gob/map.h"
#include "gob/mult.h"
#include "gob/scenery.h"
-#include "gob/sound.h"
+#include "gob/sound/sound.h"
namespace Gob {
@@ -164,7 +164,7 @@
for (col = 0; col < 6; col++)
if (_goblins[i]->realStateMach[state][col])
delete _goblins[i]->realStateMach[state][col];
- delete []_goblins[i]->realStateMach;
+ delete[] _goblins[i]->realStateMach;
}
delete _goblins[i];
}
@@ -176,7 +176,7 @@
for (col = 0; col < 6; col++)
if (_objects[i]->realStateMach[state][col])
delete _objects[i]->realStateMach[state][col];
- delete []_objects[i]->realStateMach;
+ delete[] _objects[i]->realStateMach;
}
delete _objects[i];
}
@@ -255,8 +255,8 @@
void Goblin::playSound(SoundDesc &snd, int16 repCount, int16 freq) {
if (!snd.empty()) {
- _vm->_snd->stopSound(0);
- _vm->_snd->playSample(snd, repCount, freq);
+ _vm->_sound->blasterStop(0);
+ _vm->_sound->blasterPlay(&snd, repCount, freq);
}
}
@@ -1216,7 +1216,7 @@
_objects[i] = 0;
for (int i = 0; i < 16; i++)
- _vm->_snd->freeSample(_soundData[i]);
+ _vm->_sound->sampleFree(&_soundData[i]);
}
void Goblin::freeAllObjects(void) {
@@ -1717,12 +1717,12 @@
if (!speaker) {
sndSlot = obj->goblinStates[animData->state][i].sndItem;
- _vm->_snd->stopSound(0);
+ _vm->_sound->blasterStop(0);
if (sndSlot < _soundSlotsCount)
- _vm->_snd->playSample(_vm->_game->_soundSamples[_soundSlots[sndSlot] & 0x7FFF],
+ _vm->_sound->blasterPlay(_vm->_sound->sampleGetBySlot(_soundSlots[sndSlot] & 0x7FFF),
repCount, frequency);
} else
- _vm->_snd->speakerOn(frequency, repCount * 10);
+ _vm->_sound->speakerOn(frequency, repCount * 10);
}
}
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/goblin.h
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/goblin.h 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/goblin.h 2008-05-10 18:51:25 UTC (rev 31982)
@@ -27,8 +27,8 @@
#define GOB_GOBLIN_H
#include "gob/util.h"
-#include "gob/sound.h"
#include "gob/mult.h"
+#include "gob/sound/sounddesc.h"
namespace Gob {
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/goblin_v1.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/goblin_v1.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/goblin_v1.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "gob/gob.h"
@@ -32,7 +31,7 @@
#include "gob/map.h"
#include "gob/mult.h"
#include "gob/scenery.h"
-#include "gob/sound.h"
+#include "gob/sound/sound.h"
namespace Gob {
@@ -48,7 +47,7 @@
int16 col;
for (int i = 0; i < 16; i++)
- _vm->_snd->freeSample(_soundData[i]);
+ _vm->_sound->sampleFree(&_soundData[i]);
for (int i = 0; i < 4; i++) {
if (_goblins[i] == 0)
@@ -488,19 +487,19 @@
if ((gobDesc->state >= 0) && (gobDesc->state < 10) &&
(gobDesc->stateMach == gobDesc->realStateMach) &&
((gobDesc->curFrame == 3) || (gobDesc->curFrame == 6))) {
- _vm->_snd->speakerOn(10 * _vm->_util->getRandom(3) + 50, 5);
+ _vm->_sound->speakerOn(10 * _vm->_util->getRandom(3) + 50, 5);
}
if ((_currentGoblin == 0) &&
(gobDesc->stateMach == gobDesc->realStateMach) &&
((gobDesc->state == 10) || (gobDesc->state == 11)) &&
(gobDesc->curFrame == 9)) {
- _vm->_snd->stopSound(0);
+ _vm->_sound->blasterStop(0);
if (_itemIndInPocket != -1)
- _vm->_snd->playSample(_soundData[14], 1, 9000);
+ _vm->_sound->blasterPlay(&_soundData[14], 1, 9000);
else
- _vm->_snd->playSample(_soundData[14], 1, 5000);
+ _vm->_sound->blasterPlay(&_soundData[14], 1, 5000);
}
if (_boreCounter++ == 120) {
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/goblin_v2.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/goblin_v2.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/goblin_v2.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "gob/gob.h"
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/init.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/init.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/init.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "gob/gob.h"
@@ -31,13 +30,12 @@
#include "gob/global.h"
#include "gob/util.h"
#include "gob/dataio.h"
-#include "gob/cdrom.h"
#include "gob/draw.h"
#include "gob/game.h"
#include "gob/palanim.h"
-#include "gob/sound.h"
#include "gob/video.h"
#include "gob/videoplayer.h"
+#include "gob/sound/sound.h"
namespace Gob {
@@ -51,8 +49,8 @@
_vm->_video->freeDriver();
_vm->_global->_primarySurfDesc = 0;
- _vm->_snd->speakerOff();
- _vm->_snd->stopSound(0);
+ _vm->_sound->speakerOff();
+ _vm->_sound->blasterStop(0);
_vm->_dataIO->closeDataFile();
}
@@ -169,8 +167,8 @@
strcpy(_vm->_game->_curTotFile, buffer);
- _vm->_cdrom->testCD(1, "GOB");
- _vm->_cdrom->readLIC("gob.lic");
+ _vm->_sound->cdTest(1, "GOB");
+ _vm->_sound->cdLoadLIC("gob.lic");
// Search for a Coktel logo animation or image to display
imdHandle = _vm->_dataIO->openData("coktel.imd");
@@ -213,8 +211,8 @@
_vm->_game->start();
- _vm->_cdrom->stopPlaying();
- _vm->_cdrom->freeLICbuffer();
+ _vm->_sound->cdStop();
+ _vm->_sound->cdUnloadLIC();
delete[] _vm->_global->_inter_variables;
delete[] _vm->_global->_inter_variablesSizes;
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/init_v1.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/init_v1.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/init_v1.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "gob/gob.h"
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/init_v2.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/init_v2.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/init_v2.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "gob/gob.h"
@@ -50,8 +49,8 @@
_vm->_global->_inVM = 0;
_vm->_global->_colorCount = 16;
- if (((_vm->_platform == Common::kPlatformPC) ||
- (_vm->_platform == Common::kPlatformMacintosh)) &&
+ if (((_vm->getPlatform() == Common::kPlatformPC) ||
+ (_vm->getPlatform() == Common::kPlatformMacintosh)) &&
((_vm->_global->_videoMode == 0x13) ||
(_vm->_global->_videoMode == 0x14)))
_vm->_global->_colorCount = 256;
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/inter.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/inter.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/inter.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "gob/gob.h"
@@ -34,7 +33,7 @@
#include "gob/game.h"
#include "gob/parse.h"
#include "gob/scenery.h"
-#include "gob/sound.h"
+#include "gob/sound/sound.h"
#include <time.h> // FIXME: for Inter::renewTimeInVars()
@@ -154,7 +153,7 @@
WRITE_VAR(12, _vm->_util->getTimeKey() - _vm->_game->_startTimeKey);
storeMouse();
- WRITE_VAR(1, _vm->_snd->_playingSound);
+ WRITE_VAR(1, _vm->_sound->blasterPlayingSound());
if (key == 0x4800)
key = 0x0B;
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/inter_bargon.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/inter_bargon.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/inter_bargon.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "gob/gob.h"
@@ -34,9 +33,9 @@
#include "gob/draw.h"
#include "gob/game.h"
#include "gob/palanim.h"
-#include "gob/sound.h"
#include "gob/video.h"
#include "gob/videoplayer.h"
+#include "gob/sound/sound.h"
namespace Gob {
@@ -768,9 +767,9 @@
return;
for (i = 0; i < 4; i++)
- _vm->_snd->loadSample(samples[i], sndFiles[i]);
- _vm->_snd->playComposition(comp, 0, samples, 4);
- _vm->_snd->waitEndPlay(true, false);
+ _vm->_sound->sampleLoad(&samples[i], sndFiles[i]);
+ _vm->_sound->blasterPlayComposition(comp, 0, samples, 4);
+ _vm->_sound->blasterWaitEndPlay(true, false);
_vm->_palAnim->fade(0, 0, 0);
_vm->_video->clearSurf(_vm->_draw->_frontSurface);
}
@@ -787,12 +786,12 @@
static const char *palFiles[] = {"2ou2.clt", "2ou3.clt", "2ou4.clt", "2ou5.clt"};
for (int i = 0; i < 2; i++)
- _vm->_snd->loadSample(samples[i], sndFiles[i]);
+ _vm->_sound->sampleLoad(&samples[i], sndFiles[i]);
for (int i = 0; i < 4; i++)
palettes[i] = _vm->_dataIO->getData(palFiles[i]);
palBak = _vm->_global->_pPaletteDesc->vgaPal;
- _vm->_snd->playComposition(comp, 0, samples, 2);
+ _vm->_sound->blasterPlayComposition(comp, 0, samples, 2);
for (int i = 0; i < 20; i++) {
for (int j = 0; j < 4; j++) {
_vm->_global->_pPaletteDesc->vgaPal = (Video::Color *) palettes[j];
@@ -801,7 +800,7 @@
}
if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == 0x11B) ||
_vm->_quitRequested) {
- _vm->_snd->stopSound(10);
+ _vm->_sound->blasterStop(10);
_vm->_palAnim->fade(0, -2, 0);
_vm->_video->clearSurf(_vm->_draw->_frontSurface);
memset((char *) _vm->_draw->_vgaPalette, 0, 768);
@@ -811,7 +810,7 @@
break;
}
}
- _vm->_snd->waitEndPlay(false, false);
+ _vm->_sound->blasterWaitEndPlay(false, false);
_vm->_global->_pPaletteDesc->vgaPal = palBak;
for (int i = 0; i < 4; i++)
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/inter_v1.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/inter_v1.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/inter_v1.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "common/file.h"
@@ -32,8 +31,6 @@
#include "gob/global.h"
#include "gob/util.h"
#include "gob/dataio.h"
-#include "gob/music.h"
-#include "gob/cdrom.h"
#include "gob/draw.h"
#include "gob/game.h"
#include "gob/goblin.h"
@@ -43,8 +40,8 @@
#include "gob/palanim.h"
#include "gob/parse.h"
#include "gob/scenery.h"
-#include "gob/sound.h"
#include "gob/video.h"
+#include "gob/sound/sound.h"
namespace Gob {
@@ -1071,12 +1068,8 @@
void Inter_v1::o1_playCDTrack() {
evalExpr(0);
- if (_vm->_platform == Common::kPlatformMacintosh) {
- if (_vm->_adlib)
- _vm->_adlib->playTrack(_vm->_global->_inter_resStr);
- } else
- // Used in gob1 CD
- _vm->_cdrom->startTrack(_vm->_global->_inter_resStr);
+ _vm->_sound->adlibPlayBgMusic(); // Mac version
+ _vm->_sound->cdPlay(_vm->_global->_inter_resStr); // PC CD version
}
void Inter_v1::o1_getCDTrackPos() {
@@ -1088,19 +1081,15 @@
_vm->_util->longDelay(1);
- int pos = _vm->_cdrom->getTrackPos();
+ int pos = _vm->_sound->cdGetTrackPos();
if (pos == -1)
pos = 32767;
WRITE_VAR(5, pos);
}
void Inter_v1::o1_stopCD() {
- if (_vm->_platform == Common::kPlatformMacintosh) {
- if (_vm->_adlib)
- _vm->_adlib->stopPlay();
- } else
- // Used in gob1 CD
- _vm->_cdrom->stopPlaying();
+ _vm->_sound->adlibStop(); // Mac version
+ _vm->_sound->cdStop(); // PC CD version
}
void Inter_v1::o1_loadFontToSprite() {
@@ -1685,7 +1674,7 @@
break;
default:
- _vm->_snd->speakerOnUpdate(cmd);
+ _vm->_sound->speakerOnUpdate(cmd);
if (cmd < 20) {
_vm->_util->delay(cmd);
_noBusyWait = true;
@@ -1759,12 +1748,12 @@
}
bool Inter_v1::o1_speakerOn(OpFuncParams ¶ms) {
- _vm->_snd->speakerOn(_vm->_parse->parseValExpr(), -1);
+ _vm->_sound->speakerOn(_vm->_parse->parseValExpr(), -1);
return false;
}
bool Inter_v1::o1_speakerOff(OpFuncParams ¶ms) {
- _vm->_snd->speakerOff();
+ _vm->_sound->speakerOff();
return false;
}
@@ -1978,10 +1967,10 @@
repCount = _vm->_parse->parseValExpr();
frequency = _vm->_parse->parseValExpr();
- SoundDesc &sample = _vm->_game->_soundSamples[index];
+ SoundDesc *sample = _vm->_sound->sampleGetBySlot(index);
_soundEndTimeKey = 0;
- if (sample.empty())
+ if (!sample || sample->empty())
return false;
if (repCount < 0) {
@@ -1991,31 +1980,28 @@
repCount = -repCount;
_soundEndTimeKey = _vm->_util->getTimeKey();
- freq2 = frequency ? frequency : sample._frequency;
+ freq2 = frequency ? frequency : sample->_frequency;
endRep = MAX(repCount - 1, 1);
- _soundStopVal = sample.calcFadeOutLength(freq2);
- _soundEndTimeKey += sample.calcLength(endRep, freq2, true);
+ _soundStopVal = sample->calcFadeOutLength(freq2);
+ _soundEndTimeKey += sample->calcLength(endRep, freq2, true);
}
- if (sample.getType() == SOUND_ADL) {
- if (_vm->_adlib) {
- _vm->_adlib->load(sample.getData(), sample.size(), index);
- _vm->_adlib->setRepeating(repCount - 1);
- _vm->_adlib->startPlay();
- }
+ if (sample->getType() == SOUND_ADL) {
+ _vm->_sound->adlibLoad(sample->getData(), sample->size(), index);
+ _vm->_sound->adlibSetRepeating(repCount - 1);
+ _vm->_sound->adlibPlay();
} else {
- _vm->_snd->stopSound(0);
- _vm->_snd->playSample(sample, repCount - 1, frequency);
+ _vm->_sound->blasterStop(0);
+ _vm->_sound->blasterPlay(sample, repCount - 1, frequency);
}
return false;
}
bool Inter_v1::o1_stopSound(OpFuncParams ¶ms) {
- if (_vm->_adlib)
- _vm->_adlib->stopPlay();
- _vm->_snd->stopSound(_vm->_parse->parseValExpr());
+ _vm->_sound->adlibStop();
+ _vm->_sound->blasterStop(_vm->_parse->parseValExpr());
_soundEndTimeKey = 0;
return false;
@@ -2032,7 +2018,7 @@
}
bool Inter_v1::o1_waitEndPlay(OpFuncParams ¶ms) {
- _vm->_snd->waitEndPlay();
+ _vm->_sound->blasterWaitEndPlay();
return false;
}
@@ -2046,7 +2032,7 @@
for (int i = 0; i < 50; i++)
composition[i] = (int16) VAR_OFFSET(dataVar + i * 4);
- _vm->_snd->playComposition(composition, freqVal);
+ _vm->_sound->blasterPlayComposition(composition, freqVal);
return false;
}
@@ -2803,11 +2789,9 @@
void Inter_v1::o1_drawObjects(OpGobParams ¶ms) {
_vm->_goblin->drawObjects();
- if (_vm->_platform == Common::kPlatformMacintosh) {
- if (_vm->_adlib)
- _vm->_adlib->playBgMusic();
- } else if (_vm->_cdrom->getTrackPos() == -1)
- _vm->_cdrom->playBgMusic();
+ _vm->_sound->adlibPlayBgMusic(); // Mac version
+ if (_vm->_sound->cdGetTrackPos() == -1)
+ _vm->_sound->cdPlayBgMusic(); // PC CD version
}
void Inter_v1::o1_loadMap(OpGobParams ¶ms) {
@@ -2993,9 +2977,11 @@
dataSize = (uint32) ((int32) totSize);
}
- if (dataPtr)
- _vm->_game->_soundSamples[slot].load(SOUND_SND, source,
- dataPtr, dataSize);
+ if (dataPtr) {
+ SoundDesc *sample = _vm->_sound->sampleGetBySlot(slot);
+ if (sample)
+ sample->load(SOUND_SND, source, dataPtr, dataSize);
+ }
return 0;
}
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/inter_v2.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/inter_v2.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/inter_v2.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "sound/mixer.h"
#include "sound/mods/infogrames.h"
@@ -33,8 +32,6 @@
#include "gob/global.h"
#include "gob/util.h"
#include "gob/dataio.h"
-#include "gob/music.h"
-#include "gob/cdrom.h"
#include "gob/draw.h"
#include "gob/game.h"
#include "gob/goblin.h"
@@ -42,10 +39,10 @@
#include "gob/mult.h"
#include "gob/parse.h"
#include "gob/scenery.h"
-#include "gob/sound.h"
#include "gob/video.h"
#include "gob/saveload.h"
#include "gob/videoplayer.h"
+#include "gob/sound/sound.h"
namespace Gob {
@@ -899,7 +896,7 @@
if (_terminate)
return;
- _vm->_mult->_orderArray = new uint8[_vm->_mult->_objCount];
+ _vm->_mult->_orderArray = new int8[_vm->_mult->_objCount];
memset(_vm->_mult->_orderArray, 0, _vm->_mult->_objCount * sizeof(int8));
_vm->_mult->_objects = new Mult::Mult_Object[_vm->_mult->_objCount];
memset(_vm->_mult->_objects, 0,
@@ -1086,16 +1083,16 @@
_vm->_draw->blitInvalidated();
evalExpr(0);
- _vm->_cdrom->startTrack(_vm->_global->_inter_resStr);
+ _vm->_sound->cdPlay(_vm->_global->_inter_resStr);
}
void Inter_v2::o2_waitCDTrackEnd() {
- while (_vm->_cdrom->getTrackPos() >= 0)
+ while (_vm->_sound->cdGetTrackPos() >= 0)
_vm->_util->longDelay(1);
}
void Inter_v2::o2_stopCD() {
- _vm->_cdrom->stopPlaying();
+ _vm->_sound->cdStop();
}
void Inter_v2::o2_readLIC() {
@@ -1105,11 +1102,11 @@
strncpy0(path, _vm->_global->_inter_resStr, 35);
strcat(path, ".LIC");
- _vm->_cdrom->readLIC(path);
+ _vm->_sound->cdLoadLIC(path);
}
void Inter_v2::o2_freeLIC() {
- _vm->_cdrom->freeLICbuffer();
+ _vm->_sound->cdUnloadLIC();
}
void Inter_v2::o2_getCDTrackPos() {
@@ -1121,8 +1118,8 @@
varPos = _vm->_parse->parseVarIndex();
varName = _vm->_parse->parseVarIndex();
- WRITE_VAR_OFFSET(varPos, _vm->_cdrom->getTrackPos(GET_VARO_STR(varName)));
- WRITE_VARO_STR(varName, _vm->_cdrom->getCurTrack());
+ WRITE_VAR_OFFSET(varPos, _vm->_sound->cdGetTrackPos(GET_VARO_STR(varName)));
+ WRITE_VARO_STR(varName, _vm->_sound->cdGetCurrentTrack());
}
void Inter_v2::o2_loadFontToSprite() {
@@ -1883,10 +1880,9 @@
expr = _vm->_parse->parseValExpr();
if (expr < 0) {
- if (_vm->_adlib)
- _vm->_adlib->stopPlay();
+ _vm->_sound->adlibStop();
} else
- _vm->_snd->stopSound(expr);
+ _vm->_sound->blasterStop(expr);
_soundEndTimeKey = 0;
return false;
@@ -2009,7 +2005,7 @@
WRITE_VAR(59, stream->readUint32LE());
// The scripts in some versions divide through 256^3 then,
// effectively doing a LE->BE conversion
- if ((_vm->_platform != Common::kPlatformPC) && (VAR(59) < 256))
+ if ((_vm->getPlatform() != Common::kPlatformPC) && (VAR(59) < 256))
WRITE_VAR(59, SWAP_BYTES_32(VAR(59)));
} else
retSize = stream->read(buf, size);
@@ -2054,29 +2050,11 @@
varName = load16();
- if (_vm->_noMusic)
- return;
-
strncpy0(fileName, GET_VAR_STR(varName), 15);
strcat(fileName, ".INS");
- debugC(1, kDebugMusic, "Loading Infogrames instrument file \"%s\"",
- fileName);
+ debugC(1, kDebugMusic, "Loading Infogrames instrument file \"%s\"", fileName);
- if (_vm->_game->_infogrames) {
- _vm->_mixer->stopHandle(_vm->_game->_infHandle);
- delete _vm->_game->_infogrames;
- _vm->_game->_infogrames = 0;
- }
-
- if (_vm->_game->_infIns)
- delete _vm->_game->_infIns;
-
- _vm->_game->_infIns = new Audio::Infogrames::Instruments;
- if (!_vm->_game->_infIns->load(fileName)) {
- warning("Couldn't load instruments file");
- delete _vm->_game->_infIns;
- _vm->_game->_infIns = 0;
- }
+ _vm->_sound->infogramesLoadInstruments(fileName);
}
void Inter_v2::o2_playInfogrames(OpGobParams ¶ms) {
@@ -2085,58 +2063,24 @@
varName = load16();
- if (_vm->_noMusic)
- return;
-
strncpy0(fileName, GET_VAR_STR(varName), 15);
strcat(fileName, ".DUM");
debugC(1, kDebugMusic, "Playing Infogrames music file \"%s\"", fileName);
- if (!_vm->_game->_infIns) {
- _vm->_game->_infIns = new Audio::Infogrames::Instruments;
-
- if (!_vm->_game->_infIns->load("i1.ins")) {
- warning("Couldn't load instruments file");
- delete _vm->_game->_infIns;
- _vm->_game->_infIns = 0;
- }
- }
-
- if (_vm->_game->_infIns) {
- _vm->_mixer->stopHandle(_vm->_game->_infHandle);
- delete _vm->_game->_infogrames;
- _vm->_game->_infogrames =
- new Audio::Infogrames(*_vm->_game->_infIns, true,
- _vm->_mixer->getOutputRate(),
- _vm->_mixer->getOutputRate() / 75);
-
- if (!_vm->_game->_infogrames->load(fileName)) {
- warning("Couldn't load infogrames music");
- delete _vm->_game->_infogrames;
- _vm->_game->_infogrames = 0;
- } else
- _vm->_mixer->playInputStream(Audio::Mixer::kMusicSoundType,
- &_vm->_game->_infHandle, _vm->_game->_infogrames,
- -1, 255, 0, false);
- }
+ _vm->_sound->infogramesLoadSong(fileName);
+ _vm->_sound->infogramesPlay();
}
void Inter_v2::o2_startInfogrames(OpGobParams ¶ms) {
load16();
- if (_vm->_game->_infogrames &&
- !_vm->_mixer->isSoundHandleActive(_vm->_game->_infHandle)) {
- _vm->_game->_infogrames->restart();
- _vm->_mixer->playInputStream(Audio::Mixer::kMusicSoundType,
- &_vm->_game->_infHandle, _vm->_game->_infogrames,
- -1, 255, 0, false);
- }
+ _vm->_sound->infogramesPlay();
}
void Inter_v2::o2_stopInfogrames(OpGobParams ¶ms) {
load16();
- _vm->_mixer->stopHandle(_vm->_game->_infHandle);
+ _vm->_sound->infogramesStop();
}
void Inter_v2::o2_handleGoblins(OpGobParams ¶ms) {
@@ -2172,15 +2116,15 @@
} else {
id = load16();
- for (slot = 0; slot < 60; slot++)
- if (_vm->_game->_soundSamples[slot].isId(id)) {
+ for (slot = 0; slot < Sound::kSoundsCount; slot++)
+ if (_vm->_sound->sampleGetBySlot(slot)->isId(id)) {
slotIdMask = 0x8000;
break;
}
- if (slot == 60) {
- for (slot = 59; slot >= 0; slot--) {
- if (_vm->_game->_soundSamples[slot].empty())
+ if (slot == Sound::kSoundsCount) {
+ for (slot = (Sound::kSoundsCount - 1); slot >= 0; slot--) {
+ if (_vm->_sound->sampleGetBySlot(slot)->empty())
break;
}
@@ -2192,8 +2136,10 @@
}
}
- _vm->_game->freeSoundSlot(slot);
+ SoundDesc *sample = _vm->_sound->sampleGetBySlot(slot);
+ _vm->_sound->sampleFree(sample, true, slot);
+
if (id == -1) {
char sndfile[14];
@@ -2224,8 +2170,8 @@
}
if (dataPtr) {
- _vm->_game->_soundSamples[slot].load(type, source, dataPtr, dataSize);
- _vm->_game->_soundSamples[slot]._id = id;
+ sample->load(type, source, dataPtr, dataSize);
+ sample->_id = id;
}
return slot | slotIdMask;
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/inter_v4.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/inter_v4.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/inter_v4.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -32,6 +32,7 @@
#include "gob/game.h"
#include "gob/parse.h"
#include "gob/videoplayer.h"
+#include "gob/sound/sound.h"
namespace Gob {
@@ -640,8 +641,9 @@
}
void Inter_v4::executeDrawOpcode(byte i) {
- debugC(1, kDebugDrawOp, "opcodeDraw %d [0x%X] (%s)",
- i, i, getOpcodeDrawDesc(i));
+ debugC(1, kDebugDrawOp, "opcodeDraw %d [0x%X] (%s) - %s, %d",
+ i, i, getOpcodeDrawDesc(i),
+ _vm->_game->_curTotFile, uint(_vm->_global->_inter_execPtr - _vm->_game->_totFileData));
OpcodeDrawProcV4 op = _opcodesDrawV4[i].proc;
@@ -652,8 +654,9 @@
}
bool Inter_v4::executeFuncOpcode(byte i, byte j, OpFuncParams ¶ms) {
- debugC(1, kDebugFuncOp, "opcodeFunc %d.%d [0x%X.0x%X] (%s)",
- i, j, i, j, getOpcodeFuncDesc(i, j));
+ debugC(1, kDebugFuncOp, "opcodeFunc %d.%d [0x%X.0x%X] (%s) - %s, %d",
+ i, j, i, j, getOpcodeFuncDesc(i, j),
+ _vm->_game->_curTotFile, uint(_vm->_global->_inter_execPtr - _vm->_game->_totFileData));
if ((i > 4) || (j > 15)) {
warning("unimplemented opcodeFunc: %d.%d", i, j);
@@ -671,8 +674,9 @@
}
void Inter_v4::executeGoblinOpcode(int i, OpGobParams ¶ms) {
- debugC(1, kDebugGobOp, "opcodeGoblin %d [0x%X] (%s)",
- i, i, getOpcodeGoblinDesc(i));
+ debugC(1, kDebugGobOp, "opcodeGoblin %d [0x%X] (%s) - %s, %d",
+ i, i, getOpcodeGoblinDesc(i),
+ _vm->_game->_curTotFile, uint(_vm->_global->_inter_execPtr - _vm->_game->_totFileData));
OpcodeGoblinProcV4 op = NULL;
@@ -739,7 +743,7 @@
if (lastFrame == -1) {
close = true;
} else if (lastFrame == -3) {
- warning("Woodruff Stub: Video/Music command -3: Play background video %s, %d, %d, %d, %d", fileName, startFrame, x, y, VAR_OFFSET(7872));
+// warning("Woodruff Stub: Video/Music command -3: Play background video %s, %d, %d, %d, %d", fileName, startFrame, x, y, VAR_OFFSET(7872));
_vm->_mult->_objects[startFrame].pAnimData->animation = -startFrame - 1;
@@ -763,16 +767,20 @@
warning("Woodruff Stub: Video/Music command -4: Play background video %s", fileName);
return;
} else if (lastFrame == -5) {
- warning("Woodruff Stub: Video/Music command -5: Stop background music");
+// warning("Woodruff Stub: Video/Music command -5: Stop background music");
+ _vm->_sound->bgStop();
return;
} else if (lastFrame == -6) {
- warning("Woodruff Stub: Video/Music command -6: Load background video %s", fileName);
+// warning("Woodruff Stub: Video/Music command -6: Load background video %s", fileName);
return;
} else if (lastFrame == -8) {
warning("Woodruff Stub: Video/Music command -8: Play background video %s", fileName);
return;
} else if (lastFrame == -9) {
- warning("Woodruff Stub: Video/Music command -9: Play background music %s (%d-%d)", fileName, palEnd, palStart);
+// warning("Woodruff Stub: Video/Music command -9: Play background music %s (%d-%d)", fileName, palEnd, palStart);
+ _vm->_sound->bgStop();
+ _vm->_sound->bgSetPlayMode(BackgroundAtmosphere::kPlayModeRandom);
+ _vm->_sound->bgPlay(fileName, palStart);
return;
} else if (lastFrame < 0) {
warning("Unknown Video/Music command: %d, %s", lastFrame, fileName);
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/map.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/map.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/map.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,8 +23,6 @@
*
*/
-
-
#include "gob/gob.h"
#include "gob/map.h"
#include "gob/goblin.h"
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/map_v1.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/map_v1.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/map_v1.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,15 +23,14 @@
*
*/
-
#include "common/stream.h"
#include "gob/gob.h"
#include "gob/map.h"
#include "gob/dataio.h"
#include "gob/goblin.h"
-#include "gob/sound.h"
#include "gob/mult.h"
+#include "gob/sound/sound.h"
namespace Gob {
@@ -160,7 +159,7 @@
strcpy(sndNames[i], buf);
}
- _vm->_snd->loadSample(_vm->_goblin->_soundData[14], "diamant1.snd");
+ _vm->_sound->sampleLoad(&_vm->_goblin->_soundData[14], "diamant1.snd");
for (int i = 0; i < count; i++) {
handle = _vm->_dataIO->openData(sndNames[i]);
@@ -168,7 +167,7 @@
continue;
_vm->_dataIO->closeData(handle);
- _vm->_snd->loadSample(_vm->_goblin->_soundData[i], sndNames[i]);
+ _vm->_sound->sampleLoad(&_vm->_goblin->_soundData[i], sndNames[i]);
}
}
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/map_v2.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/map_v2.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/map_v2.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/stream.h"
#include "gob/gob.h"
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/module.mk
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/module.mk 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/module.mk 2008-05-10 18:51:25 UTC (rev 31982)
@@ -1,7 +1,6 @@
MODULE := engines/gob
MODULE_OBJS := \
- cdrom.o \
dataio.o \
detection.o \
draw.o \
@@ -38,7 +37,6 @@
mult.o \
mult_v1.o \
mult_v2.o \
- music.o \
palanim.o \
parse.o \
parse_v1.o \
@@ -49,11 +47,19 @@
scenery.o \
scenery_v1.o \
scenery_v2.o \
- sound.o \
util.o \
video.o \
video_v1.o \
- video_v2.o
+ video_v2.o \
+ sound/sound.o \
+ sound/sounddesc.o \
+ sound/pcspeaker.o \
+ sound/adlib.o \
+ sound/infogrames.o \
+ sound/soundmixer.o \
+ sound/soundblaster.o \
+ sound/cdrom.o \
+ sound/bgatmosphere.o
# This module can be built as a plugin
ifeq ($(ENABLE_GOB), DYNAMIC_PLUGIN)
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/mult.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/mult.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/mult.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "gob/gob.h"
@@ -34,9 +33,9 @@
#include "gob/game.h"
#include "gob/palanim.h"
#include "gob/scenery.h"
-#include "gob/sound.h"
#include "gob/video.h"
#include "gob/videoplayer.h"
+#include "gob/sound/sound.h"
namespace Gob {
@@ -188,7 +187,7 @@
if (_frame >= endFrame)
stopNoClear = true;
- if (_vm->_snd->_playingSound)
+ if (_vm->_sound->blasterPlayingSound())
stop = false;
_vm->_util->processInput();
@@ -225,8 +224,8 @@
_animDataAllocated = false;
}
- if (_vm->_snd->_playingSound)
- _vm->_snd->stopSound(10);
+ if (_vm->_sound->blasterPlayingSound())
+ _vm->_sound->blasterStop(10);
WRITE_VAR(57, (uint32) -1);
} else
@@ -415,21 +414,24 @@
if (sndKey->cmd != -1) {
if ((sndKey->cmd == 1) || (sndKey->cmd == 4)) {
- SoundDesc &sample = _vm->_game->_soundSamples[sndKey->soundIndex];
+ SoundDesc *sample = _vm->_sound->sampleGetBySlot(sndKey->soundIndex);
- _vm->_snd->stopSound(0);
- if (!sample.empty())
- _vm->_snd->playSample(sample, sndKey->repCount,
+ _vm->_sound->blasterStop(0);
+ if (sample && !sample->empty())
+ _vm->_sound->blasterPlay(sample, sndKey->repCount,
sndKey->freq, sndKey->fadeLength);
}
} else {
- if (_vm->_snd->_playingSound)
- _vm->_snd->stopSound(sndKey->fadeLength);
+ if (_vm->_sound->blasterPlayingSound())
+ _vm->_sound->blasterStop(sndKey->fadeLength);
}
}
}
void Mult::clearObjectVideos() {
+ if (!_objects)
+ return;
+
for (int i = 0; i < _objCount; i++)
if (_objects[i].videoSlot > 0)
_vm->_vidPlayer->slotClose(_objects[i].videoSlot - 1);
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/mult.h
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/mult.h 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/mult.h 2008-05-10 18:51:25 UTC (rev 31982)
@@ -40,7 +40,7 @@
uint8 layer;
uint8 frame;
int8 animType;
- uint8 order;
+ int8 order;
int8 isPaused;
int8 isStatic;
int8 maxTick;
@@ -229,7 +229,7 @@
int16 *_renderData;
Mult_Object **_renderObjs;
- uint8 *_orderArray;
+ int8 *_orderArray;
SurfaceDesc::Ptr _animSurf;
int16 _animLeft;
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/mult_v1.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/mult_v1.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/mult_v1.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "common/stream.h"
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/mult_v2.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/mult_v2.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/mult_v2.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "common/stream.h"
@@ -526,14 +525,14 @@
delete[] _animArrayData;
_objects = new Mult_Object[_objCount];
- _orderArray = new uint8[_objCount];
+ _orderArray = new int8[_objCount];
_renderObjs = new Mult_Object*[_objCount];
_animArrayX = new int32[_objCount];
_animArrayY = new int32[_objCount];
_animArrayData = new Mult_AnimData[_objCount];
memset(_objects, 0, _objCount * sizeof(Mult_Object));
- memset(_orderArray, 0, _objCount * sizeof(uint8));
+ memset(_orderArray, 0, _objCount * sizeof(int8));
memset(_renderObjs, 0, _objCount * sizeof(Mult_Object *));
memset(_animArrayX, 0, _objCount * sizeof(int32));
memset(_animArrayY, 0, _objCount * sizeof(int32));
@@ -686,6 +685,11 @@
return;
animLayer = _vm->_scenery->getAnimLayer(nAnim, nLayer);
+ } else {
+ if (animObj.videoSlot > 0) {
+ _vm->_video->retrace();
+ _vm->_vidPlayer->slotWaitEndFrame(animObj.videoSlot - 1, true);
+ }
}
if (animData.animType == 4) {
@@ -768,9 +772,9 @@
}
void Mult_v2::animate() {
- uint8 minOrder = 100;
- uint8 maxOrder = 0;
- uint8 *orderArray;
+ int8 minOrder = 100;
+ int8 maxOrder = 0;
+ int8 *orderArray;
int orderArrayPos = 0;
int8 animIndices[150];
int numAnims = 0;
@@ -952,60 +956,58 @@
Mult_Object &animObj1 = *_renderObjs[orderArray[i]];
Mult_AnimData &animData1 = *(animObj1.pAnimData);
- if (!animObj1.needRedraw && !animData1.isStatic) {
- for (int j = 0; j < orderArrayPos; j++) {
- Mult_Object &animObj2 = *_renderObjs[orderArray[j]];
+ if (!animObj1.needRedraw) {
- if (!animObj2.needRedraw)
- continue;
+ if (!animData1.isStatic) {
+ for (int j = 0; j < orderArrayPos; j++) {
+ Mult_Object &animObj2 = *_renderObjs[orderArray[j]];
- if ((animObj1.newRight >= animObj2.newLeft) &&
- (animObj2.newRight >= animObj1.newLeft) &&
- (animObj1.newBottom >= animObj2.newTop) &&
- (animObj2.newBottom >= animObj1.newTop)) {
+ if (!animObj2.needRedraw)
+ continue;
- _vm->_scenery->_toRedrawLeft = animObj2.newLeft;
- _vm->_scenery->_toRedrawRight = animObj2.newRight;
- _vm->_scenery->_toRedrawTop = animObj2.newTop;
- _vm->_scenery->_toRedrawBottom = animObj2.newBottom;
+ if ((animObj1.newRight >= animObj2.newLeft) &&
+ (animObj2.newRight >= animObj1.newLeft) &&
+ (animObj1.newBottom >= animObj2.newTop) &&
+ (animObj2.newBottom >= animObj1.newTop)) {
- _vm->_scenery->updateAnim(animData1.layer, animData1.frame,
- animData1.animation, 12, *animObj1.pPosX, *animObj1.pPosY, 1);
- _vm->_scenery->updateStatic(animData1.order + 1);
+ _vm->_scenery->_toRedrawLeft = animObj2.newLeft;
+ _vm->_scenery->_toRedrawRight = animObj2.newRight;
+ _vm->_scenery->_toRedrawTop = animObj2.newTop;
+ _vm->_scenery->_toRedrawBottom = animObj2.newBottom;
+
+ _vm->_scenery->updateAnim(animData1.layer, animData1.frame,
+ animData1.animation, 12, *animObj1.pPosX, *animObj1.pPosY, 1);
+ _vm->_scenery->updateStatic(animData1.order + 1);
+ }
}
}
- } else if (!animData1.isStatic) {
- _vm->_scenery->updateAnim(animData1.layer, animData1.frame,
- animData1.animation, 10, *animObj1.pPosX, *animObj1.pPosY, 1);
- if (_vm->_scenery->_toRedrawLeft != -12345) {
- if (_vm->_global->_pressedKeys[0x36]) {
- _vm->_video->drawLine(_vm->_draw->_frontSurface,
- _vm->_scenery->_toRedrawLeft, _vm->_scenery->_toRedrawTop,
- _vm->_scenery->_toRedrawRight, _vm->_scenery->_toRedrawTop, 15);
- _vm->_video->drawLine(_vm->_draw->_frontSurface,
- _vm->_scenery->_toRedrawLeft, _vm->_scenery->_toRedrawBottom,
- _vm->_scenery->_toRedrawRight, _vm->_scenery->_toRedrawBottom, 15);
- _vm->_video->drawLine(_vm->_draw->_frontSurface,
- _vm->_scenery->_toRedrawLeft, _vm->_scenery->_toRedrawTop,
- _vm->_scenery->_toRedrawLeft, _vm->_scenery->_toRedrawBottom, 15);
- _vm->_video->drawLine(_vm->_draw->_frontSurface,
- _vm->_scenery->_toRedrawRight, _vm->_scenery->_toRedrawTop,
- _vm->_scenery->_toRedrawRight, _vm->_scenery->_toRedrawBottom, 15);
+ } else {
+
+ if (animData1.isStatic != 0) {
+ _vm->_scenery->_toRedrawLeft = animObj1.newLeft;
+ _vm->_scenery->_toRedrawRight = animObj1.newRight;
+ _vm->_scenery->_toRedrawTop = animObj1.newTop;
+ _vm->_scenery->_toRedrawBottom = animObj1.newBottom;
+ } else {
+ _vm->_scenery->updateAnim(animData1.layer, animData1.frame,
+ animData1.animation, 10, *animObj1.pPosX, *animObj1.pPosY, 1);
+
+ if (_vm->_scenery->_toRedrawLeft != -12345) {
+ animObj1.lastLeft = _vm->_scenery->_toRedrawLeft;
+ animObj1.lastRight = _vm->_scenery->_toRedrawRight;
+ animObj1.lastTop = _vm->_scenery->_toRedrawTop;
+ animObj1.lastBottom = _vm->_scenery->_toRedrawBottom;
+ } else {
+ animObj1.lastLeft = -1;
}
- animObj1.lastLeft = _vm->_scenery->_toRedrawLeft;
- animObj1.lastRight = _vm->_scenery->_toRedrawRight;
- animObj1.lastTop = _vm->_scenery->_toRedrawTop;
- animObj1.lastBottom = _vm->_scenery->_toRedrawBottom;
- } else
- animObj1.lastLeft = -1;
- } else {
- _vm->_scenery->_toRedrawLeft = animObj1.newLeft;
- _vm->_scenery->_toRedrawRight = animObj1.newRight;
- _vm->_scenery->_toRedrawTop = animObj1.newTop;
- _vm->_scenery->_toRedrawBottom = animObj1.newBottom;
+
+ }
+
+ _vm->_scenery->updateStatic(animData1.order + 1);
+
}
- _vm->_scenery->updateStatic(animData1.order + 1);
+
}
// Advance animations
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/parse.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/parse.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/parse.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "gob/gob.h"
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/parse_v1.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/parse_v1.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/parse_v1.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "gob/gob.h"
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/parse_v2.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/parse_v2.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/parse_v2.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "gob/gob.h"
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/scenery.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/scenery.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/scenery.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "common/stream.h"
@@ -155,9 +154,9 @@
ptr->layers[i].planes = new StaticPlane[ptr->layers[i].planeCount];
for (int j = 0; j < ptr->layers[i].planeCount; ++j) {
- ptr->layers[i].planes[j].pictIndex = layerData.readSByte();
- ptr->layers[i].planes[j].pieceIndex = layerData.readSByte();
- ptr->layers[i].planes[j].drawOrder = layerData.readSByte();
+ ptr->layers[i].planes[j].pictIndex = layerData.readByte();
+ ptr->layers[i].planes[j].pieceIndex = layerData.readByte();
+ ptr->layers[i].planes[j].drawOrder = layerData.readByte();
ptr->layers[i].planes[j].destX = layerData.readSint16LE();
ptr->layers[i].planes[j].destY = layerData.readSint16LE();
ptr->layers[i].planes[j].transp = layerData.readSByte();
@@ -278,7 +277,7 @@
}
planeCount = layerPtr->planeCount;
- for (order = 0; order < 40; order++) {
+ for (order = 0; order < 100; order++) {
for (plane = 0, planePtr = layerPtr->planes;
plane < planeCount; plane++, planePtr++) {
if (planePtr->drawOrder != order)
@@ -330,7 +329,7 @@
planeCount = layerPtr->planeCount;
- for (order = orderFrom; order < 40; order++) {
+ for (order = orderFrom; order < 100; order++) {
for (planePtr = layerPtr->planes, plane = 0;
plane < planeCount; plane++, planePtr++) {
if (planePtr->drawOrder != order)
@@ -338,6 +337,10 @@
pieceIndex = planePtr->pieceIndex;
pictIndex = planePtr->pictIndex - 1;
+
+ if ((pictIndex >= _staticPictCount[index]) || (!pictPtr[pictIndex]))
+ continue;
+
_vm->_draw->_destSpriteX = planePtr->destX;
_vm->_draw->_destSpriteY = planePtr->destY;
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/scenery.h
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/scenery.h 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/scenery.h 2008-05-10 18:51:25 UTC (rev 31982)
@@ -41,9 +41,9 @@
} PACKED_STRUCT;
struct StaticPlane {
- int8 pictIndex;
- int8 pieceIndex;
- int8 drawOrder;
+ uint8 pictIndex;
+ uint8 pieceIndex;
+ uint8 drawOrder;
int16 destX;
int16 destY;
int8 transp;
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/scenery_v1.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/scenery_v1.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/scenery_v1.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,13 +23,12 @@
*
*/
-
#include "common/endian.h"
#include "gob/gob.h"
#include "gob/scenery.h"
#include "gob/util.h"
-#include "gob/cdrom.h"
+#include "gob/sound/sound.h"
namespace Gob {
@@ -37,11 +36,11 @@
}
int16 Scenery_v1::loadAnim(char search) {
- if (_vm->_cdrom->_cdPlaying) {
- while (_vm->_cdrom->getTrackPos() != -1)
+ if (_vm->_sound->cdIsPlaying()) {
+ while (_vm->_sound->cdGetTrackPos() != -1)
_vm->_util->longDelay(50);
- _vm->_cdrom->_cdPlaying = false;
+ _vm->_sound->cdStop();
}
return Scenery::loadAnim(search);
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/scenery_v2.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/scenery_v2.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/scenery_v2.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "gob/gob.h"
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/util.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/util.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/util.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/events.h"
#include "gob/gob.h"
@@ -32,8 +31,8 @@
#include "gob/dataio.h"
#include "gob/draw.h"
#include "gob/game.h"
-#include "gob/sound.h"
#include "gob/video.h"
+#include "gob/sound/sound.h"
namespace Gob {
@@ -60,7 +59,7 @@
if (_vm->_global->_soundFlags == 0)
return;
- _vm->_snd->speakerOn(freq, 50);
+ _vm->_sound->speakerOn(freq, 50);
}
void Util::delay(uint16 msecs) {
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/video.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/video.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/video.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "graphics/cursorman.h"
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/video_v1.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/video_v1.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/video_v1.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "gob/gob.h"
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/video_v2.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/video_v2.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/video_v2.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -23,7 +23,6 @@
*
*/
-
#include "common/endian.h"
#include "gob/gob.h"
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/videoplayer.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/videoplayer.cpp 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/videoplayer.cpp 2008-05-10 18:51:25 UTC (rev 31982)
@@ -33,6 +33,7 @@
#include "gob/palanim.h"
#include "gob/inter.h"
#include "gob/map.h"
+#include "gob/sound/sound.h"
namespace Gob {
@@ -289,6 +290,8 @@
if (doPlay(startFrame, breakKey, palCmd, palStart, palEnd, palFrame, endFrame))
break;
+ evalBgShading(video);
+
if (fade) {
_vm->_palAnim->fade(_vm->_global->_pPaletteDesc, -2, 0);
fade = false;
@@ -299,18 +302,27 @@
startFrame++;
}
+ evalBgShading(video);
+
if (reverseTo >= 0) {
int16 toFrame = video.getFramesCount() - reverseTo;
for (int i = video.getCurrentFrame(); i >= toFrame; i--) {
video.seekFrame(i, SEEK_SET, true);
- if (doPlay(i, breakKey, 0, 0, 0, 0, 0)) {
+
+ bool b = doPlay(i, breakKey, 0, 0, 0, 0, 0);
+ evalBgShading(video);
+
+ if (b) {
_vm->_palAnim->fade(0, -2, 0);
memset((char *) _vm->_draw->_vgaPalette, 0, 768);
}
+
if (!_noCursorSwitch)
video.waitEndFrame();
}
}
+
+ evalBgShading(video);
}
void VideoPlayer::primaryClose() {
@@ -334,7 +346,7 @@
}
video->getVideo()->setVideoMemory();
- video->getVideo()->disableSound();
+ video->getVideo()->enableSound(*_vm->_mixer);
_videoSlots.push_back(video);
@@ -360,6 +372,8 @@
_videoSlots[slot]->nextFrame();
WRITE_VAR(11, frame);
+
+ evalBgShading(video);
}
void VideoPlayer::slotClose(int slot) {
@@ -388,6 +402,16 @@
copyPalette(*(_videoSlots[slot]->getVideo()), palStart, palEnd);
}
+void VideoPlayer::slotWaitEndFrame(int slot, bool onlySound) {
+ if ((slot < 0) || (((uint) slot) >= _videoSlots.size()))
+ return;
+
+ CoktelVideo &video = *(_videoSlots[slot]->getVideo());
+
+ if (!onlySound || (video.getFeatures() & CoktelVideo::kFeaturesSound))
+ video.waitEndFrame();
+}
+
bool VideoPlayer::slotIsOpen(int slot) const {
if ((slot >= 0) && (((uint) slot) < _videoSlots.size()))
return true;
@@ -588,4 +612,11 @@
}
}
+void VideoPlayer::evalBgShading(CoktelVideo &video) {
+ if (video.isSoundPlaying())
+ _vm->_sound->bgShade();
+ else
+ _vm->_sound->bgUnshade();
+}
+
} // End of namespace Gob
Modified: scummvm/branches/gsoc2008-tfmx/engines/gob/videoplayer.h
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/gob/videoplayer.h 2008-05-10 18:39:03 UTC (rev 31981)
+++ scummvm/branches/gsoc2008-tfmx/engines/gob/videoplayer.h 2008-05-10 18:51:25 UTC (rev 31982)
@@ -68,6 +68,7 @@
uint16 left, uint16 top, uint16 width, uint16 height,
uint16 x, uint16 y, uint16 pitch, int16 transp = -1);
void slotCopyPalette(int slot, int16 palStart = -1, int16 palEnd = -1);
+ void slotWaitEndFrame(int slot, bool onlySound = false);
bool slotIsOpen(int slot) const;
@@ -131,6 +132,7 @@
bool doPlay(int16 frame, int16 breakKey,
uint16 palCmd, int16 palStart, int16 palEnd,
int16 palFrame, int16 endFrame);
+ void evalBgShading(CoktelVideo &video);
};
} // End of namespace Gob
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list