From 0b83a8eec03fac3fe3a7ea656be6ea8752477554 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 28 Oct 2009 13:43:09 +0000 Subject: Reimplemented isItSkip() using new graphics code svn-id: r45461 --- engines/sci/engine/kgraphics.cpp | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'engines/sci/engine') diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 61419828fd..c96c9d8f53 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -38,6 +38,7 @@ #include "sci/gui/gui_animate.h" #include "sci/gui/gui_cursor.h" #include "sci/gui/gui_screen.h" +#include "sci/gui/gui_view.h" namespace Sci { @@ -377,28 +378,15 @@ reg_t kIsItSkip(EngineState *s, int argc, reg_t *argv) { int y = argv[3].toUint16(); int x = argv[4].toUint16(); -#ifdef INCLUDE_OLDGFX - gfxr_view_t *res = NULL; - gfx_pixmap_t *pxm = NULL; - - res = s->gfx_state->gfxResMan->getView(view, &loop, &cel, 0); - - if (!res) { - warning("[GFX] Attempt to get cel parameters for invalid view %d", view); - return SIGNAL_REG; - } + SciGuiView *tmpView = new SciGuiView(s->resMan, NULL, NULL, view); + sciViewCelInfo *celInfo = tmpView->getCelInfo(loop, cel); + x = CLIP(x, 0, celInfo->width - 1); + y = CLIP(y, 0, celInfo->height - 1); + byte *celData = tmpView->getBitmap(loop, cel); + int result = (celData[y * celInfo->width + x] == celInfo->clearKey); + delete tmpView; - pxm = res->loops[loop].cels[cel]; - if (x > pxm->index_width) - x = pxm->index_width - 1; - if (y > pxm->index_height) - y = pxm->index_height - 1; - - return make_reg(0, pxm->index_data[y * pxm->index_width + x] == pxm->color_key); -#else - // TODO - return NULL_REG; -#endif + return make_reg(0, result); } reg_t kCelHigh(EngineState *s, int argc, reg_t *argv) { -- cgit v1.2.3