NashGoreBlood.zc 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. // Copyright 2006-2019 Nash Muhandes
  2. // All rights reserved.
  3. //
  4. // Redistribution and use in source and binary forms, with or without
  5. // modification, are permitted provided that the following conditions
  6. // are met:
  7. //
  8. // 1. Redistributions of source code must retain the above copyright
  9. // notice, this list of conditions and the following disclaimer.
  10. // 2. Redistributions in binary form must reproduce the above copyright
  11. // notice, this list of conditions and the following disclaimer in the
  12. // documentation and/or other materials provided with the distribution.
  13. // 3. The name of the author may not be used to endorse or promote products
  14. // derived from this software without specific prior written permission.
  15. //
  16. // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  17. // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  18. // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  19. // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  20. // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  21. // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  22. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  23. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  25. // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. //===========================================================================
  27. //
  28. //
  29. //
  30. //===========================================================================
  31. class NashGoreBloodBase : Blood
  32. {
  33. Default
  34. {
  35. FloatBobPhase 0;
  36. +NOBLOCKMAP
  37. +PUFFGETSOWNER
  38. +FORCEXYBILLBOARD
  39. +RANDOMIZE
  40. +DONTSPLASH
  41. +NOTELEPORT
  42. -SOLID
  43. }
  44. const BLOOD_FLAGS = SXF_TRANSFERTRANSLATION | SXF_ABSOLUTEPOSITION | SXF_ABSOLUTEANGLE |
  45. SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION;
  46. //===========================================================================
  47. //
  48. //
  49. //
  50. //===========================================================================
  51. override void BeginPlay(void)
  52. {
  53. Super.BeginPlay();
  54. if (!level.IsPointInLevel(Pos))
  55. {
  56. Destroy();
  57. return;
  58. }
  59. NashGoreStatics.RandomXFlip(self);
  60. }
  61. override void PostBeginPlay(void)
  62. {
  63. if (random() < (255 - nashgore_bloodamount)) { Destroy(); return; }
  64. Super.PostBeginPlay();
  65. }
  66. }
  67. //===========================================================================
  68. //
  69. //
  70. //
  71. //===========================================================================
  72. class NashGoreBloodImpact : NashGoreBloodBase
  73. {
  74. Default
  75. {
  76. Scale 0.75;
  77. +NOINTERACTION
  78. +NOGRAVITY
  79. }
  80. override void PostBeginPlay(void)
  81. {
  82. Super.PostBeginPlay();
  83. NashGoreStatics.RandomXFlip(self);
  84. }
  85. States
  86. {
  87. Spawn:
  88. TNT1 A 0 NoDelay A_PlaySound("nashgore/bullethitflesh");
  89. BLIM ABCDE 3;
  90. Stop;
  91. }
  92. }
  93. //===========================================================================
  94. //
  95. //
  96. //
  97. //===========================================================================
  98. class NashGoreBlood : NashGoreBloodBase
  99. {
  100. Default
  101. {
  102. +NOGRAVITY
  103. -RANDOMIZE
  104. }
  105. int chanceMod;
  106. //===========================================================================
  107. //
  108. //
  109. //
  110. //===========================================================================
  111. States
  112. {
  113. Spawn:
  114. TNT1 A 0 { chanceMod = 0; return ResolveState("Spawn2"); }
  115. TNT1 A 0 { chanceMod = 100; return ResolveState("Spawn2"); }
  116. TNT1 A 0 { chanceMod = 220; return ResolveState("Spawn2"); }
  117. Spawn2:
  118. TNT1 A 0
  119. {
  120. A_SpawnItemEx("NashGoreBloodImpact", flags: BLOOD_FLAGS);
  121. for (int i = 0; i < 10; i++)
  122. {
  123. A_SpawnItemEx("NashGoreBloodParticle1",
  124. frandom(-8, 8), frandom(-8, 8), frandom(-8, 8),
  125. frandom(-2.0, 2.0), frandom(-2.0, 2.0), frandom(0.0, 4.0),
  126. frandom(0, 360), BLOOD_FLAGS | SXF_TRANSFERPOINTERS, chanceMod);
  127. }
  128. }
  129. TNT1 AAAAAAAAAA 1
  130. {
  131. A_SpawnItemEx("NashGoreBloodParticle2",
  132. frandom(-8, 8), frandom(-8, 8), frandom(-8, 8),
  133. frandom(-2.5, 2.5), frandom(-2.5, 2.5), frandom(1.0, 2.0),
  134. frandom(0, 360), BLOOD_FLAGS, chanceMod);
  135. }
  136. TNT1 AAAAAAAAAA 1
  137. {
  138. A_SpawnItemEx("NashGoreBloodFloorSplashSpawner",
  139. 0, 0, 0,
  140. frandom(-4.0, 4.0), frandom(-4.0, 4.0), frandom(1.0, 4.0),
  141. frandom(0, 360), BLOOD_FLAGS, chanceMod);
  142. }
  143. Stop;
  144. }
  145. }
  146. //===========================================================================
  147. //
  148. //
  149. //
  150. //===========================================================================
  151. class NashGoreBloodParticle1 : NashGoreBloodBase
  152. {
  153. Default
  154. {
  155. Scale 0.4;
  156. Gravity 0.3;
  157. +NOCLIP
  158. +CORPSE
  159. }
  160. int life;
  161. //===========================================================================
  162. //
  163. //
  164. //
  165. //===========================================================================
  166. override void Tick(void)
  167. {
  168. Super.Tick();
  169. if (!bNoTimeFreeze && (isFrozen() || Level.isFrozen())) return;
  170. life++;
  171. if (life == 10) A_SetRenderStyle(1, STYLE_Translucent);
  172. if (life > 10) Alpha *= 0.9;
  173. A_SetScale(Scale.X + 0.0075);
  174. if (life > 350)
  175. {
  176. Destroy();
  177. return;
  178. }
  179. if (waterlevel > 0 && waterlevel < 3)
  180. {
  181. SetZ(Pos.Z - Vel.Z);
  182. NashGoreLiquidBlood.SpawnLiquidBlood(self);
  183. Destroy();
  184. return;
  185. }
  186. }
  187. //===========================================================================
  188. //
  189. //
  190. //
  191. //===========================================================================
  192. States
  193. {
  194. Spawn:
  195. TNT1 A 1 NoDelay A_Jump(256, "Blood1", "Blood2", "Blood3", "Blood4", "Blood5", "Blood6");
  196. Stop;
  197. Blood1:
  198. NBL1 A -1;
  199. Stop;
  200. Blood2:
  201. NBL1 B -1;
  202. Stop;
  203. Blood3:
  204. NBL1 C -1;
  205. Stop;
  206. Blood4:
  207. NBL1 D -1;
  208. Stop;
  209. Blood5:
  210. NBL1 E -1;
  211. Stop;
  212. Blood6:
  213. NBL1 F -1;
  214. Stop;
  215. Crash:
  216. TNT1 A 1
  217. {
  218. if (random() < 50)
  219. {
  220. A_SpawnItemEx("NashGoreBloodSpot", flags: (BLOOD_FLAGS | SXF_TRANSFERPOINTERS) & ~SXF_NOCHECKPOSITION, 190);
  221. }
  222. else
  223. {
  224. A_SpawnItemEx("NashGoreBloodSpotSmall", flags: (BLOOD_FLAGS | SXF_TRANSFERPOINTERS) & ~SXF_NOCHECKPOSITION, 190);
  225. }
  226. }
  227. Stop;
  228. }
  229. }
  230. class NashGoreBloodParticle2 : NashGoreBloodBase
  231. {
  232. Default
  233. {
  234. Radius 1;
  235. Height 2;
  236. Gravity 0.18;
  237. +NOCLIP
  238. +NOBLOCKMAP
  239. +CORPSE
  240. }
  241. //===========================================================================
  242. //
  243. //
  244. //
  245. //===========================================================================
  246. States
  247. {
  248. Spawn:
  249. NBL2 ABCD 4;
  250. Stop;
  251. Crash:
  252. TNT1 A 1;
  253. Stop;
  254. }
  255. }
  256. //===========================================================================
  257. //
  258. //
  259. //
  260. //===========================================================================
  261. class NashGoreClassicBlood : NashGoreBloodBase
  262. {
  263. Default
  264. {
  265. -RANDOMIZE
  266. }
  267. //===========================================================================
  268. //
  269. //
  270. //
  271. //===========================================================================
  272. States
  273. {
  274. Spawn:
  275. TNT1 A 0 NoDelay
  276. {
  277. A_SpawnItemEx("NashGoreBloodImpact", flags: BLOOD_FLAGS);
  278. // This shit needs to be in the Spawn state for translations to work correctly. >8[
  279. A_SpawnItemEx("NashGoreClassicBloodTrailSpawner",
  280. xvel: frandom(-6, 6), frandom(-6, 6), frandom(0, 8),
  281. frandom(0.0, 360.0), SXF_TRANSFERTRANSLATION, 110);
  282. }
  283. Stop;
  284. }
  285. }
  286. class NashGoreClassicBloodTrailSpawner : NashGoreBloodBase
  287. {
  288. Default
  289. {
  290. Radius 8;
  291. Height 2;
  292. Gravity 0.235;
  293. +NOFRICTION
  294. +NOCLIP
  295. +CORPSE
  296. }
  297. const DECELERATION_SPEED = 0.963;
  298. //===========================================================================
  299. //
  300. //
  301. //
  302. //===========================================================================
  303. override void Tick(void)
  304. {
  305. Super.Tick();
  306. if (!bNoTimeFreeze && (isFrozen() || Level.isFrozen())) return;
  307. Vel.XY *= DECELERATION_SPEED;
  308. if (waterlevel >= 3)
  309. {
  310. A_FadeOut(0.07);
  311. }
  312. }
  313. //===========================================================================
  314. //
  315. //
  316. //
  317. //===========================================================================
  318. States
  319. {
  320. Spawn:
  321. TNT1 A 3
  322. {
  323. A_SpawnItemEx("NashGoreClassicBloodTrail", flags: SXF_TRANSFERTRANSLATION);
  324. }
  325. Loop;
  326. Crash:
  327. TNT1 A 0
  328. {
  329. A_PlaySound("nashgore/bloodsplash");
  330. A_SpawnItemEx("NashGoreBloodSpotClassic", flags: (BLOOD_FLAGS | SXF_TRANSFERPOINTERS) & ~SXF_NOCHECKPOSITION);
  331. }
  332. Stop;
  333. }
  334. }
  335. class NashGoreClassicBloodTrail : NashGoreBloodBase
  336. {
  337. Default
  338. {
  339. Radius 1;
  340. Height 1;
  341. Gravity 0.235;
  342. Scale 0.67;
  343. +CORPSE
  344. }
  345. //===========================================================================
  346. //
  347. //
  348. //
  349. //===========================================================================
  350. override void Tick(void)
  351. {
  352. Super.Tick();
  353. if (!bNoTimeFreeze && (isFrozen() || Level.isFrozen())) return;
  354. if (waterlevel > 0)
  355. {
  356. A_FadeOut(0.01);
  357. Vel.Z = -1;
  358. }
  359. }
  360. //===========================================================================
  361. //
  362. //
  363. //
  364. //===========================================================================
  365. States
  366. {
  367. Spawn:
  368. NTRL ABCD 4;
  369. Loop;
  370. Crash:
  371. TNT1 AAAAA 1
  372. {
  373. A_SpawnItemEx("NashGoreBloodFloorSplash",
  374. frandom(-32, 32), frandom(-32, 32),
  375. flags: SXF_TRANSFERTRANSLATION | SXF_ABSOLUTEPOSITION | SXF_NOCHECKPOSITION, 220);
  376. A_SpawnItemEx("NashGoreBloodSpotClassic",
  377. frandom(-32, 32), frandom(-32, 32),
  378. flags: (BLOOD_FLAGS | SXF_TRANSFERPOINTERS) & ~SXF_NOCHECKPOSITION, 254);
  379. }
  380. Stop;
  381. }
  382. }
  383. //===========================================================================
  384. //
  385. //
  386. //
  387. //===========================================================================
  388. class NashGoreBloodSpurtSpawner : Actor
  389. {
  390. Default
  391. {
  392. FloatBobPhase 0;
  393. +DONTSPLASH
  394. +NOTELEPORT
  395. +NOBLOCKMONST
  396. +NOBLOCKMAP
  397. +MOVEWITHSECTOR
  398. -SOLID
  399. }
  400. int life;
  401. int spurtInterval;
  402. int spurtDuration;
  403. //===========================================================================
  404. //
  405. //
  406. //
  407. //===========================================================================
  408. override void Tick(void)
  409. {
  410. Super.Tick();
  411. if (!bNoTimeFreeze && (isFrozen() || Level.isFrozen())) return;
  412. life++;
  413. if (spurtInterval == 0)
  414. {
  415. spurtInterval = random(10, 75);
  416. spurtDuration = random(5, 20);
  417. }
  418. else if (spurtInterval > 0)
  419. {
  420. spurtInterval--;
  421. }
  422. if (spurtDuration > 0)
  423. {
  424. A_SpawnItemEx("NashGoreBloodSpurt",
  425. frandom(-5, 5), frandom(-5, 5), frandom(15, 25),
  426. frandom(-2, 2), frandom(-2, 2), frandom(4, 8),
  427. frandom(0, 360),
  428. NashGoreBloodBase.BLOOD_FLAGS);
  429. spurtDuration--;
  430. }
  431. if (life >= 35 * 5)
  432. {
  433. Destroy();
  434. return;
  435. }
  436. }
  437. //===========================================================================
  438. //
  439. //
  440. //
  441. //===========================================================================
  442. States
  443. {
  444. Spawn:
  445. TNT1 A -1;
  446. Stop;
  447. }
  448. }
  449. class NashGoreBloodSpurt : NashGoreBloodBase
  450. {
  451. Default
  452. {
  453. Gravity 0.4326;
  454. +CORPSE
  455. }
  456. //===========================================================================
  457. //
  458. //
  459. //
  460. //===========================================================================
  461. override void BeginPlay(void)
  462. {
  463. Super.BeginPlay();
  464. Gravity *= frandom(1.0, 1.5);
  465. }
  466. override void Tick(void)
  467. {
  468. Super.Tick();
  469. if (!bNoTimeFreeze && (isFrozen() || Level.isFrozen())) return;
  470. if (waterlevel > 1)
  471. {
  472. NashGoreLiquidBlood.SpawnLiquidBlood(self);
  473. Destroy();
  474. return;
  475. }
  476. }
  477. //===========================================================================
  478. //
  479. //
  480. //
  481. //===========================================================================
  482. States
  483. {
  484. Spawn:
  485. NBL2 ABCD 5;
  486. Loop;
  487. Crash:
  488. TNT1 A 1
  489. {
  490. A_SpawnItemEx("NashGoreBloodFloorSplash",
  491. frandom(-32, 32), frandom(-32, 32),
  492. flags: SXF_TRANSFERTRANSLATION | SXF_ABSOLUTEPOSITION | SXF_NOCHECKPOSITION, 100);
  493. if (nashgore_bloodtype == 0 || nashgore_bloodtype == 1)
  494. {
  495. class<Actor> cls;
  496. if (nashgore_bloodtype == 0) cls = "NashGoreBloodSpot";
  497. else if (nashgore_bloodtype == 1) cls = "NashGoreBloodSpotClassic";
  498. A_SpawnItemEx(cls, flags: (BLOOD_FLAGS | SXF_TRANSFERPOINTERS) & ~SXF_NOCHECKPOSITION, 230);
  499. }
  500. }
  501. Stop;
  502. }
  503. }
  504. //===========================================================================
  505. //
  506. //
  507. //
  508. //===========================================================================
  509. class NashGoreBloodFloorSplashSpawner : Actor
  510. {
  511. Default
  512. {
  513. Radius 1;
  514. Height 1;
  515. Gravity 0.5;
  516. FloatBobPhase 0;
  517. +CORPSE
  518. +DONTSPLASH
  519. +NOTELEPORT
  520. +NOBLOCKMONST
  521. +NOBLOCKMAP
  522. -SOLID
  523. }
  524. //===========================================================================
  525. //
  526. //
  527. //
  528. //===========================================================================
  529. States
  530. {
  531. Spawn:
  532. TNT1 A -1;
  533. Stop;
  534. Crash:
  535. TNT1 A 0 A_SpawnItemEx("NashGoreBloodFloorSplash", flags: NashGoreBloodBase.BLOOD_FLAGS);
  536. Stop;
  537. }
  538. }
  539. class NashGoreBloodFloorSplash : NashGoreBloodBase
  540. {
  541. Default
  542. {
  543. Radius 1;
  544. Height 2;
  545. Scale 0.5;
  546. -NOBLOCKMAP
  547. -RANDOMIZE
  548. }
  549. //===========================================================================
  550. //
  551. //
  552. //
  553. //===========================================================================
  554. override void Tick(void)
  555. {
  556. Super.Tick();
  557. if (!bNoTimeFreeze && (isFrozen() || Level.isFrozen())) return;
  558. if (waterlevel > 1)
  559. {
  560. Destroy();
  561. return;
  562. }
  563. }
  564. //===========================================================================
  565. //
  566. //
  567. //
  568. //===========================================================================
  569. States
  570. {
  571. Spawn:
  572. BDRP BCDEF 4;
  573. Stop;
  574. }
  575. }
  576. //===========================================================================
  577. //
  578. //
  579. //
  580. //===========================================================================
  581. class NashGoreBloodDrop : NashGoreBloodBase
  582. {
  583. Default
  584. {
  585. Scale 0.35;
  586. +FORCEYBILLBOARD
  587. +CORPSE
  588. }
  589. //===========================================================================
  590. //
  591. //
  592. //
  593. //===========================================================================
  594. States
  595. {
  596. Spawn:
  597. BDRP A -1;
  598. Stop;
  599. Crash:
  600. TNT1 A 0
  601. {
  602. A_SpawnItemEx("NashGoreBloodFloorSplash", flags: BLOOD_FLAGS);
  603. if (random() < 180) A_PlaySound("nashgore/blooddrop");
  604. }
  605. Stop;
  606. }
  607. }