NashGoreIceChunk.zc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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 NashGoreIceChunk : IceChunk
  32. {
  33. Default
  34. {
  35. Radius 5;
  36. Height 10;
  37. BounceType 'Doom';
  38. BounceFactor 0.545;
  39. Gravity 0.784;
  40. +ROLLSPRITE
  41. +ROLLCENTER
  42. +MISSILE
  43. +NOTELEPORT
  44. +FLOORCLIP
  45. +FORCEXYBILLBOARD
  46. }
  47. int rollDir;
  48. double rollSpeed;
  49. //===========================================================================
  50. //
  51. //
  52. //
  53. //===========================================================================
  54. override void BeginPlay(void)
  55. {
  56. ChangeStatNum(STAT_NashGore_Gore);
  57. NashGoreStatics.QueueGore();
  58. NashGoreStatics.RandomXFlip(self);
  59. rollDir = RandomPick(-1, 1);
  60. rollSpeed = frandom(1.0, 5.0);
  61. Gravity *= frandom(0.75, 1.0);
  62. bouncefactor *= frandom(0.5, 1.0);
  63. Super.BeginPlay();
  64. }
  65. override void Tick(void)
  66. {
  67. Super.Tick();
  68. if (!bNoTimeFreeze && (isFrozen() || Level.isFrozen())) return;
  69. state DeathState = FindState('Death');
  70. if (!InStateSequence(CurState, DeathState))
  71. {
  72. A_SetRoll(Roll + (rollSpeed * rollDir), SPF_INTERPOLATE);
  73. }
  74. if (Vel ~== (0, 0, 0))
  75. {
  76. A_SetRoll(0);
  77. }
  78. if (Vel.Z ~== 0 && (Vel.X > 0 || Vel.Y > 0))
  79. {
  80. Destroy();
  81. return;
  82. }
  83. }
  84. //===========================================================================
  85. //
  86. //
  87. //
  88. //===========================================================================
  89. States
  90. {
  91. Spawn:
  92. TNT1 A 0 NoDelay A_Jump(256, "Ice1", "Ice2", "Ice3", "Ice4");
  93. Stop;
  94. Ice1:
  95. ICEN A 0;
  96. Goto SpawnLoop;
  97. Ice2:
  98. ICEN B 0;
  99. Goto SpawnLoop;
  100. Ice3:
  101. ICEN C 0;
  102. Goto SpawnLoop;
  103. Ice4:
  104. ICEN D 0;
  105. Goto SpawnLoop;
  106. SpawnLoop:
  107. // yo, idk why the fucc this needs at least 3 states
  108. // otherwise the damn game just crashes wtf
  109. "####" "###" -1;
  110. Stop;
  111. Death:
  112. "####" "#" -1;
  113. Stop;
  114. }
  115. }