]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/gamec/cl_client.c
restructure
[divverent/nexuiz.git] / data / qcsrc / gamec / cl_client.c
1 void info_player_start (void)
2 {
3         self.classname = "info_player_deathmatch";
4 }
5
6 void info_player_deathmatch (void)
7 {
8 }
9
10 float spawn_goodspots, spawn_badspots;
11 entity Spawn_ClassifyPoints(entity firstspot, entity playerlist, float mindist, float goodspotnum, float badspotnum)
12 {
13         local entity spot, player;
14         local float pcount;
15         spawn_goodspots = 0;
16         spawn_badspots = 0;
17         spot = firstspot;
18         while (spot)
19         {
20                 pcount = 0;
21                 player = playerlist;
22                 while (player)
23                 {
24                         if (player != self)
25                         if (vlen(player.origin - spot.origin) < 100)
26                                 pcount = pcount + 1;
27                         player = player.chain;
28                 }
29                 if (pcount)
30                 {
31                         if (spawn_goodspots >= badspotnum)
32                                 return spot;
33                         spawn_badspots = spawn_badspots + 1;
34                 }
35                 else
36                 {
37                         if (spawn_goodspots >= goodspotnum)
38                                 return spot;
39                         spawn_goodspots = spawn_goodspots + 1;
40                 }
41                 spot = find(spot, classname, "info_player_deathmatch");
42         }
43         return firstspot;
44 }
45
46 entity Spawn_FurthestPoint(entity firstspot, entity playerlist)
47 {
48         local entity best, spot, player;
49         local float bestrating, rating;
50         best = world;
51         bestrating = -1000000;
52         spot = firstspot;
53         while (spot)
54         {
55                 rating = 1000000000;
56                 player = playerlist;
57                 while (player)
58                 {
59                         if (player != self)
60                                 rating = min(rating, vlen(player.origin - spot.origin));
61                         player = player.chain;
62                 }
63                 rating = rating + random() * 16;
64                 if (bestrating < rating)
65                 {
66                         best = spot;
67                         bestrating = rating;
68                 }
69                 spot = find(spot, classname, "info_player_deathmatch");
70         }
71         return best;
72 }
73
74 /*
75 =============
76 SelectSpawnPoint
77
78 Finds a point to respawn
79 =============
80 */
81 entity SelectSpawnPoint (float anypoint)
82 {
83         local entity spot, firstspot, playerlist;
84         string spotname;
85
86         spot = find (world, classname, "testplayerstart");
87         if (spot)
88                 return spot;
89
90         spotname = "info_player_deathmatch";
91
92         if(!anypoint && cvar("g_ctf") )
93         {
94                 if(self.team == 5)//4)
95                         spotname = "info_player_team1";
96                 if(self.team == 14)//13)
97                         spotname = "info_player_team2";
98                 if(self.team == 4)//3)
99                         spotname = "info_player_team3";
100                 if(self.team == 13)//12)
101                         spotname = "info_player_team4";
102         }
103
104         playerlist = findchain(classname, "player");
105         firstspot = find(world, classname, spotname);
106         Spawn_ClassifyPoints(firstspot, playerlist, 100, 1000000, 1000000);
107         // first check if there are ANY good spots
108         if (spawn_goodspots > 0)
109         {
110                 // good spots exist, there is 50/50 chance of choosing a random good
111                 // spot or the furthest spot
112                 // (this means that roughly every other spawn will be furthest, so you
113                 // usually won't get fragged at spawn twice in a row)
114                 if (random() > 0.5)
115                         spot = Spawn_ClassifyPoints(firstspot, playerlist, 100, min(floor(random() * spawn_goodspots), spawn_goodspots - 1), 1000000);
116                 else
117                         spot = Spawn_FurthestPoint(firstspot, playerlist);
118         }
119         else
120         {
121                 // no good spots exist, pick a random bad spot
122                 spot = Spawn_ClassifyPoints(firstspot, playerlist, 100, 1000000, min(floor(random() * spawn_badspots), spawn_badspots - 1));
123         }
124
125         if (!spot)
126         {
127                 if(anypoint)
128                         error ("PutClientInServer: no start points on level");
129                 else // try again with deathmatch spots
130                         spot = SelectSpawnPoint(TRUE);
131         }
132
133         return spot;
134 }
135
136 /*
137 =============
138 CheckPlayerModel
139
140 Checks if the argument string can be a valid playermodel.
141 Returns a valid one in doubt.
142 =============
143 */
144 string CheckPlayerModel(string plyermodel) {
145         if( substring(plyermodel,0,14) != "models/player/") plyermodel = "models/player/marine.zym";
146
147         /* Possible Fixme: Check if server can open the model?
148            This would kill custom models, however. */
149
150         return plyermodel;
151 }
152
153
154 /*
155 =============
156 PutClientInServer
157
158 Called when a client spawns in the server
159 =============
160 */
161 void PutClientInServer (void)
162 {
163         entity  spot;
164
165         spot = SelectSpawnPoint (FALSE);
166         
167         RemoveGrapplingHook(self); // Wazat's Grappling Hook
168         
169         self.classname = "player";
170         self.iscreature = TRUE;
171         self.movetype = MOVETYPE_WALK;
172         self.solid = SOLID_SLIDEBOX;
173         self.flags = FL_CLIENT;
174         self.takedamage = DAMAGE_AIM;
175         self.effects = 0;
176         self.health = cvar("g_balance_health_start");
177         self.armorvalue = cvar("g_balance_armor_start");
178         self.pauserotarmor_finished = time + 10;
179         self.pauserothealth_finished = time + 10;
180         self.pauseregen_finished = 0;
181         self.damageforcescale = 2;
182         self.death_time = 0;
183         self.dead_time = 0;
184         self.dead_frame = 0;
185         self.die_frame = 0;
186         self.alpha = 0;
187         self.scale = 0;
188         self.fade_time = 0;
189         self.pain_frame = 0;
190         self.pain_finished = 0;
191         self.strength_finished = 0;
192         self.invincible_finished = 0;
193         self.pushltime = 0;
194         //self.speed_finished = 0;
195         //self.slowmo_finished = 0;
196         self.vote_finished = 0;
197         // players have no think function
198         self.think = SUB_Null;
199         self.nextthink = 0;
200
201         self.hook_time = 0;
202
203         self.runes = 0;
204
205         self.deadflag = DEAD_NO;
206
207         self.angles = spot.angles;
208
209         self.angles_z = 0; // never spawn tilted even if the spot says to
210         self.fixangle = TRUE; // turn this way immediately
211         self.velocity = '0 0 0';
212         self.avelocity = '0 0 0';
213         self.punchangle = '0 0 0';
214         self.punchvector = '0 0 0';
215         self.oldvelocity = self.velocity;
216
217         self.viewzoom = 0.6;
218
219
220         self.playermodel = CheckPlayerModel(self.playermodel);
221
222         precache_model (self.playermodel);
223         setmodel (self, self.playermodel);
224         self.skin = stof(self.playerskin);
225         self.crouch = FALSE;
226         self.view_ofs = PL_VIEW_OFS;
227         setsize (self, PL_MIN, PL_MAX);
228         setorigin (self, spot.origin + '0 0 1' * (1 - self.mins_z - 24));
229         // don't reset back to last position, even if new position is stuck in solid
230         self.oldorigin = self.origin;
231
232         if (cvar("g_use_ammunition")) {
233                 self.ammo_shells = cvar("g_start_ammo_shells");
234                 self.ammo_nails = cvar("g_start_ammo_nails");
235                 self.ammo_rockets = cvar("g_start_ammo_rockets");
236                 self.ammo_cells = cvar("g_start_ammo_cells");
237         } else {
238                 self.ammo_shells = 999;
239                 self.ammo_nails = 999;
240                 self.ammo_rockets = 999;
241                 self.ammo_cells = 999;
242         }
243
244         self.items = 0;
245         if (cvar("g_start_weapon_laser"))
246         {
247                 self.items = self.items | IT_LASER;
248                 self.switchweapon = WEP_LASER;
249         }
250         if (cvar("g_start_weapon_shotgun"))
251         {
252                 self.items = self.items | IT_SHOTGUN;
253                 self.switchweapon = WEP_SHOTGUN;
254         }
255         if (cvar("g_start_weapon_uzi"))
256         {
257                 self.items = self.items | IT_UZI;
258                 self.switchweapon = WEP_UZI;
259         }
260         if (cvar("g_start_weapon_grenadelauncher"))
261         {
262                 self.items = self.items | IT_GRENADE_LAUNCHER;
263                 self.switchweapon = WEP_GRENADE_LAUNCHER;
264         }
265         if (cvar("g_start_weapon_electro"))
266         {
267                 self.items = self.items | IT_ELECTRO;
268                 self.switchweapon = WEP_ELECTRO;
269         }
270         if (cvar("g_start_weapon_crylink"))
271         {
272                 self.items = self.items | IT_CRYLINK;
273                 self.switchweapon = WEP_CRYLINK;
274         }
275         if (cvar("g_start_weapon_nex"))
276         {
277                 self.items = self.items | IT_NEX;
278                 self.switchweapon = WEP_NEX;
279         }
280         if (cvar("g_start_weapon_hagar"))
281         {
282                 self.items = self.items | IT_HAGAR;
283                 self.switchweapon = WEP_HAGAR;
284         }
285         if (cvar("g_start_weapon_rocketlauncher"))
286         {
287                 self.items = self.items | IT_ROCKET_LAUNCHER;
288                 self.switchweapon = WEP_ROCKET_LAUNCHER;
289         }
290
291         self.event_damage = PlayerDamage;
292
293         self.statdraintime = time + 5;
294         self.button0 = self.button1 = self.button2 = self.button3 = 0;
295
296         /*
297         W_UpdateWeapon();
298         W_UpdateAmmo();
299         */
300         CL_SpawnWeaponentity();
301
302         //stuffcmd(self, "chase_active 0");
303 }
304
305 /*
306 =============
307 SetNewParms
308 =============
309 */
310 void SetNewParms (void)
311 {
312
313 }
314
315 /*
316 =============
317 SetChangeParms
318 =============
319 */
320 void SetChangeParms (void)
321 {
322
323 }
324
325 /*
326 =============
327 ClientKill
328
329 Called when a client types 'kill' in the console
330 =============
331 */
332 void ClientKill (void)
333 {
334         Damage(self, self, self, 100000, DEATH_KILL, self.origin, '0 0 0');
335 }
336
337 /*
338 =============
339 ClientConnect
340
341 Called when a client connects to the server
342 =============
343 */
344 string ColoredTeamName(float t);
345 //void dom_player_join_team(entity pl);
346 void ClientConnect (void)
347 {
348         self.classname = "player_joining";
349
350         //if(cvar("g_domination"))
351         //      dom_player_join_team(self);
352
353         JoinBestTeam(self, FALSE);
354
355         self.classname = "player";
356
357
358
359         bprint ("^4",self.netname);
360         bprint (" connected");
361
362         if(cvar("g_domination") || cvar("g_ctf"))
363         {
364                 bprint(" and joined the ");
365                 bprint(ColoredTeamName(self.team));
366         }
367
368         bprint("\n");
369
370         self.welcomemessage_time = time + cvar("welcome_message_time");
371         self.welcomemessage_time2 = 0;
372
373
374         stuffcmd(self, strcat("exec maps/", mapname, ".cfg\n"));
375         // send prediction settings to the client
376         stuffcmd(self, strcat("cl_movement_maxspeed ", ftos(cvar("sv_maxspeed")), "\n"));
377         stuffcmd(self, strcat("cl_movement_maxairspeed ", ftos(cvar("sv_maxairspeed")), "\n"));
378         stuffcmd(self, strcat("cl_movement_accelerate ", ftos(cvar("sv_accelerate")), "\n"));
379         stuffcmd(self, strcat("cl_movement_friction ", ftos(cvar("sv_friction")), "\n"));
380         stuffcmd(self, strcat("cl_movement_stopspeed ", ftos(cvar("sv_stopspeed")), "\n"));
381         stuffcmd(self, strcat("cl_movement_jumpvelocity ", ftos(cvar("g_balance_jumpheight")), "\n"));
382         stuffcmd(self, strcat("cl_movement_stepheight ", ftos(cvar("sv_stepheight")), "\n"));
383         stuffcmd(self, strcat("cl_movement_edgefriction 0\n"));
384         
385         // Wazat's grappling hook
386         SetGrappleHookBindings();       
387 }
388
389 /*
390 =============
391 ClientDisconnect
392
393 Called when a client disconnects from the server
394 =============
395 */
396 .entity chatbubbleentity;
397 void ClientDisconnect (void)
398 {
399         bprint ("^4",self.netname);
400         bprint (" disconnected\n");
401
402         if (self.chatbubbleentity)
403         {
404                 remove (self.chatbubbleentity);
405                 self.chatbubbleentity = world;
406         }
407         DropAllRunes(self);
408 }
409
410 .float buttonchat;
411 void() ChatBubbleThink =
412 {
413         self.nextthink = time;
414         if (!self.owner.modelindex || self.owner.chatbubbleentity != self)
415         {
416                 remove(self);
417                 return;
418         }
419         setorigin(self, self.owner.origin + '0 0 15' + self.owner.maxs_z * '0 0 1');
420         if (self.owner.buttonchat && !self.owner.deadflag)
421                 self.model = self.mdl;
422         else
423                 self.model = "";
424 };
425
426 void() UpdateChatBubble =
427 {
428         if (!self.modelindex)
429                 return;
430         // spawn a chatbubble entity if needed
431         if (!self.chatbubbleentity)
432         {
433                 self.chatbubbleentity = spawn();
434                 self.chatbubbleentity.owner = self;
435                 self.chatbubbleentity.exteriormodeltoclient = self;
436                 self.chatbubbleentity.think = ChatBubbleThink;
437                 self.chatbubbleentity.nextthink = time;
438                 setmodel(self.chatbubbleentity, "models/misc/chatbubble.spr");
439                 setorigin(self.chatbubbleentity, self.origin + '0 0 15' + self.maxs_z * '0 0 1');
440                 self.chatbubbleentity.mdl = self.chatbubbleentity.model;
441                 self.chatbubbleentity.model = "";
442         }
443 }
444
445 // LordHavoc: this hack will be removed when proper _pants/_shirt layers are
446 // added to the model skins
447 void() UpdateColorModHack =
448 {
449         local float c;
450         c = self.clientcolors & 15;
451         // LordHavoc: only bothering to support white, green, red, yellow, blue
452              if (teamplay == 0) self.colormod = '0 0 0';
453         else if (c ==  0) self.colormod = '1.00 1.00 1.00';
454         else if (c ==  3) self.colormod = '0.10 1.73 0.10';
455         else if (c ==  4) self.colormod = '1.73 0.10 0.10';
456         else if (c == 12) self.colormod = '1.22 1.22 0.10';
457         else if (c == 13) self.colormod = '0.10 0.10 1.73';
458         else self.colormod = '1 1 1';
459 };
460
461 /*
462 =============
463 PlayerJump
464
465 When you press the jump key
466 =============
467 */
468 void PlayerJump (void)
469 {
470         float mjumpheight;
471
472         mjumpheight = cvar("g_balance_jumpheight");
473         if (self.waterlevel >= 2)
474         {
475                 if (self.watertype == CONTENT_WATER)
476                         self.velocity_z = 200;
477                 else if (self.watertype == CONTENT_SLIME)
478                         self.velocity_z = 80;
479                 else
480                         self.velocity_z = 50;
481
482                 return;
483         }
484
485
486         if (!(self.flags & FL_ONGROUND))
487                 return;
488
489         if (!(self.flags & FL_JUMPRELEASED))
490                 return;
491
492         if(cvar("g_runematch"))
493         {
494                 if(self.runes & RUNE_SPEED)
495                 {
496                         if(self.runes & CURSE_SLOW)
497                                 mjumpheight = mjumpheight * cvar("g_balance_rune_speed_combo_jumpheight");
498                         else
499                                 mjumpheight = mjumpheight * cvar("g_balance_rune_speed_jumpheight");
500                 }
501                 else if(self.runes & CURSE_SLOW)
502                 {
503                         mjumpheight = mjumpheight * cvar("g_balance_curse_slow_jumpheight");
504                 }
505         }
506
507         self.velocity_z = self.velocity_z + mjumpheight;
508         self.oldvelocity_z = self.velocity_z;
509
510         self.flags = self.flags - FL_ONGROUND;
511         self.flags = self.flags - FL_JUMPRELEASED;
512 }
513
514 void() CheckWaterJump =
515 {
516         local vector start, end;
517
518 // check for a jump-out-of-water
519         makevectors (self.angles);
520         start = self.origin;
521         start_z = start_z + 8;
522         v_forward_z = 0;
523         normalize(v_forward);
524         end = start + v_forward*24;
525         traceline (start, end, TRUE, self);
526         if (trace_fraction < 1)
527         {       // solid at waist
528                 start_z = start_z + self.maxs_z - 8;
529                 end = start + v_forward*24;
530                 self.movedir = trace_plane_normal * -50;
531                 traceline (start, end, TRUE, self);
532                 if (trace_fraction == 1)
533                 {       // open at eye level
534                         self.flags = self.flags | FL_WATERJUMP;
535                         self.velocity_z = 225;
536                         self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
537                         self.teleport_time = time + 2;  // safety net
538                         return;
539                 }
540         }
541 };
542
543
544 void respawn(void)
545 {
546         CopyBody(1);
547         PutClientInServer();
548 }
549
550 void player_powerups (void)
551 {
552         self.effects = self.effects - (self.effects & (EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT));
553         if (self.items & IT_STRENGTH)
554         {
555                 self.effects = self.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT);
556                 if (time > self.strength_finished)
557                 {
558                         self.items = self.items - (self.items & IT_STRENGTH);
559                         sprint(self, "^3Strength has worn off\n");
560                 }
561         }
562         else
563         {
564                 if (time < self.strength_finished)
565                 {
566                         self.items = self.items | IT_STRENGTH;
567                         sprint(self, "^3Strength infuses your weapons with devestating power\n");
568                 }
569         }
570         if (self.items & IT_INVINCIBLE)
571         {
572                 self.effects = self.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT);
573                 if (time > self.invincible_finished)
574                 {
575                         self.items = self.items - (self.items & IT_INVINCIBLE);
576                         sprint(self, "^3Shield has worn off\n");
577                 }
578         }
579         else
580         {
581                 if (time < self.invincible_finished)
582                 {
583                         self.items = self.items | IT_INVINCIBLE;
584                         sprint(self, "^3Shield surrounds you\n");
585                 }
586         }
587         
588         if (cvar("g_fullbrightplayers"))
589                 self.effects = EF_FULLBRIGHT;
590         
591 }
592
593 void player_regen (void)
594 {
595         float maxh, maxa, max_mod, regen_mod, rot_mod;
596         maxh = cvar("g_balance_health_stable");
597         maxa = cvar("g_balance_armor_stable");
598
599         if(cvar("g_runematch"))
600         {
601                 max_mod = regen_mod = rot_mod = 1;
602                 if (self.runes & RUNE_REGEN)
603                 {
604                         if (self.runes & CURSE_VENOM) // do we have both rune/curse?
605                         {
606                                 regen_mod = cvar("g_balance_rune_regen_combo_regenrate");
607                                 max_mod = cvar("g_balance_rune_regen_combo_hpmod");
608                         }
609                         else
610                         {
611                                 regen_mod = cvar("g_balance_rune_regen_regenrate");
612                                 max_mod = cvar("g_balance_rune_regen_hpmod");
613                         }
614                 }
615                 else if (self.runes & CURSE_VENOM)
616                 {
617                         max_mod = cvar("g_balance_curse_venom_hpmod");
618                         if (self.runes & RUNE_REGEN) // do we have both rune/curse?
619                                 rot_mod = cvar("g_balance_rune_regen_combo_rotrate");
620                         else
621                                 rot_mod = cvar("g_balance_curse_venom_rotrate");
622                         //if (!self.runes & RUNE_REGEN)
623                         //      rot_mod = cvar("g_balance_curse_venom_rotrate");
624                 }
625                 maxh = maxh * max_mod;
626                 //maxa = maxa * max_mod;
627
628                 if (time > self.pauserotarmor_finished)
629                 {
630                         if (self.armorvalue > maxa)
631                                 self.armorvalue = bound(0, self.armorvalue + (maxa - self.armorvalue) * cvar("g_balance_armor_rot") * frametime, 1000);
632                 }
633                 if (time > self.pauserothealth_finished)
634                 {
635                         if (self.health > maxh)
636                                 self.health = bound(0, self.health + (maxh - self.health) * rot_mod*cvar("g_balance_health_rot") * frametime, 1000);
637                 }
638                 if (time > self.pauseregen_finished)
639                 {
640                         if (self.health < maxh)
641                                 self.health = bound(0, self.health + (maxh- self.health) * regen_mod*cvar("g_balance_health_regen") * frametime, 1000);
642                         if (self.armorvalue < maxa)
643                                 self.armorvalue = bound(0, self.armorvalue + (maxa - self.armorvalue) * cvar("g_balance_armor_regen") * frametime, 1000);
644                 }
645         }
646         else
647         {
648                 if (time > self.pauserothealth_finished)
649                 if (self.health > maxh)
650                         self.health = bound(0, self.health + (maxh - self.health) * cvar("g_balance_health_rot") * frametime, 1000);
651                 if (time > self.pauserotarmor_finished)
652                 if (self.armorvalue > maxa)
653                         self.armorvalue = bound(0, self.armorvalue + (maxa - self.armorvalue) * cvar("g_balance_armor_rot") * frametime, 1000);
654                 if (time > self.pauseregen_finished)
655                 {
656                         if (self.health < maxh)
657                                 self.health = bound(0, self.health + (maxh- self.health) * cvar("g_balance_health_regen") * frametime, 1000);
658                         if (self.armorvalue < maxa)
659                                 self.armorvalue = bound(0, self.armorvalue + (maxa - self.armorvalue) * cvar("g_balance_armor_regen") * frametime, 1000);
660                 }
661         }
662 }
663
664 /*
665 =============
666 PlayerPreThink
667
668 Called every frame for each client before the physics are run
669 =============
670 */
671 void PlayerPreThink (void)
672 {
673         local vector m1, m2;
674
675 //      MauveBot_AI();
676
677 //      if(self.netname == "Wazat")
678 //              bprint(strcat(self.classname, "\n"));
679
680         CheckRules_Player();
681
682         if (intermission_running)
683         {
684                 IntermissionThink ();   // otherwise a button could be missed between
685                 return;                                 // the think tics
686         }
687
688         if (self.deadflag != DEAD_NO)
689         {
690                 player_anim();
691                 weapon_freeze();
692                 if (self.deadflag == DEAD_DYING)
693                 {
694                         if (time > self.dead_time)
695                                 self.deadflag = DEAD_DEAD;
696                 }
697                 else if (self.deadflag == DEAD_DEAD)
698                 {
699                         if (!self.button0 && !self.button2 && !self.button3)
700                                 self.deadflag = DEAD_RESPAWNABLE;
701                 }
702                 else if (self.deadflag == DEAD_RESPAWNABLE)
703                 {
704                         if (self.button0 || self.button2 || self.button3  || self.button4)
705                                 respawn();
706                 }
707                 return;
708         }
709
710         if (self.button5)
711         {
712                 if (!self.crouch)
713                 {
714                         self.crouch = TRUE;
715                         self.view_ofs = PL_CROUCH_VIEW_OFS;
716                         setsize (self, PL_CROUCH_MIN, PL_CROUCH_MAX);
717                 }
718         }
719         else
720         {
721                 if (self.crouch)
722                 {
723                         tracebox(self.origin, PL_MIN, PL_MAX, self.origin, FALSE, self);
724                         if (!trace_startsolid)
725                         {
726                                 self.crouch = FALSE;
727                                 self.view_ofs = PL_VIEW_OFS;
728                                 setsize (self, PL_MIN, PL_MAX);
729                         }
730                 }
731         }
732
733         if (self.playermodel != self.model)
734         {
735                 self.playermodel = CheckPlayerModel(self.playermodel);
736                 m1 = self.mins;
737                 m2 = self.maxs;
738                 precache_model (self.playermodel);
739                 setmodel (self, self.playermodel);
740                 setsize (self, m1, m2);
741         }
742
743         // Savage: Check for nameless players
744         if (strlen(self.netname) < 1) {
745                 self.netname = "Player";
746                 stuffcmd(self, "name Player\n");
747         }
748
749         if (self.skin != stof(self.playerskin))
750                 self.skin = stof(self.playerskin);
751         
752         GrapplingHookFrame();
753
754         W_WeaponFrame();
755
756         if (self.button4 || (self.weapon == WEP_NEX && self.button3))
757         {
758                 if (self.viewzoom > 0.4)
759                         self.viewzoom = max (0.4, self.viewzoom - frametime * 2);
760         }
761         else if (self.viewzoom < 1.0)
762                 self.viewzoom = min (1.0, self.viewzoom + frametime);
763
764
765         if (self.button2)
766                 PlayerJump ();
767         else
768                 self.flags = self.flags | FL_JUMPRELEASED;
769
770         if (self.vote_finished > 0 // this player has called a vote
771             && time > self.vote_finished) // time is up
772         {
773                 VoteCount();
774         }
775
776         player_powerups();
777         player_regen();
778         player_anim();
779
780         //self.angles_y=self.v_angle_y + 90;   // temp
781
782         if (self.waterlevel == 2)
783                 CheckWaterJump ();
784
785         //if (TetrisPreFrame()) return;
786 }
787
788 /*
789 =============
790 PlayerPostThink
791
792 Called every frame for each client after the physics are run
793 =============
794 */
795 void PlayerPostThink (void)
796 {
797         CheckRules_Player();
798         UpdateChatBubble();
799         UpdateColorModHack();
800         if (self.deadflag == DEAD_NO)
801         if (self.impulse)
802                 ImpulseCommands ();
803         if (intermission_running)
804                 return;         // intermission or finale
805
806         PrintWelcomeMessage(self);
807         //if (TetrisPostFrame()) return;
808 }