MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / RenderPrimaryMonitor

Function RenderPrimaryMonitor

Descent3/gauges.cpp:511–566  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

509}
510
511void RenderPrimaryMonitor(tGauge *gauge, bool modified) {
512 if (Disable_primary_monitor)
513 return;
514
515 if (gauge->functional) {
516 float alphas[4];
517 alphas[0] = 1.0f;
518 alphas[1] = 1.0f;
519 alphas[2] = 1.0f;
520 alphas[3] = 1.0f;
521
522 int hud_image = get_weapon_hud_image(Player_num, PW_PRIMARY);
523
524 DrawGaugeMonitor(gauge->pts, hud_image, 0.5f, alphas);
525
526 if (!Render_gauge_moving) {
527 int x1, y;
528 int index = Players[Player_num].weapon[PW_PRIMARY].index;
529 ship *ship = &Ships[Players[Player_num].ship_index];
530 otype_wb_info *wb = &ship->static_wb[index];
531
532 gauge->pts[0].p3_flags &= (~PF_PROJECTED);
533 g3_ProjectPoint(&gauge->pts[0]);
534 x1 = gauge->pts[0].p3_sx;
535 y = gauge->pts[0].p3_sy;
536
537 grtext_SetFlags(0);
538 grtext_SetFancyColor(GR_RGB(0, 180, 0), GR_RGB(0, 180, 0), GR_RGB(0, 180, 0), GR_RGB(0, 180, 0));
539 grtext_Printf(x1 + HUD_X(30), y + HUD_Y(10), "%s", TXT(Static_weapon_ckpt_names[index][0]));
540 grtext_SetFlags(GRTEXTFLAG_SATURATE);
541 grtext_Printf(x1 + HUD_X(30), y + HUD_Y(10), "%s", TXT(Static_weapon_ckpt_names[index][0]));
542
543 if (strlen(TXT(Static_weapon_ckpt_names[Players[Player_num].weapon[PW_PRIMARY].index][1]))) {
544 grtext_SetFlags(0);
545 grtext_Printf(x1 + HUD_X(35), y + HUD_Y(20), "%s", TXT(Static_weapon_ckpt_names[index][1]));
546 grtext_SetFlags(GRTEXTFLAG_SATURATE);
547 grtext_Printf(x1 + HUD_X(35), y + HUD_Y(20), "%s", TXT(Static_weapon_ckpt_names[index][1]));
548 y = y + HUD_Y(10);
549 }
550
551 if (wb && wb->ammo_usage) {
552 int ammo = Players[Player_num].weapon_ammo[index];
553 grtext_SetFlags(0);
554 if (ship->fire_flags[index] & SFF_TENTHS) {
555 grtext_Printf(x1 + HUD_X(40), y + HUD_Y(20), "%d.%d", ammo / 10, ammo % 10);
556 grtext_SetFlags(GRTEXTFLAG_SATURATE);
557 grtext_Printf(x1 + HUD_X(40), y + HUD_Y(20), "%d.%d", ammo / 10, ammo % 10);
558 } else {
559 grtext_Printf(x1 + HUD_X(40), y + HUD_Y(20), "%d", ammo);
560 grtext_SetFlags(GRTEXTFLAG_SATURATE);
561 grtext_Printf(x1 + HUD_X(40), y + HUD_Y(20), "%d", ammo);
562 }
563 }
564 }
565 }
566}
567
568// renders the secondary monitor gauge

Callers 1

RenderGaugesFunction · 0.85

Calls 7

get_weapon_hud_imageFunction · 0.85
DrawGaugeMonitorFunction · 0.85
g3_ProjectPointFunction · 0.85
grtext_SetFlagsFunction · 0.85
grtext_SetFancyColorFunction · 0.85
grtext_PrintfFunction · 0.85
GR_RGBFunction · 0.50

Tested by

no test coverage detected