- Made spawning of floor- and ceiling huggers a little more intelligent.

SVN r1348 (trunk)
This commit is contained in:
Christoph Oelckers 2009-01-03 18:09:33 +00:00
parent fdfee91b9f
commit bbdb2b10a8
8 changed files with 35 additions and 29 deletions

View File

@ -1,4 +1,5 @@
January 3, 2009 (Changes by Graf Zahl) January 3, 2009 (Changes by Graf Zahl)
- Made spawning of floor- and ceiling huggers a little more intelligent.
- Fixed: 'None' was no longer recognized as a NULL class name by the - Fixed: 'None' was no longer recognized as a NULL class name by the
DECORATE parser. DECORATE parser.

View File

@ -132,7 +132,7 @@ IMPLEMENT_CLASS (AZCorpseLynchedNoHeart)
void AZCorpseLynchedNoHeart::PostBeginPlay () void AZCorpseLynchedNoHeart::PostBeginPlay ()
{ {
Super::PostBeginPlay (); Super::PostBeginPlay ();
Spawn ("BloodPool", x, y, ONFLOORZ, ALLOW_REPLACE); Spawn ("BloodPool", x, y, floorz, ALLOW_REPLACE);
} }
//============================================================================ //============================================================================

View File

@ -406,7 +406,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MntrFloorFire)
self->z = self->floorz; self->z = self->floorz;
x = self->x + (pr_fire.Random2 () << 10); x = self->x + (pr_fire.Random2 () << 10);
y = self->y + (pr_fire.Random2 () << 10); y = self->y + (pr_fire.Random2 () << 10);
mo = Spawn("MinotaurFX3", x, y, ONFLOORZ, ALLOW_REPLACE); mo = Spawn("MinotaurFX3", x, y, self->floorz, ALLOW_REPLACE);
mo->target = self->target; mo->target = self->target;
mo->momx = 1; // Force block checking mo->momx = 1; // Force block checking
P_CheckMissileSpawn (mo); P_CheckMissileSpawn (mo);

View File

@ -105,7 +105,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpotLightning)
if (self->target == NULL) if (self->target == NULL)
return; return;
spot = Spawn("SpectralLightningSpot", self->target->x, self->target->y, ONFLOORZ, ALLOW_REPLACE); spot = Spawn("SpectralLightningSpot", self->target->x, self->target->y, self->target->floorz, ALLOW_REPLACE);
if (spot != NULL) if (spot != NULL)
{ {
spot->threshold = 25; spot->threshold = 25;

View File

@ -75,7 +75,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Beacon)
AActor *rebel; AActor *rebel;
angle_t an; angle_t an;
rebel = Spawn("Rebel1", self->x, self->y, ONFLOORZ, ALLOW_REPLACE); rebel = Spawn("Rebel1", self->x, self->y, self->floorz, ALLOW_REPLACE);
if (!P_TryMove (rebel, rebel->x, rebel->y, true)) if (!P_TryMove (rebel, rebel->x, rebel->y, true))
{ {
rebel->Destroy (); rebel->Destroy ();

View File

@ -904,7 +904,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1)
P_BulletSlope (self, &linetarget); P_BulletSlope (self, &linetarget);
if (linetarget != NULL) if (linetarget != NULL)
{ {
spot = Spawn("SpectralLightningSpot", linetarget->x, linetarget->y, ONFLOORZ, ALLOW_REPLACE); spot = Spawn("SpectralLightningSpot", linetarget->x, linetarget->y, linetarget->floorz, ALLOW_REPLACE);
if (spot != NULL) if (spot != NULL)
{ {
spot->tracer = linetarget; spot->tracer = linetarget;

View File

@ -4456,6 +4456,26 @@ void P_PlaySpawnSound(AActor *missile, AActor *spawner)
} }
} }
static AActor * SpawnMissile (const PClass *type, fixed_t x, fixed_t y, fixed_t z)
{
AActor *th = Spawn (type, x, y, z, ALLOW_REPLACE);
if (th != NULL)
{
// Force floor huggers to the floor and ceiling huggers to the ceiling
if (th->flags3 & MF3_FLOORHUGGER)
{
z = th->floorz;
}
else if (th->flags3 & MF3_CEILINGHUGGER)
{
z = th->ceilingz - th->height;
}
}
return th;
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// FUNC P_SpawnMissile // FUNC P_SpawnMissile
@ -4485,22 +4505,13 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z,
type->TypeName.GetChars(), source->GetClass()->TypeName.GetChars()); type->TypeName.GetChars(), source->GetClass()->TypeName.GetChars());
return NULL; return NULL;
} }
int defflags3 = GetDefaultByType (type)->flags3;
if (defflags3 & MF3_FLOORHUGGER) if (z != ONFLOORZ && z != ONCEILINGZ)
{
z = ONFLOORZ;
}
else if (defflags3 & MF3_CEILINGHUGGER)
{
z = ONCEILINGZ;
}
else if (z != ONFLOORZ)
{ {
z -= source->floorclip; z -= source->floorclip;
} }
AActor *th = Spawn (type, x, y, z, ALLOW_REPLACE); AActor *th = SpawnMissile (type, x, y, z);
P_PlaySpawnSound(th, source); P_PlaySpawnSound(th, source);
th->target = source; // record missile's originator th->target = source; // record missile's originator
@ -4515,7 +4526,7 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z,
FVector3 velocity(dest->x - source->x, dest->y - source->y, dest->z - source->z); FVector3 velocity(dest->x - source->x, dest->y - source->y, dest->z - source->z);
// Floor and ceiling huggers should never have a vertical component to their velocity // Floor and ceiling huggers should never have a vertical component to their velocity
if (defflags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)) if (th->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))
{ {
velocity.Z = 0; velocity.Z = 0;
} }
@ -4609,21 +4620,14 @@ AActor *P_SpawnMissileAngleZSpeed (AActor *source, fixed_t z,
const PClass *type, angle_t angle, fixed_t momz, fixed_t speed, AActor *owner, bool checkspawn) const PClass *type, angle_t angle, fixed_t momz, fixed_t speed, AActor *owner, bool checkspawn)
{ {
AActor *mo; AActor *mo;
int defflags3 = GetDefaultByType (type)->flags3;
if (defflags3 & MF3_FLOORHUGGER) if (z != ONFLOORZ && z != ONCEILINGZ && source != NULL)
{
z = ONFLOORZ;
}
else if (defflags3 & MF3_CEILINGHUGGER)
{
z = ONCEILINGZ;
}
if (z != ONFLOORZ)
{ {
z -= source->floorclip; z -= source->floorclip;
} }
mo = Spawn (type, source->x, source->y, z, ALLOW_REPLACE);
mo = SpawnMissile (type, source->x, source->y, z);
P_PlaySpawnSound(mo, source); P_PlaySpawnSound(mo, source);
mo->target = owner != NULL ? owner : source; // Originator mo->target = owner != NULL ? owner : source; // Originator
mo->angle = angle; mo->angle = angle;

View File

@ -1,13 +1,14 @@
#ifndef __TEXTURES_H #ifndef __TEXTURES_H
#define __TEXTURES_H #define __TEXTURES_H
#include "basictypes.h" #include "doomtype.h"
class FBitmap; class FBitmap;
struct FRemapTable; struct FRemapTable;
struct FCopyInfo; struct FCopyInfo;
class FScanner; class FScanner;
struct PClass; struct PClass;
class FArchive;
// Texture IDs // Texture IDs
class FTextureManager; class FTextureManager;