evasettings.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. /*
  2. ** Command & Conquer Renegade(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. *** Confidential - Westwood Studios ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Commando *
  23. * *
  24. * $Archive:: /Commando/Code/Combat/evasettings.h $*
  25. * *
  26. * $Author:: Greg_h $*
  27. * *
  28. * $Modtime:: 10/01/01 10:49a $*
  29. * *
  30. * $Revision:: 5 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef EVASETTINGS_H
  36. #define EVASETTINGS_H
  37. #include "always.h"
  38. #include "definition.h"
  39. #include "rect.h"
  40. #include "render2d.h"
  41. ///////////////////////////////////////////////////////////////////////////////////////////
  42. //
  43. // EvaSettingsDefClass
  44. //
  45. ///////////////////////////////////////////////////////////////////////////////////////////
  46. class EvaSettingsDefClass : public DefinitionClass
  47. {
  48. public:
  49. //////////////////////////////////////////////////////////////////////////
  50. // Public constructors/destructors
  51. //////////////////////////////////////////////////////////////////////////
  52. EvaSettingsDefClass (void);
  53. ~EvaSettingsDefClass (void);
  54. //////////////////////////////////////////////////////////////////////////
  55. // Public methods
  56. //////////////////////////////////////////////////////////////////////////
  57. //
  58. // From DefinitionClass
  59. //
  60. virtual uint32 Get_Class_ID (void) const;
  61. virtual PersistClass * Create (void) const ;
  62. virtual bool Save (ChunkSaveClass &csave);
  63. virtual bool Load (ChunkLoadClass &cload);
  64. virtual const PersistFactoryClass & Get_Factory (void) const;
  65. static EvaSettingsDefClass * Get_Instance (void) { return EvaSettings; }
  66. //
  67. // Accessors
  68. //
  69. RectClass Get_Objectives_Screen_Rect (void) const;
  70. RectClass Get_Objectives_Text_Rect (void) const;
  71. const RectClass & Get_Objectives_Endcap_Rect (void) const { return ObjectivesEndcapUVRect; }
  72. const RectClass & Get_Objectives_Fadeout_Rect (void) const { return ObjectivesFadeoutUVRect; }
  73. const RectClass & Get_Objectives_Background_Rect (void) const { return ObjectivesBackgroundUVRect; }
  74. const Vector2 & Get_Objectives_Texture_Size (void) const { return ObjectivesTextureSize;; }
  75. RectClass Get_Messages_Screen_Rect (void) const;
  76. RectClass Get_Messages_Text_Rect (void) const;
  77. const RectClass & Get_Messages_Endcap_Rect (void) const { return MessagesEndcapUVRect; }
  78. const RectClass & Get_Messages_Fadeout_Rect (void) const { return MessagesFadeoutUVRect; }
  79. const RectClass & Get_Messages_Background_Rect (void) const { return MessagesBackgroundUVRect; }
  80. const Vector2 & Get_Messages_Texture_Size (void) const { return MessagesTextureSize;; }
  81. Vector2 Get_Messages_Icon_Position (void) const;
  82. //
  83. // Editable support
  84. //
  85. DECLARE_EDITABLE (EvaSettingsDefClass, DefinitionClass);
  86. protected:
  87. //////////////////////////////////////////////////////////////////////////
  88. // Protected member data
  89. //////////////////////////////////////////////////////////////////////////
  90. RectClass ObjectivesScreenRect;
  91. RectClass ObjectivesTextRect;
  92. RectClass ObjectivesEndcapUVRect;
  93. RectClass ObjectivesFadeoutUVRect;
  94. RectClass ObjectivesBackgroundUVRect;
  95. Vector2 ObjectivesTextureSize;
  96. RectClass MessagesScreenRect;
  97. RectClass MessagesTextRect;
  98. RectClass MessagesEndcapUVRect;
  99. RectClass MessagesFadeoutUVRect;
  100. RectClass MessagesBackgroundUVRect;
  101. Vector2 MessagesTextureSize;
  102. Vector2 MessagesIconPos;
  103. static EvaSettingsDefClass * EvaSettings;
  104. };
  105. //////////////////////////////////////////////////////////////////////////
  106. // Get_Objectives_Screen_Rect
  107. //////////////////////////////////////////////////////////////////////////
  108. inline RectClass
  109. EvaSettingsDefClass::Get_Objectives_Screen_Rect (void) const
  110. {
  111. RectClass adjusted_rect = ObjectivesScreenRect;
  112. //
  113. // Convert the normalized screen coords to pixels
  114. //
  115. const RectClass &screen_rect = Render2DClass::Get_Screen_Resolution ();
  116. adjusted_rect.Scale (Vector2 (screen_rect.Width (), screen_rect.Height ()));
  117. adjusted_rect.Left = float (int(adjusted_rect.Left + 0.5F));
  118. adjusted_rect.Top = float (int(adjusted_rect.Top + 0.5F));
  119. adjusted_rect.Right = float (int(adjusted_rect.Right + 0.5F));
  120. adjusted_rect.Bottom = float (int(adjusted_rect.Bottom + 0.5F));
  121. return adjusted_rect;
  122. }
  123. //////////////////////////////////////////////////////////////////////////
  124. // Get_Objectives_Text_Rect
  125. //////////////////////////////////////////////////////////////////////////
  126. inline RectClass
  127. EvaSettingsDefClass::Get_Objectives_Text_Rect (void) const
  128. {
  129. RectClass adjusted_rect = ObjectivesTextRect;
  130. //
  131. // Convert the normalized screen coords to pixels
  132. //
  133. const RectClass &screen_rect = Render2DClass::Get_Screen_Resolution ();
  134. adjusted_rect.Scale (Vector2 (screen_rect.Width (), screen_rect.Height ()));
  135. adjusted_rect.Left = float (int(adjusted_rect.Left + 0.5F));
  136. adjusted_rect.Top = float (int(adjusted_rect.Top + 0.5F));
  137. adjusted_rect.Right = float (int(adjusted_rect.Right + 0.5F));
  138. adjusted_rect.Bottom = float (int(adjusted_rect.Bottom + 0.5F));
  139. return adjusted_rect;
  140. }
  141. //////////////////////////////////////////////////////////////////////////
  142. // Get_Messages_Screen_Rect
  143. //////////////////////////////////////////////////////////////////////////
  144. inline RectClass
  145. EvaSettingsDefClass::Get_Messages_Screen_Rect (void) const
  146. {
  147. RectClass adjusted_rect = MessagesScreenRect;
  148. //
  149. // Convert the normalized screen coords to pixels
  150. //
  151. const RectClass &screen_rect = Render2DClass::Get_Screen_Resolution ();
  152. adjusted_rect.Scale (Vector2 (screen_rect.Width (), screen_rect.Height ()));
  153. adjusted_rect.Left = float (int(adjusted_rect.Left + 0.5F));
  154. adjusted_rect.Top = float (int(adjusted_rect.Top + 0.5F));
  155. adjusted_rect.Right = float (int(adjusted_rect.Right + 0.5F));
  156. adjusted_rect.Bottom = float (int(adjusted_rect.Bottom + 0.5F));
  157. return adjusted_rect;
  158. }
  159. //////////////////////////////////////////////////////////////////////////
  160. // Get_Messages_Text_Rect
  161. //////////////////////////////////////////////////////////////////////////
  162. inline RectClass
  163. EvaSettingsDefClass::Get_Messages_Text_Rect (void) const
  164. {
  165. RectClass adjusted_rect = MessagesTextRect;
  166. //
  167. // Convert the normalized screen coords to pixels
  168. //
  169. const RectClass &screen_rect = Render2DClass::Get_Screen_Resolution ();
  170. adjusted_rect.Scale (Vector2 (screen_rect.Width (), screen_rect.Height ()));
  171. adjusted_rect.Left = float (int(adjusted_rect.Left + 0.5F));
  172. adjusted_rect.Top = float (int(adjusted_rect.Top + 0.5F));
  173. adjusted_rect.Right = float (int(adjusted_rect.Right + 0.5F));
  174. adjusted_rect.Bottom = float (int(adjusted_rect.Bottom + 0.5F));
  175. return adjusted_rect;
  176. }
  177. //////////////////////////////////////////////////////////////////////////
  178. // Get_Messages_Icon_Position
  179. //////////////////////////////////////////////////////////////////////////
  180. inline Vector2
  181. EvaSettingsDefClass::Get_Messages_Icon_Position (void) const
  182. {
  183. Vector2 adjusted_point = MessagesIconPos;
  184. //
  185. // Convert the normalized screen coords to pixels
  186. //
  187. adjusted_point.X *= Render2DClass::Get_Screen_Resolution ().Width ();
  188. adjusted_point.Y *= Render2DClass::Get_Screen_Resolution ().Height ();
  189. return adjusted_point;
  190. }
  191. #endif // EVASETTINGS_H