diff options
-rw-r--r-- | engines/sci/engine/kmenu.cpp | 27 | ||||
-rw-r--r-- | engines/sci/gui/gui.cpp | 15 | ||||
-rw-r--r-- | engines/sci/gui/gui.h | 1 | ||||
-rw-r--r-- | engines/sci/gui/gui_gfx.cpp | 10 | ||||
-rw-r--r-- | engines/sci/gui/gui_gfx.h | 2 | ||||
-rw-r--r-- | engines/sci/gui32/gui32.cpp | 15 | ||||
-rw-r--r-- | engines/sci/gui32/gui32.h | 1 |
7 files changed, 51 insertions, 20 deletions
diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp index 48522be339..046b2f2f89 100644 --- a/engines/sci/engine/kmenu.cpp +++ b/engines/sci/engine/kmenu.cpp @@ -30,6 +30,7 @@ #include "sci/gfx/gfx_gui.h" #include "sci/gfx/menubar.h" #include "sci/gfx/gfx_state_internal.h" // required for GfxPort, GfxVisual +#include "sci/gui/gui.h" namespace Sci { @@ -65,32 +66,20 @@ reg_t kGetMenu(EngineState *s, int argc, reg_t *argv) { reg_t kDrawStatus(EngineState *s, int argc, reg_t *argv) { - reg_t text = argv[0]; - int fgcolor = (argc > 1) ? argv[1].toSint16() : s->status_bar_foreground; - int bgcolor = (argc > 2) ? argv[2].toSint16() : s->status_bar_background; + reg_t textReference = argv[0]; + Common::String text; + int16 colorPen = (argc > 1) ? argv[1].toSint16() : 0; // old code was: s->status_bar_foreground; + int16 colorBack = (argc > 2) ? argv[2].toSint16() : 255; // s->status_bar_background; - s->titlebar_port->_color.visual = get_pic_color(s, fgcolor); - s->titlebar_port->_color.mask = GFX_MASK_VISUAL; - s->titlebar_port->_bgcolor.visual = get_pic_color(s, bgcolor); - s->titlebar_port->_bgcolor.mask = GFX_MASK_VISUAL; - - s->status_bar_foreground = fgcolor; - s->status_bar_background = bgcolor; - - if (text.segment) { - s->_statusBarText = s->_segMan->getString(text); - } - - sciw_set_status_bar(s, s->titlebar_port, s->_statusBarText, fgcolor, bgcolor); - - gfxop_update(s->gfx_state); + if (!textReference.isNull()) + text = s->_segMan->getString(textReference); + s->gui->drawStatus(s->strSplit(text.c_str(), NULL).c_str(), colorPen, colorBack); return s->r_acc; } reg_t kDrawMenuBar(EngineState *s, int argc, reg_t *argv) { - if (argv[0].toSint16()) sciw_set_menubar(s, s->titlebar_port, s->_menubar, -1); else diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index 50c0298d11..e7ba5d5d12 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -54,7 +54,7 @@ SciGui::~SciGui() { void SciGui::init(bool oldGfxFunctions) { _usesOldGfxFunctions = oldGfxFunctions; - /* Set default SCI0 palette */ + } int16 SciGui::getTimeTicks() { @@ -232,6 +232,19 @@ void SciGui::textColors(int argc, reg_t *argv) { _gfx->SetTextColors(argc, argv); } +void SciGui::drawStatus(const char *text, int16 colorPen, int16 colorBack) { + GuiPort *oldPort = _gfx->SetPort(_gfx->_menuPort); + if (text) { + _gfx->FillRect(_gfx->_menuRect, 1, colorBack); + _gfx->PenColor(colorPen); + _gfx->MoveTo(0, 1); + _gfx->Draw_String(text); + _gfx->SetPort(oldPort); + // _gfx->ShowBits(*_theMenuBar, 1); + _screen->copyToScreen(); + } +} + void SciGui::drawPicture(GuiResourceId pictureId, uint16 style, uint16 flags, int16 EGApaletteNo) { bool addToFlag = flags ? true : false; GuiPort *oldPort = _gfx->SetPort((GuiPort *)_windowMgr->_picWind); diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h index 8c6423bd9f..e95ae8c58a 100644 --- a/engines/sci/gui/gui.h +++ b/engines/sci/gui/gui.h @@ -61,6 +61,7 @@ public: virtual void textFonts(int argc, reg_t *argv); virtual void textColors(int argc, reg_t *argv); + virtual void drawStatus(const char *text, int16 colorPen, int16 colorBack); virtual void drawPicture(GuiResourceId pictureId, uint16 showStyle, uint16 flags, int16 EGApaletteNo); virtual void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo); virtual void drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool inverse); diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp index 4719d60648..5c9a366d78 100644 --- a/engines/sci/gui/gui_gfx.cpp +++ b/engines/sci/gui/gui_gfx.cpp @@ -63,6 +63,7 @@ void SciGuiGfx::init() { OpenPort(_menuPort); SetFont(0); _menuPort->rect = Common::Rect(0, 0, _screen->_width, _screen->_height); + _menuRect = Common::Rect(0, 0, _screen->_width, 10); // HEAPHANDLE theMenuBarH = heapNewPtr(34, kDataPort, "MenuBar"); // heapClearPtr(theMenuBarH); @@ -1152,6 +1153,15 @@ void SciGuiGfx::Draw_Pattern(int16 x, int16 y, byte color, byte priority, byte c } } +void SciGuiGfx::Draw_String(const char *text) { + GuiResourceId orgFontId = GetFontId(); + int16 orgPenColor = _curPort->penClr; + + DrawText(text, 0, strlen(text), orgFontId, orgPenColor); + SetFont(orgFontId); + PenColor(orgPenColor); +} + void SciGuiGfx::Pic_Fill(int16 x, int16 y, byte color, byte prio, byte control) { Common::Stack<Common::Point> stack; Common::Point p, p1; diff --git a/engines/sci/gui/gui_gfx.h b/engines/sci/gui/gui_gfx.h index 224d198bbc..1d7c146cff 100644 --- a/engines/sci/gui/gui_gfx.h +++ b/engines/sci/gui/gui_gfx.h @@ -110,6 +110,7 @@ public: void Draw_Circle(Common::Rect box, byte size, byte color, byte prio, byte control); void Draw_TexturedCircle(Common::Rect box, byte size, byte color, byte prio, byte control, byte texture); void Draw_Pattern(int16 x, int16 y, byte pic_color, byte pic_priority, byte pic_control, byte code, byte texture); + void Draw_String(const char *text); void Pic_Fill(int16 x, int16 y, byte color, byte prio, byte control); void drawPicture(GuiResourceId pictureId, uint16 style, bool addToFlag, GuiResourceId paletteId); @@ -129,6 +130,7 @@ public: void SetNowSeen(reg_t objectReference); GuiPort *_menuPort; + Common::Rect _menuRect; uint32 _sysTicks; int32 _sysSpeed; // ticker timer in ms GuiPalette _sysPalette; diff --git a/engines/sci/gui32/gui32.cpp b/engines/sci/gui32/gui32.cpp index 125a8d68a2..ec08eaee74 100644 --- a/engines/sci/gui32/gui32.cpp +++ b/engines/sci/gui32/gui32.cpp @@ -487,6 +487,21 @@ void SciGui32::textColors(int argc, reg_t *argv) { // stub } +void SciGui32::drawStatus(const char *text, int16 colorPen, int16 colorBack) { + s->titlebar_port->_color.visual = get_pic_color(s, colorPen); + s->titlebar_port->_color.mask = GFX_MASK_VISUAL; + s->titlebar_port->_bgcolor.visual = get_pic_color(s, colorBack); + s->titlebar_port->_bgcolor.mask = GFX_MASK_VISUAL; + + s->status_bar_foreground = colorPen; + s->status_bar_background = colorBack; + s->_statusBarText = text; + + sciw_set_status_bar(s, s->titlebar_port, s->_statusBarText, colorPen, colorBack); + + gfxop_update(s->gfx_state); +} + void SciGui32::drawPicture(GuiResourceId pictureId, uint16 showStyle, uint16 flags, int16 EGApaletteNo) { drawn_pic_t dp; gfx_color_t transparent = s->wm_port->_bgcolor; diff --git a/engines/sci/gui32/gui32.h b/engines/sci/gui32/gui32.h index 0dd702ee1d..b57da26dd5 100644 --- a/engines/sci/gui32/gui32.h +++ b/engines/sci/gui32/gui32.h @@ -56,6 +56,7 @@ public: void textFonts(int argc, reg_t *argv); void textColors(int argc, reg_t *argv); + void drawStatus(const char *text, int16 colorPen, int16 colorBack); void drawPicture(GuiResourceId pictureId, uint16 showStyle, uint16 flags, int16 EGApaletteNo); void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo); void drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool inverse); |