From 8e462f313fa195ce532a7a684d17a487cbdd4613 Mon Sep 17 00:00:00 2001 From: Eric Fry Date: Thu, 26 Apr 2018 23:29:37 +1000 Subject: ILLUSIONS: Work on menu border decoration --- engines/illusions/menusystem.cpp | 6 +----- engines/illusions/resources/fontresource.h | 4 ++-- engines/illusions/screentext.cpp | 4 ++++ engines/illusions/textdrawer.cpp | 19 ++++++++++++++++++- 4 files changed, 25 insertions(+), 8 deletions(-) (limited to 'engines/illusions') diff --git a/engines/illusions/menusystem.cpp b/engines/illusions/menusystem.cpp index 266d0b9c2c..5002484190 100644 --- a/engines/illusions/menusystem.cpp +++ b/engines/illusions/menusystem.cpp @@ -258,11 +258,9 @@ void BaseMenuSystem::placeActorHoverBackground() { WidthHeight textInfoDimensions; _vm->_screenText->getTextInfoDimensions(textInfoDimensions); - /* TODO if ( _activeMenu->_field8 && _activeMenu->_fieldA != _activeMenu->_field8) textInfoDimensions._width -= 6; - */ - + WidthHeight frameDimensions; v0->getActorFrameDimensions(frameDimensions); @@ -312,12 +310,10 @@ void BaseMenuSystem::placeActorTextColorRect() { _vm->_screenText->getTextInfoPosition(textInfoPosition); _vm->_screenText->getTextInfoDimensions(textInfoDimensions); - /* TODO if (_activeMenu->_field8 && _activeMenu->_fieldA != _activeMenu->_field8) { textInfoDimensions._width -= 2; textInfoDimensions._height -= 6; } - */ v0->setActorPosition(textInfoPosition); v0->drawActorRect(Common::Rect(textInfoDimensions._width - 1, textInfoDimensions._height - 1), _activeMenu->_textColor); diff --git a/engines/illusions/resources/fontresource.h b/engines/illusions/resources/fontresource.h index fa758bc4f1..6204c9df8b 100644 --- a/engines/illusions/resources/fontresource.h +++ b/engines/illusions/resources/fontresource.h @@ -81,11 +81,11 @@ public: class FontInstance : public ResourceInstance { public: - FontInstance(IllusionsEngine *vm); + FontInstance(IllusionsEngine *vm); virtual void load(Resource *resource); virtual void unload(); public: - IllusionsEngine *_vm; + IllusionsEngine *_vm; FontResource *_fontResource; uint32 _resId; }; diff --git a/engines/illusions/screentext.cpp b/engines/illusions/screentext.cpp index 0a91570859..0894330a55 100644 --- a/engines/illusions/screentext.cpp +++ b/engines/illusions/screentext.cpp @@ -88,6 +88,10 @@ bool ScreenText::refreshScreenText(FontResource *font, WidthHeight dimensions, C uint16 *text, uint textFlags, uint16 color2, uint16 color1, uint16 *&outTextPtr) { TextDrawer textDrawer; bool done = textDrawer.wrapText(font, text, &dimensions, offsPt, textFlags, outTextPtr); + if (textFlags & TEXT_FLAG_BORDER_DECORATION) { + dimensions._width += 11; + dimensions._height += 14; + } _surface = _vm->_screen->allocSurface(dimensions._width, dimensions._height); _surface->fillRect(Common::Rect(0, 0, _surface->w, _surface->h), _vm->_screen->getColorKey1()); _dimensions = dimensions; diff --git a/engines/illusions/textdrawer.cpp b/engines/illusions/textdrawer.cpp index 1d1ac5797f..e743330434 100644 --- a/engines/illusions/textdrawer.cpp +++ b/engines/illusions/textdrawer.cpp @@ -43,10 +43,27 @@ bool TextDrawer::wrapText(FontResource *font, uint16 *text, WidthHeight *dimensi void TextDrawer::drawText(Screen *screen, Graphics::Surface *surface, uint16 color2, uint16 color1) { // TODO Fill box, draw borders and shadow if flags are set + uint16 x = 0; + uint16 y = 0; + + if (_textFlags & TEXT_FLAG_BORDER_DECORATION) { + surface->frameRect(Common::Rect(0, 0, surface->w - 3, surface->h - 6), color1); + + surface->fillRect(Common::Rect(1, 1, surface->w - 4, 4), color2); + surface->fillRect(Common::Rect(1, surface->h - 10, surface->w - 4, surface->h - 7), color2); + surface->fillRect(Common::Rect(1, 4, 4, surface->h - 10), color2); + surface->fillRect(Common::Rect(surface->w - 7, 4, surface->w - 4, surface->h - 10), color2); + + surface->fillRect(Common::Rect(3, surface->h - 7, surface->w, surface->h), color1); + surface->fillRect(Common::Rect(surface->w - 3, 6, surface->w, surface->h), color1); + x = 4; + y = 4; + } + for (Common::Array::iterator it = _textLines.begin(); it != _textLines.end(); ++it) { const TextLine &textLine = *it; if (textLine._text) - screen->drawText(_font, surface, textLine._x, textLine._y, textLine._text, textLine._length); + screen->drawText(_font, surface, textLine._x + x, textLine._y + y, textLine._text, textLine._length); #if 0 for (int16 linePos = 0; linePos < textLine._length; ++linePos) { const uint16 c = textLine._text[linePos]; -- cgit v1.2.3