diff options
Diffstat (limited to 'engines/wintermute/base')
-rw-r--r-- | engines/wintermute/base/base_game.cpp | 18 | ||||
-rw-r--r-- | engines/wintermute/base/base_game.h | 2 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/base_image.cpp | 8 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/osystem/base_render_osystem.cpp | 49 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp | 134 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/osystem/base_surface_osystem.h | 2 | ||||
-rw-r--r-- | engines/wintermute/base/sound/base_sound_buffer.cpp | 93 | ||||
-rw-r--r-- | engines/wintermute/base/sound/base_sound_manager.cpp | 17 | ||||
-rw-r--r-- | engines/wintermute/base/sound/base_sound_manager.h | 1 |
9 files changed, 15 insertions, 309 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);
|