diff options
author | Nicola Mettifogo | 2007-12-15 20:56:05 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-12-15 20:56:05 +0000 |
commit | d632206248f2910afe6a9628d82c08e5b180fd6b (patch) | |
tree | a3d9aeead84f51a94494253c87148a2d1c4ce99e /engines/parallaction | |
parent | 3dd11b260b49aa524897eaff1c7eeca1b20886cb (diff) | |
download | scummvm-rg350-d632206248f2910afe6a9628d82c08e5b180fd6b.tar.gz scummvm-rg350-d632206248f2910afe6a9628d82c08e5b180fd6b.tar.bz2 scummvm-rg350-d632206248f2910afe6a9628d82c08e5b180fd6b.zip |
Added halfbrite effect to Nippon Safes Amiga. Implementation is not complete, since the spotlight during Donna's dance is not moving yet.
svn-id: r29863
Diffstat (limited to 'engines/parallaction')
-rw-r--r-- | engines/parallaction/callables_ns.cpp | 44 | ||||
-rw-r--r-- | engines/parallaction/graphics.cpp | 73 | ||||
-rw-r--r-- | engines/parallaction/graphics.h | 5 |
3 files changed, 83 insertions, 39 deletions
diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp index 9de1dbb14b..f4ef310b09 100644 --- a/engines/parallaction/callables_ns.cpp +++ b/engines/parallaction/callables_ns.cpp @@ -620,21 +620,17 @@ void Parallaction_ns::_c_shade(void *parm) { } void Parallaction_ns::_c_projector(void*) { -#ifdef HALFBRITE static int dword_16032 = 0; -// Bitmap bm; -// InitBitMap(&bm); - - if (dword_16032 != 0) { -/* // keep drawing spotlight in its final place - _gfx->flatBlitCnv(&scnv, 110, 25, Gfx::kBitFront); - BltBitMap(&bm, 0, 0, &_screen._bitMap, 110, 25, a3->??, a3->??, 0x20, 0x20); -*/ return; - } + _gfx->setHalfbriteMode(true); - _gfx->setHalfbriteMode(true); -/* +// if (dword_16032 != 0) { + // keep drawing spotlight in its final place + _gfx->setProjectorPos(110, 25); + printf("FIXED: %i, %i\n", 110, 25); + return; +// } +#ifdef HALFBRITE // move spot light around the stage int d7, d6; for (d7 = 0; d7 < 150; d7++) { @@ -647,7 +643,7 @@ void Parallaction_ns::_c_projector(void*) { d1 >>= 1; d6 = 50 - d1; } else { - int d1 = d7 / 100; + int d1 = d7 % 100; if (d1 < 0) d1++; @@ -655,36 +651,28 @@ void Parallaction_ns::_c_projector(void*) { d6 = d1; } - BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+20, d6, a3->??, a3->??, 0x20, 0x20); - sub_1590C(d6 + a3->??); - BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+20, d6, a3->??, a3->??, 0xFA, 0x20); + printf("%i, %i, ", d7+20, d6); +// BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+20, d6, a3->??, a3->??, 0x20, 0x20); } for (d7 = 50; d7 > -10; d7--) { - BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+120, d6, a3->??, a3->??, 0x20, 0x20); - sub_1590C(d6 + a3->??); - BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+120, d6, a3->??, a3->??, 0xFA, 0x20); + printf("%i, %i, ", d7+120, d6); +// BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+120, d6, a3->??, a3->??, 0x20, 0x20); } - BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+120, d6, a3->??, a3->??, 0x20, 0x20); - _gfx->flatBlitCnv(&scnv, d7+120, d6, Gfx::kBitFront); -*/ - + printf("%i, %i\n", d7+120, d6); +// BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+120, d6, a3->??, a3->??, 0x20, 0x20); +#endif dword_16032 = 1; return; -#endif } void Parallaction_ns::_c_HBOff(void*) { -#ifdef HALFBRITE _gfx->setHalfbriteMode(false); -#endif } void Parallaction_ns::_c_HBOn(void*) { -#ifdef HALFBRITE _gfx->setHalfbriteMode(true); -#endif } diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 41f818a8a8..5b1c292ead 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -25,6 +25,7 @@ #include "common/system.h" #include "common/file.h" +#include "graphics/primitives.h" #include "parallaction/parallaction.h" @@ -32,6 +33,40 @@ namespace Parallaction { +void halfbritePixel(int x, int y, int color, void *data) { + byte *buffer = (byte*)data; + buffer[x + y * _vm->_screenWidth] &= ~0x20; +} + +void drawCircleLine(int xCenter, int yCenter, int x, int y, int color, void (*plotProc)(int, int, int, void *), void *data){ + Graphics::drawLine(xCenter + x, yCenter + y, xCenter - x, yCenter + y, color, plotProc, data); + Graphics::drawLine(xCenter + x, yCenter - y, xCenter - x, yCenter - y, color, plotProc, data); + Graphics::drawLine(xCenter + y, yCenter + x, xCenter - y, yCenter + x, color, plotProc, data); + Graphics::drawLine(xCenter + y, yCenter - x, xCenter - y, yCenter - x, color, plotProc, data); +} + +void drawCircle(int xCenter, int yCenter, int radius, int color, void (*plotProc)(int, int, int, void *), void *data) { + int x = 0; + int y = radius; + int p = 1 - radius; + + /* Plot first set of points */ + drawCircleLine(xCenter, yCenter, x, y, color, plotProc, data); + + while (x < y) { + x++; + if (p < 0) + p += 2*x + 1; + else { + y--; + p += 2 * (x-y) + 1; + } + drawCircleLine(xCenter, yCenter, x, y, color, plotProc, data); + } +} + + + Palette::Palette() { @@ -110,7 +145,7 @@ void Palette::fadeTo(const Palette& target, uint step) { uint Palette::fillRGBA(byte *rgba) { byte r, g, b; - byte *hbPal = rgba + _size; + byte *hbPal = rgba + _colors * 4; for (uint32 i = 0; i < _colors; i++) { r = (_data[i*3] << 2) | (_data[i*3] >> 4); @@ -269,22 +304,24 @@ void Gfx::animatePalette() { void Gfx::setHalfbriteMode(bool enable) { -#ifdef HALFBRITE if (_vm->getPlatform() != Common::kPlatformAmiga) return; if (enable == _halfbrite) return; - byte *buf = _buffers[kBitBack]; - for (uint32 i = 0; i < SCREEN_SIZE; i++) - *buf++ ^= 0x20; + _halfbrite = !_halfbrite; - buf = _buffers[kBitFront]; - for (uint32 i = 0; i < SCREEN_SIZE; i++) - *buf++ ^= 0x20; + if (!enable) { + _hbCircleRadius = 0; + } +} - _halfbrite = !_halfbrite; -#endif +#define HALFBRITE_CIRCLE_RADIUS 48 +void Gfx::setProjectorPos(int x, int y) { + _hbCircleRadius = HALFBRITE_CIRCLE_RADIUS; + _hbCirclePos.x = x + _hbCircleRadius; + _hbCirclePos.y = y + _hbCircleRadius; } + void Gfx::drawInventory() { if ((_engineFlags & kEngineInventory) == 0) { @@ -325,7 +362,20 @@ void Gfx::drawBalloons() { } void Gfx::updateScreen() { - g_system->copyRectToScreen((const byte*)_buffers[kBitFront]->pixels, _buffers[kBitFront]->pitch, _screenX, _screenY, _vm->_screenWidth, _vm->_screenHeight); + if (_halfbrite) { + Graphics::Surface *surf = g_system->lockScreen(); + byte *src = (byte*)_buffers[kBitFront]->pixels; + byte *dst = (byte*)surf->pixels; + for (int i = 0; i < surf->w*surf->h; i++) { + *dst++ = *src++ | 0x20; + } + if (_hbCircleRadius > 0) { + drawCircle(_hbCirclePos.x, _hbCirclePos.y, _hbCircleRadius, 0, &halfbritePixel, surf->pixels); + } + g_system->unlockScreen(); + } else { + g_system->copyRectToScreen((const byte*)_buffers[kBitFront]->pixels, _buffers[kBitFront]->pitch, _screenX, _screenY, _vm->_screenWidth, _vm->_screenHeight); + } drawInventory(); @@ -854,6 +904,7 @@ Gfx::Gfx(Parallaction* vm) : memset(_palettefx, 0, sizeof(_palettefx)); _halfbrite = false; + _hbCircleRadius = 0; _font = NULL; diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index 7eacff4f5d..a165a08fab 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -283,6 +283,7 @@ public: // amiga specific void setHalfbriteMode(bool enable); + void setProjectorPos(int x, int y); // misc int16 queryMask(int16 v); @@ -315,6 +316,10 @@ protected: Font *_font; bool _halfbrite; + Common::Point _hbCirclePos; + int _hbCircleRadius; + + protected: struct Balloon { uint16 x; |