qzdoom-gpl/src/g_shared/a_fastprojectile.cpp
Christoph Oelckers 6a321fd8f5 - Changed pickup sounds of local player to unpaused to resolve problems with
the time freezer and make them behave better.
- Fixed: When sounds are paused not all newly started sounds should actually
  be played.
- Fixed: SBARINFO had no means to check if a weapon uses any ammo at all and
  as a result the inventory icon was misplaced if a no-ammo weapon was selected.

SVN r1343 (trunk)
2009-01-01 15:09:49 +00:00

102 lines
1.9 KiB
C++

#include "a_sharedglobal.h"
#include "p_local.h"
IMPLEMENT_CLASS(AFastProjectile)
//----------------------------------------------------------------------------
//
// AFastProjectile :: Tick
//
// Thinker for the ultra-fast projectiles used by Heretic and Hexen
//
//----------------------------------------------------------------------------
void AFastProjectile::Tick ()
{
int i;
fixed_t xfrac;
fixed_t yfrac;
fixed_t zfrac;
int changexy;
PrevX = x;
PrevY = y;
PrevZ = z;
// [RH] Ripping is a little different than it was in Hexen
FCheckPosition tm(!!(flags2 & MF2_RIP));
int shift = 3;
int count = 8;
if (radius > 0)
{
while ( ((momx >> shift) > radius) || ((momy >> shift) > radius))
{
// we need to take smaller steps.
shift++;
count<<=1;
}
}
// Handle movement
if (momx || momy || (z != floorz) || momz)
{
xfrac = momx>>shift;
yfrac = momy>>shift;
zfrac = momz>>shift;
changexy = xfrac || yfrac;
int ripcount = count >> 3;
for (i = 0; i < count; i++)
{
if (changexy)
{
if (--ripcount <= 0)
{
tm.LastRipped = NULL; // [RH] Do rip damage each step, like Hexen
ripcount = count >> 3;
}
if (!P_TryMove (this, x + xfrac,y + yfrac, true, false, tm))
{ // Blocked move
P_ExplodeMissile (this, BlockingLine, BlockingMobj);
return;
}
}
z += zfrac;
if (z <= floorz)
{ // Hit the floor
z = floorz;
P_HitFloor (this);
P_ExplodeMissile (this, NULL, NULL);
return;
}
if (z + height > ceilingz)
{ // Hit the ceiling
z = ceilingz - height;
P_ExplodeMissile (this, NULL, NULL);
return;
}
if (changexy) Effect();
}
}
// Advance the state
if (tics != -1)
{
tics--;
while (!tics)
{
if (!SetState (state->GetNextState ()))
{ // mobj was removed
return;
}
}
}
}
void AFastProjectile::Effect()
{
}