aboutsummaryrefslogtreecommitdiff
path: root/saga
diff options
context:
space:
mode:
authorAndrew Kurushin2005-11-03 18:20:12 +0000
committerAndrew Kurushin2005-11-03 18:20:12 +0000
commit43a083a117a42879a18ea4c3a5e721d261fb8489 (patch)
tree8dfb8e3cad472c7b7fa928720d02af148b046eae /saga
parent7f691c3ca2068e708915b968a6f210ec205ce442 (diff)
downloadscummvm-rg350-43a083a117a42879a18ea4c3a5e721d261fb8489.tar.gz
scummvm-rg350-43a083a117a42879a18ea4c3a5e721d261fb8489.tar.bz2
scummvm-rg350-43a083a117a42879a18ea4c3a5e721d261fb8489.zip
-implement font substitution funcs
-move puzzle data to itedata svn-id: r19411
Diffstat (limited to 'saga')
-rw-r--r--saga/actor.cpp17
-rw-r--r--saga/actor.h1
-rw-r--r--saga/font.cpp74
-rw-r--r--saga/font.h113
-rw-r--r--saga/interface.cpp39
-rw-r--r--saga/ite_introproc.cpp14
-rw-r--r--saga/itedata.cpp103
-rw-r--r--saga/itedata.h18
-rw-r--r--saga/objectmap.cpp2
-rw-r--r--saga/puzzle.cpp106
-rw-r--r--saga/puzzle.h1
-rw-r--r--saga/render.cpp12
-rw-r--r--saga/saga.h20
-rw-r--r--saga/scene.cpp8
-rw-r--r--saga/sfuncs.cpp7
15 files changed, 305 insertions, 230 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp
index d30da19dda..86fbe71265 100644
--- a/saga/actor.cpp
+++ b/saga/actor.cpp
@@ -1045,13 +1045,12 @@ void Actor::handleSpeech(int msec) {
_activeSpeech.drawRect.top = _speechBoxScript.top;
_activeSpeech.drawRect.bottom = _speechBoxScript.bottom;
} else {
- FontId font = (_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont);
width = _activeSpeech.speechBox.width();
- height = _vm->_font->getHeight(font, _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
+ height = _vm->_font->getHeight(kKnownFontScript, _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
if (height > 40 && width < _vm->getDisplayWidth() - 100) {
width = _vm->getDisplayWidth() - 100;
- height = _vm->_font->getHeight(font, _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
+ height = _vm->_font->getHeight(kKnownFontScript, _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
}
_activeSpeech.speechBox.setWidth(width);
@@ -1659,12 +1658,10 @@ void Actor::drawSpeech(void) {
} else {
outputString = _activeSpeech.strings[0];
}
-
- FontId font = (_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont);
-
+
if (_activeSpeech.actorsCount > 1) {
- height = _vm->_font->getHeight(font);
- width = _vm->_font->getStringWidth(font, _activeSpeech.strings[0], 0, kFontNormal);
+ height = _vm->_font->getHeight(kKnownFontScript);
+ width = _vm->_font->getStringWidth(kKnownFontScript, _activeSpeech.strings[0], 0, kFontNormal);
for (i = 0; i < _activeSpeech.actorsCount; i++) {
actor = getActor(_activeSpeech.actorIds[i]);
@@ -1673,11 +1670,11 @@ void Actor::drawSpeech(void) {
textPoint.x = clamp(10, actor->_screenPosition.x - width / 2, _vm->getDisplayWidth() - 10 - width);
textPoint.y = clamp(10, actor->_screenPosition.y - 58, _vm->_scene->getHeight() - 10 - height);
- _vm->_font->textDraw(font, backBuffer, _activeSpeech.strings[0], textPoint,
+ _vm->_font->textDraw(kKnownFontScript, backBuffer, _activeSpeech.strings[0], textPoint,
_activeSpeech.speechColor[i], _activeSpeech.outlineColor[i], _activeSpeech.getFontFlags(i));
}
} else {
- _vm->_font->textDrawRect(font, backBuffer, _activeSpeech.strings[0], _activeSpeech.drawRect, _activeSpeech.speechColor[0],
+ _vm->_font->textDrawRect(kKnownFontScript, backBuffer, _activeSpeech.strings[0], _activeSpeech.drawRect, _activeSpeech.speechColor[0],
_activeSpeech.outlineColor[0], _activeSpeech.getFontFlags(0));
}
}
diff --git a/saga/actor.h b/saga/actor.h
index 9860885e5e..949bfd7b58 100644
--- a/saga/actor.h
+++ b/saga/actor.h
@@ -33,6 +33,7 @@
#include "saga/itedata.h"
#include "saga/list.h"
#include "saga/saga.h"
+#include "saga/font.h"
namespace Saga {
diff --git a/saga/font.cpp b/saga/font.cpp
index 7cee8d9bf6..30943a7fd7 100644
--- a/saga/font.cpp
+++ b/saga/font.cpp
@@ -62,9 +62,6 @@ Font::~Font(void) {
}
}
-FontData *Font::getFont(FontId fontId) {
- return _fonts[fontId];
-}
void Font::loadFont(uint32 fontResourceId) {
FontData *font;
@@ -239,9 +236,9 @@ void Font::createOutline(FontData *font) {
}
// Returns the horizontal length in pixels of the graphical representation
-// of at most 'test_str_ct' characters of the string 'test_str', taking
+// of at most 'count' characters of the string 'text', taking
// into account any formatting options specified by 'flags'.
-// If 'test_str_ct' is 0, all characters of 'test_str' are counted.
+// If 'count' is 0, all characters of 'test' are counted.
int Font::getStringWidth(FontId fontId, const char *text, size_t count, FontEffectFlags flags) {
FontData *font;
size_t ct;
@@ -249,8 +246,7 @@ int Font::getStringWidth(FontId fontId, const char *text, size_t count, FontEffe
int ch;
const byte *txt;
- validate(fontId);
-
+
font = getFont(fontId);
txt = (const byte *) text;
@@ -270,23 +266,12 @@ int Font::getStringWidth(FontId fontId, const char *text, size_t count, FontEffe
return width;
}
-int Font::getHeight(FontId fontId) {
- FontData *font;
-
- validate(fontId);
-
- font = getFont(fontId);
-
- return font->normal.header.charHeight;
-}
void Font::draw(FontId fontId, Surface *ds, const char *text, size_t count, const Common::Point &point,
int color, int effectColor, FontEffectFlags flags) {
FontData *font;
Point offsetPoint(point);
- validate(fontId);
-
font = getFont(fontId);
if (flags & kFontOutline) {
@@ -639,4 +624,57 @@ void Font::textDrawRect(FontId fontId, Surface *ds, const char *text, const Comm
}
}
+FontId Font::knownFont2FontIdx(KnownFont font) {
+ FontId fontId = kSmallFont;
+
+ if (_vm->getGameType() == GType_ITE) {
+ switch (font)
+ {
+ case (kKnownFontSmall):
+ fontId = kSmallFont;
+ break;
+ case (kKnownFontMedium):
+ fontId = kMediumFont;
+ break;
+ case (kKnownFontBig):
+ fontId = kBigFont;
+ break;
+
+ case (kKnownFontVerb):
+ fontId = kSmallFont;
+ break;
+ case (kKnownFontScript):
+ fontId = kMediumFont;
+ break;
+ case (kKnownFontPause):
+ fontId = _vm->_font->valid(kBigFont) ? kBigFont : kMediumFont;
+ break;
+ }
+ } else if (_vm->getGameType() == GType_IHNM) {
+ switch (font)
+ {
+ case (kKnownFontSmall):
+ fontId = kSmallFont;
+ break;
+ case (kKnownFontMedium):
+ fontId = kMediumFont;
+ break;
+ case (kKnownFontBig):
+ fontId = kBigFont;
+ break;
+
+ case (kKnownFontVerb):
+ fontId = kIHNMFont8;
+ break;
+ case (kKnownFontScript):
+ fontId = kIHNMMainFont;
+ break;
+ case (kKnownFontPause):
+ fontId = kMediumFont; // unchecked
+ break;
+ }
+ }
+ return fontId;
+}
+
} // End of namespace Saga
diff --git a/saga/font.h b/saga/font.h
index fd0d8fc2ab..7525a608fa 100644
--- a/saga/font.h
+++ b/saga/font.h
@@ -53,6 +53,35 @@ namespace Saga {
#define TEXT_MARGIN 10
#define TEXT_LINESPACING 2
+enum FontId {
+ kSmallFont,
+ kMediumFont,
+ kBigFont,
+ kIHNMUnknown,
+ kIHNMFont8,
+ kIHNMUnknown2,
+ kIHNMMainFont
+};
+
+enum FontEffectFlags {
+ kFontNormal = 0,
+ kFontOutline = 1 << 0,
+ kFontShadow = 1 << 1,
+ kFontBold = 1 << 2,
+ kFontCentered = 1 << 3,
+ kFontDontmap = 1 << 4
+};
+
+enum KnownFont {
+ kKnownFontSmall,
+ kKnownFontMedium,
+ kKnownFontBig,
+
+ kKnownFontPause,
+ kKnownFontScript,
+ kKnownFontVerb,
+};
+
struct TextListEntry {
bool display;
bool useRect;
@@ -61,7 +90,7 @@ struct TextListEntry {
int color;
int effectColor;
FontEffectFlags flags;
- FontId fontId;
+ KnownFont font;
const char *text;
TextListEntry() {
memset(this, 0, sizeof(*this));
@@ -105,38 +134,62 @@ class Font {
public:
Font(SagaEngine *vm);
~Font(void);
- FontData *getFont(FontId fontId);
- int getStringWidth(FontId fontId, const char *text, size_t count, FontEffectFlags flags);
- int getHeight(FontId fontId);
- int getHeight(FontId fontId, const char *text, int width, FontEffectFlags flags);
-
- void textDraw(FontId fontId, Surface *ds, const char *string, const Common::Point &point, int color, int effectColor, FontEffectFlags flags);
- void textDrawRect(FontId fontId, Surface *ds, const char *text, const Common::Rect &rect, int color, int effectColor, FontEffectFlags flags);
-
- void validate(FontId fontId) {
- if ((fontId < 0) || (fontId >= _loadedFonts)) {
- error("Font::validate: Invalid font id.");
- }
+ int getStringWidth(KnownFont font, const char *text, size_t count, FontEffectFlags flags) {
+ return getStringWidth(knownFont2FontIdx(font), text, count, flags);
}
-
- bool loaded(FontId fontId) {
- return !((fontId < 0) || (fontId >= _loadedFonts));
+ int getHeight(KnownFont font) {
+ return getHeight(knownFont2FontIdx(font));
}
-
- private:
- void loadFont(uint32 fontResourceId);
- void createOutline(FontData *font);
- void draw(FontId fontId, Surface *ds, const char *text, size_t count, const Common::Point &point, int color, int effectColor, FontEffectFlags flags);
- void outFont(const FontStyle &drawFont, Surface *ds, const char *text, size_t count, const Common::Point &point, int color, FontEffectFlags flags);
- int getByteLen(int numBits) const {
- int byteLength = numBits / 8;
-
- if (numBits % 8) {
- byteLength++;
- }
-
- return byteLength;
+ int getHeight(KnownFont font, const char *text, int width, FontEffectFlags flags) {
+ return getHeight(knownFont2FontIdx(font), text, width, flags);
+ }
+ void textDraw(KnownFont font, Surface *ds, const char *string, const Common::Point &point, int color, int effectColor, FontEffectFlags flags) {
+ textDraw(knownFont2FontIdx(font), ds, string, point, color, effectColor, flags);
+ }
+ void textDrawRect(KnownFont font, Surface *ds, const char *text, const Common::Rect &rect, int color, int effectColor, FontEffectFlags flags) {
+ textDrawRect(knownFont2FontIdx(font), ds, text, rect, color, effectColor, flags);
}
+
+ private:
+ FontId knownFont2FontIdx(KnownFont font);
+
+ int getStringWidth(FontId fontId, const char *text, size_t count, FontEffectFlags flags);
+ int getHeight(FontId fontId, const char *text, int width, FontEffectFlags flags);
+ void textDrawRect(FontId fontId, Surface *ds, const char *text, const Common::Rect &rect, int color, int effectColor, FontEffectFlags flags);
+ void textDraw(FontId fontId, Surface *ds, const char *string, const Common::Point &point, int color, int effectColor, FontEffectFlags flags);
+
+ void loadFont(uint32 fontResourceId);
+ void createOutline(FontData *font);
+ void draw(FontId fontId, Surface *ds, const char *text, size_t count, const Common::Point &point, int color, int effectColor, FontEffectFlags flags);
+ void outFont(const FontStyle &drawFont, Surface *ds, const char *text, size_t count, const Common::Point &point, int color, FontEffectFlags flags);
+
+ FontData *getFont(FontId fontId) {
+ validate(fontId);
+ return _fonts[fontId];
+ }
+
+public:
+ int Font::getHeight(FontId fontId) {
+ return getFont(fontId)->normal.header.charHeight;
+ }
+
+ void validate(FontId fontId) {
+ if (!valid(fontId)) {
+ error("Font::validate: Invalid font id.");
+ }
+ }
+ bool valid(FontId fontId) {
+ return ((fontId >= 0) && (fontId < _loadedFonts));
+ }
+ int getByteLen(int numBits) const {
+ int byteLength = numBits / 8;
+
+ if (numBits % 8) {
+ byteLength++;
+ }
+
+ return byteLength;
+ }
static const int _charMap[256];
SagaEngine *_vm;
diff --git a/saga/interface.cpp b/saga/interface.cpp
index fbeca08736..047e4ca42b 100644
--- a/saga/interface.cpp
+++ b/saga/interface.cpp
@@ -728,14 +728,14 @@ void Interface::drawPanelText(Surface *ds, InterfacePanel *panel, PanelButton *p
text = _vm->getTextString(panelButton->id);
panel->calcPanelButtonRect(panelButton, rect);
if (panelButton->xOffset < 0) {
- textWidth = _vm->_font->getStringWidth(kMediumFont, text, 0, kFontNormal);
+ textWidth = _vm->_font->getStringWidth(kKnownFontMedium, text, 0, kFontNormal);
rect.left += 2 + (panel->imageWidth - 1 - textWidth) / 2;
}
textPoint.x = rect.left;
textPoint.y = rect.top + 1;
- _vm->_font->textDraw(kMediumFont, ds, text, textPoint,
+ _vm->_font->textDraw(kKnownFontMedium, ds, text, textPoint,
_vm->getDisplayInfo().verbTextColor, _vm->getDisplayInfo().verbTextShadowColor, kFontShadow);
}
@@ -796,7 +796,7 @@ void Interface::drawOption() {
text = _vm->getSaveFile(idx)->name;
textPoint.x = rect.left + 1;
textPoint.y = rect2.top;
- _vm->_font->textDraw(kSmallFont, backBuffer, text, textPoint, fgColor, 0, kFontNormal);
+ _vm->_font->textDraw(kKnownFontSmall, backBuffer, text, textPoint, fgColor, 0, kFontNormal);
}
}
@@ -1003,8 +1003,8 @@ bool Interface::processTextInput(uint16 ascii) {
(ascii == ' ')) {
if (_textInputStringLength < SAVE_TITLE_SIZE - 1) {
ch[0] = ascii;
- tempWidth = _vm->_font->getStringWidth(kSmallFont, ch, 0, kFontNormal);
- tempWidth += _vm->_font->getStringWidth(kSmallFont, _textInputString, 0, kFontNormal);
+ tempWidth = _vm->_font->getStringWidth(kKnownFontSmall, ch, 0, kFontNormal);
+ tempWidth += _vm->_font->getStringWidth(kKnownFontSmall, _textInputString, 0, kFontNormal);
if (tempWidth > _textInputMaxWidth) {
break;
}
@@ -1045,7 +1045,7 @@ void Interface::drawTextInput(Surface *ds, InterfacePanel *panel, PanelButton *p
i = 0;
while ((ch[0] = _textInputString[i++]) != 0) {
- rect.setWidth(_vm->_font->getStringWidth(kSmallFont, ch, 0, kFontNormal));
+ rect.setWidth(_vm->_font->getStringWidth(kKnownFontSmall, ch, 0, kFontNormal));
if ((i == _textInputPos) && _textInput) {
fgColor = kITEColorBlack;
ds->fillRect(rect, kITEColorWhite);
@@ -1055,12 +1055,12 @@ void Interface::drawTextInput(Surface *ds, InterfacePanel *panel, PanelButton *p
textPoint.x = rect.left;
textPoint.y = rect.top + 1;
- _vm->_font->textDraw(kSmallFont, ds, ch, textPoint, fgColor, 0, kFontNormal);
+ _vm->_font->textDraw(kKnownFontSmall, ds, ch, textPoint, fgColor, 0, kFontNormal);
rect.left += rect.width();
}
if (_textInput && (_textInputPos >= i)) {
ch[0] = ' ';
- rect.setWidth(_vm->_font->getStringWidth(kSmallFont, ch, 0, kFontNormal));
+ rect.setWidth(_vm->_font->getStringWidth(kKnownFontSmall, ch, 0, kFontNormal));
ds->fillRect(rect, kITEColorWhite);
}
}
@@ -1546,7 +1546,7 @@ void Interface::drawStatusBar() {
backBuffer->drawRect(rect, _vm->getDisplayInfo().statusBGColor);
- stringWidth = _vm->_font->getStringWidth(kSmallFont, _statusText, 0, kFontNormal);
+ stringWidth = _vm->_font->getStringWidth(kKnownFontSmall, _statusText, 0, kFontNormal);
if (_statusOnceColor == -1)
color = _vm->getDisplayInfo().statusTextColor;
@@ -1555,7 +1555,7 @@ void Interface::drawStatusBar() {
textPoint.x = _vm->getDisplayInfo().statusXOffset + (_vm->getDisplayInfo().statusWidth - stringWidth) / 2;
textPoint.y = _vm->getDisplayInfo().statusYOffset + _vm->getDisplayInfo().statusTextY;
- _vm->_font->textDraw(kSmallFont, backBuffer, _statusText, textPoint, color, 0, kFontNormal);
+ _vm->_font->textDraw(kKnownFontSmall, backBuffer, _statusText, textPoint, color, 0, kFontNormal);
if (_saveReminderState > 0) {
rect.left = _vm->getDisplayInfo().saveReminderXOffset;
@@ -1922,8 +1922,8 @@ void Interface::drawPanelButtonText(Surface *ds, InterfacePanel *panel, PanelBut
}
text = _vm->getTextString(textId);
- textWidth = _vm->_font->getStringWidth(kMediumFont, text, 0, kFontNormal);
- textHeight = _vm->_font->getHeight(kMediumFont);
+ textWidth = _vm->_font->getStringWidth(kKnownFontMedium, text, 0, kFontNormal);
+ textHeight = _vm->_font->getHeight(kKnownFontMedium);
point.x = panel->x + panelButton->xOffset + (panelButton->width / 2) - (textWidth / 2);
point.y = panel->y + panelButton->yOffset + (panelButton->height / 2) - (textHeight / 2);
@@ -1937,7 +1937,7 @@ void Interface::drawPanelButtonText(Surface *ds, InterfacePanel *panel, PanelBut
panel->calcPanelButtonRect(panelButton, rect);
drawButtonBox(ds, rect, kButton, panelButton->state > 0);
- _vm->_font->textDraw(kMediumFont, ds, text, point,
+ _vm->_font->textDraw(kKnownFontMedium, ds, text, point,
textColor, _vm->getDisplayInfo().verbTextShadowColor, kFontShadow);
}
@@ -1966,20 +1966,17 @@ void Interface::drawVerbPanelText(Surface *ds, PanelButton *panelButton, int tex
int textWidth;
Point point;
int textId;
- FontId font;
if (_vm->getGameType() == GType_ITE) {
textId = verbTypeToTextStringsIdLUT[0][panelButton->id];
text = _vm->getTextString(textId);
- font = kSmallFont;
} else {
textId = verbTypeToTextStringsIdLUT[1][panelButton->id];
text = _vm->_script->_mainStrings.getString(textId + 1);
- font = kIHNMFont8;
textShadowColor = 0;
}
- textWidth = _vm->_font->getStringWidth(font, text, 0, kFontNormal);
+ textWidth = _vm->_font->getStringWidth(kKnownFontVerb, text, 0, kFontNormal);
if (_vm->getGameType() == GType_ITE) {
point.x = _mainPanel.x + panelButton->xOffset + 1 + (panelButton->width - 1 - textWidth) / 2;
@@ -1989,7 +1986,7 @@ void Interface::drawVerbPanelText(Surface *ds, PanelButton *panelButton, int tex
point.y = _mainPanel.y + panelButton->yOffset + 12;
}
- _vm->_font->textDraw(font, ds, text, point, textColor, textShadowColor, (textShadowColor != 0) ? kFontShadow : kFontNormal);
+ _vm->_font->textDraw(kKnownFontVerb, ds, text, point, textColor, textShadowColor, (textShadowColor != 0) ? kFontShadow : kFontNormal);
}
@@ -2035,7 +2032,7 @@ bool Interface::converseAddText(const char *text, int replyId, byte replyFlags,
for (i = len; i >= 0; i--) {
c = _converseWorkString[i];
- if ((c == ' ' || c == '\0') && (_vm->_font->getStringWidth(kSmallFont, _converseWorkString, i, kFontNormal) <= _vm->getDisplayInfo().converseMaxTextWidth)) {
+ if ((c == ' ' || c == '\0') && (_vm->_font->getStringWidth(kKnownFontSmall, _converseWorkString, i, kFontNormal) <= _vm->getDisplayInfo().converseMaxTextWidth)) {
break;
}
}
@@ -2144,11 +2141,11 @@ void Interface::converseDisplayTextLines(Surface *ds) {
textPoint.x = rect.left - 6;
textPoint.y = rect.top;
- _vm->_font->textDraw(kSmallFont, ds, bullet, textPoint, bulletForegnd, bulletBackgnd, (FontEffectFlags)(kFontShadow | kFontDontmap));
+ _vm->_font->textDraw(kKnownFontSmall, ds, bullet, textPoint, bulletForegnd, bulletBackgnd, (FontEffectFlags)(kFontShadow | kFontDontmap));
}
textPoint.x = rect.left + 1;
textPoint.y = rect.top;
- _vm->_font->textDraw(kSmallFont, ds, str, textPoint, foregnd, kITEColorBlack, kFontShadow);
+ _vm->_font->textDraw(kKnownFontSmall, ds, str, textPoint, foregnd, kITEColorBlack, kFontShadow);
}
if (_converseStartPos != 0) {
diff --git a/saga/ite_introproc.cpp b/saga/ite_introproc.cpp
index b51b416d1b..53a5342ee5 100644
--- a/saga/ite_introproc.cpp
+++ b/saga/ite_introproc.cpp
@@ -101,7 +101,7 @@ Event *Scene::ITEQueueDialogue(Event *q_event, int n_dialogues, const IntroDialo
textEntry.rect.right = _vm->getDisplayWidth();
textEntry.rect.top = (_vm->getLanguage() == Common::DE_DEU) ? INTRO_DE_CAPTION_Y : INTRO_CAPTION_Y;
textEntry.rect.bottom = _vm->getDisplayHeight();
- textEntry.fontId = kMediumFont;
+ textEntry.font = kKnownFontMedium;
textEntry.flags = (FontEffectFlags)(kFontOutline | kFontCentered);
for (i = 0; i < n_dialogues; i++) {
@@ -182,7 +182,7 @@ Event *Scene::ITEQueueCredits(int delta_time, int duration, int n_credits, const
int line_spacing = 0;
int paragraph_spacing;
- FontId font = kSmallFont;
+ KnownFont font = kKnownFontSmall;
int i;
int n_paragraphs = 0;
@@ -199,12 +199,12 @@ Event *Scene::ITEQueueCredits(int delta_time, int duration, int n_credits, const
switch (credits[i].type) {
case kCHeader:
- font = kSmallFont;
+ font = kKnownFontSmall;
line_spacing = 4;
n_paragraphs++;
break;
case kCText:
- font = kMediumFont;
+ font = kKnownFontMedium;
line_spacing = 2;
break;
default:
@@ -240,12 +240,12 @@ Event *Scene::ITEQueueCredits(int delta_time, int duration, int n_credits, const
switch (credits[i].type) {
case kCHeader:
- font = kSmallFont;
+ font = kKnownFontSmall;
line_spacing = 4;
y += paragraph_spacing;
break;
case kCText:
- font = kMediumFont;
+ font = kKnownFontMedium;
line_spacing = 2;
break;
default:
@@ -253,7 +253,7 @@ Event *Scene::ITEQueueCredits(int delta_time, int duration, int n_credits, const
}
textEntry.text = credits[i].string;
- textEntry.fontId = font;
+ textEntry.font = font;
textEntry.point.y = y;
entry = _vm->_scene->_textList.addEntry(textEntry);
diff --git a/saga/itedata.cpp b/saga/itedata.cpp
index 25691f68f5..e60009e17a 100644
--- a/saga/itedata.cpp
+++ b/saga/itedata.cpp
@@ -376,5 +376,108 @@ const char *ITEinterfaceTextStrings[][52] = {
}
};
+Point pieceOrigins[PUZZLE_PIECES] = {
+ Point(268, 18),
+ Point(270, 51),
+ Point( 19, 51),
+ Point( 73, 0),
+ Point( 0, 34),
+ Point(215, 0),
+ Point(159, 0),
+ Point( 9, 69),
+ Point(288, 18),
+ Point(112, 0),
+ Point( 27, 88),
+ Point( 43, 0),
+ Point( 0, 0),
+ Point(262, 0),
+ Point(271, 103)
+};
+
+const char *pieceNames[][PUZZLE_PIECES] = {
+ { "screwdriver", "pliers", "c-clamp", "wood clamp", "level",
+ "twine", "wood plane", "claw hammer", "tape measure", "hatchet",
+ "shears", "ruler", "saw", "mallet", "paint brush"
+ },
+ { "Schraubendreher", "Zange", "Schraubzwinge", "Holzzwinge", "Wasserwaage",
+ "Bindfaden", "Hobel", "Schusterhammer", "Bandma$", "Beil",
+ "Schere", "Winkel", "S\204ge", "Hammer", "Pinsel"
+ }
+};
+
+const char *hintStr[][4] = {
+ { "Check which pieces could fit in each corner first.",
+ "Check which corner has the least number of pieces that can fit and start from there.",
+ "Check each new corner and any new side for pieces that fit.",
+ "I don't see anything out of place."
+ },
+ { "\232berpr\201fe zun\204chst, welche die Eckteile sein k\224nnten.",
+ "Schau, in welche Ecke die wenigsten Teile passen, und fang dort an.",
+ "Untersuche jede Ecke und jede Seite auf Teile, die dort passen k\224nnen.",
+ "Ich sehe nichts an der falschen Stelle."
+ }
+};
+
+const char *solicitStr[][NUM_SOLICIT_REPLIES] = {
+ { "Hey, Fox! Would you like a hint?",
+ "Would you like some help?",
+ "Umm...Umm...",
+ "Psst! want a hint?",
+ "I would have done this differently, you know."
+ },
+ { "Hey, Fuchs! Brauchst Du \047nen Tip?",
+ "M\224chtest Du etwas Hilfe?"
+ "\231hm...\216hm..."
+ "Psst! \047n Tip vielleicht?"
+ "Ja, wei$t Du... ich h\204tte das anders gemacht."
+ }
+};
+
+const char portraitList[] = {
+ RID_ITE_JFERRET_SERIOUS,
+ RID_ITE_JFERRET_GOOFY,
+ RID_ITE_JFERRET_SERIOUS,
+ RID_ITE_JFERRET_GOOFY,
+ RID_ITE_JFERRET_ALOOF
+};
+
+const char *sakkaStr[][NUM_SAKKA] = {
+ { "Hey, you're not supposed to help the applicants!",
+ "Guys! This is supposed to be a test!",
+ "C'mon fellows, that's not in the rules!"
+ },
+ { "Hey, Du darfst dem Pr\201fling nicht helfen!",
+ "Hallo?! Dies soll eine Pr\201fung sein!",
+ "Also, Jungs. Schummeln steht nicht in den Regeln!"
+ }
+};
+
+const char *whineStr[][NUM_WHINES] = {
+ { "Aww, c'mon Sakka!",
+ "One hint won't hurt, will it?",
+ "Sigh...",
+ "I think that clipboard has gone to your head, Sakka!",
+ "Well, I don't recall any specific rule against hinting."
+ },
+ { "Och, sei nicht so, Sakka!"
+ "EIN Tip wird schon nicht schaden, oder?",
+ "Seufz..."
+ "Ich glaube, Du hast ein Brett vor dem Kopf, Sakka!",
+ "Hm, ich kann mich an keine Regel erinnern, die Tips verbietet."
+ }
+};
+
+const char *optionsStr[][4] = {
+ { "\"I'll do this puzzle later.\"",
+ "\"Yes, I'd like a hint please.\"",
+ "\"No, thank you, I'd like to try and solve it myself.\"",
+ "I think the %s is in the wrong place."
+ },
+ { "\"Ich l\224se das Puzzle sp\204ter.\"",
+ "\"Ja, ich m\224chte einen Tip, bitte.\"",
+ "\"Nein danke, ich m\224chte das alleine l\224sen.\"",
+ "Pssst... %s... falsche Stelle..."
+ }
+};
} // End of namespace Saga
diff --git a/saga/itedata.h b/saga/itedata.h
index bdb2c60309..c845586711 100644
--- a/saga/itedata.h
+++ b/saga/itedata.h
@@ -89,6 +89,24 @@ extern FxTable ITE_SfxTable[ITE_SFXCOUNT];
extern const char *ITEinterfaceTextStrings[][52];
+#define PUZZLE_PIECES 15
+
+extern Point pieceOrigins[PUZZLE_PIECES];
+extern const char *pieceNames[][PUZZLE_PIECES];
+
+#define NUM_SOLICIT_REPLIES 5
+extern const char *solicitStr[][NUM_SOLICIT_REPLIES];
+
+#define NUM_SAKKA 3
+extern const char *sakkaStr[][NUM_SAKKA];
+
+#define NUM_WHINES 5
+extern const char *whineStr[][NUM_WHINES];
+
+extern const char *hintStr[][4];
+extern const char portraitList[];
+extern const char *optionsStr[][4];
+
} // End of namespace Saga
#endif
diff --git a/saga/objectmap.cpp b/saga/objectmap.cpp
index 63635f0035..f4514b3ad4 100644
--- a/saga/objectmap.cpp
+++ b/saga/objectmap.cpp
@@ -242,7 +242,7 @@ void ObjectMap::draw(Surface *ds, const Point& testPoint, int color, int color2)
snprintf(txtBuf, sizeof(txtBuf), "hitZone %d", hitZoneIndex);
textPoint.x = 2;
textPoint.y = 2;
- _vm->_font->textDraw(kSmallFont, ds, txtBuf, textPoint, kITEColorBrightWhite, kITEColorBlack, kFontOutline);
+ _vm->_font->textDraw(kKnownFontSmall, ds, txtBuf, textPoint, kITEColorBrightWhite, kITEColorBlack, kFontOutline);
}
}
diff --git a/saga/puzzle.cpp b/saga/puzzle.cpp
index b53489e264..025e280021 100644
--- a/saga/puzzle.cpp
+++ b/saga/puzzle.cpp
@@ -41,99 +41,6 @@ namespace Saga {
#define PUZZLE_MOVED 0x04 // 1 when somewhere in the box
#define PUZZLE_ALL_SET PUZZLE_FIT | PUZZLE_MOVED
-static Point pieceOrigins[PUZZLE_PIECES] = {
- Point(268, 18),
- Point(270, 51),
- Point( 19, 51),
- Point( 73, 0),
- Point( 0, 34),
- Point(215, 0),
- Point(159, 0),
- Point( 9, 69),
- Point(288, 18),
- Point(112, 0),
- Point( 27, 88),
- Point( 43, 0),
- Point( 0, 0),
- Point(262, 0),
- Point(271, 103)
-};
-
-const char *pieceNames[][PUZZLE_PIECES] = {
- { "screwdriver", "pliers", "c-clamp", "wood clamp", "level",
- "twine", "wood plane", "claw hammer", "tape measure", "hatchet",
- "shears", "ruler", "saw", "mallet", "paint brush"
- },
- { "Schraubendreher", "Zange", "Schraubzwinge", "Holzzwinge", "Wasserwaage",
- "Bindfaden", "Hobel", "Schusterhammer", "Bandma$", "Beil",
- "Schere", "Winkel", "S\204ge", "Hammer", "Pinsel"
- }
-};
-
-const char *hintStr[][4] = {
- { "Check which pieces could fit in each corner first.",
- "Check which corner has the least number of pieces that can fit and start from there.",
- "Check each new corner and any new side for pieces that fit.",
- "I don't see anything out of place."
- },
- { "\232berpr\201fe zun\204chst, welche die Eckteile sein k\224nnten.",
- "Schau, in welche Ecke die wenigsten Teile passen, und fang dort an.",
- "Untersuche jede Ecke und jede Seite auf Teile, die dort passen k\224nnen.",
- "Ich sehe nichts an der falschen Stelle."
- }
-};
-
-#define NUM_SOLICIT_REPLIES 5
-const char *solicitStr[][NUM_SOLICIT_REPLIES] = {
- { "Hey, Fox! Would you like a hint?",
- "Would you like some help?",
- "Umm...Umm...",
- "Psst! want a hint?",
- "I would have done this differently, you know."
- },
- { "Hey, Fuchs! Brauchst Du \047nen Tip?",
- "M\224chtest Du etwas Hilfe?"
- "\231hm...\216hm..."
- "Psst! \047n Tip vielleicht?"
- "Ja, wei$t Du... ich h\204tte das anders gemacht."
- }
-};
-
-const char portraitList[] = {
- RID_ITE_JFERRET_SERIOUS,
- RID_ITE_JFERRET_GOOFY,
- RID_ITE_JFERRET_SERIOUS,
- RID_ITE_JFERRET_GOOFY,
- RID_ITE_JFERRET_ALOOF
-};
-
-#define NUM_SAKKA 3
-const char *sakkaStr[][NUM_SAKKA] = {
- { "Hey, you're not supposed to help the applicants!",
- "Guys! This is supposed to be a test!",
- "C'mon fellows, that's not in the rules!"
- },
- { "Hey, Du darfst dem Pr\201fling nicht helfen!",
- "Hallo?! Dies soll eine Pr\201fung sein!",
- "Also, Jungs. Schummeln steht nicht in den Regeln!"
- }
-};
-
-#define NUM_WHINES 5
-const char *whineStr[][NUM_WHINES] = {
- { "Aww, c'mon Sakka!",
- "One hint won't hurt, will it?",
- "Sigh...",
- "I think that clipboard has gone to your head, Sakka!",
- "Well, I don't recall any specific rule against hinting."
- },
- { "Och, sei nicht so, Sakka!"
- "EIN Tip wird schon nicht schaden, oder?",
- "Seufz..."
- "Ich glaube, Du hast ein Brett vor dem Kopf, Sakka!",
- "Hm, ich kann mich an keine Regel erinnern, die Tips verbietet."
- }
-};
enum rifOptions {
kROLater = 0,
@@ -142,19 +49,6 @@ enum rifOptions {
kROHint = 3
};
-const char *optionsStr[][4] = {
- { "\"I'll do this puzzle later.\"",
- "\"Yes, I'd like a hint please.\"",
- "\"No, thank you, I'd like to try and solve it myself.\"",
- "I think the %s is in the wrong place."
- },
- { "\"Ich l\224se das Puzzle sp\204ter.\"",
- "\"Ja, ich m\224chte einen Tip, bitte.\"",
- "\"Nein danke, ich m\224chte das alleine l\224sen.\"",
- "Pssst... %s... falsche Stelle..."
- }
-};
-
Puzzle::Puzzle(SagaEngine *vm) : _vm(vm), _solved(false), _active(false) {
_lang = (_vm->getLanguage() == Common::DE_DEU) ? 1 : 0;
diff --git a/saga/puzzle.h b/saga/puzzle.h
index 7617a4bea4..3df39b4631 100644
--- a/saga/puzzle.h
+++ b/saga/puzzle.h
@@ -24,7 +24,6 @@
namespace Saga {
-#define PUZZLE_PIECES 15
#define PUZZLE_SOUNDS 3622
#define PUZZLE_TOOL_SOUNDS (PUZZLE_SOUNDS + 0)
diff --git a/saga/render.cpp b/saga/render.cpp
index 269ac8396f..f0be9ac95f 100644
--- a/saga/render.cpp
+++ b/saga/render.cpp
@@ -141,20 +141,18 @@ void Render::drawScene() {
// Display rendering information
if (_flags & RF_SHOW_FPS) {
sprintf(txtBuffer, "%d", _fps);
- textPoint.x = backBufferSurface->w - _vm->_font->getStringWidth(kSmallFont, txtBuffer, 0, kFontOutline);
+ textPoint.x = backBufferSurface->w - _vm->_font->getStringWidth(kKnownFontSmall, txtBuffer, 0, kFontOutline);
textPoint.y = 2;
- _vm->_font->textDraw(kSmallFont, backBufferSurface, txtBuffer, textPoint, kITEColorBrightWhite, kITEColorBlack, kFontOutline);
+ _vm->_font->textDraw(kKnownFontSmall, backBufferSurface, txtBuffer, textPoint, kITEColorBrightWhite, kITEColorBlack, kFontOutline);
}
// Display "paused game" message, if applicable
if (_flags & RF_RENDERPAUSE) {
- FontId fontId = _vm->_font->loaded(kBigFont) ? kBigFont : kMediumFont;
-
- textPoint.x = (backBufferSurface->w - _vm->_font->getStringWidth(fontId, pauseString, 0, kFontOutline)) / 2;
+ textPoint.x = (backBufferSurface->w - _vm->_font->getStringWidth(kKnownFontPause, pauseString, 0, kFontOutline)) / 2;
textPoint.y = 90;
- _vm->_font->textDraw(fontId, backBufferSurface, pauseString, textPoint, kITEColorBrightWhite, kITEColorBlack, kFontOutline);
+ _vm->_font->textDraw(kKnownFontPause, backBufferSurface, pauseString, textPoint, kITEColorBrightWhite, kITEColorBlack, kFontOutline);
}
// Update user interface
@@ -163,7 +161,7 @@ void Render::drawScene() {
// Display text formatting test, if applicable
if (_flags & RF_TEXT_TEST) {
Rect rect(mousePoint.x, mousePoint.y, mousePoint.x + 100, mousePoint.y + 50);
- _vm->_font->textDrawRect(kMediumFont, backBufferSurface, test_txt, rect,
+ _vm->_font->textDrawRect(kKnownFontMedium, backBufferSurface, test_txt, rect,
kITEColorBrightWhite, kITEColorBlack, (FontEffectFlags)(kFontOutline | kFontCentered));
}
diff --git a/saga/saga.h b/saga/saga.h
index 0f204d333c..9138333fb0 100644
--- a/saga/saga.h
+++ b/saga/saga.h
@@ -321,24 +321,6 @@ enum GameFeatures {
GF_SCENE_SUBSTITUTES = 1 << 3
};
-enum FontId {
- kSmallFont,
- kMediumFont,
- kBigFont,
-
- kIHNMFont8 = 4,
- kIHNMMainFont = 6
-};
-
-enum FontEffectFlags {
- kFontNormal = 0,
- kFontOutline = 1 << 0,
- kFontShadow = 1 << 1,
- kFontBold = 1 << 2,
- kFontCentered = 1 << 3,
- kFontDontmap = 1 << 4
-};
-
struct GameSoundInfo {
GameSoundTypes resourceType;
long frequency;
@@ -685,8 +667,6 @@ public:
public:
bool initGame(void);
-// RSCFILE_CONTEXT *getFileContext(uint16 type, int param);
-// bool isBigEndianFile(const char *filename);
public:
const GameDescription *getGameDescription() const { return _gameDescription; }
const bool isBigEndian() const { return (_gameDescription->features & GF_BIG_ENDIAN_DATA) != 0; }
diff --git a/saga/scene.cpp b/saga/scene.cpp
index c273941f6c..99619713b5 100644
--- a/saga/scene.cpp
+++ b/saga/scene.cpp
@@ -240,9 +240,9 @@ void Scene::drawTextList(Surface *ds) {
if (entry->display) {
if (entry->useRect) {
- _vm->_font->textDrawRect(entry->fontId, ds, entry->text, entry->rect, entry->color, entry->effectColor, entry->flags);
+ _vm->_font->textDrawRect(entry->font, ds, entry->text, entry->rect, entry->color, entry->effectColor, entry->flags);
} else {
- _vm->_font->textDraw(entry->fontId, ds, entry->text, entry->point, entry->color, entry->effectColor, entry->flags);
+ _vm->_font->textDraw(entry->font, ds, entry->text, entry->point, entry->color, entry->effectColor, entry->flags);
}
}
}
@@ -452,9 +452,9 @@ void Scene::changeScene(int16 sceneNumber, int actorsEntrance, SceneTransitionTy
}
_vm->_interface->setStatusText("Click or Press Return to continue. Press Q to quit.", 96);
- _vm->_font->textDrawRect(kMediumFont, backBuffer, sceneSubstitutes[i].title,
+ _vm->_font->textDrawRect(kKnownFontMedium, backBuffer, sceneSubstitutes[i].title,
Common::Rect(0, 7, _vm->getDisplayWidth(), 27), 1, 15, kFontOutline);
- _vm->_font->textDrawRect(kMediumFont, backBuffer, sceneSubstitutes[i].message,
+ _vm->_font->textDrawRect(kKnownFontMedium, backBuffer, sceneSubstitutes[i].message,
Common::Rect(24, getHeight() - 33, _vm->getDisplayWidth() - 11,
getHeight()), 1, 15, kFontOutline);
return;
diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp
index 4fab7ccb66..e81a8106b1 100644
--- a/saga/sfuncs.cpp
+++ b/saga/sfuncs.cpp
@@ -1309,7 +1309,7 @@ void Script::sfPlacard(SCRIPTFUNC_PARAMS) {
textEntry.effectColor = kITEColorBlack;
textEntry.point.x = _vm->getDisplayWidth() / 2;
textEntry.point.y = (_vm->_scene->getHeight() - _vm->_font->getHeight(kMediumFont)) / 2;
- textEntry.fontId = kMediumFont;
+ textEntry.font = kKnownFontMedium;
textEntry.flags = (FontEffectFlags)(kFontOutline | kFontCentered);
textEntry.text = thread->_strings->getString(stringId);
@@ -1591,10 +1591,7 @@ void Script::sfScriptText(SCRIPTFUNC_PARAMS) {
text = thread->_strings->getString(stringId);
- if (_vm->getGameType() == GType_ITE)
- width = _vm->_font->getStringWidth(kMediumFont, text, 0, kFontOutline);
- else
- width = _vm->_font->getStringWidth(kIHNMMainFont, text, 0, kFontOutline);
+ width = _vm->_font->getStringWidth(kKnownFontScript, text, 0, kFontOutline);
rect.top = point.y - 6;
rect.setHeight(12);
rect.left = point.x - width / 2;