Ejemplo n.º 1
0
/*
=================
WriteLevel
 
=================
*/
void WriteLevel(char *filename){
	int	i;
	edict_t	*ent;
	FILE	*f;
	void	*base;
	
	f = fopen(filename, "wb");
	if(!f)
		gi.error("Couldn't open %s", filename);
		
	// write out edict size for checking
	i = sizeof(edict_t);
	fwrite(&i, sizeof(i), 1, f);
	
	// write out a function pointer for checking
	base =(void *)InitGame;
	fwrite(&base, sizeof(base), 1, f);
	
	// write out level_locals_t
	WriteLevelLocals(f);
	
	// write out all the entities
	for(i = 0; i < globals.num_edicts; i++){
		ent = &g_edicts[i];
		if(!ent->inuse)
			continue;
		fwrite(&i, sizeof(i), 1, f);
		WriteEdict(f, ent);
	}
	i = -1;
	fwrite(&i, sizeof(i), 1, f);
	
	fclose(f);
}
Ejemplo n.º 2
0
/*
=================
WriteLevel

=================
*/
void WriteLevel (char *filename)
{
	int		i;
	edict_t	*ent;
	FILE	*f;
	void	*base;

	if(developer->value)
		gi.dprintf ("==== WriteLevel ====\n");

	f = fopen (filename, "wb");
	if (!f)
		gi.error ("Couldn't open %s", filename);

	// write out edict_t size for checking
	i = sizeof(edict_t);
	fwrite (&i, sizeof(i), 1, f);
	

	// write out a function pointer for checking
	base = (void *)InitGame;
	fwrite (&base, sizeof(base), 1, f);

	// write out level_locals_t
	WriteLevelLocals (f);

	// write out all the entities
	for (i=0 ; i<globals.num_edicts ; i++)
	{
		ent = &g_edicts[i];
		if (!ent->inuse)
			continue;
		// Knightmare- don't save reflections
		if (ent->flags & FL_REFLECT)
			continue;

		fwrite (&i, sizeof(i), 1, f);
		WriteEdict (f, ent);
	}
	i = -1;
	fwrite (&i, sizeof(i), 1, f);

	fclose (f);
}
Ejemplo n.º 3
0
/*
 * Writes the current level
 * into a file.
 */
void
WriteLevel(const char *filename)
{
    int i;
    edict_t *ent;
    FILE *f;

    f = fopen(filename, "wb");

    if (!f)
    {
        gi.error("Couldn't open %s", filename);
    }

    /* write out edict size for checking */
    i = sizeof(edict_t);
    fwrite(&i, sizeof(i), 1, f);

    /* write out level_locals_t */
    WriteLevelLocals(f);

    /* write out all the entities */
    for (i = 0; i < globals.num_edicts; i++)
    {
        ent = &g_edicts[i];

        if (!ent->inuse)
        {
            continue;
        }

        fwrite(&i, sizeof(i), 1, f);
        WriteEdict(f, ent);
    }

    i = -1;
    fwrite(&i, sizeof(i), 1, f);

    fclose(f);
}