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

Function draw_inventory

outdated/win/gem/wingem1.c:865–924  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

863}
864
865static int
866draw_inventory(PARMBLK *pb)
867{
868 GRECT area = *(GRECT *) &pb->pb_x;
869
870 if (rc_intersect((GRECT *) &pb->pb_xc, &area)) {
871 int gl, i, x = pb->pb_x, y = pb->pb_y, start_line = area.g_y - y;
872 Gem_menu_item *it;
873
874 v_set_mode(MD_REPLACE);
875 v_set_text(menu_font.id, menu_font.size, BLACK, 0, 0, NULL);
876
877 start_line /= menu_font.ch;
878 y += start_line * menu_font.ch;
879 x -= scroll_menu.px_hpos;
880 start_line += scroll_menu.vpos;
881
882 for (it = invent_list, i = start_line; --i >= 0 && it;
883 it = it->Gmi_next)
884 ;
885
886 i = min((area.g_y - y + area.g_h + menu_font.ch - 1) / menu_font.ch,
887 Anz_inv_lines - start_line);
888
889 Vsync();
890 area.g_h = menu_font.ch;
891
892 for (; (--i >= 0) && it; it = it->Gmi_next, y += menu_font.ch) {
893 if (it->Gmi_attr)
894 v_set_text(FAIL, FALSE, BLUE, 1, FAIL, NULL); /* Bold */
895 else
896 v_set_text(FAIL, FALSE, BLACK, 0, FAIL, NULL);
897
898 area.g_y = y;
899 my_clear_area(&area);
900 if ((gl = it->Gmi_glyph) != no_glyph) {
901 int pla[8], h = min(menu_font.ch, Tile_heigth) - 1;
902
903 pla[0] = pla[2] =
904 (gl % Tiles_per_line) * Tile_width; /* x_wert from */
905 pla[1] = pla[3] =
906 (gl / Tiles_per_line) * Tile_heigth; /* y_wert from */
907 pla[4] = pla[6] = x; /* x_wert to */
908 pla[5] = pla[7] = y; /* y_wert to */
909 pla[2] += Tile_width - 1;
910 pla[3] += h;
911 pla[6] += Tile_heigth - 1;
912 pla[7] += h;
913
914 vro_cpyfm(x_handle, S_ONLY, pla, &Tile_bilder, screen);
915 }
916 if (it->Gmi_identifier)
917 it->Gmi_str[2] = it->Gmi_selected
918 ? (it->Gmi_count == -1L ? '+' : '#')
919 : '-';
920 (*v_mtext)(x_handle, (x + 23) & ~7, y, it->Gmi_str);
921 }
922 }

Callers

nothing calls this directly

Calls 1

my_clear_areaFunction · 0.85

Tested by

no test coverage detected