//////////////////////////////////////////////////////////////////////////////
//
// Asura_FlyCam.cpp
//
// Copyright (c) 2006 Rebellion. All rights reserved.
//
// Description:
//
//     Basic camera controlled by analogue sticks or buttons. Intended only
//     for debugging and prototyping purposes. 
//
//////////////////////////////////////////////////////////////////////////////

// I N C L U D E S ///////////////////////////////////////////////////////////

#include "Core/Asura.h"

#ifdef ASURA_SUPPORT_FLYCAM

// This file's header.
#include "Camera/Asura_FlyCam.h"

// Asura includes
#include "Input/Asura_PlatformInput.h"

////////////////////////////////////////////////////////////////////////////////
// Function     : Asura_FlyCam::Platform_Initialise
// Author       : Andy Tate
// Date         : 1-Oct-2007
////////////////////////////////////////////////////////////////////////////////

void Asura_FlyCam::Platform_Initialise(void)
{
	//Keyboard + Mouse Mapping
	AddMoveForwardsBackwardsMapping('w', 's');
	AddMoveLeftRightMapping('a', 'd');
	AddMoveUpDownMapping(ASURA_KEYID_UP, ASURA_KEYID_DOWN);
	AddRollMapping(ASURA_KEYID_LEFT, ASURA_KEYID_RIGHT);
	AddPitchMapping(ASURA_AXIS_MOUSE_V);
	AddYawMapping(ASURA_AXIS_MOUSE_H);
	AddFastMapping(ASURA_KEYID_SHIFT,ASURA_KEYID_CTRL);
	AddSlowMapping(ASURA_KEYID_ALT);
	AddInvertYMapping('y');
	AddResetRollMapping('r');

	if( Asura_PC_Input_Joystick::GetNumJoysticks() > 0 )
	{
		Asura_String xPadName = Asura_PC_Input_Joystick::GetJoystickName(0);
		if(xPadName.Contains("360"))
		{
			// 360 Pad...
			AddMoveForwardsBackwardsMapping(ASURA_PC_AXISID_XBOX360PAD1_LSTICK_V);
			AddMoveForwardsBackwardsMapping(ASURA_PC_KEYID_XBOX360PAD1_UP, ASURA_PC_KEYID_XBOX360PAD1_DOWN);
			AddMoveLeftRightMapping(ASURA_PC_AXISID_XBOX360PAD1_LSTICK_H);
			AddMoveLeftRightMapping(ASURA_PC_KEYID_XBOX360PAD1_LEFT, ASURA_PC_KEYID_XBOX360PAD1_RIGHT);
			AddMoveUpDownMapping(ASURA_PC_KEYID_XBOX360PAD1_Y, ASURA_PC_KEYID_XBOX360PAD1_A);
			AddRollMapping(ASURA_PC_KEYID_XBOX360PAD1_X, ASURA_PC_KEYID_XBOX360PAD1_B);
			AddPitchMapping(ASURA_PC_AXISID_XBOX360PAD1_RSTICK_V);
			AddYawMapping(ASURA_PC_AXISID_XBOX360PAD1_RSTICK_H);
			AddFastMapping(ASURA_PC_KEYID_XBOX360PAD1_L_BUMPER,ASURA_PC_KEYID_XBOX360PAD1_R_BUMPER);
			AddSlowMapping(ASURA_PC_KEYID_XBOX360PAD1_L_TRIGGER);
			AddSlowMapping(ASURA_PC_KEYID_XBOX360PAD1_R_TRIGGER);
			AddSlowMapping(ASURA_PC_AXISID_XBOX360PAD1_TRIGGER, 1.0f);
			AddInvertYMapping(ASURA_PC_KEYID_XBOX360PAD1_BACK);
			AddResetRollMapping(ASURA_PC_KEYID_XBOX360PAD1_L_THUMB);
			AddResetRollMapping(ASURA_PC_KEYID_XBOX360PAD1_R_THUMB);
		}
		else if(xPadName.Contains("PLAYSTATION(R)3"))
		{
			// PS3Pad
			AddMoveForwardsBackwardsMapping(ASURA_PC_AXISID_PS3PAD1_LSTICK_V);
			AddMoveForwardsBackwardsMapping(ASURA_PC_KEYID_PS3PAD1_UP, ASURA_PC_KEYID_PS3PAD1_DOWN);
			AddMoveLeftRightMapping(ASURA_PC_AXISID_PS3PAD1_LSTICK_H);
			AddMoveLeftRightMapping(ASURA_PC_KEYID_PS3PAD1_LEFT, ASURA_PC_KEYID_PS3PAD1_RIGHT);
			AddMoveUpDownMapping(ASURA_PC_KEYID_PS3PAD1_TRIANGLE, ASURA_PC_KEYID_PS3PAD1_CROSS);
			AddRollMapping(ASURA_PC_KEYID_PS3PAD1_SQUARE, ASURA_PC_KEYID_PS3PAD1_CIRCLE);
			AddPitchMapping(ASURA_PC_AXISID_PS3PAD1_RSTICK_V);
			AddYawMapping(ASURA_PC_AXISID_PS3PAD1_RSTICK_H);
			AddFastMapping(ASURA_PC_KEYID_PS3PAD1_L1,ASURA_PC_KEYID_PS3PAD1_R1);
			AddSlowMapping(ASURA_PC_KEYID_PS3PAD1_L2);
			AddSlowMapping(ASURA_PC_KEYID_PS3PAD1_R2);
			AddInvertYMapping(ASURA_PC_KEYID_PS3PAD1_SELECT);
			AddResetRollMapping(ASURA_PC_KEYID_PS3PAD1_L3);
			AddResetRollMapping(ASURA_PC_KEYID_PS3PAD1_R3);
		}
		else
		{
			// PS2 Pad
			AddMoveForwardsBackwardsMapping(ASURA_PC_AXISID_PS2PAD1_LSTICK_V);
			AddMoveForwardsBackwardsMapping(ASURA_PC_KEYID_PS2PAD1_UP, ASURA_PC_KEYID_PS2PAD1_DOWN);
			AddMoveLeftRightMapping(ASURA_PC_AXISID_PS2PAD1_LSTICK_H);
			AddMoveLeftRightMapping(ASURA_PC_KEYID_PS2PAD1_LEFT, ASURA_PC_KEYID_PS2PAD1_RIGHT);
			AddMoveUpDownMapping(ASURA_PC_KEYID_PS2PAD1_TRIANGLE, ASURA_PC_KEYID_PS2PAD1_CROSS);
			AddRollMapping(ASURA_PC_KEYID_PS2PAD1_SQUARE, ASURA_PC_KEYID_PS2PAD1_CIRCLE);
			AddPitchMapping(ASURA_PC_AXISID_PS2PAD1_RSTICK_V);
			AddYawMapping(ASURA_PC_AXISID_PS2PAD1_RSTICK_H);
			AddFastMapping(ASURA_PC_KEYID_PS2PAD1_L1,ASURA_PC_KEYID_PS3PAD1_R1);
			AddSlowMapping(ASURA_PC_KEYID_PS2PAD1_L2);
			AddSlowMapping(ASURA_PC_KEYID_PS2PAD1_R2);
			AddInvertYMapping(ASURA_PC_KEYID_PS2PAD1_SELECT);
			AddResetRollMapping(ASURA_PC_KEYID_PS2PAD1_L3);
			AddResetRollMapping(ASURA_PC_KEYID_PS2PAD1_R3);
		}
	}
}

/// End of function 'Asura_FlyCam::Platform_Initialise'. ///



////////////////////////////////////////////////////////////////////////////////
// Function     : Asura_FlyCam::Platform_Shutdown
// Author       : Andy Tate
// Date         : 1-Oct-2007
////////////////////////////////////////////////////////////////////////////////

void Asura_FlyCam::Platform_Shutdown(void)
{
}

/// End of function 'Asura_FlyCam::Platform_Shutdown'. ///

#endif // #ifdef ASURA_SUPPORT_FLYCAM


/// End of file. ///
