コード例 #1
0
ファイル: deh_main.c プロジェクト: Clever-Boy/chocolate-doom
int DEH_LoadFile(char *filename)
{
    deh_context_t *context;

    if (!deh_initialized)
    {
        DEH_Init();
    }

    // Before parsing a new file, reset special override flags to false.
    // Magic comments should only apply to the file in which they were
    // defined, and shouldn't carry over to subsequent files as well.
    deh_allow_long_strings = false;
    deh_allow_long_cheats = false;
    deh_allow_extended_strings = false;

    printf(" loading %s\n", filename);

    context = DEH_OpenFile(filename);

    if (context == NULL)
    {
        fprintf(stderr, "DEH_LoadFile: Unable to open %s\n", filename);
        return 0;
    }

    DEH_ParseContext(context);

    DEH_CloseFile(context);

    if (DEH_HadError(context))
    {
        I_Error("Error parsing dehacked file");
    }

    return 1;
}
コード例 #2
0
ファイル: deh_main.c プロジェクト: edwinj85/Teapot-Doom
int DEH_LoadLump(int lumpnum, boolean allow_long, boolean allow_error)
{
    deh_context_t *context;

    if (!deh_initialized)
    {
        InitializeSections();
        deh_initialized = true;
    }

    // Reset all special flags to defaults.
    deh_allow_long_strings = allow_long;
    deh_allow_long_cheats = allow_long;
    deh_allow_extended_strings = false;

    context = DEH_OpenLump(lumpnum);

    if (context == NULL)
    {
        fprintf(stderr, "DEH_LoadFile: Unable to open lump %i\n", lumpnum);
        return 0;
    }

    DEH_ParseContext(context);

    DEH_CloseFile(context);

    // If there was an error while parsing, abort with an error, but allow
    // errors to just be ignored if allow_error=true.
    if (!allow_error && DEH_HadError(context))
    {
        I_Error("Error parsing dehacked lump");
    }

    return 1;
}