File: hudnavigation.cpp

package info (click to toggle)
freespace2 3.7.4%2Brepack-1.1
  • links: PTS, VCS
  • area: non-free
  • in suites: bullseye
  • size: 22,268 kB
  • sloc: cpp: 393,535; ansic: 4,106; makefile: 1,091; xml: 181; sh: 137
file content (54 lines) | stat: -rw-r--r-- 1,489 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// HUDNavigation.cpp
// Derek Meek
// 4-30-2004



#include "autopilot/autopilot.h"
#include "hud/hud.h"
#include "hud/hudbrackets.h"
#include "hud/hudnavigation.h"
#include "hud/hudtarget.h"
#include "hud/hudtargetbox.h"
#include "object/object.h"
#include "render/3d.h"
#include "ship/ship.h"


extern void hud_target_show_dist_on_bracket(int x, int y, float distance, int font_num);
extern void draw_brackets_square_quick(int x1, int y1, int x2, int y2, int thick);

/**
 * Draws the Navigation stuff on the HUD
 */
void hud_draw_navigation()
{
	if (CurrentNav != -1 && Navs[CurrentNav].flags & NP_VALIDTYPE && !(Navs[CurrentNav].flags & NP_NOSELECT))
	{
		int in_cockpit;
		if (!(Viewer_mode & (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY)) )
			in_cockpit = 1;
		else
			in_cockpit = 0;

		vertex target_point;	// temp vertex used to find screen position for 3-D object;
		vec3d *target_pos = Navs[CurrentNav].GetPosition();

		color NavColor;
        
        memset(&target_point, 0, sizeof(target_point));

		unsigned int alpha = HUD_COLOR_ALPHA_MAX * 16;

		if (Navs[CurrentNav].flags & NP_VISITED)
			gr_init_alphacolor( &NavColor, 0xFF, 0xFF, 0x00, alpha);
		else
			gr_init_alphacolor( &NavColor, 0x80, 0x80, 0xff, alpha);

		g3_rotate_vertex(&target_point, target_pos);
		g3_project_vertex(&target_point);

		if ( in_cockpit )
			hud_target_add_display_list(NULL, &target_point, target_pos, 0, &NavColor, Navs[CurrentNav].m_NavName, TARGET_DISPLAY_DIST);
	}
}