| 723 | // renders the ship gauge monitor |
| 724 | #define GAUGE_INVSHIPRING_DELTA 0.06f |
| 725 | void RenderShipMonitor(tGauge *gauge, bool modified) { |
| 726 | if (!gauge->functional) |
| 727 | return; |
| 728 | |
| 729 | uint8_t alpha = 255; |
| 730 | if (Objects[Players[Player_num].objnum].effect_info->type_flags & EF_CLOAKED) { |
| 731 | float time_frame = Objects[Players[Player_num].objnum].effect_info->cloak_time; |
| 732 | if (time_frame < HUD_CLOAKEND_TIME) { |
| 733 | alpha = 128 - 127 * FixCos(65536.0f * (time_frame - (int)time_frame)); |
| 734 | } else { |
| 735 | alpha = 0; |
| 736 | } |
| 737 | } |
| 738 | |
| 739 | DrawGaugeQuad(gauge->pts, HUD_resources.ship_bmp, alpha); |
| 740 | DrawGaugeQuad(gauge->pts, HUD_resources.ship_bmp, alpha, true); |
| 741 | |
| 742 | if (Players[Player_num].flags & PLAYER_FLAGS_INVULNERABLE) { |
| 743 | // get to the view matrix so we have direction vectors to move along |
| 744 | matrix view_matrix; |
| 745 | g3_GetUnscaledMatrix(&view_matrix); |
| 746 | |
| 747 | float inv_time_frame = (Gametime - (int)Gametime); |
| 748 | float inv_alpha = (uint8_t)(255 * (1.0f - (inv_time_frame / 2.0f))); |
| 749 | g3Point invpts[4]; |
| 750 | int i; |
| 751 | |
| 752 | // do invulnerability animation. |
| 753 | for (i = 0; i < 4; i++) { |
| 754 | invpts[i] = gauge->pts[i]; |
| 755 | } |
| 756 | |
| 757 | float amount = (inv_time_frame * GAUGE_INVSHIPRING_DELTA); |
| 758 | invpts[0].p3_x -= amount; |
| 759 | invpts[0].p3_y += amount; |
| 760 | invpts[1].p3_x += amount; |
| 761 | invpts[1].p3_y += amount; |
| 762 | invpts[2].p3_x += amount; |
| 763 | invpts[2].p3_y -= amount; |
| 764 | invpts[3].p3_x -= amount; |
| 765 | invpts[3].p3_y -= amount; |
| 766 | |
| 767 | invpts[0].p3_vecPreRot = invpts[0].p3_vecPreRot - (view_matrix.rvec * amount) + (view_matrix.uvec * amount); |
| 768 | invpts[1].p3_vecPreRot = invpts[1].p3_vecPreRot + (view_matrix.rvec * amount) + (view_matrix.uvec * amount); |
| 769 | invpts[2].p3_vecPreRot = invpts[2].p3_vecPreRot + (view_matrix.rvec * amount) - (view_matrix.uvec * amount); |
| 770 | invpts[3].p3_vecPreRot = invpts[3].p3_vecPreRot - (view_matrix.rvec * amount) - (view_matrix.uvec * amount); |
| 771 | |
| 772 | DrawGaugeQuad(invpts, HUD_resources.invpulse_bmp, inv_alpha); |
| 773 | DrawGaugeQuad(invpts, HUD_resources.invpulse_bmp, inv_alpha, true); |
| 774 | } |
| 775 | } |
| 776 | |
| 777 | // projects monitor coordinates to screen coordinates |
| 778 | void RotateMonitorPosition(tGauge *gauge) { |
no test coverage detected