Advertisement
Chronos_Ouroboros

A_BFGStateJumpSpray

Dec 13th, 2018
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.12 KB | None | 0 0
  1.     void A_BFGStateJumpSpray (StateLabel st, int numrays = 40, double ang = 90, double distance = 16*64, double vrange = 32, int flags = 0) {
  2.         FTranslatedLineTarget t;
  3.  
  4.         // Validate parameters
  5.         if (numrays <= 0) numrays = 40;
  6.         if (ang == 0) ang = 90.;
  7.         if (distance <= 0) distance = 16 * 64;
  8.         if (vrange == 0) vrange = 32.;
  9.  
  10.         // [XA] Set the originator of the rays to the projectile (self) if
  11.         //      the new flag is set, else set it to the player (target)
  12.         Actor originator = (flags & BFGF_MISSILEORIGIN) ? self : target;
  13.  
  14.         // [RH] Don't crash if no target
  15.         if (!originator)
  16.             return;
  17.  
  18.         // offset angles from its attack ang
  19.         for (int i = 0; i < numrays; i++) {
  20.             double an = angle - ang / 2 + ang / numrays*i;
  21.  
  22.             originator.AimLineAttack (an, distance, t, vrange);
  23.  
  24.             if (t.linetarget != NULL) {
  25.                 let targetState = t.linetarget.FindState (st);
  26.  
  27.                 if (targetState != NULL)
  28.                     t.linetarget.SetState (targetState );
  29.             }
  30.         }
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement