]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/client/ons.qc
(experimental) CSQC Hud - can be turned off with "sbar_usecsqc 0"
[divverent/nexuiz.git] / data / qcsrc / client / ons.qc
1 void() Cmd_ons_map =
2 {
3         ons_showmap = !ons_showmap;
4 };
5
6 vector(vector coord) mapcoords =
7 {
8         local vector ret;
9         ret = coord; // put that up to ret's definition and it's '0 0 0' ... stupid fteqcc
10         ret -= mi_center;
11         ret_x = ret_x * 256.0 / mi_scale_x;
12         ret_y = -ret_y * 256.0 / mi_scale_y;
13         ret_z = 0;
14         ret = ret + '400 178';
15         return ret;
16 };
17
18 void(vector coord, vector pangles, vector rgb) drawplayer =
19 {
20         makevectors(pangles);
21         v_forward_z = 0;
22         v_forward = normalize(v_forward);
23         v_forward_y *= -1.0;
24         v_right_x = -v_forward_y;
25         v_right_y = v_forward_x;
26         // Ryling on !tex[0] => texture_white
27         // beware of the order, it has to be clockwise!
28         R_BeginPolygon("", 0);
29         R_PolygonVertex(coord+v_forward*2, '0 0', rgb, 1);
30         R_PolygonVertex(coord+v_right*3-v_forward*2, '0 1', rgb, 1);
31         R_PolygonVertex(coord-v_forward, '1 0', rgb, 1);
32         R_PolygonVertex(coord-v_right*3-v_forward*2, '1 1', rgb, 1);
33         R_EndPolygon();
34 };
35
36 void() ons_view =
37 {
38         if(ons_showmap) {
39                 local float color;
40                 local vector coord, rgb;
41
42                 color = stof(getplayerkey(player_localentnum-1, "colors")) & 15;
43
44                 coord = mapcoords(pmove_org);
45                         
46                 drawpic('272 50', minimapname, '256 256', '1 1 1', 1, 0);
47                 drawpic('257 35', "gfx/ons-frame.tga", '286 286', '1 1 1', 1, 0);
48                 if(color == COLOR_TEAM_RED)
49                 {
50                         rgb = '1 0 0';
51                 } else if(color == COLOR_TEAM_BLUE) {
52                         rgb = '0 0 1';
53                 } else {
54                         rgb = '1 1 1';
55                 }
56                 drawpic('257 35', "gfx/ons-frame-team.tga", '286 286', rgb, 1, 0);
57
58                 drawplayer(coord, input_angles, '1 1 1');
59
60                 local entity tm;
61                 for(tm = gps_start; tm != world; tm = tm.chain)
62                 {
63                         //print(strcat("GPS: ", ftos(tm.sv_entnum), " - ", vtos(tm.origin), "\n"));
64                         drawplayer(mapcoords(tm.origin), tm.angles, rgb);
65                 }
66         }
67 };