| 2507 | } |
| 2508 | |
| 2509 | void DrawPolygonalWeaponRing(object *obj) { |
| 2510 | vector inner_vecs[30], outer_vecs[30]; |
| 2511 | g3Point inner_points[30], outer_points[30]; |
| 2512 | float lifenorm = (obj->lifetime - obj->lifeleft) / obj->lifetime; |
| 2513 | int i; |
| 2514 | g3Point *pntlist[4]; |
| 2515 | float inner_size = (obj->size * .8); |
| 2516 | int objnum = obj - Objects; |
| 2517 | int odd = objnum % 2; |
| 2518 | |
| 2519 | int num_segments = 20; |
| 2520 | |
| 2521 | int ring_increment = 65536 / num_segments; |
| 2522 | int ring_angle = 0; |
| 2523 | |
| 2524 | if (lifenorm > 1.0) |
| 2525 | lifenorm = 1.0; |
| 2526 | |
| 2527 | rend_SetTextureType(TT_FLAT); |
| 2528 | rend_SetColorModel(CM_RGB); |
| 2529 | rend_SetLighting(LS_GOURAUD); |
| 2530 | rend_SetAlphaType(AT_SATURATE_VERTEX); |
| 2531 | |
| 2532 | for (i = 0; i < num_segments; i++, ring_angle += ring_increment) { |
| 2533 | float ring_sin = FixSin(ring_angle); |
| 2534 | float ring_cos = FixCos(ring_angle); |
| 2535 | |
| 2536 | inner_vecs[i] = obj->orient.rvec * (ring_cos * inner_size); |
| 2537 | inner_vecs[i] += obj->orient.uvec * (ring_sin * inner_size); |
| 2538 | inner_vecs[i] += obj->pos; |
| 2539 | |
| 2540 | outer_vecs[i] = obj->orient.rvec * (ring_cos * obj->size); |
| 2541 | outer_vecs[i] += obj->orient.uvec * (ring_sin * obj->size); |
| 2542 | outer_vecs[i] += obj->pos; |
| 2543 | |
| 2544 | g3_RotatePoint(&inner_points[i], &inner_vecs[i]); |
| 2545 | g3_RotatePoint(&outer_points[i], &outer_vecs[i]); |
| 2546 | |
| 2547 | outer_points[i].p3_flags |= PF_RGBA | PF_UV; |
| 2548 | inner_points[i].p3_flags |= PF_RGBA | PF_UV; |
| 2549 | |
| 2550 | outer_points[i].p3_a = (1.0 - lifenorm) * .3; |
| 2551 | inner_points[i].p3_a = (1.0 - lifenorm) * .1; |
| 2552 | |
| 2553 | outer_points[i].p3_r = Weapons[obj->id].lighting_info.red_light1; |
| 2554 | outer_points[i].p3_g = Weapons[obj->id].lighting_info.green_light1; |
| 2555 | outer_points[i].p3_b = Weapons[obj->id].lighting_info.blue_light1; |
| 2556 | |
| 2557 | inner_points[i].p3_r = Weapons[obj->id].lighting_info.red_light1; |
| 2558 | inner_points[i].p3_g = Weapons[obj->id].lighting_info.green_light1; |
| 2559 | inner_points[i].p3_b = Weapons[obj->id].lighting_info.blue_light1; |
| 2560 | } |
| 2561 | |
| 2562 | for (i = 0; i < num_segments; i++) { |
| 2563 | if (i % 2 && !odd) |
| 2564 | continue; |
| 2565 | if ((i % 2 == 0) && odd) |
| 2566 | continue; |
no test coverage detected