#library "Sprint"
#include "zcommon.acs"

script "SprintCheck" (void)
{
	//int buttons = GetPlayerInput(-1, INPUT_BUTTONS);

	if (GetPlayerInput(-1, INPUT_BUTTONS) & BT_SPEED && GetPlayerInput(-1, INPUT_BUTTONS) & BT_FORWARD)
	{
		if (GetPlayerInput(-1, INPUT_BUTTONS) & BT_BACK)
		{
			//print(s:"Run key is being block by the back key");
			SetResultValue(0);
			if (GetActorProperty(0, APROP_Speed) != 1.0)
			{
			SetActorProperty (0, APROP_Speed, 1.0);
			}
		}
		else
		{
			if (GetPlayerInput(-1, INPUT_BUTTONS) & (BT_MOVELEFT|BT_MOVERIGHT))
			{
				//print(s:"You are pressing the run key and strafing.");
				SetResultValue(1);
				
				if (GetActorProperty(0, APROP_Speed) != 1.25)
				{
				SetActorProperty (0, APROP_Speed, 1.25);
				}
			}
			else
			{
				//print(s:"You are pressing the run key straight forward.");
				SetResultValue(1);

				if (GetActorProperty(0, APROP_Speed) != 1.8)
				{
				SetActorProperty (0, APROP_Speed, 1.8);
				}			
			}
		}
	}
	else
	{
		//print(s:"You are NOT pressing the run key.");
		SetResultValue(0);
		if (GetActorProperty(0, APROP_Speed) != 1.0)
		{
		SetActorProperty (0, APROP_Speed, 1.0);
		}
	}
}
