Draws a streamer behind a weapon
| 2421 | |
| 2422 | // Draws a streamer behind a weapon |
| 2423 | void DrawWeaponStreamer(object *obj) { |
| 2424 | float time_live = Gametime - obj->creation_time; |
| 2425 | float len; |
| 2426 | float norm_time = time_live / obj->lifetime; |
| 2427 | |
| 2428 | if (norm_time >= 1) |
| 2429 | norm_time = .99999f; // don't go over! |
| 2430 | |
| 2431 | // Get length |
| 2432 | object *parent_obj = ObjGet(obj->parent_handle); |
| 2433 | |
| 2434 | if (!parent_obj) |
| 2435 | return; |
| 2436 | |
| 2437 | len = vm_VectorDistance(&parent_obj->pos, &obj->pos); |
| 2438 | |
| 2439 | rend_SetAlphaType(AT_VERTEX); |
| 2440 | rend_SetTextureType(TT_FLAT); |
| 2441 | rend_SetLighting(LS_GOURAUD); |
| 2442 | rend_SetColorModel(CM_RGB); |
| 2443 | |
| 2444 | vector vecs[2]; |
| 2445 | g3Point pnts[2]; |
| 2446 | int i; |
| 2447 | |
| 2448 | vecs[0] = obj->pos; |
| 2449 | vecs[1] = obj->pos - (obj->orient.fvec * len); |
| 2450 | |
| 2451 | for (i = 0; i < 2; i++) { |
| 2452 | g3_RotatePoint(&pnts[i], &vecs[i]); |
| 2453 | pnts[i].p3_flags |= PF_RGBA; |
| 2454 | pnts[i].p3_r = Weapons[obj->id].lighting_info.red_light1; |
| 2455 | pnts[i].p3_g = Weapons[obj->id].lighting_info.green_light1; |
| 2456 | pnts[i].p3_b = Weapons[obj->id].lighting_info.blue_light1; |
| 2457 | } |
| 2458 | |
| 2459 | pnts[0].p3_a = (1.0 - norm_time) * .3f; |
| 2460 | pnts[1].p3_a = 0; |
| 2461 | |
| 2462 | g3_DrawSpecialLine(&pnts[0], &pnts[1]); |
| 2463 | } |
| 2464 | |
| 2465 | void DrawBlobbyWeaponRing(object *obj) { |
| 2466 | vector vecs[30]; |
no test coverage detected