UFO: Alien Invasion
Loading...
Searching...
No Matches
ui_node_radar.cpp
Go to the documentation of this file.
1
4
5/*
6Copyright (C) 2002-2025 UFO: Alien Invasion.
7
8This program is free software; you can redistribute it and/or
9modify it under the terms of the GNU General Public License
10as published by the Free Software Foundation; either version 2
11of the License, or (at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
17See the GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23*/
24
25#include "ui_node_radar.h"
27#include "../ui_render.h"
28#include "../ui_main.h"
29#include "../ui_behaviour.h"
30#include "../ui_input.h"
31
32#include "../../client.h"
33#include "../../battlescape/cl_hud.h" /* cl_worldlevel cvar */
36
38
40typedef struct hudRadarImage_s {
41 /* image */
42 char* name;
44 int x, y;
46
47 /* position of this piece into the map */
48 float mapX;
49 float mapY;
50 float mapWidth;
51 float mapHeight;
52
53 bool isTile;
54 int gridX, gridY;
59
60typedef struct hudRadar_s {
66 hudRadarImage_t images[MAX_MAPTILES];
76 int x, y;
78 int w, h;
80
82
83static void UI_FreeRadarImages (void)
84{
85 for (int i = 0; i < radar.numImages; i++) {
86 hudRadarImage_t* image = &radar.images[i];
87 Mem_Free(image->name);
88 for (int j = 0; j < image->maxlevel; j++)
89 Mem_Free(image->path[j]);
90 }
92}
93
103static void UI_BuildRadarImageList (const char* tiles, const char* pos)
104{
105 const float mapMidX = cl.mapData->mapBox.getWidthX() * 0.5;
106 const float mapMidY = cl.mapData->mapBox.getWidthY() * 0.5;
107
108 /* load tiles */
109 while (tiles) {
110 vec3_t sh;
111 char name[MAX_VAR];
112 /* get tile name */
113 const char* token = Com_Parse(&tiles);
114 if (!tiles) {
115 /* finish */
116 return;
117 }
118
119 /* get base path */
120 if (token[0] == '-') {
121 Q_strncpyz(radar.base, token + 1, sizeof(radar.base));
122 continue;
123 }
124
125 /* get tile name */
126 if (token[0] == '+')
127 token++;
128 Com_sprintf(name, sizeof(name), "%s%s", radar.base, token);
129
130 hudRadarImage_t* image = &radar.images[radar.numImages++];
131 image->name = Mem_StrDup(name);
132
133 image->isTile = pos && pos[0];
134 if (!image->isTile)
135 /* it is a single background image*/
136 return;
137
138 /* get grid position and add a tile */
139 for (int i = 0; i < 3; i++) {
140 token = Com_Parse(&pos);
141 if (!pos)
142 Com_Error(ERR_DROP, "UI_BuildRadarImageList: invalid positions\n");
143 sh[i] = atoi(token);
144 }
145 image->gridX = sh[0];
146 image->gridY = sh[1];
147 image->mapX = mapMidX + sh[0] * UNIT_SIZE;
148 image->mapY = mapMidY + sh[1] * UNIT_SIZE;
149 Com_Printf("radar %s %dx%d\n", name, image->gridX, image->gridY);
150
151 if (radar.gridMin[0] > sh[0])
152 radar.gridMin[0] = sh[0];
153 if (radar.gridMin[1] > sh[1])
154 radar.gridMin[1] = sh[1];
155 }
156}
157
164static void UI_GetRadarWidth (const uiNode_t* node, vec2_t gridSize)
165{
166 int tileWidth[2];
167 int tileHeight[2];
168 int secondTileGridX;
169 int secondTileGridY;
170 float ratioConversion;
171 const int ROUNDING_PIXEL = 1;
174
175 /* Set radar.gridMax */
176 radar.gridMax[0] = radar.gridMin[0];
177 radar.gridMax[1] = radar.gridMin[1];
178
179 /* Initialize secondTileGridX to value higher that real value */
180 secondTileGridX = radar.gridMin[0] + 1000;
181 secondTileGridY = radar.gridMin[1] + 1000;
182
183 /* Initialize screen size of last tile (will be used only if there is 1 tile in a line or in a row) */
184 Vector2Set(tileWidth, 0, 0);
185 Vector2Set(tileHeight, 0, 0);
186
187 for (int j = 0; j < radar.numImages; j++) {
188 const hudRadarImage_t* image = &radar.images[j];
189
190 assert(image->gridX >= radar.gridMin[0]);
191 assert(image->gridY >= radar.gridMin[1]);
192
193 /* we can assume this because every random map tile has it's origin in
194 * (0, 0) and therefore there are no intersections possible on the min
195 * x and the min y axis. We just have to add the image->w and image->h
196 * values of those images that are placed on the gridMin values.
197 * This also works for static maps, because they have a gridX and gridY
198 * value of zero */
199
200 if (image->gridX == radar.gridMin[0]) {
201 /* radar.gridMax[1] is the maximum for FIRST column (maximum depends on column) */
202 if (image->gridY > radar.gridMax[1]) {
203 tileHeight[1] = image->height;
204 radar.gridMax[1] = image->gridY;
205 }
206 if (image->gridY == radar.gridMin[1]) {
207 /* This is the tile of the map in the lower left: */
208 tileHeight[0] = image->height;
209 tileWidth[0] = image->width;
210 } else if (image->gridY < secondTileGridY)
211 secondTileGridY = image->gridY;
212 }
213 if (image->gridY == radar.gridMin[1]) {
214 /* radar.gridMax[1] is the maximum for FIRST line (maximum depends on line) */
215 if (image->gridX > radar.gridMax[0]) {
216 tileWidth[1] = image->width;
217 radar.gridMax[0] = image->gridX;
218 } else if (image->gridX < secondTileGridX)
219 secondTileGridX = image->gridX;
220 }
221 }
222
223 /* Maybe there was only one tile in a line or in a column? */
224 if (!tileHeight[1])
225 tileHeight[1] = tileHeight[0];
226 if (!tileWidth[1])
227 tileWidth[1] = tileWidth[0];
228
229 /* Now we get the ratio conversion between screen coordinates and grid coordinates.
230 * The problem is that some tiles may have L or T shape.
231 * But we now that the tile in the lower left follows for sure the side of the map on it's whole length
232 * at least either on its height or on its width.*/
233 ratioConversion = std::max((secondTileGridX - radar.gridMin[0]) / (tileWidth[0] - ROUNDING_PIXEL),
234 (secondTileGridY - radar.gridMin[1]) / (tileHeight[0] - ROUNDING_PIXEL));
235
236 /* And now we fill radar.w and radar.h */
237 radar.w = floor((radar.gridMax[0] - radar.gridMin[0]) / ratioConversion) + tileWidth[1];
238 radar.h = floor((radar.gridMax[1] - radar.gridMin[1]) / ratioConversion) + tileHeight[1];
239
240 Vector2Set(gridSize, round(radar.w * ratioConversion), round(radar.h * ratioConversion));
241}
242
243static char const* const imageExtensions[] = {
244#ifdef HAVE_LIBWEBP_DECODE_H
245 "webp",
246#endif
247 "jpg",
248 "png",
249 nullptr
250};
251
252static bool UI_CheckRadarImage (const char* imageName, const int level)
253{
254 char const* const* ext = imageExtensions;
255
256 while (*ext) {
257 if (FS_CheckFile("pics/radars/%s_%i.%s", imageName, level, *ext) > 0)
258 return true;
259 ext++;
260 }
261 /* none found */
262 return false;
263}
264
270static void UI_InitRadar (const uiNode_t* node)
271{
272 int i, j;
274 float distAB, distBC;
275 vec2_t gridSize;
276 vec2_t nodepos;
277 vec2_t min;
278 vec2_t max;
279
282
283 UI_GetNodeAbsPos(node, nodepos);
284 radar.x = nodepos[0] + node->box.size[0] / 2;
285 radar.y = nodepos[1] + node->box.size[1] / 2;
286
287 /* only check once per map whether all the needed images exist */
288 for (j = 0; j < radar.numImages; j++) {
289 hudRadarImage_t* tile = &radar.images[j];
290 /* map_mins, map_maxs */
291 for (i = 0; i < PATHFINDING_HEIGHT; i++) {
292 char imagePath[MAX_QPATH];
293 const image_t* image;
294 if (!UI_CheckRadarImage(tile->name, i + 1)) {
295 if (i == 0) {
296 /* there should be at least one level */
297 Com_Printf("No radar images for map: '%s'\n", tile->name);
298 radar.numImages = 0;
299 return;
300 }
301 continue;
302 }
303
304 Com_sprintf(imagePath, sizeof(imagePath), "radars/%s_%i", tile->name, i + 1);
305 tile->path[i] = Mem_StrDup(imagePath);
306 tile->maxlevel++;
307
308 image = R_FindImage(va("pics/%s", tile->path[i]), it_pic);
309 tile->width = image->width;
310 tile->height = image->height;
311 if (tile->isTile) {
312 tile->gridWidth = round(image->width / 94.0f);
313 tile->gridHeight = round(image->height / 94.0f);
314 tile->mapWidth = tile->gridWidth * 8 * UNIT_SIZE;
315 tile->mapHeight = tile->gridHeight * 8 * UNIT_SIZE;
316 } else {
317 tile->mapX = cl.mapData->mapBox.getMinX();
318 tile->mapY = cl.mapData->mapBox.getMinY();
319 tile->mapWidth = cl.mapData->mapBox.getWidthX();
320 tile->mapHeight = cl.mapData->mapBox.getWidthY();
321 }
322 }
323 if (tile->isTile) {
324 tile->mapY = cl.mapData->mapBox.getMaxY() - tile->mapY - tile->mapHeight;
325 }
326 }
327
328 /* center tiles into the minMap/maxMap */
329 Vector2Copy(cl.mapData->mapBox.maxs, min);
330 Vector2Copy(cl.mapData->mapBox.mins, max);
331 for (j = 0; j < radar.numImages; j++) {
332 hudRadarImage_t* tile = &radar.images[j];
333 if (tile->mapX < min[0])
334 min[0] = tile->mapX;
335 if (tile->mapY < min[1])
336 min[1] = tile->mapY;
337 if (tile->mapX + tile->mapWidth > max[0])
338 max[0] = tile->mapX + tile->mapWidth;
339 if (tile->mapY + tile->mapHeight > max[1])
340 max[1] = tile->mapY + tile->mapHeight;
341 }
342 /* compute translation */
343 min[0] = cl.mapData->mapBox.getMinX() + (cl.mapData->mapBox.getWidthX() - (max[0] - min[0])) * 0.5 - min[0];
344 min[1] = cl.mapData->mapBox.getMinY() + (cl.mapData->mapBox.getWidthY() - (max[1] - min[1])) * 0.5 - min[1];
345 for (j = 0; j < radar.numImages; j++) {
346 hudRadarImage_t* tile = &radar.images[j];
347 tile->mapX += min[0];
348 tile->mapY += min[1];
349 }
350
351 /* get the three points of the triangle */
352 VectorSubtract(cl.mapData->mapBox.mins, offset, radar.a);
353 VectorAdd(cl.mapData->mapBox.maxs, offset, radar.c);
354 VectorSet(radar.b, radar.c[0], radar.a[1], 0);
355
356 distAB = (Vector2Dist(radar.a, radar.b) / UNIT_SIZE);
357 distBC = (Vector2Dist(radar.b, radar.c) / UNIT_SIZE);
358
359 UI_GetRadarWidth(node, gridSize);
360
361 /* get the dimensions for one grid field on the radar map */
362 radar.gridWidth = radar.w / distAB;
363 radar.gridHeight = radar.h / distBC;
364
365 /* shift the x and y values according to their grid width/height and
366 * their gridX and gridY position */
367 {
368 const float radarLength = std::max(1.0f, fabsf(gridSize[0]));
369 const float radarHeight = std::max(1.0f, fabsf(gridSize[1]));
370 /* image grid relations */
371 const float gridFactorX = radar.w / radarLength;
372 const float gridFactorY = radar.h / radarHeight;
373 for (j = 0; j < radar.numImages; j++) {
374 hudRadarImage_t* image = &radar.images[j];
375
376 image->x = (image->gridX - radar.gridMin[0]) * gridFactorX;
377 image->y = radar.h - (image->gridY - radar.gridMin[1]) * gridFactorY - image->height;
378 }
379 }
380
381 /* now align the screen coordinates like it's given by the node */
382 radar.x -= (radar.w / 2);
383 radar.y -= (radar.h / 2);
384}
385
386/*=========================================
387 DRAW FUNCTIONS
388=========================================*/
389
390static void UI_RadarNodeGetActorColor (const le_t* le, vec4_t color)
391{
392 const int actorLevel = le->pos[2];
393 Vector4Set(color, 0, 1, 0, 1);
394
395 /* use different alpha values for different levels */
396 if (actorLevel < cl_worldlevel->integer)
397 color[3] = 0.5;
398 else if (actorLevel > cl_worldlevel->integer)
399 color[3] = 0.3;
400
401 /* use different colors for different teams */
402 if (LE_IsCivilian(le)) {
403 color[0] = 1;
404 } else if (le->team != cls.team) {
405 color[1] = 0;
406 color[0] = 1;
407 }
408
409 /* show dead actors in full black */
410 if (LE_IsDead(le)) {
411 Vector4Set(color, 0, 0, 0, 0.3);
412 }
413}
414
415static void UI_RadarNodeDrawArrays (const vec4_t color, vec2_t coords[4], vec2_t vertices[4], const image_t* image)
416{
417 R_Color(color);
418 R_DrawImageArray((const vec2_t*)coords, (const vec2_t*)vertices, image);
419 R_Color(nullptr);
420}
421
422static void UI_RadarNodeDrawItem (const le_t* le, const vec3_t pos)
423{
424}
425
426static void UI_RadarNodeDrawActor (const le_t* le, const vec3_t pos)
427{
428 vec2_t coords[4];
429 vec2_t vertices[4];
430 int i;
431 const float size = 10;
432 const int tileSize = 28;
433 int tilePos = 4;
434 const image_t* image;
435 vec4_t color;
436 const float pov = directionAngles[le->angle] * torad + M_PI;
437
438 image = UI_LoadImage("ui/radar");
439 if (image == nullptr)
440 return;
441
442 /* draw FOV */
443 if (!LE_IsDead(le)) {
444 vertices[0][0] = - size * 4;
445 vertices[0][1] = + 0;
446 vertices[1][0] = + size * 4;
447 vertices[1][1] = + 0;
448 vertices[2][0] = + size * 4;
449 vertices[2][1] = - size * 4;
450 vertices[3][0] = - size * 4;
451 vertices[3][1] = - size * 4;
452 coords[0][0] = (7) / 128.0f;
453 coords[0][1] = (37 + 63) / 128.0f;
454 coords[1][0] = (7 + 114) / 128.0f;
455 coords[1][1] = (37 + 63) / 128.0f;
456 coords[2][0] = (7 + 114) / 128.0f;
457 coords[2][1] = (37) / 128.0f;
458 coords[3][0] = (7) / 128.0f;
459 coords[3][1] = (37) / 128.0f;
460
461 /* affine transformation */
462 for (i = 0; i < 4; i++) {
463 const float dx = vertices[i][0];
464 const float dy = vertices[i][1];
465 vertices[i][0] = pos[0] + dx * sin(pov) + dy * cos(pov);
466 vertices[i][1] = pos[1] + dx * cos(pov) - dy * sin(pov);
467 }
468
469 UI_RadarNodeGetActorColor(le, color);
470 if (LE_IsSelected(le)) {
471 color[3] *= 0.75;
472 } else {
473 color[3] = 0.1f;
474 }
475 UI_RadarNodeDrawArrays(color, coords, vertices, image);
476 }
477
478 if (LE_IsDead(le))
479 tilePos = 4;
480 else if (LE_IsSelected(le))
481 tilePos = 66;
482 else
483 tilePos = 36;
484
485 /* a 0,0 centered square */
486 vertices[0][0] = - size;
487 vertices[0][1] = + size;
488 vertices[1][0] = + size;
489 vertices[1][1] = + size;
490 vertices[2][0] = + size;
491 vertices[2][1] = - size;
492 vertices[3][0] = - size;
493 vertices[3][1] = - size;
494 coords[0][0] = (tilePos) / 128.0f;
495 coords[0][1] = (5 + tileSize) / 128.0f;
496 coords[1][0] = (tilePos + tileSize) / 128.0f;
497 coords[1][1] = (5 + tileSize) / 128.0f;
498 coords[2][0] = (tilePos + tileSize) / 128.0f;
499 coords[2][1] = (5) / 128.0f;
500 coords[3][0] = (tilePos) / 128.0f;
501 coords[3][1] = (5) / 128.0f;
502
503 /* affine transformation */
504 for (i = 0; i < 4; i++) {
505 const float dx = vertices[i][0];
506 const float dy = vertices[i][1];
507 vertices[i][0] = pos[0] + dx * sin(pov) + dy * cos(pov);
508 vertices[i][1] = pos[1] + dx * cos(pov) - dy * sin(pov);
509 }
510
511 UI_RadarNodeGetActorColor(le, color);
512 UI_RadarNodeDrawArrays(color, coords, vertices, image);
513}
514
515/*#define RADARSIZE_DEBUG*/
516
523{
524 vec2_t pos;
525 vec2_t screenPos;
526#ifdef RADARSIZE_DEBUG
527 int textposy = 40;
528 static const vec4_t red = {1, 0, 0, 0.5};
529#endif
530
531 static const vec4_t backgroundColor = {0.0, 0.0, 0.0, 1};
532 const float mapWidth = cl.mapData->mapBox.getWidthX();
533 const float mapHeight = cl.mapData->mapBox.getWidthY();
534
536 const float mapCoefX = (float) node->box.size[0] / (float) mapWidth;
537 const float mapCoefY = (float) node->box.size[1] / (float) mapHeight;
538
539 if (cls.state != ca_active)
540 return;
541
542 UI_GetNodeAbsPos(node, pos);
543 UI_GetNodeScreenPos(node, screenPos);
544 R_CleanupDepthBuffer(pos[0], pos[1], node->box.size[0], node->box.size[1]);
545 UI_DrawFill(pos[0], pos[1], mapWidth * mapCoefX, mapHeight * mapCoefY, backgroundColor);
546#ifndef RADARSIZE_DEBUG
547 UI_PushClipRect(screenPos[0], screenPos[1], node->box.size[0], node->box.size[1]);
548#endif
549
550 /* the cl struct is wiped with every new map */
551 if (!cl.radarInitialized) {
552 UI_InitRadar(node);
553 cl.radarInitialized = true;
554 }
555
556 /* update context */
557 radar.x = pos[0];
558 radar.y = pos[1];
559 radar.w = node->box.size[0];
560 radar.h = node->box.size[1];
561 if (radar.gridWidth < 6)
562 radar.gridWidth = 6;
563 if (radar.gridHeight < 6)
564 radar.gridHeight = 6;
565
566#ifdef RADARSIZE_DEBUG
567 UI_DrawStringInBox("f_small", ALIGN_UL, 50, textposy, 500, 25, va("%fx%f %fx%f map", cl.mapData->mapBox.getMinX(), cl.mapData->mapBox.getMinY(), cl.mapData->getMaxX(), cl.mapData->getMaxY()));
568 textposy += 25;
569 UI_DrawStringInBox("f_small", ALIGN_UL, 50, textposy, 500, 25, va("%fx%f map", mapWidth, mapHeight));
570 textposy += 25;
571#endif
572
573 /* draw background */
574 for (int i = 0; i < radar.numImages; i++) {
575 vec2_t imagePos;
576 hudRadarImage_t* tile = &radar.images[i];
577 int maxlevel = cl_worldlevel->integer;
578
579 /* check the max level value for this map tile */
580 if (maxlevel >= tile->maxlevel)
581 maxlevel = tile->maxlevel - 1;
582 assert(tile->path[maxlevel]);
583 imagePos[0] = radar.x + mapCoefX * (tile->mapX - cl.mapData->mapBox.getMinX());
584 imagePos[1] = radar.y + mapCoefY * (tile->mapY - cl.mapData->mapBox.getMinY());
585
586 UI_DrawNormImageByName(false, imagePos[0], imagePos[1],
587 mapCoefX * tile->mapWidth, mapCoefY * tile->mapHeight,
588 0, 0, 0, 0, tile->path[maxlevel]);
589#ifdef RADARSIZE_DEBUG
590 UI_DrawStringInBox("f_small", ALIGN_UL, 50, textposy, 500, 25, va("%dx%d %dx%d %s", tile->x, tile->y, tile->width, tile->height, tile->path[maxlevel]));
591 textposy += 25;
592 UI_DrawStringInBox("f_small", ALIGN_UL, imagePos[0], imagePos[1], 500, 25, va("%dx%d", tile->gridX, tile->gridY));
593#endif
594 }
595
596#ifdef RADARSIZE_DEBUG
597 UI_DrawFill(pos[0], pos[1], 100.0f * mapCoefX, 100.0f * mapCoefY, red);
598 UI_DrawFill(pos[0], pos[1], UNIT_SIZE * mapCoefX, UNIT_SIZE * mapCoefY, red);
599#endif
600
601 le_t* le = nullptr;
602 while ((le = LE_GetNextInUse(le))) {
603 vec3_t itempos;
604 if (LE_IsInvisible(le))
605 continue;
606
607 /* convert to radar area coordinates */
608 itempos[0] = pos[0] + (le->origin[0] - cl.mapData->mapBox.getMinX()) * mapCoefX;
609 itempos[1] = pos[1] + (mapHeight - (le->origin[1] - cl.mapData->mapBox.getMinY())) * mapCoefY;
610
611 switch (le->type) {
612 case ET_ACTOR:
613 case ET_ACTOR2x2:
614 UI_RadarNodeDrawActor(le, itempos);
615 break;
616 case ET_ITEM:
617 UI_RadarNodeDrawItem(le, itempos);
618 break;
619 default:
620 break;
621 }
622#ifdef RADARSIZE_DEBUG
623 UI_DrawStringInBox("f_small", ALIGN_UL, 50, textposy, 500, 25, va("%fx%f %dx%d actor", le->origin[0], le->origin[1], le->pos[0], le->pos[1]));
624 textposy += 25;
625 UI_DrawFill(itempos[0], itempos[1], UNIT_SIZE * mapCoefX, 1, red);
626 UI_DrawFill(itempos[0], itempos[1], 1, UNIT_SIZE * mapCoefY, red);
627#endif
628 }
629
630#ifndef RADARSIZE_DEBUG
632#endif
633}
634
639{
640 const float mapWidth = cl.mapData->mapBox.getWidthX();
641 const float mapHeight = cl.mapData->mapBox.getWidthY();
642 const float mapCoefX = node->box.size[0] / mapWidth;
643 const float mapCoefY = node->box.size[1] / mapHeight;
644 vec3_t pos;
645
646 /* from absolute to relative to node */
647 UI_NodeAbsoluteToRelativePos(node, &x, &y);
648
649 /* from node to map */
650 pos[0] = cl.mapData->mapBox.getMinX() + x / mapCoefX;
651 pos[1] = cl.mapData->mapBox.getMaxY() - y / mapCoefY;
652 pos[2] = 0;
653
654 VectorCopy(pos, cl.cam.origin);
655}
656
657void uiRadarNode::onMouseDown (uiNode_t* node, int x, int y, int button)
658{
659 if (node->disabled)
660 return;
661
662 if (button == K_MOUSE1) {
663 UI_SetMouseCapture(node);
664 onCapturedMouseMove(node, x, y);
665 }
666}
667
668void uiRadarNode::onMouseUp (uiNode_t* node, int x, int y, int button)
669{
670 if (button == K_MOUSE1)
672}
673
677
679{
680}
681
683{
684 behaviour->name = "radar";
685 behaviour->manager = UINodePtr(new uiRadarNode());
686 behaviour->lua_SWIG_typeinfo = UI_SWIG_TypeQuery("uiRadarNode_t *");
687}
char * CL_GetConfigString(int index)
clientBattleScape_t cl
cvar_t * cl_worldlevel
Definition cl_hud.cpp:46
HUD related routines.
@ K_MOUSE1
Definition cl_keys.h:46
le_t * LE_GetNextInUse(le_t *lastLE)
Iterate through the entities that are in use.
#define LE_IsDead(le)
#define LE_IsInvisible(le)
#define LE_IsSelected(le)
#define LE_IsCivilian(le)
client_static_t cls
Definition cl_main.cpp:83
void R_Color(const vec4_t rgba)
Change the color to given value.
Definition r_state.cpp:1011
@ ca_active
Definition cl_shared.h:80
void onMouseUp(uiNode_t *node, int x, int y, int button) override
void onWindowClosed(uiNode_t *node) override
void onMouseDown(uiNode_t *node, int x, int y, int button) override
void draw(uiNode_t *node) override
void onWindowOpened(uiNode_t *node, linkedList_t *params) override
void onCapturedMouseMove(uiNode_t *node, int x, int y) override
Called when the node is captured by the mouse.
Primary header for client.
void Com_Error(int code, const char *fmt,...)
Definition common.cpp:459
void Com_Printf(const char *const fmt,...)
Definition common.cpp:428
#define ERR_DROP
Definition common.h:211
static const vec4_t red
#define MAP_SIZE_OFFSET
Definition defines.h:388
#define UNIT_SIZE
Definition defines.h:121
#define PATHFINDING_HEIGHT
15 max, adjusting above 8 will require a rewrite to the DV code
Definition defines.h:294
int FS_CheckFile(const char *fmt,...)
Just returns the filelength and -1 if the file wasn't found.
Definition files.cpp:298
#define MAX_QPATH
Definition filesys.h:40
level_locals_t level
Definition g_main.cpp:38
voidpf void uLong size
Definition ioapi.h:42
voidpf uLong offset
Definition ioapi.h:45
const float directionAngles[CORE_DIRECTIONS]
Definition mathlib.cpp:105
#define torad
Definition mathlib.h:50
#define M_PI
Definition mathlib.h:34
#define Mem_Free(ptr)
Definition mem.h:35
#define Mem_StrDup(in)
Definition mem.h:48
const char * Com_Parse(const char *data_p[], char *target, size_t size, bool replaceWhitespaces)
Parse a token out of a string.
Definition parse.cpp:107
Shared parsing functions.
#define CS_TILES
Definition q_shared.h:325
#define CS_POSITIONS
Definition q_shared.h:326
@ ET_ACTOR
Definition q_shared.h:148
@ ET_ACTOR2x2
Definition q_shared.h:160
@ ET_ITEM
Definition q_shared.h:149
const image_t * R_DrawImageArray(const vec2_t texcoords[4], const vec2_t verts[4], const image_t *image)
Definition r_draw.cpp:357
void R_CleanupDepthBuffer(int x, int y, int width, int height)
"Clean up" the depth buffer into a rect
Definition r_draw.cpp:596
QGL_EXTERN GLint i
Definition r_gl.h:113
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition r_gl.h:110
image_t * R_FindImage(const char *pname, imagetype_t type)
Finds or loads the given image.
Definition r_image.cpp:603
@ it_pic
Definition r_image.h:45
@ ALIGN_UL
Definition scripts.h:90
Header for lua script functions.
#define OBJZERO(obj)
Definition shared.h:178
#define MAX_VAR
Definition shared.h:36
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
Definition shared.cpp:457
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
Definition shared.cpp:494
const char * va(const char *format,...)
does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functi...
Definition shared.cpp:410
char base[MAX_QPATH]
hudRadarImage_t images[MAX_MAPTILES]
Each maptile must have an entry in the images array.
char * path[PATHFINDING_HEIGHT]
int height
Definition r_image.h:64
int width
Definition r_image.h:64
a local entity
vec3_t origin
int angle
pos3_t pos
entity_type_t type
node behaviour, how a node work
const char * name
void * lua_SWIG_typeinfo
UINodePtr manager
vec2_t size
Definition ui_nodes.h:52
Atomic structure used to define most of the UI.
Definition ui_nodes.h:80
bool disabled
Definition ui_nodes.h:102
uiBox_t box
Definition ui_nodes.h:96
vec_t vec3_t[3]
Definition ufotypes.h:39
vec_t vec4_t[4]
Definition ufotypes.h:40
vec_t vec2_t[2]
Definition ufotypes.h:38
void UI_SetMouseCapture(uiNode_t *node)
Captured the mouse into a node.
Definition ui_input.cpp:516
void UI_MouseRelease(void)
Release the captured node.
Definition ui_input.cpp:526
void * UI_SWIG_TypeQuery(const char *name)
This function queries the SWIG type table for a type information structure. It is used in combination...
void UI_NodeAbsoluteToRelativePos(const uiNode_t *node, int *x, int *y)
Update an absolute position to a relative one.
Definition ui_node.cpp:604
void UI_GetNodeAbsPos(const uiNode_t *node, vec2_t pos)
Returns the absolute position of a node.
Definition ui_node.cpp:526
void UI_GetNodeScreenPos(const uiNode_t *node, vec2_t pos)
Returns the absolute position of a node in the screen. Screen position is not used for the node rende...
Definition ui_node.cpp:554
SharedPtr< uiNode > UINodePtr
static void UI_RadarNodeDrawItem(const le_t *le, const vec3_t pos)
static char const *const imageExtensions[]
static bool UI_CheckRadarImage(const char *imageName, const int level)
static void UI_RadarNodeDrawArrays(const vec4_t color, vec2_t coords[4], vec2_t vertices[4], const image_t *image)
static void UI_InitRadar(const uiNode_t *node)
Calculate some radar values that won't change during a mission.
void UI_RegisterRadarNode(uiBehaviour_t *behaviour)
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 imagen...
static void UI_FreeRadarImages(void)
static void UI_RadarNodeGetActorColor(const le_t *le, vec4_t color)
static void UI_RadarNodeDrawActor(const le_t *le, const vec3_t pos)
static hudRadar_t radar
static void UI_GetRadarWidth(const uiNode_t *node, vec2_t gridSize)
Get the width of radar.
const struct image_s * UI_LoadImage(const char *name)
Searches for an image in the image array.
Definition ui_render.cpp:91
int UI_DrawStringInBox(const char *fontID, align_t align, int x, int y, int width, int height, const char *text, longlines_t method)
draw a line into a bounding box
const image_t * UI_DrawNormImageByName(bool flip, float x, float y, float w, float h, float sh, float th, float sl, float tl, const char *name)
Draws an image or parts of it.
void UI_PushClipRect(int x, int y, int width, int height)
Definition ui_render.cpp:47
void UI_DrawFill(int x, int y, int w, int h, const vec4_t color)
Fills a box of pixels with a single color.
Definition ui_render.cpp:37
void UI_PopClipRect(void)
Definition ui_render.cpp:52
#define Vector4Set(v, r, g, b, a)
Definition vector.h:62
#define VectorSubtract(a, b, dest)
Definition vector.h:45
#define VectorCopy(src, dest)
Definition vector.h:51
#define Vector2Set(v, x, y)
Definition vector.h:61
#define Vector2Dist(a, b)
Definition vector.h:70
#define VectorAdd(a, b, dest)
Definition vector.h:47
#define VectorSet(v, x, y, z)
Definition vector.h:59
#define Vector2Copy(src, dest)
Definition vector.h:52