2016-03-01 15:47:10 +00:00
|
|
|
// Emacs style mode select -*- C++ -*-
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// $Id:$
|
|
|
|
//
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
//
|
|
|
|
// This source is available for distribution and/or modification
|
|
|
|
// only under the terms of the DOOM Source Code License as
|
|
|
|
// published by id Software. All rights reserved.
|
|
|
|
//
|
|
|
|
// The source is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
// $Log:$
|
|
|
|
//
|
|
|
|
// DESCRIPTION:
|
|
|
|
// Base class for effects on sectors.
|
|
|
|
// [RH] Created this class hierarchy.
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "dsectoreffect.h"
|
|
|
|
#include "gi.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "p_3dmidtex.h"
|
|
|
|
#include "r_data/r_interpolate.h"
|
|
|
|
#include "statnums.h"
|
2016-09-19 13:07:53 +00:00
|
|
|
#include "serializer.h"
|
2016-03-01 15:47:10 +00:00
|
|
|
#include "doomstat.h"
|
|
|
|
|
2016-11-24 20:36:02 +00:00
|
|
|
IMPLEMENT_CLASS(DSectorEffect, false, false)
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
DSectorEffect::DSectorEffect ()
|
|
|
|
: DThinker(STAT_SECTOREFFECT)
|
|
|
|
{
|
|
|
|
m_Sector = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DSectorEffect::Destroy()
|
|
|
|
{
|
|
|
|
if (m_Sector)
|
|
|
|
{
|
|
|
|
if (m_Sector->floordata == this)
|
|
|
|
{
|
|
|
|
m_Sector->floordata = NULL;
|
|
|
|
}
|
|
|
|
if (m_Sector->ceilingdata == this)
|
|
|
|
{
|
|
|
|
m_Sector->ceilingdata = NULL;
|
|
|
|
}
|
|
|
|
if (m_Sector->lightingdata == this)
|
|
|
|
{
|
|
|
|
m_Sector->lightingdata = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Super::Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
DSectorEffect::DSectorEffect (sector_t *sector)
|
2016-09-25 07:43:17 +00:00
|
|
|
: DThinker(STAT_SECTOREFFECT)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
|
|
|
m_Sector = sector;
|
|
|
|
}
|
|
|
|
|
2016-09-19 13:07:53 +00:00
|
|
|
void DSectorEffect::Serialize(FSerializer &arc)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
|
|
|
Super::Serialize (arc);
|
2016-09-19 13:07:53 +00:00
|
|
|
arc("sector", m_Sector);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
2016-11-24 20:36:02 +00:00
|
|
|
IMPLEMENT_CLASS(DMover, false, true)
|
2016-11-05 16:08:54 +00:00
|
|
|
|
|
|
|
IMPLEMENT_POINTERS_START(DMover)
|
|
|
|
IMPLEMENT_POINTER(interpolation)
|
|
|
|
IMPLEMENT_POINTERS_END
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
DMover::DMover ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
DMover::DMover (sector_t *sector)
|
|
|
|
: DSectorEffect (sector)
|
|
|
|
{
|
|
|
|
interpolation = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DMover::Destroy()
|
|
|
|
{
|
|
|
|
StopInterpolation();
|
|
|
|
Super::Destroy();
|
|
|
|
}
|
|
|
|
|
2016-09-19 13:07:53 +00:00
|
|
|
void DMover::Serialize(FSerializer &arc)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
|
|
|
Super::Serialize (arc);
|
2016-09-19 13:07:53 +00:00
|
|
|
arc("interpolation", interpolation);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DMover::StopInterpolation(bool force)
|
|
|
|
{
|
|
|
|
if (interpolation != NULL)
|
|
|
|
{
|
|
|
|
interpolation->DelRef(force);
|
|
|
|
interpolation = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-24 20:36:02 +00:00
|
|
|
IMPLEMENT_CLASS(DMovingFloor, false, false)
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
DMovingFloor::DMovingFloor ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
DMovingFloor::DMovingFloor (sector_t *sector)
|
|
|
|
: DMover (sector)
|
|
|
|
{
|
|
|
|
sector->floordata = this;
|
|
|
|
interpolation = sector->SetInterpolation(sector_t::FloorMove, true);
|
|
|
|
}
|
|
|
|
|
2016-11-24 20:36:02 +00:00
|
|
|
IMPLEMENT_CLASS(DMovingCeiling, false, false)
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
DMovingCeiling::DMovingCeiling ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-06-13 11:58:04 +00:00
|
|
|
DMovingCeiling::DMovingCeiling (sector_t *sector, bool interpolate)
|
2016-03-01 15:47:10 +00:00
|
|
|
: DMover (sector)
|
|
|
|
{
|
|
|
|
sector->ceilingdata = this;
|
2016-06-13 11:58:04 +00:00
|
|
|
if (interpolate) interpolation = sector->SetInterpolation(sector_t::CeilingMove, true);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
2016-12-27 20:16:42 +00:00
|
|
|
bool sector_t::MoveAttached(int crush, double move, int floorOrCeiling, bool resetfailed, bool instant)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2016-12-27 20:16:42 +00:00
|
|
|
if (!P_Scroll3dMidtex(this, crush, move, !!floorOrCeiling, instant) && resetfailed)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2016-12-27 20:16:42 +00:00
|
|
|
P_Scroll3dMidtex(this, crush, -move, !!floorOrCeiling, instant);
|
2016-03-01 15:47:10 +00:00
|
|
|
return false;
|
|
|
|
}
|
2016-12-27 20:16:42 +00:00
|
|
|
if (!P_MoveLinkedSectors(this, crush, move, !!floorOrCeiling, instant) && resetfailed)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2016-12-27 20:16:42 +00:00
|
|
|
P_MoveLinkedSectors(this, crush, -move, !!floorOrCeiling, instant);
|
|
|
|
P_Scroll3dMidtex(this, crush, -move, !!floorOrCeiling, instant);
|
2016-03-01 15:47:10 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Move a plane (floor or ceiling) and check for crushing
|
|
|
|
// [RH] Crush specifies the actual amount of crushing damage inflictable.
|
|
|
|
// (Use -1 to prevent it from trying to crush)
|
|
|
|
// dest is the desired d value for the plane
|
|
|
|
//
|
2016-12-27 20:16:42 +00:00
|
|
|
EMoveResult sector_t::MoveFloor(double speed, double dest, int crush, int direction, bool hexencrush, bool instant)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
|
|
|
bool flag;
|
2016-03-30 07:41:46 +00:00
|
|
|
double lastpos;
|
|
|
|
double movedest;
|
|
|
|
double move;
|
|
|
|
//double destheight; //jff 02/04/98 used to keep floors/ceilings
|
2016-03-01 15:47:10 +00:00
|
|
|
// from moving thru each other
|
2016-04-08 12:18:46 +00:00
|
|
|
lastpos = floorplane.fD();
|
2016-04-08 11:39:08 +00:00
|
|
|
switch (direction)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2016-04-08 11:39:08 +00:00
|
|
|
case -1:
|
|
|
|
// DOWN
|
2016-04-08 12:18:46 +00:00
|
|
|
movedest = floorplane.GetChangedHeight(-speed);
|
2016-04-08 11:39:08 +00:00
|
|
|
if (movedest >= dest)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
move = floorplane.HeightDiff(lastpos, dest);
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-12-27 20:16:42 +00:00
|
|
|
if (!MoveAttached(crush, move, 0, true, instant)) return EMoveResult::crushed;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 12:18:46 +00:00
|
|
|
floorplane.setD(dest);
|
2016-12-27 20:16:42 +00:00
|
|
|
flag = P_ChangeSector(this, crush, move, 0, false, instant);
|
2016-04-08 11:39:08 +00:00
|
|
|
if (flag)
|
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
floorplane.setD(lastpos);
|
2016-12-27 20:16:42 +00:00
|
|
|
P_ChangeSector(this, crush, -move, 0, true, instant);
|
|
|
|
MoveAttached(crush, -move, 0, false, instant);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
ChangePlaneTexZ(sector_t::floor, move);
|
|
|
|
AdjustFloorClip();
|
2016-04-08 11:39:08 +00:00
|
|
|
}
|
2016-04-08 11:59:03 +00:00
|
|
|
return EMoveResult::pastdest;
|
2016-04-08 11:39:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-12-27 20:16:42 +00:00
|
|
|
if (!MoveAttached(crush, -speed, 0, true, instant)) return EMoveResult::crushed;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 12:18:46 +00:00
|
|
|
floorplane.setD(movedest);
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-12-27 20:16:42 +00:00
|
|
|
flag = P_ChangeSector(this, crush, -speed, 0, false, instant);
|
2016-04-08 11:39:08 +00:00
|
|
|
if (flag)
|
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
floorplane.setD(lastpos);
|
2016-12-27 20:16:42 +00:00
|
|
|
P_ChangeSector(this, crush, speed, 0, true, instant);
|
|
|
|
MoveAttached(crush, speed, 0, false, instant);
|
2016-04-08 11:59:03 +00:00
|
|
|
return EMoveResult::crushed;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
2016-04-08 11:39:08 +00:00
|
|
|
else
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
ChangePlaneTexZ(sector_t::floor, floorplane.HeightDiff(lastpos));
|
|
|
|
AdjustFloorClip();
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
2016-04-08 11:39:08 +00:00
|
|
|
}
|
|
|
|
break;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 11:39:08 +00:00
|
|
|
case 1:
|
|
|
|
// UP
|
|
|
|
// jff 02/04/98 keep floor from moving thru ceilings
|
|
|
|
// [RH] not so easy with arbitrary planes
|
2016-04-08 12:18:46 +00:00
|
|
|
//destheight = (dest < ceilingheight) ? dest : ceilingheight;
|
|
|
|
if (!ceilingplane.isSlope() && !floorplane.isSlope() &&
|
2016-04-15 18:42:40 +00:00
|
|
|
!PortalIsLinked(sector_t::ceiling) &&
|
2016-04-08 12:18:46 +00:00
|
|
|
(!(i_compatflags2 & COMPATF2_FLOORMOVE) && -dest > ceilingplane.fD()))
|
2016-04-08 11:39:08 +00:00
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
dest = -ceilingplane.fD();
|
2016-04-08 11:39:08 +00:00
|
|
|
}
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 12:18:46 +00:00
|
|
|
movedest = floorplane.GetChangedHeight(speed);
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 11:39:08 +00:00
|
|
|
if (movedest <= dest)
|
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
move = floorplane.HeightDiff(lastpos, dest);
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-12-27 20:16:42 +00:00
|
|
|
if (!MoveAttached(crush, move, 0, true, instant)) return EMoveResult::crushed;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 12:18:46 +00:00
|
|
|
floorplane.setD(dest);
|
2016-04-08 11:39:08 +00:00
|
|
|
|
2016-12-27 20:16:42 +00:00
|
|
|
flag = P_ChangeSector(this, crush, move, 0, false, instant);
|
2016-04-08 11:39:08 +00:00
|
|
|
if (flag)
|
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
floorplane.setD(lastpos);
|
2016-12-27 20:16:42 +00:00
|
|
|
P_ChangeSector(this, crush, -move, 0, true, instant);
|
|
|
|
MoveAttached(crush, -move, 0, false, instant);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
ChangePlaneTexZ(sector_t::floor, move);
|
|
|
|
AdjustFloorClip();
|
2016-04-08 11:39:08 +00:00
|
|
|
}
|
2016-04-08 11:59:03 +00:00
|
|
|
return EMoveResult::pastdest;
|
2016-04-08 11:39:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-12-27 20:16:42 +00:00
|
|
|
if (!MoveAttached(crush, speed, 0, true, instant)) return EMoveResult::crushed;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 12:18:46 +00:00
|
|
|
floorplane.setD(movedest);
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 11:39:08 +00:00
|
|
|
// COULD GET CRUSHED
|
2016-12-27 20:16:42 +00:00
|
|
|
flag = P_ChangeSector(this, crush, speed, 0, false, instant);
|
2016-04-08 11:39:08 +00:00
|
|
|
if (flag)
|
|
|
|
{
|
|
|
|
if (crush >= 0 && !hexencrush)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
ChangePlaneTexZ(sector_t::floor, floorplane.HeightDiff(lastpos));
|
|
|
|
AdjustFloorClip();
|
2016-04-08 11:59:03 +00:00
|
|
|
return EMoveResult::crushed;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
2016-04-08 12:18:46 +00:00
|
|
|
floorplane.setD(lastpos);
|
2016-12-27 20:16:42 +00:00
|
|
|
P_ChangeSector(this, crush, -speed, 0, true, instant);
|
|
|
|
MoveAttached(crush, -speed, 0, false, instant);
|
2016-04-08 11:59:03 +00:00
|
|
|
return EMoveResult::crushed;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
2016-04-08 12:18:46 +00:00
|
|
|
ChangePlaneTexZ(sector_t::floor, floorplane.HeightDiff(lastpos));
|
|
|
|
AdjustFloorClip();
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
break;
|
2016-04-08 11:39:08 +00:00
|
|
|
}
|
2016-04-08 11:59:03 +00:00
|
|
|
return EMoveResult::ok;
|
2016-04-08 11:39:08 +00:00
|
|
|
}
|
|
|
|
|
2017-01-07 23:50:40 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(_Sector, MoveFloor)
|
|
|
|
{
|
|
|
|
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
|
|
|
PARAM_FLOAT(speed);
|
|
|
|
PARAM_FLOAT(dest);
|
|
|
|
PARAM_INT(crush);
|
|
|
|
PARAM_INT(dir);
|
|
|
|
PARAM_BOOL(hex);
|
|
|
|
PARAM_BOOL_DEF(inst);
|
|
|
|
ACTION_RETURN_INT((int)self->MoveFloor(speed, dest, crush, dir, hex, inst));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-04-08 12:18:46 +00:00
|
|
|
EMoveResult sector_t::MoveCeiling(double speed, double dest, int crush, int direction, bool hexencrush)
|
2016-04-08 11:39:08 +00:00
|
|
|
{
|
|
|
|
bool flag;
|
|
|
|
double lastpos;
|
|
|
|
double movedest;
|
|
|
|
double move;
|
|
|
|
//double destheight; //jff 02/04/98 used to keep floors/ceilings
|
|
|
|
// from moving thru each other
|
|
|
|
|
2016-04-08 12:18:46 +00:00
|
|
|
lastpos = ceilingplane.fD();
|
2016-04-08 11:39:08 +00:00
|
|
|
switch (direction)
|
|
|
|
{
|
|
|
|
case -1:
|
|
|
|
// DOWN
|
|
|
|
// jff 02/04/98 keep ceiling from moving thru floors
|
|
|
|
// [RH] not so easy with arbitrary planes
|
2016-04-08 12:18:46 +00:00
|
|
|
//destheight = (dest > floorheight) ? dest : floorheight;
|
|
|
|
if (!ceilingplane.isSlope() && !floorplane.isSlope() &&
|
2016-04-15 18:42:40 +00:00
|
|
|
!PortalIsLinked(sector_t::floor) &&
|
2016-04-08 12:18:46 +00:00
|
|
|
(!(i_compatflags2 & COMPATF2_FLOORMOVE) && dest < -floorplane.fD()))
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
dest = -floorplane.fD();
|
2016-04-08 11:39:08 +00:00
|
|
|
}
|
2016-04-08 12:18:46 +00:00
|
|
|
movedest = ceilingplane.GetChangedHeight (-speed);
|
2016-04-08 11:39:08 +00:00
|
|
|
if (movedest <= dest)
|
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
move = ceilingplane.HeightDiff (lastpos, dest);
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 11:59:03 +00:00
|
|
|
if (!MoveAttached(crush, move, 1, true)) return EMoveResult::crushed;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 12:18:46 +00:00
|
|
|
ceilingplane.setD(dest);
|
|
|
|
flag = P_ChangeSector (this, crush, move, 1, false);
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 11:39:08 +00:00
|
|
|
if (flag)
|
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
ceilingplane.setD(lastpos);
|
|
|
|
P_ChangeSector (this, crush, -move, 1, true);
|
2016-04-08 11:39:08 +00:00
|
|
|
MoveAttached(crush, -move, 1, false);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
ChangePlaneTexZ(sector_t::ceiling, move);
|
2016-04-08 11:39:08 +00:00
|
|
|
}
|
2016-04-08 11:59:03 +00:00
|
|
|
return EMoveResult::pastdest;
|
2016-04-08 11:39:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-04-08 11:59:03 +00:00
|
|
|
if (!MoveAttached(crush, -speed, 1, true)) return EMoveResult::crushed;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 12:18:46 +00:00
|
|
|
ceilingplane.setD(movedest);
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 11:39:08 +00:00
|
|
|
// COULD GET CRUSHED
|
2016-04-08 12:18:46 +00:00
|
|
|
flag = P_ChangeSector (this, crush, -speed, 1, false);
|
2016-04-08 11:39:08 +00:00
|
|
|
if (flag)
|
|
|
|
{
|
|
|
|
if (crush >= 0 && !hexencrush)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
ChangePlaneTexZ(sector_t::ceiling, ceilingplane.HeightDiff (lastpos));
|
2016-04-08 11:59:03 +00:00
|
|
|
return EMoveResult::crushed;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
2016-04-08 12:18:46 +00:00
|
|
|
ceilingplane.setD(lastpos);
|
|
|
|
P_ChangeSector (this, crush, speed, 1, true);
|
2016-04-08 11:39:08 +00:00
|
|
|
MoveAttached(crush, speed, 1, false);
|
2016-04-08 11:59:03 +00:00
|
|
|
return EMoveResult::crushed;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
2016-04-08 12:18:46 +00:00
|
|
|
ChangePlaneTexZ(sector_t::ceiling, ceilingplane.HeightDiff (lastpos));
|
2016-04-08 11:39:08 +00:00
|
|
|
}
|
|
|
|
break;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 11:39:08 +00:00
|
|
|
case 1:
|
|
|
|
// UP
|
2016-04-08 12:18:46 +00:00
|
|
|
movedest = ceilingplane.GetChangedHeight (speed);
|
2016-04-08 11:39:08 +00:00
|
|
|
if (movedest >= dest)
|
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
move = ceilingplane.HeightDiff (lastpos, dest);
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 11:59:03 +00:00
|
|
|
if (!MoveAttached(crush, move, 1, true)) return EMoveResult::crushed;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 12:18:46 +00:00
|
|
|
ceilingplane.setD(dest);
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 12:18:46 +00:00
|
|
|
flag = P_ChangeSector (this, crush, move, 1, false);
|
2016-04-08 11:39:08 +00:00
|
|
|
if (flag)
|
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
ceilingplane.setD(lastpos);
|
|
|
|
P_ChangeSector (this, crush, move, 1, true);
|
2016-04-08 11:39:08 +00:00
|
|
|
MoveAttached(crush, move, 1, false);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
ChangePlaneTexZ(sector_t::ceiling, move);
|
2016-04-08 11:39:08 +00:00
|
|
|
}
|
2016-04-08 11:59:03 +00:00
|
|
|
return EMoveResult::pastdest;
|
2016-04-08 11:39:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-04-08 11:59:03 +00:00
|
|
|
if (!MoveAttached(crush, speed, 1, true)) return EMoveResult::crushed;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 12:18:46 +00:00
|
|
|
ceilingplane.setD(movedest);
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-04-08 12:18:46 +00:00
|
|
|
flag = P_ChangeSector (this, crush, speed, 1, false);
|
2016-04-08 11:39:08 +00:00
|
|
|
if (flag)
|
|
|
|
{
|
2016-04-08 12:18:46 +00:00
|
|
|
ceilingplane.setD(lastpos);
|
|
|
|
P_ChangeSector (this, crush, -speed, 1, true);
|
2016-04-08 11:39:08 +00:00
|
|
|
MoveAttached(crush, -speed, 1, false);
|
2016-04-08 11:59:03 +00:00
|
|
|
return EMoveResult::crushed;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
2016-04-08 12:18:46 +00:00
|
|
|
ChangePlaneTexZ(sector_t::ceiling, ceilingplane.HeightDiff (lastpos));
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2016-04-08 11:59:03 +00:00
|
|
|
return EMoveResult::ok;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
2017-01-07 23:50:40 +00:00
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION(_Sector, MoveCeiling)
|
|
|
|
{
|
|
|
|
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
|
|
|
PARAM_FLOAT(speed);
|
|
|
|
PARAM_FLOAT(dest);
|
|
|
|
PARAM_INT(crush);
|
|
|
|
PARAM_INT(dir);
|
|
|
|
PARAM_BOOL(hex);
|
|
|
|
ACTION_RETURN_INT((int)self->MoveCeiling(speed, dest, crush, dir, hex));
|
|
|
|
}
|