probetypeigc.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. ** Copyright (C) 1996, 1997 Microsoft Corporation. All Rights Reserved.
  3. **
  4. ** File: probeTypeIGC.cpp
  5. **
  6. ** Author:
  7. **
  8. ** Description:
  9. ** Implementation of the CprobeTypeIGC class. This file was initially created by
  10. ** the ATL wizard for the core object.
  11. **
  12. ** History:
  13. */
  14. // probeTypeIGC.cpp : Implementation of CprobeTypeIGC
  15. #include "pch.h"
  16. #include "probeTypeIGC.h"
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CprobeTypeIGC
  19. HRESULT CprobeTypeIGC::Initialize(ImissionIGC* pMission, Time now, const void* data, int dataSize)
  20. {
  21. assert (pMission);
  22. m_pMission = pMission;
  23. ZRetailAssert (data && (dataSize == sizeof(DataProbeTypeIGC)));
  24. {
  25. m_data = *((DataProbeTypeIGC*)data);
  26. assert (iswalpha(m_data.modelName[0]));
  27. pMission->GetIgcSite()->Preload(m_data.modelName, iswalpha(m_data.textureName[0])
  28. ? m_data.textureName
  29. : NULL);
  30. MultiHullBase* pmhb = HitTest::Load(m_data.modelName);
  31. if (m_data.projectileTypeID != NA)
  32. {
  33. m_projectileType = pMission->GetProjectileType(m_data.projectileTypeID);
  34. assert (m_projectileType);
  35. m_projectileType->AddRef();
  36. if (pmhb)
  37. {
  38. float scale = (m_data.radius / pmhb->GetOriginalRadius());
  39. m_emissionPt = pmhb->GetFrameOffset("wepemt") * scale;
  40. }
  41. else
  42. {
  43. m_emissionPt = Vector::GetZero();
  44. }
  45. }
  46. pMission->AddExpendableType(this);
  47. }
  48. return S_OK;
  49. }
  50. int CprobeTypeIGC::Export(void* data) const
  51. {
  52. if (data)
  53. *((DataProbeTypeIGC*)data) = m_data;
  54. return sizeof(DataProbeTypeIGC);
  55. }