From f54036b6a45ca172512d409439ccbab8ef87433d Mon Sep 17 00:00:00 2001 From: Benjamin Haisch Date: Mon, 12 May 2008 21:47:38 +0000 Subject: Implemented o1_EXCLUDEAREA for RtZ svn-id: r32074 --- engines/made/screen.cpp | 66 +++++++++++++++++++++++++++++++++++----- engines/made/screen.h | 3 ++ engines/made/scriptfuncs_rtz.cpp | 7 +++-- 3 files changed, 66 insertions(+), 10 deletions(-) (limited to 'engines/made') diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp index 371a0e4acd..1ec57db313 100644 --- a/engines/made/screen.cpp +++ b/engines/made/screen.cpp @@ -108,6 +108,56 @@ void Screen::clearScreen() { _needPalette = true; } +void Screen::setExcludeArea(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { + + _excludeClipAreaEnabled[0] = false; + _excludeClipAreaEnabled[1] = false; + _excludeClipAreaEnabled[2] = false; + _excludeClipAreaEnabled[3] = false; + + if (x1 == 0 && y1 == 0 && x2 == 0 && y2 == 0) { + _excludeClipArea[0].x = 0; + _excludeClipArea[0].y = 0; + _excludeClipArea[0].w = 320; + _excludeClipArea[0].h = 200; + _excludeClipAreaEnabled[0] = true; + return; + } + + if (y1 > 0 && y2 > 0) { + _excludeClipArea[0].x = 0; + _excludeClipArea[0].y = 0; + _excludeClipArea[0].w = 320; + _excludeClipArea[0].h = y1; + _excludeClipAreaEnabled[0] = true; + } + + if (y1 < 200 && y2 < 200) { + _excludeClipArea[1].x = 0; + _excludeClipArea[1].y = y2; + _excludeClipArea[1].w = 320; + _excludeClipArea[1].h = 200 - y2; + _excludeClipAreaEnabled[1] = true; + } + + if (x1 > 0 && x2 > 0) { + _excludeClipArea[2].x = 0; + _excludeClipArea[2].y = y1; + _excludeClipArea[2].w = x1; + _excludeClipArea[2].h = y2 - y1; + _excludeClipAreaEnabled[2] = true; + } + + if (x1 < 320 && x2 < 320) { + _excludeClipArea[3].x = x2; + _excludeClipArea[3].y = y1; + _excludeClipArea[3].w = 320 - x2; + _excludeClipArea[3].h = y2 - y1; + _excludeClipAreaEnabled[3] = true; + } + +} + void Screen::drawSurface(Graphics::Surface *sourceSurface, int x, int y, int16 flipX, int16 flipY, int16 mask, const ClipInfo &clipInfo) { byte *source, *dest, *maskp; @@ -116,16 +166,16 @@ void Screen::drawSurface(Graphics::Surface *sourceSurface, int x, int y, int16 f int clipWidth = sourceSurface->w; int clipHeight = sourceSurface->h; - if (x < 0) { - startX = -x; + if (x < clipInfo.x) { + startX = clipInfo.x - x; clipWidth -= startX; - x = 0; + x = clipInfo.x; } - if (y < 0) { - startY = -y; + if (y < clipInfo.y) { + startY = clipInfo.y - y; clipHeight -= startY; - y = 0; + y = clipInfo.y; } if (x + clipWidth > clipInfo.x + clipInfo.w) { @@ -659,9 +709,9 @@ void Screen::printChar(uint c, int16 x, int16 y, byte color) { byte p; byte *dest = (byte*)_fontDrawCtx.destSurface->getBasePtr(x, y); - for (uint16 yc = 0; yc < height; yc++) { + for (uint yc = 0; yc < height; yc++) { p = charData[yc]; - for (uint16 xc = 0; xc < width; xc++) { + for (uint xc = 0; xc < width; xc++) { if (p & 0x80) dest[xc] = color; p <<= 1; diff --git a/engines/made/screen.h b/engines/made/screen.h index e1a92a9583..e549e86eee 100644 --- a/engines/made/screen.h +++ b/engines/made/screen.h @@ -79,6 +79,8 @@ public: _clipArea.h = ABS(y2 - y1); } + void setExcludeArea(uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void setClip(int16 clip) { _clip = clip; } void setExclude(int16 exclude) { _exclude = exclude; } void setGround(int16 ground) { _ground = ground; } @@ -185,6 +187,7 @@ protected: uint16 _channelsUsedCount; SpriteChannel _channels[100]; + }; } // End of namespace Made diff --git a/engines/made/scriptfuncs_rtz.cpp b/engines/made/scriptfuncs_rtz.cpp index 424ec1cb5d..cbfe9ce5b3 100644 --- a/engines/made/scriptfuncs_rtz.cpp +++ b/engines/made/scriptfuncs_rtz.cpp @@ -658,7 +658,7 @@ int16 ScriptFunctionsRtz::o1_SETCONTENT(int16 argc, int16 *argv) { } int16 ScriptFunctionsRtz::o1_EXCLUDEAREA(int16 argc, int16 *argv) { - warning("Unimplemented opcode: o1_EXCLUDEAREA"); + _vm->_screen->setExcludeArea(argv[3], argv[2], argv[1], argv[0]); return 0; } @@ -857,7 +857,10 @@ int16 ScriptFunctionsRtz::o1_WHATSYNTH(int16 argc, int16 *argv) { } int16 ScriptFunctionsRtz::o1_SLOWSYSTEM(int16 argc, int16 *argv) { - warning("Unimplemented opcode: o1_SLOWSYSTEM"); + //warning("Unimplemented opcode: o1_SLOWSYSTEM"); + // NOTE: In the original engine this value is set via a command-line parameter + // I don't think it's needed here + // One could maybe think about returning 1 here on actually slower systems. return 0; } -- cgit v1.2.3