From fa14227560c9be143b7c26ada4e41c6636966896 Mon Sep 17 00:00:00 2001 From: nathansmithsmith Date: Fri, 27 Oct 2023 20:15:37 -0600 Subject: Playing with targeting more --- src/radar.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/radar.c') 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 ); } -- cgit v1.2.3