gzdoom-gles/src/g_shared/a_debris.cpp
Randy Heit e4af82ae96 - Enough with this "momentum" garbage. What Doom calls "momentum" is really
velocity, and now it's known as such. The actor variables momx/momy/momz
  are now known as velx/vely/velz, and the ACS functions GetActorMomX/Y/Z
  are now known as GetActorVelX/Y/Z. For compatibility, momx/momy/momz will
  continue to work as aliases from DECORATE. The ACS functions, however,
  require you to use the new name, since they never saw an official release
  yet.


SVN r1689 (trunk)
2009-06-30 20:57:51 +00:00

55 lines
1.1 KiB
C++

#include "actor.h"
#include "info.h"
#include "m_random.h"
#include "m_fixed.h"
static FRandom pr_dirt ("SpawnDirt");
// Stained glass ------------------------------------------------------------
class AGlassShard : public AActor
{
DECLARE_CLASS (AGlassShard, AActor)
public:
bool FloorBounceMissile (secplane_t &plane)
{
if (!Super::FloorBounceMissile (plane))
{
if (abs (velz) < (FRACUNIT/2))
{
Destroy ();
}
return false;
}
return true;
}
};
IMPLEMENT_CLASS(AGlassShard)
// Dirt stuff
void P_SpawnDirt (AActor *actor, fixed_t radius)
{
fixed_t x,y,z;
const PClass *dtype = NULL;
AActor *mo;
angle_t angle;
angle = pr_dirt()<<5; // <<24 >>19
x = actor->x + FixedMul(radius,finecosine[angle]);
y = actor->y + FixedMul(radius,finesine[angle]);
z = actor->z + (pr_dirt()<<9) + FRACUNIT;
char fmt[8];
mysnprintf(fmt, countof(fmt), "Dirt%d", 1 + pr_dirt()%6);
dtype = PClass::FindClass(fmt);
if (dtype)
{
mo = Spawn (dtype, x, y, z, ALLOW_REPLACE);
if (mo)
{
mo->velz = pr_dirt()<<10;
}
}
}