Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Mostly working but still causing some hardcrashes, figure out why
- class BabelBFG9000 : BFG9000 Replaces BFG9000
- {
- default
- {
- Weapon.SelectionOrder 500;
- Weapon.BobSpeed 2.75;
- Weapon.BobRangeX 0.25;
- Weapon.BobRangeY 0.4;
- Weapon.BobStyle "Alpha";
- }
- action void A_NewBFG()
- {
- let p = players[consoleplayer].mo;
- MiniBFGBallTargetCoordinator m = MiniBFGBallTargetCoordinator.Create();
- for(int i = 0; i < 40; i++)
- {
- m.AddBall(MiniBFGBall(
- p.Spawn("MiniBFGBall",
- (
- p.pos.x,// + frandom(3, -3),
- p.pos.y,// + frandom(3, -3),
- p.pos.z + (p.height/2) + p.AttackZOffset// + frandom(3, -3)
- )
- )
- )
- );
- //Console.Printf("Ball Spawned %i", i);
- }
- ThinkerIterator targetFinder = ThinkerIterator.Create("BabelMonster");
- BabelMonster other;
- while(other = BabelMonster(targetFinder.Next()))
- {
- if(!p.CheckSight(other) || other.health <= 0)
- {
- continue;
- }
- Vector2 d = p.Vec2To(other);
- if(absangle(p.angle, BabelLib.atan2(d)) > 50) //use Fov later
- continue;
- m.Insert(other);
- }
- m.SetTargets();
- }
- States
- {
- Ready:
- BFGG A 20 A_WeaponReady;
- Loop;
- Deselect:
- BFGG A 1
- {
- A_Lower(24);
- }
- Loop;
- Select:
- BFGG A 1
- {
- A_Raise(24);
- }
- Loop;
- Fire:
- BFGG A 20
- {
- A_BFGSound();
- A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- }
- BFGG A 2
- {
- A_GunFlash();
- A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- }
- BFGN A 8 A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- SBFG D 1
- {
- BabelLib.InflictFear(players[consoleplayer].mo, "BabelMonster", random(10, 170));
- //A_FireBFG();
- A_NewBFG();
- A_ZoomFactor(0.95);
- A_SetPitch(pitch-1.0);
- A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- }
- SBFG D 1
- {
- A_ZoomFactor(0.96);
- A_SetPitch(pitch+0.20);
- A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- }
- SBFG E 1
- {
- A_ZoomFactor(0.97);
- A_SetPitch(pitch+0.20);
- A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- }
- SBFG E 1
- {
- A_ZoomFactor(0.98);
- A_SetPitch(pitch+0.20);
- A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- }
- SBFG D 1
- {
- A_ZoomFactor(0.99);
- A_SetPitch(pitch+0.20);
- A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- }
- SBFG D 1
- {
- A_ZoomFactor(1.0);
- A_SetPitch(pitch+0.20);
- A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- }
- SBFG CCBA 1 A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- BFGG A 1
- {
- A_ReFire();
- A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- }
- goto Ready;
- Hold:
- BFGG A 20
- {
- A_BFGSound();
- A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- }
- BFGG A 2
- {
- A_GunFlash();
- A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- }
- BFGN A 8 A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- SBFG D 1
- {
- BabelLib.InflictFear(players[consoleplayer].mo, "BabelMonster", random(10, 170));
- //A_FireBFG();
- A_NewBFG();
- A_ZoomFactor(0.95);
- A_SetPitch(pitch-1.0);
- A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- }
- SBFG D 1
- {
- A_ZoomFactor(0.96);
- A_SetPitch(pitch+0.20);
- A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- }
- SBFG E 1
- {
- A_ZoomFactor(0.97);
- A_SetPitch(pitch+0.20);
- A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- }
- SBFG E 1
- {
- A_ZoomFactor(0.98);
- A_SetPitch(pitch+0.20);
- A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- }
- SBFG D 1
- {
- A_ZoomFactor(0.99);
- A_SetPitch(pitch+0.20);
- A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- }
- SBFG D 1
- {
- A_ZoomFactor(1.0);
- A_SetPitch(pitch+0.20);
- A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- }
- SBFG CCBA 1 A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- BFGG A 1
- {
- A_ReFire();
- A_WeaponReady(WRF_NoFire|WRF_NoSwitch);
- }
- goto Ready;
- Flash:
- BFGW A 2 bright;
- BFGX HGFE 1 bright A_Light2();
- BFGX DCBA 1 bright A_Light2();
- TNT1 A 0 A_Light0;
- Goto LightDone;
- }
- }
- class MiniBFGBallTargetCoordinator : Thinker
- {
- Array<BabelMonster> monsters;
- Array<MiniBFGBall> balls;
- static MiniBFGBallTargetCoordinator Create()
- {
- MiniBFGBallTargetCoordinator m = new("MiniBFGBallTargetCoordinator");
- //initialize
- return m;
- }
- void Insert(BabelMonster b)
- {
- if(b.health <= 0)
- return;
- //Console.Printf("%i", monsters.Size());
- for(int i = 0; i < monsters.Size(); i++)
- {
- if(b.health > monsters[i].health)
- {
- monsters.Insert (i, b);
- return;
- }
- }
- monsters.Push(b);
- }
- void AddBall(MiniBFGBall b)
- {
- balls.Push(b);
- }
- void SetTargets()
- {
- //Console.Printf("Setting targets");
- int balldmg = balls.Size() * 100;
- int numMonsters = monsters.Size();
- int monsterIndex = 0;
- int ballIndex = 0;
- int monsterHealth;
- //Console.Printf("%i %i", balldmg, numMonsters);
- while((ballIndex < balldmg/100) && (balldmg > 0) && (monsterIndex < numMonsters))
- {
- monsterHealth = monsters[monsterIndex].health;
- //Console.Printf("Monster Health: %i", monsterHealth);
- while(monsterHealth > 0 && balldmg > 0 && ballIndex < 40)
- {
- //Console.Printf("Assigning ball %i to %s", ballIndex, monsters[monsterIndex].GetClassName());
- while(monsterHealth%100 != 0 && balldmg - monsterHealth > 0)
- monsterHealth++;
- balls[ballIndex].tracer = monsters[monsterIndex];
- balls[ballIndex].target = players[consoleplayer].mo; //so we pass through
- balls[ballIndex].damageMul = monsterHealth/100; //what the fuck am I doing aaaa
- double newScale = 0.2 + (0.05*((monsterHealth/100)-1));
- if(newScale > 1.0)
- newScale = 1.0;
- balls[ballIndex].Scale = (newScale, newScale);
- //Console.Printf("%i", balls[ballIndex].damageMul);
- ballIndex++;
- balldmg -= monsterHealth;
- monsterHealth = 0;
- }
- monsterIndex++;
- }
- //when we reach here, either all balls should be assigned or all monsters should soon be dead
- }
- }
- class MiniBFGBall : BabelFastProjectile
- {
- int user_loopCounter;
- int curspeed;
- int damageMul;
- default
- {
- Radius 3;
- Height 2;
- Speed 0;
- DamageFunction (100 * damageMul);
- Projectile;
- RenderStyle "Add";
- Alpha 0.75;
- DeathSound "weapons/bfgx";
- Obituary "$OB_MPBFG_BOOM";
- DamageType "PlayerBFG";
- Scale 0.2;
- +SEEKERMISSILE;
- }
- override void BeginPlay()
- {
- target = players[consoleplayer].mo;
- angle = players[consoleplayer].mo.angle%360;
- pitch = players[consoleplayer].mo.pitch;
- damageMul = 1;
- super.BeginPlay();
- heightCorrection = -0.5;
- lerpOffset = 0.6;
- trailDetail = 5;
- particleColors[0] = Color(0x55ff55);//0xffff99);
- particleColors[1] = Color(0xbbff33);
- particleColors[2] = Color(0x22ff22);
- size[0] = 1;
- size[1] = 2;
- lifetime[0] = 25;
- lifetime[1] = 35;
- cubeOffset[0] = 2;
- cubeOffset[1] = 2;
- cubeAccel[0] = 0.02;
- cubeAccel[1] = 0.02;
- startingAlpha = 0.7;
- trailSpawn = false;
- finalTrail = true;
- }
- States
- {
- Spawn:
- TNT1 A 0 NoDelay
- {
- if(!tracer)
- {
- //Console.Printf("Killing Self");
- return ResolveState("Disappear");
- }
- trailSpawn = true;
- finalTrail = false;
- curspeed = 10;
- A_SetSpeed(curspeed);
- //Console.Printf(tracer.GetClassName());
- return ResolveState(null);
- }
- Fly:
- BFS1 AB 4 Bright
- {
- if(curspeed < 50)
- curspeed += 4;
- A_SetSpeed(curspeed);
- A_SeekerMissile (360, 360, SMF_PRECISE);
- }
- Loop;
- Disappear:
- TNT1 A 1;
- Stop;
- Death:
- TNT1 A 0
- {
- trailSpawn = false;
- }
- TNT1 AAAAAAAAAA 0
- {
- A_SpawnParticle (0x55ff55, SPF_FULLBRIGHT, random(25,35), random(1,2), 0, frandom(-radius, radius), frandom(-radius, radius), frandom(-height, height), frandom(-4.0, 4.0),frandom(-4.0, 4.0),frandom(-4.0, 4.0), frandom(-0.1, 0.1), frandom(-0.1, 0.1), frandom(-0.1, 0.1), 0.7, -1);
- A_SpawnParticle (0xbbff33, SPF_FULLBRIGHT, random(25,35), random(1,2), 0, frandom(-radius, radius), frandom(-radius, radius), frandom(-height, height), frandom(-4.0, 4.0),frandom(-4.0, 4.0),frandom(-4.0, 4.0), frandom(-0.1, 0.1), frandom(-0.1, 0.1), frandom(-0.1, 0.1), 0.7, -1);
- A_SpawnParticle (0x22ff22, SPF_FULLBRIGHT, random(25,35), random(1,2), 0, frandom(-radius, radius), frandom(-radius, radius), frandom(-height, height), frandom(-4.0, 4.0),frandom(-4.0, 4.0),frandom(-4.0, 4.0), frandom(-0.1, 0.1), frandom(-0.1, 0.1), frandom(-0.1, 0.1), 0.7, -1);
- }
- BFE1 AABBCCDD 2 Bright;
- BFE1 EF 3 Bright;
- Stop;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement