aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gui
diff options
context:
space:
mode:
authorMartin Kiewitz2009-10-12 07:11:22 +0000
committerMartin Kiewitz2009-10-12 07:11:22 +0000
commit07222b8e89819f63ebd6cac535c7dda41a001146 (patch)
tree664b35c125c52d40fbec3ce42faaedbb7e2636b3 /engines/sci/gui
parent43437eecb88fbf0c34db6660406652b4ca4ddcde (diff)
downloadscummvm-rg350-07222b8e89819f63ebd6cac535c7dda41a001146.tar.gz
scummvm-rg350-07222b8e89819f63ebd6cac535c7dda41a001146.tar.bz2
scummvm-rg350-07222b8e89819f63ebd6cac535c7dda41a001146.zip
SCI/newgui: kGraph updateBox implemented, cleaned up usage of BitsShow() still not perfect (e.g. kq5 cutscene information box)
svn-id: r44966
Diffstat (limited to 'engines/sci/gui')
-rw-r--r--engines/sci/gui/gui.cpp68
-rw-r--r--engines/sci/gui/gui.h1
-rw-r--r--engines/sci/gui/gui_gfx.cpp114
-rw-r--r--engines/sci/gui/gui_gfx.h7
-rw-r--r--engines/sci/gui/gui_palette.cpp2
-rw-r--r--engines/sci/gui/gui_windowmgr.cpp20
6 files changed, 144 insertions, 68 deletions
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp
index 2e70447929..b1638d2480 100644
--- a/engines/sci/gui/gui.cpp
+++ b/engines/sci/gui/gui.cpp
@@ -245,8 +245,8 @@ void SciGui::display(const char *text, int argc, reg_t *argv) {
if (bgcolor != -1)
_gfx->FillRect(rect, SCI_SCREEN_MASK_VISUAL, bgcolor, 0, 0);
_gfx->TextBox(text, 0, rect, align, -1);
-// if (_picNotValid == 0 && bRedraw)
-// _gfx->ShowBits(rect, 1);
+ if (!_screen->_picNotValid && bRedraw)
+ _gfx->BitsShow(rect);
// restoring port and cursor pos
GuiPort *currport = _gfx->GetPort();
uint16 tTop = currport->curTop;
@@ -254,8 +254,6 @@ void SciGui::display(const char *text, int argc, reg_t *argv) {
*currport = oldPort;
currport->curTop = tTop;
currport->curLeft = tLeft;
-
- _screen->copyToScreen();
}
void SciGui::textSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight) {
@@ -282,8 +280,7 @@ void SciGui::drawStatus(const char *text, int16 colorPen, int16 colorBack) {
_gfx->MoveTo(0, 1);
_gfx->Draw_String(text);
_gfx->SetPort(oldPort);
- // _gfx->ShowBits(*_theMenuBar, 1);
- _gfx->BitsShow(_gfx->_menuRect, SCI_SCREEN_MASK_VISUAL);
+ _gfx->BitsShow(_gfx->_menuRect);
}
void SciGui::drawMenuBar() {
@@ -299,21 +296,18 @@ void SciGui::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirror
if (_windowMgr->isFrontWindow(_windowMgr->_picWind)) {
_gfx->drawPicture(pictureId, animationNr, mirroredFlag, addToFlag, EGApaletteNo);
+ _screen->_picNotValid = 1;
} else {
_windowMgr->BeginUpdate(_windowMgr->_picWind);
_gfx->drawPicture(pictureId, animationNr, mirroredFlag, addToFlag, EGApaletteNo);
_windowMgr->EndUpdate(_windowMgr->_picWind);
}
- _screen->copyToScreen();
-
_gfx->SetPort(oldPort);
- _screen->_picNotValid = true;
}
void SciGui::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo) {
_gfx->drawCel(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo);
_palette->setOnScreen();
- _screen->copyToScreen();
}
void SciGui::drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite) {
@@ -325,17 +319,17 @@ void SciGui::drawControlButton(Common::Rect rect, reg_t obj, const char *text, i
_gfx->TextFace(style & 1 ? 0 : 1);
_gfx->TextBox(text, 0, rect, 1, fontId);
_gfx->TextFace(0);
- if (style & 8) { // selected
- rect.grow(1);
+ rect.grow(1);
+ if (style & 8) // selected
_gfx->FrameRect(rect);
+ if (!_screen->_picNotValid) {
+ rect.grow(1);
+ _gfx->BitsShow(rect);
}
} else {
_gfx->InvertRect(rect);
+ _gfx->BitsShow(rect);
}
-
- Common::Rect screenRect = rect;
- screenRect.grow(2);
- _gfx->BitsShow(screenRect, SCI_SCREEN_MASK_VISUAL);
}
void SciGui::drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, bool hilite) {
@@ -347,13 +341,13 @@ void SciGui::drawControlText(Common::Rect rect, reg_t obj, const char *text, int
if (style & 8) { // selected
_gfx->FrameRect(rect);
}
+ rect.grow(1);
+ if (!_screen->_picNotValid)
+ _gfx->BitsShow(rect);
} else {
_gfx->InvertRect(rect);
+ _gfx->BitsShow(rect);
}
-
- Common::Rect screenRect = rect;
- screenRect.grow(1);
- _gfx->BitsShow(screenRect, SCI_SCREEN_MASK_VISUAL);
}
void SciGui::drawControlTextEdit(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite) {
@@ -371,7 +365,10 @@ void SciGui::drawControlTextEdit(Common::Rect rect, reg_t obj, const char *text,
rect.grow(-1);
_gfx->TexteditCursorDraw(rect, text, cursorPos);
_gfx->SetFont(oldFontId);
+ rect.grow(1);
}
+ if (!_screen->_picNotValid)
+ _gfx->BitsShow(rect);
}
void SciGui::drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 style, bool hilite) {
@@ -382,9 +379,8 @@ void SciGui::drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId,
}
} else {
_gfx->InvertRect(rect);
+ _gfx->BitsShow(rect);
}
-
- _gfx->BitsShow(rect, SCI_SCREEN_MASK_VISUAL);
}
void SciGui::drawControlList(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 style, int16 upperPos, int16 cursorPos, bool isAlias, bool hilite) {
@@ -394,7 +390,8 @@ void SciGui::drawControlList(Common::Rect rect, reg_t obj, int16 maxChars, int16
if (isAlias && (style & 8)) {
_gfx->FrameRect(rect);
}
- _gfx->BitsShow(rect, SCI_SCREEN_MASK_VISUAL);
+ if (!_screen->_picNotValid)
+ _gfx->BitsShow(rect);
}
}
@@ -410,22 +407,18 @@ void SciGui::editControl(reg_t controlObject, reg_t eventObject) {
void SciGui::graphFillBoxForeground(Common::Rect rect) {
_gfx->PaintRect(rect);
- _screen->copyRectToScreen(rect);
}
void SciGui::graphFillBoxBackground(Common::Rect rect) {
_gfx->EraseRect(rect);
- _screen->copyRectToScreen(rect);
}
void SciGui::graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control) {
_gfx->FillRect(rect, colorMask, color, priority, control);
- _screen->copyRectToScreen(rect);
}
void SciGui::graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control) {
_gfx->drawLine(startPoint.x, startPoint.y, endPoint.x, endPoint.y, color, priority, control);
- _screen->copyToScreen();
}
reg_t SciGui::graphSaveBox(Common::Rect rect, uint16 flags) {
@@ -434,9 +427,13 @@ reg_t SciGui::graphSaveBox(Common::Rect rect, uint16 flags) {
void SciGui::graphRestoreBox(reg_t handle) {
_gfx->BitsRestore(handle);
- _screen->copyToScreen();
}
+void SciGui::graphUpdateBox(Common::Rect rect) {
+ _gfx->BitsShow(rect);
+}
+
+
void SciGui::paletteSet(int resourceNo, int flags) {
_palette->setFromResource(resourceNo, flags);
}
@@ -484,10 +481,8 @@ void SciGui::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) {
if (listReference.isNull()) {
_gfx->AnimateDisposeLastCast();
- if (_screen->_picNotValid) {
- //(this->*ShowPic)(_showMap, _showStyle);
- _screen->_picNotValid = false;
- }
+ if (_screen->_picNotValid)
+ _gfx->ShowPic();
return;
}
@@ -513,12 +508,10 @@ void SciGui::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) {
_gfx->AnimateDrawCels();
if (_screen->_picNotValid) {
- //(this->*ShowPic)(_showMap, _showStyle);
- _screen->_picNotValid = false;
+ _gfx->ShowPic();
}
- //_gfx->AnimateUpdateScreen();
- _screen->copyToScreen();
+ _gfx->AnimateUpdateScreen(old_picNotValid);
_gfx->AnimateRestoreAndDelete(argc, argv);
_gfx->SetPort(oldPort);
@@ -586,7 +579,8 @@ void SciGui::setCursorShape(GuiResourceId cursorId) {
}
void SciGui::setCursorPos(Common::Point pos) {
- // No adjustment of position needed, directly forwarding to SciGui::moveCursor()
+ pos.y += _gfx->GetPort()->top;
+ pos.x += _gfx->GetPort()->left;
moveCursor(pos);
}
diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h
index 9aa1ea4308..9e859201fc 100644
--- a/engines/sci/gui/gui.h
+++ b/engines/sci/gui/gui.h
@@ -82,6 +82,7 @@ public:
virtual void graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control);
virtual reg_t graphSaveBox(Common::Rect rect, uint16 flags);
virtual void graphRestoreBox(reg_t handle);
+ virtual void graphUpdateBox(Common::Rect rect);
virtual void paletteSet(int resourceNo, int flags);
virtual int16 paletteFind(int r, int g, int b);
diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp
index 82ce4b7778..e061e09eea 100644
--- a/engines/sci/gui/gui_gfx.cpp
+++ b/engines/sci/gui/gui_gfx.cpp
@@ -533,7 +533,7 @@ void SciGuiGfx::ShowText(const char *text, int16 from, int16 len, GuiResourceId
rect.left = _curPort->curLeft;
DrawText(text, from, len, orgFontId, orgPenColor);
rect.right = _curPort->curLeft;
- BitsShow(rect, SCI_SCREEN_MASK_VISUAL);
+ BitsShow(rect);
}
// Draws a text in rect.
@@ -581,14 +581,13 @@ void SciGuiGfx::TextBox(const char *text, int16 bshow, const Common::Rect &rect,
}
// Update (part of) screen
-void SciGuiGfx::BitsShow(const Common::Rect &r, uint16 screenMask) {
+void SciGuiGfx::BitsShow(const Common::Rect &r) {
Common::Rect rect(r.left, r.top, r.right, r.bottom);
rect.clip(_curPort->rect);
if (rect.isEmpty()) // nothing to show
return;
OffsetRect(rect);
- assert((screenMask & 0x8000) == 0);
_screen->copyRectToScreen(rect);
}
@@ -720,10 +719,11 @@ void SciGuiGfx::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mir
picture->draw(animationNr, mirroredFlag, addToFlag, paletteId);
}
+// This one is the only one that updates screen!
void SciGuiGfx::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo) {
SciGuiView *view = new SciGuiView(_s->resMan, _screen, _palette, viewId);
- Common::Rect rect(0, 0);
- Common::Rect clipRect(0, 0);
+ Common::Rect rect;
+ Common::Rect clipRect;
if (view) {
rect.left = leftPos;
rect.top = topPos;
@@ -737,12 +737,40 @@ void SciGuiGfx::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo
Common::Rect clipRectTranslated = clipRect;
OffsetRect(clipRectTranslated);
view->draw(rect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo);
+ if (!_screen->_picNotValid)
+ BitsShow(rect);
+ }
+}
+
+// This version of drawCel is not supposed to call BitsShow()!
+void SciGuiGfx::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo) {
+ SciGuiView *view = new SciGuiView(_s->resMan, _screen, _palette, viewId);
+ Common::Rect clipRect;
+ if (view) {
+ clipRect = celRect;
+ clipRect.clip(_curPort->rect);
+ if (clipRect.isEmpty()) // nothing to draw
+ return;
- //if (_picNotValid == 0)
- // _gfx->ShowBits(rect, 1);
+ Common::Rect clipRectTranslated = clipRect;
+ OffsetRect(clipRectTranslated);
+ view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo);
}
}
+// This version of drawCel is not supposed to call BitsShow()!
+void SciGuiGfx::drawCel(SciGuiView *view, GuiViewLoopNo loopNo, GuiViewCelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo) {
+ Common::Rect clipRect;
+ clipRect = celRect;
+ clipRect.clip(_curPort->rect);
+ if (clipRect.isEmpty()) // nothing to draw
+ return;
+
+ Common::Rect clipRectTranslated = clipRect;
+ OffsetRect(clipRectTranslated);
+ view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo);
+}
+
const char controlListUpArrow[2] = { 0x18, 0 };
const char controlListDownArrow[2] = { 0x19, 0 };
@@ -810,7 +838,7 @@ void SciGuiGfx::TexteditCursorDraw (Common::Rect rect, const char *text, uint16
_texteditCursorRect.bottom = _texteditCursorRect.top + _font->getHeight();
_texteditCursorRect.right = _texteditCursorRect.left + (text[curPos] == 0 ? 1 : CharWidth(text[curPos]));
InvertRect(_texteditCursorRect);
- BitsShow(_texteditCursorRect, SCI_SCREEN_MASK_VISUAL);
+ BitsShow(_texteditCursorRect);
_texteditCursorVisible = true;
TexteditSetBlinkTime();
}
@@ -819,7 +847,7 @@ void SciGuiGfx::TexteditCursorDraw (Common::Rect rect, const char *text, uint16
void SciGuiGfx::TexteditCursorErase() {
if (_texteditCursorVisible) {
InvertRect(_texteditCursorRect);
- BitsShow(_texteditCursorRect, SCI_SCREEN_MASK_VISUAL);
+ BitsShow(_texteditCursorRect);
_texteditCursorVisible = false;
}
TexteditSetBlinkTime();
@@ -854,8 +882,10 @@ void SciGuiGfx::TexteditChange(reg_t controlObject, reg_t eventObject) {
eventKey = GET_SEL32V(eventObject, message);
switch (eventKey) {
case SCI_K_BACKSPACE:
- cursorPos--; text.deleteChar(cursorPos);
- textChanged = true;
+ if (cursorPos > 0) {
+ cursorPos--; text.deleteChar(cursorPos);
+ textChanged = true;
+ }
break;
case SCI_K_DELETE:
text.deleteChar(cursorPos);
@@ -898,7 +928,7 @@ void SciGuiGfx::TexteditChange(reg_t controlObject, reg_t eventObject) {
TexteditCursorErase();
EraseRect(rect);
TextBox(text.c_str(), 0, rect, 0, fontId);
- BitsShow(rect, SCI_SCREEN_MASK_VISUAL);
+ BitsShow(rect);
SetFont(fontId);
rect.top--;
TexteditCursorDraw(rect, text.c_str(), cursorPos);
@@ -908,7 +938,7 @@ void SciGuiGfx::TexteditChange(reg_t controlObject, reg_t eventObject) {
} else {
if (g_system->getMillis() >= _texteditBlinkTime) {
InvertRect(_texteditCursorRect);
- BitsShow(_texteditCursorRect, SCI_SCREEN_MASK_VISUAL);
+ BitsShow(_texteditCursorRect);
_texteditCursorVisible = !_texteditCursorVisible;
TexteditSetBlinkTime();
}
@@ -999,6 +1029,14 @@ int16 SciGuiGfx::PriorityToCoordinate(byte priority) {
return _priorityBottom;
}
+void SciGuiGfx::ShowPic() {
+ // TODO: Implement animations
+ warning("ShowPic animation not implemented");
+ _palette->setOnScreen();
+ _screen->copyToScreen();
+ _screen->_picNotValid = 0;
+}
+
void SciGuiGfx::AnimateDisposeLastCast() {
// FIXME
//if (!_lastCast->first.isNull())
@@ -1202,7 +1240,7 @@ void SciGuiGfx::AnimateUpdate() {
if (signal & SCI_ANIMATE_SIGNAL_ALWAYSUPDATE) {
// draw corresponding cel
- drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect.left, listEntry->celRect.top, listEntry->priority, listEntry->paletteNo);
+ drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect, listEntry->priority, listEntry->paletteNo);
listEntry->showBitsFlag = true;
signal &= 0xFFFF ^ (SCI_ANIMATE_SIGNAL_STOPUPDATE | SCI_ANIMATE_SIGNAL_VIEWUPDATED | SCI_ANIMATE_SIGNAL_NOUPDATE | SCI_ANIMATE_SIGNAL_FORCEUPDATE);
@@ -1246,7 +1284,7 @@ void SciGuiGfx::AnimateUpdate() {
if (signal & SCI_ANIMATE_SIGNAL_NOUPDATE && !(signal & SCI_ANIMATE_SIGNAL_HIDDEN)) {
// draw corresponding cel
- drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect.left, listEntry->celRect.top, listEntry->priority, listEntry->paletteNo);
+ drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect, listEntry->priority, listEntry->paletteNo);
listEntry->showBitsFlag = true;
if ((signal & SCI_ANIMATE_SIGNAL_IGNOREACTOR) == 0) {
@@ -1280,7 +1318,7 @@ void SciGuiGfx::AnimateDrawCels() {
PUT_SEL32(curObject, underBits, bitsHandle);
// draw corresponding cel
- drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect.left, listEntry->celRect.top, listEntry->priority, listEntry->paletteNo);
+ drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect, listEntry->priority, listEntry->paletteNo);
listEntry->showBitsFlag = true;
if (signal & SCI_ANIMATE_SIGNAL_REMOVEVIEW) {
@@ -1303,6 +1341,46 @@ void SciGuiGfx::AnimateDrawCels() {
}
}
+void SciGuiGfx::AnimateUpdateScreen(byte oldPicNotValid) {
+ SegManager *segMan = _s->_segMan;
+ GuiAnimateEntry *listEntry;
+ uint16 signal;
+ GuiAnimateList::iterator listIterator;
+ GuiAnimateList::iterator listEnd = _animateList.end();
+
+ listIterator = _animateList.begin();
+ while (listIterator != listEnd) {
+ listEntry = *listIterator;
+ signal = listEntry->signal;
+
+ if (listEntry->showBitsFlag || !(signal & (SCI_ANIMATE_SIGNAL_REMOVEVIEW | SCI_ANIMATE_SIGNAL_NOUPDATE) ||
+ !(signal & SCI_ANIMATE_SIGNAL_REMOVEVIEW) && signal & SCI_ANIMATE_SIGNAL_NOUPDATE && oldPicNotValid)) {
+// TODO: code finish
+// rect = (Common::Rect *)&cobj[_objOfs[7]];
+// rect1 = (Common::Rect *)&cobj[_objOfs[8]];
+//
+// Common::Rect ro(rect->left, rect->top, rect->right, rect->bottom);
+// ro.clip(*rect1);
+//
+// if (!ro.isEmpty()) {
+// ro = *rect;
+// ro.extend(*rect1);
+// } else {
+// _gfx->ShowBits(*rect, _showMap);
+// // ro = *rect1;
+// //}
+// //*rect = *rect1;
+// _gfx->ShowBits(ro, _showMap);
+ if (signal & SCI_ANIMATE_SIGNAL_HIDDEN) {
+ listEntry->signal |= SCI_ANIMATE_SIGNAL_REMOVEVIEW;
+ }
+ }
+
+ listIterator++;
+ }
+ _screen->copyToScreen();
+}
+
void SciGuiGfx::AnimateRestoreAndDelete(int argc, reg_t *argv) {
SegManager *segMan = _s->_segMan;
reg_t curObject;
@@ -1360,7 +1438,7 @@ void SciGuiGfx::AddToPicDrawCels(List *list) {
view->getCelRect(listEntry->loopNo, listEntry->celNo, listEntry->x, listEntry->y, listEntry->priority, &listEntry->celRect);
// draw corresponding cel
- drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect.left, listEntry->celRect.top, listEntry->priority, listEntry->paletteNo);
+ drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect, listEntry->priority, listEntry->paletteNo);
if ((listEntry->signal & SCI_ANIMATE_SIGNAL_IGNOREACTOR) == 0) {
listEntry->celRect.top = CLIP<int16>(PriorityToCoordinate(listEntry->priority) - 1, listEntry->celRect.top, listEntry->celRect.bottom - 1);
FillRect(listEntry->celRect, SCI_SCREEN_MASK_CONTROL, 0, 0, 15);
@@ -1378,7 +1456,7 @@ void SciGuiGfx::AddToPicDrawView(GuiResourceId viewId, GuiViewLoopNo loopNo, Gui
// Create rect according to coordinates and given cel
view->getCelRect(loopNo, celNo, leftPos, topPos, priority, &celRect);
- drawCel(viewId, loopNo, celNo, celRect.left, celRect.top, priority, 0);
+ drawCel(view, loopNo, celNo, celRect, priority, 0);
}
bool SciGuiGfx::CanBeHereCheckRectList(reg_t checkObject, Common::Rect checkRect, List *list) {
diff --git a/engines/sci/gui/gui_gfx.h b/engines/sci/gui/gui_gfx.h
index 096137374f..24e143128c 100644
--- a/engines/sci/gui/gui_gfx.h
+++ b/engines/sci/gui/gui_gfx.h
@@ -101,7 +101,7 @@ public:
DrawText(str, 0, (int16)strlen(str), orgFontId, orgPenColor);
}
void TextBox(const char *str, int16 bshow, const Common::Rect &rect, int16 align, GuiResourceId fontId);
- void BitsShow(const Common::Rect &r, uint16 flags);
+ void BitsShow(const Common::Rect &r);
GuiMemoryHandle BitsSave(const Common::Rect &rect, byte screenFlags);
void BitsRestore(GuiMemoryHandle memoryHandle);
void BitsFree(GuiMemoryHandle memoryHandle);
@@ -111,6 +111,8 @@ public:
void drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId);
void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo);
+ void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo);
+ void drawCel(SciGuiView *view, GuiViewLoopNo loopNo, GuiViewCelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo);
void drawListControl(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 upperPos, int16 cursorPos, bool isAlias);
void TexteditCursorDraw (Common::Rect rect, const char *text, uint16 curPos);
void TexteditCursorErase();
@@ -123,12 +125,15 @@ public:
byte CoordinateToPriority(int16 y);
int16 PriorityToCoordinate(byte priority);
+ void ShowPic();
+
void AnimateDisposeLastCast();
void AnimateInvoke(List *list, int argc, reg_t *argv);
void AnimateMakeSortedList(List *list);
void AnimateFill(byte &oldPicNotValid);
void AnimateUpdate();
void AnimateDrawCels();
+ void AnimateUpdateScreen(byte oldPicNotValid);
void AnimateRestoreAndDelete(int argc, reg_t *argv);
void AddToPicDrawCels(List *list);
void AddToPicDrawView(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control);
diff --git a/engines/sci/gui/gui_palette.cpp b/engines/sci/gui/gui_palette.cpp
index 2e2ae650ae..32c29f16ea 100644
--- a/engines/sci/gui/gui_palette.cpp
+++ b/engines/sci/gui/gui_palette.cpp
@@ -191,7 +191,7 @@ void SciGuiPalette::set(GuiPalette *sciPal, int16 flag) {
if (flag == 2 || sciPal->timestamp != systime) {
merge(sciPal, &_sysPalette, flag);
sciPal->timestamp = _sysPalette.timestamp;
- if (_screen->_picNotValid == 0 && systime != _sysPalette.timestamp)
+ if (!_screen->_picNotValid && systime != _sysPalette.timestamp)
setOnScreen();
}
}
diff --git a/engines/sci/gui/gui_windowmgr.cpp b/engines/sci/gui/gui_windowmgr.cpp
index 46f3895a84..908c645d94 100644
--- a/engines/sci/gui/gui_windowmgr.cpp
+++ b/engines/sci/gui/gui_windowmgr.cpp
@@ -151,6 +151,9 @@ GuiWindow *SciGuiWindowMgr::NewWindow(const Common::Rect &dims, const Common::Re
r.bottom++;
}
}
+
+ // FIXME: it seems as if shadows may result in the window getting moved one upwards
+ // so that the shadow is visible (lsl5)
pwnd->dims = r;
const Common::Rect *wmprect = &_wmgrPort->rect;
@@ -160,24 +163,19 @@ GuiWindow *SciGuiWindowMgr::NewWindow(const Common::Rect &dims, const Common::Re
pwnd->dims.moveTo(pwnd->dims.left, wmprect->top);
if (wmprect->bottom < pwnd->dims.bottom)
- pwnd->dims.moveTo(pwnd->dims.left, wmprect->bottom
- - pwnd->dims.bottom + pwnd->dims.top);
+ pwnd->dims.moveTo(pwnd->dims.left, wmprect->bottom - pwnd->dims.bottom + pwnd->dims.top);
if (wmprect->right < pwnd->dims.right)
- pwnd->dims.moveTo(wmprect->right + pwnd->dims.left
- - pwnd->dims.right, pwnd->dims.top);
+ pwnd->dims.moveTo(wmprect->right + pwnd->dims.left - pwnd->dims.right, pwnd->dims.top);
if (wmprect->left > pwnd->dims.left)
pwnd->dims.moveTo(wmprect->left, pwnd->dims.top);
- pwnd->rect.moveTo(pwnd->rect.left + pwnd->dims.left - oldleft,
- pwnd->rect.top + pwnd->dims.top - oldtop);
+ pwnd->rect.moveTo(pwnd->rect.left + pwnd->dims.left - oldleft, pwnd->rect.top + pwnd->dims.top - oldtop);
if (restoreRect == 0)
pwnd->restoreRect = pwnd->dims;
- // CHECKME: Is this 'kTransparent' check necessary?
- // The shadow is already drawn if !(wndStyle & (kUser | kNoFrame)).
- if (!(pwnd->wndStyle & (SCI_WINDOWMGR_STYLE_TRANSPARENT | SCI_WINDOWMGR_STYLE_USER | SCI_WINDOWMGR_STYLE_NOFRAME))) {
+ if (!(pwnd->wndStyle & (SCI_WINDOWMGR_STYLE_USER | SCI_WINDOWMGR_STYLE_NOFRAME))) {
// The shadow is drawn slightly outside the window.
// Enlarge restoreRect to cover that.
pwnd->restoreRect.bottom++;
@@ -240,7 +238,7 @@ void SciGuiWindowMgr::DrawWindow(GuiWindow *pWnd) {
if (!(wndStyle & SCI_WINDOWMGR_STYLE_TRANSPARENT))
_gfx->FillRect(r, SCI_SCREEN_MASK_VISUAL, pWnd->backClr);
- _gfx->BitsShow(pWnd->dims, SCI_SCREEN_MASK_VISUAL);
+ _gfx->BitsShow(pWnd->restoreRect);
}
_gfx->SetPort(oldport);
}
@@ -250,7 +248,7 @@ void SciGuiWindowMgr::DisposeWindow(GuiWindow *pWnd, int16 arg2) {
_gfx->BitsRestore(pWnd->hSaved1);
_gfx->BitsRestore(pWnd->hSaved2);
if (arg2)
- _gfx->BitsShow(pWnd->restoreRect, SCI_SCREEN_MASK_VISUAL);
+ _gfx->BitsShow(pWnd->restoreRect);
// else
// g_sci->ReAnimate(&pwnd->dims);
_windowList.remove(pWnd);