mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
- floatified warp.cpp
This commit is contained in:
parent
620613b088
commit
f47540dd3f
2 changed files with 18 additions and 39 deletions
|
@ -19,22 +19,8 @@ void MapColors(short num,COLOR_MAP cm,short create);
|
||||||
int32_t CONFIG_ReadSetup(void);
|
int32_t CONFIG_ReadSetup(void);
|
||||||
|
|
||||||
bool WarpSectorInfo(sectortype* sect, DSWActor** sp_warp);
|
bool WarpSectorInfo(sectortype* sect, DSWActor** sp_warp);
|
||||||
DSWActor* Warp(int32_t* x, int32_t* y, int32_t* z, sectortype** sect);
|
DSWActor* Warp(DVector3& pos, sectortype** sect);
|
||||||
inline DSWActor* Warp(DVector3& pos, sectortype** sect)
|
DSWActor* WarpPlane(DVector3& pos, sectortype** sect);
|
||||||
{
|
|
||||||
vec3_t vv = { int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint) };
|
|
||||||
auto act = Warp(&vv.X, &vv.Y, &vv.Z, sect);
|
|
||||||
pos = { vv.X * inttoworld, vv.Y * inttoworld, vv.Z * zinttoworld };
|
|
||||||
return act;
|
|
||||||
}
|
|
||||||
DSWActor* WarpPlane(int32_t* x, int32_t* y, int32_t* z, sectortype** sect);
|
|
||||||
inline DSWActor* WarpPlane(DVector3& pos, sectortype** sect)
|
|
||||||
{
|
|
||||||
vec3_t vv = { int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint) };
|
|
||||||
auto act = WarpPlane(&vv.X, &vv.Y, &vv.Z, sect);
|
|
||||||
pos = { vv.X * inttoworld, vv.Y * inttoworld, vv.Z * zinttoworld };
|
|
||||||
return act;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ BEGIN_SW_NS
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
extern bool Prediction;
|
extern bool Prediction;
|
||||||
DSWActor* WarpToArea(DSWActor* sp_from, int32_t* x, int32_t* y, int32_t* z, sectortype** sect);
|
DSWActor* WarpToArea(DSWActor* sp_from, DVector3& pos, sectortype** sect);
|
||||||
|
|
||||||
bool WarpPlaneSectorInfo(sectortype* sect, DSWActor** sp_ceiling, DSWActor** sp_floor)
|
bool WarpPlaneSectorInfo(sectortype* sect, DSWActor** sp_ceiling, DSWActor** sp_floor)
|
||||||
{
|
{
|
||||||
|
@ -81,7 +81,7 @@ bool WarpPlaneSectorInfo(sectortype* sect, DSWActor** sp_ceiling, DSWActor** sp_
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
DSWActor* WarpPlane(int32_t* x, int32_t* y, int32_t* z, sectortype** sect)
|
DSWActor* WarpPlane(DVector3& pos, sectortype** sect)
|
||||||
{
|
{
|
||||||
DSWActor* sp_floor,* sp_ceiling;
|
DSWActor* sp_floor,* sp_ceiling;
|
||||||
|
|
||||||
|
@ -93,17 +93,17 @@ DSWActor* WarpPlane(int32_t* x, int32_t* y, int32_t* z, sectortype** sect)
|
||||||
|
|
||||||
if (sp_ceiling)
|
if (sp_ceiling)
|
||||||
{
|
{
|
||||||
if (*z <= sp_ceiling->int_pos().Z)
|
if (pos.Z <= sp_ceiling->spr.pos.Z)
|
||||||
{
|
{
|
||||||
return WarpToArea(sp_ceiling, x, y, z, sect);
|
return WarpToArea(sp_ceiling, pos, sect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sp_floor)
|
if (sp_floor)
|
||||||
{
|
{
|
||||||
if (*z >= sp_floor->int_pos().Z)
|
if (pos.Z >= sp_floor->spr.pos.Z)
|
||||||
{
|
{
|
||||||
return WarpToArea(sp_floor, x, y, z, sect);
|
return WarpToArea(sp_floor, pos, sect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,19 +116,14 @@ DSWActor* WarpPlane(int32_t* x, int32_t* y, int32_t* z, sectortype** sect)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
DSWActor* WarpToArea(DSWActor* sp_from, int32_t* x, int32_t* y, int32_t* z, sectortype** sect)
|
DSWActor* WarpToArea(DSWActor* sp_from, DVector3& pos, sectortype** sect)
|
||||||
{
|
{
|
||||||
int xoff;
|
|
||||||
int yoff;
|
|
||||||
int zoff;
|
|
||||||
short match;
|
short match;
|
||||||
short to_tag = 0;
|
short to_tag = 0;
|
||||||
short match_rand[16];
|
short match_rand[16];
|
||||||
int z_adj = 0;
|
double z_adj = 0;
|
||||||
|
|
||||||
xoff = *x - sp_from->int_pos().X;
|
auto off = pos - sp_from->spr.pos;
|
||||||
yoff = *y - sp_from->int_pos().Y;
|
|
||||||
zoff = *z - sp_from->int_pos().Z;
|
|
||||||
match = sp_from->spr.lotag;
|
match = sp_from->spr.lotag;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -167,12 +162,12 @@ DSWActor* WarpToArea(DSWActor* sp_from, int32_t* x, int32_t* y, int32_t* z, sect
|
||||||
case WARP_CEILING_PLANE:
|
case WARP_CEILING_PLANE:
|
||||||
to_tag = WARP_FLOOR_PLANE;
|
to_tag = WARP_FLOOR_PLANE;
|
||||||
// make sure you warp outside of warp plane
|
// make sure you warp outside of warp plane
|
||||||
z_adj = -Z(2);
|
z_adj = -2;
|
||||||
break;
|
break;
|
||||||
case WARP_FLOOR_PLANE:
|
case WARP_FLOOR_PLANE:
|
||||||
to_tag = WARP_CEILING_PLANE;
|
to_tag = WARP_CEILING_PLANE;
|
||||||
// make sure you warp outside of warp plane
|
// make sure you warp outside of warp plane
|
||||||
z_adj = Z(2);
|
z_adj = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,16 +183,14 @@ DSWActor* WarpToArea(DSWActor* sp_from, int32_t* x, int32_t* y, int32_t* z, sect
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// determine new x,y,z position
|
// determine new x,y,z position
|
||||||
*x = actor->int_pos().X + xoff;
|
pos = actor->spr.pos + off;
|
||||||
*y = actor->int_pos().Y + yoff;
|
|
||||||
*z = actor->int_pos().Z + zoff;
|
|
||||||
|
|
||||||
// make sure you warp outside of warp plane
|
// make sure you warp outside of warp plane
|
||||||
*z += z_adj;
|
pos.Z += z_adj;
|
||||||
|
|
||||||
// get new sector
|
// get new sector
|
||||||
*sect = actor->sector();
|
*sect = actor->sector();
|
||||||
updatesector(*x, *y, sect);
|
updatesector(pos, sect);
|
||||||
|
|
||||||
return actor;
|
return actor;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +238,7 @@ bool WarpSectorInfo(sectortype* sect, DSWActor** sp_warp)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
DSWActor* Warp(int32_t* x, int32_t* y, int32_t* z, sectortype** sect)
|
DSWActor* Warp(DVector3& pos, sectortype** sect)
|
||||||
{
|
{
|
||||||
DSWActor* sp_warp;
|
DSWActor* sp_warp;
|
||||||
|
|
||||||
|
@ -257,7 +250,7 @@ DSWActor* Warp(int32_t* x, int32_t* y, int32_t* z, sectortype** sect)
|
||||||
|
|
||||||
if (sp_warp)
|
if (sp_warp)
|
||||||
{
|
{
|
||||||
return WarpToArea(sp_warp, x, y, z, sect);
|
return WarpToArea(sp_warp, pos, sect);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
Loading…
Reference in a new issue