-implement font substitution funcs
-move puzzle data to itedata svn-id: r19411
This commit is contained in:
parent
7f691c3ca2
commit
43a083a117
15 changed files with 303 additions and 228 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "saga/itedata.h"
|
||||
#include "saga/list.h"
|
||||
#include "saga/saga.h"
|
||||
#include "saga/font.h"
|
||||
|
||||
namespace Saga {
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
109
saga/font.h
109
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));
|
||||
}
|
||||
|
||||
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:
|
||||
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;
|
||||
FontId knownFont2FontIdx(KnownFont font);
|
||||
|
||||
if (numBits % 8) {
|
||||
byteLength++;
|
||||
}
|
||||
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);
|
||||
|
||||
return byteLength;
|
||||
}
|
||||
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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
103
saga/itedata.cpp
103
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
106
saga/puzzle.cpp
106
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;
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
namespace Saga {
|
||||
|
||||
#define PUZZLE_PIECES 15
|
||||
|
||||
#define PUZZLE_SOUNDS 3622
|
||||
#define PUZZLE_TOOL_SOUNDS (PUZZLE_SOUNDS + 0)
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
20
saga/saga.h
20
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; }
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue