aboutsummaryrefslogtreecommitdiff
path: root/sword2
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-11-03 09:47:19 +0000
committerTorbjörn Andersson2005-11-03 09:47:19 +0000
commit4d8e8b5487b5c4520e46a77afa7fc55616ec2e51 (patch)
tree4542f9f42cb54aded5628ca20113a9b4083c5f1e /sword2
parentb14417537fa308fd7e02ead180e6215fb609f27a (diff)
downloadscummvm-rg350-4d8e8b5487b5c4520e46a77afa7fc55616ec2e51.tar.gz
scummvm-rg350-4d8e8b5487b5c4520e46a77afa7fc55616ec2e51.tar.bz2
scummvm-rg350-4d8e8b5487b5c4520e46a77afa7fc55616ec2e51.zip
More credits cleanups/fixes.
svn-id: r19404
Diffstat (limited to 'sword2')
-rw-r--r--sword2/build_display.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/sword2/build_display.cpp b/sword2/build_display.cpp
index e421877db7..c3bed77219 100644
--- a/sword2/build_display.cpp
+++ b/sword2/build_display.cpp
@@ -669,6 +669,13 @@ struct CreditsLine {
str = NULL;
sprite = NULL;
};
+
+ ~CreditsLine() {
+ free(str);
+ free(sprite);
+ str = NULL;
+ sprite = NULL;
+ }
};
#define CREDITS_FONT_HEIGHT 25
@@ -873,29 +880,24 @@ void Screen::rollCredits() {
uint32 musicLength = MAX((int32)(1000 * (_vm->_sound->musicTimeRemaining() - 3)), 25 * (int32)scrollSteps);
while (scrollPos < scrollSteps && !_vm->_quit) {
- bool foundStartLine = false;
-
clearScene();
for (i = startLine; i < lineCount; i++) {
+ if (!creditsLines[i])
+ continue;
+
// Free any sprites that have scrolled off the screen
if (creditsLines[i]->top + creditsLines[i]->height < scrollPos) {
- debug(2, "Freeing line %d", i);
+ debug(2, "Freeing line %d: '%s'", i, creditsLines[i]->str);
- free(creditsLines[i]->sprite);
- creditsLines[i]->sprite = NULL;
+ delete creditsLines[i];
+ creditsLines[i] = NULL;
- free(creditsLines[i]->str);
- creditsLines[i]->str = NULL;
+ startLine = i + 1;
} else if (creditsLines[i]->top < scrollPos + 400) {
- if (!foundStartLine) {
- startLine = i;
- foundStartLine = true;
- }
-
if (!creditsLines[i]->sprite) {
- debug(2, "Creating line %d sprite '%s'", i, creditsLines[i]->str);
+ debug(2, "Creating line %d: '%s'", i, creditsLines[i]->str);
creditsLines[i]->sprite = _vm->_fontRenderer->makeTextSprite((byte *)creditsLines[i]->str, 600, 14, _vm->_speechFontId, 0);
}
@@ -954,13 +956,10 @@ void Screen::rollCredits() {
// before the credits.
for (i = 0; i < lineCount; i++) {
- free(creditsLines[i]->str);
- free(creditsLines[i]->sprite);
delete creditsLines[i];
}
- if (logoData)
- free(logoData);
+ free(logoData);
if (!abortCredits) {
fadeDown();