Exemple #1
0
void Demo_WriteVector(int inType, vec3_t inVector)
{
	float theFloatArray[3];

	theFloatArray[0] = inVector.x;
	theFloatArray[1] = inVector.y;
	theFloatArray[2] = inVector.z;

	Demo_WriteBuffer(inType, 3*sizeof(float), (unsigned char*)theFloatArray);
}
Exemple #2
0
void ScorePanel_InitializeDemoRecording()
{
	// Now save out team info
	int theTotalSize = (MAX_PLAYERS + 1)*(sizeof(hud_player_info_t) + sizeof(extra_player_info_t) + sizeof(team_info_t) + sizeof(int));
	unsigned char* theCharArray = new unsigned char[theTotalSize];
	if(theCharArray)
	{
		int theCounter = 0;
		SaveData(theCharArray, &g_PlayerInfoList, (MAX_PLAYERS+1)*sizeof(hud_player_info_t), theCounter);
		SaveData(theCharArray, &g_PlayerExtraInfo, (MAX_PLAYERS+1)*sizeof(extra_player_info_t), theCounter);
		SaveData(theCharArray, &g_TeamInfo, (MAX_PLAYERS+1)*sizeof(team_info_t), theCounter);
		SaveData(theCharArray, &g_IsSpectator, (MAX_PLAYERS+1)*sizeof(int), theCounter);
		
		Demo_WriteBuffer(TYPE_PLAYERINFO, theTotalSize, theCharArray);
	}
}
Exemple #3
0
/*
=====================
HUD_GetFOV

Returns last FOV
=====================
*/
float HUD_GetFOV( void )
{
	if ( gEngfuncs.pDemoAPI->IsRecording() )
	{
		// Write it
		int i = 0;
		unsigned char buf[ 100 ];

		// Active
		*( float * )&buf[ i ] = g_lastFOV;
		i += sizeof( float );

		Demo_WriteBuffer( TYPE_ZOOM, i, buf );
	}

	if ( gEngfuncs.pDemoAPI->IsPlayingback() )
	{
		g_lastFOV = g_demozoom;
	}
	return g_lastFOV;
}
void AvHParticleTemplateListClient::InitializeDemoRecording() const
{
	// Loop through all our particle templates, and write out each one 
	int theNumTemplates = this->GetNumberTemplates();
	for(int i = 0; i < theNumTemplates; i++)
	{
		const AvHParticleTemplate* theTemplate = this->GetTemplateAtIndex(i);
		ASSERT(theTemplate);

		int theTotalSize = 0;

		// Calculate total size needed to store template
		string theTemplateName = theTemplate->GetName();
		theTotalSize += GetDataSize(theTemplateName);

		uint32 theMaxParticles = theTemplate->GetMaxParticles();
		theTotalSize += sizeof(theMaxParticles);

		float theParticleSize = theTemplate->GetParticleSize();
		theTotalSize += sizeof(theParticleSize);

		float theParticleSystemLifetime = theTemplate->GetParticleSystemLifetime();
		theTotalSize += sizeof(theParticleSystemLifetime);

		float theParticleLifetime = theTemplate->GetParticleLifetime();
		theTotalSize += sizeof(theParticleLifetime);

		string theSpriteName = theTemplate->GetSprite();
		theTotalSize += GetDataSize(theSpriteName);

		ShapeType theGenerationShape = theTemplate->GetGenerationShape();
		theTotalSize += sizeof(theGenerationShape);

		string theGenerationEntityName = theTemplate->GetGenerationEntityName();
		theTotalSize += GetDataSize(theGenerationEntityName);

		string theParticleSystemToGenerate = theTemplate->GetParticleSystemToGenerate();
		theTotalSize += GetDataSize(theParticleSystemToGenerate);

		int theParticleSystemIndexToGenerate = theTemplate->GetParticleSystemIndexToGenerate();
		theTotalSize += sizeof(theParticleSystemIndexToGenerate);

		int theGenerationEntityIndex = theTemplate->GetGenerationEntityIndex();
		theTotalSize += sizeof(theGenerationEntityIndex);

		float theGenerationEntityParam = theTemplate->GetGenerationEntityParameter();
		theTotalSize += sizeof(theGenerationEntityParam);

		ShapeType theStartingVelocityShape = theTemplate->GetStartingVelocityShape();
		theTotalSize += sizeof(theStartingVelocityShape);

		ParticleParams theGenerationParams;
		theTemplate->GetGenerationParams(theGenerationParams);
		theTotalSize += sizeof(theGenerationParams);

		ParticleParams theStartingVelocityParams;
		theTemplate->GetStartingVelocityParams(theStartingVelocityParams);
		theTotalSize += sizeof(theStartingVelocityParams);

		uint32 theGenerationRate = theTemplate->GetGenerationRate();
		theTotalSize += sizeof(theGenerationRate);

		int theParticleFlags = theTemplate->GetFlags();
		theTotalSize += sizeof(theParticleFlags);

		PSVector theGravity;
		theTemplate->GetGravity(theGravity);
		theTotalSize += sizeof(theGravity);

		float theAnimationSpeed = theTemplate->GetAnimationSpeed();
		theTotalSize += sizeof(theAnimationSpeed);

		int theNumSpriteFrames = theTemplate->GetNumSpriteFrames();
		theTotalSize += sizeof(theNumSpriteFrames);

		float theParticleScaling = theTemplate->GetParticleScaling();
		theTotalSize += sizeof(theParticleScaling);

		int theRenderMode = theTemplate->GetRenderMode();
		theTotalSize += sizeof(theRenderMode);

		float theMaxAlpha = theTemplate->GetMaxAlpha();
		theTotalSize += sizeof(theMaxAlpha);

		// New memory 
		unsigned char* theCharArray = new unsigned char[theTotalSize];
		ASSERT(theCharArray);
		int theCounter = 0;

		// Write out each field
		SaveStringData(theCharArray, theTemplateName, theCounter);
		SAVE_DATA(theMaxParticles);
		SAVE_DATA(theParticleSize);
		SAVE_DATA(theParticleSystemLifetime);
		SAVE_DATA(theParticleLifetime);
		SaveStringData(theCharArray, theSpriteName, theCounter);
		SAVE_DATA(theGenerationShape);
		SaveStringData(theCharArray, theGenerationEntityName, theCounter);
		SaveStringData(theCharArray, theParticleSystemToGenerate, theCounter);
		SAVE_DATA(theParticleSystemIndexToGenerate);
		SAVE_DATA(theGenerationEntityIndex);
		SAVE_DATA(theGenerationEntityParam);
		SAVE_DATA(theStartingVelocityShape);
		SAVE_DATA(theGenerationParams);
		SAVE_DATA(theStartingVelocityParams);
		SAVE_DATA(theGenerationRate);
		SAVE_DATA(theParticleFlags);
		SAVE_DATA(theGravity);
		SAVE_DATA(theAnimationSpeed);
		SAVE_DATA(theNumSpriteFrames);
		SAVE_DATA(theParticleScaling);
		SAVE_DATA(theRenderMode);
		SAVE_DATA(theMaxAlpha);

		// Make sure we wrote exact amount of data we were supposed to
		ASSERT(theTotalSize == theCounter);
		
		Demo_WriteBuffer(TYPE_PARTICLES, theTotalSize, theCharArray);
	}
}
Exemple #5
0
void Demo_WriteInt(int inType, int inInt)
{
	Demo_WriteBuffer(inType, sizeof(int), (unsigned char*)&inInt);
}
Exemple #6
0
void Demo_WriteFloat(int inType, float inFloat)
{
	Demo_WriteBuffer(inType, sizeof(float), (unsigned char*)&inFloat);
}
Exemple #7
0
void Demo_WriteByte(int inType, unsigned char inByte)
{
	Demo_WriteBuffer(inType, sizeof(unsigned char), &inByte);
}