napalm.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  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. // napalm.cpp
  19. // Project: Postal
  20. //
  21. // This module implements the CNapalm weapon class which is a canister of
  22. // napalm gel that breaks apart when it hits the ground lays down a smear
  23. // of fire. The canister may be an alternate ordinate for the rocket launcher.
  24. //
  25. //
  26. // History:
  27. // 01/17/97 BRH Started this weapon object.
  28. //
  29. // 02/04/97 JMI Changed LoadDib() call to Load() (which now supports
  30. // loading of DIBs).
  31. //
  32. // 02/09/97 BRH Started the CNapalm from the CGrenade object since their
  33. // initial movement logic is similar.
  34. //
  35. // 02/10/97 JMI rspReleaseResource() now takes a ptr to a ptr.
  36. //
  37. // 02/18/97 BRH Added a time setting to the Fire with some randomness
  38. // to make it look better.
  39. //
  40. // 02/19/97 BRH Added message processing to check for ObjectDeleted
  41. // message.
  42. //
  43. // 02/19/97 BRH Changed this from 2D to 3D animation.
  44. //
  45. // 02/23/97 BRH Updated the transform with the angle so that the canister
  46. // faces the direction it is traveling. Also changed the
  47. // coordinate system to x,-z
  48. //
  49. // 02/23/97 BRH Added Preload() function to cache resources for this object
  50. // before play begins.
  51. //
  52. // 02/24/97 JMI No longer sets the m_type member of the m_sprite b/c it
  53. // is set by m_sprite's constructor.
  54. //
  55. // 02/24/97 BRH Changed fire to thin fire for more alpha effect since it
  56. // lays down many layers of fire. Also hides the napalm
  57. // canister by skipping the render when in the hidden state.
  58. //
  59. // 02/24/97 BRH Added sound effects for canister shooting, hitting things,
  60. // and when it breaks open. Used reality.h motion templates
  61. // and changed the algorithm for detecting ground and
  62. // walls.
  63. //
  64. // 03/03/97 BRH Derived this from the CWeapon base class.
  65. //
  66. // 03/03/97 JMI Commented out dHorizVelocity and dVertVelocity parameters
  67. // to Setup() so that this version would be a virtual over-
  68. // ride of CWeapon's.
  69. //
  70. // 03/06/97 JMI Upgraded to current rspMod360 usage.
  71. //
  72. // 03/13/97 JMI Load now takes a version number.
  73. //
  74. // 03/19/97 BRH Changed ProcessMessages to return a void so that it matches
  75. // the new virtual function in the CWeapon base class.
  76. //
  77. // 03/21/97 BRH Now ignores the ATTRIBUTE_NOT_WALKABLE so that the napalm
  78. // canisters don't bounce off of the edge of the world.
  79. //
  80. // 04/10/97 BRH Converted to using the new multi layer attribute maps and
  81. // the helper functions that go with them.
  82. //
  83. // 05/04/97 BRH Took out an old unused reference to an STL iterator.
  84. //
  85. // 05/29/97 JMI Removed ASSERT on m_pRealm->m_pAttribMap which no longer
  86. // exists.
  87. //
  88. // 06/11/97 BRH Added shooter ID passing to the fire that is created.
  89. //
  90. // 06/12/97 JMI Now handles State_Hide by setting m_sprite's InHidden flag.
  91. //
  92. // 06/16/97 BRH Fixed starting condition in not walkable area.
  93. //
  94. // 06/17/97 JMI Converted all occurrences of rand() to GetRand() and
  95. // srand() to SeedRand().
  96. //
  97. // 06/25/97 BRH Added use of base class 2D shadow on the ground, but loaded
  98. // a smaller shadow resource.
  99. //
  100. // 06/30/97 BRH Added sound effect cache to Preload function.
  101. //
  102. // 07/01/97 JMI Replaced GetFloorMapValue() with GetHeight() call.
  103. //
  104. // 07/09/97 JMI Now uses m_pRealm->Make2dResPath() to get the fullpath
  105. // for 2D image components.
  106. //
  107. // 07/09/97 JMI Changed Preload() to take a pointer to the calling realm
  108. // as a parameter.
  109. //
  110. // 07/18/97 JMI Got rid of bogus immitation PlaySample functions.
  111. // Now there is one PlaySample() function. Also, you now
  112. // MUST specify a category and you don't have to specify a
  113. // SoundInstance ptr to specify a volume.
  114. //
  115. // 07/30/97 JMI Same old delete error showed up on Alpha.
  116. // ProcessMessages() was deleting the napalm on a delete msg
  117. // but, once returned to Update(), it was checking the
  118. // m_eState member to see if it should return. Unfortunately,
  119. // since 'this' had already been deallocated, it was too late
  120. // to do such a thing.
  121. // Also, m_dFireX and m_dFireZ were uninitialized causing
  122. // floating point exceptions (due to bad values) on the Alpha.
  123. //
  124. // 08/05/97 JMI Changed priority to use Z position rather than 2D
  125. // projected Y position.
  126. //
  127. // 08/17/97 JMI Changed m_pthingParent to m_idParent.
  128. //
  129. // 08/27/97 BRH Added large fire sound which had not been used until now.
  130. //
  131. // 08/28/97 BRH Added cache of large fire sound.
  132. //
  133. ////////////////////////////////////////////////////////////////////////////////
  134. #define NAPALM_CPP
  135. #include "RSPiX.h"
  136. #include <math.h>
  137. #include "napalm.h"
  138. #include "dude.h"
  139. #include "fire.h"
  140. #include "SampleMaster.h"
  141. #include "game.h"
  142. #include "reality.h"
  143. ////////////////////////////////////////////////////////////////////////////////
  144. // Macros/types/etc.
  145. ////////////////////////////////////////////////////////////////////////////////
  146. #define SMALL_SHADOW_FILE "smallshadow.img"
  147. ////////////////////////////////////////////////////////////////////////////////
  148. // Variables/data
  149. ////////////////////////////////////////////////////////////////////////////////
  150. // These are default values -- actually values are set using the editor!
  151. double CNapalm::ms_dAccDrag = 300.0; // Acceleration due to drag
  152. double CNapalm::ms_dThrowVertVel = 30.0; // Throw up at this velocity
  153. double CNapalm::ms_dThrowHorizVel = 300; // Throw out at this velocity
  154. double CNapalm::ms_dMinFireInterval = 5*5;
  155. long CNapalm::ms_lGrenadeFuseTime = 1500; // Time from throw to blow
  156. // Let this auto-init to 0
  157. short CNapalm::ms_sFileCount;
  158. /// Napalm Canister Animation Files
  159. // An array of pointers to res names (one for each animation component)
  160. static char* ms_apszResNames[] =
  161. {
  162. "3d/napalmcan.sop",
  163. "3d/napalmcan.mesh",
  164. "3d/napalmcan.tex",
  165. "3d/napalmcan.hot",
  166. "3d/napalmcan.bounds",
  167. "3d/napalmcan.floor",
  168. NULL,
  169. NULL
  170. };
  171. ////////////////////////////////////////////////////////////////////////////////
  172. // Load object (should call base class version!)
  173. ////////////////////////////////////////////////////////////////////////////////
  174. short CNapalm::Load( // Returns 0 if successfull, non-zero otherwise
  175. RFile* pFile, // In: File to load from
  176. bool bEditMode, // In: True for edit mode, false otherwise
  177. short sFileCount, // In: File count (unique per file, never 0)
  178. ULONG ulFileVersion) // In: Version of file format to load.
  179. {
  180. short sResult = CWeapon::Load(pFile, bEditMode, sFileCount, ulFileVersion);
  181. if (sResult == SUCCESS)
  182. {
  183. // Load common data just once per file (not with each object)
  184. if (ms_sFileCount != sFileCount)
  185. {
  186. ms_sFileCount = sFileCount;
  187. // Load static data
  188. switch (ulFileVersion)
  189. {
  190. default:
  191. case 1:
  192. pFile->Read(&ms_dAccDrag);
  193. pFile->Read(&ms_dThrowVertVel);
  194. pFile->Read(&ms_dThrowHorizVel);
  195. pFile->Read(&ms_dMinFireInterval);
  196. pFile->Read(&ms_lGrenadeFuseTime);
  197. break;
  198. }
  199. }
  200. // Load object data
  201. switch (ulFileVersion)
  202. {
  203. default:
  204. case 1:
  205. break;
  206. }
  207. // Make sure there were no file errors or format errors . . .
  208. if (!pFile->Error() && sResult == 0)
  209. {
  210. // Get resources
  211. sResult = GetResources();
  212. }
  213. else
  214. {
  215. sResult = -1;
  216. TRACE("CNapalm::Load(): Error reading from file!\n");
  217. }
  218. }
  219. return sResult;
  220. }
  221. ////////////////////////////////////////////////////////////////////////////////
  222. // Save object (should call base class version!)
  223. ////////////////////////////////////////////////////////////////////////////////
  224. short CNapalm::Save( // Returns 0 if successfull, non-zero otherwise
  225. RFile* pFile, // In: File to save to
  226. short sFileCount) // In: File count (unique per file, never 0)
  227. {
  228. CWeapon::Save(pFile, sFileCount);
  229. // Save common data just once per file (not with each object)
  230. if (ms_sFileCount != sFileCount)
  231. {
  232. ms_sFileCount = sFileCount;
  233. // Save static data
  234. pFile->Write(&ms_dAccDrag);
  235. pFile->Write(&ms_dThrowVertVel);
  236. pFile->Write(&ms_dThrowHorizVel);
  237. pFile->Write(&ms_dMinFireInterval);
  238. pFile->Write(&ms_lGrenadeFuseTime);
  239. }
  240. // Save object data
  241. return 0;
  242. }
  243. ////////////////////////////////////////////////////////////////////////////////
  244. // Update object
  245. ////////////////////////////////////////////////////////////////////////////////
  246. void CNapalm::Update(void)
  247. {
  248. short sHeight;
  249. double dNewX;
  250. double dNewY;
  251. double dNewZ;
  252. double dX;
  253. double dZ;
  254. double dDistance;
  255. if (!m_sSuspend)
  256. {
  257. // Get new time
  258. long lThisTime = m_pRealm->m_time.GetGameTime();
  259. // If elapsed time is too short, skip this update.
  260. // Calculate elapsed time in seconds
  261. double dSeconds = (double)(lThisTime - m_lPrevTime) / 1000.0;
  262. ProcessMessages();
  263. if (m_eState == State_Deleted)
  264. {
  265. delete this;
  266. // Must return now, now to avoid accessing through deallocated
  267. // 'this'.
  268. return;
  269. }
  270. // Check the current state
  271. switch (m_eState)
  272. {
  273. case CWeapon::State_Idle:
  274. break;
  275. case CWeapon::State_Fire:
  276. // Make sure it starts in a valid location. If it is inside
  277. // a wall, delete it now.
  278. sHeight = m_pRealm->GetHeight((short) m_dX, (short) m_dZ);
  279. if (m_dY < sHeight)
  280. {
  281. delete this;
  282. return;
  283. }
  284. m_eState = State_Go;
  285. m_lTimer = lThisTime + ms_lGrenadeFuseTime;
  286. PlaySample(
  287. g_smidNapalmShot,
  288. SampleMaster::Weapon,
  289. DistanceToVolume(m_dX, m_dY, m_dZ, LaunchSndHalfLife) ); // In: Initial Sound Volume (0 - 255)
  290. break;
  291. //-----------------------------------------------------------------------
  292. // Go - fly through the air until hit the ground, change directions on
  293. // obstacle collision.
  294. //-----------------------------------------------------------------------
  295. case CWeapon::State_Go:
  296. // Do horizontal velocity
  297. dNewX = m_dX + COSQ[(short)m_dRot] * (m_dHorizVel * dSeconds);
  298. dNewZ = m_dZ - SINQ[(short)m_dRot] * (m_dHorizVel * dSeconds);
  299. // Do vertical velocity
  300. dNewY = m_dY;
  301. AdjustPosVel(&dNewY, &m_dVertVel, dSeconds);
  302. // Check the height to see if it hit the ground
  303. sHeight = m_pRealm->GetHeight((short) dNewX, (short) dNewZ);
  304. // If its lower than the last and current height, assume it
  305. // hit the ground.
  306. if (dNewY < sHeight && m_dY >= sHeight)
  307. {
  308. m_dY = sHeight;
  309. m_eState = CWeapon::State_Slide;
  310. PlaySample(
  311. g_smidNapalmFire,
  312. SampleMaster::Destruction,
  313. DistanceToVolume(m_dX, m_dY, m_dZ, NapalmSndHalfLife) ); // In: Initial Sound Volume (0 - 255)
  314. PlaySample(
  315. g_smidFireLarge,
  316. SampleMaster::Destruction,
  317. DistanceToVolume(m_dX, m_dY, m_dZ, NapalmSndHalfLife) );
  318. }
  319. else
  320. {
  321. // If it is above the last known ground and is now lower
  322. // than the height at its new position, assume it hit
  323. // a wall and should bounce.
  324. if (dNewY < sHeight && m_dY < sHeight)
  325. {
  326. dNewX = m_dX; // Restore last x position
  327. dNewZ = m_dZ; // Restore last z position
  328. m_dRot = BounceAngle(m_dRot); // Change directions
  329. PlaySample(
  330. g_smidNapalmHit,
  331. SampleMaster::Weapon,
  332. DistanceToVolume(m_dX, m_dY, m_dZ, SideEffectSndHalfLife) ); // In: Initial Sound Volume (0 - 255)
  333. }
  334. else
  335. m_dY = dNewY;
  336. }
  337. m_dX = dNewX;
  338. m_dZ = dNewZ;
  339. break;
  340. //-----------------------------------------------------------------------
  341. // Slide - Once it hits the ground, slide until it stops.
  342. //-----------------------------------------------------------------------
  343. case CWeapon::State_Slide:
  344. // As the Napalm canister slides on the ground, it lays
  345. // down fire at intervals. Check the interval to see
  346. // it its time to creat a new fire yet.
  347. dX = m_dX - m_dFireX;
  348. dZ = m_dZ - m_dFireZ;
  349. dDistance = (dX*dX) + (dZ*dZ);
  350. if (dDistance > ms_dMinFireInterval)
  351. {
  352. m_dFireX = m_dX;
  353. m_dFireZ = m_dZ;
  354. // Start a fire here
  355. CFire* pFire;
  356. if (CThing::Construct(CThing::CFireID, m_pRealm, (CThing**) &pFire) == 0)
  357. {
  358. if (pFire->Setup(m_dX - 20 + (GetRand() % 40), m_dY, m_dZ - 20 + (GetRand() % 40),
  359. 4000 + (GetRand() % 9000), false, CFire::LargeFire) != SUCCESS)
  360. delete pFire;
  361. else
  362. pFire->m_u16ShooterID = m_u16ShooterID;
  363. }
  364. }
  365. // Ground causes drag
  366. // Decelerate to zero. When you reach zero, go
  367. // to find state.
  368. if (m_dHorizVel > 0)
  369. {
  370. AdjustVel(&m_dHorizVel, dSeconds, -ms_dAccDrag);
  371. if (m_dHorizVel < 0)
  372. m_dHorizVel = 0;
  373. }
  374. else if (m_dHorizVel < 0)
  375. {
  376. AdjustVel(&m_dHorizVel, dSeconds, ms_dAccDrag);
  377. m_dHorizVel = 0;
  378. }
  379. // If it has stopped, then change to find state
  380. if (m_dHorizVel == 0)
  381. m_eState = CWeapon::State_Explode;
  382. dNewX = m_dX + COSQ[(short)m_dRot] * (m_dHorizVel * dSeconds);
  383. dNewZ = m_dZ - SINQ[(short)m_dRot] * (m_dHorizVel * dSeconds);
  384. // Check for obstacles
  385. sHeight = m_pRealm->GetHeight((short) dNewX, (short) dNewZ);
  386. // If it hit any obstacles, make it bounce off
  387. if (sHeight > m_dY)
  388. {
  389. // Restore previous position
  390. dNewX = m_dX;
  391. dNewZ = m_dZ;
  392. // Change directions
  393. m_dRot = BounceAngle(m_dRot);
  394. PlaySample(
  395. g_smidNapalmHit,
  396. SampleMaster::Weapon,
  397. DistanceToVolume(m_dX, m_dY, m_dZ, SideEffectSndHalfLife) ); // In: Initial Sound Volume (0 - 255)
  398. }
  399. // See if it fell off of something. If so make it go back
  400. // to the airborne state
  401. if (sHeight < (short) m_dY)
  402. {
  403. m_dVertVel = 0;
  404. m_eState = State_Go;
  405. }
  406. m_dX = dNewX;
  407. m_dZ = dNewZ;
  408. break;
  409. //-----------------------------------------------------------------------
  410. // Explode
  411. //-----------------------------------------------------------------------
  412. case CWeapon::State_Explode:
  413. delete this;
  414. return;
  415. break;
  416. }
  417. // Save time for next time
  418. m_lPrevTime = lThisTime;
  419. }
  420. }
  421. ////////////////////////////////////////////////////////////////////////////////
  422. // Render object
  423. ////////////////////////////////////////////////////////////////////////////////
  424. void CNapalm::Render(void)
  425. {
  426. long lThisTime = m_pRealm->m_time.GetGameTime();
  427. m_sprite.m_pmesh = (RMesh*) m_anim.m_pmeshes->GetAtTime(lThisTime);
  428. m_sprite.m_psop = (RSop*) m_anim.m_psops->GetAtTime(lThisTime);
  429. m_sprite.m_ptex = (RTexture*) m_anim.m_ptextures->GetAtTime(lThisTime);
  430. m_sprite.m_psphere = (RP3d*) m_anim.m_pbounds->GetAtTime(lThisTime);
  431. // Eventually this should be channel driven also
  432. m_sprite.m_sRadius = m_sCurRadius;
  433. // Reset rotation so it is not cumulative
  434. m_trans.Make1();
  435. // Set its pointing direction
  436. m_trans.Ry(rspMod360(m_dRot));
  437. if (m_eState == State_Hide)
  438. {
  439. // Hide.
  440. m_sprite.m_sInFlags = CSprite::InHidden;
  441. }
  442. else
  443. {
  444. // No special flags
  445. m_sprite.m_sInFlags = 0;
  446. }
  447. // If we're not a child of someone else...
  448. if (m_idParent == CIdBank::IdNil)
  449. {
  450. // Map from 3d to 2d coords
  451. Map3Dto2D((short) m_dX, (short) m_dY, (short) m_dZ, &m_sprite.m_sX2, &m_sprite.m_sY2);
  452. // Priority is based on bottom edge of sprite
  453. m_sprite.m_sPriority = m_dZ;
  454. // Layer should be based on info we get from attribute map
  455. m_sprite.m_sLayer = CRealm::GetLayerViaAttrib(m_pRealm->GetLayer((short) m_dX, (short) m_dZ));
  456. m_sprite.m_ptrans = &m_trans;
  457. // Update sprite in scene
  458. m_pRealm->m_scene.UpdateSprite(&m_sprite);
  459. // Render the 2D shadow sprite
  460. CWeapon::Render();
  461. }
  462. else
  463. {
  464. // m_idParent is setting our transform relative to its position
  465. // and we are drawn by the scene with the parent.
  466. }
  467. }
  468. ////////////////////////////////////////////////////////////////////////////////
  469. // Setup new object - called by object that created this object
  470. ////////////////////////////////////////////////////////////////////////////////
  471. short CNapalm::Setup( // Returns 0 if successfull, non-zero otherwise
  472. short sX, // In: New x coord
  473. short sY, // In: New y coord
  474. short sZ/*, // In: New z coord
  475. double dHorizVel, // In: Starting Horizontal Velocity (has default)
  476. double dVertVel*/) // In: Starting Vertical Velocity (has default)
  477. {
  478. short sResult = 0;
  479. // Use specified position
  480. m_dX = (double)sX;
  481. m_dY = (double)sY;
  482. m_dZ = (double)sZ;
  483. m_dHorizVel = ms_dThrowHorizVel;//dHorizVelocity;
  484. m_dVertVel = ms_dThrowVertVel;//dVertVelocity;
  485. // Default these to the start position so that, when we first enter
  486. // the slide state, we'll create some fire right away.
  487. m_dFireX = m_dX;
  488. m_dFireZ = m_dZ;
  489. // Load resources
  490. sResult = GetResources();
  491. // Enable the 2D shadow
  492. PrepareShadow();
  493. m_sCurRadius = 10;
  494. return sResult;
  495. }
  496. ////////////////////////////////////////////////////////////////////////////////
  497. // Get all required resources
  498. ////////////////////////////////////////////////////////////////////////////////
  499. short CNapalm::GetResources(void) // Returns 0 if successfull, non-zero otherwise
  500. {
  501. short sResult = 0;
  502. sResult = m_anim.Get(ms_apszResNames);
  503. if (sResult == 0)
  504. {
  505. sResult = rspGetResource(&g_resmgrGame, m_pRealm->Make2dResPath(SMALL_SHADOW_FILE), &(m_spriteShadow.m_pImage), RFile::LittleEndian);
  506. if (sResult == 0)
  507. {
  508. // add more gets
  509. }
  510. else
  511. {
  512. TRACE("CGrenade::GetResources - Failed to open 2D shadow image\n");
  513. }
  514. }
  515. else
  516. {
  517. TRACE("CNapalm::GetResources - Failed to open 3D animation for napalm\n");
  518. }
  519. return sResult;
  520. }
  521. ////////////////////////////////////////////////////////////////////////////////
  522. // Free all resources
  523. ////////////////////////////////////////////////////////////////////////////////
  524. short CNapalm::FreeResources(void) // Returns 0 if successfull, non-zero otherwise
  525. {
  526. m_anim.Release();
  527. return 0;
  528. }
  529. ////////////////////////////////////////////////////////////////////////////////
  530. // Preload - basically trick the resource manager into caching resources
  531. // for this object so there won't be a delay the first time it is
  532. // created.
  533. ////////////////////////////////////////////////////////////////////////////////
  534. short CNapalm::Preload(
  535. CRealm* prealm) // In: Calling realm.
  536. {
  537. CAnim3D anim;
  538. RImage* pimage;
  539. short sResult = anim.Get(ms_apszResNames);
  540. anim.Release();
  541. rspGetResource(&g_resmgrGame, prealm->Make2dResPath(SMALL_SHADOW_FILE), &pimage, RFile::LittleEndian);
  542. rspReleaseResource(&g_resmgrGame, &pimage);
  543. CacheSample(g_smidNapalmShot);
  544. CacheSample(g_smidNapalmHit);
  545. CacheSample(g_smidNapalmFire);
  546. CacheSample(g_smidFireLarge);
  547. return sResult;
  548. }
  549. ////////////////////////////////////////////////////////////////////////////////
  550. // ProcessMessages
  551. ////////////////////////////////////////////////////////////////////////////////
  552. void CNapalm::ProcessMessages(void)
  553. {
  554. GameMessage msg;
  555. if (m_MessageQueue.DeQ(&msg) == true)
  556. {
  557. switch(msg.msg_Generic.eType)
  558. {
  559. case typeObjectDelete:
  560. m_MessageQueue.Empty();
  561. m_eState = State_Deleted;
  562. return;
  563. break;
  564. }
  565. }
  566. // Dump the rest of the messages
  567. m_MessageQueue.Empty();
  568. return;
  569. }
  570. ////////////////////////////////////////////////////////////////////////////////
  571. // EOF
  572. ////////////////////////////////////////////////////////////////////////////////