[Scummvm-cvs-logs] scummvm master -> 808a59bdf26ce1bac620c9d6e9a67b815d22696a

urukgit urukgit at users.noreply.github.com
Thu Feb 20 15:59:59 CET 2014


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e03ccde6e9 AVALANCHE: Implement ShootEmUp::animate() and connected functions.
ad9a8df66d AVALANCHE: Implement ShootEmUp::escapeCheck().
808a59bdf2 AVALANCHE: Implement ShootEmUp::collisionCheck().


Commit: e03ccde6e9d13a56ca1b8e1264df1f936a234f40
    https://github.com/scummvm/scummvm/commit/e03ccde6e9d13a56ca1b8e1264df1f936a234f40
Author: uruk (koppirnyo at gmail.com)
Date: 2014-02-20T06:02:22-08:00

Commit Message:
AVALANCHE: Implement ShootEmUp::animate() and connected functions.

Changed paths:
    engines/avalanche/shootemup.cpp
    engines/avalanche/shootemup.h



diff --git a/engines/avalanche/shootemup.cpp b/engines/avalanche/shootemup.cpp
index 2e689b8..70b26d2 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 b3561ac..9162282 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();


Commit: ad9a8df66dafd2a44a3a9e3869b1ec6948a5dabf
    https://github.com/scummvm/scummvm/commit/ad9a8df66dafd2a44a3a9e3869b1ec6948a5dabf
Author: uruk (koppirnyo at gmail.com)
Date: 2014-02-20T06:28:46-08:00

Commit Message:
AVALANCHE: Implement ShootEmUp::escapeCheck().

Changed paths:
    engines/avalanche/shootemup.cpp
    engines/avalanche/shootemup.h



diff --git a/engines/avalanche/shootemup.cpp b/engines/avalanche/shootemup.cpp
index 70b26d2..4224b7f 100644
--- a/engines/avalanche/shootemup.cpp
+++ b/engines/avalanche/shootemup.cpp
@@ -88,6 +88,7 @@ ShootEmUp::ShootEmUp(AvalancheEngine *vm) {
 	_wasFacing = 0;
 	_score = 0;
 	_escapeStock = 0;
+	_gotOut = false;
 }
 
 void ShootEmUp::run() {
@@ -524,7 +525,41 @@ void ShootEmUp::hitPeople() {
 }
 
 void ShootEmUp::escapeCheck() {
-	warning("STUB: ShootEmUp::escapeCheck()");
+	if (_count321 != 0)
+		return;
+
+	if (_escapeCount > 0) {
+		_escapeCount--;
+		return;
+	}
+
+	// Escape_count = 0; now what ?
+
+	if (_escaping) {
+		if (_gotOut) {
+			newEscape();
+			_escaping = false;
+			_vm->_graphics->seuDrawPicture(_escapeStock * 90 + 20, 30, kStocks + 4);
+		} else {
+			_vm->_graphics->seuDrawPicture(_escapeStock * 90 + 20, 30, kStocks + 5);
+			_escapeCount = 20;
+			_gotOut = true;
+			define(_escapeStock * 90 + 20, 50, 25, 0, 2, 17, false, true); // Escaped!
+			gain(-10);
+			_hasEscaped[_escapeStock] = true;
+
+			_howManyHaveEscaped++;
+
+			if (_howManyHaveEscaped == 7)
+				_time = 0;
+		}
+	} else {
+		_escapeStock = getStockNumber(_vm->_rnd->getRandomNumber(6));
+		_escaping = true;
+		_gotOut = false;
+		_vm->_graphics->seuDrawPicture(_escapeStock * 90 + 20, 30, kStocks + 2); // Smiling!
+		_escapeCount = 200;
+	}
 }
 
 void ShootEmUp::check321() {
diff --git a/engines/avalanche/shootemup.h b/engines/avalanche/shootemup.h
index 9162282..9e9747b 100644
--- a/engines/avalanche/shootemup.h
+++ b/engines/avalanche/shootemup.h
@@ -92,6 +92,7 @@ private:
 	bool _cp;
 	byte _wasFacing;
 	byte _escapeStock;
+	bool _gotOut;
 
 	bool overlap(uint16 a1x, uint16 a1y, uint16 a2x, uint16 a2y, uint16 b1x, uint16 b1y, uint16 b2x, uint16 b2y);
 	byte getStockNumber(byte index);


Commit: 808a59bdf26ce1bac620c9d6e9a67b815d22696a
    https://github.com/scummvm/scummvm/commit/808a59bdf26ce1bac620c9d6e9a67b815d22696a
Author: uruk (koppirnyo at gmail.com)
Date: 2014-02-20T06:59:14-08:00

Commit Message:
AVALANCHE: Implement ShootEmUp::collisionCheck().

Changed paths:
    engines/avalanche/shootemup.cpp



diff --git a/engines/avalanche/shootemup.cpp b/engines/avalanche/shootemup.cpp
index 4224b7f..00e74cc 100644
--- a/engines/avalanche/shootemup.cpp
+++ b/engines/avalanche/shootemup.cpp
@@ -433,7 +433,41 @@ void ShootEmUp::animate() {
 }
 
 void ShootEmUp::collisionCheck() {
-	warning("STUB: ShootEmUp::collisionCheck()");
+	for (int i = 0; i < 99; i++) {
+		if ((_sprites[i]._x != kFlag) && (_sprites[i]._missile) &&
+			(_sprites[i]._y < 60) && (_sprites[i]._timeout == 1)) {
+			int distFromSide = (_sprites[i]._x - 20) % 90;
+			int thisStock = (_sprites[i]._x - 20) / 90;
+			if ((!_hasEscaped[thisStock]) && (distFromSide > 17) && (distFromSide < 34)) {
+				_vm->_sound->playNote(999, 3);
+				_vm->_system->delayMillis(3);
+				define(_sprites[i]._x + 20, _sprites[i]._y, 26 + _vm->_rnd->getRandomNumber(1), 3, 1, 12, false, true); // Well done!
+				define(thisStock * 90 + 20, 30, 31, 0, 0, 7, false, false); // Face of man
+				defineCameo(thisStock * 90 + 20 + 10, 35, 40, 7); // Splat!
+				define(thisStock * 90 + 20 + 20, 50, 34 + _vm->_rnd->getRandomNumber(4), 0, 2, 9, false, true); // Oof!
+				_stockStatus[thisStock] = 17;
+				gain(3); // Score for hitting a face.
+
+				if (_escaping && (_escapeStock = thisStock)) { // Hit the escaper.
+					_vm->_sound->playNote(1777, 1);
+					_vm->_system->delayMillis(1);
+					gain(5); // Bonus for hitting escaper.
+					_escaping = false;
+					newEscape();
+				}
+			} else {
+				define(_sprites[i]._x, _sprites[i]._y, 83 + _vm->_rnd->getRandomNumber(2), 2, 2, 17, false, true); // Missed!
+				if ((!_hasEscaped[thisStock]) && (distFromSide > 3) && (distFromSide < 43)) {
+					define(thisStock * 90 + 20, 30, 30, 0, 0, 7, false, false); // Face of man
+					if (distFromSide > 35)
+						defineCameo(_sprites[i]._x - 27, 35, 40, 7); // Splat!
+					else
+						defineCameo(_sprites[i]._x - 7, 35, 40, 7);
+					_stockStatus[thisStock] = 17;
+				}
+			}
+		}
+	}
 }
 
 void ShootEmUp::turnAround(byte who, bool randomX) {






More information about the Scummvm-git-logs mailing list