aboutsummaryrefslogtreecommitdiff
path: root/engines/sword2/screen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sword2/screen.cpp')
-rw-r--r--engines/sword2/screen.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/engines/sword2/screen.cpp b/engines/sword2/screen.cpp
index 40baf67e46..f3363df45f 100644
--- a/engines/sword2/screen.cpp
+++ b/engines/sword2/screen.cpp
@@ -845,22 +845,18 @@ enum {
};
struct CreditsLine {
- char *str;
+ Common::String str;
byte type;
int top;
int height;
byte *sprite;
CreditsLine() {
- str = NULL;
sprite = NULL;
}
~CreditsLine() {
- free(str);
free(sprite);
- str = NULL;
- sprite = NULL;
}
};
@@ -1036,7 +1032,7 @@ void Screen::rollCredits() {
creditsLines[lineCount]->top = lineTop;
creditsLines[lineCount]->height = CREDITS_FONT_HEIGHT;
creditsLines[lineCount]->type = LINE_LEFT;
- creditsLines[lineCount]->str = strdup(line);
+ creditsLines[lineCount]->str = line;
lineCount++;
*center_mark = '^';
@@ -1063,7 +1059,7 @@ void Screen::rollCredits() {
lineTop += CREDITS_LINE_SPACING;
}
- creditsLines[lineCount]->str = strdup(line);
+ creditsLines[lineCount]->str = line;
lineCount++;
}
@@ -1113,7 +1109,7 @@ void Screen::rollCredits() {
// Free any sprites that have scrolled off the screen
if (creditsLines[i]->top + creditsLines[i]->height < scrollPos) {
- debug(2, "Freeing line %d: '%s'", i, creditsLines[i]->str);
+ debug(2, "Freeing line %d: '%s'", i, creditsLines[i]->str.c_str());
delete creditsLines[i];
creditsLines[i] = NULL;
@@ -1121,8 +1117,8 @@ void Screen::rollCredits() {
startLine = i + 1;
} else if (creditsLines[i]->top < scrollPos + 400) {
if (!creditsLines[i]->sprite) {
- 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);
+ debug(2, "Creating line %d: '%s'", i, creditsLines[i]->str.c_str());
+ creditsLines[i]->sprite = _vm->_fontRenderer->makeTextSprite((byte *)creditsLines[i]->str.c_str(), 600, 14, _vm->_speechFontId, 0);
}
FrameHeader frame;
@@ -1143,7 +1139,7 @@ void Screen::rollCredits() {
spriteInfo.x = RENDERWIDE / 2 + 5;
break;
case LINE_CENTER:
- if (strcmp(creditsLines[i]->str, "@") == 0) {
+ if (strcmp(creditsLines[i]->str.c_str(), "@") == 0) {
spriteInfo.data = logoData;
spriteInfo.x = (RENDERWIDE - logoWidth) / 2;
spriteInfo.w = logoWidth;