aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/video/video_subtitler.cpp
diff options
context:
space:
mode:
authorTobia Tesan2014-10-15 21:18:00 +0200
committerTobia Tesan2014-10-15 21:36:47 +0200
commitd5ed8c29f1f97519bd72aec8585edf04ac46181f (patch)
treef206e86dc59ee08de618fba4f931fd98fc0ba295 /engines/wintermute/video/video_subtitler.cpp
parent2fc69d770c7f80b0f6027dd66a8cf4be401b2853 (diff)
downloadscummvm-rg350-d5ed8c29f1f97519bd72aec8585edf04ac46181f.tar.gz
scummvm-rg350-d5ed8c29f1f97519bd72aec8585edf04ac46181f.tar.bz2
scummvm-rg350-d5ed8c29f1f97519bd72aec8585edf04ac46181f.zip
WINTERMUTE: Turn _subtitles into Common::Array<SubtitleCard> in VideoSubtitler
This necessarily loses const in SubtitleCard's attributes
Diffstat (limited to 'engines/wintermute/video/video_subtitler.cpp')
-rw-r--r--engines/wintermute/video/video_subtitler.cpp35
1 files changed, 14 insertions, 21 deletions
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;