Does a step in a spew system
| 264 | |
| 265 | // Does a step in a spew system |
| 266 | void SpewEmitAll(void) { |
| 267 | spewinfo *spew; |
| 268 | int count; |
| 269 | |
| 270 | float size, speed, lifetime; |
| 271 | |
| 272 | for (count = 0; count < MAX_SPEW_EFFECTS; count++) { |
| 273 | |
| 274 | if (SpewEffects[count].inuse) { |
| 275 | spew = &SpewEffects[count]; |
| 276 | |
| 277 | spew->time_until_next_blob -= Frametime; // account for the current frame |
| 278 | |
| 279 | // no randomness if it's a real object! |
| 280 | if (spew->real_obj) |
| 281 | spew->random = 0; |
| 282 | |
| 283 | if (spew->time_until_next_blob >= 0) { |
| 284 | // ok, since we won't be in the following while loop at all |
| 285 | // this frame for the spew, we need to force an update on |
| 286 | // it's gunpoint (IF it's a gunpoint) that way we can be sure |
| 287 | // it has the correct position, in case we miss the obj->flags&OF_MOVED_THIS_FRAME |
| 288 | if (spew->use_gunpoint) { |
| 289 | object *obj = ObjGet(spew->gp.obj_handle); |
| 290 | if (obj) { |
| 291 | |
| 292 | if ((obj->flags & OF_MOVED_THIS_FRAME) || |
| 293 | ((obj->flags & OF_ATTACHED) && ObjGet(obj->attach_ultimate_handle) && |
| 294 | ObjGet(obj->attach_ultimate_handle)->movement_type == MT_PHYSICS && |
| 295 | (ObjGet(obj->attach_ultimate_handle)->flags & OF_MOVED_THIS_FRAME))) |
| 296 | spew->flags |= SF_FORCEUPDATE; |
| 297 | |
| 298 | // check to see if it is an animated polymodel, which means update everyframe |
| 299 | if (obj->flags & OF_POLYGON_OBJECT) { |
| 300 | if (obj->rtype.pobj_info.anim_end_frame != obj->rtype.pobj_info.anim_start_frame) { |
| 301 | spew->flags |= SF_FORCEUPDATE; |
| 302 | } |
| 303 | } |
| 304 | } else { |
| 305 | // well, this spewer is dead, kill it |
| 306 | SpewClearEvent(spew->handle, true); |
| 307 | } |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | if (spew->flags & SF_UPDATEEVERYFRAME) |
| 312 | spew->flags |= SF_FORCEUPDATE; |
| 313 | |
| 314 | // turn this off, we will turn this on the first time we calc |
| 315 | spew->flags &= ~SF_UPDATEDFORFRAME; |
| 316 | |
| 317 | // if time_until_next_blob is negative, it's time to spew |
| 318 | int num_spewed = MAX_SPEWS_PER_FRAME; |
| 319 | |
| 320 | while (spew->time_until_next_blob < 0.0 && (num_spewed--)) { |
| 321 | |
| 322 | // do random computations |
| 323 | if ((spew->random & SPEW_RAND_SIZE) != 0) { |
no test coverage detected