aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/wintermute/video/subtitle_card.cpp10
-rw-r--r--engines/wintermute/video/subtitle_card.h6
-rw-r--r--engines/wintermute/video/video_subtitler.cpp35
-rw-r--r--engines/wintermute/video/video_subtitler.h2
4 files changed, 23 insertions, 30 deletions
diff --git a/engines/wintermute/video/subtitle_card.cpp b/engines/wintermute/video/subtitle_card.cpp
index 28fb6544f2..5d882502fd 100644
--- a/engines/wintermute/video/subtitle_card.cpp
+++ b/engines/wintermute/video/subtitle_card.cpp
@@ -32,11 +32,11 @@
namespace Wintermute {
SubtitleCard::SubtitleCard(BaseGame *inGame,
- const Common::String &text,
- const uint &startFrame,
- const uint &endFrame) : _gameRef(inGame),
- _startFrame(startFrame),
- _endFrame(endFrame) {
+ const Common::String &text,
+ const uint &startFrame,
+ const uint &endFrame) : _gameRef(inGame),
+ _startFrame(startFrame),
+ _endFrame(endFrame) {
_text = text;
_gameRef->expandStringByStringTable(_text);
}
diff --git a/engines/wintermute/video/subtitle_card.h b/engines/wintermute/video/subtitle_card.h
index 7b372c76ad..629df77287 100644
--- a/engines/wintermute/video/subtitle_card.h
+++ b/engines/wintermute/video/subtitle_card.h
@@ -42,9 +42,9 @@ public:
uint32 getStartFrame() const;
Common::String getText() const;
private:
- const BaseGame* _gameRef;
- const uint32 _endFrame;
- const uint32 _startFrame;
+ BaseGame *_gameRef;
+ uint32 _endFrame;
+ uint32 _startFrame;
Common::String _text;
};
diff --git a/engines/wintermute/video/video_subtitler.cpp b/engines/wintermute/video/video_subtitler.cpp
index 2bd728c797..2123991c03 100644
--- a/engines/wintermute/video/video_subtitler.cpp
+++ b/engines/wintermute/video/video_subtitler.cpp
@@ -42,10 +42,6 @@ VideoSubtitler::VideoSubtitler(BaseGame *inGame): BaseClass(inGame) {
}
VideoSubtitler::~VideoSubtitler(void) {
- for (uint i = 0; i < _subtitles.size(); i++) {
- delete _subtitles[i];
- }
-
_subtitles.clear();
}
@@ -54,10 +50,6 @@ bool VideoSubtitler::loadSubtitles(const Common::String &filename, const Common:
return false;
}
- for (uint i = 0; i < _subtitles.size(); i++) {
- delete _subtitles[i];
- }
-
_subtitles.clear();
_lastSample = -1;
@@ -166,7 +158,7 @@ bool VideoSubtitler::loadSubtitles(const Common::String &filename, const Common:
}
if (start != -1 && text.size() > 0 && (start != 1 || end != 1)) {
- _subtitles.push_back(new SubtitleCard(_gameRef, text, start, end));
+ _subtitles.push_back(SubtitleCard(_gameRef, text, start, end));
}
pos += lineLength + 1;
@@ -190,14 +182,15 @@ void VideoSubtitler::display() {
}
int textHeight = font->getTextHeight(
- (const byte *)_subtitles[_currentSubtitle]->getText().c_str(),
+ (const byte *)_subtitles[_currentSubtitle].getText().c_str(),
_gameRef->_renderer->getWidth());
- font->drawText((const byte *)_subtitles[_currentSubtitle]->getText().c_str(),
- 0,
- (_gameRef->_renderer->getHeight() - textHeight - 5),
- (_gameRef->_renderer->getWidth()),
- TAL_CENTER);
+ font->drawText(
+ (const byte *)_subtitles[_currentSubtitle].getText().c_str(),
+ 0,
+ (_gameRef->_renderer->getHeight() - textHeight - 5),
+ (_gameRef->_renderer->getWidth()),
+ TAL_CENTER);
}
}
@@ -218,11 +211,11 @@ void VideoSubtitler::update(uint32 frame) {
_showSubtitle = false;
- bool overdue = (frame > _subtitles[_currentSubtitle]->getEndFrame());
+ bool overdue = (frame > _subtitles[_currentSubtitle].getEndFrame());
bool hasNext = (_currentSubtitle + 1 < _subtitles.size());
bool nextStarted = false;
if (hasNext) {
- nextStarted = (_subtitles[_currentSubtitle + 1]->getStartFrame() <= frame);
+ nextStarted = (_subtitles[_currentSubtitle + 1].getStartFrame() <= frame);
}
while (_currentSubtitle < _subtitles.size() &&
@@ -238,22 +231,22 @@ void VideoSubtitler::update(uint32 frame) {
_currentSubtitle++;
- overdue = (frame > _subtitles[_currentSubtitle]->getEndFrame());
+ overdue = (frame > _subtitles[_currentSubtitle].getEndFrame());
hasNext = (_currentSubtitle + 1 < _subtitles.size());
if (hasNext) {
- nextStarted = (_subtitles[_currentSubtitle + 1]->getStartFrame() <= frame);
+ nextStarted = (_subtitles[_currentSubtitle + 1].getStartFrame() <= frame);
} else {
nextStarted = false;
}
}
- bool currentValid = (_subtitles[_currentSubtitle]->getEndFrame() != 0);
+ bool currentValid = (_subtitles[_currentSubtitle].getEndFrame() != 0);
/*
* No idea why we do this check, carried over from Mnemonic's code.
* Possibly a workaround for buggy subtitles or some kind of sentinel? :-\
*/
- bool currentStarted = frame >= _subtitles[_currentSubtitle]->getStartFrame();
+ bool currentStarted = frame >= _subtitles[_currentSubtitle].getStartFrame();
if (currentStarted && !overdue && currentValid) {
_showSubtitle = true;
diff --git a/engines/wintermute/video/video_subtitler.h b/engines/wintermute/video/video_subtitler.h
index f2dcdf161e..c1730c84fd 100644
--- a/engines/wintermute/video/video_subtitler.h
+++ b/engines/wintermute/video/video_subtitler.h
@@ -46,7 +46,7 @@ public:
void display();
void update(uint32 frame);
private:
- Common::Array<SubtitleCard *> _subtitles;
+ Common::Array<SubtitleCard> _subtitles;
int32 _lastSample;
};