aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authoruruk2014-02-18 14:55:54 +0100
committeruruk2014-02-18 14:55:54 +0100
commit1b5cf54cedeb4fdac2849a57dfd6185d3bd0ade7 (patch)
tree38b0f597de5ec80f5322317abef70f28bbaa02ab /engines
parent3b313bfc83f922c5ed92503f0de99cec0bcb6f12 (diff)
downloadscummvm-rg350-1b5cf54cedeb4fdac2849a57dfd6185d3bd0ade7.tar.gz
scummvm-rg350-1b5cf54cedeb4fdac2849a57dfd6185d3bd0ade7.tar.bz2
scummvm-rg350-1b5cf54cedeb4fdac2849a57dfd6185d3bd0ade7.zip
AVALANCHE: Implement ShootEmUp::hitPeople() and connected functions.
Diffstat (limited to 'engines')
-rw-r--r--engines/avalanche/shootemup.cpp50
-rw-r--r--engines/avalanche/shootemup.h2
2 files changed, 45 insertions, 7 deletions
diff --git a/engines/avalanche/shootemup.cpp b/engines/avalanche/shootemup.cpp
index 530e65d883..4a4c10c17e 100644
--- a/engines/avalanche/shootemup.cpp
+++ b/engines/avalanche/shootemup.cpp
@@ -118,6 +118,8 @@ void ShootEmUp::run() {
updateTime();
check321();
readKbd();
+
+ _vm->_graphics->refreshScreen();
} while (_time != 0);
_vm->fadeOut();
@@ -128,8 +130,8 @@ void ShootEmUp::run() {
}
bool ShootEmUp::overlap(uint16 a1x, uint16 a1y, uint16 a2x, uint16 a2y, uint16 b1x, uint16 b1y, uint16 b2x, uint16 b2y) {
- warning("STUB: ShootEmUp::overlap()");
- return false;
+ // By De Morgan's law:
+ return (a2x >= b1x) && (b2x >= a1x) && (a2y >= b1y) && (b2y >= a1y);
}
byte ShootEmUp::getStockNumber(byte x) {
@@ -151,8 +153,20 @@ void ShootEmUp::plotThem() {
warning("STUB: ShootEmUp::plotThem()");
}
-void ShootEmUp::define(int16 xx, int16 yy, byte pp, int8 ixx, int8 iyy, int16 time, bool isAMissile, bool doWeWipe) {
- warning("STUB: ShootEmUp::define()");
+void ShootEmUp::define(int16 x, int16 y, byte p, int8 ix, int8 iy, int16 time, bool isAMissile, bool doWeWipe) {
+ for (int i = 0; i < 99; i++) {
+ if (_sprites[i]._x == kFlag) {
+ _sprites[i]._x = x;
+ _sprites[i]._y = y;
+ _sprites[i]._p = p;
+ _sprites[i]._ix = ix;
+ _sprites[i]._iy = iy;
+ _sprites[i]._timeout = time;
+ _sprites[i]._cameo = false;
+ _sprites[i]._missile = isAMissile;
+ _sprites[i]._wipe = doWeWipe;
+ }
+ }
}
void ShootEmUp::defineCameo(int16 xx, int16 yy, byte pp, int16 time) {
@@ -184,7 +198,12 @@ void ShootEmUp::showTime() {
}
void ShootEmUp::gain(int8 howMuch) {
- warning("STUB: ShootEmUp::gain()");
+ if ((_score + howMuch) == 0) // howMuch can be negative!
+ _score = 0;
+ else
+ _score += howMuch;
+
+ showScore();
}
void ShootEmUp::newEscape() {
@@ -326,7 +345,26 @@ void ShootEmUp::updateTime() {
}
void ShootEmUp::hitPeople() {
- warning("STUB: ShootEmUp::hitPeople()");
+ if (_count321 != 0)
+ return;
+
+ for (int i = 0; i < 99; i++) {
+ if ((_sprites[i]._missile) && (_sprites[i]._x != kFlag)) {
+ for (int j = 0; j < 4; j++) {
+
+ bool overlaps = overlap(_sprites[i]._x, _sprites[i]._y, _sprites[i]._x + 7, _sprites[i]._y + 10,
+ _running[j]._x, _running[j]._y, _running[j]._x + 17, _running[j]._y + 24);
+
+ if ((_running[j]._x != kFlag) && (overlaps)) {
+ _vm->_sound->playNote(7177, 1);
+ _sprites[i]._x = kFlag;
+ gain(-5);
+ define(_running[j]._x + 20, _running[j]._y + 3, 34 + _vm->_rnd->getRandomNumber(5), 1, 3, 9, false, true); // Oof!
+ define(_sprites[i]._x, _sprites[i]._y, 83, 1, 0, 17, false, true); // Oops!
+ }
+ }
+ }
+ }
}
void ShootEmUp::escapeCheck() {
diff --git a/engines/avalanche/shootemup.h b/engines/avalanche/shootemup.h
index 383a712c93..38f18b0d1c 100644
--- a/engines/avalanche/shootemup.h
+++ b/engines/avalanche/shootemup.h
@@ -91,7 +91,7 @@ private:
void blankIt();
void moveThem();
void plotThem();
- void define(int16 xx, int16 yy, byte pp, int8 ixx, int8 iyy, int16 time, bool isAMissile, bool doWeWipe);
+ 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 drawNumber(int number, int size, int x);