Fix fonts in intro. It is a very dirty code. Actually we should specify

font Ids in game settings. Also uhnm demo will definitely not work with current
code as it has lesser number of fonts.

svn-id: r18900
This commit is contained in:
Eugene Sandulenko 2005-09-29 15:57:41 +00:00
parent a7ec941d30
commit 36f77ad3f9
5 changed files with 23 additions and 12 deletions

View File

@ -1022,11 +1022,11 @@ void Actor::handleSpeech(int msec) {
_activeSpeech.drawRect.bottom = _speechBoxScript.bottom;
} else {
width = _activeSpeech.speechBox.width();
height = _vm->_font->getHeight(kMediumFont, _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
height = _vm->_font->getHeight((_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont), _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
if (height > 40 && width < _vm->getDisplayWidth() - 100) {
width = _vm->getDisplayWidth() - 100;
height = _vm->_font->getHeight(kMediumFont, _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
height = _vm->_font->getHeight((_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont), _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
}
_activeSpeech.speechBox.setWidth(width);
@ -1635,8 +1635,8 @@ void Actor::drawSpeech(void) {
}
if (_activeSpeech.actorsCount > 1) {
height = _vm->_font->getHeight(kMediumFont);
width = _vm->_font->getStringWidth(kMediumFont, _activeSpeech.strings[0], 0, kFontNormal);
height = _vm->_font->getHeight((_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont));
width = _vm->_font->getStringWidth((_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont), _activeSpeech.strings[0], 0, kFontNormal);
for (i = 0; i < _activeSpeech.actorsCount; i++) {
actor = getActor(_activeSpeech.actorIds[i]);
@ -1645,11 +1645,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->getSceneHeight() - 10 - height);
_vm->_font->textDraw(kMediumFont, backBuffer, _activeSpeech.strings[0], textPoint,
_vm->_font->textDraw((_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont), backBuffer, _activeSpeech.strings[0], textPoint,
_activeSpeech.speechColor[i], _activeSpeech.outlineColor[i], _activeSpeech.getFontFlags(i));
}
} else {
_vm->_font->textDrawRect(kMediumFont, backBuffer, _activeSpeech.strings[0], _activeSpeech.drawRect, _activeSpeech.speechColor[0],
_vm->_font->textDrawRect((_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont), backBuffer, _activeSpeech.strings[0], _activeSpeech.drawRect, _activeSpeech.speechColor[0],
_activeSpeech.outlineColor[0], _activeSpeech.getFontFlags(0));
}
}

View File

@ -693,7 +693,7 @@ static GameFontDescription IHNMCD_GameFonts[] = {
{5},
{6},
{7},
{8}
{8} // kIHNMMainFont
};
static GameSoundInfo IHNM_GameSound = {

View File

@ -159,7 +159,7 @@ struct Converse {
int replyBit;
};
enum ITEColors {
enum GameColors {
kITEColorBrightWhite = 0x01,
kITEColorWhite = 0x02,
kITEColorLightGrey = 0x04,
@ -174,7 +174,9 @@ enum ITEColors {
kITEColorLightBlue92 = 0x92,
kITEColorBlue = 0x93,
kITEColorLightBlue94 = 0x94,
kITEColorLightBlue96 = 0x96
kITEColorLightBlue96 = 0x96,
kIHNMColorBlack = 0xfa
};
enum StatusTextInputState {

View File

@ -319,7 +319,9 @@ enum GameFeatures {
enum FontId {
kSmallFont,
kMediumFont,
kBigFont
kBigFont,
kIHNMMainFont = 6
};
enum FontEffectFlags {

View File

@ -1583,13 +1583,20 @@ void Script::sfScriptText(SCRIPTFUNC_PARAMS) {
point.y = thread->pop();
text = thread->_strings->getString(stringId);
width = _vm->_font->getStringWidth(kMediumFont, text, 0, kFontOutline);
if (_vm->getGameType() == GType_ITE)
width = _vm->_font->getStringWidth(kMediumFont, text, 0, kFontOutline);
else
width = _vm->_font->getStringWidth(kIHNMMainFont, text, 0, kFontOutline);
rect.top = point.y - 6;
rect.setHeight(12);
rect.left = point.x - width / 2;
rect.setWidth(width);
_vm->_actor->setSpeechColor(color, kITEColorBlack);
if (_vm->getGameType() == GType_ITE)
_vm->_actor->setSpeechColor(color, kITEColorBlack);
else
_vm->_actor->setSpeechColor(color, kIHNMColorBlack);
_vm->_actor->nonActorSpeech(rect, &text, 1, -1, flags);
}