1 #include "g_local.h"
2 #include "m_player.h"
3
MatrixJump(edict_t * ent)4 void MatrixJump (edict_t *ent)
5 {
6 trace_t tr;
7 vec3_t forward, pt;
8 int i;
9
10 for (i=0;i < 4;i++)
11 {
12 vec3_t angles= {0,i*90,0};
13 AngleVectors (angles, forward, NULL, NULL);
14 VectorMA(ent->s.origin, 32, forward, pt);
15 tr = gi.trace(ent->s.origin, vec3_origin, vec3_origin, pt, ent, MASK_SOLID);
16 if (tr.fraction < 1)
17 {
18 vec3_t kick;
19
20
21 //VectorSubtract(ent->s.origin, tr.endpos, kick);
22 //VectorNormalize(kick);
23 //VectorScale(kick, 300, kick);
24 VectorScale(tr.plane.normal, 300, kick);
25 VectorCopy(kick, ent->velocity);
26 ent->stamina -= 5;
27 ent->velocity[2] = 300;
28 ent->groundentity = NULL;
29 ent->last_jump_time = level.time + JUMP_TIME;
30 ent->matrixflip = BFLIP;
31 }
32 }
33 }
34
MatrixFlip(edict_t * ent)35 void MatrixFlip (edict_t *ent)
36 {
37 float forwardspeed;
38 vec3_t forward, right, up;
39 int i;
40
41 AngleVectors (ent->client->v_angle, forward, right, up);
42 forwardspeed = DotProduct(ent->velocity, forward);
43 // Projection of the velocity on the forward vector it doesnt seem to work perfectly but good enough
44
45
46 if (ent->deadflag)
47 return;
48
49 //select roll
50 if ((ent->matrixflip == NOFLIP) && (ent->jumping) && !(ent->waterlevel > 0))
51 {// Flip if your jumping and not just holding jump
52 if (ent->strafebuttons > 0)
53 ent->matrixflip = LFLIP;
54
55 if (ent->strafebuttons < 0)
56 ent->matrixflip = RFLIP;
57
58 if (forwardspeed < -100)
59 // Flip if your going backwards and not just holding back
60 ent->matrixflip = BFLIP;
61 }
62
63 if (ent->matrixflip == BFLIP)
64 {
65 ent->s.angles[PITCH] -= (sv_gravity->value*0.0625);
66 ent->client->anim_priority = ANIM_ATTACK;
67 ent->s.frame = FRAME_crwalk1;
68 }
69
70 if (ent->matrixflip == FALLROLL)
71 ent->s.angles[PITCH] += (sv_gravity->value*0.1);
72
73 //you will always do a full loop from jump to land (as long as the land is flat)
74 //no matter what the gravity.
75
76 //left flip
77 if (ent->matrixflip == RFLIP)
78 {
79 //
80 ent->s.angles[ROLL] += (sv_gravity->value*0.0625);
81
82
83 ent->client->anim_priority = ANIM_ATTACK;
84 ent->s.frame = FRAME_crwalk1;
85
86 if(ent->s.angles[ROLL] == 0)
87 ent->matrixflip = NOFLIP;
88
89 if(ent->s.angles[ROLL] < -360)
90 ent->matrixflip = NOFLIP;
91 }
92
93 //rightflip switched for software
94 if (ent->matrixflip == LFLIP)
95 {
96 ent->s.angles[ROLL] -= (sv_gravity->value*0.0625);
97
98
99 ent->client->anim_priority = ANIM_ATTACK;
100 ent->s.frame = FRAME_crwalk1;
101
102 if(ent->s.angles[ROLL] == 0)
103 ent->matrixflip = NOFLIP;
104
105 if(ent->s.angles[ROLL] > 360)
106 ent->matrixflip = NOFLIP;
107 }
108 if ((ent->matrixflip == RUN_LEFT_ALONG_WALL
109 || ent->matrixflip == RUN_RIGHT_ALONG_WALL) && !ent->velocity)
110 ent->matrixflip = NOFLIP;
111 //run along walls
112 if (ent->matrixflip == RUN_RIGHT_ALONG_WALL && ent->velocity)
113 ent->s.angles[ROLL] = 270;
114 //switched
115 else if (ent->matrixflip == RUN_LEFT_ALONG_WALL && ent->velocity)
116 ent->s.angles[ROLL] = 90;
117 else if (!ent->velocity)
118 ent->s.angles[ROLL] = 0;
119
120 //run up walls
121
122 if (ent->matrixflip == RWALL)
123 {
124 if(ent->up_yours == RIGHT)
125 {
126 ent->s.angles[PITCH] = 0;
127 ent->s.angles[ROLL] = 270;
128
129 ent->velocity[2] = 50;
130 // ent->client->kick_angles[2] = -45;
131 }
132
133 if(ent->up_yours == LEFT)
134 {
135 ent->s.angles[PITCH] = 0;
136 ent->s.angles[ROLL] = 90;
137 ent->velocity[2] = 50;
138 // ent->client->kick_angles[2] = 45;
139 }
140 if(ent->up_yours == STRAIGHTUP)
141 {
142 ent->s.angles[PITCH] = 270;
143 ent->s.angles[ROLL] = 0;
144 ent->velocity[2] = 300;
145 }
146 if(ent->up_yours == CEILING)
147 {
148 ent->s.angles[PITCH] = 0;
149 ent->s.angles[ROLL] = 180;
150 ent->s.angles[YAW] = ent->client->v_angle[YAW];
151 ent->velocity[2] = 300;
152 }
153
154 ent->client->kick_angles[0] = -1;
155 if (ent->s.frame == FRAME_run6)
156 {
157 ent->client->anim_priority = ANIM_ATTACK;
158 ent->s.frame = FRAME_run1 - 1;
159 }
160 }
161
162 if(ent->matrixflip == KUNGFU)
163 {
164 if(ent->KungFuAnim == SPINKICK)
165 {
166
167
168 ent->client->anim_priority = ANIM_REVERSE;
169 ent->s.frame = 45;
170 ent->client->anim_end = 43;
171
172
173 }
174 if(ent->KungFuAnim == HOVERKICK)
175 {
176 if (random() < 0.5)
177 {
178 ent->client->anim_priority = ANIM_REVERSE;
179 ent->s.frame = 44;
180 ent->client->anim_end = 43;
181 }
182 else
183 {
184 ent->client->anim_priority = ANIM_REVERSE;
185 ent->s.frame = 41;
186 ent->client->anim_end = 40;
187 }
188 }
189 if(ent->KungFuAnim == HOOK)
190 {
191 ent->client->anim_priority = ANIM_ATTACK;
192 ent->s.frame = 113;
193 ent->client->anim_end = 120;
194 }
195 if(ent->KungFuAnim == JAB)
196 {
197 if (random() < 0.5)
198 {
199 ent->client->anim_priority = ANIM_ATTACK;
200 ent->s.frame = 58;
201 ent->client->anim_end = 60;
202 }
203 else
204 {
205 ent->client->anim_priority = ANIM_ATTACK;
206 ent->s.frame = 62;
207 ent->client->anim_end = 64;
208 }
209 }
210 if(ent->KungFuAnim == UPPERCUT)
211 {
212 ent->client->anim_priority = ANIM_ATTACK;
213 ent->s.frame = 72;
214 ent->client->anim_end = 75;
215 }
216
217
218 ent->KungFuAnim = NONE;
219 }
220 //reset stuff
221 //bug you don't do a full backflip if you are leaning forward (looking down)
222 //because you IMMEDIATELY hit 0 and it turns off looping
223
224 if(ent->client->anim_end == ent->s.frame && ent->matrixflip == KUNGFU)
225 {
226 ent->matrixflip = NOFLIP;
227
228 }
229
230 if (ent->matrixflip == BFLIP)
231 {
232 if(ent->s.angles[PITCH] == 0)
233 ent->matrixflip = NOFLIP;
234
235 if(ent->s.angles[PITCH] < -360)
236 ent->matrixflip = NOFLIP;
237 }
238
239 if (ent->matrixflip == FALLROLL)
240 {
241 if(ent->s.angles[PITCH] == 0)
242 ent->matrixflip = NOFLIP;
243
244 if(ent->s.angles[PITCH] > 360)
245 ent->matrixflip = NOFLIP;
246 }
247
248 //if(ent->matrixflip == RUN_LEFT_ALONG_WALL
249 // || ent->matrixflip == RUN_RIGHT_ALONG_WALL)
250
251 // return;
252
253 if (ent->groundentity && ent->matrixflip != FALLROLL
254 && ent->matrixflip != RUN_LEFT_ALONG_WALL
255 && ent->matrixflip != RUN_RIGHT_ALONG_WALL
256 && ent->matrixflip != KUNGFU)
257 {
258 // if (ent->matrixflip == RWALL)
259 // Cmd_Chasecam_Off (ent);
260 // if (ent->matrixflip == BFLIP)
261 // Cmd_Chasecam_Off (ent);
262 ent->matrixflip = NOFLIP;
263 }
264 if(ent->groundentity || ent->matrixflip != 0 || ent->waterlevel)
265 ent->MatrixJumping = false;
266
267 if(ent->MatrixJumping)
268 {
269 //every 5th of a second
270 i =(level.time * 10);
271 if (i % 2 != 0)
272 SpawnShadow(ent);
273 }
274
275 }
MatrixRunUpWalls(edict_t * ent)276 void MatrixRunUpWalls (edict_t *ent)
277 {
278 vec3_t forward, start, kick, blah;
279 int check = 0, n;
280 qboolean LessThanOne = false, CutSky = false;
281 trace_t tr, temptr;
282
283 MatrixRunRAlongWalls (ent);
284 MatrixRunLAlongWalls (ent);
285
286 if (ent->deadflag || (ent->movetype == MOVETYPE_NOCLIP))
287 return;
288 if (ent->groundentity)
289 return;
290 if (ent->vertbuttons<=0)
291 {
292 ent->matrixflip = NOFLIP;
293 return;
294 }
295 if (ent->velocity[2]< -200)
296 return;
297 if (ent->waterlevel>0)
298 return;
299
300 VectorCopy (ent->client->v_angle, blah);
301
302 blah[PITCH] = 0;
303 blah[YAW] -= 90 ;
304 AngleVectors (blah, forward, NULL, NULL);
305 VectorMA(ent->s.origin, 24, forward, start);
306 tr = gi.trace(ent->s.origin, vec3_origin, vec3_origin, start, ent, (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW));
307 if(tr.fraction < 1)
308 {
309 ent->up_yours = LEFT;
310 LessThanOne= true;
311 VectorCopy (tr.endpos, temptr.endpos);
312
313 }
314 if(tr.surface->flags & SURF_SKY )
315 CutSky = true;
316
317 VectorCopy (ent->client->v_angle, blah);
318 blah[PITCH] = 0;
319 blah[YAW] += 90 ;
320 AngleVectors (blah, forward, NULL, NULL);
321 VectorMA(ent->s.origin, 24, forward, start);
322 tr = gi.trace(ent->s.origin, vec3_origin, vec3_origin, start, ent, (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW));
323 if(tr.fraction < 1 && !LessThanOne)
324 {
325 ent->up_yours = RIGHT;
326 LessThanOne= true;
327 VectorCopy (tr.endpos, temptr.endpos);
328
329 }
330 if(tr.surface->flags & SURF_SKY )
331 CutSky = true;
332
333 VectorCopy (ent->client->v_angle, blah);
334 blah[PITCH] = 270;
335 AngleVectors (blah, forward, NULL, NULL);
336 VectorMA(ent->s.origin, 48, forward, start);
337 tr = gi.trace(ent->s.origin, vec3_origin, vec3_origin, start, ent, (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW));
338 if(tr.fraction < 1 && !LessThanOne)
339 {
340 ent->up_yours = CEILING;
341 LessThanOne= true;
342 VectorCopy (tr.endpos, temptr.endpos);
343
344 }
345 if(tr.surface->flags & SURF_SKY )
346 CutSky = true;
347
348 VectorCopy (ent->client->v_angle, blah);
349 blah[PITCH] = 0;
350 AngleVectors (blah, forward, NULL, NULL);
351 VectorMA(ent->s.origin, 24, forward, start);
352 tr = gi.trace(ent->s.origin, vec3_origin, vec3_origin, start, ent, (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW));
353 if(tr.fraction < 1 && !LessThanOne)
354 {
355 ent->up_yours = STRAIGHTUP;
356 LessThanOne= true;
357 VectorCopy (tr.endpos, temptr.endpos);
358
359 }
360 if(tr.surface->flags & SURF_SKY )
361 CutSky = true;
362
363
364
365 // gi.WriteByte (svc_temp_entity);
366 // gi.WriteByte (TE_BFG_LASER);
367 // gi.WritePosition (ent->s.origin);
368 // gi.WritePosition (tr.endpos);
369 // gi.multicast (ent->s.origin, MULTICAST_PHS);
370 //detect wall
371
372 if (LessThanOne && !CutSky)
373 {
374 if (ent->matrixflip != RWALL)
375 {
376 ent->client->anim_priority = ANIM_ATTACK;
377 ent->s.frame = FRAME_run1 - 1;
378 ent->client->anim_end = FRAME_run6; //start running
379 ent->matrixflip = RWALL;
380 //Cmd_Chasecam_On (ent);
381 }
382 ent->wallframe = 1;
383 }
384
385 if(CutSky)
386 {
387 ent->wallframe = 0;
388 ent->matrixflip = NOFLIP;
389 }
390
391 if (!LessThanOne)
392 {
393 ent->wallframe = 0;
394 ent->matrixflip = NOFLIP;
395 }
396
397 //speed up wall
398 if (ent->wallframe == 1)
399 {
400 ent->velocity[2] = 300;
401 }
402
403
404 if(ent->forwardbuttons<0)
405 {
406 if(ent->matrixflip == RWALL && ent->up_yours != CEILING)
407 {
408 VectorSubtract(ent->s.origin, temptr.endpos, kick);
409 VectorNormalize(kick);
410 VectorScale(kick, 300, kick);
411 VectorCopy(kick, ent->velocity);
412 // ent->stamina -= 5;
413 ent->velocity[2] = 300;
414 ent->groundentity = NULL;
415 ent->last_jump_time = level.time + JUMP_TIME;
416 ent->matrixflip = BFLIP;
417 }
418 }
419 }
420
MatrixRunRAlongWalls(edict_t * ent)421 void MatrixRunRAlongWalls (edict_t *ent)
422 {
423 vec3_t forward, start, kick, blah;
424 trace_t tr;
425
426 if(!ent->velocity)
427 {
428 ent->matrixflip = NOFLIP;
429 return;
430 }
431
432
433 if(ent->matrixflip != RUN_LEFT_ALONG_WALL
434 && ent->matrixflip != RUN_RIGHT_ALONG_WALL
435 && ent->matrixflip != NOFLIP)
436 return;
437
438
439 VectorCopy (ent->client->v_angle, blah);
440 blah[PITCH] = 0;
441 blah[YAW] += 90;
442 AngleVectors (blah, forward, NULL, NULL);
443 VectorMA(ent->s.origin, 24, forward, start);
444
445 tr = gi.trace(ent->s.origin, vec3_origin, vec3_origin, start, ent, MASK_SOLID);
446
447 if (tr.fraction <1)
448 ent->matrixflip = RUN_RIGHT_ALONG_WALL;
449 else
450 ent->matrixflip = NOFLIP;
451
452
453
454 // gi.WriteByte (svc_temp_entity);
455 // gi.WriteByte (TE_BFG_LASER);
456 // gi.WritePosition (ent->s.origin);
457 // gi.WritePosition (tr.endpos);
458 // gi.multicast (ent->s.origin, MULTICAST_PHS);
459 }
MatrixRunLAlongWalls(edict_t * ent)460 void MatrixRunLAlongWalls (edict_t *ent)
461 {
462
463 vec3_t forward, start, kick, blah;
464 trace_t tr;
465
466 if(!ent->velocity)
467 {
468 ent->matrixflip = NOFLIP;
469
470 return;
471 }
472
473
474 if(ent->matrixflip != RUN_LEFT_ALONG_WALL
475 && ent->matrixflip != NOFLIP)
476 return;
477
478 VectorCopy (ent->client->v_angle, blah);
479 blah[PITCH] = 0;
480 blah[YAW] -= 90;
481 AngleVectors (blah, forward, NULL, NULL);
482 VectorMA(ent->s.origin, 24, forward, start);
483 tr = gi.trace(ent->s.origin, vec3_origin, vec3_origin, start, ent, MASK_SOLID);
484
485 if (tr.fraction <1)
486 ent->matrixflip = RUN_LEFT_ALONG_WALL;
487 else
488 ent->matrixflip = NOFLIP;
489
490
491
492 // gi.WriteByte (svc_temp_entity);
493 // gi.WriteByte (TE_BFG_LASER);
494 // gi.WritePosition (ent->s.origin);
495 // gi.WritePosition (tr.endpos);
496 // gi.multicast (ent->s.origin, MULTICAST_PHS);
497 }
498
MatrixFallingRoll(edict_t * ent,int damage)499 int MatrixFallingRoll(edict_t *ent, int damage)
500 {
501 //called from the falling damage place p_fallingdamage
502 // you must be pressing crouch
503 if(ent->vertbuttons<0)
504 {
505 ent->matrixflip = FALLROLL;
506 damage = 0; // if it's 0, it gives infinite damage
507 //this was surprisingly simple to do - for me n e way :p
508 }
509 return damage;
510 }
511
MatrixSpeed(edict_t * ent)512 void MatrixSpeed (edict_t *ent)
513 {
514 int i;
515
516
517 if(ent->client->speed_framenum > level.framenum)
518 {
519 gi.cvar_set("cl_forwardspeed","180");
520 gi.cvar_set("cl_sidespeed","180");
521 gi.cvar_set("cl_upspeed","50");
522
523 i =(level.time * 10);
524 if (i % 2 != 0)
525 SpawnShadow (ent);
526 }
527 else
528 {
529 gi.cvar_set("cl_forwardspeed","200");
530 gi.cvar_set("cl_sidespeed","200");
531 }
532
533 }
534
SuperJump(edict_t * ent)535 void SuperJump (edict_t *ent)
536 {
537 vec3_t forward;
538 float xyspeed;
539 int impulse;
540
541 if(ent->stamina < 50)
542 return;
543
544 if(!ent->groundentity)
545 return;
546
547 if(ent->client->speed_framenum > level.framenum)
548 impulse = 400;
549 else
550 impulse = 600;
551 //matrix jump is a little too powerful
552 ent->stamina -= 50;
553 xyspeed = sqrt(ent->velocity[0]*ent->velocity[0] + ent->velocity[1]*ent->velocity[1]);
554 //pythag. so it WAS useful for something!!
555
556 if (xyspeed > 750)
557 return;
558
559 AngleVectors (ent->client->v_angle, forward, NULL, NULL);
560 VectorMA (ent->velocity, impulse, forward, ent->velocity);
561 ent->velocity[2] += impulse * 0.75;
562 ent->MatrixJumping = true;
563
564 gi.sound (ent, CHAN_VOICE, gi.soundindex ("matrixjump.wav"), 1, ATTN_NORM, 0);
565 //got to be a better way than this - increse pitch??
566 //VectorScale (forward, ent->client->pers.jump_height, ent->velocity);
567
568 //thx to mr grim, who gave me this and finally set me straight regarding vectors.
569 }
570
571 /*
572 BACKFLIPBOOL = Matrixmove now
573 its a enum, i pressume this is what you want it to be
574 it can only take those values that you have created i think
575 NOFLIP = 0 and it goes up +1 each time
576
577 Painberry's note on backflip bool. no this is not a boolean. it just started that way.
578 it is an int to register which s.angle adjusting thing is happening, so that you only do one at a
579 tome, e.g. inyour old code you do mental impossible flips, which i'm afraid are a bit dumb.
580 also i didn't want forward flips: when you run down slopes yo start somersaulting, which is dumb.
581
582 when backflip bool = 0 any move can be done. if it is not 0, no other moves can usurp it.
583 */
SpawnShadow(edict_t * ent)584 void SpawnShadow (edict_t *ent)
585 {
586 edict_t *shadow;
587
588 if(ent->deadflag)
589 return;
590
591 if(ent->client->speed_framenum > level.framenum && ent->groundentity)
592 {
593 SpawnWave (ent);
594 return;
595 }
596 // spawn the bot on a spawn spot
597 shadow = G_Spawn();
598
599 shadow->s = ent->s;
600
601 if(!ent->velocity[0] && !ent->velocity[1])
602 shadow->s.frame = random()* 180;
603
604 shadow->s.modelindex2 = 0;
605 shadow->s.modelindex3 = 0;
606 shadow->s.modelindex4 = 0;
607 VectorCopy (ent->s.old_origin, shadow->s.origin);
608 VectorCopy (ent->s.angles, shadow->s.angles);
609
610
611 shadow->classname = "shadow";
612 shadow->movetype = MOVETYPE_NONE;
613 shadow->solid = SOLID_NOT;
614 shadow->owner = ent;
615
616 if(IsFemale(ent))
617 shadow->model = "players/female/tris.md2";
618 else if(IsNeutral(ent))
619 shadow->model = "players/cyborg/tris.md2";
620 else
621 shadow->model = "players/male/tris.md2";
622
623 shadow->s.effects |= EF_SPHERETRANS;
624 shadow->waterlevel = 0;
625 shadow->watertype = 0;
626 shadow->health = 100;
627 shadow->max_health = 100;
628 shadow->gib_health = -40;
629 shadow->s.skinnum = 0;
630 //shadow->s.skinnum = ent - g_edicts - 1;
631 // think functions
632 shadow->nextthink = level.time + 0.8;
633 shadow->think = G_FreeEdict;
634 VectorSet (shadow->mins, -16, -16, -24);
635 VectorSet (shadow->maxs, 16, 16, 32);
636
637
638 VectorClear (shadow->velocity);
639
640 gi.linkentity (shadow);
641 }
642
SpeedWaveThink(edict_t * wave)643 void SpeedWaveThink (edict_t *wave)
644 {
645 if(wave->s.frame ==3)
646 G_FreeEdict (wave);
647 else
648 wave->s.frame++;
649 }
650
SpawnWave(edict_t * ent)651 void SpawnWave (edict_t *ent)
652 {
653 edict_t *wave;
654 vec3_t dir;
655 if(ent->deadflag)
656 return;
657 if(!ent->groundentity) // only on floor
658 return;
659
660
661 wave = G_Spawn();
662 wave->s = ent->s;
663
664
665 wave->s.modelindex2 = 0;
666 wave->s.modelindex3 = 0;
667 wave->s.modelindex4 = 0;
668 VectorCopy (ent->s.old_origin, wave->s.origin);
669 vectoangles(ent->velocity, wave->s.angles);
670
671 wave->s.angles[PITCH] = 0; //don't want it sticking up
672 wave->s.angles[ROLL] = 0; //don't want it sticking up
673
674 wave->s.frame = 0;
675
676 wave->classname = "speedwave";
677 wave->movetype = MOVETYPE_NONE;
678 wave->solid = SOLID_NOT;
679 wave->owner = ent;
680 wave->s.modelindex = gi.modelindex ("models/objects/speed/tris.md2");
681 wave->s.effects |= EF_SPHERETRANS;
682
683 //wave->waterlevel = 0;
684 //wave->watertype = 0;
685 //wave->health = 100;
686 //wave->max_health = 100;
687 //wave->gib_health = -40;
688 //wave->s.skinnum = ent - g_edicts - 1;
689 // think functions
690
691 wave->nextthink = level.time + 0.4;
692 wave->think = G_FreeEdict;
693 VectorSet (wave->mins, -16, -16, -24);
694 VectorSet (wave->maxs, 16, 16, 32);
695 VectorClear (wave->velocity);
696
697 gi.linkentity (wave);
698 }
699 // replace "MatrixSpeed(ent)" with
700 // "MatrixCheckSpeed(ent)"
701 //and put "MatrixSpeed(ent)" at the bottom of
702 // cmd_BuySpeed
703
MatrixCheckSpeed(edict_t * ent)704 void MatrixCheckSpeed (edict_t *ent)
705 {
706 int i;
707
708 if(ent->client->speed_framenum > level.framenum)
709 {
710 if(ent->velocity[0] || ent->velocity[1])
711 //every 5th of a second
712 i =(level.time * 10);
713 if (i % 2 != 0)
714 SpawnWave (ent);
715 return;
716 }
717
718 if(ent->pinned_nextthink>level.framenum)
719 {
720 i = 0;
721 VectorCopy(ent->pinnedpos,ent->s.old_origin);
722 VectorClear(ent->velocity);
723 }
724 else
725 i = 180;
726
727 if (ent->forwardbuttons > i || ent->strafebuttons > i)
728 {
729 char number[12];
730
731 Com_sprintf(number, 12, "%i", i);
732
733 gi.cvar_set("cl_forwardspeed", number);
734 gi.cvar_set("cl_sidespeed", number);
735 }
736 }
737
MatrixScreenTilt(edict_t * ent)738 void MatrixScreenTilt (edict_t *ent)
739 {
740 if(!ent->screentilt)
741 return;
742 if(ent->deadflag)
743 return;
744
745
746 if(ent->matrixflip == RWALL && ent->up_yours == RIGHT)
747 {
748 ent->client->kick_angles[ROLL] += 90;
749 return;
750 }
751
752 if(ent->matrixflip == RWALL && ent->up_yours == LEFT)
753 {
754 ent->client->kick_angles[ROLL] -= 90;
755 return;
756 }
757
758 if(ent->strafebuttons > 0 && !ent->groundentity)
759 {
760 ent->client->kick_angles[ROLL] += 90;
761 return;
762 }
763
764 if(ent->strafebuttons < 0 && !ent->groundentity)
765 {
766 ent->client->kick_angles[ROLL] -= 90;
767 return;
768 }
769
770 }
771
772