diff options
Diffstat (limited to 'engines/agi')
-rw-r--r-- | engines/agi/agi.cpp | 8 | ||||
-rw-r--r-- | engines/agi/agi.h | 6 | ||||
-rw-r--r-- | engines/agi/global.cpp | 1 | ||||
-rw-r--r-- | engines/agi/graphics.cpp | 20 | ||||
-rw-r--r-- | engines/agi/lzw.cpp | 1 | ||||
-rw-r--r-- | engines/agi/op_cmd.cpp | 6 | ||||
-rw-r--r-- | engines/agi/op_test.cpp | 4 | ||||
-rw-r--r-- | engines/agi/picture.cpp | 2 | ||||
-rw-r--r-- | engines/agi/preagi.cpp | 8 | ||||
-rw-r--r-- | engines/agi/preagi.h | 3 | ||||
-rw-r--r-- | engines/agi/preagi_mickey.cpp | 10 | ||||
-rw-r--r-- | engines/agi/preagi_mickey.h | 6 | ||||
-rw-r--r-- | engines/agi/preagi_winnie.cpp | 2 | ||||
-rw-r--r-- | engines/agi/saveload.cpp | 7 | ||||
-rw-r--r-- | engines/agi/sound.cpp | 11 | ||||
-rw-r--r-- | engines/agi/sound.h | 14 | ||||
-rw-r--r-- | engines/agi/sound_2gs.cpp | 5 | ||||
-rw-r--r-- | engines/agi/sound_2gs.h | 1 | ||||
-rw-r--r-- | engines/agi/sound_pcjr.cpp | 5 | ||||
-rw-r--r-- | engines/agi/sound_sarien.cpp | 6 | ||||
-rw-r--r-- | engines/agi/systemui.cpp | 2 | ||||
-rw-r--r-- | engines/agi/text.cpp | 6 | ||||
-rw-r--r-- | engines/agi/view.h | 2 |
23 files changed, 91 insertions, 45 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index e566ad12f6..60c8d1f3ef 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -403,6 +403,11 @@ AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBas _lastSaveTime = 0; + _playTimeInSecondsAdjust = 0; + _lastUsedPlayTimeInCycles = 0; + _lastUsedPlayTimeInSeconds = 0; + _passedPlayTimeCycles = 0; + memset(_keyQueue, 0, sizeof(_keyQueue)); _console = nullptr; @@ -418,6 +423,9 @@ AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBas _inventory = nullptr; _keyHoldMode = false; + + _artificialDelayCurrentRoom = 0; + _artificialDelayCurrentPicture = 0; } void AgiEngine::initialize() { diff --git a/engines/agi/agi.h b/engines/agi/agi.h index 1baf0d912f..79d05c4b1d 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -20,8 +20,8 @@ * */ -#ifndef AGI_H -#define AGI_H +#ifndef AGI_AGI_H +#define AGI_AGI_H #include "common/scummsys.h" #include "common/error.h" @@ -991,4 +991,4 @@ private: } // End of namespace Agi -#endif /* AGI_H */ +#endif /* AGI_AGI_H */ 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 6d3563a451..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; } /** @@ -605,7 +613,7 @@ void GfxMgr::render_BlockEGA(int16 x, int16 y, int16 width, int16 height, bool c switch (_upscaledHires) { case DISPLAY_UPSCALED_640x400: - offsetDisplay += _displayScreenWidth;; + offsetDisplay += _displayScreenWidth; break; default: break; @@ -660,7 +668,7 @@ void GfxMgr::render_BlockCGA(int16 x, int16 y, int16 width, int16 height, bool c switch (_upscaledHires) { case DISPLAY_UPSCALED_640x400: - offsetDisplay += _displayScreenWidth;; + offsetDisplay += _displayScreenWidth; break; default: break; @@ -743,7 +751,7 @@ void GfxMgr::render_BlockHercules(int16 x, int16 y, int16 width, int16 height, b offsetVisual += SCRIPT_WIDTH - width; offsetDisplay += _displayScreenWidth - displayWidth; - offsetDisplay += _displayScreenWidth;; + offsetDisplay += _displayScreenWidth; remainingHeight--; } @@ -1178,13 +1186,17 @@ void GfxMgr::drawCharacterOnDisplay(int16 x, int16 y, const byte character, byte #define SHAKE_HORIZONTAL_PIXELS 4 // Sierra used some EGA port trickery to do it, we have to do it by copying pixels around +// +// Shaking locations: +// - Fanmade "Enclosure" right during the intro +// - Space Quest 2 almost right at the start when getting captured (after walking into the space ship) void GfxMgr::shakeScreen(int16 repeatCount) { int shakeNr, shakeCount; uint8 *blackSpace; int16 shakeHorizontalPixels = SHAKE_HORIZONTAL_PIXELS * (2 + _displayWidthMulAdjust); int16 shakeVerticalPixels = SHAKE_VERTICAL_PIXELS * (1 + _displayHeightMulAdjust); - if ((blackSpace = (uint8 *)calloc(shakeVerticalPixels * _displayScreenWidth, 1)) == NULL) + if ((blackSpace = (uint8 *)calloc(shakeHorizontalPixels * _displayScreenWidth, 1)) == NULL) return; shakeCount = repeatCount * 8; // effectively 4 shakes per repeat 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/op_cmd.cpp b/engines/agi/op_cmd.cpp index fed07ea986..8a62fce86c 100644 --- a/engines/agi/op_cmd.cpp +++ b/engines/agi/op_cmd.cpp @@ -662,7 +662,7 @@ void cmdWordToString(AgiGame *state, AgiEngine *vm, uint8 *parameter) { uint16 stringNr = parameter[0]; uint16 wordNr = parameter[1]; - strcpy(state->strings[stringNr], state->_vm->_words->getEgoWord(wordNr)); + Common::strlcpy(state->strings[stringNr], state->_vm->_words->getEgoWord(wordNr), MAX_STRINGLEN); } void cmdOpenDialogue(AgiGame *state, AgiEngine *vm, uint8 *parameter) { @@ -2014,7 +2014,7 @@ void cmdGetString(AgiGame *state, AgiEngine *vm, uint8 *parameter) { // copy string to destination // TODO: not sure if set all the time or only when ENTER is pressed - strcpy(&state->_vm->_game.strings[stringDestNr][0], (char *)textMgr->_inputString); + Common::strlcpy(&state->_vm->_game.strings[stringDestNr][0], (char *)textMgr->_inputString, MAX_STRINGLEN); textMgr->charPos_Pop(); @@ -2102,7 +2102,7 @@ void cmdSetString(AgiGame *state, AgiEngine *vm, uint8 *parameter) { // CM: to avoid crash in Groza (str = 150) if (stringNr > MAX_STRINGS) return; - strcpy(state->strings[stringNr], state->_curLogic->texts[textNr]); + Common::strlcpy(state->strings[stringNr], state->_curLogic->texts[textNr], MAX_STRINGLEN); } void cmdDisplay(AgiGame *state, AgiEngine *vm, uint8 *parameter) { diff --git a/engines/agi/op_test.cpp b/engines/agi/op_test.cpp index 4b215edc63..4505668fd1 100644 --- a/engines/agi/op_test.cpp +++ b/engines/agi/op_test.cpp @@ -231,8 +231,8 @@ uint8 AgiEngine::testCompareStrings(uint8 s1, uint8 s2) { char ms2[MAX_STRINGLEN]; int j, k, l; - strcpy(ms1, _game.strings[s1]); - strcpy(ms2, _game.strings[s2]); + Common::strlcpy(ms1, _game.strings[s1], MAX_STRINGLEN); + Common::strlcpy(ms2, _game.strings[s2], MAX_STRINGLEN); l = strlen(ms1); for (k = 0, j = 0; k < l; k++) { 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 620d5e0baf..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; @@ -1205,7 +1205,7 @@ void MickeyEngine::printStory() { clearScreen(IDA_DEFAULT); for (iRow = 0; iRow < 25; iRow++) { - strcpy(szLine, buffer + pBuf); + Common::strlcpy(szLine, buffer + pBuf, 41); drawStr(iRow, 0, IDA_DEFAULT, szLine); pBuf += strlen(szLine) + 1; } @@ -1213,7 +1213,7 @@ void MickeyEngine::printStory() { clearScreen(IDA_DEFAULT); for (iRow = 0; iRow < 21; iRow++) { - strcpy(szLine, buffer + pBuf); + Common::strlcpy(szLine, buffer + pBuf, 41); drawStr(iRow, 0, IDA_DEFAULT, szLine); pBuf += strlen(szLine) + 1; } 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/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index 87ac7c19c6..8fb9daca5e 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -292,7 +292,7 @@ int WinnieEngine::parser(int pc, int index, uint8 *buffer) { } // extract menu string - strcpy(szMenu, (char *)(buffer + pc)); + Common::strlcpy(szMenu, (char *)(buffer + pc), 121); XOR80(szMenu); break; default: diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index 0658609cd0..fc4aea3169 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -118,7 +118,7 @@ int AgiEngine::saveGame(const Common::String &fileName, const Common::String &de out->writeByte(2); // was _game.state, 2 = STATE_RUNNING - strcpy(gameIDstring, _game.id); + Common::strlcpy(gameIDstring, _game.id, 8); out->write(gameIDstring, 8); debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing game id (%s, %s)", gameIDstring, _game.id); @@ -689,9 +689,6 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) { } } } - for (i = vtEntries; i < SCREENOBJECTS_MAX; i++) { - memset(&_game.screenObjTable[i], 0, sizeof(ScreenObjEntry)); - } // Fix some pointers in screenObjTable @@ -832,7 +829,7 @@ SavedGameSlotIdArray AgiEngine::getSavegameSlotIds() { filenames = _saveFileMan->listSavefiles(_targetName + ".###"); Common::StringArray::iterator it; - Common::StringArray::iterator end = filenames.end();; + Common::StringArray::iterator end = filenames.end(); // convert to lower-case, just to be sure for (it = filenames.begin(); it != end; it++) { 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/systemui.cpp b/engines/agi/systemui.cpp index aeb1ded4a2..1f26267ad6 100644 --- a/engines/agi/systemui.cpp +++ b/engines/agi/systemui.cpp @@ -585,7 +585,7 @@ void SystemUI::readSavedGameSlots(bool filterNonexistant, bool withAutoSaveSlot) slotIdArray.push_back(SYSTEMUI_SAVEDGAME_MAXIMUM_SLOTS); // so that the loop will process all slots SavedGameSlotIdArray::iterator it; - SavedGameSlotIdArray::iterator end = slotIdArray.end();; + SavedGameSlotIdArray::iterator end = slotIdArray.end(); for (it = slotIdArray.begin(); it != end; it++) { curSlotId = *it; diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp index 110ba10632..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; @@ -457,7 +459,7 @@ void TextMgr::drawMessageBox(const char *textPtr, int16 forcedHeight, int16 want // Caller wants to force specified width/height? set it if (forcedHeight) _messageState.textSize_Height = forcedHeight; - + if (forcedWidth) { if (wantedWidth) _messageState.textSize_Width = wantedWidth; @@ -1207,7 +1209,7 @@ char *TextMgr::stringPrintf(const char *originalText) { } assert(resultString.size() < sizeof(resultPrintfBuffer)); - strcpy(resultPrintfBuffer, resultString.c_str()); + Common::strlcpy(resultPrintfBuffer, resultString.c_str(), 2000); return resultPrintfBuffer; } 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 |