aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorColin Snover2017-11-14 12:48:41 -0600
committerEugene Sandulenko2017-11-18 22:35:12 +0100
commitff96db23dfd9e2075a710786fa0b1a01c6759a02 (patch)
tree2014aef31b047f8a1f1dbfd117b05997cedb733f /engines
parent6f8a65c739740956930c95e1d5a5c5fe0c80fbbd (diff)
downloadscummvm-rg350-ff96db23dfd9e2075a710786fa0b1a01c6759a02.tar.gz
scummvm-rg350-ff96db23dfd9e2075a710786fa0b1a01c6759a02.tar.bz2
scummvm-rg350-ff96db23dfd9e2075a710786fa0b1a01c6759a02.zip
FULLPIPE: Fix leaks and unnecessary extra allocations in FullpipeEngine
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/fullpipe.cpp123
-rw-r--r--engines/fullpipe/fullpipe.h31
-rw-r--r--engines/fullpipe/gameloader.cpp9
-rw-r--r--engines/fullpipe/gameloader.h2
-rw-r--r--engines/fullpipe/gfx.cpp26
-rw-r--r--engines/fullpipe/scene.cpp2
-rw-r--r--engines/fullpipe/scenes/scene04.cpp6
-rw-r--r--engines/fullpipe/scenes/sceneFinal.cpp2
-rw-r--r--engines/fullpipe/sound.cpp30
-rw-r--r--engines/fullpipe/stateloader.cpp2
10 files changed, 96 insertions, 137 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index f359639df7..4e05f899c3 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -45,13 +45,18 @@
namespace Fullpipe {
-FullpipeEngine *g_fp = 0;
-Vars *g_vars = 0;
+FullpipeEngine *g_fp = nullptr;
+Vars *g_vars = nullptr;
FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) :
Engine(syst),
_gameDescription(gameDesc),
- _rnd("fullpipe") {
+ _console(this),
+ _rnd("fullpipe"),
+ _gameProject(nullptr),
+ _modalObject(nullptr),
+ _currSoundList1(),
+ _mapTable() {
DebugMan.addDebugChannel(kDebugPathfinding, "path", "Pathfinding");
DebugMan.addDebugChannel(kDebugDrawing, "drawing", "Drawing");
DebugMan.addDebugChannel(kDebugLoading, "loading", "Scene loading");
@@ -72,8 +77,6 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_sfxVolume = ConfMan.getInt("sfx_volume") * 39 - 10000;
_musicVolume = ConfMan.getInt("music_volume");
- _console = 0;
-
_gameProjectVersion = 0;
_pictureScale = 8;
_scrollSpeed = 0;
@@ -96,13 +99,10 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_currentCheat = -1;
_currentCheatPos = 0;
- _modalObject = 0;
- _origFormat = 0;
-
_liftEnterMQ = 0;
_liftExitMQ = 0;
_lift = 0;
- _lastLiftButton = 0;
+ _lastLiftButton = nullptr;
_liftX = 0;
_liftY = 0;
@@ -125,32 +125,23 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_musicLocal = 0;
_trackStartDelay = 0;
- _soundStream1 = new Audio::SoundHandle();
- _soundStream2 = new Audio::SoundHandle();
- _soundStream3 = new Audio::SoundHandle();
- _soundStream4 = new Audio::SoundHandle();
-
_stream2playing = false;
_numSceneTracks = 0;
_sceneTrackHasSequence = false;
_sceneTrackIsPlaying = false;
- _aniMan = 0;
- _aniMan2 = 0;
- _currentScene = 0;
- _loaderScene = 0;
- _scene2 = 0;
- _scene3 = 0;
- _movTable = 0;
- _floaters = 0;
- _aniHandler = 0;
-
- _globalMessageQueueList = 0;
- _messageHandlers = 0;
+ _aniMan = nullptr;
+ _aniMan2 = nullptr;
+ _currentScene = nullptr;
+ _loaderScene = nullptr;
+ _scene2 = nullptr;
+ _scene3 = nullptr;
+ _movTable = nullptr;
+ _messageHandlers = nullptr;
- _updateScreenCallback = 0;
- _updateCursorCallback = 0;
+ _updateScreenCallback = nullptr;
+ _updateCursorCallback = nullptr;
_msgX = 0;
_msgY = 0;
@@ -161,38 +152,27 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_currSelectedInventoryItemId = 0;
- _behaviorManager = 0;
-
_cursorId = 0;
_keyState = Common::KEYCODE_INVALID;
_buttonState = 0;
- _gameLoader = 0;
- _gameProject = 0;
-
_updateFlag = true;
_flgCanOpenMap = true;
_sceneWidth = 1;
_sceneHeight = 1;
- for (int i = 0; i < 11; i++)
- _currSoundList1[i] = 0;
-
- for (int i = 0; i < 200; i++)
- _mapTable[i] = 0;
-
- _inventoryScene = 0;
- _inventory = 0;
+ _inventoryScene = nullptr;
+ _inventory = nullptr;
_minCursorId = 0xffff;
_maxCursorId = 0;
_objectAtCursor = 0;
_objectIdAtCursor = 0;
- _arcadeOverlay = 0;
- _arcadeOverlayHelper = 0;
+ _arcadeOverlay = nullptr;
+ _arcadeOverlayHelper = nullptr;
_arcadeOverlayX = 0;
_arcadeOverlayY = 0;
_arcadeOverlayMidX = 0;
@@ -205,25 +185,9 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
}
FullpipeEngine::~FullpipeEngine() {
- delete _console;
- delete _globalMessageQueueList;
- delete _soundStream1;
- delete _soundStream2;
- delete _soundStream3;
- delete _soundStream4;
-}
-
-void FullpipeEngine::initialize() {
- _globalMessageQueueList = new GlobalMessageQueueList;
- _behaviorManager = new BehaviorManager;
-
- _sceneRect.left = 0;
- _sceneRect.top = 0;
- _sceneRect.right = 799;
- _sceneRect.bottom = 599;
-
- _floaters = new Floaters;
- _aniHandler = new AniHandler;
+ g_fp = nullptr;
+ delete g_vars;
+ g_vars = nullptr;
}
void FullpipeEngine::restartGame() {
@@ -236,13 +200,13 @@ void FullpipeEngine::restartGame() {
if (_scene2) {
_scene2->getAniMan();
- _scene2 = 0;
+ _scene2 = nullptr;
}
if (_currentScene) {
_gameLoader->unloadScene(_currentScene->_sceneId);
- _currentScene = 0;
+ _currentScene = nullptr;
}
_gameLoader->restoreDefPicAniInfos();
@@ -286,14 +250,19 @@ Common::Error FullpipeEngine::run() {
// Initialize backend
initGraphics(800, 600, &format);
- _backgroundSurface = new Graphics::Surface;
- _backgroundSurface->create(800, 600, format);
+ _backgroundSurface.create(800, 600, format);
+ _origFormat = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
- _origFormat = new Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
+ _globalMessageQueueList.reset(new GlobalMessageQueueList);
+ _behaviorManager.reset(new BehaviorManager);
- _console = new Console(this);
+ _sceneRect.left = 0;
+ _sceneRect.top = 0;
+ _sceneRect.right = 799;
+ _sceneRect.bottom = 599;
- initialize();
+ _floaters.reset(new Floaters);
+ _aniHandler.reset(new AniHandler);
_globalPalette = &_defaultPalette;
_isSaveAllowed = false;
@@ -336,13 +305,9 @@ Common::Error FullpipeEngine::run() {
}
if (_needRestart) {
- if (_modalObject) {
- delete _modalObject;
- _modalObject = 0;
- }
-
+ delete _modalObject;
freeGameLoader();
- _currentScene = 0;
+ _currentScene = nullptr;
_updateTicks = 0;
_globalPalette = &_defaultPalette;
@@ -357,6 +322,7 @@ Common::Error FullpipeEngine::run() {
freeGameLoader();
cleanup();
+ _backgroundSurface.free();
return Common::kNoError;
}
@@ -488,7 +454,7 @@ void FullpipeEngine::freeGameLoader() {
setCursor(0);
delete _movTable;
_floaters->stopAll();
- delete _gameLoader;
+ _gameLoader.reset();
_currentScene = 0;
_scene2 = 0;
_loaderScene = 0;
@@ -504,11 +470,6 @@ void FullpipeEngine::cleanup() {
delete (*_globalMessageQueueList)[i];
stopAllSoundStreams();
-
- delete _origFormat;
- _backgroundSurface->free();
-
- delete _backgroundSurface;
}
void FullpipeEngine::updateScreen() {
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index 39c03fe3e4..9426c32573 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -23,12 +23,15 @@
#ifndef FULLPIPE_FULLPIPE_H
#define FULLPIPE_FULLPIPE_H
+#include "audio/mixer.h"
#include "common/scummsys.h"
#include "common/events.h"
#include "common/keyboard.h"
+#include "common/ptr.h"
#include "common/random.h"
#include "common/savefile.h"
#include "common/system.h"
+#include "graphics/surface.h"
#include "engines/engine.h"
@@ -101,8 +104,8 @@ public:
FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc);
virtual ~FullpipeEngine();
- Console *_console;
- GUI::Debugger *getDebugger() { return _console; }
+ Console _console;
+ GUI::Debugger *getDebugger() { return &_console; }
void initialize();
void restartGame();
@@ -123,10 +126,10 @@ public:
void updateEvents();
- Graphics::Surface *_backgroundSurface;
- Graphics::PixelFormat *_origFormat;
+ Graphics::Surface _backgroundSurface;
+ Graphics::PixelFormat _origFormat;
- GameLoader *_gameLoader;
+ Common::ScopedPtr<GameLoader> _gameLoader;
GameProject *_gameProject;
bool loadGam(const char *fname, int scene = 0);
@@ -187,7 +190,7 @@ public:
void updateTrackDelay();
void startSceneTrack();
void startSoundStream1(const Common::String &trackName);
- void playOggSound(const Common::String &trackName, Audio::SoundHandle *stream);
+ void playOggSound(const Common::String &trackName, Audio::SoundHandle &stream);
void stopSoundStream2();
void stopAllSoundStreams();
void stopAllSoundInstances(int id);
@@ -197,7 +200,7 @@ public:
int _sfxVolume;
int _musicVolume;
- GlobalMessageQueueList *_globalMessageQueueList;
+ Common::ScopedPtr<GlobalMessageQueueList> _globalMessageQueueList;
MessageHandler *_messageHandlers;
int _msgX;
@@ -212,12 +215,12 @@ public:
int _mouseVirtY;
Common::Point _mouseScreenPos;
- BehaviorManager *_behaviorManager;
+ Common::ScopedPtr<BehaviorManager> _behaviorManager;
MovTable *_movTable;
- Floaters *_floaters;
- AniHandler *_aniHandler;
+ Common::ScopedPtr<Floaters> _floaters;
+ Common::ScopedPtr<AniHandler> _aniHandler;
Common::Array<Common::Point *> _arcadeKeys;
@@ -333,10 +336,10 @@ public:
void lift_openLift();
GameVar *_musicGameVar;
- Audio::SoundHandle *_soundStream1;
- Audio::SoundHandle *_soundStream2;
- Audio::SoundHandle *_soundStream3;
- Audio::SoundHandle *_soundStream4;
+ Audio::SoundHandle _soundStream1;
+ Audio::SoundHandle _soundStream2;
+ Audio::SoundHandle _soundStream3;
+ Audio::SoundHandle _soundStream4;
bool _stream2playing;
diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp
index efa5f8c2c7..32c2d0d2db 100644
--- a/engines/fullpipe/gameloader.cpp
+++ b/engines/fullpipe/gameloader.cpp
@@ -54,8 +54,6 @@ GameLoader::GameLoader() {
_interactionController = new InteractionController();
_inputController = new InputController();
- _gameProject = 0;
-
addMessageHandlerByIndex(global_messageHandler2, 0, 0);
insertMessageHandler(global_messageHandler3, 0, 128);
insertMessageHandler(global_messageHandler4, 0, 1);
@@ -77,12 +75,9 @@ GameLoader::GameLoader() {
}
GameLoader::~GameLoader() {
- delete _gameProject;
delete _interactionController;
delete _inputController;
- g_fp->_gameLoader = 0;
-
for (uint i = 0; i < _sc2array.size(); i++) {
if (_sc2array[i]._defPicAniInfos)
free(_sc2array[i]._defPicAniInfos);
@@ -112,11 +107,11 @@ bool GameLoader::load(MfcArchive &file) {
_gameName = file.readPascalString();
debugC(1, kDebugLoading, "_gameName: %s", _gameName.c_str());
- _gameProject = new GameProject();
+ _gameProject.reset(new GameProject());
_gameProject->load(file);
- g_fp->_gameProject = _gameProject;
+ g_fp->_gameProject = _gameProject.get();
if (g_fp->_gameProjectVersion < 12) {
error("Old gameProjectVersion: %d", g_fp->_gameProjectVersion);
diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h
index 6180ab0347..5e4d931409 100644
--- a/engines/fullpipe/gameloader.h
+++ b/engines/fullpipe/gameloader.h
@@ -121,7 +121,7 @@ class GameLoader : public CObject {
void restoreDefPicAniInfos();
- GameProject *_gameProject;
+ Common::ScopedPtr<GameProject> _gameProject;
InteractionController *_interactionController;
InputController *_inputController;
Inventory2 _inventory;
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp
index 8ba2e80c1b..3abf2fc7a6 100644
--- a/engines/fullpipe/gfx.cpp
+++ b/engines/fullpipe/gfx.cpp
@@ -635,8 +635,8 @@ void Picture::displayPicture() {
if (!_dataSize)
return;
- g_fp->_backgroundSurface->fillRect(Common::Rect(0, 0, 800, 600), 0);
- g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface->getBasePtr(0, 0), g_fp->_backgroundSurface->pitch, 0, 0, 800, 600);
+ g_fp->_backgroundSurface.fillRect(Common::Rect(0, 0, 800, 600), 0);
+ g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface.getBasePtr(0, 0), g_fp->_backgroundSurface.pitch, 0, 0, 800, 600);
draw(0, 0, 0, 0);
@@ -808,8 +808,8 @@ void Bitmap::putDib(int x, int y, const Palette &palette, byte alpha) {
int alphac = TS_ARGB(0xff, alpha, 0xff, 0xff);
- _surface->blit(*g_fp->_backgroundSurface, x1, y1, _flipping, &sub, alphac);
- g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface->getBasePtr(x1, y1), g_fp->_backgroundSurface->pitch, x1, y1, sub.width(), sub.height());
+ _surface->blit(g_fp->_backgroundSurface, x1, y1, _flipping, &sub, alphac);
+ g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface.getBasePtr(x1, y1), g_fp->_backgroundSurface.pitch, x1, y1, sub.width(), sub.height());
}
bool Bitmap::putDibRB(byte *pixels, const Palette &palette) {
@@ -967,7 +967,7 @@ void Bitmap::colorFill(uint32 *dest, int len, int32 color) {
#endif
byte r, g, b;
- g_fp->_origFormat->colorToRGB(color, r, g, b);
+ g_fp->_origFormat.colorToRGB(color, r, g, b);
uint32 c = TS_ARGB(0xff, r, g, b);
@@ -990,7 +990,7 @@ void Bitmap::paletteFill(uint32 *dest, byte *src, int len, const Palette &palett
byte r, g, b;
for (int i = 0; i < len; i++) {
- g_fp->_origFormat->colorToRGB(READ_LE_UINT32(&palette[*src++]) & 0xffff, r, g, b);
+ g_fp->_origFormat.colorToRGB(palette[*src++] & 0xffff, r, g, b);
*dest++ = TS_ARGB(0xff, r, g, b);
}
@@ -1019,7 +1019,7 @@ void Bitmap::copierKeyColor(uint32 *dest, byte *src, int len, int keyColor, cons
if (!cb05_format) {
for (int i = 0; i < len; i++) {
if (*src != keyColor) {
- g_fp->_origFormat->colorToRGB(READ_LE_UINT32(&palette[*src]) & 0xffff, r, g, b);
+ g_fp->_origFormat.colorToRGB(palette[*src] & 0xffff, r, g, b);
*dest = TS_ARGB(0xff, r, g, b);
}
@@ -1031,7 +1031,7 @@ void Bitmap::copierKeyColor(uint32 *dest, byte *src, int len, int keyColor, cons
for (int i = 0; i < len; i++) {
if (*src16 != 0) {
- g_fp->_origFormat->colorToRGB(READ_LE_UINT16(src16) & 0xffff, r, g, b);
+ g_fp->_origFormat.colorToRGB(READ_LE_UINT16(src16), r, g, b);
*dest = TS_ARGB(0xff, r, g, b);
}
@@ -1063,7 +1063,7 @@ void Bitmap::copier(uint32 *dest, byte *src, int len, const Palette &palette, bo
if (!cb05_format) {
for (int i = 0; i < len; i++) {
- g_fp->_origFormat->colorToRGB(READ_LE_UINT32(&palette[*src++]) & 0xffff, r, g, b);
+ g_fp->_origFormat.colorToRGB(palette[*src++] & 0xffff, r, g, b);
*dest++ = TS_ARGB(0xff, r, g, b);
}
@@ -1071,7 +1071,7 @@ void Bitmap::copier(uint32 *dest, byte *src, int len, const Palette &palette, bo
int16 *src16 = (int16 *)src;
for (int i = 0; i < len; i++) {
- g_fp->_origFormat->colorToRGB(READ_LE_UINT32(src16++) & 0xffff, r, g, b);
+ g_fp->_origFormat.colorToRGB(READ_LE_UINT16(src16++), r, g, b);
*dest++ = TS_ARGB(0xff, r, g, b);
}
}
@@ -1203,7 +1203,7 @@ DynamicPhase *Shadows::findSize(int width, int height) {
void FullpipeEngine::drawAlphaRectangle(int x1, int y1, int x2, int y2, int alpha) {
for (int y = y1; y < y2; y++) {
- uint32 *ptr = (uint32 *)g_fp->_backgroundSurface->getBasePtr(x1, y);
+ uint32 *ptr = (uint32 *)g_fp->_backgroundSurface.getBasePtr(x1, y);
for (int x = x1; x < x2; x++) {
uint32 color = *ptr;
@@ -1222,8 +1222,8 @@ void FullpipeEngine::sceneFade(Scene *sc, bool direction) {
int ticks = g_fp->_system->getMillis();
sc->draw();
- drawAlphaRectangle(0, 0, g_fp->_backgroundSurface->w, g_fp->_backgroundSurface->h, direction ? dim : 255 - dim);
- g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface->getBasePtr(0, 0), g_fp->_backgroundSurface->pitch, 0, 0, 800, 600);
+ drawAlphaRectangle(0, 0, g_fp->_backgroundSurface.w, g_fp->_backgroundSurface.h, direction ? dim : 255 - dim);
+ g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface.getBasePtr(0, 0), g_fp->_backgroundSurface.pitch, 0, 0, 800, 600);
g_fp->_system->updateScreen();
ticks = g_fp->_system->getMillis() - ticks;
diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp
index ee0e5e5c1f..46ad205278 100644
--- a/engines/fullpipe/scene.cpp
+++ b/engines/fullpipe/scene.cpp
@@ -523,7 +523,7 @@ void Scene::draw() {
updateScrolling();
// Clean previous stuff
- g_fp->_backgroundSurface->fillRect(Common::Rect(0, 0, 800, 600), 0);
+ g_fp->_backgroundSurface.fillRect(Common::Rect(0, 0, 800, 600), 0);
drawContent(60000, 0, true);
diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp
index b78d66d54c..4b5e105311 100644
--- a/engines/fullpipe/scenes/scene04.cpp
+++ b/engines/fullpipe/scenes/scene04.cpp
@@ -1086,13 +1086,13 @@ void updateSound() {
return;
case 1:
- if (!g_fp->_mixer->isSoundHandleActive(*g_fp->_soundStream2)) {
+ if (!g_fp->_mixer->isSoundHandleActive(g_fp->_soundStream2)) {
g_fp->playOggSound("sc4_loop.ogg", g_fp->_soundStream3);
g_vars->scene04_musicStage = 2;
}
break;
case 2:
- if (!g_fp->_mixer->isSoundHandleActive(*g_fp->_soundStream3)) {
+ if (!g_fp->_mixer->isSoundHandleActive(g_fp->_soundStream3)) {
if (g_fp->_stream2playing) { // Looop it
g_fp->playOggSound("sc4_loop.ogg", g_fp->_soundStream3);
} else {
@@ -1102,7 +1102,7 @@ void updateSound() {
}
break;
case 3:
- if (!g_fp->_mixer->isSoundHandleActive(*g_fp->_soundStream4)) {
+ if (!g_fp->_mixer->isSoundHandleActive(g_fp->_soundStream4)) {
g_vars->scene04_musicStage = 0;
}
break;
diff --git a/engines/fullpipe/scenes/sceneFinal.cpp b/engines/fullpipe/scenes/sceneFinal.cpp
index 30ca31b7b0..2b4100b8ce 100644
--- a/engines/fullpipe/scenes/sceneFinal.cpp
+++ b/engines/fullpipe/scenes/sceneFinal.cpp
@@ -124,7 +124,7 @@ void sceneHandlerFinal_fallCoin() {
}
void updateMusic() {
- if (g_vars->sceneFinal_trackHasStarted && !g_fp->_mixer->isSoundHandleActive(*g_fp->_soundStream1)) { // loop music
+ if (g_vars->sceneFinal_trackHasStarted && !g_fp->_mixer->isSoundHandleActive(g_fp->_soundStream1)) { // loop music
sceneHandlerFinal_startMusic("track16.ogg");
}
}
diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp
index 44dbe56cc0..b1d0a26cf5 100644
--- a/engines/fullpipe/sound.cpp
+++ b/engines/fullpipe/sound.cpp
@@ -228,8 +228,8 @@ void Sound::stop() {
void FullpipeEngine::setSceneMusicParameters(GameVar *gvar) {
stopSoundStream2();
- if (_mixer->isSoundHandleActive(*_soundStream3))
- _mixer->stopHandle(*_soundStream4);
+ if (_mixer->isSoundHandleActive(_soundStream3))
+ _mixer->stopHandle(_soundStream4);
if (_musicLocal)
stopAllSoundStreams();
@@ -288,7 +288,7 @@ void FullpipeEngine::updateTrackDelay() {
void FullpipeEngine::startSceneTrack() {
if (_sceneTrackIsPlaying) {
- if (!_mixer->isSoundHandleActive(*_soundStream1)) { // Simulate end of sound callback
+ if (!_mixer->isSoundHandleActive(_soundStream1)) { // Simulate end of sound callback
updateTrackDelay();
}
}
@@ -349,9 +349,9 @@ void FullpipeEngine::startSoundStream1(const Common::String &trackName) {
playOggSound(trackName, _soundStream1);
}
-void FullpipeEngine::playOggSound(const Common::String &trackName, Audio::SoundHandle *stream) {
+void FullpipeEngine::playOggSound(const Common::String &trackName, Audio::SoundHandle &stream) {
#ifdef USE_VORBIS
- if (_mixer->isSoundHandleActive(*stream))
+ if (_mixer->isSoundHandleActive(stream))
return;
Common::File *track = new Common::File();
@@ -361,7 +361,7 @@ void FullpipeEngine::playOggSound(const Common::String &trackName, Audio::SoundH
return;
}
Audio::RewindableAudioStream *ogg = Audio::makeVorbisStream(track, DisposeAfterUse::YES);
- _mixer->playStream(Audio::Mixer::kMusicSoundType, stream, ogg);
+ _mixer->playStream(Audio::Mixer::kMusicSoundType, &stream, ogg);
#endif
}
@@ -399,8 +399,8 @@ void FullpipeEngine::playSound(int id, int flag) {
}
void FullpipeEngine::playTrack(GameVar *sceneVar, const char *name, bool delayed) {
- if (_mixer->isSoundHandleActive(*_soundStream3))
- _mixer->stopHandle(*_soundStream4);
+ if (_mixer->isSoundHandleActive(_soundStream3))
+ _mixer->stopHandle(_soundStream4);
stopSoundStream2();
@@ -491,17 +491,17 @@ void global_messageHandler_handleSound(ExCommand *cmd) {
void FullpipeEngine::stopSoundStream2() {
_stream2playing = false;
- if (_mixer->isSoundHandleActive(*_soundStream3)) {
- _mixer->stopHandle(*_soundStream2);
- _mixer->stopHandle(*_soundStream3);
+ if (_mixer->isSoundHandleActive(_soundStream3)) {
+ _mixer->stopHandle(_soundStream2);
+ _mixer->stopHandle(_soundStream3);
}
}
void FullpipeEngine::stopAllSoundStreams() {
- _mixer->stopHandle(*_soundStream1);
- _mixer->stopHandle(*_soundStream2);
- _mixer->stopHandle(*_soundStream3);
- _mixer->stopHandle(*_soundStream4);
+ _mixer->stopHandle(_soundStream1);
+ _mixer->stopHandle(_soundStream2);
+ _mixer->stopHandle(_soundStream3);
+ _mixer->stopHandle(_soundStream4);
_stream2playing = false;
}
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index d55f7dbf31..5a2ad51280 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -280,7 +280,7 @@ void gameLoaderSavegameCallback(MfcArchive *archive, bool mode) {
}
bool FullpipeEngine::loadGam(const char *fname, int scene) {
- _gameLoader = new GameLoader();
+ _gameLoader.reset(new GameLoader());
if (!_gameLoader->loadFile(fname))
return false;