| 1 |
/* |
| 2 |
=========================================================================== |
| 3 |
Copyright (C) 1999-2005 Id Software, Inc. |
| 4 |
|
| 5 |
This file is part of Quake III Arena source code. |
| 6 |
|
| 7 |
Quake III Arena source code is free software; you can redistribute it |
| 8 |
and/or modify it under the terms of the GNU General Public License as |
| 9 |
published by the Free Software Foundation; either version 2 of the License, |
| 10 |
or (at your option) any later version. |
| 11 |
|
| 12 |
Quake III Arena source code is distributed in the hope that it will be |
| 13 |
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
GNU General Public License for more details. |
| 16 |
|
| 17 |
You should have received a copy of the GNU General Public License |
| 18 |
along with Quake III Arena source code; if not, write to the Free Software |
| 19 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 |
=========================================================================== |
| 21 |
*/ |
| 22 |
// |
| 23 |
|
| 24 |
// cg_localents.c -- every frame, generate renderer commands for locally |
| 25 |
// processed entities, like smoke puffs, gibs, shells, etc. |
| 26 |
|
| 27 |
#include "cg_local.h" |
| 28 |
|
| 29 |
#define MAX_LOCAL_ENTITIES 512 |
| 30 |
localEntity_t cg_localEntities[MAX_LOCAL_ENTITIES]; |
| 31 |
localEntity_t cg_activeLocalEntities; // double linked list |
| 32 |
localEntity_t *cg_freeLocalEntities; // single linked list |
| 33 |
|
| 34 |
/* |
| 35 |
=================== |
| 36 |
CG_InitLocalEntities |
| 37 |
|
| 38 |
This is called at startup and for tournement restarts |
| 39 |
=================== |
| 40 |
*/ |
| 41 |
void CG_InitLocalEntities( void ) { |
| 42 |
int i; |
| 43 |
|
| 44 |
memset( cg_localEntities, 0, sizeof( cg_localEntities ) ); |
| 45 |
cg_activeLocalEntities.next = &cg_activeLocalEntities; |
| 46 |
cg_activeLocalEntities.prev = &cg_activeLocalEntities; |
| 47 |
cg_freeLocalEntities = cg_localEntities; |
| 48 |
for ( i = 0 ; i < MAX_LOCAL_ENTITIES - 1 ; i++ ) { |
| 49 |
cg_localEntities[i].next = &cg_localEntities[i+1]; |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
|
| 54 |
/* |
| 55 |
================== |
| 56 |
CG_FreeLocalEntity |
| 57 |
================== |
| 58 |
*/ |
| 59 |
void CG_FreeLocalEntity( localEntity_t *le ) { |
| 60 |
if ( !le->prev ) { |
| 61 |
CG_Error( "CG_FreeLocalEntity: not active" ); |
| 62 |
} |
| 63 |
|
| 64 |
// remove from the doubly linked active list |
| 65 |
le->prev->next = le->next; |
| 66 |
le->next->prev = le->prev; |
| 67 |
|
| 68 |
// the free list is only singly linked |
| 69 |
le->next = cg_freeLocalEntities; |
| 70 |
cg_freeLocalEntities = le; |
| 71 |
} |
| 72 |
|
| 73 |
/* |
| 74 |
=================== |
| 75 |
CG_AllocLocalEntity |
| 76 |
|
| 77 |
Will allways succeed, even if it requires freeing an old active entity |
| 78 |
=================== |
| 79 |
*/ |
| 80 |
localEntity_t *CG_AllocLocalEntity( void ) { |
| 81 |
localEntity_t *le; |
| 82 |
|
| 83 |
if ( !cg_freeLocalEntities ) { |
| 84 |
// no free entities, so free the one at the end of the chain |
| 85 |
// remove the oldest active entity |
| 86 |
CG_FreeLocalEntity( cg_activeLocalEntities.prev ); |
| 87 |
} |
| 88 |
|
| 89 |
le = cg_freeLocalEntities; |
| 90 |
cg_freeLocalEntities = cg_freeLocalEntities->next; |
| 91 |
|
| 92 |
memset( le, 0, sizeof( *le ) ); |
| 93 |
|
| 94 |
// link into the active list |
| 95 |
le->next = cg_activeLocalEntities.next; |
| 96 |
le->prev = &cg_activeLocalEntities; |
| 97 |
cg_activeLocalEntities.next->prev = le; |
| 98 |
cg_activeLocalEntities.next = le; |
| 99 |
return le; |
| 100 |
} |
| 101 |
|
| 102 |
|
| 103 |
/* |
| 104 |
==================================================================================== |
| 105 |
|
| 106 |
FRAGMENT PROCESSING |
| 107 |
|
| 108 |
A fragment localentity interacts with the environment in some way (hitting walls), |
| 109 |
or generates more localentities along a trail. |
| 110 |
|
| 111 |
==================================================================================== |
| 112 |
*/ |
| 113 |
|
| 114 |
/* |
| 115 |
================ |
| 116 |
CG_BloodTrail |
| 117 |
|
| 118 |
Leave expanding blood puffs behind gibs |
| 119 |
================ |
| 120 |
*/ |
| 121 |
void CG_BloodTrail( localEntity_t *le ) { |
| 122 |
int t; |
| 123 |
int t2; |
| 124 |
int step; |
| 125 |
vec3_t newOrigin; |
| 126 |
localEntity_t *blood; |
| 127 |
|
| 128 |
step = 150; |
| 129 |
t = step * ( (cg.time - cg.frametime + step ) / step ); |
| 130 |
t2 = step * ( cg.time / step ); |
| 131 |
|
| 132 |
for ( ; t <= t2; t += step ) { |
| 133 |
BG_EvaluateTrajectory( &le->pos, t, newOrigin ); |
| 134 |
|
| 135 |
blood = CG_SmokePuff( newOrigin, vec3_origin, |
| 136 |
20, // radius |
| 137 |
1, 1, 1, 1, // color |
| 138 |
2000, // trailTime |
| 139 |
t, // startTime |
| 140 |
0, // fadeInTime |
| 141 |
0, // flags |
| 142 |
cgs.media.bloodTrailShader ); |
| 143 |
// use the optimized version |
| 144 |
blood->leType = LE_FALL_SCALE_FADE; |
| 145 |
// drop a total of 40 units over its lifetime |
| 146 |
blood->pos.trDelta[2] = 40; |
| 147 |
if ( cg_leiSuperGoreyAwesome.integer ) { |
| 148 |
// blood = CG_SpurtBlood( newOrigin, vec3_origin, 3); // LEILEI more gore plz |
| 149 |
} |
| 150 |
} |
| 151 |
} |
| 152 |
|
| 153 |
|
| 154 |
// LEILEI |
| 155 |
void CG_SmallBloodTrail( localEntity_t *le ) { |
| 156 |
int t; |
| 157 |
int t2; |
| 158 |
int step; |
| 159 |
vec3_t newOrigin; |
| 160 |
localEntity_t *blood; |
| 161 |
|
| 162 |
step = 61; |
| 163 |
t = step * ( (cg.time - cg.frametime + step ) / step ); |
| 164 |
t2 = step * ( cg.time / step ); |
| 165 |
|
| 166 |
for ( ; t <= t2; t += step ) { |
| 167 |
BG_EvaluateTrajectory( &le->pos, t, newOrigin ); |
| 168 |
|
| 169 |
blood = CG_SmokePuff( newOrigin, vec3_origin, |
| 170 |
3, // radius |
| 171 |
1, 1, 1, 1, // color |
| 172 |
770, // trailTime |
| 173 |
t, // startTime |
| 174 |
0, // fadeInTime |
| 175 |
0, // flags |
| 176 |
cgs.media.lbldShader1 ); |
| 177 |
// use the optimized version |
| 178 |
blood->leType = LE_FALL_SCALE_FADE; |
| 179 |
// drop a total of 40 units over its lifetime |
| 180 |
blood->pos.trDelta[2] = 120; |
| 181 |
} |
| 182 |
} |
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
/* |
| 187 |
================ |
| 188 |
CG_FragmentBounceMark |
| 189 |
================ |
| 190 |
*/ |
| 191 |
void CG_FragmentBounceMark( localEntity_t *le, trace_t *trace ) { |
| 192 |
int radius; |
| 193 |
|
| 194 |
if ( le->leMarkType == LEMT_BLOOD ) { |
| 195 |
|
| 196 |
radius = 16 + (rand()&31); |
| 197 |
CG_ImpactMark( cgs.media.bloodMarkShader, trace->endpos, trace->plane.normal, random()*360, |
| 198 |
1,1,1,1, qtrue, radius, qfalse ); |
| 199 |
} else if ( le->leMarkType == LEMT_BURN ) { |
| 200 |
|
| 201 |
radius = 8 + (rand()&15); |
| 202 |
CG_ImpactMark( cgs.media.burnMarkShader, trace->endpos, trace->plane.normal, random()*360, |
| 203 |
1,1,1,1, qtrue, radius, qfalse ); |
| 204 |
} |
| 205 |
|
| 206 |
|
| 207 |
// don't allow a fragment to make multiple marks, or they |
| 208 |
// pile up while settling |
| 209 |
le->leMarkType = LEMT_NONE; |
| 210 |
} |
| 211 |
|
| 212 |
/* |
| 213 |
================ |
| 214 |
CG_FragmentBounceSound |
| 215 |
================ |
| 216 |
*/ |
| 217 |
void CG_FragmentBounceSound( localEntity_t *le, trace_t *trace ) { |
| 218 |
if ( le->leBounceSoundType == LEBS_BLOOD ) { |
| 219 |
// half the gibs will make splat sounds |
| 220 |
if ( rand() & 1 ) { |
| 221 |
int r = rand()&3; |
| 222 |
sfxHandle_t s; |
| 223 |
|
| 224 |
if ( r == 0 ) { |
| 225 |
s = cgs.media.gibBounce1Sound; |
| 226 |
} else if ( r == 1 ) { |
| 227 |
s = cgs.media.gibBounce2Sound; |
| 228 |
} else { |
| 229 |
s = cgs.media.gibBounce3Sound; |
| 230 |
} |
| 231 |
trap_S_StartSound( trace->endpos, ENTITYNUM_WORLD, CHAN_AUTO, s ); |
| 232 |
} |
| 233 |
} else if ( le->leBounceSoundType == LEBS_BRASS ) { |
| 234 |
if ( cg_leiBrassNoise.integer ) { |
| 235 |
// half the casings will make casing sounds |
| 236 |
if ( rand() & 1 ) { |
| 237 |
int r = rand()&3; |
| 238 |
sfxHandle_t s; |
| 239 |
|
| 240 |
if ( r == 0 ) { |
| 241 |
s = cgs.media.lbul1Sound; |
| 242 |
} else if ( r == 1 ) { |
| 243 |
s = cgs.media.lbul2Sound; |
| 244 |
} else { |
| 245 |
s = cgs.media.lbul3Sound; |
| 246 |
} |
| 247 |
trap_S_StartSound( trace->endpos, ENTITYNUM_WORLD, CHAN_AUTO, s ); |
| 248 |
} |
| 249 |
} |
| 250 |
|
| 251 |
} else if ( le->leBounceSoundType == LEBS_SHELL ) { |
| 252 |
|
| 253 |
if ( cg_leiBrassNoise.integer ) { |
| 254 |
|
| 255 |
// half the casings will make casing sounds |
| 256 |
if ( rand() & 1 ) { |
| 257 |
int r = rand()&3; |
| 258 |
sfxHandle_t s; |
| 259 |
|
| 260 |
if ( r == 0 ) { |
| 261 |
s = cgs.media.lshl1Sound; |
| 262 |
} else if ( r == 1 ) { |
| 263 |
s = cgs.media.lshl2Sound; |
| 264 |
} else { |
| 265 |
s = cgs.media.lshl3Sound; |
| 266 |
} |
| 267 |
trap_S_StartSound( trace->endpos, ENTITYNUM_WORLD, CHAN_AUTO, s ); |
| 268 |
} |
| 269 |
} |
| 270 |
|
| 271 |
} |
| 272 |
|
| 273 |
// don't allow a fragment to make multiple bounce sounds, |
| 274 |
// or it gets too noisy as they settle |
| 275 |
le->leBounceSoundType = LEBS_NONE; |
| 276 |
} |
| 277 |
|
| 278 |
|
| 279 |
// LEILEI |
| 280 |
void CG_GoreMark( localEntity_t *le, trace_t *trace ) { |
| 281 |
int radius; |
| 282 |
|
| 283 |
if ( le->leMarkType == LEMT_BURN ) { |
| 284 |
|
| 285 |
radius = 6 + (rand()&16); |
| 286 |
CG_ImpactMark( cgs.media.lbldShader2, trace->endpos, trace->plane.normal, random()*360, |
| 287 |
1,1,1,1, qtrue, radius, qfalse ); |
| 288 |
|
| 289 |
} |
| 290 |
|
| 291 |
le->leMarkType = LEMT_NONE; |
| 292 |
} |
| 293 |
|
| 294 |
|
| 295 |
/* |
| 296 |
================ |
| 297 |
CG_SplatSound LEILEI |
| 298 |
================ |
| 299 |
*/ |
| 300 |
void CG_SplatSound( localEntity_t *le, trace_t *trace ) { |
| 301 |
if ( le->leBounceSoundType == LEBS_BLOOD ) { |
| 302 |
// half the splats will make splat sounds |
| 303 |
if ( cg_leiGoreNoise.integer ) { |
| 304 |
if ( rand() & 1 ) { |
| 305 |
int r = rand()&3; |
| 306 |
sfxHandle_t s; |
| 307 |
|
| 308 |
if ( r == 0 ) { |
| 309 |
s = cgs.media.lspl1Sound; |
| 310 |
} else if ( r == 1 ) { |
| 311 |
s = cgs.media.lspl2Sound; |
| 312 |
} else { |
| 313 |
s = cgs.media.lspl3Sound; |
| 314 |
} |
| 315 |
trap_S_StartSound( trace->endpos, ENTITYNUM_WORLD, CHAN_AUTO, s ); |
| 316 |
} |
| 317 |
} |
| 318 |
} else if ( le->leBounceSoundType == LEBS_BRASS ) { |
| 319 |
// no GERMAN EURO CENSOR ROBOTS mode yet. |
| 320 |
} |
| 321 |
|
| 322 |
// don't allow a fragment to make multiple bounce sounds, |
| 323 |
// or it gets too noisy as they settle |
| 324 |
le->leBounceSoundType = LEBS_NONE; |
| 325 |
} |
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
/* |
| 330 |
================ |
| 331 |
CG_ReflectVelocity |
| 332 |
================ |
| 333 |
*/ |
| 334 |
void CG_ReflectVelocity( localEntity_t *le, trace_t *trace ) { |
| 335 |
vec3_t velocity; |
| 336 |
float dot; |
| 337 |
int hitTime; |
| 338 |
|
| 339 |
// reflect the velocity on the trace plane |
| 340 |
hitTime = cg.time - cg.frametime + cg.frametime * trace->fraction; |
| 341 |
BG_EvaluateTrajectoryDelta( &le->pos, hitTime, velocity ); |
| 342 |
dot = DotProduct( velocity, trace->plane.normal ); |
| 343 |
VectorMA( velocity, -2*dot, trace->plane.normal, le->pos.trDelta ); |
| 344 |
|
| 345 |
VectorScale( le->pos.trDelta, le->bounceFactor, le->pos.trDelta ); |
| 346 |
|
| 347 |
VectorCopy( trace->endpos, le->pos.trBase ); |
| 348 |
le->pos.trTime = cg.time; |
| 349 |
|
| 350 |
|
| 351 |
// check for stop, making sure that even on low FPS systems it doesn't bobble |
| 352 |
if ( trace->allsolid || |
| 353 |
( trace->plane.normal[2] > 0 && |
| 354 |
( le->pos.trDelta[2] < 40 || le->pos.trDelta[2] < -cg.frametime * le->pos.trDelta[2] ) ) ) { |
| 355 |
le->pos.trType = TR_STATIONARY; |
| 356 |
} else { |
| 357 |
|
| 358 |
} |
| 359 |
} |
| 360 |
|
| 361 |
/* |
| 362 |
================ |
| 363 |
CG_AddFragment |
| 364 |
================ |
| 365 |
*/ |
| 366 |
void CG_AddFragment( localEntity_t *le ) { |
| 367 |
vec3_t newOrigin; |
| 368 |
trace_t trace; |
| 369 |
|
| 370 |
if ( le->pos.trType == TR_STATIONARY ) { |
| 371 |
// sink into the ground if near the removal time |
| 372 |
int t; |
| 373 |
float oldZ; |
| 374 |
|
| 375 |
t = le->endTime - cg.time; |
| 376 |
if ( t < SINK_TIME ) { |
| 377 |
// we must use an explicit lighting origin, otherwise the |
| 378 |
// lighting would be lost as soon as the origin went |
| 379 |
// into the ground |
| 380 |
VectorCopy( le->refEntity.origin, le->refEntity.lightingOrigin ); |
| 381 |
le->refEntity.renderfx |= RF_LIGHTING_ORIGIN; |
| 382 |
oldZ = le->refEntity.origin[2]; |
| 383 |
le->refEntity.origin[2] -= 16 * ( 1.0 - (float)t / SINK_TIME ); |
| 384 |
trap_R_AddRefEntityToScene( &le->refEntity ); |
| 385 |
le->refEntity.origin[2] = oldZ; |
| 386 |
} else { |
| 387 |
trap_R_AddRefEntityToScene( &le->refEntity ); |
| 388 |
} |
| 389 |
|
| 390 |
return; |
| 391 |
} |
| 392 |
|
| 393 |
// calculate new position |
| 394 |
BG_EvaluateTrajectory( &le->pos, cg.time, newOrigin ); |
| 395 |
|
| 396 |
// trace a line from previous position to new position |
| 397 |
CG_Trace( &trace, le->refEntity.origin, NULL, NULL, newOrigin, -1, CONTENTS_SOLID ); |
| 398 |
if ( trace.fraction == 1.0 ) { |
| 399 |
// still in free fall |
| 400 |
VectorCopy( newOrigin, le->refEntity.origin ); |
| 401 |
|
| 402 |
if ( le->leFlags & LEF_TUMBLE ) { |
| 403 |
vec3_t angles; |
| 404 |
|
| 405 |
BG_EvaluateTrajectory( &le->angles, cg.time, angles ); |
| 406 |
AnglesToAxis( angles, le->refEntity.axis ); |
| 407 |
} |
| 408 |
|
| 409 |
trap_R_AddRefEntityToScene( &le->refEntity ); |
| 410 |
|
| 411 |
// add a blood trail |
| 412 |
if ( le->leBounceSoundType == LEBS_BLOOD ) { |
| 413 |
CG_BloodTrail( le ); |
| 414 |
} |
| 415 |
|
| 416 |
return; |
| 417 |
} |
| 418 |
|
| 419 |
// if it is in a nodrop zone, remove it |
| 420 |
// this keeps gibs from waiting at the bottom of pits of death |
| 421 |
// and floating levels |
| 422 |
if ( CG_PointContents( trace.endpos, 0 ) & CONTENTS_NODROP ) { |
| 423 |
CG_FreeLocalEntity( le ); |
| 424 |
return; |
| 425 |
} |
| 426 |
|
| 427 |
// leave a mark |
| 428 |
CG_FragmentBounceMark( le, &trace ); |
| 429 |
|
| 430 |
// do a bouncy sound |
| 431 |
CG_FragmentBounceSound( le, &trace ); |
| 432 |
|
| 433 |
// reflect the velocity on the trace plane |
| 434 |
CG_ReflectVelocity( le, &trace ); |
| 435 |
|
| 436 |
trap_R_AddRefEntityToScene( &le->refEntity ); |
| 437 |
} |
| 438 |
|
| 439 |
// LEILEI |
| 440 |
|
| 441 |
void CG_JustSplat( localEntity_t *le, trace_t *trace ) { |
| 442 |
vec3_t velocity; |
| 443 |
float dot; |
| 444 |
int hitTime; |
| 445 |
|
| 446 |
// reflect the velocity on the trace plane |
| 447 |
hitTime = cg.time - cg.frametime + cg.frametime * trace->fraction; |
| 448 |
BG_EvaluateTrajectoryDelta( &le->pos, hitTime, velocity ); |
| 449 |
dot = DotProduct( velocity, trace->plane.normal ); |
| 450 |
VectorMA( velocity, -2*dot, trace->plane.normal, le->pos.trDelta ); |
| 451 |
|
| 452 |
VectorScale( le->pos.trDelta, le->bounceFactor, le->pos.trDelta ); |
| 453 |
|
| 454 |
VectorCopy( trace->endpos, le->pos.trBase ); |
| 455 |
le->pos.trTime = cg.time; |
| 456 |
|
| 457 |
|
| 458 |
// check for stop, making sure that even on low FPS systems it doesn't bobble |
| 459 |
if ( trace->allsolid || |
| 460 |
( trace->plane.normal[2] > 0 && |
| 461 |
( le->pos.trDelta[2] < 40 || le->pos.trDelta[2] < -cg.frametime * le->pos.trDelta[2] ) ) ) { |
| 462 |
le->pos.trType = TR_STATIONARY; |
| 463 |
} else { |
| 464 |
|
| 465 |
} |
| 466 |
} |
| 467 |
|
| 468 |
void CG_AddGore( localEntity_t *le ) { |
| 469 |
vec3_t newOrigin; |
| 470 |
trace_t trace; |
| 471 |
|
| 472 |
if ( le->pos.trType == TR_STATIONARY ) { |
| 473 |
// sink into the ground if near the removal time |
| 474 |
//int t; |
| 475 |
//float oldZ; |
| 476 |
|
| 477 |
CG_FreeLocalEntity( le ); // kill it |
| 478 |
|
| 479 |
return; |
| 480 |
} |
| 481 |
|
| 482 |
// calculate new position |
| 483 |
BG_EvaluateTrajectory( &le->pos, cg.time, newOrigin ); |
| 484 |
|
| 485 |
// trace a line from previous position to new position |
| 486 |
CG_Trace( &trace, le->refEntity.origin, NULL, NULL, newOrigin, -1, CONTENTS_SOLID ); |
| 487 |
if ( trace.fraction == 1.0 ) { |
| 488 |
// still in free fall |
| 489 |
VectorCopy( newOrigin, le->refEntity.origin ); |
| 490 |
|
| 491 |
if ( le->leFlags & LEF_TUMBLE ) { |
| 492 |
vec3_t angles; |
| 493 |
|
| 494 |
BG_EvaluateTrajectory( &le->angles, cg.time, angles ); |
| 495 |
AnglesToAxis( angles, le->refEntity.axis ); |
| 496 |
} |
| 497 |
|
| 498 |
trap_R_AddRefEntityToScene( &le->refEntity ); |
| 499 |
|
| 500 |
CG_SmallBloodTrail( le ); |
| 501 |
|
| 502 |
return; |
| 503 |
} |
| 504 |
|
| 505 |
// if it is in a nodrop zone, remove it |
| 506 |
// this keeps gibs from waiting at the bottom of pits of death |
| 507 |
// and floating levels |
| 508 |
if ( trap_CM_PointContents( trace.endpos, 0 ) & CONTENTS_NODROP ) { |
| 509 |
CG_FreeLocalEntity( le ); |
| 510 |
return; |
| 511 |
} |
| 512 |
|
| 513 |
// leave a mark |
| 514 |
CG_GoreMark( le, &trace ); |
| 515 |
|
| 516 |
// do a juicy sound |
| 517 |
CG_SplatSound( le, &trace ); |
| 518 |
|
| 519 |
CG_JustSplat( le, &trace ); |
| 520 |
|
| 521 |
trap_R_AddRefEntityToScene( &le->refEntity ); |
| 522 |
} |
| 523 |
|
| 524 |
/* |
| 525 |
===================================================================== |
| 526 |
|
| 527 |
TRIVIAL LOCAL ENTITIES |
| 528 |
|
| 529 |
These only do simple scaling or modulation before passing to the renderer |
| 530 |
===================================================================== |
| 531 |
*/ |
| 532 |
|
| 533 |
/* |
| 534 |
==================== |
| 535 |
CG_AddFadeRGB |
| 536 |
==================== |
| 537 |
*/ |
| 538 |
void CG_AddFadeRGB( localEntity_t *le ) { |
| 539 |
refEntity_t *re; |
| 540 |
float c; |
| 541 |
|
| 542 |
re = &le->refEntity; |
| 543 |
|
| 544 |
c = ( le->endTime - cg.time ) * le->lifeRate; |
| 545 |
c *= 0xff; |
| 546 |
|
| 547 |
re->shaderRGBA[0] = le->color[0] * c; |
| 548 |
re->shaderRGBA[1] = le->color[1] * c; |
| 549 |
re->shaderRGBA[2] = le->color[2] * c; |
| 550 |
re->shaderRGBA[3] = le->color[3] * c; |
| 551 |
|
| 552 |
trap_R_AddRefEntityToScene( re ); |
| 553 |
} |
| 554 |
|
| 555 |
/* |
| 556 |
================== |
| 557 |
CG_AddMoveScaleFade |
| 558 |
================== |
| 559 |
*/ |
| 560 |
static void CG_AddMoveScaleFade( localEntity_t *le ) { |
| 561 |
refEntity_t *re; |
| 562 |
float c; |
| 563 |
vec3_t delta; |
| 564 |
float len; |
| 565 |
|
| 566 |
re = &le->refEntity; |
| 567 |
|
| 568 |
if ( le->fadeInTime > le->startTime && cg.time < le->fadeInTime ) { |
| 569 |
// fade / grow time |
| 570 |
c = 1.0 - (float) ( le->fadeInTime - cg.time ) / ( le->fadeInTime - le->startTime ); |
| 571 |
} |
| 572 |
else { |
| 573 |
// fade / grow time |
| 574 |
c = ( le->endTime - cg.time ) * le->lifeRate; |
| 575 |
} |
| 576 |
|
| 577 |
re->shaderRGBA[3] = 0xff * c * le->color[3]; |
| 578 |
|
| 579 |
if ( !( le->leFlags & LEF_PUFF_DONT_SCALE ) ) { |
| 580 |
re->radius = le->radius * ( 1.0 - c ) + 8; |
| 581 |
} |
| 582 |
|
| 583 |
BG_EvaluateTrajectory( &le->pos, cg.time, re->origin ); |
| 584 |
|
| 585 |
// if the view would be "inside" the sprite, kill the sprite |
| 586 |
// so it doesn't add too much overdraw |
| 587 |
VectorSubtract( re->origin, cg.refdef.vieworg, delta ); |
| 588 |
len = VectorLength( delta ); |
| 589 |
if ( len < le->radius ) { |
| 590 |
CG_FreeLocalEntity( le ); |
| 591 |
return; |
| 592 |
} |
| 593 |
|
| 594 |
trap_R_AddRefEntityToScene( re ); |
| 595 |
} |
| 596 |
|
| 597 |
|
| 598 |
/* |
| 599 |
=================== |
| 600 |
CG_AddScaleFade |
| 601 |
|
| 602 |
For rocket smokes that hang in place, fade out, and are |
| 603 |
removed if the view passes through them. |
| 604 |
There are often many of these, so it needs to be simple. |
| 605 |
=================== |
| 606 |
*/ |
| 607 |
static void CG_AddScaleFade( localEntity_t *le ) { |
| 608 |
refEntity_t *re; |
| 609 |
float c; |
| 610 |
vec3_t delta; |
| 611 |
float len; |
| 612 |
|
| 613 |
re = &le->refEntity; |
| 614 |
|
| 615 |
// fade / grow time |
| 616 |
c = ( le->endTime - cg.time ) * le->lifeRate; |
| 617 |
|
| 618 |
re->shaderRGBA[3] = 0xff * c * le->color[3]; |
| 619 |
re->radius = le->radius * ( 1.0 - c ) + 8; |
| 620 |
|
| 621 |
// if the view would be "inside" the sprite, kill the sprite |
| 622 |
// so it doesn't add too much overdraw |
| 623 |
VectorSubtract( re->origin, cg.refdef.vieworg, delta ); |
| 624 |
len = VectorLength( delta ); |
| 625 |
// LEILEI |
| 626 |
if (!cg_leiEnhancement.integer) { |
| 627 |
if ( len < le->radius ) { |
| 628 |
CG_FreeLocalEntity( le ); |
| 629 |
return; |
| 630 |
} |
| 631 |
} |
| 632 |
trap_R_AddRefEntityToScene( re ); |
| 633 |
} |
| 634 |
|
| 635 |
|
| 636 |
/* |
| 637 |
================= |
| 638 |
CG_AddFallScaleFade |
| 639 |
|
| 640 |
This is just an optimized CG_AddMoveScaleFade |
| 641 |
For blood mists that drift down, fade out, and are |
| 642 |
removed if the view passes through them. |
| 643 |
There are often 100+ of these, so it needs to be simple. |
| 644 |
================= |
| 645 |
*/ |
| 646 |
static void CG_AddFallScaleFade( localEntity_t *le ) { |
| 647 |
refEntity_t *re; |
| 648 |
float c; |
| 649 |
vec3_t delta; |
| 650 |
float len; |
| 651 |
|
| 652 |
re = &le->refEntity; |
| 653 |
|
| 654 |
// fade time |
| 655 |
c = ( le->endTime - cg.time ) * le->lifeRate; |
| 656 |
|
| 657 |
re->shaderRGBA[3] = 0xff * c * le->color[3]; |
| 658 |
|
| 659 |
re->origin[2] = le->pos.trBase[2] - ( 1.0 - c ) * le->pos.trDelta[2]; |
| 660 |
|
| 661 |
re->radius = le->radius * ( 1.0 - c ) + 16; |
| 662 |
|
| 663 |
// if the view would be "inside" the sprite, kill the sprite |
| 664 |
// so it doesn't add too much overdraw |
| 665 |
VectorSubtract( re->origin, cg.refdef.vieworg, delta ); |
| 666 |
len = VectorLength( delta ); |
| 667 |
|
| 668 |
// LEILEI |
| 669 |
if (!cg_leiEnhancement.integer) { |
| 670 |
if ( len < le->radius ) { |
| 671 |
CG_FreeLocalEntity( le ); |
| 672 |
return; |
| 673 |
} |
| 674 |
} |
| 675 |
trap_R_AddRefEntityToScene( re ); |
| 676 |
} |
| 677 |
|
| 678 |
|
| 679 |
|
| 680 |
/* |
| 681 |
================ |
| 682 |
CG_AddExplosion |
| 683 |
================ |
| 684 |
*/ |
| 685 |
static void CG_AddExplosion( localEntity_t *ex ) { |
| 686 |
refEntity_t *ent; |
| 687 |
|
| 688 |
ent = &ex->refEntity; |
| 689 |
|
| 690 |
// add the entity |
| 691 |
trap_R_AddRefEntityToScene(ent); |
| 692 |
|
| 693 |
// add the dlight |
| 694 |
if ( ex->light ) { |
| 695 |
float light; |
| 696 |
|
| 697 |
light = (float)( cg.time - ex->startTime ) / ( ex->endTime - ex->startTime ); |
| 698 |
if ( light < 0.5 ) { |
| 699 |
light = 1.0; |
| 700 |
} else { |
| 701 |
light = 1.0 - ( light - 0.5 ) * 2; |
| 702 |
} |
| 703 |
light = ex->light * light; |
| 704 |
trap_R_AddLightToScene(ent->origin, light, ex->lightColor[0], ex->lightColor[1], ex->lightColor[2] ); |
| 705 |
} |
| 706 |
} |
| 707 |
|
| 708 |
/* |
| 709 |
================ |
| 710 |
CG_AddSpriteExplosion |
| 711 |
================ |
| 712 |
*/ |
| 713 |
static void CG_AddSpriteExplosion( localEntity_t *le ) { |
| 714 |
refEntity_t re; |
| 715 |
float c; |
| 716 |
|
| 717 |
re = le->refEntity; |
| 718 |
|
| 719 |
c = ( le->endTime - cg.time ) / ( float ) ( le->endTime - le->startTime ); |
| 720 |
if ( c > 1 ) { |
| 721 |
c = 1.0; // can happen during connection problems |
| 722 |
} |
| 723 |
|
| 724 |
re.shaderRGBA[0] = 0xff; |
| 725 |
re.shaderRGBA[1] = 0xff; |
| 726 |
re.shaderRGBA[2] = 0xff; |
| 727 |
re.shaderRGBA[3] = 0xff * c * 0.33; |
| 728 |
|
| 729 |
re.reType = RT_SPRITE; |
| 730 |
re.radius = 42 * ( 1.0 - c ) + 30; |
| 731 |
|
| 732 |
trap_R_AddRefEntityToScene( &re ); |
| 733 |
|
| 734 |
// add the dlight |
| 735 |
if ( le->light ) { |
| 736 |
float light; |
| 737 |
|
| 738 |
light = (float)( cg.time - le->startTime ) / ( le->endTime - le->startTime ); |
| 739 |
if ( light < 0.5 ) { |
| 740 |
light = 1.0; |
| 741 |
} else { |
| 742 |
light = 1.0 - ( light - 0.5 ) * 2; |
| 743 |
} |
| 744 |
light = le->light * light; |
| 745 |
trap_R_AddLightToScene(re.origin, light, le->lightColor[0], le->lightColor[1], le->lightColor[2] ); |
| 746 |
} |
| 747 |
} |
| 748 |
|
| 749 |
|
| 750 |
//#ifdef MISSIONPACK |
| 751 |
/* |
| 752 |
==================== |
| 753 |
CG_AddKamikaze |
| 754 |
==================== |
| 755 |
*/ |
| 756 |
void CG_AddKamikaze( localEntity_t *le ) { |
| 757 |
refEntity_t *re; |
| 758 |
refEntity_t shockwave; |
| 759 |
float c; |
| 760 |
vec3_t test, axis[3]; |
| 761 |
int t; |
| 762 |
|
| 763 |
re = &le->refEntity; |
| 764 |
|
| 765 |
t = cg.time - le->startTime; |
| 766 |
VectorClear( test ); |
| 767 |
AnglesToAxis( test, axis ); |
| 768 |
|
| 769 |
if (t > KAMI_SHOCKWAVE_STARTTIME && t < KAMI_SHOCKWAVE_ENDTIME) { |
| 770 |
|
| 771 |
if (!(le->leFlags & LEF_SOUND1)) { |
| 772 |
// trap_S_StartSound (re->origin, ENTITYNUM_WORLD, CHAN_AUTO, cgs.media.kamikazeExplodeSound ); |
| 773 |
trap_S_StartLocalSound(cgs.media.kamikazeExplodeSound, CHAN_AUTO); |
| 774 |
le->leFlags |= LEF_SOUND1; |
| 775 |
} |
| 776 |
// 1st kamikaze shockwave |
| 777 |
memset(&shockwave, 0, sizeof(shockwave)); |
| 778 |
shockwave.hModel = cgs.media.kamikazeShockWave; |
| 779 |
shockwave.reType = RT_MODEL; |
| 780 |
shockwave.shaderTime = re->shaderTime; |
| 781 |
VectorCopy(re->origin, shockwave.origin); |
| 782 |
|
| 783 |
c = (float)(t - KAMI_SHOCKWAVE_STARTTIME) / (float)(KAMI_SHOCKWAVE_ENDTIME - KAMI_SHOCKWAVE_STARTTIME); |
| 784 |
VectorScale( axis[0], c * KAMI_SHOCKWAVE_MAXRADIUS / KAMI_SHOCKWAVEMODEL_RADIUS, shockwave.axis[0] ); |
| 785 |
VectorScale( axis[1], c * KAMI_SHOCKWAVE_MAXRADIUS / KAMI_SHOCKWAVEMODEL_RADIUS, shockwave.axis[1] ); |
| 786 |
VectorScale( axis[2], c * KAMI_SHOCKWAVE_MAXRADIUS / KAMI_SHOCKWAVEMODEL_RADIUS, shockwave.axis[2] ); |
| 787 |
shockwave.nonNormalizedAxes = qtrue; |
| 788 |
|
| 789 |
if (t > KAMI_SHOCKWAVEFADE_STARTTIME) { |
| 790 |
c = (float)(t - KAMI_SHOCKWAVEFADE_STARTTIME) / (float)(KAMI_SHOCKWAVE_ENDTIME - KAMI_SHOCKWAVEFADE_STARTTIME); |
| 791 |
} |
| 792 |
else { |
| 793 |
c = 0; |
| 794 |
} |
| 795 |
c *= 0xff; |
| 796 |
shockwave.shaderRGBA[0] = 0xff - c; |
| 797 |
shockwave.shaderRGBA[1] = 0xff - c; |
| 798 |
shockwave.shaderRGBA[2] = 0xff - c; |
| 799 |
shockwave.shaderRGBA[3] = 0xff - c; |
| 800 |
|
| 801 |
trap_R_AddRefEntityToScene( &shockwave ); |
| 802 |
} |
| 803 |
|
| 804 |
if (t > KAMI_EXPLODE_STARTTIME && t < KAMI_IMPLODE_ENDTIME) { |
| 805 |
// explosion and implosion |
| 806 |
c = ( le->endTime - cg.time ) * le->lifeRate; |
| 807 |
c *= 0xff; |
| 808 |
re->shaderRGBA[0] = le->color[0] * c; |
| 809 |
re->shaderRGBA[1] = le->color[1] * c; |
| 810 |
re->shaderRGBA[2] = le->color[2] * c; |
| 811 |
re->shaderRGBA[3] = le->color[3] * c; |
| 812 |
|
| 813 |
if( t < KAMI_IMPLODE_STARTTIME ) { |
| 814 |
c = (float)(t - KAMI_EXPLODE_STARTTIME) / (float)(KAMI_IMPLODE_STARTTIME - KAMI_EXPLODE_STARTTIME); |
| 815 |
} |
| 816 |
else { |
| 817 |
if (!(le->leFlags & LEF_SOUND2)) { |
| 818 |
// trap_S_StartSound (re->origin, ENTITYNUM_WORLD, CHAN_AUTO, cgs.media.kamikazeImplodeSound ); |
| 819 |
trap_S_StartLocalSound(cgs.media.kamikazeImplodeSound, CHAN_AUTO); |
| 820 |
le->leFlags |= LEF_SOUND2; |
| 821 |
} |
| 822 |
c = (float)(KAMI_IMPLODE_ENDTIME - t) / (float) (KAMI_IMPLODE_ENDTIME - KAMI_IMPLODE_STARTTIME); |
| 823 |
} |
| 824 |
VectorScale( axis[0], c * KAMI_BOOMSPHERE_MAXRADIUS / KAMI_BOOMSPHEREMODEL_RADIUS, re->axis[0] ); |
| 825 |
VectorScale( axis[1], c * KAMI_BOOMSPHERE_MAXRADIUS / KAMI_BOOMSPHEREMODEL_RADIUS, re->axis[1] ); |
| 826 |
VectorScale( axis[2], c * KAMI_BOOMSPHERE_MAXRADIUS / KAMI_BOOMSPHEREMODEL_RADIUS, re->axis[2] ); |
| 827 |
re->nonNormalizedAxes = qtrue; |
| 828 |
|
| 829 |
trap_R_AddRefEntityToScene( re ); |
| 830 |
// add the dlight |
| 831 |
trap_R_AddLightToScene( re->origin, c * 1000.0, 1.0, 1.0, c ); |
| 832 |
} |
| 833 |
|
| 834 |
if (t > KAMI_SHOCKWAVE2_STARTTIME && t < KAMI_SHOCKWAVE2_ENDTIME) { |
| 835 |
// 2nd kamikaze shockwave |
| 836 |
if (le->angles.trBase[0] == 0 && |
| 837 |
le->angles.trBase[1] == 0 && |
| 838 |
le->angles.trBase[2] == 0) { |
| 839 |
le->angles.trBase[0] = random() * 360; |
| 840 |
le->angles.trBase[1] = random() * 360; |
| 841 |
le->angles.trBase[2] = random() * 360; |
| 842 |
} |
| 843 |
else { |
| 844 |
c = 0; |
| 845 |
} |
| 846 |
memset(&shockwave, 0, sizeof(shockwave)); |
| 847 |
shockwave.hModel = cgs.media.kamikazeShockWave; |
| 848 |
shockwave.reType = RT_MODEL; |
| 849 |
shockwave.shaderTime = re->shaderTime; |
| 850 |
VectorCopy(re->origin, shockwave.origin); |
| 851 |
|
| 852 |
test[0] = le->angles.trBase[0]; |
| 853 |
test[1] = le->angles.trBase[1]; |
| 854 |
test[2] = le->angles.trBase[2]; |
| 855 |
AnglesToAxis( test, axis ); |
| 856 |
|
| 857 |
c = (float)(t - KAMI_SHOCKWAVE2_STARTTIME) / (float)(KAMI_SHOCKWAVE2_ENDTIME - KAMI_SHOCKWAVE2_STARTTIME); |
| 858 |
VectorScale( axis[0], c * KAMI_SHOCKWAVE2_MAXRADIUS / KAMI_SHOCKWAVEMODEL_RADIUS, shockwave.axis[0] ); |
| 859 |
VectorScale( axis[1], c * KAMI_SHOCKWAVE2_MAXRADIUS / KAMI_SHOCKWAVEMODEL_RADIUS, shockwave.axis[1] ); |
| 860 |
VectorScale( axis[2], c * KAMI_SHOCKWAVE2_MAXRADIUS / KAMI_SHOCKWAVEMODEL_RADIUS, shockwave.axis[2] ); |
| 861 |
shockwave.nonNormalizedAxes = qtrue; |
| 862 |
|
| 863 |
if (t > KAMI_SHOCKWAVE2FADE_STARTTIME) { |
| 864 |
c = (float)(t - KAMI_SHOCKWAVE2FADE_STARTTIME) / (float)(KAMI_SHOCKWAVE2_ENDTIME - KAMI_SHOCKWAVE2FADE_STARTTIME); |
| 865 |
} |
| 866 |
else { |
| 867 |
c = 0; |
| 868 |
} |
| 869 |
c *= 0xff; |
| 870 |
shockwave.shaderRGBA[0] = 0xff - c; |
| 871 |
shockwave.shaderRGBA[1] = 0xff - c; |
| 872 |
shockwave.shaderRGBA[2] = 0xff - c; |
| 873 |
shockwave.shaderRGBA[3] = 0xff - c; |
| 874 |
|
| 875 |
trap_R_AddRefEntityToScene( &shockwave ); |
| 876 |
} |
| 877 |
} |
| 878 |
|
| 879 |
/* |
| 880 |
=================== |
| 881 |
CG_AddInvulnerabilityImpact |
| 882 |
=================== |
| 883 |
*/ |
| 884 |
void CG_AddInvulnerabilityImpact( localEntity_t *le ) { |
| 885 |
trap_R_AddRefEntityToScene( &le->refEntity ); |
| 886 |
} |
| 887 |
|
| 888 |
/* |
| 889 |
=================== |
| 890 |
CG_AddInvulnerabilityJuiced |
| 891 |
=================== |
| 892 |
*/ |
| 893 |
void CG_AddInvulnerabilityJuiced( localEntity_t *le ) { |
| 894 |
int t; |
| 895 |
|
| 896 |
t = cg.time - le->startTime; |
| 897 |
if ( t > 3000 ) { |
| 898 |
le->refEntity.axis[0][0] = (float) 1.0 + 0.3 * (t - 3000) / 2000; |
| 899 |
le->refEntity.axis[1][1] = (float) 1.0 + 0.3 * (t - 3000) / 2000; |
| 900 |
le->refEntity.axis[2][2] = (float) 0.7 + 0.3 * (2000 - (t - 3000)) / 2000; |
| 901 |
} |
| 902 |
if ( t > 5000 ) { |
| 903 |
le->endTime = 0; |
| 904 |
CG_GibPlayer( le->refEntity.origin ); |
| 905 |
} |
| 906 |
else { |
| 907 |
trap_R_AddRefEntityToScene( &le->refEntity ); |
| 908 |
} |
| 909 |
} |
| 910 |
|
| 911 |
/* |
| 912 |
=================== |
| 913 |
CG_AddRefEntity |
| 914 |
=================== |
| 915 |
*/ |
| 916 |
void CG_AddRefEntity( localEntity_t *le ) { |
| 917 |
if (le->endTime < cg.time) { |
| 918 |
CG_FreeLocalEntity( le ); |
| 919 |
return; |
| 920 |
} |
| 921 |
trap_R_AddRefEntityToScene( &le->refEntity ); |
| 922 |
} |
| 923 |
|
| 924 |
//#endif |
| 925 |
/* |
| 926 |
=================== |
| 927 |
CG_AddScorePlum |
| 928 |
=================== |
| 929 |
*/ |
| 930 |
#define NUMBER_SIZE 8 |
| 931 |
|
| 932 |
void CG_AddScorePlum( localEntity_t *le ) { |
| 933 |
refEntity_t *re; |
| 934 |
vec3_t origin, delta, dir, vec, up = {0, 0, 1}; |
| 935 |
float c, len; |
| 936 |
int i, score, digits[10], numdigits, negative; |
| 937 |
|
| 938 |
re = &le->refEntity; |
| 939 |
|
| 940 |
c = ( le->endTime - cg.time ) * le->lifeRate; |
| 941 |
|
| 942 |
score = le->radius; |
| 943 |
if (score < 0) { |
| 944 |
re->shaderRGBA[0] = 0xff; |
| 945 |
re->shaderRGBA[1] = 0x11; |
| 946 |
re->shaderRGBA[2] = 0x11; |
| 947 |
} |
| 948 |
else { |
| 949 |
re->shaderRGBA[0] = 0xff; |
| 950 |
re->shaderRGBA[1] = 0xff; |
| 951 |
re->shaderRGBA[2] = 0xff; |
| 952 |
if (score >= 50) { |
| 953 |
re->shaderRGBA[1] = 0; |
| 954 |
} else if (score >= 20) { |
| 955 |
re->shaderRGBA[0] = re->shaderRGBA[1] = 0; |
| 956 |
} else if (score >= 10) { |
| 957 |
re->shaderRGBA[2] = 0; |
| 958 |
} else if (score >= 2) { |
| 959 |
re->shaderRGBA[0] = re->shaderRGBA[2] = 0; |
| 960 |
} |
| 961 |
|
| 962 |
} |
| 963 |
if (c < 0.25) |
| 964 |
re->shaderRGBA[3] = 0xff * 4 * c; |
| 965 |
else |
| 966 |
re->shaderRGBA[3] = 0xff; |
| 967 |
|
| 968 |
re->radius = NUMBER_SIZE / 2; |
| 969 |
|
| 970 |
VectorCopy(le->pos.trBase, origin); |
| 971 |
origin[2] += 110 - c * 100; |
| 972 |
|
| 973 |
VectorSubtract(cg.refdef.vieworg, origin, dir); |
| 974 |
CrossProduct(dir, up, vec); |
| 975 |
VectorNormalize(vec); |
| 976 |
|
| 977 |
VectorMA(origin, -10 + 20 * sin(c * 2 * M_PI), vec, origin); |
| 978 |
|
| 979 |
// if the view would be "inside" the sprite, kill the sprite |
| 980 |
// so it doesn't add too much overdraw |
| 981 |
VectorSubtract( origin, cg.refdef.vieworg, delta ); |
| 982 |
len = VectorLength( delta ); |
| 983 |
if ( len < 20 ) { |
| 984 |
CG_FreeLocalEntity( le ); |
| 985 |
return; |
| 986 |
} |
| 987 |
|
| 988 |
negative = qfalse; |
| 989 |
if (score < 0) { |
| 990 |
negative = qtrue; |
| 991 |
score = -score; |
| 992 |
} |
| 993 |
|
| 994 |
for (numdigits = 0; !(numdigits && !score); numdigits++) { |
| 995 |
digits[numdigits] = score % 10; |
| 996 |
score = score / 10; |
| 997 |
} |
| 998 |
|
| 999 |
if (negative) { |
| 1000 |
digits[numdigits] = 10; |
| 1001 |
numdigits++; |
| 1002 |
} |
| 1003 |
|
| 1004 |
for (i = 0; i < numdigits; i++) { |
| 1005 |
VectorMA(origin, (float) (((float) numdigits / 2) - i) * NUMBER_SIZE, vec, re->origin); |
| 1006 |
re->customShader = cgs.media.numberShaders[digits[numdigits-1-i]]; |
| 1007 |
trap_R_AddRefEntityToScene( re ); |
| 1008 |
} |
| 1009 |
} |
| 1010 |
|
| 1011 |
|
| 1012 |
|
| 1013 |
|
| 1014 |
//============================================================================== |
| 1015 |
|
| 1016 |
/* |
| 1017 |
=================== |
| 1018 |
CG_AddLocalEntities |
| 1019 |
|
| 1020 |
=================== |
| 1021 |
*/ |
| 1022 |
void CG_AddLocalEntities( void ) { |
| 1023 |
localEntity_t *le, *next; |
| 1024 |
|
| 1025 |
// walk the list backwards, so any new local entities generated |
| 1026 |
// (trails, marks, etc) will be present this frame |
| 1027 |
le = cg_activeLocalEntities.prev; |
| 1028 |
for ( ; le != &cg_activeLocalEntities ; le = next ) { |
| 1029 |
// grab next now, so if the local entity is freed we |
| 1030 |
// still have it |
| 1031 |
next = le->prev; |
| 1032 |
|
| 1033 |
if ( cg.time >= le->endTime ) { |
| 1034 |
CG_FreeLocalEntity( le ); |
| 1035 |
continue; |
| 1036 |
} |
| 1037 |
switch ( le->leType ) { |
| 1038 |
default: |
| 1039 |
CG_Error( "Bad leType: %i", le->leType ); |
| 1040 |
break; |
| 1041 |
|
| 1042 |
case LE_MARK: |
| 1043 |
break; |
| 1044 |
|
| 1045 |
case LE_SPRITE_EXPLOSION: |
| 1046 |
CG_AddSpriteExplosion( le ); |
| 1047 |
break; |
| 1048 |
|
| 1049 |
case LE_EXPLOSION: |
| 1050 |
CG_AddExplosion( le ); |
| 1051 |
break; |
| 1052 |
|
| 1053 |
case LE_FRAGMENT: // gibs and brass |
| 1054 |
CG_AddFragment( le ); |
| 1055 |
break; |
| 1056 |
|
| 1057 |
case LE_MOVE_SCALE_FADE: // water bubbles |
| 1058 |
CG_AddMoveScaleFade( le ); |
| 1059 |
break; |
| 1060 |
|
| 1061 |
case LE_FADE_RGB: // teleporters, railtrails |
| 1062 |
CG_AddFadeRGB( le ); |
| 1063 |
break; |
| 1064 |
|
| 1065 |
case LE_FALL_SCALE_FADE: // gib blood trails |
| 1066 |
CG_AddFallScaleFade( le ); |
| 1067 |
break; |
| 1068 |
|
| 1069 |
case LE_SCALE_FADE: // rocket trails |
| 1070 |
CG_AddScaleFade( le ); |
| 1071 |
break; |
| 1072 |
|
| 1073 |
case LE_SCOREPLUM: |
| 1074 |
CG_AddScorePlum( le ); |
| 1075 |
break; |
| 1076 |
|
| 1077 |
//#ifdef MISSIONPACK |
| 1078 |
case LE_KAMIKAZE: |
| 1079 |
CG_AddKamikaze( le ); |
| 1080 |
break; |
| 1081 |
case LE_INVULIMPACT: |
| 1082 |
CG_AddInvulnerabilityImpact( le ); |
| 1083 |
break; |
| 1084 |
case LE_INVULJUICED: |
| 1085 |
CG_AddInvulnerabilityJuiced( le ); |
| 1086 |
break; |
| 1087 |
case LE_SHOWREFENTITY: |
| 1088 |
CG_AddRefEntity( le ); |
| 1089 |
break; |
| 1090 |
//#endif |
| 1091 |
|
| 1092 |
case LE_GORE: // blood |
| 1093 |
CG_AddGore( le ); |
| 1094 |
break; |
| 1095 |
} |
| 1096 |
} |
| 1097 |
} |
| 1098 |
|
| 1099 |
|
| 1100 |
|
| 1101 |
|