MCPcopy Create free account
hub / github.com/NetHack/NetHack / positionbar

Function positionbar

sys/msdos/vidvesa.c:2075–2149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2073}
2074
2075static void
2076positionbar(void)
2077{
2078 unsigned char *posbar = pbar;
2079 int feature, ucol;
2080
2081 int startk, stopk;
2082 boolean nowhere = FALSE;
2083 int pixx, col;
2084 int pixy = (PBAR_ROW * vesa_char_height);
2085 int tmp;
2086
2087 if (!iflags.grmode || !iflags.tile_view)
2088 return;
2089 if ((clipx < 0) || (clipxmax <= 0) || (clipx >= clipxmax))
2090 nowhere = TRUE;
2091 if (nowhere) {
2092#ifdef DEBUG
2093 pline("Would have put bar using %d - %d.", clipx, clipxmax);
2094#endif
2095 return;
2096 }
2097 startk = clipx * vesa_x_res / COLNO;
2098 stopk = (clipxmax + 1) * vesa_x_res / COLNO;
2099#ifdef OLD_STYLE
2100 vesa_FillRect(0, pixy, startk, vesa_char_height,
2101 PBAR_COLOR_OFF + FIRST_TEXT_COLOR);
2102 vesa_FillRect(startk, pixy, stopk - startk, vesa_char_height,
2103 PBAR_COLOR_ON + FIRST_TEXT_COLOR);
2104 vesa_FillRect(stopk, pixy, vesa_x_res - stopk, vesa_char_height,
2105 PBAR_COLOR_OFF + FIRST_TEXT_COLOR);
2106#else
2107 vesa_FillRect(0, pixy, vesa_x_res, 1, PBAR_COLOR_ON + FIRST_TEXT_COLOR);
2108 vesa_FillRect(0, pixy + 1, startk, vesa_char_height - 2,
2109 BACKGROUND_VESA_COLOR);
2110 vesa_FillRect(startk, pixy + 1, stopk - startk, vesa_char_height - 2,
2111 PBAR_COLOR_ON + FIRST_TEXT_COLOR);
2112 vesa_FillRect(stopk, pixy + 1, vesa_x_res - stopk, vesa_char_height - 2,
2113 BACKGROUND_VESA_COLOR);
2114 vesa_FillRect(0, pixy + vesa_char_height - 1, vesa_x_res, 1,
2115 PBAR_COLOR_ON + FIRST_TEXT_COLOR);
2116#endif
2117 ucol = 0;
2118 if (posbar) {
2119 while (*posbar != 0) {
2120 feature = *posbar++;
2121 col = *posbar++;
2122 pixx = col * vesa_x_res / COLNO;
2123 switch (feature) {
2124 case '>':
2125 vesa_WriteCharTransparent(feature, pixx, pixy, PBAR_COLOR_STAIRS);
2126 break;
2127 case '<':
2128 vesa_WriteCharTransparent(feature, pixx, pixy, PBAR_COLOR_STAIRS);
2129 break;
2130 case '@':
2131 ucol = col;
2132 vesa_WriteCharTransparent(feature, pixx, pixy, PBAR_COLOR_HERO);

Callers 2

vesa_refreshFunction · 0.70
vesa_DrawCursorFunction · 0.70

Calls 4

vesa_FillRectFunction · 0.85
vesa_flush_textFunction · 0.85
plineFunction · 0.50

Tested by

no test coverage detected