diff options
Diffstat (limited to 'src/radar.c')
-rw-r--r-- | src/radar.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/radar.c b/src/radar.c index 192617e..19dfe21 100644 --- a/src/radar.c +++ b/src/radar.c @@ -3,6 +3,7 @@ #include "entity.h" #include "world.h" #include "assets.h" +#include "entitiesInclude.h" void initRadar(Radar * radar) { resetRadarPosition(radar); @@ -37,11 +38,18 @@ void drawRadar3DParts(Game * game, Radar * radar) { World * world = &game->world; Entity * player = getEntityFromWorld(*world, 0); + AntifaShip * data = (AntifaShip*)player->data; BeginTextureMode(radar->texture); ClearBackground(RADAR_COLOR); BeginMode3D(radar->camera); + // Get targeted entity if there is one. + Entity * targetedEntity = NULL; + + if (data->doAutoTarget) + targetedEntity = getEntityFromWorld(game->world, data->targetedEntityId); + // Draw entities on radar. Skip player. for (i = 1; i < world->entitiesCount; ++i) { Entity * entity = &world->entities[i]; @@ -50,10 +58,17 @@ void drawRadar3DParts(Game * game, Radar * radar) { if (Vector3Distance(player->position, entity->position) > RADAR_MAX_DISTANCE) continue; + Color color = RADAR_ENTITY_COLOR; + + // Is targeted. + if (targetedEntity != NULL) + if (entity->fingerprint == targetedEntity->fingerprint) + color = RADAR_TARGETED_ENTITY_COLOR; + DrawSphere( Vector3Scale(Vector3Subtract(entity->position, player->position), RADAR_WORLD_SCALE), RADAR_POINT_SIZE, - RADAR_ENTITY_COLOR + color ); } |