123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695 |
- // Copyright 2006-2019 Nash Muhandes
- // All rights reserved.
- //
- // Redistribution and use in source and binary forms, with or without
- // modification, are permitted provided that the following conditions
- // are met:
- //
- // 1. Redistributions of source code must retain the above copyright
- // notice, this list of conditions and the following disclaimer.
- // 2. Redistributions in binary form must reproduce the above copyright
- // notice, this list of conditions and the following disclaimer in the
- // documentation and/or other materials provided with the distribution.
- // 3. The name of the author may not be used to endorse or promote products
- // derived from this software without specific prior written permission.
- //
- // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- //===========================================================================
- //
- //
- //
- //===========================================================================
- class NashGoreBloodBase : Blood
- {
- Default
- {
- FloatBobPhase 0;
- +NOBLOCKMAP
- +PUFFGETSOWNER
- +FORCEXYBILLBOARD
- +RANDOMIZE
- +DONTSPLASH
- +NOTELEPORT
- -SOLID
- }
- const BLOOD_FLAGS = SXF_TRANSFERTRANSLATION | SXF_ABSOLUTEPOSITION | SXF_ABSOLUTEANGLE |
- SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION;
- //===========================================================================
- //
- //
- //
- //===========================================================================
- override void BeginPlay(void)
- {
- Super.BeginPlay();
- if (!level.IsPointInLevel(Pos))
- {
- Destroy();
- return;
- }
- NashGoreStatics.RandomXFlip(self);
- }
- override void PostBeginPlay(void)
- {
- if (random() < (255 - nashgore_bloodamount)) { Destroy(); return; }
- Super.PostBeginPlay();
- }
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- class NashGoreBloodImpact : NashGoreBloodBase
- {
- Default
- {
- Scale 0.75;
- +NOINTERACTION
- +NOGRAVITY
- }
- override void PostBeginPlay(void)
- {
- Super.PostBeginPlay();
- NashGoreStatics.RandomXFlip(self);
- }
- States
- {
- Spawn:
- TNT1 A 0 NoDelay A_PlaySound("nashgore/bullethitflesh");
- BLIM ABCDE 3;
- Stop;
- }
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- class NashGoreBlood : NashGoreBloodBase
- {
- Default
- {
- +NOGRAVITY
- -RANDOMIZE
- }
- int chanceMod;
- //===========================================================================
- //
- //
- //
- //===========================================================================
- States
- {
- Spawn:
- TNT1 A 0 { chanceMod = 0; return ResolveState("Spawn2"); }
- TNT1 A 0 { chanceMod = 100; return ResolveState("Spawn2"); }
- TNT1 A 0 { chanceMod = 220; return ResolveState("Spawn2"); }
- Spawn2:
- TNT1 A 0
- {
- A_SpawnItemEx("NashGoreBloodImpact", flags: BLOOD_FLAGS);
- for (int i = 0; i < 10; i++)
- {
- A_SpawnItemEx("NashGoreBloodParticle1",
- frandom(-8, 8), frandom(-8, 8), frandom(-8, 8),
- frandom(-2.0, 2.0), frandom(-2.0, 2.0), frandom(0.0, 4.0),
- frandom(0, 360), BLOOD_FLAGS | SXF_TRANSFERPOINTERS, chanceMod);
- }
- }
- TNT1 AAAAAAAAAA 1
- {
- A_SpawnItemEx("NashGoreBloodParticle2",
- frandom(-8, 8), frandom(-8, 8), frandom(-8, 8),
- frandom(-2.5, 2.5), frandom(-2.5, 2.5), frandom(1.0, 2.0),
- frandom(0, 360), BLOOD_FLAGS, chanceMod);
- }
- TNT1 AAAAAAAAAA 1
- {
- A_SpawnItemEx("NashGoreBloodFloorSplashSpawner",
- 0, 0, 0,
- frandom(-4.0, 4.0), frandom(-4.0, 4.0), frandom(1.0, 4.0),
- frandom(0, 360), BLOOD_FLAGS, chanceMod);
- }
- Stop;
- }
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- class NashGoreBloodParticle1 : NashGoreBloodBase
- {
- Default
- {
- Scale 0.4;
- Gravity 0.3;
- +NOCLIP
- +CORPSE
- }
- int life;
- //===========================================================================
- //
- //
- //
- //===========================================================================
- override void Tick(void)
- {
- Super.Tick();
- if (!bNoTimeFreeze && (isFrozen() || Level.isFrozen())) return;
- life++;
- if (life == 10) A_SetRenderStyle(1, STYLE_Translucent);
- if (life > 10) Alpha *= 0.9;
- A_SetScale(Scale.X + 0.0075);
- if (life > 350)
- {
- Destroy();
- return;
- }
- if (waterlevel > 0 && waterlevel < 3)
- {
- SetZ(Pos.Z - Vel.Z);
- NashGoreLiquidBlood.SpawnLiquidBlood(self);
- Destroy();
- return;
- }
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- States
- {
- Spawn:
- TNT1 A 1 NoDelay A_Jump(256, "Blood1", "Blood2", "Blood3", "Blood4", "Blood5", "Blood6");
- Stop;
- Blood1:
- NBL1 A -1;
- Stop;
- Blood2:
- NBL1 B -1;
- Stop;
- Blood3:
- NBL1 C -1;
- Stop;
- Blood4:
- NBL1 D -1;
- Stop;
- Blood5:
- NBL1 E -1;
- Stop;
- Blood6:
- NBL1 F -1;
- Stop;
- Crash:
- TNT1 A 1
- {
- if (random() < 50)
- {
- A_SpawnItemEx("NashGoreBloodSpot", flags: (BLOOD_FLAGS | SXF_TRANSFERPOINTERS) & ~SXF_NOCHECKPOSITION, 190);
- }
- else
- {
- A_SpawnItemEx("NashGoreBloodSpotSmall", flags: (BLOOD_FLAGS | SXF_TRANSFERPOINTERS) & ~SXF_NOCHECKPOSITION, 190);
- }
- }
- Stop;
- }
- }
- class NashGoreBloodParticle2 : NashGoreBloodBase
- {
- Default
- {
- Radius 1;
- Height 2;
- Gravity 0.18;
- +NOCLIP
- +NOBLOCKMAP
- +CORPSE
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- States
- {
- Spawn:
- NBL2 ABCD 4;
- Stop;
- Crash:
- TNT1 A 1;
- Stop;
- }
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- class NashGoreClassicBlood : NashGoreBloodBase
- {
- Default
- {
- -RANDOMIZE
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- States
- {
- Spawn:
- TNT1 A 0 NoDelay
- {
- A_SpawnItemEx("NashGoreBloodImpact", flags: BLOOD_FLAGS);
- // This shit needs to be in the Spawn state for translations to work correctly. >8[
- A_SpawnItemEx("NashGoreClassicBloodTrailSpawner",
- xvel: frandom(-6, 6), frandom(-6, 6), frandom(0, 8),
- frandom(0.0, 360.0), SXF_TRANSFERTRANSLATION, 110);
- }
- Stop;
- }
- }
- class NashGoreClassicBloodTrailSpawner : NashGoreBloodBase
- {
- Default
- {
- Radius 8;
- Height 2;
- Gravity 0.235;
- +NOFRICTION
- +NOCLIP
- +CORPSE
- }
- const DECELERATION_SPEED = 0.963;
- //===========================================================================
- //
- //
- //
- //===========================================================================
- override void Tick(void)
- {
- Super.Tick();
- if (!bNoTimeFreeze && (isFrozen() || Level.isFrozen())) return;
- Vel.XY *= DECELERATION_SPEED;
- if (waterlevel >= 3)
- {
- A_FadeOut(0.07);
- }
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- States
- {
- Spawn:
- TNT1 A 3
- {
- A_SpawnItemEx("NashGoreClassicBloodTrail", flags: SXF_TRANSFERTRANSLATION);
- }
- Loop;
- Crash:
- TNT1 A 0
- {
- A_PlaySound("nashgore/bloodsplash");
- A_SpawnItemEx("NashGoreBloodSpotClassic", flags: (BLOOD_FLAGS | SXF_TRANSFERPOINTERS) & ~SXF_NOCHECKPOSITION);
- }
- Stop;
- }
- }
- class NashGoreClassicBloodTrail : NashGoreBloodBase
- {
- Default
- {
- Radius 1;
- Height 1;
- Gravity 0.235;
- Scale 0.67;
- +CORPSE
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- override void Tick(void)
- {
- Super.Tick();
- if (!bNoTimeFreeze && (isFrozen() || Level.isFrozen())) return;
- if (waterlevel > 0)
- {
- A_FadeOut(0.01);
- Vel.Z = -1;
- }
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- States
- {
- Spawn:
- NTRL ABCD 4;
- Loop;
- Crash:
- TNT1 AAAAA 1
- {
- A_SpawnItemEx("NashGoreBloodFloorSplash",
- frandom(-32, 32), frandom(-32, 32),
- flags: SXF_TRANSFERTRANSLATION | SXF_ABSOLUTEPOSITION | SXF_NOCHECKPOSITION, 220);
- A_SpawnItemEx("NashGoreBloodSpotClassic",
- frandom(-32, 32), frandom(-32, 32),
- flags: (BLOOD_FLAGS | SXF_TRANSFERPOINTERS) & ~SXF_NOCHECKPOSITION, 254);
- }
- Stop;
- }
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- class NashGoreBloodSpurtSpawner : Actor
- {
- Default
- {
- FloatBobPhase 0;
- +DONTSPLASH
- +NOTELEPORT
- +NOBLOCKMONST
- +NOBLOCKMAP
- +MOVEWITHSECTOR
- -SOLID
- }
- int life;
- int spurtInterval;
- int spurtDuration;
- //===========================================================================
- //
- //
- //
- //===========================================================================
- override void Tick(void)
- {
- Super.Tick();
- if (!bNoTimeFreeze && (isFrozen() || Level.isFrozen())) return;
- life++;
- if (spurtInterval == 0)
- {
- spurtInterval = random(10, 75);
- spurtDuration = random(5, 20);
- }
- else if (spurtInterval > 0)
- {
- spurtInterval--;
- }
- if (spurtDuration > 0)
- {
- A_SpawnItemEx("NashGoreBloodSpurt",
- frandom(-5, 5), frandom(-5, 5), frandom(15, 25),
- frandom(-2, 2), frandom(-2, 2), frandom(4, 8),
- frandom(0, 360),
- NashGoreBloodBase.BLOOD_FLAGS);
- spurtDuration--;
- }
- if (life >= 35 * 5)
- {
- Destroy();
- return;
- }
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- States
- {
- Spawn:
- TNT1 A -1;
- Stop;
- }
- }
- class NashGoreBloodSpurt : NashGoreBloodBase
- {
- Default
- {
- Gravity 0.4326;
- +CORPSE
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- override void BeginPlay(void)
- {
- Super.BeginPlay();
- Gravity *= frandom(1.0, 1.5);
- }
- override void Tick(void)
- {
- Super.Tick();
- if (!bNoTimeFreeze && (isFrozen() || Level.isFrozen())) return;
- if (waterlevel > 1)
- {
- NashGoreLiquidBlood.SpawnLiquidBlood(self);
- Destroy();
- return;
- }
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- States
- {
- Spawn:
- NBL2 ABCD 5;
- Loop;
- Crash:
- TNT1 A 1
- {
- A_SpawnItemEx("NashGoreBloodFloorSplash",
- frandom(-32, 32), frandom(-32, 32),
- flags: SXF_TRANSFERTRANSLATION | SXF_ABSOLUTEPOSITION | SXF_NOCHECKPOSITION, 100);
- if (nashgore_bloodtype == 0 || nashgore_bloodtype == 1)
- {
- class<Actor> cls;
- if (nashgore_bloodtype == 0) cls = "NashGoreBloodSpot";
- else if (nashgore_bloodtype == 1) cls = "NashGoreBloodSpotClassic";
- A_SpawnItemEx(cls, flags: (BLOOD_FLAGS | SXF_TRANSFERPOINTERS) & ~SXF_NOCHECKPOSITION, 230);
- }
- }
- Stop;
- }
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- class NashGoreBloodFloorSplashSpawner : Actor
- {
- Default
- {
- Radius 1;
- Height 1;
- Gravity 0.5;
- FloatBobPhase 0;
- +CORPSE
- +DONTSPLASH
- +NOTELEPORT
- +NOBLOCKMONST
- +NOBLOCKMAP
- -SOLID
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- States
- {
- Spawn:
- TNT1 A -1;
- Stop;
- Crash:
- TNT1 A 0 A_SpawnItemEx("NashGoreBloodFloorSplash", flags: NashGoreBloodBase.BLOOD_FLAGS);
- Stop;
- }
- }
- class NashGoreBloodFloorSplash : NashGoreBloodBase
- {
- Default
- {
- Radius 1;
- Height 2;
- Scale 0.5;
- -NOBLOCKMAP
- -RANDOMIZE
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- override void Tick(void)
- {
- Super.Tick();
- if (!bNoTimeFreeze && (isFrozen() || Level.isFrozen())) return;
- if (waterlevel > 1)
- {
- Destroy();
- return;
- }
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- States
- {
- Spawn:
- BDRP BCDEF 4;
- Stop;
- }
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- class NashGoreBloodDrop : NashGoreBloodBase
- {
- Default
- {
- Scale 0.35;
- +FORCEYBILLBOARD
- +CORPSE
- }
- //===========================================================================
- //
- //
- //
- //===========================================================================
- States
- {
- Spawn:
- BDRP A -1;
- Stop;
- Crash:
- TNT1 A 0
- {
- A_SpawnItemEx("NashGoreBloodFloorSplash", flags: BLOOD_FLAGS);
- if (random() < 180) A_PlaySound("nashgore/blooddrop");
- }
- Stop;
- }
- }
|