#include "cg_local.h"Go to the source code of this file.
|
|
Definition at line 296 of file cg_marks.c. Referenced by CG_AddParticleToScene(), CG_BloodPool(), CG_Particle_Bleed(), and CG_ParticleBloodCloud(). |
|
|
Definition at line 297 of file cg_marks.c. Referenced by CG_AddParticleToScene(), CG_ParticleBulletDebris(), and CG_ParticleSparks(). |
|
|
Referenced by ValidBloodPool(). |
|
|
Definition at line 298 of file cg_marks.c. Referenced by CG_AddParticleToScene(). |
|
|
Definition at line 2009 of file cg_marks.c. Referenced by CG_ParticleBloodCloud(), and CG_ParticleDust(). |
|
|
Definition at line 219 of file cg_marks.c. Referenced by CG_AddMarks(). |
|
|
Definition at line 218 of file cg_marks.c. Referenced by CG_AddMarks(). |
|
|
Definition at line 107 of file cg_marks.c. Referenced by CG_CreateSaberMarks(), and CG_ImpactMark(). |
|
|
Definition at line 108 of file cg_marks.c. Referenced by CG_CreateSaberMarks(), and CG_ImpactMark(). |
|
|
Definition at line 378 of file cg_marks.c. |
|
|
Definition at line 361 of file cg_marks.c. |
|
|
Definition at line 360 of file cg_marks.c. |
|
|
Definition at line 2008 of file cg_marks.c. Referenced by CG_ParticleDust(). |
|
|
Definition at line 377 of file cg_marks.c. Referenced by CG_ParticleDust(). |
|
|
|
Definition at line 340 of file cg_marks.c.
00341 {
00342 P_NONE,
00343 P_WEATHER,
00344 P_FLAT,
00345 P_SMOKE,
00346 P_ROTATE,
00347 P_WEATHER_TURBULENT,
00348 P_ANIM, // Ridah
00349 P_BAT,
00350 P_BLEED,
00351 P_FLAT_SCALEUP,
00352 P_FLAT_SCALEUP_FADE,
00353 P_WEATHER_FLURRY,
00354 P_SMOKE_IMPACT,
00355 P_BUBBLE,
00356 P_BUBBLE_TURBULENT,
00357 P_SPRITE
00358 } particle_type_t;
|
|
|
Definition at line 221 of file cg_marks.c. References markPoly_s::alphaFade, cg, cg_activeMarkPolys, cg_addMarks, CG_FreeMarkPoly(), markPoly_s::color, vmCvar_t::integer, MARK_FADE_TIME, MARK_TOTAL_TIME, markPoly_t, markPoly_s::markShader, polyVert_t::modulate, markPoly_s::nextMark, poly_s::numVerts, markPoly_s::poly, markPoly_s::time, cg_t::time, trap_R_AddPolyToScene(), and markPoly_s::verts. Referenced by CG_DrawActiveFrame().
00221 {
00222 int j;
00223 markPoly_t *mp, *next;
00224 int t;
00225 int fade;
00226
00227 if ( !cg_addMarks.integer ) {
00228 return;
00229 }
00230
00231 mp = cg_activeMarkPolys.nextMark;
00232 for ( ; mp != &cg_activeMarkPolys ; mp = next ) {
00233 // grab next now, so if the local entity is freed we
00234 // still have it
00235 next = mp->nextMark;
00236
00237 // see if it is time to completely remove it
00238 if ( cg.time > mp->time + MARK_TOTAL_TIME ) {
00239 CG_FreeMarkPoly( mp );
00240 continue;
00241 }
00242
00243 // fade out the energy bursts
00244 //if ( mp->markShader == cgs.media.energyMarkShader ) {
00245 if (0) {
00246
00247 fade = 450 - 450 * ( (cg.time - mp->time ) / 3000.0 );
00248 if ( fade < 255 ) {
00249 if ( fade < 0 ) {
00250 fade = 0;
00251 }
00252 if ( mp->verts[0].modulate[0] != 0 ) {
00253 for ( j = 0 ; j < mp->poly.numVerts ; j++ ) {
00254 mp->verts[j].modulate[0] = mp->color[0] * fade;
00255 mp->verts[j].modulate[1] = mp->color[1] * fade;
00256 mp->verts[j].modulate[2] = mp->color[2] * fade;
00257 }
00258 }
00259 }
00260 }
00261
00262 // fade all marks out with time
00263 t = mp->time + MARK_TOTAL_TIME - cg.time;
00264 if ( t < MARK_FADE_TIME ) {
00265 fade = 255 * t / MARK_FADE_TIME;
00266 if ( mp->alphaFade ) {
00267 for ( j = 0 ; j < mp->poly.numVerts ; j++ ) {
00268 mp->verts[j].modulate[3] = fade;
00269 }
00270 }
00271 else
00272 {
00273 float f = (float)t / MARK_FADE_TIME;
00274 for ( j = 0 ; j < mp->poly.numVerts ; j++ ) {
00275 mp->verts[j].modulate[0] = mp->color[0] * f;
00276 mp->verts[j].modulate[1] = mp->color[1] * f;
00277 mp->verts[j].modulate[2] = mp->color[2] * f;
00278 }
00279 }
00280 }
00281 else
00282 {
00283 for ( j = 0 ; j < mp->poly.numVerts ; j++ ) {
00284 mp->verts[j].modulate[0] = mp->color[0];
00285 mp->verts[j].modulate[1] = mp->color[1];
00286 mp->verts[j].modulate[2] = mp->color[2];
00287 }
00288 }
00289
00290 trap_R_AddPolyToScene( mp->markShader, mp->poly.numVerts, mp->verts );
00291 }
00292 }
|
|
|
Definition at line 1081 of file cg_marks.c. References active_particles, particle_s::alpha, particle_s::alphavel, AngleVectors(), cg, CG_AddParticleToScene(), CG_ClearParticles(), cparticle_t, particle_s::endtime, free_particles, initparticles, particle_s::next, NULL, oldtime, particle_s::org, P_ANIM, P_BAT, P_BLEED, P_FLAT_SCALEUP_FADE, P_SMOKE, P_SMOKE_IMPACT, P_SPRITE, P_WEATHER_FLURRY, pvforward, pvright, pvup, cg_t::refdef, rforward, ROLL, rright, rup, particle_s::time, cg_t::time, particle_s::type, vec3_t, vectoangles(), VectorCopy, and refdef_t::viewaxis. Referenced by CG_DrawActiveFrame().
01082 {
01083 cparticle_t *p, *next;
01084 float alpha;
01085 float time, time2;
01086 vec3_t org;
01087 int color;
01088 cparticle_t *active, *tail;
01089 int type;
01090 vec3_t rotate_ang;
01091
01092 if (!initparticles)
01093 CG_ClearParticles ();
01094
01095 VectorCopy( cg.refdef.viewaxis[0], pvforward );
01096 VectorCopy( cg.refdef.viewaxis[1], pvright );
01097 VectorCopy( cg.refdef.viewaxis[2], pvup );
01098
01099 vectoangles( cg.refdef.viewaxis[0], rotate_ang );
01100 roll += ((cg.time - oldtime) * 0.1) ;
01101 rotate_ang[ROLL] += (roll*0.9);
01102 AngleVectors ( rotate_ang, rforward, rright, rup);
01103
01104 oldtime = cg.time;
01105
01106 active = NULL;
01107 tail = NULL;
01108
01109 for (p=active_particles ; p ; p=next)
01110 {
01111
01112 next = p->next;
01113
01114 time = (cg.time - p->time)*0.001;
01115
01116 alpha = p->alpha + time*p->alphavel;
01117 if (alpha <= 0)
01118 { // faded out
01119 p->next = free_particles;
01120 free_particles = p;
01121 p->type = 0;
01122 p->color = 0;
01123 p->alpha = 0;
01124 continue;
01125 }
01126
01127 if (p->type == P_SMOKE || p->type == P_ANIM || p->type == P_BLEED || p->type == P_SMOKE_IMPACT)
01128 {
01129 if (cg.time > p->endtime)
01130 {
01131 p->next = free_particles;
01132 free_particles = p;
01133 p->type = 0;
01134 p->color = 0;
01135 p->alpha = 0;
01136
01137 continue;
01138 }
01139
01140 }
01141
01142 if (p->type == P_WEATHER_FLURRY)
01143 {
01144 if (cg.time > p->endtime)
01145 {
01146 p->next = free_particles;
01147 free_particles = p;
01148 p->type = 0;
01149 p->color = 0;
01150 p->alpha = 0;
01151
01152 continue;
01153 }
01154 }
01155
01156
01157 if (p->type == P_FLAT_SCALEUP_FADE)
01158 {
01159 if (cg.time > p->endtime)
01160 {
01161 p->next = free_particles;
01162 free_particles = p;
01163 p->type = 0;
01164 p->color = 0;
01165 p->alpha = 0;
01166 continue;
01167 }
01168
01169 }
01170
01171 if ((p->type == P_BAT || p->type == P_SPRITE) && p->endtime < 0) {
01172 // temporary sprite
01173 CG_AddParticleToScene (p, p->org, alpha);
01174 p->next = free_particles;
01175 free_particles = p;
01176 p->type = 0;
01177 p->color = 0;
01178 p->alpha = 0;
01179 continue;
01180 }
01181
01182 p->next = NULL;
01183 if (!tail)
01184 active = tail = p;
01185 else
01186 {
01187 tail->next = p;
01188 tail = p;
01189 }
01190
01191 if (alpha > 1.0)
01192 alpha = 1;
01193
01194 color = p->color;
01195
01196 time2 = time*time;
01197
01198 org[0] = p->org[0] + p->vel[0]*time + p->accel[0]*time2;
01199 org[1] = p->org[1] + p->vel[1]*time + p->accel[1]*time2;
01200 org[2] = p->org[2] + p->vel[2]*time + p->accel[2]*time2;
01201
01202 type = p->type;
01203
01204 CG_AddParticleToScene (p, org, alpha);
01205 }
01206
01207 active_particles = active;
01208 }
|
|
|
Definition at line 1550 of file cg_marks.c. References localEntity_t.
01551 {
01552 return;
01553 }
|
|
||||||||||||||||
|
Definition at line 436 of file cg_marks.c. References particle_s::accumroll, particle_s::alpha, AngleVectors(), BLOODRED, cg, particle_s::color, cos(), cparticle_t, crandom, DEG2RAD, EMISIVEFADE, particle_s::end, particle_s::endheight, particle_s::endtime, particle_s::endwidth, floor(), GREY75, particle_s::height, particle_s::link, polyVert_t::modulate, NULL, particle_s::org, playerState_s::origin, P_ANIM, P_BLEED, P_BUBBLE, P_BUBBLE_TURBULENT, P_FLAT, P_FLAT_SCALEUP, P_SMOKE, P_SMOKE_IMPACT, P_SPRITE, P_WEATHER, P_WEATHER_FLURRY, P_WEATHER_TURBULENT, snapshot_t::ps, particle_s::pshader, pvright, pvup, cg_t::refdef, rforward, ROLL, particle_s::roll, particle_s::rotate, rright, rup, particle_s::shaderAnim, sin(), cg_t::snap, sqrt(), polyVert_t::st, particle_s::start, particle_s::startfade, cg_t::time, particle_s::time, trap_R_AddPolyToScene(), particle_s::type, vec3_t, vectoangles(), VectorCopy, VectorMA, VectorSet, particle_s::vel, refdef_t::viewaxis, particle_s::width, and polyVert_t::xyz. Referenced by CG_AddParticles().
00437 {
00438
00439 vec3_t point;
00440 polyVert_t verts[4];
00441 float width;
00442 float height;
00443 float time, time2;
00444 float ratio;
00445 float invratio;
00446 vec3_t color;
00447 polyVert_t TRIverts[3];
00448 vec3_t rright2, rup2;
00449
00450 if (p->type == P_WEATHER || p->type == P_WEATHER_TURBULENT || p->type == P_WEATHER_FLURRY
00451 || p->type == P_BUBBLE || p->type == P_BUBBLE_TURBULENT)
00452 {// create a front facing polygon
00453
00454 if (p->type != P_WEATHER_FLURRY)
00455 {
00456 if (p->type == P_BUBBLE || p->type == P_BUBBLE_TURBULENT)
00457 {
00458 if (org[2] > p->end)
00459 {
00460 p->time = cg.time;
00461 VectorCopy (org, p->org); // Ridah, fixes rare snow flakes that flicker on the ground
00462
00463 p->org[2] = ( p->start + crandom () * 4 );
00464
00465
00466 if (p->type == P_BUBBLE_TURBULENT)
00467 {
00468 p->vel[0] = crandom() * 4;
00469 p->vel[1] = crandom() * 4;
00470 }
00471
00472 }
00473 }
00474 else
00475 {
00476 if (org[2] < p->end)
00477 {
00478 p->time = cg.time;
00479 VectorCopy (org, p->org); // Ridah, fixes rare snow flakes that flicker on the ground
00480
00481 while (p->org[2] < p->end)
00482 {
00483 p->org[2] += (p->start - p->end);
00484 }
00485
00486
00487 if (p->type == P_WEATHER_TURBULENT)
00488 {
00489 p->vel[0] = crandom() * 16;
00490 p->vel[1] = crandom() * 16;
00491 }
00492
00493 }
00494 }
00495
00496
00497 // Rafael snow pvs check
00498 if (!p->link)
00499 return;
00500
00501 p->alpha = 1;
00502 }
00503
00504 // Ridah, had to do this or MAX_POLYS is being exceeded in village1.bsp
00505 if (Distance( cg.snap->ps.origin, org ) > 1024) {
00506 return;
00507 }
00508 // done.
00509
00510 if (p->type == P_BUBBLE || p->type == P_BUBBLE_TURBULENT)
00511 {
00512 VectorMA (org, -p->height, pvup, point);
00513 VectorMA (point, -p->width, pvright, point);
00514 VectorCopy (point, verts[0].xyz);
00515 verts[0].st[0] = 0;
00516 verts[0].st[1] = 0;
00517 verts[0].modulate[0] = 255;
00518 verts[0].modulate[1] = 255;
00519 verts[0].modulate[2] = 255;
00520 verts[0].modulate[3] = 255 * p->alpha;
00521
00522 VectorMA (org, -p->height, pvup, point);
00523 VectorMA (point, p->width, pvright, point);
00524 VectorCopy (point, verts[1].xyz);
00525 verts[1].st[0] = 0;
00526 verts[1].st[1] = 1;
00527 verts[1].modulate[0] = 255;
00528 verts[1].modulate[1] = 255;
00529 verts[1].modulate[2] = 255;
00530 verts[1].modulate[3] = 255 * p->alpha;
00531
00532 VectorMA (org, p->height, pvup, point);
00533 VectorMA (point, p->width, pvright, point);
00534 VectorCopy (point, verts[2].xyz);
00535 verts[2].st[0] = 1;
00536 verts[2].st[1] = 1;
00537 verts[2].modulate[0] = 255;
00538 verts[2].modulate[1] = 255;
00539 verts[2].modulate[2] = 255;
00540 verts[2].modulate[3] = 255 * p->alpha;
00541
00542 VectorMA (org, p->height, pvup, point);
00543 VectorMA (point, -p->width, pvright, point);
00544 VectorCopy (point, verts[3].xyz);
00545 verts[3].st[0] = 1;
00546 verts[3].st[1] = 0;
00547 verts[3].modulate[0] = 255;
00548 verts[3].modulate[1] = 255;
00549 verts[3].modulate[2] = 255;
00550 verts[3].modulate[3] = 255 * p->alpha;
00551 }
00552 else
00553 {
00554 VectorMA (org, -p->height, pvup, point);
00555 VectorMA (point, -p->width, pvright, point);
00556 VectorCopy( point, TRIverts[0].xyz );
00557 TRIverts[0].st[0] = 1;
00558 TRIverts[0].st[1] = 0;
00559 TRIverts[0].modulate[0] = 255;
00560 TRIverts[0].modulate[1] = 255;
00561 TRIverts[0].modulate[2] = 255;
00562 TRIverts[0].modulate[3] = 255 * p->alpha;
00563
00564 VectorMA (org, p->height, pvup, point);
00565 VectorMA (point, -p->width, pvright, point);
00566 VectorCopy (point, TRIverts[1].xyz);
00567 TRIverts[1].st[0] = 0;
00568 TRIverts[1].st[1] = 0;
00569 TRIverts[1].modulate[0] = 255;
00570 TRIverts[1].modulate[1] = 255;
00571 TRIverts[1].modulate[2] = 255;
00572 TRIverts[1].modulate[3] = 255 * p->alpha;
00573
00574 VectorMA (org, p->height, pvup, point);
00575 VectorMA (point, p->width, pvright, point);
00576 VectorCopy (point, TRIverts[2].xyz);
00577 TRIverts[2].st[0] = 0;
00578 TRIverts[2].st[1] = 1;
00579 TRIverts[2].modulate[0] = 255;
00580 TRIverts[2].modulate[1] = 255;
00581 TRIverts[2].modulate[2] = 255;
00582 TRIverts[2].modulate[3] = 255 * p->alpha;
00583 }
00584
00585 }
00586 else if (p->type == P_SPRITE)
00587 {
00588 vec3_t rr, ru;
00589 vec3_t rotate_ang;
00590
00591 VectorSet (color, 1.0, 1.0, 0.5);
00592 time = cg.time - p->time;
00593 time2 = p->endtime - p->time;
00594 ratio = time / time2;
00595
00596 width = p->width + ( ratio * ( p->endwidth - p->width) );
00597 height = p->height + ( ratio * ( p->endheight - p->height) );
00598
00599 if (p->roll) {
00600 vectoangles( cg.refdef.viewaxis[0], rotate_ang );
00601 rotate_ang[ROLL] += p->roll;
00602 AngleVectors ( rotate_ang, NULL, rr, ru);
00603 }
00604
00605 if (p->roll) {
00606 VectorMA (org, -height, ru, point);
00607 VectorMA (point, -width, rr, point);
00608 } else {
00609 VectorMA (org, -height, pvup, point);
00610 VectorMA (point, -width, pvright, point);
00611 }
00612 VectorCopy (point, verts[0].xyz);
00613 verts[0].st[0] = 0;
00614 verts[0].st[1] = 0;
00615 verts[0].modulate[0] = 255;
00616 verts[0].modulate[1] = 255;
00617 verts[0].modulate[2] = 255;
00618 verts[0].modulate[3] = 255;
00619
00620 if (p->roll) {
00621 VectorMA (point, 2*height, ru, point);
00622 } else {
00623 VectorMA (point, 2*height, pvup, point);
00624 }
00625 VectorCopy (point, verts[1].xyz);
00626 verts[1].st[0] = 0;
00627 verts[1].st[1] = 1;
00628 verts[1].modulate[0] = 255;
00629 verts[1].modulate[1] = 255;
00630 verts[1].modulate[2] = 255;
00631 verts[1].modulate[3] = 255;
00632
00633 if (p->roll) {
00634 VectorMA (point, 2*width, rr, point);
00635 } else {
00636 VectorMA (point, 2*width, pvright, point);
00637 }
00638 VectorCopy (point, verts[2].xyz);
00639 verts[2].st[0] = 1;
00640 verts[2].st[1] = 1;
00641 verts[2].modulate[0] = 255;
00642 verts[2].modulate[1] = 255;
00643 verts[2].modulate[2] = 255;
00644 verts[2].modulate[3] = 255;
00645
00646 if (p->roll) {
00647 VectorMA (point, -2*height, ru, point);
00648 } else {
00649 VectorMA (point, -2*height, pvup, point);
00650 }
00651 VectorCopy (point, verts[3].xyz);
00652 verts[3].st[0] = 1;
00653 verts[3].st[1] = 0;
00654 verts[3].modulate[0] = 255;
00655 verts[3].modulate[1] = 255;
00656 verts[3].modulate[2] = 255;
00657 verts[3].modulate[3] = 255;
00658 }
00659 else if (p->type == P_SMOKE || p->type == P_SMOKE_IMPACT)
00660 {// create a front rotating facing polygon
00661
00662 if ( p->type == P_SMOKE_IMPACT && Distance( cg.snap->ps.origin, org ) > 1024) {
00663 return;
00664 }
00665
00666 if (p->color == BLOODRED)
00667 VectorSet (color, 0.22f, 0.0f, 0.0f);
00668 else if (p->color == GREY75)
00669 {
00670 float len;
00671 float greyit;
00672 float val;
00673 len = Distance (cg.snap->ps.origin, org);
00674 if (!len)
00675 len = 1;
00676
00677 val = 4096/len;
00678 greyit = 0.25 * val;
00679 if (greyit > 0.5)
00680 greyit = 0.5;
00681
00682 VectorSet (color, greyit, greyit, greyit);
00683 }
00684 else
00685 VectorSet (color, 1.0, 1.0, 1.0);
00686
00687 time = cg.time - p->time;
00688 time2 = p->endtime - p->time;
00689 ratio = time / time2;
00690
00691 if (cg.time > p->startfade)
00692 {
00693 invratio = 1 - ( (cg.time - p->startfade) / (p->endtime - p->startfade) );
00694
00695 if (p->color == EMISIVEFADE)
00696 {
00697 float fval;
00698 fval = (invratio * invratio);
00699 if (fval < 0)
00700 fval = 0;
00701 VectorSet (color, fval , fval , fval );
00702 }
00703 invratio *= p->alpha;
00704 }
00705 else
00706 invratio = 1 * p->alpha;
00707
00708 if (invratio > 1)
00709 invratio = 1;
00710
00711 width = p->width + ( ratio * ( p->endwidth - p->width) );
00712 height = p->height + ( ratio * ( p->endheight - p->height) );
00713
00714 if (p->type != P_SMOKE_IMPACT)
00715 {
00716 vec3_t temp;
00717
00718 vectoangles (rforward, temp);
00719 p->accumroll += p->roll;
00720 temp[ROLL] += p->accumroll * 0.1;
00721 AngleVectors ( temp, NULL, rright2, rup2);
00722 }
00723 else
00724 {
00725 VectorCopy (rright, rright2);
00726 VectorCopy (rup, rup2);
00727 }
00728
00729 if (p->rotate)
00730 {
00731 VectorMA (org, -height, rup2, point);
00732 VectorMA (point, -width, rright2, point);
00733 }
00734 else
00735 {
00736 VectorMA (org, -p->height, pvup, point);
00737 VectorMA (point, -p->width, pvright, point);
00738 }
00739 VectorCopy (point, verts[0].xyz);
00740 verts[0].st[0] = 0;
00741 verts[0].st[1] = 0;
00742 verts[0].modulate[0] = 255 * color[0];
00743 verts[0].modulate[1] = 255 * color[1];
00744 verts[0].modulate[2] = 255 * color[2];
00745 verts[0].modulate[3] = 255 * invratio;
00746
00747 if (p->rotate)
00748 {
00749 VectorMA (org, -height, rup2, point);
00750 VectorMA (point, width, rright2, point);
00751 }
00752 else
00753 {
00754 VectorMA (org, -p->height, pvup, point);
00755 VectorMA (point, p->width, pvright, point);
00756 }
00757 VectorCopy (point, verts[1].xyz);
00758 verts[1].st[0] = 0;
00759 verts[1].st[1] = 1;
00760 verts[1].modulate[0] = 255 * color[0];
00761 verts[1].modulate[1] = 255 * color[1];
00762 verts[1].modulate[2] = 255 * color[2];
00763 verts[1].modulate[3] = 255 * invratio;
00764
00765 if (p->rotate)
00766 {
00767 VectorMA (org, height, rup2, point);
00768 VectorMA (point, width, rright2, point);
00769 }
00770 else
00771 {
00772 VectorMA (org, p->height, pvup, point);
00773 VectorMA (point, p->width, pvright, point);
00774 }
00775 VectorCopy (point, verts[2].xyz);
00776 verts[2].st[0] = 1;
00777 verts[2].st[1] = 1;
00778 verts[2].modulate[0] = 255 * color[0];
00779 verts[2].modulate[1] = 255 * color[1];
00780 verts[2].modulate[2] = 255 * color[2];
00781 verts[2].modulate[3] = 255 * invratio;
00782
00783 if (p->rotate)
00784 {
00785 VectorMA (org, height, rup2, point);
00786 VectorMA (point, -width, rright2, point);
00787 }
00788 else
00789 {
00790 VectorMA (org, p->height, pvup, point);
00791 VectorMA (point, -p->width, pvright, point);
00792 }
00793 VectorCopy (point, verts[3].xyz);
00794 verts[3].st[0] = 1;
00795 verts[3].st[1] = 0;
00796 verts[3].modulate[0] = 255 * color[0];
00797 verts[3].modulate[1] = 255 * color[1];
00798 verts[3].modulate[2] = 255 * color[2];
00799 verts[3].modulate[3] = 255 * invratio;
00800
00801 }
00802 else if (p->type == P_BLEED)
00803 {
00804 vec3_t rr, ru;
00805 vec3_t rotate_ang;
00806 float alpha;
00807
00808 alpha = p->alpha;
00809
00810 if (p->roll)
00811 {
00812 vectoangles( cg.refdef.viewaxis[0], rotate_ang );
00813 rotate_ang[ROLL] += p->roll;
00814 AngleVectors ( rotate_ang, NULL, rr, ru);
00815 }
00816 else
00817 {
00818 VectorCopy (pvup, ru);
00819 VectorCopy (pvright, rr);
00820 }
00821
00822 VectorMA (org, -p->height, ru, point);
00823 VectorMA (point, -p->width, rr, point);
00824 VectorCopy (point, verts[0].xyz);
00825 verts[0].st[0] = 0;
00826 verts[0].st[1] = 0;
00827 verts[0].modulate[0] = 111;
00828 verts[0].modulate[1] = 19;
00829 verts[0].modulate[2] = 9;
00830 verts[0].modulate[3] = 255 * alpha;
00831
00832 VectorMA (org, -p->height, ru, point);
00833 VectorMA (point, p->width, rr, point);
00834 VectorCopy (point, verts[1].xyz);
00835 verts[1].st[0] = 0;
00836 verts[1].st[1] = 1;
00837 verts[1].modulate[0] = 111;
00838 verts[1].modulate[1] = 19;
00839 verts[1].modulate[2] = 9;
00840 verts[1].modulate[3] = 255 * alpha;
00841
00842 VectorMA (org, p->height, ru, point);
00843 VectorMA (point, p->width, rr, point);
00844 VectorCopy (point, verts[2].xyz);
00845 verts[2].st[0] = 1;
00846 verts[2].st[1] = 1;
00847 verts[2].modulate[0] = 111;
00848 verts[2].modulate[1] = 19;
00849 verts[2].modulate[2] = 9;
00850 verts[2].modulate[3] = 255 * alpha;
00851
00852 VectorMA (org, p->height, ru, point);
00853 VectorMA (point, -p->width, rr, point);
00854 VectorCopy (point, verts[3].xyz);
00855 verts[3].st[0] = 1;
00856 verts[3].st[1] = 0;
00857 verts[3].modulate[0] = 111;
00858 verts[3].modulate[1] = 19;
00859 verts[3].modulate[2] = 9;
00860 verts[3].modulate[3] = 255 * alpha;
00861
00862 }
00863 else if (p->type == P_FLAT_SCALEUP)
00864 {
00865 float width, height;
00866 float sinR, cosR;
00867
00868 if (p->color == BLOODRED)
00869 VectorSet (color, 1, 1, 1);
00870 else
00871 VectorSet (color, 0.5, 0.5, 0.5);
00872
00873 time = cg.time - p->time;
00874 time2 = p->endtime - p->time;
00875 ratio = time / time2;
00876
00877 width = p->width + ( ratio * ( p->endwidth - p->width) );
00878 height = p->height + ( ratio * ( p->endheight - p->height) );
00879
00880 if (width > p->endwidth)
00881 width = p->endwidth;
00882
00883 if (height > p->endheight)
00884 height = p->endheight;
00885
00886 sinR = height * sin(DEG2RAD(p->roll)) * sqrt(2.0f);
00887 cosR = width * cos(DEG2RAD(p->roll)) * sqrt(2.0f);
00888
00889 VectorCopy (org, verts[0].xyz);
00890 verts[0].xyz[0] -= sinR;
00891 verts[0].xyz[1] -= cosR;
00892 verts[0].st[0] = 0;
00893 verts[0].st[1] = 0;
00894 verts[0].modulate[0] = 255 * color[0];
00895 verts[0].modulate[1] = 255 * color[1];
00896 verts[0].modulate[2] = 255 * color[2];
00897 verts[0].modulate[3] = 255;
00898
00899 VectorCopy (org, verts[1].xyz);
00900 verts[1].xyz[0] -= cosR;
00901 verts[1].xyz[1] += sinR;
00902 verts[1].st[0] = 0;
00903 verts[1].st[1] = 1;
00904 verts[1].modulate[0] = 255 * color[0];
00905 verts[1].modulate[1] = 255 * color[1];
00906 verts[1].modulate[2] = 255 * color[2];
00907 verts[1].modulate[3] = 255;
00908
00909 VectorCopy (org, verts[2].xyz);
00910 verts[2].xyz[0] += sinR;
00911 verts[2].xyz[1] += cosR;
00912 verts[2].st[0] = 1;
00913 verts[2].st[1] = 1;
00914 verts[2].modulate[0] = 255 * color[0];
00915 verts[2].modulate[1] = 255 * color[1];
00916 verts[2].modulate[2] = 255 * color[2];
00917 verts[2].modulate[3] = 255;
00918
00919 VectorCopy (org, verts[3].xyz);
00920 verts[3].xyz[0] += cosR;
00921 verts[3].xyz[1] -= sinR;
00922 verts[3].st[0] = 1;
00923 verts[3].st[1] = 0;
00924 verts[3].modulate[0] = 255 * color[0];
00925 verts[3].modulate[1] = 255 * color[1];
00926 verts[3].modulate[2] = 255 * color[2];
00927 verts[3].modulate[3] = 255;
00928 }
00929 else if (p->type == P_FLAT)
00930 {
00931
00932 VectorCopy (org, verts[0].xyz);
00933 verts[0].xyz[0] -= p->height;
00934 verts[0].xyz[1] -= p->width;
00935 verts[0].st[0] = 0;
00936 verts[0].st[1] = 0;
00937 verts[0].modulate[0] = 255;
00938 verts[0].modulate[1] = 255;
00939 verts[0].modulate[2] = 255;
00940 verts[0].modulate[3] = 255;
00941
00942 VectorCopy (org, verts[1].xyz);
00943 verts[1].xyz[0] -= p->height;
00944 verts[1].xyz[1] += p->width;
00945 verts[1].st[0] = 0;
00946 verts[1].st[1] = 1;
00947 verts[1].modulate[0] = 255;
00948 verts[1].modulate[1] = 255;
00949 verts[1].modulate[2] = 255;
00950 verts[1].modulate[3] = 255;
00951
00952 VectorCopy (org, verts[2].xyz);
00953 verts[2].xyz[0] += p->height;
00954 verts[2].xyz[1] += p->width;
00955 verts[2].st[0] = 1;
00956 verts[2].st[1] = 1;
00957 verts[2].modulate[0] = 255;
00958 verts[2].modulate[1] = 255;
00959 verts[2].modulate[2] = 255;
00960 verts[2].modulate[3] = 255;
00961
00962 VectorCopy (org, verts[3].xyz);
00963 verts[3].xyz[0] += p->height;
00964 verts[3].xyz[1] -= p->width;
00965 verts[3].st[0] = 1;
00966 verts[3].st[1] = 0;
00967 verts[3].modulate[0] = 255;
00968 verts[3].modulate[1] = 255;
00969 verts[3].modulate[2] = 255;
00970 verts[3].modulate[3] = 255;
00971
00972 }
00973 // Ridah
00974 else if (p->type == P_ANIM) {
00975 vec3_t rr, ru;
00976 vec3_t rotate_ang;
00977 int i, j;
00978
00979 time = cg.time - p->time;
00980 time2 = p->endtime - p->time;
00981 ratio = time / time2;
00982 if (ratio >= 1.0f) {
00983 ratio = 0.9999f;
00984 }
00985
00986 width = p->width + ( ratio * ( p->endwidth - p->width) );
00987 height = p->height + ( ratio * ( p->endheight - p->height) );
00988
00989 // if we are "inside" this sprite, don't draw
00990 if (Distance( cg.snap->ps.origin, org ) < width/1.5) {
00991 return;
00992 }
00993
00994 i = p->shaderAnim;
00995 j = (int)floor(ratio * shaderAnimCounts[p->shaderAnim]);
00996 p->pshader = shaderAnims[i][j];
00997
00998 if (p->roll) {
00999 vectoangles( cg.refdef.viewaxis[0], rotate_ang );
01000 rotate_ang[ROLL] += p->roll;
01001 AngleVectors ( rotate_ang, NULL, rr, ru);
01002 }
01003
01004 if (p->roll) {
01005 VectorMA (org, -height, ru, point);
01006 VectorMA (point, -width, rr, point);
01007 } else {
01008 VectorMA (org, -height, pvup, point);
01009 VectorMA (point, -width, pvright, point);
01010 }
01011 VectorCopy (point, verts[0].xyz);
01012 verts[0].st[0] = 0;
01013 verts[0].st[1] = 0;
01014 verts[0].modulate[0] = 255;
01015 verts[0].modulate[1] = 255;
01016 verts[0].modulate[2] = 255;
01017 verts[0].modulate[3] = 255;
01018
01019 if (p->roll) {
01020 VectorMA (point, 2*height, ru, point);
01021 } else {
01022 VectorMA (point, 2*height, pvup, point);
01023 }
01024 VectorCopy (point, verts[1].xyz);
01025 verts[1].st[0] = 0;
01026 verts[1].st[1] = 1;
01027 verts[1].modulate[0] = 255;
01028 verts[1].modulate[1] = 255;
01029 verts[1].modulate[2] = 255;
01030 verts[1].modulate[3] = 255;
01031
01032 if (p->roll) {
01033 VectorMA (point, 2*width, rr, point);
01034 } else {
01035 VectorMA (point, 2*width, pvright, point);
01036 }
01037 VectorCopy (point, verts[2].xyz);
01038 verts[2].st[0] = 1;
01039 verts[2].st[1] = 1;
01040 verts[2].modulate[0] = 255;
01041 verts[2].modulate[1] = 255;
01042 verts[2].modulate[2] = 255;
01043 verts[2].modulate[3] = 255;
01044
01045 if (p->roll) {
01046 VectorMA (point, -2*height, ru, point);
01047 } else {
01048 VectorMA (point, -2*height, pvup, point);
01049 }
01050 VectorCopy (point, verts[3].xyz);
01051 verts[3].st[0] = 1;
01052 verts[3].st[1] = 0;
01053 verts[3].modulate[0] = 255;
01054 verts[3].modulate[1] = 255;
01055 |