Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void A_BFGItemSpray(class<Inventory> itemType, int itemCount = 1, int numrays = 40, double ang = 90, double distance = 16*64, double vrange = 32, int flags = 0)
- {
- FTranslatedLineTarget t;
- // validate parameters
- if (spraytype == null) return;
- if (itemCount == 0) return;
- if (numrays <= 0) numrays = 40;
- if (ang == 0) ang = 90.;
- if (distance <= 0) distance = 16 * 64;
- if (vrange == 0) vrange = 32.;
- // [XA] Set the originator of the rays to the projectile (self) if
- // the new flag is set, else set it to the player (target)
- Actor originator = (flags & BFGF_MISSILEORIGIN) ? self : target;
- // [RH] Don't crash if no target
- if (!originator)
- return;
- // offset angles from its attack ang
- for (int i = 0; i < numrays; i++) {
- double an = angle - ang / 2 + ang / numrays*i;
- originator.AimLineAttack (an, distance, t, vrange);
- if (t.linetarget != null) {
- if (itemCount > 0)
- t.linetarget.GiveInventory (itemType, itemCount);
- else
- t.linetarget.TakeInventory (itemType, itemCount);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement