trigger.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2016 RWS Inc, All Rights Reserved
  4. //
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of version 2 of the GNU General Public License as published by
  7. // the Free Software Foundation
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License along
  15. // with this program; if not, write to the Free Software Foundation, Inc.,
  16. // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. //
  18. // hood.h
  19. // Project: Nostril (aka Postal)
  20. //
  21. // History:
  22. // 01/22/97 JMI Converted many m_spryAlphas/Opaques to arrays and added
  23. // a macro enum MaxLayers.
  24. //
  25. // 01/23/97 JMI Added two very non-major comments and removed a #if 0
  26. // block.
  27. //
  28. // 01/26/97 JMI Made m_imBackground public. It was the only way I could
  29. // figure to get any idea of the realm dimensions that I
  30. // needed for the editor.
  31. //
  32. // 01/26/97 JMI Added override of EditRect() that sets the rect to the
  33. // dimensions of m_pimBackground->
  34. //
  35. // 01/31/97 MJR Added GetWidth() and GetHeight().
  36. //
  37. // 02/03/97 JMI Updated default relative path used to get hood resources.
  38. //
  39. // 02/04/97 JMI Changed all resources to pointers so we can fully utilize
  40. // the RResMgr.
  41. //
  42. // 02/07/97 JMI Added m_sWorldXRot, world transformation x rotation.
  43. //
  44. // 02/13/97 JMI Changed paths for hoods to be in hoods/ instead of bg/
  45. // and also now just store the import part (like "city" instead
  46. // of "hoods/city").
  47. // Also, now gets resources for lighting effects.
  48. // Also, now sets the realm's m_phood ptr to this instance.
  49. //
  50. // 02/13/97 JMI Had to make m_pimBackground public so 3D guys could get in-
  51. // to its palette.
  52. //
  53. // 03/13/97 JMI Load now takes a version number.
  54. //
  55. // 04/09/97 BRH Added RMultiGrid to the hoods for the new type of attribute
  56. // maps. These will eventuall replace the RAttribMap but for
  57. // now they are both here so that all parts of the game
  58. // will continue to work during testing of the new attribute
  59. // map.
  60. //
  61. // 05/12/97 JRD Made it into a trigger CThing so it can load and save trigger
  62. // attribute maps.
  63. //
  64. ////////////////////////////////////////////////////////////////////////////////
  65. #ifndef TRIGGER_H
  66. #define TRIGGER_H
  67. #include "RSPiX.h"
  68. #ifdef PATHS_IN_INCLUDES
  69. #include "WishPiX/Spry/spry.h"
  70. #include "ORANGE/MultiGrid/MultiGridIndirect.h"
  71. #else
  72. #include "spry.h"
  73. #include "multigridindirect.h"
  74. #endif
  75. #include "thing.h"
  76. // A fake declaration for CRealm pointers...
  77. class CRealm;
  78. // This is the hood object
  79. class CTrigger : public CThing
  80. {
  81. //---------------------------------------------------------------------------
  82. // Types, enums, etc.
  83. //---------------------------------------------------------------------------
  84. public:
  85. //---------------------------------------------------------------------------
  86. // Variables
  87. //---------------------------------------------------------------------------
  88. public:
  89. RMultiGridIndirect* m_pmgi; // Attribute map of regions
  90. USHORT m_ausPylonUIDs[256]; // Look up for Pylon ID's
  91. //---------------------------------------------------------------------------
  92. // Constructor(s) / destructor
  93. //---------------------------------------------------------------------------
  94. protected:
  95. // Constructor
  96. CTrigger(CRealm* pRealm);
  97. public:
  98. // Destructor
  99. ~CTrigger();
  100. //---------------------------------------------------------------------------
  101. // Required static functions
  102. //---------------------------------------------------------------------------
  103. public:
  104. // Construct object
  105. static short Construct( // Returns 0 if successfull, non-zero otherwise
  106. CRealm* pRealm, // In: Pointer to realm this object belongs to
  107. CThing** ppNew) // Out: Pointer to new object
  108. {
  109. short sResult = 0;
  110. *ppNew = new CTrigger(pRealm);
  111. if (*ppNew == 0)
  112. {
  113. sResult = -1;
  114. TRACE("CTrigger::Construct(): Couldn't construct CTrigger!\n");
  115. }
  116. return sResult;
  117. }
  118. //---------------------------------------------------------------------------
  119. // Required virtual functions (implimenting them as inlines doesn't pay!)
  120. //---------------------------------------------------------------------------
  121. public:
  122. // Load object (should call base class version!)
  123. short Load( // Returns 0 if successfull, non-zero otherwise
  124. RFile* pFile, // In: File to load from
  125. bool bEditMode, // In: True for edit mode, false otherwise
  126. short sFileCount, // In: File count (unique per file, never 0)
  127. ULONG ulFileVersion); // In: Version of file format to load.
  128. // Save object (should call base class version!)
  129. short Save( // Returns 0 if successfull, non-zero otherwise
  130. RFile* pFile, // In: File to save to
  131. short sFileCount); // In: File count (unique per file, never 0)
  132. // Startup object
  133. short Startup(void); // Returns 0 if successfull, non-zero otherwise
  134. // Shutdown object
  135. short Shutdown(void); // Returns 0 if successfull, non-zero otherwise
  136. // Suspend object
  137. void Suspend(void);
  138. // Resume object
  139. void Resume(void);
  140. // Update object
  141. void Update(void);
  142. // Render object
  143. void Render(void);
  144. // Called by editor to init new object at specified position
  145. short EditNew( // Returns 0 if successfull, non-zero otherwise
  146. short sX, // In: New x coord
  147. short sY, // In: New y coord
  148. short sZ); // In: New z coord
  149. // Called by editor to modify object
  150. short EditModify(void); // Returns 0 if successfull, non-zero otherwise
  151. // Called by editor to move object to specified position
  152. short EditMove( // Returns 0 if successfull, non-zero otherwise
  153. short sX, // In: New x coord
  154. short sY, // In: New y coord
  155. short sZ); // In: New z coord
  156. // Called by editor to update object
  157. void EditUpdate(void);
  158. // Called by editor to render object
  159. void EditRender(void);
  160. // Called by editor to get the clickable pos/area of an object.
  161. virtual // If you override this, do NOT call this base class.
  162. void EditRect( // Returns nothiing.
  163. RRect* prc) // Out: Clickable pos/area of object.
  164. {
  165. // Default implementation makes the object unclickable.
  166. prc->sX = 0;
  167. prc->sY = 0;
  168. prc->sW = 16;
  169. prc->sH = 16;
  170. }
  171. //---------------------------------------------------------------------------
  172. // Trigger Specific Functions
  173. //---------------------------------------------------------------------------
  174. public:
  175. // After the game editor creates the attribute data, stick it here
  176. void AddData(RMultiGridIndirect* pmgi);
  177. };
  178. #endif //HOOD_H
  179. ////////////////////////////////////////////////////////////////////////////////
  180. // EOF
  181. ////////////////////////////////////////////////////////////////////////////////