mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
- floatified SECTOR_OBJECT::pmid
This commit is contained in:
parent
9393170408
commit
b9dbcebe2e
6 changed files with 30 additions and 32 deletions
|
@ -1406,7 +1406,7 @@ struct SECTOR_OBJECT
|
|||
{
|
||||
vec3_t int_pmid() const
|
||||
{
|
||||
return __int_pmid;
|
||||
return { int(pmid.X * worldtoint), int(pmid.Y * worldtoint),int(pmid.Z * zworldtoint) };
|
||||
}
|
||||
|
||||
soANIMATORp PreMoveAnimator;
|
||||
|
@ -1416,7 +1416,7 @@ struct SECTOR_OBJECT
|
|||
|
||||
TObjPtr<DSWActor*> sp_child; // child sprite that holds info for the sector object
|
||||
|
||||
vec3_t __int_pmid; // midpoints of the sector object
|
||||
DVector3 pmid; // midpoints of the sector object
|
||||
|
||||
TObjPtr<DSWActor*> so_actors[MAX_SO_SPRITE]; // hold the actors of the object
|
||||
TObjPtr<DSWActor*> match_event_actor; // spritenum of the match event sprite
|
||||
|
@ -1567,10 +1567,11 @@ enum
|
|||
SO_TURRET = 97,
|
||||
SO_VEHICLE = 98,
|
||||
// #define SO_SPEED_BOAT 99
|
||||
MAXSO = INT32_MAX / 2
|
||||
};
|
||||
|
||||
inline bool SO_EMPTY(SECTOR_OBJECT* sop) { return (sop->__int_pmid.X == MAXSO); }
|
||||
constexpr double MAXSO = INT32_MAX / 32; // make sure this does not overflow when converted to a Build int coordinate.
|
||||
|
||||
inline bool SO_EMPTY(SECTOR_OBJECT* sop) { return (sop->pmid.X == MAXSO); }
|
||||
|
||||
extern SECTOR_OBJECT SectorObject[MAX_SECTOR_OBJECTS];
|
||||
|
||||
|
@ -2141,7 +2142,7 @@ struct ANIM
|
|||
case ANIM_Floorz:
|
||||
return sector[animindex].int_floorz();
|
||||
case ANIM_SopZ:
|
||||
return SectorObject[animindex].__int_pmid.Z;
|
||||
return SectorObject[animindex].int_pmid().Z;
|
||||
case ANIM_Spritez:
|
||||
if (animactor == nullptr) return 0;
|
||||
return animactor->spr.int_pos().Z;
|
||||
|
@ -2163,7 +2164,7 @@ struct ANIM
|
|||
sector[animindex].set_int_floorz(value);
|
||||
break;
|
||||
case ANIM_SopZ:
|
||||
SectorObject[animindex].__int_pmid.Z = value;
|
||||
SectorObject[animindex].pmid.Z = value * zinttoworld;
|
||||
break;
|
||||
case ANIM_Spritez:
|
||||
if (animactor == nullptr) return;
|
||||
|
|
|
@ -103,11 +103,11 @@ static double getvalue(so_interp::interp_data& element)
|
|||
case soi_floor:
|
||||
return sector[index].floorz;
|
||||
case soi_sox:
|
||||
return SectorObject[index].__int_pmid.X;
|
||||
return SectorObject[index].pmid.X;
|
||||
case soi_soy:
|
||||
return SectorObject[index].__int_pmid.Y;
|
||||
return SectorObject[index].pmid.Y;
|
||||
case soi_soz:
|
||||
return SectorObject[index].__int_pmid.Z;
|
||||
return SectorObject[index].pmid.Z;
|
||||
case soi_sprx:
|
||||
if (element.actorofang)
|
||||
return element.actorofang->spr.pos.X;
|
||||
|
@ -147,13 +147,13 @@ static void setvalue(so_interp::interp_data& element, double value)
|
|||
sector[index].setfloorz(value);
|
||||
break;
|
||||
case soi_sox:
|
||||
SectorObject[index].__int_pmid.X = (int)value;
|
||||
SectorObject[index].pmid.X = value;
|
||||
break;
|
||||
case soi_soy:
|
||||
SectorObject[index].__int_pmid.Y = (int)value;
|
||||
SectorObject[index].pmid.Y = value;
|
||||
break;
|
||||
case soi_soz:
|
||||
SectorObject[index].__int_pmid.Z = (int)value;
|
||||
SectorObject[index].pmid.Z = value;
|
||||
break;
|
||||
case soi_sprx:
|
||||
if (element.actorofang)
|
||||
|
|
|
@ -637,9 +637,9 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, SECTOR_OBJECT& w,
|
|||
.Array("yorig", w.yorig, def->yorig, w.num_walls)
|
||||
("controller", w.controller, def->controller)
|
||||
("child", w.sp_child, def->sp_child)
|
||||
("xmid", w.__int_pmid.X, def->__int_pmid.X)
|
||||
("ymid", w.__int_pmid.Y, def->__int_pmid.Y)
|
||||
("zmid", w.__int_pmid.Z, def->__int_pmid.Z)
|
||||
("xmid", w.pmid.X, def->pmid.X)
|
||||
("ymid", w.pmid.Y, def->pmid.Y)
|
||||
("zmid", w.pmid.Z, def->pmid.Z)
|
||||
("vel", w.vel, def->vel)
|
||||
("vel_tgt", w.vel_tgt, def->vel_tgt)
|
||||
("player_xoff", w.player_xoff, def->player_xoff)
|
||||
|
|
|
@ -379,7 +379,7 @@ void SectorSetup(void)
|
|||
SectorObject[ndx].mid_sector = nullptr;
|
||||
SectorObject[ndx].op_main_sector = nullptr;
|
||||
SectorObject[ndx].morph_wall_point = nullptr;
|
||||
SectorObject[ndx].__int_pmid.X = MAXSO;
|
||||
SectorObject[ndx].pmid.X = MAXSO;
|
||||
}
|
||||
|
||||
memset(SineWaveFloor, 0, sizeof(SineWaveFloor));
|
||||
|
|
|
@ -707,9 +707,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECT* sop)
|
|||
BoundActor = FindBoundSprite(SECT_SO_CENTER);
|
||||
if (BoundActor)
|
||||
{
|
||||
sop->__int_pmid.X = BoundActor->int_pos().X;
|
||||
sop->__int_pmid.Y = BoundActor->int_pos().Y;
|
||||
sop->__int_pmid.Z = BoundActor->int_pos().Z;
|
||||
sop->pmid = BoundActor->spr.pos;
|
||||
KillActor(BoundActor);
|
||||
}
|
||||
|
||||
|
@ -934,7 +932,7 @@ cont:
|
|||
|
||||
ASSERT(zmid != -9999999);
|
||||
|
||||
sop->__int_pmid.Z = zmid;
|
||||
sop->pmid.Z = zmid * inttoworld;
|
||||
|
||||
for (i = 0; sop->so_actors[i] != nullptr; i++)
|
||||
{
|
||||
|
@ -1028,7 +1026,7 @@ void SetupSectorObject(sectortype* sectp, short tag)
|
|||
case TAG_OBJECT_CENTER - 500:
|
||||
|
||||
sop->mid_sector = sectp;
|
||||
SectorMidPoint(sectp, &sop->__int_pmid.X, &sop->__int_pmid.Y, &sop->__int_pmid.Z);
|
||||
sop->pmid = SectorMidPoint(sectp);
|
||||
|
||||
sop->dir = 1;
|
||||
sop->track = sectp->hitag;
|
||||
|
@ -1582,25 +1580,24 @@ void MovePoints(SECTOR_OBJECT* sop, short delta_ang, int nx, int ny)
|
|||
int i, rot_ang;
|
||||
bool PlayerMove = true;
|
||||
|
||||
if (sop->int_pmid().X >= MAXSO)
|
||||
if (SO_EMPTY(sop))
|
||||
PlayerMove = false;
|
||||
|
||||
// move along little midpoint
|
||||
sop->__int_pmid.X += nx;
|
||||
sop->__int_pmid.Y += ny;
|
||||
sop->pmid.X += nx * inttoworld;
|
||||
sop->pmid.Y += ny * inttoworld;
|
||||
|
||||
if (sop->int_pmid().X >= MAXSO)
|
||||
if (SO_EMPTY(sop))
|
||||
PlayerMove = false;
|
||||
|
||||
// move child sprite along also
|
||||
sop->sp_child->set_int_xy(sop->int_pmid().X, sop->int_pmid().Y);
|
||||
|
||||
sop->sp_child->spr.pos.XY() = sop->pmid.XY();
|
||||
|
||||
// setting floor z if need be
|
||||
if ((sop->flags & SOBJ_ZMID_FLOOR))
|
||||
sop->__int_pmid.Z = sop->mid_sector->int_floorz();
|
||||
sop->pmid.Z = sop->mid_sector->floorz;
|
||||
|
||||
DVector2 pivot = { sop->int_pmid().X * inttoworld, sop->int_pmid().Y * inttoworld};
|
||||
DVector2 pivot = sop->pmid.XY();
|
||||
DVector2 move = { nx * inttoworld, ny * inttoworld };
|
||||
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
|
||||
{
|
||||
|
@ -1756,7 +1753,7 @@ PlayerPart:
|
|||
|
||||
// Does not necessarily move with the sector so must accout for
|
||||
// moving across sectors
|
||||
if (sop->int_pmid().X < MAXSO) // special case for operating SO's
|
||||
if (!SO_EMPTY(sop)) // special case for operating SO's
|
||||
SetActorZ(sop->so_actors[i], actor->int_pos());
|
||||
}
|
||||
|
||||
|
@ -1778,7 +1775,7 @@ PlayerPart:
|
|||
// update here AFTER sectors/player has been manipulated
|
||||
// prevents you from falling into map HOLEs created by moving
|
||||
// Sectors and sprites around.
|
||||
//if (sop->xmid < MAXSO)
|
||||
//if (!SO_EMPTY(sop))
|
||||
updatesector(pp->pos.X, pp->pos.Y, &pp->cursector);
|
||||
|
||||
// in case you are in a whirlpool
|
||||
|
|
|
@ -15957,7 +15957,7 @@ int InitTurretMgun(SECTOR_OBJECT* sop)
|
|||
short delta;
|
||||
int xvect,yvect,zvect;
|
||||
|
||||
PlaySound(DIGI_BOATFIRE, &sop->__int_pmid, v3df_dontpan|v3df_doppler);
|
||||
PlaySound(DIGI_BOATFIRE, sop->pmid, v3df_dontpan|v3df_doppler);
|
||||
|
||||
for (i = 0; sop->so_actors[i] != nullptr; i++)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue