AVALANCHE: Implement ShootEmUp::plotThem() and connected functions.

This commit is contained in:
uruk 2014-02-19 17:55:32 +01:00
parent a3eea23624
commit c498e910eb
4 changed files with 58 additions and 1 deletions

View file

@ -754,6 +754,31 @@ void GraphicManager::seuDrawPicture(int x, int y, byte which) {
drawPicture(_surface, _seuPictures[which], x, y);
}
/**
* @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.

View file

@ -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();

View file

@ -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;

View file

@ -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);