diff options
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 80 | ||||
-rw-r--r-- | engines/sci/gui/gui.cpp | 8 | ||||
-rw-r--r-- | engines/sci/gui/gui.h | 1 | ||||
-rw-r--r-- | engines/sci/gui/gui_screen.cpp | 15 | ||||
-rw-r--r-- | engines/sci/gui/gui_screen.h | 1 | ||||
-rw-r--r-- | engines/sci/gui32/gui32.cpp | 7 | ||||
-rw-r--r-- | engines/sci/gui32/gui32.h | 3 |
7 files changed, 75 insertions, 40 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 438f0fa442..1b92132e77 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -198,12 +198,12 @@ enum { K_GRAPH_UPDATE_BOX = 12, K_GRAPH_REDRAW_BOX = 13, K_GRAPH_ADJUST_PRIORITY = 14, - K_GRAPH_SAVE_UNSCALED_BOX = 15 // KQ6CD Windows version + K_GRAPH_SAVE_UPSCALEDHIRES_BOX = 15 // KQ6CD Windows version }; reg_t kGraph(EngineState *s, int argc, reg_t *argv) { int16 x = 0, y = 0, x1 = 0, y1 = 0; - uint16 flags; + uint16 screenMask; int16 priority, control, color, colorMask; Common::Rect rect; @@ -229,10 +229,11 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) { case K_GRAPH_SAVE_BOX: kGraphCreateRect(x, y, x1, y1, &rect); - flags = (argc > 5) ? argv[5].toUint16() : 0; - return s->_gui->graphSaveBox(rect, flags); + screenMask = (argc > 5) ? argv[5].toUint16() : 0; + return s->_gui->graphSaveBox(rect, screenMask); case K_GRAPH_RESTORE_BOX: + // This may be called with a memoryhandle from SAVE_BOX or SAVE_UPSCALEDHIRES_BOX s->_gui->graphRestoreBox(argv[1]); break; @@ -272,10 +273,10 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) { s->priority_last = argv[2].toSint16() - 10; break; - case K_GRAPH_SAVE_UNSCALED_BOX: - // Save an area given in unscaled coordinates, so that a hires control will be drawn over it - // TODO - break; + case K_GRAPH_SAVE_UPSCALEDHIRES_BOX: + // 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); default: error("Unsupported kGraph() operation %04x", argv[0].toSint16()); @@ -633,32 +634,37 @@ reg_t kPortrait(EngineState *s, int argc, reg_t *argv) { switch (operation) { case 0: { // load resource (the corresponding .BIN file from the ACTORS directory) - Common::String resName = s->_segMan->getString(argv[1]); - warning("kPortrait, load portrait %s", resName.c_str()); - // TODO - } break; + if (argc == 2) { + Common::String resourceName = s->_segMan->getString(argv[1]); + } else { + warning("kPortrait(loadResource) called with unsupported argc %d", argc); + } + break; + } case 1: { // show portrait - Common::String resName = s->_segMan->getString(argv[1]); - - // Show the portrait and sync the sound resource (like kDoSync) - /* - Common::Point portraitPos = Common::Point(argv[2].toUint16(), argv[3].toUint16()); - uint resourceNum = argv[4].toUint16() & 0xff; - uint noun = argv[5].toUint16() & 0xff; - uint verb = argv[6].toUint16() & 0xff; - uint cond = argv[7].toUint16() & 0xff; - uint seq = argv[8].toUint16() & 0xff; - // argv[9] is usually 0 - */ - - warning("kPortrait, show portrait %s", resName.c_str()); - // TODO - } break; + if (argc == 10) { + Common::String resourceName = s->_segMan->getString(argv[1]); + Common::Point portraitPos = Common::Point(argv[2].toUint16(), argv[3].toUint16()); + uint resourceNum = argv[4].toUint16() & 0xff; + uint noun = argv[5].toUint16() & 0xff; + uint verb = argv[6].toUint16() & 0xff; + uint cond = argv[7].toUint16() & 0xff; + uint seq = argv[8].toUint16() & 0xff; + // argv[9] is usually 0??!! + warning("kPortrait(show) %s at %d, %d", resourceName.c_str(), portraitPos.x, portraitPos.y); + } else { + warning("kPortrait(show) called with unsupported argc %d", argc); + } + break; + } case 2: { // unload resource - uint16 portraitId = argv[1].toUint16(); - warning("kPortrait, unload portrait ID %d", portraitId); - // TODO - } break; + if (argc == 2) { + uint16 portraitId = argv[1].toUint16(); + } else { + warning("kPortrait(unload) called with unsupported argc %d", argc); + } + break; + } default: warning("kPortrait(%d), not implemented (argc = %d)", operation, argc); } @@ -886,10 +892,12 @@ reg_t kDrawCel(EngineState *s, int argc, reg_t *argv) { GuiResourceId viewId = argv[0].toSint16(); GuiViewLoopNo loopNo = argv[1].toSint16(); GuiViewCelNo celNo = argv[2].toSint16(); - int x = argv[3].toSint16(); - int y = argv[4].toSint16(); - int priority = (argc > 5) ? argv[5].toSint16() : -1; - int paletteNo = (argc > 6) ? argv[6].toSint16() : 0; + uint16 x = argv[3].toUint16(); + 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; s->_gui->drawCel(viewId, loopNo, celNo, x, y, priority, paletteNo); diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index 90695b7f7d..6552a52292 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -451,8 +451,12 @@ void SciGui::graphDrawLine(Common::Point startPoint, Common::Point endPoint, int _screen->drawLine(startPoint.x, startPoint.y, endPoint.x, endPoint.y, color, priority, control); } -reg_t SciGui::graphSaveBox(Common::Rect rect, uint16 flags) { - return _gfx->BitsSave(rect, flags); +reg_t SciGui::graphSaveBox(Common::Rect rect, uint16 screenMask) { + return _gfx->BitsSave(rect, screenMask); +} + +reg_t SciGui::graphSaveUpscaledHiresBox(Common::Rect rect) { + return _gfx->BitsSave(rect, SCI_SCREEN_MASK_DISPLAY); } void SciGui::graphRestoreBox(reg_t handle) { diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h index 29d090c987..f1d5f0ce77 100644 --- a/engines/sci/gui/gui.h +++ b/engines/sci/gui/gui.h @@ -96,6 +96,7 @@ public: virtual void graphFrameBox(Common::Rect rect, int16 color); 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 reg_t graphSaveUpscaledHiresBox(Common::Rect rect); virtual void graphRestoreBox(reg_t handle); virtual void graphUpdateBox(Common::Rect rect); virtual void graphRedrawBox(Common::Rect rect); diff --git a/engines/sci/gui/gui_screen.cpp b/engines/sci/gui/gui_screen.cpp index 75360c0838..6418751a66 100644 --- a/engines/sci/gui/gui_screen.cpp +++ b/engines/sci/gui/gui_screen.cpp @@ -252,6 +252,11 @@ int SciGuiScreen::bitsGetDataSize(Common::Rect rect, byte mask) { if (mask & SCI_SCREEN_MASK_CONTROL) { byteCount += pixels; // _controlScreen } + if (mask & SCI_SCREEN_MASK_DISPLAY) { + if (!_upscaledHires) + error("bitsGetDataSize() called w/o being in upscaled hires mode"); + byteCount += pixels; // _displayScreen (coordinates actually are given to us for hires displayScreen) + } return byteCount; } @@ -270,6 +275,11 @@ void SciGuiScreen::bitsSave(Common::Rect rect, byte mask, byte *memoryPtr) { if (mask & SCI_SCREEN_MASK_CONTROL) { bitsSaveScreen(rect, _controlScreen, memoryPtr); } + if (mask & SCI_SCREEN_MASK_DISPLAY) { + if (!_upscaledHires) + error("bitsSave() called w/o being in upscaled hires mode"); + bitsSaveScreen(rect, _displayScreen, memoryPtr); + } } void SciGuiScreen::bitsSaveScreen(Common::Rect rect, byte *screen, byte *&memoryPtr) { @@ -324,6 +334,11 @@ void SciGuiScreen::bitsRestore(byte *memoryPtr) { if (mask & SCI_SCREEN_MASK_CONTROL) { bitsRestoreScreen(rect, memoryPtr, _controlScreen); } + if (mask & SCI_SCREEN_MASK_DISPLAY) { + if (!_upscaledHires) + error("bitsRestore() called w/o being in upscaled hires mode"); + bitsRestoreScreen(rect, memoryPtr, _displayScreen); + } } void SciGuiScreen::bitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *screen) { diff --git a/engines/sci/gui/gui_screen.h b/engines/sci/gui/gui_screen.h index d913210495..4759b094d9 100644 --- a/engines/sci/gui/gui_screen.h +++ b/engines/sci/gui/gui_screen.h @@ -36,6 +36,7 @@ namespace Sci { #define SCI_SCREEN_MASK_VISUAL 1 #define SCI_SCREEN_MASK_PRIORITY 2 #define SCI_SCREEN_MASK_CONTROL 4 +#define SCI_SCREEN_MASK_DISPLAY 8 // not official sierra sci #define SCI_SCREEN_MASK_ALL SCI_SCREEN_MASK_VISUAL|SCI_SCREEN_MASK_PRIORITY|SCI_SCREEN_MASK_CONTROL #define SCI_SCREEN_UNDITHERMEMORIAL_SIZE 256 diff --git a/engines/sci/gui32/gui32.cpp b/engines/sci/gui32/gui32.cpp index 233df2478b..12ec90e8e8 100644 --- a/engines/sci/gui32/gui32.cpp +++ b/engines/sci/gui32/gui32.cpp @@ -1239,7 +1239,7 @@ void SciGui32::graphDrawLine(Common::Point startPoint, Common::Point endPoint, i FULL_REDRAW(); } -reg_t SciGui32::graphSaveBox(Common::Rect rect, uint16 flags) { +reg_t SciGui32::graphSaveBox(Common::Rect rect, uint16 screenMask) { rect_t area; area.x = rect.left + _s->port->zone.x + port_origin_x; area.y = rect.top + _s->port->zone.y + port_origin_y; @@ -1249,6 +1249,11 @@ reg_t SciGui32::graphSaveBox(Common::Rect rect, uint16 flags) { return graph_save_box(_s, area); } +reg_t SciGui32::graphSaveUpscaledHiresBox(Common::Rect rect) { + // STUB + return NULL_REG; +} + void SciGui32::graphRestoreBox(reg_t handle) { graph_restore_box(_s, handle); } diff --git a/engines/sci/gui32/gui32.h b/engines/sci/gui32/gui32.h index 43ce35fc29..d76fc772da 100644 --- a/engines/sci/gui32/gui32.h +++ b/engines/sci/gui32/gui32.h @@ -74,7 +74,8 @@ public: void graphFillBoxBackground(Common::Rect rect); void graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control); void graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control); - reg_t graphSaveBox(Common::Rect rect, uint16 flags); + reg_t graphSaveBox(Common::Rect rect, uint16 screenMask); + reg_t graphSaveUpscaledHiresBox(Common::Rect rect); void graphRestoreBox(reg_t handle); void graphUpdateBox(Common::Rect); void graphRedrawBox(Common::Rect); |