LookAtXlat.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: LookAtXlat.h ///////////////////////////////////////////////////////////
  24. // Author: Steven Johnson, Dec 2001
  25. #pragma once
  26. #ifndef _H_LookAtXlat
  27. #define _H_LookAtXlat
  28. #include "GameClient/InGameUI.h"
  29. //-----------------------------------------------------------------------------
  30. class LookAtTranslator : public GameMessageTranslator
  31. {
  32. public:
  33. LookAtTranslator();
  34. ~LookAtTranslator();
  35. virtual GameMessageDisposition translateGameMessage(const GameMessage *msg);
  36. virtual const ICoord2D* getRMBScrollAnchor(void); // get m_anchor ICoord2D if we're RMB scrolling
  37. Bool hasMouseMovedRecently( void );
  38. void setCurrentPos( const ICoord2D& pos );
  39. void resetModes(); //Used when disabling input, so when we reenable it we aren't stuck in a mode.
  40. private:
  41. enum
  42. {
  43. MAX_VIEW_LOCS = 8
  44. };
  45. enum
  46. {
  47. SCROLL_NONE = 0,
  48. SCROLL_RMB,
  49. SCROLL_KEY,
  50. SCROLL_SCREENEDGE
  51. };
  52. ICoord2D m_anchor;
  53. ICoord2D m_originalAnchor;
  54. ICoord2D m_currentPos;
  55. Bool m_isScrolling; // set to true if we are in the act of RMB scrolling
  56. Bool m_isRotating; // set to true if we are in the act of MMB rotating
  57. Bool m_isPitching; // set to true if we are in the act of ALT pitch rotation
  58. Bool m_isChangingFOV; // set to true if we are in the act of changing the field of view
  59. UnsignedInt m_timestamp; // set when button goes down
  60. DrawableID m_lastPlaneID;
  61. ViewLocation m_viewLocation[ MAX_VIEW_LOCS ];
  62. Int m_scrollType;
  63. void setScrolling( Int );
  64. void stopScrolling( void );
  65. UnsignedInt m_lastMouseMoveFrame;
  66. };
  67. extern LookAtTranslator *TheLookAtTranslator;
  68. #endif