[Scummvm-git-logs] scummvm master -> 95e81ee71a9ed02b215fd045784a8b8c5028d814
aquadran
noreply at scummvm.org
Fri Sep 26 12:54:57 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
95e81ee71a WINTERMUTE: Small sync code with original, related surface create flow
Commit: 95e81ee71a9ed02b215fd045784a8b8c5028d814
https://github.com/scummvm/scummvm/commit/95e81ee71a9ed02b215fd045784a8b8c5028d814
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2025-09-26T14:54:50+02:00
Commit Message:
WINTERMUTE: Small sync code with original, related surface create flow
Changed paths:
engines/wintermute/base/base_game.cpp
engines/wintermute/base/base_game.h
engines/wintermute/base/base_object.cpp
engines/wintermute/base/base_sub_frame.cpp
engines/wintermute/base/base_surface_storage.cpp
engines/wintermute/base/gfx/base_surface.cpp
engines/wintermute/base/gfx/base_surface.h
engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h
engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
engines/wintermute/base/gfx/osystem/base_surface_osystem.h
engines/wintermute/video/video_theora_player.cpp
engines/wintermute/video/video_theora_player.h
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp
index 4e90d2939ce..685aacdc2e7 100644
--- a/engines/wintermute/base/base_game.cpp
+++ b/engines/wintermute/base/base_game.cpp
@@ -1291,9 +1291,9 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
else if (strcmp(name, "PlayMusic") == 0 || strcmp(name, "PlayMusicChannel") == 0) {
int channel = 0;
if (strcmp(name, "PlayMusic") == 0) {
- stack->correctParams(3);
- } else {
stack->correctParams(4);
+ } else {
+ stack->correctParams(5);
channel = stack->pop()->getInt();
}
@@ -1304,10 +1304,10 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
ScValue *valLoopStart = stack->pop();
uint32 loopStart = (uint32)(valLoopStart->isNULL() ? 0 : valLoopStart->getInt());
- //CScValue* ValPrivVolume = Stack->Pop();
- //DWORD PrivVolume = (DWORD)(ValPrivVolume->IsNULL()?100:ValPrivVolume->GetInt());
+ ScValue *valPrivVolume = stack->pop();
+ uint32 privVolume = (uint32)(valPrivVolume->isNULL() ? 100 : valPrivVolume->getInt());
- if (DID_FAIL(playMusic(channel, filename, looping, loopStart))) {
+ if (DID_FAIL(playMusic(channel, filename, looping, loopStart, privVolume))) {
stack->pushBool(false);
} else {
stack->pushBool(true);
@@ -4423,7 +4423,7 @@ bool BaseGame::displayWindows(bool inGame) {
}
//////////////////////////////////////////////////////////////////////////
-bool BaseGame::playMusic(int channel, const char *filename, bool looping, uint32 loopStart) {
+bool BaseGame::playMusic(int channel, const char *filename, bool looping, uint32 loopStart, uint32 privVolume) {
if (channel >= NUM_MUSIC_CHANNELS) {
_game->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
return STATUS_FAILED;
@@ -4432,7 +4432,7 @@ bool BaseGame::playMusic(int channel, const char *filename, bool looping, uint32
SAFE_DELETE(_music[channel]);
_music[channel] = new BaseSound(_game);
- if (_music[channel] && DID_SUCCEED(_music[channel]->setSound(filename, TSoundType::SOUND_MUSIC, true))) {
+ if (_music[channel] && DID_SUCCEED(_music[channel]->setSound(filename, TSoundType::SOUND_MUSIC, true, privVolume))) {
if (_musicStartTime[channel]) {
_music[channel]->setPositionTime(_musicStartTime[channel]);
_musicStartTime[channel] = 0;
diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h
index a3d47fe4877..1afe686e849 100644
--- a/engines/wintermute/base/base_game.h
+++ b/engines/wintermute/base/base_game.h
@@ -324,7 +324,7 @@ public:
bool setMusicStartTime(int channel, uint32 time);
bool pauseMusic(int channel);
bool stopMusic(int channel);
- bool playMusic(int channel, const char *filename, bool looping = true, uint32 loopStart = 0);
+ bool playMusic(int channel, const char *filename, bool looping = true, uint32 loopStart = 0, uint32 privVolume = 100);
BaseSound *_music[NUM_MUSIC_CHANNELS];
bool _musicCrossfadeRunning;
bool _musicCrossfadeSwap;
diff --git a/engines/wintermute/base/base_object.cpp b/engines/wintermute/base/base_object.cpp
index 45173d45407..a21b9f15966 100644
--- a/engines/wintermute/base/base_object.cpp
+++ b/engines/wintermute/base/base_object.cpp
@@ -542,7 +542,7 @@ bool BaseObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta
stack->correctParams(0);
if (_shadowImage) {
- stack->pushString(_shadowImage->_filename.c_str());
+ stack->pushString(_shadowImage->_filename);
} else {
stack->pushNULL();
}
@@ -1126,7 +1126,7 @@ bool BaseObject::persist(BasePersistenceManager *persistMgr) {
Common::String tempString;
if (persistMgr->getIsSaving()) {
if (_shadowImage) {
- tempString = _shadowImage->_filename.c_str();
+ tempString = _shadowImage->_filename;
}
persistMgr->transferString(TMEMBER(tempString));
} else {
diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp
index fdd03965978..e8ce570423c 100644
--- a/engines/wintermute/base/base_sub_frame.cpp
+++ b/engines/wintermute/base/base_sub_frame.cpp
@@ -284,8 +284,8 @@ bool BaseSubFrame::saveAsText(BaseDynamicBuffer *buffer, int indent, bool comple
buffer->putTextIndent(indent, "SUBFRAME {\n");
}
- if (_surface && _surface->_filename != "") {
- buffer->putTextIndent(indent + 2, "IMAGE = \"%s\"\n", _surface->_filename.c_str());
+ if (_surface && _surface->_filename != nullptr) {
+ buffer->putTextIndent(indent + 2, "IMAGE = \"%s\"\n", _surface->_filename);
}
if (_transparent != 0xFFFF00FF) {
diff --git a/engines/wintermute/base/base_surface_storage.cpp b/engines/wintermute/base/base_surface_storage.cpp
index 7b8b27c5ad5..3083880fb6c 100644
--- a/engines/wintermute/base/base_surface_storage.cpp
+++ b/engines/wintermute/base/base_surface_storage.cpp
@@ -55,7 +55,7 @@ BaseSurfaceStorage::~BaseSurfaceStorage() {
bool BaseSurfaceStorage::cleanup(bool warn) {
for (int32 i = 0; i < _surfaces.getSize(); i++) {
if (warn) {
- _game->LOG(0, "BaseSurfaceStorage warning: purging surface '%s', usage:%d", _surfaces[i]->_filename.c_str(), _surfaces[i]->_referenceCount);
+ _game->LOG(0, "BaseSurfaceStorage warning: purging surface '%s', usage:%d", _surfaces[i]->_filename, _surfaces[i]->_referenceCount);
}
delete _surfaces[i];
}
@@ -104,7 +104,7 @@ bool BaseSurfaceStorage::removeSurface(BaseSurface *surface) {
//////////////////////////////////////////////////////////////////////
BaseSurface *BaseSurfaceStorage::addSurface(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) {
for (int32 i = 0; i < _surfaces.getSize(); i++) {
- if (scumm_stricmp(_surfaces[i]->_filename.c_str(), filename) == 0) {
+ if (scumm_stricmp(_surfaces[i]->_filename, filename) == 0) {
_surfaces[i]->_referenceCount++;
return _surfaces[i];
}
diff --git a/engines/wintermute/base/gfx/base_surface.cpp b/engines/wintermute/base/gfx/base_surface.cpp
index 45d03af3301..d9cd28d4cea 100644
--- a/engines/wintermute/base/gfx/base_surface.cpp
+++ b/engines/wintermute/base/gfx/base_surface.cpp
@@ -28,6 +28,9 @@
#include "engines/wintermute/wintypes.h"
#include "engines/wintermute/base/base_game.h"
#include "engines/wintermute/base/gfx/base_surface.h"
+#include "engines/wintermute/dcgf.h"
+
+#include "common/str.h"
namespace Wintermute {
@@ -37,7 +40,7 @@ BaseSurface::BaseSurface(BaseGame *inGame) : BaseClass(inGame) {
_width = _height = 0;
- _filename = "";
+ _filename = nullptr;
_ckDefault = true;
_ckRed = _ckGreen = _ckBlue = 0;
@@ -50,6 +53,9 @@ BaseSurface::BaseSurface(BaseGame *inGame) : BaseClass(inGame) {
//////////////////////////////////////////////////////////////////////
BaseSurface::~BaseSurface() {
+ if (_filename) {
+ SAFE_DELETE_ARRAY(_filename);
+ }
}
//////////////////////////////////////////////////////////////////////
@@ -89,12 +95,23 @@ bool BaseSurface::prepareToDraw() {
if (!_valid) {
//_game->LOG(0, "Reviving: %s", _filename);
- return create(_filename.c_str(), _ckDefault, _ckRed, _ckGreen, _ckBlue, _lifeTime, _keepLoaded);
+ return create(_filename, _ckDefault, _ckRed, _ckGreen, _ckBlue, _lifeTime, _keepLoaded);
} else {
return STATUS_OK;
}
}
+//////////////////////////////////////////////////////////////////////////
+void BaseSurface::setFilename(const char *filename) {
+ SAFE_DELETE_ARRAY(_filename);
+ if (!filename) {
+ return;
+ }
+
+ size_t nameSize = strlen(filename) + 1;
+ _filename = new char[nameSize];
+ Common::strcpy_s(_filename, nameSize, filename);
+}
//////////////////////////////////////////////////////////////////////////
void BaseSurface::setSize(int width, int height) {
diff --git a/engines/wintermute/base/gfx/base_surface.h b/engines/wintermute/base/gfx/base_surface.h
index 5d31e46927d..2a4a67d07dc 100644
--- a/engines/wintermute/base/gfx/base_surface.h
+++ b/engines/wintermute/base/gfx/base_surface.h
@@ -59,9 +59,9 @@ public:
virtual bool display(int x, int y, Common::Rect32 rect, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
virtual bool displayTiled(int x, int y, Common::Rect32 rect, int numTimesX, int numTimesY) = 0;
virtual bool restore();
- virtual bool create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) = 0;
+ virtual bool create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) = 0;
virtual bool create(int width, int height);
- virtual bool setAlphaImage(const Common::String &filename) {
+ virtual bool setAlphaImage(const char *filename) {
return STATUS_FAILED;
}
virtual bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) {
@@ -72,10 +72,11 @@ public:
virtual bool putPixel(int x, int y, byte r, byte g, byte b, byte a) = 0;
virtual bool getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a = nullptr) const = 0;
virtual bool isTransparentAtLite(int x, int y) const = 0;
+ void setFilename(const char *filename);
void setSize(int width, int height);
int _referenceCount;
- Common::String _filename;
+ char *_filename;
virtual int getWidth() {
return _width;
diff --git a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
index b385ea14dfe..791af9a1663 100644
--- a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
+++ b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
@@ -118,32 +118,33 @@ bool BaseSurfaceOpenGL3D::displayTiled(int x, int y, Common::Rect32 rect, int nu
return true;
}
-bool BaseSurfaceOpenGL3D::create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) {
+bool BaseSurfaceOpenGL3D::create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) {
if (defaultCK) {
ckRed = 255;
ckGreen = 0;
ckBlue = 255;
}
+ Common::String surfacefilename = filename;
BaseImage img = BaseImage();
- if (!img.getImageInfo(filename, _width, _height)) {
+ if (!img.getImageInfo(surfacefilename, _width, _height)) {
return false;
}
if (lifeTime != -1 && _lifeTime == 0) {
_valid = false;
} else {
- if (!img.loadFile(filename)) {
+ if (!img.loadFile(surfacefilename)) {
return false;
}
-
+
if (img.getSurface()->format.bytesPerPixel == 1 && img.getPalette() == nullptr) {
return false;
}
+
bool needsColorKey = false;
bool replaceAlpha = true;
-
if (_imageData) {
_imageData->free();
delete _imageData;
@@ -152,7 +153,7 @@ bool BaseSurfaceOpenGL3D::create(const Common::String &filename, bool defaultCK,
_imageData = img.getSurface()->convertTo(Graphics::PixelFormat::createFormatRGBA32(), img.getPalette(), img.getPaletteCount());
- if (_filename.matchString("savegame:*g", true)) {
+ if (surfacefilename.matchString("savegame:*g", true)) {
uint8 r, g, b, a;
for (int x = 0; x < _imageData->w; x++) {
for (int y = 0; y < _imageData->h; y++) {
@@ -163,10 +164,10 @@ bool BaseSurfaceOpenGL3D::create(const Common::String &filename, bool defaultCK,
}
}
- if (_filename.hasSuffix(".bmp")) {
+ if (surfacefilename.hasSuffix(".bmp")) {
// Ignores alpha channel for BMPs
needsColorKey = true;
- } else if (_filename.hasSuffix(".jpg")) {
+ } else if (surfacefilename.hasSuffix(".jpg")) {
// Ignores alpha channel for JPEGs
needsColorKey = true;
} else if (BaseEngine::instance().getTargetExecutable() < WME_LITE) {
@@ -191,11 +192,11 @@ bool BaseSurfaceOpenGL3D::create(const Common::String &filename, bool defaultCK,
// Some Rosemary sprites have non-fully transparent pixels
// In original WME it wasn't seen because sprites were downscaled
// Let's set alpha to 0 if it is smaller then some treshold
- if (BaseEngine::instance().getGameId() == "rosemary" && _filename.hasPrefix("actors") && _imageData->format.bytesPerPixel == 4) {
+ if (BaseEngine::instance().getGameId() == "rosemary" && surfacefilename.hasPrefix("actors") && _imageData->format.bytesPerPixel == 4) {
uint32 mask = _imageData->format.ARGBToColor(255, 0, 0, 0);
uint32 treshold = _imageData->format.ARGBToColor(16, 0, 0, 0);
uint32 blank = _imageData->format.ARGBToColor(0, 0, 0, 0);
-
+
for (int x = 0; x < _imageData->w; x++) {
for (int y = 0; y < _imageData->h; y++) {
uint32 pixel = _imageData->getPixel(x, y);
@@ -218,7 +219,9 @@ bool BaseSurfaceOpenGL3D::create(const Common::String &filename, bool defaultCK,
_ckGreen = ckGreen;
_ckBlue = ckBlue;
- _filename = filename;
+ if (!_filename || scumm_stricmp(_filename, filename) != 0) {
+ setFilename(filename);
+ }
if (_lifeTime == 0 || lifeTime == -1 || lifeTime > _lifeTime) {
_lifeTime = lifeTime;
@@ -365,7 +368,7 @@ void BaseSurfaceOpenGL3D::setTexture() {
}
//////////////////////////////////////////////////////////////////////////
-bool BaseSurfaceOpenGL3D::setAlphaImage(const Common::String &filename) {
+bool BaseSurfaceOpenGL3D::setAlphaImage(const char *filename) {
BaseImage *alphaImage = new BaseImage();
if (!alphaImage->loadFile(filename)) {
delete alphaImage;
diff --git a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h
index fcec89ea827..b55f16af3cb 100644
--- a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h
+++ b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h
@@ -45,9 +45,9 @@ public:
bool displayTrans(int x, int y, Common::Rect32 rect, uint32 alpha = 0xFFFFFFFF, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) override;
bool display(int x, int y, Common::Rect32 rect, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
bool displayTiled(int x, int y, Common::Rect32 rect, int numTimesX, int numTimesY) override;
- bool create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) override;
+ bool create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) override;
bool create(int width, int height) override;
- bool setAlphaImage(const Common::String &filename) override;
+ bool setAlphaImage(const char *filename) override;
bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) override;
bool putPixel(int x, int y, byte r, byte g, byte b, byte a) override;
bool getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a = nullptr) const override;
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
index 2cfd1b2b6d9..7d7187413a7 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
@@ -78,7 +78,7 @@ BaseSurfaceOSystem::~BaseSurfaceOSystem() {
}
//////////////////////////////////////////////////////////////////////////
-bool BaseSurfaceOSystem::create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) {
+bool BaseSurfaceOSystem::create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) {
if (defaultCK) {
ckRed = 255;
ckGreen = 0;
@@ -89,7 +89,7 @@ bool BaseSurfaceOSystem::create(const Common::String &filename, bool defaultCK,
if (!img.getImageInfo(filename, _width, _height)) {
return false;
}
-
+
if (lifeTime != -1 && _lifeTime == 0) {
_valid = false;
}
@@ -99,8 +99,10 @@ bool BaseSurfaceOSystem::create(const Common::String &filename, bool defaultCK,
_ckGreen = ckGreen;
_ckBlue = ckBlue;
- _filename = filename;
-
+ if (!_filename || scumm_stricmp(_filename, filename) != 0) {
+ setFilename(filename);
+ }
+
if (_lifeTime == 0 || lifeTime == -1 || lifeTime > _lifeTime) {
_lifeTime = lifeTime;
}
@@ -114,8 +116,9 @@ bool BaseSurfaceOSystem::create(const Common::String &filename, bool defaultCK,
}
bool BaseSurfaceOSystem::finishLoad() {
+ Common::String filename = _filename;
BaseImage *image = new BaseImage();
- if (!image->loadFile(_filename)) {
+ if (!image->loadFile(filename)) {
delete image;
return false;
}
@@ -135,7 +138,7 @@ bool BaseSurfaceOSystem::finishLoad() {
bool replaceAlpha = true;
if (image->getSurface()->format.bytesPerPixel == 1) {
if (!image->getPalette()) {
- error("Missing palette while loading 8bit image %s", _filename.c_str());
+ error("Missing palette while loading 8bit image %s", _filename);
}
_surface = image->getSurface()->convertTo(g_system->getScreenFormat(), image->getPalette(), image->getPaletteCount());
} else if (image->getSurface()->format != g_system->getScreenFormat()) {
@@ -147,7 +150,7 @@ bool BaseSurfaceOSystem::finishLoad() {
_game->addMem(_width * _height * 4);
- if (_filename.matchString("savegame:*g", true)) {
+ if (filename.matchString("savegame:*g", true)) {
uint8 r, g, b, a;
for (int x = 0; x < _surface->w; x++) {
for (int y = 0; y < _surface->h; y++) {
@@ -158,10 +161,10 @@ bool BaseSurfaceOSystem::finishLoad() {
}
}
- if (_filename.hasSuffix(".bmp")) {
+ if (filename.hasSuffix(".bmp")) {
// Ignores alpha channel for BMPs
needsColorKey = true;
- } else if (_filename.hasSuffix(".jpg")) {
+ } else if (filename.hasSuffix(".jpg")) {
// Ignores alpha channel for JPEGs
needsColorKey = true;
} else if (BaseEngine::instance().getTargetExecutable() < WME_LITE) {
@@ -197,7 +200,7 @@ bool BaseSurfaceOSystem::finishLoad() {
// Some Rosemary sprites have non-fully transparent pixels
// In original WME it wasn't seen because sprites were downscaled
// Let's set alpha to 0 if it is smaller then some treshold
- if (BaseEngine::instance().getGameId() == "rosemary" && _filename.hasPrefix("actors") &&
+ if (BaseEngine::instance().getGameId() == "rosemary" && filename.hasPrefix("actors") &&
_alphaType == Graphics::ALPHA_FULL && _surface->format.aBits() > 4) {
uint32 mask = _surface->format.ARGBToColor(255, 0, 0, 0);
uint32 treshold = _surface->format.ARGBToColor(16, 0, 0, 0);
@@ -213,7 +216,6 @@ bool BaseSurfaceOSystem::finishLoad() {
}
}
-
return true;
}
@@ -414,7 +416,7 @@ bool BaseSurfaceOSystem::putSurface(const Graphics::Surface &surface, bool hasAl
}
//////////////////////////////////////////////////////////////////////////
-bool BaseSurfaceOSystem::setAlphaImage(const Common::String &filename) {
+bool BaseSurfaceOSystem::setAlphaImage(const char *filename) {
BaseImage *alphaImage = new BaseImage();
if (!alphaImage->loadFile(filename)) {
delete alphaImage;
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
index 0b06f16fffa..6afbbb1b16a 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
@@ -42,10 +42,10 @@ public:
BaseSurfaceOSystem(BaseGame *inGame);
~BaseSurfaceOSystem() override;
- bool create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) override;
+ bool create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) override;
bool create(int width, int height) override;
- bool setAlphaImage(const Common::String &filename) override;
+ bool setAlphaImage(const char *filename) override;
bool invalidate() override;
diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp
index 09dbfecc3e0..e4f8c32bd40 100644
--- a/engines/wintermute/video/video_theora_player.cpp
+++ b/engines/wintermute/video/video_theora_player.cpp
@@ -35,6 +35,7 @@
#include "engines/wintermute/base/sound/base_sound_manager.h"
#include "engines/wintermute/platform_osystem.h"
#include "engines/wintermute/wintermute.h"
+#include "engines/wintermute/utils/utils.h"
#include "engines/wintermute/dcgf.h"
#include "video/theora_decoder.h"
@@ -68,7 +69,7 @@ void VideoTheoraPlayer::setDefaults() {
_dontDropFrames = false;
_texture = nullptr;
- _alphaFilename = "";
+ _alphaFilename = nullptr;
_frameRendered = false;
@@ -376,15 +377,15 @@ bool VideoTheoraPlayer::display(uint32 alpha) {
}
//////////////////////////////////////////////////////////////////////////
-bool VideoTheoraPlayer::setAlphaImage(const Common::String &filename) {
+bool VideoTheoraPlayer::setAlphaImage(const char *filename) {
assert(_texture);
- if (filename == "" || !_texture || DID_FAIL(_texture->setAlphaImage(filename))) {
- _alphaFilename = "";
+ if (!filename || !_texture || DID_FAIL(_texture->setAlphaImage(filename))) {
+ SAFE_DELETE_ARRAY(_alphaFilename);
return STATUS_FAILED;
}
if (_alphaFilename != filename) {
- _alphaFilename = filename;
+ BaseUtils::setString(&_alphaFilename, filename);
}
return STATUS_OK;
}
@@ -443,7 +444,7 @@ bool VideoTheoraPlayer::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferUint32(TMEMBER(_savedPos));
persistMgr->transferSint32(TMEMBER(_savedState));
persistMgr->transferString(TMEMBER(_filename));
- persistMgr->transferString(TMEMBER(_alphaFilename));
+ persistMgr->transferCharPtr(TMEMBER(_alphaFilename));
persistMgr->transferSint32(TMEMBER(_posX));
persistMgr->transferSint32(TMEMBER(_posY));
persistMgr->transferFloat(TMEMBER(_playZoom));
@@ -461,7 +462,7 @@ bool VideoTheoraPlayer::persist(BasePersistenceManager *persistMgr) {
//////////////////////////////////////////////////////////////////////////
bool VideoTheoraPlayer::initializeSimple() {
if (DID_SUCCEED(initialize(_filename))) {
- if (_alphaFilename != "") {
+ if (_alphaFilename) {
setAlphaImage(_alphaFilename);
}
play(_playbackType, _posX, _posY, false, false, _looping, _savedPos, _playZoom);
diff --git a/engines/wintermute/video/video_theora_player.h b/engines/wintermute/video/video_theora_player.h
index 411f3a09641..f69b28f7199 100644
--- a/engines/wintermute/video/video_theora_player.h
+++ b/engines/wintermute/video/video_theora_player.h
@@ -85,8 +85,8 @@ public:
BaseSurface *getTexture() const;
// alpha related
- Common::String _alphaFilename;
- bool setAlphaImage(const Common::String &filename);
+ char *_alphaFilename;
+ bool setAlphaImage(const char *filename);
bool seekToTime(uint32 Time);
More information about the Scummvm-git-logs
mailing list