mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- added alignceilslope and alignflorslope variants receiving a position vector.
This commit is contained in:
parent
98b06697f7
commit
80e10d89f4
4 changed files with 26 additions and 38 deletions
|
@ -550,4 +550,14 @@ inline void alignflorslope(sectortype* sect, int x, int y, int z)
|
|||
sect->setfloorslope(getslopeval(sect, x, y, z, sect->int_floorz()));
|
||||
}
|
||||
|
||||
inline void alignceilslope(sectortype* sect, const DVector3& pos)
|
||||
{
|
||||
sect->setceilingslope(getslopeval(sect, pos.X * worldtoint, pos.Y * worldtoint, pos.Z * zworldtoint, sect->int_ceilingz()));
|
||||
}
|
||||
|
||||
inline void alignflorslope(sectortype* sect, const DVector3& pos)
|
||||
{
|
||||
sect->setfloorslope(getslopeval(sect, pos.X * worldtoint, pos.Y * worldtoint, pos.Z * zworldtoint, sect->int_floorz()));
|
||||
}
|
||||
|
||||
#include "updatesector.h"
|
||||
|
|
|
@ -1945,8 +1945,8 @@ void SpikeAlign(DSWActor*); // spike.c
|
|||
|
||||
short DoSectorObjectSetScale(short match); // morph.c
|
||||
short DoSOevent(short match,short state); // morph.c
|
||||
void SOBJ_AlignCeilingToPoint(SECTOR_OBJECT* sop,int x,int y,int z); // morph.c
|
||||
void SOBJ_AlignFloorToPoint(SECTOR_OBJECT* sop,int x,int y,int z); // morph.c
|
||||
void SOBJ_AlignCeilingToPoint(SECTOR_OBJECT* sop, const DVector3& pos); // morph.c
|
||||
void SOBJ_AlignFloorToPoint(SECTOR_OBJECT* sop, const DVector3& pos); // morph.c
|
||||
void ScaleSectorObject(SECTOR_OBJECT* sop); // morph.c
|
||||
void MorphTornado(SECTOR_OBJECT* sop); // morph.c
|
||||
void MorphFloor(SECTOR_OBJECT* sop); // morph.c
|
||||
|
|
|
@ -452,7 +452,7 @@ void MorphFloor(SECTOR_OBJECT* sop)
|
|||
}
|
||||
}
|
||||
|
||||
void SOBJ_AlignFloorToPoint(SECTOR_OBJECT* sop, int x, int y, int z)
|
||||
void SOBJ_AlignFloorToPoint(SECTOR_OBJECT* sop, const DVector3& pos)
|
||||
{
|
||||
sectortype* *sectp;
|
||||
int j;
|
||||
|
@ -462,12 +462,12 @@ void SOBJ_AlignFloorToPoint(SECTOR_OBJECT* sop, int x, int y, int z)
|
|||
if ((*sectp)->hasU() &&
|
||||
((*sectp)->flags & SECTFU_SO_SLOPE_CEILING_TO_POINT))
|
||||
{
|
||||
alignflorslope(*sectp, x, y, z);
|
||||
alignflorslope(*sectp, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SOBJ_AlignCeilingToPoint(SECTOR_OBJECT* sop, int x, int y, int z)
|
||||
void SOBJ_AlignCeilingToPoint(SECTOR_OBJECT* sop, const DVector3& pos)
|
||||
{
|
||||
sectortype* *sectp;
|
||||
int j;
|
||||
|
@ -477,23 +477,7 @@ void SOBJ_AlignCeilingToPoint(SECTOR_OBJECT* sop, int x, int y, int z)
|
|||
if ((*sectp)->hasU() &&
|
||||
((*sectp)->flags & SECTFU_SO_SLOPE_CEILING_TO_POINT))
|
||||
{
|
||||
alignceilslope(*sectp, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SOBJ_AlignFloorCeilingToPoint(SECTOR_OBJECT* sop, int x, int y, int z)
|
||||
{
|
||||
sectortype* *sectp;
|
||||
int j;
|
||||
|
||||
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
|
||||
{
|
||||
if ((*sectp)->hasU() &&
|
||||
((*sectp)->flags & SECTFU_SO_SLOPE_CEILING_TO_POINT))
|
||||
{
|
||||
alignflorslope(*sectp, x, y, z);
|
||||
alignceilslope(*sectp, x, y, z);
|
||||
alignceilslope(*sectp, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -501,10 +485,6 @@ void SOBJ_AlignFloorCeilingToPoint(SECTOR_OBJECT* sop, int x, int y, int z)
|
|||
// moves center point around and aligns slope
|
||||
void SpikeFloor(SECTOR_OBJECT* sop)
|
||||
{
|
||||
int mx, my;
|
||||
int florz;
|
||||
int x,y;
|
||||
|
||||
// z direction
|
||||
ASSERT(sop->op_main_sector != nullptr);
|
||||
sop->morph_z -= Z(sop->morph_z_speed);
|
||||
|
@ -513,16 +493,13 @@ void SpikeFloor(SECTOR_OBJECT* sop)
|
|||
if (sop->morph_wall_point == nullptr)
|
||||
return;
|
||||
|
||||
// place at correct x,y offset from center
|
||||
x = sop->int_pmid().X - sop->morph_xoff;
|
||||
y = sop->int_pmid().Y - sop->morph_yoff;
|
||||
DVector3 pos;
|
||||
|
||||
// move it from last x,y
|
||||
mx = x;
|
||||
my = y;
|
||||
// place at correct x,y offset from center
|
||||
pos.X = sop->pmid.X - sop->morph_xoff * inttoworld;
|
||||
pos.Y = sop->pmid.Y - sop->morph_yoff * inttoworld;
|
||||
|
||||
// bound the Z
|
||||
florz = sop->op_main_sector->int_floorz();
|
||||
|
||||
#define MORPH_FLOOR_ZRANGE Z(300)
|
||||
|
||||
|
@ -536,8 +513,9 @@ void SpikeFloor(SECTOR_OBJECT* sop)
|
|||
sop->morph_z = -MORPH_FLOOR_ZRANGE;
|
||||
sop->morph_z_speed *= -1;
|
||||
}
|
||||
pos.Z = sop->op_main_sector->floorz + sop->morph_z * inttoworld;
|
||||
|
||||
SOBJ_AlignFloorToPoint(sop, mx, my, florz + sop->morph_z);
|
||||
SOBJ_AlignFloorToPoint(sop, pos);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -232,16 +232,16 @@ void SpikeAlign(DSWActor* actor)
|
|||
if ((int8_t)SP_TAG7(actor) < 0)
|
||||
{
|
||||
if (actor->spr.cstat & (CSTAT_SPRITE_YFLIP))
|
||||
alignceilslope(actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->user.int_zclip());
|
||||
alignceilslope(actor->sector(), DVector3(actor->spr.pos.XY(), actor->user.zclip));
|
||||
else
|
||||
alignflorslope(actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->user.int_zclip());
|
||||
alignflorslope(actor->sector(), DVector3(actor->spr.pos.XY(), actor->user.zclip));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (actor->spr.cstat & (CSTAT_SPRITE_YFLIP))
|
||||
SOBJ_AlignCeilingToPoint(&SectorObject[SP_TAG7(actor)], actor->int_pos().X, actor->int_pos().Y, actor->user.int_zclip());
|
||||
SOBJ_AlignCeilingToPoint(&SectorObject[SP_TAG7(actor)], DVector3(actor->spr.pos.XY(), actor->user.zclip));
|
||||
else
|
||||
SOBJ_AlignFloorToPoint(&SectorObject[SP_TAG7(actor)], actor->int_pos().X, actor->int_pos().Y, actor->user.int_zclip());
|
||||
SOBJ_AlignFloorToPoint(&SectorObject[SP_TAG7(actor)], DVector3(actor->spr.pos.XY(), actor->user.zclip));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue