Commit 9b756efc authored by alistert's avatar alistert

Stopped events firing non-existent bullets.

parent 4cdf7392
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* Part of the OpenJazz project * Part of the OpenJazz project
* *
* *
* Copyright (c) 2005-2009 Alister Thomson * Copyright (c) 2005-2010 Alister Thomson
* *
* OpenJazz is distributed under the terms of * OpenJazz is distributed under the terms of
* the GNU General Public License, version 2.0 * the GNU General Public License, version 2.0
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
// Delays // Delays
#define T_FLASH 100 #define T_FLASH 100
#define T_FINISH 200 #define T_FINISH 200
#define T_SHOOT 300
// Speed factors // Speed factors
#define ES_SLOW 80 #define ES_SLOW 80
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Part of the OpenJazz project * Part of the OpenJazz project
* *
* *
* Copyright (c) 2005-2009 Alister Thomson * Copyright (c) 2005-2010 Alister Thomson
* *
* OpenJazz is distributed under the terms of * OpenJazz is distributed under the terms of
* the GNU General Public License, version 2.0 * the GNU General Public License, version 2.0
...@@ -73,7 +73,7 @@ bool Event::step (unsigned int ticks, int msps) { ...@@ -73,7 +73,7 @@ bool Event::step (unsigned int ticks, int msps) {
// Find frame // Find frame
if (animType && (set[animType] >= 0)) { if (animType && (set[animType] >= 0)) {
if ((animType == E_LFINISHANIM) || (animType == E_RFINISHANIM)) if ((animType != E_LEFTANIM) && (animType != E_RIGHTANIM))
frame = (ticks + T_FINISH - level->getEventTime(gridX, gridY)) / 40; frame = (ticks + T_FINISH - level->getEventTime(gridX, gridY)) / 40;
else if (set[E_ANIMSP]) else if (set[E_ANIMSP])
frame = ticks / (set[E_ANIMSP] * 40); frame = ticks / (set[E_ANIMSP] * 40);
...@@ -826,29 +826,13 @@ bool Event::step (unsigned int ticks, int msps) { ...@@ -826,29 +826,13 @@ bool Event::step (unsigned int ticks, int msps) {
if (set[E_BULLETSP]) { if (set[E_BULLETSP]) {
if ((ticks % (set[E_BULLETSP] * 25) > if ((ticks % (set[E_BULLETSP] * 25) >
(unsigned int)(set[E_BULLETSP] * 25) - 200) && (unsigned int)(set[E_BULLETSP] * 25) - T_SHOOT) &&
((animType == E_LEFTANIM) || (animType == E_RIGHTANIM))) { ((animType == E_LEFTANIM) || (animType == E_RIGHTANIM))) {
if (animType == E_LEFTANIM) animType = E_LSHOOTANIM; if (animType == E_LEFTANIM) animType = E_LSHOOTANIM;
else animType = E_RSHOOTANIM; else animType = E_RSHOOTANIM;
} level->setEventTime(gridX, gridY, ticks + T_SHOOT);
if ((ticks % (set[E_BULLETSP] * 25) <
(unsigned int)(set[E_BULLETSP] * 25) - 200) &&
((animType == E_LSHOOTANIM) || (animType == E_RSHOOTANIM))) {
if (animType == E_RSHOOTANIM) {
level->firstBullet = new Bullet(this, true, ticks);
animType = E_RIGHTANIM;
} else {
level->firstBullet = new Bullet(this, false, ticks);
animType = E_LEFTANIM;
}
} }
...@@ -866,6 +850,22 @@ bool Event::step (unsigned int ticks, int msps) { ...@@ -866,6 +850,22 @@ bool Event::step (unsigned int ticks, int msps) {
return true; return true;
} else if (animType == E_LSHOOTANIM) {
if ((set[E_BULLET] < 32) &&
(level->getBullet(set[E_BULLET])[B_SPRITE] != 0))
level->firstBullet = new Bullet(this, false, ticks);
animType = E_LEFTANIM;
} else if (animType == E_RSHOOTANIM) {
if ((set[E_BULLET] < 32) &&
(level->getBullet(set[E_BULLET])[B_SPRITE + 1] != 0))
level->firstBullet = new Bullet(this, true, ticks);
animType = E_RIGHTANIM;
} else { } else {
// Change the water level // Change the water level
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment