AVALANCHE: Implement ShootEmUp::moveAvvy().

This commit is contained in:
uruk 2014-02-19 18:45:08 +01:00
parent 546a3cea82
commit 5c841dab6d
2 changed files with 38 additions and 1 deletions

View File

@ -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() {

View File

@ -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);