diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 2155f66180..17e06ed68f 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ 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 DECORATE parser. diff --git a/src/g_hexen/a_hexenspecialdecs.cpp b/src/g_hexen/a_hexenspecialdecs.cpp index fca9badece..c8c64b20b1 100644 --- a/src/g_hexen/a_hexenspecialdecs.cpp +++ b/src/g_hexen/a_hexenspecialdecs.cpp @@ -132,7 +132,7 @@ IMPLEMENT_CLASS (AZCorpseLynchedNoHeart) void AZCorpseLynchedNoHeart::PostBeginPlay () { Super::PostBeginPlay (); - Spawn ("BloodPool", x, y, ONFLOORZ, ALLOW_REPLACE); + Spawn ("BloodPool", x, y, floorz, ALLOW_REPLACE); } //============================================================================ diff --git a/src/g_raven/a_minotaur.cpp b/src/g_raven/a_minotaur.cpp index 1ad98c25a3..c3d6463cc5 100644 --- a/src/g_raven/a_minotaur.cpp +++ b/src/g_raven/a_minotaur.cpp @@ -406,7 +406,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MntrFloorFire) self->z = self->floorz; x = self->x + (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->momx = 1; // Force block checking P_CheckMissileSpawn (mo); diff --git a/src/g_strife/a_programmer.cpp b/src/g_strife/a_programmer.cpp index a8bcf42ec3..d3f259300e 100644 --- a/src/g_strife/a_programmer.cpp +++ b/src/g_strife/a_programmer.cpp @@ -105,7 +105,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpotLightning) if (self->target == NULL) 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) { spot->threshold = 25; diff --git a/src/g_strife/a_rebels.cpp b/src/g_strife/a_rebels.cpp index 2625ca173b..56feee19d2 100644 --- a/src/g_strife/a_rebels.cpp +++ b/src/g_strife/a_rebels.cpp @@ -75,7 +75,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Beacon) AActor *rebel; 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)) { rebel->Destroy (); diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index 757863fdef..0dbab29cba 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -904,7 +904,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1) P_BulletSlope (self, &linetarget); 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) { spot->tracer = linetarget; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 4722bc7562..8cd484222f 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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 @@ -4485,22 +4505,13 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, type->TypeName.GetChars(), source->GetClass()->TypeName.GetChars()); return NULL; } - int defflags3 = GetDefaultByType (type)->flags3; - if (defflags3 & MF3_FLOORHUGGER) - { - z = ONFLOORZ; - } - else if (defflags3 & MF3_CEILINGHUGGER) - { - z = ONCEILINGZ; - } - else if (z != ONFLOORZ) + if (z != ONFLOORZ && z != ONCEILINGZ) { z -= source->floorclip; } - AActor *th = Spawn (type, x, y, z, ALLOW_REPLACE); + AActor *th = SpawnMissile (type, x, y, z); P_PlaySpawnSound(th, source); 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); // 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; } @@ -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) { AActor *mo; - int defflags3 = GetDefaultByType (type)->flags3; - if (defflags3 & MF3_FLOORHUGGER) - { - z = ONFLOORZ; - } - else if (defflags3 & MF3_CEILINGHUGGER) - { - z = ONCEILINGZ; - } - if (z != ONFLOORZ) + if (z != ONFLOORZ && z != ONCEILINGZ && source != NULL) { 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); mo->target = owner != NULL ? owner : source; // Originator mo->angle = angle; diff --git a/src/textures/textures.h b/src/textures/textures.h index 28fecb5fe2..b69e89226c 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -1,13 +1,14 @@ #ifndef __TEXTURES_H #define __TEXTURES_H -#include "basictypes.h" +#include "doomtype.h" class FBitmap; struct FRemapTable; struct FCopyInfo; class FScanner; struct PClass; +class FArchive; // Texture IDs class FTextureManager;