[Scummvm-cvs-logs] SF.net SVN: scummvm:[44670] scummvm/trunk/engines/sci
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Mon Oct 5 21:20:53 CEST 2009
Revision: 44670
http://scummvm.svn.sourceforge.net/scummvm/?rev=44670&view=rev
Author: m_kiewitz
Date: 2009-10-05 19:20:52 +0000 (Mon, 05 Oct 2009)
Log Message:
-----------
SVN/newgui: kDrawStatus implemented
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kmenu.cpp
scummvm/trunk/engines/sci/gui/gui.cpp
scummvm/trunk/engines/sci/gui/gui.h
scummvm/trunk/engines/sci/gui/gui_gfx.cpp
scummvm/trunk/engines/sci/gui/gui_gfx.h
scummvm/trunk/engines/sci/gui32/gui32.cpp
scummvm/trunk/engines/sci/gui32/gui32.h
Modified: scummvm/trunk/engines/sci/engine/kmenu.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmenu.cpp 2009-10-05 18:20:50 UTC (rev 44669)
+++ scummvm/trunk/engines/sci/engine/kmenu.cpp 2009-10-05 19:20:52 UTC (rev 44670)
@@ -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 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;
+ if (!textReference.isNull())
+ text = s->_segMan->getString(textReference);
- 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);
-
+ 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
Modified: scummvm/trunk/engines/sci/gui/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.cpp 2009-10-05 18:20:50 UTC (rev 44669)
+++ scummvm/trunk/engines/sci/gui/gui.cpp 2009-10-05 19:20:52 UTC (rev 44670)
@@ -54,7 +54,7 @@
void SciGui::init(bool oldGfxFunctions) {
_usesOldGfxFunctions = oldGfxFunctions;
- /* Set default SCI0 palette */
+
}
int16 SciGui::getTimeTicks() {
@@ -232,6 +232,19 @@
_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);
Modified: scummvm/trunk/engines/sci/gui/gui.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.h 2009-10-05 18:20:50 UTC (rev 44669)
+++ scummvm/trunk/engines/sci/gui/gui.h 2009-10-05 19:20:52 UTC (rev 44670)
@@ -61,6 +61,7 @@
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);
Modified: scummvm/trunk/engines/sci/gui/gui_gfx.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_gfx.cpp 2009-10-05 18:20:50 UTC (rev 44669)
+++ scummvm/trunk/engines/sci/gui/gui_gfx.cpp 2009-10-05 19:20:52 UTC (rev 44670)
@@ -63,6 +63,7 @@
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_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;
Modified: scummvm/trunk/engines/sci/gui/gui_gfx.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_gfx.h 2009-10-05 18:20:50 UTC (rev 44669)
+++ scummvm/trunk/engines/sci/gui/gui_gfx.h 2009-10-05 19:20:52 UTC (rev 44670)
@@ -110,6 +110,7 @@
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 @@
void SetNowSeen(reg_t objectReference);
GuiPort *_menuPort;
+ Common::Rect _menuRect;
uint32 _sysTicks;
int32 _sysSpeed; // ticker timer in ms
GuiPalette _sysPalette;
Modified: scummvm/trunk/engines/sci/gui32/gui32.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui32/gui32.cpp 2009-10-05 18:20:50 UTC (rev 44669)
+++ scummvm/trunk/engines/sci/gui32/gui32.cpp 2009-10-05 19:20:52 UTC (rev 44670)
@@ -487,6 +487,21 @@
// 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;
Modified: scummvm/trunk/engines/sci/gui32/gui32.h
===================================================================
--- scummvm/trunk/engines/sci/gui32/gui32.h 2009-10-05 18:20:50 UTC (rev 44669)
+++ scummvm/trunk/engines/sci/gui32/gui32.h 2009-10-05 19:20:52 UTC (rev 44670)
@@ -56,6 +56,7 @@
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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list