// 
// File name: Robot.h
//
// Discription: Base classes
//
// Programmer: Vladimir P. Stasevich (SV)
//
// History: 
//    Created 26.01.2000 (SV)
//

#ifndef ROBOT_H
#define ROBOT_H

#include "Scene.h"

#define ROBOTDEFAULTWIDTH   55
#define ROBOTDEFAULTPOSX    100
#define ROBOTDEFAULTPOSY    100
#define ROBOTDEFAULTANGLE   0.1
#define ROBOTDEFAULTLEN     110
#define ROBOTDEFAULTSTEPPOS 0.5
#define ROBOTDEFAULTSTEPANG 0.005

#define ROBOTDEFAULTCRITICALRADIUS 5

typedef enum TTouchType
{
   NOTOUCH,
   SURFACETOUCH,
   FACETTOUCH,
   ONEPOINTTOUCH,
   TWOPOINTTOUCH,
   JAMMINGTOUCH,
} TTouchType;

typedef enum TMoveMode
{
   NOMOVE = 0,
   UP,
   DOWN,
   RIGHT,
   LEFT,
   CLOCKWISE,
   ANTICLOCKWISE,
} TMoveMode;

typedef enum TControlMode
{
   XYMODE,
   GRIPMODE,
} TControlMode;

void PaintRoundedRect
( 
   TCanvas *canvas,
   int      x,
   int      y,
   int      length,
   int      wide,
   double   angle
);

class TRobot
{
   protected:
      double  width;
      double  positionX;
      double  positionY;
      double  angle;
      double  sideLength;
      double  stepPos;
      double  stepAngle;

      double  criticalRadius;

      TTouchType touchType;

   public:
      TRobot();
      TRobot( double posX, double posY, double angle );

      double GetPositionX()
      { return positionX; };

      double GetPositionY()
      { return positionY; };

      double GetAngle()
      { return angle; };

      double GetWidth()
      { return width; };
      
      double GetSideLength()
      { return sideLength; };
      
      int GetStepPos( void )
      { return stepPos; };
      
      double GetStepAngle( void )
      { return stepAngle; };

      double GetCriticalRadius( void )
      { return criticalRadius; };
      
      void SetStepPos( int sPos )
      { stepPos = sPos; };
      
      void SetStepAngle( double sAngle )
      { stepAngle = sAngle; };

      void SetTouchType( TTouchType type )
      { touchType = type; };

      TTouchType GetTouchType( TRobot *robot );

      void GetLeftUp   ( double& x, double& y );
      void GetLeftDown ( double& x, double& y );
      void GetRightUp  ( double& x, double& y );
      void GetRightDown( double& x, double& y );

      void Move( TControlMode controlMode, TMoveMode moveMode );
      void PaintOnCanvas( TCanvas* canvas, TColor color );
};

extern TRobot robot;

#endif
