UFO: Alien Invasion
Loading...
Searching...
No Matches
ui_node_radar.cpp File Reference
Include dependency graph for ui_node_radar.cpp:

Go to the source code of this file.

Data Structures

struct  hudRadarImage_t
 Each maptile must have an entry in the images array. More...
struct  hudRadar_t

Functions

static void UI_FreeRadarImages (void)
static void UI_BuildRadarImageList (const char *tiles, const char *pos)
 Reads the tiles and position config strings and convert them into a linked list that holds the imagename (mapname), the x and the y position (screencoordinates).
static void UI_GetRadarWidth (const uiNode_t *node, vec2_t gridSize)
 Get the width of radar.
static bool UI_CheckRadarImage (const char *imageName, const int level)
static void UI_InitRadar (const uiNode_t *node)
 Calculate some radar values that won't change during a mission.
static void UI_RadarNodeGetActorColor (const le_t *le, vec4_t color)
static void UI_RadarNodeDrawArrays (const vec4_t color, vec2_t coords[4], vec2_t vertices[4], const image_t *image)
static void UI_RadarNodeDrawItem (const le_t *le, const vec3_t pos)
static void UI_RadarNodeDrawActor (const le_t *le, const vec3_t pos)
void UI_RegisterRadarNode (uiBehaviour_t *behaviour)

Variables

static hudRadar_t radar
static char const *const imageExtensions []

Function Documentation

◆ UI_BuildRadarImageList()

void UI_BuildRadarImageList ( const char * tiles,
const char * pos )
static

Reads the tiles and position config strings and convert them into a linked list that holds the imagename (mapname), the x and the y position (screencoordinates).

Parameters
[in]tilesThe configstring with the tiles (map tiles)
[in]posThe position string, only used in case of random map assembly
See also
UI_DrawRadar
R_ModBeginLoading

Definition at line 103 of file ui_node_radar.cpp.

References hudRadar_t::base, cl, Com_Error(), Com_Parse(), Com_Printf(), Com_sprintf(), ERR_DROP, AABB::getWidthX(), AABB::getWidthY(), hudRadar_t::gridMin, hudRadarImage_t::gridX, hudRadarImage_t::gridY, i, hudRadar_t::images, hudRadarImage_t::isTile, mapData_t::mapBox, clientBattleScape_t::mapData, hudRadarImage_t::mapX, hudRadarImage_t::mapY, MAX_VAR, Mem_StrDup, hudRadarImage_t::name, name, hudRadar_t::numImages, Q_strncpyz(), radar, UI_BuildRadarImageList(), and UNIT_SIZE.

Referenced by UI_BuildRadarImageList(), and UI_InitRadar().

◆ UI_CheckRadarImage()

bool UI_CheckRadarImage ( const char * imageName,
const int level )
static

Definition at line 252 of file ui_node_radar.cpp.

References FS_CheckFile(), imageExtensions, level, and UI_CheckRadarImage().

Referenced by UI_CheckRadarImage(), and UI_InitRadar().

◆ UI_FreeRadarImages()

◆ UI_GetRadarWidth()

void UI_GetRadarWidth ( const uiNode_t * node,
vec2_t gridSize )
static

Get the width of radar.

Parameters
[in]nodeNode description of the radar
[in]gridSizesize of the radar picture, in grid units.
See also
UI_InitRadar

< Contains the width of the first and the last tile of the first line (in screen unit)

< Contains the height of the first and the last tile of the first column (in screen unit)

< Contains the grid X position of 2nd tiles in first line

< Contains the grid Y position of 2nd tiles in first column

< ratio conversion between screen coordinates and grid coordinates

< Number of pixel to remove to avoid rounding errors (and lines between tiles) We remove pixel because this is much nicer if tiles overlap a little bit rather than if they are too distant one from the other

Definition at line 164 of file ui_node_radar.cpp.

References hudRadar_t::gridMax, hudRadar_t::gridMin, hudRadarImage_t::gridX, hudRadarImage_t::gridY, hudRadar_t::h, hudRadarImage_t::height, hudRadar_t::images, hudRadar_t::numImages, radar, UI_GetRadarWidth(), Vector2Set, hudRadar_t::w, and hudRadarImage_t::width.

Referenced by UI_GetRadarWidth(), and UI_InitRadar().

◆ UI_InitRadar()

void UI_InitRadar ( const uiNode_t * node)
static

Calculate some radar values that won't change during a mission.

Note
Called for every new map (client_state_t is wiped with every level change)

< Size of the whole grid (in tiles units)

Definition at line 270 of file ui_node_radar.cpp.

References hudRadar_t::a, hudRadar_t::b, uiNode_t::box, hudRadar_t::c, cl, CL_GetConfigString(), Com_Printf(), Com_sprintf(), CS_POSITIONS, CS_TILES, AABB::getMaxY(), AABB::getMinX(), AABB::getMinY(), AABB::getWidthX(), AABB::getWidthY(), hudRadar_t::gridHeight, hudRadarImage_t::gridHeight, hudRadar_t::gridMin, hudRadar_t::gridWidth, hudRadarImage_t::gridWidth, hudRadarImage_t::gridX, hudRadarImage_t::gridY, hudRadar_t::h, hudRadarImage_t::height, image_t::height, i, hudRadar_t::images, hudRadarImage_t::isTile, it_pic, MAP_SIZE_OFFSET, mapData_t::mapBox, clientBattleScape_t::mapData, hudRadarImage_t::mapHeight, hudRadarImage_t::mapWidth, hudRadarImage_t::mapX, hudRadarImage_t::mapY, MAX_QPATH, hudRadarImage_t::maxlevel, AABB::maxs, Mem_StrDup, AABB::mins, hudRadarImage_t::name, hudRadar_t::numImages, hudRadarImage_t::path, PATHFINDING_HEIGHT, R_FindImage(), radar, uiBox_t::size, UI_BuildRadarImageList(), UI_CheckRadarImage(), UI_FreeRadarImages(), UI_GetNodeAbsPos(), UI_GetRadarWidth(), UI_InitRadar(), UNIT_SIZE, va(), Vector2Copy, Vector2Dist, VectorAdd, VectorSet, VectorSubtract, hudRadar_t::w, hudRadarImage_t::width, image_t::width, hudRadar_t::x, hudRadarImage_t::x, hudRadar_t::y, and hudRadarImage_t::y.

Referenced by uiRadarNode::draw(), and UI_InitRadar().

◆ UI_RadarNodeDrawActor()

void UI_RadarNodeDrawActor ( const le_t * le,
const vec3_t pos )
static

◆ UI_RadarNodeDrawArrays()

void UI_RadarNodeDrawArrays ( const vec4_t color,
vec2_t coords[4],
vec2_t vertices[4],
const image_t * image )
static

◆ UI_RadarNodeDrawItem()

void UI_RadarNodeDrawItem ( const le_t * le,
const vec3_t pos )
static

Definition at line 422 of file ui_node_radar.cpp.

References UI_RadarNodeDrawItem().

Referenced by uiRadarNode::draw(), and UI_RadarNodeDrawItem().

◆ UI_RadarNodeGetActorColor()

void UI_RadarNodeGetActorColor ( const le_t * le,
vec4_t color )
static

◆ UI_RegisterRadarNode()

Variable Documentation

◆ imageExtensions

char const* const imageExtensions[]
static
Initial value:
= {
"jpg",
"png",
nullptr
}

Definition at line 243 of file ui_node_radar.cpp.

Referenced by UI_CheckRadarImage().

◆ radar