From c64fa600b7cd1eb185f29a29de75dd19497c4857 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 31 Oct 2009 17:54:28 +0000 Subject: - Added some TODOs - Disabled the kGraph case used in KQ6 Windows for now, as it's problematic and crashes the game - Added extra param to kDrawCel(), used in KQ6 Windows The icon bar in KQ6 Windows is shown a bit better now svn-id: r45567 --- engines/sci/engine/kgraphics.cpp | 27 +++++++++++++++++++++------ engines/sci/gui/gui.cpp | 6 ++++-- engines/sci/gui/gui.h | 2 +- engines/sci/gui/gui_gfx.cpp | 4 ++-- engines/sci/gui/gui_gfx.h | 2 +- engines/sci/gui/gui_view.cpp | 7 +++++-- engines/sci/gui/gui_view.h | 2 +- engines/sci/gui32/gui32.cpp | 2 +- engines/sci/gui32/gui32.h | 2 +- 9 files changed, 37 insertions(+), 17 deletions(-) (limited to 'engines') diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 1b92132e77..0c5284e82b 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -274,9 +274,14 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) { break; case K_GRAPH_SAVE_UPSCALEDHIRES_BOX: + warning("kGraph case 15 (%d, %d, %d, %d)", x, y, x1, y1); + + // TODO: implement this properly. The code below crashes KQ6 + // Save an area given in upscaled-hires coordinates, so that a hires control will be drawn over it - kGraphCreateRect(x, y, x1, y1, &rect); - return s->_gui->graphSaveUpscaledHiresBox(rect); + //kGraphCreateRect(x, y, x1, y1, &rect); + //return s->_gui->graphSaveUpscaledHiresBox(rect); + break; default: error("Unsupported kGraph() operation %04x", argv[0].toSint16()); @@ -624,6 +629,8 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) { reg_t kAssertPalette(EngineState *s, int argc, reg_t *argv) { GuiResourceId viewId = argv[1].toUint16(); + // TODO: implement this + warning("kAssertPalette() called with viewId = %d", viewId); return s->r_acc; } @@ -636,6 +643,9 @@ reg_t kPortrait(EngineState *s, int argc, reg_t *argv) { case 0: { // load resource (the corresponding .BIN file from the ACTORS directory) if (argc == 2) { Common::String resourceName = s->_segMan->getString(argv[1]); + + // TODO: implement this + } else { warning("kPortrait(loadResource) called with unsupported argc %d", argc); } @@ -651,6 +661,9 @@ reg_t kPortrait(EngineState *s, int argc, reg_t *argv) { uint cond = argv[7].toUint16() & 0xff; uint seq = argv[8].toUint16() & 0xff; // argv[9] is usually 0??!! + + // TODO: implement this. Looks to be a modified version of kDoSync + warning("kPortrait(show) %s at %d, %d", resourceName.c_str(), portraitPos.x, portraitPos.y); } else { warning("kPortrait(show) called with unsupported argc %d", argc); @@ -660,6 +673,9 @@ reg_t kPortrait(EngineState *s, int argc, reg_t *argv) { case 2: { // unload resource if (argc == 2) { uint16 portraitId = argv[1].toUint16(); + + // TODO: implement this + } else { warning("kPortrait(unload) called with unsupported argc %d", argc); } @@ -669,7 +685,7 @@ reg_t kPortrait(EngineState *s, int argc, reg_t *argv) { warning("kPortrait(%d), not implemented (argc = %d)", operation, argc); } - return NULL_REG; + return s->r_acc; } void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) { @@ -896,10 +912,9 @@ reg_t kDrawCel(EngineState *s, int argc, reg_t *argv) { uint16 y = argv[4].toUint16(); int16 priority = (argc > 5) ? argv[5].toSint16() : -1; uint16 paletteNo = (argc > 6) ? argv[6].toUint16() : 0; - // Unknown seems to be scaling related?!? - int16 unknown = (argc > 7) ? argv[7].toSint16() : -1; + int16 origHeight = (argc > 7) ? argv[7].toSint16() : -1; - s->_gui->drawCel(viewId, loopNo, celNo, x, y, priority, paletteNo); + s->_gui->drawCel(viewId, loopNo, celNo, x, y, priority, paletteNo, origHeight); return s->r_acc; } diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index 6552a52292..b14bd6df67 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -325,8 +325,8 @@ void SciGui::drawPicture(GuiResourceId pictureId, int16 animationNr, bool animat _gfx->SetPort(oldPort); } -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); +void SciGui::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, int16 origHeight) { + _gfx->drawCel(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo, origHeight); _palette->setOnScreen(); } @@ -456,6 +456,8 @@ reg_t SciGui::graphSaveBox(Common::Rect rect, uint16 screenMask) { } reg_t SciGui::graphSaveUpscaledHiresBox(Common::Rect rect) { + rect.right *= 2; + rect.bottom *= 2; return _gfx->BitsSave(rect, SCI_SCREEN_MASK_DISPLAY); } diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h index f1d5f0ce77..9088848458 100644 --- a/engines/sci/gui/gui.h +++ b/engines/sci/gui/gui.h @@ -82,7 +82,7 @@ public: virtual void drawMenuBar(); virtual void clearMenuBar(); virtual void drawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo); - virtual void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo); + virtual void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, int16 origHeight = -1); virtual void drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite); virtual void drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 alignment, int16 style, bool hilite); virtual void drawControlTextEdit(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite); diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp index 1719b6d845..b87079b69f 100644 --- a/engines/sci/gui/gui_gfx.cpp +++ b/engines/sci/gui/gui_gfx.cpp @@ -329,7 +329,7 @@ void SciGuiGfx::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mir } // 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) { +void SciGuiGfx::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight) { SciGuiView *view = getView(viewId); Common::Rect rect; Common::Rect clipRect; @@ -346,7 +346,7 @@ void SciGuiGfx::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo Common::Rect clipRectTranslated = clipRect; OffsetRect(clipRectTranslated); - view->draw(rect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo); + view->draw(rect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, origHeight); if (!_screen->_picNotValid) BitsShow(rect); } diff --git a/engines/sci/gui/gui_gfx.h b/engines/sci/gui/gui_gfx.h index c5e7f99d9a..28242d41b7 100644 --- a/engines/sci/gui/gui_gfx.h +++ b/engines/sci/gui/gui_gfx.h @@ -87,7 +87,7 @@ public: void BitsFree(GuiMemoryHandle memoryHandle); 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, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight = -1); 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); diff --git a/engines/sci/gui/gui_view.cpp b/engines/sci/gui/gui_view.cpp index 91d8067c3c..a5bc5ff648 100644 --- a/engines/sci/gui/gui_view.cpp +++ b/engines/sci/gui/gui_view.cpp @@ -451,7 +451,7 @@ void SciGuiView::unditherBitmap(byte *bitmapPtr, int16 width, int16 height, byte } } -void SciGuiView::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte priority, uint16 EGAmappingNr) { +void SciGuiView::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte priority, uint16 EGAmappingNr, int16 origHeight) { GuiPalette *palette = _embeddedPal ? &_viewPalette : &_palette->_sysPalette; sciViewCelInfo *celInfo = getCelInfo(loopNo, celNo); byte *bitmap = getBitmap(loopNo, celNo); @@ -477,7 +477,10 @@ void SciGuiView::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect cli for (x = 0; x < width; x++) { color = bitmap[x]; if (color != clearKey && priority >= _screen->getPriority(clipRectTranslated.left + x, y)) - _screen->putPixel(clipRectTranslated.left + x, y, drawMask, palette->mapping[color], priority, 0); + if (origHeight == -1) + _screen->putPixel(clipRectTranslated.left + x, y, drawMask, palette->mapping[color], priority, 0); + else + _screen->putPixelOnDisplay(clipRectTranslated.left + x, y, palette->mapping[color]); } } } else { diff --git a/engines/sci/gui/gui_view.h b/engines/sci/gui/gui_view.h index 09b7b69aa2..c4ed3db2b0 100644 --- a/engines/sci/gui/gui_view.h +++ b/engines/sci/gui/gui_view.h @@ -60,7 +60,7 @@ public: sciViewLoopInfo *getLoopInfo(GuiViewLoopNo loopNo); void getCelRect(GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 x, int16 y, int16 z, Common::Rect *outRect); byte *getBitmap(GuiViewLoopNo loopNo, GuiViewCelNo celNo); - void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte priority, uint16 EGAmappingNr); + void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte priority, uint16 EGAmappingNr, int16 origHeight = -1); uint16 getLoopCount() const { return _loopCount; } uint16 getCelCount(GuiViewLoopNo loopNo) { return _loop[loopNo].celCount; } GuiPalette *getPalette(); diff --git a/engines/sci/gui32/gui32.cpp b/engines/sci/gui32/gui32.cpp index 12ec90e8e8..8d6cabafaf 100644 --- a/engines/sci/gui32/gui32.cpp +++ b/engines/sci/gui32/gui32.cpp @@ -883,7 +883,7 @@ void SciGui32::drawPicture(GuiResourceId pictureId, int16 animationNr, bool anim _s->pic_is_new = 1; } -void SciGui32::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo) { +void SciGui32::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, int16 origHeight) { int loop = loopNo; int cel = celNo; GfxView *new_view; diff --git a/engines/sci/gui32/gui32.h b/engines/sci/gui32/gui32.h index d76fc772da..66c0772ff7 100644 --- a/engines/sci/gui32/gui32.h +++ b/engines/sci/gui32/gui32.h @@ -62,7 +62,7 @@ public: void drawMenuBar(); void clearMenuBar(); void drawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo); - void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo); + void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, int16 origHeight = -1); void drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite); void drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 alignment, int16 style, bool hilite); void drawControlTextEdit(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite); -- cgit v1.2.3