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

Function vesa_redrawmap

sys/msdos/vidvesa.c:803–883  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

801}
802
803static void
804vesa_redrawmap(void)
805{
806 unsigned y_top = TOP_MAP_ROW * vesa_char_height;
807 unsigned y_bottom = vesa_y_res - 5 * vesa_char_height;
808 unsigned x, y, cx, cy, py /*, px */ ;
809 /* unsigned long color; */
810 unsigned long offset = y_top * (unsigned long) vesa_scan_line;
811 unsigned char *p_row = NULL;
812 unsigned p_row_width;
813
814 /*
815 * The map is drawn in pixel-row order (pixel row 0, then row 1, etc.),
816 * rather than cell by cell, to minimize calls to vesa_SetWindow.
817 */
818 if (iflags.traditional_view) {
819 /* Text mode */
820 y = y_top;
821 for (cy = clipy; cy <= (unsigned) clipymax && cy < ROWNO; ++cy) {
822 struct VesaCharacter t_row[COLNO];
823 for (cx = clipx; cx <= (unsigned) clipxmax && cx < COLNO; ++cx) {
824 t_row[cx].chr = map[cy][cx].ch;
825 t_row[cx].colour = map[cy][cx].attr;
826 t_row[cx].bgcolour = BACKGROUND_VESA_COLOR;
827 t_row[cx].inverse = map[cy][cx].inverse;
828 }
829 vesa_WriteTextRow(0, y, t_row + clipx, cx - clipx);
830 x = (cx - clipx) * vesa_char_width;
831 if (x < vesa_x_res) {
832 vesa_FillRect(x, y, vesa_x_res - x, vesa_char_height, BACKGROUND_VESA_COLOR);
833 }
834 y += vesa_char_height;
835 }
836 } else if (iflags.over_view) {
837 /* Overview mode */
838 const unsigned char *tile;
839
840 p_row_width = vesa_oview_width * vesa_pixel_bytes;
841 y = y_top;
842 for (cy = 0; cy < ROWNO; ++cy) {
843 for (py = 0; py < vesa_oview_height; ++py) {
844 for (cx = 0; cx < COLNO; ++cx) {
845 tile = vesa_oview_tiles[map[cy][cx].tileidx];
846 vesa_WritePixelRow(offset + p_row_width * cx, tile + p_row_width * py, p_row_width);
847 }
848 x = COLNO * vesa_oview_width;
849 if (x < vesa_x_res) {
850 vesa_FillRect(x, y, vesa_x_res - x, 1, BACKGROUND_VESA_COLOR);
851 }
852 offset += vesa_scan_line;
853 ++y;
854 }
855 }
856 } else {
857 /* Normal tiled mode */
858 const unsigned char *tile;
859
860 p_row_width = iflags.wc_tile_width * vesa_pixel_bytes;

Callers 3

vesa_cliparoundFunction · 0.85
vesa_refreshFunction · 0.85
vesa_DrawCursorFunction · 0.85

Calls 3

vesa_WriteTextRowFunction · 0.85
vesa_FillRectFunction · 0.85
vesa_WritePixelRowFunction · 0.85

Tested by

no test coverage detected