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

Function win_draw_map

outdated/win/gem/wingem1.c:593–665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

591int mar_set_tile_mode(int);
592
593static void
594win_draw_map(int first, WIN *win, GRECT *area)
595{
596 int pla[8], w = area->g_w - 1, h = area->g_h - 1;
597 int i, x, y;
598 GRECT back = *area;
599
600 first = first;
601
602 if (!mar_set_tile_mode(FAIL)) {
603 int start =
604 (area->g_x - win->work.g_x) / map_font.cw + scroll_map.hpos;
605 int stop = (area->g_x + area->g_w + map_font.cw - 1 - win->work.g_x)
606 / map_font.cw
607 + scroll_map.hpos;
608 int starty =
609 (area->g_y - win->work.g_y) / map_font.ch + scroll_map.vpos;
610 int stopy = min((area->g_y + area->g_h + map_font.ch - 1
611 - win->work.g_y) / map_font.ch
612 + scroll_map.vpos,
613 ROWNO);
614 char tmp;
615 v_set_text(map_font.id, map_font.size, WHITE, 0, 0, NULL);
616 v_set_mode(MD_TRANS);
617
618 x = win->work.g_x - scroll_map.px_hpos + start * map_font.cw;
619 y = win->work.g_y - scroll_map.px_vpos + starty * map_font.ch;
620 pla[2] = pla[0] = scroll_map.px_hpos + area->g_x - win->work.g_x;
621 pla[3] = pla[1] = starty * map_font.ch;
622 pla[2] += w;
623 pla[3] += map_font.ch - 1;
624 pla[6] = pla[4] = area->g_x; /* x_wert to */
625 pla[7] = pla[5] = y; /* y_wert to */
626 pla[6] += w;
627 pla[7] += map_font.ch - 1;
628 back.g_h = map_font.ch;
629 for (i = starty; i < stopy; i++, y += map_font.ch,
630 pla[1] += map_font.ch, pla[3] += map_font.ch,
631 pla[5] += map_font.ch, pla[7] += map_font.ch) {
632 back.g_y = y;
633 my_color_area(&back, BLACK);
634 tmp = map_glyphs[i][stop];
635 map_glyphs[i][stop] = 0;
636 (*v_mtext)(x_handle, x, y, &map_glyphs[i][start]);
637 map_glyphs[i][stop] = tmp;
638 vro_cpyfm(x_handle, S_OR_D, pla, &FontCol_Bild, screen);
639 }
640 } else {
641 v_set_mode(MD_REPLACE);
642 pla[2] = pla[0] = scroll_map.px_hpos + area->g_x - win->work.g_x;
643 pla[3] = pla[1] = scroll_map.px_vpos + area->g_y - win->work.g_y;
644 pla[2] += w;
645 pla[3] += h;
646 pla[6] = pla[4] = area->g_x; /* x_wert to */
647 pla[7] = pla[5] = area->g_y; /* y_wert to */
648 pla[6] += w;
649 pla[7] += h;
650 vro_cpyfm(x_handle, S_ONLY, pla, &Map_bild, screen);

Callers

nothing calls this directly

Calls 2

mar_set_tile_modeFunction · 0.85
my_color_areaFunction · 0.85

Tested by

no test coverage detected