2016-03-01 15:47:10 +00:00
|
|
|
#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))
|
|
|
|
{
|
2016-03-19 23:54:18 +00:00
|
|
|
if (fabs (Vel.Z) < 0.5)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
|
|
|
Destroy ();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
IMPLEMENT_CLASS(AGlassShard)
|
|
|
|
|
|
|
|
// Dirt stuff
|
|
|
|
|
2016-03-20 14:04:13 +00:00
|
|
|
void P_SpawnDirt (AActor *actor, double radius)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
|
|
|
PClassActor *dtype = NULL;
|
|
|
|
AActor *mo;
|
|
|
|
|
2016-03-20 14:04:13 +00:00
|
|
|
double zo = pr_dirt() / 128. + 1;
|
|
|
|
DVector3 pos = actor->Vec3Angle(radius, pr_dirt() * (360./256), zo);
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
char fmt[8];
|
|
|
|
mysnprintf(fmt, countof(fmt), "Dirt%d", 1 + pr_dirt()%6);
|
|
|
|
dtype = PClass::FindActor(fmt);
|
|
|
|
if (dtype)
|
|
|
|
{
|
|
|
|
mo = Spawn (dtype, pos, ALLOW_REPLACE);
|
|
|
|
if (mo)
|
|
|
|
{
|
2016-03-19 23:54:18 +00:00
|
|
|
mo->Vel.Z = pr_dirt() / 64.;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|