Fixed precipitation not checking for slopes

This commit is contained in:
Monster Iestyn 2016-03-12 23:03:56 +00:00
parent c67683eb0a
commit accab7da6a

View file

@ -3710,10 +3710,15 @@ static void CalculatePrecipFloor(precipmobj_t *mobj)
mobjsecsubsec = mobj->subsector->sector; mobjsecsubsec = mobj->subsector->sector;
else else
return; return;
mobj->floorz = mobjsecsubsec->floorheight; mobj->floorz =
#ifdef ESLOPE
mobjsecsubsec->f_slope ? P_GetZAt(mobjsecsubsec->f_slope, mobj->x, mobj->y) :
#endif
mobjsecsubsec->floorheight;
if (mobjsecsubsec->ffloors) if (mobjsecsubsec->ffloors)
{ {
ffloor_t *rover; ffloor_t *rover;
fixed_t topheight;
for (rover = mobjsecsubsec->ffloors; rover; rover = rover->next) for (rover = mobjsecsubsec->ffloors; rover; rover = rover->next)
{ {
@ -3724,8 +3729,15 @@ static void CalculatePrecipFloor(precipmobj_t *mobj)
if (!(rover->flags & FF_BLOCKOTHERS) && !(rover->flags & FF_SWIMMABLE)) if (!(rover->flags & FF_BLOCKOTHERS) && !(rover->flags & FF_SWIMMABLE))
continue; continue;
if (*rover->topheight > mobj->floorz) #ifdef ESLOPE
mobj->floorz = *rover->topheight; if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
else
#endif
topheight = *rover->topheight;
if (topheight > mobj->floorz)
mobj->floorz = topheight;
} }
} }
} }
@ -7768,6 +7780,7 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
{ {
state_t *st; state_t *st;
precipmobj_t *mobj = Z_Calloc(sizeof (*mobj), PU_LEVEL, NULL); precipmobj_t *mobj = Z_Calloc(sizeof (*mobj), PU_LEVEL, NULL);
fixed_t starting_floorz;
mobj->x = x; mobj->x = x;
mobj->y = y; mobj->y = y;
@ -7786,8 +7799,16 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
// set subsector and/or block links // set subsector and/or block links
P_SetPrecipitationThingPosition(mobj); P_SetPrecipitationThingPosition(mobj);
mobj->floorz = mobj->subsector->sector->floorheight; mobj->floorz = starting_floorz =
mobj->ceilingz = mobj->subsector->sector->ceilingheight; #ifdef ESLOPE
mobj->subsector->sector->f_slope ? P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
#endif
mobj->subsector->sector->floorheight;
mobj->ceilingz =
#ifdef ESLOPE
mobj->subsector->sector->c_slope ? P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
#endif
mobj->subsector->sector->ceilingheight;
mobj->z = z; mobj->z = z;
mobj->momz = mobjinfo[type].speed; mobj->momz = mobjinfo[type].speed;
@ -7797,7 +7818,7 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
CalculatePrecipFloor(mobj); CalculatePrecipFloor(mobj);
if (mobj->floorz != mobj->subsector->sector->floorheight) if (mobj->floorz != starting_floorz)
mobj->precipflags |= PCF_FOF; mobj->precipflags |= PCF_FOF;
else if (GETSECSPECIAL(mobj->subsector->sector->special, 1) == 7 else if (GETSECSPECIAL(mobj->subsector->sector->special, 1) == 7
|| GETSECSPECIAL(mobj->subsector->sector->special, 1) == 6 || GETSECSPECIAL(mobj->subsector->sector->special, 1) == 6