diff options
author | Filippos Karapetis | 2009-10-28 13:20:30 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-10-28 13:20:30 +0000 |
commit | 04ab6bc9fc831702a26c229027dada1436509b83 (patch) | |
tree | 4b0ba4fe63ef9d7b0a1d868d4cec97c53dba397b /engines/sci/engine/kernel.cpp | |
parent | f28fe1b07423941c245e06376761054507d188c1 (diff) | |
download | scummvm-rg350-04ab6bc9fc831702a26c229027dada1436509b83.tar.gz scummvm-rg350-04ab6bc9fc831702a26c229027dada1436509b83.tar.bz2 scummvm-rg350-04ab6bc9fc831702a26c229027dada1436509b83.zip |
Enclose all of the old graphics code within the INCLUDE_OLDGFX safeguard (defined in sci.h)
svn-id: r45459
Diffstat (limited to 'engines/sci/engine/kernel.cpp')
-rw-r--r-- | engines/sci/engine/kernel.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index a7c6527bc4..fdbcaa7a5f 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -28,6 +28,7 @@ #include "sci/resource.h" #include "sci/engine/state.h" #include "sci/engine/kernel_types.h" +#include "sci/gfx/operations.h" // for gfxop_get_cel_parameters namespace Sci { @@ -728,4 +729,69 @@ bool Kernel::loadKernelNames() { return true; } +Common::Rect set_base(EngineState *s, reg_t object) { + SegManager *segMan = s->_segMan; + int x, y, original_y, z, ystep, xsize = 0, ysize = 0; + int xbase, ybase, xend, yend; + int view, loop, cel; + int oldloop, oldcel; + int xmod = 0, ymod = 0; + Common::Rect retval; + + x = (int16)GET_SEL32V(segMan, object, x); + original_y = y = (int16)GET_SEL32V(segMan, object, y); + + if (s->_kernel->_selectorCache.z > -1) + z = (int16)GET_SEL32V(segMan, object, z); + else + z = 0; + + y -= z; // Subtract z offset + + ystep = (int16)GET_SEL32V(segMan, object, yStep); + + view = (int16)GET_SEL32V(segMan, object, view); + int l = GET_SEL32V(segMan, object, loop); + oldloop = loop = (l & 0x80) ? l - 256 : l; + int c = GET_SEL32V(segMan, object, cel); + oldcel = cel = (c & 0x80) ? c - 256 : c; + + Common::Point offset = Common::Point(0, 0); + + if (loop != oldloop) { + loop = 0; + PUT_SEL32V(segMan, object, loop, 0); + debugC(2, kDebugLevelGraphics, "Resetting loop for %04x:%04x!\n", PRINT_REG(object)); + } + + if (cel != oldcel) { + cel = 0; + PUT_SEL32V(segMan, object, cel, 0); + } + +#ifdef INCLUDE_OLDGFX + gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &xsize, &ysize, &offset); +#else + // TODO +#endif + + xmod = offset.x; + ymod = offset.y; + + xbase = x - xmod - (xsize >> 1); + xend = xbase + xsize; + yend = y /* - ymod */ + 1; + ybase = yend - ystep; + + debugC(2, kDebugLevelBaseSetter, "(%d,%d)+/-(%d,%d), (%d x %d) -> (%d, %d) to (%d, %d)\n", + x, y, xmod, ymod, xsize, ysize, xbase, ybase, xend, yend); + + retval.left = xbase; + retval.top = ybase; + retval.right = xend; + retval.bottom = yend; + + return retval; +} + } // End of namespace Sci |