RadarDopplerClass

public:
        RadarDopplerClass (int idx, SimMoverClass* self);
        virtual ~RadarDopplerClass();

        virtual void DisplayInit (ImageBuffer* newImage);

        virtual SimObjectType* Exec( SimObjectType* targetList );
        virtual void ExecModes( int newDesignate, int newDrop );
        virtual void UpdateState( int cursorXCmd, int cursorYCmd );
        virtual void Display( VirtualDisplay* );

        // Queued -- call on any thread
        virtual void PushButton( int whichButton, int whichMFD = 0);
        virtual void RangeStep( int cmd )                               { rangeChangeCmd = cmd; };      // Step up/down in range

        virtual void StepAAmode( void );
        virtual void SetSRMOverride();
        virtual void SetMRMOverride();
        virtual void ClearOverride();

        virtual void SelectACMVertical()                                { modeDesiredCmd = ACM_10x60; };
        virtual void SelectACMBore()                                    { modeDesiredCmd = ACM_BORE; };
        virtual void SelectACMSlew()                                    { modeDesiredCmd = ACM_SLEW; };
        virtual void SelectACM30x20()                                   { modeDesiredCmd = ACM_30x20; };

        virtual void StepAAscanHeight()                                 { scanHeightCmd = TRUE; };
        virtual void StepAAscanWidth()                                  { scanWidthCmd = TRUE; };
        virtual void StepAAelvation( int cmd )                  { if (cmd) elSlewCmd = cmd; else centerCmd = TRUE; };

        virtual void StepAGmode( void );

        virtual void StepAGfov()                                                { fovStepCmd = TRUE; };
        virtual void StepAGgain( int cmd )                              { gainCmd = (cmd>0) ? 1.25f : 0.8f; };

   void SetAGSnowPlow(int val);
   void SetAGFreeze(int val);
   virtual void SetAGSteerpoint(int val);
        virtual void ToggleAGfreeze();
        virtual void ToggleAGsnowPlow();
        virtual void ToggleAGcursorZero();
        virtual void DefaultAGMode (void);
        virtual void DefaultAAMode (void);

        virtual void NextTarget (void);
        virtual void PrevTarget (void);
        virtual void SetGroundPoint (float rx, float ry, float rz);
        virtual int  IsAG (void);
        virtual void GetAGCenter (float* x, float* y);
        virtual float GetRange (void)                                   { return displayRange; };
        virtual float GetVolume (void)                                  { return azScan; };
        virtual void GetCursorPosition (float* xPos, float* yPos);
   virtual void SetMode (RadarMode cmd);

  protected:
        // Command queues -- These store commands until we're able to process them
        float   gainCmd;
        int   rangeChangeCmd, scanHeightCmd, scanWidthCmd, elSlewCmd;
        int   modeDesiredCmd, fovStepCmd;
        int   dropTrackCmd, designateCmd, centerCmd;

        virtual void ClearSensorTarget (void);
        virtual void SetSensorTarget (SimObjectType*);

  protected:
        // State
        enum ModeFlags {NORM = 0x1,
                                        EXP = 0x2,
                                        DBS1 = 0x4,
                                        DBS2 = 0x8,
                                        CZ = 0x10,
                                        FZ = 0x20,
                                        SP = 0x40,
               SpaceStabalized = 0x100,
               Designating = 0x200,
               Spotlight = 0x400,
               ChangingBars = 0x800,
               HorizontalScan = 0x1000,
               VerticalScan = 0x2000,
               WasMoving    = 0x4000,
               SAMingTarget = 0x8000,
               STTingTarget = 0x10000,
               HomingBeam   = 0x20000,
               Decluttered  = 0x40000};

        class GMList
        {
      protected:
                   FalconEntity* object;
         int count;

      public:
         float x, y;
                   GMList* prev;
                   GMList* next;

         GMList (FalconEntity* obj);
         void Release(void);
         FalconEntity* Object(void) {return object;};
        };

        // State
   int  IsSet (int newFlag) {return newFlag & flags ? TRUE : FALSE;};
        void SetFlagBit (int newFlag) {flags |= newFlag;};
        void ClearFlagBit (int newFlag) {flags &= ~newFlag;};
        void ToggleFlag (int flag);
        void ChangeMode(int newMode);

        // State
        RadarMode mode;
        int bars;
   int reacqFlag;
        float beamAz, beamEl;
        float azScan, elScan;
        float displayRange, displayAzScan;
        float cursorX, cursorY;
   float curCursorRate;
        class SimObjectLocalData* lockedTargetData;

  protected :
        enum {ScanFwd = 1, ScanRev = -1, ScanNone = 0};
        enum DisplayShapes {None, Det, Solid, Track, FlashTrack, Prio, Schweem, Bug, FlashBug,
                                                Tail, SolidTrack, GMObj, GMTrack, GMBeacon, Jam};
        enum {TwsFlashTime = 8000, TwsExtrapolateTime = 13000, ReacqusitionCount = 10000};

        // Beam Movement
        float targetEl, targetAz;
        float barWidth;
        float scanDir, scanRate;
        float beamWidth, tdisplayRange, tbarWidth;
        float curScanTop, curScanBottom, curScanLeft, curScanRight;
        float scanCenterAlt;
        float lastAzScan, lastSAMAzScan;
        int   patternTime;
        int   lastBars, lastSAMBars;

        // Mode/State Data
        float rangeScales[NUM_RANGES], rwsAzs[NUM_RWS_AZS];
        float velScales[NUM_VELS];
        int   rwsBars[NUM_RWS_BARS];
        int   curRangeIdx, curBarIdx, vsVelIdx, curAzIdx;
   int   gmRangeIdx, airRangeIdx;
   int   rwsAzIdx, twsAzIdx, vsAzIdx;
   int   rwsBarIdx, twsBarIdx, gmBarIdx, vsBarIdx;
        float groundDesignateX, groundDesignateY, groundDesignateZ;
        float groundLookAz, groundLookEl, groundMapRange;
        float cursRange;
        float reacqEl;
   float nctrData;
        int  flags;
        int  subMode;
        char groundMapLOD;
   long lastFeatureUpdate;
        GMList* GMFeatureListRoot;
        GMList* GMMoverListRoot;
   float GMXCenter, GMYCenter;
   void SetGroundTarget (FalconEntity* newTarget);

        // Detection Factors
        float signalFactor1, signalFactor2;

        // Functions
        void MoveBeam(void);
        void SetScan(void);
   void CalcSAMAzLimit(void);
        int LookingAtObject (SimObjectType*);
        int ObjectDetected (SimObjectType*);
        float GetRCS (SimObjectType*);
        float DopplerNotch (SimObjectType*);
        float Jamming (SimObjectType*);
        int InResCell (SimObjectType*, int, int *, int *);

        // Mode Functions
        void TWSMode(void);
        void RWSMode(void);
        void SAMMode(void);
        void VSMode(void);
        void STTMode(void);
        void ACMMode(void);
        void GMMode(void);
        void AddToHistory(SimObjectType* ptr, int sy);
        void SetHistory(SimObjectType* ptr, int sy);
        void ClearHistory(SimObjectType* ptr);
        void ClearAllHistory (void);
        void SlipHistory(SimObjectType* ptr);
        void ExtrapolateHistory(SimObjectType* ptr);

        // Bscope Functions
        void DrawRangeTicks(void);
        void DrawRangeArrows(void);
        void DrawRange(void);
        void DrawAzLimitMarkers(void);
        void DrawACQCursor(void);
        void DrawSlewCursor(void);
        void DrawCollisionSteering (SimObjectType* buggedTarget, float curX);
        void DrawSteerpoint(void);
        void DrawBars(void);
        void RWSDisplay(void);
        void TWSDisplay(void);
        void STTDisplay(void);
        void VSModeDisplay(void);
        void VSDisplay(void);
        void ACMDisplay(void);
        void SAMDisplay(void);
        void GMDisplay(void);
        void MENUDisplay(void);
   void DrawDLZSymbol(void);
        void DrawSymbol(int type, float schweemLen);
        int  IsUnderCursor (SimObjectType* , float heading);
        int  IsUnderVSCursor (SimObjectType* , float heading);
        void DrawWaterline(void);
        void DrawScanMarkers(void);
        void DrawCursor(void);
        void DrawAzElTicks(void);
        void DrawTargets(void);
        void SetGMScan(void);
        void SetAimPoint (float, float);
   void AdjustGMOffset (int rangeChangeCmd);
   int  CheckGMBump (void);
   void DropGMTrack(void);
        static void AddTargetReturnCallback( void* self, class RenderGMRadar* renderer );
        void AddTargetReturns( class RenderGMRadar* renderer );
        void AddTargetReturnsOldStyle (GMList*);
        void DoGMDesignate (GMList*);
        void FreeGMList (GMList* theList);