示例#1
0
文件: message.c 项目: mnstrmnch/meka
t_lang *	Lang_New(char *name)
{
    for (t_list* langs = Messages.Langs; langs; langs = langs->next)
	{
		t_lang* lang = (t_lang*)langs->elem;
        if (stricmp (name, lang->Name) == 0)
            return lang;
	}

    t_lang* lang = (t_lang*)malloc(sizeof (t_lang));
    lang->Name = strdup (name);
    for (int i = 0; i < MSG_MAX; i++)
        lang->Messages[i] = NULL;
    lang->WIP = FALSE;
    list_add_to_end (&Messages.Langs, lang);
    return (lang);
}
示例#2
0
文件: data.c 项目: dafyddcrosby/meka
// Convert truecolor graphics stored in datafile in current native format
void    Data_UpdateVideoMode()
{
    int i;
    t_list *bmp_copies;

    assert(g_Datafile != NULL);
    bmp_copies = g_DatafileBitmapCopy32;

    if (bmp_copies == NULL)
    {
		// First time, copy everything into 32-bits buffers.
        fixup_datafile(g_Datafile);
        for (i = 0; g_Datafile[i].type != DAT_END; i++)
        {
            if (g_Datafile[i].type == DAT_BITMAP)
            {
                BITMAP * dat_bmp = g_Datafile[i].dat;
                BITMAP * copy_bmp = create_bitmap_ex(32, dat_bmp->w, dat_bmp->h);
                blit(dat_bmp, copy_bmp, 0, 0, 0, 0, dat_bmp->w, dat_bmp->h);
                list_add_to_end(&g_DatafileBitmapCopy32, copy_bmp);
            }
        }
        bmp_copies = g_DatafileBitmapCopy32;
    }

    for (i = 0; g_Datafile[i].type != DAT_END; i++)
    {
        if (g_Datafile[i].type == DAT_BITMAP)
        {
			// Recreate it all
			BITMAP * src_bmp = bmp_copies->elem;
			BITMAP * dst_bmp = create_bitmap( src_bmp->w, src_bmp->h );
			destroy_bitmap( g_Datafile[i].dat );
			g_Datafile[i].dat = dst_bmp;
			blit(src_bmp, dst_bmp, 0, 0, 0, 0, src_bmp->w, src_bmp->h);
            bmp_copies = bmp_copies->next;
        }
    }
    //fixup_datafile(g_Datafile);
	Data_UpdateNamedPointers();
}
示例#3
0
文件: blitintf.c 项目: mnstrmnch/meka
static int  Blitters_Parse_Line(char *s, char *s_case)
{
    if (s[0] == '[')
    {
        Blitters.current = Blitter_New(&s_case[1]);
        if (Blitters.current != NULL)
        {
            Blitters.count++;
            list_add_to_end(&Blitters.list, Blitters.current);
        }
        return (MEKA_ERR_OK);
    }

    // Skip line when we're inside a blitter we can ignore
    if (Blitters.current == NULL) 
        return (MEKA_ERR_OK);

    // Set attributes
    char w[256];
    parse_getword(w, sizeof(w), &s, "=", ';', PARSE_FLAGS_NONE);
	int i;
    for (i = 0; Blitters_Def_Variables [i]; i++)
        if (!strcmp(w, Blitters_Def_Variables [i]))
            break;
    if (Blitters.current == NULL)
        return (MEKA_ERR_MISSING);
    switch (i)
    {
        // Resolution
    case 0:
        {
            int x, y;
            parse_skip_spaces(&s);
            if (sscanf(s, "%dx%d", &x, &y) == 2)
            {
                Blitters.current->res_x = x;
                Blitters.current->res_y = y;
            }
            return MEKA_ERR_OK;
        }
        // Blitter
    case 1:
        Blitters.current->blitter = Blitters_Str2Num (s);
        if (Blitters.current->blitter == BLITTER_TVMODE || Blitters.current->blitter == BLITTER_TVMODE_DOUBLE)
            Blitters.current->tv_colors = TRUE;
        else
            Blitters.current->tv_colors = FALSE;
        return MEKA_ERR_OK;
    case 2:
        if (!strcmp(w, "auto"))
            Blitters.current->refresh_rate = 0;
        else
            Blitters.current->refresh_rate = atoi(s);
        return MEKA_ERR_OK;
        // Stretch
    case 3:
        Blitters.current->stretch = BLITTER_STRETCH_MAX_INT;
        return MEKA_ERR_OK;
    }
    return MEKA_ERR_UNKNOWN;
}