Example #1
0
void SV_StopDemoRecording(client_t *client)
{
	prvm_prog_t *prog = SVVM_prog;
	sizebuf_t buf;
	unsigned char bufdata[64];

	if(client->sv_demo_file == NULL)
		return;
	
	buf.data = bufdata;
	buf.maxsize = sizeof(bufdata);
	SZ_Clear(&buf);
	MSG_WriteByte(&buf, svc_disconnect);
	SV_WriteDemoMessage(client, &buf, false);

	if (sv_autodemo_perclient_discardable.integer && PRVM_serveredictfloat(client->edict, discardabledemo))
	{
		FS_RemoveOnClose(client->sv_demo_file);
		Con_Printf("Stopped recording discardable demo for # %d (%s)\n", PRVM_NUM_FOR_EDICT(client->edict), client->netaddress);
	}
	else
		Con_Printf("Stopped recording demo for # %d (%s)\n", PRVM_NUM_FOR_EDICT(client->edict), client->netaddress);

	FS_Close(client->sv_demo_file);
	client->sv_demo_file = NULL;
}
Example #2
0
void SV_StartDemoRecording(client_t *client, const char *filename, int forcetrack)
{
	prvm_prog_t *prog = SVVM_prog;
	char name[MAX_QPATH];

	if(client->sv_demo_file != NULL)
		return; // we already have a demo

	strlcpy(name, filename, sizeof(name));
	FS_DefaultExtension(name, ".dem", sizeof(name));

	Con_Printf("Recording demo for # %d (%s) to %s\n", PRVM_NUM_FOR_EDICT(client->edict), client->netaddress, name);

	// Reset discardable flag for every new demo.
	PRVM_serveredictfloat(client->edict, discardabledemo) = 0;

	client->sv_demo_file = FS_OpenRealFile(name, "wb", false);
	if(!client->sv_demo_file)
	{
		Con_Print("ERROR: couldn't open.\n");
		return;
	}

	FS_Printf(client->sv_demo_file, "%i\n", forcetrack);
}
Example #3
0
void SV_StopDemoRecording(client_t *client)
{
	sizebuf_t buf;
	unsigned char bufdata[64];

	if(client->sv_demo_file == NULL)
		return;
	
	buf.data = bufdata;
	buf.maxsize = sizeof(bufdata);
	SZ_Clear(&buf);
	MSG_WriteByte(&buf, svc_disconnect);
	SV_WriteDemoMessage(client, &buf, false);

	FS_Close(client->sv_demo_file);
	client->sv_demo_file = NULL;
	Con_Printf("Stopped recording demo for # %d (%s)\n", PRVM_NUM_FOR_EDICT(client->edict), client->netaddress);
}
Example #4
0
void SV_StartDemoRecording(client_t *client, const char *filename, int forcetrack)
{
	char name[MAX_QPATH];

	if(client->sv_demo_file != NULL)
		return; // we already have a demo

	strlcpy(name, filename, sizeof(name));
	FS_DefaultExtension(name, ".dem", sizeof(name));

	Con_Printf("Recording demo for # %d (%s) to %s\n", PRVM_NUM_FOR_EDICT(client->edict), client->netaddress, name);

	client->sv_demo_file = FS_OpenRealFile(name, "wb", false);
	if(!client->sv_demo_file)
	{
		Con_Print("ERROR: couldn't open.\n");
		return;
	}

	FS_Printf(client->sv_demo_file, "%i\n", forcetrack);
}
Example #5
0
void CL_LinkEdict(prvm_edict_t *ent)
{
	vec3_t mins, maxs;

	if (ent == prog->edicts)
		return;		// don't add the world

	if (ent->priv.server->free)
		return;

	// set the abs box

	if (ent->fields.client->solid == SOLID_BSP)
	{
		dp_model_t *model = CL_GetModelByIndex( (int)ent->fields.client->modelindex );
		if (model == NULL)
		{
			Con_Printf("edict %i: SOLID_BSP with invalid modelindex!\n", PRVM_NUM_FOR_EDICT(ent));

			model = CL_GetModelByIndex( 0 );
		}

		if( model != NULL )
		{
			if (!model->TraceBox)
				Con_DPrintf("edict %i: SOLID_BSP with non-collidable model\n", PRVM_NUM_FOR_EDICT(ent));

			if (ent->fields.client->angles[0] || ent->fields.client->angles[2] || ent->fields.client->avelocity[0] || ent->fields.client->avelocity[2])
			{
				VectorAdd(ent->fields.client->origin, model->rotatedmins, mins);
				VectorAdd(ent->fields.client->origin, model->rotatedmaxs, maxs);
			}
			else if (ent->fields.client->angles[1] || ent->fields.client->avelocity[1])
			{
				VectorAdd(ent->fields.client->origin, model->yawmins, mins);
				VectorAdd(ent->fields.client->origin, model->yawmaxs, maxs);
			}
			else
			{
				VectorAdd(ent->fields.client->origin, model->normalmins, mins);
				VectorAdd(ent->fields.client->origin, model->normalmaxs, maxs);
			}
		}
		else
		{
			// SOLID_BSP with no model is valid, mainly because some QC setup code does so temporarily
			VectorAdd(ent->fields.client->origin, ent->fields.client->mins, mins);
			VectorAdd(ent->fields.client->origin, ent->fields.client->maxs, maxs);
		}
	}
	else
	{
		VectorAdd(ent->fields.client->origin, ent->fields.client->mins, mins);
		VectorAdd(ent->fields.client->origin, ent->fields.client->maxs, maxs);
	}

	VectorCopy(mins, ent->fields.client->absmin);
	VectorCopy(maxs, ent->fields.client->absmax);

	World_LinkEdict(&cl.world, ent, ent->fields.client->absmin, ent->fields.client->absmax);
}