Example #1
0
//
// END ARTICLES
//
void EndText()
{
	int artnum;
	const char *text;

	ClearMemory();

	artnum = endextern+gamestate.episode;
	CA_CacheGrChunk(artnum);
	if (w0 == true){
		text = (const char *)grsegsWL1[artnum];
	} else if (w1 == true){
		text = (const char *)grsegsWL6[artnum];
	} else if (s0 == true){
		text = (const char *)grsegsSDM[artnum];
	} else {
		text = (const char *)grsegsSOD[artnum];
	}

	ShowArticle(text);

	CA_UnCacheGrChunk(artnum);
	
	VW_FadeOut();
	SETFONTCOLOR(0,15);
	IN_ClearKeysDown();

	IN_GetMouseDelta(NULL, NULL); // Clear accumulated mouse movement
	
	FreeMusic();
}
Example #2
0
void CAM_GetScaledMouseDelta( float *pOutX, float *pOutY )
{
	int x,y;
	float fx, fy;

	IN_GetMouseDelta( &x, &y );

	fx = x;
	fy = y;

	IN_ScaleMouse( &fx, &fy );

	if(pOutX) *pOutX = fx;
	if(pOutY) *pOutY = fy;
}
Example #3
0
/*
===========
IN_MouseMove
===========
*/
void IN_MouseMove ( float frametime, usercmd_t *cmd)
{
	int		mx, my;
	vec3_t viewangles;

	gEngfuncs.GetViewAngles( (float *)viewangles );

	if ( in_mlook.state & 1)
	{
		V_StopPitchDrift ();
	}

	//jjb - this disbles normal mouse control if the user is trying to 
	//      move the camera, or if the mouse cursor is visible or if we're in intermission
	if ( !iMouseInUse && !gHUD.m_iIntermission && !iVisibleMouse )
	{
		IN_GetMouseDelta( &mx, &my );

		if (m_filter && m_filter->value)
		{
			mouse_x = (mx + old_mouse_x) * 0.5;
			mouse_y = (my + old_mouse_y) * 0.5;
		}
		else
		{
			mouse_x = mx;
			mouse_y = my;
		}

		old_mouse_x = mx;
		old_mouse_y = my;

		// Apply custom mouse scaling/acceleration
		IN_ScaleMouse( &mouse_x, &mouse_y );
		
		int inverseMultiplier = g_inverseControls ? -1 : 1;

		// add mouse X/Y movement to cmd
		if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) ))
			cmd->sidemove += m_side->value * mouse_x;
		else {
			if ( !upsideDown ) {
				viewangles[YAW] -= m_yaw->value * mouse_x * inverseMultiplier;
			} else {
				viewangles[YAW] -= -m_yaw->value * mouse_x * inverseMultiplier;
			}
		}
		

		if ( (in_mlook.state & 1) && !(in_strafe.state & 1))
		{
			if ( !upsideDown ) {
				viewangles[PITCH] += m_pitch->value * mouse_y * inverseMultiplier;
			} else {
				viewangles[PITCH] += -m_pitch->value * mouse_y * inverseMultiplier;
			}
			if (viewangles[PITCH] > cl_pitchdown->value)
				viewangles[PITCH] = cl_pitchdown->value;
			if (viewangles[PITCH] < -cl_pitchup->value)
				viewangles[PITCH] = -cl_pitchup->value;
		}
		else
		{
			if ((in_strafe.state & 1) && gEngfuncs.IsNoClipping() )
			{
				cmd->upmove -= m_forward->value * mouse_y;
			}
			else
			{
				cmd->forwardmove -= m_forward->value * mouse_y;
			}
		}
	}

	gEngfuncs.SetViewAngles( (float *)viewangles );

	/*
	//#define TRACE_TEST
	#if defined( TRACE_TEST )
	{
	int mx, my;
	void V_Move( int mx, int my );
	IN_GetMousePos( &mx, &my );
	V_Move( mx, my );
	}
	#endif
	*/
}
Example #4
0
///////////////////////////////////////////////////////////////////////////
//
//	IN_ReadControl() - Reads the device associated with the specified
//		player and fills in the control info struct
//
///////////////////////////////////////////////////////////////////////////
void IN_ReadControl(int player,ControlInfo *info)
{
			boolean		realdelta = false;
			word		buttons;
			int			dx,dy;
			Motion		mx,my;
			ControlType	type;
			KeyboardDef	*def;

	dx = dy = 0;
	mx = my = motion_None;
	buttons = 0;

IN_CheckAck();

		switch (type = Controls[player])
		{
		case ctrl_Keyboard:
			def = &KbdDefs;

			if (Keyboard[def->upleft])
				mx = motion_Left,my = motion_Up;
			else if (Keyboard[def->upright])
				mx = motion_Right,my = motion_Up;
			else if (Keyboard[def->downleft])
				mx = motion_Left,my = motion_Down;
			else if (Keyboard[def->downright])
				mx = motion_Right,my = motion_Down;

			if (Keyboard[def->up])
				my = motion_Up;
			else if (Keyboard[def->down])
				my = motion_Down;

			if (Keyboard[def->left])
				mx = motion_Left;
			else if (Keyboard[def->right])
				mx = motion_Right;

			if (Keyboard[def->button0])
				buttons += 1 << 0;
			if (Keyboard[def->button1])
				buttons += 1 << 1;
			realdelta = false;
			break;
		case ctrl_Joystick1:
		case ctrl_Joystick2:
			INL_GetJoyDelta(type - ctrl_Joystick,&dx,&dy);
			buttons = INL_GetJoyButtons(type - ctrl_Joystick);
			realdelta = true;
			break;
		case ctrl_Mouse:
			IN_GetMouseDelta(&dx,&dy);
			buttons = IN_MouseButtons();
			realdelta = true;
			break;
		}

	if (realdelta)
	{
		if(dx || dy != 0)
		{
		mx = (dx < -20)? motion_Left : ((dx > 20)? motion_Right : motion_None);
		my = (dy < -20)? motion_Up : ((dy > 20)? motion_Down : motion_None);
		}
	}
	else
	{
		dx = mx * 127;
		dy = my * 127;
	}

	info->x = dx;
	info->xaxis = mx;
	info->y = dy;
	info->yaxis = my;
	info->button0 = buttons & (1 << 0);
	info->button1 = buttons & (1 << 1);
	info->button2 = buttons & (1 << 2);
	info->button3 = buttons & (1 << 3);
	info->dir = DirTable[((my + 1) * 3) + (mx + 1)];
}