* Open tile files, * initialize the SCREEN, switch it to graphics mode, * initialize the pointers to the fonts, clear * the screen. * */
| 748 | * |
| 749 | */ |
| 750 | void |
| 751 | vga_Init(void) |
| 752 | { |
| 753 | int i; |
| 754 | const char *font_name; |
| 755 | |
| 756 | #ifdef TILES_IN_GLYPHMAP |
| 757 | const char *tile_file; |
| 758 | int tilefailure = 0; |
| 759 | /* |
| 760 | * Attempt to open the required tile files. If we can't |
| 761 | * don't perform the video mode switch, use TTY code instead. |
| 762 | * |
| 763 | */ |
| 764 | tile_file = iflags.wc_tile_file; |
| 765 | if (tile_file == NULL || *tile_file == '\0') { |
| 766 | tile_file = "nhtiles.bmp"; |
| 767 | } |
| 768 | if (!read_tiles(tile_file, FALSE)) |
| 769 | tilefailure |= 1; |
| 770 | if (get_palette() == NULL) |
| 771 | tilefailure |= 4; |
| 772 | |
| 773 | if (tilefailure) { |
| 774 | raw_printf("Reverting to TTY mode, tile initialization failure (%d).", |
| 775 | tilefailure); |
| 776 | wait_synch(); |
| 777 | iflags.usevga = 0; |
| 778 | iflags.tile_view = FALSE; |
| 779 | iflags.over_view = FALSE; |
| 780 | CO = 80; |
| 781 | LI = 25; |
| 782 | /* term_clear_screen() */ /* not vga_clear_screen() */ |
| 783 | return; |
| 784 | } |
| 785 | #endif |
| 786 | |
| 787 | if (iflags.usevga) { |
| 788 | for (i = 0; i < SCREENHEIGHT; ++i) { |
| 789 | screentable[i] = MK_PTR(VIDEOSEG, (i * SCREENBYTES)); |
| 790 | } |
| 791 | } |
| 792 | vga_SwitchMode(MODE640x480); |
| 793 | windowprocs.win_cliparound = vga_cliparound; |
| 794 | /* vga_NoBorder(BACKGROUND_VGA_COLOR); */ /* Not needed after palette |
| 795 | mod */ |
| 796 | #ifdef TILES_IN_GLYPHMAP |
| 797 | paletteptr = get_palette(); |
| 798 | iflags.tile_view = TRUE; |
| 799 | iflags.over_view = FALSE; |
| 800 | #else |
| 801 | paletteptr = defpalette; |
| 802 | #endif |
| 803 | vga_SetPalette(paletteptr); |
| 804 | g_attribute = attrib_gr_normal; |
| 805 | rom_font = (unsigned char __far *) vga_FontPtrs(); |
| 806 | |
| 807 | /* Load an external font if requested */ |
no test coverage detected