Пример #1
0
static void SCR_CalcRefdefFPM (void)
{
	vrect_t		vrect;
	fixedpoint_t	size;

	scr_fullupdate = 0;		// force a background redraw
	vid.recalc_refdef = 0;

// force the status bar to redraw
	Sbar_Changed ();

//========================================
	
// bound viewsize
	if (scr_viewsize.value < 30)
		Cvar_Set ("viewsize","30");
	if (scr_viewsize.value > 120)
		Cvar_Set ("viewsize","120");

// bound field of view
	if (scr_fov.value < 10)
		Cvar_Set ("fov","10");
	if (scr_fov.value > 170)
		Cvar_Set ("fov","170");

	r_refdefFPM.fov_x = FPM_FROMFLOAT(scr_fov.value);
	r_refdefFPM.fov_y = FPM_FROMFLOAT(CalcFov (scr_fov.value, (float)r_refdefFPM.vrect.width, (float)r_refdefFPM.vrect.height));

// intermission is always full screen	
	if (cl.intermission)
		size = 120;
	else
		size = (long)scr_viewsize.value;

	if (size >= 120)
		sb_lines = 0;		// no status bar at all
	else if (size >= 110)
		sb_lines = 24;		// no inventory
	else
		sb_lines = 24+16+8;

// these calculations mirror those in R_Init() for r_refdef, but take no
// account of water warping
	vrect.x = 0;
	vrect.y = 0;
	vrect.width = vid.width;
	vrect.height = vid.height;

	R_SetVrectFPM (&vrect, &scr_vrect, sb_lines);

// guard against going from one mode to another that's less than half the
// vertical resolution
	if (scr_con_current > vid.height)
		scr_con_current = (float)vid.height;

// notify the refresh of the change
	R_ViewChangedFPM (&vrect, sb_lines, FPM_FROMFLOAT(vid.aspect));
}
Пример #2
0
void CL_AdjustAnglesFPM (void)
{
	fixedpoint_t	speed;
	fixedpoint_t	up, down;
	fixedpoint_t	clpitchspeed=FPM_FROMFLOAT(cl_pitchspeed.value);

	if (in_speed.state & 1)
		speed = FPM_FROMFLOAT(host_frametime * cl_anglespeedkey.value);
	else
		speed = FPM_FROMFLOAT(host_frametime);

	if (!(in_strafe.state & 1))
	{
		fixedpoint_t clyawspeed=FPM_FROMFLOAT(cl_yawspeed.value);
		clFPM.viewangles[YAW] = FPM_SUB(clFPM.viewangles[YAW], FPM_MUL(FPM_MUL(speed,clyawspeed), CL_KeyStateFPM (&in_right)));
		clFPM.viewangles[YAW] = FPM_ADD(clFPM.viewangles[YAW], FPM_MUL(FPM_MUL(speed,clyawspeed), CL_KeyStateFPM (&in_left)));
		clFPM.viewangles[YAW] = anglemodFPM(clFPM.viewangles[YAW]);
	}
	if (in_klook.state & 1)
	{
		V_StopPitchDriftFPM ();
		clFPM.viewangles[PITCH] = FPM_SUB(clFPM.viewangles[PITCH], FPM_MUL(FPM_MUL(speed,clpitchspeed), CL_KeyStateFPM (&in_forward)));
		clFPM.viewangles[PITCH] = FPM_ADD(clFPM.viewangles[PITCH], FPM_MUL(FPM_MUL(speed,clpitchspeed), CL_KeyStateFPM (&in_back)));
	}

	up = CL_KeyStateFPM (&in_lookup);
	down = CL_KeyStateFPM(&in_lookdown);

	clFPM.viewangles[PITCH] = FPM_SUB(clFPM.viewangles[PITCH], FPM_MUL(FPM_MUL(speed, clpitchspeed), up));
	clFPM.viewangles[PITCH] = FPM_ADD(clFPM.viewangles[PITCH], FPM_MUL(FPM_MUL(speed, clpitchspeed), down));

	if (up || down)
		V_StopPitchDriftFPM ();

	if (clFPM.viewangles[PITCH] > FPM_FROMLONGC(80))
		clFPM.viewangles[PITCH] = FPM_FROMLONGC(80);
	if (clFPM.viewangles[PITCH] < FPM_FROMLONGC(-70))
		clFPM.viewangles[PITCH] = FPM_FROMLONGC(-70);

	if (clFPM.viewangles[ROLL] > FPM_FROMLONGC(50))
		clFPM.viewangles[ROLL] = FPM_FROMLONGC(50);
	if (clFPM.viewangles[ROLL] < FPM_FROMLONGC(-50))
		clFPM.viewangles[ROLL] = FPM_FROMLONGC(-50);

}
Пример #3
0
int CL_GetMessageFPM (void)
{
	int		r, i;
	float	f;
	
	if	(cls.demoplayback)
	{
	// decide if it is time to grab the next message		
		if (cls.signon == SIGNONS)	// allways grab until fully connected
		{
			if (cls.timedemo)
			{
				if (host_framecount == cls.td_lastframe)
					return 0;		// allready read this frame's message
				cls.td_lastframe = host_framecount;
			// if this is the second frame, grab the real td_starttime
			// so the bogus time on the first frame doesn't count
				if (host_framecount == cls.td_startframe + 1)
					cls.td_starttime = (float)realtime;
			}
			else if ( /* cl.time > 0 && */ clFPM.time <= clFPM.mtime[0])
			{
					return 0;		// don't need another message yet
			}
		}
		
	// get the next message
		//Dan
		fread (&net_message.cursize, 4, 1, cls.demofile);
		VectorCopy (clFPM.mviewangles[0], clFPM.mviewangles[1]);
		for (i=0 ; i<3 ; i++)
		{
			//Dan
			r = fread (&f, 4, 1, cls.demofile);
			clFPM.mviewangles[0][i] = FPM_FROMFLOAT(LittleFloat (f));
		}
		
		net_message.cursize = LittleLong (net_message.cursize);
		if (net_message.cursize > MAX_MSGLEN)
			Sys_Error ("Demo message > MAX_MSGLEN");
		//Dan
		r = fread (net_message.data, net_message.cursize, 1, cls.demofile);
		if (r != net_message.cursize/*1*/)
		{
			CL_StopPlayback ();
			return 0;
		}
	
		return 1;
	}

	while (1)
	{
		r = NET_GetMessage (cls.netcon);
		
		if (r != 1 && r != 2)
			return r;
	
	// discard nop keepalive message
		if (net_message.cursize == 1 && net_message.data[0] == svc_nop)
			Con_Printf ("<-- server to client keepalive\n");
		else
			break;
	}

	if (cls.demorecording)
		CL_WriteDemoMessage ();
	
	return r;
}
Пример #4
0
void D_DrawParticleFPM (particle_FPM_t *pparticle)
{
	vec3_FPM_t	local, transformed;
	fixedpoint_t	zi;
	byte	*pdest;
	short	*pz;
	int		i, izi, pix, count, u, v;

// transform point
	VectorSubtractFPM (pparticle->org, r_originFPM, local);

	transformed[0] = DotProductFPM(local, r_prightFPM);
	transformed[1] = DotProductFPM(local, r_pupFPM);
	transformed[2] = DotProductFPM(local, r_ppnFPM);		

	if (transformed[2] < PARTICLE_Z_CLIP_FPM)
		return;

// project the point
// FIXME: preadjust xcenter and ycenter
	zi = FPM_DIV(FPM_FROMFLOAT(1.0), transformed[2]);
	u = FPM_TOLONG(FPM_ADD3(xcenterFPM, FPM_MUL(zi, transformed[0]), FPM_FROMFLOAT(0.5)));
	v = FPM_TOLONG(FPM_SUB(ycenterFPM, FPM_ADD(FPM_MUL(zi, transformed[1]), FPM_FROMFLOAT(0.5))));

	if ((v > d_vrectbottom_particle) || 
		(u > d_vrectright_particle) ||
		(v < d_vrecty) ||
		(u < d_vrectx))
	{
		return;
	}

	pz = d_pzbuffer + (d_zwidth * v) + u;
	pdest = d_viewbuffer + d_scantable[v] + u;
	izi = FPM_TOLONG(FPM_MUL(zi, FPM_FROMLONG(0x8000)));

	pix = izi >> d_pix_shift;

	if (pix < d_pix_min)
		pix = d_pix_min;
	else if (pix > d_pix_max)
		pix = d_pix_max;

	switch (pix)
	{
	case 1:
		count = 1 << d_y_aspect_shift;

		for ( ; count ; count--, pz += d_zwidth, pdest += screenwidth)
		{
			if (pz[0] <= izi)
			{
				pz[0] = izi;
				pdest[0] = pparticle->color;
			}
		}
		break;

	case 2:
		count = 2 << d_y_aspect_shift;

		for ( ; count ; count--, pz += d_zwidth, pdest += screenwidth)
		{
			if (pz[0] <= izi)
			{
				pz[0] = izi;
				pdest[0] = pparticle->color;
			}

			if (pz[1] <= izi)
			{
				pz[1] = izi;
				pdest[1] = pparticle->color;
			}
		}
		break;

	case 3:
		count = 3 << d_y_aspect_shift;

		for ( ; count ; count--, pz += d_zwidth, pdest += screenwidth)
		{
			if (pz[0] <= izi)
			{
				pz[0] = izi;
				pdest[0] = pparticle->color;
			}

			if (pz[1] <= izi)
			{
				pz[1] = izi;
				pdest[1] = pparticle->color;
			}

			if (pz[2] <= izi)
			{
				pz[2] = izi;
				pdest[2] = pparticle->color;
			}
		}
		break;

	case 4:
		count = 4 << d_y_aspect_shift;

		for ( ; count ; count--, pz += d_zwidth, pdest += screenwidth)
		{
			if (pz[0] <= izi)
			{
				pz[0] = izi;
				pdest[0] = pparticle->color;
			}

			if (pz[1] <= izi)
			{
				pz[1] = izi;
				pdest[1] = pparticle->color;
			}

			if (pz[2] <= izi)
			{
				pz[2] = izi;
				pdest[2] = pparticle->color;
			}

			if (pz[3] <= izi)
			{
				pz[3] = izi;
				pdest[3] = pparticle->color;
			}
		}
		break;

	default:
		count = pix << d_y_aspect_shift;

		for ( ; count ; count--, pz += d_zwidth, pdest += screenwidth)
		{
			for (i=0 ; i<pix ; i++)
			{
				if (pz[i] <= izi)
				{
					pz[i] = izi;
					pdest[i] = pparticle->color;
				}
			}
		}
		break;
	}
}