Exemplo 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);
}
Exemplo n.º 2
0
void WriteLevel(qboolean qbAutosave)
{
	if (!qbAutosave) //-always save the client
	{
		// write out one client - us!
		//
		assert(level.maxclients == 1);	// I'll need to know if this changes, otherwise I'll need to change the way ReadGame works
		gclient_t client = level.clients[0];
		EnumerateFields(savefields_gClient, (byte *)&client, 'GCLI', sizeof(client));	
		WriteLevelLocals();	// level_locals_t level	
	}

	OBJ_SaveObjectiveData();
	FX_Write();

	/////////////
	WriteGEntities(qbAutosave);
	Quake3Game()->VariableSave();
	G_LoadSave_WriteMiscData();

	extern void CG_WriteTheEvilCGHackStuff(void);
	CG_WriteTheEvilCGHackStuff();

	// (Do NOT put any write-code below this line)
	//
	// put out an end-marker so that the load code can check everything was read in...
	//
	static int iDONE = 1234;
	gi.AppendToSaveGame('DONE', &iDONE, sizeof(iDONE));
}
Exemplo n.º 3
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);
}
Exemplo n.º 4
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);
}
Exemplo n.º 5
0
void WriteLevel(qboolean qbAutosave)
{
	if (!qbAutosave) //-always save the client
	{
		// write out one client - us!
		//
		assert(level.maxclients == 1);	// I'll need to know if this changes, otherwise I'll need to change the way ReadGame works
		gclient_t client = level.clients[0];
		EnumerateFields(savefields_gClient, &client, INT_ID('G','C','L','I'));
		WriteLevelLocals();	// level_locals_t level
	}

	OBJ_SaveObjectiveData();
	FX_Write();

	/////////////
	WriteGEntities(qbAutosave);
	Quake3Game()->VariableSave();
	G_LoadSave_WriteMiscData();

	extern void CG_WriteTheEvilCGHackStuff(void);
	CG_WriteTheEvilCGHackStuff();

	// (Do NOT put any write-code below this line)
	//
	// put out an end-marker so that the load code can check everything was read in...
	//
	static int iDONE = 1234;

	ojk::SavedGameHelper saved_game(
		::gi.saved_game);

	saved_game.write_chunk<int32_t>(
		INT_ID('D', 'O', 'N', 'E'),
		iDONE);
}