Doing this for the non-powered attack was simple based on other examples I had seen but the powered version uses explicit values that I can't seem to replicate. I know I can easily use A_FireBullets to do what I want but from a learning perspective, I wanted to check to see what I had done wrong.
For reference, this is what I wanted to replicate in the original function
Code: Select all
A_FireBullets (0, 0, 1, FRandom(1, 3)*5, "XtGoldWandPuff2", FBF_USEAMMO | FBF_NORANDOM | FBF_EXPLICITANGLE, 128*64, null, 32, 0);
A_FireBullets (5, 0, 1, FRandom(1, 3)*5, "XtGoldWandPuff2", FBF_NORANDOM | FBF_EXPLICITANGLE, 128*64, null, 32, 0);
A_FireBullets (-5, 0, 1, FRandom(1, 3)*5, "XtGoldWandPuff2", FBF_NORANDOM | FBF_EXPLICITANGLE, 128*64, null, 32, 0);
A_FireBullets (0, 5, 1, FRandom(1, 3)*5, "XtGoldWandPuff2", FBF_NORANDOM | FBF_EXPLICITANGLE, 128*64, null, 32, 0);
A_FireBullets (0, -5, 1, FRandom(1, 3)*5, "XtGoldWandPuff2", FBF_NORANDOM | FBF_EXPLICITANGLE, 128*64, null, 32, 0);
A_FireProjectile ("XtGoldWandFX2", 5, 0, 0, 0, 0, 0);
A_FireProjectile ("XtGoldWandFX2",-5, 0, 0, 0, 0, 0);
Code: Select all
action void A_XtFireElvenWandP()
{
if (player == null)
{
return;
}
Weapon weapon = player.ReadyWeapon;
if (weapon != null)
{
if (!weapon.DepleteAmmo (weapon.bAltFire))
return;
}
double bangle = angle;
double bslope = BulletSlope ();
double vz = -GetDefaultByType("XtGoldWandFX2").Speed * clamp(tan(pitch), -5, 5);
SpawnMissileAngle("XtGoldWandFX2", angle - (40. / 8), vz);
SpawnMissileAngle("XtGoldWandFX2", angle + (40. / 8), vz);
for(int i = 0; i < 5; i++)
{
double pangle = bangle;
double slope = bslope;
pangle += 5;
slope += 5;
int damage = random[FireGoldWand](1, 8);
LineAttack (pangle, PLAYERMISSILERANGE, slope, damage, 'Hitscan', "GoldWandPuff2");
}
A_StartSound("weapons/wandhit", CHAN_WEAPON);
}
