#include "Core/Asura.h"

#ifdef AVP_USE_INPUT_SIMULATOR

// Asura
#include "Core/Asura_UserInput.h"

// AVP
#include "InputSimulator/AVP_InputSimulator_System.h"

void AVP_InputSimulator_System::Platform_SetFireButton( const bool bFire, u_char* ucCurrentInput )
{
	// PC Implementation
	ucCurrentInput[ ASURA_KEYID_MOUSEBUTTON1 ] = (bFire) ? 255 : 0;
}

void AVP_InputSimulator_System::Platform_SetSecondaryFireButton( const bool bFire, u_char* ucCurrentInput )
{
	// PC Implementation
	ucCurrentInput[ ASURA_KEYID_MOUSEBUTTON2 ] = (bFire) ? 255 : 0;
}

void AVP_InputSimulator_System::Platform_SetTurnAxisHorizontal( const float fValue, float* pfAxisValue )
{
	// PC Implementation
	pfAxisValue[ ASURA_AXIS_MOUSE_H ] = fValue;
}

void AVP_InputSimulator_System::Platform_SetTurnAxisVertical( const float fValue, float* pfAxisValue )
{
	// PC Implementation
	pfAxisValue[ ASURA_AXIS_MOUSE_V ] = fValue;
}

void AVP_InputSimulator_System::Platform_SetMoveForwardsButton( const bool bMove, u_char* ucCurrentInput, float* pfAxisValue )
{
	// PC Implementation
	ucCurrentInput['w'] = (bMove) ? 255 : 0;
}

void AVP_InputSimulator_System::Platform_SetMoveBackwardsButton( const bool bMove, u_char* ucCurrentInput, float* pfAxisValue )
{
	// PC Implementation
	ucCurrentInput['s'] = (bMove) ? 255 : 0;
}

void AVP_InputSimulator_System::Platform_SetMoveLeftButton( const bool bMove, u_char* ucCurrentInput, float* pfAxisValue ) 
{
	// PC Implementation
	ucCurrentInput['a'] = (bMove) ? 255 : 0;
}

void AVP_InputSimulator_System::Platform_SetMoveRightButton( const bool bMove, u_char* ucCurrentInput, float* pfAxisValue )
{
	// PC Implementation
	ucCurrentInput['d'] = (bMove) ? 255 : 0;
}

void AVP_InputSimulator_System::Platform_SetJumpButton( const bool bJump, u_char* ucCurrentInput )
{
	// PC Implementation
	ucCurrentInput[ASURA_KEYID_SPACE] = (bJump) ? 255 : 0;
}

void AVP_InputSimulator_System::Platform_SetFocusMode( const bool bFocus, u_char* ucCurrentInput )
{
	// PC Implementation
	ucCurrentInput[ASURA_KEYID_MOUSEBUTTON2] = (bFocus) ? 255 : 0;
}

void AVP_InputSimulator_System::Platform_SetCloakButton( const bool bCloak, u_char* ucCurrentInput )
{
	// PC Implementation
	ucCurrentInput['f'] = (bCloak) ? 255 : 0;
}

void AVP_InputSimulator_System::Platform_SetSprintButton( const bool bSprint, u_char* ucCurrentInput )
{
	// PC Implementation
	ucCurrentInput[ASURA_KEYID_LEFTSHIFT] = (bSprint) ? 255 : 0;
}

void AVP_InputSimulator_System::Platform_SetStanceButton( const bool bChangeStance, u_char* ucCurrentInput )
{
	// PC Implementation
	ucCurrentInput['c'] = (bChangeStance) ? 255 : 0;
}

void AVP_InputSimulator_System::Platform_SetWalkButton( const bool bWalk, u_char* ucCurrentInput )
{
	// PC Implementation
	ucCurrentInput[ASURA_KEYID_LEFTCTRL] = (bWalk) ? 255 : 0;
}

void AVP_InputSimulator_System::Platform_SetReloadButton( const bool bReload, u_char* ucCurrentInput )
{
	// PC Implementation
	ucCurrentInput['r'] = (bReload) ? 255 : 0;
}

void AVP_InputSimulator_System::Platform_SetDownButton(const bool bDown, u_char* ucCurrentInput, float* pfAxisValue )
{
	// PC Implementation
	ucCurrentInput[ASURA_KEYID_DOWN] = (bDown) ? 255 : 0;
}

void AVP_InputSimulator_System::Platform_SetAcceptButton(const bool bAccept, u_char* ucCurrentInput )
{
	// PC Implementation
	ucCurrentInput[ASURA_KEYID_ENTER] = (bAccept) ? 255 : 0;
}
#endif // AVP_USE_INPUT_SIMULATOR
