Skip to content

Commit

Permalink
AVALANCHE: Implement ShootEmUp::animate() and connected functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
uruk committed Feb 20, 2014
1 parent 37b147d commit e03ccde
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
36 changes: 30 additions & 6 deletions engines/avalanche/shootemup.cpp
Expand Up @@ -87,6 +87,7 @@ ShootEmUp::ShootEmUp(AvalancheEngine *vm) {
_cp = false;
_wasFacing = 0;
_score = 0;
_escapeStock = 0;
}

void ShootEmUp::run() {
Expand Down Expand Up @@ -143,9 +144,13 @@ bool ShootEmUp::overlap(uint16 a1x, uint16 a1y, uint16 a2x, uint16 a2y, uint16 b
return (a2x >= b1x) && (b2x >= a1x) && (a2y >= b1y) && (b2y >= a1y);
}

byte ShootEmUp::getStockNumber(byte x) {
warning("STUB: ShootEmUp::getStockNumber()");
return 0;
byte ShootEmUp::getStockNumber(byte index) {
while (_hasEscaped[index]) {
index++;
if (index == 7)
index = 0;
}
return index;
}

void ShootEmUp::blankIt() {
Expand Down Expand Up @@ -211,8 +216,17 @@ void ShootEmUp::defineCameo(int16 xx, int16 yy, byte pp, int16 time) {
warning("STUB: ShootEmUp::defineCameo()");
}

void ShootEmUp::showStock(byte x) {
warning("STUB: ShootEmUp::showStock()");
void ShootEmUp::showStock(byte index) {
if (_escaping && (index == _escapeStock)) {
_vm->_graphics->seuDrawPicture(index * 90 + 20, 30, kStocks + 2);
return;
}

if (_stockStatus[index] > 5)
return;

_vm->_graphics->seuDrawPicture(index * 90 + 20, 30, kStocks + _stockStatus[index]);
_stockStatus[index] = 1 - _stockStatus[index];
}

void ShootEmUp::drawNumber(int number, int size, int x) {
Expand Down Expand Up @@ -404,7 +418,17 @@ void ShootEmUp::readKbd() {
}

void ShootEmUp::animate() {
warning("STUB: ShootEmUp::animate()");
if (_vm->_rnd->getRandomNumber(9) == 1)
showStock(getStockNumber(_vm->_rnd->getRandomNumber(5)));
for (int i = 0; i < 7; i++) {
if (_stockStatus[i] > 5) {
_stockStatus[i]--;
if (_stockStatus[i] == 8) {
_stockStatus[i] = 0;
showStock(i);
}
}
}
}

void ShootEmUp::collisionCheck() {
Expand Down
5 changes: 3 additions & 2 deletions engines/avalanche/shootemup.h
Expand Up @@ -91,16 +91,17 @@ class ShootEmUp {
byte _timeThisSecond;
bool _cp;
byte _wasFacing;
byte _escapeStock;

bool overlap(uint16 a1x, uint16 a1y, uint16 a2x, uint16 a2y, uint16 b1x, uint16 b1y, uint16 b2x, uint16 b2y);
byte getStockNumber(byte x);
byte getStockNumber(byte index);
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);
void showStock(byte x);
void showStock(byte index);
void drawNumber(int number, int size, int x);
void showScore();
void showTime();
Expand Down

0 comments on commit e03ccde

Please sign in to comment.