diff options
author | uruk | 2014-02-19 17:55:32 +0100 |
---|---|---|
committer | uruk | 2014-02-19 17:55:32 +0100 |
commit | c498e910eb19bcc78fbd35dbf743a09e9a2e0ddb (patch) | |
tree | aa7c51724e22d9098ad67859cd137ce2072ed859 /engines | |
parent | a3eea23624df66a277802bc1bf828dbf773c5da1 (diff) | |
download | scummvm-rg350-c498e910eb19bcc78fbd35dbf743a09e9a2e0ddb.tar.gz scummvm-rg350-c498e910eb19bcc78fbd35dbf743a09e9a2e0ddb.tar.bz2 scummvm-rg350-c498e910eb19bcc78fbd35dbf743a09e9a2e0ddb.zip |
AVALANCHE: Implement ShootEmUp::plotThem() and connected functions.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/avalanche/graphics.cpp | 25 | ||||
-rw-r--r-- | engines/avalanche/graphics.h | 1 | ||||
-rw-r--r-- | engines/avalanche/shootemup.cpp | 31 | ||||
-rw-r--r-- | engines/avalanche/shootemup.h | 2 |
4 files changed, 58 insertions, 1 deletions
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index cde0f5de9a..3b4413ab76 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -755,6 +755,31 @@ void GraphicManager::seuDrawPicture(int x, int y, byte which) { } /** + * @remarks Originally called 'cameo_display' + */ +void GraphicManager::seuDrawCameo(int destX, int destY, byte w1, byte w2) { + // First we make the pixels of the previous sprite (cameo) blank: + uint16 maxX = _seuPictures[w2].w; + uint16 maxY = _seuPictures[w2].h; + + if (destX + maxX > _surface.w) + maxX = _surface.w - destX; + + if (destY + maxY > _surface.h) + maxY = _surface.h - destY; + + for (uint16 y = 0; y < maxY; y++) { + for (uint16 x = 0; x < maxX; x++) { + if (*(const byte *)_seuPictures[w2].getBasePtr(x, y) != 0) + *(byte *)_surface.getBasePtr(x + destX, y + destY) = 0; + } + } + + // Then we draw the desired sprite: + drawPicture(_surface, _seuPictures[w1], destX, destY); +} + +/** * This function is for skipping the difference between a stored 'size' value associated with a picture * and the actual size of the pictures when reading them from files for Ghostroom and Shoot em' up. * It's needed bacuse the original code loaded the pictures to arrays first and only used the useful parts diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 1da875b330..553f993188 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -115,6 +115,7 @@ public: void seuLoad(); void seuFree(); void seuDrawPicture(int x, int y, byte which); + void seuDrawCameo(int destX, int destY, byte w1, byte w2); void clearAlso(); void clearTextBar(); diff --git a/engines/avalanche/shootemup.cpp b/engines/avalanche/shootemup.cpp index 07a40a0c72..d7832a07be 100644 --- a/engines/avalanche/shootemup.cpp +++ b/engines/avalanche/shootemup.cpp @@ -81,6 +81,7 @@ ShootEmUp::ShootEmUp(AvalancheEngine *vm) { _escapeCount = 0; _escaping = false; _timeThisSecond = 0; + _cp = false; } void ShootEmUp::run() { @@ -120,6 +121,8 @@ void ShootEmUp::run() { check321(); readKbd(); + _cp = !_cp; + _vm->_graphics->refreshScreen(); } while (_time != 0); @@ -150,8 +153,32 @@ void ShootEmUp::moveThem() { warning("STUB: ShootEmUp::moveThem()"); } +void ShootEmUp::blank(Common::Rect rect) { + _rectangles[_rectNum++] = rect; +} + void ShootEmUp::plotThem() { - warning("STUB: ShootEmUp::plotThem()"); + for (int i = 0; i < 99; i++) { + if (_sprites[i]._x != kFlag) { + if (_sprites[i]._cameo) { + _vm->_graphics->seuDrawCameo(_sprites[i]._x, _sprites[i]._y, _sprites[i]._p, _sprites[i]._cameoFrame); + if (!_cp) { + _sprites[i]._cameoFrame += 2; + _sprites[i]._p += 2; + } + } else + _vm->_graphics->seuDrawPicture(_sprites[i]._x, _sprites[i]._y, _sprites[i]._p); + + if (_sprites[i]._wipe) + blank(Common::Rect(_sprites[i]._x, _sprites[i]._y, _sprites[i]._x + _rectangles[i].width(), _sprites[i]._y + _rectangles[i].height())); + + if (_sprites[i]._timeout > 0) { + _sprites[i]._timeout--; + if (_sprites[i]._timeout == 0) + _sprites[i]._y = kFlag; + } + } + } } void ShootEmUp::define(int16 x, int16 y, byte p, int8 ix, int8 iy, int16 time, bool isAMissile, bool doWeWipe) { @@ -276,6 +303,8 @@ void ShootEmUp::setup() { showStock(i); } + _cp = true; + _avvyWas = 320; _avvyPos = 320; _avvyAnim = 1; diff --git a/engines/avalanche/shootemup.h b/engines/avalanche/shootemup.h index 62d55804d7..6dfa3baa1b 100644 --- a/engines/avalanche/shootemup.h +++ b/engines/avalanche/shootemup.h @@ -86,11 +86,13 @@ private: uint16 _escapeCount; bool _escaping; byte _timeThisSecond; + bool _cp; bool overlap(uint16 a1x, uint16 a1y, uint16 a2x, uint16 a2y, uint16 b1x, uint16 b1y, uint16 b2x, uint16 b2y); byte getStockNumber(byte x); void blankIt(); void moveThem(); + void blank(Common::Rect rect); void plotThem(); void define(int16 x, int16 y, byte p, int8 ix, int8 iy, int16 time, bool isAMissile, bool doWeWipe); void defineCameo(int16 xx, int16 yy, byte pp, int16 time); |