aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2014-02-20 15:02:22 +0100
committeruruk2014-02-20 15:02:22 +0100
commite03ccde6e9d13a56ca1b8e1264df1f936a234f40 (patch)
tree27b06ec466c6aa0be1eb12d028a751f13626d337
parent37b147d9503b0614983d7072be60c2708ade0800 (diff)
downloadscummvm-rg350-e03ccde6e9d13a56ca1b8e1264df1f936a234f40.tar.gz
scummvm-rg350-e03ccde6e9d13a56ca1b8e1264df1f936a234f40.tar.bz2
scummvm-rg350-e03ccde6e9d13a56ca1b8e1264df1f936a234f40.zip
AVALANCHE: Implement ShootEmUp::animate() and connected functions.
-rw-r--r--engines/avalanche/shootemup.cpp36
-rw-r--r--engines/avalanche/shootemup.h5
2 files changed, 33 insertions, 8 deletions
diff --git a/engines/avalanche/shootemup.cpp b/engines/avalanche/shootemup.cpp
index 2e689b870d..70b26d267f 100644
--- a/engines/avalanche/shootemup.cpp
+++ b/engines/avalanche/shootemup.cpp
@@ -87,6 +87,7 @@ ShootEmUp::ShootEmUp(AvalancheEngine *vm) {
_cp = false;
_wasFacing = 0;
_score = 0;
+ _escapeStock = 0;
}
void ShootEmUp::run() {
@@ -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() {
@@ -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) {
@@ -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() {
diff --git a/engines/avalanche/shootemup.h b/engines/avalanche/shootemup.h
index b3561aceae..9162282e65 100644
--- a/engines/avalanche/shootemup.h
+++ b/engines/avalanche/shootemup.h
@@ -91,16 +91,17 @@ private:
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();