aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authoruruk2014-03-01 23:25:15 +0100
committeruruk2014-03-01 23:25:15 +0100
commitf8b61872efda59c12a00d2d80d819394cdd6488b (patch)
tree95957f9d84e258667fa3b7a7f117da4ae6c7c3a6 /engines
parentf2c03e575156ab815d9e2f3c2e0c55f42c0d91c3 (diff)
downloadscummvm-rg350-f8b61872efda59c12a00d2d80d819394cdd6488b.tar.gz
scummvm-rg350-f8b61872efda59c12a00d2d80d819394cdd6488b.tar.bz2
scummvm-rg350-f8b61872efda59c12a00d2d80d819394cdd6488b.zip
AVALANCHE: Implement moving in ShootEmUp::readKbd().
Rework the existing parts of the function during the process.
Diffstat (limited to 'engines')
-rw-r--r--engines/avalanche/shootemup.cpp33
-rw-r--r--engines/avalanche/shootemup.h2
2 files changed, 26 insertions, 9 deletions
diff --git a/engines/avalanche/shootemup.cpp b/engines/avalanche/shootemup.cpp
index 88de958747..c85004d81f 100644
--- a/engines/avalanche/shootemup.cpp
+++ b/engines/avalanche/shootemup.cpp
@@ -42,6 +42,8 @@ const byte ShootEmUp::kAvvyY = 150;
const byte ShootEmUp::kShooting[7] = { 86, 79, 80, 81, 80, 79, 86 };
const byte ShootEmUp::kTimesASecond = 18;
const byte ShootEmUp::kFlashTime = 20; // If flash_time is <= this, the word "time" will flash. Should be about 20.
+const byte ShootEmUp::kLeftMargin = 10;
+const int16 ShootEmUp::kRightMargin = 605;
ShootEmUp::ShootEmUp(AvalancheEngine *vm) {
_vm = vm;
@@ -423,11 +425,19 @@ void ShootEmUp::readKbd() {
Common::Event event;
_vm->getEvent(event);
- if (_firing)
+ if ((event.type == Common::EVENT_KEYUP) && ((event.kbd.keycode == Common::KEYCODE_LALT) || (event.kbd.keycode == Common::KEYCODE_RALT))) {
+ // Don't let the player fire continuously by holding down one of the ALT keys.
+ _altWasPressedBefore = false;
+ return;
+ }
+
+ if (_firing) // So you can't stack up shots while the shooting animation plays.
return;
if (event.type == Common::EVENT_KEYDOWN) {
- if ((event.kbd.keycode == Common::KEYCODE_LALT) || (event.kbd.keycode == Common::KEYCODE_RALT)) {
+ switch (event.kbd.keycode) {
+ case Common::KEYCODE_LALT: // Alt was pressed - shoot!
+ case Common::KEYCODE_RALT: // Falltrough is intended.
if (_altWasPressedBefore || (_count321 != 0))
return;
@@ -441,15 +451,20 @@ void ShootEmUp::readKbd() {
_wasFacing = _avvyFacing;
_avvyFacing = kAvvyShoots;
return;
+ case Common::KEYCODE_RSHIFT: // Right shift: move right.
+ _avvyPos += 5;
+ if (_avvyPos > kRightMargin)
+ _avvyPos = kRightMargin;
+ return;
+ case Common::KEYCODE_LSHIFT: // Left shift: move left.
+ _avvyPos -= 5;
+ if (_avvyPos < kLeftMargin)
+ _avvyPos = kLeftMargin;
+ return;
+ default:
+ break;
}
}
-
- if ((event.type == Common::EVENT_KEYUP) && ((event.kbd.keycode == Common::KEYCODE_LALT) || (event.kbd.keycode == Common::KEYCODE_RALT))) {
- _altWasPressedBefore = false;
- return;
- }
-
- warning("STUB: ShootEmUp::readKbd()");
}
void ShootEmUp::animate() {
diff --git a/engines/avalanche/shootemup.h b/engines/avalanche/shootemup.h
index ada39066fd..4c010aa71e 100644
--- a/engines/avalanche/shootemup.h
+++ b/engines/avalanche/shootemup.h
@@ -68,6 +68,8 @@ private:
static const byte kShooting[7];
static const byte kTimesASecond;
static const byte kFlashTime;
+ static const byte kLeftMargin;
+ static const int16 kRightMargin;
AvalancheEngine *_vm;