aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/global.cpp1
-rw-r--r--engines/agi/graphics.cpp8
-rw-r--r--engines/agi/lzw.cpp1
-rw-r--r--engines/agi/picture.cpp2
-rw-r--r--engines/agi/preagi.cpp8
-rw-r--r--engines/agi/preagi.h3
-rw-r--r--engines/agi/preagi_mickey.cpp6
-rw-r--r--engines/agi/preagi_mickey.h6
-rw-r--r--engines/agi/sound.cpp11
-rw-r--r--engines/agi/sound.h14
-rw-r--r--engines/agi/sound_2gs.cpp5
-rw-r--r--engines/agi/sound_2gs.h1
-rw-r--r--engines/agi/sound_pcjr.cpp5
-rw-r--r--engines/agi/sound_sarien.cpp6
-rw-r--r--engines/agi/text.cpp2
-rw-r--r--engines/agi/view.h2
16 files changed, 59 insertions, 22 deletions
diff --git a/engines/agi/global.cpp b/engines/agi/global.cpp
index 23256f27fb..6f83f02a4e 100644
--- a/engines/agi/global.cpp
+++ b/engines/agi/global.cpp
@@ -21,6 +21,7 @@
*/
#include "common/config-manager.h"
+#include "audio/mixer.h"
#include "agi/agi.h"
#include "agi/graphics.h"
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index 24cd4f43d3..3b1b99f458 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -61,6 +61,14 @@ GfxMgr::GfxMgr(AgiBase *vm, GfxFont *font) : _vm(vm), _font(font) {
_displayWidthMulAdjust = 0; // visualPos * (2+0) = displayPos
_displayHeightMulAdjust = 0; // visualPos * (1+0) = displayPos
+
+ _pixels = 0;
+ _displayPixels = 0;
+
+ _activeScreen = NULL;
+ _gameScreen = NULL;
+ _priorityScreen = NULL;
+ _displayScreen = NULL;
}
/**
diff --git a/engines/agi/lzw.cpp b/engines/agi/lzw.cpp
index bf41e1f3b4..ecb69543d7 100644
--- a/engines/agi/lzw.cpp
+++ b/engines/agi/lzw.cpp
@@ -72,6 +72,7 @@ LZWDecoder::LZWDecoder() {
appendCharacter = (uint8 *)malloc(TABLE_SIZE * sizeof(uint8));
inputBitCount = 0; // Number of bits in input bit buffer
inputBitBuffer = 0L;
+ BITS = MAX_VALUE = MAX_CODE = 0;
}
LZWDecoder::~LZWDecoder() {
diff --git a/engines/agi/picture.cpp b/engines/agi/picture.cpp
index a80e811f44..2b3bba89db 100644
--- a/engines/agi/picture.cpp
+++ b/engines/agi/picture.cpp
@@ -44,6 +44,8 @@ PictureMgr::PictureMgr(AgiBase *agi, GfxMgr *gfx) {
_minCommand = 0xf0;
_flags = 0;
_currentStep = 0;
+
+ _width = _height = 0;
}
void PictureMgr::putVirtPixel(int x, int y) {
diff --git a/engines/agi/preagi.cpp b/engines/agi/preagi.cpp
index 7e2e65a3eb..f8630db0b6 100644
--- a/engines/agi/preagi.cpp
+++ b/engines/agi/preagi.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "audio/mixer.h"
#include "audio/softsynth/pcspk.h"
#include "common/debug-channels.h"
@@ -50,6 +51,8 @@ PreAgiEngine::PreAgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) :
memset(&_game, 0, sizeof(struct AgiGame));
memset(&_debug, 0, sizeof(struct AgiDebug));
memset(&_mouse, 0, sizeof(struct Mouse));
+
+ _speakerHandle = new Audio::SoundHandle();
}
void PreAgiEngine::initialize() {
@@ -74,7 +77,7 @@ void PreAgiEngine::initialize() {
_gfx->initVideo();
_speakerStream = new Audio::PCSpeaker(_mixer->getOutputRate());
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle,
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, _speakerHandle,
_speakerStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
debugC(2, kDebugLevelMain, "Detect game");
@@ -89,8 +92,9 @@ void PreAgiEngine::initialize() {
}
PreAgiEngine::~PreAgiEngine() {
- _mixer->stopHandle(_speakerHandle);
+ _mixer->stopHandle(*_speakerHandle);
delete _speakerStream;
+ delete _speakerHandle;
delete _picture;
delete _gfx;
diff --git a/engines/agi/preagi.h b/engines/agi/preagi.h
index d6026a5d4d..6950aa30cd 100644
--- a/engines/agi/preagi.h
+++ b/engines/agi/preagi.h
@@ -26,6 +26,7 @@
#include "agi/agi.h"
namespace Audio {
+class SoundHandle;
class PCSpeaker;
}
@@ -110,7 +111,7 @@ private:
int _defaultColor;
Audio::PCSpeaker *_speakerStream;
- Audio::SoundHandle _speakerHandle;
+ Audio::SoundHandle *_speakerHandle;
};
} // End of namespace Agi
diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp
index e1545cdb68..0584aab683 100644
--- a/engines/agi/preagi_mickey.cpp
+++ b/engines/agi/preagi_mickey.cpp
@@ -255,7 +255,7 @@ bool MickeyEngine::checkMenu() {
return parse(menu.cmd[iSel0].data[iSel1], menu.arg[iSel0].data[iSel1]);
}
-void MickeyEngine::drawMenu(MSA_MENU menu, int sel0, int sel1) {
+void MickeyEngine::drawMenu(MSA_MENU &menu, int sel0, int sel1) {
int iWord;
int iRow;
int sel;
@@ -286,7 +286,7 @@ void MickeyEngine::drawMenu(MSA_MENU menu, int sel0, int sel1) {
_gfx->updateScreen();
}
-void MickeyEngine::getMouseMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow, int x, int y) {
+void MickeyEngine::getMouseMenuSelRow(MSA_MENU &menu, int *sel0, int *sel1, int iRow, int x, int y) {
int iWord;
int *sel = 0;
@@ -313,7 +313,7 @@ void MickeyEngine::getMouseMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int i
}
}
-bool MickeyEngine::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) {
+bool MickeyEngine::getMenuSelRow(MSA_MENU &menu, int *sel0, int *sel1, int iRow) {
Common::Event event;
int *sel = 0;
int nWords;
diff --git a/engines/agi/preagi_mickey.h b/engines/agi/preagi_mickey.h
index 81565d3982..066880d324 100644
--- a/engines/agi/preagi_mickey.h
+++ b/engines/agi/preagi_mickey.h
@@ -710,9 +710,9 @@ protected:
void printExeMsg(int);
void printDesc(int);
bool checkMenu();
- void drawMenu(MSA_MENU, int, int);
- void getMouseMenuSelRow(MSA_MENU, int *, int *, int, int, int);
- bool getMenuSelRow(MSA_MENU, int *, int *, int);
+ void drawMenu(MSA_MENU &, int, int);
+ void getMouseMenuSelRow(MSA_MENU &, int *, int *, int, int, int);
+ bool getMenuSelRow(MSA_MENU &, int *, int *, int);
void getMenuSel(char *, int *, int *);
void centerMenu(MSA_MENU *);
void patchMenu(MSA_MENU *);
diff --git a/engines/agi/sound.cpp b/engines/agi/sound.cpp
index edf17960ad..2c1eb021f9 100644
--- a/engines/agi/sound.cpp
+++ b/engines/agi/sound.cpp
@@ -29,9 +29,19 @@
#include "agi/sound_pcjr.h"
#include "common/textconsole.h"
+#include "audio/mixer.h"
namespace Agi {
+SoundGen::SoundGen(AgiBase *vm, Audio::Mixer *pMixer) : _vm(vm), _mixer(pMixer) {
+ _sampleRate = pMixer->getOutputRate();
+ _soundHandle = new Audio::SoundHandle();
+}
+
+SoundGen::~SoundGen() {
+ delete _soundHandle;
+}
+
//
// TODO: add support for variable sampling rate in the output device
//
@@ -183,6 +193,7 @@ SoundMgr::SoundMgr(AgiBase *agi, Audio::Mixer *pMixer) {
_playingSound = -1;
switch (_vm->_soundemu) {
+ default:
case SOUND_EMU_NONE:
case SOUND_EMU_AMIGA:
case SOUND_EMU_MAC:
diff --git a/engines/agi/sound.h b/engines/agi/sound.h
index 4b668e8cf2..8aa7a5d1df 100644
--- a/engines/agi/sound.h
+++ b/engines/agi/sound.h
@@ -23,7 +23,10 @@
#ifndef AGI_SOUND_H
#define AGI_SOUND_H
-#include "audio/mixer.h"
+namespace Audio {
+class Mixer;
+class SoundHandle;
+}
namespace Agi {
@@ -71,11 +74,8 @@ class SoundMgr;
class SoundGen {
public:
- SoundGen(AgiBase *vm, Audio::Mixer *pMixer) : _vm(vm), _mixer(pMixer) {
- _sampleRate = pMixer->getOutputRate();
- }
-
- virtual ~SoundGen() {}
+ SoundGen(AgiBase *vm, Audio::Mixer *pMixer);
+ virtual ~SoundGen();
virtual void play(int resnum) = 0;
virtual void stop(void) = 0;
@@ -83,7 +83,7 @@ public:
AgiBase *_vm;
Audio::Mixer *_mixer;
- Audio::SoundHandle _soundHandle;
+ Audio::SoundHandle *_soundHandle;
uint32 _sampleRate;
};
diff --git a/engines/agi/sound_2gs.cpp b/engines/agi/sound_2gs.cpp
index b1bcee3920..4992b6516c 100644
--- a/engines/agi/sound_2gs.cpp
+++ b/engines/agi/sound_2gs.cpp
@@ -27,6 +27,7 @@
#include "common/memstream.h"
#include "common/str-array.h"
#include "common/textconsole.h"
+#include "audio/mixer.h"
#include "agi/agi.h"
#include "agi/sound_2gs.h"
@@ -55,11 +56,11 @@ SoundGen2GS::SoundGen2GS(AgiBase *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMixe
// Load instruments
_disableMidi = !loadInstruments();
- _mixer->playStream(Audio::Mixer::kMusicSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
+ _mixer->playStream(Audio::Mixer::kMusicSoundType, _soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
}
SoundGen2GS::~SoundGen2GS() {
- _mixer->stopHandle(_soundHandle);
+ _mixer->stopHandle(*_soundHandle);
delete[] _wavetable;
delete[] _out;
}
diff --git a/engines/agi/sound_2gs.h b/engines/agi/sound_2gs.h
index a7a23f5b06..49a375cdbc 100644
--- a/engines/agi/sound_2gs.h
+++ b/engines/agi/sound_2gs.h
@@ -126,6 +126,7 @@ public:
memset(&osc, 0, sizeof(osc));
seg = 0;
a = 0;
+ velocity = 0;
}
const IIgsInstrumentHeader *curInstrument; ///< Currently used instrument
diff --git a/engines/agi/sound_pcjr.cpp b/engines/agi/sound_pcjr.cpp
index 9d556e048a..0a0c456e14 100644
--- a/engines/agi/sound_pcjr.cpp
+++ b/engines/agi/sound_pcjr.cpp
@@ -54,6 +54,7 @@
*
*/
+#include "audio/mixer.h"
#include "agi/agi.h"
#include "agi/sound.h"
#include "agi/sound_pcjr.h"
@@ -123,7 +124,7 @@ SoundGenPCJr::SoundGenPCJr(AgiBase *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMi
memset(_channel, 0, sizeof(_channel));
memset(_tchannel, 0, sizeof(_tchannel));
- _mixer->playStream(Audio::Mixer::kMusicSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
+ _mixer->playStream(Audio::Mixer::kMusicSoundType, _soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
_v1data = NULL;
_v1size = 0;
@@ -132,7 +133,7 @@ SoundGenPCJr::SoundGenPCJr(AgiBase *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMi
SoundGenPCJr::~SoundGenPCJr() {
free(_chanData);
- _mixer->stopHandle(_soundHandle);
+ _mixer->stopHandle(*_soundHandle);
}
void SoundGenPCJr::play(int resnum) {
diff --git a/engines/agi/sound_sarien.cpp b/engines/agi/sound_sarien.cpp
index 939c3d2c77..3e44546688 100644
--- a/engines/agi/sound_sarien.cpp
+++ b/engines/agi/sound_sarien.cpp
@@ -21,6 +21,7 @@
*/
#include "common/random.h"
+#include "audio/mixer.h"
#include "agi/agi.h"
@@ -73,6 +74,7 @@ SoundGenSarien::SoundGenSarien(AgiBase *vm, Audio::Mixer *pMixer) : SoundGen(vm,
_useChorus = true; // FIXME: Currently always true?
switch (_vm->_soundemu) {
+ default:
case SOUND_EMU_NONE:
_waveform = waveformRamp;
_env = true;
@@ -92,11 +94,11 @@ SoundGenSarien::SoundGenSarien(AgiBase *vm, Audio::Mixer *pMixer) : SoundGen(vm,
debug(0, "Initializing sound: envelopes disabled");
}
- _mixer->playStream(Audio::Mixer::kMusicSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
+ _mixer->playStream(Audio::Mixer::kMusicSoundType, _soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
}
SoundGenSarien::~SoundGenSarien() {
- _mixer->stopHandle(_soundHandle);
+ _mixer->stopHandle(*_soundHandle);
free(_sndBuffer);
}
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index 274a654547..4aa42ffec3 100644
--- a/engines/agi/text.cpp
+++ b/engines/agi/text.cpp
@@ -39,6 +39,8 @@ TextMgr::TextMgr(AgiEngine *vm, Words *words, GfxMgr *gfx) {
_words = words;
_gfx = gfx;
+ _systemUI = NULL;
+
memset(&_messageState, 0, sizeof(_messageState));
_textPos.row = 0;
_textPos.column = 0;
diff --git a/engines/agi/view.h b/engines/agi/view.h
index e59916da78..adcf7dd1b3 100644
--- a/engines/agi/view.h
+++ b/engines/agi/view.h
@@ -132,6 +132,8 @@ struct ScreenObjEntry {
uint8 wander_count;
// end of motion related variables
uint8 loop_flag;
+
+ ScreenObjEntry() { memset(this, 0, sizeof(ScreenObjEntry)); }
}; // struct vt_entry
} // End of namespace Agi