示例#1
0
/** Change the UTF8graphics symbol at position with codepoint "value". */
void
assign_utf8graphics_symbol(int position, glyph_t value)
{
#ifdef UTF8_GLYPHS
    if (position < MAXPCHARS) {
        utf8_graphics[position] = value;
        /* need to update showsym */
        if (iflags.UTF8graphics) {
            switch_graphics(UTF8_GRAPHICS);
        }
    }
#endif
}
示例#2
0
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;
    }
}
示例#3
0
static nh_bool option_change_callback(struct nh_option_desc *option)
{
    if (!strcmp(option->name, "classic_status") ||
	!strcmp(option->name, "darkmsg") ||
	!strcmp(option->name, "frame") ||
	!strcmp(option->name, "frame_hp_color") ||
	!strcmp(option->name, "status3") ||
	!strcmp(option->name, "sidebar")) {
	rebuild_ui();
	return TRUE;
    }
    else if (!strcmp(option->name, "showexp") ||
	!strcmp(option->name, "showscore") ||
	!strcmp(option->name, "time")) {
	curses_update_status(NULL);
    }
    else if (!strcmp(option->name, "darkroom") ||
	!strcmp(option->name, "hilite_peaceful") ||
	!strcmp(option->name, "hilite_pet") ||
	!strcmp(option->name, "mapcolors")) {
	draw_map(player.x, player.y);
    }
    else if (!strcmp(option->name, "darkgray")) {
	set_darkgray();
	draw_map(player.x, player.y);
    }
    else if (!strcmp(option->name, "dungeon_name")) {
	settings.dungeon_name = option->value.e;
	rebuild_ui();
    }
    else if (!strcmp(option->name, "menu_headings")) {
	settings.menu_headings = option->value.e;
    }
    else if (!strcmp(option->name, "graphics")) {
	settings.graphics = option->value.e;
	switch_graphics(option->value.e);
	if (ui_flags.ingame) {
	    draw_map(player.x, player.y);
	    redraw_game_windows();
	}
    }
    else if (!strcmp(option->name, "scores_top")) {
	settings.end_top = option->value.i;
    }
    else if (!strcmp(option->name, "scores_around")) {
	settings.end_around = option->value.i;
    }
    else if (!strcmp(option->name, "optstyle")) {
	settings.optstyle = option->value.e;
    }
    else if (!strcmp(option->name, "msgheight")) {
	settings.msgheight = option->value.i;
	rebuild_ui();
    }
    else if (!strcmp(option->name, "msghistory")) {
	settings.msghistory = option->value.i;
	alloc_hist_array();
    }
#if defined(PDCURSES) && defined(WIN32)
    else if (!strcmp(option->name, "win_width")) {
	settings.win_width = option->value.i;
	resize_term(settings.win_height, settings.win_width);
	handle_resize();
    }
    else if (!strcmp(option->name, "win_height")) {
	settings.win_height = option->value.i;
	resize_term(settings.win_height, settings.win_width);
	handle_resize();
    }
#endif
    else if (!strcmp(option->name, "name")) {
	if (option->value.s)
	    strcpy(settings.plname, option->value.s);
	else
	    settings.plname[0] = '\0';
    }
    else
	return FALSE;
    
    return TRUE;
}