MOUSE.H 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. ** Command & Conquer(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: F:\projects\c&c\vcs\code\mouse.h_v 2.16 16 Oct 1995 16:45:06 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. /*
  45. ** Initialization
  46. */
  47. virtual void One_Time(void); // One-time inits
  48. virtual void Init_Clear(void); // Clears all to known state
  49. virtual void AI(KeyNumType &input, int x, int y);
  50. virtual bool Override_Mouse_Shape(MouseType mouse, bool wwsmall=false);
  51. virtual void Revert_Mouse_Shape(void);
  52. virtual MouseType Get_Mouse_Shape(void) const {return NormalMouseShape;};
  53. virtual void Mouse_Small(bool wwsmall);
  54. /*
  55. ** File I/O.
  56. */
  57. virtual bool Load(FileClass & file);
  58. virtual bool Save(FileClass & file);
  59. virtual void Code_Pointers(void);
  60. virtual void Decode_Pointers(void);
  61. virtual void Set_Default_Mouse(MouseType mouse, bool wwsmall = false);
  62. /*
  63. ** This allows the tactical map input gadget access to change the
  64. ** mouse shapes.
  65. */
  66. friend class TacticalClass;
  67. private:
  68. /*
  69. ** This type is used to control the frames and rates of the mouse
  70. ** pointer. Some mouse pointers are actually looping animations.
  71. */
  72. typedef struct MouseStruct
  73. {
  74. int StartFrame; // Starting frame number.
  75. int FrameCount; // Number of animation frames.
  76. int FrameRate; // Frame delay between changing frames.
  77. int SmallFrame; // Start frame number for small version (if any).
  78. int X,Y; // Hotspot X and Y offset.
  79. } MouseStruct;
  80. /*
  81. ** The control frames and rates for the various mouse pointers are stored
  82. ** in this static array.
  83. */
  84. static MouseStruct MouseControl[MOUSE_COUNT];
  85. /*
  86. ** If the small representation of the mouse is active, then this flag is true.
  87. */
  88. unsigned IsSmall:1;
  89. /*
  90. ** This points to the loaded mouse shapes.
  91. */
  92. static void const * MouseShapes;
  93. /*
  94. ** The mouse shape is controlled by these variables. These
  95. ** hold the current mouse shape (so resetting won't be needlessly performed) and
  96. ** the normal default mouse shape (when arrow shapes are needed).
  97. */
  98. MouseType CurrentMouseShape;
  99. MouseType NormalMouseShape;
  100. /*
  101. ** For animating mouse shapes, this controls the frame and animation rate.
  102. */
  103. static CountDownTimerClass Timer;
  104. int Frame;
  105. // StageClass Control;
  106. /*
  107. ** This contains the value of the Virtual Function Table Pointer
  108. */
  109. static void * VTable;
  110. };
  111. #endif