Пример #1
0
static	void	make_snapshot( void )
{
  int vram_mode, text_mode;
  SNAPSHOT_FUNC		(*list)[4][2];


  /* skipline の場合は、予め snapshot_clear() を呼び出しておく */

  if     ( use_interlace == 0 ){ list = snapshot_list_normal; }
  else if( use_interlace >  0 ){ list = snapshot_list_itlace; }
  else                         { snapshot_clear();
				 list = snapshot_list_skipln; }



	/* VRAM/TEXT の内容を screen_snapshot[] に転送 */

  if( sys_ctrl & SYS_CTRL_80 ){
    if( CRTC_SZ_LINES == 25 ){ text_mode = V_80x25; }
    else                     { text_mode = V_80x20; }
  }else{
    if( CRTC_SZ_LINES == 25 ){ text_mode = V_40x25; }
    else                     { text_mode = V_40x20; }
  }

  if( grph_ctrl & GRPH_CTRL_VDISP ){
    if( grph_ctrl & GRPH_CTRL_COLOR ){		/* カラー */
        vram_mode = V_COLOR;
    }else{
      if( grph_ctrl & GRPH_CTRL_200 ){		/* 白黒 */
	vram_mode = V_MONO;
      }else{					/* 400ライン */
	vram_mode = V_HIRESO;
      }
    }
  }else{					/* 非表示 */
        vram_mode = V_UNDISP;
  }

  (list[ vram_mode ][ text_mode ][ V_ALL ])();


	/* パレットの内容を pal[] に転送 */

  setup_palette( pal );

  pal[16].red   = 0;		/* pal[16] は黒固定で使用する */
  pal[16].green = 0;
  pal[16].blue  = 0;
}
Пример #2
0
int main (int argc, char **argv) {
  image *img;
  
  printf ("start\n");
  allegro_init ();
  set_gfx_mode (GFX_VESA1,640,480,640,480);
  setup_palette ();
  img=open_pcx (argv[1]);
  convert_scr7 (img);
  getch ();
  erase_image (img);
  allegro_exit ();
  return 0;
}
Пример #3
0
nh_bool
curses_set_option(const char *name, union nh_optvalue value)
{
    nh_bool game_option = FALSE;
    struct nh_option_desc *option = nhlib_find_option(curses_options, name);

    if (!option) {
        if (game_is_running)
            return nh_set_option(name, value);

        /* If the game is not running, update our local copy of options. */
        if (!nh_options || !(option = nhlib_find_option(nh_options, name))) {
            return FALSE;
        }
        game_option = TRUE;
    }

    if ((int)option->type == OPTTYPE_KEYMAP) {
        return FALSE;
    }

    if (!nhlib_option_value_ok(option, value))
        return FALSE;

    nhlib_copy_option_value(option, value);

    if (game_option)
        return TRUE;

    /* In case the option affects graphics; this is pretty cheap if we don't do
       it every turn */
    mark_mapwin_for_full_refresh();

    if (option->type == OPTTYPE_BOOL) {
        nh_bool *var = nhlib_find_boolopt(boolopt_map, option->name);
        if (!var) {
            curses_impossible("missing boolean option");
            return FALSE;
        }

        *var = value.b;

        if (!strcmp(option->name, "status3")) {
            rebuild_ui();
        } else if (!strcmp(option->name, "darkgray")) {
            set_darkgray();
            draw_map(player.x, player.y);
        } else if (!strcmp(option->name, "mouse")) {
            uncursed_enable_mouse(option->value.b);
        }
    } else if (!strcmp(option->name, "comment")) {
        /* do nothing */
    } else if (!strcmp(option->name, "tileset")) {
        if (settings.tileset)
            free(settings.tileset);
        settings.tileset = malloc(strlen(option->value.s) + 1);
        strcpy(settings.tileset, option->value.s);
        rebuild_ui();
    } else if (!strcmp(option->name, "border")) {
        settings.whichframes = option->value.e;
        rebuild_ui();
    } else if (!strcmp(option->name, "menu_headings")) {
        settings.menu_headings = option->value.e;
    } else if (!strcmp(option->name, "palette")) {
        settings.palette = option->value.e;
        setup_palette();

        if (ui_flags.initialized) {
            /*
             * - We don't want to install a palette as a result of the default
             *   setting of "palette", because some terminals cannot handle a
             *   palette reset, and thus we need to ensure that we've loaded
             *   the user's palette setting before palette initialization.
             *
             * - Besides, clear() will crash with an uninitialized libuncursed.
             *   So we have to delay this anyway.
             */
            clear();
            refresh();
            rebuild_ui();
        }
    } else if (!strcmp(option->name, "animation")) {
        settings.animation = option->value.e;
    } else if (!strcmp(option->name, "sidebar")) {
        settings.sidebar = option->value.e;
        rebuild_ui();
    } 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, "networkmotd")) {
        settings.show_motd = option->value.e;
    } else if (!strcmp(option->name, "menupaging")) {
        settings.menupaging = option->value.e;
    } 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();
    }
    else
        return FALSE;

    return TRUE;
}