aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2014-02-19 18:45:08 +0100
committeruruk2014-02-19 18:45:08 +0100
commit5c841dab6dd03754e37b3c7a0849a865f850179b (patch)
tree0d18e7fd96ea2357c5b5cc76c6dc8c4d96cdab87
parent546a3cea826fca2e33f7472dd080d21d0e2ab54c (diff)
downloadscummvm-rg350-5c841dab6dd03754e37b3c7a0849a865f850179b.tar.gz
scummvm-rg350-5c841dab6dd03754e37b3c7a0849a865f850179b.tar.bz2
scummvm-rg350-5c841dab6dd03754e37b3c7a0849a865f850179b.zip
AVALANCHE: Implement ShootEmUp::moveAvvy().
-rw-r--r--engines/avalanche/shootemup.cpp35
-rw-r--r--engines/avalanche/shootemup.h4
2 files changed, 38 insertions, 1 deletions
diff --git a/engines/avalanche/shootemup.cpp b/engines/avalanche/shootemup.cpp
index 52dd1d4676..fde6fc3ff5 100644
--- a/engines/avalanche/shootemup.cpp
+++ b/engines/avalanche/shootemup.cpp
@@ -33,10 +33,13 @@
namespace Avalanche {
const byte ShootEmUp::kStocks = 27;
+const byte ShootEmUp::kAvvyShoots = 86;
const byte ShootEmUp::kFacingRight = 87;
const byte ShootEmUp::kFacingLeft = 93;
const long int ShootEmUp::kFlag = -20047;
const byte ShootEmUp::kFrameDelayMax = 2;
+const byte ShootEmUp::kAvvyY = 150;
+const byte ShootEmUp::kShooting[7] = { 87, 80, 81, 82, 81, 80, 87 };
ShootEmUp::ShootEmUp(AvalancheEngine *vm) {
_vm = vm;
@@ -82,6 +85,7 @@ ShootEmUp::ShootEmUp(AvalancheEngine *vm) {
_escaping = false;
_timeThisSecond = 0;
_cp = false;
+ _wasFacing = 0;
}
void ShootEmUp::run() {
@@ -362,7 +366,36 @@ void ShootEmUp::initRunner(int16 x, int16 y, byte f1, byte f2, int8 ix, int8 iy)
}
void ShootEmUp::moveAvvy() {
- warning("STUB: ShootEmUp::moveAvvy()");
+ if (_avvyWas < _avvyPos)
+ _avvyFacing = kFacingRight;
+ else if (_avvyWas > _avvyPos)
+ _avvyFacing = kFacingLeft;
+
+ if (!_firing) {
+ if (_avvyWas == _avvyPos)
+ _avvyAnim = 1;
+ else {
+ _avvyAnim++;
+ if (_avvyAnim == 6)
+ _avvyAnim = 0;
+ }
+ }
+
+ if (_avvyFacing == kAvvyShoots)
+ define(_avvyPos, kAvvyY, kShooting[_avvyAnim], 0, 0, 1, false, true);
+ else
+ define(_avvyPos, kAvvyY, _avvyAnim + _avvyFacing, 0, 0, 1, false, true);
+
+ _avvyWas = _avvyPos;
+
+ if (_avvyFacing == kAvvyShoots) {
+ if (_avvyAnim == 6) {
+ _avvyFacing = _wasFacing;
+ _avvyAnim = 0;
+ _firing = false;
+ } else
+ _avvyAnim++;
+ }
}
void ShootEmUp::readKbd() {
diff --git a/engines/avalanche/shootemup.h b/engines/avalanche/shootemup.h
index 6dfa3baa1b..b3561aceae 100644
--- a/engines/avalanche/shootemup.h
+++ b/engines/avalanche/shootemup.h
@@ -59,10 +59,13 @@ private:
};
static const byte kStocks;
+ static const byte kAvvyShoots;
static const byte kFacingRight;
static const byte kFacingLeft;
static const long int kFlag;
static const byte kFrameDelayMax;
+ static const byte kAvvyY;
+ static const byte kShooting[7];
AvalancheEngine *_vm;
@@ -87,6 +90,7 @@ private:
bool _escaping;
byte _timeThisSecond;
bool _cp;
+ byte _wasFacing;
bool overlap(uint16 a1x, uint16 a1y, uint16 a2x, uint16 a2y, uint16 b1x, uint16 b1y, uint16 b2x, uint16 b2y);
byte getStockNumber(byte x);