MOUSE.H 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. ** Command & Conquer Red Alert(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. /* $Header: /CounterStrike/MOUSE.H 1 3/03/97 10:25a Joe_bostic $ */
  19. /***********************************************************************************************
  20. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Command & Conquer *
  24. * *
  25. * File Name : MOUSE.H *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : 12/15/94 *
  30. * *
  31. * Last Update : December 15, 1994 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef MOUSE_H
  37. #define MOUSE_H
  38. #include "stage.h"
  39. #include "scroll.h"
  40. class MouseClass: public ScrollClass
  41. {
  42. public:
  43. MouseClass(void);
  44. MouseClass(NoInitClass const & x) : ScrollClass(x) {};
  45. /*
  46. ** Initialization
  47. */
  48. virtual void One_Time(void); // One-time inits
  49. virtual void Init_Clear(void); // Clears all to known state
  50. virtual void AI(KeyNumType &input, int x, int y);
  51. virtual bool Override_Mouse_Shape(MouseType mouse, bool wsmall=false);
  52. virtual void Revert_Mouse_Shape(void);
  53. virtual MouseType Get_Mouse_Shape(void) const {return NormalMouseShape;};
  54. virtual void Mouse_Small(bool wsmall);
  55. /*
  56. ** File I/O.
  57. */
  58. virtual bool Load(Straw & file);
  59. virtual bool Save(Pipe & file) const;
  60. virtual void Set_Default_Mouse(MouseType mouse, bool wsmall = false);
  61. /*
  62. ** This allows the tactical map input gadget access to change the
  63. ** mouse shapes.
  64. */
  65. friend class TacticalClass;
  66. /*
  67. ** This points to the loaded mouse shapes.
  68. */
  69. static void const * MouseShapes;
  70. private:
  71. /*
  72. ** This type is used to control the frames and rates of the mouse
  73. ** pointer. Some mouse pointers are actually looping animations.
  74. */
  75. typedef struct MouseStruct
  76. {
  77. int StartFrame; // Starting frame number.
  78. int FrameCount; // Number of animation frames.
  79. int FrameRate; // Frame delay between changing frames.
  80. int SmallFrame; // Start frame number for small version (if any).
  81. int X,Y; // Hotspot X and Y offset.
  82. } MouseStruct;
  83. /*
  84. ** The control frames and rates for the various mouse pointers are stored
  85. ** in this static array.
  86. */
  87. static MouseStruct MouseControl[MOUSE_COUNT];
  88. public:
  89. /*
  90. ** If the small representation of the mouse is active, then this flag is true.
  91. */
  92. unsigned IsSmall:1;
  93. private:
  94. /*
  95. ** The mouse shape is controlled by these variables. These
  96. ** hold the current mouse shape (so resetting won't be needlessly performed) and
  97. ** the normal default mouse shape (when arrow shapes are needed).
  98. */
  99. MouseType CurrentMouseShape;
  100. MouseType NormalMouseShape;
  101. /*
  102. ** For animating mouse shapes, this controls the frame and animation rate.
  103. */
  104. static CDTimerClass<SystemTimerClass> Timer;
  105. int Frame;
  106. };
  107. #endif