diff options
author | Martin Kiewitz | 2010-01-31 21:54:43 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-01-31 21:54:43 +0000 |
commit | 19bca959050503e866b5c44f33a792e8424a6711 (patch) | |
tree | f93b230c674281804e366d28072e7c72dc94afce /engines/sci | |
parent | fb3d272c3c6310fb5aebdec035907134debddbff (diff) | |
download | scummvm-rg350-19bca959050503e866b5c44f33a792e8424a6711.tar.gz scummvm-rg350-19bca959050503e866b5c44f33a792e8424a6711.tar.bz2 scummvm-rg350-19bca959050503e866b5c44f33a792e8424a6711.zip |
SCI: renamed Text class to GfxText16
svn-id: r47780
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/graphics/controls.cpp | 32 | ||||
-rw-r--r-- | engines/sci/graphics/controls.h | 6 | ||||
-rw-r--r-- | engines/sci/graphics/gui.cpp | 44 | ||||
-rw-r--r-- | engines/sci/graphics/gui.h | 4 | ||||
-rw-r--r-- | engines/sci/graphics/gui32.cpp | 1 | ||||
-rw-r--r-- | engines/sci/graphics/menu.cpp | 18 | ||||
-rw-r--r-- | engines/sci/graphics/menu.h | 4 | ||||
-rw-r--r-- | engines/sci/graphics/paint16.cpp | 6 | ||||
-rw-r--r-- | engines/sci/graphics/paint16.h | 4 | ||||
-rw-r--r-- | engines/sci/graphics/ports.cpp | 12 | ||||
-rw-r--r-- | engines/sci/graphics/ports.h | 8 | ||||
-rw-r--r-- | engines/sci/graphics/text16.cpp (renamed from engines/sci/graphics/text.cpp) | 48 | ||||
-rw-r--r-- | engines/sci/graphics/text16.h (renamed from engines/sci/graphics/text.h) | 18 | ||||
-rw-r--r-- | engines/sci/module.mk | 2 |
14 files changed, 103 insertions, 104 deletions
diff --git a/engines/sci/graphics/controls.cpp b/engines/sci/graphics/controls.cpp index 2b097aaa26..fb1e40122f 100644 --- a/engines/sci/graphics/controls.cpp +++ b/engines/sci/graphics/controls.cpp @@ -34,13 +34,13 @@ #include "sci/graphics/ports.h" #include "sci/graphics/paint16.h" #include "sci/graphics/font.h" -#include "sci/graphics/text.h" +#include "sci/graphics/text16.h" #include "sci/graphics/controls.h" namespace Sci { -Controls::Controls(SegManager *segMan, GfxPorts *ports, GfxPaint16 *paint16, Text *text) - : _segMan(segMan), _ports(ports), _paint16(paint16), _text(text) { +Controls::Controls(SegManager *segMan, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16) + : _segMan(segMan), _ports(ports), _paint16(paint16), _text16(text16) { init(); } @@ -56,7 +56,7 @@ const char controlListDownArrow[2] = { 0x19, 0 }; void Controls::drawListControl(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 upperPos, int16 cursorPos, bool isAlias) { Common::Rect workerRect = rect; - GuiResourceId oldFontId = _text->GetFontId(); + GuiResourceId oldFontId = _text16->GetFontId(); int16 oldPenColor = _ports->_curPort->penClr; uint16 fontSize = 0; int16 i; @@ -73,9 +73,9 @@ void Controls::drawListControl(Common::Rect rect, reg_t obj, int16 maxChars, int // we draw UP arrow one pixel lower than sierra did, because it looks nicer. Also the DOWN arrow has one pixel // line inbetween as well workerRect.top++; - _text->Box(controlListUpArrow, 0, workerRect, SCI_TEXT_ALIGNMENT_CENTER, 0); + _text16->Box(controlListUpArrow, 0, workerRect, SCI_TEXT16_ALIGNMENT_CENTER, 0); workerRect.top = workerRect.bottom - 10; - _text->Box(controlListDownArrow, 0, workerRect, SCI_TEXT_ALIGNMENT_CENTER, 0); + _text16->Box(controlListDownArrow, 0, workerRect, SCI_TEXT16_ALIGNMENT_CENTER, 0); // Draw inner lines workerRect.top = rect.top + 9; @@ -83,7 +83,7 @@ void Controls::drawListControl(Common::Rect rect, reg_t obj, int16 maxChars, int _paint16->frameRect(workerRect); workerRect.grow(-1); - _text->SetFont(fontId); + _text16->SetFont(fontId); fontSize = _ports->_curPort->fontHeight; _ports->penColor(_ports->_curPort->penClr); _ports->backColor(_ports->_curPort->backClr); workerRect.bottom = workerRect.top + 9; @@ -96,7 +96,7 @@ void Controls::drawListControl(Common::Rect rect, reg_t obj, int16 maxChars, int if (listEntry[0]) { _ports->moveTo(workerRect.left, workerRect.top); listEntryLen = strlen(listEntry); - _text->Draw(listEntry, 0, MIN(maxChars, listEntryLen), oldFontId, oldPenColor); + _text16->Draw(listEntry, 0, MIN(maxChars, listEntryLen), oldFontId, oldPenColor); if ((!isAlias) && (i == cursorPos)) { _paint16->invertRect(workerRect); } @@ -106,7 +106,7 @@ void Controls::drawListControl(Common::Rect rect, reg_t obj, int16 maxChars, int break; } - _text->SetFont(oldFontId); + _text16->SetFont(oldFontId); } void Controls::TexteditCursorDraw(Common::Rect rect, const char *text, uint16 curPos) { @@ -114,12 +114,12 @@ void Controls::TexteditCursorDraw(Common::Rect rect, const char *text, uint16 cu if (!_texteditCursorVisible) { textWidth = 0; for (i = 0; i < curPos; i++) { - textWidth += _text->_font->getCharWidth(text[i]); + textWidth += _text16->_font->getCharWidth(text[i]); } _texteditCursorRect.left = rect.left + textWidth; _texteditCursorRect.top = rect.top; - _texteditCursorRect.bottom = _texteditCursorRect.top + _text->_font->getHeight(); - _texteditCursorRect.right = _texteditCursorRect.left + (text[curPos] == 0 ? 1 : _text->_font->getCharWidth(text[curPos])); + _texteditCursorRect.bottom = _texteditCursorRect.top + _text16->_font->getHeight(); + _texteditCursorRect.right = _texteditCursorRect.left + (text[curPos] == 0 ? 1 : _text16->_font->getCharWidth(text[curPos])); _paint16->invertRect(_texteditCursorRect); _paint16->bitsShow(_texteditCursorRect); _texteditCursorVisible = true; @@ -205,17 +205,17 @@ void Controls::TexteditChange(reg_t controlObject, reg_t eventObject) { } if (textChanged) { - GuiResourceId oldFontId = _text->GetFontId(); + GuiResourceId oldFontId = _text16->GetFontId(); GuiResourceId fontId = GET_SEL32V(_segMan, controlObject, font); rect = Common::Rect(GET_SEL32V(_segMan, controlObject, nsLeft), GET_SEL32V(_segMan, controlObject, nsTop), GET_SEL32V(_segMan, controlObject, nsRight), GET_SEL32V(_segMan, controlObject, nsBottom)); TexteditCursorErase(); _paint16->eraseRect(rect); - _text->Box(text.c_str(), 0, rect, SCI_TEXT_ALIGNMENT_LEFT, fontId); + _text16->Box(text.c_str(), 0, rect, SCI_TEXT16_ALIGNMENT_LEFT, fontId); _paint16->bitsShow(rect); - _text->SetFont(fontId); + _text16->SetFont(fontId); TexteditCursorDraw(rect, text.c_str(), cursorPos); - _text->SetFont(oldFontId); + _text16->SetFont(oldFontId); // Write back string _segMan->strcpy(textReference, text.c_str()); } else { diff --git a/engines/sci/graphics/controls.h b/engines/sci/graphics/controls.h index 35c1098a0f..8be3b61810 100644 --- a/engines/sci/graphics/controls.h +++ b/engines/sci/graphics/controls.h @@ -31,10 +31,10 @@ namespace Sci { class GfxPorts; class GfxPaint16; class Font; -class Text; +class GfxText16; class Controls { public: - Controls(SegManager *segMan, GfxPorts *ports, GfxPaint16 *paint16, Text *text); + Controls(SegManager *segMan, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16); ~Controls(); void drawListControl(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 upperPos, int16 cursorPos, bool isAlias); @@ -49,7 +49,7 @@ private: SegManager *_segMan; GfxPorts *_ports; GfxPaint16 *_paint16; - Text *_text; + GfxText16 *_text16; // Textedit-Control related Common::Rect _texteditCursorRect; diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp index c8ebb1380f..733af7f7f4 100644 --- a/engines/sci/graphics/gui.cpp +++ b/engines/sci/graphics/gui.cpp @@ -43,7 +43,7 @@ #include "sci/graphics/controls.h" #include "sci/graphics/menu.h" #include "sci/graphics/portrait.h" -#include "sci/graphics/text.h" +#include "sci/graphics/text16.h" #include "sci/graphics/transitions.h" #include "sci/graphics/view.h" #include "sci/sound/audio.h" @@ -58,15 +58,15 @@ SciGui::SciGui(EngineState *state, GfxScreen *screen, GfxPalette *palette, GfxCa _transitions = new Transitions(this, _screen, _palette, _s->resMan->isVGA()); _animate = new GfxAnimate(_s, _cache, _ports, _paint16, _screen, _palette, _cursor, _transitions); _s->_gfxAnimate = _animate; - _text = new Text(_s->resMan, _cache, _ports, _paint16, _screen); - _controls = new Controls(_s->_segMan, _ports, _paint16, _text); - _menu = new Menu(_s->_event, _s->_segMan, this, _ports, _paint16, _text, _screen, _cursor); + _text16 = new GfxText16(_s->resMan, _cache, _ports, _paint16, _screen); + _controls = new Controls(_s->_segMan, _ports, _paint16, _text16); + _menu = new Menu(_s->_event, _s->_segMan, this, _ports, _paint16, _text16, _screen, _cursor); } SciGui::~SciGui() { delete _menu; delete _controls; - delete _text; + delete _text16; delete _animate; delete _transitions; delete _paint16; @@ -83,8 +83,8 @@ void SciGui::resetEngineState(EngineState *s) { void SciGui::init(bool usesOldGfxFunctions) { _usesOldGfxFunctions = usesOldGfxFunctions; - _ports->init(this, _paint16, _text, _s->_gameId); - _paint16->init(_text); + _ports->init(this, _paint16, _text16, _s->_gameId); + _paint16->init(_text16); initPriorityBands(); } @@ -143,7 +143,7 @@ int16 SciGui::priorityToCoordinate(int16 priority) { void SciGui::display(const char *text, int argc, reg_t *argv) { int displayArg; - TextAlignment alignment = SCI_TEXT_ALIGNMENT_LEFT; + TextAlignment alignment = SCI_TEXT16_ALIGNMENT_LEFT; int16 colorPen = -1, colorBack = -1, width = -1, bRedraw = 1; bool doSaveUnder = false; Common::Rect rect; @@ -182,7 +182,7 @@ void SciGui::display(const char *text, int argc, reg_t *argv) { argc--; argv++; break; case SCI_DISPLAY_SETFONT: - _text->SetFont(argv[0].toUint16()); + _text16->SetFont(argv[0].toUint16()); argc--; argv++; break; case SCI_DISPLAY_WIDTH: @@ -210,7 +210,7 @@ void SciGui::display(const char *text, int argc, reg_t *argv) { } // now drawing the text - _text->Size(rect, text, -1, width); + _text16->Size(rect, text, -1, width); rect.moveTo(_ports->getPort()->curLeft, _ports->getPort()->curTop); if (getSciVersion() >= SCI_VERSION_1_LATE) { int16 leftPos = rect.right <= _screen->getWidth() ? 0 : _screen->getWidth() - rect.right; @@ -223,7 +223,7 @@ void SciGui::display(const char *text, int argc, reg_t *argv) { _s->r_acc = _paint16->bitsSave(rect, SCI_SCREEN_MASK_VISUAL); if (colorBack != -1) _paint16->fillRect(rect, SCI_SCREEN_MASK_VISUAL, colorBack, 0, 0); - _text->Box(text, 0, rect, alignment, -1); + _text16->Box(text, 0, rect, alignment, -1); if (_screen->_picNotValid == 0 && bRedraw) _paint16->bitsShow(rect); // restoring port and cursor pos @@ -237,19 +237,19 @@ void SciGui::display(const char *text, int argc, reg_t *argv) { void SciGui::textSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight) { Common::Rect rect(0, 0, *textWidth, *textHeight); - _text->Size(rect, text, font, maxWidth); + _text16->Size(rect, text, font, maxWidth); *textWidth = rect.width(); *textHeight = rect.height(); } // Used SCI1+ for text codes void SciGui::textFonts(int argc, reg_t *argv) { - _text->CodeSetFonts(argc, argv); + _text16->CodeSetFonts(argc, argv); } // Used SCI1+ for text codes void SciGui::textColors(int argc, reg_t *argv) { - _text->CodeSetColors(argc, argv); + _text16->CodeSetColors(argc, argv); } void SciGui::drawStatus(const char *text, int16 colorPen, int16 colorBack) { @@ -258,7 +258,7 @@ void SciGui::drawStatus(const char *text, int16 colorPen, int16 colorBack) { _paint16->fillRect(_ports->_menuBarRect, 1, colorBack); _ports->penColor(colorPen); _ports->moveTo(0, 1); - _text->Draw_String(text); + _text16->Draw_String(text); _paint16->bitsShow(_ports->_menuBarRect); _ports->setPort(oldPort); } @@ -276,7 +276,7 @@ void SciGui::drawMenuBar(bool clear) { void SciGui::menuReset() { delete _menu; - _menu = new Menu(_s->_event, _s->_segMan, this, _ports, _paint16, _text, _screen, _cursor); + _menu = new Menu(_s->_event, _s->_segMan, this, _ports, _paint16, _text16, _screen, _cursor); } void SciGui::menuAdd(Common::String title, Common::String content, reg_t contentVmPtr) { @@ -333,7 +333,7 @@ void SciGui::drawControlButton(Common::Rect rect, reg_t obj, const char *text, i _paint16->frameRect(rect); rect.grow(-2); _ports->textGreyedOutput(style & 1 ? false : true); - _text->Box(text, 0, rect, SCI_TEXT_ALIGNMENT_CENTER, fontId); + _text16->Box(text, 0, rect, SCI_TEXT16_ALIGNMENT_CENTER, fontId); _ports->textGreyedOutput(false); rect.grow(1); if (style & 8) // selected @@ -353,7 +353,7 @@ void SciGui::drawControlText(Common::Rect rect, reg_t obj, const char *text, int rect.grow(1); _paint16->eraseRect(rect); rect.grow(-1); - _text->Box(text, 0, rect, alignment, fontId); + _text16->Box(text, 0, rect, alignment, fontId); if (style & 8) { // selected _paint16->frameRect(rect); } @@ -368,18 +368,18 @@ void SciGui::drawControlText(Common::Rect rect, reg_t obj, const char *text, int void SciGui::drawControlTextEdit(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite) { Common::Rect textRect = rect; - uint16 oldFontId = _text->GetFontId(); + uint16 oldFontId = _text16->GetFontId(); rect.grow(1); _controls->TexteditCursorErase(); _paint16->eraseRect(rect); - _text->Box(text, 0, textRect, SCI_TEXT_ALIGNMENT_LEFT, fontId); + _text16->Box(text, 0, textRect, SCI_TEXT16_ALIGNMENT_LEFT, fontId); _paint16->frameRect(rect); if (style & 8) { - _text->SetFont(fontId); + _text16->SetFont(fontId); rect.grow(-1); _controls->TexteditCursorDraw(rect, text, cursorPos); - _text->SetFont(oldFontId); + _text16->SetFont(oldFontId); rect.grow(1); } if (!getControlPicNotValid()) diff --git a/engines/sci/graphics/gui.h b/engines/sci/graphics/gui.h index 28fb38c5f6..0434153672 100644 --- a/engines/sci/graphics/gui.h +++ b/engines/sci/graphics/gui.h @@ -52,7 +52,7 @@ class WindowMgr; class SciGuiAnimate; class Controls; class Menu; -class Text; +class GfxText16; class Transitions; class SciGui { @@ -160,7 +160,7 @@ private: GfxAnimate *_animate; Controls *_controls; Menu *_menu; - Text *_text; + GfxText16 *_text16; Transitions *_transitions; int16 _palVaryId; uint32 _palVaryStart; diff --git a/engines/sci/graphics/gui32.cpp b/engines/sci/graphics/gui32.cpp index 6e8417d82d..59a56eeda5 100644 --- a/engines/sci/graphics/gui32.cpp +++ b/engines/sci/graphics/gui32.cpp @@ -39,7 +39,6 @@ #include "sci/graphics/compare.h" #include "sci/graphics/picture.h" #include "sci/graphics/robot.h" -#include "sci/graphics/text.h" #include "sci/graphics/view.h" namespace Sci { diff --git a/engines/sci/graphics/menu.cpp b/engines/sci/graphics/menu.cpp index 81edcef280..12be85a463 100644 --- a/engines/sci/graphics/menu.cpp +++ b/engines/sci/graphics/menu.cpp @@ -37,14 +37,14 @@ #include "sci/graphics/animate.h" #include "sci/graphics/cursor.h" #include "sci/graphics/font.h" -#include "sci/graphics/text.h" +#include "sci/graphics/text16.h" #include "sci/graphics/screen.h" #include "sci/graphics/menu.h" namespace Sci { -Menu::Menu(SciEvent *event, SegManager *segMan, SciGui *gui, GfxPorts *ports, GfxPaint16 *paint16, Text *text, GfxScreen *screen, Cursor *cursor) - : _event(event), _segMan(segMan), _gui(gui), _ports(ports), _paint16(paint16), _text(text), _screen(screen), _cursor(cursor) { +Menu::Menu(SciEvent *event, SegManager *segMan, SciGui *gui, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen, Cursor *cursor) + : _event(event), _segMan(segMan), _gui(gui), _ports(ports), _paint16(paint16), _text16(text16), _screen(screen), _cursor(cursor) { _listCount = 0; // We actually set active item in here and remember last selection of the user @@ -311,7 +311,7 @@ void Menu::drawBar() { listIterator = _list.begin(); while (listIterator != listEnd) { listEntry = *listIterator; - _text->Draw_String(listEntry->text.c_str()); + _text16->Draw_String(listEntry->text.c_str()); listIterator++; } @@ -330,7 +330,7 @@ void Menu::calculateTextWidth() { menuIterator = _list.begin(); while (menuIterator != menuEnd) { menuEntry = *menuIterator; - _text->StringWidth(menuEntry->text.c_str(), 0, menuEntry->textWidth, dummyHeight); + _text16->StringWidth(menuEntry->text.c_str(), 0, menuEntry->textWidth, dummyHeight); menuIterator++; } @@ -338,8 +338,8 @@ void Menu::calculateTextWidth() { itemIterator = _itemList.begin(); while (itemIterator != itemEnd) { itemEntry = *itemIterator; - _text->StringWidth(itemEntry->text.c_str(), 0, itemEntry->textWidth, dummyHeight); - _text->StringWidth(itemEntry->textRightAligned.c_str(), 0, itemEntry->textRightAlignedWidth, dummyHeight); + _text16->StringWidth(itemEntry->text.c_str(), 0, itemEntry->textWidth, dummyHeight); + _text16->StringWidth(itemEntry->textRightAligned.c_str(), 0, itemEntry->textRightAlignedWidth, dummyHeight); itemIterator++; } @@ -542,9 +542,9 @@ void Menu::drawMenu(uint16 oldMenuId, uint16 newMenuId) { if (!listItemEntry->separatorLine) { _ports->textGreyedOutput(listItemEntry->enabled ? false : true); _ports->moveTo(_menuRect.left, topPos); - _text->Draw_String(listItemEntry->text.c_str()); + _text16->Draw_String(listItemEntry->text.c_str()); _ports->moveTo(_menuRect.right - listItemEntry->textRightAlignedWidth - 5, topPos); - _text->Draw_String(listItemEntry->textRightAligned.c_str()); + _text16->Draw_String(listItemEntry->textRightAligned.c_str()); } else { // We dont 100% follow sierra here, we draw the line from left to right. Looks better // BTW. SCI1.1 seems to put 2 pixels and then skip one, we don't do this at all (lsl6) diff --git a/engines/sci/graphics/menu.h b/engines/sci/graphics/menu.h index 05ac89abaa..00bf47c0b9 100644 --- a/engines/sci/graphics/menu.h +++ b/engines/sci/graphics/menu.h @@ -78,7 +78,7 @@ typedef Common::List<GuiMenuItemEntry *> GuiMenuItemList; class Menu { public: - Menu(SciEvent *event, SegManager *segMan, SciGui *gui, GfxPorts *ports, GfxPaint16 *paint16, Text *text, GfxScreen *screen, Cursor *cursor); + Menu(SciEvent *event, SegManager *segMan, SciGui *gui, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen, Cursor *cursor); ~Menu(); void reset(); @@ -107,7 +107,7 @@ private: SciGui *_gui; GfxPorts *_ports; GfxPaint16 *_paint16; - Text *_text; + GfxText16 *_text16; GfxScreen *_screen; Cursor *_cursor; diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp index 184c50b8cb..4ef1682a32 100644 --- a/engines/sci/graphics/paint16.cpp +++ b/engines/sci/graphics/paint16.cpp @@ -39,7 +39,7 @@ #include "sci/graphics/view.h" #include "sci/graphics/screen.h" #include "sci/graphics/palette.h" -#include "sci/graphics/text.h" +#include "sci/graphics/text16.h" namespace Sci { @@ -50,8 +50,8 @@ GfxPaint16::GfxPaint16(ResourceManager *resMan, SegManager *segMan, Kernel *kern GfxPaint16::~GfxPaint16() { } -void GfxPaint16::init(Text *text) { - _text = text; +void GfxPaint16::init(GfxText16 *text16) { + _text16 = text16; _EGAdrawingVisualize = false; } diff --git a/engines/sci/graphics/paint16.h b/engines/sci/graphics/paint16.h index 5a99c4f7ef..8d2b965219 100644 --- a/engines/sci/graphics/paint16.h +++ b/engines/sci/graphics/paint16.h @@ -44,7 +44,7 @@ public: GfxPaint16(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette); ~GfxPaint16(); - void init(Text *text); + void init(GfxText16 *text16); void setEGAdrawingVisualize(bool state); @@ -76,7 +76,7 @@ private: GfxPorts *_ports; GfxScreen *_screen; GfxPalette *_palette; - Text *_text; + GfxText16 *_text16; // true means make EGA picture drawing visible bool _EGAdrawingVisualize; diff --git a/engines/sci/graphics/ports.cpp b/engines/sci/graphics/ports.cpp index f834e93541..5731bb6b29 100644 --- a/engines/sci/graphics/ports.cpp +++ b/engines/sci/graphics/ports.cpp @@ -30,7 +30,7 @@ #include "sci/graphics/screen.h" #include "sci/graphics/paint16.h" #include "sci/graphics/animate.h" -#include "sci/graphics/text.h" +#include "sci/graphics/text16.h" #include "sci/graphics/ports.h" namespace Sci { @@ -54,12 +54,12 @@ GfxPorts::~GfxPorts() { delete _menuPort; } -void GfxPorts::init(SciGui *gui, GfxPaint16 *paint16, Text *text, Common::String gameId) { +void GfxPorts::init(SciGui *gui, GfxPaint16 *paint16, GfxText16 *text16, Common::String gameId) { int16 offTop = 10; _gui = gui; _paint16 = paint16; - _text = text; + _text16 = text16; // _mainPort is not known to windowmanager, that's okay according to sierra sci // its not even used currently in our engine @@ -70,7 +70,7 @@ void GfxPorts::init(SciGui *gui, GfxPaint16 *paint16, Text *text, Common::String // _menuPort has actually hardcoded id 0xFFFF. Its not meant to be known to windowmanager according to sierra sci _menuPort = new Port(0xFFFF); openPort(_menuPort); - _text->SetFont(0); + _text16->SetFont(0); _menuPort->rect = Common::Rect(0, 0, _screen->getWidth(), _screen->getHeight()); _menuBarRect = Common::Rect(0, 0, _screen->getWidth(), 9); _menuRect = Common::Rect(0, 0, _screen->getWidth(), 10); @@ -312,7 +312,7 @@ void GfxPorts::drawWindow(Window *pWnd) { if (!pWnd->title.empty()) { int16 oldcolor = getPort()->penClr; penColor(255); - _text->Box(pWnd->title.c_str(), 1, r, SCI_TEXT_ALIGNMENT_CENTER, 0); + _text16->Box(pWnd->title.c_str(), 1, r, SCI_TEXT16_ALIGNMENT_CENTER, 0); penColor(oldcolor); } @@ -399,7 +399,7 @@ void GfxPorts::openPort(Port *port) { Port *tmp = _curPort; _curPort = port; - _text->SetFont(port->fontId); + _text16->SetFont(port->fontId); _curPort = tmp; port->top = 0; diff --git a/engines/sci/graphics/ports.h b/engines/sci/graphics/ports.h index d6b6000c51..678ee06726 100644 --- a/engines/sci/graphics/ports.h +++ b/engines/sci/graphics/ports.h @@ -33,15 +33,15 @@ namespace Sci { class SciGui; class GfxPaint16; -class Screen; -class Text; +class GfxScreen; +class GfxText16; class GfxPorts { public: GfxPorts(SegManager *segMan, GfxScreen *screen); ~GfxPorts(); - void init(SciGui *gui, GfxPaint16 *paint16, Text *text, Common::String gameId); + void init(SciGui *gui, GfxPaint16 *paint16, GfxText16 *text16, Common::String gameId); void kernelSetActive(uint16 portId); Common::Rect kernelGetPicWindow(int16 &picTop, int16 &picLeft); @@ -98,7 +98,7 @@ private: SciGui *_gui; GfxPaint16 *_paint16; GfxScreen *_screen; - Text *_text; + GfxText16 *_text16; /** The list of open 'windows' (and ports), in visual order. */ PortList _windowList; diff --git a/engines/sci/graphics/text.cpp b/engines/sci/graphics/text16.cpp index 480c1af971..4f3bf35ce9 100644 --- a/engines/sci/graphics/text.cpp +++ b/engines/sci/graphics/text16.cpp @@ -33,19 +33,19 @@ #include "sci/graphics/ports.h" #include "sci/graphics/paint16.h" #include "sci/graphics/font.h" -#include "sci/graphics/text.h" +#include "sci/graphics/text16.h" namespace Sci { -Text::Text(ResourceManager *resMan, GfxCache *cache, GfxPorts *ports, GfxPaint16 *paint16, GfxScreen *screen) +GfxText16::GfxText16(ResourceManager *resMan, GfxCache *cache, GfxPorts *ports, GfxPaint16 *paint16, GfxScreen *screen) : _resMan(resMan), _cache(cache), _ports(ports), _paint16(paint16), _screen(screen) { init(); } -Text::~Text() { +GfxText16::~GfxText16() { } -void Text::init() { +void GfxText16::init() { _font = NULL; _codeFonts = NULL; _codeFontsCount = 0; @@ -53,18 +53,18 @@ void Text::init() { _codeColorsCount = 0; } -GuiResourceId Text::GetFontId() { +GuiResourceId GfxText16::GetFontId() { return _ports->_curPort->fontId; } -Font *Text::GetFont() { +Font *GfxText16::GetFont() { if ((_font == NULL) || (_font->getResourceId() != _ports->_curPort->fontId)) _font = _cache->getFont(_ports->_curPort->fontId); return _font; } -void Text::SetFont(GuiResourceId fontId) { +void GfxText16::SetFont(GuiResourceId fontId) { if ((_font == NULL) || (_font->getResourceId() != fontId)) _font = _cache->getFont(fontId); @@ -72,7 +72,7 @@ void Text::SetFont(GuiResourceId fontId) { _ports->_curPort->fontHeight = _font->getHeight(); } -void Text::CodeSetFonts(int argc, reg_t *argv) { +void GfxText16::CodeSetFonts(int argc, reg_t *argv) { int i; delete _codeFonts; @@ -83,7 +83,7 @@ void Text::CodeSetFonts(int argc, reg_t *argv) { } } -void Text::CodeSetColors(int argc, reg_t *argv) { +void GfxText16::CodeSetColors(int argc, reg_t *argv) { int i; delete _codeColors; @@ -94,7 +94,7 @@ void Text::CodeSetColors(int argc, reg_t *argv) { } } -void Text::ClearChar(int16 chr) { +void GfxText16::ClearChar(int16 chr) { if (_ports->_curPort->penMode != 1) return; Common::Rect rect; @@ -109,7 +109,7 @@ void Text::ClearChar(int16 chr) { // It will process the encountered code and set new font/set color // We only support one-digit codes currently, don't know if multi-digit codes are possible // Returns textcode character count -int16 Text::CodeProcessing(const char *&text, GuiResourceId orgFontId, int16 orgPenColor) { +int16 GfxText16::CodeProcessing(const char *&text, GuiResourceId orgFontId, int16 orgPenColor) { const char *textCode = text; int16 textCodeSize = 0; char curCode; @@ -152,7 +152,7 @@ int16 Text::CodeProcessing(const char *&text, GuiResourceId orgFontId, int16 org } // return max # of chars to fit maxwidth with full words -int16 Text::GetLongest(const char *text, int16 maxWidth, GuiResourceId orgFontId) { +int16 GfxText16::GetLongest(const char *text, int16 maxWidth, GuiResourceId orgFontId) { char curChar; int16 maxChars = 0, curCharCount = 0; uint16 width = 0; @@ -197,7 +197,7 @@ int16 Text::GetLongest(const char *text, int16 maxWidth, GuiResourceId orgFontId return maxChars; } -void Text::Width(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight) { +void GfxText16::Width(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight) { unsigned char curChar; GuiResourceId oldFontId = GetFontId(); int16 oldPenColor = _ports->_curPort->penClr; @@ -230,18 +230,18 @@ void Text::Width(const char *text, int16 from, int16 len, GuiResourceId orgFontI return; } -void Text::StringWidth(const char *str, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight) { +void GfxText16::StringWidth(const char *str, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight) { Width(str, 0, (int16)strlen(str), orgFontId, textWidth, textHeight); } -void Text::ShowString(const char *str, GuiResourceId orgFontId, int16 orgPenColor) { +void GfxText16::ShowString(const char *str, GuiResourceId orgFontId, int16 orgPenColor) { Show(str, 0, (int16)strlen(str), orgFontId, orgPenColor); } -void Text::DrawString(const char *str, GuiResourceId orgFontId, int16 orgPenColor) { +void GfxText16::DrawString(const char *str, GuiResourceId orgFontId, int16 orgPenColor) { Draw(str, 0, (int16)strlen(str), orgFontId, orgPenColor); } -int16 Text::Size(Common::Rect &rect, const char *str, GuiResourceId fontId, int16 maxWidth) { +int16 GfxText16::Size(Common::Rect &rect, const char *str, GuiResourceId fontId, int16 maxWidth) { GuiResourceId oldFontId = GetFontId(); int16 oldPenColor = _ports->_curPort->penClr; int16 charCount; @@ -283,7 +283,7 @@ int16 Text::Size(Common::Rect &rect, const char *str, GuiResourceId fontId, int1 } // returns maximum font height used -void Text::Draw(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor) { +void GfxText16::Draw(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor) { int16 curChar, charWidth; Common::Rect rect; @@ -322,7 +322,7 @@ void Text::Draw(const char *text, int16 from, int16 len, GuiResourceId orgFontId } // returns maximum font height used -void Text::Show(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor) { +void GfxText16::Show(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor) { Common::Rect rect; rect.top = _ports->_curPort->curTop; @@ -334,7 +334,7 @@ void Text::Show(const char *text, int16 from, int16 len, GuiResourceId orgFontId } // Draws a text in rect. -void Text::Box(const char *text, int16 bshow, const Common::Rect &rect, TextAlignment alignment, GuiResourceId fontId) { +void GfxText16::Box(const char *text, int16 bshow, const Common::Rect &rect, TextAlignment alignment, GuiResourceId fontId) { int16 textWidth, textHeight, charCount; int16 offset = 0; int16 hline = 0; @@ -354,13 +354,13 @@ void Text::Box(const char *text, int16 bshow, const Common::Rect &rect, TextAlig break; Width(text, 0, charCount, orgFontId, textWidth, textHeight); switch (alignment) { - case SCI_TEXT_ALIGNMENT_RIGHT: + case SCI_TEXT16_ALIGNMENT_RIGHT: offset = rect.width() - textWidth; break; - case SCI_TEXT_ALIGNMENT_CENTER: + case SCI_TEXT16_ALIGNMENT_CENTER: offset = (rect.width() - textWidth) / 2; break; - case SCI_TEXT_ALIGNMENT_LEFT: + case SCI_TEXT16_ALIGNMENT_LEFT: offset = 0; break; @@ -382,7 +382,7 @@ void Text::Box(const char *text, int16 bshow, const Common::Rect &rect, TextAlig _ports->penColor(orgPenColor); } -void Text::Draw_String(const char *text) { +void GfxText16::Draw_String(const char *text) { GuiResourceId orgFontId = GetFontId(); int16 orgPenColor = _ports->_curPort->penClr; diff --git a/engines/sci/graphics/text.h b/engines/sci/graphics/text16.h index 976dec0037..c55c09e91e 100644 --- a/engines/sci/graphics/text.h +++ b/engines/sci/graphics/text16.h @@ -23,23 +23,23 @@ * */ -#ifndef SCI_GRAPHICS_TEXT_H -#define SCI_GRAPHICS_TEXT_H +#ifndef SCI_GRAPHICS_TEXT16_H +#define SCI_GRAPHICS_TEXT16_H namespace Sci { -#define SCI_TEXT_ALIGNMENT_RIGHT -1 -#define SCI_TEXT_ALIGNMENT_CENTER 1 -#define SCI_TEXT_ALIGNMENT_LEFT 0 +#define SCI_TEXT16_ALIGNMENT_RIGHT -1 +#define SCI_TEXT16_ALIGNMENT_CENTER 1 +#define SCI_TEXT16_ALIGNMENT_LEFT 0 class GfxPorts; class GfxPaint16; -class Screen; +class GfxScreen; class Font; -class Text { +class GfxText16 { public: - Text(ResourceManager *_resMan, GfxCache *fonts, GfxPorts *ports, GfxPaint16 *paint16, GfxScreen *screen); - ~Text(); + GfxText16(ResourceManager *_resMan, GfxCache *fonts, GfxPorts *ports, GfxPaint16 *paint16, GfxScreen *screen); + ~GfxText16(); GuiResourceId GetFontId(); Font *GetFont(); diff --git a/engines/sci/module.mk b/engines/sci/module.mk index f2aea36c8d..23e1606078 100644 --- a/engines/sci/module.mk +++ b/engines/sci/module.mk @@ -47,7 +47,7 @@ MODULE_OBJS := \ graphics/portrait.o \ graphics/ports.o \ graphics/screen.o \ - graphics/text.o \ + graphics/text16.o \ graphics/transitions.o \ graphics/view.o \ parser/grammar.o \ |