Fix explosions

This commit is contained in:
Miloslav Číž 2019-10-21 20:07:28 +02:00
parent 7666fc9be0
commit a5cf220d5d

9
main.c
View File

@ -1428,6 +1428,7 @@ SFG_createProjectile(p);
if (p->doubleFramesToLive == 0) if (p->doubleFramesToLive == 0)
{ {
SFG_LOG("projectile times out");
collides = 1; collides = 1;
} }
else if (SFG_floorHeightAt( else if (SFG_floorHeightAt(
@ -1441,6 +1442,9 @@ SFG_createProjectile(p);
{ {
SFG_LOG("projectile collides"); SFG_LOG("projectile collides");
if (p->type == SFG_PROJECTILE_FIREBALL)
SFG_createExplosion(p->position[0],p->position[1],p->position[2]);
// remove the projectile // remove the projectile
for (uint8_t j = i; j < SFG_currentLevel.projectileRecordCount - 1; ++j) for (uint8_t j = i; j < SFG_currentLevel.projectileRecordCount - 1; ++j)
@ -1450,9 +1454,6 @@ SFG_createProjectile(p);
SFG_currentLevel.projectileRecordCount--; SFG_currentLevel.projectileRecordCount--;
i--; i--;
if (p->type == SFG_PROJECTILE_FIREBALL)
SFG_createExplosion(p->position[0],p->position[1],p->position[2]);
} }
else else
{ {
@ -1856,7 +1857,7 @@ void SFG_draw()
const uint8_t *s = const uint8_t *s =
SFG_effects[proj->type == SFG_PROJECTILE_FIREBALL ? 1 : 0]; SFG_effects[proj->type == SFG_PROJECTILE_FIREBALL ? 1 : 0];
int16_t spriteSize = SFG_GAME_RESOLUTION_Y / 2; int16_t spriteSize = SFG_GAME_RESOLUTION_Y / 2;
if (proj->type == SFG_PROJECTILE_EXPLOSION) if (proj->type == SFG_PROJECTILE_EXPLOSION)