do bouncing client side (sound is still server side)
[divverent/nexuiz.git] / data / qcsrc / client / View.qc
1 vector angles_held[24];\r
2 void Net_ReadHoldAngles()\r
3 {\r
4         float wpn;\r
5         vector v;\r
6         wpn = ReadByte();\r
7         --wpn;\r
8         angles_held_status[wpn] = ReadByte();\r
9         if(angles_held_status[wpn])\r
10         {\r
11                 v_x = ReadCoord();\r
12                 v_y = ReadCoord();\r
13                 v_z = 0;\r
14                 angles_held[wpn] = v;\r
15         }\r
16 }\r
17 \r
18 entity porto;\r
19 vector polyline[16];\r
20 float trace_dphitcontents;\r
21 float Q3SURFACEFLAG_SLICK = 2; // low friction surface\r
22 float DPCONTENTS_PLAYERCLIP = 256; // blocks player movement\r
23 void Porto_Draw()\r
24 {\r
25         vector p, dir, ang, q, nextdir;\r
26         float idx, portal_number, portal1_idx;\r
27 \r
28         if(activeweapon != WEP_PORTO)\r
29                 return;\r
30 \r
31         dir = view_forward;\r
32 \r
33         if(angles_held_status[WEP_PORTO-1])\r
34         {\r
35                 makevectors(angles_held[WEP_PORTO-1]);\r
36                 dir = v_forward;\r
37         }\r
38 \r
39         p = view_origin;\r
40 \r
41         polyline[0] = p;\r
42         idx = 1;\r
43         portal_number = 0;\r
44         nextdir = dir;\r
45 \r
46         for(;;)\r
47         {\r
48                 dir = nextdir;\r
49                 traceline(p, p + 65536 * dir, TRUE, world);\r
50                 if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)\r
51                         return;\r
52                 nextdir = dir - 2 * (dir * trace_plane_normal) * trace_plane_normal; // mirror dir at trace_plane_normal\r
53                 p = trace_endpos;\r
54                 polyline[idx] = p;\r
55                 ++idx;\r
56                 if(idx >= 16)\r
57                         return;\r
58                 if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK || trace_dphitcontents & DPCONTENTS_PLAYERCLIP)\r
59                         continue;\r
60                 ++portal_number;\r
61                 ang = vectoangles2(trace_plane_normal, dir);\r
62                 ang_x = -ang_x;\r
63                 makevectors(ang);\r
64                 if(!CheckWireframeBox(porto, p - 48 * v_right - 48 * v_up + 16 * v_forward, 96 * v_right, 96 * v_up, 96 * v_forward))\r
65                         return;\r
66                 if(portal_number == 1)\r
67                         portal1_idx = idx;\r
68                 if(portal_number >= 2)\r
69                         break;\r
70         }\r
71 \r
72         while(idx >= 2)\r
73         {\r
74                 p = polyline[idx-2];\r
75                 q = polyline[idx-1];\r
76                 if(idx == 2)\r
77                         p = p - view_up * 16;\r
78                 if(idx-1 >= portal1_idx)\r
79                 {\r
80                         Draw_CylindricLine(p, q, 4, "", 1, 0, '0 0 1', 0.5, DRAWFLAG_NORMAL);\r
81                 }\r
82                 else\r
83                 {\r
84                         Draw_CylindricLine(p, q, 4, "", 1, 0, '1 0 0', 0.5, DRAWFLAG_NORMAL);\r
85                 }\r
86                 --idx;\r
87         }\r
88 }\r
89 \r
90 float DPCONTENTS_SOLID = 1; // hit a bmodel, not a bounding box\r
91 float DPCONTENTS_BODY = 32; // hit a bounding box, not a bmodel\r
92 void Porto_Init()\r
93 {\r
94         porto = spawn();\r
95         porto.classname = "porto";\r
96         porto.draw = Porto_Draw;\r
97         porto.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP;\r
98 }\r
99 \r
100 float drawtime;\r
101 \r
102 float tan(float x)\r
103\r
104         return sin(x) / cos(x);\r
105 }\r
106 float atan2(float y, float x)\r
107 {\r
108         vector v;\r
109         v = '1 0 0' * x + '0 1 0' * y;\r
110         v = vectoangles(v);\r
111         return v_y * 0.01745329251994329576;\r
112 }\r
113 \r
114 vector GetCurrentFov(float fov)\r
115 {\r
116         float zoomsensitivity, zoomspeed, zoomfactor, zoomdir;\r
117 \r
118         zoomsensitivity = cvar("cl_zoomsensitivity");\r
119         zoomfactor = cvar("cl_zoomfactor");\r
120         if(zoomfactor < 1 || zoomfactor > 16)\r
121                 zoomfactor = 2.5;\r
122         zoomspeed = cvar("cl_zoomspeed");\r
123         if(zoomspeed >= 0)\r
124                 if(zoomspeed < 0.5 || zoomspeed > 16)\r
125                         zoomspeed = 3.5;\r
126 \r
127         zoomdir = button_zoom;\r
128         if(getstati(STAT_ACTIVEWEAPON) == WEP_NEX) // do NOT use switchweapon here\r
129                 zoomdir += button_attack2;\r
130         if(spectatee_status > 0 || isdemo())\r
131         {\r
132                 if(spectatorbutton_zoom)\r
133                         zoomdir = 0 + !zoomdir;\r
134                         // do not even THINK about removing this 0\r
135                         // _I_ know what I am doing\r
136                         // fteqcc does not\r
137         }\r
138 \r
139         if(zoomdir)\r
140                 zoomin_effect = 0;\r
141 \r
142         if(zoomin_effect)\r
143         {\r
144                 current_viewzoom = min(1, current_viewzoom + drawframetime);\r
145         }\r
146         else\r
147         {\r
148                 if(zoomspeed < 0) // instant zoom\r
149                 {\r
150                         if(zoomdir)\r
151                                 current_viewzoom = 1 / zoomfactor;\r
152                         else\r
153                                 current_viewzoom = 1;\r
154                 }\r
155                 else\r
156                 {\r
157                         if(zoomdir)\r
158                                 current_viewzoom = 1 / bound(1, 1 / current_viewzoom + drawframetime * zoomspeed * (zoomfactor - 1), zoomfactor);\r
159                         else\r
160                                 current_viewzoom = bound(1 / zoomfactor, current_viewzoom + drawframetime * zoomspeed * (1 - 1 / zoomfactor), 1);\r
161                 }\r
162         }\r
163 \r
164         if(almost_equals(current_viewzoom, 1))\r
165                 current_zoomfraction = 0;\r
166         else if(almost_equals(current_viewzoom, 1/zoomfactor))\r
167                 current_zoomfraction = 1;\r
168         else\r
169                 current_zoomfraction = (current_viewzoom - 1) / (1/zoomfactor - 1);\r
170 \r
171         if(zoomsensitivity < 1)\r
172                 setsensitivityscale(pow(current_viewzoom, 1 - zoomsensitivity));\r
173         else\r
174                 setsensitivityscale(1);\r
175 \r
176         float frustumx, frustumy, fovx, fovy;\r
177         frustumy = tan(fov * 0.00872664625997164788) * 0.75 * current_viewzoom;\r
178         frustumx = frustumy * vid_width / vid_height / vid_pixelheight;\r
179         fovx = atan2(frustumx, 1) / 0.00872664625997164788;\r
180         fovy = atan2(frustumy, 1) / 0.00872664625997164788;\r
181 \r
182         return '1 0 0' * fovx + '0 1 0' * fovy;\r
183 }\r
184 \r
185 void CSQC_common_hud(void);\r
186 \r
187 void CSQC_kh_hud(void);\r
188 void CSQC_ctf_hud(void);\r
189 void PostInit(void);\r
190 float Sbar_WouldDrawScoreboard ();\r
191 float zoomscript_caught;\r
192 float view_set;\r
193 float camera_mode;\r
194 vector camera_offset, current_origin, mouse_angles, current_camera_offset, new_angles;\r
195 void CSQC_UpdateView(float w, float h)\r
196 {\r
197         entity e;\r
198         float fov;\r
199         float f;\r
200         vector v1, v2;\r
201 \r
202         dprint_load();\r
203         WaypointSprite_Load();\r
204 \r
205         ticrate = getstatf(STAT_SYS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE);\r
206 \r
207         // Render the Scene\r
208         if(!intermission || !view_set)\r
209         {\r
210                 view_origin = pmove_org + '0 0 1' * getstati(STAT_VIEWHEIGHT);\r
211                 view_angles = input_angles;\r
212                 makevectors(view_angles);\r
213                 view_forward = v_forward;\r
214                 view_right = v_right;\r
215                 view_up = v_up;\r
216                 view_set = 1;\r
217         }\r
218 \r
219         f = floor(cvar("v_flipped"));\r
220         cvar_set("v_flipped", ftos(!f));\r
221         v1 = cs_unproject('-100 -100 1000');\r
222         cvar_set("v_flipped", ftos(f));\r
223         v2 = cs_unproject('-100 -100 1000');\r
224 \r
225         if(v1 == v2)\r
226         {\r
227                 // non-supporting engine\r
228                 vid_width = cvar("vid_width");\r
229                 vid_height = cvar("vid_height");\r
230         }\r
231         else\r
232         {\r
233                 // supporting engine\r
234                 vid_width = w;\r
235                 vid_height = h;\r
236         }\r
237 \r
238 #ifdef BLURTEST\r
239         if(time > blurtest_time0 && time < blurtest_time1)\r
240         {\r
241                 float r, t;\r
242 \r
243                 t = (time - blurtest_time0) / (blurtest_time1 - blurtest_time0);\r
244                 r = t * blurtest_radius;\r
245                 f = 1 / pow(t, blurtest_power) - 1;\r
246 \r
247                 cvar_set("r_glsl_postprocess", "1");\r
248                 cvar_set("r_glsl_postprocess_uservec1", strcat(ftos(r), " ", ftos(f), " 0 0"));\r
249         }\r
250         else\r
251         {\r
252                 cvar_set("r_glsl_postprocess", "0");\r
253                 cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");\r
254         }\r
255 #endif\r
256 \r
257         Fog_Force();\r
258 \r
259         drawframetime = max(0.000001, time - drawtime);\r
260         drawtime = time;\r
261 \r
262         // watch for gametype changes here...\r
263         // in ParseStuffCMD the cmd isn't executed yet :/\r
264         // might even be better to add the gametype to TE_CSQC_INIT...?\r
265         if(!postinit)\r
266                 PostInit();\r
267 \r
268         fov = cvar("fov");\r
269         if(button_zoom || fov <= 59.5)\r
270         {\r
271                 if(!zoomscript_caught)\r
272                 {\r
273                         localcmd("+button4\n");\r
274                         zoomscript_caught = 1;\r
275                         ignore_plus_zoom += 1;\r
276                 }\r
277         }\r
278         else\r
279         {\r
280                 if(zoomscript_caught)\r
281                 {\r
282                         localcmd("-button4\n");\r
283                         zoomscript_caught = 0;\r
284                         ignore_minus_zoom += 1;\r
285                 }\r
286         }\r
287         \r
288         sbar_alpha_fg = cvar("sbar_alpha_fg" );\r
289         sbar_hudselector = cvar("sbar_hudselector");\r
290         ColorTranslateMode = cvar("cl_stripcolorcodes");\r
291         activeweapon = getstati(STAT_SWITCHWEAPON);\r
292         f = cvar("teamplay");\r
293         if(f != teamplay)\r
294         {\r
295                 teamplay = f;\r
296                 Sbar_InitScores();\r
297         }\r
298 \r
299         if(last_weapon != activeweapon) {\r
300                 weapontime = time;\r
301                 last_weapon = activeweapon;\r
302         }\r
303 \r
304         // ALWAYS Clear Current Scene First\r
305         R_ClearScene();\r
306 \r
307         // Assign Standard Viewflags\r
308         // Draw the World (and sky)\r
309         R_SetView(VF_DRAWWORLD, 1);\r
310 \r
311         R_SetView(VF_FOV, GetCurrentFov(fov));\r
312 \r
313         // Camera for demo playback\r
314         if (cvar("chase_active") > 1 && cvar("cl_demo_mousegrab") && isdemo())\r
315         {\r
316                 float speed, attenuation;\r
317                 vector new_origin, m;\r
318 \r
319                 if(cvar("camera_free"))\r
320                         speed = cvar("camera_speed_free");\r
321                 else\r
322                         speed = cvar("camera_speed_chase");\r
323                         \r
324                 attenuation = cvar("camera_speed_attenuation");\r
325                 \r
326                 attenuation = 1 / max(1, attenuation);\r
327 \r
328                 if( cvar("camera_reset") || !camera_mode )\r
329                 {\r
330                         camera_offset = '0 0 0';\r
331                         new_angles = view_angles;\r
332                         camera_offset_z += 20;\r
333                         camera_offset_x -= 20 * cos(new_angles_y * DEG2RAD);\r
334                         camera_offset_y -= 20 * sin(new_angles_y * DEG2RAD);\r
335                         current_origin = view_origin;\r
336                 }\r
337 \r
338                 // Camera angles\r
339                 if( cvar("camera_roll") )\r
340                         mouse_angles_z += cvar("camera_roll") * cvar("camera_speed_roll");\r
341 \r
342                 m = getmousepos() * 0.1;\r
343                 if(vlen(m)>cvar("camera_mouse_treshold"))\r
344                 {\r
345                         mouse_angles_x += m_y * cos(mouse_angles_z * DEG2RAD) + (m_x * sin(mouse_angles_z * DEG2RAD));\r
346                         mouse_angles_y -= m_x * cos(mouse_angles_z * DEG2RAD) + (m_y * -sin(mouse_angles_z * DEG2RAD));\r
347                 }\r
348                 \r
349                 new_angles += (mouse_angles - new_angles) * attenuation;\r
350                 \r
351                 // Camera position\r
352                 if( cvar("camera_direction_x") )\r
353                 {\r
354                         camera_offset_x += cvar("camera_direction_x") * speed * cos(new_angles_y * DEG2RAD);\r
355                         camera_offset_y += cvar("camera_direction_x") * speed * sin(new_angles_y * DEG2RAD);\r
356                 }\r
357 \r
358                 if( cvar("camera_direction_y") )\r
359                 {\r
360                         camera_offset_y += cvar("camera_direction_y") * speed * cos(new_angles_y * DEG2RAD) * cos(new_angles_z * DEG2RAD);\r
361                         camera_offset_x += cvar("camera_direction_y") * speed * -sin(new_angles_y * DEG2RAD);\r
362                         camera_offset_z += cvar("camera_direction_y") * speed * sin(new_angles_z * DEG2RAD);\r
363                 }\r
364 \r
365                 if( cvar("camera_direction_z") )\r
366                         camera_offset_z += cvar("camera_direction_z") * speed * cos(new_angles_z * DEG2RAD);\r
367 \r
368                 current_camera_offset += (camera_offset - current_camera_offset) * attenuation;\r
369 \r
370                 // Camera modes\r
371                 if( cvar("camera_free") )\r
372                 {\r
373                         if ( camera_mode == CAMERA_CHASE )\r
374                         {\r
375                                 current_camera_offset = current_origin + current_camera_offset;\r
376                                 camera_offset = current_origin + camera_offset;\r
377                         }\r
378 \r
379                         camera_mode = CAMERA_FREE;\r
380                         new_origin = current_camera_offset;\r
381                 }\r
382                 else\r
383                 {\r
384                         if ( camera_mode == CAMERA_FREE )\r
385                         {\r
386                                 current_origin = view_origin;\r
387                                 camera_offset = camera_offset - current_origin;\r
388                                 current_camera_offset = current_camera_offset - current_origin;\r
389                         }\r
390 \r
391                         camera_mode = CAMERA_CHASE;\r
392                         \r
393                         if(cvar("camera_chase_smoothly"))\r
394                                 current_origin += (view_origin - current_origin) * attenuation;\r
395                         else\r
396                                 current_origin = view_origin;\r
397                                 \r
398                         new_origin = current_origin + current_camera_offset;\r
399                 }\r
400 \r
401                 R_SetView(VF_ANGLES, new_angles);\r
402                 R_SetView(VF_ORIGIN, new_origin);\r
403         }\r
404         \r
405         // Draw the Crosshair\r
406         float scoreboard_active;\r
407         scoreboard_active = Sbar_WouldDrawScoreboard();\r
408         R_SetView(VF_DRAWCROSSHAIR, 0); //Make sure engine crosshairs are always hidden\r
409         \r
410         // Draw the Engine Status Bar (the default Quake HUD)\r
411         R_SetView(VF_DRAWENGINESBAR, 0);\r
412 \r
413         // Set the console size vars\r
414         vid_conwidth = cvar("vid_conwidth");\r
415         vid_conheight = cvar("vid_conheight");\r
416         vid_pixelheight = cvar("vid_pixelheight");\r
417 \r
418         // fetch this one only once per frame\r
419         sbar_showbinds = cvar("sbar_showbinds");\r
420         sbar_showbinds_limit = cvar("sbar_showbinds_limit");\r
421 \r
422         // Update the mouse position\r
423         /*\r
424         mousepos_x = vid_conwidth;\r
425         mousepos_y = vid_conheight;\r
426         mousepos = mousepos*0.5 + getmousepos();\r
427         */\r
428 \r
429         R_AddEntities(MASK_NORMAL | MASK_ENGINE | MASK_ENGINEVIEWMODELS);\r
430 \r
431         e = self;\r
432         for(self = world; (self = nextent(self)); )\r
433                 if(self.draw)\r
434                         self.draw();\r
435         self = e;\r
436         R_RenderScene();\r
437 \r
438         // now switch to 2D drawing mode by calling a 2D drawing function\r
439         // then polygon drawing will draw as 2D stuff, and NOT get queued until the\r
440         // next R_RenderScene call\r
441         drawstring('0 0 0', "", '1 1 0', '1 1 1', 0, 0);\r
442 \r
443         // crosshair\r
444         if(!scoreboard_active && !ons_showmap) {\r
445                 string wcross_wep;\r
446                 float wcross_alpha, wcross_style;\r
447                 vector wcross_color, wcross_size;\r
448                 if (cvar("crosshair_per_weapon")) {\r
449                         e = get_weaponinfo(activeweapon);\r
450                         if (e && e.netname)\r
451                                 wcross_wep = strcat("_", e.netname);\r
452                 }\r
453                 wcross_style = cvar(strcat("crosshair", wcross_wep));\r
454                 wcross_color_x = cvar(strcat("crosshair", wcross_wep, "_color_red"));\r
455                 wcross_color_y = cvar(strcat("crosshair", wcross_wep, "_color_green"));\r
456                 wcross_color_z = cvar(strcat("crosshair", wcross_wep, "_color_blue"));\r
457                 wcross_size_x = cvar(strcat("crosshair", wcross_wep, "_size")) * 24;\r
458                 wcross_size_y = cvar(strcat("crosshair", wcross_wep, "_size")) * 24;\r
459                 wcross_alpha = cvar(strcat("crosshair", wcross_wep, "_color_alpha"));\r
460                 \r
461                 drawpic('0.5 0 0' * (vid_conwidth - wcross_size_x) + '0 0.5 0' * (vid_conheight - wcross_size_y), strcat("gfx/crosshair", ftos(wcross_style)), wcross_size, wcross_color, wcross_alpha, DRAWFLAG_NORMAL);\r
462         }\r
463 \r
464         // Draw the mouse cursor\r
465         // NOTE: drawpic must happen after R_RenderScene for some reason\r
466         //drawpic(getmousepos(), "gfx/cursor.tga", '11 14 0', '1 1 1', 1, 0);\r
467         //drawstring('50 50', ftos(game), '10 10 0', '1 1 1', 1, 0);\r
468         //self = edict_num(player_localnum);\r
469         //drawstring('0 0', vtos(pmove_org), '8 8 0', '1 1 1', 1, 0);\r
470         //drawstring('0 8', strcat("ORG: ", vtos(self.origin), " state: ", ftos(self.ctf_state), " HP: ", ftos(self.health)), '8 8 0', '1 1 1', 1, 0);\r
471         // as long as the ctf part isn't in, this is useless\r
472         if(menu_visible)\r
473                 menu_show();\r
474         \r
475         /*if(gametype == GAME_CTF)\r
476         {\r
477                 ctf_view();\r
478         } else */\r
479 \r
480         // draw 2D entities\r
481         e = self;\r
482         for(self = world; (self = nextent(self)); )\r
483                 if(self.draw2d)\r
484                         self.draw2d();\r
485         self = e;\r
486         \r
487         // draw radar\r
488         if(teamplay || cvar("cl_teamradar") == 2)\r
489         {\r
490                 if((cvar_string("cl_teamradar") != "0" && !scoreboard_active) || ons_showmap)\r
491                         teamradar_view();\r
492         }\r
493 \r
494         // draw sbar\r
495         if(cvar("r_letterbox") == 0)\r
496         if(cvar("viewsize") < 120)\r
497                 CSQC_common_hud();\r
498 }\r
499 \r
500 void Sbar_Draw();\r
501 void CSQC_common_hud(void)\r
502 {\r
503         // Sbar_SortFrags(); done in Sbar_Draw\r
504         Sbar_Draw();\r
505 }\r
506 \r
507 // KeyHunt HUD by victim\r
508 void CSQC_kh_hud(void)\r
509 {\r
510         // HUD 0 has the weapons on the right hand side - temporarily shown when needed\r
511         // HUD 1 has the weapons on the bottom - permanently\r
512 \r
513         // use the following two binds to check the icons move correctly\r
514         // bind g "toggle sbar_flagstatus_right; echo Menu right $sbar_flagstatus_right"  // move the icons\r
515         // bind h "toggle sbar_hudselector; echo HUD $sbar_hudselector"  // change the HUD\r
516 \r
517         float kh_keys, kh_keys_status, kh_teams_set;\r
518         float kh_margin_x, kh_margin_y, kh_key_box;\r
519         string kh_carrying, kh_outline;\r
520         vector red_pos, blue_pos, yellow_pos, pink_pos, kh_size;\r
521         vector red, blue, yellow, pink;\r
522 \r
523         kh_keys = getstati(STAT_KH_KEYS);\r
524         kh_keys_status = kh_keys / 256;\r
525         kh_teams_set = cvar("_teams_available");  // set in keyhunt.qc\r
526 \r
527         kh_margin_y = 8;\r
528         kh_margin_x = (cvar("sbar_flagstatus_right") * sbar_hudselector * (vid_conwidth - 67)) + 10;\r
529 //      sbar_flagstatus_right 0/1; sbar_hudselector 0/1; screen width - key width + margin\r
530 \r
531         red_pos_x = blue_pos_x = yellow_pos_x = pink_pos_x = kh_margin_x;\r
532 \r
533         kh_key_box = 120;\r
534 \r
535         pink_pos_y = kh_margin_y + 0;  // top\r
536         yellow_pos_y = kh_margin_y + kh_key_box;\r
537         blue_pos_y = kh_margin_y + kh_key_box * 2;\r
538         red_pos_y = kh_margin_y + kh_key_box * 3;  //bottom\r
539 \r
540         red = '1 0 0';\r
541         blue = '0 0 1';\r
542         yellow = '1 1 0';\r
543         pink = '1 0 1';\r
544 \r
545         kh_size = '0 0 0';  // don't resize the image\r
546 \r
547         kh_carrying = "gfx/sb_kh_full";\r
548         kh_outline = "gfx/sb_kh_outline";\r
549 \r
550 //      drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag)\r
551 //      vector position = '0 0';  // 'x y' 0 0 (the origin) is the top left. X 0 - 799, Y 0 - 599\r
552 \r
553 //      vector size = '0 0';  // 'x y' changes the x & y dimensions. '0 0' gives the default pic size\r
554 //      vector rgb = '0 0 0';  // 'r g b' range 0 - 1\r
555 \r
556         if (kh_keys_status & 1)  // red\r
557                 drawpic (red_pos, kh_carrying, kh_size, red, 0.2, 0);  // show 20% alpha key\r
558         else\r
559                 drawpic (red_pos, kh_outline, kh_size, red, 0.4, 0);  // show key outline 40% alpha\r
560 \r
561         if (kh_keys & 1)\r
562                 drawpic (red_pos, kh_carrying, kh_size, red, 1.0, 0);  // show solid key 100% alpha\r
563 \r
564 \r
565         if (kh_keys_status & 2)  // blue\r
566                 drawpic (blue_pos, kh_carrying, kh_size, blue, 0.2, 0);\r
567         else\r
568                 drawpic (blue_pos, kh_outline, kh_size, blue, 0.4, 0);\r
569 \r
570         if (kh_keys & 2)\r
571                 drawpic (blue_pos, kh_carrying, kh_size, blue, 1.0, 0);\r
572 \r
573 \r
574         if (kh_teams_set & 4)  // yellow\r
575         {\r
576                 if (kh_keys_status & 4)\r
577                         drawpic (yellow_pos, kh_carrying, kh_size, yellow, 0.2, 0);\r
578                 else\r
579                         drawpic (yellow_pos, kh_outline, kh_size, yellow, 0.4, 0);\r
580 \r
581                 if (kh_keys & 4)\r
582                         drawpic (yellow_pos, kh_carrying, kh_size, yellow, 1.0, 0);\r
583         }\r
584 \r
585 \r
586         if (kh_teams_set & 8)  // pink\r
587         {\r
588                 if (kh_keys_status & 8)\r
589                         drawpic (pink_pos, kh_carrying, kh_size, pink, 0.2, 0);\r
590                 else\r
591                         drawpic (pink_pos, kh_outline, kh_size, pink, 0.4, 0);\r
592 \r
593                 if (kh_keys & 8)\r
594                         drawpic (pink_pos, kh_carrying, kh_size, pink, 1.0, 0);\r
595         }\r
596 \r
597 }\r