diff options
Diffstat (limited to 'engines/toon')
-rw-r--r-- | engines/toon/anim.cpp | 8 | ||||
-rw-r--r-- | engines/toon/audio.cpp | 2 | ||||
-rw-r--r-- | engines/toon/character.cpp | 1 | ||||
-rw-r--r-- | engines/toon/font.cpp | 5 | ||||
-rw-r--r-- | engines/toon/movie.cpp | 9 | ||||
-rw-r--r-- | engines/toon/movie.h | 3 | ||||
-rw-r--r-- | engines/toon/path.cpp | 2 | ||||
-rw-r--r-- | engines/toon/picture.cpp | 5 | ||||
-rw-r--r-- | engines/toon/resource.cpp | 1 | ||||
-rw-r--r-- | engines/toon/resource.h | 1 | ||||
-rw-r--r-- | engines/toon/script.cpp | 5 | ||||
-rw-r--r-- | engines/toon/script_func.cpp | 6 | ||||
-rw-r--r-- | engines/toon/state.cpp | 4 | ||||
-rw-r--r-- | engines/toon/tools.cpp | 7 | ||||
-rw-r--r-- | engines/toon/toon.cpp | 30 |
15 files changed, 74 insertions, 15 deletions
diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp index 78d3954325..19e997af34 100644 --- a/engines/toon/anim.cpp +++ b/engines/toon/anim.cpp @@ -41,7 +41,7 @@ bool Animation::loadAnimation(const Common::String &file) { if (strncmp((char *)fileData, "KevinAguilar", 12)) return false; - strcpy(_name, file.c_str()); + Common::strlcpy(_name, file.c_str(), 32); uint32 headerSize = READ_LE_UINT32(fileData + 16); uint32 uncompressedBytes = READ_LE_UINT32(fileData + 20); @@ -52,6 +52,7 @@ bool Animation::loadAnimation(const Common::String &file) { _x2 = READ_LE_UINT32(fileData + 40); _y2 = READ_LE_UINT32(fileData + 44); _paletteEntries = READ_LE_UINT32(fileData + 56); + // CHECKME: Useless variable _fps _fps = READ_LE_UINT32(fileData + 60); uint32 paletteSize = READ_LE_UINT32(fileData + 64); @@ -119,6 +120,10 @@ Animation::Animation(ToonEngine *vm) : _vm(vm) { _palette = NULL; _numFrames = 0; _frames = NULL; + + _x1 = _y1 = _x2 = _y2 = 0; + _fps = 0; + _paletteEntries = 0; } Animation::~Animation() { @@ -448,6 +453,7 @@ AnimationInstance::AnimationInstance(ToonEngine *vm, AnimationInstanceType type) _y = 0; _z = 0; _layerZ = 0; + _visible = false; } void AnimationInstance::render() { diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp index bc0e051057..50b559ee00 100644 --- a/engines/toon/audio.cpp +++ b/engines/toon/audio.cpp @@ -255,6 +255,8 @@ AudioStreamInstance::AudioStreamInstance(AudioManager *man, Audio::Mixer *mixer, } else { stopNow(); } + + _soundType = Audio::Mixer::kPlainSoundType; } AudioStreamInstance::~AudioStreamInstance() { diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp index 83c9e3ec70..baab8888cf 100644 --- a/engines/toon/character.cpp +++ b/engines/toon/character.cpp @@ -65,6 +65,7 @@ Character::Character(ToonEngine *vm) : _vm(vm) { _numPixelToWalk = 0; _nextIdleTime = _vm->_system->getMillis() + (_vm->randRange(0, 600) + 300) * _vm->getTickLength(); _lineToSayId = 0; + _time = 0; } Character::~Character(void) { diff --git a/engines/toon/font.cpp b/engines/toon/font.cpp index e26ed92f83..2ba4eff652 100644 --- a/engines/toon/font.cpp +++ b/engines/toon/font.cpp @@ -32,6 +32,8 @@ FontRenderer::FontRenderer(ToonEngine *vm) : _vm(vm) { _currentFontColor[1] = 0xc8; _currentFontColor[2] = 0xcb; _currentFontColor[3] = 0xce; + + _currentFont = nullptr; } FontRenderer::~FontRenderer() { @@ -195,8 +197,7 @@ void FontRenderer::renderMultiLineText(int16 x, int16 y, const Common::String &o // divide the text in several lines // based on number of characters or size of lines. byte text[1024]; - strncpy((char *)text, origText.c_str(), 1023); - text[1023] = 0; + Common::strlcpy((char *)text, origText.c_str(), 1024); byte *lines[16]; int32 lineSize[16]; diff --git a/engines/toon/movie.cpp b/engines/toon/movie.cpp index f0463a52e1..9e8514d0a8 100644 --- a/engines/toon/movie.cpp +++ b/engines/toon/movie.cpp @@ -85,7 +85,8 @@ void Movie::play(const Common::String &video, int32 flags) { _playing = true; if (flags & 1) _vm->getAudioManager()->setMusicVolume(0); - _decoder->loadFile(video.c_str()); + if (!_decoder->loadFile(video.c_str())) + error("Unable to play video %s", video.c_str()); playVideo(isFirstIntroVideo); _vm->flushPalette(true); if (flags & 1) @@ -94,7 +95,7 @@ void Movie::play(const Common::String &video, int32 flags) { _playing = false; } -bool Movie::playVideo(bool isFirstIntroVideo) { +void Movie::playVideo(bool isFirstIntroVideo) { debugC(1, kDebugMovie, "playVideo(isFirstIntroVideo: %d)", isFirstIntroVideo); _decoder->start(); @@ -135,13 +136,13 @@ bool Movie::playVideo(bool isFirstIntroVideo) { while (_vm->_system->getEventManager()->pollEvent(event)) if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE)) { _vm->dirtyAllScreen(); - return false; + return; } _vm->_system->delayMillis(10); } _vm->dirtyAllScreen(); - return !_vm->shouldQuit(); + return; } } // End of namespace Toon diff --git a/engines/toon/movie.h b/engines/toon/movie.h index 4dd6583bf6..14287d87fd 100644 --- a/engines/toon/movie.h +++ b/engines/toon/movie.h @@ -53,9 +53,8 @@ public: bool isPlaying() { return _playing; } protected: - bool playVideo(bool isFirstIntroVideo); + void playVideo(bool isFirstIntroVideo); ToonEngine *_vm; - Audio::Mixer *_mixer; ToonstruckSmackerDecoder *_decoder; bool _playing; }; diff --git a/engines/toon/path.cpp b/engines/toon/path.cpp index 7914aed595..336847e73c 100644 --- a/engines/toon/path.cpp +++ b/engines/toon/path.cpp @@ -152,6 +152,8 @@ PathFinding::PathFinding() { _heap = new PathFindingHeap(); _sq = NULL; _numBlockingRects = 0; + + _currentMask = nullptr; } PathFinding::~PathFinding(void) { diff --git a/engines/toon/picture.cpp b/engines/toon/picture.cpp index 65cc3a70e1..4927f50e08 100644 --- a/engines/toon/picture.cpp +++ b/engines/toon/picture.cpp @@ -134,6 +134,11 @@ bool Picture::loadPicture(const Common::String &file) { Picture::Picture(ToonEngine *vm) : _vm(vm) { _data = NULL; _palette = NULL; + + _width = 0; + _height = 0; + _paletteEntries = 0; + _useFullPalette = false; } Picture::~Picture() { diff --git a/engines/toon/resource.cpp b/engines/toon/resource.cpp index 2d419ec027..ffcabbd348 100644 --- a/engines/toon/resource.cpp +++ b/engines/toon/resource.cpp @@ -285,6 +285,7 @@ void PakFile::close() { } PakFile::PakFile() { + _numFiles = 0; } PakFile::~PakFile() { diff --git a/engines/toon/resource.h b/engines/toon/resource.h index c80ac2216e..b432a1d335 100644 --- a/engines/toon/resource.h +++ b/engines/toon/resource.h @@ -53,7 +53,6 @@ protected: uint32 _numFiles; Common::Array<File> _files; - Common::File *_fileHandle; }; class ToonEngine; diff --git a/engines/toon/script.cpp b/engines/toon/script.cpp index 69ae727bb5..d752c277db 100644 --- a/engines/toon/script.cpp +++ b/engines/toon/script.cpp @@ -59,6 +59,8 @@ EMCInterpreter::EMCInterpreter(ToonEngine *vm) : _vm(vm), _scriptData(0), _filen }; _opcodes = opcodes; #undef OPCODE + + _parameter = 0; } EMCInterpreter::~EMCInterpreter() { @@ -132,8 +134,7 @@ bool EMCInterpreter::load(const char *filename, EMCData *scriptData, const Commo _scriptData->sysFuncs = opcodes; - strncpy(_scriptData->filename, filename, 13); - _scriptData->filename[12] = 0; + Common::strlcpy(_scriptData->filename, filename, 13); _scriptData = 0; _filename = 0; diff --git a/engines/toon/script_func.cpp b/engines/toon/script_func.cpp index 1fa4058114..70baaaef22 100644 --- a/engines/toon/script_func.cpp +++ b/engines/toon/script_func.cpp @@ -1060,9 +1060,9 @@ int32 ScriptFunc::sys_Cmd_Set_Location_Data(EMCState *state) { // initial setup of locations int32 locationId = stackPos(0); debugC(0, 0, "setlocationdata(%d) %s %x %s %s %d %d", locationId, GetText(1, state), stackPos(2), GetText(3, state), GetText(4, state), stackPos(5), stackPos(6)); - strcpy(_vm->state()->_locations[locationId]._name, GetText(1, state)); - strcpy(_vm->state()->_locations[locationId]._music, GetText(3, state)); - strcpy(_vm->state()->_locations[locationId]._cutaway, GetText(4, state)); + Common::strlcpy(_vm->state()->_locations[locationId]._name, GetText(1, state), 64); + Common::strlcpy(_vm->state()->_locations[locationId]._music, GetText(3, state), 64); + Common::strlcpy(_vm->state()->_locations[locationId]._cutaway, GetText(4, state), 64); _vm->state()->_locations[locationId]._flags = stackPos(2); _vm->state()->_locations[locationId]._visited = false; _vm->state()->_locations[locationId]._numSceneAnimations = stackPos(5); diff --git a/engines/toon/state.cpp b/engines/toon/state.cpp index 8e4abbd709..fffa8cf529 100644 --- a/engines/toon/state.cpp +++ b/engines/toon/state.cpp @@ -115,6 +115,10 @@ State::State(void) { #endif memset(_conversationState, 0, sizeof(Conversation) * 60); + + _conversationData = nullptr; + _currentConversationId = -1; + _exitConversation = true; } State::~State(void) { diff --git a/engines/toon/tools.cpp b/engines/toon/tools.cpp index added39940..f5c77aca69 100644 --- a/engines/toon/tools.cpp +++ b/engines/toon/tools.cpp @@ -136,6 +136,13 @@ uint32 decompressSPCN(byte *src, byte *dst, uint32 dstsize) { RncDecoder::RncDecoder() { initCrc(); + + _bitBuffl = 0; + _bitBuffh = 0; + _bitCount = 0; + _srcPtr = nullptr; + _dstPtr = nullptr; + _inputByteLeft = 0; } RncDecoder::~RncDecoder() { } diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp index 286bcf1941..a97bfd55e8 100644 --- a/engines/toon/toon.cpp +++ b/engines/toon/toon.cpp @@ -922,6 +922,36 @@ ToonEngine::ToonEngine(OSystem *syst, const ADGameDescription *gameDescription) _gameVariant = 0; break; } + + for (int i = 0; i < 64; i++) { + _sceneAnimationScripts[i]._lastTimer = 0; + _sceneAnimationScripts[i]._frozen = false; + _sceneAnimationScripts[i]._frozenForConversation = false; + _sceneAnimationScripts[i]._active = false; + } + + _lastProcessedSceneScript = 0; + _animationSceneScriptRunFlag = false; + _updatingSceneScriptRunFlag = false; + _dirtyAll = false; + _cursorOffsetX = 0; + _cursorOffsetY = 0; + _currentTextLine = 0; + _currentTextLineId = 0; + _currentTextLineX = 0; + _currentTextLineY = 0; + _currentTextLineCharacterId = -1; + _oldScrollValue = 0; + _drew = nullptr; + _flux = nullptr; + _currentHotspotItem = 0; + _shouldQuit = false; + _scriptStep = 0; + _oldTimer = 0; + _oldTimer2 = 0; + _lastRenderTime = 0; + _firstFrame = false; + _needPaletteFlush = true; } ToonEngine::~ToonEngine() { |