mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-17 10:00:54 +00:00
86 lines
1.6 KiB
C++
86 lines
1.6 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));
|
||
|
|
||
|
// Handle movement
|
||
|
if (momx || momy || (z != floorz) || momz)
|
||
|
{
|
||
|
xfrac = momx>>3;
|
||
|
yfrac = momy>>3;
|
||
|
zfrac = momz>>3;
|
||
|
changexy = xfrac || yfrac;
|
||
|
for (i = 0; i < 8; i++)
|
||
|
{
|
||
|
if (changexy)
|
||
|
{
|
||
|
tm.LastRipped = NULL; // [RH] Do rip damage each step, like Hexen
|
||
|
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()
|
||
|
{
|
||
|
}
|
||
|
|