- Fixed: Shooting up and down with AArtiPoisonBag3::Use() was completely

broken. I don't know what I thinking when I plugged in 2*finesine[pitch]
  for Hexen's lookdir, because that's totally wrong. Not only is the
  magnitude far too low, but it also aims in the opposite direction you
  are looking. The new code only attempts to be close to Hexen's original
  while looking straight ahead and extrapolates that to other angles using
  proper 3D math.


SVN r2057 (trunk)
This commit is contained in:
Randy Heit 2009-12-29 04:50:56 +00:00
parent 9b5c2c81f1
commit 64789b9111
2 changed files with 35 additions and 9 deletions

View File

@ -1,3 +1,12 @@
December 28, 2009
- Fixed: Shooting up and down with AArtiPoisonBag3::Use() was completely
broken. I don't know what I thinking when I plugged in 2*finesine[pitch]
for Hexen's lookdir, because that's totally wrong. Not only is the
magnitude far too low, but it also aims in the opposite direction you
are looking. The new code only attempts to be close to Hexen's original
while looking straight ahead and extrapolates that to other angles using
proper 3D math.
December 28, 2009 (Changes by Graf Zahl)
- Added full sound definitions for Heretic's ChickenPlayer and Hexen's
PigPlayer (submitted by NeuralStunner.)

View File

@ -104,21 +104,38 @@ bool AArtiPoisonBag3::Use (bool pickup)
{
AActor *mo;
mo = Spawn ("ThrowingBomb", Owner->x, Owner->y,
mo = Spawn("ThrowingBomb", Owner->x, Owner->y,
Owner->z-Owner->floorclip+35*FRACUNIT + (Owner->player? Owner->player->crouchoffset : 0), ALLOW_REPLACE);
if (mo)
{
angle_t pitch = (angle_t)Owner->pitch >> ANGLETOFINESHIFT;
mo->angle = Owner->angle + (((pr_poisonbag()&7) - 4) << 24);
/* Original flight code from Hexen
* mo->momz = 4*FRACUNIT+((player->lookdir)<<(FRACBITS-4));
* mo->z += player->lookdir<<(FRACBITS-4);
* P_ThrustMobj(mo, mo->angle, mo->info->speed);
* mo->momx += player->mo->momx>>1;
* mo->momy += player->mo->momy>>1;
*/
// When looking straight ahead, it uses a z velocity of 4 while the xy velocity
// is as set by the projectile. To accomodate this with a proper trajectory, we
// aim the projectile ~20 degrees higher than we're looking at and increase the
// speed we fire at accordingly.
angle_t orgpitch = angle_t(-Owner->pitch) >> ANGLETOFINESHIFT;
angle_t modpitch = angle_t(0xDC00000 - Owner->pitch) >> ANGLETOFINESHIFT;
angle_t angle = mo->angle >> ANGLETOFINESHIFT;
fixed_t speed = fixed_t(sqrt((double)mo->Speed*mo->Speed + (4.0*65536*4*65536)));
fixed_t xyscale = FixedMul(speed, finecosine[modpitch]);
mo->velz = FixedMul(speed, finesine[modpitch]);
mo->velx = FixedMul(xyscale, finecosine[angle]) + (Owner->velx >> 1);
mo->vely = FixedMul(xyscale, finesine[angle]) + (Owner->vely >> 1);
mo->z += FixedMul(mo->Speed, finesine[orgpitch]);
mo->angle = Owner->angle+(((pr_poisonbag()&7)-4)<<24);
mo->velz = 4*FRACUNIT + 2*finesine[pitch];
mo->z += 2*finesine[pitch];
P_ThrustMobj (mo, mo->angle, mo->Speed);
mo->velx += Owner->velx >> 1;
mo->vely += Owner->vely >> 1;
mo->target = Owner;
mo->tics -= pr_poisonbag()&3;
P_CheckMissileSpawn (mo);
P_CheckMissileSpawn(mo);
return true;
}
return false;