void curses_init_options() { set_wc_option_mod_status(WC_ALIGN_MESSAGE|WC_ALIGN_STATUS|WC_COLOR| WC_HILITE_PET|WC_POPUP_DIALOG, SET_IN_GAME); set_wc2_option_mod_status(WC2_GUICOLOR, SET_IN_GAME); /* Remove a few options that are irrelevant to this windowport */ set_option_mod_status("DECgraphics", SET_IN_FILE); set_option_mod_status("perm_invent", SET_IN_FILE); set_option_mod_status("eight_bit_tty", SET_IN_FILE); /* Make sure that DECgraphics is not set to true via the config file, as this will cause display issues. We can't disable it in options.c in case the game is compiled with both tty and curses.*/ if (iflags.DECgraphics) { switch_graphics(CURS_GRAPHICS); } #ifdef PDCURSES /* PDCurses for SDL, win32 and OS/2 has the ability to set the terminal size programatically. If the user does not specify a size in the config file, we will set it to a nice big 110x32 to take advantage of some of the nice features of this windowport. */ if (iflags.wc2_term_cols == 0) { iflags.wc2_term_cols = 110; } if (iflags.wc2_term_rows == 0) { iflags.wc2_term_rows = 32; } resize_term(iflags.wc2_term_rows, iflags.wc2_term_cols); getmaxyx(base_term, term_rows, term_cols); /* This is needed for an odd bug with PDCurses-SDL in Windows */ # ifdef WIN32 switch_graphics(ASCII_GRAPHICS); if (iflags.IBMgraphics) { switch_graphics(IBM_GRAPHICS); } else if (iflags.cursesgraphics) { switch_graphics(CURS_GRAPHICS); } else { switch_graphics(ASCII_GRAPHICS); } # endif /* WIN32 */ #endif /* PDCURSES */ if (!iflags.wc2_windowborders) { iflags.wc2_windowborders = 3; /* Set to auto if not specified */ } if (!iflags.wc2_petattr) { iflags.wc2_petattr = A_UNDERLINE; } else /* Pet attribute specified, so hilite_pet should be true */ { iflags.hilite_pet = TRUE; } }
/* init_nhwindows(int* argcp, char** argv) -- Initialize the windows used by NetHack. This can also create the standard windows listed at the top, but does not display them. -- Any commandline arguments relevant to the windowport should be interpreted, and *argcp and *argv should be changed to remove those arguments. -- When the message window is created, the variable iflags.window_inited needs to be set to TRUE. Otherwise all plines() will be done via raw_print(). ** Why not have init_nhwindows() create all of the "standard" ** windows? Or at least all but WIN_INFO? -dean */ void curses_init_nhwindows(int* argcp, char** argv) { #ifdef PDCURSES char window_title[BUFSZ]; #endif #ifdef XCURSES base_term = Xinitscr(*argcp, argv); #else base_term = initscr(); #endif #ifdef TEXTCOLOR if (has_colors()) { start_color(); curses_init_nhcolors(); } else { iflags.use_color = FALSE; set_option_mod_status("color", SET_IN_FILE); iflags.wc2_guicolor = FALSE; set_wc2_option_mod_status(WC2_GUICOLOR, SET_IN_FILE); } #else iflags.use_color = FALSE; set_option_mod_status("color", SET_IN_FILE); iflags.wc2_guicolor = FALSE; set_wc2_option_mod_status(WC2_GUICOLOR, SET_IN_FILE); #endif noecho(); raw(); meta(stdscr, TRUE); orig_cursor = curs_set(0); keypad(stdscr, TRUE); #ifdef NCURSES_VERSION # ifdef __APPLE__ ESCDELAY = 25; # else set_escdelay(25); # endif /* __APPLE__ */ #endif /* NCURSES_VERSION */ #ifdef PDCURSES # ifdef DEF_GAME_NAME # ifdef VERSION_STRING sprintf(window_title, "%s %s", DEF_GAME_NAME, VERSION_STRING); # else sprintf(window_title, "%s", DEF_GAME_NAME); # endif /* VERSION_STRING */ # else # ifdef VERSION_STRING sprintf(window_title, "%s %s", "NetHack", VERSION_STRING); # else sprintf(window_title, "%s", "NetHack"); # endif /* VERSION_STRING */ # endif /* DEF_GAME_NAME */ PDC_set_title(window_title); PDC_set_blink(TRUE); /* Only if the user asks for it! */ timeout(1); (void)getch(); timeout(-1); #endif /* PDCURSES */ getmaxyx(base_term, term_rows, term_cols); counting = FALSE; curses_init_options(); if ((term_rows < 15) || (term_cols < 40)) { panic("Terminal too small. Must be minumum 40 width and 15 height"); } curses_create_main_windows(); curses_init_mesg_history(); curses_display_splash_window(); }