void CTargaDecode::decode(OSVideoSurface &surface, const CString &name) { // Open up the resource StdCWadFile file; file.open(name); // Use the ScucmmVM deoder to decode it loadStream(*file.readStream()); const Graphics::Surface *srcSurf = getSurface(); // Resize the surface if necessary if (!surface.hasSurface() || surface.getWidth() != srcSurf->w || surface.getHeight() != srcSurf->h) surface.recreate(srcSurf->w, srcSurf->h); // Convert the decoded surface to the correct pixel format, and then copy it over surface.lock(); Graphics::Surface *convertedSurface = srcSurf->convertTo(surface._rawSurface->format); Common::copy((byte *)convertedSurface->getPixels(), (byte *)convertedSurface->getPixels() + surface.getPitch() * surface.getHeight(), (byte *)surface._rawSurface->getPixels()); convertedSurface->free(); delete convertedSurface; surface.unlock(); }
bool CWaveFile::loadMusic(const CString &name) { assert(!_stream); StdCWadFile file; if (!file.open(name)) return false; Common::SeekableReadStream *stream = file.readStream(); _size = stream->size(); _stream = Audio::makeWAVStream(stream->readStream(_size), DisposeAfterUse::YES); _soundType = Audio::Mixer::kMusicSoundType; return true; }