Mines have a short radar range.
This commit is contained in:
parent
3646a9326a
commit
daa8eff104
|
@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "mine.h"
|
||||
|
||||
static void think(void);
|
||||
static void die(void);
|
||||
static void lookForFighters(void);
|
||||
|
||||
Entity *spawnMine(void)
|
||||
|
@ -31,6 +32,8 @@ Entity *spawnMine(void)
|
|||
mine->health = mine->maxHealth = 1;
|
||||
mine->texture = getTexture("gfx/entities/mine.png");
|
||||
mine->action = think;
|
||||
mine->die = die;
|
||||
mine->flags = EF_TAKES_DAMAGE+EF_SHORT_RADAR_RANGE;
|
||||
|
||||
return mine;
|
||||
}
|
||||
|
@ -47,6 +50,13 @@ static void think(void)
|
|||
lookForFighters();
|
||||
}
|
||||
|
||||
static void die(void)
|
||||
{
|
||||
addMineExplosion();
|
||||
|
||||
self->alive = ALIVE_DEAD;
|
||||
}
|
||||
|
||||
static void lookForFighters(void)
|
||||
{
|
||||
Entity *e, **candidates;
|
||||
|
@ -59,8 +69,6 @@ static void lookForFighters(void)
|
|||
if (e->health > 0 && e->type == ET_FIGHTER && getDistance(self->x, self->y, e->x, e->y) <= 128)
|
||||
{
|
||||
self->health = 0;
|
||||
|
||||
addMineExplosion();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ void drawRadar(void)
|
|||
{
|
||||
SDL_Rect r;
|
||||
Entity *e;
|
||||
int dist, inRange;
|
||||
|
||||
blit(radarTexture, SCREEN_WIDTH - 85, SCREEN_HEIGHT - 85, 1);
|
||||
|
||||
|
@ -43,7 +44,13 @@ void drawRadar(void)
|
|||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
{
|
||||
if (e->active && getDistance(e->x, e->y, player->x, player->y) / radarRanges[battle.radarRange] < 70)
|
||||
dist = getDistance(e->x, e->y, player->x, player->y);
|
||||
|
||||
if (e->active)
|
||||
{
|
||||
inRange = (!(e->flags & EF_SHORT_RADAR_RANGE)) ? (dist / radarRanges[battle.radarRange]) < 70 : dist < 500;
|
||||
|
||||
if (inRange)
|
||||
{
|
||||
r.x = SCREEN_WIDTH - 85;
|
||||
r.y = SCREEN_HEIGHT - 85;
|
||||
|
@ -85,6 +92,7 @@ void drawRadar(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void drawRadarRangeWarning(void)
|
||||
{
|
||||
|
|
|
@ -97,6 +97,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define EF_AI_LEADER (2 << 14)
|
||||
#define EF_ROPED_ATTACHED (2 << 15)
|
||||
#define EF_NO_KILL_INC (2 << 16)
|
||||
#define EF_SHORT_RADAR_RANGE (2 << 17)
|
||||
|
||||
#define AIF_NONE 0
|
||||
#define AIF_FOLLOWS_PLAYER (2 << 0)
|
||||
|
|
Loading…
Reference in New Issue