Пример #1
0
static void saveg_setup_mobjwrite(void) {
    mobj_t* mobj;
    int i;

    savegmobjnum = 0;

    // count mobjs
    for(mobj = mobjhead.next; mobj != &mobjhead; mobj = mobj->next) {
        // don't save if mobj is expected to be removed
        if(mobj->mobjfunc == P_SafeRemoveMobj) {
            continue;
        }

        savegmobjnum++;
    }

    // allocate ref table
    savegmobj = (savegmobj_t*)Z_Alloca(sizeof(savegmobj_t) * savegmobjnum);
    i = 0;

    // store index and mobj
    for(mobj = mobjhead.next; mobj != &mobjhead; mobj = mobj->next) {
        // don't save if mobj is expected to be removed
        if(mobj->mobjfunc == P_SafeRemoveMobj) {
            continue;
        }

        savegmobj[i].index = i + 1;
        savegmobj[i].mobj = mobj;
        i++;
    }
}
Пример #2
0
static void saveg_setup_mobjread(void) {
    int i;

    // get count and allocate table
    savegmobjnum = saveg_read32();
    savegmobj = (savegmobj_t*)Z_Alloca(sizeof(savegmobj_t) * savegmobjnum);

    // read and add mobjs
    for(i = 0; i < savegmobjnum; i++) {
        savegmobj[i].index = i + 1;
        savegmobj[i].mobj = Z_Calloc(sizeof(mobj_t), PU_LEVEL, NULL);
    }
}
Пример #3
0
void CON_Init(void) {
    int i;

    CON_CvarInit();

    console_buffer = (conline_t **)Z_Malloc(sizeof(conline_t *) * MAX_CONSOLE_LINES, PU_STATIC, NULL);
    console_head = 0;
    console_minline = 0;
    console_lineoffset = 0;

    for(i = 0; i < MAX_CONSOLE_LINES; i++) {
        console_buffer[i] = NULL;
    }

    for(i = 0; i < MAX_CONSOLE_INPUT_LEN; i++) {
        console_inputbuffer[i] = 0;
    }

    console_linelength = 0;
    console_inputlength = 1;
    console_inputbuffer[0] = CONSOLE_PROMPTCHAR;

    for(i = 0; i < CMD_HISTORY_SIZE; i++) {
        console_prevcmds[i] = -1;
    }

    console_cmdhead = 0;
    console_nextcmd = 0;

#ifdef USESYSCONSOLE
    {
        extern HWND hwndBuffer;
        char *buff;
        int i = SendMessage(hwndBuffer, WM_GETTEXTLENGTH, 0, 0);

        buff = Z_Alloca(i);

        SendMessage(hwndBuffer, WM_GETTEXT, i, (LPARAM)buff);
        CON_AddText(buff);
    }
#endif

    console_initialized = true;
}
Пример #4
0
//
// bex_include
//
// 12/12/03: New include function that allows EDF to queue
// DeHackEd/BEX files for later processing.  This helps to
// integrate BEX features such as string editing into the
// EDF/BEX superlanguage.
//
// This function interprets paths relative to the current 
// file.
//
static int bex_include(cfg_t *cfg, cfg_opt_t *opt, int argc,
                       const char **argv)
{
   char *currentpath;
   char *filename = NULL;

   // haleyjd 03/18/10: deprecation warning
   E_EDFLoggedWarning(0, "Warning: bexinclude is deprecated. "
                         "Please use a GFS or DEHACKED lump instead.\n");

   if(argc != 1)
   {
      cfg_error(cfg, "wrong number of args to bexinclude()\n");
      return 1;
   }
   if(!cfg->filename)
   {
      cfg_error(cfg, "bexinclude: cfg_t filename is undefined\n");
      return 1;
   }
   if(cfg_lexer_source_type(cfg) >= 0)
   {
      cfg_error(cfg, "bexinclude: cannot call from a wad lump\n");
      return 1;
   }

   currentpath = (char *)(Z_Alloca(strlen(cfg->filename) + 1));
   M_GetFilePath(cfg->filename, currentpath, strlen(cfg->filename) + 1);

   filename = M_SafeFilePath(currentpath, argv[0]);

   // queue the file for later processing
   D_QueueDEH(filename, 0);

   return 0;
}