gamemaps.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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: /Commando/Code/Tools/max2w3d/gamemaps.h 7 10/28/97 6:08p Greg_h $ */
  19. /***********************************************************************************************
  20. *** Confidential - Westwood Studios ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Commando / G 3D engine *
  24. * *
  25. * File Name : GAMEMAPS.H *
  26. * *
  27. * Programmer : Greg Hjelstrom *
  28. * *
  29. * Start Date : 06/26/97 *
  30. * *
  31. * Last Update : June 26, 1997 [GH] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef GAMEMAPS_H
  37. #define GAMEMAPS_H
  38. #include <Max.h>
  39. #include "stdmat.h"
  40. ClassDesc * Get_Game_Maps_Desc();
  41. ///////////////////////////////////////////////////////////////////////////
  42. //
  43. // TexmapSlotClass
  44. //
  45. ///////////////////////////////////////////////////////////////////////////
  46. class TexmapSlotClass
  47. {
  48. public:
  49. BOOL MapOn;
  50. float Amount;
  51. Texmap * Map;
  52. TexmapSlotClass() : MapOn(FALSE), Amount(1.0f), Map(NULL) {};
  53. RGBA Eval(ShadeContext& sc) { return Map->EvalColor(sc); }
  54. float EvalMono(ShadeContext& sc) { return Map->EvalMono(sc); }
  55. Point3 EvalNormalPerturb(ShadeContext &sc) { return Map->EvalNormalPerturb(sc); }
  56. BOOL IsActive() { return (Map && MapOn); }
  57. void Update(TimeValue t, Interval &ivalid) { if (IsActive()) Map->Update(t,ivalid); };
  58. float GetAmount(TimeValue t) { return Amount; }
  59. };
  60. ///////////////////////////////////////////////////////////////////////////
  61. //
  62. // Texture Maps for In-Game material
  63. //
  64. // This class can contain a collection of all of the maps which
  65. // MAX uses but the GameMtl plugin will only give the user access
  66. // to the ones we can actually use in the game.
  67. //
  68. ///////////////////////////////////////////////////////////////////////////
  69. class GameMapsClass: public ReferenceTarget
  70. {
  71. public:
  72. MtlBase * Client;
  73. TexmapSlotClass TextureSlot[NTEXMAPS];
  74. GameMapsClass() { Client = NULL; }
  75. GameMapsClass(MtlBase *mb) { Client = mb; }
  76. void DeleteThis() { delete this; }
  77. void SetClientPtr(MtlBase *mb) { Client = mb; }
  78. TexmapSlotClass & operator[](int i) { return TextureSlot[i]; }
  79. Class_ID ClassID();
  80. SClass_ID SuperClassID() { return REF_MAKER_CLASS_ID; }
  81. int NumSubs() { return NTEXMAPS; }
  82. Animatable * SubAnim(int i) { return TextureSlot[i].Map; }
  83. TSTR SubAnimName(int i) { return Client->GetSubTexmapTVName(i); }
  84. int NumRefs() { return NTEXMAPS; }
  85. RefTargetHandle GetReference(int i) { return TextureSlot[i].Map; }
  86. void SetReference(int i, RefTargetHandle rtarg) { TextureSlot[i].Map = (Texmap*)rtarg; }
  87. int SubNumToRefNum(int subNum) { return subNum; }
  88. BOOL AssignController(Animatable *control,int subAnim);
  89. RefTargetHandle Clone(RemapDir &remap);
  90. RefResult NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message);
  91. IOResult Save(ISave * isave);
  92. IOResult Load(ILoad * iload);
  93. };
  94. #endif /*GAMEMAPS_H*/