Draws a glowing cone of light that represents thrusters
| 622 | |
| 623 | // Draws a glowing cone of light that represents thrusters |
| 624 | void DrawThrusterEffect(vector *pos, float r, float g, float b, vector *norm, float size, float length) { |
| 625 | vector cur_pos = *pos; |
| 626 | float cur_length = 0; |
| 627 | vector glow_pos[MAX_PARTS]; |
| 628 | float glow_size[MAX_PARTS]; |
| 629 | int total_parts = 0; |
| 630 | |
| 631 | if (length < .1) |
| 632 | return; |
| 633 | |
| 634 | int num_divs = length * 3; |
| 635 | if (num_divs > MAX_PARTS) |
| 636 | num_divs = MAX_PARTS; |
| 637 | |
| 638 | float size_change = size / num_divs; |
| 639 | float pos_change = length / num_divs; |
| 640 | |
| 641 | if (!UseHardware) |
| 642 | return; // No software stuff here! |
| 643 | |
| 644 | rend_SetZBufferWriteMask(0); |
| 645 | rend_SetAlphaType(AT_SATURATE_TEXTURE); |
| 646 | rend_SetAlphaValue(.3 * 255); |
| 647 | |
| 648 | rend_SetLighting(LS_GOURAUD); |
| 649 | rend_SetColorModel(CM_RGB); |
| 650 | |
| 651 | ddgr_color color = GR_RGB(r * 255, g * 255, b * 255); |
| 652 | int bm_handle = Fireballs[GRADIENT_BALL_INDEX].bm_handle; |
| 653 | int t; |
| 654 | |
| 655 | // We must draw the small ones first, but we're starting the iteration from the |
| 656 | // large one. Consequently, we must store our variables so we can draw in reverse order |
| 657 | for (t = 0; t < num_divs && size > .05; t++) { |
| 658 | glow_pos[t] = cur_pos; |
| 659 | glow_size[t] = size; |
| 660 | |
| 661 | size -= size_change; |
| 662 | cur_pos += ((*norm) * pos_change); |
| 663 | |
| 664 | total_parts++; |
| 665 | } |
| 666 | |
| 667 | for (t = total_parts - 1; t >= 0; t--) { |
| 668 | rend_SetZBias(-glow_size[t]); |
| 669 | g3_DrawBitmap(&glow_pos[t], glow_size[t], (glow_size[t] * bm_h(bm_handle, 0)) / bm_w(bm_handle, 0), bm_handle, |
| 670 | color); |
| 671 | } |
| 672 | rend_SetZBias(0.0); |
| 673 | rend_SetZBufferWriteMask(1); |
| 674 | } |
| 675 | |
| 676 | // Draws a glowing cone of light |
| 677 | void DrawGlowEffect(vector *pos, float r, float g, float b, vector *norm, float size) { |
no test coverage detected