aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/smush
diff options
context:
space:
mode:
authorGregory Montoir2007-01-27 02:26:37 +0000
committerGregory Montoir2007-01-27 02:26:37 +0000
commit2b61c0d6c1efba14b23655905751981e9b19e365 (patch)
treec3964a11338fc21e7e9542ced5b860fa167c3daf /engines/scumm/smush
parent843b30403163b67ec277f086f3ead587bd50e266 (diff)
downloadscummvm-rg350-2b61c0d6c1efba14b23655905751981e9b19e365.tar.gz
scummvm-rg350-2b61c0d6c1efba14b23655905751981e9b19e365.tar.bz2
scummvm-rg350-2b61c0d6c1efba14b23655905751981e9b19e365.zip
cleanup (made NutRenderer::loadFont protected, added call during initialisation of the renderer object)
svn-id: r25223
Diffstat (limited to 'engines/scumm/smush')
-rw-r--r--engines/scumm/smush/smush_font.cpp12
-rw-r--r--engines/scumm/smush/smush_font.h2
-rw-r--r--engines/scumm/smush/smush_player.cpp9
3 files changed, 6 insertions, 17 deletions
diff --git a/engines/scumm/smush/smush_font.cpp b/engines/scumm/smush/smush_font.cpp
index 59caaeea61..de7fe9c460 100644
--- a/engines/scumm/smush/smush_font.cpp
+++ b/engines/scumm/smush/smush_font.cpp
@@ -29,8 +29,8 @@
namespace Scumm {
-SmushFont::SmushFont(ScummEngine *vm, bool use_original_colors, bool new_colors) :
- NutRenderer(vm),
+SmushFont::SmushFont(ScummEngine *vm, const char *filename, bool use_original_colors, bool new_colors) :
+ NutRenderer(vm, filename, false),
_color(-1),
_new_colors(new_colors),
_original(use_original_colors) {
@@ -38,10 +38,6 @@ SmushFont::SmushFont(ScummEngine *vm, bool use_original_colors, bool new_colors)
int SmushFont::getStringWidth(const char *str) {
assert(str);
- if (!_loaded) {
- error("SmushFont::getStringWidth() Font is not loaded");
- return 0;
- }
int width = 0;
while (*str) {
@@ -56,10 +52,6 @@ int SmushFont::getStringWidth(const char *str) {
int SmushFont::getStringHeight(const char *str) {
assert(str);
- if (!_loaded) {
- error("SmushFont::getStringHeight() Font is not loaded");
- return 0;
- }
int height = 0;
while (*str) {
diff --git a/engines/scumm/smush/smush_font.h b/engines/scumm/smush/smush_font.h
index 724eb46658..65bee940c2 100644
--- a/engines/scumm/smush/smush_font.h
+++ b/engines/scumm/smush/smush_font.h
@@ -42,7 +42,7 @@ protected:
void drawSubstring(const char *str, byte *buffer, int dst_width, int x, int y);
public:
- SmushFont(ScummEngine *vm, bool use_original_colors, bool new_colors);
+ SmushFont(ScummEngine *vm, const char *filename, bool use_original_colors, bool new_colors);
void setColor(byte c) { _color = c; }
void drawString (const char *str, byte *buffer, int dst_width, int dst_height, int x, int y, bool center);
diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp
index 38febf8a29..8363868d09 100644
--- a/engines/scumm/smush/smush_player.cpp
+++ b/engines/scumm/smush/smush_player.cpp
@@ -1051,24 +1051,21 @@ SmushFont *SmushPlayer::getFont(int font) {
assert(font >= 0 && font < ARRAYSIZE(ft_fonts));
- _sf[font] = new SmushFont(_vm, true, false);
- _sf[font]->loadFont(ft_fonts[font], false);
+ _sf[font] = new SmushFont(_vm, ft_fonts[font], true, false);
}
} else if (_vm->_game.id == GID_DIG) {
if (!(_vm->_game.features & GF_DEMO)) {
assert(font >= 0 && font < 4);
sprintf(file_font, "font%d.nut", font);
- _sf[font] = new SmushFont(_vm, font != 0, false);
- _sf[font]->loadFont(file_font, false);
+ _sf[font] = new SmushFont(_vm, file_font, font != 0, false);
}
} else if (_vm->_game.id == GID_CMI) {
int numFonts = (_vm->_game.features & GF_DEMO) ? 4 : 5;
assert(font >= 0 && font < numFonts);
sprintf(file_font, "font%d.nut", font);
- _sf[font] = new SmushFont(_vm, false, true);
- _sf[font]->loadFont(file_font, false);
+ _sf[font] = new SmushFont(_vm, file_font, false, true);
} else {
error("SmushPlayer::getFont() Unknown font setup for game");
}