aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Fry2018-04-27 17:48:55 +1000
committerEugene Sandulenko2018-07-20 06:43:33 +0000
commita36cd2e39fce85e5cc1024322767284ba9b8e3b4 (patch)
tree50b71ed75459fe07584909a80e9264b3dc1f3e55
parent8e462f313fa195ce532a7a684d17a487cbdd4613 (diff)
downloadscummvm-rg350-a36cd2e39fce85e5cc1024322767284ba9b8e3b4.tar.gz
scummvm-rg350-a36cd2e39fce85e5cc1024322767284ba9b8e3b4.tar.bz2
scummvm-rg350-a36cd2e39fce85e5cc1024322767284ba9b8e3b4.zip
ILLUSIONS: Name menu border color variables to add readability
Fix menu hover color layer position.
-rw-r--r--engines/illusions/menusystem.cpp20
-rw-r--r--engines/illusions/menusystem.h4
-rw-r--r--engines/illusions/screentext.cpp14
-rw-r--r--engines/illusions/screentext.h8
-rw-r--r--engines/illusions/textdrawer.cpp16
-rw-r--r--engines/illusions/textdrawer.h2
6 files changed, 31 insertions, 33 deletions
diff --git a/engines/illusions/menusystem.cpp b/engines/illusions/menusystem.cpp
index 5002484190..391cded739 100644
--- a/engines/illusions/menusystem.cpp
+++ b/engines/illusions/menusystem.cpp
@@ -50,9 +50,9 @@ void MenuItem::executeAction() {
// BaseMenu
-BaseMenu::BaseMenu(BaseMenuSystem *menuSystem, uint32 fontId, byte field8, byte fieldA, byte textColor, byte fieldE,
+BaseMenu::BaseMenu(BaseMenuSystem *menuSystem, uint32 fontId, byte backgroundColor, byte borderColor, byte textColor, byte fieldE,
uint defaultMenuItemIndex)
- : _menuSystem(menuSystem), _fontId(fontId), _field8(field8), _fieldA(fieldA), _textColor(textColor), _fieldE(fieldE),
+ : _menuSystem(menuSystem), _fontId(fontId), _backgroundColor(backgroundColor), _borderColor(borderColor), _textColor(textColor), _fieldE(fieldE),
_defaultMenuItemIndex(defaultMenuItemIndex)
{
}
@@ -176,12 +176,10 @@ void BaseMenuSystem::calcMenuItemRect(uint menuItemIndex, WRect &rect) {
int charHeight = font->getCharHeight() + font->getLineIncr();
_vm->_screenText->getTextInfoPosition(rect._topLeft);
- /* TODO
- if (_activeMenu->_field8) {
+ if (_activeMenu->_backgroundColor) {
rect._topLeft.y += 4;
rect._topLeft.x += 4;
}
- */
rect._topLeft.y += charHeight * (menuItemIndex + _menuLinesCount - 1);
WidthHeight textInfoDimensions;
@@ -258,7 +256,7 @@ void BaseMenuSystem::placeActorHoverBackground() {
WidthHeight textInfoDimensions;
_vm->_screenText->getTextInfoDimensions(textInfoDimensions);
- if ( _activeMenu->_field8 && _activeMenu->_fieldA != _activeMenu->_field8)
+ if ( _activeMenu->_backgroundColor && _activeMenu->_borderColor != _activeMenu->_backgroundColor)
textInfoDimensions._width -= 6;
WidthHeight frameDimensions;
@@ -269,7 +267,7 @@ void BaseMenuSystem::placeActorHoverBackground() {
if (frameDimensions._height < charHeight)
charHeight = frameDimensions._height;
- v0->drawActorRect(Common::Rect(textInfoDimensions._width - 1, charHeight - 1), _activeMenu->_fieldE);
+ v0->drawActorRect(Common::Rect(textInfoDimensions._width - 1, charHeight), _activeMenu->_fieldE);
updateActorHoverBackground();
}
@@ -310,7 +308,7 @@ void BaseMenuSystem::placeActorTextColorRect() {
_vm->_screenText->getTextInfoPosition(textInfoPosition);
_vm->_screenText->getTextInfoDimensions(textInfoDimensions);
- if (_activeMenu->_field8 && _activeMenu->_fieldA != _activeMenu->_field8) {
+ if (_activeMenu->_backgroundColor && _activeMenu->_borderColor != _activeMenu->_backgroundColor) {
textInfoDimensions._width -= 2;
textInfoDimensions._height -= 6;
}
@@ -407,13 +405,13 @@ uint BaseMenuSystem::drawMenuText(BaseMenu *menu) {
Common::Point textPt;
int16 v9 = 0;
- if (menu->_field8)
+ if (menu->_backgroundColor)
v9 = 4;
textPt.x = v9;
textPt.y = v9;
uint flags = TEXT_FLAG_LEFT_ALIGN;
- if (menu->_field8 != menu->_fieldA)
+ if (menu->_backgroundColor != menu->_borderColor)
flags |= TEXT_FLAG_BORDER_DECORATION;
WidthHeight dimensions;
@@ -421,7 +419,7 @@ uint BaseMenuSystem::drawMenuText(BaseMenu *menu) {
dimensions._height = 180;
uint16 *outTextPtr;
- if (!_vm->_screenText->insertText(text, menu->_fontId, dimensions, textPt, flags, menu->_field8, menu->_fieldA, 0xFF, 0xFF, 0xFF, outTextPtr)) {
+ if (!_vm->_screenText->insertText(text, menu->_fontId, dimensions, textPt, flags, menu->_backgroundColor, menu->_borderColor, 0xFF, 0xFF, 0xFF, outTextPtr)) {
--lineCount;
for ( ; *outTextPtr; ++outTextPtr) {
if (*outTextPtr == 13)
diff --git a/engines/illusions/menusystem.h b/engines/illusions/menusystem.h
index a7ef083f65..d9961f82d5 100644
--- a/engines/illusions/menusystem.h
+++ b/engines/illusions/menusystem.h
@@ -54,7 +54,7 @@ protected:
class BaseMenu {
public:
- BaseMenu(BaseMenuSystem *menuSystem, uint32 fontId, byte field8, byte fieldA, byte textColor, byte fieldE,
+ BaseMenu(BaseMenuSystem *menuSystem, uint32 fontId, byte backgroundColor, byte borderColor, byte textColor, byte fieldE,
uint defaultMenuItemIndex);
virtual ~BaseMenu();
void addText(const Common::String text);
@@ -68,7 +68,7 @@ public://protected://TODO
typedef Common::Array<MenuItem*> MenuItems;
BaseMenuSystem *_menuSystem;
uint32 _fontId;
- byte _field8, _fieldA, _textColor, _fieldE;
+ byte _backgroundColor, _borderColor, _textColor, _fieldE;
uint _field2C18;
uint _defaultMenuItemIndex;
Common::Array<Common::String> _text;
diff --git a/engines/illusions/screentext.cpp b/engines/illusions/screentext.cpp
index 0894330a55..de664d635a 100644
--- a/engines/illusions/screentext.cpp
+++ b/engines/illusions/screentext.cpp
@@ -85,7 +85,7 @@ void ScreenText::clipTextInfoPosition(Common::Point &position) {
}
bool ScreenText::refreshScreenText(FontResource *font, WidthHeight dimensions, Common::Point offsPt,
- uint16 *text, uint textFlags, uint16 color2, uint16 color1, uint16 *&outTextPtr) {
+ uint16 *text, uint textFlags, uint16 backgroundColor, uint16 borderColor, uint16 *&outTextPtr) {
TextDrawer textDrawer;
bool done = textDrawer.wrapText(font, text, &dimensions, offsPt, textFlags, outTextPtr);
if (textFlags & TEXT_FLAG_BORDER_DECORATION) {
@@ -95,12 +95,12 @@ bool ScreenText::refreshScreenText(FontResource *font, WidthHeight dimensions, C
_surface = _vm->_screen->allocSurface(dimensions._width, dimensions._height);
_surface->fillRect(Common::Rect(0, 0, _surface->w, _surface->h), _vm->_screen->getColorKey1());
_dimensions = dimensions;
- textDrawer.drawText(_vm->_screen, _surface, color2, color1);
+ textDrawer.drawText(_vm->_screen, _surface, backgroundColor, borderColor);
return done;
}
bool ScreenText::insertText(uint16 *text, uint32 fontId, WidthHeight dimensions, Common::Point offsPt, uint flags,
- uint16 color2, uint16 color1, byte colorR, byte colorG, byte colorB, uint16 *&outTextPtr) {
+ uint16 backgroundColor, uint16 borderColor, byte colorR, byte colorG, byte colorB, uint16 *&outTextPtr) {
if (!_screenTexts.empty()) {
ScreenTextEntry *screenText = _screenTexts.back();
@@ -121,8 +121,8 @@ bool ScreenText::insertText(uint16 *text, uint32 fontId, WidthHeight dimensions,
screenText->_info._flags |= 1;
else
screenText->_info._flags |= 2;
- screenText->_info._color2 = color2;
- screenText->_info._color1 = color1;
+ screenText->_info._backgroundColor = backgroundColor;
+ screenText->_info._borderColor = borderColor;
screenText->_info._colorR = colorR;
screenText->_info._colorG = colorG;
screenText->_info._colorB = colorB;
@@ -130,7 +130,7 @@ bool ScreenText::insertText(uint16 *text, uint32 fontId, WidthHeight dimensions,
FontResource *font = _vm->_dict->findFont(screenText->_info._fontId);
bool done = refreshScreenText(font, screenText->_info._dimensions, screenText->_info._offsPt,
- text, screenText->_info._flags, screenText->_info._color2, screenText->_info._color1,
+ text, screenText->_info._flags, screenText->_info._backgroundColor, screenText->_info._borderColor,
outTextPtr);
_vm->_screenPalette->setPaletteEntry(font->getColorIndex(), screenText->_info._colorR, screenText->_info._colorG, screenText->_info._colorB);
@@ -159,7 +159,7 @@ void ScreenText::removeText() {
uint16 *outTextPtr;
FontResource *font = _vm->_dict->findFont(screenText->_info._fontId);
refreshScreenText(font, screenText->_info._dimensions, screenText->_info._offsPt,
- screenText->_text, screenText->_info._flags, screenText->_info._color2, screenText->_info._color1,
+ screenText->_text, screenText->_info._flags, screenText->_info._backgroundColor, screenText->_info._borderColor,
outTextPtr);
_vm->_screenPalette->setPaletteEntry(font->getColorIndex(), screenText->_info._colorR, screenText->_info._colorG, screenText->_info._colorB);
setTextInfoPosition(screenText->_info._position);
diff --git a/engines/illusions/screentext.h b/engines/illusions/screentext.h
index e71b6ccbbe..f8953e3330 100644
--- a/engines/illusions/screentext.h
+++ b/engines/illusions/screentext.h
@@ -43,8 +43,8 @@ struct ScreenTextInfo {
WidthHeight _dimensions;
Common::Point _offsPt;
uint32 _fontId;
- uint16 _color2;
- uint16 _color1;
+ uint16 _backgroundColor;
+ uint16 _borderColor;
byte _colorR, _colorG, _colorB;
uint _flags;
};
@@ -64,9 +64,9 @@ public:
void updateTextInfoPosition(Common::Point position);
void clipTextInfoPosition(Common::Point &position);
bool refreshScreenText(FontResource *font, WidthHeight dimensions, Common::Point offsPt,
- uint16 *text, uint textFlags, uint16 color2, uint16 color1, uint16 *&outTextPtr);
+ uint16 *text, uint textFlags, uint16 backgroundColor, uint16 borderColor, uint16 *&outTextPtr);
bool insertText(uint16 *text, uint32 fontId, WidthHeight dimensions, Common::Point offsPt, uint flags,
- uint16 color2, uint16 color1, byte colorR, byte colorG, byte colorB, uint16 *&outTextPtr);
+ uint16 backgroundColor, uint16 borderColor, byte colorR, byte colorG, byte colorB, uint16 *&outTextPtr);
void removeText();
void clearText();
public:
diff --git a/engines/illusions/textdrawer.cpp b/engines/illusions/textdrawer.cpp
index e743330434..b1c9658ee2 100644
--- a/engines/illusions/textdrawer.cpp
+++ b/engines/illusions/textdrawer.cpp
@@ -41,21 +41,21 @@ bool TextDrawer::wrapText(FontResource *font, uint16 *text, WidthHeight *dimensi
return done;
}
-void TextDrawer::drawText(Screen *screen, Graphics::Surface *surface, uint16 color2, uint16 color1) {
+void TextDrawer::drawText(Screen *screen, Graphics::Surface *surface, uint16 backgroundColor, uint16 borderColor) {
// 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->frameRect(Common::Rect(0, 0, surface->w - 3, surface->h - 6), borderColor);
- 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(1, 1, surface->w - 4, 4), backgroundColor);
+ surface->fillRect(Common::Rect(1, surface->h - 10, surface->w - 4, surface->h - 7), backgroundColor);
+ surface->fillRect(Common::Rect(1, 4, 4, surface->h - 10), backgroundColor);
+ surface->fillRect(Common::Rect(surface->w - 7, 4, surface->w - 4, surface->h - 10), backgroundColor);
- 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);
+ surface->fillRect(Common::Rect(3, surface->h - 7, surface->w, surface->h), borderColor);
+ surface->fillRect(Common::Rect(surface->w - 3, 6, surface->w, surface->h), borderColor);
x = 4;
y = 4;
}
diff --git a/engines/illusions/textdrawer.h b/engines/illusions/textdrawer.h
index 290d6c7251..68b28e0713 100644
--- a/engines/illusions/textdrawer.h
+++ b/engines/illusions/textdrawer.h
@@ -46,7 +46,7 @@ class TextDrawer {
public:
bool wrapText(FontResource *font, uint16 *text, WidthHeight *dimensions, Common::Point offsPt,
uint textFlags, uint16 *&outTextPtr);
- void drawText(Screen *screen, Graphics::Surface *surface, uint16 color2, uint16 color1);
+ void drawText(Screen *screen, Graphics::Surface *surface, uint16 backgroundColor, uint16 borderColor);
protected:
FontResource *_font;
uint16 *_text;