MOUSE.H 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /* $Header: /CounterStrike/MOUSE.H 1 3/03/97 10:25a Joe_bostic $ */
  15. /***********************************************************************************************
  16. *** 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 ***
  17. ***********************************************************************************************
  18. * *
  19. * Project Name : Command & Conquer *
  20. * *
  21. * File Name : MOUSE.H *
  22. * *
  23. * Programmer : Joe L. Bostic *
  24. * *
  25. * Start Date : 12/15/94 *
  26. * *
  27. * Last Update : December 15, 1994 [JLB] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  32. #ifndef MOUSE_H
  33. #define MOUSE_H
  34. #include "stage.h"
  35. #include "scroll.h"
  36. class MouseClass: public ScrollClass
  37. {
  38. public:
  39. MouseClass(void);
  40. MouseClass(NoInitClass const & x) : ScrollClass(x) {};
  41. /*
  42. ** Initialization
  43. */
  44. virtual void One_Time(void); // One-time inits
  45. virtual void Init_Clear(void); // Clears all to known state
  46. virtual void AI(KeyNumType &input, int x, int y);
  47. virtual bool Override_Mouse_Shape(MouseType mouse, bool wsmall=false);
  48. virtual void Revert_Mouse_Shape(void);
  49. virtual MouseType Get_Mouse_Shape(void) const {return NormalMouseShape;};
  50. virtual void Mouse_Small(bool wsmall);
  51. /*
  52. ** File I/O.
  53. */
  54. virtual bool Load(Straw & file);
  55. virtual bool Save(Pipe & file) const;
  56. virtual void Set_Default_Mouse(MouseType mouse, bool wsmall = false);
  57. /*
  58. ** This allows the tactical map input gadget access to change the
  59. ** mouse shapes.
  60. */
  61. friend class TacticalClass;
  62. /*
  63. ** This points to the loaded mouse shapes.
  64. */
  65. static void const * MouseShapes;
  66. private:
  67. /*
  68. ** This type is used to control the frames and rates of the mouse
  69. ** pointer. Some mouse pointers are actually looping animations.
  70. */
  71. typedef struct MouseStruct
  72. {
  73. int StartFrame; // Starting frame number.
  74. int FrameCount; // Number of animation frames.
  75. int FrameRate; // Frame delay between changing frames.
  76. int SmallFrame; // Start frame number for small version (if any).
  77. int X,Y; // Hotspot X and Y offset.
  78. } MouseStruct;
  79. /*
  80. ** The control frames and rates for the various mouse pointers are stored
  81. ** in this static array.
  82. */
  83. static MouseStruct MouseControl[MOUSE_COUNT];
  84. public:
  85. /*
  86. ** If the small representation of the mouse is active, then this flag is true.
  87. */
  88. unsigned IsSmall:1;
  89. private:
  90. /*
  91. ** The mouse shape is controlled by these variables. These
  92. ** hold the current mouse shape (so resetting won't be needlessly performed) and
  93. ** the normal default mouse shape (when arrow shapes are needed).
  94. */
  95. MouseType CurrentMouseShape;
  96. MouseType NormalMouseShape;
  97. /*
  98. ** For animating mouse shapes, this controls the frame and animation rate.
  99. */
  100. static CDTimerClass<SystemTimerClass> Timer;
  101. int Frame;
  102. };
  103. #endif