renders the shield rating for the ship
| 467 | |
| 468 | // renders the shield rating for the ship |
| 469 | void RenderHUDShieldValue(tHUDItem *item) { |
| 470 | const int SHIELD_NUM_X = 86, SHIELD_NUM_Y = 14; |
| 471 | const int SHIELD_IMG_X = 21, SHIELD_IMG_Y = 57; |
| 472 | const int WARNING_IMG_X = 110, WARNING_IMG_Y = 8; |
| 473 | float alpha_mod = (Objects[Players[Player_num].objnum].shields) / (float)INITIAL_SHIELDS; |
| 474 | |
| 475 | if (alpha_mod > 1.0f) |
| 476 | alpha_mod = 1.0f; |
| 477 | |
| 478 | if (item->stat & STAT_GRAPHICAL) { |
| 479 | // GRAPHICAL VERSION |
| 480 | // display text and warning dot |
| 481 | int img = (int)ceil((1.0f - alpha_mod - 0.1f) * NUM_SHIELD_GAUGE_FRAMES); |
| 482 | float grscalex = (item->grscalex != 0.0f) ? item->grscalex : HUD_SHIELD_SCALE; |
| 483 | float grscaley = (item->grscaley != 0.0f) ? item->grscaley : HUD_SHIELD_SCALE; |
| 484 | |
| 485 | RenderHUDText(item->color, item->alpha, item->saturation_count, item->x + SHIELD_NUM_X, item->y + SHIELD_NUM_Y, |
| 486 | "%03d", (int)Objects[Players[Player_num].objnum].shields); |
| 487 | |
| 488 | if (alpha_mod <= 0.20f) { |
| 489 | RenderHUDQuad(item->x + WARNING_IMG_X, item->y + WARNING_IMG_Y, bm_w(HUD_resources.dot_bmp, 0) * HUD_DOT_SCALE, |
| 490 | bm_h(HUD_resources.dot_bmp, 0) * HUD_DOT_SCALE, 0, 0, 1, 1, HUD_resources.dot_bmp, item->alpha, 1); |
| 491 | } |
| 492 | |
| 493 | if (img < NUM_SHIELD_GAUGE_FRAMES) { |
| 494 | if (img < 0) |
| 495 | img = 0; |
| 496 | img = HUD_resources.shield_bmp[img]; |
| 497 | RenderHUDQuad(item->x + SHIELD_IMG_X, item->y + SHIELD_IMG_Y, bm_w(img, 0) * grscalex, bm_h(img, 0) * grscaley, 0, |
| 498 | 0, 1, 1, img, item->alpha, item->saturation_count); |
| 499 | } |
| 500 | } else if (item->stat & STAT_SPECIAL) { |
| 501 | RenderHUDText(item->color, item->alpha, item->saturation_count, item->x, item->y, "%03d", |
| 502 | (int)Objects[Players[Player_num].objnum].shields); |
| 503 | |
| 504 | if (alpha_mod <= 0.20f) { |
| 505 | RenderHUDQuad(item->x + 30, item->y - 10, bm_w(HUD_resources.dot_bmp, 0) * HUD_DOT_SCALE, |
| 506 | bm_h(HUD_resources.dot_bmp, 0) * HUD_DOT_SCALE, 0, 0, 1, 1, HUD_resources.dot_bmp, item->alpha, 1); |
| 507 | } |
| 508 | } else { |
| 509 | // TEXT VERSION |
| 510 | RenderHUDText(item->tcolor, item->alpha, (alpha_mod <= .20f) ? item->saturation_count + 1 : item->saturation_count, |
| 511 | item->tx, item->ty, "%s: %03d", TXT_HUD_SHIELDS, (int)Objects[Players[Player_num].objnum].shields); |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | // renders the energy rating for the ship |
| 516 | void RenderHUDEnergyValue(tHUDItem *item) { |
no test coverage detected