diff options
author | Benjamin Haisch | 2008-05-14 09:54:15 +0000 |
---|---|---|
committer | Benjamin Haisch | 2008-05-14 09:54:15 +0000 |
commit | 0ec51de2721d7b670c997b7a3d1bc53f432d6e6b (patch) | |
tree | 3ec87d40623869be3adbb03d85039240f2312a26 /engines/made | |
parent | 97855800b6592cf9c9bc2b010c13cdd07575f5e2 (diff) | |
download | scummvm-rg350-0ec51de2721d7b670c997b7a3d1bc53f432d6e6b.tar.gz scummvm-rg350-0ec51de2721d7b670c997b7a3d1bc53f432d6e6b.tar.bz2 scummvm-rg350-0ec51de2721d7b670c997b7a3d1bc53f432d6e6b.zip |
- Added some visual effects (palette fading etc.)
- Moved Screen::getAnimFrameCount directly into o1_GETFRAMECOUNT
- Renamed variables/cleanup
svn-id: r32104
Diffstat (limited to 'engines/made')
-rw-r--r-- | engines/made/module.mk | 1 | ||||
-rw-r--r-- | engines/made/screen.cpp | 134 | ||||
-rw-r--r-- | engines/made/screen.h | 24 | ||||
-rw-r--r-- | engines/made/screenfx.cpp | 254 | ||||
-rw-r--r-- | engines/made/screenfx.h | 63 | ||||
-rw-r--r-- | engines/made/scriptfuncs_rtz.cpp | 8 |
6 files changed, 408 insertions, 76 deletions
diff --git a/engines/made/module.mk b/engines/made/module.mk index 164e1bfba4..8d38192af7 100644 --- a/engines/made/module.mk +++ b/engines/made/module.mk @@ -10,6 +10,7 @@ MODULE_OBJS = \ redreader.o \ resource.o \ screen.o \ + screenfx.o \ script.o \ scriptfuncs_lgop2.o \ scriptfuncs_mhne.o \ diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp index 974dc4b132..563e059309 100644 --- a/engines/made/screen.cpp +++ b/engines/made/screen.cpp @@ -32,18 +32,18 @@ namespace Made { Screen::Screen(MadeEngine *vm) : _vm(vm) { - _screen1 = new Graphics::Surface(); - _screen1->create(320, 200, 1); + _backgroundScreen = new Graphics::Surface(); + _backgroundScreen->create(320, 200, 1); - _screen2 = new Graphics::Surface(); - _screen2->create(320, 200, 1); + _workScreen = new Graphics::Surface(); + _workScreen->create(320, 200, 1); - _clipInfo1.clipRect = Common::Rect(320, 200); - _clipInfo2.clipRect = Common::Rect(320, 200); + _backgroundScreenDrawCtx.clipRect = Common::Rect(320, 200); + _workScreenDrawCtx.clipRect = Common::Rect(320, 200); - _clipInfo1.destSurface = _screen1; - _clipInfo2.destSurface = _screen2; - _clipArea.destSurface = _screen2; + _backgroundScreenDrawCtx.destSurface = _backgroundScreen; + _workScreenDrawCtx.destSurface = _workScreen; + _clipArea.destSurface = _workScreen; // FIXME: Screen mask is only needed in v2 games _screenMask = new Graphics::Surface(); @@ -70,6 +70,7 @@ Screen::Screen(MadeEngine *vm) : _vm(vm) { _mask = 0; _visualEffectNum = 0; + _fx = new ScreenEffects(this); _textX = 0; _textY = 0; @@ -81,20 +82,21 @@ Screen::Screen(MadeEngine *vm) : _vm(vm) { _font = NULL; _currentFontNum = 0; _fontDrawCtx.clipRect = Common::Rect(320, 200); - _fontDrawCtx.destSurface = _screen1; + _fontDrawCtx.destSurface = _backgroundScreen; clearChannels(); } Screen::~Screen() { - delete _screen1; - delete _screen2; + delete _backgroundScreen; + delete _workScreen; delete _screenMask; + delete _fx; } void Screen::clearScreen() { - _screen1->fillRect(Common::Rect(0, 0, 320, 200), 0); - _screen2->fillRect(Common::Rect(0, 0, 320, 200), 0); + _backgroundScreen->fillRect(Common::Rect(0, 0, 320, 200), 0); + _workScreen->fillRect(Common::Rect(0, 0, 320, 200), 0); _screenMask->fillRect(Common::Rect(0, 0, 320, 200), 0); _mask = 0; _needPalette = true; @@ -269,6 +271,20 @@ void Screen::setChannelUseMask(uint16 channelIndex) { _channels[channelIndex - 1].mask = _mask; } +void Screen::setChannelOffsets(uint16 channelIndex, int16 xofs, int16 yofs) { + if (channelIndex < 1 || channelIndex >= 100) + return; + _channels[channelIndex - 1].xofs = xofs; + _channels[channelIndex - 1].yofs = yofs; +} + +void Screen::getChannelOffsets(uint16 channelIndex, int16 &xofs, int16 &yofs) { + if (channelIndex < 1 || channelIndex >= 100) + return; + xofs = _channels[channelIndex - 1].xofs; + yofs = _channels[channelIndex - 1].yofs; +} + void Screen::drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask, int16 excludeStateMask) { for (int i = 0; i <= 3; i++) @@ -301,7 +317,7 @@ void Screen::drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask drawFlex(_channels[i].index, _channels[i].x, _channels[i].y, flipX, flipY, _channels[i].mask, clipInfo); } break; - + case 2: // drawObjectText printObjectText(_channels[i].index, _channels[i].x, _channels[i].y, _channels[i].fontNum, _channels[i].textColor, _channels[i].outlineColor, clipInfo); break; @@ -338,12 +354,12 @@ void Screen::drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask void Screen::updateSprites() { // TODO: This needs some more work, dirty rectangles are currently not used - memcpy(_screen2->pixels, _screen1->pixels, 64000); + memcpy(_workScreen->pixels, _backgroundScreen->pixels, 64000); - drawSpriteChannels(_clipInfo1, 3, 0); - drawSpriteChannels(_clipInfo2, 1, 2); + drawSpriteChannels(_backgroundScreenDrawCtx, 3, 0); + drawSpriteChannels(_workScreenDrawCtx, 1, 2); - _vm->_system->copyRectToScreen((const byte*)_screen2->pixels, _screen2->pitch, 0, 0, _screen2->w, _screen2->h); + _vm->_system->copyRectToScreen((const byte*)_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h); } @@ -395,7 +411,7 @@ void Screen::drawAnimFrame(uint16 animIndex, int16 x, int16 y, int16 frameNum, i } uint16 Screen::drawPic(uint16 index, int16 x, int16 y, int16 flipX, int16 flipY) { - drawFlex(index, x, y, flipX, flipY, 0, _clipInfo1); + drawFlex(index, x, y, flipX, flipY, 0, _backgroundScreenDrawCtx); return 0; } @@ -405,13 +421,13 @@ uint16 Screen::drawMask(uint16 index, int16 x, int16 y) { } uint16 Screen::drawAnimPic(uint16 animIndex, int16 x, int16 y, int16 frameNum, int16 flipX, int16 flipY) { - drawAnimFrame(animIndex, x, y, frameNum, flipX, flipY, _clipInfo1); + drawAnimFrame(animIndex, x, y, frameNum, flipX, flipY, _backgroundScreenDrawCtx); return 0; } void Screen::addSprite(uint16 spriteIndex) { bool oldScreenLock = _screenLock; - drawFlex(spriteIndex, 0, 0, 0, 0, 0, _clipInfo1); + drawFlex(spriteIndex, 0, 0, 0, 0, 0, _backgroundScreenDrawCtx); _screenLock = oldScreenLock; } @@ -458,8 +474,10 @@ uint16 Screen::placeSprite(uint16 channelIndex, uint16 flexIndex, int16 x, int16 _channels[channelIndex].y1 = y1; _channels[channelIndex].x2 = x2; _channels[channelIndex].y2 = y2; - _channels[channelIndex].area = (x2 - x2) * (y2 - y1); - + _channels[channelIndex].area = (x2 - x1) * (y2 - y1); + _channels[channelIndex].xofs = 0; + _channels[channelIndex].yofs = 0; + if (_channelsUsedCount <= channelIndex) _channelsUsedCount = channelIndex + 1; @@ -511,7 +529,7 @@ uint16 Screen::placeAnim(uint16 channelIndex, uint16 animIndex, int16 x, int16 y _channels[channelIndex].y1 = y1; _channels[channelIndex].x2 = x2; _channels[channelIndex].y2 = y2; - _channels[channelIndex].area = (x2 - x2) * (y2 - y1); + _channels[channelIndex].area = (x2 - x1) * (y2 - y1); if (_channelsUsedCount <= channelIndex) _channelsUsedCount = channelIndex + 1; @@ -541,17 +559,6 @@ int16 Screen::getAnimFrame(uint16 channelIndex) { return _channels[channelIndex - 1].frameNum; } -int16 Screen::getAnimFrameCount(uint16 animIndex) { - int16 frameCount = 0; - AnimationResource *anim = _vm->_res->getAnimation(animIndex); - if (anim) { - frameCount = anim->getCount(); - _vm->_res->freeResource(anim); - } - return frameCount; -} - - uint16 Screen::placeText(uint16 channelIndex, uint16 textObjectIndex, int16 x, int16 y, uint16 fontNum, int16 textColor, int16 outlineColor) { if (channelIndex < 1 || channelIndex >= 100 || textObjectIndex == 0 || fontNum == 0) @@ -604,7 +611,7 @@ uint16 Screen::placeText(uint16 channelIndex, uint16 textObjectIndex, int16 x, i _channels[channelIndex].y1 = y1; _channels[channelIndex].x2 = x2; _channels[channelIndex].y2 = y2; - _channels[channelIndex].area = (x2 - x2) * (y2 - y1); + _channels[channelIndex].area = (x2 - x1) * (y2 - y1); if (_channelsUsedCount <= channelIndex) _channelsUsedCount = channelIndex + 1; @@ -615,29 +622,18 @@ uint16 Screen::placeText(uint16 channelIndex, uint16 textObjectIndex, int16 x, i void Screen::show() { // TODO - + if (_screenLock) return; - drawSpriteChannels(_clipInfo1, 3, 0); - memcpy(_screen2->pixels, _screen1->pixels, 64000); - drawSpriteChannels(_clipInfo2, 1, 2); + drawSpriteChannels(_backgroundScreenDrawCtx, 3, 0); + memcpy(_workScreen->pixels, _backgroundScreen->pixels, 64000); + drawSpriteChannels(_workScreenDrawCtx, 1, 2); - if (_visualEffectNum != 0) { - warning("Unimplemented visual fx %d", _visualEffectNum); - } - - // TODO: Implement visual effects (palette fading etc.) - - if (!_paletteLock) - setRGBPalette(_palette, 0, _paletteColorCount); + _fx->run(_visualEffectNum, _workScreen, _palette, _newPalette, _paletteColorCount); + _visualEffectNum = 0; - _vm->_system->copyRectToScreen((const byte*)_screen2->pixels, _screen2->pitch, 0, 0, _screen2->w, _screen2->h); - - _vm->_system->updateScreen(); - - _visualEffectNum = 0; if (!_paletteInitialized) { memcpy(_newPalette, _palette, _paletteColorCount * 3); @@ -648,19 +644,7 @@ void Screen::show() { } void Screen::flash(int flashCount) { - int palSize = _paletteColorCount * 3; - if (flashCount < 1) - flashCount = 1; - for (int i = 0; i < palSize; i++) - _fxPalette[i] = CLIP<byte>(255 - _palette[i], 0, 255); - while (flashCount--) { - setRGBPalette(_fxPalette, 0, _paletteColorCount); - _vm->_system->updateScreen(); - _vm->_system->delayMillis(20); - setRGBPalette(_palette, 0, _paletteColorCount); - _vm->_system->updateScreen(); - _vm->_system->delayMillis(20); - } + _fx->flash(flashCount, _palette, _paletteColorCount); } void Screen::setFont(int16 fontNum) { @@ -817,5 +801,21 @@ int16 Screen::getTextWidth(int16 fontNum, const char *text) { return _font->getTextWidth(text); } +Graphics::Surface *Screen::lockScreen() { + return _vm->_system->lockScreen(); +} + +void Screen::unlockScreen() { + _vm->_system->unlockScreen(); +} + +void Screen::showWorkScreen() { + _vm->_system->copyRectToScreen((const byte*)_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h); +} + +void Screen::updateScreenAndWait(int delay) { + _vm->_system->updateScreen(); + _vm->_system->delayMillis(delay); +} } // End of namespace Made diff --git a/engines/made/screen.h b/engines/made/screen.h index beacd0dfa5..910096cacd 100644 --- a/engines/made/screen.h +++ b/engines/made/screen.h @@ -33,6 +33,7 @@ #include "graphics/surface.h" #include "made/resource.h" +#include "made/screenfx.h" namespace Made { @@ -41,7 +42,7 @@ struct SpriteChannel { int16 state; int16 needRefresh; uint16 index; - int16 x, y; + int16 x, y, xofs, yofs; int16 x1, y1, x2, y2; uint32 area; uint16 fontNum; @@ -69,8 +70,8 @@ public: void loadRGBPalette(byte *palRGB, int count = 256); void setRGBPalette(byte *palRGB, int start = 0, int count = 256); bool isPaletteLocked() { return _paletteLock; } - void setScreenLock(bool lock) { _screenLock = lock; } void setPaletteLock(bool lock) { _paletteLock = lock; } + void setScreenLock(bool lock) { _screenLock = lock; } void setVisualEffectNum(int visualEffectNum) { _visualEffectNum = visualEffectNum; } void setClipArea(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { @@ -119,6 +120,8 @@ public: uint16 setChannelLocation(uint16 channelIndex, int16 x, int16 y); uint16 setChannelContent(uint16 channelIndex, uint16 index); void setChannelUseMask(uint16 channelIndex); + void setChannelOffsets(uint16 channelIndex, int16 xofs, int16 yofs); + void getChannelOffsets(uint16 channelIndex, int16 &xofs, int16 &yofs); void drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask, int16 excludeStateMask); void updateSprites(); void clearChannels(); @@ -139,14 +142,12 @@ public: uint16 placeAnim(uint16 channelIndex, uint16 animIndex, int16 x, int16 y, int16 frameNum); int16 setAnimFrame(uint16 channelIndex, int16 frameNum); int16 getAnimFrame(uint16 channelIndex); - // TODO: Move to script function - int16 getAnimFrameCount(uint16 animIndex); uint16 placeText(uint16 channelIndex, uint16 textObjectIndex, int16 x, int16 y, uint16 fontNum, int16 textColor, int16 outlineColor); void show(); void flash(int count); - + void setFont(int16 fontNum); void printChar(uint c, int16 x, int16 y, byte color); void printText(const char *text); @@ -154,14 +155,21 @@ public: void printObjectText(int16 objectIndex, int16 x, int16 y, int16 fontNum, int16 textColor, int16 outlineColor, const ClipInfo &clipInfo); int16 getTextWidth(int16 fontNum, const char *text); + // Interface functions for the screen effects class + Graphics::Surface *lockScreen(); + void unlockScreen(); + void showWorkScreen(); + void updateScreenAndWait(int delay); + protected: MadeEngine *_vm; + ScreenEffects *_fx; bool _screenLock; bool _paletteLock; byte _screenPalette[256 * 4]; - byte _palette[768], _newPalette[768], _fxPalette[768]; + byte _palette[768], _newPalette[768]; int _paletteColorCount, _oldPaletteColorCount; bool _paletteInitialized, _needPalette; int16 _textColor; @@ -177,8 +185,8 @@ protected: int16 _clip, _exclude, _ground, _mask; int _visualEffectNum; - Graphics::Surface *_screen1, *_screen2, *_screenMask; - ClipInfo _clipArea, _clipInfo1, _clipInfo2, _maskDrawCtx; + Graphics::Surface *_backgroundScreen, *_workScreen, *_screenMask; + ClipInfo _clipArea, _backgroundScreenDrawCtx, _workScreenDrawCtx, _maskDrawCtx; ClipInfo _excludeClipArea[4]; bool _excludeClipAreaEnabled[4]; diff --git a/engines/made/screenfx.cpp b/engines/made/screenfx.cpp new file mode 100644 index 0000000000..feea365615 --- /dev/null +++ b/engines/made/screenfx.cpp @@ -0,0 +1,254 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "made/made.h" +#include "made/screen.h" +#include "made/screenfx.h" + +namespace Made { + +const byte ScreenEffects::vfxOffsTable[64] = { + 5, 2, 6, 1, 4, 7, 3, 0, + 7, 4, 0, 3, 6, 1, 5, 2, + 2, 5, 1, 6, 3, 0, 4, 7, + 0, 3, 7, 4, 1, 6, 2, 5, + 4, 0, 2, 5, 7, 3, 1, 6, + 1, 6, 4, 0, 2, 5, 7, 3, + 6, 1, 3, 7, 5, 2, 0, 4, + 3, 7, 5, 2, 0, 4, 6, 1 +}; + +const byte ScreenEffects::vfxOffsIndexTable[8] = { + 6, 7, 2, 3, 4, 5, 0, 1 +}; + + +ScreenEffects::ScreenEffects(Screen *screen) : _screen(screen) { + vfxOffsTablePtr = &vfxOffsTable[6 * 8]; + vfxX1 = 0; + vfxY1 = 0; + vfxWidth = 0; + vfxHeight = 0; +} + +void ScreenEffects::run(int16 effectNum, Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { + + // TODO: Put effect functions into an array + // TODO: Implement more visual effects + + switch (effectNum) { + + case 0: + vfx00(surface, palette, newPalette, colorCount); + break; + + case 9: + vfx09(surface, palette, newPalette, colorCount); + break; + + case 14: + vfx14(surface, palette, newPalette, colorCount); + break; + + case 17: + vfx17(surface, palette, newPalette, colorCount); + break; + + default: + vfx00(surface, palette, newPalette, colorCount); + warning("Unimplemented visual effect %d", effectNum); + + } + +} + +void ScreenEffects::flash(int flashCount, byte *palette, int colorCount) { + int palSize = colorCount * 3; + if (flashCount < 1) + flashCount = 1; + for (int i = 0; i < palSize; i++) + _fxPalette[i] = CLIP<byte>(255 - palette[i], 0, 255); + while (flashCount--) { + _screen->setRGBPalette(_fxPalette, 0, colorCount); + _screen->updateScreenAndWait(20); + _screen->setRGBPalette(palette, 0, colorCount); + _screen->updateScreenAndWait(20); + } +} + +void ScreenEffects::setPalette(byte *palette) { + if (!_screen->isPaletteLocked()) { + _screen->setRGBPalette(palette, 0, 256); + } +} + +void ScreenEffects::setBlendedPalette(byte *palette, byte *newPalette, int colorCount, int16 value, int16 maxValue) { + if (!_screen->isPaletteLocked()) { + int32 mulValue = (value * 64) / maxValue; + for (int i = 0; i < colorCount * 3; i++) + _fxPalette[i] = newPalette[i] - (newPalette[i] - palette[i]) * mulValue / 64; + _screen->setRGBPalette(_fxPalette, 0, 256); + } +} + +void ScreenEffects::copyRect(Graphics::Surface *surface, int16 x1, int16 y1, int16 x2, int16 y2) { + + // TODO: Clean up + + byte *src, *dst; + + x1 = CLIP<int16>(x1, 0, 320); + y1 = CLIP<int16>(y1, 0, 200); + x2 = CLIP<int16>(x2, 0, 320); + y2 = CLIP<int16>(y2, 0, 200); + + x2 -= x1; + y2 -= y1; + vfxX1 = x1 & 0x0E; + x1 += 16; + x1 = x1 & 0xFFF0; + x2 += vfxX1; + x2 -= 15; + if (x2 < 0) + x2 = 0; + vfxWidth = x2 & 0x0E; + x2 = x2 & 0xFFF0; + + vfxY1 = y1 & 7; + + byte *source = (byte*)surface->getBasePtr(x1, y1); + + Graphics::Surface *vgaScreen = _screen->lockScreen(); + byte *dest = (byte*)vgaScreen->getBasePtr(x1, y1); + + int16 addX = x2 / 16; + + while (y2-- > 0) { + + int16 addVal = vfxOffsTablePtr[vfxY1] * 2; + int16 w = 0; + vfxY1 = (vfxY1 + 1) & 7; + + src = source + addVal; + dst = dest + addVal; + + if (addVal < vfxX1) { + if (addVal < vfxWidth) + w = 1; + else + w = 0; + } else { + src -= 16; + dst -= 16; + if (addVal < vfxWidth) + w = 2; + else + w = 1; + } + + w += addX; + + while (w-- > 0) { + *dst++ = *src++; + *dst++ = *src++; + src += 14; + dst += 14; + } + + source += 320; + dest += 320; + + } + + vfxHeight = (vfxHeight + 1) & 7; + vfxOffsTablePtr = &vfxOffsTable[vfxOffsIndexTable[vfxHeight] * 8]; + + _screen->unlockScreen(); + +} + +void ScreenEffects::vfx00(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { + setPalette(palette); + _screen->showWorkScreen(); +} + +void ScreenEffects::vfx09(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { + for (int i = 0; i < 8; i++) { + copyRect(surface, 0, 0, 320, 200); + for (int j = 0; j < 4; j++) { + setBlendedPalette(palette, newPalette, colorCount, i * 4 + j, 32); + _screen->updateScreenAndWait(25); + } + } + setPalette(palette); +} + +void ScreenEffects::vfx14(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { + int16 x = 8, y = 5; + for (int i = 0; i < 27; i++) { + copyRect(surface, 160 - x, 100 - y, 160 + x, 100 + y); + x += 8; + y += 5; + setBlendedPalette(palette, newPalette, colorCount, i, 27); + _screen->updateScreenAndWait(25); + } + setPalette(palette); +} + +void ScreenEffects::vfx17(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { + + byte tempPalette[768]; + + bool savedPaletteLock = _screen->isPaletteLocked(); + _screen->setPaletteLock(false); + + memcpy(tempPalette, palette, 768); + + // Fade out to black + memset(palette, 0, 768); + for (int i = 0; i < 50; i++) { + setBlendedPalette(palette, newPalette, colorCount, i, 50); + _screen->updateScreenAndWait(25); + } + _screen->setRGBPalette(palette, 0, colorCount); + + memcpy(palette, tempPalette, 768); + + _screen->showWorkScreen(); + + // Fade from black to palette + memset(newPalette, 0, 768); + for (int i = 0; i < 50; i++) { + setBlendedPalette(palette, newPalette, colorCount, i, 50); + _screen->updateScreenAndWait(25); + } + _screen->setRGBPalette(palette, 0, colorCount); + + _screen->setPaletteLock(savedPaletteLock); + +} + + +} // End of namespace Made diff --git a/engines/made/screenfx.h b/engines/made/screenfx.h new file mode 100644 index 0000000000..e1f877b42e --- /dev/null +++ b/engines/made/screenfx.h @@ -0,0 +1,63 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#ifndef MADE_SCREENFX_H +#define MADE_SCREENFX_H + +#include "common/endian.h" +#include "common/util.h" +#include "common/rect.h" + +#include "graphics/surface.h" + +#include "made/made.h" +#include "made/screen.h" + +namespace Made { + +class ScreenEffects { +public: + ScreenEffects(Screen *screen); + void run(int16 effectNum, Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount); + void flash(int count, byte *palette, int colorCount); +private: + Screen *_screen; + byte _fxPalette[768]; + static const byte vfxOffsTable[64]; + static const byte vfxOffsIndexTable[8]; + const byte *vfxOffsTablePtr; + int16 vfxX1, vfxY1, vfxWidth, vfxHeight; + void setPalette(byte *palette); + void setBlendedPalette(byte *palette, byte *newPalette, int colorCount, int16 value, int16 maxValue); + void copyRect(Graphics::Surface *surface, int16 x1, int16 y1, int16 x2, int16 y2); + void vfx00(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount); + void vfx09(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount); + void vfx14(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount); + void vfx17(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount); +}; + +} // End of namespace Made + +#endif /* MADE_H */ diff --git a/engines/made/scriptfuncs_rtz.cpp b/engines/made/scriptfuncs_rtz.cpp index c11edb93a2..3536dc3c76 100644 --- a/engines/made/scriptfuncs_rtz.cpp +++ b/engines/made/scriptfuncs_rtz.cpp @@ -687,7 +687,13 @@ int16 ScriptFunctionsRtz::o1_GETFRAME(int16 argc, int16 *argv) { } int16 ScriptFunctionsRtz::o1_GETFRAMECOUNT(int16 argc, int16 *argv) { - return _vm->_screen->getAnimFrameCount(argv[0]); + int16 frameCount = 0; + AnimationResource *anim = _vm->_res->getAnimation(argv[0]); + if (anim) { + frameCount = anim->getCount(); + _vm->_res->freeResource(anim); + } + return frameCount; } int16 ScriptFunctionsRtz::o1_PICWIDTH(int16 argc, int16 *argv) { |