static struct line *new_line(const char *msg, int fg_color, const char *color) { struct line *l = NULL; l = calloc(1, sizeof(struct line)); if (NULL == l) return NULL; strcpy(l->s, msg); if (NULL == color) l->fg = fg_color; else l->fg = color_grc_to_al(get_color_depth(), color); l->next = NULL; return l; }
static int setgfxmode(int fullscreen) { if (!fullscreen && set_gfx_mode(GFX_AUTODETECT_WINDOWED, 512, 400, 0, 0) == 0) { term_width = 64; set_display_switch_mode(SWITCH_BACKGROUND); set_display_switch_callback(SWITCH_OUT, lost_focus); return 1; } if (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0) == 0) { term_width = 80; set_display_switch_mode(SWITCH_PAUSE); return 1; } if (get_color_depth() != 8) { set_color_depth(8); return setgfxmode(fullscreen); } set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Unable to set any graphics mode:\n" "%s\n", allegro_error); return 0; }