Example #1
0
inline void Work::Archive(Archiver& arc) {
	Behavior::Archive(arc);

	// Archive Parameters
	arc.ArchiveString(&_gotoWorkAnimName);
	arc.ArchiveFloat(&_maxDistance);

	// Archive Components
	arc.ArchiveObject(&_gotoHelperNode);


	// Archive Member Vars
	arc.ArchiveSafePointer(&_node);
	arc.ArchiveUnsigned(&_state);
	arc.ArchiveBool(&_animDone);
	arc.ArchiveFloat(&_endTime);
	arc.ArchiveObjectPointer((Class**)&_self);
}
//--------------------------------------------------------------
// Name:		Archive()
// Class:		PostureController
//
// Description:	Archives the class
//
// Parameters:	Archiver &arc
//
// Returns:		None
//--------------------------------------------------------------
void PostureController::Archive( Archiver &arc )
{
	arc.ArchiveString( &_postureStateMap_Name );
	arc.ArchiveString( &_currentPostureState_Name );
	arc.ArchiveString( &_requestedPostureState_Name );
	arc.ArchiveSafePointer ( &_requestor );

	if ( !arc.Saving() )
	{
		if ( _postureStateMap_Name.length() )
		{
			Event *event;

			event = new Event( EV_Actor_SetPostureStateMap );							  
			event->AddString( _postureStateMap_Name );
			event->AddInteger( 1 );
			act->ProcessEvent ( event );

			_currentPostureState = _postureStateMap->FindState( _currentPostureState_Name.c_str() );
			_requestedPostureState = _postureStateMap->FindState(_requestedPostureState_Name.c_str() );
		}
	}		
}
Example #3
0
void Level::Archive( Archiver &arc )
{
	int num;
	int i;

	Class::Archive( arc );

	if ( arc.Saving() )
	{
		SafePtr<Earthquake> ent;

		num = _earthquakes.NumObjects();
		arc.ArchiveInteger( &num );

		for ( i = 1 ; i <= num ; i++ )
		{
			ent = _earthquakes.ObjectAt( i );		
			arc.ArchiveSafePointer( &ent );		
		}
	}
	else
	{
		SafePtr<Earthquake> ent;
		SafePtr<Earthquake> *entityPointer;

		arc.ArchiveInteger( &num );

		_earthquakes.ClearObjectList();
		_earthquakes.Resize( num );

		for ( i = 1 ; i <= num ; i++ )
		{		
			_earthquakes.AddObject( ent );

			entityPointer = &_earthquakes.ObjectAt( i );

			arc.ArchiveSafePointer( entityPointer );
		}
	}

	arc.ArchiveInteger( &_totalEnemiesSpawned );

	// Don't archive these

	//const char     *current_map;
	//const char     *current_entities;

	//int			   spawn_entnum;
	arc.ArchiveInteger( &currentInstanceNumber );
    //int            spawnflags;

	arc.ArchiveInteger( &framenum );
	arc.ArchiveInteger( &inttime );
	arc.ArchiveFloat( &time );
	arc.ArchiveFloat( &timeInLevel );
	arc.ArchiveFloat( &frametime );
	arc.ArchiveFloat( &fixedframetime );
	arc.ArchiveInteger( &startTime );

	arc.ArchiveString( &level_name );
	arc.ArchiveString( &mapname );
	arc.ArchiveString( &spawnpoint );
	arc.ArchiveString( &nextmap );

	arc.ArchiveBoolean( &restart );
	arc.ArchiveBoolean( &started );

	arc.ArchiveBoolean( &playerfrozen );

	arc.ArchiveFloat( &intermissiontime );
	arc.ArchiveInteger( &exitintermission );
	arc.ArchiveFloat( &intermission_advancetime );
	arc.ArchiveBool( &_showIntermission );
	arc.ArchiveBool( &_saveOrientation );

	// Don't archive
	//gentity_s	   *next_edict;

	arc.ArchiveInteger( &total_secrets );
	arc.ArchiveInteger( &found_secrets );
	arc.ArchiveInteger( &total_specialItems );
	arc.ArchiveInteger( &found_specialItems );

	arc.ArchiveString( &game_script );

	// Don't archive
	//trace_t        impact_trace;

	arc.ArchiveBoolean( &cinematic );
	arc.ArchiveBoolean( &ai_on );

	arc.ArchiveBoolean( &mission_failed );
	arc.ArchiveBoolean( &died_already );

	arc.ArchiveBoolean( &near_exit );

	arc.ArchiveVector( &water_color );
	arc.ArchiveFloat( &water_alpha );

	arc.ArchiveVector( &slime_color );
	arc.ArchiveFloat( &slime_alpha );

	arc.ArchiveVector( &lava_color );
	arc.ArchiveFloat( &lava_alpha );

	arc.ArchiveString( &current_soundtrack );
	arc.ArchiveString( &saved_soundtrack );

	arc.ArchiveObjectPointer( ( Class ** )&consoleThread );

	arc.ArchiveVector( &m_fade_color );
	arc.ArchiveFloat( &m_fade_alpha );
	arc.ArchiveFloat( &m_fade_time );
	arc.ArchiveFloat( & m_fade_time_start );
	ArchiveEnum( m_fade_type, fadetype_t );
	ArchiveEnum( m_fade_style, fadestyle_t );

	arc.ArchiveFloat( &m_letterbox_fraction );
	arc.ArchiveFloat( &m_letterbox_time );
	arc.ArchiveFloat( &m_letterbox_time_start );
	ArchiveEnum( m_letterbox_dir, letterboxdir_t );

	arc.ArchiveBool( &_cleanup );

	arc.ArchiveString( &_playerDeathThread );

	arc.ArchiveObjectPointer( ( Class ** )&hNodeController );

	// Don't archive, will already be setup from camera code
	// Container<Camera *>	automatic_cameras;

	arc.ArchiveVector( & m_intermission_origin );
	arc.ArchiveVector( & m_intermission_angle );

	if ( arc.Loading() )
	{
		str temp_soundtrack;

		// Change the sound track to the one just loaded

		temp_soundtrack = saved_soundtrack;
		ChangeSoundtrack( current_soundtrack.c_str() );
		saved_soundtrack = temp_soundtrack;

		// not archived since we can't save mid-frame
		next_edict = NULL;
		// not archived since we can't save mid-frame
		memset( &impact_trace, 0, sizeof( impact_trace ) );

		loadLevelStrings();
	}
	
}