chase_active support for csqc
[divverent/nexuiz.git] / data / qcsrc / client / view.c
1 float max_ups;
2 vector angle_alive;
3
4 void View_Update (void)
5 {
6         float f;
7         string s;
8
9         vieworg = pmove_org;
10         angle_alive = input_angles;
11         makevectors(input_angles);
12
13         if(player_flags & PFL_DEAD)
14         {
15                 R_SetView(VF_ORIGIN, vieworg+'0 0 4');
16                 angle_alive_z = 80;
17                 R_SetView(VF_ANGLES, angle_alive);
18                 R_SetView(VF_CL_VIEWANGLES, angle_alive);
19                 return;
20         }
21
22         if(input_buttons & 16 && getstati(STAT_HEALTH) != 6666)
23                 vieworg += PL_CROUCH_VIEW_OFS;
24         else
25                 vieworg += PL_VIEW_OFS;
26
27         if(cvar("chase_active") && getstati(STAT_HEALTH) != 6666)
28                 vieworg = vieworg + v_up * cvar("chase_up") - v_forward * cvar("chase_back");
29
30         R_SetView(VF_ORIGIN, vieworg);
31         R_SetView(VF_ANGLES, input_angles);
32
33         if(!cvar("cg_showvelocity"))
34                 return;
35
36         f = pl_xyspeed;
37         if(max_ups < f)
38                 max_ups = f;
39         s = ftos(f);
40         s = strcat(s, " ups");
41         drawstring('1 0 0'*vid_width + '-64 64 0', s, '8 8 0', VEC_1, 1, 0);
42         s = ftos(max_ups);
43         s = strcat(s, " max");
44         drawstring('1 0 0'*vid_width + '-64 72 0', s, '8 8 0', VEC_1, 1, 0);
45 }