weaponfx.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //---------------------------------------------------------------------
  2. // Weapon FX equivalency Table for Mechs/Vehicles/Whatever
  3. //
  4. //---------------------------------------------------------------------------//
  5. // Copyright (C) Microsoft Corporation. All rights reserved. //
  6. //===========================================================================//
  7. //---------------------------------------------------------------------------------
  8. // Include Files
  9. #ifndef MCLIB_H
  10. #include "mclib.h"
  11. #endif
  12. #include "weaponfx.h"
  13. //---------------------------------------------------------------------------------
  14. // weapon FX Equivalancy. Stores names now for GOS FX
  15. WeaponEffects *weaponEffects = NULL;
  16. char mc2_word_none[5] = "NONE";
  17. //---------------------------------------------------------------------------------
  18. void WeaponEffects::destroy (void)
  19. {
  20. systemHeap->Free(effects);
  21. effects = NULL;
  22. numEffects = 0;
  23. }
  24. //---------------------------------------------------------------------------------
  25. void WeaponEffects::init (char *effectCSVFileName)
  26. {
  27. FullPathFileName effectsName;
  28. effectsName.init(objectPath,effectCSVFileName,".csv");
  29. CSVFile effectFile;
  30. long result = effectFile.open(effectsName);
  31. if (result != NO_ERR)
  32. STOP(("Unable to open Effects File %s",effectsName));
  33. numEffects = effectFile.getNumLines() - 1; //Always subtract one for the column headers
  34. effects = (EffectData *)systemHeap->Malloc(sizeof(EffectData) * numEffects);
  35. gosASSERT(effects != NULL);
  36. for (long i=0;i<numEffects;i++)
  37. {
  38. effectFile.readString(i+2,2,effects[i].effectName,49);
  39. effectFile.readString(i+2,3,effects[i].muzzleFlashName,49);
  40. effectFile.readString(i+2,4,effects[i].hitEffectName,49);
  41. effectFile.readString(i+2,6,effects[i].missEffectName,49);
  42. effectFile.readLong(i+2,5,effects[i].effectObjNum);
  43. }
  44. }
  45. //---------------------------------------------------------------------------------