aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-26 18:20:58 +0200
committerEinar Johan Trøan Sømåen2012-07-26 18:20:58 +0200
commite9a847fb352dd0e59fe45fd27c41a93d40f2bd1f (patch)
tree439a01e682d22a46bb5502e3073628ba88ee990b /engines/wintermute
parentf5cbee18f86de7c5c423fc855c8466e6ce01c714 (diff)
downloadscummvm-rg350-e9a847fb352dd0e59fe45fd27c41a93d40f2bd1f.tar.gz
scummvm-rg350-e9a847fb352dd0e59fe45fd27c41a93d40f2bd1f.tar.bz2
scummvm-rg350-e9a847fb352dd0e59fe45fd27c41a93d40f2bd1f.zip
WINTERMUTE: Remove #if 0 - commented out code.
Diffstat (limited to 'engines/wintermute')
-rw-r--r--engines/wintermute/base/base_game.cpp18
-rw-r--r--engines/wintermute/base/base_game.h2
-rw-r--r--engines/wintermute/base/gfx/base_image.cpp8
-rw-r--r--engines/wintermute/base/gfx/osystem/base_render_osystem.cpp49
-rw-r--r--engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp134
-rw-r--r--engines/wintermute/base/gfx/osystem/base_surface_osystem.h2
-rw-r--r--engines/wintermute/base/sound/base_sound_buffer.cpp93
-rw-r--r--engines/wintermute/base/sound/base_sound_manager.cpp17
-rw-r--r--engines/wintermute/base/sound/base_sound_manager.h1
-rw-r--r--engines/wintermute/video/video_theora_player.cpp264
-rw-r--r--engines/wintermute/video/video_theora_player.h1
11 files changed, 16 insertions, 573 deletions
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp
index 9de183660e..41ea01dffd 100644
--- a/engines/wintermute/base/base_game.cpp
+++ b/engines/wintermute/base/base_game.cpp
@@ -616,7 +616,6 @@ bool BaseGame::initLoop() {
getDebugMgr()->onGameTick();
_renderer->initLoop();
- _soundMgr->initLoop();
updateMusicCrossfade();
_surfaceStorage->initLoop();
@@ -4023,17 +4022,12 @@ void BaseGame::setWindowTitle() {
if (_textEncoding == TEXT_UTF8) {
utf8Title = Utf8String(title);
} else {
- warning("BaseGame::SetWindowTitle -Ignoring textencoding");
+ warning("BaseGame::SetWindowTitle - Ignoring textencoding");
utf8Title = Utf8String(title);
/* WideString wstr = StringUtil::AnsiToWide(Title);
title = StringUtil::WideToUtf8(wstr);*/
}
-#if 0
- BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_renderer);
- // TODO
-
- SDL_SetWindowTitle(renderer->GetSdlWindow(), title.c_str());
-#endif
+ warning("BaseGame::SetWindowTitle: Ignoring value: %s", utf8Title.c_str());
}
}
@@ -4722,18 +4716,14 @@ void BaseGame::getMousePos(Point32 *pos) {
}
//////////////////////////////////////////////////////////////////////////
-bool BaseGame::miniUpdate() {
+void BaseGame::miniUpdate() { // TODO: Is this really necessary, it used to update sound, but the mixer does that now.
if (!_miniUpdateEnabled) {
- return STATUS_OK;
+ return;
}
if (g_system->getMillis() - _lastMiniUpdate > 200) {
- if (_soundMgr) {
- _soundMgr->initLoop();
- }
_lastMiniUpdate = g_system->getMillis();
}
- return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h
index 8da62af40a..08d1869452 100644
--- a/engines/wintermute/base/base_game.h
+++ b/engines/wintermute/base/base_game.h
@@ -89,7 +89,7 @@ public:
uint32 _lastMiniUpdate;
bool _miniUpdateEnabled;
- virtual bool miniUpdate();
+ virtual void miniUpdate();
void getMousePos(Point32 *Pos);
Rect32 _mouseLockRect;
diff --git a/engines/wintermute/base/gfx/base_image.cpp b/engines/wintermute/base/gfx/base_image.cpp
index 571deed793..628bffff55 100644
--- a/engines/wintermute/base/gfx/base_image.cpp
+++ b/engines/wintermute/base/gfx/base_image.cpp
@@ -114,6 +114,7 @@ bool BaseImage::saveBMPFile(const char *filename) const {
//////////////////////////////////////////////////////////////////////////
bool BaseImage::resize(int newWidth, int newHeight) {
+ warning("BaseImage::resize(%d, %d), stubbed", newWidth, newHeight);
#if 0
if (!_bitmap) {
return STATUS_FAILED;
@@ -128,13 +129,6 @@ bool BaseImage::resize(int newWidth, int newHeight) {
FIBITMAP *newImg = FreeImage_Rescale(_bitmap, NewWidth, NewHeight, FILTER_BILINEAR);
- if (newImg) {
- FreeImage_Unload(_bitmap);
- _bitmap = newImg;
- return STATUS_OK;
- } else {
- return STATUS_FAILED;
- }
#endif
return false;
}
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
index e465194e58..6913b3434c 100644
--- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
@@ -114,25 +114,10 @@ BaseRenderOSystem::BaseRenderOSystem(BaseGame *inGame) : BaseRenderer(inGame) {
BaseRenderOSystem::~BaseRenderOSystem() {
_renderSurface->free();
delete _renderSurface;
-#if 0
- if (_renderer) {
- SDL_DestroyRenderer(_renderer);
- }
- if (_win) {
- SDL_DestroyWindow(_win);
- }
- SDL_Quit();
-#endif
}
//////////////////////////////////////////////////////////////////////////
bool BaseRenderOSystem::initRenderer(int width, int height, bool windowed) {
- //if (SDL_Init(SDL_INIT_VIDEO) < 0) return STATUS_FAILED;
-
-#if 0
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
- SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 1);
-#endif
_width = width;
_height = height;
_renderRect.setWidth(_width);
@@ -192,15 +177,7 @@ bool BaseRenderOSystem::initRenderer(int width, int height, bool windowed) {
_ratioX = (float)(_realWidth - _borderLeft - _borderRight) / (float)_width;
_ratioY = (float)(_realHeight - _borderTop - _borderBottom) / (float)_height;
-#if 0
- Uint32 flags = SDL_WINDOW_SHOWN;
-#endif
-#ifdef __IPHONEOS__
- //flags |= SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS;
-#endif
-
- //_windowed = _gameRef->_registry->readBool("Video", "Windowed", true);
-// if (!windowed) flags |= SDL_WINDOW_FULLSCREEN;
+ //_windowed = _gameRef->_registry->readBool("Video", "Windowed", true); TODO
Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0);
g_system->beginGFXTransaction();
@@ -211,33 +188,9 @@ bool BaseRenderOSystem::initRenderer(int width, int height, bool windowed) {
warning("Couldn't setup GFX-backend for %dx%dx%d", _width, _height, format.bytesPerPixel * 8);
return STATUS_FAILED;
}
-#if 0
- _win = SDL_CreateWindow("WME Lite",
- SDL_WINDOWPOS_UNDEFINED,
- SDL_WINDOWPOS_UNDEFINED,
- _realWidth, _realHeight,
- flags);
-
- if (!_win) {
- return STATUS_FAILED;
- }
-#endif
g_system->showMouse(false);
-#ifdef __IPHONEOS__
- // SDL defaults to OGL ES2, which doesn't work on old devices
- //SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengles");
-#else
- //SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
-#endif
-#if 0
- _renderer = SDL_CreateRenderer(_win, -1, 0);
-
- if (!_renderer) {
- return STATUS_FAILED;
- }
-#endif
_renderSurface->create(g_system->getWidth(), g_system->getHeight(), g_system->getScreenFormat());
_active = true;
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
index 4b680e2793..b77abf6a79 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
@@ -131,11 +131,7 @@ bool BaseSurfaceOSystem::finishLoad() {
bool isSaveGameGrayscale = scumm_strnicmp(_filename.c_str(), "savegame:", 9) == 0 && (_filename.c_str()[_filename.size() - 1] == 'g' || _filename.c_str()[_filename.size() - 1] == 'G');
if (isSaveGameGrayscale) {
warning("grayscaleConversion not yet implemented");
- /* FIBITMAP *newImg = FreeImage_ConvertToGreyscale(img);
- if (newImg) {
- FreeImage_Unload(img);
- img = newImg;
- }*/
+ // FIBITMAP *newImg = FreeImage_ConvertToGreyscale(img); TODO
}
// no alpha, set color key
@@ -161,31 +157,6 @@ bool BaseSurfaceOSystem::finishLoad() {
}
_hasAlpha = hasTransparency(_surface);
- //SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "best"); //TODO
- //_texture = SdlUtil::CreateTextureFromSurface(renderer->GetSdlRenderer(), surf);
-
- // This particular warning is rather messy, as this function is called a ton,
- // thus we avoid printing it more than once.
- static bool hasWarned = false;
- if (!hasWarned) {
- warning("Surface-textures not fully ported yet");
- hasWarned = true;
- }
- //delete imgDecoder;
-#if 0
- _texture = SDL_CreateTextureFromSurface(renderer->GetSdlRenderer(), surf);
- if (!_texture) {
- SDL_FreeSurface(surf);
- delete imgDecoder;
- return STATUS_FAILED;
- }
-
- GenAlphaMask(surf);
-
- SDL_FreeSurface(surf);
- delete imgDecoder; // TODO: Update this if ImageDecoder doesn't end up owning the surface.
-#endif
-
_valid = true;
_gameRef->addMem(_width * _height * 4);
@@ -207,9 +178,7 @@ void BaseSurfaceOSystem::genAlphaMask(Graphics::Surface *surface) {
if (!surface) {
return;
}
-#if 0
- SDL_LockSurface(surface);
-#endif
+
bool hasColorKey;
/* uint32 colorKey; */
uint8 ckRed, ckGreen, ckBlue;
@@ -239,9 +208,7 @@ void BaseSurfaceOSystem::genAlphaMask(Graphics::Surface *surface) {
}
}
}
-#if 0
- SDL_UnlockSurface(surface);
-#endif
+
if (!hasTransparency) {
delete[] _alphaMask;
_alphaMask = NULL;
@@ -286,11 +253,6 @@ uint32 BaseSurfaceOSystem::getPixel(Graphics::Surface *surface, int x, int y) {
//////////////////////////////////////////////////////////////////////////
bool BaseSurfaceOSystem::create(int width, int height) {
- warning("BaseSurfaceOSystem::Create not ported yet"); //TODO
-#if 0
- BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer);
- _texture = SDL_CreateTexture(renderer->GetSdlRenderer(), SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, Width, Height);
-#endif
_width = width;
_height = height;
@@ -302,68 +264,16 @@ bool BaseSurfaceOSystem::create(int width, int height) {
}
//////////////////////////////////////////////////////////////////////////
-bool BaseSurfaceOSystem::createFromSDLSurface(Graphics::Surface *surface) {
- warning("BaseSurfaceOSystem::CreateFromSDLSurface not ported yet"); //TODO
-#if 0
- BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer);
- _texture = SDL_CreateTextureFromSurface(renderer->GetSdlRenderer(), surface);
-#endif
- if (_surface) {
- _surface->free();
- delete _surface;
- _surface = NULL;
- }
- _surface = new Graphics::Surface();
- _surface->copyFrom(*surface);
- _width = surface->w;
- _height = surface->h;
-#if 0
- _gameRef->AddMem(_width * _height * 4);
-#endif
- _valid = true;
-
- return STATUS_OK;
-}
-
-//////////////////////////////////////////////////////////////////////////
bool BaseSurfaceOSystem::isTransparentAt(int x, int y) {
- // This particular warning is rather messy, as this function is called a ton,
- // thus we avoid printing it more than once.
- static bool hasWarned = false;
- if (!hasWarned) {
- warning("BaseSurfaceOSystem::IsTransparentAt not ported yet");
- hasWarned = true;
- }
-#if 0
- int access;
- int width, height;
- //SDL_QueryTexture(_texture, NULL, &access, &width, &height); //TODO
- //if (access != SDL_TEXTUREACCESS_STREAMING) return false;
- if (X < 0 || X >= width || Y < 0 || Y >= height) {
- return true;
- }
-
-
- StartPixelOp();
- bool ret = isTransparentAtLite(X, Y);
- EndPixelOp();
-
- return ret;
-#endif
- return 0;
+ return isTransparentAtLite(x, y);
}
//////////////////////////////////////////////////////////////////////////
bool BaseSurfaceOSystem::isTransparentAtLite(int x, int y) {
- //if (!_lockPixels) return false;
-
- // This particular warning is rather messy, as this function is called a ton,
- // thus we avoid printing it more than once.
- static bool hasWarned = false;
- if (!hasWarned) {
- warning("BaseSurfaceOSystem::IsTransparentAtLite not ported yet");
- hasWarned = true;
+ if (x < 0 || x >= _surface->w || y < 0 || y >= _surface->h) {
+ return true;
}
+
if (_surface->format.bytesPerPixel == 4) {
uint32 pixel = *(uint32 *)_surface->getBasePtr(x, y);
uint8 r, g, b, a;
@@ -374,35 +284,8 @@ bool BaseSurfaceOSystem::isTransparentAtLite(int x, int y) {
return false;
}
}
-#if 0
- uint32 format;
- int access;
- int width, height;
-
- //SDL_QueryTexture(_texture, &format, &access, &width, &height);
- //if (access != SDL_TEXTUREACCESS_STREAMING) return false;
- if (X < 0 || X >= width || Y < 0 || Y >= height) {
- return true;
- }
- if (!_alphaMask) {
- return false;
- } else {
- return _alphaMask[Y * width + X] <= 128;
- }
-#endif
return false;
- /*
- Uint32* dst = (Uint32*)((Uint8*)_lockPixels + Y * _lockPitch);
- Uint32 pixel = dst[X];
-
- SDL_PixelFormat* pixelFormat = SDL_AllocFormat(format);
- Uint8 r, g, b, a;
- SDL_GetRGBA(pixel, pixelFormat, &r, &g, &b, &a);
- SDL_FreeFormat(pixelFormat);
-
- return a <= 128;
- */
}
//////////////////////////////////////////////////////////////////////////
@@ -533,9 +416,6 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, flo
}
renderer->drawSurface(this, _surface, &srcRect, &position, mirrorX, mirrorY);
-#if 0
- SDL_RenderCopy(renderer->GetSdlRenderer(), _texture, &srcRect, &position);
-#endif
return STATUS_OK;
}
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
index 3a8d64703f..9ed80cec50 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
@@ -44,8 +44,6 @@ public:
bool create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false);
bool create(int width, int height);
- bool createFromSDLSurface(Graphics::Surface *surface); //TODO: Rename function
-
bool isTransparentAt(int x, int y);
bool isTransparentAtLite(int x, int y);
diff --git a/engines/wintermute/base/sound/base_sound_buffer.cpp b/engines/wintermute/base/sound/base_sound_buffer.cpp
index f2db0a18fb..d94f8c61b6 100644
--- a/engines/wintermute/base/sound/base_sound_buffer.cpp
+++ b/engines/wintermute/base/sound/base_sound_buffer.cpp
@@ -129,63 +129,6 @@ bool BaseSoundBuffer::loadFromFile(const char *filename, bool forceReload) {
BaseUtils::setString(&_filename, filename);
return STATUS_OK;
-#if 0
- BASS_FILEPROCS fileProc;
- fileProc.close = BaseSoundBuffer::FileCloseProc;
- fileProc.read = BaseSoundBuffer::FileReadProc;
- fileProc.seek = BaseSoundBuffer::FileSeekProc;
- fileProc.length = BaseSoundBuffer::FileLenProc;
-
- _stream = BASS_StreamCreateFileUser(STREAMFILE_NOBUFFER, 0, &fileProc, (void *)_file);
- if (!_stream) {
- _gameRef->LOG(0, "BASS error: %d while loading '%s'", BASS_ErrorGetCode(), filename);
- return STATUS_FAILED;
- }
-
- BaseUtils::setString(&_filename, filename);
-
- /*
- bool res;
- bool NewlyCreated = false;
-
- if (!_soundBuffer || ForceReload || _streamed){
- if (!_file) _file = _gameRef->_fileManager->openFile(filename);
- if (!_file){
- _gameRef->LOG(0, "Error opening sound file '%s'", filename);
- return STATUS_FAILED;
- }
- // switch to streamed for big files
- if (!_streamed && (_file->GetSize() > MAX_NONSTREAMED_FILE_SIZE && !_gameRef->_forceNonStreamedSounds)) SetStreaming(true);
- }
-
- // create buffer
- if (!_soundBuffer){
- NewlyCreated = true;
-
- res = InitializeBuffer(_file);
- if (DID_FAIL(res)){
- _gameRef->LOG(res, "Error creating sound buffer for file '%s'", filename);
- return res;
- }
- }
-
-
-
- // store filename
- if (!_filename){
- _filename = new char[strlen(filename)+1];
- strcpy(_filename, filename);
- }
-
- // close file (if not streaming)
- if (!_streamed && _file){
- _gameRef->_fileManager->closeFile(_file);
- _file = NULL;
- }
- */
-
- return STATUS_OK;
-#endif
}
@@ -215,15 +158,8 @@ bool BaseSoundBuffer::play(bool looping, uint32 startSample) {
//////////////////////////////////////////////////////////////////////////
void BaseSoundBuffer::setLooping(bool looping) {
- warning("BSoundBuffer::SetLooping(%d) - won't change a playing sound", looping);
+ warning("BSoundBuffer::SetLooping(%d) - won't change a playing sound", looping); // TODO
_looping = looping;
-#if 0
-
-
- if (_stream) {
- BASS_ChannelFlags(_stream, looping ? BASS_SAMPLE_LOOP : 0, BASS_SAMPLE_LOOP);
- }
-#endif
}
//////////////////////////////////////////////////////////////////////////
@@ -314,42 +250,15 @@ uint32 BaseSoundBuffer::getPosition() {
//////////////////////////////////////////////////////////////////////////
bool BaseSoundBuffer::setPosition(uint32 pos) {
warning("BaseSoundBuffer::SetPosition - not implemented yet");
-#if 0
- if (_stream) {
- QWORD pos = BASS_ChannelSeconds2Bytes(_stream, (float)Pos / 1000.0f);
- BASS_ChannelSetPosition(_stream, pos, BASS_POS_BYTE);
- }
-#endif
return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
bool BaseSoundBuffer::setLoopStart(uint32 pos) {
_loopStart = pos;
-#if 0
- if (_stream) {
- if (_sync) {
- BASS_ChannelRemoveSync(_stream, _sync);
- _sync = NULL;
- }
- if (_loopStart > 0) {
- QWORD len = BASS_ChannelGetLength(_stream, BASS_POS_BYTE);
- _sync = BASS_ChannelSetSync(_stream, BASS_SYNC_POS | BASS_SYNC_MIXTIME, len, BaseSoundBuffer::LoopSyncProc, (void *)this);
- }
- }
-#endif
return STATUS_OK;
}
-#if 0
-//////////////////////////////////////////////////////////////////////////
-void BaseSoundBuffer::LoopSyncProc(HSYNC handle, uint32 channel, uint32 data, void *user) {
- BaseSoundBuffer *soundBuf = static_cast<BaseSoundBuffer *>(user);
- QWORD pos = BASS_ChannelSeconds2Bytes(channel, (float)soundBuf->GetLoopStart() / 1000.0f);
- if (!BASS_ChannelSetPosition(channel, pos, BASS_POS_BYTE))
- BASS_ChannelSetPosition(channel, 0, BASS_POS_BYTE);
-}
-#endif
//////////////////////////////////////////////////////////////////////////
bool BaseSoundBuffer::setPan(float pan) {
if (_handle) {
diff --git a/engines/wintermute/base/sound/base_sound_manager.cpp b/engines/wintermute/base/sound/base_sound_manager.cpp
index 74aae59e3d..d2e640e3f3 100644
--- a/engines/wintermute/base/sound/base_sound_manager.cpp
+++ b/engines/wintermute/base/sound/base_sound_manager.cpp
@@ -65,9 +65,6 @@ bool BaseSoundMgr::cleanup() {
delete _sounds[i];
}
_sounds.clear();
-#if 0
- BASS_Free();
-#endif
return STATUS_OK;
}
@@ -91,20 +88,6 @@ bool BaseSoundMgr::initialize() {
return STATUS_OK;
}
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundMgr::initLoop() {
- if (!_soundAvailable) {
- return STATUS_OK;
- }
-#if 0
-
- BASS_Update(500);
-#endif
- return STATUS_OK;
-}
-
-
//////////////////////////////////////////////////////////////////////////
BaseSoundBuffer *BaseSoundMgr::addSound(const char *filename, Audio::Mixer::SoundType type, bool streamed) {
if (!_soundAvailable) {
diff --git a/engines/wintermute/base/sound/base_sound_manager.h b/engines/wintermute/base/sound/base_sound_manager.h
index 53caffbe61..464330c733 100644
--- a/engines/wintermute/base/sound/base_sound_manager.h
+++ b/engines/wintermute/base/sound/base_sound_manager.h
@@ -55,7 +55,6 @@ public:
bool removeSound(BaseSoundBuffer *sound);
BaseSoundBuffer *addSound(const char *filename, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType, bool streamed = false);
bool addSound(BaseSoundBuffer *sound, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType);
- bool initLoop();
bool initialize();
bool _soundAvailable;
BaseSoundMgr(BaseGame *inGame);
diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp
index 07e2fc022d..59c83c3a52 100644
--- a/engines/wintermute/video/video_theora_player.cpp
+++ b/engines/wintermute/video/video_theora_player.cpp
@@ -28,7 +28,6 @@
#include "engines/wintermute/video/video_theora_player.h"
-#include "engines/wintermute/base/base.h"
#include "engines/wintermute/base/base_game.h"
#include "engines/wintermute/base/base_file_manager.h"
#include "engines/wintermute/base/gfx/osystem/base_surface_osystem.h"
@@ -38,7 +37,6 @@
#include "engines/wintermute/platform_osystem.h"
#include "engines/wintermute/video/decoders/theora_decoder.h"
#include "common/system.h"
-//#pragma comment(lib, "libtheora.lib")
namespace WinterMute {
@@ -87,10 +85,6 @@ void VideoTheoraPlayer::SetDefaults() {
_volume = 100;
_theoraDecoder = NULL;
#if 0
- _vorbisStreams = _theoraStreams = 0;
-
- GenLookupTables();
-
_subtitler = NULL;
#endif
}
@@ -120,16 +114,6 @@ void VideoTheoraPlayer::cleanup() {
_alphaImage = NULL;
delete _texture;
_texture = NULL;
-#if 0
- if (m_Sound) {
- _gameRef->m_SoundMgr->RemoveSound(m_Sound);
- m_Sound = NULL;
- }
-
- SAFE_DELETE_ARRAY(m_AudioBuf);
- m_AudioBufFill = 0;
- m_AudioBufSize = 0;
-#endif
}
//////////////////////////////////////////////////////////////////////////
@@ -164,182 +148,6 @@ bool VideoTheoraPlayer::initialize(const Common::String &filename, const Common:
_playZoom = 100;
return STATUS_OK;
-#if 0
- cleanup();
-
- _file = _gameRef->_fileManager->openFile(filename);
- if (!_file) {
- return STATUS_FAILED;
- }
-
- if (filename != _filename) {
- BaseUtils::setString(&_filename, filename);
- }
-
- // start up Ogg stream synchronization layer
- ogg_sync_init(&m_OggSyncState);
-
- // init supporting Vorbis structures needed in header parsing
- vorbis_comment_init(&m_VorbisComment);
- vorbis_info_init(&m_VorbisInfo);
-
- // init supporting Theora structures needed in header parsing
- theora_comment_init(&m_TheoraComment);
- theora_info_init(&m_TheoraInfo);
-
-
-
- // Ogg file open; parse the headers
- // Only interested in Vorbis/Theora streams
- ogg_packet TempOggPacket;
- bool IsDone = false;
- while (!IsDone) {
- int bytesRead = BufferData(&m_OggSyncState);
- if (bytesRead == 0) {
- break;
- }
-
- while (ogg_sync_pageout(&m_OggSyncState, &m_OggPage) > 0) {
- ogg_stream_state OggStateTest;
-
- // is this a mandated initial header? If not, stop parsing
- if (!ogg_page_bos(&m_OggPage)) {
- // don't leak the page; get it into the appropriate stream
- if (m_TheoraStreams)
- ogg_stream_pagein(&m_TheoraStreamState, &m_OggPage);
- if (m_VorbisStreams)
- ogg_stream_pagein(&m_VorbisStreamState, &m_OggPage);
-
- IsDone = true;
- break;
- }
-
- ogg_stream_init(&OggStateTest, ogg_page_serialno(&m_OggPage));
- ogg_stream_pagein(&OggStateTest, &m_OggPage);
- ogg_stream_packetout(&OggStateTest, &TempOggPacket);
-
- // identify the codec: try theora
- if (!m_TheoraStreams && theora_decode_header(&m_TheoraInfo, &m_TheoraComment, &TempOggPacket) >= 0) {
- // it is theora
- memcpy(&m_TheoraStreamState, &OggStateTest, sizeof(OggStateTest));
- m_TheoraStreams = 1;
- } else if (!m_VorbisStreams && vorbis_synthesis_headerin(&m_VorbisInfo, &m_VorbisComment, &TempOggPacket) >= 0) {
- // it is vorbis
- memcpy(&m_VorbisStreamState, &OggStateTest, sizeof(OggStateTest));
- m_VorbisStreams = 1;
- } else {
- // whatever it is, we don't care about it
- ogg_stream_clear(&OggStateTest);
- }
- }
- }
-
- // we're expecting more header packets
- while ((m_TheoraStreams && m_TheoraStreams < 3) || (m_VorbisStreams && m_VorbisStreams < 3)) {
- int Ret;
-
- // look for further theora headers
- while (m_TheoraStreams && (m_TheoraStreams < 3) && (Ret = ogg_stream_packetout(&m_TheoraStreamState, &TempOggPacket))) {
- if (Ret < 0) {
- _gameRef->LOG(0, "Error parsing Theora stream headers; corrupt stream?");
- return STATUS_FAILED;
- }
- if (theora_decode_header(&m_TheoraInfo, &m_TheoraComment, &TempOggPacket)) {
- _gameRef->LOG(0, "Error parsing Theora stream headers; corrupt stream?");
- return STATUS_FAILED;
- }
- m_TheoraStreams++;
- if (m_TheoraStreams == 3) break;
- }
-
- /* look for more vorbis header packets */
- while (m_VorbisStreams && (m_VorbisStreams < 3) && (Ret = ogg_stream_packetout(&m_VorbisStreamState, &TempOggPacket))) {
- if (Ret < 0) {
- _gameRef->LOG(0, "Error parsing Vorbis stream headers; corrupt stream?");
- return STATUS_FAILED;
- }
- if (vorbis_synthesis_headerin(&m_VorbisInfo, &m_VorbisComment, &TempOggPacket)) {
- _gameRef->LOG(0, "Error parsing Vorbis stream headers; corrupt stream?");
- return STATUS_FAILED;
- }
- m_VorbisStreams++;
- if (m_VorbisStreams == 3) break;
- }
-
- // The header pages/packets will arrive before anything else we
- // care about, or the stream is not obeying spec
- if (ogg_sync_pageout(&m_OggSyncState, &m_OggPage) > 0) {
- if (m_TheoraStreams)
- ogg_stream_pagein(&m_TheoraStreamState, &m_OggPage);
- if (m_VorbisStreams)
- ogg_stream_pagein(&m_VorbisStreamState, &m_OggPage);
- } else {
- int Ret = BufferData(&m_OggSyncState); // someone needs more data
- if (Ret == 0) {
- _gameRef->LOG(0, "End of file while searching for codec headers");
- return STATUS_FAILED;
- }
- }
- }
-
-
-
- // and now we have it all. initialize decoders
- if (m_TheoraStreams) {
- theora_decode_init(&m_TheoraState, &m_TheoraInfo);
- } else {
- // tear down the partial theora setup
- theora_info_clear(&m_TheoraInfo);
- theora_comment_clear(&m_TheoraComment);
- }
-
- if (m_VorbisStreams) {
- vorbis_synthesis_init(&m_VorbisDSPState, &m_VorbisInfo);
- vorbis_block_init(&m_VorbisDSPState, &m_VorbisBlock);
-
- } else {
- // tear down the partial vorbis setup
- vorbis_info_clear(&m_VorbisInfo);
- vorbis_comment_clear(&m_VorbisComment);
- }
-
- bool Res = STATUS_OK;
-
- // create sound buffer
- if (m_VorbisStreams && _gameRef->m_SoundMgr->m_SoundAvailable) {
- m_Sound = new BaseSoundTheora(_gameRef);
- _gameRef->m_SoundMgr->AddSound(m_Sound);
- if (DID_FAIL(Res = m_Sound->InitializeBuffer(this))) {
- _gameRef->m_SoundMgr->RemoveSound(m_Sound);
- m_Sound = NULL;
- _gameRef->LOG(Res, "Error initializing sound buffer for Theora file '%s'", filename);
- } else {
- SAFE_DELETE_ARRAY(m_AudioBuf);
- m_AudioBufSize = m_Sound->m_StreamBlockSize;
- m_AudioBuf = new ogg_int16_t[m_AudioBufSize];
- }
- }
-
- // create texture
- if (m_TheoraStreams && !m_Texture) {
- if (_gameRef->m_UseD3D) {
- m_Texture = new BaseSurfaceD3D(_gameRef);
- } else {
- m_Texture = new BaseSurfaceDD(_gameRef);
- }
-
- if (!m_Texture || DID_FAIL(Res = m_Texture->Create(m_TheoraInfo.width, m_TheoraInfo.height))) {
- SAFE_DELETE(m_Texture);
- }
- }
-
-
- if (!m_Subtitler) m_Subtitler = new CVidSubtitler(_gameRef);
- if (m_Subtitler && _gameRef->m_VideoSubtitles) m_Subtitler->LoadSubtitles(filename, SubtitleFile);
-
- return Res;
-#endif
- return STATUS_FAILED;
}
@@ -420,45 +228,6 @@ bool VideoTheoraPlayer::play(TVideoPlayback type, int x, int y, bool freezeGame,
}
return STATUS_OK;
#if 0
-
- m_State = THEORA_STATE_PLAYING;
-
- m_Looping = Looping;
- m_PlaybackType = Type;
-
- float Width, Height;
- if (m_TheoraStreams) {
- Width = (float)m_TheoraInfo.width;
- Height = (float)m_TheoraInfo.height;
- } else {
- Width = (float)_gameRef->m_Renderer->m_Width;
- Height = (float)_gameRef->m_Renderer->m_Height;
- }
-
- switch (Type) {
- case VID_PLAY_POS:
- m_PlayZoom = ForceZoom;
- m_PosX = X;
- m_PosY = Y;
- break;
-
- case VID_PLAY_STRETCH: {
- float ZoomX = (float)((float)_gameRef->m_Renderer->m_Width / Width * 100);
- float ZoomY = (float)((float)_gameRef->m_Renderer->m_Height / Height * 100);
- m_PlayZoom = min(ZoomX, ZoomY);
- m_PosX = (_gameRef->m_Renderer->m_Width - Width * (m_PlayZoom / 100)) / 2;
- m_PosY = (_gameRef->m_Renderer->m_Height - Height * (m_PlayZoom / 100)) / 2;
- }
- break;
-
- case VID_PLAY_CENTER:
- m_PlayZoom = 100.0f;
- m_PosX = (_gameRef->m_Renderer->m_Width - Width) / 2;
- m_PosY = (_gameRef->m_Renderer->m_Height - Height) / 2;
- break;
- }
-
-
if (StartTime) SeekToTime(StartTime);
Update();
@@ -473,11 +242,7 @@ bool VideoTheoraPlayer::stop() {
if (_freezeGame) {
_gameRef->unfreeze();
}
-#if 0
- if (m_Sound) m_Sound->Stop();
- m_State = THEORA_STATE_FINISHED;
- if (m_FreezeGame) _gameRef->Unfreeze();
-#endif
+
return STATUS_OK;
}
@@ -623,22 +388,6 @@ uint32 VideoTheoraPlayer::getMovieTime() {
}
}
-
-//////////////////////////////////////////////////////////////////////////
-uint32 VideoTheoraPlayer::getMovieFrame() {
-#if 0
- if (!m_TheoraStreams) return 0;
- float Time = GetMovieTime();
-
- return Time / ((double)m_TheoraInfo.fps_denominator / m_TheoraInfo.fps_numerator);
-#endif
- if (_theoraDecoder) {
- return _theoraDecoder->getTime();
- } else {
- return 0;
- }
-}
-
//////////////////////////////////////////////////////////////////////////
bool VideoTheoraPlayer::WriteVideo() {
if (!_texture) {
@@ -718,17 +467,6 @@ bool VideoTheoraPlayer::setAlphaImage(const Common::String &filename) {
_alphaFilename = filename;
}
//TODO: Conversion.
-#if 0
- SAFE_DELETE(m_AlphaImage);
- m_AlphaImage = new BaseImage(_gameRef);
- if (!m_AlphaImage || DID_FAIL(m_AlphaImage->loadFile(filename))) {
- SAFE_DELETE(m_AlphaImage);
- SAFE_DELETE_ARRAY(m_AlphaFilename);
- return STATUS_FAILED;
- }
- if (m_AlphaFilename != Filename) BaseUtils::setString(&m_AlphaFilename, filename);
- m_AlphaImage->Convert(IMG_TRUECOLOR);
-#endif
return STATUS_OK;
}
diff --git a/engines/wintermute/video/video_theora_player.h b/engines/wintermute/video/video_theora_player.h
index 3d17aed31e..58fe700d75 100644
--- a/engines/wintermute/video/video_theora_player.h
+++ b/engines/wintermute/video/video_theora_player.h
@@ -84,7 +84,6 @@ public:
};
uint32 getMovieTime();
- uint32 getMovieFrame();
BaseSurface *getTexture();