Added back in collision support (Classic difficulty only)
I completely forgot about this stupid feature of the original game. Nonetheless, it's a part of the original experience and thus has been added back in, albeit implemented in a slightly different way (the result is still the same). Because this is such a stupid and badly designed mechanic, this is of course in Classic difficulty only.
This commit is contained in:
parent
cd49905aee
commit
d262806105
48
src/alien.c
48
src/alien.c
|
@ -1773,6 +1773,7 @@ int alien_enemiesInFront(Object *alien)
|
||||||
void alien_move(Object *alien)
|
void alien_move(Object *alien)
|
||||||
{
|
{
|
||||||
int checkCollisions;
|
int checkCollisions;
|
||||||
|
int collided = 0;
|
||||||
|
|
||||||
if ((alien->flags & FL_LEAVESECTOR) || (alien->shield < 1))
|
if ((alien->flags & FL_LEAVESECTOR) || (alien->shield < 1))
|
||||||
checkCollisions = 0;
|
checkCollisions = 0;
|
||||||
|
@ -1808,9 +1809,16 @@ void alien_move(Object *alien)
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < ALIEN_MAX ; i++)
|
for (int i = 0 ; i < ALIEN_MAX ; i++)
|
||||||
{
|
{
|
||||||
if ((aliens[i].classDef == CD_BARRIER) &&
|
if (ship_collision(alien, &aliens[i]) && (aliens[i].owner != alien))
|
||||||
(aliens[i].owner != alien) &&
|
{
|
||||||
ship_collision(alien, &aliens[i]))
|
if ((game.difficulty == DIFFICULTY_ORIGINAL) && (alien->classDef != CD_DRONE) &&
|
||||||
|
(alien->classDef != CD_ASTEROID) && (alien->classDef != CD_ASTEROID2) &&
|
||||||
|
(alien->owner == alien))
|
||||||
|
{
|
||||||
|
collided = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aliens[i].classDef == CD_BARRIER)
|
||||||
{
|
{
|
||||||
alien->shield--;
|
alien->shield--;
|
||||||
alien->hit = 3;
|
alien->hit = 3;
|
||||||
|
@ -1819,6 +1827,7 @@ void alien_move(Object *alien)
|
||||||
audio_playSound(SFX_HIT, alien->x, alien->y);
|
audio_playSound(SFX_HIT, alien->x, alien->y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Handle a collision with the player
|
// Handle a collision with the player
|
||||||
if ((player.shield > 0) && ship_collision(alien, &player))
|
if ((player.shield > 0) && ship_collision(alien, &player))
|
||||||
|
@ -1842,6 +1851,39 @@ void alien_move(Object *alien)
|
||||||
player_damage(1, 0);
|
player_damage(1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ship collision (only in Classic difficulty)
|
||||||
|
if (collided)
|
||||||
|
{
|
||||||
|
if (alien->flags & FL_CIRCLES)
|
||||||
|
{
|
||||||
|
if (alien->face == 0)
|
||||||
|
{
|
||||||
|
alien->dx -= 0.02;
|
||||||
|
alien->dy -= 0.02;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alien->dx += 0.02;
|
||||||
|
alien->dy += 0.02;
|
||||||
|
}
|
||||||
|
|
||||||
|
alien->x += (sinf(alien->dx) * 4);
|
||||||
|
alien->y += (cosf(alien->dy) * 4);
|
||||||
|
|
||||||
|
alien->thinktime = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alien->x += alien->dx;
|
||||||
|
alien->y += alien->dy;
|
||||||
|
|
||||||
|
alien->dx *= -0.2;
|
||||||
|
alien->dy *= -0.2;
|
||||||
|
|
||||||
|
LIMIT(alien->thinktime, 0, 15);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue