#include <math.h>
#include "ui_node_radar.h"
#include "ui_node_abstractnode.h"
#include "../ui_render.h"
#include "../ui_timer.h"
#include "../ui_windows.h"
#include "../ui_main.h"
#include "../ui_input.h"
#include "../../client.h"
#include "../../battlescape/cl_localentity.h"
#include "../../battlescape/cl_hud.h"
#include "../../renderer/r_draw.h"
#include "../../renderer/r_misc.h"
#include "../../../shared/parse.h"
Go to the source code of this file.
Data Structures | |
struct | hudRadarImage_s |
Each maptile must have an entry in the images array. More... | |
struct | hudRadar_s |
Typedefs | |
typedef struct hudRadarImage_s | hudRadarImage_t |
Each maptile must have an entry in the images array. | |
typedef struct hudRadar_s | 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 qboolean | 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_RadarNodeDrawActor (const le_t *le, const vec3_t pos) |
static void | UI_RadarNodeDrawItem (const le_t *le, const vec3_t pos) |
static void | UI_RadarNodeDraw (uiNode_t *node) |
static void | UI_RadarNodeCapturedMouseMove (uiNode_t *node, int x, int y) |
Called when the node is captured by the mouse. | |
static void | UI_RadarNodeMouseDown (uiNode_t *node, int x, int y, int button) |
static void | UI_RadarNodeMouseUp (uiNode_t *node, int x, int y, int button) |
static void | UI_GetRadarMapInFrameBuffer (int *x, int *y, int *width, int *height) |
static void | UI_GenPreviewRadarMap_f (void) |
static void | UI_GenRadarMap_f (void) |
static void | UI_GenAllRadarMap (uiNode_t *node, uiTimer_t *timer) |
static void | UI_GenAllRadarMapRelease_f (void) |
static void | UI_GenAllRadarMap_f (void) |
void | UI_RegisterRadarNode (uiBehaviour_t *behaviour) |
Variables | |
static hudRadar_t | radar |
static const char * | imageExtensions [] |
uiTimer_t * | timer |
Definition in file ui_node_radar.c.
typedef struct hudRadar_s hudRadar_t |
typedef struct hudRadarImage_s hudRadarImage_t |
Each maptile must have an entry in the images array.
static 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).
[in] | tiles | The configstring with the tiles (map tiles) |
[in] | pos | The position string, only used in case of random map assembly |
Definition at line 107 of file ui_node_radar.c.
References hudRadar_s::base, cl, Com_Error(), Com_Parse(), Com_Printf(), Com_sprintf(), ERR_DROP, hudRadar_s::gridMin, hudRadarImage_s::gridX, hudRadarImage_s::gridY, i, hudRadar_s::images, hudRadarImage_s::isTile, hudRadarImage_s::mapX, hudRadarImage_s::mapY, MAX_VAR, Mem_StrDup, hudRadarImage_s::name, name, hudRadar_s::numImages, Q_strncpyz(), and UNIT_SIZE.
Referenced by UI_InitRadar().
static qboolean UI_CheckRadarImage | ( | const char * | imageName, | |
const int | level | |||
) | [static] |
Definition at line 254 of file ui_node_radar.c.
References FS_CheckFile(), imageExtensions, qfalse, and qtrue.
Referenced by UI_InitRadar().
static void UI_FreeRadarImages | ( | void | ) | [static] |
Definition at line 86 of file ui_node_radar.c.
References i, hudRadar_s::images, hudRadarImage_s::maxlevel, Mem_Free, hudRadarImage_s::name, hudRadar_s::numImages, and hudRadarImage_s::path.
Referenced by UI_InitRadar().
Definition at line 776 of file ui_node_radar.c.
References uiTimer_s::calledTime, Cbuf_AddText(), cl, Cmd_ExecuteString(), Cvar_SetValue(), and level.
Referenced by UI_GenAllRadarMap_f().
static void UI_GenAllRadarMap_f | ( | void | ) | [static] |
Take all screenshots from lower to upper map level. Use a timer to delay each capture
Definition at line 806 of file ui_node_radar.c.
References UI_AllocTimer(), UI_GenAllRadarMap(), and UI_TimerStart().
Referenced by UI_RegisterRadarNode().
static void UI_GenAllRadarMapRelease_f | ( | void | ) | [static] |
Definition at line 797 of file ui_node_radar.c.
References UI_ExecuteConfunc(), and UI_TimerRelease().
Referenced by UI_RegisterRadarNode().
static void UI_GenPreviewRadarMap_f | ( | void | ) | [static] |
Definition at line 739 of file ui_node_radar.c.
References viddef_t::rx, viddef_t::ry, UI_ExecuteConfunc(), UI_GetRadarMapInFrameBuffer(), viddef, and viddef_t::virtualHeight.
Referenced by UI_RegisterRadarNode().
static void UI_GenRadarMap_f | ( | void | ) | [static] |
Take a screen shot of the map with the position of the radar
We add 1 pixel into the border to easy check the result: the screen shot must have a border of 1 black pixel
Definition at line 761 of file ui_node_radar.c.
References Cvar_GetInteger(), Cvar_GetString(), level, R_ScreenShot(), UI_GetRadarMapInFrameBuffer(), and va().
Referenced by UI_RegisterRadarNode().
static void UI_GetRadarMapInFrameBuffer | ( | int * | x, | |
int * | y, | |||
int * | width, | |||
int * | height | |||
) | [static] |
Return the rect where the radarmap should be, when we generate radar images
[out] | x | X position of the rect in the frame buffer (from bottom-to-top according to the screen) |
[out] | y | Y position of the rect in the frame buffer (from bottom-to-top according to the screen) |
[out] | width | Width of the rect in the frame buffer (from bottom-to-top according to the screen) |
[out] | height | Height of the rect in the frame buffer (from bottom-to-top according to the screen) |
Definition at line 723 of file ui_node_radar.c.
References cl, viddef_t::height, viddef, and viddef_t::width.
Referenced by UI_GenPreviewRadarMap_f(), and UI_GenRadarMap_f().
Get the width of radar.
[in] | node | Node description of the radar |
[in] | gridSize | size of the radar picture, in grid units. |
< 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 170 of file ui_node_radar.c.
References hudRadar_s::gridMax, hudRadar_s::gridMin, hudRadarImage_s::gridX, hudRadarImage_s::gridY, hudRadar_s::h, hudRadarImage_s::height, hudRadar_s::images, hudRadar_s::numImages, Vector2Set, hudRadar_s::w, and hudRadarImage_s::width.
Referenced by UI_InitRadar().
static void UI_InitRadar | ( | const uiNode_t * | node | ) | [static] |
Calculate some radar values that won't change during a mission.
< Size of the whole grid (in tiles units)
Definition at line 272 of file ui_node_radar.c.
References hudRadar_s::a, hudRadar_s::b, hudRadar_s::c, cl, CL_GetConfigString(), Com_Printf(), Com_sprintf(), CS_POSITIONS, CS_TILES, hudRadar_s::gridHeight, hudRadarImage_s::gridHeight, hudRadar_s::gridMin, hudRadar_s::gridWidth, hudRadarImage_s::gridWidth, hudRadarImage_s::gridX, hudRadarImage_s::gridY, hudRadar_s::h, image_s::height, hudRadarImage_s::height, i, hudRadar_s::images, hudRadarImage_s::isTile, it_pic, MAP_SIZE_OFFSET, hudRadarImage_s::mapHeight, hudRadarImage_s::mapWidth, hudRadarImage_s::mapX, hudRadarImage_s::mapY, MAX_QPATH, hudRadarImage_s::maxlevel, Mem_StrDup, hudRadarImage_s::name, hudRadar_s::numImages, hudRadarImage_s::path, PATHFINDING_HEIGHT, R_FindImage(), uiNode_s::size, UI_BuildRadarImageList(), UI_CheckRadarImage(), UI_FreeRadarImages(), UI_GetNodeAbsPos(), UI_GetRadarWidth(), UNIT_SIZE, va(), Vector2Copy, Vector2Dist, VectorAdd, VectorSet, VectorSubtract, hudRadar_s::w, image_s::width, hudRadarImage_s::width, hudRadarImage_s::x, hudRadar_s::x, hudRadarImage_s::y, and hudRadar_s::y.
Referenced by UI_RadarNodeDraw().
static void UI_RadarNodeCapturedMouseMove | ( | uiNode_t * | node, | |
int | x, | |||
int | y | |||
) | [static] |
Called when the node is captured by the mouse.
Definition at line 680 of file ui_node_radar.c.
References cl, pos, uiNode_s::size, UI_NodeAbsoluteToRelativePos(), and VectorCopy.
Referenced by UI_RadarNodeMouseDown(), and UI_RegisterRadarNode().
static void UI_RadarNodeDraw | ( | uiNode_t * | node | ) | [static] |
[in] | node | Node description of the radar |
Definition at line 563 of file ui_node_radar.c.
References ca_active, cl, cl_worldlevel, cls, ET_ACTOR, ET_ACTOR2x2, ET_ITEM, f, hudRadar_s::gridHeight, hudRadar_s::gridWidth, hudRadarImage_s::gridX, hudRadarImage_s::gridY, hudRadar_s::h, hudRadarImage_s::height, i, hudRadar_s::images, cvar_s::integer, le_s::invis, LE_GetNextInUse(), LONGLINES_PRETTYCHOP, hudRadarImage_s::mapHeight, hudRadarImage_s::mapWidth, hudRadarImage_s::mapX, hudRadarImage_s::mapY, hudRadarImage_s::maxlevel, hudRadar_s::numImages, le_s::origin, hudRadarImage_s::path, le_s::pos, pos, qtrue, R_CleanupDepthBuffer(), R_PopClipRect(), R_PushClipRect(), red, uiNode_s::size, client_static_s::state, le_s::type, UI_DrawFill(), UI_DrawNormImageByName(), UI_DrawStringInBox(), UI_GetNodeAbsPos(), UI_InitRadar(), UI_RadarNodeDrawActor(), UI_RadarNodeDrawItem(), UNIT_SIZE, va(), hudRadar_s::w, hudRadarImage_s::width, hudRadarImage_s::x, hudRadar_s::x, hudRadarImage_s::y, and hudRadar_s::y.
Referenced by UI_RegisterRadarNode().
Definition at line 424 of file ui_node_radar.c.
References le_s::dir, directionAngles, f, i, LE_IsDead, le_s::selected, torad, UI_LoadImage(), UI_RadarNodeDrawArrays(), UI_RadarNodeGetActorColor(), and Vector4Set.
Referenced by UI_RadarNodeDraw().
static void UI_RadarNodeDrawArrays | ( | const vec4_t | color, | |
vec2_t | coords[4], | |||
vec2_t | vertices[4], | |||
const image_t * | image | |||
) | [static] |
Definition at line 417 of file ui_node_radar.c.
References R_Color(), and R_DrawImageArray().
Referenced by UI_RadarNodeDrawActor().
Definition at line 512 of file ui_node_radar.c.
References f, i, UI_LoadImage(), UI_RadarNodeGetActorColor(), and Vector4Set.
Referenced by UI_RadarNodeDraw().
Definition at line 392 of file ui_node_radar.c.
References cl_worldlevel, cls, cvar_s::integer, LE_IsCivilian, LE_IsDead, le_s::pos, client_static_s::team, le_s::team, and Vector4Set.
Referenced by UI_RadarNodeDrawActor(), and UI_RadarNodeDrawItem().
static void UI_RadarNodeMouseDown | ( | uiNode_t * | node, | |
int | x, | |||
int | y, | |||
int | button | |||
) | [static] |
Definition at line 698 of file ui_node_radar.c.
References uiNode_s::disabled, K_MOUSE1, UI_RadarNodeCapturedMouseMove(), and UI_SetMouseCapture().
Referenced by UI_RegisterRadarNode().
static void UI_RadarNodeMouseUp | ( | uiNode_t * | node, | |
int | x, | |||
int | y, | |||
int | button | |||
) | [static] |
Definition at line 709 of file ui_node_radar.c.
References K_MOUSE1, and UI_MouseRelease().
Referenced by UI_RegisterRadarNode().
void UI_RegisterRadarNode | ( | uiBehaviour_t * | behaviour | ) |
Definition at line 813 of file ui_node_radar.c.
References uiBehaviour_s::capturedMouseMove, Cmd_AddCommand(), uiBehaviour_s::draw, uiBehaviour_s::mouseDown, uiBehaviour_s::mouseUp, uiBehaviour_s::name, UI_GenAllRadarMap_f(), UI_GenAllRadarMapRelease_f(), UI_GenPreviewRadarMap_f(), UI_GenRadarMap_f(), UI_RadarNodeCapturedMouseMove(), UI_RadarNodeDraw(), UI_RadarNodeMouseDown(), and UI_RadarNodeMouseUp().
const char* imageExtensions[] [static] |
{ "tga", "jpg", "png", NULL }
Definition at line 250 of file ui_node_radar.c.
Referenced by UI_CheckRadarImage().
hudRadar_t radar [static] |
Definition at line 84 of file ui_node_radar.c.
Referenced by RADAR_AddDetectedUFOToEveryRadar(), and RADAR_CheckRadarSensored().
Definition at line 792 of file ui_node_radar.c.