mirror of
https://github.com/ZDoom/gzdoom-last-svn.git
synced 2025-06-01 01:41:18 +00:00
- replaced a few occurences of ONFLOORZ to work with 3D floors and 3DMidtex textures.
- fixed skyrotate option. - fixed: 3D floors need to be spawned before the things. This was the reason why checking for the floor height did not work and which required a hack in P_ZMovement to prevent actors from falling through 3D floors. Now that this is working I could also fix some other things, most importantly floor and ceiling huggers which until now ignored 3D floors. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@285 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
parent
5b2c91106e
commit
950c314974
12 changed files with 83 additions and 82 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 ();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -268,7 +268,6 @@ static void ParseFunc(FScanner &sc, level_info_t *info)
|
|||
opt->skyrotatevector.Y = (float)sc.Float;
|
||||
sc.MustGetFloat();
|
||||
opt->skyrotatevector.Z = (float)sc.Float;
|
||||
sc.MustGetFloat();
|
||||
opt->skyrotatevector.MakeUnit();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -382,7 +382,7 @@ static void RenderDome(FTextureID texno, FGLTexture * tex, float x_offset, float
|
|||
|
||||
if (texh>190 && skystretch) texh=190;
|
||||
|
||||
gl.Rotatef(-180.0f+x_offset, glset.skyrotatevector.X, glset.skyrotatevector.Z, glset.skyrotatevector.Y);
|
||||
gl.Rotatef(-180.0f+x_offset, 0.f, 1.f, 0.f);
|
||||
|
||||
yAdd = y_offset/texh;
|
||||
|
||||
|
@ -463,7 +463,7 @@ static void RenderDome(FTextureID texno, FGLTexture * tex, float x_offset, float
|
|||
|
||||
if (tex)
|
||||
{
|
||||
gl.Rotatef(180.0f-x_offset, glset.skyrotatevector.X, glset.skyrotatevector.Z, glset.skyrotatevector.Y);
|
||||
gl.Rotatef(180.0f-x_offset, 0, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -480,7 +480,7 @@ static void RenderBox(FTextureID texno, FGLTexture * gltex, float x_offset, int
|
|||
int faces;
|
||||
FGLTexture * tex;
|
||||
|
||||
gl.Rotatef(-180.0f+x_offset, 0.f, 1.f, 0.f);
|
||||
gl.Rotatef(-180.0f+x_offset, glset.skyrotatevector.X, glset.skyrotatevector.Z, glset.skyrotatevector.Y);
|
||||
gl.Color3f(R, G ,B);
|
||||
|
||||
if (sb->faces[5])
|
||||
|
|
|
@ -627,10 +627,10 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// Spawns non-ZDoom specials
|
||||
// Spawns 3D floors
|
||||
//
|
||||
//==========================================================================
|
||||
void P_SpawnSpecials2 (void)
|
||||
void P_Spawn3DFloors (void)
|
||||
{
|
||||
static int flagvals[] = {128+512, 2+512, 512};
|
||||
int i;
|
||||
|
@ -670,27 +670,6 @@ void P_SpawnSpecials2 (void)
|
|||
line->special=0;
|
||||
line->args[0] = line->args[1] = line->args[2] = line->args[3] = line->args[4] = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Also do some tweaks to the spawned actors
|
||||
//
|
||||
TThinkerIterator<AActor> it;
|
||||
AActor * mo;
|
||||
|
||||
while ((mo=it.Next()))
|
||||
{
|
||||
// Don't count monsters in end-of-level sectors
|
||||
// In 99.9% of all occurences they are part of a trap
|
||||
// and not supposed to be killed.
|
||||
if (mo->flags & MF_COUNTKILL)
|
||||
{
|
||||
if (mo->Sector->special == dDamage_End)
|
||||
{
|
||||
level.total_monsters--;
|
||||
mo->flags&=~(MF_COUNTKILL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ bool P_CheckFor3DCeilingHit(AActor * mo);
|
|||
void P_Recalculate3DFloors(sector_t *);
|
||||
void P_RecalculateAttached3DFloors(sector_t * sec);
|
||||
lightlist_t * P_GetPlaneLight(sector_t * , secplane_t * plane, bool underside);
|
||||
void P_SpawnSpecials2( void );
|
||||
void P_Spawn3DFloors( void );
|
||||
|
||||
struct FLineOpening;
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ static bool PIT_FindFloorCeiling (line_t *ld, const FBoundingBox &box, FCheckPos
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void P_FindFloorCeiling (AActor *actor, bool onlymidtex)
|
||||
void P_FindFloorCeiling (AActor *actor, bool onlyspawnpos)
|
||||
{
|
||||
sector_t *sec;
|
||||
FCheckPosition tmf;
|
||||
|
@ -197,7 +197,7 @@ void P_FindFloorCeiling (AActor *actor, bool onlymidtex)
|
|||
|
||||
if (tmf.touchmidtex) tmf.dropoffz = tmf.floorz;
|
||||
|
||||
if (!onlymidtex || (tmf.touchmidtex && (tmf.floorz <= actor->z)))
|
||||
if (!onlyspawnpos || (tmf.touchmidtex && (tmf.floorz <= actor->z)))
|
||||
{
|
||||
actor->floorz = tmf.floorz;
|
||||
actor->dropoffz = tmf.dropoffz;
|
||||
|
@ -207,6 +207,26 @@ void P_FindFloorCeiling (AActor *actor, bool onlymidtex)
|
|||
actor->ceilingpic = tmf.ceilingpic;
|
||||
actor->ceilingsector = tmf.ceilingsector;
|
||||
}
|
||||
|
||||
// also check 3D floors at the spawn position if the result from the block lines iterator cannot be used.
|
||||
if (onlyspawnpos)
|
||||
{
|
||||
for(unsigned int i=0;i<actor->Sector->e->XFloor.ffloors.Size();i++)
|
||||
{
|
||||
F3DFloor* rover=actor->Sector->e->XFloor.ffloors[i];
|
||||
|
||||
if (!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue;
|
||||
|
||||
fixed_t ff_bottom=rover->bottom.plane->ZatPoint(actor->x, actor->y);
|
||||
fixed_t ff_top=rover->top.plane->ZatPoint(actor->x, actor->y);
|
||||
|
||||
fixed_t delta1 = actor->z - (ff_bottom + ((ff_top-ff_bottom)/2));
|
||||
fixed_t delta2 = actor->z + (actor->height? actor->height:1) - (ff_bottom + ((ff_top-ff_bottom)/2));
|
||||
|
||||
if (ff_top > actor->floorz && abs(delta1) < abs(delta2)) actor->floorz = ff_top;
|
||||
if (ff_bottom < actor->ceilingz && abs(delta1) >= abs(delta2)) actor->ceilingz = ff_bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -1851,28 +1851,6 @@ void P_ZMovement (AActor *mo)
|
|||
fixed_t delta;
|
||||
fixed_t oldz = mo->z;
|
||||
|
||||
// Intercept the stupid 'fall through 3dfloors' bug SSNTails 06-13-2002
|
||||
|
||||
// [GrafZahl] This is a really ugly workaround... :(
|
||||
// But unless the collision code is completely rewritten it is the
|
||||
// only way to avoid problems caused by incorrect positioning info...
|
||||
for(unsigned int i=0;i<mo->Sector->e->XFloor.ffloors.Size();i++)
|
||||
{
|
||||
F3DFloor* rover=mo->Sector->e->XFloor.ffloors[i];
|
||||
|
||||
if (!(rover->flags&FF_EXISTS)) continue;
|
||||
if(!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue;
|
||||
|
||||
fixed_t ff_bottom=rover->bottom.plane->ZatPoint(mo->x, mo->y);
|
||||
fixed_t ff_top=rover->top.plane->ZatPoint(mo->x, mo->y);
|
||||
|
||||
fixed_t delta1 = mo->z - (ff_bottom + ((ff_top-ff_bottom)/2));
|
||||
fixed_t delta2 = mo->z + (mo->height? mo->height:1) - (ff_bottom + ((ff_top-ff_bottom)/2));
|
||||
|
||||
if(ff_top > mo->floorz && abs(delta1) < abs(delta2)) mo->floorz = ff_top;
|
||||
if(ff_bottom < mo->ceilingz && abs(delta1) >= abs(delta2)) mo->ceilingz = ff_bottom;
|
||||
}
|
||||
|
||||
//
|
||||
// check for smooth step up
|
||||
//
|
||||
|
@ -4613,6 +4591,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
|
||||
|
@ -4642,22 +4640,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
|
||||
|
@ -4672,7 +4661,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;
|
||||
}
|
||||
|
@ -4766,21 +4755,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;
|
||||
|
|
|
@ -3555,6 +3555,9 @@ void P_SetupLevel (char *lumpname, int position)
|
|||
|
||||
deathmatchstarts.Clear ();
|
||||
|
||||
// Spawn 3d floors - must be done before spawning things so it can't be done in P_SpawnSpecials
|
||||
P_Spawn3DFloors();
|
||||
|
||||
if (!buildmap)
|
||||
{
|
||||
times[14].Clock();
|
||||
|
@ -3585,8 +3588,6 @@ void P_SetupLevel (char *lumpname, int position)
|
|||
// set up world state
|
||||
P_SpawnSpecials ();
|
||||
|
||||
// Spawn extended specials
|
||||
P_SpawnSpecials2();
|
||||
P_InitTagLists();
|
||||
|
||||
// This must be done BEFORE the PolyObj Spawn!!!
|
||||
|
@ -3609,6 +3610,26 @@ void P_SetupLevel (char *lumpname, int position)
|
|||
}
|
||||
}
|
||||
|
||||
// Don't count monsters in end-of-level sectors
|
||||
// In 99.9% of all occurences they are part of a trap
|
||||
// and not supposed to be killed.
|
||||
{
|
||||
TThinkerIterator<AActor> it;
|
||||
AActor * mo;
|
||||
|
||||
while ((mo=it.Next()))
|
||||
{
|
||||
if (mo->flags & MF_COUNTKILL)
|
||||
{
|
||||
if (mo->Sector->special == dDamage_End)
|
||||
{
|
||||
level.total_monsters--;
|
||||
mo->flags&=~(MF_COUNTKILL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
T_PreprocessScripts(); // preprocess FraggleScript scripts
|
||||
|
||||
// build subsector connect matrix
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue