diff options
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 11 | ||||
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 16 | ||||
-rw-r--r-- | engines/sci/graphics/frameout.h | 6 |
3 files changed, 18 insertions, 15 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 556e5249b6..0eda91b433 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -1322,10 +1322,10 @@ reg_t kRepaintPlane(EngineState *s, int argc, reg_t *argv) { reg_t kAddPicAt(EngineState *s, int argc, reg_t *argv) { reg_t planeObj = argv[0]; GuiResourceId pictureId = argv[1].toUint16(); - int16 forWidth = argv[2].toSint16(); - // argv[3] seems to be 0 most of the time + int16 pictureX = argv[2].toSint16(); + int16 pictureY = argv[3].toSint16(); - g_sci->_gfxFrameout->kernelAddPicAt(planeObj, forWidth, pictureId); + g_sci->_gfxFrameout->kernelAddPicAt(planeObj, pictureId, pictureX, pictureY); return s->r_acc; } @@ -1334,12 +1334,7 @@ reg_t kGetHighPlanePri(EngineState *s, int argc, reg_t *argv) { } reg_t kFrameOut(EngineState *s, int argc, reg_t *argv) { - // This kernel call likely seems to be doing the screen updates, - // as its called right after a view is updated - - // TODO g_sci->_gfxFrameout->kernelFrameout(); - return NULL_REG; } diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index 5499a2d192..6bd310f1a0 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -198,12 +198,13 @@ void GfxFrameout::kernelDeletePlane(reg_t object) { } } -void GfxFrameout::addPlanePicture(reg_t object, GuiResourceId pictureId, uint16 startX) { +void GfxFrameout::addPlanePicture(reg_t object, GuiResourceId pictureId, uint16 startX, uint16 startY) { PlanePictureEntry newPicture; newPicture.object = object; newPicture.pictureId = pictureId; newPicture.picture = new GfxPicture(_resMan, _coordAdjuster, 0, _screen, _palette, pictureId, false); newPicture.startX = startX; + newPicture.startY = startY; newPicture.pictureCels = 0; _planePictures.push_back(newPicture); } @@ -275,9 +276,8 @@ int16 GfxFrameout::kernelGetHighPlanePri() { return readSelectorValue(g_sci->getEngineState()->_segMan, _planes.back().object, SELECTOR(priority)); } -// TODO: No idea yet how to implement this -void GfxFrameout::kernelAddPicAt(reg_t planeObj, int16 forWidth, GuiResourceId pictureId) { - addPlanePicture(planeObj, pictureId, forWidth); +void GfxFrameout::kernelAddPicAt(reg_t planeObj, GuiResourceId pictureId, int16 pictureX, int16 pictureY) { + addPlanePicture(planeObj, pictureId, pictureX, pictureY); } bool sortHelper(const FrameoutEntry* entry1, const FrameoutEntry* entry2) { @@ -403,6 +403,7 @@ void GfxFrameout::kernelFrameout() { picEntry->y = planePicture->getSci32celY(pictureCelNr); picEntry->x = planePicture->getSci32celX(pictureCelNr); picEntry->picStartX = pictureIt->startX; + picEntry->picStartY = pictureIt->startY; picEntry->priority = planePicture->getSci32celPriority(pictureCelNr); @@ -425,8 +426,9 @@ void GfxFrameout::kernelFrameout() { itemEntry->y = ((itemEntry->y * _screen->getHeight()) / scriptsRunningHeight); itemEntry->x = ((itemEntry->x * _screen->getWidth()) / scriptsRunningWidth); itemEntry->picStartX = ((itemEntry->picStartX * _screen->getWidth()) / scriptsRunningWidth); + itemEntry->picStartY = ((itemEntry->picStartY * _screen->getHeight()) / scriptsRunningHeight); - // Out of view + // Out of view horizontally (sanity checks) int16 pictureCelStartX = itemEntry->picStartX + itemEntry->x; int16 pictureCelEndX = pictureCelStartX + itemEntry->picture->getSci32celWidth(itemEntry->celNo); int16 planeStartX = it->planeOffsetX; @@ -436,6 +438,9 @@ void GfxFrameout::kernelFrameout() { if (pictureCelStartX > planeEndX) continue; + // Out of view vertically (sanity checks) + // TODO + int16 pictureOffsetX = it->planeOffsetX; int16 pictureX = itemEntry->x; if ((it->planeOffsetX) || (itemEntry->picStartX)) { @@ -447,6 +452,7 @@ void GfxFrameout::kernelFrameout() { } } + // TODO: pictureOffsetY itemEntry->picture->drawSci32Vga(itemEntry->celNo, pictureX, itemEntry->y, pictureOffsetX, it->planePictureMirrored); // warning("picture cel %d %d", itemEntry->celNo, itemEntry->priority); diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h index 7e5b1a5006..d2c8086f5f 100644 --- a/engines/sci/graphics/frameout.h +++ b/engines/sci/graphics/frameout.h @@ -58,6 +58,7 @@ struct FrameoutEntry { Common::Rect celRect; GfxPicture *picture; int16 picStartX; + int16 picStartY; }; typedef Common::List<FrameoutEntry *> FrameoutList; @@ -65,6 +66,7 @@ typedef Common::List<FrameoutEntry *> FrameoutList; struct PlanePictureEntry { reg_t object; int16 startX; + int16 startY; GuiResourceId pictureId; GfxPicture *picture; FrameoutEntry *pictureCels; // temporary @@ -93,10 +95,10 @@ public: void kernelUpdateScreenItem(reg_t object); void kernelDeleteScreenItem(reg_t object); int16 kernelGetHighPlanePri(); - void kernelAddPicAt(reg_t planeObj, int16 forWidth, GuiResourceId pictureId); + void kernelAddPicAt(reg_t planeObj, GuiResourceId pictureId, int16 pictureX, int16 pictureY); void kernelFrameout(); - void addPlanePicture(reg_t object, GuiResourceId pictureId, uint16 startX); + void addPlanePicture(reg_t object, GuiResourceId pictureId, uint16 startX, uint16 startY = 0); void deletePlanePictures(reg_t object); void clear(); |