Continue pushing away

This commit is contained in:
Miloslav Číž 2019-10-21 23:09:08 +02:00
parent b1dd065bcd
commit d5b5e75b20
1 changed files with 6 additions and 8 deletions

14
main.c
View File

@ -1162,11 +1162,14 @@ RCL_Vector2D SFG_pushAway(
fromCenter.x = pos[0] - center.x; fromCenter.x = pos[0] - center.x;
fromCenter.y = pos[1] - center.y; fromCenter.y = pos[1] - center.y;
if (fromCenter.x == 0 && fromCenter.y == 0)
fromCenter = RCL_angleToDirection(preferredDirection);
RCL_Unit l = RCL_len(fromCenter); RCL_Unit l = RCL_len(fromCenter);
if (l < 128)
{
fromCenter = RCL_angleToDirection(preferredDirection);
l = RCL_UNITS_PER_SQUARE;
}
if (l >= distance) if (l >= distance)
return; return;
@ -1193,8 +1196,6 @@ RCL_Vector2D SFG_pushAway(
void SFG_createExplosion(RCL_Unit x, RCL_Unit y, RCL_Unit z) void SFG_createExplosion(RCL_Unit x, RCL_Unit y, RCL_Unit z)
{ {
SFG_LOG("creating explostion");
SFG_ProjectileRecord explostion; SFG_ProjectileRecord explostion;
explostion.type = SFG_PROJECTILE_EXPLOSION; explostion.type = SFG_PROJECTILE_EXPLOSION;
@ -1493,7 +1494,6 @@ 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(
@ -1505,8 +1505,6 @@ SFG_createProjectile(p);
if (collides) if (collides)
{ {
SFG_LOG("projectile collides");
if (p->type == SFG_PROJECTILE_FIREBALL) if (p->type == SFG_PROJECTILE_FIREBALL)
SFG_createExplosion(p->position[0],p->position[1],p->position[2]); SFG_createExplosion(p->position[0],p->position[1],p->position[2]);