projectileIGC.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. ** Copyright (C) 1996, 1997 Microsoft Corporation. All Rights Reserved.
  3. **
  4. ** File: projectileIGC.h
  5. **
  6. ** Author:
  7. **
  8. ** Description:
  9. ** Header for the CprojectileIGC class. This file was initially created by
  10. ** the ATL wizard.
  11. **
  12. ** History:
  13. */
  14. // projectileIGC.h : Declaration of the CprojectileIGC
  15. #ifndef __PROJECTILEIGC_H_
  16. #define __PROJECTILEIGC_H_
  17. #include "modelIGC.h"
  18. class CprojectileIGC : public TmodelIGC<IprojectileIGC>
  19. {
  20. public:
  21. CprojectileIGC(void);
  22. ~CprojectileIGC(void);
  23. public:
  24. // IbaseIGC
  25. virtual HRESULT Initialize(ImissionIGC* pMission, Time now, const void* data, int dataSize);
  26. virtual void Terminate(void);
  27. virtual void Update(Time now);
  28. virtual int Export(void* data);
  29. virtual ObjectType GetObjectType(void) const
  30. {
  31. return OT_projectile;
  32. }
  33. // ImodelIGC
  34. virtual void SetCluster(IclusterIGC* cluster)
  35. {
  36. AddRef();
  37. {
  38. IclusterIGC* c = GetCluster();
  39. if (c)
  40. c->DeleteModel(this);
  41. }
  42. TmodelIGC<IprojectileIGC>::SetCluster(cluster);
  43. if (cluster)
  44. cluster->AddModel(this);
  45. Release();
  46. }
  47. virtual void HandleCollision(Time timeCollision,
  48. float tCollision,
  49. const CollisionEntry& entry,
  50. ImodelIGC* pModel);
  51. // IprojectileIGC
  52. virtual IprojectileTypeIGC* GetProjectileType(void) const
  53. {
  54. return m_projectileType;
  55. }
  56. virtual ImodelIGC* GetLauncher(void) const
  57. {
  58. return m_launcher;
  59. }
  60. virtual void SetLauncher(ImodelIGC* newVal)
  61. {
  62. assert (!m_launcher); //Only set once
  63. assert (newVal);
  64. newVal->AddRef();
  65. m_launcher = newVal;
  66. GetHitTest()->SetNoHit(m_launcher->GetHitTest());
  67. SetSide(m_launcher->GetSide());
  68. }
  69. virtual void SetGunner(IshipIGC* newVal)
  70. {
  71. assert (!m_launcher); //Only set once
  72. assert (newVal);
  73. newVal->AddRef();
  74. m_launcher = newVal;
  75. GetHitTest()->SetNoHit(newVal->GetParentShip()->GetHitTest());
  76. SetSide(m_launcher->GetSide());
  77. }
  78. private:
  79. IprojectileTypeIGC* m_projectileType;
  80. ImodelIGC* m_launcher;
  81. ExplosionData* m_pExplosionData;
  82. Time m_timeExpire;
  83. };
  84. #endif //__PROJECTILEIGC_H_