fixed some bugs and design flaws in the csqc code, it works better now
[divverent/nexuiz.git] / data / qcsrc / client / main.c
1 void SysParms_UPDATE (void)
2 {
3         float f;
4
5         vid_width = cvar("vid_conwidth");
6         vid_height = cvar("vid_conheight");
7         makevectors(input_angles);
8         pl_view_forward = v_forward;
9         pl_view_right = v_right;
10         pl_view_up = v_up;
11         pl_xyspeed = floor(sqrt(pmove_vel_x*pmove_vel_x + pmove_vel_y*pmove_vel_y));
12
13         f = getstati(STAT_HEALTH);
14         spec = (f == -666);
15         if(f <= 1 && !(player_flags & PFL_DEAD))
16                 player_flags |= PFL_DEAD;
17         else if(f > 1 && player_flags & PFL_DEAD)
18                 player_flags -= player_flags & (PFL_DEAD | PFL_GIBBED);
19 }
20
21 void CSQC_Ent_Update (float isnew)
22 {
23         float i;
24         i = ReadByte();
25 }
26
27 void CSQC_Ent_Remove ()
28 {
29         remove(self);
30 };
31
32
33 void CSQC_Init (void)
34 {
35 }
36
37 void CSQC_Shutdown (void)
38 {
39 }
40
41 void CSQC_ConsoleCommand (string str)
42 {
43 }
44
45 void CSQC_UpdateView (void)
46 {
47         SysParms_UPDATE();
48         View_Update();
49
50         R_ClearScene();
51
52         R_SetView(VF_DRAWWORLD, 1);
53
54         if(getstati(STAT_HEALTH) == 6666)
55         {
56                 R_SetView(VF_DRAWCROSSHAIR, 0);
57                 R_SetView(VF_DRAWENGINESBAR, 0);
58         }
59         else
60         {
61                 R_SetView(VF_DRAWCROSSHAIR, 1);
62                 R_SetView(VF_DRAWENGINESBAR, 1);
63         }
64
65         R_AddEntities(MASK_NORMAL | MASK_ENGINE | MASK_ENGINEVIEWMODELS);
66         R_RenderScene();
67
68         if(cvar("cg_showvelocity"))
69         {
70                 local float f;
71                 local string s;
72                 f = pl_xyspeed;
73                 if(max_ups < f)
74                         max_ups = f;
75                 s = ftos(f);
76                 s = strcat(s, " ups");
77                 drawstring('1 0 0'*vid_width + '-64 64 0', s, '8 8 0', VEC_1, 1, 0);
78                 s = ftos(max_ups);
79                 s = strcat(s, " max");
80                 drawstring('1 0 0'*vid_width + '-64 72 0', s, '8 8 0', VEC_1, 1, 0);
81         }
82 }
83
84 float CSQC_InputEvent (float event, float parama)
85 {
86         return false;
87 }
88
89 void CSQC_Parse_StuffCmd (string msg)
90 {
91         // doesn't work, dp obviously doesn't execute csprogs.dat on demo playback
92         if(isdemo() && msg == "menu_showteamselect\n")
93                 return;
94         localcmd(msg);
95 }
96
97 void CSQC_Parse_Print (string msg)
98 {
99         print(msg);
100 }
101
102 void CSQC_Parse_CenterPrint (string msg)
103 {
104         cprint(msg);
105 }