예제 #1
0
/*
==============
WriteClient

All pointer variables (except function pointers) must be handled specially.
==============
*/
void WriteClient (FILE *f, gclient_t *client)
{
	field_t		*field;
	gclient_t	temp;
	
	// all of the ints, floats, and vectors stay as they are
	temp = *client;

	// change the pointers to lengths or indexes
	for (field=clientfields ; field->name ; field++)
	{
		WriteField1 (f, field, (byte *)&temp);
	}

	// write the block
	fwrite (&temp, sizeof(temp), 1, f);

	// now write any allocated data following the edict
	for (field=clientfields ; field->name ; field++)
	{
		WriteField2 (f, field, (byte *)client);
	}
}
예제 #2
0
/*
 * Helper fcuntion to write the
 * level local data into a file.
 * Called by WriteLevel.
 */
void
WriteLevelLocals(FILE *f)
{
    field_t *field;
    level_locals_t temp;

    /* all of the ints, floats, and vectors stay as they are */
    temp = level;

    /* change the pointers to lengths or indexes */
    for (field = levelfields; field->name; field++)
    {
        WriteField1(f, field, (byte *)&temp);
    }

    /* write the block */
    fwrite(&temp, sizeof(temp), 1, f);

    /* now write any allocated data following the edict */
    for (field = levelfields; field->name; field++)
    {
        WriteField2(f, field, (byte *)&level);
    }
}
예제 #3
0
/*
 * Helper function to write the
 * edict into a file. Called by
 * WriteLevel.
 */
void
WriteEdict(FILE *f, edict_t *ent)
{
    field_t *field;
    edict_t temp;

    /* all of the ints, floats, and vectors stay as they are */
    temp = *ent;

    /* change the pointers to lengths or indexes */
    for (field = fields; field->name; field++)
    {
        WriteField1(f, field, (byte *)&temp);
    }

    /* write the block */
    fwrite(&temp, sizeof(temp), 1, f);

    /* now write any allocated data following the edict */
    for (field = fields; field->name; field++)
    {
        WriteField2(f, field, (byte *)ent);
    }
}